diff options
author | Amit Kumar Salecha <amit@netxen.com> | 2009-10-16 11:50:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-18 02:44:42 -0400 |
commit | 6abb4b83eac25d91f6de834e97b2ea38e979575b (patch) | |
tree | d06065cc9c37f3bbc9a2a15a6c9e09535e3adb79 /drivers/net/netxen | |
parent | 0be367bd5d10634c0836f57a684432fee935d929 (diff) |
netxen: onchip memory access change
Add support for different windowing scheme for on chip
memory in future chip revisions. This is required by
diagnostic tools.
Signed-off-by: Amit Kumar Salecha <amit@netxen.com>
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hdr.h | 3 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 17 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 6 |
3 files changed, 17 insertions, 9 deletions
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index d40fe33a4d84..7386a7cce2ba 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -867,6 +867,9 @@ enum { | |||
867 | (PCIX_SN_WINDOW_F0 + (0x20 * (func))) :\ | 867 | (PCIX_SN_WINDOW_F0 + (0x20 * (func))) :\ |
868 | (PCIX_SN_WINDOW_F4 + (0x10 * ((func)-4)))) | 868 | (PCIX_SN_WINDOW_F4 + (0x10 * ((func)-4)))) |
869 | 869 | ||
870 | #define PCIX_OCM_WINDOW (0x10800) | ||
871 | #define PCIX_OCM_WINDOW_REG(func) (PCIX_OCM_WINDOW + 0x20 * (func)) | ||
872 | |||
870 | #define PCIX_TARGET_STATUS (0x10118) | 873 | #define PCIX_TARGET_STATUS (0x10118) |
871 | #define PCIX_TARGET_STATUS_F1 (0x10160) | 874 | #define PCIX_TARGET_STATUS_F1 (0x10160) |
872 | #define PCIX_TARGET_STATUS_F2 (0x10164) | 875 | #define PCIX_TARGET_STATUS_F2 (0x10164) |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 52a2f2d67552..a63324613430 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #define MASK(n) ((1ULL<<(n))-1) | 31 | #define MASK(n) ((1ULL<<(n))-1) |
32 | #define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff)) | 32 | #define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff)) |
33 | #define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff)) | 33 | #define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff)) |
34 | #define OCM_WIN_P3P(addr) (addr & 0xffc0000) | ||
34 | #define MS_WIN(addr) (addr & 0x0ffc0000) | 35 | #define MS_WIN(addr) (addr & 0x0ffc0000) |
35 | 36 | ||
36 | #define GET_MEM_OFFS_2M(addr) (addr & MASK(18)) | 37 | #define GET_MEM_OFFS_2M(addr) (addr & MASK(18)) |
@@ -1338,7 +1339,7 @@ static int | |||
1338 | netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, | 1339 | netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, |
1339 | u64 addr, u32 *start) | 1340 | u64 addr, u32 *start) |
1340 | { | 1341 | { |
1341 | u32 win_read, window; | 1342 | u32 window; |
1342 | struct pci_dev *pdev = adapter->pdev; | 1343 | struct pci_dev *pdev = adapter->pdev; |
1343 | 1344 | ||
1344 | if ((addr & 0x00ff800) == 0xff800) { | 1345 | if ((addr & 0x00ff800) == 0xff800) { |
@@ -1347,14 +1348,14 @@ netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, | |||
1347 | return -EIO; | 1348 | return -EIO; |
1348 | } | 1349 | } |
1349 | 1350 | ||
1350 | window = OCM_WIN(addr); | 1351 | if (NX_IS_REVISION_P3P(adapter->ahw.revision_id)) |
1352 | window = OCM_WIN_P3P(addr); | ||
1353 | else | ||
1354 | window = OCM_WIN(addr); | ||
1355 | |||
1351 | writel(window, adapter->ahw.ocm_win_crb); | 1356 | writel(window, adapter->ahw.ocm_win_crb); |
1352 | win_read = readl(adapter->ahw.ocm_win_crb); | 1357 | /* read back to flush */ |
1353 | if ((win_read >> 7) != window) { | 1358 | readl(adapter->ahw.ocm_win_crb); |
1354 | if (printk_ratelimit()) | ||
1355 | dev_warn(&pdev->dev, "failed to set OCM window\n"); | ||
1356 | return -EIO; | ||
1357 | } | ||
1358 | 1359 | ||
1359 | adapter->ahw.ocm_win = window; | 1360 | adapter->ahw.ocm_win = window; |
1360 | *start = NETXEN_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr); | 1361 | *start = NETXEN_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr); |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 2d772dd381fe..30d9afe7366a 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -649,7 +649,11 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) | |||
649 | adapter->ahw.pci_base1 = mem_ptr1; | 649 | adapter->ahw.pci_base1 = mem_ptr1; |
650 | adapter->ahw.pci_base2 = mem_ptr2; | 650 | adapter->ahw.pci_base2 = mem_ptr2; |
651 | 651 | ||
652 | if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 652 | if (NX_IS_REVISION_P3P(adapter->ahw.revision_id)) { |
653 | adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter, | ||
654 | NETXEN_PCIX_PS_REG(PCIX_OCM_WINDOW_REG(pci_func))); | ||
655 | |||
656 | } else if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
653 | adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter, | 657 | adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter, |
654 | NETXEN_PCIX_PS_REG(PCIE_MN_WINDOW_REG(pci_func))); | 658 | NETXEN_PCIX_PS_REG(PCIE_MN_WINDOW_REG(pci_func))); |
655 | } | 659 | } |