2019-10-09 22:09:42 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Copyright (c) 2019, Intel Corporation. */
|
|
|
|
|
|
|
|
#ifndef _ICE_NVM_H_
|
|
|
|
#define _ICE_NVM_H_
|
|
|
|
|
2020-11-12 08:43:30 +08:00
|
|
|
struct ice_orom_civd_info {
|
|
|
|
u8 signature[4]; /* Must match ASCII '$CIV' characters */
|
|
|
|
u8 checksum; /* Simple modulo 256 sum of all structure bytes must equal 0 */
|
|
|
|
__le32 combo_ver; /* Combo Image Version number */
|
|
|
|
u8 combo_name_len; /* Length of the unicode combo image version string, max of 32 */
|
|
|
|
__le16 combo_name[32]; /* Unicode string representing the Combo Image version */
|
|
|
|
} __packed;
|
|
|
|
|
2020-03-12 09:58:14 +08:00
|
|
|
enum ice_status
|
|
|
|
ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access);
|
|
|
|
void ice_release_nvm(struct ice_hw *hw);
|
2020-03-12 09:58:11 +08:00
|
|
|
enum ice_status
|
|
|
|
ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
|
|
|
|
bool read_shadow_ram);
|
2020-03-12 09:58:18 +08:00
|
|
|
enum ice_status
|
2020-07-10 00:16:07 +08:00
|
|
|
ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
|
|
|
|
u16 module_type);
|
|
|
|
enum ice_status
|
2020-11-12 08:43:30 +08:00
|
|
|
ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom);
|
|
|
|
enum ice_status
|
ice: display some stored NVM versions via devlink info
The devlink info interface supports drivers reporting "stored" versions.
These versions indicate the version of an update that has been
downloaded to the device, but is not yet active.
The code for extracting the NVM version recently changed to enable
support for reading from either the active or the inactive bank. Use
this to implement ice_get_inactive_nvm_ver, which will read the NVM
version data from the inactive section of flash.
When reporting the versions via devlink info, first read the device
capabilities. Determine if there is a pending flash update, and if so,
extract relevant version information from the inactive flash. Store
these within the info context structure.
When reporting "stored" firmware versions, devlink documentation
indicates that we ought to always report a stored value, even if there
is no pending update. In this common case, the stored version should
match the running version. This means that each stored version should by
default fallback to the same value as reported by the running handler.
To support this, modify the version structure to have both a "getter"
and a "fallback". Modify the control loop so that it will use the
"fallback" function if the "getter" function does not report a version.
To report versions for which we can read the stored value, use a new
"stored()" macro. This macro will insert two entries into the version
list. The first entry is the traditional running version. The second is
the stored version, implemented with a fallback to the active version.
This is a little tricky, but reduces the overall duplication of elements
in the entry list, and ensures that running and stored values remain
consistent.
To avoid some duplication, add a combined() macro that will insert both
the running and stored versions into the version entry list.
Using this new support, add pending version reporter functions for
"fw.psid.api" and "fw.bundle_id". This enables reporting the stored
values for some of versions in the NVM module of the flash.
Reporting management versions is not implemented by this patch. The
active management version is reported to the driver via the AdminQ
mailbox during load. Although the version must be in the firmware binary
somewhere, accessing this from the inactive firmware is not trivial and
has not been implemented in this change.
Future changes will introduce support for reading the UNDI Option ROM
version and the version associated with the Netlist module.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-11-12 08:43:28 +08:00
|
|
|
ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm);
|
|
|
|
enum ice_status
|
2020-11-12 08:43:29 +08:00
|
|
|
ice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netlist_info *netlist);
|
|
|
|
enum ice_status
|
2020-03-12 09:58:18 +08:00
|
|
|
ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);
|
2020-03-12 09:58:14 +08:00
|
|
|
enum ice_status ice_init_nvm(struct ice_hw *hw);
|
2020-07-10 00:16:03 +08:00
|
|
|
enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);
|
2020-07-24 08:22:01 +08:00
|
|
|
enum ice_status
|
|
|
|
ice_aq_update_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset,
|
|
|
|
u16 length, void *data, bool last_command, u8 command_flags,
|
|
|
|
struct ice_sq_cd *cd);
|
|
|
|
enum ice_status
|
|
|
|
ice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd);
|
|
|
|
enum ice_status ice_nvm_validate_checksum(struct ice_hw *hw);
|
|
|
|
enum ice_status ice_nvm_write_activate(struct ice_hw *hw, u8 cmd_flags);
|
|
|
|
enum ice_status ice_aq_nvm_update_empr(struct ice_hw *hw);
|
|
|
|
enum ice_status
|
|
|
|
ice_nvm_set_pkg_data(struct ice_hw *hw, bool del_pkg_data_flag, u8 *data,
|
|
|
|
u16 length, struct ice_sq_cd *cd);
|
|
|
|
enum ice_status
|
|
|
|
ice_nvm_pass_component_tbl(struct ice_hw *hw, u8 *data, u16 length,
|
|
|
|
u8 transfer_flag, u8 *comp_response,
|
|
|
|
u8 *comp_response_code, struct ice_sq_cd *cd);
|
2019-10-09 22:09:42 +08:00
|
|
|
#endif /* _ICE_NVM_H_ */
|