aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv40_fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv40_fb.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv40_fb.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nv40_fb.c b/drivers/gpu/drm/nouveau/nv40_fb.c
index f0ac2a768c67..7fbcb334c096 100644
--- a/drivers/gpu/drm/nouveau/nv40_fb.c
+++ b/drivers/gpu/drm/nouveau/nv40_fb.c
@@ -72,6 +72,51 @@ nv44_fb_init_gart(struct drm_device *dev)
72} 72}
73 73
74int 74int
75nv40_fb_vram_init(struct drm_device *dev)
76{
77 struct drm_nouveau_private *dev_priv = dev->dev_private;
78
79 /* 0x001218 is actually present on a few other NV4X I looked at,
80 * and even contains sane values matching 0x100474. From looking
81 * at various vbios images however, this isn't the case everywhere.
82 * So, I chose to use the same regs I've seen NVIDIA reading around
83 * the memory detection, hopefully that'll get us the right numbers
84 */
85 if (dev_priv->chipset == 0x40) {
86 u32 pbus1218 = nv_rd32(dev, 0x001218);
87 switch (pbus1218 & 0x00000300) {
88 case 0x00000000: dev_priv->vram_type = NV_MEM_TYPE_SDRAM; break;
89 case 0x00000100: dev_priv->vram_type = NV_MEM_TYPE_DDR1; break;
90 case 0x00000200: dev_priv->vram_type = NV_MEM_TYPE_GDDR3; break;
91 case 0x00000300: dev_priv->vram_type = NV_MEM_TYPE_DDR2; break;
92 }
93 } else
94 if (dev_priv->chipset == 0x49 || dev_priv->chipset == 0x4b) {
95 u32 pfb914 = nv_rd32(dev, 0x100914);
96 switch (pfb914 & 0x00000003) {
97 case 0x00000000: dev_priv->vram_type = NV_MEM_TYPE_DDR1; break;
98 case 0x00000001: dev_priv->vram_type = NV_MEM_TYPE_DDR2; break;
99 case 0x00000002: dev_priv->vram_type = NV_MEM_TYPE_GDDR3; break;
100 case 0x00000003: break;
101 }
102 } else
103 if (dev_priv->chipset != 0x4e) {
104 u32 pfb474 = nv_rd32(dev, 0x100474);
105 if (pfb474 & 0x00000004)
106 dev_priv->vram_type = NV_MEM_TYPE_GDDR3;
107 if (pfb474 & 0x00000002)
108 dev_priv->vram_type = NV_MEM_TYPE_DDR2;
109 if (pfb474 & 0x00000001)
110 dev_priv->vram_type = NV_MEM_TYPE_DDR1;
111 } else {
112 dev_priv->vram_type = NV_MEM_TYPE_STOLEN;
113 }
114
115 dev_priv->vram_size = nv_rd32(dev, 0x10020c) & 0xff000000;
116 return 0;
117}
118
119int
75nv40_fb_init(struct drm_device *dev) 120nv40_fb_init(struct drm_device *dev)
76{ 121{
77 struct drm_nouveau_private *dev_priv = dev->dev_private; 122 struct drm_nouveau_private *dev_priv = dev->dev_private;