Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga/dev More 53c770 stuff: update 53c720/770 reg...



details:   https://anonhg.NetBSD.org/src/rev/adb133fe78a6
branches:  trunk
changeset: 467648:adb133fe78a6
user:      mhitch <mhitch%NetBSD.org@localhost>
date:      Fri Mar 26 22:50:22 1999 +0000

description:
More 53c770 stuff:  update 53c720/770 register defines and use them in
siop2.c.  Add wide negotiation and Ultra support.  Modify siop.c to match
the siop2.c sync negotiation changes.  The CyberStorm MKIII driver now
supports 15 targets.  Remove some old table-driven sync rate stuff from
the original Zeus driver.

diffstat:

 sys/arch/amiga/dev/cbiiisc.c        |    4 +-
 sys/arch/amiga/dev/siop.c           |   85 +++++++---
 sys/arch/amiga/dev/siop2.c          |  283 +++++++++++++++++++++--------------
 sys/arch/amiga/dev/siop2_script.out |  189 ++++++++++++-----------
 sys/arch/amiga/dev/siop2_script.ss  |   23 ++-
 sys/arch/amiga/dev/siop_script.out  |  150 +++++++++---------
 sys/arch/amiga/dev/siop_script.ss   |   14 +-
 sys/arch/amiga/dev/siopreg.h        |  134 ++++++++++++++++-
 sys/arch/amiga/dev/siopvar.h        |   22 ++-
 9 files changed, 578 insertions(+), 326 deletions(-)

diffs (truncated from 1532 to 300 lines):

diff -r ff4e0bf268da -r adb133fe78a6 sys/arch/amiga/dev/cbiiisc.c
--- a/sys/arch/amiga/dev/cbiiisc.c      Fri Mar 26 22:45:17 1999 +0000
+++ b/sys/arch/amiga/dev/cbiiisc.c      Fri Mar 26 22:50:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cbiiisc.c,v 1.2 1999/03/09 20:25:46 is Exp $   */
+/*     $NetBSD: cbiiisc.c,v 1.3 1999/03/26 22:50:22 mhitch Exp $       */
 
 /*
  * Copyright (c) 1994,1998 Michael L. Hitch
@@ -140,7 +140,7 @@
        sc->sc_link.adapter = &sc->sc_adapter;
        sc->sc_link.device = &cbiiisc_scsidev;
        sc->sc_link.openings = 2;
-       sc->sc_link.scsipi_scsi.max_target = 7 /*15*/;
+       sc->sc_link.scsipi_scsi.max_target = 15;
        sc->sc_link.scsipi_scsi.max_lun = 7;
        sc->sc_link.type = BUS_SCSI;
 
