diff options
author | Divy Le Ray <divy@chelsio.com> | 2007-03-18 16:10:06 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-03-23 01:48:33 -0400 |
commit | 2e2839627a957714808f98a802d137a7a2a1df46 (patch) | |
tree | 7c001eeb3a45b9f31da3862acbfc11633eea3914 /drivers/net/cxgb3/cxgb3_main.c | |
parent | 05b97b30b09ed245d376035cddf669532e5cca67 (diff) |
cxgb3 - Auto-load FW if mismatch detected
The driver attempts to upgrade the FW if the card has the wrong version.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_main.c')
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index eb0a4e068200..b9bcda821f7c 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/workqueue.h> | 42 | #include <linux/workqueue.h> |
43 | #include <linux/proc_fs.h> | 43 | #include <linux/proc_fs.h> |
44 | #include <linux/rtnetlink.h> | 44 | #include <linux/rtnetlink.h> |
45 | #include <linux/firmware.h> | ||
45 | #include <asm/uaccess.h> | 46 | #include <asm/uaccess.h> |
46 | 47 | ||
47 | #include "common.h" | 48 | #include "common.h" |
@@ -707,6 +708,28 @@ static void bind_qsets(struct adapter *adap) | |||
707 | } | 708 | } |
708 | } | 709 | } |
709 | 710 | ||
711 | #define FW_FNAME "t3fw-%d.%d.bin" | ||
712 | |||
713 | static int upgrade_fw(struct adapter *adap) | ||
714 | { | ||
715 | int ret; | ||
716 | char buf[64]; | ||
717 | const struct firmware *fw; | ||
718 | struct device *dev = &adap->pdev->dev; | ||
719 | |||
720 | snprintf(buf, sizeof(buf), FW_FNAME, FW_VERSION_MAJOR, | ||
721 | FW_VERSION_MINOR); | ||
722 | ret = request_firmware(&fw, buf, dev); | ||
723 | if (ret < 0) { | ||
724 | dev_err(dev, "could not upgrade firmware: unable to load %s\n", | ||
725 | buf); | ||
726 | return ret; | ||
727 | } | ||
728 | ret = t3_load_fw(adap, fw->data, fw->size); | ||
729 | release_firmware(fw); | ||
730 | return ret; | ||
731 | } | ||
732 | |||
710 | /** | 733 | /** |
711 | * cxgb_up - enable the adapter | 734 | * cxgb_up - enable the adapter |
712 | * @adapter: adapter being enabled | 735 | * @adapter: adapter being enabled |
@@ -723,6 +746,8 @@ static int cxgb_up(struct adapter *adap) | |||
723 | 746 | ||
724 | if (!(adap->flags & FULL_INIT_DONE)) { | 747 | if (!(adap->flags & FULL_INIT_DONE)) { |
725 | err = t3_check_fw_version(adap); | 748 | err = t3_check_fw_version(adap); |
749 | if (err == -EINVAL) | ||
750 | err = upgrade_fw(adap); | ||
726 | if (err) | 751 | if (err) |
727 | goto out; | 752 | goto out; |
728 | 753 | ||