Home | History | Annotate | Line # | Download | only in dc
      1 /*	$NetBSD: dc_bios_types.h,v 1.2 2021/12/18 23:45:00 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2016 Advanced Micro Devices, Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors: AMD
     25  *
     26  */
     27 
     28 #ifndef DC_BIOS_TYPES_H
     29 #define DC_BIOS_TYPES_H
     30 
     31 /******************************************************************************
     32  * Interface file for VBIOS implementations.
     33  *
     34  * The default implementation is inside DC.
     35  * Display Manager (which instantiates DC) has the option to supply it's own
     36  * (external to DC) implementation of VBIOS, which will be called by DC, using
     37  * this interface.
     38  * (The intended use is Diagnostics, but other uses may appear.)
     39  *****************************************************************************/
     40 
     41 #include "include/bios_parser_types.h"
     42 
     43 struct dc_vbios_funcs {
     44 	uint8_t (*get_connectors_number)(struct dc_bios *bios);
     45 
     46 	struct graphics_object_id (*get_connector_id)(
     47 		struct dc_bios *bios,
     48 		uint8_t connector_index);
     49 	enum bp_result (*get_src_obj)(
     50 		struct dc_bios *bios,
     51 		struct graphics_object_id object_id, uint32_t index,
     52 		struct graphics_object_id *src_object_id);
     53 	enum bp_result (*get_i2c_info)(
     54 		struct dc_bios *dcb,
     55 		struct graphics_object_id id,
     56 		struct graphics_object_i2c_info *info);
     57 	enum bp_result (*get_hpd_info)(
     58 		struct dc_bios *bios,
     59 		struct graphics_object_id id,
     60 		struct graphics_object_hpd_info *info);
     61 	enum bp_result (*get_device_tag)(
     62 		struct dc_bios *bios,
     63 		struct graphics_object_id connector_object_id,
     64 		uint32_t device_tag_index,
     65 		struct connector_device_tag_info *info);
     66 	enum bp_result (*get_spread_spectrum_info)(
     67 		struct dc_bios *bios,
     68 		enum as_signal_type signal,
     69 		uint32_t index,
     70 		struct spread_spectrum_info *ss_info);
     71 	uint32_t (*get_ss_entry_number)(
     72 		struct dc_bios *bios,
     73 		enum as_signal_type signal);
     74 	enum bp_result (*get_embedded_panel_info)(
     75 		struct dc_bios *bios,
     76 		struct embedded_panel_info *info);
     77 	enum bp_result (*get_gpio_pin_info)(
     78 		struct dc_bios *bios,
     79 		uint32_t gpio_id,
     80 		struct gpio_pin_info *info);
     81 	enum bp_result (*get_encoder_cap_info)(
     82 		struct dc_bios *bios,
     83 		struct graphics_object_id object_id,
     84 		struct bp_encoder_cap_info *info);
     85 
     86 	bool (*is_accelerated_mode)(
     87 		struct dc_bios *bios);
     88 	void (*set_scratch_critical_state)(
     89 		struct dc_bios *bios,
     90 		bool state);
     91 	bool (*is_device_id_supported)(
     92 		struct dc_bios *bios,
     93 		struct device_id id);
     94 
     95 	/* COMMANDS */
     96 
     97 	enum bp_result (*encoder_control)(
     98 		struct dc_bios *bios,
     99 		struct bp_encoder_control *cntl);
    100 	enum bp_result (*transmitter_control)(
    101 		struct dc_bios *bios,
    102 		struct bp_transmitter_control *cntl);
    103 	enum bp_result (*enable_crtc)(
    104 		struct dc_bios *bios,
    105 		enum controller_id id,
    106 		bool enable);
    107 	enum bp_result (*adjust_pixel_clock)(
    108 		struct dc_bios *bios,
    109 		struct bp_adjust_pixel_clock_parameters *bp_params);
    110 	enum bp_result (*set_pixel_clock)(
    111 		struct dc_bios *bios,
    112 		struct bp_pixel_clock_parameters *bp_params);
    113 	enum bp_result (*set_dce_clock)(
    114 		struct dc_bios *bios,
    115 		struct bp_set_dce_clock_parameters *bp_params);
    116 	enum bp_result (*enable_spread_spectrum_on_ppll)(
    117 		struct dc_bios *bios,
    118 		struct bp_spread_spectrum_parameters *bp_params,
    119 		bool enable);
    120 	enum bp_result (*program_crtc_timing)(
    121 		struct dc_bios *bios,
    122 		struct bp_hw_crtc_timing_parameters *bp_params);
    123 	enum bp_result (*program_display_engine_pll)(
    124 		struct dc_bios *bios,
    125 		struct bp_pixel_clock_parameters *bp_params);
    126 	enum bp_result (*enable_disp_power_gating)(
    127 		struct dc_bios *bios,
    128 		enum controller_id controller_id,
    129 		enum bp_pipe_control_action action);
    130 
    131 	void (*bios_parser_destroy)(struct dc_bios **dcb);
    132 
    133 	enum bp_result (*get_board_layout_info)(
    134 		struct dc_bios *dcb,
    135 		struct board_layout_info *board_layout_info);
    136 };
    137 
    138 struct bios_registers {
    139 	uint32_t BIOS_SCRATCH_3;
    140 	uint32_t BIOS_SCRATCH_6;
    141 };
    142 
    143 struct dc_bios {
    144 	const struct dc_vbios_funcs *funcs;
    145 
    146 	uint8_t *bios;
    147 	uint32_t bios_size;
    148 
    149 	uint8_t *bios_local_image;
    150 
    151 	struct dc_context *ctx;
    152 	const struct bios_registers *regs;
    153 	struct integrated_info *integrated_info;
    154 	struct dc_firmware_info fw_info;
    155 	bool fw_info_valid;
    156 };
    157 
    158 #endif /* DC_BIOS_TYPES_H */
    159