Source-Changes-HG archive

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

[src/thorpej_scsipi]: src/sys/dev Sync w/ trunk.



details:   https://anonhg.NetBSD.org/src/rev/d81a1b2f58a9
branches:  thorpej_scsipi
changeset: 477297:d81a1b2f58a9
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Oct 20 22:31:06 1999 +0000

description:
Sync w/ trunk.

diffstat:

 sys/dev/ic/dpt.c            |   14 +-
 sys/dev/ic/dptreg.h         |   12 +-
 sys/dev/ic/elink3.c         |   73 +++--
 sys/dev/ic/wdc.c            |   30 ++-
 sys/dev/ic/wdcvar.h         |    5 +-
 sys/dev/pci/pccbb.c         |  521 ++++++++++++++++++++++---------------------
 sys/dev/pci/pccbbvar.h      |    3 +-
 sys/dev/pcmcia/aic_pcmcia.c |   51 +--
 sys/dev/pcmcia/mhzc.c       |    8 +-
 sys/dev/pcmcia/wdc_pcmcia.c |   25 +-
 sys/dev/scsipi/atapi_wdc.c  |   35 ++-
 11 files changed, 413 insertions(+), 364 deletions(-)

diffs (truncated from 1605 to 300 lines):

diff -r a0558b66fbe8 -r d81a1b2f58a9 sys/dev/ic/dpt.c
--- a/sys/dev/ic/dpt.c  Wed Oct 20 22:00:55 1999 +0000
+++ b/sys/dev/ic/dpt.c  Wed Oct 20 22:31:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dpt.c,v 1.8.2.6 1999/10/20 20:40:52 thorpej Exp $      */
+/*     $NetBSD: dpt.c,v 1.8.2.7 1999/10/20 22:31:06 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -65,12 +65,11 @@
  * o Test with a bunch of different boards.
  * o dpt_readcfg() should not be using CP_PIO_GETCFG.
  * o An interface to userland applications.
- * o A port of DPT Storage Manager included in the base system would be nice.
  * o Some sysctls or a utility (eg dptctl(8)) to control parameters.
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.8.2.6 1999/10/20 20:40:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.8.2.7 1999/10/20 22:31:06 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -81,6 +80,7 @@
 #include <sys/buf.h>
 
 #include <machine/endian.h>
+#include <machine/bswap.h>
 #include <machine/bus.h>
 
 #include <dev/scsipi/scsi_all.h>
@@ -818,8 +818,6 @@
        bus_dma_tag_t dmat;
        bus_dmamap_t xfer;
 
-       SC_DEBUG(sc_link, SDEV_DB2, ("dpt_scsipi_request\n"));
-
        sc = (void *)chan->chan_adapter->adapt_dev;
        dmat = sc->sc_dmat;
 
@@ -890,16 +888,16 @@
                cp->cp_senseaddr =
                    SWAP32(sc->sc_dmamap_ccb->dm_segs[0].ds_addr +
                    CCB_OFF(sc, ccb) + offsetof(struct dpt_ccb, ccb_sense));
-           
+
                if (xs->datalen) {
                        xfer = ccb->ccb_dmamap_xfer;
-#ifdef TFS
+#ifdef TFS
                        if (flags & XS_CTL_DATA_UIO) {
                                error = bus_dmamap_load_uio(dmat, xfer,
                                    (struct uio *)xs->data,
                                    BUS_DMA_NOWAIT);
                        } else
-#endif /*TFS */
+#endif /* TFS */
                        {
                                error = bus_dmamap_load(dmat, xfer,
                                    xs->data, xs->datalen, NULL,
diff -r a0558b66fbe8 -r d81a1b2f58a9 sys/dev/ic/dptreg.h
--- a/sys/dev/ic/dptreg.h       Wed Oct 20 22:00:55 1999 +0000
+++ b/sys/dev/ic/dptreg.h       Wed Oct 20 22:31:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dptreg.h,v 1.3 1999/10/01 12:08:51 ad Exp $    */
+/*     $NetBSD: dptreg.h,v 1.3.2.1 1999/10/20 22:31:07 thorpej Exp $   */
 
 /*
  * Copyright (c) 1999 Andy Doran <ad%NetBSD.org@localhost>
@@ -39,7 +39,8 @@
 #define        DPT_MAX_XFER            ((DPT_SG_SIZE - 1) << PGSHIFT)
 #define DPT_MAX_CCBS           256
 #define DPT_SG_SIZE            64
-#define DPT_ABORT_TIMEOUT      2000
+#define DPT_ABORT_TIMEOUT      2000    /* milliseconds */
+#define DPT_MORE_TIMEOUT       1000    /* microseconds */
 
 #ifdef _KERNEL
 
@@ -181,8 +182,7 @@
  * contains status, message info and a handle on the initiating CCB. 
  */
 struct eata_sp {
-       u_int8_t        sp_hba_status : 7;      /* host adapter status */
-       u_int8_t        sp_eoc : 1;             /* end of command (unsafe) */
+       u_int8_t        sp_hba_status;          /* host adapter status */
        u_int8_t        sp_scsi_status;         /* SCSI bus status */
        u_int8_t        sp_reserved[2];         /* reserved */
        u_int32_t       sp_inv_residue;         /* bytes not transfered */
@@ -193,7 +193,9 @@
        u_int8_t        sp_messages[9];
 };
 
-/* HBA status as returned by status packet */
+/* 
+ * HBA status as returned by status packet. Bit 7 signals end of command. 
+ */
 #define HA_NO_ERROR             0x00    /* No error on command */
 #define HA_ERROR_SEL_TO         0x01    /* Device selection timeout */
 #define HA_ERROR_CMD_TO         0x02    /* Device command timeout */
diff -r a0558b66fbe8 -r d81a1b2f58a9 sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c       Wed Oct 20 22:00:55 1999 +0000
+++ b/sys/dev/ic/elink3.c       Wed Oct 20 22:31:06 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink3.c,v 1.59 1999/10/11 17:48:20 thorpej Exp $      */
+/*     $NetBSD: elink3.c,v 1.59.2.1 1999/10/20 22:31:53 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -202,11 +202,11 @@
 
 static void eptxstat __P((struct ep_softc *));
 static int epstatus __P((struct ep_softc *));
-void epinit __P((struct ep_softc *));
-int epioctl __P((struct ifnet *, u_long, caddr_t));
-void epstart __P((struct ifnet *));
-void epwatchdog __P((struct ifnet *));
-void epreset __P((struct ep_softc *));
+void   epinit __P((struct ep_softc *));
+int    epioctl __P((struct ifnet *, u_long, caddr_t));
+void   epstart __P((struct ifnet *));
+void   epwatchdog __P((struct ifnet *));
+void   epreset __P((struct ep_softc *));
 static void epshutdown __P((void *));
 void   epread __P((struct ep_softc *));
 struct mbuf *epget __P((struct ep_softc *, int));
@@ -282,7 +282,8 @@
        int i;
 
        for (i = 0; i < 10000; i++) {
-               if ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
+               if ((bus_space_read_2(iot, ioh, ELINK_STATUS) &
+                   S_COMMAND_IN_PROGRESS) == 0)
                        break;
                DELAY(10);
        }
@@ -321,7 +322,8 @@
         * is about right.
         */
        for (i = 0; i < 8000; i++) {
-               if  ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
+               if ((bus_space_read_2(iot, ioh, ELINK_STATUS) &
+                   S_COMMAND_IN_PROGRESS) == 0)
                    return;
        }
 
@@ -378,7 +380,7 @@
         * threshold value was shifted or not.
         */
        bus_space_write_2(iot, ioh, ELINK_COMMAND,
-                         SET_TX_AVAIL_THRESH | ELINK_LARGEWIN_PROBE ); 
+           SET_TX_AVAIL_THRESH | ELINK_LARGEWIN_PROBE); 
        GO_WINDOW(5);
        i = bus_space_read_2(iot, ioh, ELINK_W5_TX_AVAIL_THRESH);
        GO_WINDOW(1);
@@ -494,13 +496,12 @@
        GO_WINDOW(1);           /* Window 1 is operating window */
 
 #if NBPFILTER > 0
-       bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB,
-                 sizeof(struct ether_header));
+       bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
 #endif
 
 #if NRND > 0
        rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
