[Intel-wired-lan] [PATCH v3 4/9] ice: discover and store size of available flash

Bowers, AndrewX andrewx.bowers at intel.com
Mon Mar 16 19:21:28 UTC 2020

-----Original Message-----
From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <intel-wired-lan at lists.osuosl.org>
Cc: Jakub Kicinski <kuba at kernel.org>
Subject: [Intel-wired-lan] [PATCH v3 4/9] ice: discover and store size of available flash

When reading from the NVM using a flat address, it is useful to know the upper bound on the size of the flash contents. This value is not stored within the NVM.

We can determine the size by performing a bisection between upper and lower bounds. It is known that the size cannot exceed 16 MB (offset of 0xFFFFFF).

Use a while loop to bisect the upper and lower bounds by reading one byte at a time. On a failed read, lower the maximum bound. On a successful read, increase the lower bound.

Save this as the flash_size in the ice_nvm_info structure that contains data related to the NVM.

The size will be used in a future patch for implementing full NVM read via ethtool's GEEPROM command.

The maximum possible size for the flash is bounded by the size limit for the NVM AdminQ commands. Add a new macro, ICE_AQC_NVM_MAX_OFFSET, which can be used to represent this upper bound.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg at intel.com>
 .../net/ethernet/intel/ice/ice_adminq_cmd.h   |  2 +
 drivers/net/ethernet/intel/ice/ice_nvm.c      | 62 ++++++++++++++++++-
 drivers/net/ethernet/intel/ice/ice_type.h     |  1 +
 3 files changed, 63 insertions(+), 2 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers at intel.com>

More information about the Intel-wired-lan mailing list