xref: /dflybsd-src/sys/dev/netif/ig_hal/e1000_nvm.h (revision 01a55482b42bba8de64caeb8c9ede647a9208734)
19c80d176SSepherosa Ziehau /******************************************************************************
29c80d176SSepherosa Ziehau 
3*01a55482SSepherosa Ziehau   Copyright (c) 2001-2019, Intel Corporation
49c80d176SSepherosa Ziehau   All rights reserved.
59c80d176SSepherosa Ziehau 
69c80d176SSepherosa Ziehau   Redistribution and use in source and binary forms, with or without
79c80d176SSepherosa Ziehau   modification, are permitted provided that the following conditions are met:
89c80d176SSepherosa Ziehau 
99c80d176SSepherosa Ziehau    1. Redistributions of source code must retain the above copyright notice,
109c80d176SSepherosa Ziehau       this list of conditions and the following disclaimer.
119c80d176SSepherosa Ziehau 
129c80d176SSepherosa Ziehau    2. Redistributions in binary form must reproduce the above copyright
139c80d176SSepherosa Ziehau       notice, this list of conditions and the following disclaimer in the
149c80d176SSepherosa Ziehau       documentation and/or other materials provided with the distribution.
159c80d176SSepherosa Ziehau 
169c80d176SSepherosa Ziehau    3. Neither the name of the Intel Corporation nor the names of its
179c80d176SSepherosa Ziehau       contributors may be used to endorse or promote products derived from
189c80d176SSepherosa Ziehau       this software without specific prior written permission.
199c80d176SSepherosa Ziehau 
209c80d176SSepherosa Ziehau   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
219c80d176SSepherosa Ziehau   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
229c80d176SSepherosa Ziehau   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
239c80d176SSepherosa Ziehau   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
249c80d176SSepherosa Ziehau   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
259c80d176SSepherosa Ziehau   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
269c80d176SSepherosa Ziehau   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
279c80d176SSepherosa Ziehau   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
289c80d176SSepherosa Ziehau   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
299c80d176SSepherosa Ziehau   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
309c80d176SSepherosa Ziehau   POSSIBILITY OF SUCH DAMAGE.
319c80d176SSepherosa Ziehau 
329c80d176SSepherosa Ziehau ******************************************************************************/
3374dc3754SSepherosa Ziehau /*$FreeBSD$*/
349c80d176SSepherosa Ziehau 
359c80d176SSepherosa Ziehau #ifndef _E1000_NVM_H_
369c80d176SSepherosa Ziehau #define _E1000_NVM_H_
379c80d176SSepherosa Ziehau 
384be59a01SSepherosa Ziehau struct e1000_pba {
394be59a01SSepherosa Ziehau 	u16 word[2];
404be59a01SSepherosa Ziehau 	u16 *pba_block;
414be59a01SSepherosa Ziehau };
424be59a01SSepherosa Ziehau 
434be59a01SSepherosa Ziehau struct e1000_fw_version {
444be59a01SSepherosa Ziehau 	u32 etrack_id;
454be59a01SSepherosa Ziehau 	u16 eep_major;
464be59a01SSepherosa Ziehau 	u16 eep_minor;
47379ebbe7SSepherosa Ziehau 	u16 eep_build;
484be59a01SSepherosa Ziehau 
494be59a01SSepherosa Ziehau 	u8 invm_major;
504be59a01SSepherosa Ziehau 	u8 invm_minor;
514be59a01SSepherosa Ziehau 	u8 invm_img_type;
524be59a01SSepherosa Ziehau 
534be59a01SSepherosa Ziehau 	bool or_valid;
544be59a01SSepherosa Ziehau 	u16 or_major;
554be59a01SSepherosa Ziehau 	u16 or_build;
564be59a01SSepherosa Ziehau 	u16 or_patch;
574be59a01SSepherosa Ziehau };
584be59a01SSepherosa Ziehau 
594be59a01SSepherosa Ziehau 
609c80d176SSepherosa Ziehau void e1000_init_nvm_ops_generic(struct e1000_hw *hw);
619c80d176SSepherosa Ziehau s32  e1000_null_read_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c);
629c80d176SSepherosa Ziehau void e1000_null_nvm_generic(struct e1000_hw *hw);
639c80d176SSepherosa Ziehau s32  e1000_null_led_default(struct e1000_hw *hw, u16 *data);
649c80d176SSepherosa Ziehau s32  e1000_null_write_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c);
659c80d176SSepherosa Ziehau s32  e1000_acquire_nvm_generic(struct e1000_hw *hw);
669c80d176SSepherosa Ziehau 
679c80d176SSepherosa Ziehau s32  e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
689c80d176SSepherosa Ziehau s32  e1000_read_mac_addr_generic(struct e1000_hw *hw);
696a5a645eSSepherosa Ziehau s32  e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
706a5a645eSSepherosa Ziehau 				   u32 pba_num_size);
716a5a645eSSepherosa Ziehau s32  e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size);
724be59a01SSepherosa Ziehau s32 e1000_read_pba_raw(struct e1000_hw *hw, u16 *eeprom_buf,
734be59a01SSepherosa Ziehau 		       u32 eeprom_buf_size, u16 max_pba_block_size,
744be59a01SSepherosa Ziehau 		       struct e1000_pba *pba);
754be59a01SSepherosa Ziehau s32 e1000_write_pba_raw(struct e1000_hw *hw, u16 *eeprom_buf,
764be59a01SSepherosa Ziehau 			u32 eeprom_buf_size, struct e1000_pba *pba);
774be59a01SSepherosa Ziehau s32 e1000_get_pba_block_size(struct e1000_hw *hw, u16 *eeprom_buf,
784be59a01SSepherosa Ziehau 			     u32 eeprom_buf_size, u16 *pba_block_size);
799c80d176SSepherosa Ziehau s32  e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
809c80d176SSepherosa Ziehau s32  e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset,
819c80d176SSepherosa Ziehau 			      u16 words, u16 *data);
829c80d176SSepherosa Ziehau s32  e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words,
839c80d176SSepherosa Ziehau 			 u16 *data);
849c80d176SSepherosa Ziehau s32  e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data);
859c80d176SSepherosa Ziehau s32  e1000_validate_nvm_checksum_generic(struct e1000_hw *hw);
869c80d176SSepherosa Ziehau s32  e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset,
879c80d176SSepherosa Ziehau 			       u16 words, u16 *data);
889c80d176SSepherosa Ziehau s32  e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words,
899c80d176SSepherosa Ziehau 			 u16 *data);
909c80d176SSepherosa Ziehau s32  e1000_update_nvm_checksum_generic(struct e1000_hw *hw);
919c80d176SSepherosa Ziehau void e1000_stop_nvm(struct e1000_hw *hw);
929c80d176SSepherosa Ziehau void e1000_release_nvm_generic(struct e1000_hw *hw);
934be59a01SSepherosa Ziehau void e1000_get_fw_version(struct e1000_hw *hw,
944be59a01SSepherosa Ziehau 			  struct e1000_fw_version *fw_vers);
959c80d176SSepherosa Ziehau 
969c80d176SSepherosa Ziehau #define E1000_STM_OPCODE	0xDB00
979c80d176SSepherosa Ziehau 
989c80d176SSepherosa Ziehau #endif
99