1031f2147SMd Fahad Iqbal Polash /* SPDX-License-Identifier: GPL-2.0 */
2031f2147SMd Fahad Iqbal Polash /* Copyright (c) 2019, Intel Corporation. */
3031f2147SMd Fahad Iqbal Polash 
4031f2147SMd Fahad Iqbal Polash #ifndef _ICE_NVM_H_
5031f2147SMd Fahad Iqbal Polash #define _ICE_NVM_H_
6031f2147SMd Fahad Iqbal Polash 
7e67fbcfbSJacob Keller struct ice_orom_civd_info {
8e67fbcfbSJacob Keller 	u8 signature[4];	/* Must match ASCII '$CIV' characters */
9e67fbcfbSJacob Keller 	u8 checksum;		/* Simple modulo 256 sum of all structure bytes must equal 0 */
10e67fbcfbSJacob Keller 	__le32 combo_ver;	/* Combo Image Version number */
11e67fbcfbSJacob Keller 	u8 combo_name_len;	/* Length of the unicode combo image version string, max of 32 */
12e67fbcfbSJacob Keller 	__le16 combo_name[32];	/* Unicode string representing the Combo Image version */
13e67fbcfbSJacob Keller } __packed;
14e67fbcfbSJacob Keller 
155518ac2aSTony Nguyen int ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access);
1684a24798SJesse Brandeburg void ice_release_nvm(struct ice_hw *hw);
175e24d598STony Nguyen int
18e9450990SJacob Keller ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
19e9450990SJacob Keller 		  bool read_shadow_ram);
205e24d598STony Nguyen int
21ea78ce4dSPaul Greenwalt ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
22ea78ce4dSPaul Greenwalt 		       u16 module_type);
235518ac2aSTony Nguyen int ice_get_inactive_orom_ver(struct ice_hw *hw, struct ice_orom_info *orom);
245518ac2aSTony Nguyen int ice_get_inactive_nvm_ver(struct ice_hw *hw, struct ice_nvm_info *nvm);
255e24d598STony Nguyen int
26e120a9abSJacob Keller ice_get_inactive_netlist_ver(struct ice_hw *hw, struct ice_netlist_info *netlist);
275518ac2aSTony Nguyen int ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);
285e24d598STony Nguyen int ice_init_nvm(struct ice_hw *hw);
295e24d598STony Nguyen int ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);
305e24d598STony Nguyen int
31544cd2acSCudzilo, Szymon T ice_aq_update_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset,
32544cd2acSCudzilo, Szymon T 		  u16 length, void *data, bool last_command, u8 command_flags,
33544cd2acSCudzilo, Szymon T 		  struct ice_sq_cd *cd);
345e24d598STony Nguyen int
35544cd2acSCudzilo, Szymon T ice_aq_erase_nvm(struct ice_hw *hw, u16 module_typeid, struct ice_sq_cd *cd);
365e24d598STony Nguyen int ice_nvm_validate_checksum(struct ice_hw *hw);
37*da02ee9cSJacob Keller int ice_nvm_write_activate(struct ice_hw *hw, u16 cmd_flags, u8 *response_flags);
385e24d598STony Nguyen int ice_aq_nvm_update_empr(struct ice_hw *hw);
395e24d598STony Nguyen int
40544cd2acSCudzilo, Szymon T ice_nvm_set_pkg_data(struct ice_hw *hw, bool del_pkg_data_flag, u8 *data,
41544cd2acSCudzilo, Szymon T 		     u16 length, struct ice_sq_cd *cd);
425e24d598STony Nguyen int
43544cd2acSCudzilo, Szymon T ice_nvm_pass_component_tbl(struct ice_hw *hw, u8 *data, u16 length,
44544cd2acSCudzilo, Szymon T 			   u8 transfer_flag, u8 *comp_response,
45544cd2acSCudzilo, Szymon T 			   u8 *comp_response_code, struct ice_sq_cd *cd);
46031f2147SMd Fahad Iqbal Polash #endif /* _ICE_NVM_H_ */
47