xref: /openbsd/sys/dev/isa/aic_isapnp.c (revision 121d2812)
1 /*	$OpenBSD: aic_isapnp.c,v 1.1 2002/09/03 16:30:55 mickey Exp $	*/
2 
3 /*
4  * Copyright (c) 2002 Anders Arnholm
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
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.
17  *
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.
29  */
30 
31 /*
32  * Acknowledgements: Many of the algorithms used in this driver are
33  * inspired by the work of Julian Elischer (julian@tfs.com),
34  * Charles Hannum (mycroft@duality.gnu.ai.mit.edu) and Jarle Greipsland.
35  * Thanks a million!
36  */
37 
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/device.h>
41 
42 #include <machine/bus.h>
43 
44 #include <scsi/scsi_all.h>
45 #include <scsi/scsiconf.h>
46 
47 #include <dev/isa/isavar.h>
48 
49 #include <dev/ic/aic6360var.h>
50 
51 int	aic_isapnp_match(struct device *, void *, void *);
52 void	aic_isapnp_attach(struct device *, struct device *, void *);
53 
54 struct cfattach aic_isapnp_ca = {
55 	sizeof(struct aic_softc), aic_isapnp_match, aic_isapnp_attach
56 };
57 
58 /*
59  * INITIALIZATION ROUTINES (match, attach ++)
60  */
61 /*
62  * aic_isapnp_match: isapnp code does the probing for us, and other configured
63  *		     and other configured card are found by aic_isa_match
64  */
65 int
66 aic_isapnp_match(parent, match, aux)
67 	struct device *parent;
68 	void *match, *aux;
69 {
70 	AIC_TRACE(("aic: aic_isapnp_match\n"));
71 	return(1);
72 }
73 
74 /*
75  * Attach the AIC6360, takes the data from isapnp and feads into aicattach.
76  */
77 void
78 aic_isapnp_attach(parent, self, aux)
79 	struct device *parent, *self;
80 	void *aux;
81 {
82 	struct aic_softc *sc = (void *)self;
83 	struct isa_attach_args *ia = aux;
84 
85 	AIC_TRACE(("aic: aic_isapnp_attach\n"));
86 
87 	sc->sc_iot = ia->ia_iot;
88 	sc->sc_ioh = ia->ia_ioh;
89 	sc->sc_irq = ia->ia_irq;
90 	sc->sc_drq = ia->ia_drq;
91 
92 	AIC_TRACE(("aic: aic_isapnp_attach isa_intr_establish(...)\n"));
93 	sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
94 	    IPL_BIO, aicintr, sc, sc->sc_dev.dv_xname);
95 	AIC_TRACE(("aic: aic_isapnp_attach aicattach(0x%08x, 0x%08x, %d, %d)\n",
96 		sc->sc_iot, sc->sc_ioh, sc->sc_irq, sc->sc_drq));
97 	aicattach(sc);
98 }
99