[SeaBIOS] [PATCH 1/4] vgabios: Don't have geode code peak into stdvga mode struct.

Kevin O'Connor kevin at koconnor.net
Sat Jan 21 04:13:31 CET 2012


Create a wrapper (stdvga_override_crtc) so the Geode code doesn't need
to access the stdvga mode tables directly.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/geodevga.c    |   10 ++--------
 vgasrc/stdvga.h      |    1 +
 vgasrc/stdvgamodes.c |   11 +++++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c
index 3da1b7c..d326eda 100644
--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -360,14 +360,8 @@ int geodevga_init(void)
     int i;
     for (i=0; i<ARRAY_SIZE(new_crtc); i++) {
         u8 *crtc = GET_GLOBAL(new_crtc[i]);
-        if (!crtc)
-            continue;
-        struct vgamode_s *vmode_g = stdvga_find_mode(i);
-        if (!vmode_g)
-            continue;
-        struct stdvga_mode_s *stdmode_g = container_of(
-            vmode_g, struct stdvga_mode_s, info);
-        SET_VGA(stdmode_g->crtc_regs, crtc);
+        if (crtc)
+            stdvga_override_crtc(i, crtc);
     }
 
     ret |= vp_setup();
diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h
index 9372127..c19b21f 100644
--- a/vgasrc/stdvga.h
+++ b/vgasrc/stdvga.h
@@ -85,6 +85,7 @@ struct saveDACcolors {
 // stdvgamodes.c
 struct vgamode_s *stdvga_find_mode(int mode);
 void stdvga_build_video_param(void);
+void stdvga_override_crtc(int mode, u8 *crtc);
 
 // stdvgaio.c
 u8 stdvga_pelmask_read(void);
diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c
index 94e273f..08c3a58 100644
--- a/vgasrc/stdvgamodes.c
+++ b/vgasrc/stdvgamodes.c
@@ -360,3 +360,14 @@ stdvga_build_video_param(void)
                    , ARRAY_SIZE(vparam_g->grdc_regs));
     }
 }
+
+void
+stdvga_override_crtc(int mode, u8 *crtc)
+{
+    struct vgamode_s *vmode_g = stdvga_find_mode(mode);
+    if (!vmode_g)
+        return;
+    struct stdvga_mode_s *stdmode_g = container_of(
+        vmode_g, struct stdvga_mode_s, info);
+    SET_VGA(stdmode_g->crtc_regs, crtc);
+}
-- 
1.7.6.4




More information about the SeaBIOS mailing list