-                         RND_TYPE_NET, 0);
+           RND_TYPE_NET, 0);
 #endif
 
        sc->tx_start_thresh = 20;       /* probably a good starting point. */
@@ -537,7 +538,8 @@
 
        GO_WINDOW(3);
        config0 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG);
-       config1 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2);
+       config1 = (u_int)bus_space_read_2(iot, ioh,
+           ELINK_W3_INTERNAL_CONFIG + 2);
        GO_WINDOW(0);
 
        ram_size  = (config0 & CONFIG_RAMSIZE) >> CONFIG_RAMSIZE_SHIFT;
@@ -644,7 +646,8 @@
        const char *sep = "", *defmedianame = NULL;
 
        GO_WINDOW(3);
-       config1 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2);
+       config1 = (u_int)bus_space_read_2(iot, ioh,
+           ELINK_W3_INTERNAL_CONFIG + 2);
        reset_options = (int)bus_space_read_1(iot, ioh, ELINK_W3_RESET_OPTIONS);
        GO_WINDOW(0);
 
@@ -741,7 +744,8 @@
        if (sc->bustype != ELINK_BUS_PCI) {
                GO_WINDOW(0);
                bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL, 0);
-               bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
+               bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL,
+                   ENABLE_DRQ_IRQ);
        }
 
        if (sc->bustype == ELINK_BUS_PCMCIA) {
@@ -799,10 +803,12 @@
        }
 
        /* Enable interrupts. */
