[SeaBIOS] [PATCH 5/8] Convert ps2 code EBDA variables to VARLOW variables.

Kevin O'Connor kevin at koconnor.net
Mon May 14 05:35:51 CEST 2012


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/biosvar.h |    1 -
 src/ps2port.c |   18 +++++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/biosvar.h b/src/biosvar.h
index 6758f1a..cf601ee 100644
--- a/src/biosvar.h
+++ b/src/biosvar.h
@@ -223,7 +223,6 @@ struct extended_bios_data_area_s {
     u8 other2[0xC4];
 
     // 0x121 - Begin custom storage.
-    u8 ps2ctr;
     struct usbkeyinfo usbkey_last;
 
     // El Torito Emulation data
diff --git a/src/ps2port.c b/src/ps2port.c
index 4b27b7a..a63a28c 100644
--- a/src/ps2port.c
+++ b/src/ps2port.c
@@ -8,7 +8,6 @@
 #include "ioport.h" // inb
 #include "util.h" // dprintf
 #include "paravirt.h" // romfile_loadint
-#include "biosvar.h" // GET_EBDA
 #include "ps2port.h" // ps2_kbd_command
 #include "pic.h" // eoi_pic1
 
@@ -208,6 +207,8 @@ ps2_sendbyte(int aux, u8 command, int timeout)
     return 0;
 }
 
+u8 Ps2ctr VARLOW;
+
 static int
 __ps2_command(int aux, int command, u8 *param)
 {
@@ -216,7 +217,7 @@ __ps2_command(int aux, int command, u8 *param)
     int send = (command >> 12) & 0xf;
 
     // Disable interrupts and keyboard/mouse.
-    u8 ps2ctr = GET_EBDA(ps2ctr);
+    u8 ps2ctr = GET_FLATPTR(Ps2ctr);
     u8 newctr = ((ps2ctr | I8042_CTR_AUXDIS | I8042_CTR_KBDDIS)
                  & ~(I8042_CTR_KBDINT|I8042_CTR_AUXINT));
     dprintf(6, "i8042 ctr old=%x new=%x\n", ps2ctr, newctr);
@@ -337,13 +338,12 @@ ps2_mouse_command(int command, u8 *param)
 
     // Update ps2ctr for mouse enable/disable.
     if (command == PSMOUSE_CMD_ENABLE || command == PSMOUSE_CMD_DISABLE) {
-        u16 ebda_seg = get_ebda_seg();
-        u8 ps2ctr = GET_EBDA2(ebda_seg, ps2ctr);
+        u8 ps2ctr = GET_FLATPTR(Ps2ctr);
         if (command == PSMOUSE_CMD_ENABLE)
             ps2ctr = (ps2ctr | I8042_CTR_AUXINT) & ~I8042_CTR_AUXDIS;
         else
             ps2ctr = (ps2ctr | I8042_CTR_AUXDIS) & ~I8042_CTR_AUXINT;
-        SET_EBDA2(ebda_seg, ps2ctr, ps2ctr);
+        SET_FLATPTR(Ps2ctr, ps2ctr);
     }
 
     return ps2_command(1, command, param);
@@ -371,7 +371,7 @@ handle_74(void)
     }
     v = inb(PORT_PS2_DATA);
 
-    if (!(GET_EBDA(ps2ctr) & I8042_CTR_AUXINT))
+    if (!(GET_FLATPTR(Ps2ctr) & I8042_CTR_AUXINT))
         // Interrupts not enabled.
         goto done;
 
@@ -398,7 +398,7 @@ handle_09(void)
     }
     v = inb(PORT_PS2_DATA);
 
-    if (!(GET_EBDA(ps2ctr) & I8042_CTR_KBDINT))
+    if (!(GET_FLATPTR(Ps2ctr) & I8042_CTR_KBDINT))
         // Interrupts not enabled.
         goto done;
 
@@ -444,7 +444,7 @@ keyboard_init(void *data)
     }
 
     // Disable keyboard and mouse events.
-    SET_EBDA(ps2ctr, I8042_CTR_KBDDIS | I8042_CTR_AUXDIS);
+    SET_FLATPTR(Ps2ctr, I8042_CTR_KBDDIS | I8042_CTR_AUXDIS);
 
 
     /* ------------------- keyboard side ------------------------*/
@@ -479,7 +479,7 @@ keyboard_init(void *data)
         return;
 
     // Keyboard Mode: disable mouse, scan code convert, enable kbd IRQ
-    SET_EBDA(ps2ctr, I8042_CTR_AUXDIS | I8042_CTR_XLATE | I8042_CTR_KBDINT);
+    SET_FLATPTR(Ps2ctr, I8042_CTR_AUXDIS | I8042_CTR_XLATE | I8042_CTR_KBDINT);
 
     /* Enable keyboard */
     ret = ps2_kbd_command(ATKBD_CMD_ENABLE, NULL);
-- 
1.7.6.5




More information about the SeaBIOS mailing list