#define BNXT_GRCP_WINDOW_2_BASE 0x2000
#define BNXT_GRCP_WINDOW_3_BASE 0x3000
+#define BNXT_FW_STATUS_SHUTDOWN 0x100000
+
#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)
struct bnxt {
void *bar0;
#define BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE (1 << 18)
#define BNXT_FLAG_FW_CAP_ERROR_RECOVERY (1 << 19)
#define BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED (1 << 20)
+#define BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD (1 << 21)
#define BNXT_FLAG_EXT_STATS_SUPPORTED (1 << 29)
#define BNXT_FLAG_NEW_RM (1 << 30)
#define BNXT_FLAG_INIT_DONE (1U << 31)
#include <rte_malloc.h>
#include <rte_alarm.h>
+#include <rte_cycles.h>
#include "bnxt.h"
#include "bnxt_cpr.h"
#include "bnxt_ring.h"
#include "hsi_struct_def_dpdk.h"
+void bnxt_wait_for_device_shutdown(struct bnxt *bp)
+{
+ uint32_t val, timeout;
+
+ /* if HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD is set
+ * in HWRM_FUNC_QCAPS command, wait for FW_STATUS to set
+ * the SHUTDOWN bit in health register
+ */
+ if (!(bp->recovery_info &&
+ (bp->flags & BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD)))
+ return;
+
+ /* Driver has to wait for fw_reset_max_msecs or shutdown bit which comes
+ * first for FW to collect crash dump.
+ */
+ timeout = bp->fw_reset_max_msecs;
+
+ /* Driver has to poll for shutdown bit in fw_status register
+ *
+ * 1. in case of hot fw upgrade, this bit will be set after all
+ * function drivers unregistered with fw.
+ * 2. in case of fw initiated error recovery, this bit will be
+ * set after fw has collected the core dump
+ */
+ do {
+ val = bnxt_read_fw_status_reg(bp, BNXT_FW_STATUS_REG);
+ if (val & BNXT_FW_STATUS_SHUTDOWN)
+ return;
+
+ rte_delay_ms(100);
+ timeout -= 100;
+ } while (timeout);
+}
+
/*
* Async event handling
*/
void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmp);
int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp);
void bnxt_dev_reset_and_resume(void *arg);
+void bnxt_wait_for_device_shutdown(struct bnxt *bp);
#define EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL \
HWRM_ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL
bnxt_dev_cleanup(bp);
+ bnxt_wait_for_device_shutdown(bp);
+
rc = rte_eal_alarm_set(US_PER_MS * bp->fw_reset_min_msecs,
bnxt_dev_recover, (void *)bp);
if (rc)
bp->flags &= ~BNXT_FLAG_FW_CAP_ERROR_RECOVERY;
}
+ if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD)
+ bp->flags |= BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD;
+ else
+ bp->flags &= ~BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD;
+
HWRM_UNLOCK();
return rc;
*/
#define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_STATS_SUPPORTED \
UINT32_C(0x1000000)
+ /*
+ * If the query is for a VF, then this flag shall be ignored.
+ * If this query is for a PF and this flag is set to 1, then host
+ * must initiate reset or reload (or fastboot) the firmware image
+ * upon detection of device shutdown state.
+ */
+ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD \
+ UINT32_C(0x2000000)
/*
* This value is current MAC address configured for this
* function. A value of 00-00-00-00-00-00 indicates no