esiop_pci.c revision 1.2
11.2Sbouyer/* $NetBSD: esiop_pci.c,v 1.2 2002/04/23 20:41:17 bouyer Exp $ */ 21.1Sbouyer 31.1Sbouyer/* 41.1Sbouyer * Copyright (c) 2002 Manuel Bouyer. 51.1Sbouyer * 61.1Sbouyer * Redistribution and use in source and binary forms, with or without 71.1Sbouyer * modification, are permitted provided that the following conditions 81.1Sbouyer * are met: 91.1Sbouyer * 1. Redistributions of source code must retain the above copyright 101.1Sbouyer * notice, this list of conditions and the following disclaimer. 111.1Sbouyer * 2. Redistributions in binary form must reproduce the above copyright 121.1Sbouyer * notice, this list of conditions and the following disclaimer in the 131.1Sbouyer * documentation and/or other materials provided with the distribution. 141.1Sbouyer * 3. All advertising materials mentioning features or use of this software 151.1Sbouyer * must display the following acknowledgement: 161.2Sbouyer * This product includes software developed by Manuel Bouyer. 171.1Sbouyer * 4. The name of the author may not be used to endorse or promote products 181.1Sbouyer * derived from this software without specific prior written permission. 191.1Sbouyer * 201.1Sbouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 211.1Sbouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 221.1Sbouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 231.1Sbouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 241.1Sbouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 251.1Sbouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 261.1Sbouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 271.1Sbouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 281.1Sbouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 291.1Sbouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 301.1Sbouyer */ 311.1Sbouyer 321.1Sbouyer/* SYM53c8xx PCI-SCSI I/O Processors driver: PCI front-end */ 331.1Sbouyer 341.1Sbouyer#include <sys/cdefs.h> 351.2Sbouyer__KERNEL_RCSID(0, "$NetBSD: esiop_pci.c,v 1.2 2002/04/23 20:41:17 bouyer Exp $"); 361.1Sbouyer 371.1Sbouyer#include <sys/param.h> 381.1Sbouyer#include <sys/systm.h> 391.1Sbouyer#include <sys/device.h> 401.1Sbouyer#include <sys/kernel.h> 411.1Sbouyer 421.1Sbouyer#include <dev/pci/pcireg.h> 431.1Sbouyer#include <dev/pci/pcivar.h> 441.1Sbouyer 451.1Sbouyer#include <dev/scsipi/scsipi_all.h> 461.1Sbouyer#include <dev/scsipi/scsipiconf.h> 471.1Sbouyer 481.1Sbouyer#include <dev/ic/siopvar_common.h> 491.1Sbouyer#include <dev/pci/siop_pci_common.h> 501.1Sbouyer#include <dev/ic/esiopvar.h> 511.1Sbouyer 521.1Sbouyerint esiop_pci_match __P((struct device *, struct cfdata *, void *)); 531.1Sbouyervoid esiop_pci_attach __P((struct device *, struct device *, void *)); 541.1Sbouyer 551.1Sbouyerstruct esiop_pci_softc { 561.1Sbouyer struct esiop_softc esiop; 571.1Sbouyer struct siop_pci_common_softc esiop_pci; 581.1Sbouyer}; 591.1Sbouyer 601.1Sbouyerstruct cfattach esiop_pci_ca = { 611.1Sbouyer sizeof(struct esiop_pci_softc), esiop_pci_match, esiop_pci_attach 621.1Sbouyer}; 631.1Sbouyer 641.1Sbouyerint 651.1Sbouyeresiop_pci_match(parent, match, aux) 661.1Sbouyer struct device *parent; 671.1Sbouyer struct cfdata *match; 681.1Sbouyer void *aux; 691.1Sbouyer{ 701.1Sbouyer struct pci_attach_args *pa = aux; 711.1Sbouyer const struct siop_product_desc *pp; 721.1Sbouyer 731.1Sbouyer /* look if it's a known product */ 741.1Sbouyer pp = siop_lookup_product(pa->pa_id, PCI_REVISION(pa->pa_class)); 751.1Sbouyer if (pp == NULL) 761.1Sbouyer return 0; 771.1Sbouyer /* we need 10 scratch registers and load/store */ 781.1Sbouyer if ((pp->features & SF_CHIP_10REGS) == 0) 791.1Sbouyer return 0; 801.1Sbouyer if ((pp->features & SF_CHIP_LS) == 0) 811.1Sbouyer return 0; 821.1Sbouyer return 2; 831.1Sbouyer} 841.1Sbouyer 851.1Sbouyervoid 861.1Sbouyeresiop_pci_attach(parent, self, aux) 871.1Sbouyer struct device *parent, *self; 881.1Sbouyer void *aux; 891.1Sbouyer{ 901.1Sbouyer struct pci_attach_args *pa = aux; 911.1Sbouyer struct esiop_pci_softc *sc = (struct esiop_pci_softc *)self; 921.1Sbouyer 931.1Sbouyer if (siop_pci_attach_common(&sc->esiop_pci, &sc->esiop.sc_c, 941.1Sbouyer pa, esiop_intr) == 0) 951.1Sbouyer return; 961.1Sbouyer 971.1Sbouyer esiop_attach(&sc->esiop); 981.1Sbouyer} 99