Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Add new microcode for all of the supported boards.



details:   https://anonhg.NetBSD.org/src/rev/d48610e240fc
branches:  trunk
changeset: 485540:d48610e240fc
user:      dante <dante%NetBSD.org@localhost>
date:      Sun Apr 30 18:52:14 2000 +0000

description:
Add new microcode for all of the supported boards.
Fix minor glitches.
Add preliminary support for ASB-3940U3W host adapters; it might work w/ autotermination on.
ASB-3940U3W support is not yet tested due to lack of board.

diffstat:

 sys/dev/ic/adw.c      |    56 +-
 sys/dev/ic/adw.h      |     9 +-
 sys/dev/ic/adwlib.c   |  1316 +++++++++++++++++++++++++++++++++-----
 sys/dev/ic/adwlib.h   |   315 +++++++--
 sys/dev/ic/adwmcode.c |  1678 +++++++++++++++++++++++++++++-------------------
 sys/dev/ic/adwmcode.h |     6 +-
 sys/dev/pci/adw_pci.c |    28 +-
 7 files changed, 2468 insertions(+), 940 deletions(-)

diffs (truncated from 4051 to 300 lines):

diff -r 1c22eed2f752 -r d48610e240fc sys/dev/ic/adw.c
--- a/sys/dev/ic/adw.c  Sun Apr 30 18:46:18 2000 +0000
+++ b/sys/dev/ic/adw.c  Sun Apr 30 18:52:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adw.c,v 1.15 2000/03/23 07:01:28 thorpej Exp $      */
+/* $NetBSD: adw.c,v 1.16 2000/04/30 18:52:15 dante Exp $        */
 
 /*
  * Generic driver for the Advanced Systems Inc. SCSI controllers
@@ -535,9 +535,22 @@
        } else {
                AdvResetChip(sc->sc_iot, sc->sc_ioh);
 
-               warn_code = (sc->chip_type == ADV_CHIP_ASC3550)?
-                               AdvInitFrom3550EEP(sc) :
-                               AdvInitFrom38C0800EEP(sc);
+               switch(sc->chip_type) {
+               case ADV_CHIP_ASC3550:
+                       warn_code = AdvInitFrom3550EEP(sc);
+                       break;
+
+               case ADV_CHIP_ASC38C0800:
+                       warn_code = AdvInitFrom38C0800EEP(sc);
+                       break;
+
+               case ADV_CHIP_ASC38C1600:
+                       warn_code = AdvInitFrom38C1600EEP(sc);
+                       break;
+
+               default:
+                       return -1;
+               }
 
                if (warn_code & ASC_WARN_EEPROM_CHKSUM)
                        printf("%s: Bad checksum found. "
@@ -552,7 +565,7 @@
        sc->isr_callback = (ADW_CALLBACK) adw_isr_callback;
        sc->async_callback = (ADW_CALLBACK) adw_async_callback;
 
-       return (0);
+       return 0;
 }
 
 
@@ -612,11 +625,25 @@
 
 
        /*
-        * Initialize the ASC3550.
+        * Initialize the adapter
         */
-       error = (sc->chip_type == ADV_CHIP_ASC3550)?
-                       AdvInitAsc3550Driver(sc) :
-                       AdvInitAsc38C0800Driver(sc);
+       switch(sc->chip_type) {
+       case ADV_CHIP_ASC3550:
+               error = AdvInitAsc3550Driver(sc);
+               break;
+
+       case ADV_CHIP_ASC38C0800:
+               error = AdvInitAsc38C0800Driver(sc);
+               break;
+
+       case ADV_CHIP_ASC38C1600:
+               error = AdvInitAsc38C1600Driver(sc);
+               break;
+
+       default:
+               return;
+       }
+
        switch (error) {
        case ASC_IERR_MCODE_CHKSUM:
                panic("%s: Microcode checksum error",
@@ -837,8 +864,13 @@
 
        /*
         * Set CDB length and copy it to the request structure.
+        * For wide  boards a CDB length maximum of 16 bytes
+        * is supported.
         */
-       bcopy(xs->cmd, &scsiqp->cdb, scsiqp->cdb_len = xs->cmdlen);
+       bcopy(xs->cmd, &scsiqp->cdb, ((scsiqp->cdb_len = xs->cmdlen) <= 12)?
+                       xs->cmdlen : 12 );
+       if(xs->cmdlen > 12)
+               bcopy(&(xs->cmd[12]),  &scsiqp->cdb16, xs->cmdlen - 12);
 
        scsiqp->target_id = sc_link->scsipi_scsi.target;
        scsiqp->target_lun = sc_link->scsipi_scsi.lun;
@@ -981,9 +1013,11 @@
                 */
                if ((xs = TAILQ_FIRST(&sc->sc_queue)) != NULL)
                        (void) adw_scsi_cmd(xs);
+
+               return (1);
        }
 
-       return (1);
+       return (0);
 }
 
 
