2005-02-27 03:26:58 +03:00
|
|
|
/* $NetBSD: pciide.c,v 1.212 2005/02/27 00:27:33 perry Exp $ */
|
1999-08-29 21:20:10 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2001-05-04 19:25:05 +04:00
|
|
|
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
|
1999-08-29 21:20:10 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
2002-04-24 00:41:13 +04:00
|
|
|
* This product includes software developed by Manuel Bouyer.
|
2003-10-05 21:48:49 +04:00
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
1999-08-29 21:20:10 +04:00
|
|
|
*
|
2000-05-15 12:46:00 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
2005-02-27 03:26:58 +03:00
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
2000-05-15 12:46:00 +04:00
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1999-08-29 21:20:10 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1998-03-04 09:35:11 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Christopher G. Demetriou
|
|
|
|
* for the NetBSD Project.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PCI IDE controller driver.
|
|
|
|
*
|
|
|
|
* Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD
|
|
|
|
* sys/dev/pci/ppb.c, revision 1.16).
|
|
|
|
*
|
1998-03-04 22:18:22 +03:00
|
|
|
* See "PCI IDE Controller Specification, Revision 1.0 3/4/94" and
|
|
|
|
* "Programming Interface for Bus Master IDE Controller, Revision 1.0
|
|
|
|
* 5/16/94" from the PCI SIG.
|
1998-03-04 09:35:11 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2001-11-13 10:48:40 +03:00
|
|
|
#include <sys/cdefs.h>
|
2005-02-27 03:26:58 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.212 2005/02/27 00:27:33 perry Exp $");
|
2001-11-13 10:48:40 +03:00
|
|
|
|
1998-03-04 09:35:11 +03:00
|
|
|
#include <sys/param.h>
|
2000-11-14 21:42:55 +03:00
|
|
|
|
1998-03-04 09:35:11 +03:00
|
|
|
#include <dev/pci/pcivar.h>
|
|
|
|
#include <dev/pci/pciidereg.h>
|
|
|
|
#include <dev/pci/pciidevar.h>
|
1998-10-22 19:11:39 +04:00
|
|
|
|
2005-02-04 05:10:35 +03:00
|
|
|
int pciide_match(struct device *, struct cfdata *, void *);
|
|
|
|
void pciide_attach(struct device *, struct device *, void *);
|
1998-03-04 09:35:11 +03:00
|
|
|
|
2002-10-01 00:37:04 +04:00
|
|
|
CFATTACH_DECL(pciide, sizeof(struct pciide_softc),
|
2002-10-02 20:51:16 +04:00
|
|
|
pciide_match, pciide_attach, NULL, NULL);
|
2002-10-01 00:37:04 +04:00
|
|
|
|
1998-03-04 09:35:11 +03:00
|
|
|
int
|
|
|
|
pciide_match(parent, match, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *match;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct pci_attach_args *pa = aux;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check the ID register to see that it's a PCI IDE controller.
|
|
|
|
* If it is, we assume that we can deal with it; it _should_
|
|
|
|
* work in a standardized way...
|
|
|
|
*/
|
|
|
|
if (PCI_CLASS(pa->pa_class) == PCI_CLASS_MASS_STORAGE &&
|
|
|
|
PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_IDE) {
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pciide_attach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
struct pci_attach_args *pa = aux;
|
|
|
|
struct pciide_softc *sc = (struct pciide_softc *)self;
|
2001-10-21 22:55:14 +04:00
|
|
|
|
2004-09-18 03:04:02 +04:00
|
|
|
pciide_common_attach(sc, pa, NULL);
|
2003-03-18 04:13:08 +03:00
|
|
|
}
|