[romprefix] Report a pessimistic runtime size estimate

PCI3.0 allows us to report a "runtime size" which can be smaller than
the actual ROM size.  On systems that support PMM our runtime size
will be small (~2.5kB), which helps to conserve the limited option ROM
space.  However, there is no guarantee that the PMM allocation will
succeed, and so we need to report the worst-case runtime size in the
PCI header.

Move the "shrunk ROM size" field from the PCI header to a new "iPXE
ROM header", allowing it to be accessed by ROM-manipulation utilities
such as disrom.pl.

Reported-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2012-07-23 17:41:38 +01:00
parent ee3636370d
commit 5de45cd3da
4 changed files with 111 additions and 6 deletions

View File

@@ -63,6 +63,8 @@ romheader_size: .byte 0 /* Size in 512-byte blocks */
jmp init /* Initialisation vector */
checksum:
.byte 0
.org 0x10
.word ipxeheader
.org 0x16
.word undiheader
.org 0x18
@@ -78,9 +80,6 @@ checksum:
.long 0
.previous
build_id:
.long _build_id /* Randomly-generated build ID */
pciheader:
.ascii "PCIR" /* Signature */
.word pci_vendor_id /* Vendor identification */
@@ -106,7 +105,7 @@ pciheader_runtime_length:
.long pciheader_image_length
.long 512
.long 0
.ascii "ADHW"
.ascii ZINFO_TYPE_ADxW
.long pciheader_runtime_length
.long 512
.long 0
@@ -175,6 +174,25 @@ undiheader:
.equ undiheader_len, . - undiheader
.size undiheader, . - undiheader
ipxeheader:
.ascii "iPXE" /* Signature */
.byte ipxeheader_len /* Length of structure */
.byte 0 /* Checksum */
shrunk_rom_size:
.byte 0 /* Shrunk size (in 512-byte blocks) */
.byte 0 /* Reserved */
build_id:
.long _build_id /* Randomly-generated build ID */
.equ ipxeheader_len, . - ipxeheader
.size ipxeheader, . - ipxeheader
.section ".zinfo.fixup", "a", @progbits /* Compressor fixups */
.ascii "ADHB"
.long shrunk_rom_size
.long 512
.long 0
.previous
/* Initialisation (called once during POST)
*
* Determine whether or not this is a PnP system via a signature
@@ -354,7 +372,7 @@ pmm_scan:
addr32 rep movsl /* PMM presence implies flat real mode */
popw %es
/* Shrink ROM */
movw pciheader_runtime_length, %ax
movb shrunk_rom_size, %al
movb %al, romheader_size
1: /* Allocate decompression PMM block. Round up the size to the
* nearest 128kB and use the size within the PMM handle; this