summaryrefslogtreecommitdiff
path: root/shared-core/radeon_cp.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-02-05 08:00:14 +0000
committerEric Anholt <anholt@freebsd.org>2005-02-05 08:00:14 +0000
commit080a547d4d42d42e08a525aca9a62b5ece7616d5 (patch)
tree6996ba882ce26098fb69ba336969d88aa47dc39c /shared-core/radeon_cp.c
parent270ca5f3cee387c10a06a4d58e50c5d0e1cea837 (diff)
- Implement drm_initmap, and extend it with the resource number to help
FreeBSD. Add drm_get_resource_{start|len} so linux-specific stuff doesn't need to be in shared code. - Fix mach64 build by using __DECONST to work around passing a const pointer to useracc, which is unfortunately not marked const. - Get rid of a lot of maplist code by not having dev->maplist be a pointer, and by sticking the link entries directly in drm_local_map_t rather than having a separate structure for the linked list. - Factor out map uninit and removal into its own routine, rather than duplicating in both drm_takedown() and drm_rmmap(). - Hook up more driver functions, and correct FreeBSD-specific bits of radeon_cp.c, making radeon work. - Baby steps towards using bus_space as we should.
Diffstat (limited to 'shared-core/radeon_cp.c')
-rw-r--r--shared-core/radeon_cp.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/shared-core/radeon_cp.c b/shared-core/radeon_cp.c
index 9eaa2d76..4606a332 100644
--- a/shared-core/radeon_cp.c
+++ b/shared-core/radeon_cp.c
@@ -2006,7 +2006,9 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
/* Always create a map record for MMIO and FB memory, done from DRIVER_POSTINIT */
int radeon_preinit(struct drm_device *dev, unsigned long flags)
{
+#if defined(__linux__)
u32 save, temp;
+#endif
drm_radeon_private_t *dev_priv;
int ret = 0;
@@ -2030,19 +2032,18 @@ int radeon_preinit(struct drm_device *dev, unsigned long flags)
break;
}
-#ifdef __linux__
- /* registers */
- if ((ret = drm_initmap(dev, pci_resource_start(dev->pdev, 2),
- pci_resource_len(dev->pdev, 2), _DRM_REGISTERS,
- 0)))
+ ret = drm_initmap(dev, drm_get_resource_start(dev, 2),
+ drm_get_resource_len(dev, 2), 2, _DRM_REGISTERS, 0);
+ if (ret != 0)
return ret;
- /* framebuffer */
- if ((ret = drm_initmap(dev, pci_resource_start(dev->pdev, 0),
- pci_resource_len(dev->pdev, 0),
- _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING)))
+ ret = drm_initmap(dev, drm_get_resource_start(dev, 0),
+ drm_get_resource_len(dev, 0), 0, _DRM_FRAME_BUFFER,
+ _DRM_WRITE_COMBINING);
+ if (ret != 0)
return ret;
+#if defined(__linux__)
/* 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.
@@ -2057,9 +2058,14 @@ int radeon_preinit(struct drm_device *dev, unsigned long flags)
if (temp & RADEON_AGP_ENABLE)
dev_priv->flags |= CHIP_IS_AGP;
#else
+ /* The above method of detecting AGP is known to not work correctly,
+ * according to Mike Harris. The solution is to walk the capabilities
+ * list, which should be done in drm_device_is_agp().
+ */
if (drm_device_is_agp(dev))
- dev_priv->flags & CHIP_IS_AGP;
+ dev_priv->flags |= CHIP_IS_AGP;
#endif
+
DRM_DEBUG("%s card detected\n",
((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : "PCI"));