drm/nv50: add memory type detection
authorBen Skeggs <bskeggs@redhat.com>
Mon, 12 Dec 2011 23:45:25 +0000 (09:45 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 13 Mar 2012 07:05:40 +0000 (17:05 +1000)
DDR1/DDR[23] confirmed on NVA8 (see note about DDR3 in source) by changing
the value and watching the binary driver's behaviour.

GDDR3/4 values confirmed on a NV96 via the same method above.  That GDDR4
is present is interesting, as far as I can see no boards using it were ever
released.

GDDR5 value is based on VBIOS images of known GDDR5 boards.

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

index 2e45e57fd8698e03a2b8fdf3fcd04b69ddf86290..84069669461187d88f6787149125080fd57a8a69 100644 (file)
@@ -189,8 +189,24 @@ nv50_vram_init(struct drm_device *dev)
        struct nouveau_vram_engine *vram = &dev_priv->engine.vram;
        const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */
        const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */
+       u32 pfb714 = nv_rd32(dev, 0x100714);
        u32 rblock, length;
 
+       switch (pfb714 & 0x00000007) {
+       case 0: dev_priv->vram_type = NV_MEM_TYPE_DDR1; break;
+       case 1:
+               if (0 /* some currently unknown condition */)
+                       dev_priv->vram_type = NV_MEM_TYPE_DDR2;
+               else
+                       dev_priv->vram_type = NV_MEM_TYPE_DDR3;
+               break;
+       case 2: dev_priv->vram_type = NV_MEM_TYPE_GDDR3; break;
+       case 3: dev_priv->vram_type = NV_MEM_TYPE_GDDR4; break;
+       case 4: dev_priv->vram_type = NV_MEM_TYPE_GDDR5; break;
+       default:
+               break;
+       }
+
        dev_priv->vram_size  = nv_rd32(dev, 0x10020c);
        dev_priv->vram_size |= (dev_priv->vram_size & 0xff) << 32;
        dev_priv->vram_size &= 0xffffffff00ULL;