summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv20_fb.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-12-12 23:03:14 +1000
committerBen Skeggs <bskeggs@redhat.com>2012-03-13 17:05:35 +1000
commitff92a6cda74c0a51cb723f5e224124cf74e62f25 (patch)
treeb5973d168c9b2dfcbacfaf9e8bbbc124c7c6d8c5 /drivers/gpu/drm/nouveau/nv20_fb.c
parentd81c19e312a22bdcebef1370f3af30a146670787 (diff)
drm/nv20-nv40: add memory type detection
NV20/NV30 is partially educated guesswork at this point, based on any information around about available memory types and a horribly unspeakable amount of vbios image scouring. I'm not entirely certain the GDDR3 define is correct, I have not spotted a single vbios with that value yet (though it is mentioned in some 1218-using nv4x vbios), but there are reports that some nv3x did use it.. NV40(100914) confirmed by switching an NV49 to DDR1/DDR2 values and making sure that the binary driver behaviour showed it had detected DDR1/DDR2 instead of GDDR3 before dying horribly. NV40(100474) confirmed by doing much the same task as above on an NV44, except this was *much* easier as changing the values didn't seem to have any noticable effect on the memory controller aside from changing the binary driver's behaviour. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv20_fb.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv20_fb.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nv20_fb.c b/drivers/gpu/drm/nouveau/nv20_fb.c
index 6585c27186d..19bd64059a6 100644
--- a/drivers/gpu/drm/nouveau/nv20_fb.c
+++ b/drivers/gpu/drm/nouveau/nv20_fb.c
@@ -100,8 +100,17 @@ int
nv20_fb_vram_init(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
+ u32 mem_size = nv_rd32(dev, 0x10020c);
+ u32 pbus1218 = nv_rd32(dev, 0x001218);
+
+ dev_priv->vram_size = mem_size & 0xff000000;
+ switch (pbus1218 & 0x00000300) {
+ case 0x00000000: dev_priv->vram_type = NV_MEM_TYPE_SDRAM; break;
+ case 0x00000100: dev_priv->vram_type = NV_MEM_TYPE_DDR1; break;
+ case 0x00000200: dev_priv->vram_type = NV_MEM_TYPE_GDDR3; break;
+ case 0x00000300: dev_priv->vram_type = NV_MEM_TYPE_GDDR2; break;
+ }
- dev_priv->vram_size = nv_rd32(dev, 0x10020c) & 0xff000000;
return 0;
}