1d38ceaf9SAlex Deucher /* 2d38ceaf9SAlex Deucher * Copyright 2012 Advanced Micro Devices, Inc. 3d38ceaf9SAlex Deucher * 4d38ceaf9SAlex Deucher * Permission is hereby granted, free of charge, to any person obtaining a 5d38ceaf9SAlex Deucher * copy of this software and associated documentation files (the "Software"), 6d38ceaf9SAlex Deucher * to deal in the Software without restriction, including without limitation 7d38ceaf9SAlex Deucher * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8d38ceaf9SAlex Deucher * and/or sell copies of the Software, and to permit persons to whom the 9d38ceaf9SAlex Deucher * Software is furnished to do so, subject to the following conditions: 10d38ceaf9SAlex Deucher * 11d38ceaf9SAlex Deucher * The above copyright notice and this permission notice shall be included in 12d38ceaf9SAlex Deucher * all copies or substantial portions of the Software. 13d38ceaf9SAlex Deucher * 14d38ceaf9SAlex Deucher * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15d38ceaf9SAlex Deucher * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16d38ceaf9SAlex Deucher * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17d38ceaf9SAlex Deucher * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18d38ceaf9SAlex Deucher * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19d38ceaf9SAlex Deucher * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20d38ceaf9SAlex Deucher * OTHER DEALINGS IN THE SOFTWARE. 21d38ceaf9SAlex Deucher * 22d38ceaf9SAlex Deucher */ 23d38ceaf9SAlex Deucher #ifndef __AMDGPU_UCODE_H__ 24d38ceaf9SAlex Deucher #define __AMDGPU_UCODE_H__ 25d38ceaf9SAlex Deucher 2657b3ec35SLeo Li #include "amdgpu_socbb.h" 2757b3ec35SLeo Li 28d38ceaf9SAlex Deucher struct common_firmware_header { 29d38ceaf9SAlex Deucher uint32_t size_bytes; /* size of the entire header+image(s) in bytes */ 30d38ceaf9SAlex Deucher uint32_t header_size_bytes; /* size of just the header in bytes */ 31d38ceaf9SAlex Deucher uint16_t header_version_major; /* header version */ 32d38ceaf9SAlex Deucher uint16_t header_version_minor; /* header version */ 33d38ceaf9SAlex Deucher uint16_t ip_version_major; /* IP version */ 34d38ceaf9SAlex Deucher uint16_t ip_version_minor; /* IP version */ 35d38ceaf9SAlex Deucher uint32_t ucode_version; 36d38ceaf9SAlex Deucher uint32_t ucode_size_bytes; /* size of ucode in bytes */ 37d38ceaf9SAlex Deucher uint32_t ucode_array_offset_bytes; /* payload offset from the start of the header */ 38d38ceaf9SAlex Deucher uint32_t crc32; /* crc32 checksum of the payload */ 39d38ceaf9SAlex Deucher }; 40d38ceaf9SAlex Deucher 41d38ceaf9SAlex Deucher /* version_major=1, version_minor=0 */ 42d38ceaf9SAlex Deucher struct mc_firmware_header_v1_0 { 43d38ceaf9SAlex Deucher struct common_firmware_header header; 44d38ceaf9SAlex Deucher uint32_t io_debug_size_bytes; /* size of debug array in dwords */ 45d38ceaf9SAlex Deucher uint32_t io_debug_array_offset_bytes; /* payload offset from the start of the header */ 46d38ceaf9SAlex Deucher }; 47d38ceaf9SAlex Deucher 48d38ceaf9SAlex Deucher /* version_major=1, version_minor=0 */ 49d38ceaf9SAlex Deucher struct smc_firmware_header_v1_0 { 50d38ceaf9SAlex Deucher struct common_firmware_header header; 51d38ceaf9SAlex Deucher uint32_t ucode_start_addr; 52d38ceaf9SAlex Deucher }; 53d38ceaf9SAlex Deucher 54336a1c82SHuang Rui /* version_major=2, version_minor=0 */ 55336a1c82SHuang Rui struct smc_firmware_header_v2_0 { 56336a1c82SHuang Rui struct smc_firmware_header_v1_0 v1_0; 57336a1c82SHuang Rui uint32_t ppt_offset_bytes; /* soft pptable offset */ 58336a1c82SHuang Rui uint32_t ppt_size_bytes; /* soft pptable size */ 59336a1c82SHuang Rui }; 60336a1c82SHuang Rui 61b55c83a7SKevin Wang struct smc_soft_pptable_entry { 62b55c83a7SKevin Wang uint32_t id; 63b55c83a7SKevin Wang uint32_t ppt_offset_bytes; 64b55c83a7SKevin Wang uint32_t ppt_size_bytes; 65b55c83a7SKevin Wang }; 66b55c83a7SKevin Wang 67b55c83a7SKevin Wang /* version_major=2, version_minor=1 */ 68b55c83a7SKevin Wang struct smc_firmware_header_v2_1 { 69b55c83a7SKevin Wang struct smc_firmware_header_v1_0 v1_0; 70b55c83a7SKevin Wang uint32_t pptable_count; 71b55c83a7SKevin Wang uint32_t pptable_entry_offset; 72b55c83a7SKevin Wang }; 73b55c83a7SKevin Wang 74f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc { 7579a0f441SJohn Clements uint32_t fw_version; 7679a0f441SJohn Clements uint32_t offset_bytes; 7779a0f441SJohn Clements uint32_t size_bytes; 7879a0f441SJohn Clements }; 7979a0f441SJohn Clements 80d38ceaf9SAlex Deucher /* version_major=1, version_minor=0 */ 81eb661113SHuang Rui struct psp_firmware_header_v1_0 { 82eb661113SHuang Rui struct common_firmware_header header; 83f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc sos; 84eb661113SHuang Rui }; 85eb661113SHuang Rui 867d0906e8SHawking Zhang /* version_major=1, version_minor=1 */ 877d0906e8SHawking Zhang struct psp_firmware_header_v1_1 { 887d0906e8SHawking Zhang struct psp_firmware_header_v1_0 v1_0; 89f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc toc; 90f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc kdb; 917d0906e8SHawking Zhang }; 927d0906e8SHawking Zhang 93dc0d9622SJohn Clements /* version_major=1, version_minor=2 */ 94dc0d9622SJohn Clements struct psp_firmware_header_v1_2 { 95dc0d9622SJohn Clements struct psp_firmware_header_v1_0 v1_0; 96f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc res; 97f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc kdb; 98dc0d9622SJohn Clements }; 99dc0d9622SJohn Clements 100390d59beSLikun Gao /* version_major=1, version_minor=3 */ 101390d59beSLikun Gao struct psp_firmware_header_v1_3 { 102390d59beSLikun Gao struct psp_firmware_header_v1_1 v1_1; 103f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc spl; 104f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc rl; 105f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc sys_drv_aux; 106f8e487ceSJohn Clements struct psp_fw_legacy_bin_desc sos_aux; 107f8e487ceSJohn Clements }; 108f8e487ceSJohn Clements 109f8e487ceSJohn Clements struct psp_fw_bin_desc { 110f8e487ceSJohn Clements uint32_t fw_type; 111f8e487ceSJohn Clements uint32_t fw_version; 112f8e487ceSJohn Clements uint32_t offset_bytes; 113f8e487ceSJohn Clements uint32_t size_bytes; 114f8e487ceSJohn Clements }; 115f8e487ceSJohn Clements 116f8e487ceSJohn Clements enum psp_fw_type { 117f8e487ceSJohn Clements PSP_FW_TYPE_UNKOWN, 118f8e487ceSJohn Clements PSP_FW_TYPE_PSP_SOS, 119f8e487ceSJohn Clements PSP_FW_TYPE_PSP_SYS_DRV, 120f8e487ceSJohn Clements PSP_FW_TYPE_PSP_KDB, 121f8e487ceSJohn Clements PSP_FW_TYPE_PSP_TOC, 122f8e487ceSJohn Clements PSP_FW_TYPE_PSP_SPL, 123f8e487ceSJohn Clements PSP_FW_TYPE_PSP_RL, 1246ff34fd6SJohn Clements PSP_FW_TYPE_PSP_SOC_DRV, 1256ff34fd6SJohn Clements PSP_FW_TYPE_PSP_INTF_DRV, 1266ff34fd6SJohn Clements PSP_FW_TYPE_PSP_DBG_DRV, 127c3db1b90SJohn Clements PSP_FW_TYPE_PSP_RAS_DRV, 1286c6acc5fSHawking Zhang PSP_FW_TYPE_PSP_IPKEYMGR_DRV, 129*98230febSHawking Zhang PSP_FW_TYPE_PSP_SPDM_DRV, 130e9ff000bSHawking Zhang PSP_FW_TYPE_MAX_INDEX, 131f8e487ceSJohn Clements }; 132f8e487ceSJohn Clements 133f8e487ceSJohn Clements /* version_major=2, version_minor=0 */ 134f8e487ceSJohn Clements struct psp_firmware_header_v2_0 { 135f8e487ceSJohn Clements struct common_firmware_header header; 136f8e487ceSJohn Clements uint32_t psp_fw_bin_count; 137f8e487ceSJohn Clements struct psp_fw_bin_desc psp_fw_bin[]; 138390d59beSLikun Gao }; 139390d59beSLikun Gao 1402778701bSLe Ma /* version_major=2, version_minor=1 */ 1412778701bSLe Ma struct psp_firmware_header_v2_1 { 1422778701bSLe Ma struct common_firmware_header header; 1432778701bSLe Ma uint32_t psp_fw_bin_count; 1442778701bSLe Ma uint32_t psp_aux_fw_bin_index; 1452778701bSLe Ma struct psp_fw_bin_desc psp_fw_bin[]; 1462778701bSLe Ma }; 1472778701bSLe Ma 148eb661113SHuang Rui /* version_major=1, version_minor=0 */ 14951e7177fSHawking Zhang struct ta_firmware_header_v1_0 { 15051e7177fSHawking Zhang struct common_firmware_header header; 1516457205cSCandice Li struct psp_fw_legacy_bin_desc xgmi; 1526457205cSCandice Li struct psp_fw_legacy_bin_desc ras; 1536457205cSCandice Li struct psp_fw_legacy_bin_desc hdcp; 1546457205cSCandice Li struct psp_fw_legacy_bin_desc dtm; 1556457205cSCandice Li struct psp_fw_legacy_bin_desc securedisplay; 15651e7177fSHawking Zhang }; 15751e7177fSHawking Zhang 158f893d74fSJohn Clements enum ta_fw_type { 159f893d74fSJohn Clements TA_FW_TYPE_UNKOWN, 160f893d74fSJohn Clements TA_FW_TYPE_PSP_ASD, 161f893d74fSJohn Clements TA_FW_TYPE_PSP_XGMI, 162f893d74fSJohn Clements TA_FW_TYPE_PSP_RAS, 163f893d74fSJohn Clements TA_FW_TYPE_PSP_HDCP, 164f893d74fSJohn Clements TA_FW_TYPE_PSP_DTM, 1658602692bSWenhui Sheng TA_FW_TYPE_PSP_RAP, 166ecaafb7bSJinzhou Su TA_FW_TYPE_PSP_SECUREDISPLAY, 167ea9d8863SLe Ma TA_FW_TYPE_PSP_XGMI_AUX, 1684d5ae731SKevin Wang TA_FW_TYPE_MAX_INDEX, 169f893d74fSJohn Clements }; 170f893d74fSJohn Clements 171f893d74fSJohn Clements /* version_major=2, version_minor=0 */ 172f893d74fSJohn Clements struct ta_firmware_header_v2_0 { 173f893d74fSJohn Clements struct common_firmware_header header; 174f893d74fSJohn Clements uint32_t ta_fw_bin_count; 175f8e487ceSJohn Clements struct psp_fw_bin_desc ta_fw_bin[]; 176f893d74fSJohn Clements }; 177f893d74fSJohn Clements 17851e7177fSHawking Zhang /* version_major=1, version_minor=0 */ 179d38ceaf9SAlex Deucher struct gfx_firmware_header_v1_0 { 180d38ceaf9SAlex Deucher struct common_firmware_header header; 181d38ceaf9SAlex Deucher uint32_t ucode_feature_version; 182d38ceaf9SAlex Deucher uint32_t jt_offset; /* jt location */ 183d38ceaf9SAlex Deucher uint32_t jt_size; /* size of jt */ 184d38ceaf9SAlex Deucher }; 185d38ceaf9SAlex Deucher 186641f053eSLikun Gao /* version_major=2, version_minor=0 */ 187641f053eSLikun Gao struct gfx_firmware_header_v2_0 { 188641f053eSLikun Gao struct common_firmware_header header; 189641f053eSLikun Gao uint32_t ucode_feature_version; 190641f053eSLikun Gao uint32_t ucode_size_bytes; 191641f053eSLikun Gao uint32_t ucode_offset_bytes; 192641f053eSLikun Gao uint32_t data_size_bytes; 193641f053eSLikun Gao uint32_t data_offset_bytes; 194641f053eSLikun Gao uint32_t ucode_start_addr_lo; 195641f053eSLikun Gao uint32_t ucode_start_addr_hi; 196641f053eSLikun Gao }; 197641f053eSLikun Gao 198d38ceaf9SAlex Deucher /* version_major=1, version_minor=0 */ 1997f785e78SJack Xiao struct mes_firmware_header_v1_0 { 2007f785e78SJack Xiao struct common_firmware_header header; 2017f785e78SJack Xiao uint32_t mes_ucode_version; 2027f785e78SJack Xiao uint32_t mes_ucode_size_bytes; 2037f785e78SJack Xiao uint32_t mes_ucode_offset_bytes; 2047f785e78SJack Xiao uint32_t mes_ucode_data_version; 2057f785e78SJack Xiao uint32_t mes_ucode_data_size_bytes; 2067f785e78SJack Xiao uint32_t mes_ucode_data_offset_bytes; 2077f785e78SJack Xiao uint32_t mes_uc_start_addr_lo; 2087f785e78SJack Xiao uint32_t mes_uc_start_addr_hi; 2097f785e78SJack Xiao uint32_t mes_data_start_addr_lo; 2107f785e78SJack Xiao uint32_t mes_data_start_addr_hi; 2117f785e78SJack Xiao }; 2127f785e78SJack Xiao 2137f785e78SJack Xiao /* version_major=1, version_minor=0 */ 214d38ceaf9SAlex Deucher struct rlc_firmware_header_v1_0 { 215d38ceaf9SAlex Deucher struct common_firmware_header header; 216d38ceaf9SAlex Deucher uint32_t ucode_feature_version; 217d38ceaf9SAlex Deucher uint32_t save_and_restore_offset; 218d38ceaf9SAlex Deucher uint32_t clear_state_descriptor_offset; 219d38ceaf9SAlex Deucher uint32_t avail_scratch_ram_locations; 220d38ceaf9SAlex Deucher uint32_t master_pkt_description_offset; 221d38ceaf9SAlex Deucher }; 222d38ceaf9SAlex Deucher 223d38ceaf9SAlex Deucher /* version_major=2, version_minor=0 */ 224d38ceaf9SAlex Deucher struct rlc_firmware_header_v2_0 { 225d38ceaf9SAlex Deucher struct common_firmware_header header; 226d38ceaf9SAlex Deucher uint32_t ucode_feature_version; 227d38ceaf9SAlex Deucher uint32_t jt_offset; /* jt location */ 228d38ceaf9SAlex Deucher uint32_t jt_size; /* size of jt */ 229d38ceaf9SAlex Deucher uint32_t save_and_restore_offset; 230d38ceaf9SAlex Deucher uint32_t clear_state_descriptor_offset; 231d38ceaf9SAlex Deucher uint32_t avail_scratch_ram_locations; 232d38ceaf9SAlex Deucher uint32_t reg_restore_list_size; 233d38ceaf9SAlex Deucher uint32_t reg_list_format_start; 234d38ceaf9SAlex Deucher uint32_t reg_list_format_separate_start; 235d38ceaf9SAlex Deucher uint32_t starting_offsets_start; 236d38ceaf9SAlex Deucher uint32_t reg_list_format_size_bytes; /* size of reg list format array in bytes */ 237d38ceaf9SAlex Deucher uint32_t reg_list_format_array_offset_bytes; /* payload offset from the start of the header */ 238d38ceaf9SAlex Deucher uint32_t reg_list_size_bytes; /* size of reg list array in bytes */ 239d38ceaf9SAlex Deucher uint32_t reg_list_array_offset_bytes; /* payload offset from the start of the header */ 240d38ceaf9SAlex Deucher uint32_t reg_list_format_separate_size_bytes; /* size of reg list format array in bytes */ 241d38ceaf9SAlex Deucher uint32_t reg_list_format_separate_array_offset_bytes; /* payload offset from the start of the header */ 242d38ceaf9SAlex Deucher uint32_t reg_list_separate_size_bytes; /* size of reg list array in bytes */ 243d38ceaf9SAlex Deucher uint32_t reg_list_separate_array_offset_bytes; /* payload offset from the start of the header */ 244d38ceaf9SAlex Deucher }; 245d38ceaf9SAlex Deucher 246d40e9b13SHuang Rui /* version_major=2, version_minor=1 */ 247d40e9b13SHuang Rui struct rlc_firmware_header_v2_1 { 248d40e9b13SHuang Rui struct rlc_firmware_header_v2_0 v2_0; 249d40e9b13SHuang Rui uint32_t reg_list_format_direct_reg_list_length; /* length of direct reg list format array */ 250d40e9b13SHuang Rui uint32_t save_restore_list_cntl_ucode_ver; 251d40e9b13SHuang Rui uint32_t save_restore_list_cntl_feature_ver; 252d40e9b13SHuang Rui uint32_t save_restore_list_cntl_size_bytes; 253d40e9b13SHuang Rui uint32_t save_restore_list_cntl_offset_bytes; 254d40e9b13SHuang Rui uint32_t save_restore_list_gpm_ucode_ver; 255d40e9b13SHuang Rui uint32_t save_restore_list_gpm_feature_ver; 256d40e9b13SHuang Rui uint32_t save_restore_list_gpm_size_bytes; 257d40e9b13SHuang Rui uint32_t save_restore_list_gpm_offset_bytes; 258d40e9b13SHuang Rui uint32_t save_restore_list_srm_ucode_ver; 259d40e9b13SHuang Rui uint32_t save_restore_list_srm_feature_ver; 260d40e9b13SHuang Rui uint32_t save_restore_list_srm_size_bytes; 261d40e9b13SHuang Rui uint32_t save_restore_list_srm_offset_bytes; 262d40e9b13SHuang Rui }; 263d40e9b13SHuang Rui 264550bb28eSLikun Gao /* version_major=2, version_minor=2 */ 265843c7eb2SLikun Gao struct rlc_firmware_header_v2_2 { 266843c7eb2SLikun Gao struct rlc_firmware_header_v2_1 v2_1; 267843c7eb2SLikun Gao uint32_t rlc_iram_ucode_size_bytes; 268843c7eb2SLikun Gao uint32_t rlc_iram_ucode_offset_bytes; 269843c7eb2SLikun Gao uint32_t rlc_dram_ucode_size_bytes; 270843c7eb2SLikun Gao uint32_t rlc_dram_ucode_offset_bytes; 271843c7eb2SLikun Gao }; 272843c7eb2SLikun Gao 273550bb28eSLikun Gao /* version_major=2, version_minor=3 */ 274550bb28eSLikun Gao struct rlc_firmware_header_v2_3 { 275550bb28eSLikun Gao struct rlc_firmware_header_v2_2 v2_2; 276ed2eee42SHawking Zhang uint32_t rlcp_ucode_version; 277ed2eee42SHawking Zhang uint32_t rlcp_ucode_feature_version; 278550bb28eSLikun Gao uint32_t rlcp_ucode_size_bytes; 279550bb28eSLikun Gao uint32_t rlcp_ucode_offset_bytes; 280ed2eee42SHawking Zhang uint32_t rlcv_ucode_version; 281ed2eee42SHawking Zhang uint32_t rlcv_ucode_feature_version; 282550bb28eSLikun Gao uint32_t rlcv_ucode_size_bytes; 283550bb28eSLikun Gao uint32_t rlcv_ucode_offset_bytes; 284550bb28eSLikun Gao }; 285550bb28eSLikun Gao 2862207efddSChengming Gui /* version_major=2, version_minor=4 */ 2872207efddSChengming Gui struct rlc_firmware_header_v2_4 { 2882207efddSChengming Gui struct rlc_firmware_header_v2_3 v2_3; 2892207efddSChengming Gui uint32_t global_tap_delays_ucode_size_bytes; 2902207efddSChengming Gui uint32_t global_tap_delays_ucode_offset_bytes; 2912207efddSChengming Gui uint32_t se0_tap_delays_ucode_size_bytes; 2922207efddSChengming Gui uint32_t se0_tap_delays_ucode_offset_bytes; 2932207efddSChengming Gui uint32_t se1_tap_delays_ucode_size_bytes; 2942207efddSChengming Gui uint32_t se1_tap_delays_ucode_offset_bytes; 2952207efddSChengming Gui uint32_t se2_tap_delays_ucode_size_bytes; 2962207efddSChengming Gui uint32_t se2_tap_delays_ucode_offset_bytes; 2972207efddSChengming Gui uint32_t se3_tap_delays_ucode_size_bytes; 2982207efddSChengming Gui uint32_t se3_tap_delays_ucode_offset_bytes; 2992207efddSChengming Gui }; 3002207efddSChengming Gui 301d38ceaf9SAlex Deucher /* version_major=1, version_minor=0 */ 302d38ceaf9SAlex Deucher struct sdma_firmware_header_v1_0 { 303d38ceaf9SAlex Deucher struct common_firmware_header header; 304d38ceaf9SAlex Deucher uint32_t ucode_feature_version; 305d38ceaf9SAlex Deucher uint32_t ucode_change_version; 306d38ceaf9SAlex Deucher uint32_t jt_offset; /* jt location */ 307d38ceaf9SAlex Deucher uint32_t jt_size; /* size of jt */ 308d38ceaf9SAlex Deucher }; 309d38ceaf9SAlex Deucher 310d38ceaf9SAlex Deucher /* version_major=1, version_minor=1 */ 311d38ceaf9SAlex Deucher struct sdma_firmware_header_v1_1 { 312d38ceaf9SAlex Deucher struct sdma_firmware_header_v1_0 v1_0; 313d38ceaf9SAlex Deucher uint32_t digest_size; 314d38ceaf9SAlex Deucher }; 315d38ceaf9SAlex Deucher 3168e070831SLikun Gao /* version_major=2, version_minor=0 */ 3178e070831SLikun Gao struct sdma_firmware_header_v2_0 { 3188e070831SLikun Gao struct common_firmware_header header; 3198e070831SLikun Gao uint32_t ucode_feature_version; 3208e070831SLikun Gao uint32_t ctx_ucode_size_bytes; /* context thread ucode size */ 3218e070831SLikun Gao uint32_t ctx_jt_offset; /* context thread jt location */ 3228e070831SLikun Gao uint32_t ctx_jt_size; /* context thread size of jt */ 3238e070831SLikun Gao uint32_t ctl_ucode_offset; 3248e070831SLikun Gao uint32_t ctl_ucode_size_bytes; /* control thread ucode size */ 3258e070831SLikun Gao uint32_t ctl_jt_offset; /* control thread jt location */ 3268e070831SLikun Gao uint32_t ctl_jt_size; /* control thread size of jt */ 3278e070831SLikun Gao }; 3288e070831SLikun Gao 329878fe051SLang Yu /* version_major=1, version_minor=0 */ 330878fe051SLang Yu struct vpe_firmware_header_v1_0 { 331878fe051SLang Yu struct common_firmware_header header; 332878fe051SLang Yu uint32_t ucode_feature_version; 333878fe051SLang Yu uint32_t ctx_ucode_size_bytes; /* context thread ucode size */ 334878fe051SLang Yu uint32_t ctx_jt_offset; /* context thread jt location */ 335878fe051SLang Yu uint32_t ctx_jt_size; /* context thread size of jt */ 336878fe051SLang Yu uint32_t ctl_ucode_offset; 337878fe051SLang Yu uint32_t ctl_ucode_size_bytes; /* control thread ucode size */ 338878fe051SLang Yu uint32_t ctl_jt_offset; /* control thread jt location */ 339878fe051SLang Yu uint32_t ctl_jt_size; /* control thread size of jt */ 340878fe051SLang Yu }; 341878fe051SLang Yu 3429c852a42SLang Yu /* version_major=1, version_minor=0 */ 3439c852a42SLang Yu struct umsch_mm_firmware_header_v1_0 { 3449c852a42SLang Yu struct common_firmware_header header; 3459c852a42SLang Yu uint32_t umsch_mm_ucode_version; 3469c852a42SLang Yu uint32_t umsch_mm_ucode_size_bytes; 3479c852a42SLang Yu uint32_t umsch_mm_ucode_offset_bytes; 3489c852a42SLang Yu uint32_t umsch_mm_ucode_data_version; 3499c852a42SLang Yu uint32_t umsch_mm_ucode_data_size_bytes; 3509c852a42SLang Yu uint32_t umsch_mm_ucode_data_offset_bytes; 3519c852a42SLang Yu uint32_t umsch_mm_irq_start_addr_lo; 3529c852a42SLang Yu uint32_t umsch_mm_irq_start_addr_hi; 3539c852a42SLang Yu uint32_t umsch_mm_uc_start_addr_lo; 3549c852a42SLang Yu uint32_t umsch_mm_uc_start_addr_hi; 3559c852a42SLang Yu uint32_t umsch_mm_data_start_addr_lo; 3569c852a42SLang Yu uint32_t umsch_mm_data_start_addr_hi; 3579c852a42SLang Yu }; 3589c852a42SLang Yu 3599989a924SLikun Gao /* version_major=3, version_minor=0 */ 3609989a924SLikun Gao struct sdma_firmware_header_v3_0 { 3619989a924SLikun Gao struct common_firmware_header header; 3629989a924SLikun Gao uint32_t ucode_feature_version; 3639989a924SLikun Gao uint32_t ucode_offset_bytes; 3649989a924SLikun Gao uint32_t ucode_size_bytes; 3659989a924SLikun Gao }; 3669989a924SLikun Gao 3678ae1a336SAlex Deucher /* gpu info payload */ 3688ae1a336SAlex Deucher struct gpu_info_firmware_v1_0 { 3698ae1a336SAlex Deucher uint32_t gc_num_se; 3708ae1a336SAlex Deucher uint32_t gc_num_cu_per_sh; 3718ae1a336SAlex Deucher uint32_t gc_num_sh_per_se; 3728ae1a336SAlex Deucher uint32_t gc_num_rb_per_se; 3738ae1a336SAlex Deucher uint32_t gc_num_tccs; 3748ae1a336SAlex Deucher uint32_t gc_num_gprs; 3758ae1a336SAlex Deucher uint32_t gc_num_max_gs_thds; 3768ae1a336SAlex Deucher uint32_t gc_gs_table_depth; 3778ae1a336SAlex Deucher uint32_t gc_gsprim_buff_depth; 3788ae1a336SAlex Deucher uint32_t gc_parameter_cache_depth; 3798ae1a336SAlex Deucher uint32_t gc_double_offchip_lds_buffer; 3808ae1a336SAlex Deucher uint32_t gc_wave_size; 38151fd0370SHawking Zhang uint32_t gc_max_waves_per_simd; 38251fd0370SHawking Zhang uint32_t gc_max_scratch_slots_per_cu; 38351fd0370SHawking Zhang uint32_t gc_lds_size; 3848ae1a336SAlex Deucher }; 3858ae1a336SAlex Deucher 386109c80ddSHawking Zhang struct gpu_info_firmware_v1_1 { 387109c80ddSHawking Zhang struct gpu_info_firmware_v1_0 v1_0; 388109c80ddSHawking Zhang uint32_t num_sc_per_sh; 389109c80ddSHawking Zhang uint32_t num_packer_per_sc; 390109c80ddSHawking Zhang }; 391109c80ddSHawking Zhang 39248321c3dSHarry Wentland /* gpu info payload 39348321c3dSHarry Wentland * version_major=1, version_minor=1 */ 39448321c3dSHarry Wentland struct gpu_info_firmware_v1_2 { 39548321c3dSHarry Wentland struct gpu_info_firmware_v1_1 v1_1; 39648321c3dSHarry Wentland struct gpu_info_soc_bounding_box_v1_0 soc_bounding_box; 39748321c3dSHarry Wentland }; 39848321c3dSHarry Wentland 3998ae1a336SAlex Deucher /* version_major=1, version_minor=0 */ 4008ae1a336SAlex Deucher struct gpu_info_firmware_header_v1_0 { 4018ae1a336SAlex Deucher struct common_firmware_header header; 4028ae1a336SAlex Deucher uint16_t version_major; /* version */ 4038ae1a336SAlex Deucher uint16_t version_minor; /* version */ 4048ae1a336SAlex Deucher }; 4058ae1a336SAlex Deucher 40601fcfc83SDavid Francis /* version_major=1, version_minor=0 */ 40701fcfc83SDavid Francis struct dmcu_firmware_header_v1_0 { 40801fcfc83SDavid Francis struct common_firmware_header header; 40901fcfc83SDavid Francis uint32_t intv_offset_bytes; /* interrupt vectors offset from end of header, in bytes */ 41001fcfc83SDavid Francis uint32_t intv_size_bytes; /* size of interrupt vectors, in bytes */ 41101fcfc83SDavid Francis }; 41201fcfc83SDavid Francis 41302350f0bSNicholas Kazlauskas /* version_major=1, version_minor=0 */ 41402350f0bSNicholas Kazlauskas struct dmcub_firmware_header_v1_0 { 41502350f0bSNicholas Kazlauskas struct common_firmware_header header; 41602350f0bSNicholas Kazlauskas uint32_t inst_const_bytes; /* size of instruction region, in bytes */ 41702350f0bSNicholas Kazlauskas uint32_t bss_data_bytes; /* size of bss/data region, in bytes */ 41802350f0bSNicholas Kazlauskas }; 41902350f0bSNicholas Kazlauskas 420d142f56eSLikun Gao /* version_major=1, version_minor=0 */ 421d142f56eSLikun Gao struct imu_firmware_header_v1_0 { 422d142f56eSLikun Gao struct common_firmware_header header; 423d142f56eSLikun Gao uint32_t imu_iram_ucode_size_bytes; 424d142f56eSLikun Gao uint32_t imu_iram_ucode_offset_bytes; 425d142f56eSLikun Gao uint32_t imu_dram_ucode_size_bytes; 426d142f56eSLikun Gao uint32_t imu_dram_ucode_offset_bytes; 427d142f56eSLikun Gao }; 428d142f56eSLikun Gao 429d38ceaf9SAlex Deucher /* header is fixed size */ 430d38ceaf9SAlex Deucher union amdgpu_firmware_header { 431d38ceaf9SAlex Deucher struct common_firmware_header common; 432d38ceaf9SAlex Deucher struct mc_firmware_header_v1_0 mc; 433d38ceaf9SAlex Deucher struct smc_firmware_header_v1_0 smc; 434336a1c82SHuang Rui struct smc_firmware_header_v2_0 smc_v2_0; 435eb661113SHuang Rui struct psp_firmware_header_v1_0 psp; 4367d0906e8SHawking Zhang struct psp_firmware_header_v1_1 psp_v1_1; 437390d59beSLikun Gao struct psp_firmware_header_v1_3 psp_v1_3; 438f8e487ceSJohn Clements struct psp_firmware_header_v2_0 psp_v2_0; 4392778701bSLe Ma struct psp_firmware_header_v2_0 psp_v2_1; 44051e7177fSHawking Zhang struct ta_firmware_header_v1_0 ta; 441f893d74fSJohn Clements struct ta_firmware_header_v2_0 ta_v2_0; 442d38ceaf9SAlex Deucher struct gfx_firmware_header_v1_0 gfx; 443641f053eSLikun Gao struct gfx_firmware_header_v2_0 gfx_v2_0; 444d38ceaf9SAlex Deucher struct rlc_firmware_header_v1_0 rlc; 445d38ceaf9SAlex Deucher struct rlc_firmware_header_v2_0 rlc_v2_0; 446d40e9b13SHuang Rui struct rlc_firmware_header_v2_1 rlc_v2_1; 447550bb28eSLikun Gao struct rlc_firmware_header_v2_2 rlc_v2_2; 448550bb28eSLikun Gao struct rlc_firmware_header_v2_3 rlc_v2_3; 449ba6d29e8SChengming Gui struct rlc_firmware_header_v2_4 rlc_v2_4; 450d38ceaf9SAlex Deucher struct sdma_firmware_header_v1_0 sdma; 451d38ceaf9SAlex Deucher struct sdma_firmware_header_v1_1 sdma_v1_1; 4528e070831SLikun Gao struct sdma_firmware_header_v2_0 sdma_v2_0; 4539989a924SLikun Gao struct sdma_firmware_header_v3_0 sdma_v3_0; 4548ae1a336SAlex Deucher struct gpu_info_firmware_header_v1_0 gpu_info; 45501fcfc83SDavid Francis struct dmcu_firmware_header_v1_0 dmcu; 45602350f0bSNicholas Kazlauskas struct dmcub_firmware_header_v1_0 dmcub; 457d142f56eSLikun Gao struct imu_firmware_header_v1_0 imu; 458d38ceaf9SAlex Deucher uint8_t raw[0x100]; 459d38ceaf9SAlex Deucher }; 460d38ceaf9SAlex Deucher 4612778701bSLe Ma #define UCODE_MAX_PSP_PACKAGING (((sizeof(union amdgpu_firmware_header) - sizeof(struct common_firmware_header) - 4) / sizeof(struct psp_fw_bin_desc)) * 2) 462f893d74fSJohn Clements 463d38ceaf9SAlex Deucher /* 464d38ceaf9SAlex Deucher * fw loading support 465d38ceaf9SAlex Deucher */ 466d38ceaf9SAlex Deucher enum AMDGPU_UCODE_ID { 467e6fac6a9SYifan Zha AMDGPU_UCODE_ID_CAP = 0, 468e6fac6a9SYifan Zha AMDGPU_UCODE_ID_SDMA0, 469d38ceaf9SAlex Deucher AMDGPU_UCODE_ID_SDMA1, 470b86f8d8bSJohn Clements AMDGPU_UCODE_ID_SDMA2, 471b86f8d8bSJohn Clements AMDGPU_UCODE_ID_SDMA3, 472b86f8d8bSJohn Clements AMDGPU_UCODE_ID_SDMA4, 473b86f8d8bSJohn Clements AMDGPU_UCODE_ID_SDMA5, 474b86f8d8bSJohn Clements AMDGPU_UCODE_ID_SDMA6, 475b86f8d8bSJohn Clements AMDGPU_UCODE_ID_SDMA7, 4764e9d10ceSLikun Gao AMDGPU_UCODE_ID_SDMA_UCODE_TH0, 4774e9d10ceSLikun Gao AMDGPU_UCODE_ID_SDMA_UCODE_TH1, 478807d90b5SLikun Gao AMDGPU_UCODE_ID_SDMA_RS64, 479d38ceaf9SAlex Deucher AMDGPU_UCODE_ID_CP_CE, 480d38ceaf9SAlex Deucher AMDGPU_UCODE_ID_CP_PFP, 481d38ceaf9SAlex Deucher AMDGPU_UCODE_ID_CP_ME, 482be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_PFP, 483be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_ME, 484be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_MEC, 485be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_PFP_P0_STACK, 486be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_PFP_P1_STACK, 487be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_ME_P0_STACK, 488be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_ME_P1_STACK, 489be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_MEC_P0_STACK, 490be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_MEC_P1_STACK, 491be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_MEC_P2_STACK, 492be3a3409SLikun Gao AMDGPU_UCODE_ID_CP_RS64_MEC_P3_STACK, 493d38ceaf9SAlex Deucher AMDGPU_UCODE_ID_CP_MEC1, 4942445b227SHuang Rui AMDGPU_UCODE_ID_CP_MEC1_JT, 495d38ceaf9SAlex Deucher AMDGPU_UCODE_ID_CP_MEC2, 4962445b227SHuang Rui AMDGPU_UCODE_ID_CP_MEC2_JT, 497186b0ca2SJack Xiao AMDGPU_UCODE_ID_CP_MES, 498186b0ca2SJack Xiao AMDGPU_UCODE_ID_CP_MES_DATA, 499d6b4014aSJack Xiao AMDGPU_UCODE_ID_CP_MES1, 500d6b4014aSJack Xiao AMDGPU_UCODE_ID_CP_MES1_DATA, 501a32fa029SLikun Gao AMDGPU_UCODE_ID_IMU_I, 502a32fa029SLikun Gao AMDGPU_UCODE_ID_IMU_D, 5032207efddSChengming Gui AMDGPU_UCODE_ID_GLOBAL_TAP_DELAYS, 5042207efddSChengming Gui AMDGPU_UCODE_ID_SE0_TAP_DELAYS, 5052207efddSChengming Gui AMDGPU_UCODE_ID_SE1_TAP_DELAYS, 5062207efddSChengming Gui AMDGPU_UCODE_ID_SE2_TAP_DELAYS, 5072207efddSChengming Gui AMDGPU_UCODE_ID_SE3_TAP_DELAYS, 508621a6318SHuang Rui AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL, 509621a6318SHuang Rui AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM, 510621a6318SHuang Rui AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM, 511843c7eb2SLikun Gao AMDGPU_UCODE_ID_RLC_IRAM, 512843c7eb2SLikun Gao AMDGPU_UCODE_ID_RLC_DRAM, 513a0fe38b4SLikun Gao AMDGPU_UCODE_ID_RLC_P, 5148e41a56aSLikun Gao AMDGPU_UCODE_ID_RLC_V, 5150753e56eSEvan Quan AMDGPU_UCODE_ID_RLC_G, 516bed5712eSMonk Liu AMDGPU_UCODE_ID_STORAGE, 5172445b227SHuang Rui AMDGPU_UCODE_ID_SMC, 518b37c41f2SEvan Quan AMDGPU_UCODE_ID_PPTABLE, 5192445b227SHuang Rui AMDGPU_UCODE_ID_UVD, 520d4e83843SEvan Quan AMDGPU_UCODE_ID_UVD1, 5212445b227SHuang Rui AMDGPU_UCODE_ID_VCE, 522c9ca9896SLikun Gao AMDGPU_UCODE_ID_VCN, 523a07d163cSJames Zhu AMDGPU_UCODE_ID_VCN1, 52401fcfc83SDavid Francis AMDGPU_UCODE_ID_DMCU_ERAM, 52501fcfc83SDavid Francis AMDGPU_UCODE_ID_DMCU_INTV, 5266e72d8e9SJack Xiao AMDGPU_UCODE_ID_VCN0_RAM, 5276e72d8e9SJack Xiao AMDGPU_UCODE_ID_VCN1_RAM, 52802350f0bSNicholas Kazlauskas AMDGPU_UCODE_ID_DMCUB, 5294c63735fSLang Yu AMDGPU_UCODE_ID_VPE_CTX, 5304c63735fSLang Yu AMDGPU_UCODE_ID_VPE_CTL, 531f9ecae9aSLang Yu AMDGPU_UCODE_ID_VPE, 5324f949033SLang Yu AMDGPU_UCODE_ID_UMSCH_MM_UCODE, 5334f949033SLang Yu AMDGPU_UCODE_ID_UMSCH_MM_DATA, 5344f949033SLang Yu AMDGPU_UCODE_ID_UMSCH_MM_CMD_BUFFER, 53579daf692SLijo Lazar AMDGPU_UCODE_ID_P2S_TABLE, 536617efef4SSaleemkhan Jamadar AMDGPU_UCODE_ID_JPEG_RAM, 5378fcbfd53SPratap Nirujogi AMDGPU_UCODE_ID_ISP, 538d38ceaf9SAlex Deucher AMDGPU_UCODE_ID_MAXIMUM, 539d38ceaf9SAlex Deucher }; 540d38ceaf9SAlex Deucher 541d38ceaf9SAlex Deucher /* engine firmware status */ 542d38ceaf9SAlex Deucher enum AMDGPU_UCODE_STATUS { 543d38ceaf9SAlex Deucher AMDGPU_UCODE_STATUS_INVALID, 544d38ceaf9SAlex Deucher AMDGPU_UCODE_STATUS_NOT_LOADED, 545d38ceaf9SAlex Deucher AMDGPU_UCODE_STATUS_LOADED, 546d38ceaf9SAlex Deucher }; 547d38ceaf9SAlex Deucher 54855560046SHuang Rui enum amdgpu_firmware_load_type { 54955560046SHuang Rui AMDGPU_FW_LOAD_DIRECT = 0, 55055560046SHuang Rui AMDGPU_FW_LOAD_PSP, 551ae2d50beSChengming Gui AMDGPU_FW_LOAD_SMU, 5524a94ba8fSHawking Zhang AMDGPU_FW_LOAD_RLC_BACKDOOR_AUTO, 55355560046SHuang Rui }; 55455560046SHuang Rui 555ea5d4934SMario Limonciello enum amdgpu_ucode_required { 556ea5d4934SMario Limonciello AMDGPU_UCODE_OPTIONAL, 557ea5d4934SMario Limonciello AMDGPU_UCODE_REQUIRED, 558ea5d4934SMario Limonciello }; 559ea5d4934SMario Limonciello 560d38ceaf9SAlex Deucher /* conform to smu_ucode_xfer_cz.h */ 561d38ceaf9SAlex Deucher #define AMDGPU_SDMA0_UCODE_LOADED 0x00000001 562d38ceaf9SAlex Deucher #define AMDGPU_SDMA1_UCODE_LOADED 0x00000002 563d38ceaf9SAlex Deucher #define AMDGPU_CPCE_UCODE_LOADED 0x00000004 564d38ceaf9SAlex Deucher #define AMDGPU_CPPFP_UCODE_LOADED 0x00000008 565d38ceaf9SAlex Deucher #define AMDGPU_CPME_UCODE_LOADED 0x00000010 566d38ceaf9SAlex Deucher #define AMDGPU_CPMEC1_UCODE_LOADED 0x00000020 567d38ceaf9SAlex Deucher #define AMDGPU_CPMEC2_UCODE_LOADED 0x00000040 568d38ceaf9SAlex Deucher #define AMDGPU_CPRLC_UCODE_LOADED 0x00000100 569d38ceaf9SAlex Deucher 570d38ceaf9SAlex Deucher /* amdgpu firmware info */ 571d38ceaf9SAlex Deucher struct amdgpu_firmware_info { 572d38ceaf9SAlex Deucher /* ucode ID */ 573d38ceaf9SAlex Deucher enum AMDGPU_UCODE_ID ucode_id; 574d38ceaf9SAlex Deucher /* request_firmware */ 575d38ceaf9SAlex Deucher const struct firmware *fw; 576d38ceaf9SAlex Deucher /* starting mc address */ 577d38ceaf9SAlex Deucher uint64_t mc_addr; 578d38ceaf9SAlex Deucher /* kernel linear address */ 579d38ceaf9SAlex Deucher void *kaddr; 580daf42c31SHuang Rui /* ucode_size_bytes */ 581daf42c31SHuang Rui uint32_t ucode_size; 582abf412b3SJames Zhu /* starting tmr mc address */ 583abf412b3SJames Zhu uint32_t tmr_mc_addr_lo; 584abf412b3SJames Zhu uint32_t tmr_mc_addr_hi; 585d38ceaf9SAlex Deucher }; 586d38ceaf9SAlex Deucher 58755560046SHuang Rui struct amdgpu_firmware { 58855560046SHuang Rui struct amdgpu_firmware_info ucode[AMDGPU_UCODE_ID_MAXIMUM]; 58955560046SHuang Rui enum amdgpu_firmware_load_type load_type; 59055560046SHuang Rui struct amdgpu_bo *fw_buf; 59155560046SHuang Rui unsigned int fw_size; 59255560046SHuang Rui unsigned int max_ucodes; 59355560046SHuang Rui /* firmwares are loaded by psp instead of smu from vega10 */ 59455560046SHuang Rui const struct amdgpu_psp_funcs *funcs; 59555560046SHuang Rui struct amdgpu_bo *rbuf; 59655560046SHuang Rui struct mutex mutex; 59755560046SHuang Rui 59855560046SHuang Rui /* gpu info firmware data pointer */ 59955560046SHuang Rui const struct firmware *gpu_info_fw; 60055560046SHuang Rui 60155560046SHuang Rui void *fw_buf_ptr; 60255560046SHuang Rui uint64_t fw_buf_mc; 60355560046SHuang Rui }; 60455560046SHuang Rui 605d38ceaf9SAlex Deucher void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr); 606d38ceaf9SAlex Deucher void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr); 607877b57c6SArthur Grillo void amdgpu_ucode_print_imu_hdr(const struct common_firmware_header *hdr); 608d38ceaf9SAlex Deucher void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr); 609d38ceaf9SAlex Deucher void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr); 610d38ceaf9SAlex Deucher void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr); 6116fa40564SHawking Zhang void amdgpu_ucode_print_psp_hdr(const struct common_firmware_header *hdr); 6128ae1a336SAlex Deucher void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr); 613ea5d4934SMario Limonciello __printf(4, 5) 6142210af50SMario Limonciello int amdgpu_ucode_request(struct amdgpu_device *adev, const struct firmware **fw, 615ea5d4934SMario Limonciello enum amdgpu_ucode_required required, const char *fmt, ...); 6162210af50SMario Limonciello void amdgpu_ucode_release(const struct firmware **fw); 617d38ceaf9SAlex Deucher bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr, 618d38ceaf9SAlex Deucher uint16_t hdr_major, uint16_t hdr_minor); 619d38ceaf9SAlex Deucher 620735f654eSRex Zhu int amdgpu_ucode_init_bo(struct amdgpu_device *adev); 621c8963ea4SRex Zhu int amdgpu_ucode_create_bo(struct amdgpu_device *adev); 6225bb23532SOri Messinger int amdgpu_ucode_sysfs_init(struct amdgpu_device *adev); 623c8963ea4SRex Zhu void amdgpu_ucode_free_bo(struct amdgpu_device *adev); 6245bb23532SOri Messinger void amdgpu_ucode_sysfs_fini(struct amdgpu_device *adev); 625c8963ea4SRex Zhu 626e635ee07SHuang Rui enum amdgpu_firmware_load_type 627e635ee07SHuang Rui amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type); 628e635ee07SHuang Rui 629aae435c6SLang Yu const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id); 630aae435c6SLang Yu 6311d5eee7dSLikun Gao void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, char *ucode_prefix, int len); 6321d5eee7dSLikun Gao 633d38ceaf9SAlex Deucher #endif 634