1 /* $OpenBSD: aic_isapnp.c,v 1.3 2022/04/06 18:59:28 naddy 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 const 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(struct device *parent, void *match, void *aux) 67 { 68 AIC_TRACE(("aic: aic_isapnp_match\n")); 69 return(1); 70 } 71 72 /* 73 * Attach the AIC6360, takes the data from isapnp and feads into aicattach. 74 */ 75 void 76 aic_isapnp_attach(struct device *parent, struct device *self, void *aux) 77 { 78 struct aic_softc *sc = (void *)self; 79 struct isa_attach_args *ia = aux; 80 81 AIC_TRACE(("aic: aic_isapnp_attach\n")); 82 83 sc->sc_iot = ia->ia_iot; 84 sc->sc_ioh = ia->ia_ioh; 85 sc->sc_irq = ia->ia_irq; 86 sc->sc_drq = ia->ia_drq; 87 88 AIC_TRACE(("aic: aic_isapnp_attach isa_intr_establish(...)\n")); 89 sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, 90 IPL_BIO, aicintr, sc, sc->sc_dev.dv_xname); 91 AIC_TRACE(("aic: aic_isapnp_attach aicattach(0x%08x, 0x%08x, %d, %d)\n", 92 sc->sc_iot, sc->sc_ioh, sc->sc_irq, sc->sc_drq)); 93 aicattach(sc); 94 } 95