162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright 2012 Advanced Micro Devices, Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 1262306a36Sopenharmony_ci * all copies or substantial portions of the Software. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_ci#ifndef __RADEON_UCODE_H__ 2462306a36Sopenharmony_ci#define __RADEON_UCODE_H__ 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* CP */ 2762306a36Sopenharmony_ci#define R600_PFP_UCODE_SIZE 576 2862306a36Sopenharmony_ci#define R600_PM4_UCODE_SIZE 1792 2962306a36Sopenharmony_ci#define R700_PFP_UCODE_SIZE 848 3062306a36Sopenharmony_ci#define R700_PM4_UCODE_SIZE 1360 3162306a36Sopenharmony_ci#define EVERGREEN_PFP_UCODE_SIZE 1120 3262306a36Sopenharmony_ci#define EVERGREEN_PM4_UCODE_SIZE 1376 3362306a36Sopenharmony_ci#define CAYMAN_PFP_UCODE_SIZE 2176 3462306a36Sopenharmony_ci#define CAYMAN_PM4_UCODE_SIZE 2176 3562306a36Sopenharmony_ci#define SI_PFP_UCODE_SIZE 2144 3662306a36Sopenharmony_ci#define SI_PM4_UCODE_SIZE 2144 3762306a36Sopenharmony_ci#define SI_CE_UCODE_SIZE 2144 3862306a36Sopenharmony_ci#define CIK_PFP_UCODE_SIZE 2144 3962306a36Sopenharmony_ci#define CIK_ME_UCODE_SIZE 2144 4062306a36Sopenharmony_ci#define CIK_CE_UCODE_SIZE 2144 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/* MEC */ 4362306a36Sopenharmony_ci#define CIK_MEC_UCODE_SIZE 4192 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci/* RLC */ 4662306a36Sopenharmony_ci#define R600_RLC_UCODE_SIZE 768 4762306a36Sopenharmony_ci#define R700_RLC_UCODE_SIZE 1024 4862306a36Sopenharmony_ci#define EVERGREEN_RLC_UCODE_SIZE 768 4962306a36Sopenharmony_ci#define CAYMAN_RLC_UCODE_SIZE 1024 5062306a36Sopenharmony_ci#define ARUBA_RLC_UCODE_SIZE 1536 5162306a36Sopenharmony_ci#define SI_RLC_UCODE_SIZE 2048 5262306a36Sopenharmony_ci#define BONAIRE_RLC_UCODE_SIZE 2048 5362306a36Sopenharmony_ci#define KB_RLC_UCODE_SIZE 2560 5462306a36Sopenharmony_ci#define KV_RLC_UCODE_SIZE 2560 5562306a36Sopenharmony_ci#define ML_RLC_UCODE_SIZE 2560 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci/* MC */ 5862306a36Sopenharmony_ci#define BTC_MC_UCODE_SIZE 6024 5962306a36Sopenharmony_ci#define CAYMAN_MC_UCODE_SIZE 6037 6062306a36Sopenharmony_ci#define SI_MC_UCODE_SIZE 7769 6162306a36Sopenharmony_ci#define TAHITI_MC_UCODE_SIZE 7808 6262306a36Sopenharmony_ci#define PITCAIRN_MC_UCODE_SIZE 7775 6362306a36Sopenharmony_ci#define VERDE_MC_UCODE_SIZE 7875 6462306a36Sopenharmony_ci#define OLAND_MC_UCODE_SIZE 7863 6562306a36Sopenharmony_ci#define BONAIRE_MC_UCODE_SIZE 7866 6662306a36Sopenharmony_ci#define BONAIRE_MC2_UCODE_SIZE 7948 6762306a36Sopenharmony_ci#define HAWAII_MC_UCODE_SIZE 7933 6862306a36Sopenharmony_ci#define HAWAII_MC2_UCODE_SIZE 8091 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci/* SDMA */ 7162306a36Sopenharmony_ci#define CIK_SDMA_UCODE_SIZE 1050 7262306a36Sopenharmony_ci#define CIK_SDMA_UCODE_VERSION 64 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* SMC */ 7562306a36Sopenharmony_ci#define RV770_SMC_UCODE_START 0x0100 7662306a36Sopenharmony_ci#define RV770_SMC_UCODE_SIZE 0x410d 7762306a36Sopenharmony_ci#define RV770_SMC_INT_VECTOR_START 0xffc0 7862306a36Sopenharmony_ci#define RV770_SMC_INT_VECTOR_SIZE 0x0040 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#define RV730_SMC_UCODE_START 0x0100 8162306a36Sopenharmony_ci#define RV730_SMC_UCODE_SIZE 0x412c 8262306a36Sopenharmony_ci#define RV730_SMC_INT_VECTOR_START 0xffc0 8362306a36Sopenharmony_ci#define RV730_SMC_INT_VECTOR_SIZE 0x0040 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci#define RV710_SMC_UCODE_START 0x0100 8662306a36Sopenharmony_ci#define RV710_SMC_UCODE_SIZE 0x3f1f 8762306a36Sopenharmony_ci#define RV710_SMC_INT_VECTOR_START 0xffc0 8862306a36Sopenharmony_ci#define RV710_SMC_INT_VECTOR_SIZE 0x0040 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#define RV740_SMC_UCODE_START 0x0100 9162306a36Sopenharmony_ci#define RV740_SMC_UCODE_SIZE 0x41c5 9262306a36Sopenharmony_ci#define RV740_SMC_INT_VECTOR_START 0xffc0 9362306a36Sopenharmony_ci#define RV740_SMC_INT_VECTOR_SIZE 0x0040 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci#define CEDAR_SMC_UCODE_START 0x0100 9662306a36Sopenharmony_ci#define CEDAR_SMC_UCODE_SIZE 0x5d50 9762306a36Sopenharmony_ci#define CEDAR_SMC_INT_VECTOR_START 0xffc0 9862306a36Sopenharmony_ci#define CEDAR_SMC_INT_VECTOR_SIZE 0x0040 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#define REDWOOD_SMC_UCODE_START 0x0100 10162306a36Sopenharmony_ci#define REDWOOD_SMC_UCODE_SIZE 0x5f0a 10262306a36Sopenharmony_ci#define REDWOOD_SMC_INT_VECTOR_START 0xffc0 10362306a36Sopenharmony_ci#define REDWOOD_SMC_INT_VECTOR_SIZE 0x0040 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define JUNIPER_SMC_UCODE_START 0x0100 10662306a36Sopenharmony_ci#define JUNIPER_SMC_UCODE_SIZE 0x5f1f 10762306a36Sopenharmony_ci#define JUNIPER_SMC_INT_VECTOR_START 0xffc0 10862306a36Sopenharmony_ci#define JUNIPER_SMC_INT_VECTOR_SIZE 0x0040 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define CYPRESS_SMC_UCODE_START 0x0100 11162306a36Sopenharmony_ci#define CYPRESS_SMC_UCODE_SIZE 0x61f7 11262306a36Sopenharmony_ci#define CYPRESS_SMC_INT_VECTOR_START 0xffc0 11362306a36Sopenharmony_ci#define CYPRESS_SMC_INT_VECTOR_SIZE 0x0040 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci#define BARTS_SMC_UCODE_START 0x0100 11662306a36Sopenharmony_ci#define BARTS_SMC_UCODE_SIZE 0x6107 11762306a36Sopenharmony_ci#define BARTS_SMC_INT_VECTOR_START 0xffc0 11862306a36Sopenharmony_ci#define BARTS_SMC_INT_VECTOR_SIZE 0x0040 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define TURKS_SMC_UCODE_START 0x0100 12162306a36Sopenharmony_ci#define TURKS_SMC_UCODE_SIZE 0x605b 12262306a36Sopenharmony_ci#define TURKS_SMC_INT_VECTOR_START 0xffc0 12362306a36Sopenharmony_ci#define TURKS_SMC_INT_VECTOR_SIZE 0x0040 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#define CAICOS_SMC_UCODE_START 0x0100 12662306a36Sopenharmony_ci#define CAICOS_SMC_UCODE_SIZE 0x5fbd 12762306a36Sopenharmony_ci#define CAICOS_SMC_INT_VECTOR_START 0xffc0 12862306a36Sopenharmony_ci#define CAICOS_SMC_INT_VECTOR_SIZE 0x0040 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci#define CAYMAN_SMC_UCODE_START 0x0100 13162306a36Sopenharmony_ci#define CAYMAN_SMC_UCODE_SIZE 0x79ec 13262306a36Sopenharmony_ci#define CAYMAN_SMC_INT_VECTOR_START 0xffc0 13362306a36Sopenharmony_ci#define CAYMAN_SMC_INT_VECTOR_SIZE 0x0040 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci#define TAHITI_SMC_UCODE_START 0x10000 13662306a36Sopenharmony_ci#define TAHITI_SMC_UCODE_SIZE 0xf458 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define PITCAIRN_SMC_UCODE_START 0x10000 13962306a36Sopenharmony_ci#define PITCAIRN_SMC_UCODE_SIZE 0xe9f4 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci#define VERDE_SMC_UCODE_START 0x10000 14262306a36Sopenharmony_ci#define VERDE_SMC_UCODE_SIZE 0xebe4 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci#define OLAND_SMC_UCODE_START 0x10000 14562306a36Sopenharmony_ci#define OLAND_SMC_UCODE_SIZE 0xe7b4 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci#define HAINAN_SMC_UCODE_START 0x10000 14862306a36Sopenharmony_ci#define HAINAN_SMC_UCODE_SIZE 0xe67C 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#define BONAIRE_SMC_UCODE_START 0x20000 15162306a36Sopenharmony_ci#define BONAIRE_SMC_UCODE_SIZE 0x1FDEC 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci#define HAWAII_SMC_UCODE_START 0x20000 15462306a36Sopenharmony_ci#define HAWAII_SMC_UCODE_SIZE 0x1FDEC 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_cistruct common_firmware_header { 15762306a36Sopenharmony_ci uint32_t size_bytes; /* size of the entire header+image(s) in bytes */ 15862306a36Sopenharmony_ci uint32_t header_size_bytes; /* size of just the header in bytes */ 15962306a36Sopenharmony_ci uint16_t header_version_major; /* header version */ 16062306a36Sopenharmony_ci uint16_t header_version_minor; /* header version */ 16162306a36Sopenharmony_ci uint16_t ip_version_major; /* IP version */ 16262306a36Sopenharmony_ci uint16_t ip_version_minor; /* IP version */ 16362306a36Sopenharmony_ci uint32_t ucode_version; 16462306a36Sopenharmony_ci uint32_t ucode_size_bytes; /* size of ucode in bytes */ 16562306a36Sopenharmony_ci uint32_t ucode_array_offset_bytes; /* payload offset from the start of the header */ 16662306a36Sopenharmony_ci uint32_t crc32; /* crc32 checksum of the payload */ 16762306a36Sopenharmony_ci}; 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci/* version_major=1, version_minor=0 */ 17062306a36Sopenharmony_cistruct mc_firmware_header_v1_0 { 17162306a36Sopenharmony_ci struct common_firmware_header header; 17262306a36Sopenharmony_ci uint32_t io_debug_size_bytes; /* size of debug array in dwords */ 17362306a36Sopenharmony_ci uint32_t io_debug_array_offset_bytes; /* payload offset from the start of the header */ 17462306a36Sopenharmony_ci}; 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci/* version_major=1, version_minor=0 */ 17762306a36Sopenharmony_cistruct smc_firmware_header_v1_0 { 17862306a36Sopenharmony_ci struct common_firmware_header header; 17962306a36Sopenharmony_ci uint32_t ucode_start_addr; 18062306a36Sopenharmony_ci}; 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci/* version_major=1, version_minor=0 */ 18362306a36Sopenharmony_cistruct gfx_firmware_header_v1_0 { 18462306a36Sopenharmony_ci struct common_firmware_header header; 18562306a36Sopenharmony_ci uint32_t ucode_feature_version; 18662306a36Sopenharmony_ci uint32_t jt_offset; /* jt location */ 18762306a36Sopenharmony_ci uint32_t jt_size; /* size of jt */ 18862306a36Sopenharmony_ci}; 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci/* version_major=1, version_minor=0 */ 19162306a36Sopenharmony_cistruct rlc_firmware_header_v1_0 { 19262306a36Sopenharmony_ci struct common_firmware_header header; 19362306a36Sopenharmony_ci uint32_t ucode_feature_version; 19462306a36Sopenharmony_ci uint32_t save_and_restore_offset; 19562306a36Sopenharmony_ci uint32_t clear_state_descriptor_offset; 19662306a36Sopenharmony_ci uint32_t avail_scratch_ram_locations; 19762306a36Sopenharmony_ci uint32_t master_pkt_description_offset; 19862306a36Sopenharmony_ci}; 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci/* version_major=1, version_minor=0 */ 20162306a36Sopenharmony_cistruct sdma_firmware_header_v1_0 { 20262306a36Sopenharmony_ci struct common_firmware_header header; 20362306a36Sopenharmony_ci uint32_t ucode_feature_version; 20462306a36Sopenharmony_ci uint32_t ucode_change_version; 20562306a36Sopenharmony_ci uint32_t jt_offset; /* jt location */ 20662306a36Sopenharmony_ci uint32_t jt_size; /* size of jt */ 20762306a36Sopenharmony_ci}; 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci/* header is fixed size */ 21062306a36Sopenharmony_ciunion radeon_firmware_header { 21162306a36Sopenharmony_ci struct common_firmware_header common; 21262306a36Sopenharmony_ci struct mc_firmware_header_v1_0 mc; 21362306a36Sopenharmony_ci struct smc_firmware_header_v1_0 smc; 21462306a36Sopenharmony_ci struct gfx_firmware_header_v1_0 gfx; 21562306a36Sopenharmony_ci struct rlc_firmware_header_v1_0 rlc; 21662306a36Sopenharmony_ci struct sdma_firmware_header_v1_0 sdma; 21762306a36Sopenharmony_ci uint8_t raw[0x100]; 21862306a36Sopenharmony_ci}; 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_civoid radeon_ucode_print_mc_hdr(const struct common_firmware_header *hdr); 22162306a36Sopenharmony_civoid radeon_ucode_print_smc_hdr(const struct common_firmware_header *hdr); 22262306a36Sopenharmony_civoid radeon_ucode_print_gfx_hdr(const struct common_firmware_header *hdr); 22362306a36Sopenharmony_civoid radeon_ucode_print_rlc_hdr(const struct common_firmware_header *hdr); 22462306a36Sopenharmony_civoid radeon_ucode_print_sdma_hdr(const struct common_firmware_header *hdr); 22562306a36Sopenharmony_ciint radeon_ucode_validate(const struct firmware *fw); 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci#endif 228