[SeaBIOS] [PATCH 2/3] debug: Only call serial_debug_preinit() at startup.

Kevin O'Connor kevin at koconnor.net
Mon Jan 20 18:33:30 CET 2014


The serial_debug_preinit() function disables serial interrupts so that
the OS doesn't get confused by "transmit buffer empty" interrupts
caused when seabios writes to the serial port.  It's unnecessary
paranoia to keep rechecking that interrupts are disabled.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/boot.c       | 2 --
 src/optionroms.c | 2 --
 src/output.c     | 7 -------
 src/output.h     | 1 -
 src/post.c       | 3 ++-
 src/resume.c     | 1 -
 vgasrc/vgainit.c | 3 ++-
 7 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/boot.c b/src/boot.c
index ad799f9..183f4f3 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -743,7 +743,6 @@ int BootSequence VARLOW = -1;
 void VISIBLE32FLAT
 handle_18(void)
 {
-    debug_preinit();
     debug_enter(NULL, DEBUG_HDL_18);
     int seq = BootSequence + 1;
     BootSequence = seq;
@@ -754,7 +753,6 @@ handle_18(void)
 void VISIBLE32FLAT
 handle_19(void)
 {
-    debug_preinit();
     debug_enter(NULL, DEBUG_HDL_19);
     BootSequence = 0;
     do_boot(0);
diff --git a/src/optionroms.c b/src/optionroms.c
index 1ff73c4..93d9d2f 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -44,8 +44,6 @@ __callrom(struct rom_header *rom, u16 offset, u16 bdf)
     start_preempt();
     farcall16big(&br);
     finish_preempt();
-
-    debug_preinit();
 }
 
 // Execute a given option rom at the standard entry vector.
diff --git a/src/output.c b/src/output.c
index 1d882fa..06d42a2 100644
--- a/src/output.c
+++ b/src/output.c
@@ -26,13 +26,6 @@ struct putcinfo {
  * Debug output
  ****************************************************************/
 
-// Setup debugging port(s).
-void
-debug_preinit(void)
-{
-    serial_debug_preinit();
-}
-
 // Write a character to debug port(s).
 static void
 debug_putc(struct putcinfo *action, char c)
diff --git a/src/output.h b/src/output.h
index a13d55b..6601035 100644
--- a/src/output.h
+++ b/src/output.h
@@ -4,7 +4,6 @@
 #include "types.h" // u32
 
 // output.c
-void debug_preinit(void);
 void panic(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2))) __noreturn;
 void printf(const char *fmt, ...)
diff --git a/src/post.c b/src/post.c
index ace6f4c..ec3271e 100644
--- a/src/post.c
+++ b/src/post.c
@@ -19,6 +19,7 @@
 #include "hw/pic.h" // pic_setup
 #include "hw/ps2port.h" // ps2port_setup
 #include "hw/rtc.h" // rtc_write
+#include "hw/serialio.h" // serial_debug_preinit
 #include "hw/usb.h" // usb_setup
 #include "hw/virtio-blk.h" // virtio_blk_setup
 #include "hw/virtio-scsi.h" // virtio_scsi_setup
@@ -317,7 +318,7 @@ handle_post(void)
     if (!CONFIG_QEMU && !CONFIG_COREBOOT)
         return;
 
-    debug_preinit();
+    serial_debug_preinit();
     dprintf(1, "Start bios (version %s)\n", VERSION);
 
     // Check if we are running under Xen.
diff --git a/src/resume.c b/src/resume.c
index 9ad2e4f..e2ceef1 100644
--- a/src/resume.c
+++ b/src/resume.c
@@ -25,7 +25,6 @@ void VISIBLE16
 handle_resume(void)
 {
     ASSERT16();
-    debug_preinit();
     int status = rtc_read(CMOS_RESET_CODE);
     rtc_write(CMOS_RESET_CODE, 0);
     dprintf(1, "In resume (status=%d)\n", status);
diff --git a/vgasrc/vgainit.c b/vgasrc/vgainit.c
index 7b01e03..13221fd 100644
--- a/vgasrc/vgainit.c
+++ b/vgasrc/vgainit.c
@@ -9,6 +9,7 @@
 #include "bregs.h" // struct bregs
 #include "hw/pci.h" // pci_config_readw
 #include "hw/pci_regs.h" // PCI_VENDOR_ID
+#include "hw/serialio.h" // serial_debug_preinit
 #include "output.h" // dprintf
 #include "std/optionrom.h" // struct pci_data
 #include "std/pmm.h" // struct pmmheader
@@ -126,7 +127,7 @@ int HaveRunInit VAR16;
 void VISIBLE16
 vga_post(struct bregs *regs)
 {
-    debug_preinit();
+    serial_debug_preinit();
     dprintf(1, "Start SeaVGABIOS (version %s)\n", VERSION);
     debug_enter(regs, DEBUG_VGA_POST);
 
-- 
1.8.3.1




More information about the SeaBIOS mailing list