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