Commit 629bd33c authored by Alex Deucher's avatar Alex Deucher

drm/radeon/si: Add support for new ucode format (v3)

This adds SI support for the new ucode format.

v2: add size validation, integrate debug info
v3: update to latest version
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent de515822
...@@ -2306,6 +2306,7 @@ struct radeon_device { ...@@ -2306,6 +2306,7 @@ struct radeon_device {
const struct firmware *smc_fw; /* SMC firmware */ const struct firmware *smc_fw; /* SMC firmware */
const struct firmware *uvd_fw; /* UVD firmware */ const struct firmware *uvd_fw; /* UVD firmware */
const struct firmware *vce_fw; /* VCE firmware */ const struct firmware *vce_fw; /* VCE firmware */
bool new_fw;
struct r600_vram_scratch vram_scratch; struct r600_vram_scratch vram_scratch;
int msi_enabled; /* msi enabled */ int msi_enabled; /* msi enabled */
struct r600_ih ih; /* r6/700 interrupt ring */ struct r600_ih ih; /* r6/700 interrupt ring */
......
This diff is collapsed.
...@@ -219,36 +219,48 @@ int si_load_smc_ucode(struct radeon_device *rdev, u32 limit) ...@@ -219,36 +219,48 @@ int si_load_smc_ucode(struct radeon_device *rdev, u32 limit)
if (!rdev->smc_fw) if (!rdev->smc_fw)
return -EINVAL; return -EINVAL;
switch (rdev->family) { if (rdev->new_fw) {
case CHIP_TAHITI: const struct smc_firmware_header_v1_0 *hdr =
ucode_start_address = TAHITI_SMC_UCODE_START; (const struct smc_firmware_header_v1_0 *)rdev->smc_fw->data;
ucode_size = TAHITI_SMC_UCODE_SIZE;
break; radeon_ucode_print_smc_hdr(&hdr->header);
case CHIP_PITCAIRN:
ucode_start_address = PITCAIRN_SMC_UCODE_START; ucode_start_address = le32_to_cpu(hdr->ucode_start_addr);
ucode_size = PITCAIRN_SMC_UCODE_SIZE; ucode_size = le32_to_cpu(hdr->header.ucode_size_bytes);
break; src = (const u8 *)
case CHIP_VERDE: (rdev->smc_fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes));
ucode_start_address = VERDE_SMC_UCODE_START; } else {
ucode_size = VERDE_SMC_UCODE_SIZE; switch (rdev->family) {
break; case CHIP_TAHITI:
case CHIP_OLAND: ucode_start_address = TAHITI_SMC_UCODE_START;
ucode_start_address = OLAND_SMC_UCODE_START; ucode_size = TAHITI_SMC_UCODE_SIZE;
ucode_size = OLAND_SMC_UCODE_SIZE; break;
break; case CHIP_PITCAIRN:
case CHIP_HAINAN: ucode_start_address = PITCAIRN_SMC_UCODE_START;
ucode_start_address = HAINAN_SMC_UCODE_START; ucode_size = PITCAIRN_SMC_UCODE_SIZE;
ucode_size = HAINAN_SMC_UCODE_SIZE; break;
break; case CHIP_VERDE:
default: ucode_start_address = VERDE_SMC_UCODE_START;
DRM_ERROR("unknown asic in smc ucode loader\n"); ucode_size = VERDE_SMC_UCODE_SIZE;
BUG(); break;
case CHIP_OLAND:
ucode_start_address = OLAND_SMC_UCODE_START;
ucode_size = OLAND_SMC_UCODE_SIZE;
break;
case CHIP_HAINAN:
ucode_start_address = HAINAN_SMC_UCODE_START;
ucode_size = HAINAN_SMC_UCODE_SIZE;
break;
default:
DRM_ERROR("unknown asic in smc ucode loader\n");
BUG();
}
src = (const u8 *)rdev->smc_fw->data;
} }
if (ucode_size & 3) if (ucode_size & 3)
return -EINVAL; return -EINVAL;
src = (const u8 *)rdev->smc_fw->data;
spin_lock_irqsave(&rdev->smc_idx_lock, flags); spin_lock_irqsave(&rdev->smc_idx_lock, flags);
WREG32(SMC_IND_INDEX_0, ucode_start_address); WREG32(SMC_IND_INDEX_0, ucode_start_address);
WREG32_P(SMC_IND_ACCESS_CNTL, AUTO_INCREMENT_IND_0, ~AUTO_INCREMENT_IND_0); WREG32_P(SMC_IND_ACCESS_CNTL, AUTO_INCREMENT_IND_0, ~AUTO_INCREMENT_IND_0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment