mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
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@intel.com> Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
committed by
Jeff Kirsher
parent
d4e874448e
commit
81f07491e2
@@ -1232,6 +1232,7 @@ struct ice_aqc_sff_eeprom {
|
||||
* NVM Update commands (indirect 0x0703)
|
||||
*/
|
||||
struct ice_aqc_nvm {
|
||||
#define ICE_AQC_NVM_MAX_OFFSET 0xFFFFFF
|
||||
__le16 offset_low;
|
||||
u8 offset_high;
|
||||
u8 cmd_flags;
|
||||
@@ -1766,6 +1767,7 @@ enum ice_aq_err {
|
||||
ICE_AQ_RC_ENOMEM = 9, /* Out of memory */
|
||||
ICE_AQ_RC_EBUSY = 12, /* Device or resource busy */
|
||||
ICE_AQ_RC_EEXIST = 13, /* Object already exists */
|
||||
ICE_AQ_RC_EINVAL = 14, /* Invalid argument */
|
||||
ICE_AQ_RC_ENOSPC = 16, /* No space left or allocation failure */
|
||||
ICE_AQ_RC_ENOSYS = 17, /* Function not implemented */
|
||||
ICE_AQ_RC_ENOSEC = 24, /* Missing security manifest */
|
||||
|
||||
Reference in New Issue
Block a user