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 (*stop_hw)(struct ngbe_hw *hw);
98 s32 (*get_mac_addr)(struct ngbe_hw *hw, u8 *mac_addr);
99 s32 (*acquire_swfw_sync)(struct ngbe_hw *hw, u32 mask);
100 void (*release_swfw_sync)(struct ngbe_hw *hw, u32 mask);
102 s32 (*setup_link)(struct ngbe_hw *hw, u32 speed,
103 bool autoneg_wait_to_complete);
104 s32 (*check_link)(struct ngbe_hw *hw, u32 *speed,
105 bool *link_up, bool link_up_wait_to_complete);
107 s32 (*set_rar)(struct ngbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
109 s32 (*clear_rar)(struct ngbe_hw *hw, u32 index);
110 s32 (*set_vmdq)(struct ngbe_hw *hw, u32 rar, u32 vmdq);
111 s32 (*clear_vmdq)(struct ngbe_hw *hw, u32 rar, u32 vmdq);
112 s32 (*init_rx_addrs)(struct ngbe_hw *hw);
114 /* Manageability interface */
115 s32 (*init_thermal_sensor_thresh)(struct ngbe_hw *hw);
116 s32 (*check_overtemp)(struct ngbe_hw *hw);
118 enum ngbe_mac_type type;
119 u8 addr[ETH_ADDR_LEN];
120 u8 perm_addr[ETH_ADDR_LEN];
126 bool get_link_status;
127 struct ngbe_thermal_sensor_data thermal_sensor_data;
129 u32 max_link_up_time;
134 struct ngbe_phy_info {
135 s32 (*identify)(struct ngbe_hw *hw);
136 s32 (*reset_hw)(struct ngbe_hw *hw);
137 s32 (*read_reg)(struct ngbe_hw *hw, u32 reg_addr,
138 u32 device_type, u16 *phy_data);
139 s32 (*write_reg)(struct ngbe_hw *hw, u32 reg_addr,
140 u32 device_type, u16 phy_data);
141 s32 (*read_reg_unlocked)(struct ngbe_hw *hw, u32 reg_addr,
142 u32 device_type, u16 *phy_data);
143 s32 (*write_reg_unlocked)(struct ngbe_hw *hw, u32 reg_addr,
144 u32 device_type, u16 phy_data);
145 s32 (*setup_link)(struct ngbe_hw *hw, u32 speed,
146 bool autoneg_wait_to_complete);
147 s32 (*check_link)(struct ngbe_hw *hw, u32 *speed, bool *link_up);
149 enum ngbe_media_type media_type;
150 enum ngbe_phy_type type;
154 u32 phy_semaphore_mask;
156 u32 autoneg_advertised;
170 struct ngbe_mac_info mac;
171 struct ngbe_addr_filter_info addr_ctrl;
172 struct ngbe_phy_info phy;
173 struct ngbe_rom_info rom;
174 struct ngbe_bus_info bus;
179 bool adapter_stopped;
187 #include "ngbe_regs.h"
188 #include "ngbe_dummy.h"
190 #endif /* _NGBE_TYPE_H_ */