bnxt_en: Define macros for the various health register states.
Define macros to check for the various states in the lower 16 bits of the health register. Replace the C code that checks for these values with the newly defined macros. Reviewed-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
16db632304
commit
fe1b853572
@@ -1534,9 +1534,19 @@ struct bnxt_fw_reporter_ctx {
|
||||
#define BNXT_FW_HEALTH_WIN_OFF(reg) (BNXT_FW_HEALTH_WIN_BASE + \
|
||||
((reg) & BNXT_GRC_OFFSET_MASK))
|
||||
|
||||
#define BNXT_FW_STATUS_HEALTH_MSK 0xffff
|
||||
#define BNXT_FW_STATUS_HEALTHY 0x8000
|
||||
#define BNXT_FW_STATUS_SHUTDOWN 0x100000
|
||||
|
||||
#define BNXT_FW_IS_HEALTHY(sts) (((sts) & BNXT_FW_STATUS_HEALTH_MSK) ==\
|
||||
BNXT_FW_STATUS_HEALTHY)
|
||||
|
||||
#define BNXT_FW_IS_BOOTING(sts) (((sts) & BNXT_FW_STATUS_HEALTH_MSK) < \
|
||||
BNXT_FW_STATUS_HEALTHY)
|
||||
|
||||
#define BNXT_FW_IS_ERR(sts) (((sts) & BNXT_FW_STATUS_HEALTH_MSK) > \
|
||||
BNXT_FW_STATUS_HEALTHY)
|
||||
|
||||
struct bnxt {
|
||||
void __iomem *bar0;
|
||||
void __iomem *bar1;
|
||||
|
||||
@@ -44,21 +44,20 @@ static int bnxt_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct bnxt *bp = devlink_health_reporter_priv(reporter);
|
||||
u32 val, health_status;
|
||||
u32 val;
|
||||
int rc;
|
||||
|
||||
if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
|
||||
return 0;
|
||||
|
||||
val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
|
||||
health_status = val & 0xffff;
|
||||
|
||||
if (health_status < BNXT_FW_STATUS_HEALTHY) {
|
||||
if (BNXT_FW_IS_BOOTING(val)) {
|
||||
rc = devlink_fmsg_string_pair_put(fmsg, "Description",
|
||||
"Not yet completed initialization");
|
||||
if (rc)
|
||||
return rc;
|
||||
} else if (health_status > BNXT_FW_STATUS_HEALTHY) {
|
||||
} else if (BNXT_FW_IS_ERR(val)) {
|
||||
rc = devlink_fmsg_string_pair_put(fmsg, "Description",
|
||||
"Encountered fatal error and cannot recover");
|
||||
if (rc)
|
||||
|
||||
Reference in New Issue
Block a user