Supporting extension ROMs and beyond...

Stefan Reinauer stepan at suse.de
Tue Aug 12 06:19:00 CEST 2003


* ron minnich <rminnich at lanl.gov> [030812 01:21]:
> > I try to move the vgabios to freebios2 for 2880. I put the BIOS option rom
> > to 0xfff8c000, ( the second 48k).
> 
> ah, well, we shouldn't really do that until we resolve the VGA bios 
> question. 
 
It sounds cleaner to work on a seperated version of the legacy emulation
code since no matter what it does, it won't mess up the LinuxBIOS core.

> I did look at our three options today: emulation, ADLO, and VGABIOS. 
> 
> VGABIOS is almost 100% C save for the 32-16 trampoline code. 
> 
> ADLO rombios.c is mostly assembly code with C wrappers around it.
> 
> Emulation is C. 
> 
> Emulation is 256K
> 
> ADLO is 64K. 
> 
> VGABIOS is much less, something like 16K last time I built it.
 
Emulation and ADLO go hand in hand I think. There are 2 different
problems to be addressed:

 1) x86 realmode code execution.
 2) legacy api emulation/implementation (pcibios, etc)

* LinuxBIOS1 on x86 supports 1) directly and does 2 with an emulation
  (pcibios.c)

* ADLO on x86 supports 1) and does 2) using the bochs bios image.
 
* "testbios" from the freebios1 tree (util/vgabios) supports 1) with
  an x86 emulation and 2) with an emulation as well. (int*.c)

Now x86emu comes with some example code doing legacy emulation, either 
in vm86 mode on x86 or with the cpu emulation on non-x86 cpus. This is
how XFree86 does it.

In my opinion writing the legacy emulation code (2) in C certainly makes
sense, since it will run on all platforms by recompiling and it can be
driven by either the realmode idt code (like in linuxbios1) or by an
x86emu, depending on your platform.

OTOH, making an x86emu capable version of ADLO can make the day as well,
running the whole blob of bochs bios in the emulation. This looks
closest to a normal PC, but definitely needs tweaking as well.
Looking at the several thousand lines of bochs bios intermixed assembler
and C code I am not sure whether I would want to touch this at all.
bochs bios has problems in quite some places and a clean 32bit rewrite
of the legacy interface that is enough to interface with vga and scsi
devices is not an overwhelming effort.

Looking at the size I got the x86emu emulation including an incomplete
legacy bios emulation plus userland pci code (testbios) to 
below 150k with -Os, so it would fit in a 256k rom with linuxbios and
etherboot pretty easily. On x86 most of the code can be dropped leaving
probably less than 32k for the legacy emulation.

> The functions that VGABIOS needs to finish up to have as complete support 
> as bringing up graphics as ADLO are not that many in number. Which makes 
> sense: what a VGA BIOS needs to do is diddle its own registers, so most 
> BISO functionality is not that useful for them. 

Still it can be easily enhanced to cope with more hardware if someone
needs this. Even some disk interfacing code to be able to load a kernel
from a scsi device just by using the scsi controller's firmware seems
only little extra work 

> ADLO will not find the option rom on a card and use it; VGABIOS will. 
 
This is probably only a matter of setting the right shadow/ram/rom
mapping configuration?

    Stefan






More information about the coreboot mailing list