From fd96795630428ceca775bd1effc5bf41a9fe5272 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 28 Apr 2008 02:15:30 -0700 Subject: 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 Cc: Jordan Crouse Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/geode/lxfb_ops.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'drivers/video/geode/lxfb_ops.c') diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c index e42e12489f6d..cd9d4cc26954 100644 --- a/drivers/video/geode/lxfb_ops.c +++ b/drivers/video/geode/lxfb_ops.c @@ -329,6 +329,22 @@ unsigned int lx_framebuffer_size(void) { unsigned int val; + 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); + } + /* The frame buffer size is reported by a VSM in VSA II */ /* Virtual Register Class = 0x02 */ /* VG_MEM_SIZE (1MB units) = 0x00 */ -- cgit v1.2.3-55-g7522