net: wangxun: Rename private structure in libwx
In order to move the total members in struct adapter to struct wx_hw to keep the code clean, it's a bad name of 'wx_hw' only for hardware. Rename 'wx_hw' to 'wx', and rename the pointers at use. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
79625f45ca
commit
9607a3e626
File diff suppressed because it is too large
Load Diff
|
@ -4,26 +4,26 @@
|
|||
#ifndef _WX_HW_H_
|
||||
#define _WX_HW_H_
|
||||
|
||||
int wx_check_flash_load(struct wx_hw *hw, u32 check_bit);
|
||||
void wx_control_hw(struct wx_hw *wxhw, bool drv);
|
||||
int wx_mng_present(struct wx_hw *wxhw);
|
||||
int wx_host_interface_command(struct wx_hw *wxhw, u32 *buffer,
|
||||
int wx_check_flash_load(struct wx *wx, u32 check_bit);
|
||||
void wx_control_hw(struct wx *wx, bool drv);
|
||||
int wx_mng_present(struct wx *wx);
|
||||
int wx_host_interface_command(struct wx *wx, u32 *buffer,
|
||||
u32 length, u32 timeout, bool return_data);
|
||||
int wx_read_ee_hostif(struct wx_hw *wxhw, u16 offset, u16 *data);
|
||||
int wx_read_ee_hostif_buffer(struct wx_hw *wxhw,
|
||||
int wx_read_ee_hostif(struct wx *wx, u16 offset, u16 *data);
|
||||
int wx_read_ee_hostif_buffer(struct wx *wx,
|
||||
u16 offset, u16 words, u16 *data);
|
||||
int wx_reset_hostif(struct wx_hw *wxhw);
|
||||
void wx_init_eeprom_params(struct wx_hw *wxhw);
|
||||
void wx_get_mac_addr(struct wx_hw *wxhw, u8 *mac_addr);
|
||||
void wx_init_rx_addrs(struct wx_hw *wxhw);
|
||||
void wx_mac_set_default_filter(struct wx_hw *wxhw, u8 *addr);
|
||||
void wx_flush_sw_mac_table(struct wx_hw *wxhw);
|
||||
int wx_reset_hostif(struct wx *wx);
|
||||
void wx_init_eeprom_params(struct wx *wx);
|
||||
void wx_get_mac_addr(struct wx *wx, u8 *mac_addr);
|
||||
void wx_init_rx_addrs(struct wx *wx);
|
||||
void wx_mac_set_default_filter(struct wx *wx, u8 *addr);
|
||||
void wx_flush_sw_mac_table(struct wx *wx);
|
||||
int wx_set_mac(struct net_device *netdev, void *p);
|
||||
void wx_disable_rx(struct wx_hw *wxhw);
|
||||
int wx_disable_pcie_master(struct wx_hw *wxhw);
|
||||
int wx_stop_adapter(struct wx_hw *wxhw);
|
||||
void wx_reset_misc(struct wx_hw *wxhw);
|
||||
int wx_get_pcie_msix_counts(struct wx_hw *wxhw, u16 *msix_count, u16 max_msix_count);
|
||||
int wx_sw_init(struct wx_hw *wxhw);
|
||||
void wx_disable_rx(struct wx *wx);
|
||||
int wx_disable_pcie_master(struct wx *wx);
|
||||
int wx_stop_adapter(struct wx *wx);
|
||||
void wx_reset_misc(struct wx *wx);
|
||||
int wx_get_pcie_msix_counts(struct wx *wx, u16 *msix_count, u16 max_msix_count);
|
||||
int wx_sw_init(struct wx *wx);
|
||||
|
||||
#endif /* _WX_HW_H_ */
|
||||
|
|
|
@ -300,7 +300,7 @@ enum wx_reset_type {
|
|||
WX_GLOBAL_RESET
|
||||
};
|
||||
|
||||
struct wx_hw {
|
||||
struct wx {
|
||||
u8 __iomem *hw_addr;
|
||||
struct pci_dev *pdev;
|
||||
struct net_device *netdev;
|
||||
|
@ -331,23 +331,23 @@ struct wx_hw {
|
|||
wr32((a), (reg) + ((off) << 2), (val))
|
||||
|
||||
static inline u32
|
||||
rd32m(struct wx_hw *wxhw, u32 reg, u32 mask)
|
||||
rd32m(struct wx *wx, u32 reg, u32 mask)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
val = rd32(wxhw, reg);
|
||||
val = rd32(wx, reg);
|
||||
return val & mask;
|
||||
}
|
||||
|
||||
static inline void
|
||||
wr32m(struct wx_hw *wxhw, u32 reg, u32 mask, u32 field)
|
||||
wr32m(struct wx *wx, u32 reg, u32 mask, u32 field)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
val = rd32(wxhw, reg);
|
||||
val = rd32(wx, reg);
|
||||
val = ((val & ~mask) | (field & mask));
|
||||
|
||||
wr32(wxhw, reg, val);
|
||||
wr32(wx, reg, val);
|
||||
}
|
||||
|
||||
/* On some domestic CPU platforms, sometimes IO is not synchronized with
|
||||
|
@ -355,10 +355,10 @@ wr32m(struct wx_hw *wxhw, u32 reg, u32 mask, u32 field)
|
|||
*/
|
||||
#define WX_WRITE_FLUSH(H) rd32(H, WX_MIS_PWR)
|
||||
|
||||
#define wx_err(wxhw, fmt, arg...) \
|
||||
dev_err(&(wxhw)->pdev->dev, fmt, ##arg)
|
||||
#define wx_err(wx, fmt, arg...) \
|
||||
dev_err(&(wx)->pdev->dev, fmt, ##arg)
|
||||
|
||||
#define wx_dbg(wxhw, fmt, arg...) \
|
||||
dev_dbg(&(wxhw)->pdev->dev, fmt, ##arg)
|
||||
#define wx_dbg(wx, fmt, arg...) \
|
||||
dev_dbg(&(wx)->pdev->dev, fmt, ##arg)
|
||||
|
||||
#endif /* _WX_TYPE_H_ */
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
int ngbe_eeprom_chksum_hostif(struct ngbe_adapter *adapter)
|
||||
{
|
||||
struct wx_hic_read_shadow_ram buffer;
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
int status;
|
||||
int tmp;
|
||||
|
||||
|
@ -26,12 +26,12 @@ int ngbe_eeprom_chksum_hostif(struct ngbe_adapter *adapter)
|
|||
/* one word */
|
||||
buffer.length = 0;
|
||||
|
||||
status = wx_host_interface_command(wxhw, (u32 *)&buffer, sizeof(buffer),
|
||||
status = wx_host_interface_command(wx, (u32 *)&buffer, sizeof(buffer),
|
||||
WX_HI_COMMAND_TIMEOUT, false);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
tmp = rd32a(wxhw, WX_MNG_MBOX, 1);
|
||||
tmp = rd32a(wx, WX_MNG_MBOX, 1);
|
||||
if (tmp == NGBE_FW_CMD_ST_PASS)
|
||||
return 0;
|
||||
return -EIO;
|
||||
|
@ -39,15 +39,15 @@ int ngbe_eeprom_chksum_hostif(struct ngbe_adapter *adapter)
|
|||
|
||||
static int ngbe_reset_misc(struct ngbe_adapter *adapter)
|
||||
{
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
|
||||
wx_reset_misc(wxhw);
|
||||
wx_reset_misc(wx);
|
||||
if (adapter->mac_type == ngbe_mac_type_rgmii)
|
||||
wr32(wxhw, NGBE_MDIO_CLAUSE_SELECT, 0xF);
|
||||
wr32(wx, NGBE_MDIO_CLAUSE_SELECT, 0xF);
|
||||
if (adapter->gpio_ctrl) {
|
||||
/* gpio0 is used to power on/off control*/
|
||||
wr32(wxhw, NGBE_GPIO_DDR, 0x1);
|
||||
wr32(wxhw, NGBE_GPIO_DR, NGBE_GPIO_DR_0);
|
||||
wr32(wx, NGBE_GPIO_DDR, 0x1);
|
||||
wr32(wx, NGBE_GPIO_DR, NGBE_GPIO_DR_0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -62,25 +62,25 @@ static int ngbe_reset_misc(struct ngbe_adapter *adapter)
|
|||
**/
|
||||
int ngbe_reset_hw(struct ngbe_adapter *adapter)
|
||||
{
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
int status = 0;
|
||||
u32 reset = 0;
|
||||
|
||||
/* Call adapter stop to disable tx/rx and clear interrupts */
|
||||
status = wx_stop_adapter(wxhw);
|
||||
status = wx_stop_adapter(wx);
|
||||
if (status != 0)
|
||||
return status;
|
||||
reset = WX_MIS_RST_LAN_RST(wxhw->bus.func);
|
||||
wr32(wxhw, WX_MIS_RST, reset | rd32(wxhw, WX_MIS_RST));
|
||||
reset = WX_MIS_RST_LAN_RST(wx->bus.func);
|
||||
wr32(wx, WX_MIS_RST, reset | rd32(wx, WX_MIS_RST));
|
||||
ngbe_reset_misc(adapter);
|
||||
|
||||
/* Store the permanent mac address */
|
||||
wx_get_mac_addr(wxhw, wxhw->mac.perm_addr);
|
||||
wx_get_mac_addr(wx, wx->mac.perm_addr);
|
||||
|
||||
/* reset num_rar_entries to 128 */
|
||||
wxhw->mac.num_rar_entries = NGBE_RAR_ENTRIES;
|
||||
wx_init_rx_addrs(wxhw);
|
||||
pci_set_master(wxhw->pdev);
|
||||
wx->mac.num_rar_entries = NGBE_RAR_ENTRIES;
|
||||
wx_init_rx_addrs(wx);
|
||||
pci_set_master(wx->pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ static const struct pci_device_id ngbe_pci_tbl[] = {
|
|||
**/
|
||||
static void ngbe_init_type_code(struct ngbe_adapter *adapter)
|
||||
{
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
int wol_mask = 0, ncsi_mask = 0;
|
||||
u16 type_mask = 0;
|
||||
|
||||
wxhw->mac.type = wx_mac_em;
|
||||
type_mask = (u16)(wxhw->subsystem_device_id & NGBE_OEM_MASK);
|
||||
ncsi_mask = wxhw->subsystem_device_id & NGBE_NCSI_MASK;
|
||||
wol_mask = wxhw->subsystem_device_id & NGBE_WOL_MASK;
|
||||
wx->mac.type = wx_mac_em;
|
||||
type_mask = (u16)(wx->subsystem_device_id & NGBE_OEM_MASK);
|
||||
ncsi_mask = wx->subsystem_device_id & NGBE_NCSI_MASK;
|
||||
wol_mask = wx->subsystem_device_id & NGBE_WOL_MASK;
|
||||
|
||||
switch (type_mask) {
|
||||
case NGBE_SUBID_M88E1512_SFP:
|
||||
|
@ -134,19 +134,19 @@ static inline int ngbe_init_rss_key(struct ngbe_adapter *adapter)
|
|||
static int ngbe_sw_init(struct ngbe_adapter *adapter)
|
||||
{
|
||||
struct pci_dev *pdev = adapter->pdev;
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
u16 msix_count = 0;
|
||||
int err = 0;
|
||||
|
||||
wxhw->hw_addr = adapter->io_addr;
|
||||
wxhw->pdev = pdev;
|
||||
wx->hw_addr = adapter->io_addr;
|
||||
wx->pdev = pdev;
|
||||
|
||||
wxhw->mac.num_rar_entries = NGBE_RAR_ENTRIES;
|
||||
wxhw->mac.max_rx_queues = NGBE_MAX_RX_QUEUES;
|
||||
wxhw->mac.max_tx_queues = NGBE_MAX_TX_QUEUES;
|
||||
wx->mac.num_rar_entries = NGBE_RAR_ENTRIES;
|
||||
wx->mac.max_rx_queues = NGBE_MAX_RX_QUEUES;
|
||||
wx->mac.max_tx_queues = NGBE_MAX_TX_QUEUES;
|
||||
|
||||
/* PCI config space info */
|
||||
err = wx_sw_init(wxhw);
|
||||
err = wx_sw_init(wx);
|
||||
if (err < 0) {
|
||||
netif_err(adapter, probe, adapter->netdev,
|
||||
"Read of internal subsystem device id failed\n");
|
||||
|
@ -158,10 +158,10 @@ static int ngbe_sw_init(struct ngbe_adapter *adapter)
|
|||
|
||||
/* Set common capability flags and settings */
|
||||
adapter->max_q_vectors = NGBE_MAX_MSIX_VECTORS;
|
||||
err = wx_get_pcie_msix_counts(wxhw, &msix_count, NGBE_MAX_MSIX_VECTORS);
|
||||
err = wx_get_pcie_msix_counts(wx, &msix_count, NGBE_MAX_MSIX_VECTORS);
|
||||
if (err)
|
||||
dev_err(&pdev->dev, "Do not support MSI-X\n");
|
||||
wxhw->mac.max_msix_vectors = msix_count;
|
||||
wx->mac.max_msix_vectors = msix_count;
|
||||
|
||||
if (ngbe_init_rss_key(adapter))
|
||||
return -ENOMEM;
|
||||
|
@ -199,9 +199,9 @@ static void ngbe_down(struct ngbe_adapter *adapter)
|
|||
static int ngbe_open(struct net_device *netdev)
|
||||
{
|
||||
struct ngbe_adapter *adapter = netdev_priv(netdev);
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
|
||||
wx_control_hw(wxhw, true);
|
||||
wx_control_hw(wx, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ static int ngbe_close(struct net_device *netdev)
|
|||
struct ngbe_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
ngbe_down(adapter);
|
||||
wx_control_hw(&adapter->wxhw, false);
|
||||
wx_control_hw(&adapter->wx, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ static void ngbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake)
|
|||
if (netif_running(netdev))
|
||||
ngbe_down(adapter);
|
||||
rtnl_unlock();
|
||||
wx_control_hw(&adapter->wxhw, false);
|
||||
wx_control_hw(&adapter->wx, false);
|
||||
|
||||
pci_disable_device(pdev);
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ static int ngbe_probe(struct pci_dev *pdev,
|
|||
const struct pci_device_id __always_unused *ent)
|
||||
{
|
||||
struct ngbe_adapter *adapter = NULL;
|
||||
struct wx_hw *wxhw = NULL;
|
||||
struct wx *wx = NULL;
|
||||
struct net_device *netdev;
|
||||
u32 e2rom_cksum_cap = 0;
|
||||
static int func_nums;
|
||||
|
@ -333,8 +333,8 @@ static int ngbe_probe(struct pci_dev *pdev,
|
|||
adapter = netdev_priv(netdev);
|
||||
adapter->netdev = netdev;
|
||||
adapter->pdev = pdev;
|
||||
wxhw = &adapter->wxhw;
|
||||
wxhw->netdev = netdev;
|
||||
wx = &adapter->wx;
|
||||
wx->netdev = netdev;
|
||||
adapter->msg_enable = BIT(3) - 1;
|
||||
|
||||
adapter->io_addr = devm_ioremap(&pdev->dev,
|
||||
|
@ -356,14 +356,14 @@ static int ngbe_probe(struct pci_dev *pdev,
|
|||
goto err_free_mac_table;
|
||||
|
||||
/* check if flash load is done after hw power up */
|
||||
err = wx_check_flash_load(wxhw, NGBE_SPI_ILDR_STATUS_PERST);
|
||||
err = wx_check_flash_load(wx, NGBE_SPI_ILDR_STATUS_PERST);
|
||||
if (err)
|
||||
goto err_free_mac_table;
|
||||
err = wx_check_flash_load(wxhw, NGBE_SPI_ILDR_STATUS_PWRRST);
|
||||
err = wx_check_flash_load(wx, NGBE_SPI_ILDR_STATUS_PWRRST);
|
||||
if (err)
|
||||
goto err_free_mac_table;
|
||||
|
||||
err = wx_mng_present(wxhw);
|
||||
err = wx_mng_present(wx);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "Management capability is not present\n");
|
||||
goto err_free_mac_table;
|
||||
|
@ -375,16 +375,16 @@ static int ngbe_probe(struct pci_dev *pdev,
|
|||
goto err_free_mac_table;
|
||||
}
|
||||
|
||||
if (wxhw->bus.func == 0) {
|
||||
wr32(wxhw, NGBE_CALSUM_CAP_STATUS, 0x0);
|
||||
wr32(wxhw, NGBE_EEPROM_VERSION_STORE_REG, 0x0);
|
||||
if (wx->bus.func == 0) {
|
||||
wr32(wx, NGBE_CALSUM_CAP_STATUS, 0x0);
|
||||
wr32(wx, NGBE_EEPROM_VERSION_STORE_REG, 0x0);
|
||||
} else {
|
||||
e2rom_cksum_cap = rd32(wxhw, NGBE_CALSUM_CAP_STATUS);
|
||||
saved_ver = rd32(wxhw, NGBE_EEPROM_VERSION_STORE_REG);
|
||||
e2rom_cksum_cap = rd32(wx, NGBE_CALSUM_CAP_STATUS);
|
||||
saved_ver = rd32(wx, NGBE_EEPROM_VERSION_STORE_REG);
|
||||
}
|
||||
|
||||
wx_init_eeprom_params(wxhw);
|
||||
if (wxhw->bus.func == 0 || e2rom_cksum_cap == 0) {
|
||||
wx_init_eeprom_params(wx);
|
||||
if (wx->bus.func == 0 || e2rom_cksum_cap == 0) {
|
||||
/* make sure the EEPROM is ready */
|
||||
err = ngbe_eeprom_chksum_hostif(adapter);
|
||||
if (err) {
|
||||
|
@ -399,7 +399,7 @@ static int ngbe_probe(struct pci_dev *pdev,
|
|||
adapter->wol = NGBE_PSR_WKUP_CTL_MAG;
|
||||
|
||||
adapter->wol_enabled = !!(adapter->wol);
|
||||
wr32(wxhw, NGBE_PSR_WKUP_CTL, adapter->wol);
|
||||
wr32(wx, NGBE_PSR_WKUP_CTL, adapter->wol);
|
||||
|
||||
device_set_wakeup_enable(&pdev->dev, adapter->wol);
|
||||
|
||||
|
@ -409,19 +409,19 @@ static int ngbe_probe(struct pci_dev *pdev,
|
|||
if (saved_ver) {
|
||||
etrack_id = saved_ver;
|
||||
} else {
|
||||
wx_read_ee_hostif(wxhw,
|
||||
wxhw->eeprom.sw_region_offset + NGBE_EEPROM_VERSION_H,
|
||||
wx_read_ee_hostif(wx,
|
||||
wx->eeprom.sw_region_offset + NGBE_EEPROM_VERSION_H,
|
||||
&e2rom_ver);
|
||||
etrack_id = e2rom_ver << 16;
|
||||
wx_read_ee_hostif(wxhw,
|
||||
wxhw->eeprom.sw_region_offset + NGBE_EEPROM_VERSION_L,
|
||||
wx_read_ee_hostif(wx,
|
||||
wx->eeprom.sw_region_offset + NGBE_EEPROM_VERSION_L,
|
||||
&e2rom_ver);
|
||||
etrack_id |= e2rom_ver;
|
||||
wr32(wxhw, NGBE_EEPROM_VERSION_STORE_REG, etrack_id);
|
||||
wr32(wx, NGBE_EEPROM_VERSION_STORE_REG, etrack_id);
|
||||
}
|
||||
|
||||
eth_hw_addr_set(netdev, wxhw->mac.perm_addr);
|
||||
wx_mac_set_default_filter(wxhw, wxhw->mac.perm_addr);
|
||||
eth_hw_addr_set(netdev, wx->mac.perm_addr);
|
||||
wx_mac_set_default_filter(wx, wx->mac.perm_addr);
|
||||
|
||||
err = register_netdev(netdev);
|
||||
if (err)
|
||||
|
@ -437,9 +437,9 @@ static int ngbe_probe(struct pci_dev *pdev,
|
|||
return 0;
|
||||
|
||||
err_register:
|
||||
wx_control_hw(wxhw, false);
|
||||
wx_control_hw(wx, false);
|
||||
err_free_mac_table:
|
||||
kfree(wxhw->mac_table);
|
||||
kfree(wx->mac_table);
|
||||
err_pci_release_regions:
|
||||
pci_disable_pcie_error_reporting(pdev);
|
||||
pci_release_selected_regions(pdev,
|
||||
|
@ -461,7 +461,7 @@ err_pci_disable_dev:
|
|||
static void ngbe_remove(struct pci_dev *pdev)
|
||||
{
|
||||
struct ngbe_adapter *adapter = pci_get_drvdata(pdev);
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
struct net_device *netdev;
|
||||
|
||||
netdev = adapter->netdev;
|
||||
|
@ -469,7 +469,7 @@ static void ngbe_remove(struct pci_dev *pdev)
|
|||
pci_release_selected_regions(pdev,
|
||||
pci_select_bars(pdev, IORESOURCE_MEM));
|
||||
|
||||
kfree(wxhw->mac_table);
|
||||
kfree(wx->mac_table);
|
||||
pci_disable_pcie_error_reporting(pdev);
|
||||
|
||||
pci_disable_device(pdev);
|
||||
|
|
|
@ -154,7 +154,7 @@ struct ngbe_adapter {
|
|||
struct net_device *netdev;
|
||||
struct pci_dev *pdev;
|
||||
|
||||
struct wx_hw wxhw;
|
||||
struct wx wx;
|
||||
struct ngbe_phy_info phy;
|
||||
enum ngbe_mac_type mac_type;
|
||||
|
||||
|
|
|
@ -15,64 +15,64 @@
|
|||
|
||||
/**
|
||||
* txgbe_init_thermal_sensor_thresh - Inits thermal sensor thresholds
|
||||
* @wxhw: pointer to hardware structure
|
||||
* @wx: pointer to hardware structure
|
||||
*
|
||||
* Inits the thermal sensor thresholds according to the NVM map
|
||||
* and save off the threshold and location values into mac.thermal_sensor_data
|
||||
**/
|
||||
static void txgbe_init_thermal_sensor_thresh(struct wx_hw *wxhw)
|
||||
static void txgbe_init_thermal_sensor_thresh(struct wx *wx)
|
||||
{
|
||||
struct wx_thermal_sensor_data *data = &wxhw->mac.sensor;
|
||||
struct wx_thermal_sensor_data *data = &wx->mac.sensor;
|
||||
|
||||
memset(data, 0, sizeof(struct wx_thermal_sensor_data));
|
||||
|
||||
/* Only support thermal sensors attached to SP physical port 0 */
|
||||
if (wxhw->bus.func)
|
||||
if (wx->bus.func)
|
||||
return;
|
||||
|
||||
wr32(wxhw, TXGBE_TS_CTL, TXGBE_TS_CTL_EVAL_MD);
|
||||
wr32(wx, TXGBE_TS_CTL, TXGBE_TS_CTL_EVAL_MD);
|
||||
|
||||
wr32(wxhw, WX_TS_INT_EN,
|
||||
wr32(wx, WX_TS_INT_EN,
|
||||
WX_TS_INT_EN_ALARM_INT_EN | WX_TS_INT_EN_DALARM_INT_EN);
|
||||
wr32(wxhw, WX_TS_EN, WX_TS_EN_ENA);
|
||||
wr32(wx, WX_TS_EN, WX_TS_EN_ENA);
|
||||
|
||||
data->alarm_thresh = 100;
|
||||
wr32(wxhw, WX_TS_ALARM_THRE, 677);
|
||||
wr32(wx, WX_TS_ALARM_THRE, 677);
|
||||
data->dalarm_thresh = 90;
|
||||
wr32(wxhw, WX_TS_DALARM_THRE, 614);
|
||||
wr32(wx, WX_TS_DALARM_THRE, 614);
|
||||
}
|
||||
|
||||
/**
|
||||
* txgbe_read_pba_string - Reads part number string from EEPROM
|
||||
* @wxhw: pointer to hardware structure
|
||||
* @wx: pointer to hardware structure
|
||||
* @pba_num: stores the part number string from the EEPROM
|
||||
* @pba_num_size: part number string buffer length
|
||||
*
|
||||
* Reads the part number string from the EEPROM.
|
||||
**/
|
||||
int txgbe_read_pba_string(struct wx_hw *wxhw, u8 *pba_num, u32 pba_num_size)
|
||||
int txgbe_read_pba_string(struct wx *wx, u8 *pba_num, u32 pba_num_size)
|
||||
{
|
||||
u16 pba_ptr, offset, length, data;
|
||||
int ret_val;
|
||||
|
||||
if (!pba_num) {
|
||||
wx_err(wxhw, "PBA string buffer was null\n");
|
||||
wx_err(wx, "PBA string buffer was null\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret_val = wx_read_ee_hostif(wxhw,
|
||||
wxhw->eeprom.sw_region_offset + TXGBE_PBANUM0_PTR,
|
||||
ret_val = wx_read_ee_hostif(wx,
|
||||
wx->eeprom.sw_region_offset + TXGBE_PBANUM0_PTR,
|
||||
&data);
|
||||
if (ret_val != 0) {
|
||||
wx_err(wxhw, "NVM Read Error\n");
|
||||
wx_err(wx, "NVM Read Error\n");
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
ret_val = wx_read_ee_hostif(wxhw,
|
||||
wxhw->eeprom.sw_region_offset + TXGBE_PBANUM1_PTR,
|
||||
ret_val = wx_read_ee_hostif(wx,
|
||||
wx->eeprom.sw_region_offset + TXGBE_PBANUM1_PTR,
|
||||
&pba_ptr);
|
||||
if (ret_val != 0) {
|
||||
wx_err(wxhw, "NVM Read Error\n");
|
||||
wx_err(wx, "NVM Read Error\n");
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
@ -81,11 +81,11 @@ int txgbe_read_pba_string(struct wx_hw *wxhw, u8 *pba_num, u32 pba_num_size)
|
|||
* and we can decode it into an ascii string
|
||||
*/
|
||||
if (data != TXGBE_PBANUM_PTR_GUARD) {
|
||||
wx_err(wxhw, "NVM PBA number is not stored as string\n");
|
||||
wx_err(wx, "NVM PBA number is not stored as string\n");
|
||||
|
||||
/* we will need 11 characters to store the PBA */
|
||||
if (pba_num_size < 11) {
|
||||
wx_err(wxhw, "PBA string buffer too small\n");
|
||||
wx_err(wx, "PBA string buffer too small\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -115,20 +115,20 @@ int txgbe_read_pba_string(struct wx_hw *wxhw, u8 *pba_num, u32 pba_num_size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ret_val = wx_read_ee_hostif(wxhw, pba_ptr, &length);
|
||||
ret_val = wx_read_ee_hostif(wx, pba_ptr, &length);
|
||||
if (ret_val != 0) {
|
||||
wx_err(wxhw, "NVM Read Error\n");
|
||||
wx_err(wx, "NVM Read Error\n");
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
if (length == 0xFFFF || length == 0) {
|
||||
wx_err(wxhw, "NVM PBA number section invalid length\n");
|
||||
wx_err(wx, "NVM PBA number section invalid length\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* check if pba_num buffer is big enough */
|
||||
if (pba_num_size < (((u32)length * 2) - 1)) {
|
||||
wx_err(wxhw, "PBA string buffer too small\n");
|
||||
wx_err(wx, "PBA string buffer too small\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -137,9 +137,9 @@ int txgbe_read_pba_string(struct wx_hw *wxhw, u8 *pba_num, u32 pba_num_size)
|
|||
length--;
|
||||
|
||||
for (offset = 0; offset < length; offset++) {
|
||||
ret_val = wx_read_ee_hostif(wxhw, pba_ptr + offset, &data);
|
||||
ret_val = wx_read_ee_hostif(wx, pba_ptr + offset, &data);
|
||||
if (ret_val != 0) {
|
||||
wx_err(wxhw, "NVM Read Error\n");
|
||||
wx_err(wx, "NVM Read Error\n");
|
||||
return ret_val;
|
||||
}
|
||||
pba_num[offset * 2] = (u8)(data >> 8);
|
||||
|
@ -152,12 +152,12 @@ int txgbe_read_pba_string(struct wx_hw *wxhw, u8 *pba_num, u32 pba_num_size)
|
|||
|
||||
/**
|
||||
* txgbe_calc_eeprom_checksum - Calculates and returns the checksum
|
||||
* @wxhw: pointer to hardware structure
|
||||
* @wx: pointer to hardware structure
|
||||
* @checksum: pointer to cheksum
|
||||
*
|
||||
* Returns a negative error code on error
|
||||
**/
|
||||
static int txgbe_calc_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum)
|
||||
static int txgbe_calc_eeprom_checksum(struct wx *wx, u16 *checksum)
|
||||
{
|
||||
u16 *eeprom_ptrs = NULL;
|
||||
u32 buffer_size = 0;
|
||||
|
@ -166,7 +166,7 @@ static int txgbe_calc_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum)
|
|||
int status;
|
||||
u16 i;
|
||||
|
||||
wx_init_eeprom_params(wxhw);
|
||||
wx_init_eeprom_params(wx);
|
||||
|
||||
if (!buffer) {
|
||||
eeprom_ptrs = kvmalloc_array(TXGBE_EEPROM_LAST_WORD, sizeof(u16),
|
||||
|
@ -174,11 +174,11 @@ static int txgbe_calc_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum)
|
|||
if (!eeprom_ptrs)
|
||||
return -ENOMEM;
|
||||
/* Read pointer area */
|
||||
status = wx_read_ee_hostif_buffer(wxhw, 0,
|
||||
status = wx_read_ee_hostif_buffer(wx, 0,
|
||||
TXGBE_EEPROM_LAST_WORD,
|
||||
eeprom_ptrs);
|
||||
if (status != 0) {
|
||||
wx_err(wxhw, "Failed to read EEPROM image\n");
|
||||
wx_err(wx, "Failed to read EEPROM image\n");
|
||||
kvfree(eeprom_ptrs);
|
||||
return status;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ static int txgbe_calc_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum)
|
|||
}
|
||||
|
||||
for (i = 0; i < TXGBE_EEPROM_LAST_WORD; i++)
|
||||
if (i != wxhw->eeprom.sw_region_offset + TXGBE_EEPROM_CHECKSUM)
|
||||
if (i != wx->eeprom.sw_region_offset + TXGBE_EEPROM_CHECKSUM)
|
||||
*checksum += local_buffer[i];
|
||||
|
||||
if (eeprom_ptrs)
|
||||
|
@ -206,13 +206,13 @@ static int txgbe_calc_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum)
|
|||
|
||||
/**
|
||||
* txgbe_validate_eeprom_checksum - Validate EEPROM checksum
|
||||
* @wxhw: pointer to hardware structure
|
||||
* @wx: pointer to hardware structure
|
||||
* @checksum_val: calculated checksum
|
||||
*
|
||||
* Performs checksum calculation and validates the EEPROM checksum. If the
|
||||
* caller does not need checksum_val, the value can be NULL.
|
||||
**/
|
||||
int txgbe_validate_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum_val)
|
||||
int txgbe_validate_eeprom_checksum(struct wx *wx, u16 *checksum_val)
|
||||
{
|
||||
u16 read_checksum = 0;
|
||||
u16 checksum;
|
||||
|
@ -222,18 +222,18 @@ int txgbe_validate_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum_val)
|
|||
* not continue or we could be in for a very long wait while every
|
||||
* EEPROM read fails
|
||||
*/
|
||||
status = wx_read_ee_hostif(wxhw, 0, &checksum);
|
||||
status = wx_read_ee_hostif(wx, 0, &checksum);
|
||||
if (status) {
|
||||
wx_err(wxhw, "EEPROM read failed\n");
|
||||
wx_err(wx, "EEPROM read failed\n");
|
||||
return status;
|
||||
}
|
||||
|
||||
checksum = 0;
|
||||
status = txgbe_calc_eeprom_checksum(wxhw, &checksum);
|
||||
status = txgbe_calc_eeprom_checksum(wx, &checksum);
|
||||
if (status != 0)
|
||||
return status;
|
||||
|
||||
status = wx_read_ee_hostif(wxhw, wxhw->eeprom.sw_region_offset +
|
||||
status = wx_read_ee_hostif(wx, wx->eeprom.sw_region_offset +
|
||||
TXGBE_EEPROM_CHECKSUM, &read_checksum);
|
||||
if (status != 0)
|
||||
return status;
|
||||
|
@ -243,7 +243,7 @@ int txgbe_validate_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum_val)
|
|||
*/
|
||||
if (read_checksum != checksum) {
|
||||
status = -EIO;
|
||||
wx_err(wxhw, "Invalid EEPROM checksum\n");
|
||||
wx_err(wx, "Invalid EEPROM checksum\n");
|
||||
}
|
||||
|
||||
/* If the user cares, return the calculated checksum */
|
||||
|
@ -255,10 +255,10 @@ int txgbe_validate_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum_val)
|
|||
|
||||
static void txgbe_reset_misc(struct txgbe_adapter *adapter)
|
||||
{
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
|
||||
wx_reset_misc(wxhw);
|
||||
txgbe_init_thermal_sensor_thresh(wxhw);
|
||||
wx_reset_misc(wx);
|
||||
txgbe_init_thermal_sensor_thresh(wx);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,37 +271,37 @@ static void txgbe_reset_misc(struct txgbe_adapter *adapter)
|
|||
**/
|
||||
int txgbe_reset_hw(struct txgbe_adapter *adapter)
|
||||
{
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
int status;
|
||||
|
||||
/* Call adapter stop to disable tx/rx and clear interrupts */
|
||||
status = wx_stop_adapter(wxhw);
|
||||
status = wx_stop_adapter(wx);
|
||||
if (status != 0)
|
||||
return status;
|
||||
|
||||
if (!(((wxhw->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
|
||||
((wxhw->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP)))
|
||||
wx_reset_hostif(wxhw);
|
||||
if (!(((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
|
||||
((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP)))
|
||||
wx_reset_hostif(wx);
|
||||
|
||||
usleep_range(10, 100);
|
||||
|
||||
status = wx_check_flash_load(wxhw, TXGBE_SPI_ILDR_STATUS_LAN_SW_RST(wxhw->bus.func));
|
||||
status = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_LAN_SW_RST(wx->bus.func));
|
||||
if (status != 0)
|
||||
return status;
|
||||
|
||||
txgbe_reset_misc(adapter);
|
||||
|
||||
/* Store the permanent mac address */
|
||||
wx_get_mac_addr(wxhw, wxhw->mac.perm_addr);
|
||||
wx_get_mac_addr(wx, wx->mac.perm_addr);
|
||||
|
||||
/* Store MAC address from RAR0, clear receive address registers, and
|
||||
* clear the multicast table. Also reset num_rar_entries to 128,
|
||||
* since we modify this value when programming the SAN MAC address.
|
||||
*/
|
||||
wxhw->mac.num_rar_entries = TXGBE_SP_RAR_ENTRIES;
|
||||
wx_init_rx_addrs(wxhw);
|
||||
wx->mac.num_rar_entries = TXGBE_SP_RAR_ENTRIES;
|
||||
wx_init_rx_addrs(wx);
|
||||
|
||||
pci_set_master(wxhw->pdev);
|
||||
pci_set_master(wx->pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#ifndef _TXGBE_HW_H_
|
||||
#define _TXGBE_HW_H_
|
||||
|
||||
int txgbe_read_pba_string(struct wx_hw *wxhw, u8 *pba_num, u32 pba_num_size);
|
||||
int txgbe_validate_eeprom_checksum(struct wx_hw *wxhw, u16 *checksum_val);
|
||||
int txgbe_read_pba_string(struct wx *wx, u8 *pba_num, u32 pba_num_size);
|
||||
int txgbe_validate_eeprom_checksum(struct wx *wx, u16 *checksum_val);
|
||||
int txgbe_reset_hw(struct txgbe_adapter *adapter);
|
||||
|
||||
#endif /* _TXGBE_HW_H_ */
|
||||
|
|
|
@ -74,15 +74,15 @@ static int txgbe_enumerate_functions(struct txgbe_adapter *adapter)
|
|||
|
||||
static void txgbe_up_complete(struct txgbe_adapter *adapter)
|
||||
{
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
|
||||
wx_control_hw(wxhw, true);
|
||||
wx_control_hw(wx, true);
|
||||
}
|
||||
|
||||
static void txgbe_reset(struct txgbe_adapter *adapter)
|
||||
{
|
||||
struct net_device *netdev = adapter->netdev;
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
u8 old_addr[ETH_ALEN];
|
||||
int err;
|
||||
|
||||
|
@ -91,38 +91,38 @@ static void txgbe_reset(struct txgbe_adapter *adapter)
|
|||
dev_err(&adapter->pdev->dev, "Hardware Error: %d\n", err);
|
||||
|
||||
/* do not flush user set addresses */
|
||||
memcpy(old_addr, &wxhw->mac_table[0].addr, netdev->addr_len);
|
||||
wx_flush_sw_mac_table(wxhw);
|
||||
wx_mac_set_default_filter(wxhw, old_addr);
|
||||
memcpy(old_addr, &wx->mac_table[0].addr, netdev->addr_len);
|
||||
wx_flush_sw_mac_table(wx);
|
||||
wx_mac_set_default_filter(wx, old_addr);
|
||||
}
|
||||
|
||||
static void txgbe_disable_device(struct txgbe_adapter *adapter)
|
||||
{
|
||||
struct net_device *netdev = adapter->netdev;
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
|
||||
wx_disable_pcie_master(wxhw);
|
||||
wx_disable_pcie_master(wx);
|
||||
/* disable receives */
|
||||
wx_disable_rx(wxhw);
|
||||
wx_disable_rx(wx);
|
||||
|
||||
netif_carrier_off(netdev);
|
||||
netif_tx_disable(netdev);
|
||||
|
||||
if (wxhw->bus.func < 2)
|
||||
wr32m(wxhw, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wxhw->bus.func), 0);
|
||||
if (wx->bus.func < 2)
|
||||
wr32m(wx, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wx->bus.func), 0);
|
||||
else
|
||||
dev_err(&adapter->pdev->dev,
|
||||
"%s: invalid bus lan id %d\n",
|
||||
__func__, wxhw->bus.func);
|
||||
__func__, wx->bus.func);
|
||||
|
||||
if (!(((wxhw->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
|
||||
((wxhw->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP))) {
|
||||
if (!(((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
|
||||
((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP))) {
|
||||
/* disable mac transmiter */
|
||||
wr32m(wxhw, WX_MAC_TX_CFG, WX_MAC_TX_CFG_TE, 0);
|
||||
wr32m(wx, WX_MAC_TX_CFG, WX_MAC_TX_CFG_TE, 0);
|
||||
}
|
||||
|
||||
/* Disable the Tx DMA engine */
|
||||
wr32m(wxhw, WX_TDM_CTL, WX_TDM_CTL_TE, 0);
|
||||
wr32m(wx, WX_TDM_CTL, WX_TDM_CTL_TE, 0);
|
||||
}
|
||||
|
||||
static void txgbe_down(struct txgbe_adapter *adapter)
|
||||
|
@ -138,32 +138,32 @@ static void txgbe_down(struct txgbe_adapter *adapter)
|
|||
static int txgbe_sw_init(struct txgbe_adapter *adapter)
|
||||
{
|
||||
struct pci_dev *pdev = adapter->pdev;
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
int err;
|
||||
|
||||
wxhw->hw_addr = adapter->io_addr;
|
||||
wxhw->pdev = pdev;
|
||||
wx->hw_addr = adapter->io_addr;
|
||||
wx->pdev = pdev;
|
||||
|
||||
wxhw->mac.num_rar_entries = TXGBE_SP_RAR_ENTRIES;
|
||||
wxhw->mac.max_tx_queues = TXGBE_SP_MAX_TX_QUEUES;
|
||||
wxhw->mac.max_rx_queues = TXGBE_SP_MAX_RX_QUEUES;
|
||||
wxhw->mac.mcft_size = TXGBE_SP_MC_TBL_SIZE;
|
||||
wx->mac.num_rar_entries = TXGBE_SP_RAR_ENTRIES;
|
||||
wx->mac.max_tx_queues = TXGBE_SP_MAX_TX_QUEUES;
|
||||
wx->mac.max_rx_queues = TXGBE_SP_MAX_RX_QUEUES;
|
||||
wx->mac.mcft_size = TXGBE_SP_MC_TBL_SIZE;
|
||||
|
||||
/* PCI config space info */
|
||||
err = wx_sw_init(wxhw);
|
||||
err = wx_sw_init(wx);
|
||||
if (err < 0) {
|
||||
netif_err(adapter, probe, adapter->netdev,
|
||||
"read of internal subsystem device id failed\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
switch (wxhw->device_id) {
|
||||
switch (wx->device_id) {
|
||||
case TXGBE_DEV_ID_SP1000:
|
||||
case TXGBE_DEV_ID_WX1820:
|
||||
wxhw->mac.type = wx_mac_sp;
|
||||
wx->mac.type = wx_mac_sp;
|
||||
break;
|
||||
default:
|
||||
wxhw->mac.type = wx_mac_unknown;
|
||||
wx->mac.type = wx_mac_unknown;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ static int txgbe_close(struct net_device *netdev)
|
|||
struct txgbe_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
txgbe_down(adapter);
|
||||
wx_control_hw(&adapter->wxhw, false);
|
||||
wx_control_hw(&adapter->wx, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ static void txgbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake)
|
|||
{
|
||||
struct txgbe_adapter *adapter = pci_get_drvdata(pdev);
|
||||
struct net_device *netdev = adapter->netdev;
|
||||
struct wx_hw *wxhw = &adapter->wxhw;
|
||||
struct wx *wx = &adapter->wx;
|
||||
|
||||
netif_device_detach(netdev);
|
||||
|
||||
|
@ -234,7 +234,7 @@ static void txgbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake)
|
|||
txgbe_close_suspend(adapter);
|
||||
rtnl_unlock();
|
||||
|
||||
wx_control_hw(wxhw, false);
|
||||
wx_control_hw(wx, false);
|
||||
|
||||
pci_disable_device(pdev);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ static int txgbe_probe(struct pci_dev *pdev,
|
|||
const struct pci_device_id __always_unused *ent)
|
||||
{
|
||||
struct txgbe_adapter *adapter = NULL;
|
||||
struct wx_hw *wxhw = NULL;
|
||||
struct wx *wx = NULL;
|
||||
struct net_device *netdev;
|
||||
int err, expected_gts;
|
||||
|
||||
|
@ -327,8 +327,8 @@ static int txgbe_probe(struct pci_dev *pdev,
|
|||
adapter = netdev_priv(netdev);
|
||||
adapter->netdev = netdev;
|
||||
adapter->pdev = pdev;
|
||||
wxhw = &adapter->wxhw;
|
||||
wxhw->netdev = netdev;
|
||||
wx = &adapter->wx;
|
||||
wx->netdev = netdev;
|
||||
adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1;
|
||||
|
||||
adapter->io_addr = devm_ioremap(&pdev->dev,
|
||||
|
@ -347,14 +347,14 @@ static int txgbe_probe(struct pci_dev *pdev,
|
|||
goto err_free_mac_table;
|
||||
|
||||
/* check if flash load is done after hw power up */
|
||||
err = wx_check_flash_load(wxhw, TXGBE_SPI_ILDR_STATUS_PERST);
|
||||
err = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_PERST);
|
||||
if (err)
|
||||
goto err_free_mac_table;
|
||||
err = wx_check_flash_load(wxhw, TXGBE_SPI_ILDR_STATUS_PWRRST);
|
||||
err = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_PWRRST);
|
||||
if (err)
|
||||
goto err_free_mac_table;
|
||||
|
||||
err = wx_mng_present(wxhw);
|
||||
err = wx_mng_present(wx);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "Management capability is not present\n");
|
||||
goto err_free_mac_table;
|
||||
|
@ -369,36 +369,36 @@ static int txgbe_probe(struct pci_dev *pdev,
|
|||
netdev->features |= NETIF_F_HIGHDMA;
|
||||
|
||||
/* make sure the EEPROM is good */
|
||||
err = txgbe_validate_eeprom_checksum(wxhw, NULL);
|
||||
err = txgbe_validate_eeprom_checksum(wx, NULL);
|
||||
if (err != 0) {
|
||||
dev_err(&pdev->dev, "The EEPROM Checksum Is Not Valid\n");
|
||||
wr32(wxhw, WX_MIS_RST, WX_MIS_RST_SW_RST);
|
||||
wr32(wx, WX_MIS_RST, WX_MIS_RST_SW_RST);
|
||||
err = -EIO;
|
||||
goto err_free_mac_table;
|
||||
}
|
||||
|
||||
eth_hw_addr_set(netdev, wxhw->mac.perm_addr);
|
||||
wx_mac_set_default_filter(wxhw, wxhw->mac.perm_addr);
|
||||
eth_hw_addr_set(netdev, wx->mac.perm_addr);
|
||||
wx_mac_set_default_filter(wx, wx->mac.perm_addr);
|
||||
|
||||
/* Save off EEPROM version number and Option Rom version which
|
||||
* together make a unique identify for the eeprom
|
||||
*/
|
||||
wx_read_ee_hostif(wxhw,
|
||||
wxhw->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_H,
|
||||
wx_read_ee_hostif(wx,
|
||||
wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_H,
|
||||
&eeprom_verh);
|
||||
wx_read_ee_hostif(wxhw,
|
||||
wxhw->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_L,
|
||||
wx_read_ee_hostif(wx,
|
||||
wx->eeprom.sw_region_offset + TXGBE_EEPROM_VERSION_L,
|
||||
&eeprom_verl);
|
||||
etrack_id = (eeprom_verh << 16) | eeprom_verl;
|
||||
|
||||
wx_read_ee_hostif(wxhw,
|
||||
wxhw->eeprom.sw_region_offset + TXGBE_ISCSI_BOOT_CONFIG,
|
||||
wx_read_ee_hostif(wx,
|
||||
wx->eeprom.sw_region_offset + TXGBE_ISCSI_BOOT_CONFIG,
|
||||
&offset);
|
||||
|
||||
/* Make sure offset to SCSI block is valid */
|
||||
if (!(offset == 0x0) && !(offset == 0xffff)) {
|
||||
wx_read_ee_hostif(wxhw, offset + 0x84, &eeprom_cfg_blkh);
|
||||
wx_read_ee_hostif(wxhw, offset + 0x83, &eeprom_cfg_blkl);
|
||||
wx_read_ee_hostif(wx, offset + 0x84, &eeprom_cfg_blkh);
|
||||
wx_read_ee_hostif(wx, offset + 0x83, &eeprom_cfg_blkl);
|
||||
|
||||
/* Only display Option Rom if exist */
|
||||
if (eeprom_cfg_blkl && eeprom_cfg_blkh) {
|
||||
|
@ -439,7 +439,7 @@ static int txgbe_probe(struct pci_dev *pdev,
|
|||
dev_warn(&pdev->dev, "Failed to enumerate PF devices.\n");
|
||||
|
||||
/* First try to read PBA as a string */
|
||||
err = txgbe_read_pba_string(wxhw, part_str, TXGBE_PBANUM_LENGTH);
|
||||
err = txgbe_read_pba_string(wx, part_str, TXGBE_PBANUM_LENGTH);
|
||||
if (err)
|
||||
strncpy(part_str, "Unknown", TXGBE_PBANUM_LENGTH);
|
||||
|
||||
|
@ -448,9 +448,9 @@ static int txgbe_probe(struct pci_dev *pdev,
|
|||
return 0;
|
||||
|
||||
err_release_hw:
|
||||
wx_control_hw(wxhw, false);
|
||||
wx_control_hw(wx, false);
|
||||
err_free_mac_table:
|
||||
kfree(wxhw->mac_table);
|
||||
kfree(wx->mac_table);
|
||||
err_pci_release_regions:
|
||||
pci_disable_pcie_error_reporting(pdev);
|
||||
pci_release_selected_regions(pdev,
|
||||
|
@ -480,7 +480,7 @@ static void txgbe_remove(struct pci_dev *pdev)
|
|||
pci_release_selected_regions(pdev,
|
||||
pci_select_bars(pdev, IORESOURCE_MEM));
|
||||
|
||||
kfree(adapter->wxhw.mac_table);
|
||||
kfree(adapter->wx.mac_table);
|
||||
|
||||
pci_disable_pcie_error_reporting(pdev);
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ struct txgbe_adapter {
|
|||
/* OS defined structs */
|
||||
struct net_device *netdev;
|
||||
struct pci_dev *pdev;
|
||||
struct wx_hw wxhw;
|
||||
struct wx wx;
|
||||
u16 msg_enable;
|
||||
|
||||
char eeprom_id[32];
|
||||
|
|
Loading…
Reference in New Issue