Commit 89c3a86c authored by Hariprasad Shenai's avatar Hariprasad Shenai Committed by David S. Miller

cxgb4/cxg4vf/csiostor: Cleanup MC, MA and CIM related register defines

This patch cleanups all MC, MA and CIM related macros/register defines that are
defined in t4_regs.h and the affected files.
Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f061de42
This diff is collapsed.
...@@ -64,8 +64,8 @@ ...@@ -64,8 +64,8 @@
* Mailbox Data in the fixed CIM PF map and the programmable VF map must * Mailbox Data in the fixed CIM PF map and the programmable VF map must
* match. However, it's a useful convention ... * match. However, it's a useful convention ...
*/ */
#if T4VF_MBDATA_BASE_ADDR != CIM_PF_MAILBOX_DATA #if T4VF_MBDATA_BASE_ADDR != CIM_PF_MAILBOX_DATA_A
#error T4VF_MBDATA_BASE_ADDR must match CIM_PF_MAILBOX_DATA! #error T4VF_MBDATA_BASE_ADDR must match CIM_PF_MAILBOX_DATA_A!
#endif #endif
/* /*
......
...@@ -138,9 +138,9 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, ...@@ -138,9 +138,9 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size,
* Loop trying to get ownership of the mailbox. Return an error * Loop trying to get ownership of the mailbox. Return an error
* if we can't gain ownership. * if we can't gain ownership.
*/ */
v = MBOWNER_GET(t4_read_reg(adapter, mbox_ctl)); v = MBOWNER_G(t4_read_reg(adapter, mbox_ctl));
for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++) for (i = 0; v == MBOX_OWNER_NONE && i < 3; i++)
v = MBOWNER_GET(t4_read_reg(adapter, mbox_ctl)); v = MBOWNER_G(t4_read_reg(adapter, mbox_ctl));
if (v != MBOX_OWNER_DRV) if (v != MBOX_OWNER_DRV)
return v == MBOX_OWNER_FW ? -EBUSY : -ETIMEDOUT; return v == MBOX_OWNER_FW ? -EBUSY : -ETIMEDOUT;
...@@ -162,7 +162,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, ...@@ -162,7 +162,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size,
t4_read_reg(adapter, mbox_data); /* flush write */ t4_read_reg(adapter, mbox_data); /* flush write */
t4_write_reg(adapter, mbox_ctl, t4_write_reg(adapter, mbox_ctl,
MBMSGVALID | MBOWNER(MBOX_OWNER_FW)); MBMSGVALID_F | MBOWNER_V(MBOX_OWNER_FW));
t4_read_reg(adapter, mbox_ctl); /* flush write */ t4_read_reg(adapter, mbox_ctl); /* flush write */
/* /*
...@@ -184,14 +184,14 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, ...@@ -184,14 +184,14 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size,
* If we're the owner, see if this is the reply we wanted. * If we're the owner, see if this is the reply we wanted.
*/ */
v = t4_read_reg(adapter, mbox_ctl); v = t4_read_reg(adapter, mbox_ctl);
if (MBOWNER_GET(v) == MBOX_OWNER_DRV) { if (MBOWNER_G(v) == MBOX_OWNER_DRV) {
/* /*
* If the Message Valid bit isn't on, revoke ownership * If the Message Valid bit isn't on, revoke ownership
* of the mailbox and continue waiting for our reply. * of the mailbox and continue waiting for our reply.
*/ */
if ((v & MBMSGVALID) == 0) { if ((v & MBMSGVALID_F) == 0) {
t4_write_reg(adapter, mbox_ctl, t4_write_reg(adapter, mbox_ctl,
MBOWNER(MBOX_OWNER_NONE)); MBOWNER_V(MBOX_OWNER_NONE));
continue; continue;
} }
...@@ -217,7 +217,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, ...@@ -217,7 +217,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size,
& FW_CMD_REQUEST_F) != 0); & FW_CMD_REQUEST_F) != 0);
} }
t4_write_reg(adapter, mbox_ctl, t4_write_reg(adapter, mbox_ctl,
MBOWNER(MBOX_OWNER_NONE)); MBOWNER_V(MBOX_OWNER_NONE));
return -FW_CMD_RETVAL_G(v); return -FW_CMD_RETVAL_G(v);
} }
} }
......
...@@ -1193,7 +1193,7 @@ csio_hw_fw_halt(struct csio_hw *hw, uint32_t mbox, int32_t force) ...@@ -1193,7 +1193,7 @@ csio_hw_fw_halt(struct csio_hw *hw, uint32_t mbox, int32_t force)
* rather than a RESET ... if it's new enough to understand that ... * rather than a RESET ... if it's new enough to understand that ...
*/ */
if (retval == 0 || force) { if (retval == 0 || force) {
csio_set_reg_field(hw, CIM_BOOT_CFG, UPCRST, UPCRST); csio_set_reg_field(hw, CIM_BOOT_CFG_A, UPCRST_F, UPCRST_F);
csio_set_reg_field(hw, PCIE_FW_A, PCIE_FW_HALT_F, csio_set_reg_field(hw, PCIE_FW_A, PCIE_FW_HALT_F,
PCIE_FW_HALT_F); PCIE_FW_HALT_F);
} }
...@@ -1245,7 +1245,7 @@ csio_hw_fw_restart(struct csio_hw *hw, uint32_t mbox, int32_t reset) ...@@ -1245,7 +1245,7 @@ csio_hw_fw_restart(struct csio_hw *hw, uint32_t mbox, int32_t reset)
* hitting the chip with a hammer. * hitting the chip with a hammer.
*/ */
if (mbox <= PCIE_FW_MASTER_M) { if (mbox <= PCIE_FW_MASTER_M) {
csio_set_reg_field(hw, CIM_BOOT_CFG, UPCRST, 0); csio_set_reg_field(hw, CIM_BOOT_CFG_A, UPCRST_F, 0);
msleep(100); msleep(100);
if (csio_do_reset(hw, true) == 0) if (csio_do_reset(hw, true) == 0)
return 0; return 0;
...@@ -1256,7 +1256,7 @@ csio_hw_fw_restart(struct csio_hw *hw, uint32_t mbox, int32_t reset) ...@@ -1256,7 +1256,7 @@ csio_hw_fw_restart(struct csio_hw *hw, uint32_t mbox, int32_t reset)
} else { } else {
int ms; int ms;
csio_set_reg_field(hw, CIM_BOOT_CFG, UPCRST, 0); csio_set_reg_field(hw, CIM_BOOT_CFG_A, UPCRST_F, 0);
for (ms = 0; ms < FW_CMD_MAX_TIMEOUT; ) { for (ms = 0; ms < FW_CMD_MAX_TIMEOUT; ) {
if (!(csio_rd_reg32(hw, PCIE_FW_A) & PCIE_FW_HALT_F)) if (!(csio_rd_reg32(hw, PCIE_FW_A) & PCIE_FW_HALT_F))
return 0; return 0;
...@@ -2741,10 +2741,10 @@ static void csio_sge_intr_handler(struct csio_hw *hw) ...@@ -2741,10 +2741,10 @@ static void csio_sge_intr_handler(struct csio_hw *hw)
csio_hw_fatal_err(hw); csio_hw_fatal_err(hw);
} }
#define CIM_OBQ_INTR (OBQULP0PARERR | OBQULP1PARERR | OBQULP2PARERR |\ #define CIM_OBQ_INTR (OBQULP0PARERR_F | OBQULP1PARERR_F | OBQULP2PARERR_F |\
OBQULP3PARERR | OBQSGEPARERR | OBQNCSIPARERR) OBQULP3PARERR_F | OBQSGEPARERR_F | OBQNCSIPARERR_F)
#define CIM_IBQ_INTR (IBQTP0PARERR | IBQTP1PARERR | IBQULPPARERR |\ #define CIM_IBQ_INTR (IBQTP0PARERR_F | IBQTP1PARERR_F | IBQULPPARERR_F |\
IBQSGEHIPARERR | IBQSGELOPARERR | IBQNCSIPARERR) IBQSGEHIPARERR_F | IBQSGELOPARERR_F | IBQNCSIPARERR_F)
/* /*
* CIM interrupt handler. * CIM interrupt handler.
...@@ -2752,52 +2752,52 @@ static void csio_sge_intr_handler(struct csio_hw *hw) ...@@ -2752,52 +2752,52 @@ static void csio_sge_intr_handler(struct csio_hw *hw)
static void csio_cim_intr_handler(struct csio_hw *hw) static void csio_cim_intr_handler(struct csio_hw *hw)
{ {
static struct intr_info cim_intr_info[] = { static struct intr_info cim_intr_info[] = {
{ PREFDROPINT, "CIM control register prefetch drop", -1, 1 }, { PREFDROPINT_F, "CIM control register prefetch drop", -1, 1 },
{ CIM_OBQ_INTR, "CIM OBQ parity error", -1, 1 }, { CIM_OBQ_INTR, "CIM OBQ parity error", -1, 1 },
{ CIM_IBQ_INTR, "CIM IBQ parity error", -1, 1 }, { CIM_IBQ_INTR, "CIM IBQ parity error", -1, 1 },
{ MBUPPARERR, "CIM mailbox uP parity error", -1, 1 }, { MBUPPARERR_F, "CIM mailbox uP parity error", -1, 1 },
{ MBHOSTPARERR, "CIM mailbox host parity error", -1, 1 }, { MBHOSTPARERR_F, "CIM mailbox host parity error", -1, 1 },
{ TIEQINPARERRINT, "CIM TIEQ outgoing parity error", -1, 1 }, { TIEQINPARERRINT_F, "CIM TIEQ outgoing parity error", -1, 1 },
{ TIEQOUTPARERRINT, "CIM TIEQ incoming parity error", -1, 1 }, { TIEQOUTPARERRINT_F, "CIM TIEQ incoming parity error", -1, 1 },
{ 0, NULL, 0, 0 } { 0, NULL, 0, 0 }
}; };
static struct intr_info cim_upintr_info[] = { static struct intr_info cim_upintr_info[] = {
{ RSVDSPACEINT, "CIM reserved space access", -1, 1 }, { RSVDSPACEINT_F, "CIM reserved space access", -1, 1 },
{ ILLTRANSINT, "CIM illegal transaction", -1, 1 }, { ILLTRANSINT_F, "CIM illegal transaction", -1, 1 },
{ ILLWRINT, "CIM illegal write", -1, 1 }, { ILLWRINT_F, "CIM illegal write", -1, 1 },
{ ILLRDINT, "CIM illegal read", -1, 1 }, { ILLRDINT_F, "CIM illegal read", -1, 1 },
{ ILLRDBEINT, "CIM illegal read BE", -1, 1 }, { ILLRDBEINT_F, "CIM illegal read BE", -1, 1 },
{ ILLWRBEINT, "CIM illegal write BE", -1, 1 }, { ILLWRBEINT_F, "CIM illegal write BE", -1, 1 },
{ SGLRDBOOTINT, "CIM single read from boot space", -1, 1 }, { SGLRDBOOTINT_F, "CIM single read from boot space", -1, 1 },
{ SGLWRBOOTINT, "CIM single write to boot space", -1, 1 }, { SGLWRBOOTINT_F, "CIM single write to boot space", -1, 1 },
{ BLKWRBOOTINT, "CIM block write to boot space", -1, 1 }, { BLKWRBOOTINT_F, "CIM block write to boot space", -1, 1 },
{ SGLRDFLASHINT, "CIM single read from flash space", -1, 1 }, { SGLRDFLASHINT_F, "CIM single read from flash space", -1, 1 },
{ SGLWRFLASHINT, "CIM single write to flash space", -1, 1 }, { SGLWRFLASHINT_F, "CIM single write to flash space", -1, 1 },
{ BLKWRFLASHINT, "CIM block write to flash space", -1, 1 }, { BLKWRFLASHINT_F, "CIM block write to flash space", -1, 1 },
{ SGLRDEEPROMINT, "CIM single EEPROM read", -1, 1 }, { SGLRDEEPROMINT_F, "CIM single EEPROM read", -1, 1 },
{ SGLWREEPROMINT, "CIM single EEPROM write", -1, 1 }, { SGLWREEPROMINT_F, "CIM single EEPROM write", -1, 1 },
{ BLKRDEEPROMINT, "CIM block EEPROM read", -1, 1 }, { BLKRDEEPROMINT_F, "CIM block EEPROM read", -1, 1 },
{ BLKWREEPROMINT, "CIM block EEPROM write", -1, 1 }, { BLKWREEPROMINT_F, "CIM block EEPROM write", -1, 1 },
{ SGLRDCTLINT , "CIM single read from CTL space", -1, 1 }, { SGLRDCTLINT_F, "CIM single read from CTL space", -1, 1 },
{ SGLWRCTLINT , "CIM single write to CTL space", -1, 1 }, { SGLWRCTLINT_F, "CIM single write to CTL space", -1, 1 },
{ BLKRDCTLINT , "CIM block read from CTL space", -1, 1 }, { BLKRDCTLINT_F, "CIM block read from CTL space", -1, 1 },
{ BLKWRCTLINT , "CIM block write to CTL space", -1, 1 }, { BLKWRCTLINT_F, "CIM block write to CTL space", -1, 1 },
{ SGLRDPLINT , "CIM single read from PL space", -1, 1 }, { SGLRDPLINT_F, "CIM single read from PL space", -1, 1 },
{ SGLWRPLINT , "CIM single write to PL space", -1, 1 }, { SGLWRPLINT_F, "CIM single write to PL space", -1, 1 },
{ BLKRDPLINT , "CIM block read from PL space", -1, 1 }, { BLKRDPLINT_F, "CIM block read from PL space", -1, 1 },
{ BLKWRPLINT , "CIM block write to PL space", -1, 1 }, { BLKWRPLINT_F, "CIM block write to PL space", -1, 1 },
{ REQOVRLOOKUPINT , "CIM request FIFO overwrite", -1, 1 }, { REQOVRLOOKUPINT_F, "CIM request FIFO overwrite", -1, 1 },
{ RSPOVRLOOKUPINT , "CIM response FIFO overwrite", -1, 1 }, { RSPOVRLOOKUPINT_F, "CIM response FIFO overwrite", -1, 1 },
{ TIMEOUTINT , "CIM PIF timeout", -1, 1 }, { TIMEOUTINT_F, "CIM PIF timeout", -1, 1 },
{ TIMEOUTMAINT , "CIM PIF MA timeout", -1, 1 }, { TIMEOUTMAINT_F, "CIM PIF MA timeout", -1, 1 },
{ 0, NULL, 0, 0 } { 0, NULL, 0, 0 }
}; };
int fat; int fat;
fat = csio_handle_intr_status(hw, CIM_HOST_INT_CAUSE, fat = csio_handle_intr_status(hw, CIM_HOST_INT_CAUSE_A,
cim_intr_info) + cim_intr_info) +
csio_handle_intr_status(hw, CIM_HOST_UPACC_INT_CAUSE, csio_handle_intr_status(hw, CIM_HOST_UPACC_INT_CAUSE_A,
cim_upintr_info); cim_upintr_info);
if (fat) if (fat)
csio_hw_fatal_err(hw); csio_hw_fatal_err(hw);
...@@ -2987,7 +2987,8 @@ static void csio_mps_intr_handler(struct csio_hw *hw) ...@@ -2987,7 +2987,8 @@ static void csio_mps_intr_handler(struct csio_hw *hw)
csio_hw_fatal_err(hw); csio_hw_fatal_err(hw);
} }
#define MEM_INT_MASK (PERR_INT_CAUSE | ECC_CE_INT_CAUSE | ECC_UE_INT_CAUSE) #define MEM_INT_MASK (PERR_INT_CAUSE_F | ECC_CE_INT_CAUSE_F | \
ECC_UE_INT_CAUSE_F)
/* /*
* EDC/MC interrupt handler. * EDC/MC interrupt handler.
...@@ -2999,28 +3000,28 @@ static void csio_mem_intr_handler(struct csio_hw *hw, int idx) ...@@ -2999,28 +3000,28 @@ static void csio_mem_intr_handler(struct csio_hw *hw, int idx)
unsigned int addr, cnt_addr, v; unsigned int addr, cnt_addr, v;
if (idx <= MEM_EDC1) { if (idx <= MEM_EDC1) {
addr = EDC_REG(EDC_INT_CAUSE, idx); addr = EDC_REG(EDC_INT_CAUSE_A, idx);
cnt_addr = EDC_REG(EDC_ECC_STATUS, idx); cnt_addr = EDC_REG(EDC_ECC_STATUS_A, idx);
} else { } else {
addr = MC_INT_CAUSE; addr = MC_INT_CAUSE_A;
cnt_addr = MC_ECC_STATUS; cnt_addr = MC_ECC_STATUS_A;
} }
v = csio_rd_reg32(hw, addr) & MEM_INT_MASK; v = csio_rd_reg32(hw, addr) & MEM_INT_MASK;
if (v & PERR_INT_CAUSE) if (v & PERR_INT_CAUSE_F)
csio_fatal(hw, "%s FIFO parity error\n", name[idx]); csio_fatal(hw, "%s FIFO parity error\n", name[idx]);
if (v & ECC_CE_INT_CAUSE) { if (v & ECC_CE_INT_CAUSE_F) {
uint32_t cnt = ECC_CECNT_GET(csio_rd_reg32(hw, cnt_addr)); uint32_t cnt = ECC_CECNT_G(csio_rd_reg32(hw, cnt_addr));
csio_wr_reg32(hw, ECC_CECNT_MASK, cnt_addr); csio_wr_reg32(hw, ECC_CECNT_V(ECC_CECNT_M), cnt_addr);
csio_warn(hw, "%u %s correctable ECC data error%s\n", csio_warn(hw, "%u %s correctable ECC data error%s\n",
cnt, name[idx], cnt > 1 ? "s" : ""); cnt, name[idx], cnt > 1 ? "s" : "");
} }
if (v & ECC_UE_INT_CAUSE) if (v & ECC_UE_INT_CAUSE_F)
csio_fatal(hw, "%s uncorrectable ECC data error\n", name[idx]); csio_fatal(hw, "%s uncorrectable ECC data error\n", name[idx]);
csio_wr_reg32(hw, v, addr); csio_wr_reg32(hw, v, addr);
if (v & (PERR_INT_CAUSE | ECC_UE_INT_CAUSE)) if (v & (PERR_INT_CAUSE_F | ECC_UE_INT_CAUSE_F))
csio_hw_fatal_err(hw); csio_hw_fatal_err(hw);
} }
...@@ -3029,18 +3030,18 @@ static void csio_mem_intr_handler(struct csio_hw *hw, int idx) ...@@ -3029,18 +3030,18 @@ static void csio_mem_intr_handler(struct csio_hw *hw, int idx)
*/ */
static void csio_ma_intr_handler(struct csio_hw *hw) static void csio_ma_intr_handler(struct csio_hw *hw)
{ {
uint32_t v, status = csio_rd_reg32(hw, MA_INT_CAUSE); uint32_t v, status = csio_rd_reg32(hw, MA_INT_CAUSE_A);
if (status & MEM_PERR_INT_CAUSE) if (status & MEM_PERR_INT_CAUSE_F)
csio_fatal(hw, "MA parity error, parity status %#x\n", csio_fatal(hw, "MA parity error, parity status %#x\n",
csio_rd_reg32(hw, MA_PARITY_ERROR_STATUS)); csio_rd_reg32(hw, MA_PARITY_ERROR_STATUS_A));
if (status & MEM_WRAP_INT_CAUSE) { if (status & MEM_WRAP_INT_CAUSE_F) {
v = csio_rd_reg32(hw, MA_INT_WRAP_STATUS); v = csio_rd_reg32(hw, MA_INT_WRAP_STATUS_A);
csio_fatal(hw, csio_fatal(hw,
"MA address wrap-around error by client %u to address %#x\n", "MA address wrap-around error by client %u to address %#x\n",
MEM_WRAP_CLIENT_NUM_GET(v), MEM_WRAP_ADDRESS_GET(v) << 4); MEM_WRAP_CLIENT_NUM_G(v), MEM_WRAP_ADDRESS_G(v) << 4);
} }
csio_wr_reg32(hw, status, MA_INT_CAUSE); csio_wr_reg32(hw, status, MA_INT_CAUSE_A);
csio_hw_fatal_err(hw); csio_hw_fatal_err(hw);
} }
......
...@@ -209,19 +209,19 @@ csio_t4_mc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data, ...@@ -209,19 +209,19 @@ csio_t4_mc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data,
{ {
int i; int i;
if (csio_rd_reg32(hw, MC_BIST_CMD) & START_BIST) if (csio_rd_reg32(hw, MC_BIST_CMD_A) & START_BIST_F)
return -EBUSY; return -EBUSY;
csio_wr_reg32(hw, addr & ~0x3fU, MC_BIST_CMD_ADDR); csio_wr_reg32(hw, addr & ~0x3fU, MC_BIST_CMD_ADDR_A);
csio_wr_reg32(hw, 64, MC_BIST_CMD_LEN); csio_wr_reg32(hw, 64, MC_BIST_CMD_LEN_A);
csio_wr_reg32(hw, 0xc, MC_BIST_DATA_PATTERN); csio_wr_reg32(hw, 0xc, MC_BIST_DATA_PATTERN_A);
csio_wr_reg32(hw, BIST_OPCODE(1) | START_BIST | BIST_CMD_GAP(1), csio_wr_reg32(hw, BIST_OPCODE_V(1) | START_BIST_F | BIST_CMD_GAP_V(1),
MC_BIST_CMD); MC_BIST_CMD_A);
i = csio_hw_wait_op_done_val(hw, MC_BIST_CMD, START_BIST, i = csio_hw_wait_op_done_val(hw, MC_BIST_CMD_A, START_BIST_F,
0, 10, 1, NULL); 0, 10, 1, NULL);
if (i) if (i)
return i; return i;
#define MC_DATA(i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA, i) #define MC_DATA(i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA_A, i)
for (i = 15; i >= 0; i--) for (i = 15; i >= 0; i--)
*data++ = htonl(csio_rd_reg32(hw, MC_DATA(i))); *data++ = htonl(csio_rd_reg32(hw, MC_DATA(i)));
...@@ -250,19 +250,19 @@ csio_t4_edc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data, ...@@ -250,19 +250,19 @@ csio_t4_edc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data,
int i; int i;
idx *= EDC_STRIDE; idx *= EDC_STRIDE;
if (csio_rd_reg32(hw, EDC_BIST_CMD + idx) & START_BIST) if (csio_rd_reg32(hw, EDC_BIST_CMD_A + idx) & START_BIST_F)
return -EBUSY; return -EBUSY;
csio_wr_reg32(hw, addr & ~0x3fU, EDC_BIST_CMD_ADDR + idx); csio_wr_reg32(hw, addr & ~0x3fU, EDC_BIST_CMD_ADDR_A + idx);
csio_wr_reg32(hw, 64, EDC_BIST_CMD_LEN + idx); csio_wr_reg32(hw, 64, EDC_BIST_CMD_LEN_A + idx);
csio_wr_reg32(hw, 0xc, EDC_BIST_DATA_PATTERN + idx); csio_wr_reg32(hw, 0xc, EDC_BIST_DATA_PATTERN_A + idx);
csio_wr_reg32(hw, BIST_OPCODE(1) | BIST_CMD_GAP(1) | START_BIST, csio_wr_reg32(hw, BIST_OPCODE_V(1) | BIST_CMD_GAP_V(1) | START_BIST_F,
EDC_BIST_CMD + idx); EDC_BIST_CMD_A + idx);
i = csio_hw_wait_op_done_val(hw, EDC_BIST_CMD + idx, START_BIST, i = csio_hw_wait_op_done_val(hw, EDC_BIST_CMD_A + idx, START_BIST_F,
0, 10, 1, NULL); 0, 10, 1, NULL);
if (i) if (i)
return i; return i;
#define EDC_DATA(i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA, i) + idx) #define EDC_DATA(i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA_A, i) + idx)
for (i = 15; i >= 0; i--) for (i = 15; i >= 0; i--)
*data++ = htonl(csio_rd_reg32(hw, EDC_DATA(i))); *data++ = htonl(csio_rd_reg32(hw, EDC_DATA(i)));
......
...@@ -177,25 +177,25 @@ csio_t5_mc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data, ...@@ -177,25 +177,25 @@ csio_t5_mc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data,
uint32_t mc_bist_cmd_reg, mc_bist_cmd_addr_reg, mc_bist_cmd_len_reg; uint32_t mc_bist_cmd_reg, mc_bist_cmd_addr_reg, mc_bist_cmd_len_reg;
uint32_t mc_bist_status_rdata_reg, mc_bist_data_pattern_reg; uint32_t mc_bist_status_rdata_reg, mc_bist_data_pattern_reg;
mc_bist_cmd_reg = MC_REG(MC_P_BIST_CMD, idx); mc_bist_cmd_reg = MC_REG(MC_P_BIST_CMD_A, idx);
mc_bist_cmd_addr_reg = MC_REG(MC_P_BIST_CMD_ADDR, idx); mc_bist_cmd_addr_reg = MC_REG(MC_P_BIST_CMD_ADDR_A, idx);
mc_bist_cmd_len_reg = MC_REG(MC_P_BIST_CMD_LEN, idx); mc_bist_cmd_len_reg = MC_REG(MC_P_BIST_CMD_LEN_A, idx);
mc_bist_status_rdata_reg = MC_REG(MC_P_BIST_STATUS_RDATA, idx); mc_bist_status_rdata_reg = MC_REG(MC_P_BIST_STATUS_RDATA_A, idx);
mc_bist_data_pattern_reg = MC_REG(MC_P_BIST_DATA_PATTERN, idx); mc_bist_data_pattern_reg = MC_REG(MC_P_BIST_DATA_PATTERN_A, idx);
if (csio_rd_reg32(hw, mc_bist_cmd_reg) & START_BIST) if (csio_rd_reg32(hw, mc_bist_cmd_reg) & START_BIST_F)
return -EBUSY; return -EBUSY;
csio_wr_reg32(hw, addr & ~0x3fU, mc_bist_cmd_addr_reg); csio_wr_reg32(hw, addr & ~0x3fU, mc_bist_cmd_addr_reg);
csio_wr_reg32(hw, 64, mc_bist_cmd_len_reg); csio_wr_reg32(hw, 64, mc_bist_cmd_len_reg);
csio_wr_reg32(hw, 0xc, mc_bist_data_pattern_reg); csio_wr_reg32(hw, 0xc, mc_bist_data_pattern_reg);
csio_wr_reg32(hw, BIST_OPCODE(1) | START_BIST | BIST_CMD_GAP(1), csio_wr_reg32(hw, BIST_OPCODE_V(1) | START_BIST_F | BIST_CMD_GAP_V(1),
mc_bist_cmd_reg); mc_bist_cmd_reg);
i = csio_hw_wait_op_done_val(hw, mc_bist_cmd_reg, START_BIST, i = csio_hw_wait_op_done_val(hw, mc_bist_cmd_reg, START_BIST_F,
0, 10, 1, NULL); 0, 10, 1, NULL);
if (i) if (i)
return i; return i;
#define MC_DATA(i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA, i) #define MC_DATA(i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA_A, i)
for (i = 15; i >= 0; i--) for (i = 15; i >= 0; i--)
*data++ = htonl(csio_rd_reg32(hw, MC_DATA(i))); *data++ = htonl(csio_rd_reg32(hw, MC_DATA(i)));
...@@ -231,27 +231,27 @@ csio_t5_edc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data, ...@@ -231,27 +231,27 @@ csio_t5_edc_read(struct csio_hw *hw, int idx, uint32_t addr, __be32 *data,
#define EDC_STRIDE_T5 (EDC_T51_BASE_ADDR - EDC_T50_BASE_ADDR) #define EDC_STRIDE_T5 (EDC_T51_BASE_ADDR - EDC_T50_BASE_ADDR)
#define EDC_REG_T5(reg, idx) (reg + EDC_STRIDE_T5 * idx) #define EDC_REG_T5(reg, idx) (reg + EDC_STRIDE_T5 * idx)
edc_bist_cmd_reg = EDC_REG_T5(EDC_H_BIST_CMD, idx); edc_bist_cmd_reg = EDC_REG_T5(EDC_H_BIST_CMD_A, idx);
edc_bist_cmd_addr_reg = EDC_REG_T5(EDC_H_BIST_CMD_ADDR, idx); edc_bist_cmd_addr_reg = EDC_REG_T5(EDC_H_BIST_CMD_ADDR_A, idx);
edc_bist_cmd_len_reg = EDC_REG_T5(EDC_H_BIST_CMD_LEN, idx); edc_bist_cmd_len_reg = EDC_REG_T5(EDC_H_BIST_CMD_LEN_A, idx);
edc_bist_cmd_data_pattern = EDC_REG_T5(EDC_H_BIST_DATA_PATTERN, idx); edc_bist_cmd_data_pattern = EDC_REG_T5(EDC_H_BIST_DATA_PATTERN_A, idx);
edc_bist_status_rdata_reg = EDC_REG_T5(EDC_H_BIST_STATUS_RDATA, idx); edc_bist_status_rdata_reg = EDC_REG_T5(EDC_H_BIST_STATUS_RDATA_A, idx);
#undef EDC_REG_T5 #undef EDC_REG_T5
#undef EDC_STRIDE_T5 #undef EDC_STRIDE_T5
if (csio_rd_reg32(hw, edc_bist_cmd_reg) & START_BIST) if (csio_rd_reg32(hw, edc_bist_cmd_reg) & START_BIST_F)
return -EBUSY; return -EBUSY;
csio_wr_reg32(hw, addr & ~0x3fU, edc_bist_cmd_addr_reg); csio_wr_reg32(hw, addr & ~0x3fU, edc_bist_cmd_addr_reg);
csio_wr_reg32(hw, 64, edc_bist_cmd_len_reg); csio_wr_reg32(hw, 64, edc_bist_cmd_len_reg);
csio_wr_reg32(hw, 0xc, edc_bist_cmd_data_pattern); csio_wr_reg32(hw, 0xc, edc_bist_cmd_data_pattern);
csio_wr_reg32(hw, BIST_OPCODE(1) | START_BIST | BIST_CMD_GAP(1), csio_wr_reg32(hw, BIST_OPCODE_V(1) | START_BIST_F | BIST_CMD_GAP_V(1),
edc_bist_cmd_reg); edc_bist_cmd_reg);
i = csio_hw_wait_op_done_val(hw, edc_bist_cmd_reg, START_BIST, i = csio_hw_wait_op_done_val(hw, edc_bist_cmd_reg, START_BIST_F,
0, 10, 1, NULL); 0, 10, 1, NULL);
if (i) if (i)
return i; return i;
#define EDC_DATA(i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA, i) + idx) #define EDC_DATA(i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA_A, i) + idx)
for (i = 15; i >= 0; i--) for (i = 15; i >= 0; i--)
*data++ = htonl(csio_rd_reg32(hw, EDC_DATA(i))); *data++ = htonl(csio_rd_reg32(hw, EDC_DATA(i)));
......
...@@ -1104,8 +1104,8 @@ csio_mb_process_portparams_rsp(struct csio_hw *hw, ...@@ -1104,8 +1104,8 @@ csio_mb_process_portparams_rsp(struct csio_hw *hw,
void void
csio_mb_intr_enable(struct csio_hw *hw) csio_mb_intr_enable(struct csio_hw *hw)
{ {
csio_wr_reg32(hw, MBMSGRDYINTEN(1), MYPF_REG(CIM_PF_HOST_INT_ENABLE)); csio_wr_reg32(hw, MBMSGRDYINTEN_F, MYPF_REG(CIM_PF_HOST_INT_ENABLE_A));
csio_rd_reg32(hw, MYPF_REG(CIM_PF_HOST_INT_ENABLE)); csio_rd_reg32(hw, MYPF_REG(CIM_PF_HOST_INT_ENABLE_A));
} }
/* /*
...@@ -1117,8 +1117,9 @@ csio_mb_intr_enable(struct csio_hw *hw) ...@@ -1117,8 +1117,9 @@ csio_mb_intr_enable(struct csio_hw *hw)
void void
csio_mb_intr_disable(struct csio_hw *hw) csio_mb_intr_disable(struct csio_hw *hw)
{ {
csio_wr_reg32(hw, MBMSGRDYINTEN(0), MYPF_REG(CIM_PF_HOST_INT_ENABLE)); csio_wr_reg32(hw, MBMSGRDYINTEN_V(0),
csio_rd_reg32(hw, MYPF_REG(CIM_PF_HOST_INT_ENABLE)); MYPF_REG(CIM_PF_HOST_INT_ENABLE_A));
csio_rd_reg32(hw, MYPF_REG(CIM_PF_HOST_INT_ENABLE_A));
} }
static void static void
...@@ -1153,8 +1154,8 @@ csio_mb_debug_cmd_handler(struct csio_hw *hw) ...@@ -1153,8 +1154,8 @@ csio_mb_debug_cmd_handler(struct csio_hw *hw)
{ {
int i; int i;
__be64 cmd[CSIO_MB_MAX_REGS]; __be64 cmd[CSIO_MB_MAX_REGS];
uint32_t ctl_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_CTRL); uint32_t ctl_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_CTRL_A);
uint32_t data_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_DATA); uint32_t data_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_DATA_A);
int size = sizeof(struct fw_debug_cmd); int size = sizeof(struct fw_debug_cmd);
/* Copy mailbox data */ /* Copy mailbox data */
...@@ -1164,8 +1165,8 @@ csio_mb_debug_cmd_handler(struct csio_hw *hw) ...@@ -1164,8 +1165,8 @@ csio_mb_debug_cmd_handler(struct csio_hw *hw)
csio_mb_dump_fw_dbg(hw, cmd); csio_mb_dump_fw_dbg(hw, cmd);
/* Notify FW of mailbox by setting owner as UP */ /* Notify FW of mailbox by setting owner as UP */
csio_wr_reg32(hw, MBMSGVALID | MBINTREQ | MBOWNER(CSIO_MBOWNER_FW), csio_wr_reg32(hw, MBMSGVALID_F | MBINTREQ_F |
ctl_reg); MBOWNER_V(CSIO_MBOWNER_FW), ctl_reg);
csio_rd_reg32(hw, ctl_reg); csio_rd_reg32(hw, ctl_reg);
wmb(); wmb();
...@@ -1187,8 +1188,8 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp) ...@@ -1187,8 +1188,8 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp)
__be64 *cmd = mbp->mb; __be64 *cmd = mbp->mb;
__be64 hdr; __be64 hdr;
struct csio_mbm *mbm = &hw->mbm; struct csio_mbm *mbm = &hw->mbm;
uint32_t ctl_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_CTRL); uint32_t ctl_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_CTRL_A);
uint32_t data_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_DATA); uint32_t data_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_DATA_A);
int size = mbp->mb_size; int size = mbp->mb_size;
int rv = -EINVAL; int rv = -EINVAL;
struct fw_cmd_hdr *fw_hdr; struct fw_cmd_hdr *fw_hdr;
...@@ -1224,12 +1225,12 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp) ...@@ -1224,12 +1225,12 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp)
} }
/* Now get ownership of mailbox */ /* Now get ownership of mailbox */
owner = MBOWNER_GET(csio_rd_reg32(hw, ctl_reg)); owner = MBOWNER_G(csio_rd_reg32(hw, ctl_reg));
if (!csio_mb_is_host_owner(owner)) { if (!csio_mb_is_host_owner(owner)) {
for (i = 0; (owner == CSIO_MBOWNER_NONE) && (i < 3); i++) for (i = 0; (owner == CSIO_MBOWNER_NONE) && (i < 3); i++)
owner = MBOWNER_GET(csio_rd_reg32(hw, ctl_reg)); owner = MBOWNER_G(csio_rd_reg32(hw, ctl_reg));
/* /*
* Mailbox unavailable. In immediate mode, fail the command. * Mailbox unavailable. In immediate mode, fail the command.
* In other modes, enqueue the request. * In other modes, enqueue the request.
...@@ -1271,10 +1272,10 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp) ...@@ -1271,10 +1272,10 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp)
if (mbp->mb_cbfn != NULL) { if (mbp->mb_cbfn != NULL) {
mbm->mcurrent = mbp; mbm->mcurrent = mbp;
mod_timer(&mbm->timer, jiffies + msecs_to_jiffies(mbp->tmo)); mod_timer(&mbm->timer, jiffies + msecs_to_jiffies(mbp->tmo));
csio_wr_reg32(hw, MBMSGVALID | MBINTREQ | csio_wr_reg32(hw, MBMSGVALID_F | MBINTREQ_F |
MBOWNER(CSIO_MBOWNER_FW), ctl_reg); MBOWNER_V(CSIO_MBOWNER_FW), ctl_reg);
} else } else
csio_wr_reg32(hw, MBMSGVALID | MBOWNER(CSIO_MBOWNER_FW), csio_wr_reg32(hw, MBMSGVALID_F | MBOWNER_V(CSIO_MBOWNER_FW),
ctl_reg); ctl_reg);
/* Flush posted writes */ /* Flush posted writes */
...@@ -1294,9 +1295,9 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp) ...@@ -1294,9 +1295,9 @@ csio_mb_issue(struct csio_hw *hw, struct csio_mb *mbp)
/* Check for response */ /* Check for response */
ctl = csio_rd_reg32(hw, ctl_reg); ctl = csio_rd_reg32(hw, ctl_reg);
if (csio_mb_is_host_owner(MBOWNER_GET(ctl))) { if (csio_mb_is_host_owner(MBOWNER_G(ctl))) {
if (!(ctl & MBMSGVALID)) { if (!(ctl & MBMSGVALID_F)) {
csio_wr_reg32(hw, 0, ctl_reg); csio_wr_reg32(hw, 0, ctl_reg);
continue; continue;
} }
...@@ -1457,16 +1458,16 @@ csio_mb_isr_handler(struct csio_hw *hw) ...@@ -1457,16 +1458,16 @@ csio_mb_isr_handler(struct csio_hw *hw)
__be64 *cmd; __be64 *cmd;
uint32_t ctl, cim_cause, pl_cause; uint32_t ctl, cim_cause, pl_cause;
int i; int i;
uint32_t ctl_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_CTRL); uint32_t ctl_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_CTRL_A);
uint32_t data_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_DATA); uint32_t data_reg = PF_REG(hw->pfn, CIM_PF_MAILBOX_DATA_A);
int size; int size;
__be64 hdr; __be64 hdr;
struct fw_cmd_hdr *fw_hdr; struct fw_cmd_hdr *fw_hdr;
pl_cause = csio_rd_reg32(hw, MYPF_REG(PL_PF_INT_CAUSE)); pl_cause = csio_rd_reg32(hw, MYPF_REG(PL_PF_INT_CAUSE));
cim_cause = csio_rd_reg32(hw, MYPF_REG(CIM_PF_HOST_INT_CAUSE)); cim_cause = csio_rd_reg32(hw, MYPF_REG(CIM_PF_HOST_INT_CAUSE_A));
if (!(pl_cause & PFCIM) || !(cim_cause & MBMSGRDYINT)) { if (!(pl_cause & PFCIM) || !(cim_cause & MBMSGRDYINT_F)) {
CSIO_INC_STATS(hw, n_mbint_unexp); CSIO_INC_STATS(hw, n_mbint_unexp);
return -EINVAL; return -EINVAL;
} }
...@@ -1477,16 +1478,16 @@ csio_mb_isr_handler(struct csio_hw *hw) ...@@ -1477,16 +1478,16 @@ csio_mb_isr_handler(struct csio_hw *hw)
* the upper level cause register. In other words, CIM-cause * the upper level cause register. In other words, CIM-cause
* first followed by PL-Cause next. * first followed by PL-Cause next.
*/ */
csio_wr_reg32(hw, MBMSGRDYINT, MYPF_REG(CIM_PF_HOST_INT_CAUSE)); csio_wr_reg32(hw, MBMSGRDYINT_F, MYPF_REG(CIM_PF_HOST_INT_CAUSE_A));
csio_wr_reg32(hw, PFCIM, MYPF_REG(PL_PF_INT_CAUSE)); csio_wr_reg32(hw, PFCIM, MYPF_REG(PL_PF_INT_CAUSE));
ctl = csio_rd_reg32(hw, ctl_reg); ctl = csio_rd_reg32(hw, ctl_reg);
if (csio_mb_is_host_owner(MBOWNER_GET(ctl))) { if (csio_mb_is_host_owner(MBOWNER_G(ctl))) {
CSIO_DUMP_MB(hw, hw->pfn, data_reg); CSIO_DUMP_MB(hw, hw->pfn, data_reg);
if (!(ctl & MBMSGVALID)) { if (!(ctl & MBMSGVALID_F)) {
csio_warn(hw, csio_warn(hw,
"Stray mailbox interrupt recvd," "Stray mailbox interrupt recvd,"
" mailbox data not valid\n"); " mailbox data not valid\n");
......
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