[SeaBIOS] Proper support for PCI-based option rom loading (was Re: [Qemu-devel] Re: qdev property bug?)

Anthony Liguori anthony at codemonkey.ws
Tue Dec 15 18:35:51 CET 2009


Avi Kivity wrote:
> On 12/15/2009 04:20 PM, Anthony Liguori wrote:
>> Anthony Liguori wrote:
>>>
>>> The bios gets mapped in 0xe0000 .. 0x100000 so if SeaBIOS fills the 
>>> 0xc0000-0xf0000 space it will write over half of the bios.
>>
>> I'm a little confused by this.  SeaBIOS seems to assume that it only 
>> has to deal with the 0xf0000 .. 0x100000 space as the bios which is 
>> certainly true (i don't think there's anything special about the 
>> 0xe0000 .. 0xf0000 region).
>>
>> I'm not sure why we load the 128K worth of bios instead of just 
>> loading 64K.
>>
>
> bochs bios required all 128kB, so this is probably a leftover.

This is apparently well defined in the PIIX spec.  There is a bit of a 
difference between the lower half and upper half of the BIOS region 
though and I expect this is part of what the problem is.  FYI, the 
following patch works.  Surprisingly, we only need to restore the 
0xe8000..0xe8fff region.  Still trying to understand what's happening.

diff --git a/src/shadow.c b/src/shadow.c
index f0f97c5..860f461 100644
--- a/src/shadow.c
+++ b/src/shadow.c
@@ -29,7 +29,8 @@ __make_bios_writable(u16 bdf)
     int clear = 0;
     int i;
     for (i=0; i<6; i++) {
-        if (CONFIG_OPTIONROMS_DEPLOYED) {
+        /* need to copy 0xe8000 bios region for qemu */
+        if (i==5) {
             int reg = pci_config_readb(bdf, 0x5a + i);
             if ((reg & 0x11) != 0x11) {
                 // Need to copy optionroms to work around qemu 
implementation

Regards,

Anthony Liguori





More information about the SeaBIOS mailing list