diff --git a/usr.sbin/fwget/fwget.sh b/usr.sbin/fwget/fwget.sh index cd5ee7a7048c..63ed020a437c 100644 --- a/usr.sbin/fwget/fwget.sh +++ b/usr.sbin/fwget/fwget.sh @@ -1,110 +1,110 @@ #!/bin/sh #- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# SPDX-License-Identifier: BSD-2-Clause # # Copyright 2023 Beckhoff Automation GmbH & Co. KG # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing 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 ``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 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. : ${LIBEXEC_PATH:="/usr/libexec/fwget"} usage() { cat <&1 4>&2 } log() { echo $@ 1>&3 } log_verbose() { if [ "${VERBOSE}" = "n" ]; then return fi echo $@ 1>&3 } DRY_RUN=n VERBOSE=n log_start while [ $# -gt 0 ]; do case $1 in -n) DRY_RUN=y ;; -v) VERBOSE=y ;; *) subsystems="${subsystems} $1" ;; esac shift done # Default searching PCI subsystem if [ -z "${subsystems}" ]; then subsystems="pci" fi # Fail early on unsupported subsystem for subsystem in ${subsystems}; do if [ ! -f ${LIBEXEC_PATH}/${subsystem} ]; then usage fi . ${LIBEXEC_PATH}/${subsystem} done packages="" for subsystem in ${subsystems}; do package=$(${subsystem}_search_packages) packages="${packages} ${package}" done echo "Needed packages: ${packages}" if [ "${DRY_RUN}" = "y" ]; then exit 0 fi pkg install -q ${package} diff --git a/usr.sbin/fwget/pci/pci b/usr.sbin/fwget/pci/pci index f97cb97d16fe..b30aae4fadb8 100644 --- a/usr.sbin/fwget/pci/pci +++ b/usr.sbin/fwget/pci/pci @@ -1,84 +1,84 @@ #- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# SPDX-License-Identifier: BSD-2-Clause # # Copyright 2023 Beckhoff Automation GmbH & Co. KG # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing 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 ``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 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. pci_get_class() { local hexclass=$(echo $1 | sed 's/.*class=\(0x[0-9a-z]*\).*/\1/') case "${hexclass}" in 0x030000) echo "video" ;; esac } pci_get_vendor() { local hexvendor=$(echo $1 | sed 's/.*\ vendor=\(0x[0-9a-z]*\).*/\1/') case "${hexvendor}" in 0x8086) echo "intel" ;; 0x1002) echo "amd" ;; esac } pci_get_device() { local hexdevice=$(echo $1 | sed 's/.*\ device=\(0x[0-9a-z]*\).*/\1/') echo ${hexdevice} } pci_search_packages() { local IFS oldifs=$IFS IFS=$'\n' for fulldevice in $(pciconf -l); do class=$(pci_get_class "${fulldevice}") if [ -z "${class}" ]; then continue fi vendor=$(pci_get_vendor "${fulldevice}") if [ -z "${vendor}" ]; then continue fi device=$(pci_get_device "${fulldevice}") log_verbose "Trying to match device ${device} in class ${class} and vendor ${vendor} with pci_${class}_${vendor}" 1>&3 if [ ! -f ${LIBEXEC_PATH}/pci_${class}_${vendor} ]; then continue fi . ${LIBEXEC_PATH}/pci_${class}_${vendor} pci_${class}_${vendor} ${device} done IFS=${oldifs} } diff --git a/usr.sbin/fwget/pci/pci_video_amd b/usr.sbin/fwget/pci/pci_video_amd index 79f79d4958db..4afb44ed787e 100644 --- a/usr.sbin/fwget/pci/pci_video_amd +++ b/usr.sbin/fwget/pci/pci_video_amd @@ -1,139 +1,139 @@ #- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# SPDX-License-Identifier: BSD-2-Clause # # Copyright 2023 Beckhoff Automation GmbH & Co. KG # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing 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 ``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 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. pci_video_amd() { case "$1" in 0x678*|0x679*) echo "gpu-firmware-amd-kmod-tahiti" ;; 0x680*|0x681*) echo "gpu-firmware-amd-kmod-pitcairn" ;; 0x660*|0x661*|0x662*|0x663*) echo "gpu-firmware-amd-kmod-oland" ;; 0x682*|0x683*) echo "gpu-firmware-amd-kmod-verde gpu-firmware-amd-kmod-si58" ;; 0x666*) echo "gpu-firmware-amd-kmod-hainan" ;; 0x13*) echo "gpu-firmware-amd-kmod-kaveri" ;; 0x664*|0x664*) echo "gpu-firmware-amd-kmod-bonaire" ;; 0x67a*|0x67b*) echo "gpu-firmware-amd-kmod-hawaii" ;; 0x983*) echo "gpu-firmware-amd-kmod-kabini" ;; 0x985*) echo "gpu-firmware-amd-kmod-mullins" ;; 0x690*) echo "gpu-firmware-amd-kmod-topaz" ;; 0x692*|0x693*) echo "gpu-firmware-amd-kmod-tonga" ;; 0x730*) echo "gpu-firmware-amd-kmod-fiji" ;; 0x987*) echo "gpu-firmware-amd-kmod-carrizo" ;; 0x98e4*) echo "gpu-firmware-amd-kmod-stoney" ;; 0x67e*|0x67ff) echo "gpu-firmware-amd-kmod-polaris11" ;; 0x67c*|0x67d*|0x6fdf) echo "gpu-firmware-amd-kmod-polaris10" ;; 0x698*|0x699*) echo "gpu-firmware-amd-kmod-polaris12" ;; 0x694*) echo "gpu-firmware-amd-kmod-vegam" ;; 0x686*|0x687*) echo "gpu-firmware-amd-kmod-vega10" ;; 0x69a*) echo "gpu-firmware-amd-kmod-vega12" ;; 0x66a*) echo "gpu-firmware-amd-kmod-vega20" ;; 0x15d*) echo "gpu-firmware-amd-kmod-raven" ;; 0x738*|0x739*) echo "gpu-firmware-amd-kmod-arcturus" ;; 0x731*) echo "gpu-firmware-amd-kmod-navi10" ;; 0x734*) echo "gpu-firmware-amd-kmod-navi14" ;; 0x15e7|0x1636|0x1638|0x164c) echo "gpu-firmware-amd-kmod-renoir" ;; 0x736*) echo "gpu-firmware-amd-kmod-navi12" ;; 0x73a*|0x73b*) echo "gpu-firmware-amd-kmod-sienna-cichlid" ;; 0x163f) echo "gpu-firmware-amd-kmod-vangogh" ;; 0x164d|0x1681) echo "gpu-firmware-amd-kmod-yellow-carp" ;; 0x73c*|0x73d*) echo "gpu-firmware-amd-kmod-navy-flounder" ;; 0x73e*|0x73f*) echo "gpu-firmware-amd-kmod-dimgrey-cavefish" ;; 0x740*|0x741*) echo "gpu-firmware-amd-kmod-aldebaran" ;; 0x13fe) echo "gpu-firmware-amd-kmod-cyan-skillfish2" ;; 0x742*|0x743*) echo "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 3d37a430c3d2..8dc8b9aee2bd 100644 --- a/usr.sbin/fwget/pci/pci_video_intel +++ b/usr.sbin/fwget/pci/pci_video_intel @@ -1,78 +1,78 @@ #- -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# SPDX-License-Identifier: BSD-2-Clause # # Copyright 2023 Beckhoff Automation GmbH & Co. KG # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing 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 ``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 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. pci_video_intel() { case "$1" in # Skylake 0x19*) echo "gpu-firmware-intel-kmod-skylake" ;; # Broxton 0x0a*|0x1a*|0x5a84|0x5a85) echo "gpu-firmware-intel-kmod-broxton" ;; # Geminilake 0x318*) echo "gpu-firmware-intel-kmod-geminilake" ;; # Kabylake, Coffeelake and Cometlake 0x59*|0x87*|0x9b*|0x3e*) echo "gpu-firmware-intel-kmod-kabylake" ;; # Cannonlake 0x5a*) echo "gpu-firmware-intel-kmod-cannonlake" ;; # Icelake 0x8a*) echo "gpu-firmware-intel-kmod-icelake" ;; # Elkhartlake/Jasperlake 0x45*|0x4e*) echo "gpu-firmware-intel-kmod-elkhartlake" ;; # Tigerlake 0x9a*) echo "gpu-firmware-intel-kmod-tigerlake" ;; # Rocketlake (Uses tigerlake GuC/HuC firmware) 0x4c*) echo "gpu-firmware-intel-kmod-rocketlake gpu-firmware-intel-kmod-tigerlake" ;; # DG1 0x49*) echo "gpu-firmware-intel-kmod-dg1" ;; # Alderlake (Uses tigerlake GuC/HuC firmware) 0x46*) echo "gpu-firmware-intel-kmod-alderlake gpu-firmware-intel-kmod-tigerlake" ;; *) log "No package found for device $1" ;; esac }