aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/geode/display_gx.c
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2008-04-28 02:15:30 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 08:58:40 -0700
commitfd96795630428ceca775bd1effc5bf41a9fe5272 (patch)
treed14276ebf1ff907711e56e2742e15b594ebd166e /drivers/video/geode/display_gx.c
parentgxfb/lxfb: use VSA definitions when fetching framebuffer size (diff)
downloadlinux-dev-fd96795630428ceca775bd1effc5bf41a9fe5272.tar.xz
linux-dev-fd96795630428ceca775bd1effc5bf41a9fe5272.zip
gxfb/lxfb: detect framebuffer size using an MSR if VSA2 isn't available
If there's no VSA2 (ie, if we're using tinybios or OpenFirmware), use the GLIU's P2D Range Offset Descriptor to determine how much memory we have available for the framebuffer. Originally based on a patch by Jordan Crouse. Tested with OpenFirmware; Pascal informs me that tinybios has a stub that fills in P2D_RO0. Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Jordan Crouse <jordan.crouse@amd.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/geode/display_gx.c')
-rw-r--r--drivers/video/geode/display_gx.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
index 1e82ecc367dd..e759895bf3d3 100644
--- a/drivers/video/geode/display_gx.c
+++ b/drivers/video/geode/display_gx.c
@@ -25,7 +25,23 @@ unsigned int gx_frame_buffer_size(void)
{
unsigned int val;
- /* FB size is reported by a virtual register */
+ if (!geode_has_vsa2()) {
+ uint32_t hi, lo;
+
+ /* The number of pages is (PMAX - PMIN)+1 */
+ rdmsr(MSR_GLIU_P2D_RO0, lo, hi);
+
+ /* PMAX */
+ val = ((hi & 0xff) << 12) | ((lo & 0xfff00000) >> 20);
+ /* PMIN */
+ val -= (lo & 0x000fffff);
+ val += 1;
+
+ /* The page size is 4k */
+ return (val << 12);
+ }
+
+ /* FB size can be obtained from the VSA II */
/* Virtual register class = 0x02 */
/* VG_MEM_SIZE(512Kb units) = 0x00 */