e1000/base: various changes
authorJijiang Liu <jijiang.liu@intel.com>
Wed, 18 Jun 2014 12:30:20 +0000 (14:30 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 18 Jun 2014 21:30:34 +0000 (23:30 +0200)
Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
[Thomas: split code drop]

lib/librte_pmd_e1000/e1000/e1000_ich8lan.c
lib/librte_pmd_e1000/e1000/e1000_ich8lan.h
lib/librte_pmd_e1000/e1000/e1000_mac.c
lib/librte_pmd_e1000/e1000/e1000_mac.h
lib/librte_pmd_e1000/e1000/e1000_nvm.c
lib/librte_pmd_e1000/e1000/e1000_phy.c

index 22cc01d..837ab2d 100644 (file)
@@ -1761,7 +1761,7 @@ STATIC void e1000_rar_set_pch2lan(struct e1000_hw *hw, u8 *addr, u32 index)
        /* RAR[1-6] are owned by manageability.  Skip those and program the
         * next address into the SHRA register array.
         */
-       if (index < (u32) (hw->mac.rar_entry_count - 6)) {
+       if (index < (u32) (hw->mac.rar_entry_count)) {
                s32 ret_val;
 
                ret_val = e1000_acquire_swflag_ich8lan(hw);
@@ -3745,8 +3745,7 @@ STATIC s32 e1000_write_flash_data_ich8lan(struct e1000_hw *hw, u32 offset,
 
        DEBUGFUNC("e1000_write_ich8_data");
 
-       if (size < 1 || size > 2 || data > size * 0xff ||
-           offset > ICH_FLASH_LINEAR_ADDR_MASK)
+       if (size < 1 || size > 2 || offset > ICH_FLASH_LINEAR_ADDR_MASK)
                return -E1000_ERR_NVM;
 
        flash_linear_addr = ((ICH_FLASH_LINEAR_ADDR_MASK & offset) +
index 44c2cd2..ced4550 100644 (file)
@@ -122,7 +122,7 @@ POSSIBILITY OF SUCH DAMAGE.
 #define PCIE_ICH8_SNOOP_ALL    PCIE_NO_SNOOP_ALL
 
 #define E1000_ICH_RAR_ENTRIES  7
-#define E1000_PCH2_RAR_ENTRIES 11 /* RAR[0-6], SHRA[0-3] */
+#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */
 #define E1000_PCH_LPT_RAR_ENTRIES      12 /* RAR[0], SHRA[0-10] */
 
 #define PHY_PAGE_SHIFT         5
index 1028fd2..8668904 100644 (file)
@@ -2091,7 +2091,8 @@ s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw)
 
        while (timeout) {
                if (!(E1000_READ_REG(hw, E1000_STATUS) &
-                     E1000_STATUS_GIO_MASTER_ENABLE))
+                     E1000_STATUS_GIO_MASTER_ENABLE) ||
+                               E1000_REMOVED(hw->hw_addr))
                        break;
                usec_delay(100);
                timeout--;
index c4c6b04..62512f0 100644 (file)
@@ -35,6 +35,9 @@ POSSIBILITY OF SUCH DAMAGE.
 #define _E1000_MAC_H_
 
 void e1000_init_mac_ops_generic(struct e1000_hw *hw);
+#ifndef E1000_REMOVED
+#define E1000_REMOVED(a) (0)
+#endif /* E1000_REMOVED */
 void e1000_null_mac_generic(struct e1000_hw *hw);
 s32  e1000_null_ops_generic(struct e1000_hw *hw);
 s32  e1000_null_link_info(struct e1000_hw *hw, u16 *s, u16 *d);
index 54c017d..77bd500 100644 (file)
@@ -1023,7 +1023,7 @@ s32 e1000_read_pba_raw(struct e1000_hw *hw, u16 *eeprom_buf,
                                return ret_val;
                } else {
                        if (eeprom_buf_size > (u32)(pba->word[1] +
-                                             pba->pba_block[0])) {
+                                             pba_block_size)) {
                                memcpy(pba->pba_block,
                                       &eeprom_buf[pba->word[1]],
                                       pba_block_size * sizeof(u16));
index 02c1f51..a8063cd 100644 (file)
@@ -2368,19 +2368,23 @@ s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
                 * it across the board.
                 */
                ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
-               if (ret_val)
+               if (ret_val) {
                        /* If the first read fails, another entity may have
                         * ownership of the resources, wait and try again to
                         * see if they have relinquished the resources yet.
                         */
-                       usec_delay(usec_interval);
+                       if (usec_interval >= 1000)
+                               msec_delay(usec_interval/1000);
+                       else
+                               usec_delay(usec_interval);
+               }
                ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
                if (ret_val)
                        break;
                if (phy_status & MII_SR_LINK_STATUS)
                        break;
                if (usec_interval >= 1000)
-                       msec_delay_irq(usec_interval/1000);
+                       msec_delay(usec_interval/1000);
                else
                        usec_delay(usec_interval);
        }