summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2016-01-06 00:40:18 +0100
committerMichael Brown2016-01-06 01:30:23 +0100
commit173c48a57e43b747ab8ace1e5a59bfdb2132ddee (patch)
tree26e8dbb870fc3125803cbe68eb6fcd0a2d728b86 /src
parent[vmware] Expose GuestRPC mechanism in 64-bit builds (diff)
downloadipxe-173c48a57e43b747ab8ace1e5a59bfdb2132ddee.tar.gz
ipxe-173c48a57e43b747ab8ace1e5a59bfdb2132ddee.tar.xz
ipxe-173c48a57e43b747ab8ace1e5a59bfdb2132ddee.zip
[romprefix] Report an optimistic runtime size estimate
Commit 5de45cd ("[romprefix] Report a pessimistic runtime size estimate") set the PCI3.0 "runtime size" field equal to the worst-case runtime size, on the basis that there is no guarantee that PMM allocation will succeed and hence no guarantee that we will be able to shrink the ROM image. On a PCI3.0 system where PMM allocation would succeed, this can cause the BIOS to unnecessarily refuse to initialise the iPXE ROM due to a perceived shortage of option ROM space. Fix by reporting the best-case runtime size via the PCI header, and checking that we have sufficient runtime space (if applicable). This allows iPXE ROMs to initialise on PCI3.0 systems that might otherwise fail due to a shortage of option ROM space. This may cause iPXE ROMs to fail to initialise on PCI3.0 systems where PMM is broken. (Pre-PCI3.0 systems are unaffected since there must already have been sufficient option ROM space available for the initialisation entry point to be called.) On balance, it seems preferable to avoid breaking "good" systems (PCI3.0 with working PMM) at the cost of potentially breaking "bad" systems (PCI3.0 with broken PMM). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/prefix/romprefix.S20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S
index 18dda2b3..8974c539 100644
--- a/src/arch/i386/prefix/romprefix.S
+++ b/src/arch/i386/prefix/romprefix.S
@@ -123,7 +123,7 @@ pci_devlist_end:
.long pciheader_image_length
.long 512
.long 0
- .ascii ZINFO_TYPE_ADxW
+ .ascii "ADHW"
.long pciheader_runtime_length
.long 512
.long 0
@@ -435,13 +435,25 @@ no_pmm:
* memory. Will be a no-op for lower PCI versions.
*/
.ifeqs BUSTYPE, "PCIR"
+ /* Get runtime segment address and length */
+ movw %gs, %ax
+ movw %ax, %es
+ movzbw romheader_size, %cx
+ /* Print runtime segment address */
xorw %di, %di
call print_space
- movw %gs, %ax
call print_hex_word
- movzbw romheader_size, %cx
+ /* Fail if we have insufficient space in final location */
+ movw %cs, %si
+ cmpw %si, %ax
+ je 1f
+ cmpw pciheader_runtime_length, %cx
+ jbe 1f
+ movb $( '!' ), %al
+ call print_character
+ xorw %cx, %cx
+1: /* Copy to final location */
shlw $9, %cx
- movw %ax, %es
xorw %si, %si
xorw %di, %di
cs rep movsb