diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 856378434ea2..690cf77b950e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -87,6 +87,8 @@ static const char *amdgpu_asic_name[] = { | |||
87 | "LAST", | 87 | "LAST", |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev); | ||
91 | |||
90 | bool amdgpu_device_is_px(struct drm_device *dev) | 92 | bool amdgpu_device_is_px(struct drm_device *dev) |
91 | { | 93 | { |
92 | struct amdgpu_device *adev = dev->dev_private; | 94 | struct amdgpu_device *adev = dev->dev_private; |
@@ -121,6 +123,32 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg, | |||
121 | return ret; | 123 | return ret; |
122 | } | 124 | } |
123 | 125 | ||
126 | /* | ||
127 | * MMIO register read with bytes helper functions | ||
128 | * @offset:bytes offset from MMIO start | ||
129 | * | ||
130 | */ | ||
131 | |||
132 | uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset) { | ||
133 | if (offset < adev->rmmio_size) | ||
134 | return (readb(adev->rmmio + offset)); | ||
135 | BUG(); | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * MMIO register write with bytes helper functions | ||
140 | * @offset:bytes offset from MMIO start | ||
141 | * @value: the value want to be written to the register | ||
142 | * | ||
143 | */ | ||
144 | void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value) { | ||
145 | if (offset < adev->rmmio_size) | ||
146 | writeb(value, adev->rmmio + offset); | ||
147 | else | ||
148 | BUG(); | ||
149 | } | ||
150 | |||
151 | |||
124 | void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v, | 152 | void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v, |
125 | uint32_t acc_flags) | 153 | uint32_t acc_flags) |
126 | { | 154 | { |
@@ -830,6 +858,8 @@ static void amdgpu_device_check_arguments(struct amdgpu_device *adev) | |||
830 | dev_warn(adev->dev, "lockup_timeout msut be > 0, adjusting to 10000\n"); | 858 | dev_warn(adev->dev, "lockup_timeout msut be > 0, adjusting to 10000\n"); |
831 | amdgpu_lockup_timeout = 10000; | 859 | amdgpu_lockup_timeout = 10000; |
832 | } | 860 | } |
861 | |||
862 | adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type); | ||
833 | } | 863 | } |
834 | 864 | ||
835 | /** | 865 | /** |
@@ -1387,7 +1417,8 @@ static int amdgpu_device_ip_late_set_cg_state(struct amdgpu_device *adev) | |||
1387 | continue; | 1417 | continue; |
1388 | /* skip CG for VCE/UVD, it's handled specially */ | 1418 | /* skip CG for VCE/UVD, it's handled specially */ |
1389 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && | 1419 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && |
1390 | adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) { | 1420 | adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE && |
1421 | adev->ip_blocks[i].version->funcs->set_clockgating_state) { | ||
1391 | /* enable clockgating to save power */ | 1422 | /* enable clockgating to save power */ |
1392 | r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, | 1423 | r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, |
1393 | AMD_CG_STATE_GATE); | 1424 | AMD_CG_STATE_GATE); |
@@ -1436,7 +1467,8 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev) | |||
1436 | for (i = 0; i < adev->num_ip_blocks; i++) { | 1467 | for (i = 0; i < adev->num_ip_blocks; i++) { |
1437 | if (!adev->ip_blocks[i].status.hw) | 1468 | if (!adev->ip_blocks[i].status.hw) |
1438 | continue; | 1469 | continue; |
1439 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) { | 1470 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC && |
1471 | adev->ip_blocks[i].version->funcs->set_clockgating_state) { | ||
1440 | /* ungate blocks before hw fini so that we can shutdown the blocks safely */ | 1472 | /* ungate blocks before hw fini so that we can shutdown the blocks safely */ |
1441 | r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, | 1473 | r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, |
1442 | AMD_CG_STATE_UNGATE); | 1474 | AMD_CG_STATE_UNGATE); |
@@ -1545,7 +1577,8 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev) | |||
1545 | if (!adev->ip_blocks[i].status.valid) | 1577 | if (!adev->ip_blocks[i].status.valid) |
1546 | continue; | 1578 | continue; |
1547 | /* ungate blocks so that suspend can properly shut them down */ | 1579 | /* ungate blocks so that suspend can properly shut them down */ |
1548 | if (i != AMD_IP_BLOCK_TYPE_SMC) { | 1580 | if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_SMC && |
1581 | adev->ip_blocks[i].version->funcs->set_clockgating_state) { | ||
1549 | r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, | 1582 | r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev, |
1550 | AMD_CG_STATE_UNGATE); | 1583 | AMD_CG_STATE_UNGATE); |
1551 | if (r) { | 1584 | if (r) { |
@@ -1878,6 +1911,8 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1878 | if (adev->rio_mem == NULL) | 1911 | if (adev->rio_mem == NULL) |
1879 | DRM_INFO("PCI I/O BAR is not found.\n"); | 1912 | DRM_INFO("PCI I/O BAR is not found.\n"); |
1880 | 1913 | ||
1914 | amdgpu_device_get_pcie_info(adev); | ||
1915 | |||
1881 | /* early init functions */ | 1916 | /* early init functions */ |
1882 | r = amdgpu_device_ip_early_init(adev); | 1917 | r = amdgpu_device_ip_early_init(adev); |
1883 | if (r) | 1918 | if (r) |
@@ -2086,6 +2121,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev) | |||
2086 | 2121 | ||
2087 | amdgpu_ib_pool_fini(adev); | 2122 | amdgpu_ib_pool_fini(adev); |
2088 | amdgpu_fence_driver_fini(adev); | 2123 | amdgpu_fence_driver_fini(adev); |
2124 | amdgpu_pm_sysfs_fini(adev); | ||
2089 | amdgpu_fbdev_fini(adev); | 2125 | amdgpu_fbdev_fini(adev); |
2090 | r = amdgpu_device_ip_fini(adev); | 2126 | r = amdgpu_device_ip_fini(adev); |
2091 | if (adev->firmware.gpu_info_fw) { | 2127 | if (adev->firmware.gpu_info_fw) { |
@@ -2114,7 +2150,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev) | |||
2114 | iounmap(adev->rmmio); | 2150 | iounmap(adev->rmmio); |
2115 | adev->rmmio = NULL; | 2151 | adev->rmmio = NULL; |
2116 | amdgpu_device_doorbell_fini(adev); | 2152 | amdgpu_device_doorbell_fini(adev); |
2117 | amdgpu_pm_sysfs_fini(adev); | ||
2118 | amdgpu_debugfs_regs_cleanup(adev); | 2153 | amdgpu_debugfs_regs_cleanup(adev); |
2119 | } | 2154 | } |
2120 | 2155 | ||
@@ -2755,7 +2790,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, | |||
2755 | return r; | 2790 | return r; |
2756 | } | 2791 | } |
2757 | 2792 | ||
2758 | void amdgpu_device_get_pcie_info(struct amdgpu_device *adev) | 2793 | static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev) |
2759 | { | 2794 | { |
2760 | u32 mask; | 2795 | u32 mask; |
2761 | int ret; | 2796 | int ret; |