On Wed, Feb 13, 2013 at 04:52:09AM +0100, Laszlo Ersek wrote: > This series bears witness to my extreme cluelessness. With it I'm only > asking if we can move the hypervisor/platform detection logic to SRCBOTH > code, so that it sets up "PlatformRunningOn" for all of CSM, vgabios, > and "normal" SeaBIOS.
It's possible to do this, but it's not a great way of detecting the platform - it can only detect Xen/KVM and not raw QEMU. On coreboot, it's possible to determine if qemu (or its derivatives) launched SeaBIOS by looking for the qemu signature in the vendor/part identifiers in the coreboot tables. David suggested that something similar could be done for CSM by looking at the SMBIOS tables. >The motivation is that running on qemu is now a > requirement for logging to the qemu debug port, and logging to that port > would be nice in all flavors & parts. I recently pushed the "Improved multi-platform support" series, but I pulled out the CONFIG_DEBUG_IO change that allowed it to work with just CONFIG_QEMU_HARDWARE. I think it's possible to get it working with CONFIG_QEMU_HARDWARE with something like the patch below. Also, the current SeaVGABIOS code is checking for "!COREBOOT" in its Kconfig file - that should be changed to "QEMU". With that fixed this will be even less of a concern. (It really only makes sense to build a cirrus/bochs vgabios for QEMU - which would always have the debug port available.) -Kevin diff --git a/Makefile b/Makefile index e02803e..b9fed0f 100644 --- a/Makefile +++ b/Makefile @@ -36,14 +36,14 @@ COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) -CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0 -fomit-frame-pointer +CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0 -fomit-frame-pointer -DMODEVGA=0 CFLAGSSEG := $(COMMONCFLAGS) -DMODESEGMENT=1 -fno-defer-pop \ $(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \ $(call cc-option,$(CC),-fno-tree-switch-conversion,) -CFLAGS32SEG := $(CFLAGSSEG) -DMODE16=0 -fomit-frame-pointer +CFLAGS32SEG := $(CFLAGSSEG) -DMODE16=0 -fomit-frame-pointer -DMODEVGA=0 CFLAGS16INC := $(CFLAGSSEG) -DMODE16=1 -Wa,src/code16gcc.s \ $(call cc-option,$(CC),--param large-stack-frame=4,-fno-inline) -CFLAGS16 := $(CFLAGS16INC) -fomit-frame-pointer +CFLAGS16 := $(CFLAGS16INC) -fomit-frame-pointer -DMODEVGA=0 # Run with "make V=1" to see the actual compile commands ifdef V @@ -179,7 +179,7 @@ SRCVGA=src/output.c src/util.c src/pci.c \ vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \ vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c -CFLAGS16VGA = $(CFLAGS16INC) -Isrc +CFLAGS16VGA = $(CFLAGS16INC) -Isrc -DMODEVGA=1 $(OUT)vgaccode16.raw.s: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@) diff --git a/src/Kconfig b/src/Kconfig index 4ddf9da..7df6c67 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -406,7 +406,7 @@ menu "Debugging" Base port for serial - generally 0x3f8, 0x2f8, 0x3e8, or 0x2e8. config DEBUG_IO - depends on QEMU && DEBUG_LEVEL != 0 + depends on QEMU_HARDWARE && DEBUG_LEVEL != 0 bool "Special IO port debugging" default y help diff --git a/src/output.c b/src/output.c index e623d37..27621f5 100644 --- a/src/output.c +++ b/src/output.c @@ -11,6 +11,7 @@ #include "bregs.h" // struct bregs #include "config.h" // CONFIG_* #include "biosvar.h" // GET_GLOBAL +#include "paravirt.h" // runningOnQEMU struct putcinfo { void (*func)(struct putcinfo *info, char c); @@ -77,7 +78,7 @@ putc_debug(struct putcinfo *action, char c) { if (! CONFIG_DEBUG_LEVEL) return; - if (CONFIG_DEBUG_IO) + if (CONFIG_DEBUG_IO && runningOnQEMU()) // Send character to debug port. outb(c, GET_GLOBAL(DebugOutputPort)); if (c == '\n') diff --git a/src/paravirt.h b/src/paravirt.h index 4438273..11343cd 100644 --- a/src/paravirt.h +++ b/src/paravirt.h @@ -14,7 +14,7 @@ extern int PlatformRunningOn; static inline int runningOnQEMU(void) { return CONFIG_QEMU || ( - CONFIG_QEMU_HARDWARE && GET_GLOBAL(PlatformRunningOn) & PF_QEMU); + !MODEVGA && CONFIG_QEMU_HARDWARE && GET_GLOBAL(PlatformRunningOn) & PF_QEMU); } static inline int runningOnXen(void) { return CONFIG_XEN && GET_GLOBAL(PlatformRunningOn) & PF_XEN; _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org http://www.seabios.org/mailman/listinfo/seabios