aboutsummaryrefslogtreecommitdiff
path: root/bsd-core/drm_drv.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-11-08 06:11:55 +0000
committerEric Anholt <anholt@freebsd.org>2005-11-08 06:11:55 +0000
commit4b2235d2e089a512b26ecd66ae42ea279fbb1df2 (patch)
treeb9d119752cce93f9cb240e881c4430c50e057eb9 /bsd-core/drm_drv.c
parent71f9b7357cb3d4ea7bb5b396840de3985bc13ad4 (diff)
Correct a LOR related to the PCI resource allocations by simply moving the
uninit to unload time rather than lastclose.
Diffstat (limited to 'bsd-core/drm_drv.c')
-rw-r--r--bsd-core/drm_drv.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 648fbf3d..6766195b 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -474,13 +474,7 @@ static int drm_lastclose(drm_device_t *dev)
TAILQ_FOREACH_SAFE(map, &dev->maplist, link, mapsave) {
drm_rmmap(dev, map);
}
- for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++) {
- if (dev->pcir[i] == NULL)
- continue;
- bus_release_resource(dev->device, SYS_RES_MEMORY,
- dev->pcirid[i], dev->pcir[i]);
- dev->pcir[i] = NULL;
- }
+
drm_dma_takedown(dev);
if ( dev->lock.hw_lock ) {
@@ -568,6 +562,8 @@ error:
static void drm_unload(drm_device_t *dev)
{
+ int i;
+
DRM_DEBUG( "\n" );
#ifdef __FreeBSD__
@@ -589,6 +585,19 @@ static void drm_unload(drm_device_t *dev)
drm_lastclose(dev);
DRM_UNLOCK();
+ /* Clean up PCI resources allocated by drm_bufs.c. We're not really
+ * worried about resource consumption while the DRM is inactive (between
+ * lastclose and firstopen or unload) because these aren't actually
+ * taking up KVA, just keeping the PCI resource allocated.
+ */
+ for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++) {
+ if (dev->pcir[i] == NULL)
+ continue;
+ bus_release_resource(dev->device, SYS_RES_MEMORY,
+ dev->pcirid[i], dev->pcir[i]);
+ dev->pcir[i] = NULL;
+ }
+
if ( dev->agp ) {
free(dev->agp, M_DRM);
dev->agp = NULL;