The branch main has been updated by bz:

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

commit dd8a74e74d9961d3aa4b7078368a5de84e3a1083
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2023-05-11 20:41:40 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2023-05-20 11:18:51 +0000

    fwget: add support for various WiFi NICs
    
    Add support for Realtek, QCA, and Mediatek WiFi NIC cards.
    We group the matching entries by driver in sub-functions in order
    to semi-automatically create the lists for now.
    
    Reviewed by:    manu
    Differential Revision: https://reviews.freebsd.org/D40073
---
 usr.sbin/fwget/pci/Makefile             |  3 ++
 usr.sbin/fwget/pci/pci_network_mediatek | 65 ++++++++++++++++++++++++++
 usr.sbin/fwget/pci/pci_network_qca      | 81 +++++++++++++++++++++++++++++++++
 usr.sbin/fwget/pci/pci_network_realtek  | 65 ++++++++++++++++++++++++++
 4 files changed, 214 insertions(+)

diff --git a/usr.sbin/fwget/pci/Makefile b/usr.sbin/fwget/pci/Makefile
index 5cf3b0cd2ed9..66b3901e4a91 100644
--- a/usr.sbin/fwget/pci/Makefile
+++ b/usr.sbin/fwget/pci/Makefile
@@ -1,6 +1,9 @@
 PACKAGE=       fwget
 
 SCRIPTS=pci \
+       pci_network_mediatek \
+       pci_network_qca \
+       pci_network_realtek \
        pci_video_amd \
        pci_video_intel
 
