Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / pci / esiop_pci.c
bloba4c5fc1001c4ad5c89869dc62820fec70e1a17ac
1 /* $NetBSD: esiop_pci.c,v 1.16 2009/05/15 17:55:44 tsutsui Exp $ */
3 /*
4 * Copyright (c) 2002 Manuel Bouyer.
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.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 /* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: esiop_pci.c,v 1.16 2009/05/15 17:55:44 tsutsui Exp $");
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/device.h>
35 #include <sys/kernel.h>
37 #include <uvm/uvm_extern.h>
39 #include <dev/pci/pcireg.h>
40 #include <dev/pci/pcivar.h>
42 #include <dev/scsipi/scsipi_all.h>
43 #include <dev/scsipi/scsipiconf.h>
45 #include <dev/ic/siopvar_common.h>
46 #include <dev/pci/siop_pci_common.h>
47 #include <dev/ic/esiopvar.h>
49 struct esiop_pci_softc {
50 struct esiop_softc esiop;
51 struct siop_pci_common_softc esiop_pci;
54 static int
55 esiop_pci_match(device_t parent, cfdata_t match, void *aux)
57 struct pci_attach_args *pa = aux;
58 const struct siop_product_desc *pp;
60 /* look if it's a known product */
61 pp = siop_lookup_product(pa->pa_id, PCI_REVISION(pa->pa_class));
62 if (pp == NULL)
63 return 0;
64 /* we need 10 scratch registers and load/store */
65 if ((pp->features & SF_CHIP_10REGS) == 0)
66 return 0;
67 if ((pp->features & SF_CHIP_LS) == 0)
68 return 0;
69 return 2;
72 static void
73 esiop_pci_attach(device_t parent, device_t self, void *aux)
75 struct pci_attach_args *pa = aux;
76 struct esiop_pci_softc *sc = device_private(self);
78 sc->esiop.sc_c.sc_dev = self;
79 if (siop_pci_attach_common(&sc->esiop_pci, &sc->esiop.sc_c,
80 pa, esiop_intr) == 0)
81 return;
83 esiop_attach(&sc->esiop);
87 CFATTACH_DECL_NEW(esiop_pci, sizeof(struct esiop_pci_softc),
88 esiop_pci_match, esiop_pci_attach, NULL, NULL);