cxgbe(4): Never install a firmware if hw.cxgbe.fw_install is 0.

MFC after:	1 week
This commit is contained in:
Navdeep Parhar 2013-06-05 20:57:52 +00:00
parent c6ef00e390
commit ad13c6af54
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251434

View File

@ -1912,18 +1912,15 @@ fw_compatible(const struct fw_hdr *hdr1, const struct fw_hdr *hdr2)
}
/*
* The firmware in the KLD is usable and can be installed. But should it be?
* This routine explains itself in detail if it indicates the KLD firmware
* should be installed.
* The firmware in the KLD is usable, but should it be installed? This routine
* explains itself in detail if it indicates the KLD firmware should be
* installed.
*/
static int
should_install_kld_fw(struct adapter *sc, int card_fw_usable, int k, int c)
{
const char *reason;
KASSERT(t4_fw_install != 0, ("%s: Can't install; shouldn't be asked "
"to evaluate if install is a good idea.", __func__));
if (!card_fw_usable) {
reason = "incompatible or unusable";
goto install;
@ -1942,6 +1939,16 @@ should_install_kld_fw(struct adapter *sc, int card_fw_usable, int k, int c)
return (0);
install:
if (t4_fw_install == 0) {
device_printf(sc->dev, "firmware on card (%u.%u.%u.%u) is %s, "
"but the driver is prohibited from installing a different "
"firmware on the card.\n",
G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c),
G_FW_HDR_FW_VER_MICRO(c), G_FW_HDR_FW_VER_BUILD(c), reason);
return (0);
}
device_printf(sc->dev, "firmware on card (%u.%u.%u.%u) is %s, "
"installing firmware %u.%u.%u.%u on card.\n",
G_FW_HDR_FW_VER_MAJOR(c), G_FW_HDR_FW_VER_MINOR(c),
@ -2028,15 +2035,13 @@ prep_firmware(struct adapter *sc)
}
if (card_fw_usable && card_fw->fw_ver == drv_fw->fw_ver &&
(!kld_fw_usable || kld_fw->fw_ver == drv_fw->fw_ver ||
t4_fw_install == 0)) {
(!kld_fw_usable || kld_fw->fw_ver == drv_fw->fw_ver)) {
/*
* Common case: the firmware on the card is an exact match and
* the KLD is an exact match too, or the KLD is
* absent/incompatible, or we're prohibited from using it. Note
* that t4_fw_install = 2 is ignored here -- use cxgbetool
* loadfw if you want to reinstall the same firmware as the one
* on the card.
* absent/incompatible. Note that t4_fw_install = 2 is ignored
* here -- use cxgbetool loadfw if you want to reinstall the
* same firmware as the one on the card.
*/
} else if (kld_fw_usable && state == DEV_STATE_UNINIT &&
should_install_kld_fw(sc, card_fw_usable, be32toh(kld_fw->fw_ver),