Quellcode durchsuchen

[romprefix] Attempt to gracefully handle semi-PnP IBM BIOSes

Some IBM BIOSes provide partial support for PnP: they will use the BEV
entry point but will not advertise PnP support.  This causes iPXE to
hook INT 19, which disrupts the boot process.

Attempt to improve this situation by detecting an IBM BIOS and
treating it as a PnP BIOS despite the absence of a PnP signature.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown vor 13 Jahren
Ursprung
Commit
38cd351243
1 geänderte Dateien mit 20 neuen und 6 gelöschten Zeilen
  1. 20
    6
      src/arch/i386/prefix/romprefix.S

+ 20
- 6
src/arch/i386/prefix/romprefix.S Datei anzeigen

@@ -13,6 +13,7 @@ FILE_LICENCE ( GPL2_OR_LATER )
13 13
 #define PNP_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'n' << 16 ) + ( 'P' << 24 ) )
14 14
 #define PMM_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'M' << 16 ) + ( 'M' << 24 ) )
15 15
 #define PCI_SIGNATURE ( 'P' + ( 'C' << 8 ) + ( 'I' << 16 ) + ( ' ' << 24 ) )
16
+#define IBM_SIGNATURE ( ( 'I' << 24 ) + ( 'B' << 16 ) + ( 'M' << 8 ) + ' ' )
16 17
 #define STACK_MAGIC ( 'L' + ( 'R' << 8 ) + ( 'E' << 16 ) + ( 'T' << 24 ) )
17 18
 #define PMM_ALLOCATE 0x0000
18 19
 #define PMM_FIND 0x0001
@@ -172,6 +173,7 @@ undiheader:
172 173
 init:
173 174
 	/* Preserve registers, clear direction flag, set %ds=%cs */
174 175
 	pushaw
176
+	pushl	%ebx
175 177
 	pushw	%ds
176 178
 	pushw	%es
177 179
 	pushw	%fs
@@ -180,15 +182,14 @@ init:
180 182
 	pushw	%cs
181 183
 	popw	%ds
182 184
 
183
-	/* Shuffle some registers around.  We need %di available for
184
-	 * the print_xxx functions, and in a register that's
185
-	 * addressable from %es, so shuffle as follows:
185
+	/* Shuffle some registers around.  We need to use %di for the
186
+	 * print_xxx functions, so shuffle as follows:
186 187
 	 *
187
-	 *    %di (pointer to PnP structure) => %bx
188 188
 	 *    %bx (runtime segment address, for PCI 3.0) => %gs
189
+	 *    %edi (IBM signature) => %ebx
189 190
 	 */
190 191
 	movw	%bx, %gs
191
-	movw	%di, %bx
192
+	movl	%edi, %ebx
192 193
 
193 194
 	/* Store PCI bus:dev.fn address */
194 195
 	movw	%ax, init_pci_busdevfn
@@ -263,7 +264,16 @@ no_pci3:
263 264
 	popl	%edx
264 265
 	popl	%ebx
265 266
 
266
-	/* Check for PnP BIOS.  Although %es:di should point to the
267
+	/* Check for IBM BIOS, which uses the PnP entry points but
268
+	 * doesn't indicate PnP support.
269
+	 */
270
+	cmpl	$IBM_SIGNATURE, %ebx
271
+	jne	no_ibm
272
+	movw	$init_message_ibm, %si
273
+	xorw	%di, %di
274
+	call	print_message
275
+	jmp	pnp_done
276
+no_ibm:	/* Check for PnP BIOS.  Although %es:di should point to the
267 277
 	 * PnP BIOS signature on entry, some BIOSes fail to do this.
268 278
 	 */
269 279
 	movw	$( 0xf000 - 1 ), %bx
@@ -416,6 +426,7 @@ no_pmm:
416 426
 	popw	%fs
417 427
 	popw	%es
418 428
 	popw	%ds
429
+	popl	%ebx
419 430
 	popaw
420 431
 
421 432
 	/* Indicate boot capability to PnP BIOS, if present */
@@ -530,6 +541,9 @@ init_message:
530 541
 init_message_pci:
531 542
 	.asciz	" PCI"
532 543
 	.size	init_message_pci, . - init_message_pci
544
+init_message_ibm:
545
+	.asciz	" IBM"
546
+	.size	init_message_ibm, . - init_message_ibm
533 547
 init_message_pnp:
534 548
 	.asciz	" PnP"
535 549
 	.size	init_message_pnp, . - init_message_pnp

Laden…
Abbrechen
Speichern