Skip to content

Commit

Permalink
fw_util: add DARWIN48V platform support (#265)
Browse files Browse the repository at this point in the history
Summary:
# Description

Adds initial `fw_util` support for `DARWIN48V` platform. The config is mostly the same as `DARWIN`, with the one deviation being that we now support upgrading the `sc_scd` target via `flashrom` using the `scd-spi` driver (similar to `MERU800BIA` platform).

Pull Request resolved: #265

Test Plan:
FBOSS OSS build passes with CentOS 9 and Linux kernel 6.4.

Validated on DARWIN48V hardware with all targets.

```
# fw_util --config_file=/opt/fboss/share/platform_configs/fw_util.json --fw_action=version --fw_target_name=bios
I0905 18:02:16.545376  6389 ConfigLib.cpp:48] Using config file: /opt/fboss/share/platform_configs/fw_util.json
bios : 7.5.2
# fw_util --config_file=/opt/fboss/share/platform_configs/fw_util.json --fw_action=version --fw_target_name=cpu_cpld
I0905 18:02:24.277890  6394 ConfigLib.cpp:48] Using config file: /opt/fboss/share/platform_configs/fw_util.json
cpu_cpld : 22.37
# fw_util --config_file=/opt/fboss/share/platform_configs/fw_util.json --fw_action=version --fw_target_name=sc_cpld
I0905 18:02:29.067325  6398 ConfigLib.cpp:48] Using config file: /opt/fboss/share/platform_configs/fw_util.json
sc_cpld : 13.7
# fw_util --config_file=/opt/fboss/share/platform_configs/fw_util.json --fw_action=version --fw_target_name=sc_scd
I0905 18:02:34.329194  6406 ConfigLib.cpp:48] Using config file: /opt/fboss/share/platform_configs/fw_util.json
sc_scd : 14.6
# fw_util --config_file=/opt/fboss/share/platform_configs/fw_util.json --fw_action=version --fw_target_name=sc_sat_cpld0
I0905 18:02:40.057369  6410 ConfigLib.cpp:48] Using config file: /opt/fboss/share/platform_configs/fw_util.json
sc_sat_cpld0 : 5.0
# fw_util --config_file=/opt/fboss/share/platform_configs/fw_util.json --fw_action=version --fw_target_name=sc_sat_cpld1
I0905 18:02:43.650451  6414 ConfigLib.cpp:48] Using config file: /opt/fboss/share/platform_configs/fw_util.json
sc_sat_cpld1 : 5.0
# fw_util --config_file=/opt/fboss/share/platform_configs/fw_util.json --fw_action=version --fw_target_name=fan_cpld
I0905 18:02:48.332357  6418 ConfigLib.cpp:48] Using config file: /opt/fboss/share/platform_configs/fw_util.json
fan_cpld : 4.0
```

Reviewed By: Scott8440

Differential Revision: D64087852

Pulled By: joancaneus

fbshipit-source-id: a4cd89a8bdfda1f3f3b9e697b5ef4de4d79c7289
  • Loading branch information
adamcalabrigo authored and facebook-github-bot committed Dec 4, 2024
1 parent b22f0db commit c645744
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions fboss/platform/configs/darwin48v/fw_util.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"fwConfigs" : {
"bios" : {
"preUpgradeCmd" : "printf 'A00000:FFFFFF normal\n400000:9EFFFF fallback\n9FA000:9FEFFF aboot_conf\n000000:FFFFFF total\n001000:01EFFF prefdl' > /home/bios_spi_layout;flashrom -p internal 2>&1 > /home/flashrom-output.txt; grep -w 'MX25L12805D' /home/flashrom-output.txt && echo 'MX25L12805D' > /home/chip.txt || grep 'N25Q128..3E' /home/flashrom-output.txt && echo 'N25Q128..3E' > /home/chip.txt || echo '****** error finding chip ****** ...'",
"getVersionCmd" : "cat /sys/devices/virtual/dmi/id/bios_version | cut -d ':' -f 2 | cut -d '-' -f 3",
"priority" : 1,
"upgradeCmd" : "chip=$(head -n 1 /home/chip.txt); bios_filename=$(head -n 1 /home/bios_filename.txt); flashrom -p internal -c $chip -l /home/bios_spi_layout -i normal -i fallback -i aboot_conf --noverify-all -w $bios_filename",
"postUpgradeCmd" : "chip=$(head -n 1 /home/chip.txt); bios_filename=$(head -n 1 /home/bios_filename.txt); flashrom -p internal -c $chip -l /home/bios_spi_layout -i normal -i fallback -i aboot_conf --noverify-all -v $bios_filename",
"verifyFwCmd" : "chip=$(head -n 1 /home/chip.txt); bios_filename=$(head -n 1 /home/bios_filename.txt); flashrom -p internal -c $chip -l /home/bios_spi_layout -i normal -i fallback -i aboot_conf --noverify-all -v $bios_filename",
"readFwCmd" : "chip=$(head -n 1 /home/chip.txt); bios_filename=$(head -n 1 /home/bios_filename.txt); flashrom -p internal -c $chip -l /home/bios_spi_layout -i normal -i fallback -i aboot_conf --noverify-all -r $bios_filename",
"sha1sum" : "f821367de316fdcd28bdaae64a83d9d0876aeebe"
},
"cpu_cpld" : {
"preUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x00",
"getVersionCmd" : "cpu_cpld_ver=$((`cat /sys/bus/pci/drivers/scd/0000:ff:0b.3/fpga_ver`));cpu_cpld_subver=$((`cat /sys/bus/pci/drivers/scd/0000:ff:0b.3/fpga_sub_ver`));echo $cpu_cpld_ver'.'$cpu_cpld_subver",
"priority" : 2,
"upgradeCmd" : "cpu_cpld_filename=$(head -n 1 /home/cpu_cpld_filename.txt);jam -aprogram -fcpu_cpld -v $cpu_cpld_filename",
"postUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x00",
"sha1sum" : "98ecb2d427085eda47a580144a622dfe8aa0c1ce"
},
"sc_cpld" : {
"preUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x00",
"getVersionCmd" : "sc_cpld_ver=$((`cat /sys/bus/i2c/drivers/blackhawk-cpld/*/cpld_ver | head -1`));sc_cpld_subver=$((`cat /sys/bus/i2c/drivers/blackhawk-cpld/*/cpld_sub_ver | head -1`));echo $sc_cpld_ver'.'$sc_cpld_subver",
"priority" : 7,
"upgradeCmd" : "sc_cpld_filename=$(head -n 1 /home/sc_cpld_filename.txt);jam -aprogram -fsc_cpld -v $sc_cpld_filename",
"postUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x00",
"sha1sum" : "3729a09b9b83359b5b273f0fe59fb4fe9ff3dc71"
},
"sc_scd" : {
"preUpgradeCmd" : "modprobe spidev;fpga_spidev=$(echo $(ls /run/devmap/fpgas/SCD_FPGA/*spi*/spi_master/spi* | grep spi*.*) | cut -c 4-);echo 'spidev' > /sys/bus/spi/devices/spi$fpga_spidev/driver_override;echo spi$fpga_spidev > /sys/bus/spi/drivers/spidev/bind;flashrom -p linux_spi:dev=/dev/spidev$fpga_spidev > /home/flashrom_output;(grep 'MX25L1606E' /home/flashrom_output && echo 'MX25L1605A/MX25L1606E/MX25L1608E' > /home/flash_chip_name) || echo 'NONE' > /home/flash_chip_name",
"getVersionCmd" : "sc_scd_ver=$((`cat /run/devmap/fpgas/SCD_FPGA/fpga_ver`));sc_scd_subver=$((`cat /run/devmap/fpgas/SCD_FPGA/fpga_sub_ver`));echo $sc_scd_ver'.'$sc_scd_subver",
"priority" : 3,
"upgradeCmd" : "sc_scd_binary_name=$(head -n 1 /home/sc_scd_filename.txt);fpga_spidev=$(echo $(ls /run/devmap/fpgas/SCD_FPGA/*spi*/spi_master/spi* | grep spi*.*) | cut -c 4-);chip=$(head -n 1 /home/flash_chip_name);if [ $chip = 'NONE' ];then cmd_chip_option='' cmd_chip_name='';else cmd_chip_option='-c' cmd_chip_name=$chip;fi;flashrom -p linux_spi:dev=/dev/spidev$fpga_spidev $cmd_chip_option $cmd_chip_name -w $sc_scd_binary_name",
"postUpgradeCmd" : "rm /home/flash_chip_name",
"sha1sum" : "c5a6bf5c64371971103a2e31a1dded2fc7ecb1ca"
},
"sc_sat_cpld0" : {
"preUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x02",
"getVersionCmd" : "sat0_cpld_ver=$((`cat /sys/bus/pci/devices/0000:07:00.0/sat0_cpld_ver`));sat0_cpld_subver=$((`cat /sys/bus/pci/devices/0000:07:00.0/sat0_cpld_sub_ver`));echo $sat0_cpld_ver'.'$sat0_cpld_subver",
"priority" : 4,
"upgradeCmd" : "sc_sat_cpld0_filename=$(head -n 1 /home/sc_sat_cpld0_filename.txt);jam -aprogram -fsc_sat_cpld -v $sc_sat_cpld0_filename",
"postUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x00",
"sha1sum" : "faf75ec07bf6a974a921622dfed253a5712f3a11"
},
"sc_sat_cpld1" : {
"preUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x04",
"getVersionCmd" : "sat1_cpld_ver=$((`cat /sys/bus/pci/devices/0000:07:00.0/sat1_cpld_ver`));sat1_cpld_subver=$((`cat /sys/bus/pci/devices/0000:07:00.0/sat1_cpld_sub_ver`));echo $sat1_cpld_ver'.'$sat1_cpld_subver",
"priority" : 5,
"upgradeCmd" : "sc_sat_cpld1_filename=$(head -n 1 /home/sc_sat_cpld1_filename.txt);jam -aprogram -fsc_sat_cpld -v $sc_sat_cpld1_filename",
"postUpgradeCmd" : "scBus=$(i2cdetect -l | grep '0000:ff:0b.3 SMBus master 2 bus 0' | cut -d '-' -f 2 | grep -o '^[0-9]*');i2cset -f -y $scBus 0x23 0x0c 0x00",
"sha1sum" : "faf75ec07bf6a974a921622dfed253a5712f3a11"
},
"fan_cpld" : {
"getVersionCmd" : "fanCpld_ver=$((`cat /sys/bus/i2c/drivers/rook-fan-cpld/*/*/*/cpld_ver`));fanCpld_subver=$((`cat /sys/bus/i2c/drivers/rook-fan-cpld/*/*/*/cpld_sub_ver`));echo $fanCpld_ver'.'$fanCpld_subver",
"priority" : 6
}
}
}

0 comments on commit c645744

Please sign in to comment.