1*b843c749SSergey Zigachev /* 2*b843c749SSergey Zigachev * Copyright 2016 Advanced Micro Devices, Inc. 3*b843c749SSergey Zigachev * 4*b843c749SSergey Zigachev * Permission is hereby granted, free of charge, to any person obtaining a 5*b843c749SSergey Zigachev * copy of this software and associated documentation files (the "Software"), 6*b843c749SSergey Zigachev * to deal in the Software without restriction, including without limitation 7*b843c749SSergey Zigachev * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*b843c749SSergey Zigachev * and/or sell copies of the Software, and to permit persons to whom the 9*b843c749SSergey Zigachev * Software is furnished to do so, subject to the following conditions: 10*b843c749SSergey Zigachev * 11*b843c749SSergey Zigachev * The above copyright notice and this permission notice shall be included in 12*b843c749SSergey Zigachev * all copies or substantial portions of the Software. 13*b843c749SSergey Zigachev * 14*b843c749SSergey Zigachev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*b843c749SSergey Zigachev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*b843c749SSergey Zigachev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17*b843c749SSergey Zigachev * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18*b843c749SSergey Zigachev * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19*b843c749SSergey Zigachev * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20*b843c749SSergey Zigachev * OTHER DEALINGS IN THE SOFTWARE. 21*b843c749SSergey Zigachev * 22*b843c749SSergey Zigachev */ 23*b843c749SSergey Zigachev // CZ Ucode Loading Definitions 24*b843c749SSergey Zigachev #ifndef SMU_UCODE_XFER_CZ_H 25*b843c749SSergey Zigachev #define SMU_UCODE_XFER_CZ_H 26*b843c749SSergey Zigachev 27*b843c749SSergey Zigachev #define NUM_JOBLIST_ENTRIES 32 28*b843c749SSergey Zigachev 29*b843c749SSergey Zigachev #define TASK_TYPE_NO_ACTION 0 30*b843c749SSergey Zigachev #define TASK_TYPE_UCODE_LOAD 1 31*b843c749SSergey Zigachev #define TASK_TYPE_UCODE_SAVE 2 32*b843c749SSergey Zigachev #define TASK_TYPE_REG_LOAD 3 33*b843c749SSergey Zigachev #define TASK_TYPE_REG_SAVE 4 34*b843c749SSergey Zigachev #define TASK_TYPE_INITIALIZE 5 35*b843c749SSergey Zigachev 36*b843c749SSergey Zigachev #define TASK_ARG_REG_SMCIND 0 37*b843c749SSergey Zigachev #define TASK_ARG_REG_MMIO 1 38*b843c749SSergey Zigachev #define TASK_ARG_REG_FCH 2 39*b843c749SSergey Zigachev #define TASK_ARG_REG_UNB 3 40*b843c749SSergey Zigachev 41*b843c749SSergey Zigachev #define TASK_ARG_INIT_MM_PWR_LOG 0 42*b843c749SSergey Zigachev #define TASK_ARG_INIT_CLK_TABLE 1 43*b843c749SSergey Zigachev 44*b843c749SSergey Zigachev #define JOB_GFX_SAVE 0 45*b843c749SSergey Zigachev #define JOB_GFX_RESTORE 1 46*b843c749SSergey Zigachev #define JOB_FCH_SAVE 2 47*b843c749SSergey Zigachev #define JOB_FCH_RESTORE 3 48*b843c749SSergey Zigachev #define JOB_UNB_SAVE 4 49*b843c749SSergey Zigachev #define JOB_UNB_RESTORE 5 50*b843c749SSergey Zigachev #define JOB_GMC_SAVE 6 51*b843c749SSergey Zigachev #define JOB_GMC_RESTORE 7 52*b843c749SSergey Zigachev #define JOB_GNB_SAVE 8 53*b843c749SSergey Zigachev #define JOB_GNB_RESTORE 9 54*b843c749SSergey Zigachev 55*b843c749SSergey Zigachev #define IGNORE_JOB 0xff 56*b843c749SSergey Zigachev #define END_OF_TASK_LIST (uint16_t)0xffff 57*b843c749SSergey Zigachev 58*b843c749SSergey Zigachev // Size of DRAM regions (in bytes) requested by SMU: 59*b843c749SSergey Zigachev #define SMU_DRAM_REQ_MM_PWR_LOG 48 60*b843c749SSergey Zigachev 61*b843c749SSergey Zigachev #define UCODE_ID_SDMA0 0 62*b843c749SSergey Zigachev #define UCODE_ID_SDMA1 1 63*b843c749SSergey Zigachev #define UCODE_ID_CP_CE 2 64*b843c749SSergey Zigachev #define UCODE_ID_CP_PFP 3 65*b843c749SSergey Zigachev #define UCODE_ID_CP_ME 4 66*b843c749SSergey Zigachev #define UCODE_ID_CP_MEC_JT1 5 67*b843c749SSergey Zigachev #define UCODE_ID_CP_MEC_JT2 6 68*b843c749SSergey Zigachev #define UCODE_ID_GMCON_RENG 7 69*b843c749SSergey Zigachev #define UCODE_ID_RLC_G 8 70*b843c749SSergey Zigachev #define UCODE_ID_RLC_SCRATCH 9 71*b843c749SSergey Zigachev #define UCODE_ID_RLC_SRM_ARAM 10 72*b843c749SSergey Zigachev #define UCODE_ID_RLC_SRM_DRAM 11 73*b843c749SSergey Zigachev #define UCODE_ID_DMCU_ERAM 12 74*b843c749SSergey Zigachev #define UCODE_ID_DMCU_IRAM 13 75*b843c749SSergey Zigachev 76*b843c749SSergey Zigachev #define UCODE_ID_SDMA0_MASK 0x00000001 77*b843c749SSergey Zigachev #define UCODE_ID_SDMA1_MASK 0x00000002 78*b843c749SSergey Zigachev #define UCODE_ID_CP_CE_MASK 0x00000004 79*b843c749SSergey Zigachev #define UCODE_ID_CP_PFP_MASK 0x00000008 80*b843c749SSergey Zigachev #define UCODE_ID_CP_ME_MASK 0x00000010 81*b843c749SSergey Zigachev #define UCODE_ID_CP_MEC_JT1_MASK 0x00000020 82*b843c749SSergey Zigachev #define UCODE_ID_CP_MEC_JT2_MASK 0x00000040 83*b843c749SSergey Zigachev #define UCODE_ID_GMCON_RENG_MASK 0x00000080 84*b843c749SSergey Zigachev #define UCODE_ID_RLC_G_MASK 0x00000100 85*b843c749SSergey Zigachev #define UCODE_ID_RLC_SCRATCH_MASK 0x00000200 86*b843c749SSergey Zigachev #define UCODE_ID_RLC_SRM_ARAM_MASK 0x00000400 87*b843c749SSergey Zigachev #define UCODE_ID_RLC_SRM_DRAM_MASK 0x00000800 88*b843c749SSergey Zigachev #define UCODE_ID_DMCU_ERAM_MASK 0x00001000 89*b843c749SSergey Zigachev #define UCODE_ID_DMCU_IRAM_MASK 0x00002000 90*b843c749SSergey Zigachev 91*b843c749SSergey Zigachev #define UCODE_ID_SDMA0_SIZE_BYTE 10368 92*b843c749SSergey Zigachev #define UCODE_ID_SDMA1_SIZE_BYTE 10368 93*b843c749SSergey Zigachev #define UCODE_ID_CP_CE_SIZE_BYTE 8576 94*b843c749SSergey Zigachev #define UCODE_ID_CP_PFP_SIZE_BYTE 16768 95*b843c749SSergey Zigachev #define UCODE_ID_CP_ME_SIZE_BYTE 16768 96*b843c749SSergey Zigachev #define UCODE_ID_CP_MEC_JT1_SIZE_BYTE 384 97*b843c749SSergey Zigachev #define UCODE_ID_CP_MEC_JT2_SIZE_BYTE 384 98*b843c749SSergey Zigachev #define UCODE_ID_GMCON_RENG_SIZE_BYTE 4096 99*b843c749SSergey Zigachev #define UCODE_ID_RLC_G_SIZE_BYTE 2048 100*b843c749SSergey Zigachev #define UCODE_ID_RLC_SCRATCH_SIZE_BYTE 132 101*b843c749SSergey Zigachev #define UCODE_ID_RLC_SRM_ARAM_SIZE_BYTE 8192 102*b843c749SSergey Zigachev #define UCODE_ID_RLC_SRM_DRAM_SIZE_BYTE 4096 103*b843c749SSergey Zigachev #define UCODE_ID_DMCU_ERAM_SIZE_BYTE 24576 104*b843c749SSergey Zigachev #define UCODE_ID_DMCU_IRAM_SIZE_BYTE 1024 105*b843c749SSergey Zigachev 106*b843c749SSergey Zigachev #define NUM_UCODES 14 107*b843c749SSergey Zigachev 108*b843c749SSergey Zigachev typedef struct { 109*b843c749SSergey Zigachev uint32_t high; 110*b843c749SSergey Zigachev uint32_t low; 111*b843c749SSergey Zigachev } data_64_t; 112*b843c749SSergey Zigachev 113*b843c749SSergey Zigachev struct SMU_Task { 114*b843c749SSergey Zigachev uint8_t type; 115*b843c749SSergey Zigachev uint8_t arg; 116*b843c749SSergey Zigachev uint16_t next; 117*b843c749SSergey Zigachev data_64_t addr; 118*b843c749SSergey Zigachev uint32_t size_bytes; 119*b843c749SSergey Zigachev }; 120*b843c749SSergey Zigachev typedef struct SMU_Task SMU_Task; 121*b843c749SSergey Zigachev 122*b843c749SSergey Zigachev struct TOC { 123*b843c749SSergey Zigachev uint8_t JobList[NUM_JOBLIST_ENTRIES]; 124*b843c749SSergey Zigachev SMU_Task tasks[1]; 125*b843c749SSergey Zigachev }; 126*b843c749SSergey Zigachev 127*b843c749SSergey Zigachev // META DATA COMMAND Definitions 128*b843c749SSergey Zigachev #define METADATA_CMD_MODE0 0x00000103 129*b843c749SSergey Zigachev #define METADATA_CMD_MODE1 0x00000113 130*b843c749SSergey Zigachev #define METADATA_CMD_MODE2 0x00000123 131*b843c749SSergey Zigachev #define METADATA_CMD_MODE3 0x00000133 132*b843c749SSergey Zigachev #define METADATA_CMD_DELAY 0x00000203 133*b843c749SSergey Zigachev #define METADATA_CMD_CHNG_REGSPACE 0x00000303 134*b843c749SSergey Zigachev #define METADATA_PERFORM_ON_SAVE 0x00001000 135*b843c749SSergey Zigachev #define METADATA_PERFORM_ON_LOAD 0x00002000 136*b843c749SSergey Zigachev #define METADATA_CMD_ARG_MASK 0xFFFF0000 137*b843c749SSergey Zigachev #define METADATA_CMD_ARG_SHIFT 16 138*b843c749SSergey Zigachev 139*b843c749SSergey Zigachev // Simple register addr/data fields 140*b843c749SSergey Zigachev struct SMU_MetaData_Mode0 { 141*b843c749SSergey Zigachev uint32_t register_address; 142*b843c749SSergey Zigachev uint32_t register_data; 143*b843c749SSergey Zigachev }; 144*b843c749SSergey Zigachev typedef struct SMU_MetaData_Mode0 SMU_MetaData_Mode0; 145*b843c749SSergey Zigachev 146*b843c749SSergey Zigachev // Register addr/data with mask 147*b843c749SSergey Zigachev struct SMU_MetaData_Mode1 { 148*b843c749SSergey Zigachev uint32_t register_address; 149*b843c749SSergey Zigachev uint32_t register_mask; 150*b843c749SSergey Zigachev uint32_t register_data; 151*b843c749SSergey Zigachev }; 152*b843c749SSergey Zigachev typedef struct SMU_MetaData_Mode1 SMU_MetaData_Mode1; 153*b843c749SSergey Zigachev 154*b843c749SSergey Zigachev struct SMU_MetaData_Mode2 { 155*b843c749SSergey Zigachev uint32_t register_address; 156*b843c749SSergey Zigachev uint32_t register_mask; 157*b843c749SSergey Zigachev uint32_t target_value; 158*b843c749SSergey Zigachev }; 159*b843c749SSergey Zigachev typedef struct SMU_MetaData_Mode2 SMU_MetaData_Mode2; 160*b843c749SSergey Zigachev 161*b843c749SSergey Zigachev // Always write data (even on a save operation) 162*b843c749SSergey Zigachev struct SMU_MetaData_Mode3 { 163*b843c749SSergey Zigachev uint32_t register_address; 164*b843c749SSergey Zigachev uint32_t register_mask; 165*b843c749SSergey Zigachev uint32_t register_data; 166*b843c749SSergey Zigachev }; 167*b843c749SSergey Zigachev typedef struct SMU_MetaData_Mode3 SMU_MetaData_Mode3; 168*b843c749SSergey Zigachev 169*b843c749SSergey Zigachev #endif 170