Commit 14e2cfbb authored by Sucheta Chakraborty's avatar Sucheta Chakraborty Committed by David S. Miller

netxen: to fix onchip memory access.

Remove unnecessary remap of the region in bar 0 to access onhip memory
for NX3031.
Signed-off-by: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 215387a4
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#define MASK(n) ((1ULL<<(n))-1) #define MASK(n) ((1ULL<<(n))-1)
#define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff)) #define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff))
#define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff)) #define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff))
#define OCM_WIN_P3P(addr) (addr & 0xffc0000)
#define MS_WIN(addr) (addr & 0x0ffc0000) #define MS_WIN(addr) (addr & 0x0ffc0000)
#define GET_MEM_OFFS_2M(addr) (addr & MASK(18)) #define GET_MEM_OFFS_2M(addr) (addr & MASK(18))
...@@ -1391,18 +1390,8 @@ netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, ...@@ -1391,18 +1390,8 @@ netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter,
u64 addr, u32 *start) u64 addr, u32 *start)
{ {
u32 window; u32 window;
struct pci_dev *pdev = adapter->pdev;
if ((addr & 0x00ff800) == 0xff800) { window = OCM_WIN(addr);
if (printk_ratelimit())
dev_warn(&pdev->dev, "QM access not handled\n");
return -EIO;
}
if (NX_IS_REVISION_P3P(adapter->ahw.revision_id))
window = OCM_WIN_P3P(addr);
else
window = OCM_WIN(addr);
writel(window, adapter->ahw.ocm_win_crb); writel(window, adapter->ahw.ocm_win_crb);
/* read back to flush */ /* read back to flush */
...@@ -1419,7 +1408,7 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off, ...@@ -1419,7 +1408,7 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off,
{ {
void __iomem *addr, *mem_ptr = NULL; void __iomem *addr, *mem_ptr = NULL;
resource_size_t mem_base; resource_size_t mem_base;
int ret = -EIO; int ret;
u32 start; u32 start;
spin_lock(&adapter->ahw.mem_lock); spin_lock(&adapter->ahw.mem_lock);
...@@ -1428,20 +1417,23 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off, ...@@ -1428,20 +1417,23 @@ netxen_nic_pci_mem_access_direct(struct netxen_adapter *adapter, u64 off,
if (ret != 0) if (ret != 0)
goto unlock; goto unlock;
addr = pci_base_offset(adapter, start); if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
if (addr) addr = adapter->ahw.pci_base0 + start;
goto noremap; } else {
addr = pci_base_offset(adapter, start);
mem_base = pci_resource_start(adapter->pdev, 0) + (start & PAGE_MASK); if (addr)
goto noremap;
mem_base = pci_resource_start(adapter->pdev, 0) +
(start & PAGE_MASK);
mem_ptr = ioremap(mem_base, PAGE_SIZE);
if (mem_ptr == NULL) {
ret = -EIO;
goto unlock;
}
mem_ptr = ioremap(mem_base, PAGE_SIZE); addr = mem_ptr + (start & (PAGE_SIZE-1));
if (mem_ptr == NULL) {
ret = -EIO;
goto unlock;
} }
addr = mem_ptr + (start & (PAGE_SIZE - 1));
noremap: noremap:
if (op == 0) /* read */ if (op == 0) /* read */
*data = readq(addr); *data = readq(addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment