xref: /f-stack/dpdk/drivers/net/igc/base/igc_nvm.h (revision 2d9fd380)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2020 Intel Corporation
3  */
4 
5 #ifndef _IGC_NVM_H_
6 #define _IGC_NVM_H_
7 
8 struct igc_pba {
9 	u16 word[2];
10 	u16 *pba_block;
11 };
12 
13 struct igc_fw_version {
14 	u32 etrack_id;
15 	u16 eep_major;
16 	u16 eep_minor;
17 	u16 eep_build;
18 
19 	u8 invm_major;
20 	u8 invm_minor;
21 	u8 invm_img_type;
22 
23 	bool or_valid;
24 	u16 or_major;
25 	u16 or_build;
26 	u16 or_patch;
27 };
28 
29 
30 void igc_init_nvm_ops_generic(struct igc_hw *hw);
31 s32  igc_null_read_nvm(struct igc_hw *hw, u16 a, u16 b, u16 *c);
32 void igc_null_nvm_generic(struct igc_hw *hw);
33 s32  igc_null_led_default(struct igc_hw *hw, u16 *data);
34 s32  igc_null_write_nvm(struct igc_hw *hw, u16 a, u16 b, u16 *c);
35 s32  igc_acquire_nvm_generic(struct igc_hw *hw);
36 
37 s32  igc_poll_eerd_eewr_done(struct igc_hw *hw, int ee_reg);
38 s32  igc_read_mac_addr_generic(struct igc_hw *hw);
39 s32  igc_read_pba_num_generic(struct igc_hw *hw, u32 *pba_num);
40 s32  igc_read_pba_string_generic(struct igc_hw *hw, u8 *pba_num,
41 				   u32 pba_num_size);
42 s32  igc_read_pba_length_generic(struct igc_hw *hw, u32 *pba_num_size);
43 s32 igc_read_pba_raw(struct igc_hw *hw, u16 *eeprom_buf,
44 		       u32 eeprom_buf_size, u16 max_pba_block_size,
45 		       struct igc_pba *pba);
46 s32 igc_write_pba_raw(struct igc_hw *hw, u16 *eeprom_buf,
47 			u32 eeprom_buf_size, struct igc_pba *pba);
48 s32 igc_get_pba_block_size(struct igc_hw *hw, u16 *eeprom_buf,
49 			     u32 eeprom_buf_size, u16 *pba_block_size);
50 s32  igc_read_nvm_spi(struct igc_hw *hw, u16 offset, u16 words, u16 *data);
51 s32  igc_read_nvm_microwire(struct igc_hw *hw, u16 offset,
52 			      u16 words, u16 *data);
53 s32  igc_read_nvm_eerd(struct igc_hw *hw, u16 offset, u16 words,
54 			 u16 *data);
55 s32  igc_valid_led_default_generic(struct igc_hw *hw, u16 *data);
56 s32  igc_validate_nvm_checksum_generic(struct igc_hw *hw);
57 s32  igc_write_nvm_microwire(struct igc_hw *hw, u16 offset,
58 			       u16 words, u16 *data);
59 s32  igc_write_nvm_spi(struct igc_hw *hw, u16 offset, u16 words,
60 			 u16 *data);
61 s32  igc_update_nvm_checksum_generic(struct igc_hw *hw);
62 void igc_stop_nvm(struct igc_hw *hw);
63 void igc_release_nvm_generic(struct igc_hw *hw);
64 void igc_get_fw_version(struct igc_hw *hw,
65 			  struct igc_fw_version *fw_vers);
66 
67 #define IGC_STM_OPCODE	0xDB00
68 
69 #endif
70