static int cond_psfix(char **a, int id) { if (comp_check()) { if (a[1]) return do_comp_vars(id, cond_val(a, 0), cond_str(a, 1, 1), 0, NULL, 0); else return do_comp_vars(id, -1, cond_str(a, 0, 1), 0, NULL, 0); } return 0; }
/* init_ops read/poll commands */ static void ecore_init_cmd_rd(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct init_read_op *cmd) { bool (*comp_check)(u32 val, u32 expected_val); u32 delay = ECORE_INIT_POLL_PERIOD_US, val; u32 data, addr, poll; int i; data = OSAL_LE32_TO_CPU(cmd->op_data); addr = GET_FIELD(data, INIT_READ_OP_ADDRESS) << 2; poll = GET_FIELD(data, INIT_READ_OP_POLL_TYPE); #ifndef ASIC_ONLY if (CHIP_REV_IS_EMUL(p_hwfn->p_dev)) delay *= 100; #endif val = ecore_rd(p_hwfn, p_ptt, addr); if (poll == INIT_POLL_NONE) return; switch (poll) { case INIT_POLL_EQ: comp_check = comp_eq; break; case INIT_POLL_OR: comp_check = comp_or; break; case INIT_POLL_AND: comp_check = comp_and; break; default: DP_ERR(p_hwfn, "Invalid poll comparison type %08x\n", cmd->op_data); return; } data = OSAL_LE32_TO_CPU(cmd->expected_val); for (i = 0; i < ECORE_INIT_MAX_POLL_COUNT && !comp_check(val, data); i++) { OSAL_UDELAY(delay); val = ecore_rd(p_hwfn, p_ptt, addr); } if (i == ECORE_INIT_MAX_POLL_COUNT) DP_ERR(p_hwfn, "Timeout when polling reg: 0x%08x [ Waiting-for: %08x Got: %08x (comparison %08x)]\n", addr, OSAL_LE32_TO_CPU(cmd->expected_val), val, OSAL_LE32_TO_CPU(cmd->op_data)); }
/* init_ops read/poll commands */ static void qed_init_cmd_rd(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, struct init_read_op *cmd) { bool (*comp_check)(u32 val, u32 expected_val); u32 delay = QED_INIT_POLL_PERIOD_US, val; u32 data, addr, poll; int i; data = le32_to_cpu(cmd->op_data); addr = GET_FIELD(data, INIT_READ_OP_ADDRESS) << 2; poll = GET_FIELD(data, INIT_READ_OP_POLL_TYPE); val = qed_rd(p_hwfn, p_ptt, addr); if (poll == INIT_POLL_NONE) return; switch (poll) { case INIT_POLL_EQ: comp_check = comp_eq; break; case INIT_POLL_OR: comp_check = comp_or; break; case INIT_POLL_AND: comp_check = comp_and; break; default: DP_ERR(p_hwfn, "Invalid poll comparison type %08x\n", cmd->op_data); return; } data = le32_to_cpu(cmd->expected_val); for (i = 0; i < QED_INIT_MAX_POLL_COUNT && !comp_check(val, data); i++) { udelay(delay); val = qed_rd(p_hwfn, p_ptt, addr); } if (i == QED_INIT_MAX_POLL_COUNT) { DP_ERR(p_hwfn, "Timeout when polling reg: 0x%08x [ Waiting-for: %08x Got: %08x (comparsion %08x)]\n", addr, le32_to_cpu(cmd->expected_val), val, le32_to_cpu(cmd->op_data)); } }