Add Kconfig option to specify which serial port when serial debugging.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 11 May 2011 03:36:11 +0000 (23:36 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 11 May 2011 03:36:11 +0000 (23:36 -0400)
src/Kconfig
src/output.c

index 0da69e6f4b811f06c9c6bd04d1443f4f43e84dd7..123db018edf97239e845038f0a89a4ee4c6845c7 100644 (file)
@@ -371,6 +371,12 @@ menu "Debugging"
         default n
         help
             Send debugging information to serial port.
+    config DEBUG_SERIAL_PORT
+        depends on DEBUG_SERIAL
+        hex "Serial port base address"
+        default 0x3f8
+        help
+            Base port for serial - generally 0x3f8, 0x2f8, 0x3e8, or 0x2e8.
 
     config SCREEN_AND_DEBUG
         depends on DEBUG_LEVEL != 0
index 4c9f95b042695e156aab13e0d0101f6ce6be5fd8..7c10d33e3635dbd9a583081cf9a7521fba11ff59 100644 (file)
@@ -21,7 +21,6 @@ struct putcinfo {
  * Debug output
  ****************************************************************/
 
-#define DEBUG_PORT PORT_SERIAL1
 #define DEBUG_TIMEOUT 100000
 
 void
@@ -31,12 +30,12 @@ debug_serial_setup(void)
         return;
     // setup for serial logging: 8N1
     u8 oldparam, newparam = 0x03;
-    oldparam = inb(DEBUG_PORT+SEROFF_LCR);
-    outb(newparam, DEBUG_PORT+SEROFF_LCR);
+    oldparam = inb(CONFIG_DEBUG_SERIAL_PORT+SEROFF_LCR);
+    outb(newparam, CONFIG_DEBUG_SERIAL_PORT+SEROFF_LCR);
     // Disable irqs
     u8 oldier, newier = 0;
-    oldier = inb(DEBUG_PORT+SEROFF_IER);
-    outb(newier, DEBUG_PORT+SEROFF_IER);
+    oldier = inb(CONFIG_DEBUG_SERIAL_PORT+SEROFF_IER);
+    outb(newier, CONFIG_DEBUG_SERIAL_PORT+SEROFF_IER);
 
     if (oldparam != newparam || oldier != newier)
         dprintf(1, "Changing serial settings was %x/%x now %x/%x\n"
@@ -50,11 +49,11 @@ debug_serial(char c)
     if (!CONFIG_DEBUG_SERIAL)
         return;
     int timeout = DEBUG_TIMEOUT;
-    while ((inb(DEBUG_PORT+SEROFF_LSR) & 0x60) != 0x60)
+    while ((inb(CONFIG_DEBUG_SERIAL_PORT+SEROFF_LSR) & 0x60) != 0x60)
         if (!timeout--)
             // Ran out of time.
             return;
-    outb(c, DEBUG_PORT+SEROFF_DATA);
+    outb(c, CONFIG_DEBUG_SERIAL_PORT+SEROFF_DATA);
 }
 
 // Make sure all serial port writes have been completely sent.
@@ -64,7 +63,7 @@ debug_serial_flush(void)
     if (!CONFIG_DEBUG_SERIAL)
         return;
     int timeout = DEBUG_TIMEOUT;
-    while ((inb(DEBUG_PORT+SEROFF_LSR) & 0x40) != 0x40)
+    while ((inb(CONFIG_DEBUG_SERIAL_PORT+SEROFF_LSR) & 0x40) != 0x40)
         if (!timeout--)
             // Ran out of time.
             return;