Home | History | Annotate | Line # | Download | only in amdgpu
      1  1.1  riastrad /*	$NetBSD: amdgpu_ucode.h,v 1.3 2021/12/18 23:44:58 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2012 Advanced Micro Devices, Inc.
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     14  1.1  riastrad  * all copies or substantial portions of the Software.
     15  1.1  riastrad  *
     16  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  1.1  riastrad  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  1.1  riastrad  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  1.1  riastrad  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  1.1  riastrad  * OTHER DEALINGS IN THE SOFTWARE.
     23  1.1  riastrad  *
     24  1.1  riastrad  */
     25  1.1  riastrad #ifndef __AMDGPU_UCODE_H__
     26  1.1  riastrad #define __AMDGPU_UCODE_H__
     27  1.1  riastrad 
     28  1.3  riastrad #include "amdgpu_socbb.h"
     29  1.3  riastrad 
     30  1.1  riastrad struct common_firmware_header {
     31  1.1  riastrad 	uint32_t size_bytes; /* size of the entire header+image(s) in bytes */
     32  1.1  riastrad 	uint32_t header_size_bytes; /* size of just the header in bytes */
     33  1.1  riastrad 	uint16_t header_version_major; /* header version */
     34  1.1  riastrad 	uint16_t header_version_minor; /* header version */
     35  1.1  riastrad 	uint16_t ip_version_major; /* IP version */
     36  1.1  riastrad 	uint16_t ip_version_minor; /* IP version */
     37  1.1  riastrad 	uint32_t ucode_version;
     38  1.1  riastrad 	uint32_t ucode_size_bytes; /* size of ucode in bytes */
     39  1.1  riastrad 	uint32_t ucode_array_offset_bytes; /* payload offset from the start of the header */
     40  1.1  riastrad 	uint32_t crc32;  /* crc32 checksum of the payload */
     41  1.1  riastrad };
     42  1.1  riastrad 
     43  1.1  riastrad /* version_major=1, version_minor=0 */
     44  1.1  riastrad struct mc_firmware_header_v1_0 {
     45  1.1  riastrad 	struct common_firmware_header header;
     46  1.1  riastrad 	uint32_t io_debug_size_bytes; /* size of debug array in dwords */
     47  1.1  riastrad 	uint32_t io_debug_array_offset_bytes; /* payload offset from the start of the header */
     48  1.1  riastrad };
     49  1.1  riastrad 
     50  1.1  riastrad /* version_major=1, version_minor=0 */
     51  1.1  riastrad struct smc_firmware_header_v1_0 {
     52  1.1  riastrad 	struct common_firmware_header header;
     53  1.1  riastrad 	uint32_t ucode_start_addr;
     54  1.1  riastrad };
     55  1.1  riastrad 
     56  1.3  riastrad /* version_major=2, version_minor=0 */
     57  1.3  riastrad struct smc_firmware_header_v2_0 {
     58  1.3  riastrad 	struct smc_firmware_header_v1_0 v1_0;
     59  1.3  riastrad 	uint32_t ppt_offset_bytes; /* soft pptable offset */
     60  1.3  riastrad 	uint32_t ppt_size_bytes; /* soft pptable size */
     61  1.3  riastrad };
     62  1.3  riastrad 
     63  1.3  riastrad struct smc_soft_pptable_entry {
     64  1.3  riastrad         uint32_t id;
     65  1.3  riastrad         uint32_t ppt_offset_bytes;
     66  1.3  riastrad         uint32_t ppt_size_bytes;
     67  1.3  riastrad };
     68  1.3  riastrad 
     69  1.3  riastrad /* version_major=2, version_minor=1 */
     70  1.3  riastrad struct smc_firmware_header_v2_1 {
     71  1.3  riastrad         struct smc_firmware_header_v1_0 v1_0;
     72  1.3  riastrad         uint32_t pptable_count;
     73  1.3  riastrad         uint32_t pptable_entry_offset;
     74  1.3  riastrad };
     75  1.3  riastrad 
     76  1.3  riastrad /* version_major=1, version_minor=0 */
     77  1.3  riastrad struct psp_firmware_header_v1_0 {
     78  1.3  riastrad 	struct common_firmware_header header;
     79  1.3  riastrad 	uint32_t ucode_feature_version;
     80  1.3  riastrad 	uint32_t sos_offset_bytes;
     81  1.3  riastrad 	uint32_t sos_size_bytes;
     82  1.3  riastrad };
     83  1.3  riastrad 
     84  1.3  riastrad /* version_major=1, version_minor=1 */
     85  1.3  riastrad struct psp_firmware_header_v1_1 {
     86  1.3  riastrad 	struct psp_firmware_header_v1_0 v1_0;
     87  1.3  riastrad 	uint32_t toc_header_version;
     88  1.3  riastrad 	uint32_t toc_offset_bytes;
     89  1.3  riastrad 	uint32_t toc_size_bytes;
     90  1.3  riastrad 	uint32_t kdb_header_version;
     91  1.3  riastrad 	uint32_t kdb_offset_bytes;
     92  1.3  riastrad 	uint32_t kdb_size_bytes;
     93  1.3  riastrad };
     94  1.3  riastrad 
     95  1.3  riastrad /* version_major=1, version_minor=2 */
     96  1.3  riastrad struct psp_firmware_header_v1_2 {
     97  1.3  riastrad 	struct psp_firmware_header_v1_0 v1_0;
     98  1.3  riastrad 	uint32_t reserve[3];
     99  1.3  riastrad 	uint32_t kdb_header_version;
    100  1.3  riastrad 	uint32_t kdb_offset_bytes;
    101  1.3  riastrad 	uint32_t kdb_size_bytes;
    102  1.3  riastrad };
    103  1.3  riastrad 
    104  1.3  riastrad /* version_major=1, version_minor=0 */
    105  1.3  riastrad struct ta_firmware_header_v1_0 {
    106  1.3  riastrad 	struct common_firmware_header header;
    107  1.3  riastrad 	uint32_t ta_xgmi_ucode_version;
    108  1.3  riastrad 	uint32_t ta_xgmi_offset_bytes;
    109  1.3  riastrad 	uint32_t ta_xgmi_size_bytes;
    110  1.3  riastrad 	uint32_t ta_ras_ucode_version;
    111  1.3  riastrad 	uint32_t ta_ras_offset_bytes;
    112  1.3  riastrad 	uint32_t ta_ras_size_bytes;
    113  1.3  riastrad 	uint32_t ta_hdcp_ucode_version;
    114  1.3  riastrad 	uint32_t ta_hdcp_offset_bytes;
    115  1.3  riastrad 	uint32_t ta_hdcp_size_bytes;
    116  1.3  riastrad 	uint32_t ta_dtm_ucode_version;
    117  1.3  riastrad 	uint32_t ta_dtm_offset_bytes;
    118  1.3  riastrad 	uint32_t ta_dtm_size_bytes;
    119  1.3  riastrad };
    120  1.3  riastrad 
    121  1.1  riastrad /* version_major=1, version_minor=0 */
    122  1.1  riastrad struct gfx_firmware_header_v1_0 {
    123  1.1  riastrad 	struct common_firmware_header header;
    124  1.1  riastrad 	uint32_t ucode_feature_version;
    125  1.1  riastrad 	uint32_t jt_offset; /* jt location */
    126  1.1  riastrad 	uint32_t jt_size;  /* size of jt */
    127  1.1  riastrad };
    128  1.1  riastrad 
    129  1.1  riastrad /* version_major=1, version_minor=0 */
    130  1.3  riastrad struct mes_firmware_header_v1_0 {
    131  1.3  riastrad 	struct common_firmware_header header;
    132  1.3  riastrad 	uint32_t mes_ucode_version;
    133  1.3  riastrad 	uint32_t mes_ucode_size_bytes;
    134  1.3  riastrad 	uint32_t mes_ucode_offset_bytes;
    135  1.3  riastrad 	uint32_t mes_ucode_data_version;
    136  1.3  riastrad 	uint32_t mes_ucode_data_size_bytes;
    137  1.3  riastrad 	uint32_t mes_ucode_data_offset_bytes;
    138  1.3  riastrad 	uint32_t mes_uc_start_addr_lo;
    139  1.3  riastrad 	uint32_t mes_uc_start_addr_hi;
    140  1.3  riastrad 	uint32_t mes_data_start_addr_lo;
    141  1.3  riastrad 	uint32_t mes_data_start_addr_hi;
    142  1.3  riastrad };
    143  1.3  riastrad 
    144  1.3  riastrad /* version_major=1, version_minor=0 */
    145  1.1  riastrad struct rlc_firmware_header_v1_0 {
    146  1.1  riastrad 	struct common_firmware_header header;
    147  1.1  riastrad 	uint32_t ucode_feature_version;
    148  1.1  riastrad 	uint32_t save_and_restore_offset;
    149  1.1  riastrad 	uint32_t clear_state_descriptor_offset;
    150  1.1  riastrad 	uint32_t avail_scratch_ram_locations;
    151  1.1  riastrad 	uint32_t master_pkt_description_offset;
    152  1.1  riastrad };
    153  1.1  riastrad 
    154  1.1  riastrad /* version_major=2, version_minor=0 */
    155  1.1  riastrad struct rlc_firmware_header_v2_0 {
    156  1.1  riastrad 	struct common_firmware_header header;
    157  1.1  riastrad 	uint32_t ucode_feature_version;
    158  1.1  riastrad 	uint32_t jt_offset; /* jt location */
    159  1.1  riastrad 	uint32_t jt_size;  /* size of jt */
    160  1.1  riastrad 	uint32_t save_and_restore_offset;
    161  1.1  riastrad 	uint32_t clear_state_descriptor_offset;
    162  1.1  riastrad 	uint32_t avail_scratch_ram_locations;
    163  1.1  riastrad 	uint32_t reg_restore_list_size;
    164  1.1  riastrad 	uint32_t reg_list_format_start;
    165  1.1  riastrad 	uint32_t reg_list_format_separate_start;
    166  1.1  riastrad 	uint32_t starting_offsets_start;
    167  1.1  riastrad 	uint32_t reg_list_format_size_bytes; /* size of reg list format array in bytes */
    168  1.1  riastrad 	uint32_t reg_list_format_array_offset_bytes; /* payload offset from the start of the header */
    169  1.1  riastrad 	uint32_t reg_list_size_bytes; /* size of reg list array in bytes */
    170  1.1  riastrad 	uint32_t reg_list_array_offset_bytes; /* payload offset from the start of the header */
    171  1.1  riastrad 	uint32_t reg_list_format_separate_size_bytes; /* size of reg list format array in bytes */
    172  1.1  riastrad 	uint32_t reg_list_format_separate_array_offset_bytes; /* payload offset from the start of the header */
    173  1.1  riastrad 	uint32_t reg_list_separate_size_bytes; /* size of reg list array in bytes */
    174  1.1  riastrad 	uint32_t reg_list_separate_array_offset_bytes; /* payload offset from the start of the header */
    175  1.1  riastrad };
    176  1.1  riastrad 
    177  1.3  riastrad /* version_major=2, version_minor=1 */
    178  1.3  riastrad struct rlc_firmware_header_v2_1 {
    179  1.3  riastrad 	struct rlc_firmware_header_v2_0 v2_0;
    180  1.3  riastrad 	uint32_t reg_list_format_direct_reg_list_length; /* length of direct reg list format array */
    181  1.3  riastrad 	uint32_t save_restore_list_cntl_ucode_ver;
    182  1.3  riastrad 	uint32_t save_restore_list_cntl_feature_ver;
    183  1.3  riastrad 	uint32_t save_restore_list_cntl_size_bytes;
    184  1.3  riastrad 	uint32_t save_restore_list_cntl_offset_bytes;
    185  1.3  riastrad 	uint32_t save_restore_list_gpm_ucode_ver;
    186  1.3  riastrad 	uint32_t save_restore_list_gpm_feature_ver;
    187  1.3  riastrad 	uint32_t save_restore_list_gpm_size_bytes;
    188  1.3  riastrad 	uint32_t save_restore_list_gpm_offset_bytes;
    189  1.3  riastrad 	uint32_t save_restore_list_srm_ucode_ver;
    190  1.3  riastrad 	uint32_t save_restore_list_srm_feature_ver;
    191  1.3  riastrad 	uint32_t save_restore_list_srm_size_bytes;
    192  1.3  riastrad 	uint32_t save_restore_list_srm_offset_bytes;
    193  1.3  riastrad };
    194  1.3  riastrad 
    195  1.1  riastrad /* version_major=1, version_minor=0 */
    196  1.1  riastrad struct sdma_firmware_header_v1_0 {
    197  1.1  riastrad 	struct common_firmware_header header;
    198  1.1  riastrad 	uint32_t ucode_feature_version;
    199  1.1  riastrad 	uint32_t ucode_change_version;
    200  1.1  riastrad 	uint32_t jt_offset; /* jt location */
    201  1.1  riastrad 	uint32_t jt_size; /* size of jt */
    202  1.1  riastrad };
    203  1.1  riastrad 
    204  1.1  riastrad /* version_major=1, version_minor=1 */
    205  1.1  riastrad struct sdma_firmware_header_v1_1 {
    206  1.1  riastrad 	struct sdma_firmware_header_v1_0 v1_0;
    207  1.1  riastrad 	uint32_t digest_size;
    208  1.1  riastrad };
    209  1.1  riastrad 
    210  1.3  riastrad /* gpu info payload */
    211  1.3  riastrad struct gpu_info_firmware_v1_0 {
    212  1.3  riastrad 	uint32_t gc_num_se;
    213  1.3  riastrad 	uint32_t gc_num_cu_per_sh;
    214  1.3  riastrad 	uint32_t gc_num_sh_per_se;
    215  1.3  riastrad 	uint32_t gc_num_rb_per_se;
    216  1.3  riastrad 	uint32_t gc_num_tccs;
    217  1.3  riastrad 	uint32_t gc_num_gprs;
    218  1.3  riastrad 	uint32_t gc_num_max_gs_thds;
    219  1.3  riastrad 	uint32_t gc_gs_table_depth;
    220  1.3  riastrad 	uint32_t gc_gsprim_buff_depth;
    221  1.3  riastrad 	uint32_t gc_parameter_cache_depth;
    222  1.3  riastrad 	uint32_t gc_double_offchip_lds_buffer;
    223  1.3  riastrad 	uint32_t gc_wave_size;
    224  1.3  riastrad 	uint32_t gc_max_waves_per_simd;
    225  1.3  riastrad 	uint32_t gc_max_scratch_slots_per_cu;
    226  1.3  riastrad 	uint32_t gc_lds_size;
    227  1.3  riastrad };
    228  1.3  riastrad 
    229  1.3  riastrad struct gpu_info_firmware_v1_1 {
    230  1.3  riastrad 	struct gpu_info_firmware_v1_0 v1_0;
    231  1.3  riastrad 	uint32_t num_sc_per_sh;
    232  1.3  riastrad 	uint32_t num_packer_per_sc;
    233  1.3  riastrad };
    234  1.3  riastrad 
    235  1.3  riastrad /* gpu info payload
    236  1.3  riastrad  * version_major=1, version_minor=1 */
    237  1.3  riastrad struct gpu_info_firmware_v1_2 {
    238  1.3  riastrad 	struct gpu_info_firmware_v1_1 v1_1;
    239  1.3  riastrad 	struct gpu_info_soc_bounding_box_v1_0 soc_bounding_box;
    240  1.3  riastrad };
    241  1.3  riastrad 
    242  1.3  riastrad /* version_major=1, version_minor=0 */
    243  1.3  riastrad struct gpu_info_firmware_header_v1_0 {
    244  1.3  riastrad 	struct common_firmware_header header;
    245  1.3  riastrad 	uint16_t version_major; /* version */
    246  1.3  riastrad 	uint16_t version_minor; /* version */
    247  1.3  riastrad };
    248  1.3  riastrad 
    249  1.3  riastrad /* version_major=1, version_minor=0 */
    250  1.3  riastrad struct dmcu_firmware_header_v1_0 {
    251  1.3  riastrad 	struct common_firmware_header header;
    252  1.3  riastrad 	uint32_t intv_offset_bytes; /* interrupt vectors offset from end of header, in bytes */
    253  1.3  riastrad 	uint32_t intv_size_bytes;  /* size of interrupt vectors, in bytes */
    254  1.3  riastrad };
    255  1.3  riastrad 
    256  1.3  riastrad /* version_major=1, version_minor=0 */
    257  1.3  riastrad struct dmcub_firmware_header_v1_0 {
    258  1.3  riastrad 	struct common_firmware_header header;
    259  1.3  riastrad 	uint32_t inst_const_bytes; /* size of instruction region, in bytes */
    260  1.3  riastrad 	uint32_t bss_data_bytes; /* size of bss/data region, in bytes */
    261  1.3  riastrad };
    262  1.3  riastrad 
    263  1.1  riastrad /* header is fixed size */
    264  1.1  riastrad union amdgpu_firmware_header {
    265  1.1  riastrad 	struct common_firmware_header common;
    266  1.1  riastrad 	struct mc_firmware_header_v1_0 mc;
    267  1.1  riastrad 	struct smc_firmware_header_v1_0 smc;
    268  1.3  riastrad 	struct smc_firmware_header_v2_0 smc_v2_0;
    269  1.3  riastrad 	struct psp_firmware_header_v1_0 psp;
    270  1.3  riastrad 	struct psp_firmware_header_v1_1 psp_v1_1;
    271  1.3  riastrad 	struct ta_firmware_header_v1_0 ta;
    272  1.1  riastrad 	struct gfx_firmware_header_v1_0 gfx;
    273  1.1  riastrad 	struct rlc_firmware_header_v1_0 rlc;
    274  1.1  riastrad 	struct rlc_firmware_header_v2_0 rlc_v2_0;
    275  1.3  riastrad 	struct rlc_firmware_header_v2_1 rlc_v2_1;
    276  1.1  riastrad 	struct sdma_firmware_header_v1_0 sdma;
    277  1.1  riastrad 	struct sdma_firmware_header_v1_1 sdma_v1_1;
    278  1.3  riastrad 	struct gpu_info_firmware_header_v1_0 gpu_info;
    279  1.3  riastrad 	struct dmcu_firmware_header_v1_0 dmcu;
    280  1.3  riastrad 	struct dmcub_firmware_header_v1_0 dmcub;
    281  1.1  riastrad 	uint8_t raw[0x100];
    282  1.1  riastrad };
    283  1.1  riastrad 
    284  1.1  riastrad /*
    285  1.1  riastrad  * fw loading support
    286  1.1  riastrad  */
    287  1.1  riastrad enum AMDGPU_UCODE_ID {
    288  1.1  riastrad 	AMDGPU_UCODE_ID_SDMA0 = 0,
    289  1.1  riastrad 	AMDGPU_UCODE_ID_SDMA1,
    290  1.3  riastrad 	AMDGPU_UCODE_ID_SDMA2,
    291  1.3  riastrad 	AMDGPU_UCODE_ID_SDMA3,
    292  1.3  riastrad 	AMDGPU_UCODE_ID_SDMA4,
    293  1.3  riastrad 	AMDGPU_UCODE_ID_SDMA5,
    294  1.3  riastrad 	AMDGPU_UCODE_ID_SDMA6,
    295  1.3  riastrad 	AMDGPU_UCODE_ID_SDMA7,
    296  1.1  riastrad 	AMDGPU_UCODE_ID_CP_CE,
    297  1.1  riastrad 	AMDGPU_UCODE_ID_CP_PFP,
    298  1.1  riastrad 	AMDGPU_UCODE_ID_CP_ME,
    299  1.1  riastrad 	AMDGPU_UCODE_ID_CP_MEC1,
    300  1.3  riastrad 	AMDGPU_UCODE_ID_CP_MEC1_JT,
    301  1.1  riastrad 	AMDGPU_UCODE_ID_CP_MEC2,
    302  1.3  riastrad 	AMDGPU_UCODE_ID_CP_MEC2_JT,
    303  1.3  riastrad 	AMDGPU_UCODE_ID_CP_MES,
    304  1.3  riastrad 	AMDGPU_UCODE_ID_CP_MES_DATA,
    305  1.3  riastrad 	AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL,
    306  1.3  riastrad 	AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM,
    307  1.3  riastrad 	AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM,
    308  1.1  riastrad 	AMDGPU_UCODE_ID_RLC_G,
    309  1.3  riastrad 	AMDGPU_UCODE_ID_STORAGE,
    310  1.3  riastrad 	AMDGPU_UCODE_ID_SMC,
    311  1.3  riastrad 	AMDGPU_UCODE_ID_UVD,
    312  1.3  riastrad 	AMDGPU_UCODE_ID_UVD1,
    313  1.3  riastrad 	AMDGPU_UCODE_ID_VCE,
    314  1.3  riastrad 	AMDGPU_UCODE_ID_VCN,
    315  1.3  riastrad 	AMDGPU_UCODE_ID_VCN1,
    316  1.3  riastrad 	AMDGPU_UCODE_ID_DMCU_ERAM,
    317  1.3  riastrad 	AMDGPU_UCODE_ID_DMCU_INTV,
    318  1.3  riastrad 	AMDGPU_UCODE_ID_VCN0_RAM,
    319  1.3  riastrad 	AMDGPU_UCODE_ID_VCN1_RAM,
    320  1.3  riastrad 	AMDGPU_UCODE_ID_DMCUB,
    321  1.1  riastrad 	AMDGPU_UCODE_ID_MAXIMUM,
    322  1.1  riastrad };
    323  1.1  riastrad 
    324  1.1  riastrad /* engine firmware status */
    325  1.1  riastrad enum AMDGPU_UCODE_STATUS {
    326  1.1  riastrad 	AMDGPU_UCODE_STATUS_INVALID,
    327  1.1  riastrad 	AMDGPU_UCODE_STATUS_NOT_LOADED,
    328  1.1  riastrad 	AMDGPU_UCODE_STATUS_LOADED,
    329  1.1  riastrad };
    330  1.1  riastrad 
    331  1.3  riastrad enum amdgpu_firmware_load_type {
    332  1.3  riastrad 	AMDGPU_FW_LOAD_DIRECT = 0,
    333  1.3  riastrad 	AMDGPU_FW_LOAD_SMU,
    334  1.3  riastrad 	AMDGPU_FW_LOAD_PSP,
    335  1.3  riastrad 	AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO,
    336  1.3  riastrad };
    337  1.3  riastrad 
    338  1.1  riastrad /* conform to smu_ucode_xfer_cz.h */
    339  1.1  riastrad #define AMDGPU_SDMA0_UCODE_LOADED	0x00000001
    340  1.1  riastrad #define AMDGPU_SDMA1_UCODE_LOADED	0x00000002
    341  1.1  riastrad #define AMDGPU_CPCE_UCODE_LOADED	0x00000004
    342  1.1  riastrad #define AMDGPU_CPPFP_UCODE_LOADED	0x00000008
    343  1.1  riastrad #define AMDGPU_CPME_UCODE_LOADED	0x00000010
    344  1.1  riastrad #define AMDGPU_CPMEC1_UCODE_LOADED	0x00000020
    345  1.1  riastrad #define AMDGPU_CPMEC2_UCODE_LOADED	0x00000040
    346  1.1  riastrad #define AMDGPU_CPRLC_UCODE_LOADED	0x00000100
    347  1.1  riastrad 
    348  1.1  riastrad /* amdgpu firmware info */
    349  1.1  riastrad struct amdgpu_firmware_info {
    350  1.1  riastrad 	/* ucode ID */
    351  1.1  riastrad 	enum AMDGPU_UCODE_ID ucode_id;
    352  1.1  riastrad 	/* request_firmware */
    353  1.1  riastrad 	const struct firmware *fw;
    354  1.1  riastrad 	/* starting mc address */
    355  1.1  riastrad 	uint64_t mc_addr;
    356  1.1  riastrad 	/* kernel linear address */
    357  1.1  riastrad 	void *kaddr;
    358  1.3  riastrad 	/* ucode_size_bytes */
    359  1.3  riastrad 	uint32_t ucode_size;
    360  1.3  riastrad 	/* starting tmr mc address */
    361  1.3  riastrad 	uint32_t tmr_mc_addr_lo;
    362  1.3  riastrad 	uint32_t tmr_mc_addr_hi;
    363  1.3  riastrad };
    364  1.3  riastrad 
    365  1.3  riastrad struct amdgpu_firmware {
    366  1.3  riastrad 	struct amdgpu_firmware_info ucode[AMDGPU_UCODE_ID_MAXIMUM];
    367  1.3  riastrad 	enum amdgpu_firmware_load_type load_type;
    368  1.3  riastrad 	struct amdgpu_bo *fw_buf;
    369  1.3  riastrad 	unsigned int fw_size;
    370  1.3  riastrad 	unsigned int max_ucodes;
    371  1.3  riastrad 	/* firmwares are loaded by psp instead of smu from vega10 */
    372  1.3  riastrad 	const struct amdgpu_psp_funcs *funcs;
    373  1.3  riastrad 	struct amdgpu_bo *rbuf;
    374  1.3  riastrad 	struct mutex mutex;
    375  1.3  riastrad 
    376  1.3  riastrad 	/* gpu info firmware data pointer */
    377  1.3  riastrad 	const struct firmware *gpu_info_fw;
    378  1.3  riastrad 
    379  1.3  riastrad 	void *fw_buf_ptr;
    380  1.3  riastrad 	uint64_t fw_buf_mc;
    381  1.1  riastrad };
    382  1.1  riastrad 
    383  1.1  riastrad void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
    384  1.1  riastrad void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr);
    385  1.1  riastrad void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr);
    386  1.1  riastrad void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr);
    387  1.1  riastrad void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr);
    388  1.3  riastrad void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr);
    389  1.3  riastrad void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr);
    390  1.1  riastrad int amdgpu_ucode_validate(const struct firmware *fw);
    391  1.1  riastrad bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,
    392  1.1  riastrad 				uint16_t hdr_major, uint16_t hdr_minor);
    393  1.3  riastrad 
    394  1.1  riastrad int amdgpu_ucode_init_bo(struct amdgpu_device *adev);
    395  1.3  riastrad int amdgpu_ucode_create_bo(struct amdgpu_device *adev);
    396  1.3  riastrad int amdgpu_ucode_sysfs_init(struct amdgpu_device *adev);
    397  1.3  riastrad void amdgpu_ucode_free_bo(struct amdgpu_device *adev);
    398  1.3  riastrad void amdgpu_ucode_sysfs_fini(struct amdgpu_device *adev);
    399  1.3  riastrad 
    400  1.3  riastrad enum amdgpu_firmware_load_type
    401  1.3  riastrad amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type);
    402  1.1  riastrad 
    403  1.1  riastrad #endif
    404