Source-Changes-HG archive

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

[src/trunk]: src/sys Add a "sc_rev" member to ncr5380_softc and handle CXD118...



details:   https://anonhg.NetBSD.org/src/rev/f282c3c4bab4
branches:  trunk
changeset: 484097:f282c3c4bab4
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Mar 25 15:27:54 2000 +0000

description:
Add a "sc_rev" member to ncr5380_softc and handle CXD1180 quirk
in MI ncr5380sbc.

diffstat:

 sys/arch/arm32/podulebus/csa.c      |     4 +-
 sys/arch/arm32/podulebus/oak.c      |     6 +-
 sys/arch/mac68k/obio/sbc_obio.c     |     4 +-
 sys/arch/news68k/conf/files.news68k |     7 +-
 sys/arch/news68k/dev/ncr5380sbc.c   |  2667 -----------------------------------
 sys/arch/news68k/dev/si.c           |     4 +-
 sys/arch/pc532/dev/ncr.c            |     4 +-
 sys/arch/sparc/dev/si.c             |     4 +-
 sys/arch/sun3/dev/si.c              |     4 +-
 sys/arch/sun3/dev/si_sebuf.c        |     4 +-
 sys/arch/vax/vsa/ncr.c              |     4 +-
 sys/dev/ic/ncr5380sbc.c             |    30 +-
 sys/dev/ic/ncr5380var.h             |     8 +-
 sys/dev/isa/nca_isa.c               |     5 +-
 sys/dev/pcmcia/nca_pcmcia.c         |     4 +-
 15 files changed, 64 insertions(+), 2695 deletions(-)

diffs (truncated from 3000 to 300 lines):

diff -r 712fc03dae3f -r f282c3c4bab4 sys/arch/arm32/podulebus/csa.c
--- a/sys/arch/arm32/podulebus/csa.c    Sat Mar 25 15:12:04 2000 +0000
+++ b/sys/arch/arm32/podulebus/csa.c    Sat Mar 25 15:27:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: csa.c,v 1.6 2000/03/18 16:16:12 mycroft Exp $  */
+/*     $NetBSD: csa.c,v 1.7 2000/03/25 15:27:54 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -170,6 +170,8 @@
        sc->sc_ncr5380.sci_r6 = iobase + 24;
        sc->sc_ncr5380.sci_r7 = iobase + 28;
 
+       sc->sc_ncr5380.sc_rev = NCR_VARIANT_NCR5380;
+
        sc->sc_ctrl = (u_char *)pa->pa_podule->slow_base + CSA_CTRL_OFFSET;
        sc->sc_status = (u_char *)pa->pa_podule->slow_base + CSA_STAT_OFFSET;
        sc->sc_data = (u_char *)pa->pa_podule->slow_base + CSA_DATA_OFFSET;
diff -r 712fc03dae3f -r f282c3c4bab4 sys/arch/arm32/podulebus/oak.c
--- a/sys/arch/arm32/podulebus/oak.c    Sat Mar 25 15:12:04 2000 +0000
+++ b/sys/arch/arm32/podulebus/oak.c    Sat Mar 25 15:27:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oak.c,v 1.17 2000/03/18 16:13:22 mycroft Exp $ */
+/*     $NetBSD: oak.c,v 1.18 2000/03/25 15:27:54 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -146,7 +146,9 @@
        sc->sc_ncr5380.sci_r5 = iobase + 20;
        sc->sc_ncr5380.sci_r6 = iobase + 24;
        sc->sc_ncr5380.sci_r7 = iobase + 28;
-       
+
+       sc->sc_ncr5380.sc_rev = NCR_VARIANT_NCR5380;
+
        sc->sc_ncr5380.sc_pio_in = ncr5380_pio_in;
        sc->sc_ncr5380.sc_pio_out = ncr5380_pio_out;
 
diff -r 712fc03dae3f -r f282c3c4bab4 sys/arch/mac68k/obio/sbc_obio.c
--- a/sys/arch/mac68k/obio/sbc_obio.c   Sat Mar 25 15:12:04 2000 +0000
+++ b/sys/arch/mac68k/obio/sbc_obio.c   Sat Mar 25 15:27:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbc_obio.c,v 1.12 2000/03/18 16:14:57 mycroft Exp $    */
+/*     $NetBSD: sbc_obio.c,v 1.13 2000/03/25 15:27:55 tsutsui Exp $    */
 
 /*
  * Copyright (C) 1996,1997 Scott Reynolds.  All rights reserved.
@@ -171,6 +171,8 @@
        ncr_sc->sci_r6 = &sc->sc_regs->sci_pr6.sci_reg;
        ncr_sc->sci_r7 = &sc->sc_regs->sci_pr7.sci_reg;
 
+       ncr_sc->sc_rev = NCR_VARIANT_NCR5380;
+
        /*
         * MD function pointers used by the MI code.
         */
