aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/netxen/netxen_nic.h12
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c33
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c108
-rw-r--r--drivers/net/netxen/netxen_nic_hw.h1
-rw-r--r--drivers/net/netxen/netxen_nic_init.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c38
6 files changed, 85 insertions, 109 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index cde8e70b6b08..618507074bdd 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -90,7 +90,6 @@
90 (sizeof(struct netxen_rx_buffer) * rds_ring->max_rx_desc_count) 90 (sizeof(struct netxen_rx_buffer) * rds_ring->max_rx_desc_count)
91#define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) 91#define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a)))
92 92
93#define NETXEN_NETDEV_STATUS 0x1
94#define NETXEN_RCV_PRODUCER_OFFSET 0 93#define NETXEN_RCV_PRODUCER_OFFSET 0
95#define NETXEN_RCV_PEG_DB_ID 2 94#define NETXEN_RCV_PEG_DB_ID 2
96#define NETXEN_HOST_DUMMY_DMA_SIZE 1024 95#define NETXEN_HOST_DUMMY_DMA_SIZE 1024
@@ -795,21 +794,19 @@ struct netxen_hardware_context {
795 void __iomem *pci_base0; 794 void __iomem *pci_base0;
796 void __iomem *pci_base1; 795 void __iomem *pci_base1;
797 void __iomem *pci_base2; 796 void __iomem *pci_base2;
798 unsigned long first_page_group_end;
799 unsigned long first_page_group_start;
800 void __iomem *db_base; 797 void __iomem *db_base;
801 unsigned long db_len; 798 unsigned long db_len;
802 unsigned long pci_len0; 799 unsigned long pci_len0;
803 800
804 u8 cut_through;
805 int qdr_sn_window; 801 int qdr_sn_window;
806 int ddr_mn_window; 802 int ddr_mn_window;
807 unsigned long mn_win_crb; 803 unsigned long mn_win_crb;
808 unsigned long ms_win_crb; 804 unsigned long ms_win_crb;
809 805
806 u8 cut_through;
810 u8 revision_id; 807 u8 revision_id;
811 u16 board_type; 808 u16 port_type;
812 struct netxen_board_info boardcfg; 809 int board_type;
813 u32 linkup; 810 u32 linkup;
814 /* Address of cmd ring in Phantom */ 811 /* Address of cmd ring in Phantom */
815 struct cmd_desc_type0 *cmd_desc_head; 812 struct cmd_desc_type0 *cmd_desc_head;
@@ -1260,6 +1257,7 @@ struct netxen_adapter {
1260 u32 temp; 1257 u32 temp;
1261 1258
1262 u32 fw_major; 1259 u32 fw_major;
1260 u32 fw_version;
1263 1261
1264 u8 msix_supported; 1262 u8 msix_supported;
1265 u8 max_possible_rss_rings; 1263 u8 max_possible_rss_rings;
@@ -1272,7 +1270,6 @@ struct netxen_adapter {
1272 u16 state; 1270 u16 state;
1273 u16 link_autoneg; 1271 u16 link_autoneg;
1274 int rx_csum; 1272 int rx_csum;
1275 int status;
1276 1273
1277 struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ 1274 struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */
1278 1275
@@ -1391,6 +1388,7 @@ void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, u32 value);
1391void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, u32 *value); 1388void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, u32 *value);
1392 1389
1393int netxen_nic_get_board_info(struct netxen_adapter *adapter); 1390int netxen_nic_get_board_info(struct netxen_adapter *adapter);
1391void netxen_nic_get_firmware_info(struct netxen_adapter *adapter);
1394 1392
1395int netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter, 1393int netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter,
1396 ulong off, void *data, int len); 1394 ulong off, void *data, int len);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index f811880a57c5..8b4bdfd6a117 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -115,10 +115,9 @@ static int
115netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) 115netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
116{ 116{
117 struct netxen_adapter *adapter = netdev_priv(dev); 117 struct netxen_adapter *adapter = netdev_priv(dev);
118 struct netxen_board_info *boardinfo = &adapter->ahw.boardcfg;
119 118
120 /* read which mode */ 119 /* read which mode */
121 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 120 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
122 ecmd->supported = (SUPPORTED_10baseT_Half | 121 ecmd->supported = (SUPPORTED_10baseT_Half |
123 SUPPORTED_10baseT_Full | 122 SUPPORTED_10baseT_Full |
124 SUPPORTED_100baseT_Half | 123 SUPPORTED_100baseT_Half |
@@ -137,7 +136,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
137 ecmd->duplex = adapter->link_duplex; 136 ecmd->duplex = adapter->link_duplex;
138 ecmd->autoneg = adapter->link_autoneg; 137 ecmd->autoneg = adapter->link_autoneg;
139 138
140 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 139 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
141 u32 val; 140 u32 val;
142 141
143 adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR, &val, 4); 142 adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR, &val, 4);
@@ -169,7 +168,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
169 ecmd->phy_address = adapter->physical_port; 168 ecmd->phy_address = adapter->physical_port;
170 ecmd->transceiver = XCVR_EXTERNAL; 169 ecmd->transceiver = XCVR_EXTERNAL;
171 170
172 switch ((netxen_brdtype_t) boardinfo->board_type) { 171 switch ((netxen_brdtype_t)adapter->ahw.board_type) {
173 case NETXEN_BRDTYPE_P2_SB35_4G: 172 case NETXEN_BRDTYPE_P2_SB35_4G:
174 case NETXEN_BRDTYPE_P2_SB31_2G: 173 case NETXEN_BRDTYPE_P2_SB31_2G:
175 case NETXEN_BRDTYPE_P3_REF_QG: 174 case NETXEN_BRDTYPE_P3_REF_QG:
@@ -185,7 +184,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
185 ecmd->supported |= SUPPORTED_TP; 184 ecmd->supported |= SUPPORTED_TP;
186 ecmd->advertising |= ADVERTISED_TP; 185 ecmd->advertising |= ADVERTISED_TP;
187 ecmd->port = PORT_TP; 186 ecmd->port = PORT_TP;
188 ecmd->autoneg = (boardinfo->board_type == 187 ecmd->autoneg = (adapter->ahw.board_type ==
189 NETXEN_BRDTYPE_P2_SB31_10G_CX4) ? 188 NETXEN_BRDTYPE_P2_SB31_10G_CX4) ?
190 (AUTONEG_DISABLE) : (adapter->link_autoneg); 189 (AUTONEG_DISABLE) : (adapter->link_autoneg);
191 break; 190 break;
@@ -212,7 +211,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
212 ecmd->autoneg = AUTONEG_DISABLE; 211 ecmd->autoneg = AUTONEG_DISABLE;
213 break; 212 break;
214 case NETXEN_BRDTYPE_P3_10G_TP: 213 case NETXEN_BRDTYPE_P3_10G_TP:
215 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 214 if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
216 ecmd->autoneg = AUTONEG_DISABLE; 215 ecmd->autoneg = AUTONEG_DISABLE;
217 ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); 216 ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP);
218 ecmd->advertising |= 217 ecmd->advertising |=
@@ -228,7 +227,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
228 break; 227 break;
229 default: 228 default:
230 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", 229 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
231 (netxen_brdtype_t) boardinfo->board_type); 230 (netxen_brdtype_t)adapter->ahw.board_type);
232 return -EIO; 231 return -EIO;
233 } 232 }
234 233
@@ -242,7 +241,7 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
242 __u32 status; 241 __u32 status;
243 242
244 /* read which mode */ 243 /* read which mode */
245 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 244 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
246 /* autonegotiation */ 245 /* autonegotiation */
247 if (adapter->phy_write 246 if (adapter->phy_write
248 && adapter->phy_write(adapter, 247 && adapter->phy_write(adapter,
@@ -430,7 +429,7 @@ static u32 netxen_nic_test_link(struct net_device *dev)
430 int val; 429 int val;
431 430
432 /* read which mode */ 431 /* read which mode */
433 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 432 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
434 if (adapter->phy_read 433 if (adapter->phy_read
435 && adapter->phy_read(adapter, 434 && adapter->phy_read(adapter,
436 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 435 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
@@ -440,7 +439,7 @@ static u32 netxen_nic_test_link(struct net_device *dev)
440 val = netxen_get_phy_link(status); 439 val = netxen_get_phy_link(status);
441 return !val; 440 return !val;
442 } 441 }
443 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 442 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
444 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); 443 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE);
445 return (val == XG_LINK_UP) ? 0 : 1; 444 return (val == XG_LINK_UP) ? 0 : 1;
446 } 445 }
@@ -483,7 +482,7 @@ netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
483 rds_rings[RCV_DESC_JUMBO_CTXID].max_rx_desc_count; 482 rds_rings[RCV_DESC_JUMBO_CTXID].max_rx_desc_count;
484 ring->tx_pending = adapter->max_tx_desc_count; 483 ring->tx_pending = adapter->max_tx_desc_count;
485 484
486 if (adapter->ahw.board_type == NETXEN_NIC_GBE) 485 if (adapter->ahw.port_type == NETXEN_NIC_GBE)
487 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G; 486 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G;
488 else 487 else
489 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G; 488 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G;
@@ -501,7 +500,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
501 __u32 val; 500 __u32 val;
502 int port = adapter->physical_port; 501 int port = adapter->physical_port;
503 502
504 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 503 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
505 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 504 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
506 return; 505 return;
507 /* get flow control settings */ 506 /* get flow control settings */
@@ -524,7 +523,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
524 pause->tx_pause = !(netxen_gb_get_gb3_mask(val)); 523 pause->tx_pause = !(netxen_gb_get_gb3_mask(val));
525 break; 524 break;
526 } 525 }
527 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 526 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
528 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) 527 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
529 return; 528 return;
530 pause->rx_pause = 1; 529 pause->rx_pause = 1;
@@ -535,7 +534,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
535 pause->tx_pause = !(netxen_xg_get_xg1_mask(val)); 534 pause->tx_pause = !(netxen_xg_get_xg1_mask(val));
536 } else { 535 } else {
537 printk(KERN_ERR"%s: Unknown board type: %x\n", 536 printk(KERN_ERR"%s: Unknown board type: %x\n",
538 netxen_nic_driver_name, adapter->ahw.board_type); 537 netxen_nic_driver_name, adapter->ahw.port_type);
539 } 538 }
540} 539}
541 540
@@ -547,7 +546,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
547 __u32 val; 546 __u32 val;
548 int port = adapter->physical_port; 547 int port = adapter->physical_port;
549 /* read mode */ 548 /* read mode */
550 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 549 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
551 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 550 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
552 return -EIO; 551 return -EIO;
553 /* set flow control */ 552 /* set flow control */
@@ -591,7 +590,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
591 break; 590 break;
592 } 591 }
593 netxen_nic_write_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL, val); 592 netxen_nic_write_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL, val);
594 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 593 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
595 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) 594 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
596 return -EIO; 595 return -EIO;
597 netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL, &val); 596 netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL, &val);
@@ -610,7 +609,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
610 } else { 609 } else {
611 printk(KERN_ERR "%s: Unknown board type: %x\n", 610 printk(KERN_ERR "%s: Unknown board type: %x\n",
612 netxen_nic_driver_name, 611 netxen_nic_driver_name,
613 adapter->ahw.board_type); 612 adapter->ahw.port_type);
614 } 613 }
615 return 0; 614 return 0;
616} 615}
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index b564d69cfa45..a93ab589d9ce 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -728,9 +728,8 @@ int netxen_is_flash_supported(struct netxen_adapter *adapter)
728static int netxen_get_flash_block(struct netxen_adapter *adapter, int base, 728static int netxen_get_flash_block(struct netxen_adapter *adapter, int base,
729 int size, __le32 * buf) 729 int size, __le32 * buf)
730{ 730{
731 int i, addr; 731 int i, v, addr;
732 __le32 *ptr32; 732 __le32 *ptr32;
733 u32 v;
734 733
735 addr = base; 734 addr = base;
736 ptr32 = buf; 735 ptr32 = buf;
@@ -2089,47 +2088,44 @@ u32 netxen_nic_pci_read_normalize_2M(struct netxen_adapter *adapter, u64 off)
2089 2088
2090int netxen_nic_get_board_info(struct netxen_adapter *adapter) 2089int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2091{ 2090{
2092 int rv = 0; 2091 int offset, board_type, magic, header_version;
2093 int addr = NETXEN_BRDCFG_START; 2092 struct pci_dev *pdev = adapter->pdev;
2094 struct netxen_board_info *boardinfo;
2095 int index;
2096 int *ptr32;
2097 2093
2098 boardinfo = &adapter->ahw.boardcfg; 2094 offset = NETXEN_BRDCFG_START +
2099 ptr32 = (int *) boardinfo; 2095 offsetof(struct netxen_board_info, magic);
2096 if (netxen_rom_fast_read(adapter, offset, &magic))
2097 return -EIO;
2100 2098
2101 for (index = 0; index < sizeof(struct netxen_board_info) / sizeof(u32); 2099 offset = NETXEN_BRDCFG_START +
2102 index++) { 2100 offsetof(struct netxen_board_info, header_version);
2103 if (netxen_rom_fast_read(adapter, addr, ptr32) == -1) { 2101 if (netxen_rom_fast_read(adapter, offset, &header_version))
2104 return -EIO; 2102 return -EIO;
2105 } 2103
2106 ptr32++; 2104 if (magic != NETXEN_BDINFO_MAGIC ||
2107 addr += sizeof(u32); 2105 header_version != NETXEN_BDINFO_VERSION) {
2108 } 2106 dev_err(&pdev->dev,
2109 if (boardinfo->magic != NETXEN_BDINFO_MAGIC) { 2107 "invalid board config, magic=%08x, version=%08x\n",
2110 printk("%s: ERROR reading %s board config." 2108 magic, header_version);
2111 " Read %x, expected %x\n", netxen_nic_driver_name, 2109 return -EIO;
2112 netxen_nic_driver_name,
2113 boardinfo->magic, NETXEN_BDINFO_MAGIC);
2114 rv = -1;
2115 }
2116 if (boardinfo->header_version != NETXEN_BDINFO_VERSION) {
2117 printk("%s: Unknown board config version."
2118 " Read %x, expected %x\n", netxen_nic_driver_name,
2119 boardinfo->header_version, NETXEN_BDINFO_VERSION);
2120 rv = -1;
2121 } 2110 }
2122 2111
2123 if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) { 2112 offset = NETXEN_BRDCFG_START +
2113 offsetof(struct netxen_board_info, board_type);
2114 if (netxen_rom_fast_read(adapter, offset, &board_type))
2115 return -EIO;
2116
2117 adapter->ahw.board_type = board_type;
2118
2119 if (board_type == NETXEN_BRDTYPE_P3_4_GB_MM) {
2124 u32 gpio = netxen_nic_reg_read(adapter, 2120 u32 gpio = netxen_nic_reg_read(adapter,
2125 NETXEN_ROMUSB_GLB_PAD_GPIO_I); 2121 NETXEN_ROMUSB_GLB_PAD_GPIO_I);
2126 if ((gpio & 0x8000) == 0) 2122 if ((gpio & 0x8000) == 0)
2127 boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP; 2123 board_type = NETXEN_BRDTYPE_P3_10G_TP;
2128 } 2124 }
2129 2125
2130 switch ((netxen_brdtype_t) boardinfo->board_type) { 2126 switch ((netxen_brdtype_t)board_type) {
2131 case NETXEN_BRDTYPE_P2_SB35_4G: 2127 case NETXEN_BRDTYPE_P2_SB35_4G:
2132 adapter->ahw.board_type = NETXEN_NIC_GBE; 2128 adapter->ahw.port_type = NETXEN_NIC_GBE;
2133 break; 2129 break;
2134 case NETXEN_BRDTYPE_P2_SB31_10G: 2130 case NETXEN_BRDTYPE_P2_SB31_10G:
2135 case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: 2131 case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ:
@@ -2145,7 +2141,7 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2145 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 2141 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
2146 case NETXEN_BRDTYPE_P3_10G_XFP: 2142 case NETXEN_BRDTYPE_P3_10G_XFP:
2147 case NETXEN_BRDTYPE_P3_10000_BASE_T: 2143 case NETXEN_BRDTYPE_P3_10000_BASE_T:
2148 adapter->ahw.board_type = NETXEN_NIC_XGBE; 2144 adapter->ahw.port_type = NETXEN_NIC_XGBE;
2149 break; 2145 break;
2150 case NETXEN_BRDTYPE_P1_BD: 2146 case NETXEN_BRDTYPE_P1_BD:
2151 case NETXEN_BRDTYPE_P1_SB: 2147 case NETXEN_BRDTYPE_P1_SB:
@@ -2154,20 +2150,19 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2154 case NETXEN_BRDTYPE_P3_REF_QG: 2150 case NETXEN_BRDTYPE_P3_REF_QG:
2155 case NETXEN_BRDTYPE_P3_4_GB: 2151 case NETXEN_BRDTYPE_P3_4_GB:
2156 case NETXEN_BRDTYPE_P3_4_GB_MM: 2152 case NETXEN_BRDTYPE_P3_4_GB_MM:
2157 adapter->ahw.board_type = NETXEN_NIC_GBE; 2153 adapter->ahw.port_type = NETXEN_NIC_GBE;
2158 break; 2154 break;
2159 case NETXEN_BRDTYPE_P3_10G_TP: 2155 case NETXEN_BRDTYPE_P3_10G_TP:
2160 adapter->ahw.board_type = (adapter->portnum < 2) ? 2156 adapter->ahw.port_type = (adapter->portnum < 2) ?
2161 NETXEN_NIC_XGBE : NETXEN_NIC_GBE; 2157 NETXEN_NIC_XGBE : NETXEN_NIC_GBE;
2162 break; 2158 break;
2163 default: 2159 default:
2164 printk("%s: Unknown(%x)\n", netxen_nic_driver_name, 2160 dev_err(&pdev->dev, "unknown board type %x\n", board_type);
2165 boardinfo->board_type); 2161 adapter->ahw.port_type = NETXEN_NIC_XGBE;
2166 rv = -ENODEV;
2167 break; 2162 break;
2168 } 2163 }
2169 2164
2170 return rv; 2165 return 0;
2171} 2166}
2172 2167
2173/* NIU access sections */ 2168/* NIU access sections */
@@ -2213,7 +2208,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2213 return; 2208 return;
2214 } 2209 }
2215 2210
2216 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 2211 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
2217 adapter->hw_read_wx(adapter, 2212 adapter->hw_read_wx(adapter,
2218 NETXEN_PORT_MODE_ADDR, &port_mode, 4); 2213 NETXEN_PORT_MODE_ADDR, &port_mode, 4);
2219 if (port_mode == NETXEN_PORT_MODE_802_3_AP) { 2214 if (port_mode == NETXEN_PORT_MODE_802_3_AP) {
@@ -2268,17 +2263,14 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2268 } 2263 }
2269} 2264}
2270 2265
2271void netxen_nic_flash_print(struct netxen_adapter *adapter) 2266void netxen_nic_get_firmware_info(struct netxen_adapter *adapter)
2272{ 2267{
2273 u32 fw_major = 0; 2268 u32 fw_major, fw_minor, fw_build;
2274 u32 fw_minor = 0;
2275 u32 fw_build = 0;
2276 char brd_name[NETXEN_MAX_SHORT_NAME]; 2269 char brd_name[NETXEN_MAX_SHORT_NAME];
2277 char serial_num[32]; 2270 char serial_num[32];
2278 int i, addr; 2271 int i, addr;
2279 int *ptr32; 2272 int *ptr32;
2280 2273 struct pci_dev *pdev = adapter->pdev;
2281 struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
2282 2274
2283 adapter->driver_mismatch = 0; 2275 adapter->driver_mismatch = 0;
2284 2276
@@ -2302,23 +2294,31 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
2302 adapter->hw_read_wx(adapter, NETXEN_FW_VERSION_SUB, &fw_build, 4); 2294 adapter->hw_read_wx(adapter, NETXEN_FW_VERSION_SUB, &fw_build, 4);
2303 2295
2304 adapter->fw_major = fw_major; 2296 adapter->fw_major = fw_major;
2297 adapter->fw_version = NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build);
2305 2298
2306 if (adapter->portnum == 0) { 2299 if (adapter->portnum == 0) {
2307 get_brd_name_by_type(board_info->board_type, brd_name); 2300 get_brd_name_by_type(adapter->ahw.board_type, brd_name);
2308 2301
2309 printk(KERN_INFO "NetXen %s Board S/N %s Chip rev 0x%x\n", 2302 printk(KERN_INFO "NetXen %s Board S/N %s Chip rev 0x%x\n",
2310 brd_name, serial_num, adapter->ahw.revision_id); 2303 brd_name, serial_num, adapter->ahw.revision_id);
2311 printk(KERN_INFO "NetXen Firmware version %d.%d.%d\n",
2312 fw_major, fw_minor, fw_build);
2313 } 2304 }
2314 2305
2315 if (NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build) < 2306 if (adapter->fw_version < NETXEN_VERSION_CODE(3, 4, 216)) {
2316 NETXEN_VERSION_CODE(3, 4, 216)) {
2317 adapter->driver_mismatch = 1; 2307 adapter->driver_mismatch = 1;
2318 printk(KERN_ERR "%s: firmware version %d.%d.%d unsupported\n", 2308 dev_warn(&pdev->dev, "firmware version %d.%d.%d unsupported\n",
2319 netxen_nic_driver_name,
2320 fw_major, fw_minor, fw_build); 2309 fw_major, fw_minor, fw_build);
2321 return; 2310 return;
2322 } 2311 }
2312
2313 dev_info(&pdev->dev, "firmware version %d.%d.%d\n",
2314 fw_major, fw_minor, fw_build);
2315
2316 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
2317 adapter->hw_read_wx(adapter,
2318 NETXEN_MIU_MN_CONTROL, &i, 4);
2319 adapter->ahw.cut_through = (i & 0x4) ? 1 : 0;
2320 dev_info(&pdev->dev, "firmware running in %s mode\n",
2321 adapter->ahw.cut_through ? "cut-through" : "legacy");
2322 }
2323} 2323}
2324 2324
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 9fb51627ee54..04b47a7993cd 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -57,7 +57,6 @@ struct netxen_adapter;
57 57
58struct netxen_port; 58struct netxen_port;
59void netxen_nic_set_link_parameters(struct netxen_adapter *adapter); 59void netxen_nic_set_link_parameters(struct netxen_adapter *adapter);
60void netxen_nic_flash_print(struct netxen_adapter *adapter);
61 60
62typedef u8 netxen_ethernet_macaddr_t[6]; 61typedef u8 netxen_ethernet_macaddr_t[6];
63 62
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index bd5e0d692230..120b480c1e82 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -316,7 +316,7 @@ err_out:
316 316
317void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) 317void netxen_initialize_adapter_ops(struct netxen_adapter *adapter)
318{ 318{
319 switch (adapter->ahw.board_type) { 319 switch (adapter->ahw.port_type) {
320 case NETXEN_NIC_GBE: 320 case NETXEN_NIC_GBE:
321 adapter->enable_phy_interrupts = 321 adapter->enable_phy_interrupts =
322 netxen_niu_gbe_enable_phy_interrupts; 322 netxen_niu_gbe_enable_phy_interrupts;
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 3b4d923f947d..9445277321d7 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -212,7 +212,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter)
212 212
213static void netxen_check_options(struct netxen_adapter *adapter) 213static void netxen_check_options(struct netxen_adapter *adapter)
214{ 214{
215 switch (adapter->ahw.boardcfg.board_type) { 215 switch (adapter->ahw.board_type) {
216 case NETXEN_BRDTYPE_P3_HMEZ: 216 case NETXEN_BRDTYPE_P3_HMEZ:
217 case NETXEN_BRDTYPE_P3_XG_LOM: 217 case NETXEN_BRDTYPE_P3_XG_LOM:
218 case NETXEN_BRDTYPE_P3_10G_CX4: 218 case NETXEN_BRDTYPE_P3_10G_CX4:
@@ -250,7 +250,7 @@ static void netxen_check_options(struct netxen_adapter *adapter)
250 250
251 case NETXEN_BRDTYPE_P3_10G_TP: 251 case NETXEN_BRDTYPE_P3_10G_TP:
252 adapter->msix_supported = !!use_msi_x; 252 adapter->msix_supported = !!use_msi_x;
253 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) 253 if (adapter->ahw.port_type == NETXEN_NIC_XGBE)
254 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; 254 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G;
255 else 255 else
256 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 256 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
@@ -261,7 +261,7 @@ static void netxen_check_options(struct netxen_adapter *adapter)
261 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 261 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
262 262
263 printk(KERN_WARNING "Unknown board type(0x%x)\n", 263 printk(KERN_WARNING "Unknown board type(0x%x)\n",
264 adapter->ahw.boardcfg.board_type); 264 adapter->ahw.board_type);
265 break; 265 break;
266 } 266 }
267 267
@@ -330,7 +330,7 @@ static void netxen_set_port_mode(struct netxen_adapter *adapter)
330{ 330{
331 u32 val, data; 331 u32 val, data;
332 332
333 val = adapter->ahw.boardcfg.board_type; 333 val = adapter->ahw.board_type;
334 if ((val == NETXEN_BRDTYPE_P3_HMEZ) || 334 if ((val == NETXEN_BRDTYPE_P3_HMEZ) ||
335 (val == NETXEN_BRDTYPE_P3_XG_LOM)) { 335 (val == NETXEN_BRDTYPE_P3_XG_LOM)) {
336 if (port_mode == NETXEN_PORT_MODE_802_3_AP) { 336 if (port_mode == NETXEN_PORT_MODE_802_3_AP) {
@@ -523,8 +523,6 @@ netxen_setup_pci_map(struct netxen_adapter *adapter)
523 void __iomem *mem_ptr2 = NULL; 523 void __iomem *mem_ptr2 = NULL;
524 void __iomem *db_ptr = NULL; 524 void __iomem *db_ptr = NULL;
525 525
526 unsigned long first_page_group_end;
527 unsigned long first_page_group_start;
528 unsigned long mem_base, mem_len, db_base, db_len = 0, pci_len0 = 0; 526 unsigned long mem_base, mem_len, db_base, db_len = 0, pci_len0 = 0;
529 527
530 struct pci_dev *pdev = adapter->pdev; 528 struct pci_dev *pdev = adapter->pdev;
@@ -562,14 +560,10 @@ netxen_setup_pci_map(struct netxen_adapter *adapter)
562 SECOND_PAGE_GROUP_SIZE); 560 SECOND_PAGE_GROUP_SIZE);
563 mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START, 561 mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START,
564 THIRD_PAGE_GROUP_SIZE); 562 THIRD_PAGE_GROUP_SIZE);
565 first_page_group_start = FIRST_PAGE_GROUP_START;
566 first_page_group_end = FIRST_PAGE_GROUP_END;
567 } else if (mem_len == NETXEN_PCI_32MB_SIZE) { 563 } else if (mem_len == NETXEN_PCI_32MB_SIZE) {
568 mem_ptr1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE); 564 mem_ptr1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE);
569 mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START - 565 mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START -
570 SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE); 566 SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE);
571 first_page_group_start = 0;
572 first_page_group_end = 0;
573 } else if (mem_len == NETXEN_PCI_2MB_SIZE) { 567 } else if (mem_len == NETXEN_PCI_2MB_SIZE) {
574 adapter->hw_write_wx = netxen_nic_hw_write_wx_2M; 568 adapter->hw_write_wx = netxen_nic_hw_write_wx_2M;
575 adapter->hw_read_wx = netxen_nic_hw_read_wx_2M; 569 adapter->hw_read_wx = netxen_nic_hw_read_wx_2M;
@@ -589,8 +583,6 @@ netxen_setup_pci_map(struct netxen_adapter *adapter)
589 return -EIO; 583 return -EIO;
590 } 584 }
591 pci_len0 = mem_len; 585 pci_len0 = mem_len;
592 first_page_group_start = 0;
593 first_page_group_end = 0;
594 586
595 adapter->ahw.ddr_mn_window = 0; 587 adapter->ahw.ddr_mn_window = 0;
596 adapter->ahw.qdr_sn_window = 0; 588 adapter->ahw.qdr_sn_window = 0;
@@ -611,8 +603,6 @@ netxen_setup_pci_map(struct netxen_adapter *adapter)
611 603
612 adapter->ahw.pci_base0 = mem_ptr0; 604 adapter->ahw.pci_base0 = mem_ptr0;
613 adapter->ahw.pci_len0 = pci_len0; 605 adapter->ahw.pci_len0 = pci_len0;
614 adapter->ahw.first_page_group_start = first_page_group_start;
615 adapter->ahw.first_page_group_end = first_page_group_end;
616 adapter->ahw.pci_base1 = mem_ptr1; 606 adapter->ahw.pci_base1 = mem_ptr1;
617 adapter->ahw.pci_base2 = mem_ptr2; 607 adapter->ahw.pci_base2 = mem_ptr2;
618 608
@@ -679,7 +669,7 @@ netxen_start_firmware(struct netxen_adapter *adapter)
679 669
680 /* Initialize multicast addr pool owners */ 670 /* Initialize multicast addr pool owners */
681 val = 0x7654; 671 val = 0x7654;
682 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) 672 if (adapter->ahw.port_type == NETXEN_NIC_XGBE)
683 val |= 0x0f000000; 673 val |= 0x0f000000;
684 netxen_crb_writelit_adapter(adapter, 674 netxen_crb_writelit_adapter(adapter,
685 NETXEN_MAC_ADDR_CNTL_REG, val); 675 NETXEN_MAC_ADDR_CNTL_REG, val);
@@ -870,7 +860,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
870 struct netxen_adapter *adapter = NULL; 860 struct netxen_adapter *adapter = NULL;
871 int i = 0, err; 861 int i = 0, err;
872 int first_driver; 862 int first_driver;
873 u32 val;
874 int pci_func_id = PCI_FUNC(pdev->devfn); 863 int pci_func_id = PCI_FUNC(pdev->devfn);
875 uint8_t revision_id; 864 uint8_t revision_id;
876 865
@@ -936,7 +925,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
936 925
937 /* This will be reset for mezz cards */ 926 /* This will be reset for mezz cards */
938 adapter->portnum = pci_func_id; 927 adapter->portnum = pci_func_id;
939 adapter->status &= ~NETXEN_NETDEV_STATUS;
940 adapter->rx_csum = 1; 928 adapter->rx_csum = 1;
941 adapter->mc_enabled = 0; 929 adapter->mc_enabled = 0;
942 if (NX_IS_REVISION_P3(revision_id)) 930 if (NX_IS_REVISION_P3(revision_id))
@@ -974,7 +962,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
974 netxen_initialize_adapter_ops(adapter); 962 netxen_initialize_adapter_ops(adapter);
975 963
976 /* Mezz cards have PCI function 0,2,3 enabled */ 964 /* Mezz cards have PCI function 0,2,3 enabled */
977 switch (adapter->ahw.boardcfg.board_type) { 965 switch (adapter->ahw.board_type) {
978 case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ: 966 case NETXEN_BRDTYPE_P2_SB31_10G_IMEZ:
979 case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ: 967 case NETXEN_BRDTYPE_P2_SB31_10G_HMEZ:
980 if (pci_func_id >= 2) 968 if (pci_func_id >= 2)
@@ -1007,15 +995,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1007 995
1008 nx_update_dma_mask(adapter); 996 nx_update_dma_mask(adapter);
1009 997
1010 netxen_nic_flash_print(adapter); 998 netxen_nic_get_firmware_info(adapter);
1011
1012 if (NX_IS_REVISION_P3(revision_id)) {
1013 adapter->hw_read_wx(adapter,
1014 NETXEN_MIU_MN_CONTROL, &val, 4);
1015 adapter->ahw.cut_through = (val & 0x4) ? 1 : 0;
1016 dev_info(&pdev->dev, "firmware running in %s mode\n",
1017 adapter->ahw.cut_through ? "cut through" : "legacy");
1018 }
1019 999
1020 /* 1000 /*
1021 * See if the firmware gave us a virtual-physical port mapping. 1001 * See if the firmware gave us a virtual-physical port mapping.
@@ -1066,7 +1046,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1066 1046
1067 pci_set_drvdata(pdev, adapter); 1047 pci_set_drvdata(pdev, adapter);
1068 1048
1069 switch (adapter->ahw.board_type) { 1049 switch (adapter->ahw.port_type) {
1070 case NETXEN_NIC_GBE: 1050 case NETXEN_NIC_GBE:
1071 dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n", 1051 dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n",
1072 adapter->netdev->name); 1052 adapter->netdev->name);
@@ -1460,7 +1440,7 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1460 linkup = (val == XG_LINK_UP_P3); 1440 linkup = (val == XG_LINK_UP_P3);
1461 } else { 1441 } else {
1462 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); 1442 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE);
1463 if (adapter->ahw.board_type == NETXEN_NIC_GBE) 1443 if (adapter->ahw.port_type == NETXEN_NIC_GBE)
1464 linkup = (val >> port) & 1; 1444 linkup = (val >> port) & 1;
1465 else { 1445 else {
1466 val = (val >> port*8) & 0xff; 1446 val = (val >> port*8) & 0xff;