aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-07-25 14:32:37 +0100
committerMichael Brown <mcb30@ipxe.org>2012-07-25 14:37:43 +0100
commit1f88e9c8eaef91db510739b451a6837102a87f60 (patch)
treeec541c28718f309a063c2d49c4e78bb92fa20250 /src/arch
parentced1493c021133fe34066a0e430c82ec5a5d40ff (diff)
downloadipxe-1f88e9c8eaef91db510739b451a6837102a87f60.zip
ipxe-1f88e9c8eaef91db510739b451a6837102a87f60.tar.gz
ipxe-1f88e9c8eaef91db510739b451a6837102a87f60.tar.bz2
[romprefix] Round up PMM allocation sizes to nearest 4kB
Some AMI BIOSes apparently break in exciting ways when asked for PMM allocations for sizes that are not multiples of 4kB. Fix by rounding up the image source area to the nearest 4kB. (The temporary decompression area is already rounded up to the nearest 128kB, to facilitate sharing between multiple iPXE ROMs.) Reported-by: Itay Gazit <itayg@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/prefix/romprefix.S6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S
index 2b4c20b..35d037e 100644
--- a/src/arch/i386/prefix/romprefix.S
+++ b/src/arch/i386/prefix/romprefix.S
@@ -352,9 +352,13 @@ pmm_scan:
call print_message
/* We have PMM and so a 1kB stack: preserve whole registers */
pushal
- /* Allocate image source PMM block */
+ /* Allocate image source PMM block. Round up the size to the
+ * nearest 4kB (8 512-byte sectors) to work around AMI BIOS bugs.
+ */
movzbl romheader_size, %ecx
addw extra_size, %cx
+ addw $0x0007, %cx /* Round up to multiple of 8 512-byte sectors */
+ andw $0xfff8, %cx
shll $5, %ecx
movl $PMM_HANDLE_BASE_IMAGE_SOURCE, %ebx
movw $get_pmm_image_source, %bp