On 05/30/13 03:34, Kevin O'Connor wrote: > On Wed, May 29, 2013 at 04:25:59PM +0200, Gerd Hoffmann wrote: >> Allow selecting DEBUG_IO for non-qemu configurations, >> which is useful when running coreboot+seabios on qemu. > > Unfortunately, if one does run seabios on real hardware and has > DEBUG_IO enabled, it will write to IO port 0x402 before confirming > that it is actually running on QEMU. This could cause mysterious > failures on real hardware if something is listening to that port. > It's why I left the option dependent on QEMU instead of QEMU_HARDWARE. > Ideally the code would verify it is on QEMU before using the IO port, > while still providing the very early debugging when it is known to be > safe.
The debgconsole port returns 0xe9 on reads, so we could use that for probing and do something like the attached patch. Which doesn't build for some reason. Is the F segment read-only in 16bit mode? Should I use something else instead? Or #ifdef the SET_GLOBAL for 32bit mode, which should work fine given that POST runs in 32bit mode? cheers, Gerd
>From ea131715b0b8f959f8f34768ef46ac029a5f84b0 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann <kra...@redhat.com> Date: Thu, 30 May 2013 09:25:40 +0200 Subject: [PATCH] [broken] probe for debug port Signed-off-by: Gerd Hoffmann <kra...@redhat.com> --- src/output.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/output.c b/src/output.c index 79c3ada..102f177 100644 --- a/src/output.c +++ b/src/output.c @@ -24,6 +24,7 @@ struct putcinfo { #define DEBUG_TIMEOUT 100000 u16 DebugOutputPort VARFSEG = 0x402; +u8 DebugOutputEnabled VARFSEG = 0xff; void debug_serial_preinit(void) @@ -77,9 +78,17 @@ putc_debug(struct putcinfo *action, char c) { if (! CONFIG_DEBUG_LEVEL) return; - if (CONFIG_DEBUG_IO) + if (CONFIG_DEBUG_IO) { // Send character to debug port. - outb(c, GET_GLOBAL(DebugOutputPort)); + u8 enabled = GET_GLOBAL(DebugOutputEnabled); + if (enabled == 0xff) { + enabled = (inb(GET_GLOBAL(DebugOutputPort)) == 0xe9); + SET_GLOBAL(DebugOutputEnabled, enabled); + } + if (enabled ) { + outb(c, GET_GLOBAL(DebugOutputPort)); + } + } if (c == '\n') debug_serial('\r'); debug_serial(c); -- 1.7.9.7
_______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios