summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-01-24 05:52:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-01-24 05:52:02 +0000
commit317952e76ef192bf159dfbbe0a607758bfc8e4d8 (patch)
tree9ee404e4b738ae2f9c427258d3f8b8ee61a466cb /sys
parent3b2dfbe3f265ffdfb28eae3602ef57a3b0ca0ce4 (diff)
drm/radeon: fixup bad vram size on SI
From Alex Deucher 7e3f2ed899128187ecc9ab7573e966d8a5afc664 in ubuntu 3.8 0ca223b029a261e82fb2f50c52eb85d510f4260e in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/radeon/si.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/radeon/si.c b/sys/dev/pci/drm/radeon/si.c
index 3627d105acf..6e04b7a8265 100644
--- a/sys/dev/pci/drm/radeon/si.c
+++ b/sys/dev/pci/drm/radeon/si.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: si.c,v 1.7 2014/01/24 05:43:46 jsg Exp $ */
+/* $OpenBSD: si.c,v 1.8 2014/01/24 05:52:01 jsg Exp $ */
/*
* Copyright 2011 Advanced Micro Devices, Inc.
*
@@ -2431,8 +2431,15 @@ static int si_mc_init(struct radeon_device *rdev)
rdev->mc.aper_base = rdev->fb_aper_offset;
rdev->mc.aper_size = rdev->fb_aper_size;
/* size in MB on si */
- rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
- rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
+ tmp = RREG32(CONFIG_MEMSIZE);
+ /* some boards may have garbage in the upper 16 bits */
+ if (tmp & 0xffff0000) {
+ DRM_INFO("Probable bad vram size: 0x%08x\n", tmp);
+ if (tmp & 0xffff)
+ tmp &= 0xffff;
+ }
+ rdev->mc.mc_vram_size = tmp * 1024ULL * 1024ULL;
+ rdev->mc.real_vram_size = rdev->mc.mc_vram_size;
rdev->mc.visible_vram_size = rdev->mc.aper_size;
si_vram_gtt_location(rdev, &rdev->mc);
radeon_update_bandwidth_info(rdev);