175eba5b6SRobert Mustacchi /******************************************************************************
275eba5b6SRobert Mustacchi 
3*49b78600SRobert Mustacchi   Copyright (c) 2001-2015, Intel Corporation
475eba5b6SRobert Mustacchi   All rights reserved.
575eba5b6SRobert Mustacchi 
675eba5b6SRobert Mustacchi   Redistribution and use in source and binary forms, with or without
775eba5b6SRobert Mustacchi   modification, are permitted provided that the following conditions are met:
875eba5b6SRobert Mustacchi 
975eba5b6SRobert Mustacchi    1. Redistributions of source code must retain the above copyright notice,
1075eba5b6SRobert Mustacchi       this list of conditions and the following disclaimer.
1175eba5b6SRobert Mustacchi 
1275eba5b6SRobert Mustacchi    2. Redistributions in binary form must reproduce the above copyright
1375eba5b6SRobert Mustacchi       notice, this list of conditions and the following disclaimer in the
1475eba5b6SRobert Mustacchi       documentation and/or other materials provided with the distribution.
1575eba5b6SRobert Mustacchi 
1675eba5b6SRobert Mustacchi    3. Neither the name of the Intel Corporation nor the names of its
1775eba5b6SRobert Mustacchi       contributors may be used to endorse or promote products derived from
1875eba5b6SRobert Mustacchi       this software without specific prior written permission.
1975eba5b6SRobert Mustacchi 
2075eba5b6SRobert Mustacchi   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2175eba5b6SRobert Mustacchi   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2275eba5b6SRobert Mustacchi   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2375eba5b6SRobert Mustacchi   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2475eba5b6SRobert Mustacchi   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2575eba5b6SRobert Mustacchi   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2675eba5b6SRobert Mustacchi   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2775eba5b6SRobert Mustacchi   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2875eba5b6SRobert Mustacchi   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2975eba5b6SRobert Mustacchi   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3075eba5b6SRobert Mustacchi   POSSIBILITY OF SUCH DAMAGE.
3175eba5b6SRobert Mustacchi 
3275eba5b6SRobert Mustacchi ******************************************************************************/
3375eba5b6SRobert Mustacchi /*$FreeBSD$*/
3475eba5b6SRobert Mustacchi 
3575eba5b6SRobert Mustacchi #ifndef _E1000_NVM_H_
3675eba5b6SRobert Mustacchi #define _E1000_NVM_H_
3775eba5b6SRobert Mustacchi 
3875eba5b6SRobert Mustacchi struct e1000_pba {
3975eba5b6SRobert Mustacchi 	u16 word[2];
4075eba5b6SRobert Mustacchi 	u16 *pba_block;
4175eba5b6SRobert Mustacchi };
4275eba5b6SRobert Mustacchi 
4375eba5b6SRobert Mustacchi 
4475eba5b6SRobert Mustacchi void e1000_init_nvm_ops_generic(struct e1000_hw *hw);
4575eba5b6SRobert Mustacchi s32  e1000_null_read_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c);
4675eba5b6SRobert Mustacchi void e1000_null_nvm_generic(struct e1000_hw *hw);
4775eba5b6SRobert Mustacchi s32  e1000_null_led_default(struct e1000_hw *hw, u16 *data);
4875eba5b6SRobert Mustacchi s32  e1000_null_write_nvm(struct e1000_hw *hw, u16 a, u16 b, u16 *c);
4975eba5b6SRobert Mustacchi s32  e1000_acquire_nvm_generic(struct e1000_hw *hw);
5075eba5b6SRobert Mustacchi 
5175eba5b6SRobert Mustacchi s32  e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
5275eba5b6SRobert Mustacchi s32  e1000_read_mac_addr_generic(struct e1000_hw *hw);
5375eba5b6SRobert Mustacchi s32  e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
5475eba5b6SRobert Mustacchi 				   u32 pba_num_size);
5575eba5b6SRobert Mustacchi s32  e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size);
5675eba5b6SRobert Mustacchi s32 e1000_read_pba_raw(struct e1000_hw *hw, u16 *eeprom_buf,
5775eba5b6SRobert Mustacchi 		       u32 eeprom_buf_size, u16 max_pba_block_size,
5875eba5b6SRobert Mustacchi 		       struct e1000_pba *pba);
5975eba5b6SRobert Mustacchi s32 e1000_write_pba_raw(struct e1000_hw *hw, u16 *eeprom_buf,
6075eba5b6SRobert Mustacchi 			u32 eeprom_buf_size, struct e1000_pba *pba);
6175eba5b6SRobert Mustacchi s32 e1000_get_pba_block_size(struct e1000_hw *hw, u16 *eeprom_buf,
6275eba5b6SRobert Mustacchi 			     u32 eeprom_buf_size, u16 *pba_block_size);
6375eba5b6SRobert Mustacchi s32  e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
6475eba5b6SRobert Mustacchi s32  e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset,
6575eba5b6SRobert Mustacchi 			      u16 words, u16 *data);
6675eba5b6SRobert Mustacchi s32  e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words,
6775eba5b6SRobert Mustacchi 			 u16 *data);
6875eba5b6SRobert Mustacchi s32  e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data);
6975eba5b6SRobert Mustacchi s32  e1000_validate_nvm_checksum_generic(struct e1000_hw *hw);
7075eba5b6SRobert Mustacchi s32  e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset,
7175eba5b6SRobert Mustacchi 			       u16 words, u16 *data);
7275eba5b6SRobert Mustacchi s32  e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words,
7375eba5b6SRobert Mustacchi 			 u16 *data);
7475eba5b6SRobert Mustacchi s32  e1000_update_nvm_checksum_generic(struct e1000_hw *hw);
7575eba5b6SRobert Mustacchi void e1000_stop_nvm(struct e1000_hw *hw);
7675eba5b6SRobert Mustacchi void e1000_release_nvm_generic(struct e1000_hw *hw);
7775eba5b6SRobert Mustacchi 
7875eba5b6SRobert Mustacchi #define E1000_STM_OPCODE	0xDB00
7975eba5b6SRobert Mustacchi 
8075eba5b6SRobert Mustacchi #endif
81