diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 9138bbcbb80a..cbfe44c8a7fd 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -86,7 +86,6 @@ static void __iomem *pci_base_offset(struct netxen_adapter *adapter, | |||
86 | return NULL; | 86 | return NULL; |
87 | } | 87 | } |
88 | 88 | ||
89 | #define CRB_WIN_LOCK_TIMEOUT 100000000 | ||
90 | static crb_128M_2M_block_map_t | 89 | static crb_128M_2M_block_map_t |
91 | crb_128M_2M_map[64] __cacheline_aligned_in_smp = { | 90 | crb_128M_2M_map[64] __cacheline_aligned_in_smp = { |
92 | {{{0, 0, 0, 0} } }, /* 0: PCI */ | 91 | {{{0, 0, 0, 0} } }, /* 0: PCI */ |
@@ -320,6 +319,35 @@ static unsigned crb_hub_agt[64] = | |||
320 | 319 | ||
321 | #define NETXEN_WINDOW_ONE 0x2000000 /*CRB Window: bit 25 of CRB address */ | 320 | #define NETXEN_WINDOW_ONE 0x2000000 /*CRB Window: bit 25 of CRB address */ |
322 | 321 | ||
322 | #define NETXEN_PCIE_SEM_TIMEOUT 10000 | ||
323 | |||
324 | int | ||
325 | netxen_pcie_sem_lock(struct netxen_adapter *adapter, int sem, u32 id_reg) | ||
326 | { | ||
327 | int done = 0, timeout = 0; | ||
328 | |||
329 | while (!done) { | ||
330 | done = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_LOCK(sem))); | ||
331 | if (done == 1) | ||
332 | break; | ||
333 | if (++timeout >= NETXEN_PCIE_SEM_TIMEOUT) | ||
334 | return -1; | ||
335 | msleep(1); | ||
336 | } | ||
337 | |||
338 | if (id_reg) | ||
339 | NXWR32(adapter, id_reg, adapter->portnum); | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | void | ||
345 | netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) | ||
346 | { | ||
347 | int val; | ||
348 | val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem))); | ||
349 | } | ||
350 | |||
323 | #define NETXEN_UNICAST_ADDR(port, index) \ | 351 | #define NETXEN_UNICAST_ADDR(port, index) \ |
324 | (NETXEN_UNICAST_ADDR_BASE+(port*32)+(index*8)) | 352 | (NETXEN_UNICAST_ADDR_BASE+(port*32)+(index*8)) |
325 | #define NETXEN_MCAST_ADDR(port, index) \ | 353 | #define NETXEN_MCAST_ADDR(port, index) \ |
@@ -906,33 +934,6 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac) | |||
906 | return 0; | 934 | return 0; |
907 | } | 935 | } |
908 | 936 | ||
909 | #define CRB_WIN_LOCK_TIMEOUT 100000000 | ||
910 | |||
911 | static int crb_win_lock(struct netxen_adapter *adapter) | ||
912 | { | ||
913 | int done = 0, timeout = 0; | ||
914 | |||
915 | while (!done) { | ||
916 | /* acquire semaphore3 from PCI HW block */ | ||
917 | done = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM7_LOCK)); | ||
918 | if (done == 1) | ||
919 | break; | ||
920 | if (timeout >= CRB_WIN_LOCK_TIMEOUT) | ||
921 | return -1; | ||
922 | timeout++; | ||
923 | udelay(1); | ||
924 | } | ||
925 | NXWR32(adapter, NETXEN_CRB_WIN_LOCK_ID, adapter->portnum); | ||
926 | return 0; | ||
927 | } | ||
928 | |||
929 | static void crb_win_unlock(struct netxen_adapter *adapter) | ||
930 | { | ||
931 | int val; | ||
932 | |||
933 | val = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM7_UNLOCK)); | ||
934 | } | ||
935 | |||
936 | /* | 937 | /* |
937 | * Changes the CRB window to the specified window. | 938 | * Changes the CRB window to the specified window. |
938 | */ | 939 | */ |