aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
index bdc472b6e641..aa6641b944a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
@@ -157,6 +157,13 @@ struct gpu_info_firmware_header_v1_0 {
157 uint16_t version_minor; /* version */ 157 uint16_t version_minor; /* version */
158}; 158};
159 159
160/* version_major=1, version_minor=0 */
161struct dmcu_firmware_header_v1_0 {
162 struct common_firmware_header header;
163 uint32_t intv_offset_bytes; /* interrupt vectors offset from end of header, in bytes */
164 uint32_t intv_size_bytes; /* size of interrupt vectors, in bytes */
165};
166
160/* header is fixed size */ 167/* header is fixed size */
161union amdgpu_firmware_header { 168union amdgpu_firmware_header {
162 struct common_firmware_header common; 169 struct common_firmware_header common;
@@ -170,6 +177,7 @@ union amdgpu_firmware_header {
170 struct sdma_firmware_header_v1_0 sdma; 177 struct sdma_firmware_header_v1_0 sdma;
171 struct sdma_firmware_header_v1_1 sdma_v1_1; 178 struct sdma_firmware_header_v1_1 sdma_v1_1;
172 struct gpu_info_firmware_header_v1_0 gpu_info; 179 struct gpu_info_firmware_header_v1_0 gpu_info;
180 struct dmcu_firmware_header_v1_0 dmcu;
173 uint8_t raw[0x100]; 181 uint8_t raw[0x100];
174}; 182};
175 183
@@ -193,8 +201,11 @@ enum AMDGPU_UCODE_ID {
193 AMDGPU_UCODE_ID_STORAGE, 201 AMDGPU_UCODE_ID_STORAGE,
194 AMDGPU_UCODE_ID_SMC, 202 AMDGPU_UCODE_ID_SMC,
195 AMDGPU_UCODE_ID_UVD, 203 AMDGPU_UCODE_ID_UVD,
204 AMDGPU_UCODE_ID_UVD1,
196 AMDGPU_UCODE_ID_VCE, 205 AMDGPU_UCODE_ID_VCE,
197 AMDGPU_UCODE_ID_VCN, 206 AMDGPU_UCODE_ID_VCN,
207 AMDGPU_UCODE_ID_DMCU_ERAM,
208 AMDGPU_UCODE_ID_DMCU_INTV,
198 AMDGPU_UCODE_ID_MAXIMUM, 209 AMDGPU_UCODE_ID_MAXIMUM,
199}; 210};
200 211
@@ -205,6 +216,12 @@ enum AMDGPU_UCODE_STATUS {
205 AMDGPU_UCODE_STATUS_LOADED, 216 AMDGPU_UCODE_STATUS_LOADED,
206}; 217};
207 218
219enum amdgpu_firmware_load_type {
220 AMDGPU_FW_LOAD_DIRECT = 0,
221 AMDGPU_FW_LOAD_SMU,
222 AMDGPU_FW_LOAD_PSP,
223};
224
208/* conform to smu_ucode_xfer_cz.h */ 225/* conform to smu_ucode_xfer_cz.h */
209#define AMDGPU_SDMA0_UCODE_LOADED 0x00000001 226#define AMDGPU_SDMA0_UCODE_LOADED 0x00000001
210#define AMDGPU_SDMA1_UCODE_LOADED 0x00000002 227#define AMDGPU_SDMA1_UCODE_LOADED 0x00000002
@@ -232,6 +249,24 @@ struct amdgpu_firmware_info {
232 uint32_t tmr_mc_addr_hi; 249 uint32_t tmr_mc_addr_hi;
233}; 250};
234 251
252struct amdgpu_firmware {
253 struct amdgpu_firmware_info ucode[AMDGPU_UCODE_ID_MAXIMUM];
254 enum amdgpu_firmware_load_type load_type;
255 struct amdgpu_bo *fw_buf;
256 unsigned int fw_size;
257 unsigned int max_ucodes;
258 /* firmwares are loaded by psp instead of smu from vega10 */
259 const struct amdgpu_psp_funcs *funcs;
260 struct amdgpu_bo *rbuf;
261 struct mutex mutex;
262
263 /* gpu info firmware data pointer */
264 const struct firmware *gpu_info_fw;
265
266 void *fw_buf_ptr;
267 uint64_t fw_buf_mc;
268};
269
235void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr); 270void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
236void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr); 271void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr);
237void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr); 272void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr);
@@ -241,8 +276,10 @@ void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr);
241int amdgpu_ucode_validate(const struct firmware *fw); 276int amdgpu_ucode_validate(const struct firmware *fw);
242bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr, 277bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,
243 uint16_t hdr_major, uint16_t hdr_minor); 278 uint16_t hdr_major, uint16_t hdr_minor);
279
244int amdgpu_ucode_init_bo(struct amdgpu_device *adev); 280int amdgpu_ucode_init_bo(struct amdgpu_device *adev);
245int amdgpu_ucode_fini_bo(struct amdgpu_device *adev); 281int amdgpu_ucode_create_bo(struct amdgpu_device *adev);
282void amdgpu_ucode_free_bo(struct amdgpu_device *adev);
246 283
247enum amdgpu_firmware_load_type 284enum amdgpu_firmware_load_type
248amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type); 285amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type);