#ifndef _ICE_NVM_H_
#define _ICE_NVM_H_
#define ICE_NVM_CMD_READ 0x0000000B
#define ICE_NVM_CMD_WRITE 0x0000000C
#define ICE_NVM_CFG_MODULE_M MAKEMASK(0xFF, 0)
#define ICE_NVM_CFG_MODULE_S 0
#define ICE_NVM_CFG_FLAGS_M MAKEMASK(0xF, 8)
#define ICE_NVM_CFG_FLAGS_S 8
#define ICE_NVM_CFG_EXT_FLAGS_M MAKEMASK(0xF, 12)
#define ICE_NVM_CFG_EXT_FLAGS_S 12
#define ICE_NVM_CFG_ADAPTER_INFO_M MAKEMASK(0xFFFF, 16)
#define ICE_NVM_CFG_ADAPTER_INFO_S 16
#define ICE_NVM_GET_FEATURES_MODULE 0xE
#define ICE_NVM_GET_FEATURES_FLAGS 0xF
#define ICE_NVM_REG_RW_MODULE 0x0
#define ICE_NVM_REG_RW_FLAGS 0x1
#pragma pack(1)
struct ice_orom_civd_info {
u8 signature[4];
u8 checksum;
__le32 combo_ver;
u8 combo_name_len;
__le16 combo_name[32];
};
#pragma pack()
#define ICE_NVM_ACCESS_MAJOR_VER 0
#define ICE_NVM_ACCESS_MINOR_VER 5
#define ICE_NVM_FEATURES_0_REG_ACCESS BIT(1)
struct ice_nvm_features {
u8 major;
u8 minor;
u16 size;
u8 features[12];
};
struct ice_nvm_access_cmd {
u32 command;
u32 config;
u32 offset;
u32 data_size;
};
union ice_nvm_access_data {
u32 regval;
struct ice_nvm_features drv_features;
};
u32 ice_nvm_access_get_module(struct ice_nvm_access_cmd *cmd);
u32 ice_nvm_access_get_flags(struct ice_nvm_access_cmd *cmd);
u32 ice_nvm_access_get_adapter(struct ice_nvm_access_cmd *cmd);
int
ice_nvm_access_read(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,
union ice_nvm_access_data *data);
int
ice_nvm_access_write(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,
union ice_nvm_access_data *data);
int
ice_nvm_access_get_features(struct ice_nvm_access_cmd *cmd,
union ice_nvm_access_data *data);
int
ice_handle_nvm_access(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,
union ice_nvm_access_data *data);
int
ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access);
void ice_release_nvm(struct ice_hw *hw);
int
ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,
void *data, bool last_command, bool read_shadow_ram,
struct ice_sq_cd *cd);
int
ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
bool read_shadow_ram);
int
ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
u16 module_type);
int
ice_get_nvm_minsrevs(struct ice_hw *hw, struct ice_minsrev_info *minsrevs);
int
ice_update_nvm_minsrevs(struct ice_hw *hw, struct ice_minsrev_info *minsrevs);
int
ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom);
int
ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm);
int
ice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netlist_info *netlist);
int
ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);
int ice_init_nvm(struct ice_hw *hw);
int ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);
int ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data);
int
ice_read_sr_buf(struct ice_hw *hw, u16 offset, u16 *words, u16 *data);
int
ice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd);
int
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);
int
ice_aq_read_nvm_cfg(struct ice_hw *hw, u8 cmd_flags, u16 field_id, void *data,
u16 buf_size, u16 *elem_count, struct ice_sq_cd *cd);
int
ice_aq_write_nvm_cfg(struct ice_hw *hw, u8 cmd_flags, void *data, u16 buf_size,
u16 elem_count, struct ice_sq_cd *cd);
int ice_update_sr_checksum(struct ice_hw *hw);
int ice_validate_sr_checksum(struct ice_hw *hw, u16 *checksum);
int ice_nvm_validate_checksum(struct ice_hw *hw);
int ice_nvm_recalculate_checksum(struct ice_hw *hw);
int
ice_nvm_write_activate(struct ice_hw *hw, u16 cmd_flags, u8 *response_flags);
s32 ice_nvm_sanitize_operate(struct ice_hw *hw);
s32 ice_nvm_sanitize(struct ice_hw *hw, u8 cmd_flags, u8 *values);
#endif