Hi,
This patch series prepares vgabios for being used as qemu vga bios. Qemu comes with multiple vga card emulations, so we need multiple vgabios binaries. All build out of the same source tree, but with different config options. Thus patch #1 revamps vgabios configuration to allow building different variants in one go. Patches #2 .. #5 enable more qemu virtual hardware support on top of that.
Gerd Hoffmann (5): vgabios: support building multiple variants. bochsvga: handle vmware vga. bochsvga: build bios variant for vmware. bochsvga: build bios variant for qxl. bochsvga: build bios variant for isa-vga.
Makefile | 69 +++++++++++++++++++++++++++++---- vgasrc/Kconfig | 107 ++++++++++++++++++----------------------------------- vgasrc/bochsvga.c | 18 ++++++-- vgasrc/vgaentry.S | 2 +- 4 files changed, 110 insertions(+), 86 deletions(-)
This patch allows to build multiple versions of the vgabios without the need to reconfigure it each time. To implement that the way vgabios configuration works has been changed radically. It is now done in the Makefile, using target-specific variables. Kconfig is used to pick the variants which should be built.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- Makefile | 58 ++++++++++++++++++++++++++++----- vgasrc/Kconfig | 92 ++++++++++------------------------------------------ vgasrc/vgaentry.S | 2 +- 3 files changed, 68 insertions(+), 84 deletions(-)
diff --git a/Makefile b/Makefile index 0343ce5..bfed5f9 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,10 @@ STRIP=strip -include $(KCONFIG_CONFIG)
target-y = $(OUT) $(OUT)bios.bin -target-$(CONFIG_BUILD_VGABIOS) += $(OUT)vgabios.bin +target-$(CONFIG_BUILD_QEMU_CIRRUS) += $(OUT)vgabios-cirrus.bin +target-$(CONFIG_BUILD_QEMU_STDVGA) += $(OUT)vgabios-stdvga.bin +target-$(CONFIG_BUILD_GEODEGX2) += $(OUT)vgabios-genodegx2.bin +target-$(CONFIG_BUILD_GEODELX) += $(OUT)vgabios-genodelx.bin
all: $(target-y)
@@ -188,21 +191,58 @@ SRCVGA=src/output.c src/util.c src/pci.c \
CFLAGS16VGA = $(CFLAGS16INC) -g -Isrc
-$(OUT)vgaccode.16.s: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@) - -$(OUT)vgalayout16.o: vgaentry.S $(OUT)vgaccode.16.s $(OUT)asm-offsets.h +# defaults +ENABLE_CIRRUS := 0 +ENABLE_BOCHS := 0 +ENABLE_GEODEGX2 := 0 +ENABLE_GEODELX := 0 +ENABLE_PCI := 1 +ENABLE_VBE := 1 + +# tweak defaults per target +$(OUT)vgabios-cirrus.bin : ENABLE_CIRRUS := 1 +$(OUT)vgabios-stdvga.bin : ENABLE_BOCHS := 1 +$(OUT)vgabios-genodegx2.bin : ENABLE_GEODEGX2 := 1 +$(OUT)vgabios-genodelx.bin : ENABLE_GEODELX := 1 + +# add common config options +CFLAGS16INC += -DCONFIG_VGA_CIRRUS=$(ENABLE_CIRRUS) +CFLAGS16INC += -DCONFIG_VGA_BOCHS=$(ENABLE_BOCHS) +CFLAGS16INC += -DCONFIG_VGA_GEODEGX2=$(ENABLE_GEODEGX2) +CFLAGS16INC += -DCONFIG_VGA_GEODELX=$(ENABLE_GEODELX) +CFLAGS16INC += -DCONFIG_VGA_PCI=$(ENABLE_PCI) +CFLAGS16INC += -DCONFIG_VGA_VBE=$(ENABLE_VBE) + +# set pci vendor ids per target +$(OUT)vgabios-cirrus.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1013 +$(OUT)vgabios-stdvga.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1234 +$(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x100b +$(OUT)vgabios-genodelx.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1022 + +# set pci device ids per target +$(OUT)vgabios-cirrus.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x00b8 +$(OUT)vgabios-stdvga.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x1111 +$(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x0030 +$(OUT)vgabios-genodelx.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x2081 + +$(OUT)vgaccode-%.16.s: $(OUT)autoconf.h + @echo CFLAGS16INC=$(CFLAGS16INC) + $(call whole-compile, $(CFLAGS16VGA) -S, $(SRCVGA),$@) + +$(OUT)vgalayout-%16.o: $(OUT)vgaccode-%.16.s vgaentry.S $(OUT)asm-offsets.h @echo " Compiling (16bit) $@" - $(Q)$(CC) $(CFLAGS16INC) -c -D__ASSEMBLY__ -Isrc $< -o $@ + $(Q)$(CC) $(CFLAGS16INC) -c -D__ASSEMBLY__ \ + -DVGACODE16='"vgaccode-$*.16.s"' -Isrc vgasrc/vgaentry.S -o $@
-$(OUT)vgarom.o: $(OUT)vgalayout16.o $(OUT)vgalayout.lds +$(OUT)vgarom-%.o: $(OUT)vgalayout-%16.o $(OUT)vgalayout.lds @echo " Linking $@" - $(Q)$(LD) --gc-sections -T $(OUT)vgalayout.lds $(OUT)vgalayout16.o -o $@ + $(Q)$(LD) --gc-sections -T $(OUT)vgalayout.lds $< -o $@
-$(OUT)vgabios.bin.raw: $(OUT)vgarom.o +$(OUT)vgabios-%.bin.raw: $(OUT)vgarom-%.o @echo " Extracting binary $@" $(Q)$(OBJCOPY) -O binary $< $@
-$(OUT)vgabios.bin: $(OUT)vgabios.bin.raw tools/buildrom.py +$(OUT)vgabios-%.bin: $(OUT)vgabios-%.bin.raw tools/buildrom.py @echo " Finalizing rom $@" $(Q)./tools/buildrom.py $< $@
diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig index 881e9ec..ed59065 100644 --- a/vgasrc/Kconfig +++ b/vgasrc/Kconfig @@ -1,87 +1,31 @@ # Kconfig SeaBIOS VGA BIOS configuration
menu "VGA ROM" - choice - prompt "VGA Hardware Type" - default NO_VGABIOS + config BUILD_QEMU + bool "Build vgabios variants for QEMU" + default !COREBOOT
- config NO_VGABIOS - bool "None" - help - Do not build a VGA BIOS. - - config VGA_STANDARD_VGA - bool "Standard VGA" - help - Build basic VGA BIOS support. - - config VGA_CIRRUS - bool "QEMU Cirrus CLGD 54xx VGA BIOS" - help - Build support for Cirrus VGA emulation. - - config VGA_BOCHS - bool "Bochs DISPI interface VGA BIOS" - help - Build support for Bochs DISPI interface. - - config VGA_GEODEGX2 - bool "GeodeGX2 interface VGA BIOS" - help - Build support for Geode GX2 vga. - - config VGA_GEODELX - bool "GeodeLX interface VGA BIOS" - help - Build support for Geode LX vga. - endchoice - - config BUILD_VGABIOS - bool - default !NO_VGABIOS - - config VGA_VBE - depends on BUILD_VGABIOS - bool "Video BIOS Extensions (VBE)" - default y + config BUILD_QEMU_CIRRUS + bool "QEMU Cirrus CLGD 54xx VGA BIOS" + default BUILD_QEMU help - Support VBE. + Build vgabios for cirrus VGA emulation.
- config VGA_PCI - depends on BUILD_VGABIOS - bool "PCI ROM Headers" - default y + config BUILD_QEMU_STDVGA + bool "QEMU standard VGA BIOS" + default BUILD_QEMU help - Build PCI ROM headers so the vga rom can be extracted from - a PCI device. + Build vgabios for QEMU standard VGA emulation, + using Bochs DISPI interface.
- config OVERRIDE_PCI_ID - depends on VGA_PCI - bool "Override PCI Vendor and Device IDs" + config BUILD_GEODEGX2 + bool "GeodeGX2 interface VGA BIOS" help - Specify specific values for the PCI Vendor and Device IDs. + Build vgabios for Geode GX2 vga.
- config VGA_VID - depends on VGA_PCI - hex - prompt "PCI Vendor ID" if OVERRIDE_PCI_ID - default 0x1013 if VGA_CIRRUS - default 0x1234 if VGA_BOCHS - default 0x100b if VGA_GEODEGX2 - default 0x1022 if VGA_GEODELX - default 0x0000 + config BUILD_GEODELX + bool "GeodeLX interface VGA BIOS" help - Vendor ID for the PCI ROM + Build vgabios for Geode LX vga.
- config VGA_DID - depends on VGA_PCI - hex - prompt "PCI Vendor ID" if OVERRIDE_PCI_ID - default 0x00b8 if VGA_CIRRUS - default 0x1111 if VGA_BOCHS - default 0x0030 if VGA_GEODEGX2 - default 0x2081 if VGA_GEODELX - default 0x0000 - help - Device ID for the PCI ROM endmenu diff --git a/vgasrc/vgaentry.S b/vgasrc/vgaentry.S index 112857b..d83a4ca 100644 --- a/vgasrc/vgaentry.S +++ b/vgasrc/vgaentry.S @@ -10,7 +10,7 @@ ****************************************************************/
.code16gcc -#include "vgaccode.16.s" +#include VGACODE16
#include "config.h" // CONFIG_* #include "entryfuncs.S" // ENTRY_*
The vmware vga emulated by qemu has a I/O region in pci bar 0. The framebuffer is in pci bar 1. Handle that by checking the type of bar 0 in case it is a I/O bar use bar 1 instead.
Also make bochsbios report lfb size in debug output.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- vgasrc/bochsvga.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index 82629b9..274c93b 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -124,10 +124,17 @@ bochsvga_init(void) dispi_write(VBE_DISPI_INDEX_ID, VBE_DISPI_ID5);
u32 lfb_addr; - if (CONFIG_VGA_PCI) - lfb_addr = (pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0) - & PCI_BASE_ADDRESS_MEM_MASK); - else + if (CONFIG_VGA_PCI) { + u32 bar = pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0); + if ((bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) { + lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK; + dprintf(1, "VBE DISPI: bdf %x, bar 0\n", GET_GLOBAL(VgaBDF)); + } else { + bar = pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_1); + lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK; + dprintf(1, "VBE DISPI: bdf %x, bar 1\n", GET_GLOBAL(VgaBDF)); + } + } else lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
SET_VGA(VBE_framebuffer, lfb_addr); @@ -135,7 +142,8 @@ bochsvga_init(void) SET_VGA(VBE_total_memory, totalmem * 64 * 1024); SET_VGA(VBE_capabilities, VBE_CAPABILITY_8BIT_DAC);
- dprintf(1, "VBE DISPI detected. lfb_addr=%x\n", lfb_addr); + dprintf(1, "VBE DISPI: lfb_addr=%x, size %d MB\n", + lfb_addr, totalmem / 16);
return 0; }
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- Makefile | 4 ++++ vgasrc/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile index bfed5f9..8090ae9 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,7 @@ STRIP=strip target-y = $(OUT) $(OUT)bios.bin target-$(CONFIG_BUILD_QEMU_CIRRUS) += $(OUT)vgabios-cirrus.bin target-$(CONFIG_BUILD_QEMU_STDVGA) += $(OUT)vgabios-stdvga.bin +target-$(CONFIG_BUILD_QEMU_VMWARE) += $(OUT)vgabios-vmware.bin target-$(CONFIG_BUILD_GEODEGX2) += $(OUT)vgabios-genodegx2.bin target-$(CONFIG_BUILD_GEODELX) += $(OUT)vgabios-genodelx.bin
@@ -202,6 +203,7 @@ ENABLE_VBE := 1 # tweak defaults per target $(OUT)vgabios-cirrus.bin : ENABLE_CIRRUS := 1 $(OUT)vgabios-stdvga.bin : ENABLE_BOCHS := 1 +$(OUT)vgabios-vmware.bin : ENABLE_BOCHS := 1 $(OUT)vgabios-genodegx2.bin : ENABLE_GEODEGX2 := 1 $(OUT)vgabios-genodelx.bin : ENABLE_GEODELX := 1
@@ -216,12 +218,14 @@ CFLAGS16INC += -DCONFIG_VGA_VBE=$(ENABLE_VBE) # set pci vendor ids per target $(OUT)vgabios-cirrus.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1013 $(OUT)vgabios-stdvga.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1234 +$(OUT)vgabios-vmware.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x15ad $(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x100b $(OUT)vgabios-genodelx.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1022
# set pci device ids per target $(OUT)vgabios-cirrus.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x00b8 $(OUT)vgabios-stdvga.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x1111 +$(OUT)vgabios-vmware.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x0405 $(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x0030 $(OUT)vgabios-genodelx.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x2081
diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig index ed59065..71af78e 100644 --- a/vgasrc/Kconfig +++ b/vgasrc/Kconfig @@ -18,6 +18,13 @@ menu "VGA ROM" Build vgabios for QEMU standard VGA emulation, using Bochs DISPI interface.
+ config BUILD_QEMU_VMWARE + bool "QEMU vmware VGA BIOS" + default BUILD_QEMU + help + Build vgabios for QEMU vmware VGA emulation, + using Bochs DISPI interface. + config BUILD_GEODEGX2 bool "GeodeGX2 interface VGA BIOS" help
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- Makefile | 4 ++++ vgasrc/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile index 8090ae9..8e85ba4 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ target-y = $(OUT) $(OUT)bios.bin target-$(CONFIG_BUILD_QEMU_CIRRUS) += $(OUT)vgabios-cirrus.bin target-$(CONFIG_BUILD_QEMU_STDVGA) += $(OUT)vgabios-stdvga.bin target-$(CONFIG_BUILD_QEMU_VMWARE) += $(OUT)vgabios-vmware.bin +target-$(CONFIG_BUILD_QEMU_QXL) += $(OUT)vgabios-qxl.bin target-$(CONFIG_BUILD_GEODEGX2) += $(OUT)vgabios-genodegx2.bin target-$(CONFIG_BUILD_GEODELX) += $(OUT)vgabios-genodelx.bin
@@ -204,6 +205,7 @@ ENABLE_VBE := 1 $(OUT)vgabios-cirrus.bin : ENABLE_CIRRUS := 1 $(OUT)vgabios-stdvga.bin : ENABLE_BOCHS := 1 $(OUT)vgabios-vmware.bin : ENABLE_BOCHS := 1 +$(OUT)vgabios-qxl.bin : ENABLE_BOCHS := 1 $(OUT)vgabios-genodegx2.bin : ENABLE_GEODEGX2 := 1 $(OUT)vgabios-genodelx.bin : ENABLE_GEODELX := 1
@@ -219,6 +221,7 @@ CFLAGS16INC += -DCONFIG_VGA_VBE=$(ENABLE_VBE) $(OUT)vgabios-cirrus.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1013 $(OUT)vgabios-stdvga.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1234 $(OUT)vgabios-vmware.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x15ad +$(OUT)vgabios-qxl.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1b36 $(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x100b $(OUT)vgabios-genodelx.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1022
@@ -226,6 +229,7 @@ $(OUT)vgabios-genodelx.bin : CFLAGS16INC += -DCONFIG_VGA_VID=0x1022 $(OUT)vgabios-cirrus.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x00b8 $(OUT)vgabios-stdvga.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x1111 $(OUT)vgabios-vmware.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x0405 +$(OUT)vgabios-qxl.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x0100 $(OUT)vgabios-genodegx2.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x0030 $(OUT)vgabios-genodelx.bin : CFLAGS16INC += -DCONFIG_VGA_DID=0x2081
diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig index 71af78e..0a6a959 100644 --- a/vgasrc/Kconfig +++ b/vgasrc/Kconfig @@ -25,6 +25,13 @@ menu "VGA ROM" Build vgabios for QEMU vmware VGA emulation, using Bochs DISPI interface.
+ config BUILD_QEMU_QXL + bool "QEMU QXL VGA BIOS" + default BUILD_QEMU + help + Build vgabios for QEMU qxl paravirtual VGA, + using Bochs DISPI interface. + config BUILD_GEODEGX2 bool "GeodeGX2 interface VGA BIOS" help
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- Makefile | 3 +++ vgasrc/Kconfig | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile index 8e85ba4..8aaa8e6 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,7 @@ STRIP=strip target-y = $(OUT) $(OUT)bios.bin target-$(CONFIG_BUILD_QEMU_CIRRUS) += $(OUT)vgabios-cirrus.bin target-$(CONFIG_BUILD_QEMU_STDVGA) += $(OUT)vgabios-stdvga.bin +target-$(CONFIG_BUILD_QEMU_ISAVGA) += $(OUT)vgabios-isavga.bin target-$(CONFIG_BUILD_QEMU_VMWARE) += $(OUT)vgabios-vmware.bin target-$(CONFIG_BUILD_QEMU_QXL) += $(OUT)vgabios-qxl.bin target-$(CONFIG_BUILD_GEODEGX2) += $(OUT)vgabios-genodegx2.bin @@ -204,6 +205,8 @@ ENABLE_VBE := 1 # tweak defaults per target $(OUT)vgabios-cirrus.bin : ENABLE_CIRRUS := 1 $(OUT)vgabios-stdvga.bin : ENABLE_BOCHS := 1 +$(OUT)vgabios-isavga.bin : ENABLE_BOCHS := 1 +$(OUT)vgabios-isavga.bin : ENABLE_PCI := 0 $(OUT)vgabios-vmware.bin : ENABLE_BOCHS := 1 $(OUT)vgabios-qxl.bin : ENABLE_BOCHS := 1 $(OUT)vgabios-genodegx2.bin : ENABLE_GEODEGX2 := 1 diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig index 0a6a959..093754d 100644 --- a/vgasrc/Kconfig +++ b/vgasrc/Kconfig @@ -12,7 +12,14 @@ menu "VGA ROM" Build vgabios for cirrus VGA emulation.
config BUILD_QEMU_STDVGA - bool "QEMU standard VGA BIOS" + bool "QEMU standard PCI VGA BIOS" + default BUILD_QEMU + help + Build vgabios for QEMU standard VGA emulation, + using Bochs DISPI interface. + + config BUILD_QEMU_ISAVGA + bool "QEMU standard ISA VGA BIOS" default BUILD_QEMU help Build vgabios for QEMU standard VGA emulation,
On Mon, Jan 23, 2012 at 12:30:29PM +0100, Gerd Hoffmann wrote:
Hi,
This patch series prepares vgabios for being used as qemu vga bios.
Are you thinking of driving an effort to replace the default vga bios in qemu? (Assistance would be helpful here.)
As for current state in comparison to the existing LGPL vgabios, the only thing I'm aware of is the Cirrus support still lacks a few vbe calls (calls 05/06/07/10) and BochsVGA has similar vbe calls lacking (calls 04/05/06/07/0a) and BochsVGA has a 32bit mode interface not implemented. The remaining calls look pretty straight forward, but the 32bit interface would require some build magic.
Testing is going to be the real challenge. I don't even know what (if anything) actually uses some of the obscure vgabios calls.
Qemu comes with multiple vga card emulations, so we need multiple vgabios binaries. All build out of the same source tree, but with different config options. Thus patch #1 revamps vgabios configuration to allow building different variants in one go. Patches #2 .. #5 enable more qemu virtual hardware support on top of that.
Why does QEMU have so many different vgabios blobs? QEMU is actively peaking into the blob and updating the PCI ids, so it shouldn't require a different blob for each BochsVGA variant. That would then leave just two blobs - Cirrus and Bochs. I do wonder if it would be simpler to just run the build twice (updating .config between builds).
That said, I'm okay with moving this to the Makefile. However, we'd really need to move it to a new vgasrc/Makefile - as I think it would complicate the main Makefile too much.
-Kevin
On 01/24/12 01:23, Kevin O'Connor wrote:
On Mon, Jan 23, 2012 at 12:30:29PM +0100, Gerd Hoffmann wrote:
Hi,
This patch series prepares vgabios for being used as qemu vga bios.
Are you thinking of driving an effort to replace the default vga bios in qemu? (Assistance would be helpful here.)
I'd love to do that. A vga bios largely written in C is much easier to handle, also the lgpl vgabios upstream is very non-responsitive.
As for current state in comparison to the existing LGPL vgabios, the only thing I'm aware of is the Cirrus support still lacks a few vbe calls (calls 05/06/07/10) and BochsVGA has similar vbe calls lacking (calls 04/05/06/07/0a) and BochsVGA has a 32bit mode interface not implemented. The remaining calls look pretty straight forward, but the 32bit interface would require some build magic.
Testing is going to be the real challenge. I don't even know what (if anything) actually uses some of the obscure vgabios calls.
Agree. Didn't test vbe at all yet. vesafb can use these calls, but doesn't by default. In 8bit modes (pretty out of fashion these days) they are used to set the palette registers, but vesafb happily falls back to direct vga port access in case they are not available. vesafb can also pan the display for faster scrolling, which uses these calls too to set the first scanline to be displayed.
Qemu comes with multiple vga card emulations, so we need multiple vgabios binaries. All build out of the same source tree, but with different config options. Thus patch #1 revamps vgabios configuration to allow building different variants in one go. Patches #2 .. #5 enable more qemu virtual hardware support on top of that.
Why does QEMU have so many different vgabios blobs? QEMU is actively peaking into the blob and updating the PCI ids, so it shouldn't require a different blob for each BochsVGA variant.
Hmm, need to check. The lgpl vgabios looked up the card by pci id, so the pci id is encoded in more places than just the rom header, thus the patching approach doesn't fly. The seabios version uses the bdf passed in from seabios instead if I read the code correctly, so the patching should actually work.
That would then leave just two blobs - Cirrus and Bochs. I do wonder if it would be simpler to just run the build twice (updating .config between builds).
Another way would be runtime detection, so we could have a single bios binary with both cirrus and bochs support.
cheers, Gerd
Kevin O'Connor wrote:
Testing is going to be the real challenge. I don't even know what (if anything) actually uses some of the obscure vgabios calls.
See if you can locate a copy of SciTech Display Doctor.
//Peter
On Mon, Jan 23, 2012 at 12:30:31PM +0100, Gerd Hoffmann wrote:
The vmware vga emulated by qemu has a I/O region in pci bar 0. The framebuffer is in pci bar 1. Handle that by checking the type of bar 0 in case it is a I/O bar use bar 1 instead.
Also make bochsbios report lfb size in debug output.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
FYI - I updated this patch and added it to my repo.
-Kevin
commit b1d222d74bafe6190c3c16ca1f62f67835929abd Author: Kevin O'Connor kevin@koconnor.net Date: Sun Jan 29 11:53:59 2012 -0500
vgabios: handle vmware vga in bochsvga.
The vmware vga emulated by qemu has a I/O region in pci bar 0. The framebuffer is in pci bar 1. Handle that by checking the type of bar 0 in case it is a I/O bar use bar 1 instead.
Also make bochsbios report lfb size in debug output.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com Signed-off-by: Kevin O'Connor kevin@koconnor.net
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index 6065f25..331cb4e 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -138,16 +138,25 @@ bochsvga_init(void)
u32 lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS; int bdf = GET_GLOBAL(VgaBDF); - if (CONFIG_VGA_PCI && bdf >= 0) - lfb_addr = (pci_config_readl(bdf, PCI_BASE_ADDRESS_0) - & PCI_BASE_ADDRESS_MEM_MASK); + if (CONFIG_VGA_PCI && bdf >= 0) { + int barid = 0; + u32 bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_0); + if ((bar & PCI_BASE_ADDRESS_SPACE) != PCI_BASE_ADDRESS_SPACE_MEMORY) { + barid = 1; + bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_1); + } + lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK; + dprintf(1, "VBE DISPI: bdf %02x:%02x.%x, bar %d\n", pci_bdf_to_bus(bdf) + , pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf), barid); + }
SET_VGA(VBE_framebuffer, lfb_addr); u16 totalmem = dispi_read(VBE_DISPI_INDEX_VIDEO_MEMORY_64K); SET_VGA(VBE_total_memory, totalmem * 64 * 1024); SET_VGA(VBE_capabilities, VBE_CAPABILITY_8BIT_DAC);
- dprintf(1, "VBE DISPI detected. lfb_addr=%x\n", lfb_addr); + dprintf(1, "VBE DISPI: lfb_addr=%x, size %d MB\n", + lfb_addr, totalmem / 16);
return 0; }