diff options
author | Jonathan Gray <jsg@jsg.id.au> | 2013-05-29 12:19:40 +1000 |
---|---|---|
committer | Jonathan Gray <jsg@jsg.id.au> | 2013-08-12 10:40:59 +1000 |
commit | 7ddbc59229577b2172e14ba7b4bccd4e44b7d76c (patch) | |
tree | 0a55fb54f3c65291983e3e8342f261a5a58bda68 /sys | |
parent | 37e60a703677f50e306943d51d8a7cd2b54ce622 (diff) |
unstub r600+ firmware loading
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/radeon/ni.c | 104 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/r600.c | 133 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon.h | 21 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/si.c | 118 |
4 files changed, 168 insertions, 208 deletions
diff --git a/sys/dev/pci/drm/radeon/ni.c b/sys/dev/pci/drm/radeon/ni.c index 6fc443fdaad..12b8bf3923f 100644 --- a/sys/dev/pci/drm/radeon/ni.c +++ b/sys/dev/pci/drm/radeon/ni.c @@ -205,9 +205,6 @@ static const u32 cayman_io_mc_regs[BTC_IO_MC_REGS_SIZE][2] = { int ni_mc_load_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet const __be32 *fw_data; u32 mem_type, running, blackout = 0; u32 *io_mc_regs; @@ -259,7 +256,7 @@ int ni_mc_load_microcode(struct radeon_device *rdev) WREG32(MC_SEQ_IO_DEBUG_DATA, io_mc_regs[(i << 1) + 1]); } /* load the MC ucode */ - fw_data = (const __be32 *)rdev->mc_fw->data; + fw_data = (const __be32 *)rdev->mc_fw; for (i = 0; i < ucode_size; i++) WREG32(MC_SEQ_SUP_PGM, be32_to_cpup(fw_data++)); @@ -280,15 +277,10 @@ int ni_mc_load_microcode(struct radeon_device *rdev) } return 0; -#endif } int ni_init_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet - struct platform_device *pdev; const char *chip_name; const char *rlc_chip_name; size_t pfp_req_size, me_req_size, rlc_req_size, mc_req_size; @@ -297,49 +289,42 @@ int ni_init_microcode(struct radeon_device *rdev) DRM_DEBUG("\n"); - pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0); - err = IS_ERR(pdev); - if (err) { - DRM_ERROR( "radeon_cp: Failed to register firmware\n"); - return -EINVAL; - } - switch (rdev->family) { case CHIP_BARTS: - chip_name = "BARTS"; - rlc_chip_name = "BTC"; + chip_name = "barts"; + rlc_chip_name = "btc"; pfp_req_size = EVERGREEN_PFP_UCODE_SIZE * 4; me_req_size = EVERGREEN_PM4_UCODE_SIZE * 4; rlc_req_size = EVERGREEN_RLC_UCODE_SIZE * 4; mc_req_size = BTC_MC_UCODE_SIZE * 4; break; case CHIP_TURKS: - chip_name = "TURKS"; - rlc_chip_name = "BTC"; + chip_name = "turks"; + rlc_chip_name = "btc"; pfp_req_size = EVERGREEN_PFP_UCODE_SIZE * 4; me_req_size = EVERGREEN_PM4_UCODE_SIZE * 4; rlc_req_size = EVERGREEN_RLC_UCODE_SIZE * 4; mc_req_size = BTC_MC_UCODE_SIZE * 4; break; case CHIP_CAICOS: - chip_name = "CAICOS"; - rlc_chip_name = "BTC"; + chip_name = "caicos"; + rlc_chip_name = "btc"; pfp_req_size = EVERGREEN_PFP_UCODE_SIZE * 4; me_req_size = EVERGREEN_PM4_UCODE_SIZE * 4; rlc_req_size = EVERGREEN_RLC_UCODE_SIZE * 4; mc_req_size = BTC_MC_UCODE_SIZE * 4; break; case CHIP_CAYMAN: - chip_name = "CAYMAN"; - rlc_chip_name = "CAYMAN"; + chip_name = "cayman"; + rlc_chip_name = "cayman"; pfp_req_size = CAYMAN_PFP_UCODE_SIZE * 4; me_req_size = CAYMAN_PM4_UCODE_SIZE * 4; rlc_req_size = CAYMAN_RLC_UCODE_SIZE * 4; mc_req_size = CAYMAN_MC_UCODE_SIZE * 4; break; case CHIP_ARUBA: - chip_name = "ARUBA"; - rlc_chip_name = "ARUBA"; + chip_name = "aruba"; + rlc_chip_name = "aruba"; /* pfp/me same size as CAYMAN */ pfp_req_size = CAYMAN_PFP_UCODE_SIZE * 4; me_req_size = CAYMAN_PM4_UCODE_SIZE * 4; @@ -351,72 +336,77 @@ int ni_init_microcode(struct radeon_device *rdev) DRM_INFO("Loading %s Microcode\n", chip_name); - snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); - err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_pfp", chip_name); + err = loadfirmware(fw_name, &rdev->pfp_fw, &rdev->pfp_fw_size); if (err) goto out; - if (rdev->pfp_fw->size != pfp_req_size) { + if (rdev->pfp_fw_size != pfp_req_size) { DRM_ERROR( "ni_cp: Bogus length %zu in firmware \"%s\"\n", - rdev->pfp_fw->size, fw_name); + rdev->pfp_fw_size, fw_name); err = -EINVAL; goto out; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); - err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_me", chip_name); + err = loadfirmware(fw_name, &rdev->me_fw, &rdev->me_fw_size); if (err) goto out; - if (rdev->me_fw->size != me_req_size) { + if (rdev->me_fw_size != me_req_size) { DRM_ERROR( "ni_cp: Bogus length %zu in firmware \"%s\"\n", - rdev->me_fw->size, fw_name); + rdev->me_fw_size, fw_name); err = -EINVAL; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); - err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_rlc", rlc_chip_name); + err = loadfirmware(fw_name, &rdev->rlc_fw, &rdev->rlc_fw_size); if (err) goto out; - if (rdev->rlc_fw->size != rlc_req_size) { + if (rdev->rlc_fw_size != rlc_req_size) { DRM_ERROR( "ni_rlc: Bogus length %zu in firmware \"%s\"\n", - rdev->rlc_fw->size, fw_name); + rdev->rlc_fw_size, fw_name); err = -EINVAL; } /* no MC ucode on TN */ if (!(rdev->flags & RADEON_IS_IGP)) { - snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); - err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_mc", chip_name); + err = loadfirmware(fw_name, &rdev->mc_fw, &rdev->mc_fw_size); if (err) goto out; - if (rdev->mc_fw->size != mc_req_size) { + if (rdev->mc_fw_size != mc_req_size) { DRM_ERROR( "ni_mc: Bogus length %zu in firmware \"%s\"\n", - rdev->mc_fw->size, fw_name); + rdev->mc_fw_size, fw_name); err = -EINVAL; } } out: - platform_device_unregister(pdev); - if (err) { if (err != -EINVAL) DRM_ERROR( "ni_cp: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(rdev->pfp_fw); - rdev->pfp_fw = NULL; - release_firmware(rdev->me_fw); - rdev->me_fw = NULL; - release_firmware(rdev->rlc_fw); - rdev->rlc_fw = NULL; - release_firmware(rdev->mc_fw); - rdev->mc_fw = NULL; + if (rdev->pfp_fw) { + free(rdev->pfp_fw, M_DEVBUF); + rdev->pfp_fw = NULL; + } + if (rdev->me_fw) { + free(rdev->me_fw, M_DEVBUF); + rdev->me_fw = NULL; + } + if (rdev->rlc_fw) { + free(rdev->rlc_fw, M_DEVBUF); + rdev->rlc_fw = NULL; + } + if (rdev->mc_fw) { + free(rdev->mc_fw, M_DEVBUF); + rdev->mc_fw = NULL; + } } return err; -#endif } /* @@ -949,9 +939,6 @@ static void cayman_cp_enable(struct radeon_device *rdev, bool enable) static int cayman_cp_load_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet const __be32 *fw_data; int i; @@ -960,13 +947,13 @@ static int cayman_cp_load_microcode(struct radeon_device *rdev) cayman_cp_enable(rdev, false); - fw_data = (const __be32 *)rdev->pfp_fw->data; + fw_data = (const __be32 *)rdev->pfp_fw; WREG32(CP_PFP_UCODE_ADDR, 0); for (i = 0; i < CAYMAN_PFP_UCODE_SIZE; i++) WREG32(CP_PFP_UCODE_DATA, be32_to_cpup(fw_data++)); WREG32(CP_PFP_UCODE_ADDR, 0); - fw_data = (const __be32 *)rdev->me_fw->data; + fw_data = (const __be32 *)rdev->me_fw; WREG32(CP_ME_RAM_WADDR, 0); for (i = 0; i < CAYMAN_PM4_UCODE_SIZE; i++) WREG32(CP_ME_RAM_DATA, be32_to_cpup(fw_data++)); @@ -975,7 +962,6 @@ static int cayman_cp_load_microcode(struct radeon_device *rdev) WREG32(CP_ME_RAM_WADDR, 0); WREG32(CP_ME_RAM_RADDR, 0); return 0; -#endif } static int cayman_cp_start(struct radeon_device *rdev) diff --git a/sys/dev/pci/drm/radeon/r600.c b/sys/dev/pci/drm/radeon/r600.c index 476b7ba149a..c04bc58579e 100644 --- a/sys/dev/pci/drm/radeon/r600.c +++ b/sys/dev/pci/drm/radeon/r600.c @@ -1961,10 +1961,6 @@ void r600_cp_stop(struct radeon_device *rdev) int r600_init_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet - struct platform_device *pdev; const char *chip_name; const char *rlc_chip_name; size_t pfp_req_size, me_req_size, rlc_req_size; @@ -1973,84 +1969,86 @@ int r600_init_microcode(struct radeon_device *rdev) DRM_DEBUG("\n"); +#if 0 pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0); err = IS_ERR(pdev); if (err) { DRM_ERROR( "radeon_cp: Failed to register firmware\n"); return -EINVAL; } +#endif switch (rdev->family) { case CHIP_R600: - chip_name = "R600"; - rlc_chip_name = "R600"; + chip_name = "r600"; + rlc_chip_name = "r600"; break; case CHIP_RV610: - chip_name = "RV610"; - rlc_chip_name = "R600"; + chip_name = "rv610"; + rlc_chip_name = "r600"; break; case CHIP_RV630: - chip_name = "RV630"; - rlc_chip_name = "R600"; + chip_name = "rv630"; + rlc_chip_name = "r600"; break; case CHIP_RV620: - chip_name = "RV620"; - rlc_chip_name = "R600"; + chip_name = "rv620"; + rlc_chip_name = "r600"; break; case CHIP_RV635: - chip_name = "RV635"; - rlc_chip_name = "R600"; + chip_name = "rv635"; + rlc_chip_name = "r600"; break; case CHIP_RV670: - chip_name = "RV670"; - rlc_chip_name = "R600"; + chip_name = "rv670"; + rlc_chip_name = "r600"; break; case CHIP_RS780: case CHIP_RS880: - chip_name = "RS780"; - rlc_chip_name = "R600"; + chip_name = "rs780"; + rlc_chip_name = "r600"; break; case CHIP_RV770: - chip_name = "RV770"; - rlc_chip_name = "R700"; + chip_name = "rv770"; + rlc_chip_name = "r700"; break; case CHIP_RV730: case CHIP_RV740: - chip_name = "RV730"; - rlc_chip_name = "R700"; + chip_name = "rv730"; + rlc_chip_name = "r700"; break; case CHIP_RV710: - chip_name = "RV710"; - rlc_chip_name = "R700"; + chip_name = "rv710"; + rlc_chip_name = "r700"; break; case CHIP_CEDAR: - chip_name = "CEDAR"; - rlc_chip_name = "CEDAR"; + chip_name = "cedar"; + rlc_chip_name = "cedar"; break; case CHIP_REDWOOD: - chip_name = "REDWOOD"; - rlc_chip_name = "REDWOOD"; + chip_name = "redwood"; + rlc_chip_name = "redwood"; break; case CHIP_JUNIPER: - chip_name = "JUNIPER"; - rlc_chip_name = "JUNIPER"; + chip_name = "juniper"; + rlc_chip_name = "juniper"; break; case CHIP_CYPRESS: case CHIP_HEMLOCK: - chip_name = "CYPRESS"; - rlc_chip_name = "CYPRESS"; + chip_name = "cypress"; + rlc_chip_name = "cypress"; break; case CHIP_PALM: - chip_name = "PALM"; - rlc_chip_name = "SUMO"; + chip_name = "palm"; + rlc_chip_name = "sumo"; break; case CHIP_SUMO: - chip_name = "SUMO"; - rlc_chip_name = "SUMO"; + chip_name = "sumo"; + rlc_chip_name = "sumo"; break; case CHIP_SUMO2: - chip_name = "SUMO2"; - rlc_chip_name = "SUMO"; + chip_name = "sumo2"; + rlc_chip_name = "sumo"; break; default: BUG(); } @@ -2071,64 +2069,64 @@ int r600_init_microcode(struct radeon_device *rdev) DRM_INFO("Loading %s Microcode\n", chip_name); - snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); - err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_pfp", chip_name); + err = loadfirmware(fw_name, &rdev->pfp_fw, &rdev->pfp_fw_size); if (err) goto out; - if (rdev->pfp_fw->size != pfp_req_size) { + if (rdev->pfp_fw_size != pfp_req_size) { DRM_ERROR( "r600_cp: Bogus length %zu in firmware \"%s\"\n", - rdev->pfp_fw->size, fw_name); + rdev->pfp_fw_size, fw_name); err = -EINVAL; goto out; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); - err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_me", chip_name); + err = loadfirmware(fw_name, &rdev->me_fw, &rdev->me_fw_size); if (err) goto out; - if (rdev->me_fw->size != me_req_size) { + if (rdev->me_fw_size != me_req_size) { DRM_ERROR( "r600_cp: Bogus length %zu in firmware \"%s\"\n", - rdev->me_fw->size, fw_name); + rdev->me_fw_size, fw_name); err = -EINVAL; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); - err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_rlc", rlc_chip_name); + err = loadfirmware(fw_name, &rdev->rlc_fw, &rdev->rlc_fw_size); if (err) goto out; - if (rdev->rlc_fw->size != rlc_req_size) { + if (rdev->rlc_fw_size != rlc_req_size) { DRM_ERROR( "r600_rlc: Bogus length %zu in firmware \"%s\"\n", - rdev->rlc_fw->size, fw_name); + rdev->rlc_fw_size, fw_name); err = -EINVAL; } out: - platform_device_unregister(pdev); - if (err) { if (err != -EINVAL) DRM_ERROR( "r600_cp: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(rdev->pfp_fw); - rdev->pfp_fw = NULL; - release_firmware(rdev->me_fw); - rdev->me_fw = NULL; - release_firmware(rdev->rlc_fw); - rdev->rlc_fw = NULL; + if (rdev->pfp_fw) { + free(rdev->pfp_fw, M_DEVBUF); + rdev->pfp_fw = NULL; + } + if (rdev->me_fw) { + free(rdev->me_fw, M_DEVBUF); + rdev->me_fw = NULL; + } + if (rdev->rlc_fw) { + free(rdev->rlc_fw, M_DEVBUF); + rdev->rlc_fw = NULL; + } } return err; -#endif } static int r600_cp_load_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet const __be32 *fw_data; int i; @@ -2151,13 +2149,13 @@ static int r600_cp_load_microcode(struct radeon_device *rdev) WREG32(CP_ME_RAM_WADDR, 0); - fw_data = (const __be32 *)rdev->me_fw->data; + fw_data = (const __be32 *)rdev->me_fw; WREG32(CP_ME_RAM_WADDR, 0); for (i = 0; i < PM4_UCODE_SIZE * 3; i++) WREG32(CP_ME_RAM_DATA, be32_to_cpup(fw_data++)); - fw_data = (const __be32 *)rdev->pfp_fw->data; + fw_data = (const __be32 *)rdev->pfp_fw; WREG32(CP_PFP_UCODE_ADDR, 0); for (i = 0; i < PFP_UCODE_SIZE; i++) WREG32(CP_PFP_UCODE_DATA, @@ -2167,7 +2165,6 @@ static int r600_cp_load_microcode(struct radeon_device *rdev) WREG32(CP_ME_RAM_WADDR, 0); WREG32(CP_ME_RAM_RADDR, 0); return 0; -#endif } int r600_cp_start(struct radeon_device *rdev) @@ -3308,9 +3305,6 @@ r600_rlc_start(struct radeon_device *rdev) static int r600_rlc_init(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet u32 i; const __be32 *fw_data; @@ -3337,7 +3331,7 @@ static int r600_rlc_init(struct radeon_device *rdev) WREG32(RLC_MC_CNTL, 0); WREG32(RLC_UCODE_CNTL, 0); - fw_data = (const __be32 *)rdev->rlc_fw->data; + fw_data = (const __be32 *)rdev->rlc_fw; if (rdev->family >= CHIP_ARUBA) { for (i = 0; i < ARUBA_RLC_UCODE_SIZE; i++) { WREG32(RLC_UCODE_ADDR, i); @@ -3369,7 +3363,6 @@ static int r600_rlc_init(struct radeon_device *rdev) r600_rlc_start(rdev); return 0; -#endif } static void r600_enable_interrupts(struct radeon_device *rdev) diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h index 6dd9a657ed9..45867b4d7ed 100644 --- a/sys/dev/pci/drm/radeon/radeon.h +++ b/sys/dev/pci/drm/radeon/radeon.h @@ -1620,19 +1620,16 @@ struct radeon_device { bool need_dma32; bool accel_working; struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES]; - u_char *me_fw; /* all family ME firmware */ + u_char *me_fw; /* all family ME firmware */ size_t me_fw_size; - const u32 (*pfp_fw)[2]; - const u32 (*rlc_fw)[2]; - const u32 (*mc_fw)[2]; - const u32 (*ce_fw)[2]; -#ifdef notyet - const struct firmware *me_fw; /* all family ME firmware */ - const struct firmware *pfp_fw; /* r6/700 PFP firmware */ - const struct firmware *rlc_fw; /* r6/700 RLC firmware */ - const struct firmware *mc_fw; /* NI MC firmware */ - const struct firmware *ce_fw; /* SI CE firmware */ -#endif + u_char *pfp_fw; /* r6/700 PFP firmware */ + size_t pfp_fw_size; + u_char *rlc_fw; /* r6/700 RLC firmware */ + size_t rlc_fw_size; + u_char *mc_fw; /* NI MC firmware */ + size_t mc_fw_size; + u_char *ce_fw; /* SI CE firmware */ + size_t ce_fw_size; struct r600_blit r600_blit; struct r600_vram_scratch vram_scratch; int msi_enabled; /* msi enabled */ diff --git a/sys/dev/pci/drm/radeon/si.c b/sys/dev/pci/drm/radeon/si.c index 2c6478ecdf6..afab22256e9 100644 --- a/sys/dev/pci/drm/radeon/si.c +++ b/sys/dev/pci/drm/radeon/si.c @@ -204,9 +204,6 @@ static const u32 verde_io_mc_regs[TAHITI_IO_MC_REGS_SIZE][2] = { /* ucode loading */ static int si_mc_load_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet const __be32 *fw_data; u32 running, blackout = 0; u32 *io_mc_regs; @@ -252,7 +249,7 @@ static int si_mc_load_microcode(struct radeon_device *rdev) WREG32(MC_SEQ_IO_DEBUG_DATA, io_mc_regs[(i << 1) + 1]); } /* load the MC ucode */ - fw_data = (const __be32 *)rdev->mc_fw->data; + fw_data = (const __be32 *)rdev->mc_fw; for (i = 0; i < ucode_size; i++) WREG32(MC_SEQ_SUP_PGM, be32_to_cpup(fw_data++)); @@ -278,15 +275,10 @@ static int si_mc_load_microcode(struct radeon_device *rdev) } return 0; -#endif } static int si_init_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet - struct platform_device *pdev; const char *chip_name; const char *rlc_chip_name; size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; @@ -295,17 +287,10 @@ static int si_init_microcode(struct radeon_device *rdev) DRM_DEBUG("\n"); - pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0); - err = IS_ERR(pdev); - if (err) { - DRM_ERROR( "radeon_cp: Failed to register firmware\n"); - return -EINVAL; - } - switch (rdev->family) { case CHIP_TAHITI: - chip_name = "TAHITI"; - rlc_chip_name = "TAHITI"; + chip_name = "tahiti"; + rlc_chip_name = "tahiti"; pfp_req_size = SI_PFP_UCODE_SIZE * 4; me_req_size = SI_PM4_UCODE_SIZE * 4; ce_req_size = SI_CE_UCODE_SIZE * 4; @@ -313,8 +298,8 @@ static int si_init_microcode(struct radeon_device *rdev) mc_req_size = SI_MC_UCODE_SIZE * 4; break; case CHIP_PITCAIRN: - chip_name = "PITCAIRN"; - rlc_chip_name = "PITCAIRN"; + chip_name = "pitcairn"; + rlc_chip_name = "pitcairn"; pfp_req_size = SI_PFP_UCODE_SIZE * 4; me_req_size = SI_PM4_UCODE_SIZE * 4; ce_req_size = SI_CE_UCODE_SIZE * 4; @@ -322,8 +307,8 @@ static int si_init_microcode(struct radeon_device *rdev) mc_req_size = SI_MC_UCODE_SIZE * 4; break; case CHIP_VERDE: - chip_name = "VERDE"; - rlc_chip_name = "VERDE"; + chip_name = "verde"; + rlc_chip_name = "verde"; pfp_req_size = SI_PFP_UCODE_SIZE * 4; me_req_size = SI_PM4_UCODE_SIZE * 4; ce_req_size = SI_CE_UCODE_SIZE * 4; @@ -335,83 +320,90 @@ static int si_init_microcode(struct radeon_device *rdev) DRM_INFO("Loading %s Microcode\n", chip_name); - snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); - err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_pfp", chip_name); + err = loadfirmware(fw_name, &rdev->pfp_fw, &rdev->pfp_fw_size); if (err) goto out; - if (rdev->pfp_fw->size != pfp_req_size) { + if (rdev->pfp_fw_size != pfp_req_size) { DRM_ERROR( "si_cp: Bogus length %zu in firmware \"%s\"\n", - rdev->pfp_fw->size, fw_name); + rdev->pfp_fw_size, fw_name); err = -EINVAL; goto out; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); - err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_me", chip_name); + err = loadfirmware(fw_name, &rdev->me_fw, &rdev->me_fw_size); if (err) goto out; - if (rdev->me_fw->size != me_req_size) { + if (rdev->me_fw_size != me_req_size) { DRM_ERROR( "si_cp: Bogus length %zu in firmware \"%s\"\n", - rdev->me_fw->size, fw_name); + rdev->me_fw_size, fw_name); err = -EINVAL; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name); - err = request_firmware(&rdev->ce_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_ce", chip_name); + err = loadfirmware(fw_name, &rdev->ce_fw, &rdev->ce_fw_size); if (err) goto out; - if (rdev->ce_fw->size != ce_req_size) { + if (rdev->ce_fw_size != ce_req_size) { DRM_ERROR( "si_cp: Bogus length %zu in firmware \"%s\"\n", - rdev->ce_fw->size, fw_name); + rdev->ce_fw_size, fw_name); err = -EINVAL; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); - err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_rlc", rlc_chip_name); + err = loadfirmware(fw_name, &rdev->rlc_fw, &rdev->rlc_fw_size); if (err) goto out; - if (rdev->rlc_fw->size != rlc_req_size) { + if (rdev->rlc_fw_size != rlc_req_size) { DRM_ERROR( "si_rlc: Bogus length %zu in firmware \"%s\"\n", - rdev->rlc_fw->size, fw_name); + rdev->rlc_fw_size, fw_name); err = -EINVAL; } - snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); - err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); + snprintf(fw_name, sizeof(fw_name), "radeon-%s_mc", chip_name); + err = loadfirmware(fw_name, &rdev->mc_fw, &rdev->mc_fw_size); if (err) goto out; - if (rdev->mc_fw->size != mc_req_size) { + if (rdev->mc_fw_size != mc_req_size) { DRM_ERROR( "si_mc: Bogus length %zu in firmware \"%s\"\n", - rdev->mc_fw->size, fw_name); + rdev->mc_fw_size, fw_name); err = -EINVAL; } out: - platform_device_unregister(pdev); - if (err) { if (err != -EINVAL) DRM_ERROR( "si_cp: Failed to load firmware \"%s\"\n", fw_name); - release_firmware(rdev->pfp_fw); - rdev->pfp_fw = NULL; - release_firmware(rdev->me_fw); - rdev->me_fw = NULL; - release_firmware(rdev->ce_fw); - rdev->ce_fw = NULL; - release_firmware(rdev->rlc_fw); - rdev->rlc_fw = NULL; - release_firmware(rdev->mc_fw); - rdev->mc_fw = NULL; + if (rdev->pfp_fw) { + free(rdev->pfp_fw, M_DEVBUF); + rdev->pfp_fw = NULL; + } + if (rdev->me_fw) { + free(rdev->pfp_fw, M_DEVBUF); + rdev->me_fw = NULL; + } + if (rdev->ce_fw) { + free(rdev->ce_fw, M_DEVBUF); + rdev->ce_fw = NULL; + } + if (rdev->rlc_fw) { + free(rdev->rlc_fw, M_DEVBUF); + rdev->rlc_fw = NULL; + } + if (rdev->mc_fw) { + free(rdev->mc_fw, M_DEVBUF); + rdev->mc_fw = NULL; + } } return err; -#endif } /* watermark setup */ @@ -1856,9 +1848,6 @@ static void si_cp_enable(struct radeon_device *rdev, bool enable) static int si_cp_load_microcode(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet const __be32 *fw_data; int i; @@ -1868,21 +1857,21 @@ static int si_cp_load_microcode(struct radeon_device *rdev) si_cp_enable(rdev, false); /* PFP */ - fw_data = (const __be32 *)rdev->pfp_fw->data; + fw_data = (const __be32 *)rdev->pfp_fw; WREG32(CP_PFP_UCODE_ADDR, 0); for (i = 0; i < SI_PFP_UCODE_SIZE; i++) WREG32(CP_PFP_UCODE_DATA, be32_to_cpup(fw_data++)); WREG32(CP_PFP_UCODE_ADDR, 0); /* CE */ - fw_data = (const __be32 *)rdev->ce_fw->data; + fw_data = (const __be32 *)rdev->ce_fw; WREG32(CP_CE_UCODE_ADDR, 0); for (i = 0; i < SI_CE_UCODE_SIZE; i++) WREG32(CP_CE_UCODE_DATA, be32_to_cpup(fw_data++)); WREG32(CP_CE_UCODE_ADDR, 0); /* ME */ - fw_data = (const __be32 *)rdev->me_fw->data; + fw_data = (const __be32 *)rdev->me_fw; WREG32(CP_ME_RAM_WADDR, 0); for (i = 0; i < SI_PM4_UCODE_SIZE; i++) WREG32(CP_ME_RAM_DATA, be32_to_cpup(fw_data++)); @@ -1893,7 +1882,6 @@ static int si_cp_load_microcode(struct radeon_device *rdev) WREG32(CP_ME_RAM_WADDR, 0); WREG32(CP_ME_RAM_RADDR, 0); return 0; -#endif } static int si_cp_start(struct radeon_device *rdev) @@ -3203,9 +3191,6 @@ si_rlc_start(struct radeon_device *rdev) static int si_rlc_resume(struct radeon_device *rdev) { - printf("%s stub\n", __func__); - return -ENOSYS; -#ifdef notyet u32 i; const __be32 *fw_data; @@ -3226,7 +3211,7 @@ static int si_rlc_resume(struct radeon_device *rdev) WREG32(RLC_MC_CNTL, 0); WREG32(RLC_UCODE_CNTL, 0); - fw_data = (const __be32 *)rdev->rlc_fw->data; + fw_data = (const __be32 *)rdev->rlc_fw; for (i = 0; i < SI_RLC_UCODE_SIZE; i++) { WREG32(RLC_UCODE_ADDR, i); WREG32(RLC_UCODE_DATA, be32_to_cpup(fw_data++)); @@ -3236,7 +3221,6 @@ static int si_rlc_resume(struct radeon_device *rdev) si_rlc_start(rdev); return 0; -#endif } static void si_enable_interrupts(struct radeon_device *rdev) |