This should fix it in general for all cards and make it into Linux
specific code. I gave it a minimal test and it works for me.
If it's working right cat /proc/iomem /proc/ioports will show the
driver as owning the resources. pci_request_regions() will fail if
called in stealth mode so it needs to be protected by !DRM(fb_loaded).
In stealth mode it's the other drivers responsibility to reserve the
resources.
Check it in if you like it.
--
Jon Smirl
[EMAIL PROTECTED]
===== linux/drm_drv.h 1.14 vs edited =====
--- 1.14/linux/drm_drv.h Sun Sep 5 21:22:06 2004
+++ edited/linux/drm_drv.h Thu Sep 9 21:51:54 2004
@@ -464,8 +464,10 @@
return -ENODEV;
dev = &(DRM(device)[DRM(numdevs)]);
- if (DRM(fb_loaded)==0)
+ if (DRM(fb_loaded)==0) {
pci_set_drvdata(pdev, dev);
+ pci_request_regions(pdev, DRIVER_NAME);
+ }
memset( (void *)dev, 0, sizeof(*dev) );
dev->count_lock = SPIN_LOCK_UNLOCKED;
@@ -568,6 +570,7 @@
pci_set_drvdata(pdev, NULL);
drm_cleanup(dev);
+ pci_release_regions(pdev);
}
static struct pci_driver drm_driver = {
===== shared/radeon_cp.c 1.4 vs edited =====
--- 1.4/shared/radeon_cp.c Wed Aug 25 16:55:14 2004
+++ edited/shared/radeon_cp.c Thu Sep 9 21:53:03 2004
@@ -1732,32 +1732,9 @@
return ret;
}
-static int radeon_register_regions(struct pci_dev *pdev) {
- int retcode = -EINVAL;
-
- /* request the mem regions */
- if (!request_mem_region (pci_resource_start( pdev, 2 ),
- pci_resource_len(pdev, 2), DRIVER_NAME)) {
- DRM_ERROR("cannot reserve MMIO region\n");
- return retcode;
- }
- if (!request_mem_region (pci_resource_start( pdev, 0 ),
- pci_resource_len(pdev, 0), DRIVER_NAME)) {
- DRM_ERROR("cannot reserve FB region\n");
- return retcode;
- }
- return 0;
-}
-
-static void radeon_release_regions(struct pci_dev *pdev) {
- release_mem_region (pci_resource_start( pdev, 2 ), pci_resource_len(pdev, 2));
- release_mem_region (pci_resource_start( pdev, 0 ), pci_resource_len(pdev, 0));
-}
-
/* Always create a map record for MMIO and FB memory, done from DRIVER_POSTINIT */
int radeon_preinit( struct drm_device *dev, unsigned long flags )
{
- int retcode = -EINVAL;
u32 save, temp;
drm_radeon_private_t *dev_priv;
@@ -1769,11 +1746,6 @@
dev->dev_private = (void *)dev_priv;
dev_priv->flags = flags;
- /* request the mem regions */
- if (!DRM(fb_loaded))
- if ((retcode = radeon_register_regions(dev->pdev)) != 0)
- return retcode;
-
/* There are signatures in BIOS and PCI-SSID for a PCI card, but they are not very reliable.
Following detection method works for all cards tested so far.
Note, checking AGP_ENABLE bit after drmAgpEnable call can also give the correct result.
@@ -1802,9 +1774,6 @@
DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
- if (!DRM(fb_loaded))
- radeon_release_regions(dev->pdev);
-
dev->dev_private = NULL;
return 0;
}