]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[bios] Allow pcibios_discover() to return an empty range
authorMichael Brown <mcb30@ipxe.org>
Sun, 18 Sep 2022 12:35:58 +0000 (13:35 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 18 Sep 2022 12:35:58 +0000 (13:35 +0100)
Allow pcibios_discover() to return an empty range if the INT 1A,B101
PCI BIOS installation check call fails.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/interface/pcbios/pcibios.c

index cf818630a92abf71d3fe491aef452186e75d8cb8..6f31ce94374b69ed34ead42aa3a73516df3fd2ea 100644 (file)
@@ -42,7 +42,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 static void pcibios_discover ( uint32_t busdevfn __unused,
                               struct pci_range *range ) {
        int discard_a, discard_D;
-       uint8_t max_bus;
+       uint16_t num_bus;
 
        /* We issue this call using flat real mode, to work around a
         * bug in some HP BIOSes.
@@ -50,10 +50,12 @@ static void pcibios_discover ( uint32_t busdevfn __unused,
        __asm__ __volatile__ ( REAL_CODE ( "call flatten_real_mode\n\t"
                                           "stc\n\t"
                                           "int $0x1a\n\t"
+                                          "movzbw %%cl, %%cx\n\t"
+                                          "incw %%cx\n\t"
                                           "jnc 1f\n\t"
                                           "xorw %%cx, %%cx\n\t"
                                           "\n1:\n\t" )
-                              : "=c" ( max_bus ), "=a" ( discard_a ),
+                              : "=c" ( num_bus ), "=a" ( discard_a ),
                                 "=D" ( discard_D )
                               : "a" ( PCIBIOS_INSTALLATION_CHECK >> 16 ),
                                 "D" ( 0 )
@@ -61,7 +63,7 @@ static void pcibios_discover ( uint32_t busdevfn __unused,
 
        /* Populate range */
        range->start = PCI_BUSDEVFN ( 0, 0, 0, 0 );
-       range->count = PCI_BUSDEVFN ( 0, ( max_bus + 1 ), 0, 0 );
+       range->count = PCI_BUSDEVFN ( 0, num_bus, 0, 0 );
 }
 
 /**