From: Sasha Neftin <sasha.nef...@intel.com>

When reading NVM checksum, we may encounter the following scenarios:

- Checksum may be invalid, and can be updated
- Checksum may be invalid but cannot be updated because NVM is read-only

For the latter case, we should just ignore invalid checksum and not attempt
to update it.

Signed-off-by: Sasha Neftin <sasha.nef...@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.bura...@intel.com>
---
 drivers/net/intel/e1000/base/e1000_ich8lan.c | 24 ++++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/net/intel/e1000/base/e1000_ich8lan.c 
b/drivers/net/intel/e1000/base/e1000_ich8lan.c
index da36d4c098..77c403fa80 100644
--- a/drivers/net/intel/e1000/base/e1000_ich8lan.c
+++ b/drivers/net/intel/e1000/base/e1000_ich8lan.c
@@ -4364,13 +4364,23 @@ STATIC s32 e1000_validate_nvm_checksum_ich8lan(struct 
e1000_hw *hw)
                return ret_val;
 
        if (!(data & valid_csum_mask)) {
-               data |= valid_csum_mask;
-               ret_val = hw->nvm.ops.write(hw, word, 1, &data);
-               if (ret_val)
-                       return ret_val;
-               ret_val = hw->nvm.ops.update(hw);
-               if (ret_val)
-                       return ret_val;
+               DEBUGOUT("NVM checksum valid bit not set");
+
+               if (hw->mac.type < e1000_pch_tgp) {
+                       data |= valid_csum_mask;
+                       ret_val = hw->nvm.ops.write(hw, word, 1, &data);
+                       if (ret_val)
+                               return ret_val;
+                       ret_val = hw->nvm.ops.update(hw);
+                       if (ret_val)
+                               return ret_val;
+               } else if (hw->mac.type == e1000_pch_tgp) {
+                       /* Tiger Lake systems may have uninitialized NVM
+                        * checksum. Since the NVM cannot be updated by
+                        * software, do not validate the checksum.
+                        */
+                       return E1000_SUCCESS;
+               }
        }
 
        return e1000_validate_nvm_checksum_generic(hw);
-- 
2.43.5

Reply via email to