提交 e7ece050 编写于 作者: X Xinming Hu 提交者: Kalle Valo

mwifiex: pcie: compatible with wifi-only image while extract wifi-part fw

Sometimes, we might using wifi-only firmware with a combo firmware name,
in this case, do not need to filter bluetooth part from header.
Signed-off-by: NXinming Hu <huxm@marvell.com>
Signed-off-by: NCathy Luo <cluo@marvell.com>
Reviewed-by: NBrian Norris <briannorris@chromium.org>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 e37f6483
...@@ -1985,7 +1985,8 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter, ...@@ -1985,7 +1985,8 @@ static int mwifiex_pcie_event_complete(struct mwifiex_adapter *adapter,
* (3) wifi image. * (3) wifi image.
* *
* This function bypass the header and bluetooth part, return * This function bypass the header and bluetooth part, return
* the offset of tail wifi-only part. * the offset of tail wifi-only part. If the image is already wifi-only,
* that is start with CMD1, return 0.
*/ */
static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter, static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter,
...@@ -1993,7 +1994,7 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter, ...@@ -1993,7 +1994,7 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter,
const struct mwifiex_fw_data *fwdata; const struct mwifiex_fw_data *fwdata;
u32 offset = 0, data_len, dnld_cmd; u32 offset = 0, data_len, dnld_cmd;
int ret = 0; int ret = 0;
bool cmd7_before = false; bool cmd7_before = false, first_cmd = false;
while (1) { while (1) {
/* Check for integer and buffer overflow */ /* Check for integer and buffer overflow */
...@@ -2014,20 +2015,29 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter, ...@@ -2014,20 +2015,29 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter,
switch (dnld_cmd) { switch (dnld_cmd) {
case MWIFIEX_FW_DNLD_CMD_1: case MWIFIEX_FW_DNLD_CMD_1:
if (!cmd7_before) { if (offset + data_len < data_len) {
mwifiex_dbg(adapter, ERROR, mwifiex_dbg(adapter, ERROR, "bad FW parse\n");
"no cmd7 before cmd1!\n");
ret = -1; ret = -1;
goto done; goto done;
} }
if (offset + data_len < data_len) {
mwifiex_dbg(adapter, ERROR, "bad FW parse\n"); /* Image start with cmd1, already wifi-only firmware */
if (!first_cmd) {
mwifiex_dbg(adapter, MSG,
"input wifi-only firmware\n");
return 0;
}
if (!cmd7_before) {
mwifiex_dbg(adapter, ERROR,
"no cmd7 before cmd1!\n");
ret = -1; ret = -1;
goto done; goto done;
} }
offset += data_len; offset += data_len;
break; break;
case MWIFIEX_FW_DNLD_CMD_5: case MWIFIEX_FW_DNLD_CMD_5:
first_cmd = true;
/* Check for integer overflow */ /* Check for integer overflow */
if (offset + data_len < data_len) { if (offset + data_len < data_len) {
mwifiex_dbg(adapter, ERROR, "bad FW parse\n"); mwifiex_dbg(adapter, ERROR, "bad FW parse\n");
...@@ -2037,6 +2047,7 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter, ...@@ -2037,6 +2047,7 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter,
offset += data_len; offset += data_len;
break; break;
case MWIFIEX_FW_DNLD_CMD_6: case MWIFIEX_FW_DNLD_CMD_6:
first_cmd = true;
/* Check for integer overflow */ /* Check for integer overflow */
if (offset + data_len < data_len) { if (offset + data_len < data_len) {
mwifiex_dbg(adapter, ERROR, "bad FW parse\n"); mwifiex_dbg(adapter, ERROR, "bad FW parse\n");
...@@ -2053,6 +2064,7 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter, ...@@ -2053,6 +2064,7 @@ static int mwifiex_extract_wifi_fw(struct mwifiex_adapter *adapter,
} }
goto done; goto done;
case MWIFIEX_FW_DNLD_CMD_7: case MWIFIEX_FW_DNLD_CMD_7:
first_cmd = true;
cmd7_before = true; cmd7_before = true;
break; break;
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册