aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2012-03-20 17:18:39 -0400
committerDave Airlie <airlied@redhat.com>2012-03-21 02:55:57 -0400
commitc420c7454f9c13d2dc706516d13fb9329ccacd05 (patch)
tree7c39ee95586f2a436d81ef1d86a10fef9dfad852 /drivers
parente71270fd80e99211a704c981c0f48d4e02a33473 (diff)
drm/radeon/kms: add support for ucode loading on trinity (v2)
v2: fix check for MC ucode from Tom. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/radeon/ni.c82
-rw-r--r--drivers/gpu/drm/radeon/r600.c21
-rw-r--r--drivers/gpu/drm/radeon/r600d.h4
-rw-r--r--drivers/gpu/drm/radeon/si.c4
4 files changed, 87 insertions, 24 deletions
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index bae3ec332b45..a48ca53fcd6a 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -42,6 +42,8 @@ extern void evergreen_irq_suspend(struct radeon_device *rdev);
42extern int evergreen_mc_init(struct radeon_device *rdev); 42extern int evergreen_mc_init(struct radeon_device *rdev);
43extern void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev); 43extern void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev);
44extern void evergreen_pcie_gen2_enable(struct radeon_device *rdev); 44extern void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
45extern void si_rlc_fini(struct radeon_device *rdev);
46extern int si_rlc_init(struct radeon_device *rdev);
45 47
46#define EVERGREEN_PFP_UCODE_SIZE 1120 48#define EVERGREEN_PFP_UCODE_SIZE 1120
47#define EVERGREEN_PM4_UCODE_SIZE 1376 49#define EVERGREEN_PM4_UCODE_SIZE 1376
@@ -53,6 +55,8 @@ extern void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
53#define CAYMAN_RLC_UCODE_SIZE 1024 55#define CAYMAN_RLC_UCODE_SIZE 1024
54#define CAYMAN_MC_UCODE_SIZE 6037 56#define CAYMAN_MC_UCODE_SIZE 6037
55 57
58#define ARUBA_RLC_UCODE_SIZE 1536
59
56/* Firmware Names */ 60/* Firmware Names */
57MODULE_FIRMWARE("radeon/BARTS_pfp.bin"); 61MODULE_FIRMWARE("radeon/BARTS_pfp.bin");
58MODULE_FIRMWARE("radeon/BARTS_me.bin"); 62MODULE_FIRMWARE("radeon/BARTS_me.bin");
@@ -68,6 +72,9 @@ MODULE_FIRMWARE("radeon/CAYMAN_pfp.bin");
68MODULE_FIRMWARE("radeon/CAYMAN_me.bin"); 72MODULE_FIRMWARE("radeon/CAYMAN_me.bin");
69MODULE_FIRMWARE("radeon/CAYMAN_mc.bin"); 73MODULE_FIRMWARE("radeon/CAYMAN_mc.bin");
70MODULE_FIRMWARE("radeon/CAYMAN_rlc.bin"); 74MODULE_FIRMWARE("radeon/CAYMAN_rlc.bin");
75MODULE_FIRMWARE("radeon/ARUBA_pfp.bin");
76MODULE_FIRMWARE("radeon/ARUBA_me.bin");
77MODULE_FIRMWARE("radeon/ARUBA_rlc.bin");
71 78
72#define BTC_IO_MC_REGS_SIZE 29 79#define BTC_IO_MC_REGS_SIZE 29
73 80
@@ -326,6 +333,15 @@ int ni_init_microcode(struct radeon_device *rdev)
326 rlc_req_size = CAYMAN_RLC_UCODE_SIZE * 4; 333 rlc_req_size = CAYMAN_RLC_UCODE_SIZE * 4;
327 mc_req_size = CAYMAN_MC_UCODE_SIZE * 4; 334 mc_req_size = CAYMAN_MC_UCODE_SIZE * 4;
328 break; 335 break;
336 case CHIP_ARUBA:
337 chip_name = "ARUBA";
338 rlc_chip_name = "ARUBA";
339 /* pfp/me same size as CAYMAN */
340 pfp_req_size = CAYMAN_PFP_UCODE_SIZE * 4;
341 me_req_size = CAYMAN_PM4_UCODE_SIZE * 4;
342 rlc_req_size = ARUBA_RLC_UCODE_SIZE * 4;
343 mc_req_size = 0;
344 break;
329 default: BUG(); 345 default: BUG();
330 } 346 }
331 347
@@ -365,15 +381,18 @@ int ni_init_microcode(struct radeon_device *rdev)
365 err = -EINVAL; 381 err = -EINVAL;
366 } 382 }
367 383
368 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 384 /* no MC ucode on TN */
369 err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); 385 if (!(rdev->flags & RADEON_IS_IGP)) {
370 if (err) 386 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name);
371 goto out; 387 err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev);
372 if (rdev->mc_fw->size != mc_req_size) { 388 if (err)
373 printk(KERN_ERR 389 goto out;
374 "ni_mc: Bogus length %zu in firmware \"%s\"\n", 390 if (rdev->mc_fw->size != mc_req_size) {
375 rdev->mc_fw->size, fw_name); 391 printk(KERN_ERR
376 err = -EINVAL; 392 "ni_mc: Bogus length %zu in firmware \"%s\"\n",
393 rdev->mc_fw->size, fw_name);
394 err = -EINVAL;
395 }
377 } 396 }
378out: 397out:
379 platform_device_unregister(pdev); 398 platform_device_unregister(pdev);
@@ -1484,18 +1503,29 @@ static int cayman_startup(struct radeon_device *rdev)
1484 /* enable pcie gen2 link */ 1503 /* enable pcie gen2 link */
1485 evergreen_pcie_gen2_enable(rdev); 1504 evergreen_pcie_gen2_enable(rdev);
1486 1505
1487 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { 1506 if (rdev->flags & RADEON_IS_IGP) {
1488 r = ni_init_microcode(rdev); 1507 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
1508 r = ni_init_microcode(rdev);
1509 if (r) {
1510 DRM_ERROR("Failed to load firmware!\n");
1511 return r;
1512 }
1513 }
1514 } else {
1515 if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) {
1516 r = ni_init_microcode(rdev);
1517 if (r) {
1518 DRM_ERROR("Failed to load firmware!\n");
1519 return r;
1520 }
1521 }
1522
1523 r = ni_mc_load_microcode(rdev);
1489 if (r) { 1524 if (r) {
1490 DRM_ERROR("Failed to load firmware!\n"); 1525 DRM_ERROR("Failed to load MC firmware!\n");
1491 return r; 1526 return r;
1492 } 1527 }
1493 } 1528 }
1494 r = ni_mc_load_microcode(rdev);
1495 if (r) {
1496 DRM_ERROR("Failed to load MC firmware!\n");
1497 return r;
1498 }
1499 1529
1500 r = r600_vram_scratch_init(rdev); 1530 r = r600_vram_scratch_init(rdev);
1501 if (r) 1531 if (r)
@@ -1514,6 +1544,15 @@ static int cayman_startup(struct radeon_device *rdev)
1514 dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r); 1544 dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
1515 } 1545 }
1516 1546
1547 /* allocate rlc buffers */
1548 if (rdev->flags & RADEON_IS_IGP) {
1549 r = si_rlc_init(rdev);
1550 if (r) {
1551 DRM_ERROR("Failed to init rlc BOs!\n");
1552 return r;
1553 }
1554 }
1555
1517 /* allocate wb buffer */ 1556 /* allocate wb buffer */
1518 r = radeon_wb_init(rdev); 1557 r = radeon_wb_init(rdev);
1519 if (r) 1558 if (r)
@@ -1698,6 +1737,8 @@ int cayman_init(struct radeon_device *rdev)
1698 dev_err(rdev->dev, "disabling GPU acceleration\n"); 1737 dev_err(rdev->dev, "disabling GPU acceleration\n");
1699 cayman_cp_fini(rdev); 1738 cayman_cp_fini(rdev);
1700 r600_irq_fini(rdev); 1739 r600_irq_fini(rdev);
1740 if (rdev->flags & RADEON_IS_IGP)
1741 si_rlc_fini(rdev);
1701 radeon_wb_fini(rdev); 1742 radeon_wb_fini(rdev);
1702 r100_ib_fini(rdev); 1743 r100_ib_fini(rdev);
1703 radeon_vm_manager_fini(rdev); 1744 radeon_vm_manager_fini(rdev);
@@ -1709,8 +1750,11 @@ int cayman_init(struct radeon_device *rdev)
1709 /* Don't start up if the MC ucode is missing. 1750 /* Don't start up if the MC ucode is missing.
1710 * The default clocks and voltages before the MC ucode 1751 * The default clocks and voltages before the MC ucode
1711 * is loaded are not suffient for advanced operations. 1752 * is loaded are not suffient for advanced operations.
1753 *
1754 * We can skip this check for TN, because there is no MC
1755 * ucode.
1712 */ 1756 */
1713 if (!rdev->mc_fw) { 1757 if (!rdev->mc_fw && !(rdev->flags & RADEON_IS_IGP)) {
1714 DRM_ERROR("radeon: MC ucode required for NI+.\n"); 1758 DRM_ERROR("radeon: MC ucode required for NI+.\n");
1715 return -EINVAL; 1759 return -EINVAL;
1716 } 1760 }
@@ -1723,6 +1767,8 @@ void cayman_fini(struct radeon_device *rdev)
1723 r600_blit_fini(rdev); 1767 r600_blit_fini(rdev);
1724 cayman_cp_fini(rdev); 1768 cayman_cp_fini(rdev);
1725 r600_irq_fini(rdev); 1769 r600_irq_fini(rdev);
1770 if (rdev->flags & RADEON_IS_IGP)
1771 si_rlc_fini(rdev);
1726 radeon_wb_fini(rdev); 1772 radeon_wb_fini(rdev);
1727 radeon_vm_manager_fini(rdev); 1773 radeon_vm_manager_fini(rdev);
1728 r100_ib_fini(rdev); 1774 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 924b68718b82..391bd2636a80 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -49,6 +49,7 @@
49#define EVERGREEN_PM4_UCODE_SIZE 1376 49#define EVERGREEN_PM4_UCODE_SIZE 1376
50#define EVERGREEN_RLC_UCODE_SIZE 768 50#define EVERGREEN_RLC_UCODE_SIZE 768
51#define CAYMAN_RLC_UCODE_SIZE 1024 51#define CAYMAN_RLC_UCODE_SIZE 1024
52#define ARUBA_RLC_UCODE_SIZE 1536
52 53
53/* Firmware Names */ 54/* Firmware Names */
54MODULE_FIRMWARE("radeon/R600_pfp.bin"); 55MODULE_FIRMWARE("radeon/R600_pfp.bin");
@@ -2861,10 +2862,17 @@ static int r600_rlc_init(struct radeon_device *rdev)
2861 2862
2862 r600_rlc_stop(rdev); 2863 r600_rlc_stop(rdev);
2863 2864
2864 WREG32(RLC_HB_BASE, 0);
2865 WREG32(RLC_HB_CNTL, 0); 2865 WREG32(RLC_HB_CNTL, 0);
2866 WREG32(RLC_HB_RPTR, 0); 2866
2867 WREG32(RLC_HB_WPTR, 0); 2867 if (rdev->family == CHIP_ARUBA) {
2868 WREG32(TN_RLC_SAVE_AND_RESTORE_BASE, rdev->rlc.save_restore_gpu_addr >> 8);
2869 WREG32(TN_RLC_CLEAR_STATE_RESTORE_BASE, rdev->rlc.clear_state_gpu_addr >> 8);
2870 }
2871 if (rdev->family <= CHIP_CAYMAN) {
2872 WREG32(RLC_HB_BASE, 0);
2873 WREG32(RLC_HB_RPTR, 0);
2874 WREG32(RLC_HB_WPTR, 0);
2875 }
2868 if (rdev->family <= CHIP_CAICOS) { 2876 if (rdev->family <= CHIP_CAICOS) {
2869 WREG32(RLC_HB_WPTR_LSB_ADDR, 0); 2877 WREG32(RLC_HB_WPTR_LSB_ADDR, 0);
2870 WREG32(RLC_HB_WPTR_MSB_ADDR, 0); 2878 WREG32(RLC_HB_WPTR_MSB_ADDR, 0);
@@ -2873,7 +2881,12 @@ static int r600_rlc_init(struct radeon_device *rdev)
2873 WREG32(RLC_UCODE_CNTL, 0); 2881 WREG32(RLC_UCODE_CNTL, 0);
2874 2882
2875 fw_data = (const __be32 *)rdev->rlc_fw->data; 2883 fw_data = (const __be32 *)rdev->rlc_fw->data;
2876 if (rdev->family >= CHIP_CAYMAN) { 2884 if (rdev->family >= CHIP_ARUBA) {
2885 for (i = 0; i < ARUBA_RLC_UCODE_SIZE; i++) {
2886 WREG32(RLC_UCODE_ADDR, i);
2887 WREG32(RLC_UCODE_DATA, be32_to_cpup(fw_data++));
2888 }
2889 } else if (rdev->family >= CHIP_CAYMAN) {
2877 for (i = 0; i < CAYMAN_RLC_UCODE_SIZE; i++) { 2890 for (i = 0; i < CAYMAN_RLC_UCODE_SIZE; i++) {
2878 WREG32(RLC_UCODE_ADDR, i); 2891 WREG32(RLC_UCODE_ADDR, i);
2879 WREG32(RLC_UCODE_DATA, be32_to_cpup(fw_data++)); 2892 WREG32(RLC_UCODE_DATA, be32_to_cpup(fw_data++));
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 8ae328ff5fdd..3568a2e345fa 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -593,6 +593,10 @@
593#define RLC_UCODE_ADDR 0x3f2c 593#define RLC_UCODE_ADDR 0x3f2c
594#define RLC_UCODE_DATA 0x3f30 594#define RLC_UCODE_DATA 0x3f30
595 595
596/* new for TN */
597#define TN_RLC_SAVE_AND_RESTORE_BASE 0x3f10
598#define TN_RLC_CLEAR_STATE_RESTORE_BASE 0x3f20
599
596#define SRBM_SOFT_RESET 0xe60 600#define SRBM_SOFT_RESET 0xe60
597# define SOFT_RESET_RLC (1 << 13) 601# define SOFT_RESET_RLC (1 << 13)
598 602
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index d773ea9c30f7..ac7a199ffece 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2949,7 +2949,7 @@ void si_vm_tlb_flush(struct radeon_device *rdev, struct radeon_vm *vm)
2949/* 2949/*
2950 * RLC 2950 * RLC
2951 */ 2951 */
2952static void si_rlc_fini(struct radeon_device *rdev) 2952void si_rlc_fini(struct radeon_device *rdev)
2953{ 2953{
2954 int r; 2954 int r;
2955 2955
@@ -2978,7 +2978,7 @@ static void si_rlc_fini(struct radeon_device *rdev)
2978 } 2978 }
2979} 2979}
2980 2980
2981static int si_rlc_init(struct radeon_device *rdev) 2981int si_rlc_init(struct radeon_device *rdev)
2982{ 2982{
2983 int r; 2983 int r;
2984 2984