Push use of 'struct pci_device' to bootprio_find_usb().
authorKevin O'Connor <kevin@koconnor.net>
Sat, 9 Jul 2011 18:31:50 +0000 (14:31 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 10 Jul 2011 19:36:04 +0000 (15:36 -0400)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/boot.c
src/boot.h
src/usb-msc.c

index fcc95ab2e20dc743f10afa1ae80d339d6a060d04..58fb70b590ee3f0968fb97d57eb23373b8772fb9 100644 (file)
@@ -193,14 +193,14 @@ int bootprio_find_named_rom(const char *name, int instance)
     return find_prio(desc);
 }
 
-int bootprio_find_usb(int bdf, u64 path)
+int bootprio_find_usb(struct pci_device *pci, u64 path)
 {
     if (!CONFIG_BOOTORDER)
         return -1;
     // 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", find_pci(bdf));
+    p = build_pci_path(desc, sizeof(desc), "usb", pci);
     for (i=56; i>0; i-=8) {
         int port = (path >> i) & 0xff;
         if (port != 0xff)
index a6f358fd0fb647bf5f3c3cc09bf9b59cf65cf1df..649500277219dc92f0ab20097298e918026c8752 100644 (file)
@@ -12,11 +12,12 @@ void boot_add_hd(struct drive_s *drive_g, const char *desc, int prio);
 void boot_add_cd(struct drive_s *drive_g, const char *desc, int prio);
 void boot_add_cbfs(void *data, const char *desc, int prio);
 void boot_prep(void);
+struct pci_device;
 int bootprio_find_pci_device(int bdf);
 int bootprio_find_ata_device(int bdf, int chanid, int slave);
 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);
+int bootprio_find_usb(struct pci_device *pci, u64 path);
 
 #endif // __BOOT_H
index a57e4d2c35c50584411c41c8a20b04690e472565..13ef93e930db4c5b1ec7a38890b97da3d32e0527 100644 (file)
@@ -12,7 +12,6 @@
 #include "blockcmd.h" // cdb_read
 #include "disk.h" // DTYPE_USB
 #include "boot.h" // boot_add_hd
-#include "pci.h" // struct pci_device
 
 struct usbdrive_s {
     struct drive_s drive;
@@ -146,7 +145,7 @@ setup_drive_cdrom(struct disk_op_s *op, char *desc)
     op->drive_g->sectors = (u64)-1;
     struct usb_pipe *pipe = container_of(
         op->drive_g, struct usbdrive_s, drive)->bulkout;
-    int prio = bootprio_find_usb(pipe->cntl->pci->bdf, pipe->path);
+    int prio = bootprio_find_usb(pipe->cntl->pci, pipe->path);
     boot_add_cd(op->drive_g, desc, prio);
     return 0;
 }
@@ -174,7 +173,7 @@ setup_drive_hd(struct disk_op_s *op, char *desc)
     // Register with bcv system.
     struct usb_pipe *pipe = container_of(
         op->drive_g, struct usbdrive_s, drive)->bulkout;
-    int prio = bootprio_find_usb(pipe->cntl->pci->bdf, pipe->path);
+    int prio = bootprio_find_usb(pipe->cntl->pci, pipe->path);
     boot_add_hd(op->drive_g, desc, prio);
 
     return 0;