[PATCH] FB: Get the Geode GX frambuffer size from the BIOS

Jordan Crouse jordan.crouse at amd.unroutablecom
Sun Dec 24 04:29:34 EST 2006


Commit:     4c1979c8963528cc6f52203ae62162ed22e171f4
Parent:     4437cd1e98409e236a9d303fb742fdd53b3a20bb
commit 4c1979c8963528cc6f52203ae62162ed22e171f4
Author:     Jordan Crouse <jordan.crouse at amd.com>
AuthorDate: Fri Dec 8 02:40:52 2006 -0800
Commit:     Linus Torvalds <torvalds at woody.osdl.org>
CommitDate: Fri Dec 8 08:29:08 2006 -0800

    [PATCH] FB: Get the Geode GX frambuffer size from the BIOS
    
    Use the Geode GX BIOS virtual registers to get the actual size of the
    framebuffer.
    
    Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
    Cc: "Antonino A. Daplas" <adaplas at pol.net>
    Acked-by: James Simmons <jsimmons at infradead.org>
    Signed-off-by: Andrew Morton <akpm at osdl.org>
    Signed-off-by: Linus Torvalds <torvalds at osdl.org>
---
 drivers/video/geode/display_gx.c |   15 ++++++++++++---
 drivers/video/geode/display_gx.h |    2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
index 825c340..0245169 100644
--- a/drivers/video/geode/display_gx.c
+++ b/drivers/video/geode/display_gx.c
@@ -21,10 +21,19 @@ #include <asm/delay.h>
 #include "geodefb.h"
 #include "display_gx.h"
 
-int gx_frame_buffer_size(void)
+unsigned int gx_frame_buffer_size(void)
 {
-	/* Assuming 16 MiB. */
-	return 16*1024*1024;
+	unsigned int val;
+
+	/* FB size is reported by a virtual register */
+	/* Virtual register class = 0x02 */
+	/* VG_MEM_SIZE(512Kb units) = 0x00 */
+
+	outw(0xFC53, 0xAC1C);
+	outw(0x0200, 0xAC1C);
+
+	val = (unsigned int)(inw(0xAC1E)) & 0xFFl;
+	return (val << 19);
 }
 
 int gx_line_delta(int xres, int bpp)
diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
index 86c6233..41e79f4 100644
--- a/drivers/video/geode/display_gx.h
+++ b/drivers/video/geode/display_gx.h
@@ -11,7 +11,7 @@
 #ifndef __DISPLAY_GX_H__
 #define __DISPLAY_GX_H__
 
-int gx_frame_buffer_size(void);
+unsigned int gx_frame_buffer_size(void);
 int gx_line_delta(int xres, int bpp);
 
 extern struct geode_dc_ops gx_dc_ops;


More information about the Commits-kernel mailing list