diff -r 1c22eed2f752 -r d48610e240fc sys/dev/ic/adw.h
--- a/sys/dev/ic/adw.h  Sun Apr 30 18:46:18 2000 +0000
+++ b/sys/dev/ic/adw.h  Sun Apr 30 18:52:14 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: adw.h,v 1.5 2000/02/03 20:29:15 dante Exp $        */
+/*      $NetBSD: adw.h,v 1.6 2000/04/30 18:52:15 dante Exp $        */
 
 /*
  * Generic driver definitions and exported functions for the Advanced
@@ -80,10 +80,11 @@
 /*
  * Mask used to eliminate low 4 bits of carrier 'next_vpa' field.
  */
-#define ASC_NEXT_VPA_MASK       0xFFFFFFF0
+#define ASC_NEXT_VPA_MASK      0xFFFFFFF0
 
-#define ASC_RQ_DONE             0x00000001
-#define ASC_CQ_STOPPER          0x00000000
+#define ASC_RQ_DONE            0x00000001
+#define ASC_RQ_GOOD            0x00000002
+#define ASC_CQ_STOPPER         0x00000000
 
 #define ASC_GET_CARRP(carrp) ((carrp) & ASC_NEXT_VPA_MASK)
 
diff -r 1c22eed2f752 -r d48610e240fc sys/dev/ic/adwlib.c
--- a/sys/dev/ic/adwlib.c       Sun Apr 30 18:46:18 2000 +0000
+++ b/sys/dev/ic/adwlib.c       Sun Apr 30 18:52:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adwlib.c,v 1.9 2000/02/04 16:23:14 dante Exp $        */
+/* $NetBSD: adwlib.c,v 1.10 2000/04/30 18:52:15 dante Exp $        */
 
 /*
  * Low level routines for the Advanced Systems Inc. SCSI controllers chips
@@ -42,7 +42,7 @@
 /*
  * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters
  * 
- * Copyright (c) 1995-1999 Advanced System Products, Inc.
+ * Copyright (c) 1995-2000 Advanced System Products, Inc.
  * All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -83,12 +83,16 @@
                                                        ADW_EEP_3550_CONFIG *));
 static u_int16_t AdvGet38C0800EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
                                                        ADW_EEP_38C0800_CONFIG *));
+static u_int16_t AdvGet38C1600EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
+                                                       ADW_EEP_38C1600_CONFIG *));
 static u_int16_t AdvReadEEPWord __P((bus_space_tag_t, bus_space_handle_t, int));
 static void AdvWaitEEPCmd __P((bus_space_tag_t, bus_space_handle_t));
 static void AdvSet3550EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
                                                         ADW_EEP_3550_CONFIG *));
 static void AdvSet38C0800EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
                                                         ADW_EEP_38C0800_CONFIG *));
+static void AdvSet38C1600EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
+                                                        ADW_EEP_38C1600_CONFIG *));
 static void AdvInquiryHandling __P((ADW_SOFTC *, ADW_SCSI_REQ_Q *));
 
 static void AdvSleepMilliSecond __P((u_int32_t));
@@ -206,6 +210,71 @@
        0                       /* 63 reserved */
 };
 
