svn commit: r333682 - head/sys/dev/cxgbe
Navdeep Parhar
np at FreeBSD.org
Wed May 16 17:55:17 UTC 2018
Author: np
Date: Wed May 16 17:55:16 2018
New Revision: 333682
URL: https://svnweb.freebsd.org/changeset/base/333682
Log:
cxgbe(4): Fall back to a failsafe configuration built into the firmware
if an error is reported while pre-processing the configuration file that
the driver attempted to use.
Also, allow the user to explicitly use the built-in configuration with
hw.cxgbe.config_file="built-in"
MFC after: 2 days
Sponsored by: Chelsio Communications
Modified:
head/sys/dev/cxgbe/t4_main.c
Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c Wed May 16 17:54:40 2018 (r333681)
+++ head/sys/dev/cxgbe/t4_main.c Wed May 16 17:55:16 2018 (r333682)
@@ -379,9 +379,10 @@ int t4_intr_types = INTR_MSIX | INTR_MSI | INTR_INTX;
TUNABLE_INT("hw.cxgbe.interrupt_types", &t4_intr_types);
/*
- * Configuration file.
+ * Configuration file. All the _CF names here are special.
*/
#define DEFAULT_CF "default"
+#define BUILTIN_CF "built-in"
#define FLASH_CF "flash"
#define UWIRE_CF "uwire"
#define FPGA_CF "fpga"
@@ -3342,7 +3343,8 @@ partition_resources(struct adapter *sc, const struct f
snprintf(sc->cfg_file, sizeof(sc->cfg_file), UWIRE_CF);
if (is_fpga(sc))
snprintf(sc->cfg_file, sizeof(sc->cfg_file), FPGA_CF);
- }
+ } else if (strncmp(t4_cfg_file, BUILTIN_CF, sizeof(t4_cfg_file)) == 0)
+ goto use_built_in_config; /* go straight to config. */
/*
* We need to load another module if the profile is anything except
@@ -3453,8 +3455,31 @@ use_config_on_flash:
if (rc != 0) {
device_printf(sc->dev,
"failed to pre-process config file: %d "
- "(mtype %d, moff 0x%x).\n", rc, mtype, moff);
- goto done;
+ "(mtype %d, moff 0x%x). Will reset the firmware and retry "
+ "with the built-in configuration.\n", rc, mtype, moff);
+
+ rc = -t4_fw_reset(sc, sc->mbox, F_PIORSTMODE | F_PIORST);
+ if (rc != 0) {
+ device_printf(sc->dev,
+ "firmware reset failed: %d.\n", rc);
+ if (rc != ETIMEDOUT && rc != EIO) {
+ t4_fw_bye(sc, sc->mbox);
+ sc->flags &= ~FW_OK;
+ }
+ goto done;
+ }
+ snprintf(sc->cfg_file, sizeof(sc->cfg_file), "%s", "built-in");
+use_built_in_config:
+ bzero(&caps, sizeof(caps));
+ caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) |
+ F_FW_CMD_REQUEST | F_FW_CMD_READ);
+ caps.cfvalid_to_len16 = htobe32(FW_LEN16(caps));
+ rc = t4_wr_mbox(sc, sc->mbox, &caps, sizeof(caps), &caps);
+ if (rc != 0) {
+ device_printf(sc->dev,
+ "built-in configuration failed: %d.\n", rc);
+ goto done;
+ }
}
finicsum = be32toh(caps.finicsum);
More information about the svn-src-head
mailing list