1*b843c749SSergey Zigachev /* 2*b843c749SSergey Zigachev * Copyright 2016 Advanced Micro Devices, Inc. 3*b843c749SSergey Zigachev * 4*b843c749SSergey Zigachev * Permission is hereby granted, free of charge, to any person obtaining a 5*b843c749SSergey Zigachev * copy of this software and associated documentation files (the "Software"), 6*b843c749SSergey Zigachev * to deal in the Software without restriction, including without limitation 7*b843c749SSergey Zigachev * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*b843c749SSergey Zigachev * and/or sell copies of the Software, and to permit persons to whom the 9*b843c749SSergey Zigachev * Software is furnished to do so, subject to the following conditions: 10*b843c749SSergey Zigachev * 11*b843c749SSergey Zigachev * The above copyright notice and this permission notice shall be included in 12*b843c749SSergey Zigachev * all copies or substantial portions of the Software. 13*b843c749SSergey Zigachev * 14*b843c749SSergey Zigachev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*b843c749SSergey Zigachev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*b843c749SSergey Zigachev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17*b843c749SSergey Zigachev * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18*b843c749SSergey Zigachev * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19*b843c749SSergey Zigachev * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20*b843c749SSergey Zigachev * OTHER DEALINGS IN THE SOFTWARE. 21*b843c749SSergey Zigachev * 22*b843c749SSergey Zigachev * Authors: AMD 23*b843c749SSergey Zigachev * 24*b843c749SSergey Zigachev */ 25*b843c749SSergey Zigachev 26*b843c749SSergey Zigachev #ifndef DC_BIOS_TYPES_H 27*b843c749SSergey Zigachev #define DC_BIOS_TYPES_H 28*b843c749SSergey Zigachev 29*b843c749SSergey Zigachev /****************************************************************************** 30*b843c749SSergey Zigachev * Interface file for VBIOS implementations. 31*b843c749SSergey Zigachev * 32*b843c749SSergey Zigachev * The default implementation is inside DC. 33*b843c749SSergey Zigachev * Display Manager (which instantiates DC) has the option to supply it's own 34*b843c749SSergey Zigachev * (external to DC) implementation of VBIOS, which will be called by DC, using 35*b843c749SSergey Zigachev * this interface. 36*b843c749SSergey Zigachev * (The intended use is Diagnostics, but other uses may appear.) 37*b843c749SSergey Zigachev *****************************************************************************/ 38*b843c749SSergey Zigachev 39*b843c749SSergey Zigachev #include "include/bios_parser_types.h" 40*b843c749SSergey Zigachev 41*b843c749SSergey Zigachev struct dc_vbios_funcs { 42*b843c749SSergey Zigachev uint8_t (*get_connectors_number)(struct dc_bios *bios); 43*b843c749SSergey Zigachev 44*b843c749SSergey Zigachev struct graphics_object_id (*get_encoder_id)( 45*b843c749SSergey Zigachev struct dc_bios *bios, 46*b843c749SSergey Zigachev uint32_t i); 47*b843c749SSergey Zigachev struct graphics_object_id (*get_connector_id)( 48*b843c749SSergey Zigachev struct dc_bios *bios, 49*b843c749SSergey Zigachev uint8_t connector_index); 50*b843c749SSergey Zigachev uint32_t (*get_dst_number)( 51*b843c749SSergey Zigachev struct dc_bios *bios, 52*b843c749SSergey Zigachev struct graphics_object_id id); 53*b843c749SSergey Zigachev 54*b843c749SSergey Zigachev enum bp_result (*get_src_obj)( 55*b843c749SSergey Zigachev struct dc_bios *bios, 56*b843c749SSergey Zigachev struct graphics_object_id object_id, uint32_t index, 57*b843c749SSergey Zigachev struct graphics_object_id *src_object_id); 58*b843c749SSergey Zigachev enum bp_result (*get_dst_obj)( 59*b843c749SSergey Zigachev struct dc_bios *bios, 60*b843c749SSergey Zigachev struct graphics_object_id object_id, uint32_t index, 61*b843c749SSergey Zigachev struct graphics_object_id *dest_object_id); 62*b843c749SSergey Zigachev 63*b843c749SSergey Zigachev enum bp_result (*get_i2c_info)( 64*b843c749SSergey Zigachev struct dc_bios *dcb, 65*b843c749SSergey Zigachev struct graphics_object_id id, 66*b843c749SSergey Zigachev struct graphics_object_i2c_info *info); 67*b843c749SSergey Zigachev 68*b843c749SSergey Zigachev enum bp_result (*get_voltage_ddc_info)( 69*b843c749SSergey Zigachev struct dc_bios *bios, 70*b843c749SSergey Zigachev uint32_t index, 71*b843c749SSergey Zigachev struct graphics_object_i2c_info *info); 72*b843c749SSergey Zigachev enum bp_result (*get_thermal_ddc_info)( 73*b843c749SSergey Zigachev struct dc_bios *bios, 74*b843c749SSergey Zigachev uint32_t i2c_channel_id, 75*b843c749SSergey Zigachev struct graphics_object_i2c_info *info); 76*b843c749SSergey Zigachev enum bp_result (*get_hpd_info)( 77*b843c749SSergey Zigachev struct dc_bios *bios, 78*b843c749SSergey Zigachev struct graphics_object_id id, 79*b843c749SSergey Zigachev struct graphics_object_hpd_info *info); 80*b843c749SSergey Zigachev enum bp_result (*get_device_tag)( 81*b843c749SSergey Zigachev struct dc_bios *bios, 82*b843c749SSergey Zigachev struct graphics_object_id connector_object_id, 83*b843c749SSergey Zigachev uint32_t device_tag_index, 84*b843c749SSergey Zigachev struct connector_device_tag_info *info); 85*b843c749SSergey Zigachev enum bp_result (*get_firmware_info)( 86*b843c749SSergey Zigachev struct dc_bios *bios, 87*b843c749SSergey Zigachev struct dc_firmware_info *info); 88*b843c749SSergey Zigachev enum bp_result (*get_spread_spectrum_info)( 89*b843c749SSergey Zigachev struct dc_bios *bios, 90*b843c749SSergey Zigachev enum as_signal_type signal, 91*b843c749SSergey Zigachev uint32_t index, 92*b843c749SSergey Zigachev struct spread_spectrum_info *ss_info); 93*b843c749SSergey Zigachev uint32_t (*get_ss_entry_number)( 94*b843c749SSergey Zigachev struct dc_bios *bios, 95*b843c749SSergey Zigachev enum as_signal_type signal); 96*b843c749SSergey Zigachev enum bp_result (*get_embedded_panel_info)( 97*b843c749SSergey Zigachev struct dc_bios *bios, 98*b843c749SSergey Zigachev struct embedded_panel_info *info); 99*b843c749SSergey Zigachev enum bp_result (*get_gpio_pin_info)( 100*b843c749SSergey Zigachev struct dc_bios *bios, 101*b843c749SSergey Zigachev uint32_t gpio_id, 102*b843c749SSergey Zigachev struct gpio_pin_info *info); 103*b843c749SSergey Zigachev enum bp_result (*get_encoder_cap_info)( 104*b843c749SSergey Zigachev struct dc_bios *bios, 105*b843c749SSergey Zigachev struct graphics_object_id object_id, 106*b843c749SSergey Zigachev struct bp_encoder_cap_info *info); 107*b843c749SSergey Zigachev 108*b843c749SSergey Zigachev bool (*is_lid_status_changed)( 109*b843c749SSergey Zigachev struct dc_bios *bios); 110*b843c749SSergey Zigachev bool (*is_display_config_changed)( 111*b843c749SSergey Zigachev struct dc_bios *bios); 112*b843c749SSergey Zigachev bool (*is_accelerated_mode)( 113*b843c749SSergey Zigachev struct dc_bios *bios); 114*b843c749SSergey Zigachev uint32_t (*get_vga_enabled_displays)( 115*b843c749SSergey Zigachev struct dc_bios *bios); 116*b843c749SSergey Zigachev void (*get_bios_event_info)( 117*b843c749SSergey Zigachev struct dc_bios *bios, 118*b843c749SSergey Zigachev struct bios_event_info *info); 119*b843c749SSergey Zigachev void (*update_requested_backlight_level)( 120*b843c749SSergey Zigachev struct dc_bios *bios, 121*b843c749SSergey Zigachev uint32_t backlight_8bit); 122*b843c749SSergey Zigachev uint32_t (*get_requested_backlight_level)( 123*b843c749SSergey Zigachev struct dc_bios *bios); 124*b843c749SSergey Zigachev void (*take_backlight_control)( 125*b843c749SSergey Zigachev struct dc_bios *bios, 126*b843c749SSergey Zigachev bool cntl); 127*b843c749SSergey Zigachev 128*b843c749SSergey Zigachev bool (*is_active_display)( 129*b843c749SSergey Zigachev struct dc_bios *bios, 130*b843c749SSergey Zigachev enum signal_type signal, 131*b843c749SSergey Zigachev const struct connector_device_tag_info *device_tag); 132*b843c749SSergey Zigachev enum controller_id (*get_embedded_display_controller_id)( 133*b843c749SSergey Zigachev struct dc_bios *bios); 134*b843c749SSergey Zigachev uint32_t (*get_embedded_display_refresh_rate)( 135*b843c749SSergey Zigachev struct dc_bios *bios); 136*b843c749SSergey Zigachev 137*b843c749SSergey Zigachev void (*set_scratch_critical_state)( 138*b843c749SSergey Zigachev struct dc_bios *bios, 139*b843c749SSergey Zigachev bool state); 140*b843c749SSergey Zigachev bool (*is_device_id_supported)( 141*b843c749SSergey Zigachev struct dc_bios *bios, 142*b843c749SSergey Zigachev struct device_id id); 143*b843c749SSergey Zigachev 144*b843c749SSergey Zigachev /* COMMANDS */ 145*b843c749SSergey Zigachev 146*b843c749SSergey Zigachev enum bp_result (*encoder_control)( 147*b843c749SSergey Zigachev struct dc_bios *bios, 148*b843c749SSergey Zigachev struct bp_encoder_control *cntl); 149*b843c749SSergey Zigachev enum bp_result (*transmitter_control)( 150*b843c749SSergey Zigachev struct dc_bios *bios, 151*b843c749SSergey Zigachev struct bp_transmitter_control *cntl); 152*b843c749SSergey Zigachev enum bp_result (*crt_control)( 153*b843c749SSergey Zigachev struct dc_bios *bios, 154*b843c749SSergey Zigachev enum engine_id engine_id, 155*b843c749SSergey Zigachev bool enable, 156*b843c749SSergey Zigachev uint32_t pixel_clock); 157*b843c749SSergey Zigachev enum bp_result (*enable_crtc)( 158*b843c749SSergey Zigachev struct dc_bios *bios, 159*b843c749SSergey Zigachev enum controller_id id, 160*b843c749SSergey Zigachev bool enable); 161*b843c749SSergey Zigachev enum bp_result (*adjust_pixel_clock)( 162*b843c749SSergey Zigachev struct dc_bios *bios, 163*b843c749SSergey Zigachev struct bp_adjust_pixel_clock_parameters *bp_params); 164*b843c749SSergey Zigachev enum bp_result (*set_pixel_clock)( 165*b843c749SSergey Zigachev struct dc_bios *bios, 166*b843c749SSergey Zigachev struct bp_pixel_clock_parameters *bp_params); 167*b843c749SSergey Zigachev enum bp_result (*set_dce_clock)( 168*b843c749SSergey Zigachev struct dc_bios *bios, 169*b843c749SSergey Zigachev struct bp_set_dce_clock_parameters *bp_params); 170*b843c749SSergey Zigachev unsigned int (*get_smu_clock_info)( 171*b843c749SSergey Zigachev struct dc_bios *bios); 172*b843c749SSergey Zigachev enum bp_result (*enable_spread_spectrum_on_ppll)( 173*b843c749SSergey Zigachev struct dc_bios *bios, 174*b843c749SSergey Zigachev struct bp_spread_spectrum_parameters *bp_params, 175*b843c749SSergey Zigachev bool enable); 176*b843c749SSergey Zigachev enum bp_result (*program_crtc_timing)( 177*b843c749SSergey Zigachev struct dc_bios *bios, 178*b843c749SSergey Zigachev struct bp_hw_crtc_timing_parameters *bp_params); 179*b843c749SSergey Zigachev 180*b843c749SSergey Zigachev enum bp_result (*crtc_source_select)( 181*b843c749SSergey Zigachev struct dc_bios *bios, 182*b843c749SSergey Zigachev struct bp_crtc_source_select *bp_params); 183*b843c749SSergey Zigachev enum bp_result (*program_display_engine_pll)( 184*b843c749SSergey Zigachev struct dc_bios *bios, 185*b843c749SSergey Zigachev struct bp_pixel_clock_parameters *bp_params); 186*b843c749SSergey Zigachev 187*b843c749SSergey Zigachev enum signal_type (*dac_load_detect)( 188*b843c749SSergey Zigachev struct dc_bios *bios, 189*b843c749SSergey Zigachev struct graphics_object_id encoder, 190*b843c749SSergey Zigachev struct graphics_object_id connector, 191*b843c749SSergey Zigachev enum signal_type display_signal); 192*b843c749SSergey Zigachev 193*b843c749SSergey Zigachev enum bp_result (*enable_disp_power_gating)( 194*b843c749SSergey Zigachev struct dc_bios *bios, 195*b843c749SSergey Zigachev enum controller_id controller_id, 196*b843c749SSergey Zigachev enum bp_pipe_control_action action); 197*b843c749SSergey Zigachev 198*b843c749SSergey Zigachev void (*post_init)(struct dc_bios *bios); 199*b843c749SSergey Zigachev 200*b843c749SSergey Zigachev void (*bios_parser_destroy)(struct dc_bios **dcb); 201*b843c749SSergey Zigachev 202*b843c749SSergey Zigachev enum bp_result (*get_board_layout_info)( 203*b843c749SSergey Zigachev struct dc_bios *dcb, 204*b843c749SSergey Zigachev struct board_layout_info *board_layout_info); 205*b843c749SSergey Zigachev }; 206*b843c749SSergey Zigachev 207*b843c749SSergey Zigachev struct bios_registers { 208*b843c749SSergey Zigachev uint32_t BIOS_SCRATCH_3; 209*b843c749SSergey Zigachev uint32_t BIOS_SCRATCH_6; 210*b843c749SSergey Zigachev }; 211*b843c749SSergey Zigachev 212*b843c749SSergey Zigachev struct dc_bios { 213*b843c749SSergey Zigachev const struct dc_vbios_funcs *funcs; 214*b843c749SSergey Zigachev 215*b843c749SSergey Zigachev uint8_t *bios; 216*b843c749SSergey Zigachev uint32_t bios_size; 217*b843c749SSergey Zigachev 218*b843c749SSergey Zigachev uint8_t *bios_local_image; 219*b843c749SSergey Zigachev 220*b843c749SSergey Zigachev struct dc_context *ctx; 221*b843c749SSergey Zigachev const struct bios_registers *regs; 222*b843c749SSergey Zigachev struct integrated_info *integrated_info; 223*b843c749SSergey Zigachev }; 224*b843c749SSergey Zigachev 225*b843c749SSergey Zigachev #endif /* DC_BIOS_TYPES_H */ 226