drm/radeon: Add early unregister of firmware fb's
diff mbox

Message ID 1286383147-5180-1-git-send-email-daniel.vetter@ffwll.ch
State New, archived
Headers show

Commit Message

Daniel Vetter Oct. 6, 2010, 4:39 p.m. UTC
None

Patch
diff mbox

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 256d204..3aea1a8 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -584,6 +584,22 @@  static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
 }
 
 
+static void radeon_kick_out_firmware_fb(struct drm_device *ddev)
+{
+	struct apertures_struct *ap;
+	bool primary = false;
+
+	ap = alloc_apertures(1);
+	ap->ranges[0].base = pci_resource_start(ddev->pdev, 0);
+	ap->ranges[0].size = pci_resource_len(ddev->pdev, 0);
+
+#ifdef CONFIG_X86
+	primary = ddev->pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
+#endif
+	remove_conflicting_framebuffers(ap, "radeondrmfb", primary);
+	kfree(ap);
+}
+
 int radeon_device_init(struct radeon_device *rdev,
 		       struct drm_device *ddev,
 		       struct pci_dev *pdev,
@@ -623,6 +639,9 @@  int radeon_device_init(struct radeon_device *rdev,
 	init_waitqueue_head(&rdev->irq.vblank_queue);
 	init_waitqueue_head(&rdev->irq.idle_queue);
 
+	/* Get rid of things like offb */
+	radeon_kick_out_firmware_fb(ddev);
+
 	/* setup workqueue */
 	rdev->wq = create_workqueue("radeon");
 	if (rdev->wq == NULL)