Skip to content

Commit

Permalink
hw-mgmt: devtree: Add support for Based Management Borad device table…
Browse files Browse the repository at this point in the history
… parsing

Add new CPU type ARMv7 / Aspeed 2600.
Add configuration for BMC card.

Signed-off-by: Vadim Pasternak <[email protected]>
  • Loading branch information
vadimp-nvidia committed Nov 19, 2024
1 parent b2cdfe9 commit d3376ea
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
4 changes: 2 additions & 2 deletions usr/usr/bin/hw-management-devtree-check.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
################################################################################
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -141,7 +141,7 @@ devtr_sim_environment_vars()
fi

if [[ -z "${DT_SYS_SKU}" ]]; then
sku=$(< /sys/devices/virtual/dmi/id/product_sku)
sku=$(< $sku_file)
else
sku="${DT_SYS_SKU}"
fi
Expand Down
45 changes: 44 additions & 1 deletion usr/usr/bin/hw-management-devtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ declare -A comex_amd_snw_alternatives=(["mp2855_0"]="mp2855 0x69 15 comex_voltmo
["24c128_0"]="24c128 0x50 16 cpu_info" \
["24c512_0"]="24c512 0x50 16 cpu_info")

declare -A bmc_comex_amd_snw_alternatives=(["mp2855_0"]="mp2855 0x69 17 comex_voltmon1" \
["mp2975_1"]="mp2975 0x6a 17 comex_voltmon2")

