Procházet zdrojové kódy

[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 před 13 roky
rodič
revize
38cd351243
1 změnil soubory, kde provedl 20 přidání a 6 odebrání
  1. 20
    6
      src/arch/i386/prefix/romprefix.S

+ 20
- 6
src/arch/i386/prefix/romprefix.S Zobrazit soubor

13
 #define PNP_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'n' << 16 ) + ( 'P' << 24 ) )
13
 #define PNP_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'n' << 16 ) + ( 'P' << 24 ) )
14
 #define PMM_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'M' << 16 ) + ( 'M' << 24 ) )
14
 #define PMM_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'M' << 16 ) + ( 'M' << 24 ) )
15
 #define PCI_SIGNATURE ( 'P' + ( 'C' << 8 ) + ( 'I' << 16 ) + ( ' ' << 24 ) )
15
 #define PCI_SIGNATURE ( 'P' + ( 'C' << 8 ) + ( 'I' << 16 ) + ( ' ' << 24 ) )
16
+#define IBM_SIGNATURE ( ( 'I' << 24 ) + ( 'B' << 16 ) + ( 'M' << 8 ) + ' ' )
16
 #define STACK_MAGIC ( 'L' + ( 'R' << 8 ) + ( 'E' << 16 ) + ( 'T' << 24 ) )
17
 #define STACK_MAGIC ( 'L' + ( 'R' << 8 ) + ( 'E' << 16 ) + ( 'T' << 24 ) )
17
 #define PMM_ALLOCATE 0x0000
18
 #define PMM_ALLOCATE 0x0000
18
 #define PMM_FIND 0x0001
19
 #define PMM_FIND 0x0001
172
 init:
173
 init:
173
 	/* Preserve registers, clear direction flag, set %ds=%cs */
174
 	/* Preserve registers, clear direction flag, set %ds=%cs */
174
 	pushaw
175
 	pushaw
176
+	pushl	%ebx
175
 	pushw	%ds
177
 	pushw	%ds
176
 	pushw	%es
178
 	pushw	%es
177
 	pushw	%fs
179
 	pushw	%fs
180
 	pushw	%cs
182
 	pushw	%cs
181
 	popw	%ds
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
 	 *    %bx (runtime segment address, for PCI 3.0) => %gs
188
 	 *    %bx (runtime segment address, for PCI 3.0) => %gs
189
+	 *    %edi (IBM signature) => %ebx
189
 	 */
190
 	 */
190
 	movw	%bx, %gs
191
 	movw	%bx, %gs
191
-	movw	%di, %bx
192
+	movl	%edi, %ebx
192
 
193
 
193
 	/* Store PCI bus:dev.fn address */
194
 	/* Store PCI bus:dev.fn address */
194
 	movw	%ax, init_pci_busdevfn
195
 	movw	%ax, init_pci_busdevfn
263
 	popl	%edx
264
 	popl	%edx
264
 	popl	%ebx
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
 	 * PnP BIOS signature on entry, some BIOSes fail to do this.
277
 	 * PnP BIOS signature on entry, some BIOSes fail to do this.
268
 	 */
278
 	 */
269
 	movw	$( 0xf000 - 1 ), %bx
279
 	movw	$( 0xf000 - 1 ), %bx
416
 	popw	%fs
426
 	popw	%fs
417
 	popw	%es
427
 	popw	%es
418
 	popw	%ds
428
 	popw	%ds
429
+	popl	%ebx
419
 	popaw
430
 	popaw
420
 
431
 
421
 	/* Indicate boot capability to PnP BIOS, if present */
432
 	/* Indicate boot capability to PnP BIOS, if present */
530
 init_message_pci:
541
 init_message_pci:
531
 	.asciz	" PCI"
542
 	.asciz	" PCI"
532
 	.size	init_message_pci, . - init_message_pci
543
 	.size	init_message_pci, . - init_message_pci
544
+init_message_ibm:
545
+	.asciz	" IBM"
546
+	.size	init_message_ibm, . - init_message_ibm
533
 init_message_pnp:
547
 init_message_pnp:
534
 	.asciz	" PnP"
548
 	.asciz	" PnP"
535
 	.size	init_message_pnp, . - init_message_pnp
549
 	.size	init_message_pnp, . - init_message_pnp

Načítá se…
Zrušit
Uložit