Source-Changes-HG archive

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

[src/thorpej_scsipi]: src/sys/dev/i2o Sync w/current.



details:   https://anonhg.NetBSD.org/src/rev/521c86686b4b
branches:  thorpej_scsipi
changeset: 477448:521c86686b4b
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Apr 01 15:03:42 2001 +0000

description:
Sync w/current.

diffstat:

 sys/dev/i2o/TODO       |   4 +-
 sys/dev/i2o/i2o.h      |  86 +++++++++++++++++++++++++++++++++++++++++++++++++-
 sys/dev/i2o/iop.c      |  48 ++++++++++++++++++++------
 sys/dev/i2o/iopsp.c    |  83 ++++++++++++++++++++++-------------------------
 sys/dev/i2o/iopspvar.h |   5 +-
 sys/dev/i2o/iopvar.h   |   6 ++-
 sys/dev/i2o/ld_iop.c   |   2 +-
 7 files changed, 171 insertions(+), 63 deletions(-)

diffs (truncated from 490 to 300 lines):

diff -r 44abbf999924 -r 521c86686b4b sys/dev/i2o/TODO
--- a/sys/dev/i2o/TODO  Fri Mar 30 17:33:58 2001 +0000
+++ b/sys/dev/i2o/TODO  Sun Apr 01 15:03:42 2001 +0000
@@ -1,6 +1,6 @@
-$NetBSD: TODO,v 1.1.2.4 2001/03/27 15:31:51 bouyer Exp $
+$NetBSD: TODO,v 1.1.2.5 2001/04/01 15:03:42 ad Exp $
 
-o Handle device control & private space issues
+o Handle device control issues
 o Resolve portability issues
 o ld_iop: handle removable and non-direct access devices
 o Driver for LAN class device (some code exists already)
diff -r 44abbf999924 -r 521c86686b4b sys/dev/i2o/i2o.h
--- a/sys/dev/i2o/i2o.h Fri Mar 30 17:33:58 2001 +0000
+++ b/sys/dev/i2o/i2o.h Sun Apr 01 15:03:42 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2o.h,v 1.1.2.4 2001/03/27 15:31:51 bouyer Exp $       */
+/*     $NetBSD: i2o.h,v 1.1.2.5 2001/04/01 15:03:42 ad Exp $   */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -978,6 +978,8 @@
        u_int32_t       msgfunc;
        u_int32_t       msgictx;
        u_int32_t       tcw;
+
+       /* SGL follows */
 };
 
 #define        I2O_LAN_TCW_ACCESS_PRI_MASK     0x00000007
@@ -996,6 +998,19 @@
        u_int32_t       msgfunc;
        u_int32_t       msgictx;
        u_int32_t       tcw;            /* As per PACKET_SEND. */
+
+       /* SGL follows */
+};
+
+struct i2o_lan_send_reply {
+       u_int32_t       msgflags;
+       u_int32_t       msgfunc;
+       u_int32_t       msgictx;
+       u_int32_t       trl;
+       u_int16_t       detail;
+       u_int8_t        reserved;
+       u_int8_t        reqstatus;
+       u_int32_t       tctx[1];
 };
 
 #define        I2O_LAN_RECIEVE_POST            0x3e
@@ -1004,6 +1019,29 @@
        u_int32_t       msgfunc;
        u_int32_t       msgictx;
        u_int32_t       bktcnt;
+
+       /* SGL follows */
+};
+
+struct i2o_lan_pdb {
+       u_int32_t       bctx;
+       u_int32_t       pktoff;
+       u_int32_t       pktlen;
+};
+
+#define        I2O_LAN_FRAG_VALID              0x00
+#define        I2O_LAN_FRAG_VALID_MASK         foo
+
+struct i2o_lan_recieve_reply {
+       u_int32_t       msgflags;
+       u_int32_t       msgfunc;
+       u_int32_t       msgictx;
+       u_int8_t        trlcount;
+       u_int8_t        trlesize;
+       u_int8_t        reserved;
+       u_int8_t        trlflags;
+       u_int32_t       bucketsleft;
+       struct i2o_lan_pdb      pdb[1];
 };
 
 #define        I2O_LAN_RESET                   0x35