declare -A mqm8700_alternatives=(["max11603_0"]="max11603 0x64 5 swb_a2d" \
["tps53679_0"]="tps53679 0x70 5 voltmon1" \
["tps53679_1"]="tps53679 0x71 5 voltmon2" \
Expand Down Expand Up @@ -264,6 +267,9 @@ declare -A sn4280_alternatives=(["max11603_0"]="max11603 0x6d 5 swb_a2d" \
declare -A n5110ld_platform_alternatives=(["adt75_0"]="adt75 0x49 6 mng_amb" \
["emc1412_0"]="emc1403 0x4C 6 fpga")

declare -A bmc_n5110ld_platform_alternatives=(["adt75_0"]="adt75 0x49 20 mng_amb" \
["emc1412_0"]="emc1403 0x4c 20 fpga")

declare -A n5110ld_swb_alternatives=(["mp2891_0"]="mp2891 0x66 5 voltmon1" \
["mp2891_1"]="mp2891 0x68 5 voltmon2" \
["mp2891_2"]="mp2891 0x6c 5 voltmon3" \
Expand All @@ -284,6 +290,25 @@ declare -A n5110ld_swb_alternatives=(["mp2891_0"]="mp2891 0x66 5 voltmon1" \
["stts751_1"]="stts751 0x4b 7 swb_asic2" \
["24c512_0"]="24c512 0x51 11 swb_info")

declare -A bmc_n5110ld_swb_alternatives=(["mp2891_0"]="mp2891 0x66 17 voltmon1" \
["mp2891_1"]="mp2891 0x68 17 voltmon2" \
["mp2891_2"]="mp2891 0x6c 17 voltmon3" \
["mp2891_3"]="mp2891 0x66 19 voltmon4" \
["mp2891_4"]="mp2891 0x68 19 voltmon5" \
["mp2891_5"]="mp2891 0x6c 19 voltmon6" \
["xdpe1a2g7_0"]="xdpe1a2g7 0x66 17 voltmon1" \
["xdpe1a2g7_1"]="xdpe1a2g7 0x68 17 voltmon2" \
["xdpe1a2g7_2"]="xdpe1a2g7 0x6c 17 voltmon3" \
["xdpe1a2g7_3"]="xdpe1a2g7 0x66 19 voltmon4" \
["xdpe1a2g7_4"]="xdpe1a2g7 0x68 19 voltmon5" \
["xdpe1a2g7_5"]="xdpe1a2g7 0x6c 19 voltmon6" \
["adt75_0"]="adt75 0x4a 21 swb_asic1" \
["adt75_1"]="adt75 0x4b 21 swb_asic2" \
["tmp102_0"]="tmp102 0x4a 21 swb_asic1" \
["tmp102_1"]="tmp102 0x4b 21 swb_asic2" \
["stts751_0"]="stts751 0x4a 21 swb_asic1" \
["stts751_1"]="stts751 0x4b 21 swb_asic2")

# Old connection table assumes that Fan amb temp sensors is located on main/switch board.
# Actually it's located on fan board and in this way it will be passed through SMBIOS
# string generated from Agile settings. Thus, declare also Fan board alternatives.
Expand Down Expand Up @@ -338,6 +363,15 @@ declare -A pwr_type3_alternatives=(["pmbus_0"]="pmbus 0x10 4 pwr_conv1" \
["lm5066_0"]="lm5066 0x16 4 pdb_hotswap1" \
["24c512_0"]="24c512 0x51 4 pdb_eeprom")

declare -A bmc_pwr_type3_alternatives=(["pmbus_0"]="pmbus 0x10 18 pwr_conv1" \
["raa228000_0"]="raa228000 0x60 18 pwr_conv1" \
["pmbus_1"]="pmbus 0x11 18 pwr_conv2" \
["raa228000_1"]="raa228000 0x61 18 pwr_conv2" \
["pmbus_2"]="pmbus 0x13 18 pwr_conv3" \
["pmbus_3"]="pmbus 0x15 18 pwr_conv4" \
["lm5066_0"]="lm5066 0x16 18 pdb_hotswap1" \
["24c512_0"]="24c512 0x51 18 pdb_eeprom")

declare -A platform_type0_alternatives=(["max11603_0"]="max11603 0x6d 15 carrier_a2d" \
["lm75_0"]="lm75 0x49 17 fan_amb" \
["tmp75_0"]="tmp75 0x49 7 fan_amb")
Expand Down Expand Up @@ -675,8 +709,17 @@ devtr_check_board_components()
local board_name_pfx=
local board_type=static
# local board_addr_offset=0
local comp_arr

local comp_arr=($(echo "$board_str" | fold -w2))
case $cpu_type in
$ARMv7_CPU)
# busybox fold version.
local comp_arr=($(echo "$board_str" | fold -2))
;;
*)
local comp_arr=($(echo "$board_str" | fold -w2))
;;
esac

local board_key=${comp_arr[0]:0:1}
local board_name=${board_arr[$board_key]}
Expand Down
16 changes: 12 additions & 4 deletions usr/usr/bin/hw-management-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ bin_path=$hw_management_path/bin
dynamic_boards_path=$config_path/dynamic_boards
udev_ready=$hw_management_path/.udev_ready
LOCKFILE="/var/run/hw-management-chassis.lock"
board_type_file=/sys/devices/virtual/dmi/id/board_name
sku_file=/sys/devices/virtual/dmi/id/product_sku
system_ver_file=/sys/devices/virtual/dmi/id/product_version
if [ -d /sys/devices/virtual/dmi/id ]; then
board_type_file=/sys/devices/virtual/dmi/id/board_name
sku_file=/sys/devices/virtual/dmi/id/product_sku
system_ver_file=/sys/devices/virtual/dmi/id/product_version
else
board_type_file=/var/run/hw-management/config/pn
sku_file=/var/run/hw-management/config/hid
system_ver_file=/var/run/hw-management/config/bom
fi
pn_file=/sys/devices/virtual/dmi/id/product_name
devtree_file=$config_path/devtree
dpu2host_events_file=$config_path/dpu_to_host_events
Expand Down Expand Up @@ -121,13 +127,15 @@ device_connect_delay=0.2
# DNV - Denverton
# BF3 - BlueField-3
# AMD_SNW - AMD Snow Owl - EPYC Embedded 3000
# ARMv7 - Aspeed 2600
IVB_CPU=0x63A
RNG_CPU=0x64D
BDW_CPU=0x656
CFL_CPU=0x69E
DNV_CPU=0x65F
BF3_CPU=0xD42
AMD_SNW_CPU=0x171
ARMv7_CPU=0xC07
amd_snw_i2c_sodimm_dev=/sys/devices/platform/AMDI0010:02
n5110_mctp_bus="0"
n5110_mctp_addr="1040"
Expand Down Expand Up @@ -155,7 +163,7 @@ check_cpu_type()
cpu_pn=$(grep -m1 "CPU part" /proc/cpuinfo | awk '{print $4}')
cpu_pn=`echo $cpu_pn | cut -c 3- | tr a-z A-Z`
cpu_pn=0x$cpu_pn
if [ "$cpu_pn" == "$BF3_CPU" ]; then
if [ "$cpu_pn" == "$BF3_CPU" ] || [ "$cpu_pn" == "$ARMv7_CPU" ]; then
cpu_type=$cpu_pn
echo $cpu_type > $config_path/cpu_type
return 0
Expand Down

0 comments on commit d3376ea

Please sign in to comment.