3 * [NetBSD for NEC PC98 series]
4 * Copyright (c) 1995, 1996 NetBSD/pc98 porting staff.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
31 #include <dev/isa/bs/bsif.h>
33 static int bs_pisa_probe __P((struct device *, void *, void *));
34 static void bs_pisa_attach __P((struct device *, struct device *, void *));
35 static int bs_deactivate __P((pisa_device_args_t));
36 static int bs_activate __P((pisa_device_args_t));
38 struct cfattach bs_pisa_ca = {
39 sizeof(struct bs_softc), bs_pisa_probe, bs_pisa_attach
42 struct pisa_driver bs_pd = {
43 bs_activate, bs_deactivate,
47 bs_pisa_probe(parent, match, aux)
48 struct device *parent;
51 struct bs_softc *sc = match;
52 struct pisa_attach_args *pa = aux;
53 struct isa_attach_args *ia = &pa->pa_ia;
55 if (ia->ia_iobase == IOBASEUNK ||
56 ia->ia_irq == IRQUNK || ia->ia_drq == DRQUNK)
59 sc->sc_pdv = pa->pa_pdv;
61 return bsprobe(parent, match, ia);
65 bs_pisa_attach(parent, self, aux)
66 struct device *parent, *self;
69 struct bs_softc *sc = (void *) self;
70 struct pisa_attach_args *pa = aux;
72 sc->sc_pdv = PISAMSG_BIND(pa->pa_pdv, sc, &bs_pd);
74 bsattach(parent, self, (void *) &pa->pa_ia);
76 PISA_INTR_REGISTER(sc->sc_pdv, sc->sc_ih);
81 pisa_device_args_t arg;
83 struct bs_softc *bsc = arg->id;
85 bsc->sc_flags |= BSINACTIVE;
86 bshw_dmaabort(bsc, NULL);
88 bs_terminate_timeout(bsc);
93 #define SCSIBUS_RESCAN
97 pisa_device_args_t arg;
99 struct bs_softc *bsc = arg->id;
100 struct isa_attach_args *ia = arg->ia;
101 struct targ_info *ti;
104 bsc->sc_irqmasks = (1 << ia->ia_irq);
106 while((ti = bsc->sc_titab.tqh_first) != NULL)
107 TAILQ_REMOVE(&bsc->sc_titab, ti, ti_tchain);
110 for (i = 0; i < NTARGETS; i ++)
111 if (i != bsc->sc_hostid && (ti = bsc->sc_ti[i]) != NULL)
113 TAILQ_INSERT_TAIL(&bsc->sc_titab, ti, ti_tchain);
114 bsc->sc_openf |= (1 << i);
117 bsc->sc_hstate = BSC_BOOTUP;
118 bsc->sc_flags &= ~BSINACTIVE;
121 #ifdef SCSIBUS_RESCAN
122 if (bsc->sc_nexus == NULL)
123 scsi_probe_busses((int) bsc->sc_link.scsibus, -1, -1);
126 bs_start_timeout(bsc);