Use the device path of the USB device to find a bootorder entry.
return find_prio(desc);
}
+int bootprio_find_usb(int bdf, u64 path)
+{
+ // Find usb - for example: /pci@i0cf8/usb@1,2/hub@1/network@0/ethernet@0
+ int i;
+ char desc[256], *p;
+ p = build_pci_path(desc, sizeof(desc), "usb", bdf);
+ for (i=56; i>0; i-=8) {
+ int port = (path >> i) & 0xff;
+ if (port != 0xff)
+ p += snprintf(p, desc+sizeof(desc)-p, "/hub@%x", port);
+ }
+ snprintf(p, desc+sizeof(desc)-p, "/*@%x", (u32)(path & 0xff));
+ return find_prio(desc);
+}
+
/****************************************************************
* Boot setup
void boot_prep(void);
int bootprio_find_pci_device(int bdf);
int bootprio_find_ata_device(int bdf, int chanid, int slave);
-int bootprio_find_fdc_device(int bfd, int port, int fdid);
+int bootprio_find_fdc_device(int bdf, int port, int fdid);
int bootprio_find_pci_rom(int bdf, int instance);
int bootprio_find_named_rom(const char *name, int instance);
+int bootprio_find_usb(int bdf, u64 path);
#endif // __BOOT_H
{
op->drive_g->blksize = CDROM_SECTOR_SIZE;
op->drive_g->sectors = (u64)-1;
- boot_add_cd(op->drive_g, desc, -1);
+ struct usb_pipe *pipe = container_of(
+ op->drive_g, struct usbdrive_s, drive)->bulkout;
+ int prio = bootprio_find_usb(pipe->cntl->bdf, pipe->path);
+ boot_add_cd(op->drive_g, desc, prio);
return 0;
}
dprintf(1, "USB MSC blksize=%d sectors=%d\n", blksize, sectors);
// Register with bcv system.
- boot_add_hd(op->drive_g, desc, -1);
+ struct usb_pipe *pipe = container_of(
+ op->drive_g, struct usbdrive_s, drive)->bulkout;
+ int prio = bootprio_find_usb(pipe->cntl->bdf, pipe->path);
+ boot_add_hd(op->drive_g, desc, prio);
return 0;
}