+static ADW_EEP_38C1600_CONFIG
+Default_38C1600_EEPROM_Config = {
+       ADW_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
+       0x0000,                 /* 01 cfg_msw */
+       0xFFFF,                 /* 02 disc_enable */
+       0xFFFF,                 /* 03 wdtr_able */
+       0x5555,                 /* 04 sdtr_speed1 */
+       0xFFFF,                 /* 05 start_motor */
+       0xFFFF,                 /* 06 tagqng_able */
+       0xFFFF,                 /* 07 bios_scan */
+       0,                      /* 08 scam_tolerant */
+       7,                      /* 09 adapter_scsi_id */
+       0,                      /*    bios_boot_delay */
+       3,                      /* 10 scsi_reset_delay */
+       0,                      /*    bios_id_lun */
+       0,                      /* 11 termination_se */
+       0,                      /*    termination_lvd */
+       0xFFE7,                 /* 12 bios_ctrl */
+       0x5555,                 /* 13 sdtr_speed2 */
+       0x5555,                 /* 14 sdtr_speed3 */
+       ASC_DEF_MAX_HOST_QNG,   /* 15 max_host_qng */
+       ASC_DEF_MAX_DVC_QNG,    /*    max_dvc_qng */
+       0,                      /* 16 dvc_cntl */
+       0x5555,                 /* 17 sdtr_speed4 */
+       0,                      /* 18 serial_number_word1 */
+       0,                      /* 19 serial_number_word2 */
+       0,                      /* 20 serial_number_word3 */
+       0,                      /* 21 check_sum */
+       { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* 22-29 oem_name[16] */
+       0,                      /* 30 dvc_err_code */
+       0,                      /* 31 adv_err_code */
+       0,                      /* 32 adv_err_addr */
+       0,                      /* 33 saved_dvc_err_code */
+       0,                      /* 34 saved_adv_err_code */
+       0,                      /* 35 saved_adv_err_addr */
+       0,                      /* 36 reserved */
+       0,                      /* 37 reserved */
+       0,                      /* 38 reserved */
+       0,                      /* 39 reserved */
+       0,                      /* 40 reserved */
+       0,                      /* 41 reserved */
+       0,                      /* 42 reserved */
+       0,                      /* 43 reserved */
+       0,                      /* 44 reserved */
+       0,                      /* 45 reserved */
+       0,                      /* 46 reserved */
+       0,                      /* 47 reserved */
+       0,                      /* 48 reserved */
+       0,                      /* 49 reserved */
+       0,                      /* 50 reserved */
+       0,                      /* 51 reserved */
+       0,                      /* 52 reserved */
+       0,                      /* 53 reserved */
+       0,                      /* 54 reserved */
+       0,                      /* 55 reserved */
+       0,                      /* 56 cisptr_lsw */
+       0,                      /* 57 cisprt_msw */
+       PCI_VENDOR_ADVSYS,      /* 58 subsysvid */
+       PCI_PRODUCT_ADVSYS_U3W, /* 59 subsysid */
+       0,                      /* 60 reserved */
+       0,                      /* 61 reserved */
+       0,                      /* 62 reserved */
+       0                       /* 63 reserved */
+};
+
 /*
  * Initialize the ASC3550.
  *
@@ -247,7 +316,7 @@
         * that a chip reset does not clear RISC LRAM.
         */
        for (i = 0; i < ASC_MC_BIOSLEN/2; i++) {
-               ADW_READ_WORD_LRAM(iot, ioh, ASC_MC_BIOSMEM + (2*i), bios_mem[i]);
+               ADW_READ_WORD_LRAM(iot, ioh, ASC_MC_BIOSMEM+(2*i), bios_mem[i]);
        }
 
        /*
@@ -314,7 +383,7 @@
                        word++;
                } else {
                        ADW_WRITE_WORD_AUTO_INC_LRAM(iot, ioh, (((u_int16_t)
-                        adv_asc3550_mcode[(adv_asc3550_mcode[i] * 2) + 1] <<8) |
+                        adv_asc3550_mcode[(adv_asc3550_mcode[i] * 2) + 1] <<8)|
                         adv_asc3550_mcode[adv_asc3550_mcode[i] * 2]));
                        word++;
                }
@@ -389,11 +458,6 @@
         * to ignore DMA parity errors.
         */
        if (sc->cfg.control_flag & CONTROL_FLAG_IGNORE_PERR) {
-               /*
-                * Note: Don't remove the use of a temporary variable in
-                * the following code, otherwise some  C compiler
-                * might turn the following lines into a no-op.
-                */
                ADW_READ_WORD_LRAM(iot, ioh, ASC_MC_CONTROL_FLAG, word);
                word |= CONTROL_FLAG_IGNORE_PERR;
                ADW_WRITE_WORD_LRAM(iot, ioh, ASC_MC_CONTROL_FLAG, word);
@@ -488,8 +552,8 @@
         * after it is started below.
         */
        ADW_WRITE_WORD_LRAM(iot, ioh, ASC_MC_DEFAULT_SCSI_CFG0,
-               ADW_PARITY_EN | ADW_SEL_TMO_LONG | ADW_OUR_ID_EN |
-                       sc->chip_scsi_id);
+               ADW_PARITY_EN | ADW_QUEUE_128 | ADW_SEL_TMO_LONG |
+               ADW_OUR_ID_EN | sc->chip_scsi_id);
 
        /*
         * Determine SCSI_CFG1 Microcode Default Value.
@@ -505,7 +569,7 @@
         * If all three connectors are in use, return an error.
         */
        if ((scsi_cfg1 & CABLE_ILLEGAL_A) == 0 ||
-               (scsi_cfg1 & CABLE_ILLEGAL_B) == 0) {
+           (scsi_cfg1 & CABLE_ILLEGAL_B) == 0) {
                return ASC_IERR_ILLEGAL_CONNECTION;
        }
 
@@ -537,15 +601,19 @@
         */
        if (sc->cfg.termination == 0) {
                /*
-                * The software always controls termination by setting TERM_CTL_SEL.
-                * If TERM_CTL_SEL were set to 0, the hardware would set termination.
+                * The software always controls termination by setting
+                * TERM_CTL_SEL.
+                * If TERM_CTL_SEL were set to 0, the hardware would set
+                * termination.
                 */
                sc->cfg.termination |= ADW_TERM_CTL_SEL;
 
                switch(scsi_cfg1 & ADW_CABLE_DETECT) {
                        /* TERM_CTL_H: on, TERM_CTL_L: on */
-                       case 0x3: case 0x7: case 0xB: case 0xD: case 0xE: case 0xF:
-                               sc->cfg.termination |= (ADW_TERM_CTL_H | ADW_TERM_CTL_L);



Home | Main Index | Thread Index | Old Index