diff --git a/usr.sbin/fwget/pci/pci_network_mediatek 
b/usr.sbin/fwget/pci/pci_network_mediatek
new file mode 100644
index 000000000000..5de31e6661eb
--- /dev/null
+++ b/usr.sbin/fwget/pci/pci_network_mediatek
@@ -0,0 +1,65 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright 2023 Bjoern A. Zeeb
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+#
+
+# mt7915
+pci_network_mediatek_mt7915()
+{
+
+       # awk '/PCI_DEVICE\(PCI_VENDOR_ID_MEDIATEK,/ { gsub(").*", "", $3); 
printf "%s)\taddpkg \"wifi-firmware-mt76-kmod\"; return 1 ;;\n", tolower($3) }' 
*.c
+
+       case "$1" in
+       0x7915) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       0x7906) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       0x7916) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       0x790a) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       esac
+}
+
+# mt7921
+pci_network_mediatek_mt7921()
+{
+
+       # awk '/PCI_DEVICE\(PCI_VENDOR_ID_MEDIATEK,/ { gsub(").*", "", $3); 
printf "%s)\taddpkg \"wifi-firmware-mt76-kmod\"; return 1 ;;\n", tolower($3) }' 
*.c
+        case "$1" in
+       0x7961) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       0x7922) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       0x0608) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       0x0616) addpkg "wifi-firmware-mt76-kmod"; return 1 ;;
+       esac
+}
+
+
+pci_network_mediatek()
+{
+
+       for _drv in mt7915 mt7921; do
+               pci_network_mediatek_${_drv} "$1"
+               case $? in
+               1)      break ;;
+               esac
+       done
+}
diff --git a/usr.sbin/fwget/pci/pci_network_qca 
b/usr.sbin/fwget/pci/pci_network_qca
new file mode 100644
index 000000000000..cf33e0d87239
--- /dev/null
+++ b/usr.sbin/fwget/pci/pci_network_qca
@@ -0,0 +1,81 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright 2023 Bjoern A. Zeeb
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+#
+
+# ath10k
+pci_network_qca_ath10k()
+{
+
+       # awk '/DEVICE_ID[[:space:]]/ { gsub("[()]", "", $3); printf 
"%s)\taddpkg \"wifi-firmware-ath10k-kmod\"; return 1 ;;\n", tolower($3) }' hw.h
+       # We ignore the ubiquity entry for now.
+        case "$1" in
+       0x003c) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x0041) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x003e) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x0042) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x0040) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x0056) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x0046) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x0042) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       0x0050) addpkg "wifi-firmware-ath10k-kmod"; return 1 ;;
+       esac
+}
+
+# ath11k
+pci_network_qca_ath11k()
+{
+
+       # awk '/DEVICE_ID[[:space:]]/ { gsub("[()]", "", $3); printf 
"%s)\taddpkg \"wifi-firmware-ath11k-kmod\"; return 1 ;;\n", tolower($3) }' pci.c
+        case "$1" in
+       0x1101) addpkg "wifi-firmware-ath11k-kmod"; return 1 ;;
+       0x1104) addpkg "wifi-firmware-ath11k-kmod"; return 1 ;;
+       0x1103) addpkg "wifi-firmware-ath11k-kmod"; return 1 ;;
+       esac
+}
+
+# ath12k
+pci_network_qca_ath12k()
+{
+       # No ath12k firmware package yet
+       return 0
+
+       # awk '/DEVICE_ID[[:space:]]/ { gsub("[()]", "", $3); printf 
"%s)\taddpkg \"wifi-firmware-ath12k-kmod\"; return 1 ;;\n", tolower($3) }' pci.c
+        case "$1" in
+       0x1109) addpkg "wifi-firmware-ath12k-kmod"; return 1 ;;
+       0x1107) addpkg "wifi-firmware-ath12k-kmod"; return 1 ;;
+       esac
+}
+
+pci_network_qca()
+{
+
+       for _drv in ath10k ath11k; do
+               pci_network_qca_${_drv} "$1"
+               case $? in
+               1)      break ;;
+               esac
+       done
+}
diff --git a/usr.sbin/fwget/pci/pci_network_realtek 
b/usr.sbin/fwget/pci/pci_network_realtek
new file mode 100644
index 000000000000..795d9d4a6e0a
--- /dev/null
+++ b/usr.sbin/fwget/pci/pci_network_realtek
@@ -0,0 +1,65 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright 2023 Bjoern A. Zeeb
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+#
+
+# rtw88
+pci_network_realtek_rtw88()
+{
+
+       # awk '/PCI_DEVICE\(PCI_VENDOR_ID_REALTEK,/ { gsub(").*", "", $2); 
printf "%s)\taddpkg \"wifi-firmware-rtw88-kmod\"; return 1 ;;\n", tolower($2) 
}' *.c
+       case "$1" in
+       0xd723) addpkg "wifi-firmware-rtw88-kmod"; return 1 ;;
+       0xb821) addpkg "wifi-firmware-rtw88-kmod"; return 1 ;;
+       0xc821) addpkg "wifi-firmware-rtw88-kmod"; return 1 ;;
+       0xb822) addpkg "wifi-firmware-rtw88-kmod"; return 1 ;;
+       0xc822) addpkg "wifi-firmware-rtw88-kmod"; return 1 ;;
+       0xc82f) addpkg "wifi-firmware-rtw88-kmod"; return 1 ;;
+       esac
+}
+
+# rtw89
+pci_network_realtek_rtw89()
+{
+
+       # awk '/PCI_DEVICE\(PCI_VENDOR_ID_REALTEK,/ { gsub(").*", "", $2); 
printf "%s)\taddpkg \"wifi-firmware-rtw89-kmod\"; return 1 ;;\n", tolower($2) 
}' *.c
+        case "$1" in
+       0x8852) addpkg "wifi-firmware-rtw89-kmod"; return 1 ;;
+       0xa85a) addpkg "wifi-firmware-rtw89-kmod"; return 1 ;;
+       0xc852) addpkg "wifi-firmware-rtw89-kmod"; return 1 ;;
+       esac
+}
+
+
+pci_network_realtek()
+{
+
+       for _drv in rtw88 rtw89; do
+               pci_network_realtek_${_drv} "$1"
+               case $? in
+               1)      break ;;
+               esac
+       done
+}

Reply via email to