Commit 1f5e055d authored by Amit Kumar Salecha's avatar Amit Kumar Salecha Committed by David S. Miller

netxen: remove sub 64-bit mem accesses

Sub 64-bit / unaligned access to oncard memory was only used
by old diagnostic tools, causes some intermittent issues when
memory controller agent is used.  The new access method was
added by commit ea6828b8
("netxen: improve pci memory access").  Firmware init anyway
uses 8-byte strides.

This also fixes address/offset calculation for NX2031 context
memory (SIU). For NX3031, SIU uses same register offsets
as packet memory (MIU).
Signed-off-by: default avatarAmit Kumar Salecha <amit@netxen.com>
Signed-off-by: default avatarDhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89d71a66
...@@ -1180,8 +1180,8 @@ struct netxen_adapter { ...@@ -1180,8 +1180,8 @@ struct netxen_adapter {
u32 (*crb_read)(struct netxen_adapter *, ulong); u32 (*crb_read)(struct netxen_adapter *, ulong);
int (*crb_write)(struct netxen_adapter *, ulong, u32); int (*crb_write)(struct netxen_adapter *, ulong, u32);
int (*pci_mem_read)(struct netxen_adapter *, u64, void *, int); int (*pci_mem_read)(struct netxen_adapter *, u64, u64 *);
int (*pci_mem_write)(struct netxen_adapter *, u64, void *, int); int (*pci_mem_write)(struct netxen_adapter *, u64, u64);
unsigned long (*pci_set_window)(struct netxen_adapter *, unsigned long (*pci_set_window)(struct netxen_adapter *,
unsigned long long); unsigned long long);
......
...@@ -661,40 +661,47 @@ enum { ...@@ -661,40 +661,47 @@ enum {
#define NETXEN_NIU_AP_STATION_ADDR_0(I) (NETXEN_CRB_NIU+0xa0040+(I)*0x10000) #define NETXEN_NIU_AP_STATION_ADDR_0(I) (NETXEN_CRB_NIU+0xa0040+(I)*0x10000)
#define NETXEN_NIU_AP_STATION_ADDR_1(I) (NETXEN_CRB_NIU+0xa0044+(I)*0x10000) #define NETXEN_NIU_AP_STATION_ADDR_1(I) (NETXEN_CRB_NIU+0xa0044+(I)*0x10000)
#define TEST_AGT_CTRL (0x00)
#define TA_CTL_START 1
#define TA_CTL_ENABLE 2
#define TA_CTL_WRITE 4
#define TA_CTL_BUSY 8
/* /*
* Register offsets for MN * Register offsets for MN
*/ */
#define MIU_CONTROL (0x000) #define MIU_TEST_AGT_BASE (0x90)
#define MIU_TEST_AGT_CTRL (0x090)
#define MIU_TEST_AGT_ADDR_LO (0x094) #define MIU_TEST_AGT_ADDR_LO (0x04)
#define MIU_TEST_AGT_ADDR_HI (0x098) #define MIU_TEST_AGT_ADDR_HI (0x08)
#define MIU_TEST_AGT_WRDATA_LO (0x0a0) #define MIU_TEST_AGT_WRDATA_LO (0x10)
#define MIU_TEST_AGT_WRDATA_HI (0x0a4) #define MIU_TEST_AGT_WRDATA_HI (0x14)
#define MIU_TEST_AGT_WRDATA(i) (0x0a0+(4*(i))) #define MIU_TEST_AGT_WRDATA(i) (0x10+(4*(i)))
#define MIU_TEST_AGT_RDDATA_LO (0x0a8) #define MIU_TEST_AGT_RDDATA_LO (0x18)
#define MIU_TEST_AGT_RDDATA_HI (0x0ac) #define MIU_TEST_AGT_RDDATA_HI (0x1c)
#define MIU_TEST_AGT_RDDATA(i) (0x0a8+(4*(i))) #define MIU_TEST_AGT_RDDATA(i) (0x18+(4*(i)))
#define MIU_TEST_AGT_ADDR_MASK 0xfffffff8
#define MIU_TEST_AGT_UPPER_ADDR(off) (0) #define MIU_TEST_AGT_ADDR_MASK 0xfffffff8
#define MIU_TEST_AGT_UPPER_ADDR(off) (0)
/* MIU_TEST_AGT_CTRL flags. work for SIU as well */
#define MIU_TA_CTL_START 1 /*
#define MIU_TA_CTL_ENABLE 2 * Register offsets for MS
#define MIU_TA_CTL_WRITE 4 */
#define MIU_TA_CTL_BUSY 8 #define SIU_TEST_AGT_BASE (0x60)
#define SIU_TEST_AGT_CTRL (0x060) #define SIU_TEST_AGT_ADDR_LO (0x04)
#define SIU_TEST_AGT_ADDR_LO (0x064) #define SIU_TEST_AGT_ADDR_HI (0x18)
#define SIU_TEST_AGT_ADDR_HI (0x078) #define SIU_TEST_AGT_WRDATA_LO (0x08)
#define SIU_TEST_AGT_WRDATA_LO (0x068) #define SIU_TEST_AGT_WRDATA_HI (0x0c)
#define SIU_TEST_AGT_WRDATA_HI (0x06c) #define SIU_TEST_AGT_WRDATA(i) (0x08+(4*(i)))
#define SIU_TEST_AGT_WRDATA(i) (0x068+(4*(i))) #define SIU_TEST_AGT_RDDATA_LO (0x10)
#define SIU_TEST_AGT_RDDATA_LO (0x070) #define SIU_TEST_AGT_RDDATA_HI (0x14)
#define SIU_TEST_AGT_RDDATA_HI (0x074) #define SIU_TEST_AGT_RDDATA(i) (0x10+(4*(i)))
#define SIU_TEST_AGT_RDDATA(i) (0x070+(4*(i)))
#define SIU_TEST_AGT_ADDR_MASK 0x3ffff8
#define SIU_TEST_AGT_ADDR_MASK 0x3ffff8 #define SIU_TEST_AGT_UPPER_ADDR(off) ((off)>>22)
#define SIU_TEST_AGT_UPPER_ADDR(off) ((off)>>22)
/* XG Link status */ /* XG Link status */
#define XG_LINK_UP 0x10 #define XG_LINK_UP 0x10
......
This diff is collapsed.
...@@ -702,7 +702,10 @@ netxen_load_firmware(struct netxen_adapter *adapter) ...@@ -702,7 +702,10 @@ netxen_load_firmware(struct netxen_adapter *adapter)
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
data = cpu_to_le64(ptr64[i]); data = cpu_to_le64(ptr64[i]);
adapter->pci_mem_write(adapter, flashaddr, &data, 8); if (adapter->pci_mem_write(adapter,
flashaddr, data))
return -EIO;
flashaddr += 8; flashaddr += 8;
} }
...@@ -716,7 +719,7 @@ netxen_load_firmware(struct netxen_adapter *adapter) ...@@ -716,7 +719,7 @@ netxen_load_firmware(struct netxen_adapter *adapter)
data = cpu_to_le64(ptr64[i]); data = cpu_to_le64(ptr64[i]);
if (adapter->pci_mem_write(adapter, if (adapter->pci_mem_write(adapter,
flashaddr, &data, 8)) flashaddr, data))
return -EIO; return -EIO;
flashaddr += 8; flashaddr += 8;
...@@ -730,17 +733,17 @@ netxen_load_firmware(struct netxen_adapter *adapter) ...@@ -730,17 +733,17 @@ netxen_load_firmware(struct netxen_adapter *adapter)
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if (netxen_rom_fast_read(adapter, if (netxen_rom_fast_read(adapter,
flashaddr, &lo) != 0) flashaddr, (int *)&lo) != 0)
return -EIO; return -EIO;
if (netxen_rom_fast_read(adapter, if (netxen_rom_fast_read(adapter,
flashaddr + 4, &hi) != 0) flashaddr + 4, (int *)&hi) != 0)
return -EIO; return -EIO;
/* hi, lo are already in host endian byteorder */ /* hi, lo are already in host endian byteorder */
data = (((u64)hi << 32) | lo); data = (((u64)hi << 32) | lo);
if (adapter->pci_mem_write(adapter, if (adapter->pci_mem_write(adapter,
flashaddr, &data, 8)) flashaddr, data))
return -EIO; return -EIO;
flashaddr += 8; flashaddr += 8;
......
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