summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-01-24 05:43:47 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-01-24 05:43:47 +0000
commit3b2dfbe3f265ffdfb28eae3602ef57a3b0ca0ce4 (patch)
tree7f4dbbc8bfeb9fce72cd738efcd30aa4e44b2279
parent3592969d4a16b0afa18781476cc88af9eb5e2590 (diff)
drm/radeon: Fix VRAM size calculation for VRAM >= 4GB
From Niels Ole Salscheider 091a581a030f3c8c6515fb21a3f23271a86c4107 in ubuntu 3.8 fc986034540102cd090237bf3f70262e1ae80d9c in mainline linux
-rw-r--r--sys/dev/pci/drm/radeon/evergreen.c6
-rw-r--r--sys/dev/pci/drm/radeon/radeon_ttm.c4
-rw-r--r--sys/dev/pci/drm/radeon/si.c6
3 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/pci/drm/radeon/evergreen.c b/sys/dev/pci/drm/radeon/evergreen.c
index 41391436f53..4a64d2dbe7c 100644
--- a/sys/dev/pci/drm/radeon/evergreen.c
+++ b/sys/dev/pci/drm/radeon/evergreen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evergreen.c,v 1.8 2013/11/17 15:12:47 jsg Exp $ */
+/* $OpenBSD: evergreen.c,v 1.9 2014/01/24 05:43:46 jsg Exp $ */
/*
* Copyright 2010 Advanced Micro Devices, Inc.
*
@@ -2425,8 +2425,8 @@ int evergreen_mc_init(struct radeon_device *rdev)
rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
} else {
/* size in MB on evergreen/cayman/tn */
- rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
- rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
+ rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
+ rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
}
rdev->mc.visible_vram_size = rdev->mc.aper_size;
r700_vram_gtt_location(rdev, &rdev->mc);
diff --git a/sys/dev/pci/drm/radeon/radeon_ttm.c b/sys/dev/pci/drm/radeon/radeon_ttm.c
index 16501f2ff5c..89d5e0c8133 100644
--- a/sys/dev/pci/drm/radeon/radeon_ttm.c
+++ b/sys/dev/pci/drm/radeon/radeon_ttm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_ttm.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */
+/* $OpenBSD: radeon_ttm.c,v 1.2 2014/01/24 05:43:46 jsg Exp $ */
/*
* Copyright 2009 Jerome Glisse.
* All Rights Reserved.
@@ -816,7 +816,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
}
#ifdef DRMDEBUG
DRM_INFO("radeon: %uM of VRAM memory ready\n",
- (unsigned)rdev->mc.real_vram_size / (1024 * 1024));
+ (unsigned) (rdev->mc.real_vram_size / (1024 * 1024)));
#endif
r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_TT,
rdev->mc.gtt_size >> PAGE_SHIFT);
diff --git a/sys/dev/pci/drm/radeon/si.c b/sys/dev/pci/drm/radeon/si.c
index 14ac1a16333..3627d105acf 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.6 2014/01/24 05:04:56 jsg Exp $ */
+/* $OpenBSD: si.c,v 1.7 2014/01/24 05:43:46 jsg Exp $ */
/*
* Copyright 2011 Advanced Micro Devices, Inc.
*
@@ -2431,8 +2431,8 @@ 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) * 1024 * 1024;
- rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
+ rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
+ rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL;
rdev->mc.visible_vram_size = rdev->mc.aper_size;
si_vram_gtt_location(rdev, &rdev->mc);
radeon_update_bandwidth_info(rdev);