Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / pci / pciide.c
blobf927d2eeafc5c73eb0514d069bd9c15de8171a03
1 /* $NetBSD: pciide.c,v 1.216 2008/03/18 20:46:37 cube Exp $ */
4 /*
5 * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by Christopher G. Demetriou
44 * for the NetBSD Project.
45 * 4. The name of the author may not be used to endorse or promote products
46 * derived from this software without specific prior written permission
48 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
49 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
50 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
51 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
52 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 * PCI IDE controller driver.
63 * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD
64 * sys/dev/pci/ppb.c, revision 1.16).
66 * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" and
67 * "Programming Interface for Bus Master IDE Controller, Revision 1.0
68 * 5/16/94" from the PCI SIG.
72 #include <sys/cdefs.h>
73 __KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.216 2008/03/18 20:46:37 cube Exp $");
75 #include <sys/param.h>
77 #include <dev/pci/pcivar.h>
78 #include <dev/pci/pciidereg.h>
79 #include <dev/pci/pciidevar.h>
81 int pciide_match(device_t, cfdata_t, void *);
82 void pciide_attach(device_t, device_t, void *);
84 CFATTACH_DECL_NEW(pciide, sizeof(struct pciide_softc),
85 pciide_match, pciide_attach, NULL, NULL);
87 int
88 pciide_match(device_t parent, cfdata_t match, void *aux)
90 struct pci_attach_args *pa = aux;
93 * Check the ID register to see that it's a PCI IDE controller.
94 * If it is, we assume that we can deal with it; it _should_
95 * work in a standardized way...
97 if (PCI_CLASS(pa->pa_class) == PCI_CLASS_MASS_STORAGE &&
98 PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_IDE) {
99 return (1);
102 return (0);
105 void
106 pciide_attach(device_t parent, device_t self, void *aux)
108 struct pci_attach_args *pa = aux;
109 struct pciide_softc *sc = device_private(self);
111 sc->sc_wdcdev.sc_atac.atac_dev = self;
113 pciide_common_attach(sc, pa, NULL);