[PATCH] FB: Get the Geode GX frambuffer size from the BIOS
authorJordan Crouse <jordan.crouse@amd.com>
Fri, 8 Dec 2006 10:40:52 +0000 (02:40 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 8 Dec 2006 16:29:08 +0000 (08:29 -0800)
Use the Geode GX BIOS virtual registers to get the actual size of the
framebuffer.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/geode/display_gx.c
drivers/video/geode/display_gx.h

index 825c340..0245169 100644 (file)
 #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)
index 86c6233..41e79f4 100644 (file)
@@ -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;