diff options
| author | Michael Brown | 2005-04-14 15:44:07 +0200 |
|---|---|---|
| committer | Michael Brown | 2005-04-14 15:44:07 +0200 |
| commit | 104880ca19e230ebbe6a4f46fa17e32ff05324f2 (patch) | |
| tree | d99a776582dfb278218299f88c3ee8fd8203e631 /src/drivers/bus/eisa.c | |
| parent | Separate out bus-scanning and device-probing logic. (diff) | |
| download | ipxe-104880ca19e230ebbe6a4f46fa17e32ff05324f2.tar.gz ipxe-104880ca19e230ebbe6a4f46fa17e32ff05324f2.tar.xz ipxe-104880ca19e230ebbe6a4f46fa17e32ff05324f2.zip | |
Tweak API to allow separation of bus-scanning and device-probing logic.
Diffstat (limited to 'src/drivers/bus/eisa.c')
| -rw-r--r-- | src/drivers/bus/eisa.c | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/src/drivers/bus/eisa.c b/src/drivers/bus/eisa.c index 29d1d83d0..1cd53c9b8 100644 --- a/src/drivers/bus/eisa.c +++ b/src/drivers/bus/eisa.c @@ -48,37 +48,22 @@ static int fill_eisa_device ( struct eisa_device *eisa ) { } /* - * Obtain a struct eisa * from a struct dev * + * Find an EISA device matching the specified driver * - * If dev has not previously been used for an EISA device scan, blank - * out struct eisa */ -struct eisa_device * eisa_device ( struct dev *dev ) { - struct eisa_device *eisa = dev->bus;; +int find_eisa_device ( struct eisa_device *eisa, struct eisa_driver *driver ) { + unsigned int i; + /* Initialise struct eisa if it's the first time it's been used. */ if ( eisa->magic != eisa_magic ) { memset ( eisa, 0, sizeof ( *eisa ) ); eisa->magic = eisa_magic; + eisa->slot = EISA_MIN_SLOT; } - eisa->dev = dev; - return eisa; -} - -/* - * Find an EISA device matching the specified driver - * - */ -int find_eisa_device ( struct eisa_device *eisa, struct eisa_driver *driver ) { - unsigned int i; /* Iterate through all possible EISA slots, starting where we - * left off. If eisa->slot is zero (which it will be if we - * have a zeroed structure), start from slot EISA_MIN_SLOT, - * since slot 0 doesn't exist. + * left off. */ - if ( ! eisa->slot ) { - eisa->slot = EISA_MIN_SLOT; - } for ( ; eisa->slot <= EISA_MAX_SLOT ; eisa->slot++ ) { /* If we've already used this device, skip it */ if ( eisa->already_tried ) { @@ -102,15 +87,7 @@ int find_eisa_device ( struct eisa_device *eisa, struct eisa_driver *driver ) { id->name, driver->name, isa_id_string ( eisa->mfg_id, eisa->prod_id ) ); - if ( eisa->dev ) { - eisa->dev->name = driver->name; - eisa->dev->devid.bus_type - = ISA_BUS_TYPE; - eisa->dev->devid.vendor_id - = eisa->mfg_id; - eisa->dev->devid.device_id - = eisa->prod_id; - } + eisa->name = id->name; eisa->already_tried = 1; return 1; } @@ -123,6 +100,25 @@ int find_eisa_device ( struct eisa_device *eisa, struct eisa_driver *driver ) { } /* + * Find the next EISA device that can be used to boot using the + * specified driver. + * + */ +int find_eisa_boot_device ( struct dev *dev, struct eisa_driver *driver ) { + struct eisa_device *eisa = ( struct eisa_device * )dev->bus; + + if ( ! find_eisa_device ( eisa, driver ) ) + return 0; + + dev->name = eisa->name; + dev->devid.bus_type = ISA_BUS_TYPE; + dev->devid.vendor_id = eisa->mfg_id; + dev->devid.device_id = eisa->prod_id; + + return 1; +} + +/* * Reset and enable an EISA device * */ |
