OSDN Git Service

wifi: rtw89: introduce infrastructure of firmware elements
authorPing-Ke Shih <pkshih@realtek.com>
Tue, 1 Aug 2023 02:11:25 +0000 (10:11 +0800)
committerKalle Valo <kvalo@kernel.org>
Thu, 3 Aug 2023 12:04:11 +0000 (15:04 +0300)
commita337d4331fd64652a9ad459049713ba5b1f8e0bd
tree0285e97c813c6a661bff29a9d3ac5f6543251549
parent7d112665982b0b78e6bcf4173c8231838c158187
wifi: rtw89: introduce infrastructure of firmware elements

In order to pack more data into firmware file, we introduce firmware
elements and append BB_MCU firmware first. The first part of new firmware
file is still unchanged firmware of WiFi CPU, so the new firmware format
can be backward compatible to old format. The new elements part consists
of ID and size basically, which can append more elements simply. To avoid
unaligned access in certain platform and be easy to read, headers of all
elements start at 16-byte aligned address.

 +===========================================+
 |             original firmware             |
 |                             +-------------+
 |                             |   padding   |
 +===========================================+
 | elm ID 1 | elm size |  other header data  |
 +----------+----------+                     |
 |                                           |
 +-------------------------------------------+
 | content (variable length)                 |
 |                             +-------------+
 |                             |   padding   |
 +===========================================+
 | elm ID 2 | elm size |  other header data  |
 +----------+----------+                     |
 |                                           |
 +-------------------------------------------+
 | content (variable length)                 |
 |                   +-----------------------+
 |                   | (no padding for the last one)
 +===================+

More detail of element header is shown below. The additional fields
'version' and 'element_priv[]' are meta data of elements, so that we can
know element version easily, and element_priv[] provide specific fields
for certain element, such as RF path index for RF parameter tables.

 +===========================================+
 |  elm ID  | elm size | version  |   rsvd0  |
 +----------+----------+----------+----------+
 |        rsvd1/2      |  element_priv[]     |
 +-------------------------------------------+

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-7-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h