Port the logic from freebsd to em_check_phy_reset_block(). A single
read does not seem to be reliable.
---
 sys/dev/pci/if_em_hw.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git sys/dev/pci/if_em_hw.c sys/dev/pci/if_em_hw.c
index 52d3ee95d15..e5084252c29 100644
--- sys/dev/pci/if_em_hw.c
+++ sys/dev/pci/if_em_hw.c
@@ -9539,9 +9539,18 @@ em_check_phy_reset_block(struct em_hw *hw)
        DEBUGFUNC("em_check_phy_reset_block\n");
 
        if (IS_ICH8(hw->mac_type)) {
-               fwsm = E1000_READ_REG(hw, FWSM);
-               return (fwsm & E1000_FWSM_RSPCIPHY) ? E1000_SUCCESS :
-                   E1000_BLK_PHY_RESET;
+               int i = 0;
+               int blocked = 0;
+               do {
+                       fwsm = E1000_READ_REG(hw, FWSM);
+                       if (!(fwsm & E1000_FWSM_RSPCIPHY)) {
+                               blocked = 1;
+                               msec_delay(10);
+                               continue;
+                       }
+                       blocked = 0;
+               } while (blocked && (i++ < 30));
+               return blocked ? E1000_BLK_PHY_RESET : E1000_SUCCESS;
        }
        if (hw->mac_type > em_82547_rev_2)
                manc = E1000_READ_REG(hw, MANC);
-- 
2.13.0

Reply via email to