aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-06-01 20:16:24 -0400
committerDave Airlie <airlied@redhat.com>2010-06-07 21:02:56 -0400
commit6d696305530c0b3fcd7d15ad87d7203cb53df5b7 (patch)
treeee771c7b9023cd7b2473b31c6d6fb664b25cdf90 /drivers
parent1eb38100abc467f1133e548d82ab171cab34292b (diff)
drm/nouveau: completely fail init if we fail to map the PRAMIN BAR
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 147e59c40151..b02a231d6937 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -779,29 +779,24 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
779 return ret; 779 return ret;
780 } 780 }
781 781
782 /* map larger RAMIN aperture on NV40 cards */ 782 /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */
783 dev_priv->ramin = NULL;
784 if (dev_priv->card_type >= NV_40) { 783 if (dev_priv->card_type >= NV_40) {
785 int ramin_bar = 2; 784 int ramin_bar = 2;
786 if (pci_resource_len(dev->pdev, ramin_bar) == 0) 785 if (pci_resource_len(dev->pdev, ramin_bar) == 0)
787 ramin_bar = 3; 786 ramin_bar = 3;
788 787
789 dev_priv->ramin_size = pci_resource_len(dev->pdev, ramin_bar); 788 dev_priv->ramin_size = pci_resource_len(dev->pdev, ramin_bar);
790 dev_priv->ramin = ioremap( 789 dev_priv->ramin =
791 pci_resource_start(dev->pdev, ramin_bar), 790 ioremap(pci_resource_start(dev->pdev, ramin_bar),
792 dev_priv->ramin_size); 791 dev_priv->ramin_size);
793 if (!dev_priv->ramin) { 792 if (!dev_priv->ramin) {
794 NV_ERROR(dev, "Failed to init RAMIN mapping, " 793 NV_ERROR(dev, "Failed to PRAMIN BAR");
795 "limited instance memory available\n"); 794 return -ENOMEM;
796 } 795 }
797 } 796 } else {
798
799 /* On older cards (or if the above failed), create a map covering
800 * the BAR0 PRAMIN aperture */
801 if (!dev_priv->ramin) {
802 dev_priv->ramin_size = 1 * 1024 * 1024; 797 dev_priv->ramin_size = 1 * 1024 * 1024;
803 dev_priv->ramin = ioremap(mmio_start_offs + NV_RAMIN, 798 dev_priv->ramin = ioremap(mmio_start_offs + NV_RAMIN,
804 dev_priv->ramin_size); 799 dev_priv->ramin_size);
805 if (!dev_priv->ramin) { 800 if (!dev_priv->ramin) {
806 NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n"); 801 NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n");
807 return -ENOMEM; 802 return -ENOMEM;