]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[romprefix] Report failure cause when unable to open payload
authorMichael Brown <mcb30@ipxe.org>
Tue, 30 Apr 2013 13:31:39 +0000 (14:31 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 30 Apr 2013 13:56:19 +0000 (14:56 +0100)
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>
src/arch/i386/prefix/mromprefix.S

index 058663c4018f7edfcc25c58afd6211570285a181..0f0847e5fde8627afd493f5e928d16c77ec2531e 100644 (file)
@@ -98,6 +98,7 @@ find_mem_bar:
        cmpw    $PCI_BAR_5, %di
        jle     1f
        stc
+       movl    $0xbabababa, %esi       /* Report "No suitable BAR" */
        jmp     99f
 1:     movw    $4, %bp
 
@@ -157,15 +158,17 @@ find_mem_bar:
 
        /* Locate our ROM image */
 1:     addr32 es cmpw $0xaa55, (%eax)
-       stc
-       jne     99f
-       addr32 es cmpl $_build_id, build_id(%eax)
        je      2f
+       stc
+       movl    %eax, %esi              /* Report failure address */
+       jmp     99f
+2:     addr32 es cmpl $_build_id, build_id(%eax)
+       je      3f
        addr32 es movzbl 2(%eax), %ecx
        shll    $9, %ecx
        addl    %ecx, %eax
        jmp     1b
-2:
+3:
 
        /* Copy payload to buffer, or set buffer address to BAR address */
        testl   %esi, %esi