summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authornp <np@FreeBSD.org>2010-03-31 00:19:39 +0000
committernp <np@FreeBSD.org>2010-03-31 00:19:39 +0000
commit1b86dcfef737152d89ee5a7c4bf4118a2fb570eb (patch)
treea85cb8117c7f32112ee9233df56809196497fc51 /sys
parentb5856ffe18a90a307588b04c40542c50ceeef8fa (diff)
downloadFreeBSD-src-1b86dcfef737152d89ee5a7c4bf4118a2fb570eb.zip
FreeBSD-src-1b86dcfef737152d89ee5a7c4bf4118a2fb570eb.tar.gz
Refresh the firmware version immediately after it is upgraded (or downgraded).
MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/cxgb/cxgb_main.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c
index 28160b1..f232969 100644
--- a/sys/dev/cxgb/cxgb_main.c
+++ b/sys/dev/cxgb/cxgb_main.c
@@ -378,17 +378,25 @@ upgrade_fw(adapter_t *sc)
{
const struct firmware *fw;
int status;
+ u32 vers;
if ((fw = firmware_get(FW_FNAME)) == NULL) {
device_printf(sc->dev, "Could not find firmware image %s\n", FW_FNAME);
return (ENOENT);
} else
- device_printf(sc->dev, "updating firmware on card\n");
+ device_printf(sc->dev, "installing firmware on card\n");
status = t3_load_fw(sc, (const uint8_t *)fw->data, fw->datasize);
- device_printf(sc->dev, "firmware update returned %s %d\n",
- status == 0 ? "success" : "fail", status);
-
+ if (status != 0) {
+ device_printf(sc->dev, "failed to install firmware: %d\n",
+ status);
+ } else {
+ t3_get_fw_version(sc, &vers);
+ snprintf(&sc->fw_version[0], sizeof(sc->fw_version), "%d.%d.%d",
+ G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers),
+ G_FW_VERSION_MICRO(vers));
+ }
+
firmware_put(fw, FIRMWARE_UNLOAD);
return (status);
OpenPOWER on IntegriCloud