Browse Source

[autoboot] Match against parent devices when matching by bus type and location

When using iPXE as an option ROM for a PCI USB controller (e.g. via
qemu's "-device nec-usb-xhci,romfile=..." syntax), the ROM prefix will
set the PCI bus:dev.fn address of the USB controller as the PCI
autoboot device.  This will cause iPXE to fail to boot from any
detected USB network devices, since they will not match the autoboot
bus type (or location).

Fix by allowing the autoboot bus type and location to match against
the network device or any of its parent devices.  This allows the
match to succeed for USB network devices attached to the selected PCI
USB controller.

Reported-by: Dan Ellis <Dan.Ellis@displaylink.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
75d6fec6c4
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/usr/autoboot.c

+ 7
- 2
src/usr/autoboot.c View File

@@ -439,9 +439,14 @@ int netboot ( struct net_device *netdev ) {
439 439
  * @ret is_autoboot	Network device matches the autoboot device
440 440
  */
441 441
 static int is_autoboot_busloc ( struct net_device *netdev ) {
442
+	struct device *dev;
442 443
 
443
-	return ( ( netdev->dev->desc.bus_type == autoboot_desc.bus_type ) &&
444
-		 ( netdev->dev->desc.location == autoboot_desc.location ) );
444
+	for ( dev = netdev->dev ; dev ; dev = dev->parent ) {
445
+		if ( ( dev->desc.bus_type == autoboot_desc.bus_type ) &&
446
+		     ( dev->desc.location == autoboot_desc.location ) )
447
+			return 1;
448
+	}
449
+	return 0;
445 450
 }
446 451
 
447 452
 /**

Loading…
Cancel
Save