netxen: add 2MB PCI memory support
New revision of netxen chip has 2MB PCI memory. Older chips had 128MB addressable PCI memory. To retain compatibility, this patch adds function pointers based on pci bar0 size. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
parent
e4c93c817c
commit
3ce06a320f
|
@ -799,6 +799,12 @@ struct netxen_hardware_context {
|
|||
unsigned long first_page_group_start;
|
||||
void __iomem *db_base;
|
||||
unsigned long db_len;
|
||||
unsigned long pci_len0;
|
||||
|
||||
int qdr_sn_window;
|
||||
int ddr_mn_window;
|
||||
unsigned long mn_win_crb;
|
||||
unsigned long ms_win_crb;
|
||||
|
||||
u8 revision_id;
|
||||
u16 board_type;
|
||||
|
@ -894,6 +900,8 @@ struct netxen_adapter {
|
|||
struct work_struct tx_timeout_task;
|
||||
|
||||
u32 curr_window;
|
||||
u32 crb_win;
|
||||
rwlock_t adapter_lock;
|
||||
|
||||
u32 cmd_producer;
|
||||
__le32 *cmd_consumer;
|
||||
|
@ -947,6 +955,17 @@ struct netxen_adapter {
|
|||
int (*init_port) (struct netxen_adapter *, int);
|
||||
void (*init_niu) (struct netxen_adapter *);
|
||||
int (*stop_port) (struct netxen_adapter *);
|
||||
|
||||
int (*hw_read_wx)(struct netxen_adapter *, ulong, void *, int);
|
||||
int (*hw_write_wx)(struct netxen_adapter *, ulong, void *, int);
|
||||
int (*pci_mem_read)(struct netxen_adapter *, u64, void *, int);
|
||||
int (*pci_mem_write)(struct netxen_adapter *, u64, void *, int);
|
||||
int (*pci_write_immediate)(struct netxen_adapter *, u64, u32);
|
||||
u32 (*pci_read_immediate)(struct netxen_adapter *, u64);
|
||||
void (*pci_write_normalize)(struct netxen_adapter *, u64, u32);
|
||||
u32 (*pci_read_normalize)(struct netxen_adapter *, u64);
|
||||
unsigned long (*pci_set_window)(struct netxen_adapter *,
|
||||
unsigned long long);
|
||||
}; /* netxen_adapter structure */
|
||||
|
||||
/*
|
||||
|
@ -1022,19 +1041,52 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
|
|||
int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu);
|
||||
int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu);
|
||||
void netxen_nic_init_niu_gb(struct netxen_adapter *adapter);
|
||||
void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw);
|
||||
void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val);
|
||||
int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off);
|
||||
void netxen_nic_write_w0(struct netxen_adapter *adapter, u32 index, u32 value);
|
||||
void netxen_nic_read_w0(struct netxen_adapter *adapter, u32 index, u32 * value);
|
||||
void netxen_nic_read_w0(struct netxen_adapter *adapter, u32 index, u32 *value);
|
||||
void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, u32 value);
|
||||
void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, u32 *value);
|
||||
|
||||
int netxen_nic_get_board_info(struct netxen_adapter *adapter);
|
||||
int netxen_nic_hw_read_wx(struct netxen_adapter *adapter, u64 off, void *data,
|
||||
int len);
|
||||
int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off, void *data,
|
||||
int len);
|
||||
|
||||
int netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter,
|
||||
ulong off, void *data, int len);
|
||||
int netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter,
|
||||
ulong off, void *data, int len);
|
||||
int netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter,
|
||||
u64 off, void *data, int size);
|
||||
int netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter,
|
||||
u64 off, void *data, int size);
|
||||
int netxen_nic_pci_write_immediate_128M(struct netxen_adapter *adapter,
|
||||
u64 off, u32 data);
|
||||
u32 netxen_nic_pci_read_immediate_128M(struct netxen_adapter *adapter, u64 off);
|
||||
void netxen_nic_pci_write_normalize_128M(struct netxen_adapter *adapter,
|
||||
u64 off, u32 data);
|
||||
u32 netxen_nic_pci_read_normalize_128M(struct netxen_adapter *adapter, u64 off);
|
||||
unsigned long netxen_nic_pci_set_window_128M(struct netxen_adapter *adapter,
|
||||
unsigned long long addr);
|
||||
void netxen_nic_pci_change_crbwindow_128M(struct netxen_adapter *adapter,
|
||||
u32 wndw);
|
||||
|
||||
int netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter,
|
||||
ulong off, void *data, int len);
|
||||
int netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter,
|
||||
ulong off, void *data, int len);
|
||||
int netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter,
|
||||
u64 off, void *data, int size);
|
||||
int netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter,
|
||||
u64 off, void *data, int size);
|
||||
void netxen_crb_writelit_adapter(struct netxen_adapter *adapter,
|
||||
unsigned long off, int data);
|
||||
int netxen_nic_pci_write_immediate_2M(struct netxen_adapter *adapter,
|
||||
u64 off, u32 data);
|
||||
u32 netxen_nic_pci_read_immediate_2M(struct netxen_adapter *adapter, u64 off);
|
||||
void netxen_nic_pci_write_normalize_2M(struct netxen_adapter *adapter,
|
||||
u64 off, u32 data);
|
||||
u32 netxen_nic_pci_read_normalize_2M(struct netxen_adapter *adapter, u64 off);
|
||||
unsigned long netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter,
|
||||
unsigned long long addr);
|
||||
|
||||
/* Functions from netxen_nic_init.c */
|
||||
void netxen_free_adapter_offload(struct netxen_adapter *adapter);
|
||||
|
@ -1129,7 +1181,7 @@ dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
|
|||
u32 ctrl;
|
||||
|
||||
/* check if already inactive */
|
||||
if (netxen_nic_hw_read_wx(adapter,
|
||||
if (adapter->hw_read_wx(adapter,
|
||||
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
|
||||
printk(KERN_ERR "failed to read dma watchdog status\n");
|
||||
|
||||
|
@ -1149,7 +1201,7 @@ dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
|
|||
{
|
||||
u32 ctrl;
|
||||
|
||||
if (netxen_nic_hw_read_wx(adapter,
|
||||
if (adapter->hw_read_wx(adapter,
|
||||
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
|
||||
printk(KERN_ERR "failed to read dma watchdog status\n");
|
||||
|
||||
|
@ -1161,7 +1213,7 @@ dma_watchdog_wakeup(struct netxen_adapter *adapter)
|
|||
{
|
||||
u32 ctrl;
|
||||
|
||||
if (netxen_nic_hw_read_wx(adapter,
|
||||
if (adapter->hw_read_wx(adapter,
|
||||
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
|
||||
printk(KERN_ERR "failed to read dma watchdog status\n");
|
||||
|
||||
|
|
|
@ -93,17 +93,21 @@ static void
|
|||
netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
|
||||
{
|
||||
struct netxen_adapter *adapter = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
u32 fw_major = 0;
|
||||
u32 fw_minor = 0;
|
||||
u32 fw_build = 0;
|
||||
|
||||
strncpy(drvinfo->driver, netxen_nic_driver_name, 32);
|
||||
strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32);
|
||||
fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_FW_VERSION_MAJOR));
|
||||
fw_minor = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_FW_VERSION_MINOR));
|
||||
fw_build = readl(NETXEN_CRB_NORMALIZE(adapter, NETXEN_FW_VERSION_SUB));
|
||||
write_lock_irqsave(&adapter->adapter_lock, flags);
|
||||
fw_major = adapter->pci_read_normalize(adapter,
|
||||
NETXEN_FW_VERSION_MAJOR);
|
||||
fw_minor = adapter->pci_read_normalize(adapter,
|
||||
NETXEN_FW_VERSION_MINOR);
|
||||
fw_build = adapter->pci_read_normalize(adapter,
|
||||
NETXEN_FW_VERSION_SUB);
|
||||
write_unlock_irqrestore(&adapter->adapter_lock, flags);
|
||||
sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build);
|
||||
|
||||
strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
|
||||
|
@ -361,19 +365,18 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
|
|||
{
|
||||
struct netxen_adapter *adapter = netdev_priv(dev);
|
||||
__u32 mode, *regs_buff = p;
|
||||
void __iomem *addr;
|
||||
int i, window;
|
||||
|
||||
memset(p, 0, NETXEN_NIC_REGS_LEN);
|
||||
regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) |
|
||||
(adapter->pdev)->device;
|
||||
/* which mode */
|
||||
NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_MODE, ®s_buff[0]);
|
||||
adapter->hw_read_wx(adapter, NETXEN_NIU_MODE, ®s_buff[0], 4);
|
||||
mode = regs_buff[0];
|
||||
|
||||
/* Common registers to all the modes */
|
||||
NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER,
|
||||
®s_buff[2]);
|
||||
adapter->hw_read_wx(adapter,
|
||||
NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER, ®s_buff[2], 4);
|
||||
/* GB/XGB Mode */
|
||||
mode = (mode / 2) - 1;
|
||||
window = 0;
|
||||
|
@ -384,9 +387,9 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
|
|||
window = adapter->physical_port *
|
||||
NETXEN_NIC_PORT_WINDOW;
|
||||
|
||||
NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
|
||||
reg[i - 3] + window,
|
||||
®s_buff[i]);
|
||||
adapter->hw_read_wx(adapter,
|
||||
niu_registers[mode].reg[i - 3] + window,
|
||||
®s_buff[i], 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -410,7 +413,7 @@ static u32 netxen_nic_test_link(struct net_device *dev)
|
|||
return !val;
|
||||
}
|
||||
} else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
|
||||
val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
|
||||
val = adapter->pci_read_normalize(adapter, CRB_XG_STATE);
|
||||
return (val == XG_LINK_UP) ? 0 : 1;
|
||||
}
|
||||
return -EIO;
|
||||
|
@ -668,7 +671,7 @@ static int netxen_nic_reg_test(struct net_device *dev)
|
|||
data_written = (u32)0xa5a5a5a5;
|
||||
|
||||
netxen_nic_reg_write(adapter, CRB_SCRATCHPAD_TEST, data_written);
|
||||
data_read = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_SCRATCHPAD_TEST));
|
||||
data_read = adapter->pci_read_normalize(adapter, CRB_SCRATCHPAD_TEST);
|
||||
if (data_written != data_read)
|
||||
return 1;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -82,19 +82,9 @@ struct netxen_adapter;
|
|||
|
||||
#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
|
||||
|
||||
#define NETXEN_NIC_LOCKED_READ_REG(X, Y) \
|
||||
addr = pci_base_offset(adapter, X); \
|
||||
*(u32 *)Y = readl((void __iomem*) addr);
|
||||
|
||||
struct netxen_port;
|
||||
void netxen_nic_set_link_parameters(struct netxen_adapter *adapter);
|
||||
void netxen_nic_flash_print(struct netxen_adapter *adapter);
|
||||
int netxen_nic_hw_write_wx(struct netxen_adapter *adapter, u64 off,
|
||||
void *data, int len);
|
||||
void netxen_crb_writelit_adapter(struct netxen_adapter *adapter,
|
||||
unsigned long off, int data);
|
||||
int netxen_nic_hw_read_wx(struct netxen_adapter *adapter, u64 off,
|
||||
void *data, int len);
|
||||
|
||||
typedef u8 netxen_ethernet_macaddr_t[6];
|
||||
|
||||
|
@ -503,4 +493,15 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter);
|
|||
|
||||
int netxen_niu_disable_xg_port(struct netxen_adapter *adapter);
|
||||
|
||||
typedef struct {
|
||||
unsigned valid;
|
||||
unsigned start_128M;
|
||||
unsigned end_128M;
|
||||
unsigned start_2M;
|
||||
} crb_128M_2M_sub_block_map_t;
|
||||
|
||||
typedef struct {
|
||||
crb_128M_2M_sub_block_map_t sub_block[16];
|
||||
} crb_128M_2M_block_map_t;
|
||||
|
||||
#endif /* __NETXEN_NIC_HW_H_ */
|
||||
|
|
|
@ -124,7 +124,7 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
|
|||
u32 state = 0, loops = 0, err = 0;
|
||||
|
||||
/* Window 1 call */
|
||||
state = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
|
||||
state = adapter->pci_read_normalize(adapter, CRB_CMDPEG_STATE);
|
||||
|
||||
if (state == PHAN_INITIALIZE_ACK)
|
||||
return 0;
|
||||
|
@ -132,7 +132,7 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
|
|||
while (state != PHAN_INITIALIZE_COMPLETE && loops < 2000) {
|
||||
udelay(100);
|
||||
/* Window 1 call */
|
||||
state = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
|
||||
state = adapter->pci_read_normalize(adapter, CRB_CMDPEG_STATE);
|
||||
|
||||
loops++;
|
||||
}
|
||||
|
@ -143,14 +143,14 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
|
|||
return err;
|
||||
}
|
||||
/* Window 1 call */
|
||||
writel(INTR_SCHEME_PERPORT,
|
||||
NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_HOST));
|
||||
writel(MSI_MODE_MULTIFUNC,
|
||||
NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_HOST));
|
||||
writel(MPORT_MULTI_FUNCTION_MODE,
|
||||
NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE));
|
||||
writel(PHAN_INITIALIZE_ACK,
|
||||
NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
CRB_NIC_CAPABILITIES_HOST, INTR_SCHEME_PERPORT);
|
||||
adapter->pci_write_normalize(adapter,
|
||||
CRB_NIC_MSI_MODE_HOST, MSI_MODE_MULTIFUNC);
|
||||
adapter->pci_write_normalize(adapter,
|
||||
CRB_MPORT_MODE, MPORT_MULTI_FUNCTION_MODE);
|
||||
adapter->pci_write_normalize(adapter,
|
||||
CRB_CMDPEG_STATE, PHAN_INITIALIZE_ACK);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
|
|||
buf[i].data = NETXEN_NIC_XDMA_RESET;
|
||||
}
|
||||
|
||||
netxen_nic_hw_write_wx(adapter, off, &buf[i].data, 4);
|
||||
adapter->hw_write_wx(adapter, off, &buf[i].data, 4);
|
||||
|
||||
if (init_delay == 1) {
|
||||
msleep(1000);
|
||||
|
@ -824,7 +824,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
|
|||
/* disable_peg_cache_all */
|
||||
|
||||
/* unreset_net_cache */
|
||||
netxen_nic_hw_read_wx(adapter, NETXEN_ROMUSB_GLB_SW_RESET, &val,
|
||||
adapter->hw_read_wx(adapter, NETXEN_ROMUSB_GLB_SW_RESET, &val,
|
||||
4);
|
||||
netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET,
|
||||
(val & 0xffffff0f));
|
||||
|
@ -884,8 +884,8 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
|
|||
hi = (addr >> 32) & 0xffffffff;
|
||||
lo = addr & 0xffffffff;
|
||||
|
||||
writel(hi, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI));
|
||||
writel(lo, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO));
|
||||
adapter->pci_write_normalize(adapter, CRB_HOST_DUMMY_BUF_ADDR_HI, hi);
|
||||
adapter->pci_write_normalize(adapter, CRB_HOST_DUMMY_BUF_ADDR_LO, lo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -924,10 +924,10 @@ int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val)
|
|||
|
||||
if (!pegtune_val) {
|
||||
do {
|
||||
val = readl(NETXEN_CRB_NORMALIZE
|
||||
(adapter, CRB_CMDPEG_STATE));
|
||||
pegtune_val = readl(NETXEN_CRB_NORMALIZE
|
||||
(adapter, NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
|
||||
val = adapter->pci_read_normalize(adapter,
|
||||
CRB_CMDPEG_STATE);
|
||||
pegtune_val = adapter->pci_read_normalize(adapter,
|
||||
NETXEN_ROMUSB_GLB_PEGTUNE_DONE);
|
||||
|
||||
if (val == PHAN_INITIALIZE_COMPLETE ||
|
||||
val == PHAN_INITIALIZE_ACK)
|
||||
|
@ -951,7 +951,7 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter)
|
|||
uint32_t temp, temp_state, temp_val;
|
||||
int rv = 0;
|
||||
|
||||
temp = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_TEMP_STATE));
|
||||
temp = adapter->pci_read_normalize(adapter, CRB_TEMP_STATE);
|
||||
|
||||
temp_state = nx_get_temp_state(temp);
|
||||
temp_val = nx_get_temp_val(temp);
|
||||
|
@ -1119,8 +1119,8 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
|
|||
recv_ctx->status_rx_consumer = consumer;
|
||||
|
||||
/* Window = 1 */
|
||||
writel(consumer, NETXEN_CRB_NORMALIZE(adapter,
|
||||
recv_ctx->crb_sts_consumer));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
recv_ctx->crb_sts_consumer, consumer);
|
||||
}
|
||||
|
||||
return count;
|
||||
|
@ -1264,9 +1264,9 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
|
|||
rcv_desc->begin_alloc = index;
|
||||
rcv_desc->producer = producer;
|
||||
/* Window = 1 */
|
||||
writel((producer - 1) & (rcv_desc->max_rx_desc_count - 1),
|
||||
NETXEN_CRB_NORMALIZE(adapter,
|
||||
rcv_desc->crb_rcv_producer));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
rcv_desc->crb_rcv_producer,
|
||||
(producer-1) & (rcv_desc->max_rx_desc_count-1));
|
||||
/*
|
||||
* Write a doorbell msg to tell phanmon of change in
|
||||
* receive ring producer
|
||||
|
@ -1344,9 +1344,9 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter,
|
|||
rcv_desc->begin_alloc = index;
|
||||
rcv_desc->producer = producer;
|
||||
/* Window = 1 */
|
||||
writel((producer - 1) & (rcv_desc->max_rx_desc_count - 1),
|
||||
NETXEN_CRB_NORMALIZE(adapter,
|
||||
rcv_desc->crb_rcv_producer));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
rcv_desc->crb_rcv_producer,
|
||||
(producer-1) & (rcv_desc->max_rx_desc_count-1));
|
||||
wmb();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ static void netxen_nic_isr_other(struct netxen_adapter *adapter)
|
|||
u32 val, linkup, qg_linksup;
|
||||
|
||||
/* verify the offset */
|
||||
val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
|
||||
val = adapter->pci_read_normalize(adapter, CRB_XG_STATE);
|
||||
val = val >> adapter->physical_port;
|
||||
if (val == adapter->ahw.qg_linksup)
|
||||
return;
|
||||
|
@ -198,7 +198,7 @@ void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter)
|
|||
u32 val;
|
||||
|
||||
/* WINDOW = 1 */
|
||||
val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE));
|
||||
val = adapter->pci_read_normalize(adapter, CRB_XG_STATE);
|
||||
val >>= (adapter->physical_port * 8);
|
||||
val &= 0xff;
|
||||
|
||||
|
|
|
@ -114,11 +114,12 @@ static uint32_t crb_cmd_producer[4] = {
|
|||
CRB_CMD_PRODUCER_OFFSET_2, CRB_CMD_PRODUCER_OFFSET_3
|
||||
};
|
||||
|
||||
static void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
|
||||
uint32_t crb_producer)
|
||||
static inline void
|
||||
netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
|
||||
uint32_t crb_producer)
|
||||
{
|
||||
writel(crb_producer, NETXEN_CRB_NORMALIZE(adapter,
|
||||
adapter->crb_addr_cmd_producer));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
adapter->crb_addr_cmd_producer, crb_producer);
|
||||
}
|
||||
|
||||
static uint32_t crb_cmd_consumer[4] = {
|
||||
|
@ -126,11 +127,12 @@ static uint32_t crb_cmd_consumer[4] = {
|
|||
CRB_CMD_CONSUMER_OFFSET_2, CRB_CMD_CONSUMER_OFFSET_3
|
||||
};
|
||||
|
||||
static void netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter,
|
||||
u32 crb_consumer)
|
||||
static inline void
|
||||
netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter,
|
||||
u32 crb_consumer)
|
||||
{
|
||||
writel(crb_consumer, NETXEN_CRB_NORMALIZE(adapter,
|
||||
adapter->crb_addr_cmd_consumer));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
adapter->crb_addr_cmd_consumer, crb_consumer);
|
||||
}
|
||||
|
||||
static uint32_t msi_tgt_status[4] = {
|
||||
|
@ -151,17 +153,18 @@ static void netxen_nic_disable_int(struct netxen_adapter *adapter)
|
|||
int pci_fn = adapter->ahw.pci_func;
|
||||
|
||||
if (adapter->msi_mode != MSI_MODE_MULTIFUNC)
|
||||
writel(0x0, NETXEN_CRB_NORMALIZE(adapter, sw_int_mask[port]));
|
||||
adapter->pci_write_normalize(adapter, sw_int_mask[port], 0);
|
||||
|
||||
if (adapter->intr_scheme != -1 &&
|
||||
adapter->intr_scheme != INTR_SCHEME_PERPORT)
|
||||
writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
|
||||
adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask);
|
||||
|
||||
if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
|
||||
do {
|
||||
writel(0xffffffff,
|
||||
PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS));
|
||||
mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR));
|
||||
adapter->pci_write_immediate(adapter,
|
||||
ISR_INT_TARGET_STATUS, 0xffffffff);
|
||||
mask = adapter->pci_read_immediate(adapter,
|
||||
ISR_INT_VECTOR);
|
||||
if (!(mask & 0x80))
|
||||
break;
|
||||
udelay(10);
|
||||
|
@ -173,8 +176,8 @@ static void netxen_nic_disable_int(struct netxen_adapter *adapter)
|
|||
}
|
||||
} else {
|
||||
if (adapter->msi_mode == MSI_MODE_MULTIFUNC) {
|
||||
writel(0xffffffff, PCI_OFFSET_SECOND_RANGE(adapter,
|
||||
msi_tgt_status[pci_fn]));
|
||||
adapter->pci_write_immediate(adapter,
|
||||
msi_tgt_status[pci_fn], 0xffffffff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,19 +203,20 @@ static void netxen_nic_enable_int(struct netxen_adapter *adapter)
|
|||
break;
|
||||
}
|
||||
|
||||
writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
|
||||
adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask);
|
||||
}
|
||||
|
||||
writel(0x1, NETXEN_CRB_NORMALIZE(adapter, sw_int_mask[port]));
|
||||
adapter->pci_write_normalize(adapter, sw_int_mask[port], 0x1);
|
||||
|
||||
if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
|
||||
mask = 0xbff;
|
||||
if (adapter->intr_scheme != -1 &&
|
||||
adapter->intr_scheme != INTR_SCHEME_PERPORT) {
|
||||
writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
CRB_INT_VECTOR, 0);
|
||||
}
|
||||
writel(mask,
|
||||
PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK));
|
||||
adapter->pci_write_immediate(adapter,
|
||||
ISR_INT_TARGET_MASK, mask);
|
||||
}
|
||||
|
||||
DPRINTK(1, INFO, "Done with enable Int\n");
|
||||
|
@ -243,7 +247,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
|
||||
|
||||
u8 __iomem *db_ptr = NULL;
|
||||
unsigned long mem_base, mem_len, db_base, db_len;
|
||||
unsigned long mem_base, mem_len, db_base, db_len, pci_len0;
|
||||
int pci_using_dac, i = 0, err;
|
||||
int ring;
|
||||
struct netxen_recv_context *recv_ctx = NULL;
|
||||
|
@ -300,10 +304,24 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
adapter = netdev->priv;
|
||||
|
||||
adapter->ahw.pci_func = pci_func_id;
|
||||
rwlock_init(&adapter->adapter_lock);
|
||||
adapter->ahw.qdr_sn_window = -1;
|
||||
adapter->ahw.ddr_mn_window = -1;
|
||||
|
||||
/* remap phys address */
|
||||
mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */
|
||||
mem_len = pci_resource_len(pdev, 0);
|
||||
pci_len0 = 0;
|
||||
|
||||
adapter->hw_write_wx = netxen_nic_hw_write_wx_128M;
|
||||
adapter->hw_read_wx = netxen_nic_hw_read_wx_128M;
|
||||
adapter->pci_read_immediate = netxen_nic_pci_read_immediate_128M;
|
||||
adapter->pci_write_immediate = netxen_nic_pci_write_immediate_128M;
|
||||
adapter->pci_read_normalize = netxen_nic_pci_read_normalize_128M;
|
||||
adapter->pci_write_normalize = netxen_nic_pci_write_normalize_128M;
|
||||
adapter->pci_set_window = netxen_nic_pci_set_window_128M;
|
||||
adapter->pci_mem_read = netxen_nic_pci_mem_read_128M;
|
||||
adapter->pci_mem_write = netxen_nic_pci_mem_write_128M;
|
||||
|
||||
/* 128 Meg of memory */
|
||||
if (mem_len == NETXEN_PCI_128MB_SIZE) {
|
||||
|
@ -320,21 +338,42 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE);
|
||||
first_page_group_start = 0;
|
||||
first_page_group_end = 0;
|
||||
} else if (mem_len == NETXEN_PCI_2MB_SIZE) {
|
||||
adapter->hw_write_wx = netxen_nic_hw_write_wx_2M;
|
||||
adapter->hw_read_wx = netxen_nic_hw_read_wx_2M;
|
||||
adapter->pci_read_immediate = netxen_nic_pci_read_immediate_2M;
|
||||
adapter->pci_write_immediate =
|
||||
netxen_nic_pci_write_immediate_2M;
|
||||
adapter->pci_read_normalize = netxen_nic_pci_read_normalize_2M;
|
||||
adapter->pci_write_normalize =
|
||||
netxen_nic_pci_write_normalize_2M;
|
||||
adapter->pci_set_window = netxen_nic_pci_set_window_2M;
|
||||
adapter->pci_mem_read = netxen_nic_pci_mem_read_2M;
|
||||
adapter->pci_mem_write = netxen_nic_pci_mem_write_2M;
|
||||
|
||||
mem_ptr0 = ioremap(mem_base, mem_len);
|
||||
pci_len0 = mem_len;
|
||||
first_page_group_start = 0;
|
||||
first_page_group_end = 0;
|
||||
|
||||
adapter->ahw.ddr_mn_window = 0;
|
||||
adapter->ahw.qdr_sn_window = 0;
|
||||
|
||||
adapter->ahw.mn_win_crb = 0x100000 + PCIX_MN_WINDOW +
|
||||
(pci_func_id * 0x20);
|
||||
adapter->ahw.ms_win_crb = 0x100000 + PCIX_SN_WINDOW;
|
||||
if (pci_func_id < 4)
|
||||
adapter->ahw.ms_win_crb += (pci_func_id * 0x20);
|
||||
else
|
||||
adapter->ahw.ms_win_crb +=
|
||||
0xA0 + ((pci_func_id - 4) * 0x10);
|
||||
} else {
|
||||
err = -EIO;
|
||||
goto err_out_free_netdev;
|
||||
}
|
||||
|
||||
if ((!mem_ptr0 && mem_len == NETXEN_PCI_128MB_SIZE) ||
|
||||
!mem_ptr1 || !mem_ptr2) {
|
||||
DPRINTK(ERR,
|
||||
"Cannot remap adapter memory aborting.:"
|
||||
"0 -> %p, 1 -> %p, 2 -> %p\n",
|
||||
mem_ptr0, mem_ptr1, mem_ptr2);
|
||||
dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20));
|
||||
|
||||
err = -EIO;
|
||||
goto err_out_iounmap;
|
||||
}
|
||||
db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */
|
||||
db_len = pci_resource_len(pdev, 4);
|
||||
|
||||
|
@ -357,6 +396,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
DPRINTK(INFO, "doorbell ioremaped at %p\n", db_ptr);
|
||||
|
||||
adapter->ahw.pci_base0 = mem_ptr0;
|
||||
adapter->ahw.pci_len0 = pci_len0;
|
||||
adapter->ahw.first_page_group_start = first_page_group_start;
|
||||
adapter->ahw.first_page_group_end = first_page_group_end;
|
||||
adapter->ahw.pci_base1 = mem_ptr1;
|
||||
|
@ -520,9 +560,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task);
|
||||
adapter->ahw.revision_id = pdev->revision;
|
||||
|
||||
/* make sure Window == 1 */
|
||||
netxen_nic_pci_change_crbwindow(adapter, 1);
|
||||
|
||||
adapter->crb_addr_cmd_producer = crb_cmd_producer[adapter->portnum];
|
||||
adapter->crb_addr_cmd_consumer = crb_cmd_consumer[adapter->portnum];
|
||||
netxen_nic_update_cmd_producer(adapter, 0);
|
||||
|
@ -560,8 +597,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
err = netxen_initialize_adapter_offload(adapter);
|
||||
if (err)
|
||||
goto err_out_free_rx_buffer;
|
||||
val = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_CAM_RAM(0x1fc)));
|
||||
val = adapter->pci_read_normalize(adapter,
|
||||
NETXEN_CAM_RAM(0x1fc));
|
||||
if (val == 0x55555555) {
|
||||
/* This is the first boot after power up */
|
||||
netxen_nic_read_w0(adapter, NETXEN_PCIE_REG(0x4), &val);
|
||||
|
@ -573,20 +610,20 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
printk(KERN_ERR "%s: failed to set MSI bit in PCI-e reg\n",
|
||||
netxen_nic_driver_name);
|
||||
}
|
||||
val = readl(NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_ROMUSB_GLB_SW_RESET));
|
||||
val = adapter->pci_read_normalize(adapter,
|
||||
NETXEN_ROMUSB_GLB_SW_RESET);
|
||||
printk(KERN_INFO"NetXen: read 0x%08x for reset reg.\n",val);
|
||||
if (val != 0x80000f) {
|
||||
/* clear the register for future unloads/loads */
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_CAM_RAM(0x1fc)));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
NETXEN_CAM_RAM(0x1fc), 0);
|
||||
printk(KERN_ERR "ERROR in NetXen HW init sequence.\n");
|
||||
err = -ENODEV;
|
||||
goto err_out_free_dev;
|
||||
}
|
||||
} else {
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter,
|
||||
CRB_CMDPEG_STATE));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
CRB_CMDPEG_STATE, 0);
|
||||
netxen_pinit_from_rom(adapter, 0);
|
||||
msleep(1);
|
||||
netxen_load_firmware(adapter);
|
||||
|
@ -602,9 +639,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
}
|
||||
|
||||
/* clear the register for future unloads/loads */
|
||||
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
|
||||
adapter->pci_write_normalize(adapter, NETXEN_CAM_RAM(0x1fc), 0);
|
||||
dev_info(&pdev->dev, "cmdpeg state: 0x%0x\n",
|
||||
readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
|
||||
adapter->pci_read_normalize(adapter, CRB_CMDPEG_STATE));
|
||||
|
||||
/*
|
||||
* Tell the hardware our version number.
|
||||
|
@ -612,12 +649,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
i = (_NETXEN_NIC_LINUX_MAJOR << 16)
|
||||
| ((_NETXEN_NIC_LINUX_MINOR << 8))
|
||||
| (_NETXEN_NIC_LINUX_SUBVERSION);
|
||||
writel(i, NETXEN_CRB_NORMALIZE(adapter, CRB_DRIVER_VERSION));
|
||||
adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i);
|
||||
|
||||
/* Unlock the HW, prompting the boot sequence */
|
||||
writel(1,
|
||||
NETXEN_CRB_NORMALIZE(adapter,
|
||||
NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
|
||||
adapter->pci_write_normalize(adapter,
|
||||
NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1);
|
||||
/* Handshake with the card before we register the devices. */
|
||||
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
|
||||
}
|
||||
|
@ -626,7 +662,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
* See if the firmware gave us a virtual-physical port mapping.
|
||||
*/
|
||||
adapter->physical_port = adapter->portnum;
|
||||
i = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_V2P(adapter->portnum)));
|
||||
i = adapter->pci_read_normalize(adapter, CRB_V2P(adapter->portnum));
|
||||
if (i != 0x55555555)
|
||||
adapter->physical_port = i;
|
||||
|
||||
|
@ -1104,15 +1140,15 @@ static irqreturn_t netxen_intr(int irq, void *data)
|
|||
struct netxen_adapter *adapter = data;
|
||||
u32 our_int = 0;
|
||||
|
||||
our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
|
||||
our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR);
|
||||
/* not our interrupt */
|
||||
if ((our_int & (0x80 << adapter->portnum)) == 0)
|
||||
return IRQ_NONE;
|
||||
|
||||
if (adapter->intr_scheme == INTR_SCHEME_PERPORT) {
|
||||
/* claim interrupt */
|
||||
writel(our_int & ~((u32)(0x80 << adapter->portnum)),
|
||||
NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
|
||||
adapter->pci_write_normalize(adapter, CRB_INT_VECTOR,
|
||||
our_int & ~((u32)(0x80 << adapter->portnum)));
|
||||
}
|
||||
|
||||
netxen_handle_int(adapter);
|
||||
|
|
|
@ -46,9 +46,8 @@ static int phy_lock(struct netxen_adapter *adapter)
|
|||
int done = 0, timeout = 0;
|
||||
|
||||
while (!done) {
|
||||
done =
|
||||
readl(pci_base_offset
|
||||
(adapter, NETXEN_PCIE_REG(PCIE_SEM3_LOCK)));
|
||||
done = netxen_nic_reg_read(adapter,
|
||||
NETXEN_PCIE_REG(PCIE_SEM3_LOCK));
|
||||
if (done == 1)
|
||||
break;
|
||||
if (timeout >= phy_lock_timeout) {
|
||||
|
@ -63,14 +62,14 @@ static int phy_lock(struct netxen_adapter *adapter)
|
|||
}
|
||||
}
|
||||
|
||||
writel(PHY_LOCK_DRIVER,
|
||||
NETXEN_CRB_NORMALIZE(adapter, NETXEN_PHY_LOCK_ID));
|
||||
netxen_crb_writelit_adapter(adapter,
|
||||
NETXEN_PHY_LOCK_ID, PHY_LOCK_DRIVER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int phy_unlock(struct netxen_adapter *adapter)
|
||||
{
|
||||
readl(pci_base_offset(adapter, NETXEN_PCIE_REG(PCIE_SEM3_UNLOCK)));
|
||||
adapter->pci_read_immediate(adapter, NETXEN_PCIE_REG(PCIE_SEM3_UNLOCK));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -109,7 +108,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
|
|||
* so it cannot be in reset
|
||||
*/
|
||||
|
||||
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
if (adapter->hw_read_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
if (netxen_gb_get_soft_reset(mac_cfg0)) {
|
||||
|
@ -119,7 +118,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
|
|||
netxen_gb_rx_reset_pb(temp);
|
||||
netxen_gb_tx_reset_mac(temp);
|
||||
netxen_gb_rx_reset_mac(temp);
|
||||
if (netxen_nic_hw_write_wx(adapter,
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
&temp, 4))
|
||||
return -EIO;
|
||||
|
@ -129,22 +128,22 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
|
|||
address = 0;
|
||||
netxen_gb_mii_mgmt_reg_addr(address, reg);
|
||||
netxen_gb_mii_mgmt_phy_addr(address, phy);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_ADDR(0),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_ADDR(0),
|
||||
&address, 4))
|
||||
return -EIO;
|
||||
command = 0; /* turn off any prior activity */
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
|
||||
&command, 4))
|
||||
return -EIO;
|
||||
/* send read command */
|
||||
netxen_gb_mii_mgmt_set_read_cycle(command);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
|
||||
&command, 4))
|
||||
return -EIO;
|
||||
|
||||
status = 0;
|
||||
do {
|
||||
if (netxen_nic_hw_read_wx(adapter,
|
||||
if (adapter->hw_read_wx(adapter,
|
||||
NETXEN_NIU_GB_MII_MGMT_INDICATE(0),
|
||||
&status, 4))
|
||||
return -EIO;
|
||||
|
@ -154,7 +153,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
|
|||
&& (timeout++ < NETXEN_NIU_PHY_WAITMAX));
|
||||
|
||||
if (timeout < NETXEN_NIU_PHY_WAITMAX) {
|
||||
if (netxen_nic_hw_read_wx(adapter,
|
||||
if (adapter->hw_read_wx(adapter,
|
||||
NETXEN_NIU_GB_MII_MGMT_STATUS(0),
|
||||
readval, 4))
|
||||
return -EIO;
|
||||
|
@ -163,7 +162,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg,
|
|||
result = -1;
|
||||
|
||||
if (restore)
|
||||
if (netxen_nic_hw_write_wx(adapter,
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
|
@ -201,7 +200,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
|
|||
* cannot be in reset
|
||||
*/
|
||||
|
||||
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
if (adapter->hw_read_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
if (netxen_gb_get_soft_reset(mac_cfg0)) {
|
||||
|
@ -212,7 +211,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
|
|||
netxen_gb_tx_reset_mac(temp);
|
||||
netxen_gb_rx_reset_mac(temp);
|
||||
|
||||
if (netxen_nic_hw_write_wx(adapter,
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
&temp, 4))
|
||||
return -EIO;
|
||||
|
@ -220,24 +219,24 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
|
|||
}
|
||||
|
||||
command = 0; /* turn off any prior activity */
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
|
||||
&command, 4))
|
||||
return -EIO;
|
||||
|
||||
address = 0;
|
||||
netxen_gb_mii_mgmt_reg_addr(address, reg);
|
||||
netxen_gb_mii_mgmt_phy_addr(address, phy);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_ADDR(0),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_ADDR(0),
|
||||
&address, 4))
|
||||
return -EIO;
|
||||
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_CTRL(0),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_CTRL(0),
|
||||
&val, 4))
|
||||
return -EIO;
|
||||
|
||||
status = 0;
|
||||
do {
|
||||
if (netxen_nic_hw_read_wx(adapter,
|
||||
if (adapter->hw_read_wx(adapter,
|
||||
NETXEN_NIU_GB_MII_MGMT_INDICATE(0),
|
||||
&status, 4))
|
||||
return -EIO;
|
||||
|
@ -252,7 +251,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg,
|
|||
|
||||
/* restore the state of port 0 MAC in case we tampered with it */
|
||||
if (restore)
|
||||
if (netxen_nic_hw_write_wx(adapter,
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_MAC_CONFIG_0(0),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
|
@ -581,10 +580,10 @@ static int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
|
|||
if ((phy < 0) || (phy > 3))
|
||||
return -EINVAL;
|
||||
|
||||
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy),
|
||||
if (adapter->hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy),
|
||||
&stationhigh, 4))
|
||||
return -EIO;
|
||||
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy),
|
||||
if (adapter->hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy),
|
||||
&stationlow, 4))
|
||||
return -EIO;
|
||||
((__le32 *)val)[1] = cpu_to_le32(stationhigh);
|
||||
|
@ -613,14 +612,14 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter,
|
|||
temp[0] = temp[1] = 0;
|
||||
memcpy(temp + 2, addr, 2);
|
||||
val = le32_to_cpu(*(__le32 *)temp);
|
||||
if (netxen_nic_hw_write_wx
|
||||
(adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), &val, 4))
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_STATION_ADDR_1(phy), &val, 4))
|
||||
return -EIO;
|
||||
|
||||
memcpy(temp, ((u8 *) addr) + 2, sizeof(__le32));
|
||||
val = le32_to_cpu(*(__le32 *)temp);
|
||||
if (netxen_nic_hw_write_wx
|
||||
(adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4))
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4))
|
||||
return -2;
|
||||
|
||||
netxen_niu_macaddr_get(adapter,
|
||||
|
@ -654,7 +653,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
|
|||
|
||||
mac_cfg0 = 0;
|
||||
netxen_gb_soft_reset(mac_cfg0);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
mac_cfg0 = 0;
|
||||
|
@ -666,7 +665,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
|
|||
netxen_gb_tx_reset_mac(mac_cfg0);
|
||||
netxen_gb_rx_reset_mac(mac_cfg0);
|
||||
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
mac_cfg1 = 0;
|
||||
|
@ -679,7 +678,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
|
|||
|
||||
if (mode == NETXEN_NIU_10_100_MB) {
|
||||
netxen_gb_set_intfmode(mac_cfg1, 1);
|
||||
if (netxen_nic_hw_write_wx(adapter,
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_MAC_CONFIG_1(port),
|
||||
&mac_cfg1, 4))
|
||||
return -EIO;
|
||||
|
@ -692,7 +691,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
|
|||
|
||||
} else if (mode == NETXEN_NIU_1000_MB) {
|
||||
netxen_gb_set_intfmode(mac_cfg1, 2);
|
||||
if (netxen_nic_hw_write_wx(adapter,
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_GB_MAC_CONFIG_1(port),
|
||||
&mac_cfg1, 4))
|
||||
return -EIO;
|
||||
|
@ -704,7 +703,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
|
|||
}
|
||||
mii_cfg = 0;
|
||||
netxen_gb_set_mii_mgmt_clockselect(mii_cfg, 7);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_CONFIG(port),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MII_MGMT_CONFIG(port),
|
||||
&mii_cfg, 4))
|
||||
return -EIO;
|
||||
mac_cfg0 = 0;
|
||||
|
@ -713,7 +712,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
|
|||
netxen_gb_unset_rx_flowctl(mac_cfg0);
|
||||
netxen_gb_unset_tx_flowctl(mac_cfg0);
|
||||
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
return 0;
|
||||
|
@ -730,7 +729,7 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter)
|
|||
return -EINVAL;
|
||||
mac_cfg0 = 0;
|
||||
netxen_gb_soft_reset(mac_cfg0);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
|
||||
&mac_cfg0, 4))
|
||||
return -EIO;
|
||||
return 0;
|
||||
|
@ -746,7 +745,7 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
|
|||
return -EINVAL;
|
||||
|
||||
mac_cfg = 0;
|
||||
if (netxen_nic_hw_write_wx(adapter,
|
||||
if (adapter->hw_write_wx(adapter,
|
||||
NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4))
|
||||
return -EIO;
|
||||
return 0;
|
||||
|
@ -763,7 +762,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
|
|||
return -EINVAL;
|
||||
|
||||
/* save previous contents */
|
||||
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_DROP_WRONGADDR,
|
||||
if (adapter->hw_read_wx(adapter, NETXEN_NIU_GB_DROP_WRONGADDR,
|
||||
®, 4))
|
||||
return -EIO;
|
||||
if (mode == NETXEN_NIU_PROMISC_MODE) {
|
||||
|
@ -801,7 +800,7 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter,
|
|||
return -EIO;
|
||||
}
|
||||
}
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_GB_DROP_WRONGADDR,
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_GB_DROP_WRONGADDR,
|
||||
®, 4))
|
||||
return -EIO;
|
||||
return 0;
|
||||
|
@ -826,13 +825,13 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
|
|||
case 0:
|
||||
memcpy(temp + 2, addr, 2);
|
||||
val = le32_to_cpu(*(__le32 *)temp);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1,
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1,
|
||||
&val, 4))
|
||||
return -EIO;
|
||||
|
||||
memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32));
|
||||
val = le32_to_cpu(*(__le32 *)temp);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI,
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI,
|
||||
&val, 4))
|
||||
return -EIO;
|
||||
break;
|
||||
|
@ -840,13 +839,13 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter,
|
|||
case 1:
|
||||
memcpy(temp + 2, addr, 2);
|
||||
val = le32_to_cpu(*(__le32 *)temp);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XG1_STATION_ADDR_0_1,
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_XG1_STATION_ADDR_0_1,
|
||||
&val, 4))
|
||||
return -EIO;
|
||||
|
||||
memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32));
|
||||
val = le32_to_cpu(*(__le32 *)temp);
|
||||
if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XG1_STATION_ADDR_0_HI,
|
||||
if (adapter->hw_write_wx(adapter, NETXEN_NIU_XG1_STATION_ADDR_0_HI,
|
||||
&val, 4))
|
||||
return -EIO;
|
||||
break;
|
||||
|
@ -877,10 +876,10 @@ int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter,
|
|||
if (phy != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI,
|
||||
if (adapter->hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI,
|
||||
&stationhigh, 4))
|
||||
return -EIO;
|
||||
if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1,
|
||||
if (adapter->hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1,
|
||||
&stationlow, 4))
|
||||
return -EIO;
|
||||
((__le32 *)val)[1] = cpu_to_le32(stationhigh);
|
||||
|
@ -901,7 +900,7 @@ int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
|
|||
if (port > NETXEN_NIU_MAX_XG_PORTS)
|
||||
return -EINVAL;
|
||||
|
||||
if (netxen_nic_hw_read_wx(adapter,
|
||||
if (adapter->hw_read_wx(adapter,
|
||||
NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), ®, 4))
|
||||
return -EIO;
|
||||
if (mode == NETXEN_NIU_PROMISC_MODE)
|
||||
|
|
Loading…
Reference in a new issue