提交 6abb4b83 编写于 作者: A Amit Kumar Salecha 提交者: David S. Miller

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: NAmit Kumar Salecha <amit@netxen.com>
Signed-off-by: NDhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0be367bd
...@@ -867,6 +867,9 @@ enum { ...@@ -867,6 +867,9 @@ enum {
(PCIX_SN_WINDOW_F0 + (0x20 * (func))) :\ (PCIX_SN_WINDOW_F0 + (0x20 * (func))) :\
(PCIX_SN_WINDOW_F4 + (0x10 * ((func)-4)))) (PCIX_SN_WINDOW_F4 + (0x10 * ((func)-4))))
#define PCIX_OCM_WINDOW (0x10800)
#define PCIX_OCM_WINDOW_REG(func) (PCIX_OCM_WINDOW + 0x20 * (func))
#define PCIX_TARGET_STATUS (0x10118) #define PCIX_TARGET_STATUS (0x10118)
#define PCIX_TARGET_STATUS_F1 (0x10160) #define PCIX_TARGET_STATUS_F1 (0x10160)
#define PCIX_TARGET_STATUS_F2 (0x10164) #define PCIX_TARGET_STATUS_F2 (0x10164)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#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))
...@@ -1338,7 +1339,7 @@ static int ...@@ -1338,7 +1339,7 @@ static int
netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter,
u64 addr, u32 *start) u64 addr, u32 *start)
{ {
u32 win_read, window; u32 window;
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
if ((addr & 0x00ff800) == 0xff800) { if ((addr & 0x00ff800) == 0xff800) {
...@@ -1347,14 +1348,14 @@ netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter, ...@@ -1347,14 +1348,14 @@ netxen_nic_pci_set_window_2M(struct netxen_adapter *adapter,
return -EIO; return -EIO;
} }
window = OCM_WIN(addr); 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);
win_read = readl(adapter->ahw.ocm_win_crb); /* read back to flush */
if ((win_read >> 7) != window) { readl(adapter->ahw.ocm_win_crb);
if (printk_ratelimit())
dev_warn(&pdev->dev, "failed to set OCM window\n");
return -EIO;
}
adapter->ahw.ocm_win = window; adapter->ahw.ocm_win = window;
*start = NETXEN_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr); *start = NETXEN_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr);
......
...@@ -649,7 +649,11 @@ netxen_setup_pci_map(struct netxen_adapter *adapter) ...@@ -649,7 +649,11 @@ netxen_setup_pci_map(struct netxen_adapter *adapter)
adapter->ahw.pci_base1 = mem_ptr1; adapter->ahw.pci_base1 = mem_ptr1;
adapter->ahw.pci_base2 = mem_ptr2; adapter->ahw.pci_base2 = mem_ptr2;
if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) { if (NX_IS_REVISION_P3P(adapter->ahw.revision_id)) {
adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter,
NETXEN_PCIX_PS_REG(PCIX_OCM_WINDOW_REG(pci_func)));
} else if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter, adapter->ahw.ocm_win_crb = netxen_get_ioaddr(adapter,
NETXEN_PCIX_PS_REG(PCIE_MN_WINDOW_REG(pci_func))); NETXEN_PCIX_PS_REG(PCIE_MN_WINDOW_REG(pci_func)));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册