xref: /dragonfly/sys/dev/drm/radeon/radeon_ucode.h (revision 591d5043)
157e252bfSMichael Neumann /*
257e252bfSMichael Neumann  * Copyright 2012 Advanced Micro Devices, Inc.
357e252bfSMichael Neumann  *
457e252bfSMichael Neumann  * Permission is hereby granted, free of charge, to any person obtaining a
557e252bfSMichael Neumann  * copy of this software and associated documentation files (the "Software"),
657e252bfSMichael Neumann  * to deal in the Software without restriction, including without limitation
757e252bfSMichael Neumann  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
857e252bfSMichael Neumann  * and/or sell copies of the Software, and to permit persons to whom the
957e252bfSMichael Neumann  * Software is furnished to do so, subject to the following conditions:
1057e252bfSMichael Neumann  *
1157e252bfSMichael Neumann  * The above copyright notice and this permission notice shall be included in
1257e252bfSMichael Neumann  * all copies or substantial portions of the Software.
1357e252bfSMichael Neumann  *
1457e252bfSMichael Neumann  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1557e252bfSMichael Neumann  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1657e252bfSMichael Neumann  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1757e252bfSMichael Neumann  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1857e252bfSMichael Neumann  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1957e252bfSMichael Neumann  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2057e252bfSMichael Neumann  * OTHER DEALINGS IN THE SOFTWARE.
2157e252bfSMichael Neumann  *
2257e252bfSMichael Neumann  */
2357e252bfSMichael Neumann #ifndef __RADEON_UCODE_H__
2457e252bfSMichael Neumann #define __RADEON_UCODE_H__
2557e252bfSMichael Neumann 
2657e252bfSMichael Neumann /* CP */
2757e252bfSMichael Neumann #define R600_PFP_UCODE_SIZE          576
2857e252bfSMichael Neumann #define R600_PM4_UCODE_SIZE          1792
2957e252bfSMichael Neumann #define R700_PFP_UCODE_SIZE          848
3057e252bfSMichael Neumann #define R700_PM4_UCODE_SIZE          1360
3157e252bfSMichael Neumann #define EVERGREEN_PFP_UCODE_SIZE     1120
3257e252bfSMichael Neumann #define EVERGREEN_PM4_UCODE_SIZE     1376
3357e252bfSMichael Neumann #define CAYMAN_PFP_UCODE_SIZE        2176
3457e252bfSMichael Neumann #define CAYMAN_PM4_UCODE_SIZE        2176
3557e252bfSMichael Neumann #define SI_PFP_UCODE_SIZE            2144
3657e252bfSMichael Neumann #define SI_PM4_UCODE_SIZE            2144
3757e252bfSMichael Neumann #define SI_CE_UCODE_SIZE             2144
384cd92098Szrj #define CIK_PFP_UCODE_SIZE           2144
394cd92098Szrj #define CIK_ME_UCODE_SIZE            2144
404cd92098Szrj #define CIK_CE_UCODE_SIZE            2144
414cd92098Szrj 
424cd92098Szrj /* MEC */
434cd92098Szrj #define CIK_MEC_UCODE_SIZE           4192
4457e252bfSMichael Neumann 
4557e252bfSMichael Neumann /* RLC */
4657e252bfSMichael Neumann #define R600_RLC_UCODE_SIZE          768
4757e252bfSMichael Neumann #define R700_RLC_UCODE_SIZE          1024
4857e252bfSMichael Neumann #define EVERGREEN_RLC_UCODE_SIZE     768
4957e252bfSMichael Neumann #define CAYMAN_RLC_UCODE_SIZE        1024
5057e252bfSMichael Neumann #define ARUBA_RLC_UCODE_SIZE         1536
5157e252bfSMichael Neumann #define SI_RLC_UCODE_SIZE            2048
524cd92098Szrj #define BONAIRE_RLC_UCODE_SIZE       2048
534cd92098Szrj #define KB_RLC_UCODE_SIZE            2560
544cd92098Szrj #define KV_RLC_UCODE_SIZE            2560
55c6f73aabSFrançois Tigeot #define ML_RLC_UCODE_SIZE            2560
5657e252bfSMichael Neumann 
5757e252bfSMichael Neumann /* MC */
5857e252bfSMichael Neumann #define BTC_MC_UCODE_SIZE            6024
5957e252bfSMichael Neumann #define CAYMAN_MC_UCODE_SIZE         6037
6057e252bfSMichael Neumann #define SI_MC_UCODE_SIZE             7769
61c6f73aabSFrançois Tigeot #define TAHITI_MC_UCODE_SIZE         7808
62c6f73aabSFrançois Tigeot #define PITCAIRN_MC_UCODE_SIZE       7775
63c6f73aabSFrançois Tigeot #define VERDE_MC_UCODE_SIZE          7875
6457e252bfSMichael Neumann #define OLAND_MC_UCODE_SIZE          7863
65c6f73aabSFrançois Tigeot #define BONAIRE_MC_UCODE_SIZE        7866
66c6f73aabSFrançois Tigeot #define BONAIRE_MC2_UCODE_SIZE       7948
67c6f73aabSFrançois Tigeot #define HAWAII_MC_UCODE_SIZE         7933
68c6f73aabSFrançois Tigeot #define HAWAII_MC2_UCODE_SIZE        8091
694cd92098Szrj 
704cd92098Szrj /* SDMA */
714cd92098Szrj #define CIK_SDMA_UCODE_SIZE          1050
724cd92098Szrj #define CIK_SDMA_UCODE_VERSION       64
7357e252bfSMichael Neumann 
7457e252bfSMichael Neumann /* SMC */
7557e252bfSMichael Neumann #define RV770_SMC_UCODE_START        0x0100
7657e252bfSMichael Neumann #define RV770_SMC_UCODE_SIZE         0x410d
7757e252bfSMichael Neumann #define RV770_SMC_INT_VECTOR_START   0xffc0
7857e252bfSMichael Neumann #define RV770_SMC_INT_VECTOR_SIZE    0x0040
7957e252bfSMichael Neumann 
8057e252bfSMichael Neumann #define RV730_SMC_UCODE_START        0x0100
8157e252bfSMichael Neumann #define RV730_SMC_UCODE_SIZE         0x412c
8257e252bfSMichael Neumann #define RV730_SMC_INT_VECTOR_START   0xffc0
8357e252bfSMichael Neumann #define RV730_SMC_INT_VECTOR_SIZE    0x0040
8457e252bfSMichael Neumann 
8557e252bfSMichael Neumann #define RV710_SMC_UCODE_START        0x0100
8657e252bfSMichael Neumann #define RV710_SMC_UCODE_SIZE         0x3f1f
8757e252bfSMichael Neumann #define RV710_SMC_INT_VECTOR_START   0xffc0
8857e252bfSMichael Neumann #define RV710_SMC_INT_VECTOR_SIZE    0x0040
8957e252bfSMichael Neumann 
9057e252bfSMichael Neumann #define RV740_SMC_UCODE_START        0x0100
9157e252bfSMichael Neumann #define RV740_SMC_UCODE_SIZE         0x41c5
9257e252bfSMichael Neumann #define RV740_SMC_INT_VECTOR_START   0xffc0
9357e252bfSMichael Neumann #define RV740_SMC_INT_VECTOR_SIZE    0x0040
9457e252bfSMichael Neumann 
9557e252bfSMichael Neumann #define CEDAR_SMC_UCODE_START        0x0100
9657e252bfSMichael Neumann #define CEDAR_SMC_UCODE_SIZE         0x5d50
9757e252bfSMichael Neumann #define CEDAR_SMC_INT_VECTOR_START   0xffc0
9857e252bfSMichael Neumann #define CEDAR_SMC_INT_VECTOR_SIZE    0x0040
9957e252bfSMichael Neumann 
10057e252bfSMichael Neumann #define REDWOOD_SMC_UCODE_START      0x0100
10157e252bfSMichael Neumann #define REDWOOD_SMC_UCODE_SIZE       0x5f0a
10257e252bfSMichael Neumann #define REDWOOD_SMC_INT_VECTOR_START 0xffc0
10357e252bfSMichael Neumann #define REDWOOD_SMC_INT_VECTOR_SIZE  0x0040
10457e252bfSMichael Neumann 
10557e252bfSMichael Neumann #define JUNIPER_SMC_UCODE_START      0x0100
10657e252bfSMichael Neumann #define JUNIPER_SMC_UCODE_SIZE       0x5f1f
10757e252bfSMichael Neumann #define JUNIPER_SMC_INT_VECTOR_START 0xffc0
10857e252bfSMichael Neumann #define JUNIPER_SMC_INT_VECTOR_SIZE  0x0040
10957e252bfSMichael Neumann 
11057e252bfSMichael Neumann #define CYPRESS_SMC_UCODE_START      0x0100
11157e252bfSMichael Neumann #define CYPRESS_SMC_UCODE_SIZE       0x61f7
11257e252bfSMichael Neumann #define CYPRESS_SMC_INT_VECTOR_START 0xffc0
11357e252bfSMichael Neumann #define CYPRESS_SMC_INT_VECTOR_SIZE  0x0040
11457e252bfSMichael Neumann 
11557e252bfSMichael Neumann #define BARTS_SMC_UCODE_START        0x0100
11657e252bfSMichael Neumann #define BARTS_SMC_UCODE_SIZE         0x6107
11757e252bfSMichael Neumann #define BARTS_SMC_INT_VECTOR_START   0xffc0
11857e252bfSMichael Neumann #define BARTS_SMC_INT_VECTOR_SIZE    0x0040
11957e252bfSMichael Neumann 
12057e252bfSMichael Neumann #define TURKS_SMC_UCODE_START        0x0100
12157e252bfSMichael Neumann #define TURKS_SMC_UCODE_SIZE         0x605b
12257e252bfSMichael Neumann #define TURKS_SMC_INT_VECTOR_START   0xffc0
12357e252bfSMichael Neumann #define TURKS_SMC_INT_VECTOR_SIZE    0x0040
12457e252bfSMichael Neumann 
12557e252bfSMichael Neumann #define CAICOS_SMC_UCODE_START       0x0100
12657e252bfSMichael Neumann #define CAICOS_SMC_UCODE_SIZE        0x5fbd
12757e252bfSMichael Neumann #define CAICOS_SMC_INT_VECTOR_START  0xffc0
12857e252bfSMichael Neumann #define CAICOS_SMC_INT_VECTOR_SIZE   0x0040
12957e252bfSMichael Neumann 
13057e252bfSMichael Neumann #define CAYMAN_SMC_UCODE_START       0x0100
13157e252bfSMichael Neumann #define CAYMAN_SMC_UCODE_SIZE        0x79ec
13257e252bfSMichael Neumann #define CAYMAN_SMC_INT_VECTOR_START  0xffc0
13357e252bfSMichael Neumann #define CAYMAN_SMC_INT_VECTOR_SIZE   0x0040
13457e252bfSMichael Neumann 
13557e252bfSMichael Neumann #define TAHITI_SMC_UCODE_START       0x10000
13657e252bfSMichael Neumann #define TAHITI_SMC_UCODE_SIZE        0xf458
13757e252bfSMichael Neumann 
13857e252bfSMichael Neumann #define PITCAIRN_SMC_UCODE_START     0x10000
13957e252bfSMichael Neumann #define PITCAIRN_SMC_UCODE_SIZE      0xe9f4
14057e252bfSMichael Neumann 
14157e252bfSMichael Neumann #define VERDE_SMC_UCODE_START        0x10000
14257e252bfSMichael Neumann #define VERDE_SMC_UCODE_SIZE         0xebe4
14357e252bfSMichael Neumann 
14457e252bfSMichael Neumann #define OLAND_SMC_UCODE_START        0x10000
14557e252bfSMichael Neumann #define OLAND_SMC_UCODE_SIZE         0xe7b4
14657e252bfSMichael Neumann 
14757e252bfSMichael Neumann #define HAINAN_SMC_UCODE_START       0x10000
14857e252bfSMichael Neumann #define HAINAN_SMC_UCODE_SIZE        0xe67C
14957e252bfSMichael Neumann 
1504cd92098Szrj #define BONAIRE_SMC_UCODE_START      0x20000
1514cd92098Szrj #define BONAIRE_SMC_UCODE_SIZE       0x1FDEC
1524cd92098Szrj 
153c6f73aabSFrançois Tigeot #define HAWAII_SMC_UCODE_START       0x20000
154c6f73aabSFrançois Tigeot #define HAWAII_SMC_UCODE_SIZE        0x1FDEC
155c6f73aabSFrançois Tigeot 
156*591d5043SFrançois Tigeot struct common_firmware_header {
157*591d5043SFrançois Tigeot 	uint32_t size_bytes; /* size of the entire header+image(s) in bytes */
158*591d5043SFrançois Tigeot 	uint32_t header_size_bytes; /* size of just the header in bytes */
159*591d5043SFrançois Tigeot 	uint16_t header_version_major; /* header version */
160*591d5043SFrançois Tigeot 	uint16_t header_version_minor; /* header version */
161*591d5043SFrançois Tigeot 	uint16_t ip_version_major; /* IP version */
162*591d5043SFrançois Tigeot 	uint16_t ip_version_minor; /* IP version */
163*591d5043SFrançois Tigeot 	uint32_t ucode_version;
164*591d5043SFrançois Tigeot 	uint32_t ucode_size_bytes; /* size of ucode in bytes */
165*591d5043SFrançois Tigeot 	uint32_t ucode_array_offset_bytes; /* payload offset from the start of the header */
166*591d5043SFrançois Tigeot 	uint32_t crc32;  /* crc32 checksum of the payload */
167*591d5043SFrançois Tigeot };
168*591d5043SFrançois Tigeot 
169*591d5043SFrançois Tigeot /* version_major=1, version_minor=0 */
170*591d5043SFrançois Tigeot struct mc_firmware_header_v1_0 {
171*591d5043SFrançois Tigeot 	struct common_firmware_header header;
172*591d5043SFrançois Tigeot 	uint32_t io_debug_size_bytes; /* size of debug array in dwords */
173*591d5043SFrançois Tigeot 	uint32_t io_debug_array_offset_bytes; /* payload offset from the start of the header */
174*591d5043SFrançois Tigeot };
175*591d5043SFrançois Tigeot 
176*591d5043SFrançois Tigeot /* version_major=1, version_minor=0 */
177*591d5043SFrançois Tigeot struct smc_firmware_header_v1_0 {
178*591d5043SFrançois Tigeot 	struct common_firmware_header header;
179*591d5043SFrançois Tigeot 	uint32_t ucode_start_addr;
180*591d5043SFrançois Tigeot };
181*591d5043SFrançois Tigeot 
182*591d5043SFrançois Tigeot /* version_major=1, version_minor=0 */
183*591d5043SFrançois Tigeot struct gfx_firmware_header_v1_0 {
184*591d5043SFrançois Tigeot 	struct common_firmware_header header;
185*591d5043SFrançois Tigeot 	uint32_t ucode_feature_version;
186*591d5043SFrançois Tigeot 	uint32_t jt_offset; /* jt location */
187*591d5043SFrançois Tigeot 	uint32_t jt_size;  /* size of jt */
188*591d5043SFrançois Tigeot };
189*591d5043SFrançois Tigeot 
190*591d5043SFrançois Tigeot /* version_major=1, version_minor=0 */
191*591d5043SFrançois Tigeot struct rlc_firmware_header_v1_0 {
192*591d5043SFrançois Tigeot 	struct common_firmware_header header;
193*591d5043SFrançois Tigeot 	uint32_t ucode_feature_version;
194*591d5043SFrançois Tigeot 	uint32_t save_and_restore_offset;
195*591d5043SFrançois Tigeot 	uint32_t clear_state_descriptor_offset;
196*591d5043SFrançois Tigeot 	uint32_t avail_scratch_ram_locations;
197*591d5043SFrançois Tigeot 	uint32_t master_pkt_description_offset;
198*591d5043SFrançois Tigeot };
199*591d5043SFrançois Tigeot 
200*591d5043SFrançois Tigeot /* version_major=1, version_minor=0 */
201*591d5043SFrançois Tigeot struct sdma_firmware_header_v1_0 {
202*591d5043SFrançois Tigeot 	struct common_firmware_header header;
203*591d5043SFrançois Tigeot 	uint32_t ucode_feature_version;
204*591d5043SFrançois Tigeot 	uint32_t ucode_change_version;
205*591d5043SFrançois Tigeot 	uint32_t jt_offset; /* jt location */
206*591d5043SFrançois Tigeot 	uint32_t jt_size; /* size of jt */
207*591d5043SFrançois Tigeot };
208*591d5043SFrançois Tigeot 
209*591d5043SFrançois Tigeot /* header is fixed size */
210*591d5043SFrançois Tigeot union radeon_firmware_header {
211*591d5043SFrançois Tigeot 	struct common_firmware_header common;
212*591d5043SFrançois Tigeot 	struct mc_firmware_header_v1_0 mc;
213*591d5043SFrançois Tigeot 	struct smc_firmware_header_v1_0 smc;
214*591d5043SFrançois Tigeot 	struct gfx_firmware_header_v1_0 gfx;
215*591d5043SFrançois Tigeot 	struct rlc_firmware_header_v1_0 rlc;
216*591d5043SFrançois Tigeot 	struct sdma_firmware_header_v1_0 sdma;
217*591d5043SFrançois Tigeot 	uint8_t raw[0x100];
218*591d5043SFrançois Tigeot };
219*591d5043SFrançois Tigeot 
220*591d5043SFrançois Tigeot void radeon_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
221*591d5043SFrançois Tigeot void radeon_ucode_print_smc_hdr(const struct common_firmware_header *hdr);
222*591d5043SFrançois Tigeot void radeon_ucode_print_gfx_hdr(const struct common_firmware_header *hdr);
223*591d5043SFrançois Tigeot void radeon_ucode_print_rlc_hdr(const struct common_firmware_header *hdr);
224*591d5043SFrançois Tigeot void radeon_ucode_print_sdma_hdr(const struct common_firmware_header *hdr);
225*591d5043SFrançois Tigeot int radeon_ucode_validate(const struct firmware *fw);
226*591d5043SFrançois Tigeot 
22757e252bfSMichael Neumann #endif
228