/*
* Copyright (c) 1995, 1996 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* EISA Bus device
*
* Makes sure an EISA bus is present, and finds and attaches devices
* living on it.
*/
/*
* Search for and attach subdevices.
*
* Slot 0 is the "motherboard" slot, and the code attaching
* the EISA bus should have already attached an ISA bus there.
*/
maxnslots = eisa_maxslots(ec);
for (slot = 1; slot < maxnslots; slot++) {
struct eisa_attach_args ea;
u_int slotaddr;
bus_space_handle_t slotioh;
int i;
int locs[EISACF_NLOCS];
/*
* Get a mapping for the whole slot-specific address
* space. If we can't, assume nothing's there but warn
* about it.
*/
if (bus_space_map(iot, slotaddr, EISA_SLOT_SIZE, 0, &slotioh)) {
aprint_error_dev(self,
"can't map I/O space for slot %d\n", slot);
continue;
}
/* Get the vendor ID bytes */
for (i = 0; i < EISA_NVIDREGS; i++)
ea.ea_vid[i] = bus_space_read_1(iot, slotioh,
EISA_SLOTOFF_VID + i);
/* Check for device existence */
if (EISA_VENDID_NODEV(ea.ea_vid)) {
#if 0
printf("no device at %s slot %d\n", device_xname(self),
slot);
printf("\t(0x%x, 0x%x)\n", ea.ea_vid[0], ea.ea_vid[1]);
#endif
bus_space_unmap(iot, slotioh, EISA_SLOT_SIZE);
continue;
}
/* And check that the firmware didn't biff something badly */
if (EISA_VENDID_IDDELAY(ea.ea_vid)) {
printf("%s slot %d not configured by BIOS?\n",
device_xname(self), slot);
bus_space_unmap(iot, slotioh, EISA_SLOT_SIZE);
continue;
}
/* Get the product ID bytes */
for (i = 0; i < EISA_NPIDREGS; i++)
ea.ea_pid[i] = bus_space_read_1(iot, slotioh,
EISA_SLOTOFF_PID + i);
/* Create the ID string from the vendor and product IDs */
ea.ea_idstring[0] = EISA_VENDID_0(ea.ea_vid);
ea.ea_idstring[1] = EISA_VENDID_1(ea.ea_vid);
ea.ea_idstring[2] = EISA_VENDID_2(ea.ea_vid);
ea.ea_idstring[3] = EISA_PRODID_0(ea.ea_pid);
ea.ea_idstring[4] = EISA_PRODID_1(ea.ea_pid);
ea.ea_idstring[5] = EISA_PRODID_2(ea.ea_pid);
ea.ea_idstring[6] = EISA_PRODID_3(ea.ea_pid);
ea.ea_idstring[7] = '\0'; /* sanity */
/* We no longer need the I/O handle; free it. */
bus_space_unmap(iot, slotioh, EISA_SLOT_SIZE);
#ifdef EISAVERBOSE
/*
* Descriptions of known vendors and devices ("products").
*/
struct eisa_knowndev {
int flags;
const char *id, *name;
};
#define EISA_KNOWNDEV_NOPROD 0x01 /* match on vendor only */