Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Check the hardware config words and print them. ...



details:   https://anonhg.NetBSD.org/src/rev/d14af0dd71d8
branches:  trunk
changeset: 786730:d14af0dd71d8
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed May 08 04:05:46 2013 +0000

description:
Check the hardware config words and print them. This change only read them
and print the values.

diffstat:

 sys/dev/pci/if_bge.c    |  50 +++++++++++++++++++++++++++++++++---------------
 sys/dev/pci/if_bgereg.h |  10 ++++++++-
 2 files changed, 43 insertions(+), 17 deletions(-)

diffs (130 lines):

diff -r 9c238b70df5d -r d14af0dd71d8 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Wed May 08 03:13:35 2013 +0000
+++ b/sys/dev/pci/if_bge.c      Wed May 08 04:05:46 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.240 2013/05/08 03:13:35 msaitoh Exp $     */
+/*     $NetBSD: if_bge.c,v 1.241 2013/05/08 04:05:46 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.240 2013/05/08 03:13:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.241 2013/05/08 04:05:46 msaitoh Exp $");
 
 #include "vlan.h"
 
@@ -3260,7 +3260,7 @@
        pci_chipset_tag_t       pc;
        pci_intr_handle_t       ih;
        const char              *intrstr = NULL;
-       uint32_t                hwcfg = 0;
+       uint32_t                hwcfg, hwcfg2, hwcfg3, hwcfg4;
        uint32_t                command;
        struct ifnet            *ifp;
        uint32_t                misccfg;
@@ -3593,6 +3593,33 @@
                }
        }
 
+       /*
+        * Read the hardware config word in the first 32k of NIC internal
+        * memory, or fall back to the config word in the EEPROM.
+        * Note: on some BCM5700 cards, this value appears to be unset.
+        */
+       hwcfg = hwcfg2 = hwcfg3 = hwcfg4 = 0;
+       if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) ==
+           BGE_SRAM_DATA_SIG_MAGIC) {
+               uint32_t tmp;
+
+               hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG);
+               tmp = bge_readmem_ind(sc, BGE_SRAM_DATA_VER) >>
+                   BGE_SRAM_DATA_VER_SHIFT;
+               if ((0 < tmp) && (tmp < 0x100))
+                       hwcfg2 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_2);
+               if (sc->bge_flags & BGE_PCIE)
+                       hwcfg3 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_3);
+               if (BGE_ASICREV(sc->bge_chipid == BGE_ASICREV_BCM5785))
+                       hwcfg4 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_4);
+       } else if (!(sc->bge_flags & BGE_NO_EEPROM)) {
+               bge_read_eeprom(sc, (void *)&hwcfg,
+                   BGE_EE_HWCFG_OFFSET, sizeof(hwcfg));
+               hwcfg = be32toh(hwcfg);
+       }
+       aprint_normal_dev(sc->bge_dev, "HW config %08x, %08x, %08x, %08x\n",
+           hwcfg, hwcfg2, hwcfg3, hwcfg4);
+
 #if 0
        /*
         * Reset NVRAM before bge_reset(). It's required to acquire NVRAM
@@ -3758,20 +3785,11 @@
 
        /*
         * Figure out what sort of media we have by checking the hardware
-        * config word in the first 32k of NIC internal memory, or fall back to
-        * the config word in the EEPROM. Note: on some BCM5700 cards,
-        * this value appears to be unset. If that's the case, we have to rely
-        * on identifying the NIC by its PCI subsystem ID, as we do below for
-        * the SysKonnect SK-9D41.
+        * config word.  Note: on some BCM5700 cards, this value appears to be
+        * unset. If that's the case, we have to rely on identifying the NIC
+        * by its PCI subsystem ID, as we do below for the SysKonnect SK-9D41.
+        * The SysKonnect SK-9D41 is a 1000baseSX card.
         */
-       if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == BGE_SRAM_DATA_SIG_MAGIC) {
-               hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG);
-       } else if (!(sc->bge_flags & BGE_NO_EEPROM)) {
-               bge_read_eeprom(sc, (void *)&hwcfg,
-                   BGE_EE_HWCFG_OFFSET, sizeof(hwcfg));
-               hwcfg = be32toh(hwcfg);
-       }
-       /* The SysKonnect SK-9D41 is a 1000baseSX card. */
        if (PCI_PRODUCT(pa->pa_id) == SK_SUBSYSID_9D41 ||
            (hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) {
                if (BGE_IS_5714_FAMILY(sc))
diff -r 9c238b70df5d -r d14af0dd71d8 sys/dev/pci/if_bgereg.h
--- a/sys/dev/pci/if_bgereg.h   Wed May 08 03:13:35 2013 +0000
+++ b/sys/dev/pci/if_bgereg.h   Wed May 08 04:05:46 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bgereg.h,v 1.75 2013/04/21 19:59:40 msaitoh Exp $   */
+/*     $NetBSD: if_bgereg.h,v 1.76 2013/05/08 04:05:46 msaitoh Exp $   */
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -75,12 +75,16 @@
 #define        BGE_SRAM_FW_MB                  0x00000B50
 #define        BGE_SRAM_DATA_SIG               0x00000B54
 #define        BGE_SRAM_DATA_CFG               0x00000B58
+#define        BGE_SRAM_DATA_VER               0x00000B5C
 #define        BGE_SRAM_FW_CMD_MB              0x00000B78
 #define        BGE_SRAM_FW_CMD_LEN_MB          0x00000B7C
 #define        BGE_SRAM_FW_CMD_DATA_MB         0x00000B80
 #define        BGE_SRAM_FW_DRV_STATE_MB        0x00000C04
 #define        BGE_SRAM_MAC_ADDR_HIGH_MB       0x00000C14
 #define        BGE_SRAM_MAC_ADDR_LOW_MB        0x00000C18
+#define        BGE_SRAM_DATA_CFG_2             0x00000D38
+#define        BGE_SRAM_DATA_CFG_3             0x00000D3C
+#define        BGE_SRAM_DATA_CFG_4             0x00000D60
 #define BGE_SOFTWARE_GENCOMM_END       0x00000FFF
 #define BGE_UNMAPPED                   0x00001000
 #define BGE_UNMAPPED_END               0x00001FFF
@@ -104,6 +108,9 @@
 #define        BGE_FW_DRV_STATE_UNLOAD_DONE    0x80000002
 #define        BGE_FW_DRV_STATE_SUSPEND        0x00000004
 
+/* SRAM data version */
+#define        BGE_SRAM_DATA_VER_SHIFT         16
+
 /* Mappings for internal memory configuration */
 #define BGE_STD_RX_RINGS               0x00006000
 #define BGE_STD_RX_RINGS_END           0x00006FFF
@@ -2361,6 +2368,7 @@
 #define BGE_HWCFG_PHYLED_MODE          0x0000000C
 #define BGE_HWCFG_MEDIA                        0x00000030
 #define        BGE_HWCFG_ASF                   0x00000080
+#define        BGE_HWCFG_EEPROM_WP             0x00000100
 
 #define BGE_VOLTAGE_1POINT3            0x00000000
 #define BGE_VOLTAGE_1POINT8            0x00000001



Home | Main Index | Thread Index | Old Index