1/*	$NetBSD$	*/
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 *
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.
25 */
26
27/* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */
28
29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD$");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/device.h>
35#include <sys/kernel.h>
36
37#include <dev/pci/pcireg.h>
38#include <dev/pci/pcivar.h>
39
40#include <dev/scsipi/scsipi_all.h>
41#include <dev/scsipi/scsipiconf.h>
42
43#include <dev/ic/siopvar_common.h>
44#include <dev/pci/siop_pci_common.h>
45#include <dev/ic/siopvar.h>
46
47struct siop_pci_softc {
48	struct siop_softc siop;
49	struct siop_pci_common_softc siop_pci;
50};
51
52static int
53siop_pci_match(device_t parent, cfdata_t match, void *aux)
54{
55	struct pci_attach_args *pa = aux;
56	const struct siop_product_desc *pp;
57
58	/* look if it's a known product */
59	pp = siop_lookup_product(pa->pa_id, PCI_REVISION(pa->pa_class));
60	if (pp)
61		return 1;
62	return 0;
63}
64
65static void
66siop_pci_attach(device_t parent, device_t self, void *aux)
67{
68	struct pci_attach_args *pa = aux;
69	struct siop_pci_softc *sc = device_private(self);
70
71	sc->siop.sc_c.sc_dev = self;
72	if (siop_pci_attach_common(&sc->siop_pci, &sc->siop.sc_c,
73	    pa, siop_intr) == 0)
74		return;
75
76	siop_attach(&sc->siop);
77}
78
79CFATTACH_DECL_NEW(siop_pci, sizeof(struct siop_pci_softc),
80    siop_pci_match, siop_pci_attach, NULL, NULL);
81