/* * Copyright 2019 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD * */ #ifndef DMUB_CMD_H #define DMUB_CMD_H #include <asm/byteorder.h> #include <linux/types.h> #include <linux/string.h> #include <linux/delay.h> #include "atomfirmware.h" //<DMUB_TYPES>================================================================== /* Basic type definitions. */ #define __forceinline … /** * Flag from driver to indicate that ABM should be disabled gradually * by slowly reversing all backlight programming and pixel compensation. */ #define SET_ABM_PIPE_GRADUALLY_DISABLE … /** * Flag from driver to indicate that ABM should be disabled immediately * and undo all backlight programming and pixel compensation. */ #define SET_ABM_PIPE_IMMEDIATELY_DISABLE … /** * Flag from driver to indicate that ABM should be disabled immediately * and keep the current backlight programming and pixel compensation. */ #define SET_ABM_PIPE_IMMEDIATE_KEEP_GAIN_DISABLE … /** * Flag from driver to set the current ABM pipe index or ABM operating level. */ #define SET_ABM_PIPE_NORMAL … /** * Number of ambient light levels in ABM algorithm. */ #define NUM_AMBI_LEVEL … /** * Number of operating/aggression levels in ABM algorithm. */ #define NUM_AGGR_LEVEL … /** * Number of segments in the gamma curve. */ #define NUM_POWER_FN_SEGS … /** * Number of segments in the backlight curve. */ #define NUM_BL_CURVE_SEGS … /** * Maximum number of segments in ABM ACE curve. */ #define ABM_MAX_NUM_OF_ACE_SEGMENTS … /** * Maximum number of bins in ABM histogram. */ #define ABM_MAX_NUM_OF_HG_BINS … /* Maximum number of SubVP streams */ #define DMUB_MAX_SUBVP_STREAMS … /* Define max FPO streams as 4 for now. Current implementation today * only supports 1, but could be more in the future. Reduce array * size to ensure the command size remains less than 64 bytes if * adding new fields. */ #define DMUB_MAX_FPO_STREAMS … /* Maximum number of streams on any ASIC. */ #define DMUB_MAX_STREAMS … /* Maximum number of planes on any ASIC. */ #define DMUB_MAX_PLANES … /* Maximum number of phantom planes on any ASIC */ #define DMUB_MAX_PHANTOM_PLANES … /* Trace buffer offset for entry */ #define TRACE_BUFFER_ENTRY_OFFSET … /** * Maximum number of dirty rects supported by FW. */ #define DMUB_MAX_DIRTY_RECTS … /** * * PSR control version legacy */ #define DMUB_CMD_PSR_CONTROL_VERSION_UNKNOWN … /** * PSR control version with multi edp support */ #define DMUB_CMD_PSR_CONTROL_VERSION_1 … /** * ABM control version legacy */ #define DMUB_CMD_ABM_CONTROL_VERSION_UNKNOWN … /** * ABM control version with multi edp support */ #define DMUB_CMD_ABM_CONTROL_VERSION_1 … /** * Physical framebuffer address location, 64-bit. */ #ifndef PHYSICAL_ADDRESS_LOC #define PHYSICAL_ADDRESS_LOC … #endif /** * OS/FW agnostic memcpy */ #ifndef dmub_memcpy #define dmub_memcpy(dest, source, bytes) … #endif /** * OS/FW agnostic memset */ #ifndef dmub_memset #define dmub_memset(dest, val, bytes) … #endif /** * OS/FW agnostic udelay */ #ifndef dmub_udelay #define dmub_udelay(microseconds) … #endif #pragma pack(push, 1) #define ABM_NUM_OF_ACE_SEGMENTS … abm_flags; struct abm_save_restore { … }; /** * union dmub_addr - DMUB physical/virtual 64-bit address. */ dmub_addr; #pragma pack(pop) /** * Dirty rect definition. */ struct dmub_rect { … }; /** * Flags that can be set by driver to change some PSR behaviour. */ dmub_psr_debug_flags; /** * Flags that can be set by driver to change some Replay behaviour. */ replay_debug_flags; replay_hw_flags; /** * DMUB feature capabilities. * After DMUB init, driver will query FW capabilities prior to enabling certain features. */ struct dmub_feature_caps { … }; struct dmub_visual_confirm_color { … }; //============================================================================== //</DMUB_TYPES>================================================================= //============================================================================== //< DMUB_META>================================================================== //============================================================================== #pragma pack(push, 1) /* Magic value for identifying dmub_fw_meta_info */ #define DMUB_FW_META_MAGIC … /* Offset from the end of the file to the dmub_fw_meta_info */ #define DMUB_FW_META_OFFSET … /** * union dmub_fw_meta_feature_bits - Static feature bits for pre-initialization */ dmub_fw_meta_feature_bits; /** * struct dmub_fw_meta_info - metadata associated with fw binary * * NOTE: This should be considered a stable API. Fields should * not be repurposed or reordered. New fields should be * added instead to extend the structure. * * @magic_value: magic value identifying DMUB firmware meta info * @fw_region_size: size of the firmware state region * @trace_buffer_size: size of the tracebuffer region * @fw_version: the firmware version information * @dal_fw: 1 if the firmware is DAL * @shared_state_size: size of the shared state region in bytes * @shared_state_features: number of shared state features */ struct dmub_fw_meta_info { … }; /** * union dmub_fw_meta - ensures that dmub_fw_meta_info remains 64 bytes */ dmub_fw_meta; #pragma pack(pop) //============================================================================== //< DMUB Trace Buffer>================================================================ //============================================================================== #if !defined(TENSILICA) && !defined(DMUB_TRACE_ENTRY_DEFINED) /** * dmub_trace_code_t - firmware trace code, 32-bits */ dmub_trace_code_t; /** * struct dmcub_trace_buf_entry - Firmware trace entry */ struct dmcub_trace_buf_entry { … }; #endif //============================================================================== //< DMUB_STATUS>================================================================ //============================================================================== /** * DMCUB scratch registers can be used to determine firmware status. * Current scratch register usage is as follows: * * SCRATCH0: FW Boot Status register * SCRATCH5: LVTMA Status Register * SCRATCH15: FW Boot Options register */ /** * union dmub_fw_boot_status - Status bit definitions for SCRATCH0. */ dmub_fw_boot_status; /** * enum dmub_fw_boot_status_bit - Enum bit definitions for SCRATCH0. */ enum dmub_fw_boot_status_bit { … }; /* Register bit definition for SCRATCH5 */ dmub_lvtma_status; enum dmub_lvtma_status_bit { … }; enum dmub_ips_disable_type { … }; #define DMUB_IPS1_ALLOW_MASK … #define DMUB_IPS2_ALLOW_MASK … #define DMUB_IPS1_COMMIT_MASK … #define DMUB_IPS2_COMMIT_MASK … /** * union dmub_fw_boot_options - Boot option definitions for SCRATCH14 */ dmub_fw_boot_options; enum dmub_fw_boot_options_bit { … }; //============================================================================== //< DMUB_SHARED_STATE>========================================================== //============================================================================== /** * Shared firmware state between driver and firmware for lockless communication * in situations where the inbox/outbox may be unavailable. * * Each structure *must* be at most 256-bytes in size. The layout allocation is * described below: * * [Header (256 Bytes)][Feature 1 (256 Bytes)][Feature 2 (256 Bytes)]... */ /** * enum dmub_shared_state_feature_id - List of shared state features. */ enum dmub_shared_state_feature_id { … }; /** * struct dmub_shared_state_ips_fw - Firmware signals for IPS. */ dmub_shared_state_ips_fw_signals; /** * struct dmub_shared_state_ips_signals - Firmware signals for IPS. */ dmub_shared_state_ips_driver_signals; /** * IPS FW Version */ #define DMUB_SHARED_STATE__IPS_FW_VERSION … /** * struct dmub_shared_state_ips_fw - Firmware state for IPS. */ struct dmub_shared_state_ips_fw { … }; /* 248-bytes, fixed */ /** * IPS Driver Version */ #define DMUB_SHARED_STATE__IPS_DRIVER_VERSION … /** * struct dmub_shared_state_ips_driver - Driver state for IPS. */ struct dmub_shared_state_ips_driver { … }; /* 248-bytes, fixed */ /** * enum dmub_shared_state_feature_common - Generic payload. */ struct dmub_shared_state_feature_common { … }; /* 248-bytes, fixed */ /** * enum dmub_shared_state_feature_header - Feature description. */ struct dmub_shared_state_feature_header { … }; /* 8 bytes, fixed */ /** * struct dmub_shared_state_feature_block - Feature block. */ struct dmub_shared_state_feature_block { … }; /* 256-bytes, fixed */ /** * Shared state size in bytes. */ #define DMUB_FW_HEADER_SHARED_STATE_SIZE … //============================================================================== //</DMUB_STATUS>================================================================ //============================================================================== //< DMUB_VBIOS>================================================================= //============================================================================== /* * enum dmub_cmd_vbios_type - VBIOS commands. * * Command IDs should be treated as stable ABI. * Do not reuse or modify IDs. */ enum dmub_cmd_vbios_type { … }; //============================================================================== //</DMUB_VBIOS>================================================================= //============================================================================== //< DMUB_GPINT>================================================================= //============================================================================== /** * The shifts and masks below may alternatively be used to format and read * the command register bits. */ #define DMUB_GPINT_DATA_PARAM_MASK … #define DMUB_GPINT_DATA_PARAM_SHIFT … #define DMUB_GPINT_DATA_COMMAND_CODE_MASK … #define DMUB_GPINT_DATA_COMMAND_CODE_SHIFT … #define DMUB_GPINT_DATA_STATUS_MASK … #define DMUB_GPINT_DATA_STATUS_SHIFT … /** * Command responses. */ /** * Return response for DMUB_GPINT__STOP_FW command. */ #define DMUB_GPINT__STOP_FW_RESPONSE … /** * union dmub_gpint_data_register - Format for sending a command via the GPINT. */ dmub_gpint_data_register; /* * enum dmub_gpint_command - GPINT command to DMCUB FW * * Command IDs should be treated as stable ABI. * Do not reuse or modify IDs. */ enum dmub_gpint_command { … }; /** * INBOX0 generic command definition */ dmub_inbox0_cmd_common; /** * INBOX0 hw_lock command definition */ dmub_inbox0_cmd_lock_hw; dmub_inbox0_data_register; enum dmub_inbox0_command { … }; //============================================================================== //</DMUB_GPINT>================================================================= //============================================================================== //< DMUB_CMD>=================================================================== //============================================================================== /** * Size in bytes of each DMUB command. */ #define DMUB_RB_CMD_SIZE … /** * Maximum number of items in the DMUB ringbuffer. */ #define DMUB_RB_MAX_ENTRY … /** * Ringbuffer size in bytes. */ #define DMUB_RB_SIZE … /** * REG_SET mask for reg offload. */ #define REG_SET_MASK … /* * enum dmub_cmd_type - DMUB inbox command. * * Command IDs should be treated as stable ABI. * Do not reuse or modify IDs. */ enum dmub_cmd_type { … }; /** * enum dmub_out_cmd_type - DMUB outbox commands. */ enum dmub_out_cmd_type { … }; /* DMUB_CMD__DPIA command sub-types. */ enum dmub_cmd_dpia_type { … }; /* DMUB_OUT_CMD__DPIA_NOTIFICATION command types. */ enum dmub_cmd_dpia_notification_type { … }; #pragma pack(push, 1) /** * struct dmub_cmd_header - Common command header fields. */ struct dmub_cmd_header { … }; /* * struct dmub_cmd_read_modify_write_sequence - Read modify write * * 60 payload bytes can hold up to 5 sets of read modify writes, * each take 3 dwords. * * number of sequences = header.payload_bytes / sizeof(struct dmub_cmd_read_modify_write_sequence) * * modify_mask = 0xffff'ffff means all fields are going to be updated. in this case * command parser will skip the read and we can use modify_mask = 0xffff'ffff as reg write */ struct dmub_cmd_read_modify_write_sequence { … }; /** * Maximum number of ops in read modify write sequence. */ #define DMUB_READ_MODIFY_WRITE_SEQ__MAX … /** * struct dmub_cmd_read_modify_write_sequence - Read modify write command. */ struct dmub_rb_cmd_read_modify_write { … }; /* * Update a register with specified masks and values sequeunce * * 60 payload bytes can hold address + up to 7 sets of mask/value combo, each take 2 dword * * number of field update sequence = (header.payload_bytes - sizeof(addr)) / sizeof(struct read_modify_write_sequence) * * * USE CASE: * 1. auto-increment register where additional read would update pointer and produce wrong result * 2. toggle a bit without read in the middle */ struct dmub_cmd_reg_field_update_sequence { … }; /** * Maximum number of ops in field update sequence. */ #define DMUB_REG_FIELD_UPDATE_SEQ__MAX … /** * struct dmub_rb_cmd_reg_field_update_sequence - Field update command. */ struct dmub_rb_cmd_reg_field_update_sequence { … }; /** * Maximum number of burst write values. */ #define DMUB_BURST_WRITE_VALUES__MAX … /* * struct dmub_rb_cmd_burst_write - Burst write * * support use case such as writing out LUTs. * * 60 payload bytes can hold up to 14 values to write to given address * * number of payload = header.payload_bytes / sizeof(struct read_modify_write_sequence) */ struct dmub_rb_cmd_burst_write { … }; /** * struct dmub_rb_cmd_common - Common command header */ struct dmub_rb_cmd_common { … }; /** * struct dmub_cmd_reg_wait_data - Register wait data */ struct dmub_cmd_reg_wait_data { … }; /** * struct dmub_rb_cmd_reg_wait - Register wait command */ struct dmub_rb_cmd_reg_wait { … }; /** * struct dmub_cmd_PLAT_54186_wa - Underflow workaround * * Reprograms surface parameters to avoid underflow. */ struct dmub_cmd_PLAT_54186_wa { … }; /** * struct dmub_rb_cmd_PLAT_54186_wa - Underflow workaround command */ struct dmub_rb_cmd_PLAT_54186_wa { … }; /** * enum dmub_cmd_mall_type - MALL commands */ enum dmub_cmd_mall_type { … }; /** * struct dmub_rb_cmd_mall - MALL command data. */ struct dmub_rb_cmd_mall { … }; /** * enum dmub_cmd_cab_type - CAB command data. */ enum dmub_cmd_cab_type { … }; /** * struct dmub_rb_cmd_cab - CAB command data. */ struct dmub_rb_cmd_cab_for_ss { … }; /** * Enum for indicating which MCLK switch mode per pipe */ enum mclk_switch_mode { … }; /* Per pipe struct which stores the MCLK switch mode * data to be sent to DMUB. * Named "v2" for now -- once FPO and SUBVP are fully merged * the type name can be updated */ struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 { … }; /** * Config data for Sub-VP and FPO * Named "v2" for now -- once FPO and SUBVP are fully merged * the type name can be updated */ struct dmub_cmd_fw_assisted_mclk_switch_config_v2 { … }; /** * DMUB rb command definition for Sub-VP and FPO * Named "v2" for now -- once FPO and SUBVP are fully merged * the type name can be updated */ struct dmub_rb_cmd_fw_assisted_mclk_switch_v2 { … }; struct dmub_flip_addr_info { … }; struct dmub_fams2_flip_info { … }; struct dmub_rb_cmd_fams2_flip { … }; struct dmub_optc_state_v2 { … }; struct dmub_optc_position { … }; struct dmub_rb_cmd_fams2_drr_update { … }; /* HW and FW global configuration data for FAMS2 */ /* FAMS2 types and structs */ enum fams2_stream_type { … }; /* dynamic stream state */ struct dmub_fams2_legacy_stream_dynamic_state { … }; struct dmub_fams2_subvp_stream_dynamic_state { … }; struct dmub_fams2_drr_stream_dynamic_state { … }; struct dmub_fams2_stream_dynamic_state { … }; /* static stream state */ struct dmub_fams2_legacy_stream_static_state { … }; struct dmub_fams2_subvp_stream_static_state { … }; struct dmub_fams2_drr_stream_static_state { … }; struct dmub_fams2_stream_static_state { … }; /** * enum dmub_fams2_allow_delay_check_mode - macroscheduler mode for breaking on excessive * p-state request to allow latency */ enum dmub_fams2_allow_delay_check_mode { … }; dmub_fams2_global_feature_config; struct dmub_cmd_fams2_global_config { … }; dmub_cmd_fams2_config; /** * DMUB rb command definition for FAMS2 (merged SubVP, FPO, Legacy) */ struct dmub_rb_cmd_fams2 { … }; /** * enum dmub_cmd_idle_opt_type - Idle optimization command type. */ enum dmub_cmd_idle_opt_type { … }; /** * struct dmub_rb_cmd_idle_opt_dcn_restore - DCN restore command data. */ struct dmub_rb_cmd_idle_opt_dcn_restore { … }; /** * struct dmub_dcn_notify_idle_cntl_data - Data passed to FW in a DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE command. */ struct dmub_dcn_notify_idle_cntl_data { … }; /** * struct dmub_rb_cmd_idle_opt_dcn_notify_idle - Data passed to FW in a DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE command. */ struct dmub_rb_cmd_idle_opt_dcn_notify_idle { … }; /** * struct dmub_clocks - Clock update notification. */ struct dmub_clocks { … }; /** * enum dmub_cmd_clk_mgr_type - Clock manager commands. */ enum dmub_cmd_clk_mgr_type { … }; /** * struct dmub_rb_cmd_clk_mgr_notify_clocks - Clock update notification. */ struct dmub_rb_cmd_clk_mgr_notify_clocks { … }; /** * struct dmub_cmd_digx_encoder_control_data - Encoder control data. */ struct dmub_cmd_digx_encoder_control_data { … }; /** * struct dmub_rb_cmd_digx_encoder_control - Encoder control command. */ struct dmub_rb_cmd_digx_encoder_control { … }; /** * struct dmub_cmd_set_pixel_clock_data - Set pixel clock data. */ struct dmub_cmd_set_pixel_clock_data { … }; /** * struct dmub_cmd_set_pixel_clock_data - Set pixel clock command. */ struct dmub_rb_cmd_set_pixel_clock { … }; /** * struct dmub_cmd_enable_disp_power_gating_data - Display power gating. */ struct dmub_cmd_enable_disp_power_gating_data { … }; /** * struct dmub_rb_cmd_enable_disp_power_gating - Display power command. */ struct dmub_rb_cmd_enable_disp_power_gating { … }; /** * struct dmub_dig_transmitter_control_data_v1_7 - Transmitter control. */ struct dmub_dig_transmitter_control_data_v1_7 { … }; /** * union dmub_cmd_dig1_transmitter_control_data - Transmitter control data. */ dmub_cmd_dig1_transmitter_control_data; /** * struct dmub_rb_cmd_dig1_transmitter_control - Transmitter control command. */ struct dmub_rb_cmd_dig1_transmitter_control { … }; /** * struct dmub_rb_cmd_domain_control_data - Data for DOMAIN power control */ struct dmub_rb_cmd_domain_control_data { … }; /** * struct dmub_rb_cmd_domain_control - Controls DOMAIN power gating */ struct dmub_rb_cmd_domain_control { … }; /** * DPIA tunnel command parameters. */ struct dmub_cmd_dig_dpia_control_data { … }; /** * DMUB command for DPIA tunnel control. */ struct dmub_rb_cmd_dig1_dpia_control { … }; /** * SET_CONFIG Command Payload */ struct set_config_cmd_payload { … }; /** * Data passed from driver to FW in a DMUB_CMD__DPIA_SET_CONFIG_ACCESS command. */ struct dmub_cmd_set_config_control_data { … }; /** * DMUB command structure for SET_CONFIG command. */ struct dmub_rb_cmd_set_config_access { … }; /** * Data passed from driver to FW in a DMUB_CMD__DPIA_MST_ALLOC_SLOTS command. */ struct dmub_cmd_mst_alloc_slots_control_data { … }; /** * DMUB command structure for SET_ command. */ struct dmub_rb_cmd_set_mst_alloc_slots { … }; /** * DMUB command structure for DPIA HPD int enable control. */ struct dmub_rb_cmd_dpia_hpd_int_enable { … }; /** * struct dmub_rb_cmd_dpphy_init - DPPHY init. */ struct dmub_rb_cmd_dpphy_init { … }; /** * enum dp_aux_request_action - DP AUX request command listing. * * 4 AUX request command bits are shifted to high nibble. */ enum dp_aux_request_action { … }; /** * enum aux_return_code_type - DP AUX process return code listing. */ enum aux_return_code_type { … }; /** * enum aux_channel_type - DP AUX channel type listing. */ enum aux_channel_type { … }; /** * struct aux_transaction_parameters - DP AUX request transaction data */ struct aux_transaction_parameters { … }; /** * Data passed from driver to FW in a DMUB_CMD__DP_AUX_ACCESS command. */ struct dmub_cmd_dp_aux_control_data { … }; /** * Definition of a DMUB_CMD__DP_AUX_ACCESS command. */ struct dmub_rb_cmd_dp_aux_access { … }; /** * Definition of a DMUB_CMD__OUTBOX1_ENABLE command. */ struct dmub_rb_cmd_outbox1_enable { … }; /* DP AUX Reply command - OutBox Cmd */ /** * Data passed to driver from FW in a DMUB_OUT_CMD__DP_AUX_REPLY command. */ struct aux_reply_data { … }; /** * Control Data passed to driver from FW in a DMUB_OUT_CMD__DP_AUX_REPLY command. */ struct aux_reply_control_data { … }; /** * Definition of a DMUB_OUT_CMD__DP_AUX_REPLY command. */ struct dmub_rb_cmd_dp_aux_reply { … }; /* DP HPD Notify command - OutBox Cmd */ /** * DP HPD Type */ enum dp_hpd_type { … }; /** * DP HPD Status */ enum dp_hpd_status { … }; /** * Data passed to driver from FW in a DMUB_OUT_CMD__DP_HPD_NOTIFY command. */ struct dp_hpd_data { … }; /** * Definition of a DMUB_OUT_CMD__DP_HPD_NOTIFY command. */ struct dmub_rb_cmd_dp_hpd_notify { … }; /** * Definition of a SET_CONFIG reply from DPOA. */ enum set_config_status { … }; /** * Definition of a set_config reply */ struct set_config_reply_control_data { … }; /** * Definition of a DMUB_OUT_CMD__SET_CONFIG_REPLY command. */ struct dmub_rb_cmd_dp_set_config_reply { … }; /** * Definition of a DPIA notification header */ struct dpia_notification_header { … }; /** * Definition of the common data struct of DPIA notification */ struct dpia_notification_common { … }; /** * Definition of a DPIA notification data */ struct dpia_bw_allocation_notify_data { … }; /** * union dpia_notify_data_type - DPIA Notification in Outbox command */ dpia_notification_data; /** * Definition of a DPIA notification payload */ struct dpia_notification_payload { … }; /** * Definition of a DMUB_OUT_CMD__DPIA_NOTIFICATION command. */ struct dmub_rb_cmd_dpia_notification { … }; /** * Data passed from driver to FW in a DMUB_CMD__QUERY_HPD_STATE command. */ struct dmub_cmd_hpd_state_query_data { … }; /** * Definition of a DMUB_CMD__QUERY_HPD_STATE command. */ struct dmub_rb_cmd_query_hpd_state { … }; /** * struct dmub_rb_cmd_hpd_sense_notify - HPD sense notification data. */ struct dmub_rb_cmd_hpd_sense_notify_data { … }; /** * struct dmub_rb_cmd_hpd_sense_notify - DMUB_OUT_CMD__HPD_SENSE_NOTIFY command. */ struct dmub_rb_cmd_hpd_sense_notify { … }; /* * Command IDs should be treated as stable ABI. * Do not reuse or modify IDs. */ /** * PSR command sub-types. */ enum dmub_cmd_psr_type { … }; /** * Different PSR residency modes. * Different modes change the definition of PSR residency. */ enum psr_residency_mode { … }; enum dmub_cmd_fams_type { … }; /** * PSR versions. */ enum psr_version { … }; /** * PHY Link rate for DP. */ enum phy_link_rate { … }; /** * enum dmub_phy_fsm_state - PHY FSM states. * PHY FSM state to transit to during PSR enable/disable. */ enum dmub_phy_fsm_state { … }; /** * Data passed from driver to FW in a DMUB_CMD__PSR_COPY_SETTINGS command. */ struct dmub_cmd_psr_copy_settings_data { … }; /** * Definition of a DMUB_CMD__PSR_COPY_SETTINGS command. */ struct dmub_rb_cmd_psr_copy_settings { … }; /** * Data passed from driver to FW in a DMUB_CMD__PSR_SET_LEVEL command. */ struct dmub_cmd_psr_set_level_data { … }; /** * Definition of a DMUB_CMD__PSR_SET_LEVEL command. */ struct dmub_rb_cmd_psr_set_level { … }; struct dmub_rb_cmd_psr_enable_data { … }; /** * Definition of a DMUB_CMD__PSR_ENABLE command. * PSR enable/disable is controlled using the sub_type. */ struct dmub_rb_cmd_psr_enable { … }; /** * Data passed from driver to FW in a DMUB_CMD__PSR_SET_VERSION command. */ struct dmub_cmd_psr_set_version_data { … }; /** * Definition of a DMUB_CMD__PSR_SET_VERSION command. */ struct dmub_rb_cmd_psr_set_version { … }; struct dmub_cmd_psr_force_static_data { … }; /** * Definition of a DMUB_CMD__PSR_FORCE_STATIC command. */ struct dmub_rb_cmd_psr_force_static { … }; /** * PSR SU debug flags. */ dmub_psr_su_debug_flags; /** * Data passed from driver to FW in a DMUB_CMD__UPDATE_DIRTY_RECT command. * This triggers a selective update for PSR SU. */ struct dmub_cmd_update_dirty_rect_data { … }; /** * Definition of a DMUB_CMD__UPDATE_DIRTY_RECT command. */ struct dmub_rb_cmd_update_dirty_rect { … }; /** * Data passed from driver to FW in a DMUB_CMD__UPDATE_CURSOR_INFO command. */ dmub_reg_cursor_control_cfg; struct dmub_cursor_position_cache_hubp { … }; dmub_reg_cur0_control_cfg; struct dmub_cursor_position_cache_dpp { … }; struct dmub_cursor_position_cfg { … }; struct dmub_cursor_attribute_cache_hubp { … }; struct dmub_cursor_attribute_cache_dpp { … }; struct dmub_cursor_attributes_cfg { … }; struct dmub_cmd_update_cursor_payload0 { … }; struct dmub_cmd_update_cursor_payload1 { … }; dmub_cmd_update_cursor_info_data; /** * Definition of a DMUB_CMD__UPDATE_CURSOR_INFO command. */ struct dmub_rb_cmd_update_cursor_info { … }; /** * Data passed from driver to FW in a DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE command. */ struct dmub_cmd_psr_set_vtotal_data { … }; /** * Definition of a DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE command. */ struct dmub_rb_cmd_psr_set_vtotal { … }; /** * Data passed from driver to FW in a DMUB_CMD__SET_PSR_POWER_OPT command. */ struct dmub_cmd_psr_set_power_opt_data { … }; /** * Definition of a DMUB_CMD__SET_PSR_POWER_OPT command. */ struct dmub_rb_cmd_psr_set_power_opt { … }; /** * Definition of Replay Residency GPINT command. * Bit[0] - Residency mode for Revision 0 * Bit[1] - Enable/Disable state * Bit[2-3] - Revision number * Bit[4-7] - Residency mode for Revision 1 * Bit[8] - Panel instance * Bit[9-15] - Reserved */ enum pr_residency_mode { … }; #define REPLAY_RESIDENCY_MODE_SHIFT … #define REPLAY_RESIDENCY_ENABLE_SHIFT … #define REPLAY_RESIDENCY_REVISION_SHIFT … #define REPLAY_RESIDENCY_MODE2_SHIFT … #define REPLAY_RESIDENCY_MODE_MASK … #define REPLAY_RESIDENCY_FIELD_MODE_PHY … #define REPLAY_RESIDENCY_FIELD_MODE_ALPM … #define REPLAY_RESIDENCY_MODE2_MASK … #define REPLAY_RESIDENCY_FIELD_MODE2_IPS … #define REPLAY_RESIDENCY_FIELD_MODE2_FRAME_CNT … #define REPLAY_RESIDENCY_FIELD_MODE2_EN_PERIOD … #define REPLAY_RESIDENCY_ENABLE_MASK … #define REPLAY_RESIDENCY_DISABLE … #define REPLAY_RESIDENCY_ENABLE … #define REPLAY_RESIDENCY_REVISION_MASK … #define REPLAY_RESIDENCY_REVISION_0 … #define REPLAY_RESIDENCY_REVISION_1 … /** * Definition of a replay_state. */ enum replay_state { … }; /** * Replay command sub-types. */ enum dmub_cmd_replay_type { … }; /** * Replay general command sub-types. */ enum dmub_cmd_replay_general_subtype { … }; /** * Data passed from driver to FW in a DMUB_CMD__REPLAY_COPY_SETTINGS command. */ struct dmub_cmd_replay_copy_settings_data { … }; /** * Definition of a DMUB_CMD__REPLAY_COPY_SETTINGS command. */ struct dmub_rb_cmd_replay_copy_settings { … }; /** * Replay disable / enable state for dmub_rb_cmd_replay_enable_data.enable */ enum replay_enable { … }; /** * Data passed from driver to FW in a DMUB_CMD__REPLAY_ENABLE command. */ struct dmub_rb_cmd_replay_enable_data { … }; /** * Definition of a DMUB_CMD__REPLAY_ENABLE command. * Replay enable/disable is controlled using action in data. */ struct dmub_rb_cmd_replay_enable { … }; /** * Data passed from driver to FW in a DMUB_CMD__SET_REPLAY_POWER_OPT command. */ struct dmub_cmd_replay_set_power_opt_data { … }; /** * Data passed from driver to FW in a DMUB_CMD__REPLAY_SET_TIMING_SYNC_SUPPORTED command. */ struct dmub_cmd_replay_set_timing_sync_data { … }; /** * Data passed from driver to FW in a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command. */ struct dmub_cmd_replay_set_pseudo_vtotal { … }; struct dmub_cmd_replay_disabled_adaptive_sync_sdp_data { … }; struct dmub_cmd_replay_set_general_cmd_data { … }; /** * Definition of a DMUB_CMD__SET_REPLAY_POWER_OPT command. */ struct dmub_rb_cmd_replay_set_power_opt { … }; /** * Data passed from driver to FW in a DMUB_CMD__REPLAY_SET_COASTING_VTOTAL command. */ struct dmub_cmd_replay_set_coasting_vtotal_data { … }; /** * Definition of a DMUB_CMD__REPLAY_SET_COASTING_VTOTAL command. */ struct dmub_rb_cmd_replay_set_coasting_vtotal { … }; /** * Definition of a DMUB_CMD__REPLAY_SET_POWER_OPT_AND_COASTING_VTOTAL command. */ struct dmub_rb_cmd_replay_set_power_opt_and_coasting_vtotal { … }; /** * Definition of a DMUB_CMD__REPLAY_SET_TIMING_SYNC_SUPPORTED command. */ struct dmub_rb_cmd_replay_set_timing_sync { … }; /** * Definition of a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command. */ struct dmub_rb_cmd_replay_set_pseudo_vtotal { … }; /** * Definition of a DMUB_CMD__REPLAY_DISABLED_ADAPTIVE_SYNC_SDP command. */ struct dmub_rb_cmd_replay_disabled_adaptive_sync_sdp { … }; /** * Definition of a DMUB_CMD__REPLAY_SET_GENERAL_CMD command. */ struct dmub_rb_cmd_replay_set_general_cmd { … }; /** * Data passed from driver to FW in DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER command. */ struct dmub_cmd_replay_frameupdate_timer_data { … }; /** * Definition of DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER */ struct dmub_rb_cmd_replay_set_frameupdate_timer { … }; /** * Definition union of replay command set */ dmub_replay_cmd_set; /** * Set of HW components that can be locked. * * Note: If updating with more HW components, fields * in dmub_inbox0_cmd_lock_hw must be updated to match. */ dmub_hw_lock_flags; /** * Instances of HW to be locked. * * Note: If updating with more HW components, fields * in dmub_inbox0_cmd_lock_hw must be updated to match. */ struct dmub_hw_lock_inst_flags { … }; /** * Clients that can acquire the HW Lock Manager. * * Note: If updating with more clients, fields in * dmub_inbox0_cmd_lock_hw must be updated to match. */ enum hw_lock_client { … }; /** * Data passed to HW Lock Mgr in a DMUB_CMD__HW_LOCK command. */ struct dmub_cmd_lock_hw_data { … }; /** * Definition of a DMUB_CMD__HW_LOCK command. * Command is used by driver and FW. */ struct dmub_rb_cmd_lock_hw { … }; /** * ABM command sub-types. */ enum dmub_cmd_abm_type { … }; struct abm_ace_curve { … }; struct fixed_pt_format { … }; struct abm_caps { … }; /** * Parameters for ABM2.4 algorithm. Passed from driver to FW via an indirect buffer. * Requirements: * - Padded explicitly to 32-bit boundary. * - Must ensure this structure matches the one on driver-side, * otherwise it won't be aligned. */ struct abm_config_table { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_SET_PIPE command. */ struct dmub_cmd_abm_set_pipe_data { … }; /** * Definition of a DMUB_CMD__ABM_SET_PIPE command. */ struct dmub_rb_cmd_abm_set_pipe { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_SET_BACKLIGHT command. */ struct dmub_cmd_abm_set_backlight_data { … }; /** * Definition of a DMUB_CMD__ABM_SET_BACKLIGHT command. */ struct dmub_rb_cmd_abm_set_backlight { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_SET_LEVEL command. */ struct dmub_cmd_abm_set_level_data { … }; /** * Definition of a DMUB_CMD__ABM_SET_LEVEL command. */ struct dmub_rb_cmd_abm_set_level { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_SET_AMBIENT_LEVEL command. */ struct dmub_cmd_abm_set_ambient_level_data { … }; /** * Definition of a DMUB_CMD__ABM_SET_AMBIENT_LEVEL command. */ struct dmub_rb_cmd_abm_set_ambient_level { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_SET_PWM_FRAC command. */ struct dmub_cmd_abm_set_pwm_frac_data { … }; /** * Definition of a DMUB_CMD__ABM_SET_PWM_FRAC command. */ struct dmub_rb_cmd_abm_set_pwm_frac { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_INIT_CONFIG command. */ struct dmub_cmd_abm_init_config_data { … }; /** * Definition of a DMUB_CMD__ABM_INIT_CONFIG command. */ struct dmub_rb_cmd_abm_init_config { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_PAUSE command. */ struct dmub_cmd_abm_pause_data { … }; /** * Definition of a DMUB_CMD__ABM_PAUSE command. */ struct dmub_rb_cmd_abm_pause { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_QUERY_CAPS command. */ struct dmub_cmd_abm_query_caps_in { … }; /** * Data passed from FW to driver in a DMUB_CMD__ABM_QUERY_CAPS command. */ struct dmub_cmd_abm_query_caps_out { … }; /** * Definition of a DMUB_CMD__ABM_QUERY_CAPS command. */ struct dmub_rb_cmd_abm_query_caps { … }; /** * enum dmub_abm_ace_curve_type - ACE curve type. */ enum dmub_abm_ace_curve_type { … }; /** * Definition of a DMUB_CMD__ABM_GET_ACE_CURVE command. */ struct dmub_rb_cmd_abm_get_ace_curve { … }; /** * Definition of a DMUB_CMD__ABM_SAVE_RESTORE command. */ struct dmub_rb_cmd_abm_save_restore { … }; /** * Data passed from driver to FW in a DMUB_CMD__ABM_SET_EVENT command. */ struct dmub_cmd_abm_set_event_data { … }; /** * Definition of a DMUB_CMD__ABM_SET_EVENT command. */ struct dmub_rb_cmd_abm_set_event { … }; /** * Data passed from driver to FW in a DMUB_CMD__QUERY_FEATURE_CAPS command. */ struct dmub_cmd_query_feature_caps_data { … }; /** * Definition of a DMUB_CMD__QUERY_FEATURE_CAPS command. */ struct dmub_rb_cmd_query_feature_caps { … }; /** * Data passed from driver to FW in a DMUB_CMD__GET_VISUAL_CONFIRM_COLOR command. */ struct dmub_cmd_visual_confirm_color_data { … }; /** * Definition of a DMUB_CMD__GET_VISUAL_CONFIRM_COLOR command. */ struct dmub_rb_cmd_get_visual_confirm_color { … }; /** * enum dmub_cmd_panel_cntl_type - Panel control command. */ enum dmub_cmd_panel_cntl_type { … }; /** * struct dmub_cmd_panel_cntl_data - Panel control data. */ struct dmub_cmd_panel_cntl_data { … }; /** * struct dmub_rb_cmd_panel_cntl - Panel control command. */ struct dmub_rb_cmd_panel_cntl { … }; struct dmub_optc_state { … }; struct dmub_rb_cmd_drr_update { … }; struct dmub_cmd_fw_assisted_mclk_switch_pipe_data { … }; struct dmub_cmd_fw_assisted_mclk_switch_config { … }; struct dmub_rb_cmd_fw_assisted_mclk_switch { … }; /** * Data passed from driver to FW in a DMUB_CMD__VBIOS_LVTMA_CONTROL command. */ struct dmub_cmd_lvtma_control_data { … }; /** * Definition of a DMUB_CMD__VBIOS_LVTMA_CONTROL command. */ struct dmub_rb_cmd_lvtma_control { … }; /** * Data passed in/out in a DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT command. */ struct dmub_rb_cmd_transmitter_query_dp_alt_data { … }; /** * Definition of a DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT command. */ struct dmub_rb_cmd_transmitter_query_dp_alt { … }; struct phy_test_mode { … }; /** * Data passed in/out in a DMUB_CMD__VBIOS_TRANSMITTER_SET_PHY_FSM command. */ struct dmub_rb_cmd_transmitter_set_phy_fsm_data { … }; /** * Definition of a DMUB_CMD__VBIOS_TRANSMITTER_SET_PHY_FSM command. */ struct dmub_rb_cmd_transmitter_set_phy_fsm { … }; /** * Maximum number of bytes a chunk sent to DMUB for parsing */ #define DMUB_EDID_CEA_DATA_CHUNK_BYTES … /** * Represent a chunk of CEA blocks sent to DMUB for parsing */ struct dmub_cmd_send_edid_cea { … }; /** * Result of VSDB parsing from CEA block */ struct dmub_cmd_edid_cea_amd_vsdb { … }; /** * Result of sending a CEA chunk */ struct dmub_cmd_edid_cea_ack { … }; /** * Specify whether the result is an ACK/NACK or the parsing has finished */ enum dmub_cmd_edid_cea_reply_type { … }; /** * Definition of a DMUB_CMD__EDID_CEA command. */ struct dmub_rb_cmd_edid_cea { … }; /** * struct dmub_cmd_cable_id_input - Defines the input of DMUB_CMD_GET_USBC_CABLE_ID command. */ struct dmub_cmd_cable_id_input { … }; /** * struct dmub_cmd_cable_id_input - Defines the output of DMUB_CMD_GET_USBC_CABLE_ID command. */ struct dmub_cmd_cable_id_output { … }; /** * Definition of a DMUB_CMD_GET_USBC_CABLE_ID command */ struct dmub_rb_cmd_get_usbc_cable_id { … }; /** * Command type of a DMUB_CMD__SECURE_DISPLAY command */ enum dmub_cmd_secure_display_type { … }; /** * Definition of a DMUB_CMD__SECURE_DISPLAY command */ struct dmub_rb_cmd_secure_display { … }; /** * Command type of a DMUB_CMD__PSP command */ enum dmub_cmd_psp_type { … }; /** * Data passed from driver to FW in a DMUB_CMD__PSP_ASSR_ENABLE command. */ struct dmub_cmd_assr_enable_data { … }; /** * Definition of a DMUB_CMD__PSP_ASSR_ENABLE command. */ struct dmub_rb_cmd_assr_enable { … }; /** * union dmub_rb_cmd - DMUB inbox command. */ dmub_rb_cmd; /** * union dmub_rb_out_cmd - Outbox command */ dmub_rb_out_cmd; #pragma pack(pop) //============================================================================== //</DMUB_CMD>=================================================================== //============================================================================== //< DMUB_RB>==================================================================== //============================================================================== /** * struct dmub_rb_init_params - Initialization params for DMUB ringbuffer */ struct dmub_rb_init_params { … }; /** * struct dmub_rb - Inbox or outbox DMUB ringbuffer */ struct dmub_rb { … }; /** * @brief Checks if the ringbuffer is empty. * * @param rb DMUB Ringbuffer * @return true if empty * @return false otherwise */ static inline bool dmub_rb_empty(struct dmub_rb *rb) { … } /** * @brief Checks if the ringbuffer is full * * @param rb DMUB Ringbuffer * @return true if full * @return false otherwise */ static inline bool dmub_rb_full(struct dmub_rb *rb) { … } /** * @brief Pushes a command into the ringbuffer * * @param rb DMUB ringbuffer * @param cmd The command to push * @return true if the ringbuffer was not full * @return false otherwise */ static inline bool dmub_rb_push_front(struct dmub_rb *rb, const union dmub_rb_cmd *cmd) { … } /** * @brief Pushes a command into the DMUB outbox ringbuffer * * @param rb DMUB outbox ringbuffer * @param cmd Outbox command * @return true if not full * @return false otherwise */ static inline bool dmub_rb_out_push_front(struct dmub_rb *rb, const union dmub_rb_out_cmd *cmd) { … } /** * @brief Returns the next unprocessed command in the ringbuffer. * * @param rb DMUB ringbuffer * @param cmd The command to return * @return true if not empty * @return false otherwise */ static inline bool dmub_rb_front(struct dmub_rb *rb, union dmub_rb_cmd **cmd) { … } /** * @brief Determines the next ringbuffer offset. * * @param rb DMUB inbox ringbuffer * @param num_cmds Number of commands * @param next_rptr The next offset in the ringbuffer */ static inline void dmub_rb_get_rptr_with_offset(struct dmub_rb *rb, uint32_t num_cmds, uint32_t *next_rptr) { … } /** * @brief Returns a pointer to a command in the inbox. * * @param rb DMUB inbox ringbuffer * @param cmd The inbox command to return * @param rptr The ringbuffer offset * @return true if not empty * @return false otherwise */ static inline bool dmub_rb_peek_offset(struct dmub_rb *rb, union dmub_rb_cmd **cmd, uint32_t rptr) { … } /** * @brief Returns the next unprocessed command in the outbox. * * @param rb DMUB outbox ringbuffer * @param cmd The outbox command to return * @return true if not empty * @return false otherwise */ static inline bool dmub_rb_out_front(struct dmub_rb *rb, union dmub_rb_out_cmd *cmd) { … } /** * @brief Removes the front entry in the ringbuffer. * * @param rb DMUB ringbuffer * @return true if the command was removed * @return false if there were no commands */ static inline bool dmub_rb_pop_front(struct dmub_rb *rb) { … } /** * @brief Flushes commands in the ringbuffer to framebuffer memory. * * Avoids a race condition where DMCUB accesses memory while * there are still writes in flight to framebuffer. * * @param rb DMUB ringbuffer */ static inline void dmub_rb_flush_pending(const struct dmub_rb *rb) { … } /** * @brief Initializes a DMCUB ringbuffer * * @param rb DMUB ringbuffer * @param init_params initial configuration for the ringbuffer */ static inline void dmub_rb_init(struct dmub_rb *rb, struct dmub_rb_init_params *init_params) { … } /** * @brief Copies output data from in/out commands into the given command. * * @param rb DMUB ringbuffer * @param cmd Command to copy data into */ static inline void dmub_rb_get_return_data(struct dmub_rb *rb, union dmub_rb_cmd *cmd) { … } //============================================================================== //</DMUB_RB>==================================================================== //============================================================================== #endif /* _DMUB_CMD_H_ */