[SeaBIOS] [PATCH 3/4] Unlock CRTC access and use Standard VGA IO port

Christian Gmeiner christian.gmeiner at gmail.com
Fri Aug 31 15:40:42 CEST 2012


If we unlock CRTC access once we can simply make use of standard
VGA IO port access functions.
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 vgasrc/geodevga.c | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c
index f7fd895..31632e7 100644
--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -107,36 +107,6 @@ static int legacyio_check(void)
 }

 /****************************************************************
-* Extened CRTC Register functions
-****************************************************************/
-static void crtce_lock(void)
-{
-    stdvga_crtc_write(VGAREG_VGA_CRTC_ADDRESS, EXTENDED_REGISTER_LOCK
-                      , CRTCE_LOCK);
-}
-
-static void crtce_unlock(void)
-{
-    stdvga_crtc_write(VGAREG_VGA_CRTC_ADDRESS, EXTENDED_REGISTER_LOCK
-                      , CRTCE_UNLOCK);
-}
-
-static u8 crtce_read(u8 reg)
-{
-    crtce_unlock();
-    u8 val = stdvga_crtc_read(VGAREG_VGA_CRTC_ADDRESS, reg);
-    crtce_lock();
-    return val;
-}
-
-static void crtce_write(u8 reg, u8 val)
-{
-    crtce_unlock();
-    stdvga_crtc_write(VGAREG_VGA_CRTC_ADDRESS, reg, val);
-    crtce_lock();
-}
-
-/****************************************************************
 * Display Controller Functions
 ****************************************************************/
 static u32 dc_read(u16 seg, u32 reg)
@@ -174,7 +144,7 @@ static u16 dc_map(u16 seg)
 {
     u8 reg;

-    reg = crtce_read(EXTENDED_MODE_CONTROL);
+    reg = stdvga_crtc_read(VGAREG_VGA_CRTC_ADDRESS, EXTENDED_MODE_CONTROL);
     reg &= 0xf9;
     switch (seg) {
     case SEG_GRAPH:
@@ -191,7 +161,7 @@ static u16 dc_map(u16 seg)
         break;
     }

-    crtce_write(EXTENDED_MODE_CONTROL,reg);
+    stdvga_crtc_write(VGAREG_VGA_CRTC_ADDRESS, EXTENDED_MODE_CONTROL,reg);
     return seg;
 }

@@ -366,6 +336,10 @@ int geodevga_init(void)
         // Device should be at 00:01.1
         SET_VGA(VgaBDF, pci_to_bdf(0, 1, 1));

+    // unlock crtc so we can use Standard VGA IO port access functions
+    stdvga_crtc_write(VGAREG_VGA_CRTC_ADDRESS, EXTENDED_REGISTER_LOCK
+                      , CRTCE_UNLOCK);
+
     vp_setup();
     dc_setup();

-- 
1.7.11.rc2.5.g68f532f




More information about the SeaBIOS mailing list