Browse Source

[prefix] Add .hrom prefix for a ROM that loads high under PCI3 without PMM

gPXE currently takes advantage of the feature of PCI3.0 that allows
option ROMs to relocate the bulk of their code to high memory and so
take up only a small amount of space in the option ROM area. Currently,
the relocation can only take place if the BIOS's implementation of PMM
can be made to return blocks aligned to an even megabyte, because of
the A20 gate. AMI BIOSes, in particular, will not return allocations
that gPXE can use.

Ameliorate the situation somewhat by adding a prefix, .hrom, that works
identically to .rom except in the case that PMM allocation fails. Where
.rom would give up and place itself entirely in option ROM space, .hrom
moves to a block (assumed free) at HIGHMEM_LOADPOINT = 4MB. This allows
for the use of larger gPXE ROMs than would otherwise be possible.

Because there is no way to check that the area at HIGHMEM_LOADPOINT is
really free, other devices using that memory during the boot process
will cause failure for gPXE, the other device, or both. In practice
such conflicts will likely not occur, but this prefix should still be
considered EXPERIMENTAL.

Signed-off-by: Marty Connor <mdc@etherboot.org>
tags/v1.0.0-rc1
Joshua Oreman 14 years ago
parent
commit
5736f5eb32

+ 1
- 0
src/Makefile.housekeeping View File

@@ -830,6 +830,7 @@ endif # defined(BIN)
830 830
 #
831 831
 FINALISE_rom	= $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
832 832
 		  -i$(IDENT) -s 0 $@
833
+FINALISE_hrom	= $(FINALISE_rom)
833 834
 
834 835
 # Some ROMs require specific flags to be passed to makerom.pl
835 836
 #

+ 2
- 0
src/arch/i386/Makefile.pcbios View File

@@ -11,6 +11,7 @@ LDFLAGS		+= -N --no-check-sections
11 11
 # Media types.
12 12
 #
13 13
 MEDIA		+= rom
14
+MEDIA		+= hrom
14 15
 MEDIA		+= pxe
15 16
 MEDIA		+= kpxe
16 17
 MEDIA		+= kkpxe
@@ -30,6 +31,7 @@ MEDIA		+= exe
30 31
 # Padding rules
31 32
 #
32 33
 PAD_rom		= $(PADIMG) --blksize=512 --byte=0xff $@
34
+PAD_hrom	= $(PAD_rom)
33 35
 PAD_dsk		= $(PADIMG) --blksize=512 $@
34 36
 PAD_hd		= $(PADIMG) --blksize=32768 $@
35 37
 

+ 12
- 0
src/arch/i386/prefix/hromprefix.S View File

@@ -0,0 +1,12 @@
1
+/*****************************************************************************
2
+ * ROM prefix that relocates to HIGHMEM_LOADPOINT during POST if PMM allocation
3
+ * fails. Intended to be used, with caution, on BIOSes that support PCI3.00 but
4
+ * have limited PMM support, such as most AMI BIOSes.
5
+ *****************************************************************************
6
+ */
7
+
8
+FILE_LICENCE ( GPL2_OR_LATER )
9
+
10
+#define SHRINK_WITHOUT_PMM
11
+
12
+#include "romprefix.S"

+ 13
- 0
src/arch/i386/prefix/romprefix.S View File

@@ -351,6 +351,7 @@ got_pmm: /* PMM allocation succeeded */
351 351
 	call	print_character
352 352
 	movw	%si, %ax
353 353
 	call	print_hex_byte
354
+pmm_copy:
354 355
 	/* Copy ROM to PMM block */
355 356
 	xorw	%ax, %ax
356 357
 	movw	%ax, %es
@@ -362,7 +363,19 @@ got_pmm: /* PMM allocation succeeded */
362 363
 	movl	%edi, decompress_to
363 364
 	/* Shrink ROM */
364 365
 	movb	$_prefix_memsz_sect, romheader_size
366
+#ifdef SHRINK_WITHOUT_PMM
367
+	jmp	pmm_done
365 368
 pmm_fail:
369
+	/* Print marker and copy ourselves to high memory */
370
+	movl	$HIGHMEM_LOADPOINT, image_source
371
+	xorw	%di, %di
372
+	movb	$( '!' ), %al
373
+	call	print_character
374
+	jmp	pmm_copy
375
+pmm_done:
376
+#else
377
+pmm_fail:
378
+#endif
366 379
 	/* Restore upper register halves */
367 380
 	popal
368 381
 no_pmm:

Loading…
Cancel
Save