aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic.h
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-04-07 18:50:44 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-08 18:58:28 -0400
commit1fbe63235893e5dce28fe91d8465dd231b0cb3d9 (patch)
tree52d88817b8e23c2784c0e2a33a538f4eab2fcb8f /drivers/net/netxen/netxen_nic.h
parent71dcddbdd35487eb931aa8aab28a2df474008754 (diff)
netxen: annotate register access functions
o remove unnecessary length parameter since register access width is fixed 4 byte. o remove superfluous pci_read_normalize and pci_write_normalize functions. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r--drivers/net/netxen/netxen_nic.h75
1 files changed, 14 insertions, 61 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index e0f329ff3691..1e4190dd0c16 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1258,14 +1258,12 @@ struct netxen_adapter {
1258 int (*init_port) (struct netxen_adapter *, int); 1258 int (*init_port) (struct netxen_adapter *, int);
1259 int (*stop_port) (struct netxen_adapter *); 1259 int (*stop_port) (struct netxen_adapter *);
1260 1260
1261 int (*hw_read_wx)(struct netxen_adapter *, ulong, void *, int); 1261 u32 (*hw_read_wx)(struct netxen_adapter *, ulong);
1262 int (*hw_write_wx)(struct netxen_adapter *, ulong, void *, int); 1262 int (*hw_write_wx)(struct netxen_adapter *, ulong, u32);
1263 int (*pci_mem_read)(struct netxen_adapter *, u64, void *, int); 1263 int (*pci_mem_read)(struct netxen_adapter *, u64, void *, int);
1264 int (*pci_mem_write)(struct netxen_adapter *, u64, void *, int); 1264 int (*pci_mem_write)(struct netxen_adapter *, u64, void *, int);
1265 int (*pci_write_immediate)(struct netxen_adapter *, u64, u32); 1265 int (*pci_write_immediate)(struct netxen_adapter *, u64, u32);
1266 u32 (*pci_read_immediate)(struct netxen_adapter *, u64); 1266 u32 (*pci_read_immediate)(struct netxen_adapter *, u64);
1267 void (*pci_write_normalize)(struct netxen_adapter *, u64, u32);
1268 u32 (*pci_read_normalize)(struct netxen_adapter *, u64);
1269 unsigned long (*pci_set_window)(struct netxen_adapter *, 1267 unsigned long (*pci_set_window)(struct netxen_adapter *,
1270 unsigned long long); 1268 unsigned long long);
1271 1269
@@ -1302,46 +1300,6 @@ struct netxen_adapter {
1302#define netxen_get_dma_watchdog_disabled(config_word) \ 1300#define netxen_get_dma_watchdog_disabled(config_word) \
1303 (((config_word) >> 1) & 0x1) 1301 (((config_word) >> 1) & 0x1)
1304 1302
1305/* Max number of xmit producer threads that can run simultaneously */
1306#define MAX_XMIT_PRODUCERS 16
1307
1308#define PCI_OFFSET_FIRST_RANGE(adapter, off) \
1309 ((adapter)->ahw.pci_base0 + (off))
1310#define PCI_OFFSET_SECOND_RANGE(adapter, off) \
1311 ((adapter)->ahw.pci_base1 + (off) - SECOND_PAGE_GROUP_START)
1312#define PCI_OFFSET_THIRD_RANGE(adapter, off) \
1313 ((adapter)->ahw.pci_base2 + (off) - THIRD_PAGE_GROUP_START)
1314
1315static inline void __iomem *pci_base_offset(struct netxen_adapter *adapter,
1316 unsigned long off)
1317{
1318 if ((off < FIRST_PAGE_GROUP_END) && (off >= FIRST_PAGE_GROUP_START)) {
1319 return (adapter->ahw.pci_base0 + off);
1320 } else if ((off < SECOND_PAGE_GROUP_END) &&
1321 (off >= SECOND_PAGE_GROUP_START)) {
1322 return (adapter->ahw.pci_base1 + off - SECOND_PAGE_GROUP_START);
1323 } else if ((off < THIRD_PAGE_GROUP_END) &&
1324 (off >= THIRD_PAGE_GROUP_START)) {
1325 return (adapter->ahw.pci_base2 + off - THIRD_PAGE_GROUP_START);
1326 }
1327 return NULL;
1328}
1329
1330static inline void __iomem *pci_base(struct netxen_adapter *adapter,
1331 unsigned long off)
1332{
1333 if ((off < FIRST_PAGE_GROUP_END) && (off >= FIRST_PAGE_GROUP_START)) {
1334 return adapter->ahw.pci_base0;
1335 } else if ((off < SECOND_PAGE_GROUP_END) &&
1336 (off >= SECOND_PAGE_GROUP_START)) {
1337 return adapter->ahw.pci_base1;
1338 } else if ((off < THIRD_PAGE_GROUP_END) &&
1339 (off >= THIRD_PAGE_GROUP_START)) {
1340 return adapter->ahw.pci_base2;
1341 }
1342 return NULL;
1343}
1344
1345int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter); 1303int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter);
1346int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter); 1304int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter);
1347int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter); 1305int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter);
@@ -1357,18 +1315,17 @@ int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu);
1357void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val); 1315void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val);
1358int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off); 1316int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off);
1359void netxen_nic_write_w0(struct netxen_adapter *adapter, u32 index, u32 value); 1317void netxen_nic_write_w0(struct netxen_adapter *adapter, u32 index, u32 value);
1360void netxen_nic_read_w0(struct netxen_adapter *adapter, u32 index, u32 *value); 1318u32 netxen_nic_read_w0(struct netxen_adapter *adapter, u32 index);
1361void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, u32 value); 1319void netxen_nic_write_w1(struct netxen_adapter *adapter, u32 index, u32 value);
1362void netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index, u32 *value); 1320u32 netxen_nic_read_w1(struct netxen_adapter *adapter, u32 index);
1363 1321
1364int netxen_nic_get_board_info(struct netxen_adapter *adapter); 1322int netxen_nic_get_board_info(struct netxen_adapter *adapter);
1365void netxen_nic_get_firmware_info(struct netxen_adapter *adapter); 1323void netxen_nic_get_firmware_info(struct netxen_adapter *adapter);
1366int netxen_nic_wol_supported(struct netxen_adapter *adapter); 1324int netxen_nic_wol_supported(struct netxen_adapter *adapter);
1367 1325
1368int netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter, 1326u32 netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter, ulong off);
1369 ulong off, void *data, int len);
1370int netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter, 1327int netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter,
1371 ulong off, void *data, int len); 1328 ulong off, u32 data);
1372int netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter, 1329int netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter,
1373 u64 off, void *data, int size); 1330 u64 off, void *data, int size);
1374int netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter, 1331int netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter,
@@ -1384,10 +1341,9 @@ unsigned long netxen_nic_pci_set_window_128M(struct netxen_adapter *adapter,
1384void netxen_nic_pci_change_crbwindow_128M(struct netxen_adapter *adapter, 1341void netxen_nic_pci_change_crbwindow_128M(struct netxen_adapter *adapter,
1385 u32 wndw); 1342 u32 wndw);
1386 1343
1387int netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter, 1344u32 netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter, ulong off);
1388 ulong off, void *data, int len);
1389int netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter, 1345int netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter,
1390 ulong off, void *data, int len); 1346 ulong off, u32 data);
1391int netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter, 1347int netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter,
1392 u64 off, void *data, int size); 1348 u64 off, void *data, int size);
1393int netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter, 1349int netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter,
@@ -1514,9 +1470,8 @@ dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
1514 u32 ctrl; 1470 u32 ctrl;
1515 1471
1516 /* check if already inactive */ 1472 /* check if already inactive */
1517 if (adapter->hw_read_wx(adapter, 1473 ctrl = adapter->hw_read_wx(adapter,
1518 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) 1474 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL));
1519 printk(KERN_ERR "failed to read dma watchdog status\n");
1520 1475
1521 if (netxen_get_dma_watchdog_enabled(ctrl) == 0) 1476 if (netxen_get_dma_watchdog_enabled(ctrl) == 0)
1522 return 1; 1477 return 1;
@@ -1534,9 +1489,8 @@ dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
1534{ 1489{
1535 u32 ctrl; 1490 u32 ctrl;
1536 1491
1537 if (adapter->hw_read_wx(adapter, 1492 ctrl = adapter->hw_read_wx(adapter,
1538 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) 1493 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL));
1539 printk(KERN_ERR "failed to read dma watchdog status\n");
1540 1494
1541 return (netxen_get_dma_watchdog_enabled(ctrl) == 0); 1495 return (netxen_get_dma_watchdog_enabled(ctrl) == 0);
1542} 1496}
@@ -1546,9 +1500,8 @@ dma_watchdog_wakeup(struct netxen_adapter *adapter)
1546{ 1500{
1547 u32 ctrl; 1501 u32 ctrl;
1548 1502
1549 if (adapter->hw_read_wx(adapter, 1503 ctrl = adapter->hw_read_wx(adapter,
1550 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) 1504 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL));
1551 printk(KERN_ERR "failed to read dma watchdog status\n");
1552 1505
1553 if (netxen_get_dma_watchdog_enabled(ctrl)) 1506 if (netxen_get_dma_watchdog_enabled(ctrl))
1554 return 1; 1507 return 1;