[SeaBIOS] [PATCH] pci: clean all funcs when hot-removing multifunc device

Kevin O'Connor kevin at koconnor.net
Thu Sep 15 03:59:37 CEST 2011


On Wed, Sep 14, 2011 at 07:45:59AM -0400, Amos Kong wrote:
> The size of bios.bin compiled from seabios
> original: 128K
> only apply patch1:  256K
> only apply patch2:  128K
> 
> patch1: add 6 slot(only slot6 has 8 funcs) to the table
> can hotplug/hot-remove a multifunc device to slot 6 successfully
> 
> patch2: add 31 slot(with 8 funcs) to the table
> could not boot up guest.
> I found there is a special process for large bios.bin in qemu,
> problem maybe exist here, I'm driving into it...
> 
> qemu/hw/pc.c:
> void pc_memory_init(...
>     ....
>     /* map the last 128KB of the BIOS in ISA space */
>     isa_bios_size = bios_size;
>     if (isa_bios_size > (128 * 1024))
>         isa_bios_size = 128 * 1024;

This is probably a regression since seabios commit 87b533bf.  Prior to
that commit, seabios did not mark the early 32bit initialization code
as init code.  However, a side effect of marking that code
(handle_post) as init code is that it is more likely the linker could
place the code at an address less than 0xe0000.

I'm guesing the patch below (just a hack) would cover up the issue.

-Kevin


--- a/src/post.c
+++ b/src/post.c
@@ -336,7 +336,7 @@ reloc_init(void)
 // Start of Power On Self Test (POST) - the BIOS initilization phase.
 // This function does the setup needed for code relocation, and then
 // invokes the relocation and main setup code.
-void VISIBLE32INIT
+void VISIBLE32FLAT
 handle_post(void)
 {
     debug_serial_setup();
@@ -356,6 +356,14 @@ handle_post(void)
 
     // Allow writes to modify bios area (0xf0000)
     make_bios_writable();
+
+    void handle_post2(void);
+    handle_post2();
+}
+
+void VISIBLE32INIT
+handle_post2(void)
+{
     HaveRunPost = 1;
 
     // Detect ram and setup internal malloc.



More information about the SeaBIOS mailing list