drm/nouveau: completely fail init if we fail to map the PRAMIN BAR
authorBen Skeggs <bskeggs@redhat.com>
Wed, 2 Jun 2010 00:16:24 +0000 (10:16 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 8 Jun 2010 01:02:56 +0000 (11:02 +1000)
On cards where there's a specific BAR for PRAMIN, we used to try and fall
back to the "legacy" aperture within the mmio BAR.

This is doomed to cause problems, so lets just fail completely as there's
obviously something else very wrong anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/nouveau/nouveau_state.c

index 147e59c..b02a231 100644 (file)
@@ -779,29 +779,24 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
                        return ret;
        }
 
                        return ret;
        }
 
-       /* map larger RAMIN aperture on NV40 cards */
-       dev_priv->ramin  = NULL;
+       /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */
        if (dev_priv->card_type >= NV_40) {
                int ramin_bar = 2;
                if (pci_resource_len(dev->pdev, ramin_bar) == 0)
                        ramin_bar = 3;
 
                dev_priv->ramin_size = pci_resource_len(dev->pdev, ramin_bar);
        if (dev_priv->card_type >= NV_40) {
                int ramin_bar = 2;
                if (pci_resource_len(dev->pdev, ramin_bar) == 0)
                        ramin_bar = 3;
 
                dev_priv->ramin_size = pci_resource_len(dev->pdev, ramin_bar);
-               dev_priv->ramin = ioremap(
-                               pci_resource_start(dev->pdev, ramin_bar),
+               dev_priv->ramin =
+                       ioremap(pci_resource_start(dev->pdev, ramin_bar),
                                dev_priv->ramin_size);
                if (!dev_priv->ramin) {
                                dev_priv->ramin_size);
                if (!dev_priv->ramin) {
-                       NV_ERROR(dev, "Failed to init RAMIN mapping, "
-                                     "limited instance memory available\n");
+                       NV_ERROR(dev, "Failed to PRAMIN BAR");
+                       return -ENOMEM;
                }
                }
-       }
-
-       /* On older cards (or if the above failed), create a map covering
-        * the BAR0 PRAMIN aperture */
-       if (!dev_priv->ramin) {
+       } else {
                dev_priv->ramin_size = 1 * 1024 * 1024;
                dev_priv->ramin = ioremap(mmio_start_offs + NV_RAMIN,
                dev_priv->ramin_size = 1 * 1024 * 1024;
                dev_priv->ramin = ioremap(mmio_start_offs + NV_RAMIN,
-                                                       dev_priv->ramin_size);
+                                         dev_priv->ramin_size);
                if (!dev_priv->ramin) {
                        NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n");
                        return -ENOMEM;
                if (!dev_priv->ramin) {
                        NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n");
                        return -ENOMEM;