@@ -1117,4 +1155,50 @@
        u_int8_t        badpkthandling;
 };
 
+#define        I2O_LAN_CONNECTOR_OTHER         0x00
+#define        I2O_LAN_CONNECTOR_UNKNOWN       0x01
+#define        I2O_LAN_CONNECTOR_AUI           0x02
+#define        I2O_LAN_CONNECTOR_UTP           0x03
+#define        I2O_LAN_CONNECTOR_BNC           0x04
+#define        I2O_LAN_CONNECTOR_RJ45          0x05
+#define        I2O_LAN_CONNECTOR_STP_DB9       0x06
+#define        I2O_LAN_CONNECTOR_FIBER_MIC     0x07
+#define        I2O_LAN_CONNECTOR_APPLE_AUI     0x08
+#define        I2O_LAN_CONNECTOR_MII           0x09
+#define        I2O_LAN_CONNECTOR_COPPER_DB9    0x0a
+#define        I2O_LAN_CONNECTOR_COPPER_AW     0x0b
+#define        I2O_LAN_CONNECTOR_OPTICAL_LW    0x0c
+#define        I2O_LAN_CONNECTOR_SIP           0x0d
+#define        I2O_LAN_CONNECTOR_OPTICAL_SW    0x0e
+
+#define        I2O_LAN_CONNECTION_UNKNOWN              0x0000
+
+#define        I2O_LAN_CONNECTION_ETHERNET_AUI         0x0301
+#define        I2O_LAN_CONNECTION_ETHERNET_10BASE5     0x0302
+#define        I2O_LAN_CONNECTION_ETHERNET_FOIRL       0x0303
+#define        I2O_LAN_CONNECTION_ETHERNET_10BASE2     0x0304
+#define        I2O_LAN_CONNECTION_ETHERNET_10BROAD36   0x0305
+#define        I2O_LAN_CONNECTION_ETHERNET_10BASET     0x0306
+#define        I2O_LAN_CONNECTION_ETHERNET_10BASEFP    0x0307
+#define        I2O_LAN_CONNECTION_ETHERNET_10BASEFB    0x0308
+#define        I2O_LAN_CONNECTION_ETHERNET_10BASEFL    0x0309
+#define        I2O_LAN_CONNECTION_ETHERNET_100BASETX   0x030a
+#define        I2O_LAN_CONNECTION_ETHERNET_100BASEFX   0x030b
+#define        I2O_LAN_CONNECTION_ETHERNET_100BASET4   0x030c
+
+#define        I2O_LAN_CONNECTION_100BASEVG_100BASEVG  0x0401
+
+#define        I2O_LAN_CONNECTION_TOKEN_RING_4MBIT     0x0501
+#define        I2O_LAN_CONNECTION_TOKEN_RING_16MBIT    0x0502
+
+#define        I2O_LAN_CONNECTION_FDDI_125MBIT         0x0601
+
+#define        I2O_LAN_CONNECTION_FIBRECHANNEL_P2P     0x0701
+#define        I2O_LAN_CONNECTION_FIBRECHANNEL_AL      0x0702
+#define        I2O_LAN_CONNECTION_FIBRECHANNEL_PL      0x0703
+#define        I2O_LAN_CONNECTION_FIBRECHANNEL_F       0x0704
+
+#define        I2O_LAN_CONNECTION_OTHER_EMULATED       0x0f00
+#define        I2O_LAN_CONNECTION_OTHER_OTHER          0x0f01
+
 #endif /* !defined _I2O_I2O_H_ */
