aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-06-10 19:01:20 +0100
committerMichael Brown <mcb30@ipxe.org>2012-06-12 15:15:06 +0100
commitb58374fe91a4d599c18f2b99501a54f73850f4de (patch)
tree8494762a283921009475a2a32d729293ec5cdb62 /src/arch
parent9e8d431a0d58caba3c5f65d4e30fd259d2f782e1 (diff)
downloadipxe-b58374fe91a4d599c18f2b99501a54f73850f4de.zip
ipxe-b58374fe91a4d599c18f2b99501a54f73850f4de.tar.gz
ipxe-b58374fe91a4d599c18f2b99501a54f73850f4de.tar.bz2
[romprefix] Allow .mrom image to be placed anywhere within the BAR
A .mrom image currently assumes that it is the first image within the expansion ROM BAR, which may not be correct when multiple images are present. Fix by scanning through the BAR until we locate an image matching our build ID. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/prefix/mromprefix.S12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/arch/i386/prefix/mromprefix.S b/src/arch/i386/prefix/mromprefix.S
index d7b7fc3..abe1c9e 100644
--- a/src/arch/i386/prefix/mromprefix.S
+++ b/src/arch/i386/prefix/mromprefix.S
@@ -154,6 +154,18 @@ find_mem_bar:
movw $PCI_BAR_EXPROM, %di
call pci_write_config_dword
+ /* Locate our ROM image */
+1: addr32 es cmpw $0xaa55, (%eax)
+ stc
+ jne 99f
+ addr32 es cmpl $_build_id, build_id(%eax)
+ je 2f
+ addr32 es movzbl 2(%eax), %ecx
+ shll $9, %ecx
+ addl %ecx, %eax
+ jmp 1b
+2:
+
/* Copy payload to buffer, or set buffer address to BAR address */
testl %esi, %esi
jz 1f