diff options
| author | Michael Brown | 2005-04-14 15:33:03 +0200 |
|---|---|---|
| committer | Michael Brown | 2005-04-14 15:33:03 +0200 |
| commit | ce8dea0dffea9076879bb0d38510c1f5f790820c (patch) | |
| tree | 27985a7005db6b1a3b39f7fde4538e5790b537c9 /src/include | |
| parent | Split 3c509.c into 3c509.9 and 3c529.c, with shared code in 3c5x9.c. (diff) | |
| download | ipxe-ce8dea0dffea9076879bb0d38510c1f5f790820c.tar.gz ipxe-ce8dea0dffea9076879bb0d38510c1f5f790820c.tar.xz ipxe-ce8dea0dffea9076879bb0d38510c1f5f790820c.zip | |
Separate out bus-scanning and device-probing logic.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/dev.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/include/dev.h b/src/include/dev.h index 73a4ca65e..9ade0e1fe 100644 --- a/src/include/dev.h +++ b/src/include/dev.h @@ -23,11 +23,12 @@ struct dev { struct dev_operations *dev_op; const char *name; struct dev_id devid; /* device ID string (sent to DHCP server) */ + struct boot_driver *driver; /* driver being used for boot */ /* Pointer to bus information for device. Whatever sets up * the struct dev must make sure that this points to a buffer * large enough for the required struct <bus>_device. */ - void *bus; + struct bus_device *bus; /* All possible device types */ union { struct nic nic; @@ -49,20 +50,33 @@ struct dev_operations { int ( *load ) ( struct dev * ); }; +/* + * Table to describe a bootable device driver. See comments in dev.c + * for an explanation. + * + */ +struct bus_device {}; +struct bus_driver {}; struct boot_driver { char *name; - int (*probe) ( struct dev * ); + struct bus_device * ( *find_bus_boot_device ) ( struct dev *dev, + struct bus_driver *driver ); + struct bus_driver *bus_driver; + int ( *probe ) ( struct dev *dev, struct bus_device *bus_device ); }; -#define BOOT_DRIVER( driver_name, probe_func ) \ +#define BOOT_DRIVER( _name, _find_bus_boot_device, _bus_driver, _probe ) \ static struct boot_driver boot_driver_ ## probe_func \ __attribute__ ((used,__section__(".boot_drivers"))) = { \ - .name = driver_name, \ - .probe = probe_func, \ + .name = _name, \ + .find_bus_boot_device = ( void * ) _find_bus_boot_device, \ + .bus_driver = ( void * ) _bus_driver, \ + .probe = ( void * ) _probe, \ }; /* Functions in dev.c */ extern void print_drivers ( void ); +extern int find_boot_device ( struct dev *dev ); extern int probe ( struct dev *dev ); extern void disable ( struct dev *dev ); static inline void print_info ( struct dev *dev ) { |
