5 * isa.c implements a "classical" port-scanning method of ISA device
6 * detection. The driver must provide a list of probe addresses
7 * (probe_addrs), together with a function (probe_addr) that can be
8 * used to test for the physical presence of a device at any given
11 * Note that this should probably be considered the "last resort" for
12 * device probing. If the card supports ISAPnP or EISA, use that
13 * instead. Some cards (e.g. the 3c509) implement a proprietary
14 * ISAPnP-like mechanism.
16 * The ISA probe address list can be overridden by config.c; if the
17 * user specifies ISA_PROBE_ADDRS then that list will be used first.
18 * (If ISA_PROBE_ADDRS ends with a zero, the driver's own list will
23 * Ensure that there is sufficient space in the shared dev_bus
24 * structure for a struct isa_device.
27 DEV_BUS( struct isa_device, isa_dev );
28 static char isa_magic[0]; /* guaranteed unique symbol */
31 * Find an ISA device matching the specified driver
34 int find_isa_device ( struct isa_device *isa, struct isa_driver *driver ) {
38 /* Initialise struct isa if it's the first time it's been used. */
39 if ( isa->magic != isa_magic ) {
40 memset ( isa, 0, sizeof ( *isa ) );
41 isa->magic = isa_magic;
44 /* Iterate through any ISA probe addresses specified by
45 * config.c, starting where we left off.
47 DBG ( "ISA searching for device matching driver %s\n", driver->name );
48 for ( i = isa->probe_idx ; i < isa_extra_probe_addr_count ; i++ ) {
49 /* If we've already used this device, skip it */
50 if ( isa->already_tried ) {
51 isa->already_tried = 0;
56 ioaddr = isa_extra_probe_addrs[i];
58 /* An I/O address of 0 in extra_probe_addrs list means
59 * stop probing (i.e. don't continue to the
60 * driver-provided list)
65 /* Use probe_addr method to see if there's a device
66 * present at this address.
68 if ( driver->probe_addr ( ioaddr ) ) {
74 /* Iterate through all ISA probe addresses provided by the
75 * driver, starting where we left off.
77 for ( i = isa->probe_idx - isa_extra_probe_addr_count ;
78 i < driver->addr_count ; i++ ) {
80 /* If we've already used this device, skip it */
81 if ( isa->already_tried ) {
82 isa->already_tried = 0;
87 ioaddr = driver->probe_addrs[i];
89 /* Use probe_addr method to see if there's a device
90 * present at this address.
92 if ( driver->probe_addr ( ioaddr ) ) {
93 isa->probe_idx = i + isa_extra_probe_addr_count;
100 DBG ( "ISA found no device matching driver %s\n", driver->name );
105 DBG ( "ISA found %s device at address %hx\n", driver->name, ioaddr );
106 isa->ioaddr = ioaddr;
107 isa->already_tried = 1;
112 * Find the next ISA device that can be used to boot using the
116 int find_isa_boot_device ( struct dev *dev, struct isa_driver *driver ) {
117 struct isa_device *isa = ( struct isa_device * )dev->bus;
119 if ( ! find_isa_device ( isa, driver ) )
122 dev->name = driver->name;
123 dev->devid.bus_type = ISA_BUS_TYPE;
124 dev->devid.vendor_id = driver->mfg_id;
125 dev->devid.device_id = driver->prod_id;