1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
3 * Copyright(c) 2010-2017 Intel Corporation
9 #define NGBE_LINK_UP_TIME 90 /* 9.0 Seconds */
11 #define NGBE_FRAME_SIZE_DFT (1522) /* Default frame size, +FCS */
12 #define NGBE_NUM_POOL (32)
14 #define NGBE_ALIGN 128 /* as intel did */
15 #define NGBE_ISB_SIZE 16
17 #include "ngbe_status.h"
18 #include "ngbe_osdep.h"
19 #include "ngbe_devids.h"
21 struct ngbe_thermal_diode_data {
27 struct ngbe_thermal_sensor_data {
28 struct ngbe_thermal_diode_data sensor[1];
31 enum ngbe_eeprom_type {
32 ngbe_eeprom_unknown = 0,
35 ngbe_eeprom_none /* No NVM support */
57 enum ngbe_media_type {
58 ngbe_media_type_unknown = 0,
59 ngbe_media_type_fiber,
60 ngbe_media_type_fiber_qsfp,
61 ngbe_media_type_copper,
62 ngbe_media_type_backplane,
64 ngbe_media_type_virtual
69 struct ngbe_addr_filter_info {
74 struct ngbe_bus_info {
75 void (*set_lan_id)(struct ngbe_hw *hw);
81 struct ngbe_rom_info {
82 s32 (*init_params)(struct ngbe_hw *hw);
83 s32 (*validate_checksum)(struct ngbe_hw *hw, u16 *checksum_val);
85 enum ngbe_eeprom_type type;
95 struct ngbe_mac_info {
96 s32 (*init_hw)(struct ngbe_hw *hw);
97 s32 (*reset_hw)(struct ngbe_hw *hw);
98 s32 (*start_hw)(struct ngbe_hw *hw);
99 s32 (*stop_hw)(struct ngbe_hw *hw);
100 s32 (*get_mac_addr)(struct ngbe_hw *hw, u8 *mac_addr);
101 s32 (*enable_rx_dma)(struct ngbe_hw *hw, u32 regval);
102 s32 (*disable_sec_rx_path)(struct ngbe_hw *hw);
103 s32 (*enable_sec_rx_path)(struct ngbe_hw *hw);
104 s32 (*acquire_swfw_sync)(struct ngbe_hw *hw, u32 mask);
105 void (*release_swfw_sync)(struct ngbe_hw *hw, u32 mask);
108 s32 (*setup_link)(struct ngbe_hw *hw, u32 speed,
109 bool autoneg_wait_to_complete);
110 s32 (*check_link)(struct ngbe_hw *hw, u32 *speed,
111 bool *link_up, bool link_up_wait_to_complete);
112 s32 (*get_link_capabilities)(struct ngbe_hw *hw,
113 u32 *speed, bool *autoneg);
116 s32 (*set_rar)(struct ngbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
118 s32 (*clear_rar)(struct ngbe_hw *hw, u32 index);
119 s32 (*set_vmdq)(struct ngbe_hw *hw, u32 rar, u32 vmdq);
120 s32 (*clear_vmdq)(struct ngbe_hw *hw, u32 rar, u32 vmdq);
121 s32 (*init_rx_addrs)(struct ngbe_hw *hw);
122 s32 (*clear_vfta)(struct ngbe_hw *hw);
124 /* Manageability interface */
125 s32 (*init_thermal_sensor_thresh)(struct ngbe_hw *hw);
126 s32 (*check_overtemp)(struct ngbe_hw *hw);
128 enum ngbe_mac_type type;
129 u8 addr[ETH_ADDR_LEN];
130 u8 perm_addr[ETH_ADDR_LEN];
137 bool get_link_status;
138 struct ngbe_thermal_sensor_data thermal_sensor_data;
140 u32 max_link_up_time;
146 struct ngbe_phy_info {
147 s32 (*identify)(struct ngbe_hw *hw);
148 s32 (*init_hw)(struct ngbe_hw *hw);
149 s32 (*reset_hw)(struct ngbe_hw *hw);
150 s32 (*read_reg)(struct ngbe_hw *hw, u32 reg_addr,
151 u32 device_type, u16 *phy_data);
152 s32 (*write_reg)(struct ngbe_hw *hw, u32 reg_addr,
153 u32 device_type, u16 phy_data);
154 s32 (*read_reg_unlocked)(struct ngbe_hw *hw, u32 reg_addr,
155 u32 device_type, u16 *phy_data);
156 s32 (*write_reg_unlocked)(struct ngbe_hw *hw, u32 reg_addr,
157 u32 device_type, u16 phy_data);
158 s32 (*setup_link)(struct ngbe_hw *hw, u32 speed,
159 bool autoneg_wait_to_complete);
160 s32 (*check_link)(struct ngbe_hw *hw, u32 *speed, bool *link_up);
162 enum ngbe_media_type media_type;
163 enum ngbe_phy_type type;
167 u32 phy_semaphore_mask;
169 u32 autoneg_advertised;
183 struct ngbe_mac_info mac;
184 struct ngbe_addr_filter_info addr_ctrl;
185 struct ngbe_phy_info phy;
186 struct ngbe_rom_info rom;
187 struct ngbe_bus_info bus;
192 bool adapter_stopped;
199 u32 q_rx_regs[8 * 4];
200 u32 q_tx_regs[8 * 4];
204 #include "ngbe_regs.h"
205 #include "ngbe_dummy.h"
207 #endif /* _NGBE_TYPE_H_ */