162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright (c) 2019, Intel Corporation. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef _ICE_NVM_H_
562306a36Sopenharmony_ci#define _ICE_NVM_H_
662306a36Sopenharmony_ci
762306a36Sopenharmony_cistruct ice_orom_civd_info {
862306a36Sopenharmony_ci	u8 signature[4];	/* Must match ASCII '$CIV' characters */
962306a36Sopenharmony_ci	u8 checksum;		/* Simple modulo 256 sum of all structure bytes must equal 0 */
1062306a36Sopenharmony_ci	__le32 combo_ver;	/* Combo Image Version number */
1162306a36Sopenharmony_ci	u8 combo_name_len;	/* Length of the unicode combo image version string, max of 32 */
1262306a36Sopenharmony_ci	__le16 combo_name[32];	/* Unicode string representing the Combo Image version */
1362306a36Sopenharmony_ci} __packed;
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciint ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access);
1662306a36Sopenharmony_civoid ice_release_nvm(struct ice_hw *hw);
1762306a36Sopenharmony_ciint
1862306a36Sopenharmony_ciice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
1962306a36Sopenharmony_ci		  bool read_shadow_ram);
2062306a36Sopenharmony_ciint
2162306a36Sopenharmony_ciice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
2262306a36Sopenharmony_ci		       u16 module_type);
2362306a36Sopenharmony_ciint ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom);
2462306a36Sopenharmony_ciint ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm);
2562306a36Sopenharmony_ciint
2662306a36Sopenharmony_ciice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netlist_info *netlist);
2762306a36Sopenharmony_ciint ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);
2862306a36Sopenharmony_ciint ice_init_nvm(struct ice_hw *hw);
2962306a36Sopenharmony_ciint ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);
3062306a36Sopenharmony_ciint
3162306a36Sopenharmony_ciice_aq_update_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset,
3262306a36Sopenharmony_ci		  u16 length, void *data, bool last_command, u8 command_flags,
3362306a36Sopenharmony_ci		  struct ice_sq_cd *cd);
3462306a36Sopenharmony_ciint
3562306a36Sopenharmony_ciice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd);
3662306a36Sopenharmony_ciint ice_nvm_validate_checksum(struct ice_hw *hw);
3762306a36Sopenharmony_ciint ice_nvm_write_activate(struct ice_hw *hw, u16 cmd_flags, u8 *response_flags);
3862306a36Sopenharmony_ciint ice_aq_nvm_update_empr(struct ice_hw *hw);
3962306a36Sopenharmony_ciint
4062306a36Sopenharmony_ciice_nvm_set_pkg_data(struct ice_hw *hw, bool del_pkg_data_flag, u8 *data,
4162306a36Sopenharmony_ci		     u16 length, struct ice_sq_cd *cd);
4262306a36Sopenharmony_ciint
4362306a36Sopenharmony_ciice_nvm_pass_component_tbl(struct ice_hw *hw, u8 *data, u16 length,
4462306a36Sopenharmony_ci			   u8 transfer_flag, u8 *comp_response,
4562306a36Sopenharmony_ci			   u8 *comp_response_code, struct ice_sq_cd *cd);
4662306a36Sopenharmony_ci#endif /* _ICE_NVM_H_ */
47