Browse Source

[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>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
173c48a57e
1 changed files with 16 additions and 4 deletions
  1. 16
    4
      src/arch/i386/prefix/romprefix.S

+ 16
- 4
src/arch/i386/prefix/romprefix.S View File

123
 	.long	pciheader_image_length
123
 	.long	pciheader_image_length
124
 	.long	512
124
 	.long	512
125
 	.long	0
125
 	.long	0
126
-	.ascii	ZINFO_TYPE_ADxW
126
+	.ascii	"ADHW"
127
 	.long	pciheader_runtime_length
127
 	.long	pciheader_runtime_length
128
 	.long	512
128
 	.long	512
129
 	.long	0
129
 	.long	0
435
 	 * memory.  Will be a no-op for lower PCI versions.
435
 	 * memory.  Will be a no-op for lower PCI versions.
436
 	 */
436
 	 */
437
 .ifeqs	BUSTYPE, "PCIR"
437
 .ifeqs	BUSTYPE, "PCIR"
438
+	/* Get runtime segment address and length */
439
+	movw	%gs, %ax
440
+	movw	%ax, %es
441
+	movzbw	romheader_size, %cx
442
+	/* Print runtime segment address */
438
 	xorw	%di, %di
443
 	xorw	%di, %di
439
 	call	print_space
444
 	call	print_space
440
-	movw	%gs, %ax
441
 	call	print_hex_word
445
 	call	print_hex_word
442
-	movzbw	romheader_size, %cx
446
+	/* Fail if we have insufficient space in final location */
447
+	movw	%cs, %si
448
+	cmpw	%si, %ax
449
+	je	1f
450
+	cmpw	pciheader_runtime_length, %cx
451
+	jbe	1f
452
+	movb	$( '!' ), %al
453
+	call	print_character
454
+	xorw	%cx, %cx
455
+1:	/* Copy to final location */
443
 	shlw	$9, %cx
456
 	shlw	$9, %cx
444
-	movw	%ax, %es
445
 	xorw	%si, %si
457
 	xorw	%si, %si
446
 	xorw	%di, %di
458
 	xorw	%di, %di
447
 	cs rep	movsb
459
 	cs rep	movsb

Loading…
Cancel
Save