esiop_pci.c revision 1.8
11.8Sperry/* $NetBSD: esiop_pci.c,v 1.8 2005/02/27 00:27:32 perry 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.8Sperry * 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.8Sperry__KERNEL_RCSID(0, "$NetBSD: esiop_pci.c,v 1.8 2005/02/27 00:27:32 perry 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.6Sthorpej 421.6Sthorpej#include <uvm/uvm_extern.h> 431.1Sbouyer 441.1Sbouyer#include <dev/pci/pcireg.h> 451.1Sbouyer#include <dev/pci/pcivar.h> 461.1Sbouyer 471.1Sbouyer#include <dev/scsipi/scsipi_all.h> 481.1Sbouyer#include <dev/scsipi/scsipiconf.h> 491.1Sbouyer 501.1Sbouyer#include <dev/ic/siopvar_common.h> 511.1Sbouyer#include <dev/pci/siop_pci_common.h> 521.1Sbouyer#include <dev/ic/esiopvar.h> 531.1Sbouyer 541.7Sperryint esiop_pci_match(struct device *, struct cfdata *, void *); 551.7Sperryvoid esiop_pci_attach(struct device *, struct device *, void *); 561.1Sbouyer 571.1Sbouyerstruct esiop_pci_softc { 581.1Sbouyer struct esiop_softc esiop; 591.1Sbouyer struct siop_pci_common_softc esiop_pci; 601.1Sbouyer}; 611.1Sbouyer 621.4SthorpejCFATTACH_DECL(esiop_pci, sizeof(struct esiop_pci_softc), 631.5Sthorpej esiop_pci_match, esiop_pci_attach, NULL, NULL); 641.1Sbouyer 651.1Sbouyerint 661.1Sbouyeresiop_pci_match(parent, match, aux) 671.1Sbouyer struct device *parent; 681.1Sbouyer struct cfdata *match; 691.1Sbouyer void *aux; 701.1Sbouyer{ 711.1Sbouyer struct pci_attach_args *pa = aux; 721.1Sbouyer const struct siop_product_desc *pp; 731.1Sbouyer 741.1Sbouyer /* look if it's a known product */ 751.1Sbouyer pp = siop_lookup_product(pa->pa_id, PCI_REVISION(pa->pa_class)); 761.1Sbouyer if (pp == NULL) 771.1Sbouyer return 0; 781.1Sbouyer /* we need 10 scratch registers and load/store */ 791.1Sbouyer if ((pp->features & SF_CHIP_10REGS) == 0) 801.1Sbouyer return 0; 811.1Sbouyer if ((pp->features & SF_CHIP_LS) == 0) 821.1Sbouyer return 0; 831.1Sbouyer return 2; 841.1Sbouyer} 851.1Sbouyer 861.1Sbouyervoid 871.1Sbouyeresiop_pci_attach(parent, self, aux) 881.1Sbouyer struct device *parent, *self; 891.1Sbouyer void *aux; 901.1Sbouyer{ 911.1Sbouyer struct pci_attach_args *pa = aux; 921.1Sbouyer struct esiop_pci_softc *sc = (struct esiop_pci_softc *)self; 931.1Sbouyer 941.1Sbouyer if (siop_pci_attach_common(&sc->esiop_pci, &sc->esiop.sc_c, 951.1Sbouyer pa, esiop_intr) == 0) 961.1Sbouyer return; 971.1Sbouyer 981.1Sbouyer esiop_attach(&sc->esiop); 991.1Sbouyer} 100