aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2018-05-16 17:55:16 +0000
committerNavdeep Parhar <np@FreeBSD.org>2018-05-16 17:55:16 +0000
commit47ae7a7e4f9e15abc49c67974ebb58814ba2b1e8 (patch)
tree1e359a3a622eab4f7fdad9b7263f2a261e404c18 /sys
parent964b24b42d017db3d604350a573276fdbcb39f1f (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/cxgbe/t4_main.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index 4de966af4f26..cc9e044cff6e 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -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 firmware *default_cfg,
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);