-       bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_RD_0_MASK | S_CARD_FAILURE |
-                               S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
-       bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_INTR_MASK | S_CARD_FAILURE |
-                               S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
+       bus_space_write_2(iot, ioh, ELINK_COMMAND,
+           SET_RD_0_MASK | S_CARD_FAILURE | S_RX_COMPLETE | S_TX_COMPLETE |
+           S_TX_AVAIL);
+       bus_space_write_2(iot, ioh, ELINK_COMMAND,
+           SET_INTR_MASK | S_CARD_FAILURE | S_RX_COMPLETE | S_TX_COMPLETE |
+           S_TX_AVAIL);
 
        /*
         * Attempt to get rid of any stray interrupts that occured during
@@ -846,10 +852,10 @@
        register struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 
        GO_WINDOW(1);           /* Window 1 is operating window */
-       bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_COMMAND, SET_RX_FILTER |
-           FIL_INDIVIDUAL | FIL_BRDCST |
-           ((ifp->if_flags & IFF_MULTICAST) ? FIL_MULTICAST : 0 ) |
-           ((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0 ));
+       bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_COMMAND,
+           SET_RX_FILTER | FIL_INDIVIDUAL | FIL_BRDCST |
+           ((ifp->if_flags & IFF_MULTICAST) ? FIL_MULTICAST : 0) |
+           ((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0));
 }
 
 int
@@ -921,8 +927,8 @@
 
                        resopt = bus_space_read_2(iot, ioh,
                            ELINK_W3_RESET_OPTIONS);
-                       bus_space_write_2(iot, ioh,
-                           ELINK_W3_RESET_OPTIONS, resopt|ELINK_RUNNER_ENABLE_MII);
+                       bus_space_write_2(iot, ioh, ELINK_W3_RESET_OPTIONS,
+                           resopt | ELINK_RUNNER_ENABLE_MII);
                }
 #endif
 
@@ -935,7 +941,8 @@
                config1 |= (ELINKMEDIA_MII << CONFIG_MEDIAMASK_SHIFT);
 
                bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG, config0);
-               bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2, config1);
+               bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2,
+                   config1);
                GO_WINDOW(1);   /* back to operating window */
 
                mii_mediachg(&sc->sc_mii);
@@ -1141,7 +1148,7 @@
                return;
        } else {
                bus_space_write_2(iot, ioh, ELINK_COMMAND,
-                   SET_TX_AVAIL_THRESH | ELINK_THRESH_DISABLE );
+                   SET_TX_AVAIL_THRESH | ELINK_THRESH_DISABLE);
        }
 
        IF_DEQUEUE(&ifp->if_snd, m0);
@@ -1149,7 +1156,7 @@
                return;
 
        bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_TX_START_THRESH |
-           ((len / 4 + sc->tx_start_thresh) /* >> sc->ep_pktlenshift*/) );
+           ((len / 4 + sc->tx_start_thresh) /* >> sc->ep_pktlenshift*/));
 
 #if NBPFILTER > 0
        if (ifp->if_bpf)
@@ -1179,7 +1186,7 @@
        bus_space_write_2(iot, ioh, txreg, len);
        bus_space_write_2(iot, ioh, txreg, 0xffff); /* Second is meaningless */
        if (ELINK_IS_BUS_32(sc->bustype)) {
-               for (m = m0; m; ) {
+               for (m = m0; m;) {
                        if (m->m_len > 3)  {
                                /* align our reads from core */
                                if (mtod(m, u_long) & 3)  {
@@ -1205,7 +1212,7 @@
                        m = m0;
                }
        } else {
-               for (m = m0; m; ) {
+               for (m = m0; m;) {
                        if (m->m_len > 1)  {
                                if (mtod(m, u_long) & 1)  {
                                        bus_space_write_1(iot, ioh,
@@ -1328,8 +1335,8 @@
         * We need to read+write TX_STATUS until we get a 0 status
         * in order to turn off the interrupt flag.
         */
-       while ((i = bus_space_read_1(iot, ioh, ep_w1_reg(sc, ELINK_W1_TX_STATUS)))
-           & TXS_COMPLETE) {
+       while ((i = bus_space_read_1(iot, ioh,
+            ep_w1_reg(sc, ELINK_W1_TX_STATUS))) & TXS_COMPLETE) {
                bus_space_write_1(iot, ioh, ep_w1_reg(sc, ELINK_W1_TX_STATUS),
                    0x0);



Home | Main Index | Thread Index | Old Index