diff -r 44abbf999924 -r 521c86686b4b sys/dev/i2o/iop.c
--- a/sys/dev/i2o/iop.c Fri Mar 30 17:33:58 2001 +0000
+++ b/sys/dev/i2o/iop.c Sun Apr 01 15:03:42 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iop.c,v 1.4.2.5 2001/03/27 15:31:51 bouyer Exp $       */
+/*     $NetBSD: iop.c,v 1.4.2.6 2001/04/01 15:03:42 ad Exp $   */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -1219,6 +1219,8 @@
 {
        struct i2o_exec_sys_tab_set *mf;
        struct iop_msg *im;
+       bus_space_handle_t bsh;
+       bus_addr_t boo;
        u_int32_t mema[2], ioa[2];
        int rv;
        u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];
@@ -1233,11 +1235,32 @@
        mf->iopid = (sc->sc_dv.dv_unit + 2) << 12;
        mf->segnumber = 0;
 
-       /* XXX This is questionable, but better than nothing... */
-       mema[0] = le32toh(sc->sc_status.currentprivmembase);
-       mema[1] = le32toh(sc->sc_status.currentprivmemsize);
-       ioa[0] = le32toh(sc->sc_status.currentpriviobase);
-       ioa[1] = le32toh(sc->sc_status.currentpriviosize);
+       mema[1] = sc->sc_status.desiredprivmemsize;
+       ioa[1] = sc->sc_status.desiredpriviosize;
+
+       if (mema[1] != 0) {
+               rv = bus_space_alloc(sc->sc_bus_memt, 0, 0xffffffff,
+                   le32toh(mema[1]), PAGE_SIZE, 0, 0, &boo, &bsh);
+               mema[0] = htole32(boo);
+               if (rv != 0) {
+                       printf("%s: can't alloc priv mem space, err = %d\n",
+                           sc->sc_dv.dv_xname, rv);
+                       mema[0] = 0;
+                       mema[1] = 0;
+               }
+       }
+
+       if (ioa[1] != 0) {
+               rv = bus_space_alloc(sc->sc_bus_iot, 0, 0xffff,
+                   le32toh(ioa[1]), 0, 0, 0, &boo, &bsh);
+               ioa[0] = htole32(boo);
+               if (rv != 0) {
+                       printf("%s: can't alloc priv i/o space, err = %d\n",
+                           sc->sc_dv.dv_xname, rv);
+                       ioa[0] = 0;
+                       ioa[1] = 0;
+               }
+       }
 
        PHOLD(curproc);
        iop_msg_map(sc, im, mb, iop_systab, iop_systab_size, 1);
@@ -1460,7 +1483,7 @@
                /* Notify the initiator. */
                if ((im->im_flags & IM_WAIT) != 0)
                        wakeup(im);
