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