Commit 05208419 authored by Chin-Yen Lee's avatar Chin-Yen Lee Committed by Kalle Valo

wifi: rtw89: recognize log format from firmware file

Firmware log format is an element of multi-firmware file
and used for firmware to provide log with formatted text.
Driver needs to recognize it in advance if it exists.
Signed-off-by: default avatarChin-Yen Lee <timlee@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-2-pkshih@realtek.com
parent 288c63d5
......@@ -3548,6 +3548,7 @@ enum rtw89_fw_type {
RTW89_FW_NORMAL = 1,
RTW89_FW_WOWLAN = 3,
RTW89_FW_NORMAL_CE = 5,
RTW89_FW_LOGFMT = 255,
};
enum rtw89_fw_feature {
......@@ -3607,6 +3608,7 @@ struct rtw89_fw_info {
u8 c2h_counter;
struct rtw89_fw_suit normal;
struct rtw89_fw_suit wowlan;
struct rtw89_fw_suit logfmt;
bool fw_log_enable;
u32 feature_map;
};
......@@ -5143,6 +5145,8 @@ static inline struct rtw89_fw_suit *rtw89_fw_suit_get(struct rtw89_dev *rtwdev,
if (type == RTW89_FW_WOWLAN)
return &fw_info->wowlan;
else if (type == RTW89_FW_LOGFMT)
return &fw_info->logfmt;
return &fw_info->normal;
}
......
......@@ -178,19 +178,22 @@ int rtw89_mfw_recognize(struct rtw89_dev *rtwdev, enum rtw89_fw_type type,
for (i = 0; i < mfw_hdr->fw_nr; i++) {
mfw_info = &mfw_hdr->info[i];
if (mfw_info->cv != rtwdev->hal.cv ||
mfw_info->type != type ||
mfw_info->mp)
continue;
fw_suit->data = mfw + le32_to_cpu(mfw_info->shift);
fw_suit->size = le32_to_cpu(mfw_info->size);
return 0;
if (mfw_info->type == type) {
if (mfw_info->cv == rtwdev->hal.cv && !mfw_info->mp)
goto found;
if (type == RTW89_FW_LOGFMT)
goto found;
}
}
if (!nowarn)
rtw89_err(rtwdev, "no suitable firmware found\n");
return -ENOENT;
found:
fw_suit->data = mfw + le32_to_cpu(mfw_info->shift);
fw_suit->size = le32_to_cpu(mfw_info->size);
return 0;
}
static void rtw89_fw_update_ver(struct rtw89_dev *rtwdev,
......@@ -199,6 +202,9 @@ static void rtw89_fw_update_ver(struct rtw89_dev *rtwdev,
{
const struct rtw89_fw_hdr *hdr = (const struct rtw89_fw_hdr *)fw_suit->data;
if (type == RTW89_FW_LOGFMT)
return;
fw_suit->major_ver = le32_get_bits(hdr->w1, FW_HDR_W1_MAJOR_VERSION);
fw_suit->minor_ver = le32_get_bits(hdr->w1, FW_HDR_W1_MINOR_VERSION);
fw_suit->sub_ver = le32_get_bits(hdr->w1, FW_HDR_W1_SUBVERSION);
......@@ -365,6 +371,9 @@ int rtw89_fw_recognize(struct rtw89_dev *rtwdev)
/* It still works if wowlan firmware isn't existing. */
__rtw89_fw_recognize(rtwdev, RTW89_FW_WOWLAN, false);
/* It still works if log format file isn't existing. */
__rtw89_fw_recognize(rtwdev, RTW89_FW_LOGFMT, true);
rtw89_fw_recognize_features(rtwdev);
rtw89_coex_recognize_ver(rtwdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment