Navigation Menu

Skip to content

Commit

Permalink
[prefix] Add .hrom prefix for a ROM that loads high under PCI3 withou…
Browse files Browse the repository at this point in the history
…t 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>
  • Loading branch information
rwcr authored and Marty Connor committed Jan 14, 2010
1 parent 57faa48 commit 5736f5e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Makefile.housekeeping
Expand Up @@ -830,6 +830,7 @@ endif # defined(BIN)
#
FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
-i$(IDENT) -s 0 $@
FINALISE_hrom = $(FINALISE_rom)

# Some ROMs require specific flags to be passed to makerom.pl
#
Expand Down
2 changes: 2 additions & 0 deletions src/arch/i386/Makefile.pcbios
Expand Up @@ -11,6 +11,7 @@ LDFLAGS += -N --no-check-sections
# Media types.
#
MEDIA += rom
MEDIA += hrom
MEDIA += pxe
MEDIA += kpxe
MEDIA += kkpxe
Expand All @@ -30,6 +31,7 @@ MEDIA += exe
# Padding rules
#
PAD_rom = $(PADIMG) --blksize=512 --byte=0xff $@
PAD_hrom = $(PAD_rom)
PAD_dsk = $(PADIMG) --blksize=512 $@
PAD_hd = $(PADIMG) --blksize=32768 $@

Expand Down
12 changes: 12 additions & 0 deletions src/arch/i386/prefix/hromprefix.S
@@ -0,0 +1,12 @@
/*****************************************************************************
* ROM prefix that relocates to HIGHMEM_LOADPOINT during POST if PMM allocation
* fails. Intended to be used, with caution, on BIOSes that support PCI3.00 but
* have limited PMM support, such as most AMI BIOSes.
*****************************************************************************
*/

FILE_LICENCE ( GPL2_OR_LATER )

#define SHRINK_WITHOUT_PMM

#include "romprefix.S"
13 changes: 13 additions & 0 deletions src/arch/i386/prefix/romprefix.S
Expand Up @@ -351,6 +351,7 @@ got_pmm: /* PMM allocation succeeded */
call print_character
movw %si, %ax
call print_hex_byte
pmm_copy:
/* Copy ROM to PMM block */
xorw %ax, %ax
movw %ax, %es
Expand All @@ -362,7 +363,19 @@ got_pmm: /* PMM allocation succeeded */
movl %edi, decompress_to
/* Shrink ROM */
movb $_prefix_memsz_sect, romheader_size
#ifdef SHRINK_WITHOUT_PMM
jmp pmm_done
pmm_fail:
/* Print marker and copy ourselves to high memory */
movl $HIGHMEM_LOADPOINT, image_source
xorw %di, %di
movb $( '!' ), %al
call print_character
jmp pmm_copy
pmm_done:
#else
pmm_fail:
#endif
/* Restore upper register halves */
popal
no_pmm:
Expand Down

0 comments on commit 5736f5e

Please sign in to comment.