diff -r ff4e0bf268da -r adb133fe78a6 sys/arch/amiga/dev/siop.c
--- a/sys/arch/amiga/dev/siop.c Fri Mar 26 22:45:17 1999 +0000
+++ b/sys/arch/amiga/dev/siop.c Fri Mar 26 22:50:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop.c,v 1.39 1998/07/04 22:18:17 jonathan Exp $       */
+/*     $NetBSD: siop.c,v 1.40 1999/03/26 22:50:22 mhitch Exp $ */
 
 /*
  * Copyright (c) 1994 Michael L. Hitch
@@ -746,9 +746,14 @@
        acb->ds.synmsgbuf = (char *) kvtop(&acb->msg[3]);
        bzero(&acb->ds.chain, sizeof (acb->ds.chain));
 
-       if (sc->sc_sync[target].state == SYNC_START) {
+       /*
+        * Negotiate wide is the initial negotiation state;  since the 53c710
+        * doesn't do wide transfers, just begin the synchronous transfer
+        * negotation here.
+        */
+       if (sc->sc_sync[target].state == NEG_WIDE) {
                if (siop_inhibit_sync[target]) {
-                       sc->sc_sync[target].state = SYNC_DONE;
+                       sc->sc_sync[target].state = NEG_DONE;
                        sc->sc_sync[target].sbcl = 0;
                        sc->sc_sync[target].sxfer = 0;
 #ifdef DEBUG
@@ -768,7 +773,7 @@
 #endif
                        acb->msgout[5] = SIOP_MAX_OFFSET;
                        acb->ds.idlen = 6;
-                       sc->sc_sync[target].state = SYNC_SENT;
+                       sc->sc_sync[target].state = NEG_WAITS;
 #ifdef DEBUG
                        if (siopsync_debug)
                                printf ("Sending sync request to target %d\n", target);
@@ -918,20 +923,48 @@
                }
 #endif
                target = acb->xs->sc_link->scsipi_scsi.target;
-               if (sc->sc_sync[target].state == SYNC_SENT) {
+               if (sc->sc_sync[target].state == NEG_WAITS) {
+                       if (acb->msg[1] == 0xff)
+                               printf ("%s: target %d ignored sync request\n",
+                                   sc->sc_dev.dv_xname, target);
+                       else if (acb->msg[1] == MSG_REJECT)
+                               printf ("%s: target %d rejected sync request\n",
+                                   sc->sc_dev.dv_xname, target);
+                       else
+/* XXX - need to set sync transfer parameters */
+                               printf("%s: target %d (sync) %02x %02x %02x\n",
+                                   sc->sc_dev.dv_xname, target, acb->msg[1],
+                                   acb->msg[2], acb->msg[3]);
+                       sc->sc_sync[target].state = NEG_DONE;
+               }
+               dma_cachectl(&acb->stat[0], 1);
+               *status = acb->stat[0];
+#ifdef DEBUG
+               if (rp->siop_sbcl & SIOP_BSY) {
+                       /*printf ("ACK! siop was busy at end: rp %x script %x dsa %x\n",
+                           rp, &scripts, &acb->ds);*/
+#ifdef DDB
+                       /*Debugger();*/
+#endif
+               }
+               if (acb->msg[0] != 0x00)
+                       printf("%s: message was not COMMAND COMPLETE: %x\n",
+                           sc->sc_dev.dv_xname, acb->msg[0]);
+#endif
+               if (sc->nexus_list.tqh_first)
+                       rp->siop_dcntl |= SIOP_DCNTL_STD;
+               return 1;
+       }
+       if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff0b) {
+               target = acb->xs->sc_link->scsipi_scsi.target;
+               if (acb->msg[1] == MSG_EXT_MESSAGE && acb->msg[2] == 3 &&
+                   acb->msg[3] == MSG_SYNC_REQ) {
 #ifdef DEBUG
                        if (siopsync_debug)
                                printf ("sync msg in: %02x %02x %02x %02x %02x %02x\n",
                                    acb->msg[0], acb->msg[1], acb->msg[2],
                                    acb->msg[3], acb->msg[4], acb->msg[5]);
 #endif
-                       if (acb->msg[1] == 0xff)
-                               printf ("%s: target %d ignored sync request\n",
-                                   sc->sc_dev.dv_xname, target);
-                       else if (acb->msg[1] == MSG_REJECT)
-                               printf ("%s: target %d rejected sync request\n",
-                                   sc->sc_dev.dv_xname, target);
-                       sc->sc_sync[target].state = SYNC_DONE;
                        sc->sc_sync[target].sxfer = 0;
                        sc->sc_sync[target].sbcl = 0;
                        if (acb->msg[2] == 3 &&
@@ -964,24 +997,18 @@
                                    acb->msg[4] * 4, acb->msg[5]);
                                scsi_period_to_siop (sc, target);
                        }
+                       rp->siop_sxfer = sc->sc_sync[target].sxfer;
+                       rp->siop_sbcl = sc->sc_sync[target].sbcl;
+                       if (sc->sc_sync[target].state == NEG_WAITS) {
+                               sc->sc_sync[target].state = NEG_DONE;
+                               rp->siop_dsp = sc->sc_scriptspa + Ent_clear_ack;
+                               return(0);
+                       }
+                       rp->siop_dcntl |= SIOP_DCNTL_STD;
+                       sc->sc_sync[target].state = NEG_DONE;
+                       return (0);
                }
