xref: /freebsd/sys/dev/ixgbe/ixgbe_common.h (revision 85d0a26e)
19ca4041bSJack F Vogel /******************************************************************************
213705f88SJack F Vogel 
385d0a26eSJack F Vogel   Copyright (c) 2001-2012, Intel Corporation
413705f88SJack F Vogel   All rights reserved.
513705f88SJack F Vogel 
613705f88SJack F Vogel   Redistribution and use in source and binary forms, with or without
713705f88SJack F Vogel   modification, are permitted provided that the following conditions are met:
813705f88SJack F Vogel 
913705f88SJack F Vogel    1. Redistributions of source code must retain the above copyright notice,
1013705f88SJack F Vogel       this list of conditions and the following disclaimer.
1113705f88SJack F Vogel 
1213705f88SJack F Vogel    2. Redistributions in binary form must reproduce the above copyright
1313705f88SJack F Vogel       notice, this list of conditions and the following disclaimer in the
1413705f88SJack F Vogel       documentation and/or other materials provided with the distribution.
1513705f88SJack F Vogel 
1613705f88SJack F Vogel    3. Neither the name of the Intel Corporation nor the names of its
1713705f88SJack F Vogel       contributors may be used to endorse or promote products derived from
1813705f88SJack F Vogel       this software without specific prior written permission.
1913705f88SJack F Vogel 
2013705f88SJack F Vogel   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2113705f88SJack F Vogel   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2213705f88SJack F Vogel   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2313705f88SJack F Vogel   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2413705f88SJack F Vogel   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2513705f88SJack F Vogel   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2613705f88SJack F Vogel   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2713705f88SJack F Vogel   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2813705f88SJack F Vogel   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2913705f88SJack F Vogel   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3013705f88SJack F Vogel   POSSIBILITY OF SUCH DAMAGE.
3113705f88SJack F Vogel 
329ca4041bSJack F Vogel ******************************************************************************/
3313705f88SJack F Vogel /*$FreeBSD$*/
3413705f88SJack F Vogel 
3513705f88SJack F Vogel #ifndef _IXGBE_COMMON_H_
3613705f88SJack F Vogel #define _IXGBE_COMMON_H_
3713705f88SJack F Vogel 
3813705f88SJack F Vogel #include "ixgbe_type.h"
390ac6dfecSJack F Vogel #define IXGBE_WRITE_REG64(hw, reg, value) \
400ac6dfecSJack F Vogel 	do { \
410ac6dfecSJack F Vogel 		IXGBE_WRITE_REG(hw, reg, (u32) value); \
420ac6dfecSJack F Vogel 		IXGBE_WRITE_REG(hw, reg + 4, (u32) (value >> 32)); \
430ac6dfecSJack F Vogel 	} while (0)
4413705f88SJack F Vogel 
452969bf0eSJack F Vogel u32 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw);
462969bf0eSJack F Vogel 
479ca4041bSJack F Vogel s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw);
4813705f88SJack F Vogel s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw);
4913705f88SJack F Vogel s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw);
501a4e3449SJack F Vogel s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw);
5113705f88SJack F Vogel s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw);
529ca4041bSJack F Vogel s32 ixgbe_read_pba_num_generic(struct ixgbe_hw *hw, u32 *pba_num);
531a4e3449SJack F Vogel s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num,
541a4e3449SJack F Vogel 				  u32 pba_num_size);
5513705f88SJack F Vogel s32 ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, u8 *mac_addr);
5613705f88SJack F Vogel s32 ixgbe_get_bus_info_generic(struct ixgbe_hw *hw);
571b6e0dbaSJack F Vogel void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw);
5813705f88SJack F Vogel s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);
5913705f88SJack F Vogel 
6013705f88SJack F Vogel s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index);
6113705f88SJack F Vogel s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index);
6213705f88SJack F Vogel 
6313705f88SJack F Vogel s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
6413705f88SJack F Vogel s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data);
6585d0a26eSJack F Vogel s32 ixgbe_write_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset,
6685d0a26eSJack F Vogel 					       u16 words, u16 *data);
672969bf0eSJack F Vogel s32 ixgbe_read_eerd_generic(struct ixgbe_hw *hw, u16 offset, u16 *data);
6885d0a26eSJack F Vogel s32 ixgbe_read_eerd_buffer_generic(struct ixgbe_hw *hw, u16 offset,
6985d0a26eSJack F Vogel 				   u16 words, u16 *data);
701a4e3449SJack F Vogel s32 ixgbe_write_eewr_generic(struct ixgbe_hw *hw, u16 offset, u16 data);
7185d0a26eSJack F Vogel s32 ixgbe_write_eewr_buffer_generic(struct ixgbe_hw *hw, u16 offset,
7285d0a26eSJack F Vogel 				    u16 words, u16 *data);
7313705f88SJack F Vogel s32 ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, u16 offset,
7413705f88SJack F Vogel 				       u16 *data);
7585d0a26eSJack F Vogel s32 ixgbe_read_eeprom_buffer_bit_bang_generic(struct ixgbe_hw *hw, u16 offset,
7685d0a26eSJack F Vogel 					      u16 words, u16 *data);
772969bf0eSJack F Vogel u16 ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw);
7813705f88SJack F Vogel s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw,
7913705f88SJack F Vogel 					   u16 *checksum_val);
8013705f88SJack F Vogel s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw);
812969bf0eSJack F Vogel s32 ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, u32 ee_reg);
8213705f88SJack F Vogel 
839ca4041bSJack F Vogel s32 ixgbe_set_rar_generic(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
849ca4041bSJack F Vogel 			  u32 enable_addr);
855b7f4cedSJack F Vogel s32 ixgbe_clear_rar_generic(struct ixgbe_hw *hw, u32 index);
8613705f88SJack F Vogel s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw);
8713705f88SJack F Vogel s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
889ca4041bSJack F Vogel 				      u32 mc_addr_count,
8985d0a26eSJack F Vogel 				      ixgbe_mc_addr_itr func, bool clear);
909ca4041bSJack F Vogel s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list,
919ca4041bSJack F Vogel 				      u32 addr_count, ixgbe_mc_addr_itr func);
9213705f88SJack F Vogel s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
9313705f88SJack F Vogel s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw);
940ac6dfecSJack F Vogel s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval);
9585d0a26eSJack F Vogel s32 ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw *hw);
9685d0a26eSJack F Vogel s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw);
9713705f88SJack F Vogel 
980ac6dfecSJack F Vogel s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packtetbuf_num);
991b6e0dbaSJack F Vogel s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw);
1001b6e0dbaSJack F Vogel 
10113705f88SJack F Vogel s32 ixgbe_validate_mac_addr(u8 *mac_addr);
10213705f88SJack F Vogel s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
10313705f88SJack F Vogel void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask);
10413705f88SJack F Vogel s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
10513705f88SJack F Vogel 
1060ac6dfecSJack F Vogel s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index);
1070ac6dfecSJack F Vogel s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index);
1080ac6dfecSJack F Vogel 
1092969bf0eSJack F Vogel s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr);
1102969bf0eSJack F Vogel s32 ixgbe_set_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr);
1112969bf0eSJack F Vogel 
1122969bf0eSJack F Vogel s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
1132969bf0eSJack F Vogel s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
1142969bf0eSJack F Vogel s32 ixgbe_insert_mac_addr_generic(struct ixgbe_hw *hw, u8 *addr, u32 vmdq);
1152969bf0eSJack F Vogel s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
1162969bf0eSJack F Vogel s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan,
1172969bf0eSJack F Vogel 			 u32 vind, bool vlan_on);
11885d0a26eSJack F Vogel s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
11985d0a26eSJack F Vogel 			   bool vlan_on, bool *vfta_changed);
1202969bf0eSJack F Vogel s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw);
12185d0a26eSJack F Vogel s32 ixgbe_find_vlvf_slot(struct ixgbe_hw *hw, u32 vlan);
1222969bf0eSJack F Vogel 
1232969bf0eSJack F Vogel s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw,
1242969bf0eSJack F Vogel 			       ixgbe_link_speed *speed,
1252969bf0eSJack F Vogel 			       bool *link_up, bool link_up_wait_to_complete);
1262969bf0eSJack F Vogel 
1272969bf0eSJack F Vogel s32 ixgbe_get_wwn_prefix_generic(struct ixgbe_hw *hw, u16 *wwnn_prefix,
1282969bf0eSJack F Vogel 				 u16 *wwpn_prefix);
1292969bf0eSJack F Vogel 
1301a4e3449SJack F Vogel s32 ixgbe_get_fcoe_boot_status_generic(struct ixgbe_hw *hw, u16 *bs);
1311a4e3449SJack F Vogel void ixgbe_set_mac_anti_spoofing(struct ixgbe_hw *hw, bool enable, int pf);
1321a4e3449SJack F Vogel void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf);
133182b3808SJack F Vogel s32 ixgbe_get_device_caps_generic(struct ixgbe_hw *hw, u16 *device_caps);
13485d0a26eSJack F Vogel void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb, u32 headroom,
13585d0a26eSJack F Vogel 			     int strategy);
136182b3808SJack F Vogel void ixgbe_enable_relaxed_ordering_gen2(struct ixgbe_hw *hw);
13785d0a26eSJack F Vogel s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
13885d0a26eSJack F Vogel 				 u8 build, u8 ver);
13985d0a26eSJack F Vogel void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
14013705f88SJack F Vogel #endif /* IXGBE_COMMON */
141