Skip to content

Commit ba02629

Browse files
Edwin Peerdavem330
authored andcommitted
bnxt_en: log firmware status on firmware init failure
Firmware now supports device independent discovery of the status register location. This status register can provide more detailed information about firmware errors, especially if problems occur before the HWRM interface is functioning. Attempt to map this register if it is present and report the firmware status on firmware init failures. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3e9ec2b commit ba02629

File tree

2 files changed

+55
-5
lines changed

2 files changed

+55
-5
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7366,6 +7366,47 @@ static int bnxt_alloc_fw_health(struct bnxt *bp)
73667366
return 0;
73677367
}
73687368

7369+
static void __bnxt_map_fw_health_reg(struct bnxt *bp, u32 reg)
7370+
{
7371+
writel(reg & BNXT_GRC_BASE_MASK, bp->bar0 +
7372+
BNXT_GRCPF_REG_WINDOW_BASE_OUT +
7373+
BNXT_FW_HEALTH_WIN_MAP_OFF);
7374+
}
7375+
7376+
static void bnxt_try_map_fw_health_reg(struct bnxt *bp)
7377+
{
7378+
void __iomem *hs;
7379+
u32 status_loc;
7380+
u32 reg_type;
7381+
u32 sig;
7382+
7383+
__bnxt_map_fw_health_reg(bp, HCOMM_STATUS_STRUCT_LOC);
7384+
hs = bp->bar0 + BNXT_FW_HEALTH_WIN_OFF(HCOMM_STATUS_STRUCT_LOC);
7385+
7386+
sig = readl(hs + offsetof(struct hcomm_status, sig_ver));
7387+
if ((sig & HCOMM_STATUS_SIGNATURE_MASK) != HCOMM_STATUS_SIGNATURE_VAL) {
7388+
if (bp->fw_health)
7389+
bp->fw_health->status_reliable = false;
7390+
return;
7391+
}
7392+
7393+
if (__bnxt_alloc_fw_health(bp)) {
7394+
netdev_warn(bp->dev, "no memory for firmware status checks\n");
7395+
return;
7396+
}
7397+
7398+
status_loc = readl(hs + offsetof(struct hcomm_status, fw_status_loc));
7399+
bp->fw_health->regs[BNXT_FW_HEALTH_REG] = status_loc;
7400+
reg_type = BNXT_FW_HEALTH_REG_TYPE(status_loc);
7401+
if (reg_type == BNXT_FW_HEALTH_REG_TYPE_GRC) {
7402+
__bnxt_map_fw_health_reg(bp, status_loc);
7403+
bp->fw_health->mapped_regs[BNXT_FW_HEALTH_REG] =
7404+
BNXT_FW_HEALTH_WIN_OFF(status_loc);
7405+
}
7406+
7407+
bp->fw_health->status_reliable = true;
7408+
}
7409+
73697410
static int bnxt_map_fw_health_regs(struct bnxt *bp)
73707411
{
73717412
struct bnxt_fw_health *fw_health = bp->fw_health;
@@ -7382,14 +7423,12 @@ static int bnxt_map_fw_health_regs(struct bnxt *bp)
73827423
reg_base = reg & BNXT_GRC_BASE_MASK;
73837424
if ((reg & BNXT_GRC_BASE_MASK) != reg_base)
73847425
return -ERANGE;
7385-
fw_health->mapped_regs[i] = BNXT_FW_HEALTH_WIN_BASE +
7386-
(reg & BNXT_GRC_OFFSET_MASK);
7426+
fw_health->mapped_regs[i] = BNXT_FW_HEALTH_WIN_OFF(reg);
73877427
}
73887428
if (reg_base == 0xffffffff)
73897429
return 0;
73907430

7391-
writel(reg_base, bp->bar0 + BNXT_GRCPF_REG_WINDOW_BASE_OUT +
7392-
BNXT_FW_HEALTH_WIN_MAP_OFF);
7431+
__bnxt_map_fw_health_reg(bp, reg_base);
73937432
return 0;
73947433
}
73957434

@@ -11002,8 +11041,15 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp)
1100211041

1100311042
bp->fw_cap = 0;
1100411043
rc = bnxt_hwrm_ver_get(bp);
11005-
if (rc)
11044+
bnxt_try_map_fw_health_reg(bp);
11045+
if (rc) {
11046+
if (bp->fw_health && bp->fw_health->status_reliable)
11047+
netdev_err(bp->dev,
11048+
"Firmware not responding, status: 0x%x\n",
11049+
bnxt_fw_health_readl(bp,
11050+
BNXT_FW_HEALTH_REG));
1100611051
return rc;
11052+
}
1100711053

1100811054
if (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL) {
1100911055
rc = bnxt_alloc_kong_hwrm_resources(bp);

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ struct bnxt_fw_health {
14941494
u8 enabled:1;
14951495
u8 master:1;
14961496
u8 fatal:1;
1497+
u8 status_reliable:1;
14971498
u8 tmr_multiplier;
14981499
u8 tmr_counter;
14991500
u8 fw_reset_seq_cnt;
@@ -1521,6 +1522,9 @@ struct bnxt_fw_reporter_ctx {
15211522
#define BNXT_FW_HEALTH_WIN_BASE 0x3000
15221523
#define BNXT_FW_HEALTH_WIN_MAP_OFF 8
15231524

1525+
#define BNXT_FW_HEALTH_WIN_OFF(reg) (BNXT_FW_HEALTH_WIN_BASE + \
1526+
((reg) & BNXT_GRC_OFFSET_MASK))
1527+
15241528
#define BNXT_FW_STATUS_HEALTHY 0x8000
15251529
#define BNXT_FW_STATUS_SHUTDOWN 0x100000
15261530

0 commit comments

Comments
 (0)