-               dma_cachectl(&acb->stat[0], 1);
-               *status = acb->stat[0];
-#ifdef DEBUG
-               if (rp->siop_sbcl & SIOP_BSY) {
-                       /*printf ("ACK! siop was busy at end: rp %x script %x dsa %x\n",
-                           rp, &scripts, &acb->ds);*/
-#ifdef DDB
-                       /*Debugger();*/
-#endif
-               }
-               if (acb->msg[0] != 0x00)
-                       printf("%s: message was not COMMAND COMPLETE: %x\n",
-                           sc->sc_dev.dv_xname, acb->msg[0]);
-#endif
-               if (sc->nexus_list.tqh_first)
-                       rp->siop_dcntl |= SIOP_DCNTL_STD;
-               return 1;
+               /* XXX - not SDTR message */
        }
        if (sstat0 & SIOP_SSTAT0_M_A) {         /* Phase mismatch */
 #ifdef DEBUG
diff -r ff4e0bf268da -r adb133fe78a6 sys/arch/amiga/dev/siop2.c
--- a/sys/arch/amiga/dev/siop2.c        Fri Mar 26 22:45:17 1999 +0000
+++ b/sys/arch/amiga/dev/siop2.c        Fri Mar 26 22:50:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop2.c,v 1.5 1999/03/22 19:30:57 is Exp $     */
+/*     $NetBSD: siop2.c,v 1.6 1999/03/26 22:50:23 mhitch Exp $ */
 
 /*
  * Copyright (c) 1994,1998 Michael L. Hitch
@@ -93,6 +93,7 @@
 
 /* default to not inhibit sync negotiation on any drive */
 u_char siopng_inhibit_sync[16] = { 0, 0, 0, 0, 0, 0, 0 }; /* initialize, so patchable */
+u_char siopng_inhibit_wide[16] = { 0, 0, 0, 0, 0, 0, 0 }; /* initialize, so patchable */
 u_char siopng_allow_disc[16] = {3, 3, 3, 3, 3, 3, 3, 3};
 int siopng_no_dma = 0;
 
@@ -104,43 +105,6 @@
 
 #define DEBUG_SYNC
 
-#ifdef DEBUG_SYNC
-/*
- * sync period transfer lookup - only valid for 66Mhz clock
- */
-#ifdef FIXME
-static struct {
-       unsigned char p;        /* period from sync request message */
-       unsigned char r;        /* siop_period << 4 | sbcl */
-} sync_tab[] = {
-       { 60/4, 0<<4 | 1},
-       { 76/4, 1<<4 | 1},
-       { 92/4, 2<<4 | 1},
-       { 92/4, 0<<4 | 2},
-       {108/4, 3<<4 | 1},
-       {116/4, 1<<4 | 2},
-       {120/4, 4<<4 | 1},
-       {120/4, 0<<4 | 3},
-       {136/4, 5<<4 | 1},
-       {140/4, 2<<4 | 2},
-       {152/4, 6<<4 | 1},
-       {152/4, 1<<4 | 3},
-       {164/4, 3<<4 | 2},
-       {168/4, 7<<4 | 1},
-       {180/4, 2<<4 | 3},
-       {184/4, 4<<4 | 2},
-       {208/4, 5<<4 | 2},
-       {212/4, 3<<4 | 3},
-       {232/4, 6<<4 | 2},
-       {240/4, 4<<4 | 3},
-       {256/4, 7<<4 | 2},
-       {272/4, 5<<4 | 3},
-       {300/4, 6<<4 | 3},
-       {332/4, 7<<4 | 3}
-};
-#endif
-#endif
-
 #ifdef DEBUG
 /*
  *     0x01 - full debug
@@ -177,7 +141,7 @@
 
 static char *siopng_chips[] = {
        "720", "720SE", "770", "0x3",
-       "810A", "0x5", "0x6", "0x7",
+       "0x4", "0x5", "0x6", "0x7",
        "0x8", "0x9", "0xA", "0xB",
        "0xC", "0xD", "0xE", "0xF",
 };
@@ -576,6 +540,7 @@
        sc->sc_minsync = sc->sc_tcp[1];         /* in 4ns units */
        if (sc->sc_minsync < 25)
                sc->sc_minsync = 25;
+       sc->sc_minsync >>= 1;                   /* Using clock doubler, allow Ultra */
        if (sc->sc_clock_freq <= 25) {
                sc->sc_dcntl |= 0x80;           /* SCLK/1 */
                sc->sc_tcp[0] = sc->sc_tcp[1];
@@ -591,14 +556,14 @@
        }
 
        if (scsi_nosync) {
-               inhibit_sync = (scsi_nosync >> shift_nosync) & 0xff;
-               shift_nosync += 8;
+               inhibit_sync = (scsi_nosync >> shift_nosync) & 0xffff;
+               shift_nosync += 16;             /* XXX maxtarget */
 #ifdef DEBUG
                if (inhibit_sync)
                        printf("%s: Inhibiting synchronous transfer %02x\n",
                                sc->sc_dev.dv_xname, inhibit_sync);
 #endif
-               for (i = 0; i < 8; ++i)
+               for (i = 0; i < 16; ++i)                /* XXX maxtarget */
                        if (inhibit_sync & (1 << i))
                                siopng_inhibit_sync[i] = 1;
        }
@@ -642,18 +607,19 @@
        /*
         * Set up various chip parameters
         */
-       rp->siop_stest1 |= 0x08;        /* SCLK doubler enable */
+       rp->siop_stest1 |= SIOP_STEST1_DBLEN;   /* SCLK doubler enable */
        delay(20);
-       rp->siop_stest3 |= 0x20;        /* Halt SCSI clock */
-       rp->siop_scntl3 = 0x15;         /* SCF/CCF*/
-       rp->siop_stest1 |= 0x04;        /* SCLK doubler select */
-       rp->siop_stest3 &= ~0x20;       /* Clear Halt SCSI clock */
+       rp->siop_stest3 |= SIOP_STEST3_HSC;     /* Halt SCSI clock */
+       rp->siop_scntl3 = 0x15;                 /* SCF/CCF*/
+       rp->siop_stest1 |= SIOP_STEST1_DBLSEL;  /* SCLK doubler select */
+       rp->siop_stest3 &= ~SIOP_STEST3_HSC;    /* Clear Halt SCSI clock */
        rp->siop_scntl0 = SIOP_ARB_FULL | /*SIOP_SCNTL0_EPC |*/ SIOP_SCNTL0_EPG;
        rp->siop_dcntl = sc->sc_dcntl;
        rp->siop_dmode = 0xc0;          /* XXX burst length */
        rp->siop_sien = 0x00;   /* don't enable interrupts yet */
        rp->siop_dien = 0x00;   /* don't enable interrupts yet */
-       rp->siop_scid = sc->sc_link.scsipi_scsi.adapter_target | 0x60;
+       rp->siop_scid = sc->sc_link.scsipi_scsi.adapter_target |
+           SIOP_SCID_RRE | SIOP_SCID_SRE;
        rp->siop_respid = 1 << sc->sc_link.scsipi_scsi.adapter_target;
        rp->siop_dwt = 0x00;
        rp->siop_stime0 = 0x0c;         /* XXXXX check */
@@ -676,8 +642,12 @@
         */
        if ((rp->siop_sbdl & 0xff00) == 0xff00) {
                printf(" NO WIDE TERM");
-               for (i = 0; i < 16; ++i)
+               /* XXX need to restrict maximum target ID as well? */
+               sc->sc_link.scsipi_scsi.max_target = 7;
+               for (i = 0; i < 16; ++i) {
                        siopng_allow_disc[i] = 0;
+                       siopng_inhibit_wide[i] |= 0x80;
+               }
        }
 
        printf("siopng type %s id %d reset V%d\n",
@@ -764,7 +734,7 @@
        acb->stat[0] = -1;
        acb->msg[0] = -1;
        acb->ds.scsi_addr = (target << 16) | (sc->sc_sync[target].sxfer << 8) |
-           (sc->sc_sync[target].sbcl << 24);
+           (sc->sc_sync[target].scntl3 << 24);
        acb->ds.idlen = 1;
        acb->ds.idbuf = (char *) kvtop(&acb->msgout[0]);
        acb->ds.cmdlen = clen;
@@ -777,15 +747,42 @@
        acb->ds.msginlen = 1;
        acb->ds.extmsglen = 1;
        acb->ds.synmsglen = 3;
-       acb->ds.msginbuf = (char *) kvtop(&acb->msg[1]);
-       acb->ds.extmsgbuf = (char *) kvtop(&acb->msg[2]);
-       acb->ds.synmsgbuf = (char *) kvtop(&acb->msg[3]);
+       acb->ds.msginbuf = acb->ds.msgbuf + 1;
+       acb->ds.extmsgbuf = acb->ds.msginbuf + 1;



Home | Main Index | Thread Index | Old Index