diff -r 712fc03dae3f -r f282c3c4bab4 sys/arch/news68k/conf/files.news68k
--- a/sys/arch/news68k/conf/files.news68k       Sat Mar 25 15:12:04 2000 +0000
+++ b/sys/arch/news68k/conf/files.news68k       Sat Mar 25 15:27:54 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.news68k,v 1.4 2000/03/15 17:08:40 soren Exp $
+#      $NetBSD: files.news68k,v 1.5 2000/03/25 15:27:55 tsutsui Exp $
 
 #      NEWS68K-specific configuration info
 
@@ -112,11 +112,8 @@
 major { st = 17 }
 
 # Sony CXD1180 SCSI controller
-# XXX should use MI driver...
-#device si: scsi, ncr5380sbc
-device si: scsi
+device si: scsi, ncr5380sbc
 file arch/news68k/dev/si.c                     si needs-flag
-file arch/news68k/dev/ncr5380sbc.c             si
 attach si at hb
 
 # memory disk
diff -r 712fc03dae3f -r f282c3c4bab4 sys/arch/news68k/dev/ncr5380sbc.c
--- a/sys/arch/news68k/dev/ncr5380sbc.c Sat Mar 25 15:12:04 2000 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,2667 +0,0 @@
-/*     $NetBSD: ncr5380sbc.c,v 1.3 2000/03/23 06:41:56 thorpej Exp $   */
-
-/*
- * Copyright (c) 1995 David Jones, Gordon W. Ross
- * Copyright (c) 1994 Jarle Greipsland
- * 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. The name of the authors may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by
- *      David Jones and Gordon Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
- */
-
-/*
- * This is a machine-independent driver for the NCR5380
- * SCSI Bus Controller (SBC), also known as the Am5380.
- *
- * This code should work with any memory-mapped 5380,
- * and can be shared by multiple adapters that address
- * the 5380 with different register offset spacings.
- * (This can happen on the atari, for example.)
- * For porting/design info. see: ncr5380.doc
- *
- * Credits, history:
- *
- * David Jones is the author of most of the code that now
- * appears in this file, and was the architect of the
- * current overall structure (MI/MD code separation, etc.)
- *
- * Gordon Ross integrated the message phase code, added lots of
- * comments about what happens when and why (re. SCSI spec.),
- * debugged some reentrance problems, and added several new
- * "hooks" needed for the Sun3 "si" adapters.
- *
- * The message in/out code was taken nearly verbatim from
- * the aic6360 driver by Jarle Greipsland.
- *
- * Several other NCR5380 drivers were used for reference
- * while developing this driver, including work by:
- *   The Alice Group (mac68k port) namely:
- *       Allen K. Briggs, Chris P. Caputo, Michael L. Finch,
- *       Bradley A. Grantham, and Lawrence A. Kesteloot
- *   Michael L. Hitch (amiga drivers: sci.c)
- *   Leo Weppelman (atari driver: ncr5380.c)
- * There are others too.  Thanks, everyone.
- *
- * Transliteration to bus_space() performed 9/17/98 by
- * John Ruschmeyer (jruschme%exit109.com@localhost) for i386 'nca' driver.
- * Thank you all.
- */
-
-#include "opt_ddb.h"
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsipi_debug.h>
-#include <dev/scsipi/scsi_message.h>
-#include <dev/scsipi/scsiconf.h>
-
-#ifdef DDB
-#include <ddb/db_output.h>
-#endif
-
-#include <dev/ic/ncr5380reg.h>
-#include <dev/ic/ncr5380var.h>
-
-static void    ncr5380_reset_scsibus __P((struct ncr5380_softc *));
-static void    ncr5380_sched __P((struct ncr5380_softc *));
-static void    ncr5380_done __P((struct ncr5380_softc *));
-
-static int     ncr5380_select
-       __P((struct ncr5380_softc *, struct sci_req *));
-static void    ncr5380_reselect __P((struct ncr5380_softc *));
-
-static int     ncr5380_msg_in __P((struct ncr5380_softc *));
-static int     ncr5380_msg_out __P((struct ncr5380_softc *));
-static int     ncr5380_data_xfer __P((struct ncr5380_softc *, int));
-static int     ncr5380_command __P((struct ncr5380_softc *));
-static int     ncr5380_status __P((struct ncr5380_softc *));
-static void    ncr5380_machine __P((struct ncr5380_softc *));
-
-void   ncr5380_abort __P((struct ncr5380_softc *));
-void   ncr5380_cmd_timeout __P((void *));
-/*
- * Action flags returned by the info_tranfer functions:
- * (These determine what happens next.)
- */
-#define ACT_CONTINUE   0x00    /* No flags: expect another phase */
-#define ACT_DISCONNECT 0x01    /* Target is disconnecting */
-#define ACT_CMD_DONE   0x02    /* Need to call scsipi_done() */
-#define ACT_RESET_BUS  0x04    /* Need bus reset (cmd timeout) */
-#define ACT_WAIT_DMA   0x10    /* Wait for DMA to complete */
-
-/*****************************************************************
- * Debugging stuff
- *****************************************************************/
-
-#ifndef DDB
-/* This is used only in recoverable places. */
-#define Debugger() printf("Debug: ncr5380.c:%d\n", __LINE__)
-#endif
-
-#ifdef NCR5380_DEBUG
-
-#define        NCR_DBG_BREAK   1
-#define        NCR_DBG_CMDS    2
-int ncr5380_debug = 0;
-#define        NCR_BREAK() \
-       do { if (ncr5380_debug & NCR_DBG_BREAK) Debugger(); } while (0)
-static void ncr5380_show_scsi_cmd __P((struct scsipi_xfer *));
-static void ncr5380_show_sense __P((struct scsipi_xfer *));
-#ifdef DDB
-void   ncr5380_clear_trace __P((void));
-void   ncr5380_show_trace __P((void));
-void   ncr5380_show_req __P((struct sci_req *));
-void   ncr5380_show_state __P((void));
-#endif /* DDB */
-#else  /* NCR5380_DEBUG */
-
-#define        NCR_BREAK()             /* nada */
-#define ncr5380_show_scsi_cmd(xs) /* nada */
-#define ncr5380_show_sense(xs) /* nada */
-
-#endif /* NCR5380_DEBUG */
-
-static char *
-phase_names[8] = {
-       "DATA_OUT",
-       "DATA_IN",
-       "COMMAND",
-       "STATUS",
-       "UNSPEC1",
-       "UNSPEC2",
-       "MSG_OUT",
-       "MSG_IN",
-};
-
-/*****************************************************************
- * Actual chip control
- *****************************************************************/
-
-/*
- * XXX: These timeouts might need to be tuned...
- */
-
-/* This one is used when waiting for a phase change. (X100uS.) */
-int ncr5380_wait_phase_timo = 1000 * 10 * 300; /* 5 min. */
-
-/* These are used in the following inline functions. */
-int ncr5380_wait_req_timo = 1000 * 50; /* X2 = 100 mS. */
-int ncr5380_wait_nrq_timo = 1000 * 25; /* X2 =  50 mS. */
-
-static __inline int ncr5380_wait_req __P((struct ncr5380_softc *));
-static __inline int ncr5380_wait_not_req __P((struct ncr5380_softc *));
-static __inline void ncr_sched_msgout __P((struct ncr5380_softc *, int));
-
-/* Return zero on success. */
-static __inline int ncr5380_wait_req(sc)
-       struct ncr5380_softc *sc;
-{
-       register int timo = ncr5380_wait_req_timo;
-       for (;;) {
-               if (NCR5380_READ(sc, sci_bus_csr) & SCI_BUS_REQ) {
-                       timo = 0;       /* return 0 */
-                       break;
-               }
-               if (--timo < 0)
-                       break;  /* return -1 */
-               delay(2);
-       }
-       return (timo);
-}
-
-/* Return zero on success. */
-static __inline int ncr5380_wait_not_req(sc)
-       struct ncr5380_softc *sc;
-{
-       register int timo = ncr5380_wait_nrq_timo;
-       for (;;) {
-               if ((NCR5380_READ(sc, sci_bus_csr) & SCI_BUS_REQ) == 0) {
-                       timo = 0;       /* return 0 */
-                       break;
-               }
-               if (--timo < 0)
-                       break;  /* return -1 */
-               delay(2);
-       }



Home | Main Index | Thread Index | Old Index