Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Move some code around in preparation for nca_pcmcia.



details:   https://anonhg.NetBSD.org/src/rev/405471ee7d82
branches:  trunk
changeset: 483773:405471ee7d82
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sat Mar 18 13:05:20 2000 +0000

description:
Move some code around in preparation for nca_pcmcia.

diffstat:

 sys/dev/ic/Makefile       |    5 +-
 sys/dev/ic/ncr53c400reg.h |  101 ++++++++++
 sys/dev/isa/files.isa     |    6 +-
 sys/dev/isa/nca.c         |  451 ----------------------------------------------
 sys/dev/isa/nca_isa.c     |  451 ++++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/isa/nca_isavar.h  |   74 +++++++
 sys/dev/isa/ncareg.h      |  101 ----------
 sys/dev/isa/ncavar.h      |   74 -------
 8 files changed, 632 insertions(+), 631 deletions(-)

diffs (truncated from 1315 to 300 lines):

diff -r 1dcbb9e2b026 -r 405471ee7d82 sys/dev/ic/Makefile
--- a/sys/dev/ic/Makefile       Sat Mar 18 08:07:50 2000 +0000
+++ b/sys/dev/ic/Makefile       Sat Mar 18 13:05:20 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.7 2000/03/15 07:17:06 sommerfeld Exp $
+#      $NetBSD: Makefile,v 1.8 2000/03/18 13:05:20 mycroft Exp $
 
 INCSDIR= /usr/include/dev/ic
 
@@ -14,7 +14,8 @@
        interwavevar.h ispmbox.h ispreg.h ispvar.h lemacreg.h lemacvar.h \
        lptreg.h lptvar.h mb86960reg.h mb86960var.h mc146818reg.h \
        mc68450reg.h mc6845reg.h midwayreg.h midwayvar.h ncr5380reg.h \
-       ncr5380var.h ncr53c9xreg.h ncr53c9xvar.h ne2000reg.h ne2000var.h \
+       ncr5380var.h ncr53c400reg.h ncr53c9xreg.h ncr53c9xvar.h ne2000reg.h \
+       ne2000var.h \
        nec765reg.h ns16450reg.h ns16550reg.h opl3sa3reg.h pcdisplay.h \
        pcdisplayvar.h pckbcvar.h pdqreg.h pdqvar.h rrunnerreg.h rrunnervar.h \
        smc83c170reg.h smc83c170var.h smc90cx6reg.h smc91cxxreg.h \
diff -r 1dcbb9e2b026 -r 405471ee7d82 sys/dev/ic/ncr53c400reg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/ic/ncr53c400reg.h Sat Mar 18 13:05:20 2000 +0000
@@ -0,0 +1,101 @@
+/*     $NetBSD: ncr53c400reg.h,v 1.1 2000/03/18 13:05:21 mycroft Exp $ */
+
+/*-
+ * Copyright (c)  1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by John M. Ruschmeyer.
+ *
+ * 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 the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Definitions for 53C400 SCSI-controller chip.
+ *
+ * Derived from Linux NCR-5380 generic driver sources (by Drew Eckhardt).
+ *
+ * Copyright (C) 1994 Serge Vakulenko (vak%cronyx.ru@localhost)
+ *
+ * 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 DEVELOPERS ``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 DEVELOPERS 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.
+ */
+
+/*
+ * NCR5380 registers
+ */
+#define C80_CSDR       0       /* ro - Current SCSI Data Reg. */
+#define C80_ODR                0       /* wo - Output Data Reg. */
+#define C80_ICR                1       /* rw - Initiator Command Reg. */
+#define C80_MR         2       /* rw - Mode Reg. */
+#define C80_TCR                3       /* rw - Target Command Reg. */
+#define C80_CSBR       4       /* ro - Current SCSI Bus Status Reg. */
+#define C80_SER                4       /* wo - Select Enable Reg. */
+#define C80_BSR                5       /* ro - Bus and Status Reg. */
+#define C80_SDSR       5       /* wo - Start DMA Send Reg. */
+#define C80_IDR                6       /* ro - Input Data Reg. */
+#define C80_SDTR       6       /* wo - Start DMA Target Receive Reg. */
+#define C80_RPIR       7       /* ro - Reset Parity/Interrupt Reg. */
+#define C80_SDIR       7       /* wo - Start DMA Initiator Receive Reg. */
+
+
+#define C400_CSR               0       /* rw - Control and Status Reg. */
+# define C400_CSR_5380_ENABLE          0x80
+# define C400_CSR_TRANSFER_DIRECTION   0x40
+# define C400_CSR_TRANSFER_READY_INTR  0x20
+# define C400_CSR_5380_INTR            0x10
+# define C400_CSR_SHARED_INTR          0x08
+# define C400_CSR_HOST_BUF_NOT_READY   0x04 /* read only */
+# define C400_CSR_SCSI_BUF_READY       0x02 /* read only */
+# define C400_CSR_5380_GATED_IRQ       0x01 /* read only */
+# define C400_CSR_BITS "\20\1irq\2sbrdy\3hbrdy\4shintr\5intr\6tintr\7tdir\10enable"
+
+#define C400_CCR               1       /* rw - Clock Counter Reg. */
+
+#define C400_HBR               4       /* rw - Host Buffer Reg. */
+
+#define C400_5380_REG_OFFSET   8       /* Offset of 5380 registers. */
diff -r 1dcbb9e2b026 -r 405471ee7d82 sys/dev/isa/files.isa
--- a/sys/dev/isa/files.isa     Sat Mar 18 08:07:50 2000 +0000
+++ b/sys/dev/isa/files.isa     Sat Mar 18 13:05:20 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.isa,v 1.97 2000/02/25 02:17:44 groo Exp $
+#      $NetBSD: files.isa,v 1.98 2000/03/18 13:05:22 mycroft Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -220,8 +220,8 @@
 # the probe routine of this "recognizes" the iy. Probe after it.
 # NCR 5380-based boards
 device nca: scsi, ncr5380sbc
