From nobody Sat May 20 11:14:58 2023 X-Original-To: dev-commits-src-all@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 4QNh2B31zJz4Bxdf; Sat, 20 May 2023 11:14:58 +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 4QNh2B1xm1z40g3; Sat, 20 May 2023 11:14:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684581298; 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=tTAf+sTiRxw1/q9s0j5luQDh2GAFWB9A8Q1QYVj4vQM=; b=YQs5Zdan2ySlHFYexsgxDMGYaadxyRAdiZtAhWf8km2R0WZLoTp5XsJEilG1QolwYckdjX TfGyMc4/sm9g/fO75r4wqysSo3ErR+0c0iswD1xK7Fr3xg1Ld5W/ysOR+T230C7D3bpqr/ +Tm2lVIeJL+8uBfraJHjdMX0wXTyuI2hFDO/E0Kl16PCmab/v+/45Im/XmXRnnFrirCQmj dDX0/EEz4tVm5XUK2t65AwR52EoO2hpry3In/Sj3ODglm/EweZGXrsnx2K+9oeD1d3l7Vk juw3JxsSUA5w6iAMfekzc5weN5yaMEgZVlFaGILEUklemJLZDzQhNbVI6dfkrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684581298; 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=tTAf+sTiRxw1/q9s0j5luQDh2GAFWB9A8Q1QYVj4vQM=; b=HrdqPPtBI/28QZJcaVKeJHsXj4cl8xBsehvqftb6OeEJlboB57eY+NoxhITVkbuv5CaF7H FjnvDyZh8Ex8JYbhp13VoIuMxnxJfRPwfRMK0ysrlfeJspZcdEvaPTs3ReltSjOfCBBEeu JR17nsG1OJdPDvPF5spqKzB+2/XBmtDopvQlbxWZyjDRNClcYgkcyUMoCELwe4zCXjCuBd Ye1ZGiDAT6KDx5goeTExZNkJIsQt3gTw9jOXMBfyjh+qNaZc5mbtV6EJ7K+w4uJSQAM9eH BTJL4gPwNYG8+u7R6hrYJCZjDjvp02be+UCFYh7UIKv//fzbjS9WYe5JIWJuAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684581298; a=rsa-sha256; cv=none; b=qQ3XsY0bAKp4C31+MFgsDmdbs0/+q9cYj09BfTENVloRnYLNCfJYXiGkZjqYJJLt9/kiLh n6EjEmNqv5iLh5XTwhXFKPmHC0guaDMlD2fPhIhyjlJ7jimXlE8ZyCCnbg8tl6MeYkoTRD LwcWUY0q8kpG4kCgTETPUNLwtnP7V0WUjrQW4cXAjLPsojP9g3CMu1ABXtIhWBF2fFHi+r L9l0evVZ+DUSW0pTXomwdW5L58z2v3qX4XxVrs4TaXjEbSLGsHD5vfOHBkmSk1BZeb8i6K p4blmwE7omtFx599f0PDbDZfh2Zhi00KFQGyDC3y3IlbeN8/L/EkA1fI0GO+gw== 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 4QNh2B10gzz16nH; Sat, 20 May 2023 11:14:58 +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 34KBEwQT085539; Sat, 20 May 2023 11:14:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34KBEwcL085538; Sat, 20 May 2023 11:14:58 GMT (envelope-from git) Date: Sat, 20 May 2023 11:14:58 GMT Message-Id: <202305201114.34KBEwcL085538@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: 10aa369afd99 - main - fwget: simplify adding firmware images to pkg to install List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 10aa369afd9946da18ae51b07aeadc3314fba56d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=10aa369afd9946da18ae51b07aeadc3314fba56d commit 10aa369afd9946da18ae51b07aeadc3314fba56d Author: Bjoern A. Zeeb AuthorDate: 2023-05-11 20:30:44 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-05-20 11:13:12 +0000 fwget: simplify adding firmware images to pkg to install Rather than using echo to return the firmware package name, call a new function (addpkg) which will also deal with (i) no leading space and (ii) remove duplicates (as some devices have dual-wifi-cards). In addition we won't have a line break when having multiple packages. While here also do not call pkg(8) anymore if there is no package to install and use the correct variable to install all and not just the last found package. Reviewed by: manu, bapt Differential Revision: https://reviews.freebsd.org/D40071 --- usr.sbin/fwget/fwget.sh | 32 ++++++++++++++--- usr.sbin/fwget/pci/pci_video_amd | 72 +++++++++++++++++++------------------- usr.sbin/fwget/pci/pci_video_intel | 22 ++++++------ 3 files changed, 74 insertions(+), 52 deletions(-) diff --git a/usr.sbin/fwget/fwget.sh b/usr.sbin/fwget/fwget.sh index 63ed020a437c..5e50569c3991 100644 --- a/usr.sbin/fwget/fwget.sh +++ b/usr.sbin/fwget/fwget.sh @@ -4,6 +4,7 @@ # SPDX-License-Identifier: BSD-2-Clause # # Copyright 2023 Beckhoff Automation GmbH & Co. KG +# Copyright 2023 Bjoern A. Zeeb # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing that the following conditions @@ -62,6 +63,22 @@ log_verbose() echo $@ 1>&3 } +addpkg() +{ + local _p + + _p=$1 + + case "${packages}" in + "") packages="${_p}" ;; + *) # Avoid duplicates. + case " ${packages} " in + *\ ${_p}\ *) ;; # duplicate + *) packages="${packages} ${_p}" ;; + esac + esac +} + DRY_RUN=n VERBOSE=n @@ -97,14 +114,19 @@ done packages="" for subsystem in ${subsystems}; do - package=$(${subsystem}_search_packages) - - packages="${packages} ${package}" + ${subsystem}_search_packages done -echo "Needed packages: ${packages}" +case "${packages}" in +""|^[[:space:]]*$) + echo "No firmware packages to install." + exit 0 + ;; +esac + +echo "Needed firmware packages: '${packages}'" if [ "${DRY_RUN}" = "y" ]; then exit 0 fi -pkg install -q ${package} +pkg install -q ${packages} diff --git a/usr.sbin/fwget/pci/pci_video_amd b/usr.sbin/fwget/pci/pci_video_amd index 4afb44ed787e..b44eac1adf7b 100644 --- a/usr.sbin/fwget/pci/pci_video_amd +++ b/usr.sbin/fwget/pci/pci_video_amd @@ -28,112 +28,112 @@ pci_video_amd() { case "$1" in 0x678*|0x679*) - echo "gpu-firmware-amd-kmod-tahiti" + addpkg "gpu-firmware-amd-kmod-tahiti" ;; 0x680*|0x681*) - echo "gpu-firmware-amd-kmod-pitcairn" + addpkg "gpu-firmware-amd-kmod-pitcairn" ;; 0x660*|0x661*|0x662*|0x663*) - echo "gpu-firmware-amd-kmod-oland" + addpkg "gpu-firmware-amd-kmod-oland" ;; 0x682*|0x683*) - echo "gpu-firmware-amd-kmod-verde gpu-firmware-amd-kmod-si58" + addpkg "gpu-firmware-amd-kmod-verde gpu-firmware-amd-kmod-si58" ;; 0x666*) - echo "gpu-firmware-amd-kmod-hainan" + addpkg "gpu-firmware-amd-kmod-hainan" ;; 0x13*) - echo "gpu-firmware-amd-kmod-kaveri" + addpkg "gpu-firmware-amd-kmod-kaveri" ;; 0x664*|0x664*) - echo "gpu-firmware-amd-kmod-bonaire" + addpkg "gpu-firmware-amd-kmod-bonaire" ;; 0x67a*|0x67b*) - echo "gpu-firmware-amd-kmod-hawaii" + addpkg "gpu-firmware-amd-kmod-hawaii" ;; 0x983*) - echo "gpu-firmware-amd-kmod-kabini" + addpkg "gpu-firmware-amd-kmod-kabini" ;; 0x985*) - echo "gpu-firmware-amd-kmod-mullins" + addpkg "gpu-firmware-amd-kmod-mullins" ;; 0x690*) - echo "gpu-firmware-amd-kmod-topaz" + addpkg "gpu-firmware-amd-kmod-topaz" ;; 0x692*|0x693*) - echo "gpu-firmware-amd-kmod-tonga" + addpkg "gpu-firmware-amd-kmod-tonga" ;; 0x730*) - echo "gpu-firmware-amd-kmod-fiji" + addpkg "gpu-firmware-amd-kmod-fiji" ;; 0x987*) - echo "gpu-firmware-amd-kmod-carrizo" + addpkg "gpu-firmware-amd-kmod-carrizo" ;; 0x98e4*) - echo "gpu-firmware-amd-kmod-stoney" + addpkg "gpu-firmware-amd-kmod-stoney" ;; 0x67e*|0x67ff) - echo "gpu-firmware-amd-kmod-polaris11" + addpkg "gpu-firmware-amd-kmod-polaris11" ;; 0x67c*|0x67d*|0x6fdf) - echo "gpu-firmware-amd-kmod-polaris10" + addpkg "gpu-firmware-amd-kmod-polaris10" ;; 0x698*|0x699*) - echo "gpu-firmware-amd-kmod-polaris12" + addpkg "gpu-firmware-amd-kmod-polaris12" ;; 0x694*) - echo "gpu-firmware-amd-kmod-vegam" + addpkg "gpu-firmware-amd-kmod-vegam" ;; 0x686*|0x687*) - echo "gpu-firmware-amd-kmod-vega10" + addpkg "gpu-firmware-amd-kmod-vega10" ;; 0x69a*) - echo "gpu-firmware-amd-kmod-vega12" + addpkg "gpu-firmware-amd-kmod-vega12" ;; 0x66a*) - echo "gpu-firmware-amd-kmod-vega20" + addpkg "gpu-firmware-amd-kmod-vega20" ;; 0x15d*) - echo "gpu-firmware-amd-kmod-raven" + addpkg "gpu-firmware-amd-kmod-raven" ;; 0x738*|0x739*) - echo "gpu-firmware-amd-kmod-arcturus" + addpkg "gpu-firmware-amd-kmod-arcturus" ;; 0x731*) - echo "gpu-firmware-amd-kmod-navi10" + addpkg "gpu-firmware-amd-kmod-navi10" ;; 0x734*) - echo "gpu-firmware-amd-kmod-navi14" + addpkg "gpu-firmware-amd-kmod-navi14" ;; 0x15e7|0x1636|0x1638|0x164c) - echo "gpu-firmware-amd-kmod-renoir" + addpkg "gpu-firmware-amd-kmod-renoir" ;; 0x736*) - echo "gpu-firmware-amd-kmod-navi12" + addpkg "gpu-firmware-amd-kmod-navi12" ;; 0x73a*|0x73b*) - echo "gpu-firmware-amd-kmod-sienna-cichlid" + addpkg "gpu-firmware-amd-kmod-sienna-cichlid" ;; 0x163f) - echo "gpu-firmware-amd-kmod-vangogh" + addpkg "gpu-firmware-amd-kmod-vangogh" ;; 0x164d|0x1681) - echo "gpu-firmware-amd-kmod-yellow-carp" + addpkg "gpu-firmware-amd-kmod-yellow-carp" ;; 0x73c*|0x73d*) - echo "gpu-firmware-amd-kmod-navy-flounder" + addpkg "gpu-firmware-amd-kmod-navy-flounder" ;; 0x73e*|0x73f*) - echo "gpu-firmware-amd-kmod-dimgrey-cavefish" + addpkg "gpu-firmware-amd-kmod-dimgrey-cavefish" ;; 0x740*|0x741*) - echo "gpu-firmware-amd-kmod-aldebaran" + addpkg "gpu-firmware-amd-kmod-aldebaran" ;; 0x13fe) - echo "gpu-firmware-amd-kmod-cyan-skillfish2" + addpkg "gpu-firmware-amd-kmod-cyan-skillfish2" ;; 0x742*|0x743*) - echo "gpu-firmware-amd-kmod-beige-goby" + addpkg "gpu-firmware-amd-kmod-beige-goby" ;; esac } diff --git a/usr.sbin/fwget/pci/pci_video_intel b/usr.sbin/fwget/pci/pci_video_intel index 8dc8b9aee2bd..3824c4a49ffb 100644 --- a/usr.sbin/fwget/pci/pci_video_intel +++ b/usr.sbin/fwget/pci/pci_video_intel @@ -29,47 +29,47 @@ pci_video_intel() case "$1" in # Skylake 0x19*) - echo "gpu-firmware-intel-kmod-skylake" + addpkg "gpu-firmware-intel-kmod-skylake" ;; # Broxton 0x0a*|0x1a*|0x5a84|0x5a85) - echo "gpu-firmware-intel-kmod-broxton" + addpkg "gpu-firmware-intel-kmod-broxton" ;; # Geminilake 0x318*) - echo "gpu-firmware-intel-kmod-geminilake" + addpkg "gpu-firmware-intel-kmod-geminilake" ;; # Kabylake, Coffeelake and Cometlake 0x59*|0x87*|0x9b*|0x3e*) - echo "gpu-firmware-intel-kmod-kabylake" + addpkg "gpu-firmware-intel-kmod-kabylake" ;; # Cannonlake 0x5a*) - echo "gpu-firmware-intel-kmod-cannonlake" + addpkg "gpu-firmware-intel-kmod-cannonlake" ;; # Icelake 0x8a*) - echo "gpu-firmware-intel-kmod-icelake" + addpkg "gpu-firmware-intel-kmod-icelake" ;; # Elkhartlake/Jasperlake 0x45*|0x4e*) - echo "gpu-firmware-intel-kmod-elkhartlake" + addpkg "gpu-firmware-intel-kmod-elkhartlake" ;; # Tigerlake 0x9a*) - echo "gpu-firmware-intel-kmod-tigerlake" + addpkg "gpu-firmware-intel-kmod-tigerlake" ;; # Rocketlake (Uses tigerlake GuC/HuC firmware) 0x4c*) - echo "gpu-firmware-intel-kmod-rocketlake gpu-firmware-intel-kmod-tigerlake" + addpkg "gpu-firmware-intel-kmod-rocketlake gpu-firmware-intel-kmod-tigerlake" ;; # DG1 0x49*) - echo "gpu-firmware-intel-kmod-dg1" + addpkg "gpu-firmware-intel-kmod-dg1" ;; # Alderlake (Uses tigerlake GuC/HuC firmware) 0x46*) - echo "gpu-firmware-intel-kmod-alderlake gpu-firmware-intel-kmod-tigerlake" + addpkg "gpu-firmware-intel-kmod-alderlake gpu-firmware-intel-kmod-tigerlake" ;; *) log "No package found for device $1"