-               else if ((im->im_flags & IM_POLL) == 0)
+               else if ((im->im_flags & (IM_POLL | IM_POLL_INTR)) != IM_POLL)
                        (*ii->ii_intr)(ii->ii_dv, im, rb);
        } else {
                /*
@@ -1572,8 +1595,6 @@
 #ifdef I2ODEBUG
        if ((im->im_flags & IM_ALLOCED) == 0)
                panic("iop_msg_free: wrapper not allocated");
-       if ((im->im_flags & IM_REPLIED) == 0)
-               printf("iop_msg_free: message was not replied to");
 #endif
 
        im->im_flags = 0;
@@ -1746,9 +1767,8 @@
                        mb[off] |= I2O_SGL_DATA_OUT;
        } else {
                p = mb + off;
+               nsegs = dm->dm_nsegs;
 
-               if (dm->dm_nsegs < nsegs)
-                       nsegs = dm->dm_nsegs;
                if (out)
                        flg = I2O_SGL_SIMPLE | I2O_SGL_DATA_OUT;
                else
@@ -1818,6 +1838,10 @@
        u_int32_t mfa;
        int s;
 
+       /* ZZZ */
+       if ((mb[0] >> 16) > IOP_MAX_MSG_SIZE / 4)
+               panic("iop_post: frame too large");
+
        s = splbio();   /* XXX */
 
        /* Allocate a slot with the IOP. */
@@ -1836,7 +1860,7 @@
 
        /* Copy out the message frame. */
        bus_space_write_region_4(sc->sc_iot, sc->sc_ioh, mfa, mb, mb[0] >> 16);
-       bus_space_barrier(sc->sc_iot, sc->sc_ioh, mfa, mb[0] >> 16,
+       bus_space_barrier(sc->sc_iot, sc->sc_ioh, mfa, (mb[0] >> 14) & ~3,
            BUS_SPACE_BARRIER_WRITE);
 
        /* Post the MFA back to the IOP. */
diff -r 44abbf999924 -r 521c86686b4b sys/dev/i2o/iopsp.c
--- a/sys/dev/i2o/iopsp.c       Fri Mar 30 17:33:58 2001 +0000
+++ b/sys/dev/i2o/iopsp.c       Sun Apr 01 15:03:42 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iopsp.c,v 1.2.2.8 2001/03/27 15:58:41 ad Exp $ */
+/*     $NetBSD: iopsp.c,v 1.2.2.9 2001/04/01 15:03:43 ad Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -77,7 +77,6 @@
 static int     iopsp_match(struct device *, struct cfdata *, void *);
 static int     iopsp_rescan(struct iopsp_softc *);
 static int     iopsp_reconfig(struct device *);
-static int     iopsp_scsi_abort(struct iopsp_softc *, int, struct iop_msg *);
 static void    iopsp_scsipi_request(struct scsipi_channel *,
                                     scsipi_adapter_req_t, void *);
 
@@ -397,12 +396,9 @@
                printf("%s: bus rescan failed (error %d)\n",
                    sc->sc_dv.dv_xname, rv);
 
-       if ((rv = iop_lct_get(iop)) != 0)
-               goto done;
+       if ((rv = iop_lct_get(iop)) == 0)
+               rv = iopsp_reconfig(&sc->sc_dv);
 
-       /* Rebuild the target/LUN -> TID map, release lock, and return. */
-       rv = iopsp_reconfig(&sc->sc_dv);
- done:
        lockmgr(&iop->sc_conflock, LK_RELEASE, NULL);
        return (rv);
 }
@@ -420,7 +416,7 @@
        struct iop_msg *im;
        struct iop_softc *iop;
        struct i2o_scsi_scb_exec *mf;
-       int error, flags, tid, imf;
+       int error, flags, tid, s;
        u_int32_t mb[IOP_MAX_MSG_SIZE / sizeof(u_int32_t)];
 
        sc = (void *)chan->chan_adapter->adapt_dev;
@@ -445,7 +441,7 @@
                /* Need to reset the target? */
                if ((flags & XS_CTL_RESET) != 0) {
                        if (iop_simple_cmd(iop, tid, I2O_SCSI_DEVICE_RESET,
-                           sc->sc_ii.ii_ictx, 1, 10*1000) != 0) {
+                           sc->sc_ii.ii_ictx, 1, 30*1000) != 0) {
 #ifdef I2ODEBUG
                                printf("%s: reset failed\n",
                                    sc->sc_dv.dv_xname);
@@ -463,8 +459,8 @@
                        panic("%s: CDB too large\n", sc->sc_dv.dv_xname);
 #endif
 
-               imf = (flags & (XS_CTL_POLL|XS_CTL_NOSLEEP)) != 0 ? IM_POLL : 0;
-               im = iop_msg_alloc(iop, &sc->sc_ii, imf);
+               im = iop_msg_alloc(iop, &sc->sc_ii, IM_POLL_INTR |
+                   IM_NOSTATUS | ((flags & XS_CTL_POLL) != 0 ? IM_POLL : 0));
                im->im_dvcontext = xs;
 
                mf = (struct i2o_scsi_scb_exec *)mb;
@@ -477,7 +473,7 @@
                mf->datalen = xs->datalen;
                memcpy(mf->cdb, xs->cmd, xs->cmdlen);



Home | Main Index | Thread Index | Old Index