]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
[PATCH] e1000: Fixed register and loopback test failures with 82573 controllers
authorMalli Chilakala <mallikarjuna.chilakala@intel.com>
Sat, 18 Jun 2005 00:42:29 +0000 (17:42 -0700)
committerJeff Garzik <jgarzik@pobox.com>
Mon, 27 Jun 2005 04:34:25 +0000 (00:34 -0400)
Fixed register and loopback test failures with 82573 controllers

Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>
Signed-off-by: Ganesh Venkatesan <ganesh.venkatesan@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
drivers/net/e1000/e1000_ethtool.c

index b27b71b8834fc60a6f498e40248f9be6063765f0..58a1836f53fd7f048bb9da1435be3e7def9010c4 100644 (file)
@@ -651,6 +651,9 @@ err_setup_rx:
                E1000_WRITE_REG(&adapter->hw, R, (test[pat] & W));             \
                value = E1000_READ_REG(&adapter->hw, R);                       \
                if(value != (test[pat] & W & M)) {                             \
+                       DPRINTK(DRV, ERR, "pattern test reg %04X failed: got " \
+                               "0x%08X expected 0x%08X\n",                    \
+                               E1000_##R, value, (test[pat] & W & M));        \
                        *data = (adapter->hw.mac_type < e1000_82543) ?         \
                                E1000_82542_##R : E1000_##R;                   \
                        return 1;                                              \
@@ -663,7 +666,9 @@ err_setup_rx:
        uint32_t value;                                                        \
        E1000_WRITE_REG(&adapter->hw, R, W & M);                               \
        value = E1000_READ_REG(&adapter->hw, R);                               \
-       if ((W & M) != (value & M)) {                                          \
+       if((W & M) != (value & M)) {                                          \
+               DPRINTK(DRV, ERR, "set/check reg %04X test failed: got 0x%08X "\
+                       "expected 0x%08X\n", E1000_##R, (value & M), (W & M)); \
                *data = (adapter->hw.mac_type < e1000_82543) ?                 \
                        E1000_82542_##R : E1000_##R;                           \
                return 1;                                                      \
@@ -673,18 +678,33 @@ err_setup_rx:
 static int
 e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data)
 {
-       uint32_t value;
-       uint32_t i;
+       uint32_t value, before, after;
+       uint32_t i, toggle;
 
        /* The status register is Read Only, so a write should fail.
         * Some bits that get toggled are ignored.
         */
-       value = (E1000_READ_REG(&adapter->hw, STATUS) & (0xFFFFF833));
-       E1000_WRITE_REG(&adapter->hw, STATUS, (0xFFFFFFFF));
-       if(value != (E1000_READ_REG(&adapter->hw, STATUS) & (0xFFFFF833))) {
+        switch (adapter->hw.mac_type) {
+       case e1000_82573:
+               toggle = 0x7FFFF033;
+               break;
+       default:
+               toggle = 0xFFFFF833;
+               break;
+       }
+
+       before = E1000_READ_REG(&adapter->hw, STATUS);
+       value = (E1000_READ_REG(&adapter->hw, STATUS) & toggle);
+       E1000_WRITE_REG(&adapter->hw, STATUS, toggle);
+       after = E1000_READ_REG(&adapter->hw, STATUS) & toggle;
+       if(value != after) {
+               DPRINTK(DRV, ERR, "failed STATUS register test got: "
+                       "0x%08X expected: 0x%08X\n", after, value);
                *data = 1;
                return 1;
        }
+       /* restore previous status */
+       E1000_WRITE_REG(&adapter->hw, STATUS, before);
 
        REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF);
        REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF);