Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Change AdwInitCarriers in adwmcode.c



details:   https://anonhg.NetBSD.org/src/rev/add4ebfb7207
branches:  trunk
changeset: 486709:add4ebfb7207
user:      dante <dante%NetBSD.org@localhost>
date:      Sat May 27 18:24:50 2000 +0000

description:
Change AdwInitCarriers in adwmcode.c
Add new AdwInitCarriers prototype in adwmcode.h
All of the supported adapters are now initialized calling a unique common
    function

diffstat:

 sys/dev/ic/adw.c      |    38 +-
 sys/dev/ic/adwlib.c   |  3574 ++++++++++++++++--------------------------------
 sys/dev/ic/adwlib.h   |   250 +---
 sys/dev/ic/adwmcode.c |    13 +-
 sys/dev/ic/adwmcode.h |     6 +-
 5 files changed, 1275 insertions(+), 2606 deletions(-)

diffs (truncated from 4277 to 300 lines):

diff -r 052738f031db -r add4ebfb7207 sys/dev/ic/adw.c
--- a/sys/dev/ic/adw.c  Sat May 27 18:23:27 2000 +0000
+++ b/sys/dev/ic/adw.c  Sat May 27 18:24:50 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adw.c,v 1.22 2000/05/26 15:13:43 dante Exp $        */
+/* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $        */
 
 /*
  * Generic driver for the Advanced Systems Inc. SCSI controllers
@@ -446,22 +446,7 @@
        } else {
                AdwResetChip(sc->sc_iot, sc->sc_ioh);
 
-               switch(sc->chip_type) {
-               case ADW_CHIP_ASC3550:
-                       warn_code = AdwInitFrom3550EEP(sc);
-                       break;
-
-               case ADW_CHIP_ASC38C0800:
-                       warn_code = AdwInitFrom38C0800EEP(sc);
-                       break;
-
-               case ADW_CHIP_ASC38C1600:
-                       warn_code = AdwInitFrom38C1600EEP(sc);
-                       break;
-
-               default:
-                       return -1;
-               }
+               warn_code = AdwInitFromEEPROM(sc);
 
                if (warn_code & ADW_WARN_EEPROM_CHKSUM)
                        printf("%s: Bad checksum found. "
@@ -531,24 +516,7 @@
        /*
         * Initialize the adapter
         */
-       switch(sc->chip_type) {
-       case ADW_CHIP_ASC3550:
-               error = AdwInitAsc3550Driver(sc);
-               break;
-
-       case ADW_CHIP_ASC38C0800:
-               error = AdwInitAsc38C0800Driver(sc);
-               break;
-
-       case ADW_CHIP_ASC38C1600:
-               error = AdwInitAsc38C1600Driver(sc);
-               break;
-
-       default:
-               return;
-       }
-
-       switch (error) {
+       switch (AdwInitDriver(sc)) {
        case ADW_IERR_BIST_PRE_TEST:
                panic("%s: BIST pre-test error",
                      sc->sc_dev.dv_xname);
diff -r 052738f031db -r add4ebfb7207 sys/dev/ic/adwlib.c
--- a/sys/dev/ic/adwlib.c       Sat May 27 18:23:27 2000 +0000
+++ b/sys/dev/ic/adwlib.c       Sat May 27 18:24:50 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adwlib.c,v 1.16 2000/05/26 15:13:43 dante Exp $        */
+/* $NetBSD: adwlib.c,v 1.17 2000/05/27 18:24:50 dante Exp $        */
 
 /*
  * Low level routines for the Advanced Systems Inc. SCSI controllers chips
@@ -79,20 +79,22 @@
 
 /* Static Functions */
 
-static u_int16_t AdwGet3550EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
-                                                       ADW_EEP_3550_CONFIG *));
-static u_int16_t AdwGet38C0800EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
-                                                       ADW_EEP_38C0800_CONFIG *));
-static u_int16_t AdwGet38C1600EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
-                                                       ADW_EEP_38C1600_CONFIG *));
+int AdwRamSelfTest __P((bus_space_tag_t, bus_space_handle_t, u_int8_t));
+int AdwLoadMCode __P((bus_space_tag_t, bus_space_handle_t, u_int16_t *,
+                                                               u_int8_t));
+int AdwASC3550Cabling __P((bus_space_tag_t, bus_space_handle_t, ADW_DVC_CFG *));
+int AdwASC38C0800Cabling __P((bus_space_tag_t, bus_space_handle_t,
+                                                               ADW_DVC_CFG *));
+int AdwASC38C1600Cabling __P((bus_space_tag_t, bus_space_handle_t,
+                                                               ADW_DVC_CFG *));
+
+static u_int16_t AdwGetEEPROMConfig __P((bus_space_tag_t, bus_space_handle_t,
+                                                       ADW_EEPROM *));
+static void AdwSetEEPROMConfig __P((bus_space_tag_t, bus_space_handle_t,
+                                                        ADW_EEPROM *));
 static u_int16_t AdwReadEEPWord __P((bus_space_tag_t, bus_space_handle_t, int));
 static void AdwWaitEEPCmd __P((bus_space_tag_t, bus_space_handle_t));
