提交 39396085 编写于 作者: J Jay Sternberg 提交者: John W. Linville

iwlwifi: enable experimental ucode support

ucode firmware may need to be released as experimental for testing or
debugging. released ucode filenames have the API version as the last
component.  experimental ucode files will have that component be "exp"
and the fw_version string reported by ethtool will also contain the
string EXP to clearly identify this ucode from released ucode.
EXP is short for EXPERIMENTAL since fw_version has a max lenght on 32.

this capability is controlled by Kconfig and defaulted to not be used.
Signed-off-by: NJay Sternberg <jay.e.sternberg@intel.com>
Signed-off-by: NWey-Yi Guy <wey-yi.w.guy@intel.com>
上级 79e88e79
...@@ -36,6 +36,12 @@ config IWLWIFI_DEBUGFS ...@@ -36,6 +36,12 @@ config IWLWIFI_DEBUGFS
is a low-impact option that allows getting insight into the is a low-impact option that allows getting insight into the
driver's state at runtime. driver's state at runtime.
config IWLWIFI_DEBUG_EXPERIMENTAL_UCODE
bool "Experimental uCode support"
depends on IWLWIFI && IWLWIFI_DEBUG
---help---
Enable use of experimental ucode for testing and debugging.
config IWLWIFI_DEVICE_TRACING config IWLWIFI_DEVICE_TRACING
bool "iwlwifi device access tracing" bool "iwlwifi device access tracing"
depends on IWLWIFI depends on IWLWIFI
......
...@@ -1659,24 +1659,37 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context); ...@@ -1659,24 +1659,37 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
static int iwl_mac_setup_register(struct iwl_priv *priv, static int iwl_mac_setup_register(struct iwl_priv *priv,
struct iwlagn_ucode_capabilities *capa); struct iwlagn_ucode_capabilities *capa);
#define UCODE_EXPERIMENTAL_INDEX 100
#define UCODE_EXPERIMENTAL_TAG "exp"
static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first) static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first)
{ {
const char *name_pre = priv->cfg->fw_name_pre; const char *name_pre = priv->cfg->fw_name_pre;
char tag[8];
if (first) if (first) {
#ifdef CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE
priv->fw_index = UCODE_EXPERIMENTAL_INDEX;
strcpy(tag, UCODE_EXPERIMENTAL_TAG);
} else if (priv->fw_index == UCODE_EXPERIMENTAL_INDEX) {
#endif
priv->fw_index = priv->cfg->ucode_api_max; priv->fw_index = priv->cfg->ucode_api_max;
else sprintf(tag, "%d", priv->fw_index);
} else {
priv->fw_index--; priv->fw_index--;
sprintf(tag, "%d", priv->fw_index);
}
if (priv->fw_index < priv->cfg->ucode_api_min) { if (priv->fw_index < priv->cfg->ucode_api_min) {
IWL_ERR(priv, "no suitable firmware found!\n"); IWL_ERR(priv, "no suitable firmware found!\n");
return -ENOENT; return -ENOENT;
} }
sprintf(priv->firmware_name, "%s%d%s", sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode");
name_pre, priv->fw_index, ".ucode");
IWL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n", IWL_DEBUG_INFO(priv, "attempting to load firmware %s'%s'\n",
(priv->fw_index == UCODE_EXPERIMENTAL_INDEX)
? "EXPERIMENTAL " : "",
priv->firmware_name); priv->firmware_name);
return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name, return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name,
...@@ -1971,8 +1984,10 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -1971,8 +1984,10 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
memset(&pieces, 0, sizeof(pieces)); memset(&pieces, 0, sizeof(pieces));
if (!ucode_raw) { if (!ucode_raw) {
IWL_ERR(priv, "request for firmware file '%s' failed.\n", if (priv->fw_index <= priv->cfg->ucode_api_max)
priv->firmware_name); IWL_ERR(priv,
"request for firmware file '%s' failed.\n",
priv->firmware_name);
goto try_again; goto try_again;
} }
...@@ -2019,7 +2034,9 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) ...@@ -2019,7 +2034,9 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
api_max, api_ver); api_max, api_ver);
if (build) if (build)
sprintf(buildstr, " build %u", build); sprintf(buildstr, " build %u%s", build,
(priv->fw_index == UCODE_EXPERIMENTAL_INDEX)
? " (EXP)" : "");
else else
buildstr[0] = '\0'; buildstr[0] = '\0';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册