On Tue, Jan 12, 2010 at 9:54 AM, Itay Gazit <itayga...@gmail.com> wrote: > In order to implement what you have suggested, I will need to use NVRAM to > store the PCI device function, right?
No, you do not need NVRAM. When the BIOS calls the gPXE ROM entry point it passes the PCI bus:dev.fn in a register. Right now this register is not stored away anywhere so gPXE "forgets" which device it came from. Storing away the PCI bus:dev.fn is a little bit tricky because the gPXE image is split into .prefix, .text16/.data16, and .text/.data sections. .prefix is the uncompressed startup code which is called by the BIOS. It uncompresses gPXE into memory and passes control to it. Once gPXE proper has started up the .prefix section is abandoned and may be overwritten. .text16/.data16 is for 16-bit code and lives <1 MB in the address space. This section is stored compressed in the gPXE image. .text/.data is for 32-bit code and is loaded at a suitable location >1 MB in the address space. This section is stored compressed in the gPXE image. The .prefix code mostly runs in 16-bit real-mode and is not able to directly access .text/.data. Therefore variables that are accessed by both 16-bit real-mode and 32-bit protected mode code usually live in the .data16 section. The goal here is pass a value from .prefix code all the way through to .text32 code. This can be done by copying the value into a .data16 variable from .prefix code before entering gPXE. The .text code may access .data16 variables. As an example look at arch/i386/prefix/pxeprefix.S:308 where the PXE prefix stores away the PCI bus:dev.fn in the .prefix section. Later, on line 702, the UNDI device structure with the PCI bus:dev.fn is copied to its final destination in the .text16 section. The C code (32-bit .text code) declares the UNDI device structure as follows in arch/i386/drivers/net/undipreload.c: struct undi_device __data16 ( preloaded_undi ); Another thing to watch out for is the source tree structure where all architecture-specific code goes into arch/{i386,x86,x86_64}. The main, portable, part of gPXE in usr/autoboot.c needs to get at the network device in a way is not specific to the .rom prefix or the i386 architecture. Hope this helps, Stefan _______________________________________________ gPXE mailing list gPXE@etherboot.org http://etherboot.org/mailman/listinfo/gpxe