summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2005-10-14 05:01:19 +0000
committerIan Romanick <idr@us.ibm.com>2005-10-14 05:01:19 +0000
commit4b3ee6c50ed8b9382d3f253669470a5c82e8f0bc (patch)
tree996a2496754395f6c044c228455f869f85ab82ec
parent1505e316afc68da0167c1d2db1a862ac580c65f1 (diff)
Doig a full clean up from mga_do_dma_bootstrap when
mga_do_agp_dma_bootstrap fails causes problems if mga_do_pci_dma_bootstrap succeeds. This commit makes it possible to do a "minimal" clean up instead. I'm still trying to figure out what is causing the failures in mga_do_agp_dma_bootstrap... Signed-off-by: Ian Romanick <idr@us.ibm.com>
-rw-r--r--shared-core/mga_dma.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/shared-core/mga_dma.c b/shared-core/mga_dma.c
index 6cc36543..1eae5ec1 100644
--- a/shared-core/mga_dma.c
+++ b/shared-core/mga_dma.c
@@ -44,7 +44,9 @@
#define MGA_DEFAULT_USEC_TIMEOUT 10000
#define MGA_FREELIST_DEBUG 0
-static int mga_do_cleanup_dma(drm_device_t * dev);
+#define MINIMAL_CLEANUP 0
+#define FULL_CLEANUP 1
+static int mga_do_cleanup_dma(drm_device_t * dev, int full_cleanup);
/* ================================================================
* Engine control
@@ -716,7 +718,7 @@ static int mga_do_dma_bootstrap(drm_device_t * dev,
*/
if (err) {
- mga_do_cleanup_dma(dev);
+ mga_do_cleanup_dma(dev, MINIMAL_CLEANUP);
}
@@ -752,7 +754,7 @@ int mga_dma_bootstrap(DRM_IOCTL_ARGS)
err = mga_do_dma_bootstrap(dev, & bootstrap);
if (err) {
- mga_do_cleanup_dma(dev);
+ mga_do_cleanup_dma(dev, FULL_CLEANUP);
return err;
}
@@ -910,7 +912,7 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init)
return 0;
}
-static int mga_do_cleanup_dma(drm_device_t * dev)
+static int mga_do_cleanup_dma(drm_device_t * dev, int full_cleanup)
{
int err = 0;
DRM_DEBUG("\n");
@@ -949,18 +951,20 @@ static int mga_do_cleanup_dma(drm_device_t * dev)
if ((dev->agp != NULL) && dev->agp->acquired) {
err = drm_agp_release(dev);
}
-
- dev_priv->used_new_dma_init = 0;
}
dev_priv->warp = NULL;
dev_priv->primary = NULL;
- dev_priv->mmio = NULL;
- dev_priv->status = NULL;
dev_priv->sarea = NULL;
dev_priv->sarea_priv = NULL;
dev->agp_buffer_map = NULL;
+ if (full_cleanup) {
+ dev_priv->mmio = NULL;
+ dev_priv->status = NULL;
+ dev_priv->used_new_dma_init = 0;
+ }
+
memset(&dev_priv->prim, 0, sizeof(dev_priv->prim));
dev_priv->warp_pipe = 0;
memset(dev_priv->warp_pipe_phys, 0, sizeof(dev_priv->warp_pipe_phys));
@@ -988,11 +992,11 @@ int mga_dma_init(DRM_IOCTL_ARGS)
case MGA_INIT_DMA:
err = mga_do_init_dma(dev, &init);
if (err) {
- (void) mga_do_cleanup_dma(dev);
+ (void) mga_do_cleanup_dma(dev, FULL_CLEANUP);
}
return err;
case MGA_CLEANUP_DMA:
- return mga_do_cleanup_dma(dev);
+ return mga_do_cleanup_dma(dev, FULL_CLEANUP);
}
return DRM_ERR(EINVAL);
@@ -1134,7 +1138,7 @@ int mga_driver_unload(drm_device_t * dev)
*/
void mga_driver_lastclose(drm_device_t * dev)
{
- mga_do_cleanup_dma(dev);
+ mga_do_cleanup_dma(dev, FULL_CLEANUP);
}
int mga_driver_dma_quiescent(drm_device_t * dev)