From 5de45cd3da2308a6db37fb7c0822c9fdadf00d96 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 23 Jul 2012 17:41:38 +0100 Subject: [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 Signed-off-by: Michael Brown --- src/arch/i386/prefix/romprefix.S | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/arch') diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S index 2719a70aa..2b4c20b8e 100644 --- a/src/arch/i386/prefix/romprefix.S +++ b/src/arch/i386/prefix/romprefix.S @@ -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 -- cgit v1.2.3-55-g7522