/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
* Lule}, Sweden and its contributors.
* 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.
*/
void
xmi_attach(struct xmi_softc *sc)
{
struct xmi_attach_args xa;
int nodenr;
aprint_normal("\n");
xa.xa_iot = sc->sc_iot;
xa.xa_busnr = sc->sc_busnr;
xa.xa_dmat = sc->sc_dmat;
xa.xa_intcpu = sc->sc_intcpu;
/*
* Interrupt numbers. All vectors from 256-512 are free, use
* them for XMI devices and just count them up.
* Above 512 are only interrupt vectors for unibus devices.
*
* The XMI nodespace is giant in size. Only map in the first
* page here and map more (if needed) in the device itself.
*/
for (nodenr = 0; nodenr < NNODEXMI; nodenr++) {
if (bus_space_map(sc->sc_iot, sc->sc_addr + XMI_NODE(nodenr),
PAGE_SIZE, 0, &xa.xa_ioh)) {
aprint_error_dev(sc->sc_dev,
"bus_space_map failed, node %d\n", nodenr);
return;
}
if (badaddr((void *)xa.xa_ioh, 4)) {
bus_space_unmap(sc->sc_iot, xa.xa_ioh, PAGE_SIZE);
continue;
}
xa.xa_nodenr = nodenr;
xa.xa_ivec = 256 + lastiv;
lastiv += 4;
config_found(sc->sc_dev, &xa, xmi_print, CFARGS_NONE);
}
}