drm/nvc0: implement memory detection
authorBen Skeggs <bskeggs@redhat.com>
Wed, 4 Aug 2010 03:44:41 +0000 (13:44 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 5 Aug 2010 22:35:24 +0000 (08:35 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_mem.c

index 47e5ad9cfda2d262eeaa094ae6a36c7f1f98a1e0..9689d41476867c82a7be56d92d4a0cfe2aa6e822 100644 (file)
@@ -320,7 +320,8 @@ nouveau_mem_detect(struct drm_device *dev)
        if (dev_priv->card_type < NV_50) {
                dev_priv->vram_size  = nv_rd32(dev, NV04_PFB_FIFO_DATA);
                dev_priv->vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK;
-       } else {
+       } else
+       if (dev_priv->card_type < NV_C0) {
                dev_priv->vram_size = nv_rd32(dev, NV04_PFB_FIFO_DATA);
                dev_priv->vram_size |= (dev_priv->vram_size & 0xff) << 32;
                dev_priv->vram_size &= 0xffffffff00ll;
@@ -328,6 +329,9 @@ nouveau_mem_detect(struct drm_device *dev)
                        dev_priv->vram_sys_base = nv_rd32(dev, 0x100e10);
                        dev_priv->vram_sys_base <<= 12;
                }
+       } else {
+               dev_priv->vram_size  = nv_rd32(dev, 0x10f20c) << 20;
+               dev_priv->vram_size *= nv_rd32(dev, 0x121c74);
        }
 
        NV_INFO(dev, "Detected %dMiB VRAM\n", (int)(dev_priv->vram_size >> 20));