Module Name: src Committed By: jakllsch Date: Thu Apr 1 04:04:11 UTC 2010
Modified Files: src/share/man/man4: nca.4 pci.4 src/sys/arch/i386/conf: ALL src/sys/dev/pci: files.pci Added Files: src/sys/dev/pci: nca_pci.c Log Message: Add support for Domex 536 PCI SCSI controller to nca(4). This truly remarkable chip is found on the Domex DMX-3191D SCSI adapter. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/nca.4 cvs rdiff -u -r1.91 -r1.92 src/share/man/man4/pci.4 cvs rdiff -u -r1.251 -r1.252 src/sys/arch/i386/conf/ALL cvs rdiff -u -r1.327 -r1.328 src/sys/dev/pci/files.pci cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/nca_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man4/nca.4 diff -u src/share/man/man4/nca.4:1.5 src/share/man/man4/nca.4:1.6 --- src/share/man/man4/nca.4:1.5 Wed Apr 30 13:10:54 2008 +++ src/share/man/man4/nca.4 Thu Apr 1 04:04:11 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: nca.4,v 1.5 2008/04/30 13:10:54 martin Exp $ +.\" $NetBSD: nca.4,v 1.6 2010/04/01 04:04:11 jakllsch Exp $ .\" .\" Copyright (c) 2000 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -24,7 +24,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 18, 2000 +.Dd April 1, 2010 .Dt NCA 4 .Os .Sh NAME @@ -33,6 +33,7 @@ .Sh SYNOPSIS .Cd "nca0 at isa? port 0x360 irq 15 # Port-mapped NCR 53C80 controller" .Cd "nca1 at isa? iomem 0xd8000 irq 5 # Memory-mapped controller (T128...)" +.Cd "nca* at pci? dev ? function ? # Domex 536 (DMX-3191D)" .Cd "scsibus* at nca?" .Sh DESCRIPTION The @@ -40,6 +41,7 @@ driver provides support for the NCR-5380/NCR-53C400 SCSI controllers. .Sh SEE ALSO .Xr isa 4 , +.Xr pci 4 , .Xr scsi 4 .Sh HISTORY The @@ -47,3 +49,5 @@ driver appeared in .Nx 1.4 . +Domex 536 support appeared in +.Nx 6.0 . Index: src/share/man/man4/pci.4 diff -u src/share/man/man4/pci.4:1.91 src/share/man/man4/pci.4:1.92 --- src/share/man/man4/pci.4:1.91 Sun Jan 4 16:38:58 2009 +++ src/share/man/man4/pci.4 Thu Apr 1 04:04:11 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: pci.4,v 1.91 2009/01/04 16:38:58 christos Exp $ +.\" $NetBSD: pci.4,v 1.92 2010/04/01 04:04:11 jakllsch Exp $ .\" .\" Copyright (c) 1997 Jason R. Thorpe. All rights reserved. .\" Copyright (c) 1997 Jonathan Stone @@ -29,7 +29,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 3, 2009 +.Dd April 1, 2010 .Dt PCI 4 .Os .Sh NAME @@ -173,6 +173,10 @@ LSI Logic \*[Am] Dell MegaRAID SAS RAID controllers. .It mly Mylex AcceleRAID and eXtremeRAID controllers with v6 firmware. +.It nca +Domex 536 +.Tn SCSI +interfaces. .It pcscp Advanced Micro Devices Am53c974 PCscsi-PCI .Tn SCSI @@ -473,6 +477,7 @@ .Xr mly 4 , .Xr mpt 4 , .Xr msk 4 , +.Xr nca 4 , .Xr ne 4 , .Xr neo 4 , .Xr nfe 4 , Index: src/sys/arch/i386/conf/ALL diff -u src/sys/arch/i386/conf/ALL:1.251 src/sys/arch/i386/conf/ALL:1.252 --- src/sys/arch/i386/conf/ALL:1.251 Sat Mar 27 03:04:51 2010 +++ src/sys/arch/i386/conf/ALL Thu Apr 1 04:04:11 2010 @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.251 2010/03/27 03:04:51 nonaka Exp $ +# $NetBSD: ALL,v 1.252 2010/04/01 04:04:11 jakllsch Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.251 $" +#ident "ALL-$Revision: 1.252 $" maxusers 64 # estimated number of users @@ -764,6 +764,7 @@ mfi* at pci? dev ? function ? # LSI MegaRAID SAS mly* at pci? dev ? function ? # Mylex AcceleRAID and eXtremeRAID mpt* at pci? dev ? function ? # LSI Fusion SCSI/FC +nca* at pci? dev ? function ? # Domex DMX-3191D njs* at pci? dev ? function ? # Workbit NinjaSCSI-32 pcscp* at pci? dev ? function ? # AMD 53c974 PCscsi-PCI SCSI siop* at pci? dev ? function ? # Symbios 53c8xx SCSI Index: src/sys/dev/pci/files.pci diff -u src/sys/dev/pci/files.pci:1.327 src/sys/dev/pci/files.pci:1.328 --- src/sys/dev/pci/files.pci:1.327 Sun Mar 21 21:11:13 2010 +++ src/sys/dev/pci/files.pci Thu Apr 1 04:04:11 2010 @@ -1,4 +1,4 @@ -# $NetBSD: files.pci,v 1.327 2010/03/21 21:11:13 jklos Exp $ +# $NetBSD: files.pci,v 1.328 2010/04/01 04:04:11 jakllsch Exp $ # # Config file and device description for machine-independent PCI code. # Included by ports that need it. Requires that the SCSI files be @@ -1005,3 +1005,7 @@ attach wcfb at pci file dev/pci/wcfb.c wcfb defflag opt_wcfb.h WCFB_DEBUG + +# Domex 536, 5380-compatible SCSI HBA +attach nca at pci with nca_pci +file dev/pci/nca_pci.c nca_pci Added files: Index: src/sys/dev/pci/nca_pci.c diff -u /dev/null src/sys/dev/pci/nca_pci.c:1.1 --- /dev/null Thu Apr 1 04:04:11 2010 +++ src/sys/dev/pci/nca_pci.c Thu Apr 1 04:04:11 2010 @@ -0,0 +1,128 @@ +/* $NetBSD: nca_pci.c,v 1.1 2010/04/01 04:04:11 jakllsch Exp $ */ + +/* + * Copyright (c) 2010 Jonathan A. Kollasch + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT HOLDER OR + * CONTRIBUTORS 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 attachment for 5380-compatible Domex 536 SCSI controller, + * found on Domex DMX-3191D. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: nca_pci.c,v 1.1 2010/04/01 04:04:11 jakllsch Exp $"); + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/device.h> +#include <sys/buf.h> + +#include <sys/bus.h> + +#include <dev/pci/pcireg.h> +#include <dev/pci/pcivar.h> +#include <dev/pci/pcidevs.h> + +#include <dev/scsipi/scsi_all.h> +#include <dev/scsipi/scsipi_all.h> +#include <dev/scsipi/scsiconf.h> + +#include <dev/ic/ncr5380reg.h> +#include <dev/ic/ncr5380var.h> + +static int nca_pci_match(device_t, cfdata_t, void *); +static void nca_pci_attach(device_t, device_t, void *); + +CFATTACH_DECL_NEW(nca_pci, sizeof(struct ncr5380_softc), + nca_pci_match, nca_pci_attach, NULL, NULL); + +static int +nca_pci_match(device_t parent, cfdata_t match, void *aux) +{ + struct pci_attach_args *pa = aux; + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DOMEX && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DOMEX_PCISCSI) + return 1; + return 0; +} + +static void +nca_pci_attach(device_t parent, device_t self, void *aux) +{ + struct ncr5380_softc *sc = device_private(self); + struct pci_attach_args *pa = aux; + char devinfo[128]; + + sc->sc_dev = self; + + pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); + aprint_naive(": SCSI controller\n"); + aprint_normal(": %s (rev 0x%02x)\n", devinfo, + PCI_REVISION(pa->pa_class)); + + if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_IO, 0, + &sc->sc_regt, &sc->sc_regh, NULL, NULL)) { + aprint_error_dev(self, "could not map IO space\n"); + return; + } + + /* The Domex 536 seems to be driven by polling, + * don't bother mapping an interrupt handler. + */ + + sc->sc_rev = NCR_VARIANT_CXD1180; + sc->sci_r0 = 0; + sc->sci_r1 = 1; + sc->sci_r2 = 2; + sc->sci_r3 = 3; + sc->sci_r4 = 4; + sc->sci_r5 = 5; + sc->sci_r6 = 6; + sc->sci_r7 = 7; + + sc->sc_pio_out = ncr5380_pio_out; + sc->sc_pio_in = ncr5380_pio_in; + sc->sc_dma_alloc = NULL; + sc->sc_dma_free = NULL; + sc->sc_dma_setup = NULL; + sc->sc_dma_start = NULL; + sc->sc_dma_poll = NULL; + sc->sc_dma_eop = NULL; + sc->sc_dma_stop = NULL; + sc->sc_intr_on = NULL; + sc->sc_intr_off = NULL; + + sc->sc_flags |= NCR5380_FORCE_POLLING; + + sc->sc_min_dma_len = 0; + + sc->sc_adapter.adapt_request = ncr5380_scsipi_request; + sc->sc_adapter.adapt_minphys = minphys; + + sc->sc_channel.chan_id = 7; + + ncr5380_attach(sc); +}