xref: /openbsd/sys/dev/pci/ixgbe.h (revision 42152828)
1*42152828Syasuoka /*	$OpenBSD: ixgbe.h,v 1.37 2024/10/27 04:44:41 yasuoka Exp $	*/
2ad013249Sreyk 
3ad013249Sreyk /******************************************************************************
4ad013249Sreyk 
5ad013249Sreyk   Copyright (c) 2001-2008, Intel Corporation
6ad013249Sreyk   All rights reserved.
7ad013249Sreyk 
8ad013249Sreyk   Redistribution and use in source and binary forms, with or without
9ad013249Sreyk   modification, are permitted provided that the following conditions are met:
10ad013249Sreyk 
11ad013249Sreyk    1. Redistributions of source code must retain the above copyright notice,
12ad013249Sreyk       this list of conditions and the following disclaimer.
13ad013249Sreyk 
14ad013249Sreyk    2. Redistributions in binary form must reproduce the above copyright
15ad013249Sreyk       notice, this list of conditions and the following disclaimer in the
16ad013249Sreyk       documentation and/or other materials provided with the distribution.
17ad013249Sreyk 
18ad013249Sreyk    3. Neither the name of the Intel Corporation nor the names of its
19ad013249Sreyk       contributors may be used to endorse or promote products derived from
20ad013249Sreyk       this software without specific prior written permission.
21ad013249Sreyk 
22ad013249Sreyk   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23ad013249Sreyk   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24ad013249Sreyk   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25ad013249Sreyk   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26ad013249Sreyk   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27ad013249Sreyk   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28ad013249Sreyk   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29ad013249Sreyk   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30ad013249Sreyk   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31ad013249Sreyk   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32ad013249Sreyk   POSSIBILITY OF SUCH DAMAGE.
33ad013249Sreyk 
34ad013249Sreyk ******************************************************************************/
35d7a8f955Sjmatthew /* FreeBSD: src/sys/dev/ixgbe/ixgbe_osdep.h 326022 2017-11-20 19:36:21Z pfg $*/
36d7a8f955Sjmatthew /* FreeBSD: src/sys/dev/ixgbe/ixgbe_common.h 326022 2017-11-20 19:36:21Z pfg $*/
37d7a8f955Sjmatthew 
38ad013249Sreyk 
396f0ce38dSreyk #ifndef _IXGBE_H_
406f0ce38dSreyk #define _IXGBE_H_
41ad013249Sreyk 
42ad013249Sreyk #include "bpfilter.h"
43ad013249Sreyk #include "vlan.h"
442cacaaf4Sdlg #include "kstat.h"
45ad013249Sreyk 
46ad013249Sreyk #include <sys/param.h>
47ad013249Sreyk #include <sys/systm.h>
48ad013249Sreyk #include <sys/sockio.h>
49ad013249Sreyk #include <sys/mbuf.h>
50ad013249Sreyk #include <sys/malloc.h>
51ad013249Sreyk #include <sys/kernel.h>
52ad013249Sreyk #include <sys/device.h>
53ad013249Sreyk #include <sys/socket.h>
54ad013249Sreyk #include <sys/timeout.h>
55c64b87a0Sjsg #include <sys/pool.h>
56c64b87a0Sjsg #include <sys/rwlock.h>
57a4cd2d76Sdlg #include <sys/intrmap.h>
58d6e48046Skettenis #include <sys/atomic.h>
592cacaaf4Sdlg #include <sys/kstat.h>
60ad013249Sreyk 
61ad013249Sreyk #include <net/if.h>
62ad013249Sreyk #include <net/if_media.h>
63cd396c98Sjan #include <net/route.h>
642405a0d3Sdlg #include <net/toeplitz.h>
65ad013249Sreyk 
66ad013249Sreyk #include <netinet/in.h>
67ad013249Sreyk #include <netinet/if_ether.h>
68cd396c98Sjan #include <netinet/tcp.h>
69cd396c98Sjan #include <netinet/tcp_timer.h>
70cd396c98Sjan #include <netinet/tcp_var.h>
71ad013249Sreyk 
72ad013249Sreyk #if NBPFILTER > 0
73ad013249Sreyk #include <net/bpf.h>
74ad013249Sreyk #endif
75ad013249Sreyk 
761792d869Sderaadt typedef int	boolean_t;
771792d869Sderaadt #define TRUE	1
781792d869Sderaadt #define FALSE	0
79ad013249Sreyk 
80ad013249Sreyk #include <dev/pci/pcireg.h>
81ad013249Sreyk #include <dev/pci/pcivar.h>
82ad013249Sreyk #include <dev/pci/pcidevs.h>
83ad013249Sreyk #include <dev/pci/ixgbe_type.h>
84ad013249Sreyk 
85ad013249Sreyk #define DBG 0
86ad013249Sreyk #define MSGOUT(S, A, B)     printf(S "\n", A, B)
87ad013249Sreyk #define DEBUGFUNC(F)        DEBUGOUT(F);
88ad013249Sreyk #if DBG
8911efaf7fSmikeb 	#define DEBUGOUT(S)         printf(S "\n")
9011efaf7fSmikeb 	#define DEBUGOUT1(S,A)      printf(S "\n",A)
9111efaf7fSmikeb 	#define DEBUGOUT2(S,A,B)    printf(S "\n",A,B)
9211efaf7fSmikeb 	#define DEBUGOUT3(S,A,B,C)  printf(S "\n",A,B,C)
9311efaf7fSmikeb 	#define DEBUGOUT4(S,A,B,C,D)  printf(S "\n",A,B,C,D)
9411efaf7fSmikeb 	#define DEBUGOUT5(S,A,B,C,D,E)  printf(S "\n",A,B,C,D,E)
9511efaf7fSmikeb 	#define DEBUGOUT6(S,A,B,C,D,E,F)  printf(S "\n",A,B,C,D,E,F)
9611efaf7fSmikeb 	#define DEBUGOUT7(S,A,B,C,D,E,F,G)  printf(S "\n",A,B,C,D,E,F,G)
9711efaf7fSmikeb 	#define ERROR_REPORT1(S,A)      printf(S "\n",A)
9811efaf7fSmikeb 	#define ERROR_REPORT2(S,A,B)    printf(S "\n",A,B)
9911efaf7fSmikeb 	#define ERROR_REPORT3(S,A,B,C)  printf(S "\n",A,B,C)
100ad013249Sreyk #else
101ad013249Sreyk 	#define DEBUGOUT(S)
102ad013249Sreyk 	#define DEBUGOUT1(S,A)
103ad013249Sreyk 	#define DEBUGOUT2(S,A,B)
104ad013249Sreyk 	#define DEBUGOUT3(S,A,B,C)
10511efaf7fSmikeb 	#define DEBUGOUT4(S,A,B,C,D)
10611efaf7fSmikeb 	#define DEBUGOUT5(S,A,B,C,D,E)
107ad013249Sreyk 	#define DEBUGOUT6(S,A,B,C,D,E,F)
108ad013249Sreyk 	#define DEBUGOUT7(S,A,B,C,D,E,F,G)
10911efaf7fSmikeb 
11011efaf7fSmikeb 	#define ERROR_REPORT1(S,A)
11111efaf7fSmikeb 	#define ERROR_REPORT2(S,A,B)
11211efaf7fSmikeb 	#define ERROR_REPORT3(S,A,B,C)
113ad013249Sreyk #endif
114ad013249Sreyk 
115ad013249Sreyk #define FALSE		    		0
116ad013249Sreyk #define TRUE		    		1
117ad013249Sreyk #define CMD_MEM_WRT_INVALIDATE          0x0010  /* BIT_4 */
118ad013249Sreyk #define PCI_COMMAND_REGISTER            PCIR_COMMAND
119ad013249Sreyk 
1206f0ce38dSreyk /* Compat glue */
1216f0ce38dSreyk #define PCIR_BAR(_x)	(0x10 + (_x) * 4)
1226f0ce38dSreyk #define roundup2(size, unit) (((size) + (unit) - 1) & ~((unit) - 1))
1236f0ce38dSreyk #define usec_delay(x) delay(x)
1246f0ce38dSreyk #define msec_delay(x) delay(1000 * (x))
125ad013249Sreyk 
126ad013249Sreyk /* This is needed by the shared code */
127ad013249Sreyk struct ixgbe_hw;
1286f0ce38dSreyk 
129ad013249Sreyk struct ixgbe_osdep {
130ad013249Sreyk 	bus_dma_tag_t		 os_dmat;
131ad013249Sreyk 	bus_space_tag_t		 os_memt;
132ad013249Sreyk 	bus_space_handle_t	 os_memh;
133ad013249Sreyk 
134ad013249Sreyk 	bus_size_t		 os_memsize;
135ad013249Sreyk 	bus_addr_t		 os_membase;
136ad013249Sreyk 
137ad013249Sreyk 	void			*os_sc;
13860a501bfSmikeb 	struct pci_attach_args	 os_pa;
139ad013249Sreyk };
140ad013249Sreyk 
1419feba5bbSclaudio extern uint16_t ixgbe_read_pci_cfg(struct ixgbe_hw *, uint32_t);
1429feba5bbSclaudio #define IXGBE_READ_PCIE_WORD ixgbe_read_pci_cfg
1439feba5bbSclaudio 
1449feba5bbSclaudio extern void ixgbe_write_pci_cfg(struct ixgbe_hw *, uint32_t, uint16_t);
1459feba5bbSclaudio #define IXGBE_WRITE_PCIE_WORD ixgbe_write_pci_cfg
1469feba5bbSclaudio 
1476f0ce38dSreyk #define IXGBE_WRITE_FLUSH(a)						\
1486f0ce38dSreyk 	IXGBE_READ_REG(a, IXGBE_STATUS)
149ad013249Sreyk #define IXGBE_READ_REG(a, reg)						\
150ad013249Sreyk 	bus_space_read_4(((struct ixgbe_osdep *)(a)->back)->os_memt,	\
151ad013249Sreyk 	((struct ixgbe_osdep *)(a)->back)->os_memh, reg)
152ad013249Sreyk #define IXGBE_WRITE_REG(a, reg, value)					\
153ad013249Sreyk 	bus_space_write_4(((struct ixgbe_osdep *)(a)->back)->os_memt,	\
154ad013249Sreyk 	((struct ixgbe_osdep *)(a)->back)->os_memh, reg, value)
155ad013249Sreyk #define IXGBE_READ_REG_ARRAY(a, reg, offset)				\
156ad013249Sreyk 	bus_space_read_4(((struct ixgbe_osdep *)(a)->back)->os_memt,	\
1579feba5bbSclaudio 	((struct ixgbe_osdep *)(a)->back)->os_memh, (reg + ((offset) << 2)))
158ad013249Sreyk #define IXGBE_WRITE_REG_ARRAY(a, reg, offset, value)			\
159ad013249Sreyk 	bus_space_write_4(((struct ixgbe_osdep *)(a)->back)->os_memt,	\
160ad013249Sreyk 	((struct ixgbe_osdep *)(a)->back)->os_memh, (reg + ((offset) << 2)), value)
161ad013249Sreyk 
162d7a8f955Sjmatthew #define IXGBE_REMOVED(a) (0)
163d7a8f955Sjmatthew 
1642f63561bSmikeb /* MAC Operations */
16511efaf7fSmikeb uint16_t ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw);
16635befa56Sreyk int32_t ixgbe_init_ops_generic(struct ixgbe_hw *hw);
16735befa56Sreyk int32_t ixgbe_init_hw_generic(struct ixgbe_hw *hw);
16835befa56Sreyk int32_t ixgbe_start_hw_generic(struct ixgbe_hw *hw);
1699feba5bbSclaudio int32_t ixgbe_start_hw_gen2(struct ixgbe_hw *hw);
17035befa56Sreyk int32_t ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw);
17135befa56Sreyk int32_t ixgbe_get_mac_addr_generic(struct ixgbe_hw *hw, uint8_t *mac_addr);
17235befa56Sreyk int32_t ixgbe_get_bus_info_generic(struct ixgbe_hw *hw);
1733201f924Sjsg void    ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw);
17435befa56Sreyk int32_t ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);
175ad013249Sreyk 
17635befa56Sreyk int32_t ixgbe_led_on_generic(struct ixgbe_hw *hw, uint32_t index);
17735befa56Sreyk int32_t ixgbe_led_off_generic(struct ixgbe_hw *hw, uint32_t index);
178ad013249Sreyk 
17935befa56Sreyk int32_t ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
18035befa56Sreyk int32_t ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, uint16_t offset, uint16_t data);
1813201f924Sjsg int32_t ixgbe_read_eerd_generic(struct ixgbe_hw *hw, uint16_t offset, uint16_t *data);
1829feba5bbSclaudio int32_t ixgbe_write_eewr_generic(struct ixgbe_hw *hw, uint16_t offset, uint16_t data);
18335befa56Sreyk int32_t ixgbe_read_eeprom_bit_bang_generic(struct ixgbe_hw *hw, uint16_t offset,
18435befa56Sreyk 					   uint16_t *data);
185318bcc4bSmikeb int32_t ixgbe_calc_eeprom_checksum_generic(struct ixgbe_hw *hw);
18635befa56Sreyk int32_t ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw,
18735befa56Sreyk 					       uint16_t *checksum_val);
18835befa56Sreyk int32_t ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw);
1893201f924Sjsg int32_t ixgbe_poll_eerd_eewr_done(struct ixgbe_hw *hw, uint32_t ee_reg);
190ad013249Sreyk 
19135befa56Sreyk int32_t ixgbe_set_rar_generic(struct ixgbe_hw *hw, uint32_t index, uint8_t *addr, uint32_t vmdq,
19235befa56Sreyk 			      uint32_t enable_addr);
1933201f924Sjsg int32_t ixgbe_clear_rar_generic(struct ixgbe_hw *hw, uint32_t index);
19435befa56Sreyk int32_t ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw);
19535befa56Sreyk int32_t ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, uint8_t *mc_addr_list,
19635befa56Sreyk 					  uint32_t mc_addr_count,
19711efaf7fSmikeb 					  ixgbe_mc_addr_itr func, bool clear);
19835befa56Sreyk int32_t ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
19935befa56Sreyk int32_t ixgbe_disable_mc_generic(struct ixgbe_hw *hw);
2003201f924Sjsg int32_t ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, uint32_t regval);
20111efaf7fSmikeb int32_t ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw *hw);
20211efaf7fSmikeb int32_t ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw);
2033201f924Sjsg 
20411efaf7fSmikeb int32_t ixgbe_fc_enable_generic(struct ixgbe_hw *hw);
20511efaf7fSmikeb void ixgbe_fc_autoneg(struct ixgbe_hw *hw);
206276d64b7Smikeb int32_t ixgbe_setup_fc_generic(struct ixgbe_hw *hw);
207ad013249Sreyk 
20835befa56Sreyk int32_t ixgbe_validate_mac_addr(uint8_t *mac_addr);
209276d64b7Smikeb int32_t ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, uint32_t mask);
210276d64b7Smikeb void    ixgbe_release_swfw_sync(struct ixgbe_hw *hw, uint32_t mask);
21135befa56Sreyk int32_t ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
212ad013249Sreyk 
213276d64b7Smikeb int32_t prot_autoc_read_generic(struct ixgbe_hw *hw, bool *, uint32_t *reg_val);
214276d64b7Smikeb int32_t prot_autoc_write_generic(struct ixgbe_hw *hw, uint32_t reg_val, bool locked);
215276d64b7Smikeb 
2163201f924Sjsg int32_t ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, uint32_t index);
2173201f924Sjsg int32_t ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, uint32_t index);
218ad013249Sreyk 
2193201f924Sjsg int32_t ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, uint32_t rar, uint32_t vmdq);
2203201f924Sjsg int32_t ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, uint32_t rar, uint32_t vmdq);
2213201f924Sjsg int32_t ixgbe_insert_mac_addr_generic(struct ixgbe_hw *hw, uint8_t *addr, uint32_t vmdq);
2223201f924Sjsg int32_t ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
2233201f924Sjsg int32_t ixgbe_set_vfta_generic(struct ixgbe_hw *hw, uint32_t vlan,
224d7a8f955Sjmatthew 			       uint32_t vind, bool vlan_on, bool);
22511efaf7fSmikeb int32_t ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, uint32_t vlan, uint32_t vind,
226d7a8f955Sjmatthew 			       bool vlan_on, uint32_t*, uint32_t, bool);
2273201f924Sjsg int32_t ixgbe_clear_vfta_generic(struct ixgbe_hw *hw);
2283201f924Sjsg 
2293201f924Sjsg int32_t ixgbe_check_mac_link_generic(struct ixgbe_hw *hw,
2303201f924Sjsg 				     ixgbe_link_speed *speed,
2312f63561bSmikeb 				     bool *link_up,
2322f63561bSmikeb 				     bool link_up_wait_to_complete);
2333201f924Sjsg 
2342f63561bSmikeb int32_t ixgbe_get_device_caps_generic(struct ixgbe_hw *hw,
2352f63561bSmikeb 				      uint16_t *device_caps);
2362f63561bSmikeb int32_t ixgbe_host_interface_command(struct ixgbe_hw *hw, uint32_t *buffer,
2372f63561bSmikeb 				     uint32_t length, uint32_t timeout,
2382f63561bSmikeb 				     bool return_data);
239d7a8f955Sjmatthew int32_t ixgbe_hic_unlocked(struct ixgbe_hw *, uint32_t *buffer, uint32_t length, uint32_t timeout);
24011efaf7fSmikeb void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
24111efaf7fSmikeb 
2422f63561bSmikeb bool ixgbe_mng_present(struct ixgbe_hw *hw);
2432f63561bSmikeb bool ixgbe_mng_enabled(struct ixgbe_hw *hw);
2442f63561bSmikeb 
2452f63561bSmikeb void ixgbe_disable_rx_generic(struct ixgbe_hw *hw);
2462f63561bSmikeb void ixgbe_enable_rx_generic(struct ixgbe_hw *hw);
2472f63561bSmikeb int32_t ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
2482f63561bSmikeb 					      ixgbe_link_speed speed,
2492f63561bSmikeb 					      bool autoneg_wait_to_complete);
2502f63561bSmikeb void ixgbe_set_soft_rate_select_speed(struct ixgbe_hw *hw,
2512f63561bSmikeb 				      ixgbe_link_speed speed);
2522f63561bSmikeb 
253d7a8f955Sjmatthew int32_t ixgbe_negotiate_fc(struct ixgbe_hw *hw, uint32_t adv_reg, uint32_t lp_reg,
254d7a8f955Sjmatthew 			uint32_t adv_sym, uint32_t adv_asm, uint32_t lp_sym, uint32_t lp_asm);
255d7a8f955Sjmatthew 
25611efaf7fSmikeb int32_t ixgbe_init_shared_code(struct ixgbe_hw *hw);
2572f63561bSmikeb 
2582f63561bSmikeb int32_t ixgbe_init_ops_82598(struct ixgbe_hw *hw);
2592f63561bSmikeb int32_t ixgbe_init_ops_82599(struct ixgbe_hw *hw);
2602f63561bSmikeb int32_t ixgbe_init_ops_X540(struct ixgbe_hw *hw);
2612f63561bSmikeb int32_t ixgbe_init_ops_X550(struct ixgbe_hw *hw);
2622f63561bSmikeb int32_t ixgbe_init_ops_X550EM(struct ixgbe_hw *hw);
263d7a8f955Sjmatthew int32_t ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw);
264d7a8f955Sjmatthew int32_t ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw);
2652f63561bSmikeb 
2662f63561bSmikeb int32_t ixgbe_set_mac_type(struct ixgbe_hw *hw);
26711efaf7fSmikeb int32_t ixgbe_init_hw(struct ixgbe_hw *hw);
26811efaf7fSmikeb enum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw);
26911efaf7fSmikeb int32_t ixgbe_identify_phy(struct ixgbe_hw *hw);
2702f63561bSmikeb void ixgbe_flap_tx_laser(struct ixgbe_hw *hw);
27111efaf7fSmikeb int32_t ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
27211efaf7fSmikeb 			 bool *link_up, bool link_up_wait_to_complete);
2732f63561bSmikeb 
27411efaf7fSmikeb int32_t ixgbe_set_rar(struct ixgbe_hw *hw, uint32_t index, uint8_t *addr,
27511efaf7fSmikeb 		      uint32_t vmdq, uint32_t enable_addr);
27611efaf7fSmikeb int32_t ixgbe_set_vmdq(struct ixgbe_hw *hw, uint32_t rar, uint32_t vmdq);
27711efaf7fSmikeb int32_t ixgbe_clear_vmdq(struct ixgbe_hw *hw, uint32_t rar, uint32_t vmdq);
27811efaf7fSmikeb int32_t ixgbe_init_uta_tables(struct ixgbe_hw *hw);
2799feba5bbSclaudio 
2803201f924Sjsg void ixgbe_add_uc_addr(struct ixgbe_hw *hw, uint8_t *addr, uint32_t vmdq);
281*42152828Syasuoka int32_t ixgbe_mta_vector(struct ixgbe_hw *hw, uint8_t *mc_addr);
28235befa56Sreyk void ixgbe_set_mta(struct ixgbe_hw *hw, uint8_t *mc_addr);
2833201f924Sjsg 
2842f63561bSmikeb void ixgbe_disable_rx(struct ixgbe_hw *hw);
2852f63561bSmikeb void ixgbe_enable_rx(struct ixgbe_hw *hw);
286ad013249Sreyk 
287ad013249Sreyk /* PHY */
28835befa56Sreyk int32_t ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw);
28911efaf7fSmikeb bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, uint32_t phy_addr);
29035befa56Sreyk enum ixgbe_phy_type ixgbe_get_phy_type_from_id(uint32_t phy_id);
29135befa56Sreyk int32_t ixgbe_get_phy_id(struct ixgbe_hw *hw);
29235befa56Sreyk int32_t ixgbe_identify_phy_generic(struct ixgbe_hw *hw);
29335befa56Sreyk int32_t ixgbe_reset_phy_generic(struct ixgbe_hw *hw);
29411efaf7fSmikeb int32_t ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, uint32_t reg_addr,
29511efaf7fSmikeb 			       uint32_t device_type, uint16_t *phy_data);
29611efaf7fSmikeb int32_t ixgbe_write_phy_reg_mdi(struct ixgbe_hw *hw, uint32_t reg_addr,
29711efaf7fSmikeb 				uint32_t device_type, uint16_t phy_data);
29835befa56Sreyk int32_t ixgbe_read_phy_reg_generic(struct ixgbe_hw *hw, uint32_t reg_addr,
29935befa56Sreyk 				   uint32_t device_type, uint16_t *phy_data);
30035befa56Sreyk int32_t ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, uint32_t reg_addr,
30135befa56Sreyk 				    uint32_t device_type, uint16_t phy_data);
30235befa56Sreyk int32_t ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw);
30335befa56Sreyk int32_t ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw,
304ad013249Sreyk 					   ixgbe_link_speed speed,
30511efaf7fSmikeb 					   bool autoneg_wait_to_complete);
3063201f924Sjsg int32_t ixgbe_get_copper_link_capabilities_generic(struct ixgbe_hw *hw,
3073201f924Sjsg 						   ixgbe_link_speed *speed,
30811efaf7fSmikeb 						   bool *autoneg);
3092f63561bSmikeb int32_t ixgbe_check_reset_blocked(struct ixgbe_hw *hw);
310ad013249Sreyk 
3119feba5bbSclaudio /* PHY specific */
31235befa56Sreyk int32_t ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw,
313ad013249Sreyk 				 ixgbe_link_speed *speed,
31411efaf7fSmikeb 				 bool *link_up);
3153201f924Sjsg int32_t ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw);
31635befa56Sreyk int32_t ixgbe_get_phy_firmware_version_tnx(struct ixgbe_hw *hw,
31735befa56Sreyk 					   uint16_t *firmware_version);
3183201f924Sjsg int32_t ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw,
3193201f924Sjsg 					       uint16_t *firmware_version);
320ad013249Sreyk 
32135befa56Sreyk int32_t ixgbe_reset_phy_nl(struct ixgbe_hw *hw);
3222f63561bSmikeb bool ixgbe_is_sfp(struct ixgbe_hw *hw);
3232f63561bSmikeb int32_t ixgbe_set_copper_phy_power(struct ixgbe_hw *hw, bool on);
32411efaf7fSmikeb int32_t ixgbe_identify_module_generic(struct ixgbe_hw *hw);
3253201f924Sjsg int32_t ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw);
326d7a8f955Sjmatthew uint64_t ixgbe_get_supported_phy_sfp_layer_generic(struct ixgbe_hw *hw);
3272f63561bSmikeb int32_t ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw);
3283201f924Sjsg int32_t ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw,
3293201f924Sjsg 					    uint16_t *list_offset,
3303201f924Sjsg 					    uint16_t *data_offset);
3319feba5bbSclaudio int32_t ixgbe_tn_check_overtemp(struct ixgbe_hw *hw);
3323201f924Sjsg int32_t ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, uint8_t byte_offset,
3333201f924Sjsg 				    uint8_t dev_addr, uint8_t *data);
334276d64b7Smikeb int32_t ixgbe_read_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, uint8_t byte_offset,
335276d64b7Smikeb 					     uint8_t dev_addr, uint8_t *data);
3363201f924Sjsg int32_t ixgbe_write_i2c_byte_generic(struct ixgbe_hw *hw, uint8_t byte_offset,
3373201f924Sjsg 				     uint8_t dev_addr, uint8_t data);
338276d64b7Smikeb int32_t ixgbe_write_i2c_byte_generic_unlocked(struct ixgbe_hw *hw, uint8_t byte_offset,
339276d64b7Smikeb 					      uint8_t dev_addr, uint8_t data);
3403201f924Sjsg int32_t ixgbe_read_i2c_eeprom_generic(struct ixgbe_hw *hw, uint8_t byte_offset,
3413201f924Sjsg 				      uint8_t *eeprom_data);
3423201f924Sjsg int32_t ixgbe_write_i2c_eeprom_generic(struct ixgbe_hw *hw, uint8_t byte_offset,
3433201f924Sjsg 				       uint8_t eeprom_data);
344d7a8f955Sjmatthew void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw);
345d7a8f955Sjmatthew int32_t ixgbe_read_i2c_combined_generic_int(struct ixgbe_hw *, uint8_t addr, uint16_t reg,
346d7a8f955Sjmatthew 					uint16_t *val, bool lock);
347d7a8f955Sjmatthew int32_t ixgbe_read_i2c_combined_generic(struct ixgbe_hw *, uint8_t addr, uint16_t reg,
348d7a8f955Sjmatthew 					uint16_t *val);
349d7a8f955Sjmatthew int32_t ixgbe_read_i2c_combined_generic_unlocked(struct ixgbe_hw *, uint8_t addr,
350d7a8f955Sjmatthew 						 uint16_t reg, uint16_t *val);
351d7a8f955Sjmatthew int32_t ixgbe_write_i2c_combined_generic_int(struct ixgbe_hw *, uint8_t addr, uint16_t reg,
352d7a8f955Sjmatthew 					uint16_t val, bool lock);
353d7a8f955Sjmatthew int32_t ixgbe_write_i2c_combined_generic(struct ixgbe_hw *, uint8_t addr, uint16_t reg,
354d7a8f955Sjmatthew 					 uint16_t val);
355d7a8f955Sjmatthew int32_t ixgbe_write_i2c_combined_generic_unlocked(struct ixgbe_hw *, uint8_t addr,
356d7a8f955Sjmatthew 						  uint16_t reg, uint16_t val);
3579feba5bbSclaudio 
358*42152828Syasuoka /* Virtual Functions */
359*42152828Syasuoka int32_t ixgbe_init_ops_vf(struct ixgbe_hw *hw);
360*42152828Syasuoka int32_t ixgbe_init_hw_vf(struct ixgbe_hw *hw);
361*42152828Syasuoka int32_t ixgbe_start_hw_vf(struct ixgbe_hw *hw);
362*42152828Syasuoka int32_t ixgbe_reset_hw_vf(struct ixgbe_hw *hw);
363*42152828Syasuoka int32_t ixgbe_stop_adapter_vf(struct ixgbe_hw *hw);
364*42152828Syasuoka uint32_t ixgbe_get_num_of_tx_queues_vf(struct ixgbe_hw *hw);
365*42152828Syasuoka uint32_t ixgbe_get_num_of_rx_queues_vf(struct ixgbe_hw *hw);
366*42152828Syasuoka int32_t ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, uint8_t *mac_addr);
367*42152828Syasuoka int32_t ixgbe_setup_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed speed,
368*42152828Syasuoka 			    bool autoneg_wait_to_complete);
369*42152828Syasuoka int32_t ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
370*42152828Syasuoka 			    bool *link_up, bool autoneg_wait_to_complete);
371*42152828Syasuoka int32_t ixgbe_set_rar_vf(struct ixgbe_hw *hw, uint32_t index, uint8_t *addr, uint32_t vmdq,
372*42152828Syasuoka 		     uint32_t enable_addr);
373*42152828Syasuoka int32_t ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, uint32_t index, uint8_t *addr);
374*42152828Syasuoka int32_t ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, uint8_t *mc_addr_list,
375*42152828Syasuoka 				 uint32_t mc_addr_count, ixgbe_mc_addr_itr,
376*42152828Syasuoka 				 bool clear);
377*42152828Syasuoka int32_t ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
378*42152828Syasuoka int32_t ixgbe_get_link_state_vf(struct ixgbe_hw *hw, bool *link_state);
379*42152828Syasuoka int32_t ixgbe_set_vfta_vf(struct ixgbe_hw *hw, uint32_t vlan, uint32_t vind,
380*42152828Syasuoka 		      bool vlan_on, bool vlvf_bypass);
381*42152828Syasuoka int32_t ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, uint16_t max_size);
382*42152828Syasuoka int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
383*42152828Syasuoka int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
384*42152828Syasuoka 		       unsigned int *default_tc);
385*42152828Syasuoka 
3869feba5bbSclaudio /* MBX */
3879feba5bbSclaudio int32_t ixgbe_read_mbx(struct ixgbe_hw *, uint32_t *, uint16_t, uint16_t);
388*42152828Syasuoka int32_t ixgbe_poll_mbx(struct ixgbe_hw *, uint32_t *, uint16_t, uint16_t);
3899feba5bbSclaudio int32_t ixgbe_write_mbx(struct ixgbe_hw *, uint32_t *, uint16_t, uint16_t);
3909feba5bbSclaudio int32_t ixgbe_read_posted_mbx(struct ixgbe_hw *, uint32_t *, uint16_t, uint16_t);
3919feba5bbSclaudio int32_t ixgbe_write_posted_mbx(struct ixgbe_hw *, uint32_t *, uint16_t, uint16_t);
3929feba5bbSclaudio int32_t ixgbe_check_for_msg(struct ixgbe_hw *, uint16_t);
3939feba5bbSclaudio int32_t ixgbe_check_for_ack(struct ixgbe_hw *, uint16_t);
3949feba5bbSclaudio int32_t ixgbe_check_for_rst(struct ixgbe_hw *, uint16_t);
3959feba5bbSclaudio void ixgbe_init_mbx_ops_generic(struct ixgbe_hw *hw);
396*42152828Syasuoka void ixgbe_init_mbx_params_vf(struct ixgbe_hw *);
397*42152828Syasuoka void ixgbe_upgrade_mbx_params_vf(struct ixgbe_hw *);
3989feba5bbSclaudio void ixgbe_init_mbx_params_pf(struct ixgbe_hw *);
399*42152828Syasuoka void ixgbe_upgrade_mbx_params_pf(struct ixgbe_hw *, uint16_t);
4009feba5bbSclaudio 
4016f0ce38dSreyk #endif /* _IXGBE_H_ */
402