-static void AdwSet3550EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
-                                                        ADW_EEP_3550_CONFIG *));
-static void AdwSet38C0800EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
-                                                        ADW_EEP_38C0800_CONFIG *));
-static void AdwSet38C1600EEPConfig __P((bus_space_tag_t, bus_space_handle_t,
-                                                        ADW_EEP_38C1600_CONFIG *));
+
 static void AdwInquiryHandling __P((ADW_SOFTC *, ADW_SCSI_REQ_Q *));
 
 static void AdwSleepMilliSecond __P((u_int32_t));
@@ -107,51 +109,49 @@
  * Additional structure information can be found in adwlib.h where
  * the structure is defined.
  */
-static ADW_EEP_3550_CONFIG
-Default_3550_EEPROM_Config = {
-       ADW_EEPROM_BIOS_ENABLE, /* cfg_lsw */
-       0x0000,                 /* cfg_msw */
-       0xFFFF,                 /* disc_enable */
-       0xFFFF,                 /* wdtr_able */
-       0xFFFF,                 /* sdtr_able */
-       0xFFFF,                 /* start_motor */
-       0xFFFF,                 /* tagqng_able */
-       0xFFFF,                 /* bios_scan */
-       0,                      /* scam_tolerant */
-       7,                      /* adapter_scsi_id */
-       0,                      /* bios_boot_delay */
-       3,                      /* scsi_reset_delay */
-       0,                      /* bios_id_lun */
-       0,                      /* termination */
-       0,                      /* reserved1 */
-       0xFFE7,                 /* bios_ctrl */
-       0xFFFF,                 /* ultra_able */
-       0,                      /* reserved2 */
-       ADW_DEF_MAX_HOST_QNG,   /* max_host_qng */
-       ADW_DEF_MAX_DVC_QNG,    /* max_dvc_qng */
-       0,                      /* dvc_cntl */
-       0,                      /* bug_fix */
-       0,                      /* serial_number_word1 */
-       0,                      /* serial_number_word2 */
-       0,                      /* serial_number_word3 */
-       0,                      /* check_sum */
-       { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* oem_name[16] */
-       0,                      /* dvc_err_code */
-       0,                      /* adv_err_code */
-       0,                      /* adv_err_addr */
-       0,                      /* saved_dvc_err_code */
-       0,                      /* saved_adv_err_code */
-       0,                      /* saved_adv_err_addr */
-       0                       /* num_of_err */
-};
-
-static ADW_EEP_38C0800_CONFIG
-Default_38C0800_EEPROM_Config = {
+const static ADW_EEPROM adw_3550_Default_EEPROM = {
        ADW_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
        0x0000,                 /* 01 cfg_msw */
        0xFFFF,                 /* 02 disc_enable */
        0xFFFF,                 /* 03 wdtr_able */
-       0x4444,                 /* 04 sdtr_speed1 */
+       { 0xFFFF },             /* 04 sdtr_able */
+       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 */
+       0,                      /*    reserved1 */
+       0xFFE7,                 /* 12 bios_ctrl */
+       { 0xFFFF },             /* 13 ultra_able */
+       { 0 },                  /* 14 reserved2 */
+       ADW_DEF_MAX_HOST_QNG,   /* 15 max_host_qng */
+       ADW_DEF_MAX_DVC_QNG,    /*    max_dvc_qng */
+       0,                      /* 16 dvc_cntl */
+       { 0 },                  /* 17 bug_fix */
+       { 0,0,0 },              /* 18-20 serial_number[3] */
+       0,                      /* 21 check_sum */
+       {                       /* 22-29 oem_name[16] */
+         0,0,0,0,0,0,0,0,
+         0,0,0,0,0,0,0,0
+       },
+       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 */
+};
+
+const static ADW_EEPROM adw_38C0800_Default_EEPROM = {
+       ADW_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
+       0x0000,                 /* 01 cfg_msw */
+       0xFFFF,                 /* 02 disc_enable */
+       0xFFFF,                 /* 03 wdtr_able */
+       { 0x4444 },             /* 04 sdtr_speed1 */
        0xFFFF,                 /* 05 start_motor */
        0xFFFF,                 /* 06 tagqng_able */
        0xFFFF,                 /* 07 bios_scan */
@@ -163,60 +163,41 @@
        0,                      /* 11 termination_se */
        0,                      /*    termination_lvd */
        0xFFE7,                 /* 12 bios_ctrl */
-       0x4444,                 /* 13 sdtr_speed2 */
-       0x4444,                 /* 14 sdtr_speed3 */
+       { 0x4444 },             /* 13 sdtr_speed2 */
+       { 0x4444 },             /* 14 sdtr_speed3 */
        ADW_DEF_MAX_HOST_QNG,   /* 15 max_host_qng */
        ADW_DEF_MAX_DVC_QNG,    /*    max_dvc_qng */
        0,                      /* 16 dvc_cntl */
-       0x4444,                 /* 17 sdtr_speed4 */
-       0,                      /* 18 serial_number_word1 */
-       0,                      /* 19 serial_number_word2 */
-       0,                      /* 20 serial_number_word3 */
+       { 0x4444 },             /* 17 sdtr_speed4 */
+       { 0,0,0 },              /* 18-20 serial_number[3] */
        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] */
+       {                       /* 22-29 oem_name[16] */
+         0,0,0,0,0,0,0,0,
+         0,0,0,0,0,0,0,0
+       },
        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 */
+       {                       /* 36-55 reserved1[16] */
+         0,0,0,0,0,0,0,0,0,0,
+         0,0,0,0,0,0,0,0,0,0
+       },
        0,                      /* 56 cisptr_lsw */
        0,                      /* 57 cisprt_msw */
        PCI_VENDOR_ADVSYS,      /* 58 subsysvid */
        PCI_PRODUCT_ADVSYS_U2W, /* 59 subsysid */
-       0,                      /* 60 reserved */
-       0,                      /* 61 reserved */
-       0,                      /* 62 reserved */
-       0                       /* 63 reserved */
+       { 0,0,0,0 }             /* 60-63 reserved2[4] */
 };
 
-static ADW_EEP_38C1600_CONFIG
-Default_38C1600_EEPROM_Config = {
+const static ADW_EEPROM adw_38C1600_Default_EEPROM = {
        ADW_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
        0x0000,                 /* 01 cfg_msw */
        0xFFFF,                 /* 02 disc_enable */
        0xFFFF,                 /* 03 wdtr_able */
-       0x5555,                 /* 04 sdtr_speed1 */
+       { 0x5555 },             /* 04 sdtr_speed1 */
        0xFFFF,                 /* 05 start_motor */
        0xFFFF,                 /* 06 tagqng_able */
        0xFFFF,                 /* 07 bios_scan */
@@ -228,1648 +209,57 @@
        0,                      /* 11 termination_se */
        0,                      /*    termination_lvd */
        0xFFE7,                 /* 12 bios_ctrl */
-       0x5555,                 /* 13 sdtr_speed2 */
-       0x5555,                 /* 14 sdtr_speed3 */
+       { 0x5555 },             /* 13 sdtr_speed2 */
+       { 0x5555 },             /* 14 sdtr_speed3 */
        ADW_DEF_MAX_HOST_QNG,   /* 15 max_host_qng */
        ADW_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 */
+       { 0x5555 },             /* 17 sdtr_speed4 */
+       { 0,0,0 },              /* 18-20 serial_number[3] */
        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] */
+       {                       /* 22-29 oem_name[16] */
+         0,0,0,0,0,0,0,0,
+         0,0,0,0,0,0,0,0
+       },
        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 */



Home | Main Index | Thread Index | Old Index