Browse Source

[romprefix] Report failure cause when unable to open payload

Report the cause of the failure when we are unable to open the .mrom
payload.  There are two possible failure cases:

 - Unable to find a suitable memory BAR to borrow (e.g. if the NIC
   doesn't have a memory BAR that is at least as large as the
   expansion ROM BAR, or if the memory BAR has been assigned a 64-bit
   address which won't fit into the 32-bit expansion ROM BAR).  This
   will be reported as "BABABABA".

 - Unable to find correct ROM image within the BAR.  This will be
   reported as the address (within the borrowed BAR) at which we first
   fail to find a valid 55AA signature.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
c6375a85be
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      src/arch/i386/prefix/mromprefix.S

+ 7
- 4
src/arch/i386/prefix/mromprefix.S View File

98
 	cmpw	$PCI_BAR_5, %di
98
 	cmpw	$PCI_BAR_5, %di
99
 	jle	1f
99
 	jle	1f
100
 	stc
100
 	stc
101
+	movl	$0xbabababa, %esi	/* Report "No suitable BAR" */
101
 	jmp	99f
102
 	jmp	99f
102
 1:	movw	$4, %bp
103
 1:	movw	$4, %bp
103
 
104
 
157
 
158
 
158
 	/* Locate our ROM image */
159
 	/* Locate our ROM image */
159
 1:	addr32 es cmpw $0xaa55, (%eax)
160
 1:	addr32 es cmpw $0xaa55, (%eax)
160
-	stc
161
-	jne	99f
162
-	addr32 es cmpl $_build_id, build_id(%eax)
163
 	je	2f
161
 	je	2f
162
+	stc
163
+	movl	%eax, %esi		/* Report failure address */
164
+	jmp	99f
165
+2:	addr32 es cmpl $_build_id, build_id(%eax)
166
+	je	3f
164
 	addr32 es movzbl 2(%eax), %ecx
167
 	addr32 es movzbl 2(%eax), %ecx
165
 	shll	$9, %ecx
168
 	shll	$9, %ecx
166
 	addl	%ecx, %eax
169
 	addl	%ecx, %eax
167
 	jmp	1b
170
 	jmp	1b
168
-2:
171
+3:
169
 
172
 
170
 	/* Copy payload to buffer, or set buffer address to BAR address */
173
 	/* Copy payload to buffer, or set buffer address to BAR address */
171
 	testl	%esi, %esi
174
 	testl	%esi, %esi

Loading…
Cancel
Save