aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-06-21 12:15:10 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-06-21 12:15:10 -0400
commit61d6b06696b7efc6e6bc1df6573ba58e743d6ae3 (patch)
treeb1c58d048abcbb27fe6130554828db45c803aded
parentdb03d5db185430812775f0075a18da459b96a019 (diff)
downloadseabios-hppa-61d6b06696b7efc6e6bc1df6573ba58e743d6ae3.zip
seabios-hppa-61d6b06696b7efc6e6bc1df6573ba58e743d6ae3.tar.gz
seabios-hppa-61d6b06696b7efc6e6bc1df6573ba58e743d6ae3.tar.bz2
Init serial port before using it for debug - also reinit after option rom.
Apparently, some VGA option roms will enable serial irqs - this could cause problems with spurious irqs from debug messages. Also, improve debugging of option roms that fail the checksum check.
-rw-r--r--src/boot.c2
-rw-r--r--src/output.c19
-rw-r--r--src/post.c10
-rw-r--r--src/util.h1
4 files changed, 31 insertions, 1 deletions
diff --git a/src/boot.c b/src/boot.c
index 09d28e8..3ee957b 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -200,6 +200,7 @@ do_boot(u16 seq_nr)
void VISIBLE16
handle_18()
{
+ debug_serial_setup();
debug_enter(NULL, DEBUG_HDL_18);
u16 seq = GET_EBDA(ipl.sequence) + 1;
do_boot(seq);
@@ -209,6 +210,7 @@ handle_18()
void VISIBLE16
handle_19()
{
+ debug_serial_setup();
debug_enter(NULL, DEBUG_HDL_19);
do_boot(0);
}
diff --git a/src/output.c b/src/output.c
index 054082f..dd647a2 100644
--- a/src/output.c
+++ b/src/output.c
@@ -13,6 +13,25 @@
#define DEBUG_PORT 0x03f8
#define DEBUG_TIMEOUT 100000
+void
+debug_serial_setup()
+{
+ if (!CONFIG_DEBUG_SERIAL)
+ return;
+ // setup for serial logging: 8N1
+ u8 oldparam, newparam = 0x03;
+ oldparam = inb(DEBUG_PORT+3);
+ outb(newparam, DEBUG_PORT+3);
+ // Disable irqs
+ u8 oldier, newier = 0;
+ oldier = inb(DEBUG_PORT+1);
+ outb(newier, DEBUG_PORT+1);
+
+ if (oldparam != newparam || oldier != newier)
+ dprintf(1, "Changing serial settings was %x/%x now %x/%x\n"
+ , oldparam, oldier, newparam, newier);
+}
+
static void
debug_serial(char c)
{
diff --git a/src/post.c b/src/post.c
index ca1d223..1b26e2b 100644
--- a/src/post.c
+++ b/src/post.c
@@ -156,6 +156,8 @@ callrom(u16 seg, u16 offset)
br.cs = seg;
br.ip = offset;
call16(&br);
+
+ debug_serial_setup();
}
// Find and run any "option roms" found in the given address range.
@@ -168,8 +170,13 @@ rom_scan(u32 start, u32 end)
if (*(u16*)rom != 0xaa55)
continue;
u32 len = rom[2] * 512;
- if (checksum(rom, len) != 0)
+ u8 sum = checksum(rom, len);
+ if (sum != 0) {
+ dprintf(1, "Found option rom with bad checksum:"
+ " loc=%p len=%d sum=%x\n"
+ , rom, len, sum);
continue;
+ }
p = (u8*)(((u32)p + len) / 2048 * 2048);
dprintf(1, "Running option rom at %p\n", rom+3);
callrom(FARPTR_TO_SEG(rom), FARPTR_TO_OFFSET(rom + 3));
@@ -300,6 +307,7 @@ _start()
init_dma();
check_restart_status();
+ debug_serial_setup();
dprintf(1, "Start bios\n");
// Setup for .bss and .data sections
diff --git a/src/util.h b/src/util.h
index ee42f6c..30c396a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -92,6 +92,7 @@ void __call16_int(struct bregs *callregs, u16 offset)
#endif
// output.c
+void debug_serial_setup();
void BX_PANIC(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)))
__attribute__ ((noreturn));