summaryrefslogtreecommitdiff
path: root/shared-core/nouveau_state.c
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2007-06-25 15:16:19 +1000
committerBen Skeggs <skeggsb@gmail.com>2007-06-28 03:26:44 +1000
commit18a6d1c9c380b6b19524f654d9173a79e19aa1df (patch)
tree2a12e25cbb51916cad335a2fdd8981c82f6fe7e7 /shared-core/nouveau_state.c
parent38617b6a26d893bbd7b235019159e609f6cdd84b (diff)
nouveau: simplify PRAMIN access
Diffstat (limited to 'shared-core/nouveau_state.c')
-rw-r--r--shared-core/nouveau_state.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/shared-core/nouveau_state.c b/shared-core/nouveau_state.c
index 0cb82355..94d8081c 100644
--- a/shared-core/nouveau_state.c
+++ b/shared-core/nouveau_state.c
@@ -51,6 +51,7 @@ static int nouveau_init_card_mappings(drm_device_t *dev)
DRM_DEBUG("regs mapped ok at 0x%lx\n", dev_priv->mmio->offset);
/* map larger RAMIN aperture on NV40 cards */
+ dev_priv->ramin = NULL;
if (dev_priv->card_type >= NV_40) {
int ramin_resource = 2;
if (drm_get_resource_len(dev, ramin_resource) == 0)
@@ -66,8 +67,21 @@ static int nouveau_init_card_mappings(drm_device_t *dev)
"limited instance memory available\n");
dev_priv->ramin = NULL;
}
- } else
- dev_priv->ramin = NULL;
+ }
+
+ /* On older cards (or if the above failed), create a map covering
+ * the BAR0 PRAMIN aperture */
+ if (!dev_priv->ramin) {
+ ret = drm_addmap(dev,
+ drm_get_resource_start(dev, 0) + NV_RAMIN,
+ (1*1024*1024),
+ _DRM_REGISTERS, _DRM_READ_ONLY,
+ &dev_priv->ramin);
+ if (ret) {
+ DRM_ERROR("Failed to map BAR0 PRAMIN: %d\n", ret);
+ return ret;
+ }
+ }
return 0;
}