aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-12-12 20:57:55 -0500
committerBen Skeggs <bskeggs@redhat.com>2012-03-13 03:05:46 -0400
commitc70c41e89f0481f26749d8264aebc594566c2a6d (patch)
tree9a112ff10ccbda529d70eecbedc5d763113846a0 /drivers/gpu
parent1072856a1c604726be6a8adfb6b2c86033e6a314 (diff)
drm/nv50: hopefully handle the DDR2/DDR3 memtype detection somewhat better
M version 2 appears to have a table with some form of memory type info available. NVIDIA appear to ignore the table information except for this DDR2/DDR3 case (which has the same value in 0x100714). My guess is this is due to some of the supported memory types not being represented in the table. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c23
-rw-r--r--drivers/gpu/drm/nouveau/nv50_vram.c6
3 files changed, 27 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 59031d308fcc..5a4947919f1c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -909,6 +909,7 @@ extern int nouveau_mem_init_agp(struct drm_device *);
909extern int nouveau_mem_reset_agp(struct drm_device *); 909extern int nouveau_mem_reset_agp(struct drm_device *);
910extern void nouveau_mem_close(struct drm_device *); 910extern void nouveau_mem_close(struct drm_device *);
911extern bool nouveau_mem_flags_valid(struct drm_device *, u32 tile_flags); 911extern bool nouveau_mem_flags_valid(struct drm_device *, u32 tile_flags);
912extern int nouveau_mem_vbios_type(struct drm_device *);
912extern struct nouveau_tile_reg *nv10_mem_set_tiling( 913extern struct nouveau_tile_reg *nv10_mem_set_tiling(
913 struct drm_device *dev, uint32_t addr, uint32_t size, 914 struct drm_device *dev, uint32_t addr, uint32_t size,
914 uint32_t pitch, uint32_t flags); 915 uint32_t pitch, uint32_t flags);
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 4a658310c29a..c5ba6c2eab88 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -683,6 +683,29 @@ nouveau_mem_timing_fini(struct drm_device *dev)
683 } 683 }
684} 684}
685 685
686int
687nouveau_mem_vbios_type(struct drm_device *dev)
688{
689 struct bit_entry M;
690 u8 ramcfg = (nv_rd32(dev, 0x101000) & 0x0000003c) >> 2;
691 if (!bit_table(dev, 'M', &M) || M.version != 2 || M.length < 5) {
692 u8 *table = ROMPTR(dev, M.data[3]);
693 if (table && table[0] == 0x10 && ramcfg < table[3]) {
694 u8 *entry = table + table[1] + (ramcfg * table[2]);
695 switch (entry[0] & 0x0f) {
696 case 0: return NV_MEM_TYPE_DDR2;
697 case 1: return NV_MEM_TYPE_DDR3;
698 case 2: return NV_MEM_TYPE_GDDR3;
699 case 3: return NV_MEM_TYPE_GDDR5;
700 default:
701 break;
702 }
703
704 }
705 }
706 return NV_MEM_TYPE_UNKNOWN;
707}
708
686static int 709static int
687nouveau_vram_manager_init(struct ttm_mem_type_manager *man, unsigned long psize) 710nouveau_vram_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
688{ 711{
diff --git a/drivers/gpu/drm/nouveau/nv50_vram.c b/drivers/gpu/drm/nouveau/nv50_vram.c
index 840696694611..1467efc6d61d 100644
--- a/drivers/gpu/drm/nouveau/nv50_vram.c
+++ b/drivers/gpu/drm/nouveau/nv50_vram.c
@@ -195,10 +195,10 @@ nv50_vram_init(struct drm_device *dev)
195 switch (pfb714 & 0x00000007) { 195 switch (pfb714 & 0x00000007) {
196 case 0: dev_priv->vram_type = NV_MEM_TYPE_DDR1; break; 196 case 0: dev_priv->vram_type = NV_MEM_TYPE_DDR1; break;
197 case 1: 197 case 1:
198 if (0 /* some currently unknown condition */) 198 if (nouveau_mem_vbios_type(dev) == NV_MEM_TYPE_DDR3)
199 dev_priv->vram_type = NV_MEM_TYPE_DDR2;
200 else
201 dev_priv->vram_type = NV_MEM_TYPE_DDR3; 199 dev_priv->vram_type = NV_MEM_TYPE_DDR3;
200 else
201 dev_priv->vram_type = NV_MEM_TYPE_DDR2;
202 break; 202 break;
203 case 2: dev_priv->vram_type = NV_MEM_TYPE_GDDR3; break; 203 case 2: dev_priv->vram_type = NV_MEM_TYPE_GDDR3; break;
204 case 3: dev_priv->vram_type = NV_MEM_TYPE_GDDR4; break; 204 case 3: dev_priv->vram_type = NV_MEM_TYPE_GDDR4; break;