Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ A public collection of useful scripts to help manage the Mellanox BlueField
SoC.

Overview of each file:
- **bfacpievt** Config ACPI daemon to handle AUX power mode.
- **bfacpievt** Config ACPI daemon to handle AUX power mode. ***(Not supported on BlueField-4.)***
- **bfbootmgr** Change boot options.
- **bfcfg** Processes a config file passed over the rshim device.
- **bfcpu-freq** Display Arm core frequency.
- **bfdracut** Create an initramfs.
- **bfdracut** Create an initramfs. ***(Not supported on BlueField-4.)***
- **bffamily** Display the BlueField family for the particular board.
- **bfgrubcheck** Checks if default grub password needs to be changed.
- **bfhcafw** Utilities for managing ConnectX interfaces on BlueField.
- **bfhcafw** Utilities for managing ConnectX interfaces on BlueField. ***(Not supported on BlueField-4.)***
- **bfinst** Simple installation script for both the bootloader and a root file
system.
- **bfperf_pmc** Tool for collecting memory statistics..
system. ***(Not supported on BlueField-4.)***
- **bfperf_pmc** Tool for collecting memory statistics. ***(Not supported on BlueField-4.)***
- **bfpxe** PXE boot helper script.
- **bfrec** Force update of the bootloader only.
- **bfrshlog** Write message into the rshim logging buffer.
- **bfrec** Force update of the bootloader only. ***(Not supported on BlueField-4.)***
- **bfrshlog** Write message into the rshim logging buffer. ***(Not supported on BlueField-4.)***
- **bfsbdump** Dump secure boot status information.
- **bfsbkeys** Dump all public keys in ATF.
- **bfsbkeys** Dump all public keys in ATF. ***(Not supported on BlueField-4.)***
- **bfsbverify** Read BFB file from file or device and verify RoTPK and CoT.
- **bftraining_results** Read DDR5 training parameters from ACPI.
- **bfver** Print ATF, UEFI and rootfs versions.
- **bfvcheck** Check whether software versions installed match those in current release.
- **bfver** Print ATF, UEFI and rootfs versions. ***(Not supported on BlueField-4.)***
- **bfvcheck** Check whether software versions installed match those in current release. ***(Not supported on BlueField-4.)***
- **bfvcheck.service** Companion service to bfvcheck, runs bfvcheck at boot time.
- **mlx-mkbfb** Builds and extracts BFB files.
- **bfup** Informs that linux is running via rshlog message and gpio pin
Expand Down
12 changes: 11 additions & 1 deletion bfcfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TMP_DIR=$(mktemp -d)
trap "rm -rf $TMP_DIR" EXIT
trap "rm -rf $TMP_DIR; exit 1" TERM INT

bfcfg_version=4.6
bfcfg_version=4.7
bfcfg_rc=0
cfg_file=/etc/bf.cfg
log_file=/tmp/bfcfg.log
Expand Down Expand Up @@ -1934,6 +1934,16 @@ arm_cfg_get_value()
|| [ "$name" = "PXE_DHCP_CLASS_ID" ] \
|| [ "$name" = "BF_BUNDLE_VERSION" ]; then
value=$(dd if=${in_file} skip=${offset} count=${size} bs=1 2> /dev/null | tr -d '\0')

# For BOOTX_DEVPATH, when converting from binary back to text,
# we need to ESC the backslashes. This is so if we later
# convert that configuration back to binary, the path is
# preserved correctly.
# Example: "\EFI\debian\grubaa64.efi" ==> "\\EFI\\debian\\grubaa64.efi"
if [[ "$name" == "BOOT"*"_DEVPATH" ]]; then
value=${value//\\/\\\\}
fi

if [[ "$name" == "BOOT"*"_DESC" ]] \
|| [[ "$name" == "BOOT"*"_ARGS" ]] \
|| [[ "$name" == "BOOT"*"_DEVPATH" ]]; then
Expand Down
7 changes: 7 additions & 0 deletions bfdracut
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

set -e

#
Expand Down
2 changes: 1 addition & 1 deletion bffamily
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ elif [[ "$bfversion" = "$BF3_PLATFORM_ID" ]]; then
PART_NUMBER=$(lspci -s "$(bfhcafw bus)" -vv | grep PN)

else
echo "Unknown platform"
show_chip
exit 1
fi

Expand Down
7 changes: 7 additions & 0 deletions bfhcafw
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

usage () {
cat >&2 <<EOF
usage: bfhcafw [-h|--help]
Expand Down
7 changes: 7 additions & 0 deletions bfinst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

usage()
{
cat <<EOF
Expand Down
7 changes: 7 additions & 0 deletions bfpart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

usage ()
{
echo "syntax: bfpart [-b MB] [-p MB] [-o]"
Expand Down
12 changes: 12 additions & 0 deletions bfperf_pmc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ from collections import defaultdict
import os

import argparse
import sys
import subprocess
from pathlib import Path


sys_fs_prefix = '/to/be/initialized/'
sys_fs_parent_folder = '/sys/class/hwmon'
Expand Down Expand Up @@ -155,6 +159,14 @@ def pmc_perf_ctrs_collect(set_perf_core, _module2intEvents_ids_dict, _module2ran
def main():
global sys_fs_prefix

bf_chip = subprocess.check_output(["bffamily", "--chip"], text=True).strip()

script_name = Path(sys.argv[0]).name

if bf_chip == "BlueField-4":
print(f"{script_name} is NOT supported for BlueField-4", file=sys.stderr)
return 1

parser = argparse.ArgumentParser(#prog = 'PROG',
description="sysfs access to performance counters in BF3",
epilog = 'Text at the bottom of help')
Expand Down
7 changes: 7 additions & 0 deletions bfrshlog
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

rshlog_path="/sys/devices/platform/MLNXBF04:00/driver/rsh_log"
if [ ! -e "${rshlog_path}" ]; then
rshlog_path="/sys/devices/platform/MLNXBF04:00/rsh_log"
Expand Down
10 changes: 10 additions & 0 deletions bfsbdump
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import struct
import binascii
import os
import sys
import subprocess
from pathlib import Path

LifeCycleState = [ 'Production', 'Secure', 'Non-Secure', 'RMA' ]

Expand Down Expand Up @@ -152,6 +154,14 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Dump BlueField platform secure boot status information.")
options = parser.parse_args()

bf_chip = subprocess.check_output(["bffamily", "--chip"], text=True).strip()

script_name = Path(sys.argv[0]).name

if bf_chip == "BlueField-4":
print(f'{script_name} is NOT supported for BlueField-4', file=sys.stderr)
sys.exit(1)

'''
Initially BfSbStatus EFI variable is created using the EFI Global Variable GUID which
is not platform specific and might cause confusions among variables managed by common
Expand Down
7 changes: 7 additions & 0 deletions bfsbkeys
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

BF1_PLATFORM_ID=0x00000211
BF2_PLATFORM_ID=0x00000214

Expand Down
7 changes: 7 additions & 0 deletions bfsbverify
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

set -e

##############################################################################
Expand Down
7 changes: 7 additions & 0 deletions bfvcheck
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

PROGNAME=bfvcheck

err () {
Expand Down
7 changes: 7 additions & 0 deletions bfver
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.

bf_chip=$(bffamily --chip)

if [ "$bf_chip" = "BlueField-4" ]; then
echo "${0##*/} is NOT supported for BlueField-4" >&2
exit 1
fi

PROGNAME=$(basename "$0")
TMP_DIR=$(mktemp -d)
trap "rm -rf $TMP_DIR" EXIT
Expand Down