Check for CONFIG_PS2PORT on all entry ps2 function entry points.
[seabios.git] / src / ps2port.c
index 8259f659a14211b490dd3ef417725ea88b8d04a0..1f042999047ed818e7a5b458c0c03716b9b4cc0d 100644 (file)
@@ -7,6 +7,7 @@
 
 #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
@@ -131,6 +132,8 @@ i8042_aux_write(u8 c)
 void
 i8042_reboot(void)
 {
+    if (! CONFIG_PS2PORT)
+       return;
     int i;
     for (i=0; i<10; i++) {
         i8042_wait_write();
@@ -321,12 +324,17 @@ ps2_command(int aux, int command, u8 *param)
 int
 ps2_kbd_command(int command, u8 *param)
 {
+    if (! CONFIG_PS2PORT)
+        return -1;
     return ps2_command(0, command, param);
 }
 
 int
 ps2_mouse_command(int command, u8 *param)
 {
+    if (! CONFIG_PS2PORT)
+        return -1;
+
     // Update ps2ctr for mouse enable/disable.
     if (command == PSMOUSE_CMD_ENABLE || command == PSMOUSE_CMD_DISABLE) {
         u16 ebda_seg = get_ebda_seg();
@@ -438,13 +446,14 @@ keyboard_init(void *data)
 
     /* ------------------- keyboard side ------------------------*/
     /* reset keyboard and self test  (keyboard side) */
-    u64 end = calc_future_tsc(CONFIG_PS2_KEYBOARD_SPINUP);
+    int spinupdelay = romfile_loadint("etc/ps2-keyboard-spinup", 0);
+    u64 end = calc_future_tsc(spinupdelay);
     for (;;) {
         ret = ps2_kbd_command(ATKBD_CMD_RESET_BAT, param);
         if (!ret)
             break;
         if (check_tsc(end)) {
-            if (CONFIG_PS2_KEYBOARD_SPINUP)
+            if (spinupdelay)
                 warn_timeout();
             return;
         }