Author: np
Date: Wed Mar 31 00:19:39 2010
New Revision: 205944
URL: http://svn.freebsd.org/changeset/base/205944

Log:
  Refresh the firmware version immediately after it is upgraded (or downgraded).
  
  MFC after:    3 days

Modified:
  head/sys/dev/cxgb/cxgb_main.c

Modified: head/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_main.c       Tue Mar 30 23:15:06 2010        
(r205943)
+++ head/sys/dev/cxgb/cxgb_main.c       Wed Mar 31 00:19:39 2010        
(r205944)
@@ -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);        
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to