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 */
13 #define NGBE_ALIGN 128 /* as intel did */
14 #define NGBE_ISB_SIZE 16
16 #include "ngbe_status.h"
17 #include "ngbe_osdep.h"
18 #include "ngbe_devids.h"
20 struct ngbe_thermal_diode_data {
26 struct ngbe_thermal_sensor_data {
27 struct ngbe_thermal_diode_data sensor[1];
30 enum ngbe_eeprom_type {
31 ngbe_eeprom_unknown = 0,
34 ngbe_eeprom_none /* No NVM support */
56 enum ngbe_media_type {
57 ngbe_media_type_unknown = 0,
58 ngbe_media_type_fiber,
59 ngbe_media_type_fiber_qsfp,
60 ngbe_media_type_copper,
61 ngbe_media_type_backplane,
63 ngbe_media_type_virtual
68 struct ngbe_addr_filter_info {
73 struct ngbe_bus_info {
74 void (*set_lan_id)(struct ngbe_hw *hw);
80 struct ngbe_rom_info {
81 s32 (*init_params)(struct ngbe_hw *hw);
82 s32 (*validate_checksum)(struct ngbe_hw *hw, u16 *checksum_val);
84 enum ngbe_eeprom_type type;
94 struct ngbe_mac_info {
95 s32 (*init_hw)(struct ngbe_hw *hw);
96 s32 (*reset_hw)(struct ngbe_hw *hw);
97 s32 (*start_hw)(struct ngbe_hw *hw);
98 s32 (*stop_hw)(struct ngbe_hw *hw);
99 s32 (*get_mac_addr)(struct ngbe_hw *hw, u8 *mac_addr);
100 s32 (*enable_rx_dma)(struct ngbe_hw *hw, u32 regval);
101 s32 (*disable_sec_rx_path)(struct ngbe_hw *hw);
102 s32 (*enable_sec_rx_path)(struct ngbe_hw *hw);
103 s32 (*acquire_swfw_sync)(struct ngbe_hw *hw, u32 mask);
104 void (*release_swfw_sync)(struct ngbe_hw *hw, u32 mask);
107 s32 (*setup_link)(struct ngbe_hw *hw, u32 speed,
108 bool autoneg_wait_to_complete);
109 s32 (*check_link)(struct ngbe_hw *hw, u32 *speed,
110 bool *link_up, bool link_up_wait_to_complete);
111 s32 (*get_link_capabilities)(struct ngbe_hw *hw,
112 u32 *speed, bool *autoneg);
115 s32 (*set_rar)(struct ngbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
117 s32 (*clear_rar)(struct ngbe_hw *hw, u32 index);
118 s32 (*set_vmdq)(struct ngbe_hw *hw, u32 rar, u32 vmdq);
119 s32 (*clear_vmdq)(struct ngbe_hw *hw, u32 rar, u32 vmdq);
120 s32 (*init_rx_addrs)(struct ngbe_hw *hw);
122 /* Manageability interface */
123 s32 (*init_thermal_sensor_thresh)(struct ngbe_hw *hw);
124 s32 (*check_overtemp)(struct ngbe_hw *hw);
126 enum ngbe_mac_type type;
127 u8 addr[ETH_ADDR_LEN];
128 u8 perm_addr[ETH_ADDR_LEN];
134 bool get_link_status;
135 struct ngbe_thermal_sensor_data thermal_sensor_data;
137 u32 max_link_up_time;
143 struct ngbe_phy_info {
144 s32 (*identify)(struct ngbe_hw *hw);
145 s32 (*init_hw)(struct ngbe_hw *hw);
146 s32 (*reset_hw)(struct ngbe_hw *hw);
147 s32 (*read_reg)(struct ngbe_hw *hw, u32 reg_addr,
148 u32 device_type, u16 *phy_data);
149 s32 (*write_reg)(struct ngbe_hw *hw, u32 reg_addr,
150 u32 device_type, u16 phy_data);
151 s32 (*read_reg_unlocked)(struct ngbe_hw *hw, u32 reg_addr,
152 u32 device_type, u16 *phy_data);
153 s32 (*write_reg_unlocked)(struct ngbe_hw *hw, u32 reg_addr,
154 u32 device_type, u16 phy_data);
155 s32 (*setup_link)(struct ngbe_hw *hw, u32 speed,
156 bool autoneg_wait_to_complete);
157 s32 (*check_link)(struct ngbe_hw *hw, u32 *speed, bool *link_up);
159 enum ngbe_media_type media_type;
160 enum ngbe_phy_type type;
164 u32 phy_semaphore_mask;
166 u32 autoneg_advertised;
180 struct ngbe_mac_info mac;
181 struct ngbe_addr_filter_info addr_ctrl;
182 struct ngbe_phy_info phy;
183 struct ngbe_rom_info rom;
184 struct ngbe_bus_info bus;
189 bool adapter_stopped;
196 u32 q_rx_regs[8 * 4];
197 u32 q_tx_regs[8 * 4];
201 #include "ngbe_regs.h"
202 #include "ngbe_dummy.h"
204 #endif /* _NGBE_TYPE_H_ */