git: 73d4ebea3567 - main - rtw88: import firmware for Realtek's rtw88 supported chipsets.

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 01 Apr 2022 00:32:28 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=73d4ebea3567f18db549638c3d897b6d6758faa4

commit 73d4ebea3567f18db549638c3d897b6d6758faa4
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-03-30 22:06:14 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-04-01 00:07:24 +0000

    rtw88: import firmware for Realtek's rtw88 supported chipsets.
    
    Import the most recent versions of the firmware images for the
    rtw88 driver.
    
    This is based on linux-firmware at 681281e49fb6778831370e5d94e6e1d97f0752d6.
    
    The license of the firmware matches the previous rtwnfw(4) firmware
    files (modulo a Copyright year) and you can find a copy in
    sys/contrib/dev/rtw88fw/LICENCE.rtlwifi_firmware.txt.
    
    Add build infrastructure to create the .ko files but do not yet hook
    it up to the build until all parts are in the tree.
    
    Approved by:    core (imp)
    MFC after:      2 weeks
---
 .../dev/rtw88fw/LICENCE.rtlwifi_firmware.txt       |  39 +++++++++++++++++++++
 sys/contrib/dev/rtw88fw/README                     |  34 ++++++++++++++++++
 sys/contrib/dev/rtw88fw/WHENCE                     |  19 ++++++++++
 sys/contrib/dev/rtw88fw/rtw8723d_fw.bin            | Bin 0 -> 28884 bytes
 sys/contrib/dev/rtw88fw/rtw8821c_fw.bin            | Bin 0 -> 138984 bytes
 sys/contrib/dev/rtw88fw/rtw8822b_fw.bin            | Bin 0 -> 150984 bytes
 sys/contrib/dev/rtw88fw/rtw8822c_fw.bin            | Bin 0 -> 202456 bytes
 sys/contrib/dev/rtw88fw/rtw8822c_wow_fw.bin        | Bin 0 -> 145224 bytes
 sys/modules/rtw88fw/Makefile                       |  10 ++++++
 sys/modules/rtw88fw/Makefile.inc                   |  17 +++++++++
 sys/modules/rtw88fw/rtw8723d/Makefile              |   6 ++++
 sys/modules/rtw88fw/rtw8821c/Makefile              |   6 ++++
 sys/modules/rtw88fw/rtw8822b/Makefile              |   6 ++++
 sys/modules/rtw88fw/rtw8822c/Makefile              |   6 ++++
 sys/modules/rtw88fw/rtw8822c_wow/Makefile          |   6 ++++
 15 files changed, 149 insertions(+)

