From nobody Sat May 20 11:19:34 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QNh7V6rvQz4Bxj6; Sat, 20 May 2023 11:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QNh7V6P7Rz41dS; Sat, 20 May 2023 11:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684581574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=clVTHDmauO+EA+qxcBrqQDC8rFks0ilmK4m6Qcq7tUk=; b=AvxjLl6Xp265P3gV+a1MyDws8Vb9BBScnYAjpPVr7N+2BARcF5RQpJx6gfyRBKo4d6IRh9 1dHAet45pGYrF8+kHj9cxpmHRAQ4lD4ieeIYSyCLI3xEbDdBZTXGf4LARG+8+CLKscCPJU PzmTyBtqjcF3Y/AaKqNUtvp49uEfx+JBwDiBVyjpIamMqQWAGTgL5O8V33UlA9IqH+Eitu CGgEcbCUne2RmkQhFVp6ayo0A8qx6XH6/8L6cUhfJ2vCs/C5cv+Y3s6tMvuHMobNVZMtDe si5JgABhXSD6FSSnWKPTuujEmbweGzmJ6FQSgwko0MMbdlneMqH0vSwfPJAmWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684581574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=clVTHDmauO+EA+qxcBrqQDC8rFks0ilmK4m6Qcq7tUk=; b=NLmJNBTPNLO/o7wxbYSZAm2uD5fW82tPVVWEDYDNiksrwUFdoPphiv2PypC+g0vjFFUvVL sMdgKtgQcGdUxENcCa4i8XRS2KKA7BmXhKyU/yG6R5TyrZuOymU66WOOVIcvzq5cmUIRpO lj7shmyqCFd5ESwgNSZgcxsI81C6pK9xr9T8NVy7DGfH49xlv5ZCJrJfc4QiaEoQvXnzOz QdmQC4xrG7xtEBWZXVZptnIzplx/QGb8F5nSi8mFHi1986/h4uxtgdGCGjoW3YWZ73EasC 01tX7H6T7oTsbUlOIETE4zXhlehMzHH/xGG7UjP/fiEKOXbk7Rjt9ntMXhiygw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684581574; a=rsa-sha256; cv=none; b=yaz9IFIi31ZWWYpTAtGGmbwHwe0Cu53eDl7BKxZmc/Z6/N/TxRU1RX6qs4v6FSQ+KJc0xK XXA3E3XRN6YixT3IKrx8fCDqikqrs1kpVlyPwFDI2O+KdztU435TB3Rb63GXCsrodAFYR0 i9tyWgJdUi/fccafYjScIfzjw0eJS092Ipw/1VMEnnkpEyjzoWSAJMITjKxGgjQmCfj5Bm Y7PfRz5oXPPWghhIuluIL3vGdtUEuDbPHuxuH5SqnGVTiEJBVaw8WKA/ct2JbTePapGKcC h34ecFouEbNRSLe7ZEPvht1IvGgI75mPF5Dhukd0X4TTW4oO/jtT/QHi4Eefsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QNh7V5SVbz16vr; Sat, 20 May 2023 11:19:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34KBJYlo086334; Sat, 20 May 2023 11:19:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34KBJYiA086333; Sat, 20 May 2023 11:19:34 GMT (envelope-from git) Date: Sat, 20 May 2023 11:19:34 GMT Message-Id: <202305201119.34KBJYiA086333@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: dd8a74e74d99 - main - fwget: add support for various WiFi NICs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd8a74e74d9961d3aa4b7078368a5de84e3a1083 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=dd8a74e74d9961d3aa4b7078368a5de84e3a1083 commit dd8a74e74d9961d3aa4b7078368a5de84e3a1083 Author: Bjoern A. Zeeb AuthorDate: 2023-05-11 20:41:40 +0000 Commit: Bjoern A. Zeeb 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 +}