mirror of https://github.com/ipxe/ipxe.git
[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>
pull/43/head
parent
dd485992dc
commit
173c48a57e
|
@ -123,7 +123,7 @@ pci_devlist_end:
|
||||||
.long pciheader_image_length
|
.long pciheader_image_length
|
||||||
.long 512
|
.long 512
|
||||||
.long 0
|
.long 0
|
||||||
.ascii ZINFO_TYPE_ADxW
|
.ascii "ADHW"
|
||||||
.long pciheader_runtime_length
|
.long pciheader_runtime_length
|
||||||
.long 512
|
.long 512
|
||||||
.long 0
|
.long 0
|
||||||
|
@ -435,13 +435,25 @@ no_pmm:
|
||||||
* memory. Will be a no-op for lower PCI versions.
|
* memory. Will be a no-op for lower PCI versions.
|
||||||
*/
|
*/
|
||||||
.ifeqs BUSTYPE, "PCIR"
|
.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
|
xorw %di, %di
|
||||||
call print_space
|
call print_space
|
||||||
movw %gs, %ax
|
|
||||||
call print_hex_word
|
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
|
shlw $9, %cx
|
||||||
movw %ax, %es
|
|
||||||
xorw %si, %si
|
xorw %si, %si
|
||||||
xorw %di, %di
|
xorw %di, %di
|
||||||
cs rep movsb
|
cs rep movsb
|
||||||
|
|
Loading…
Reference in New Issue