diff --git a/sys/contrib/dev/rtw88fw/LICENCE.rtlwifi_firmware.txt b/sys/contrib/dev/rtw88fw/LICENCE.rtlwifi_firmware.txt
new file mode 100644
index 000000000000..d70921f49379
--- /dev/null
+++ b/sys/contrib/dev/rtw88fw/LICENCE.rtlwifi_firmware.txt
@@ -0,0 +1,39 @@
+Copyright (c) 2010, Realtek Semiconductor Corporation 
+All rights reserved.
+
+Redistribution.  Redistribution and use in binary form, without 
+modification, are permitted provided that the following conditions are 
+met:
+
+* Redistributions must reproduce the above copyright notice and the 
+  following disclaimer in the documentation and/or other materials 
+  provided with the distribution. 
+* Neither the name of Realtek Semiconductor Corporation nor the names of its
+  suppliers may be used to endorse or promote products derived from this
+  software without specific prior written permission. 
+* No reverse engineering, decompilation, or disassembly of this software 
+  is permitted.
+
+Limited patent license. Realtek Semiconductor Corporation grants a world-wide, 
+royalty-free, non-exclusive license under patents it now or hereafter 
+owns or controls to make, have made, use, import, offer to sell and 
+sell ("Utilize") this software, but solely to the extent that any 
+such patent is necessary to Utilize the software alone, or in 
+combination with an operating system licensed under an approved Open 
+Source license as listed by the Open Source Initiative at 
+http://opensource.org/licenses.  The patent license shall not apply to 
+any other combinations which include this software.  No hardware per 
+se is licensed hereunder.
+
+DISCLAIMER.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
+DAMAGE.
diff --git a/sys/contrib/dev/rtw88fw/README b/sys/contrib/dev/rtw88fw/README
new file mode 100644
index 000000000000..01449ca72e4c
--- /dev/null
+++ b/sys/contrib/dev/rtw88fw/README
@@ -0,0 +1,34 @@
+
+ rtw88 firmware
+================
+
+This repository contains firmware images supported by Realtek's wireless
+driver rtw88. And some of the devices run with more than one firmware
+file. Basically, a "normal" firmware is necessary to be downloaded to
+the device.
+And another is called "wowlan" firmware, it should be loaded when a
+device is going to suspend. Which means driver will "re-download/swap"
+the firmware image. The wowlan firmware contains wake up functions that
+can recognize specific events and send a wake up signal to device if
+needed, and the system will resume to running state. During resume,
+driver will then swap the normal firmware back, return to running state.
+
+If any distros or platforms do not require wowlan feature, they can
+_only_ pick the normal firmware. And everything still works fine,
+except that the device cannot be waken from the wireless NICs.
+
+Currently supported devices with corresponding firmwares:
+
+RTL8822BE
+    rtw8822b_fw.bin
+
+RTL8821CE
+    rtw8821c_fw.bin
+
+RTL8822CE
+    rtw8822c_fw.bin
+    rtw8822c_wow_fw.bin
+
+RTL8723DE
+    rtw8723d_fw.bin
+
diff --git a/sys/contrib/dev/rtw88fw/WHENCE b/sys/contrib/dev/rtw88fw/WHENCE
new file mode 100644
index 000000000000..71cb61f86a1f
--- /dev/null
+++ b/sys/contrib/dev/rtw88fw/WHENCE
@@ -0,0 +1,19 @@
+Driver: rtw88 - Realtek 802.11ac WLAN driver for RTL8822BE and RTL8822CE
+
+Info: Sent to Larry Finger by Realtek engineer Yan-Hsuan Chuang <yhchuang@realtek.com>
+File: rtw88/rtw8822b_fw.bin
+File: rtw88/rtw8822c_fw.bin
+File: rtw88/rtw8822c_wow_fw.bin
+File: rtw88/README
+File: rtw88/rtw8723d_fw.bin
+File: rtw88/rtw8821c_fw.bin
+
+Licence: Redistributable. See LICENCE.rtlwifi_firmware.txt for details.
+
+    These firmware should be put under /lib/firmware/rtw88/
+    And note that the rtw88 driver is able to support wake-on-wireless LAN
+    for RTL8822C devices, after kernel v5.6+. So, make sure the firmware
+    rtw88/rtw8822c_wow_fw.bin is also packed, otherwise the firmware load
+    fail could be a problem.
+    Although RTL8723D devices are 802.11n device, they are also supported
+    by rtw88 because the hardware arch is similar.
diff --git a/sys/contrib/dev/rtw88fw/rtw8723d_fw.bin b/sys/contrib/dev/rtw88fw/rtw8723d_fw.bin
new file mode 100644
index 000000000000..ac2b9250c39e
Binary files /dev/null and b/sys/contrib/dev/rtw88fw/rtw8723d_fw.bin differ
diff --git a/sys/contrib/dev/rtw88fw/rtw8821c_fw.bin b/sys/contrib/dev/rtw88fw/rtw8821c_fw.bin
new file mode 100644
index 000000000000..8264e3480cc8
Binary files /dev/null and b/sys/contrib/dev/rtw88fw/rtw8821c_fw.bin differ
diff --git a/sys/contrib/dev/rtw88fw/rtw8822b_fw.bin b/sys/contrib/dev/rtw88fw/rtw8822b_fw.bin
new file mode 100644
index 000000000000..0934ffcc77a3
Binary files /dev/null and b/sys/contrib/dev/rtw88fw/rtw8822b_fw.bin differ
diff --git a/sys/contrib/dev/rtw88fw/rtw8822c_fw.bin b/sys/contrib/dev/rtw88fw/rtw8822c_fw.bin
new file mode 100644
index 000000000000..807044f11768
Binary files /dev/null and b/sys/contrib/dev/rtw88fw/rtw8822c_fw.bin differ
diff --git a/sys/contrib/dev/rtw88fw/rtw8822c_wow_fw.bin b/sys/contrib/dev/rtw88fw/rtw8822c_wow_fw.bin
new file mode 100644
index 000000000000..1ce74fda8bff
Binary files /dev/null and b/sys/contrib/dev/rtw88fw/rtw8822c_wow_fw.bin differ
diff --git a/sys/modules/rtw88fw/Makefile b/sys/modules/rtw88fw/Makefile
new file mode 100644
index 000000000000..9a3b82b78922
--- /dev/null
+++ b/sys/modules/rtw88fw/Makefile
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+SUBDIR=	\
+	rtw8723d \
+	rtw8821c \
+	rtw8822b \
+	rtw8822c \
+	rtw8822c_wow
+
+.include <bsd.subdir.mk>
diff --git a/sys/modules/rtw88fw/Makefile.inc b/sys/modules/rtw88fw/Makefile.inc
new file mode 100644
index 000000000000..dfdfd17cb245
--- /dev/null
+++ b/sys/modules/rtw88fw/Makefile.inc
@@ -0,0 +1,17 @@
+# $FreeBSD$
+#
+# Common rules for building firmware.  Note this gets auto-included
+# by the subdir Makefile's as a consequence of included bsd.kmod.mk.
+
+_NAME=		rtw${NAME}_fw.bin
+
+IMG=		${_NAME}
+KMOD=		${_NAME}
+
+CLEANFILES+=	${IMG}
+
+FIRMWS=		${IMG}:${IMG}:${VERSION}
+
+${IMG}: ${SRCTOP}/sys/contrib/dev/rtw88fw/${IMG}
+	cp ${.ALLSRC} ${.TARGET}
+
diff --git a/sys/modules/rtw88fw/rtw8723d/Makefile b/sys/modules/rtw88fw/rtw8723d/Makefile
new file mode 100644
index 000000000000..6bc8dcecc365
--- /dev/null
+++ b/sys/modules/rtw88fw/rtw8723d/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+VERSION=	48
+NAME=		8723d
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/rtw88fw/rtw8821c/Makefile b/sys/modules/rtw88fw/rtw8821c/Makefile
new file mode 100644
index 000000000000..d8a7c03e82e9
--- /dev/null
+++ b/sys/modules/rtw88fw/rtw8821c/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+VERSION=	2408
+NAME=		8821c
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/rtw88fw/rtw8822b/Makefile b/sys/modules/rtw88fw/rtw8822b/Makefile
new file mode 100644
index 000000000000..12a732d3907a
--- /dev/null
+++ b/sys/modules/rtw88fw/rtw8822b/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+VERSION=	0
+NAME=		8822b
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/rtw88fw/rtw8822c/Makefile b/sys/modules/rtw88fw/rtw8822c/Makefile
new file mode 100644
index 000000000000..0f92657b28c0
--- /dev/null
+++ b/sys/modules/rtw88fw/rtw8822c/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+VERSION=	9911
+NAME=		8822c
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/rtw88fw/rtw8822c_wow/Makefile b/sys/modules/rtw88fw/rtw8822c_wow/Makefile
new file mode 100644
index 000000000000..149d9bdf378e
--- /dev/null
+++ b/sys/modules/rtw88fw/rtw8822c_wow/Makefile
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+VERSION=	994
+NAME=		8822c_wow
+
+.include <bsd.kmod.mk>