-attach nca at isa
-file   dev/isa/nca.c                   nca
+attach nca at isa with nca_isa
+file   dev/isa/nca_isa.c               nca_isa
 
 # AMD am7990 (Lance) -based boards
 # (BICC Isolan, NE2100, DEPCA)
diff -r 1dcbb9e2b026 -r 405471ee7d82 sys/dev/isa/nca.c
--- a/sys/dev/isa/nca.c Sat Mar 18 08:07:50 2000 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +0,0 @@
-/*     $NetBSD: nca.c,v 1.3 1998/11/19 21:53:32 thorpej Exp $  */
-
-/*-
- * Copyright (c)  1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by John M. Ruschmeyer.
- *
- * 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 the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * FreeBSD generic NCR-5380/NCR-53C400 SCSI driver
- *
- * Copyright (C) 1994 Serge Vakulenko (vak%cronyx.ru@localhost)
- *
- * 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 DEVELOPERS ``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 DEVELOPERS 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.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-
-#include <dev/isa/isavar.h>
-#include <dev/isa/isadmavar.h>
-
-#include <dev/ic/ncr5380reg.h>
-#include <dev/ic/ncr5380var.h>
-
-#include <dev/isa/ncareg.h>
-#include <dev/isa/ncavar.h>
-
-int    nca_find __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, struct nca_probe_data*));
-int    nca_match __P((struct device *, struct cfdata *, void *)); 
-void   nca_attach __P((struct device *, struct device *, void *));  
-int    nca_test __P((bus_space_tag_t, bus_space_handle_t, bus_size_t));
-
-struct cfattach nca_ca = {
-       sizeof(struct nca_softc), nca_match, nca_attach
-};
-
-struct scsipi_device nca_dev = {
-       NULL,                   /* Use default error handler */
-       NULL,                   /* have a queue, served by this */
-       NULL,                   /* have no async handler */
-       NULL,                   /* Use default 'done' routine */
-};
-
-
-/* Supported controller types */
-#define MAX_NCA_CONTROLLER     3
-#define CTLR_NCR_5380  1
-#define        CTLR_NCR_53C400 2
-#define CTLR_PAS16     3
-
-#define NCA_ISA_IOSIZE 16
-#define MIN_DMA_LEN 128
-
-/* Options for disconnect/reselect, DMA, and interrupts. */
-#define NCA_NO_DISCONNECT    0xff
-#define NCA_NO_PARITY_CHK  0xff00
-#define NCA_FORCE_POLLING 0x10000
-#define NCA_DISABLE_DMA   0x20000
-
-
-/*
- * Initialization and test function used by nca_find()
- */
-int
-nca_test(iot, ioh, reg_offset)
-       bus_space_tag_t iot;
-       bus_space_handle_t ioh;
-       bus_size_t reg_offset;
-{
-       /* Reset the SCSI bus. */
-       bus_space_write_1(iot, ioh, reg_offset + C80_ICR, SCI_ICMD_RST);
-       bus_space_write_1(iot, ioh, reg_offset + C80_ODR, 0);
-       /* Hold reset for at least 25 microseconds. */
-       delay(500);
-       /* Check that status cleared. */
-       if (bus_space_read_1(iot, ioh, reg_offset + C80_CSBR) != SCI_BUS_RST) {
-#ifdef DEBUG
-               printf("nca_find: reset status not cleared [0x%x]\n",
-                   bus_space_read_1(iot, ioh, reg_offset+C80_CSBR));
-#endif
-               bus_space_write_1(iot, ioh, reg_offset+C80_ICR, 0);
-               return 0;
-       }
-       /* Clear reset. */
-       bus_space_write_1(iot, ioh, reg_offset + C80_ICR, 0);
-       /* Wait a Bus Clear Delay (800 ns + bus free delay 800 ns). */
-       delay(16000);
-
-       /* Read RPI port, resetting parity/interrupt state. */
-       bus_space_read_1(iot, ioh, reg_offset + C80_RPIR);
-
-       /* Test BSR: parity error, interrupt request and busy loss state
-        * should be cleared. */



Home | Main Index | Thread Index | Old Index