aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorKen Wang <Qingqing.Wang@amd.com>2016-01-21 06:08:55 -0500
committerAlex Deucher <alexander.deucher@amd.com>2016-08-31 15:21:07 -0400
commitda69c161448d6a682b3761d9bc444161cbf25337 (patch)
tree76cc9dcd8754ef6e5f204e2fdeb148e8c09d2fd6 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent33f34802686c8bcfd236e085208ea6338d220251 (diff)
drm/amdgpu: add si specific logic into the device initialize function v3
v3: guard doorbell_fini as well Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Ken Wang <Qingqing.Wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index abea6f23c184..aef9a9ac6280 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -55,6 +55,11 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
55static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev); 55static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
56 56
57static const char *amdgpu_asic_name[] = { 57static const char *amdgpu_asic_name[] = {
58 "TAHITI",
59 "PITCAIRN",
60 "VERDE",
61 "OLAND",
62 "HAINAN",
58 "BONAIRE", 63 "BONAIRE",
59 "KAVERI", 64 "KAVERI",
60 "KABINI", 65 "KABINI",
@@ -1571,8 +1576,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1571 INIT_LIST_HEAD(&adev->shadow_list); 1576 INIT_LIST_HEAD(&adev->shadow_list);
1572 mutex_init(&adev->shadow_list_lock); 1577 mutex_init(&adev->shadow_list_lock);
1573 1578
1574 adev->rmmio_base = pci_resource_start(adev->pdev, 5); 1579 if (adev->asic_type >= CHIP_BONAIRE) {
1575 adev->rmmio_size = pci_resource_len(adev->pdev, 5); 1580 adev->rmmio_base = pci_resource_start(adev->pdev, 5);
1581 adev->rmmio_size = pci_resource_len(adev->pdev, 5);
1582 } else {
1583 adev->rmmio_base = pci_resource_start(adev->pdev, 2);
1584 adev->rmmio_size = pci_resource_len(adev->pdev, 2);
1585 }
1576 adev->rmmio = ioremap(adev->rmmio_base, adev->rmmio_size); 1586 adev->rmmio = ioremap(adev->rmmio_base, adev->rmmio_size);
1577 if (adev->rmmio == NULL) { 1587 if (adev->rmmio == NULL) {
1578 return -ENOMEM; 1588 return -ENOMEM;
@@ -1580,8 +1590,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1580 DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base); 1590 DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base);
1581 DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size); 1591 DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size);
1582 1592
1583 /* doorbell bar mapping */ 1593 if (adev->asic_type >= CHIP_BONAIRE)
1584 amdgpu_doorbell_init(adev); 1594 /* doorbell bar mapping */
1595 amdgpu_doorbell_init(adev);
1585 1596
1586 /* io port mapping */ 1597 /* io port mapping */
1587 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 1598 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
@@ -1790,7 +1801,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
1790 adev->rio_mem = NULL; 1801 adev->rio_mem = NULL;
1791 iounmap(adev->rmmio); 1802 iounmap(adev->rmmio);
1792 adev->rmmio = NULL; 1803 adev->rmmio = NULL;
1793 amdgpu_doorbell_fini(adev); 1804 if (adev->asic_type >= CHIP_BONAIRE)
1805 amdgpu_doorbell_fini(adev);
1794 amdgpu_debugfs_regs_cleanup(adev); 1806 amdgpu_debugfs_regs_cleanup(adev);
1795 amdgpu_debugfs_remove_files(adev); 1807 amdgpu_debugfs_remove_files(adev);
1796} 1808}