vgabios: Don't have geode code peak into stdvga mode struct.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 15 Jan 2012 04:25:24 +0000 (23:25 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 16 Jan 2012 17:03:14 +0000 (12:03 -0500)
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@koconnor.net>
vgasrc/geodevga.c
vgasrc/stdvga.h
vgasrc/stdvgamodes.c

index 3da1b7c085e3a75f285cf58bc67436c91d90e80f..d326eda021fdc941819cdbde217c34b09599e8c6 100644 (file)
@@ -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]);
     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();
     }
 
     ret |= vp_setup();
index 9372127d12d93afd893d883031e82f8c7c93006b..c19b21f534702a3731e3d3ee2a6217f3ef030ce1 100644 (file)
@@ -85,6 +85,7 @@ struct saveDACcolors {
 // stdvgamodes.c
 struct vgamode_s *stdvga_find_mode(int mode);
 void stdvga_build_video_param(void);
 // 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);
 
 // stdvgaio.c
 u8 stdvga_pelmask_read(void);
index 94e273f7ab649788cd0e6d69a5bbd9756ba34035..08c3a58ece93bef816426952cc18210eaa38f930 100644 (file)
@@ -360,3 +360,14 @@ stdvga_build_video_param(void)
                    , ARRAY_SIZE(vparam_g->grdc_regs));
     }
 }
                    , 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);
+}