Home | History | Annotate | Line # | Download | only in pci
siop_pci.c revision 1.8
      1 /*	$NetBSD: siop_pci.c,v 1.8 2000/05/15 07:53:17 bouyer Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2000 Manuel Bouyer.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by Manuel Bouyer
     17  * 4. The name of the author may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 /* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */
     33 
     34 #include <sys/param.h>
     35 #include <sys/systm.h>
     36 #include <sys/device.h>
     37 #include <sys/kernel.h>
     38 
     39 #include <dev/pci/pcireg.h>
     40 #include <dev/pci/pcivar.h>
     41 
     42 #include <dev/scsipi/scsipi_all.h>
     43 #include <dev/scsipi/scsipiconf.h>
     44 
     45 #include <dev/ic/siopvar.h>
     46 #include <dev/pci/siop_pci_common.h>
     47 
     48 int     siop_pci_match __P((struct device *, struct cfdata *, void *));
     49 void    siop_pci_attach __P((struct device *, struct device *, void *));
     50 
     51 struct cfattach siop_pci_ca = {
     52 	sizeof(struct siop_pci_softc), siop_pci_match, siop_pci_attach
     53 };
     54 
     55 int
     56 siop_pci_match(parent, match, aux)
     57 	struct device *parent;
     58 	struct cfdata *match;
     59 	void *aux;
     60 {
     61 	struct pci_attach_args *pa = aux;
     62 	const struct siop_product_desc *pp;
     63 
     64 	/* look if it's a known product */
     65 	pp = siop_lookup_product(pa->pa_id, PCI_REVISION(pa->pa_class));
     66 	if (pp)
     67 		return 1;
     68 	return 0;
     69 }
     70 
     71 void
     72 siop_pci_attach(parent, self, aux)
     73 	struct device *parent, *self;
     74 	void *aux;
     75 {
     76 	struct pci_attach_args *pa = aux;
     77 	struct siop_pci_softc *sc = (struct siop_pci_softc *)self;
     78 
     79 	if (siop_pci_attach_common(sc, pa) == 0)
     80 		return;
     81 
     82 	siop_attach(&sc->siop);
     83 }
     84