/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Rafal K. Boni.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``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 FOUNDATION OR CONTRIBUTORS
* 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.
*/
/* Local support functions */
static int check_ie_present(struct ie_softc*, bus_space_tag_t,
bus_space_handle_t, bus_size_t);
static int ai_find_mem_size(struct ai_softc*, bus_space_tag_t,
bus_size_t);
switch (why) {
case CHIP_PROBE:
/* Reset to chip to see if it responds */
bus_space_write_1(asc->sc_regt, asc->sc_regh, AI_RESET, 0);
DELAY(100);
break;
case CARD_RESET:
/*
* This takes around 10sec, and we can get
* by quite well w/out it...
*/
break;
}
}
if (ia->ia_nio < 1)
return 0;
if (ia->ia_niomem < 1)
return 0;
if (ia->ia_nirq < 1)
return 0;
if (ISA_DIRECT_CONFIG(ia))
return 0;
/* Punt if wildcarded port, IRQ or memory address */
if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT ||
ia->ia_iomem[0].ir_addr == ISA_UNKNOWN_IOMEM ||
ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ) {
DPRINTF((
"ai_match: wildcarded IRQ, IOAddr, or memAddr, skipping\n"));
return 0;
}
iot = ia->ia_iot;
/*
* This probe is horribly bad, but I have no info on this card other
* than the former driver, and it was just as bad!
*/
if (bus_space_map(iot, ia->ia_io[0].ir_addr,
AI_IOSIZE, 0, &ioh) != 0) {
type = SL_BOARD(val);
if (type != SL10_BOARD && type != EN100_BOARD &&
type != SLFIBER_BOARD) {
DPRINTF(("ai_match: unknown board code 0x%02x @ 0x%x\n",
type, ia->ia_io[0].ir_addr));
goto out;
}
/*
* Fill in just about enough of our local `ai_softc' for
* ai_find_mem_size() to do its job.
*/
memset(&asc, 0, sizeof asc);
asc.sc_regt = iot;
asc.sc_regh = ioh;
/*
* Divine the memory size of this board.
* Better hope there's nothing important hiding just below the card...
*/
static int
ai_find_mem_size(struct ai_softc* asc, bus_space_tag_t memt, bus_size_t maddr)
{
int size;
bus_space_handle_t memh;
struct ie_softc *sc = &asc->sc_ie;
/*
* Check to see if there's an 82586 out there.
*/
static int
check_ie_present(struct ie_softc* sc, bus_space_tag_t memt,
bus_space_handle_t memh, bus_size_t size)
{