summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c
index 71ef4d4537e..3509e8b3815 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c
@@ -886,6 +886,7 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb)
*/
int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
{
+#ifdef __linux__
u64 space_needed = roundup_pow_of_two(adev->gmc.real_vram_size);
u32 rbar_size = order_base_2(((space_needed >> 20) | 1)) - 1;
struct pci_bus *root;
@@ -893,16 +894,10 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
unsigned i;
u16 cmd;
int r;
- pcireg_t type;
-
- /* XXX not right yet */
- STUB();
- return 0;
/* Bypass for VF */
if (amdgpu_sriov_vf(adev))
return 0;
-#ifdef notyet
/* Check if the root BUS has 64bit memory resources */
root = adev->pdev->bus;
@@ -918,7 +913,6 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
/* Trying to resize is pointless without a root hub window above 4GB */
if (!res)
return 0;
-#endif
/* Disable memory decoding while we change the BAR addresses and size */
pci_read_config_word(adev->pdev, PCI_COMMAND, &cmd);
@@ -927,12 +921,10 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
/* Free the VRAM and doorbell BAR, we most likely need to move both. */
amdgpu_device_doorbell_fini(adev);
-#ifdef __linux__
if (adev->asic_type >= CHIP_BONAIRE)
pci_release_resource(adev->pdev, 2);
pci_release_resource(adev->pdev, 0);
-#endif
r = pci_resize_resource(adev->pdev, 0, rbar_size);
if (r == -ENOSPC)
@@ -940,31 +932,17 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
else if (r && r != -ENOTSUPP)
DRM_ERROR("Problem resizing BAR0 (%d).", r);
-#ifdef __linux__
pci_assign_unassigned_bus_resources(adev->pdev->bus);
-#else
-#define AMDGPU_PCI_MEM 0x10
- type = pci_mapreg_type(adev->pc, adev->pa_tag, AMDGPU_PCI_MEM);
- if (PCI_MAPREG_TYPE(type) != PCI_MAPREG_TYPE_MEM ||
- pci_mapreg_info(adev->pc, adev->pa_tag, AMDGPU_PCI_MEM,
- type, NULL, &adev->fb_aper_size, NULL)) {
- printf(": can't get frambuffer info\n");
- return -ENODEV;
- }
-#endif
/* When the doorbell or fb BAR isn't available we have no chance of
* using the device.
*/
r = amdgpu_device_doorbell_init(adev);
-#ifdef notyet
if (r || (pci_resource_flags(adev->pdev, 0) & IORESOURCE_UNSET))
-#else
- if (r)
-#endif
return -ENODEV;
pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
+#endif /* __linux__ */
return 0;
}