Browse Source

[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>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
b58374fe91
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      src/arch/i386/prefix/mromprefix.S

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

154
 	movw	$PCI_BAR_EXPROM, %di
154
 	movw	$PCI_BAR_EXPROM, %di
155
 	call	pci_write_config_dword
155
 	call	pci_write_config_dword
156
 
156
 
157
+	/* Locate our ROM image */
158
+1:	addr32 es cmpw $0xaa55, (%eax)
159
+	stc
160
+	jne	99f
161
+	addr32 es cmpl $_build_id, build_id(%eax)
162
+	je	2f
163
+	addr32 es movzbl 2(%eax), %ecx
164
+	shll	$9, %ecx
165
+	addl	%ecx, %eax
166
+	jmp	1b
167
+2:
168
+
157
 	/* Copy payload to buffer, or set buffer address to BAR address */
169
 	/* Copy payload to buffer, or set buffer address to BAR address */
158
 	testl	%esi, %esi
170
 	testl	%esi, %esi
159
 	jz	1f
171
 	jz	1f

Loading…
Cancel
Save