OSDN Git Service

wifi: rtw89: add firmware parser for v1 format
authorPing-Ke Shih <pkshih@realtek.com>
Tue, 1 Aug 2023 02:11:23 +0000 (10:11 +0800)
committerKalle Valo <kvalo@kernel.org>
Thu, 3 Aug 2023 12:04:11 +0000 (15:04 +0300)
commit12b1a12548eb31812f0a6128a0796d1656e2abb2
tree9e5be7d4b14bcc434dc8e59834924c20baf03bb1
parent1b073b350d24b9481f0dffea9e9dec05c838098a
wifi: rtw89: add firmware parser for v1 format

A firmware with v1 format contains many sections to download. Add parser to
read section type, target address, length, checksum and so on, and then
download the section to WiFi CPU with proper location.

The additional dynamic header length named dynamic_hdr_len is used to
skip content of dynamic header containing compiler flags of firmware, which
can help to determine variant firmware build, but currently rtw89 only
use single one variant. So, just skip the content.

The layout of a WiFi CPU firmware with v1 format looks like:

+---------------------------------------+
|      Header (12 words)                |
+---------------------------------------+
|      Section header 1 (4 words)       |
|      Section header 2 (4 words)       |
|      Section header 3 (4 words)       |
|      ...                              |
+---------------------------------------+
|      Dynamic header (variable length) |
+---------------------------------------+
|      Data used & pointed by section   |
|      ...                              |
+---------------------------------------+

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230801021127.15919-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h