aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 87bc910f9772..be6398860781 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -32,7 +32,6 @@
32#define MASK(n) ((1ULL<<(n))-1) 32#define MASK(n) ((1ULL<<(n))-1)
33#define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff)) 33#define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff))
34#define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff)) 34#define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff))
35#define OCM_WIN_P3P(addr) (addr & 0xffc0000)
36#define MS_WIN(addr) (addr & 0x0ffc0000) 35#define MS_WIN(addr) (addr & 0x0ffc0000)
37 36
38#define GET_MEM_OFFS_2M(addr) (addr & MASK(18)) 37#define GET_MEM_OFFS_2M(addr) (addr & MASK(18))
@@ -1391,18 +1390,8 @@ netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter,
1391 u64 addr, u32 *start) 1390 u64 addr, u32 *start)
1392{ 1391{
1393 u32 window; 1392 u32 window;
1394 struct pci_dev *pdev = adapter->pdev;
1395 1393
1396 if ((addr & 0x00ff800) == 0xff800) { 1394 window = OCM_WIN(addr);
1397 if (printk_ratelimit())
1398 dev_warn(&pdev->dev, "QM access not handled\n");
1399 return -EIO;
1400 }
1401
1402 if (NX_IS_REVISION_P3P(adapter->ahw.revision_id))
1403 window = OCM_WIN_P3P(addr);
1404 else
1405 window = OCM_WIN(addr);
1406 1395
1407 writel(window, adapter->ahw.ocm_win_crb); 1396 writel(window, adapter->ahw.ocm_win_crb);
1408 /* read back to flush */ 1397 /* read back to flush */
@@ -1419,7 +1408,7 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off,
1419{ 1408{
1420 void __iomem *addr, *mem_ptr = NULL; 1409 void __iomem *addr, *mem_ptr = NULL;
1421 resource_size_t mem_base; 1410 resource_size_t mem_base;
1422 int ret = -EIO; 1411 int ret;
1423 u32 start; 1412 u32 start;
1424 1413
1425 spin_lock(&adapter->ahw.mem_lock); 1414 spin_lock(&adapter->ahw.mem_lock);
@@ -1428,20 +1417,23 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off,
1428 if (ret != 0) 1417 if (ret != 0)
1429 goto unlock; 1418 goto unlock;
1430 1419
1431 addr = pci_base_offset(adapter, start); 1420 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
1432 if (addr) 1421 addr = adapter->ahw.pci_base0 + start;
1433 goto noremap; 1422 } else {
1434 1423 addr = pci_base_offset(adapter, start);
1435 mem_base = pci_resource_start(adapter->pdev, 0) + (start & PAGE_MASK); 1424 if (addr)
1425 goto noremap;
1426
1427 mem_base = pci_resource_start(adapter->pdev, 0) +
1428 (start & PAGE_MASK);
1429 mem_ptr = ioremap(mem_base, PAGE_SIZE);
1430 if (mem_ptr == NULL) {
1431 ret = -EIO;
1432 goto unlock;
1433 }
1436 1434
1437 mem_ptr = ioremap(mem_base, PAGE_SIZE); 1435 addr = mem_ptr + (start & (PAGE_SIZE-1));
1438 if (mem_ptr == NULL) {
1439 ret = -EIO;
1440 goto unlock;
1441 } 1436 }
1442
1443 addr = mem_ptr + (start & (PAGE_SIZE - 1));
1444
1445noremap: 1437noremap:
1446 if (op == 0) /* read */ 1438 if (op == 0) /* read */
1447 *data = readq(addr); 1439 *data = readq(addr);