Skip to content

Commit 37c378e

Browse files
committed
Merge branch 'master' into V.7.0040.4000_BR
2 parents dca6576 + aee4665 commit 37c378e

File tree

7 files changed

+154
-36
lines changed

7 files changed

+154
-36
lines changed

debian/changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
hw-management (1.mlnx.7.0040.3937) unstable; urgency=low
1+
hw-management (1.mlnx.7.0040.3936) unstable; urgency=low
22
[ MLNX ]
33

4-
-- NBU BSP <[email protected]> Tue, 13 Mar 2025 16:00:00 +030
4+
-- NBU BSP <[email protected]> Tue, 06 Mar 2025 16:00:00 +030

usr/etc/hw-management-sensors/sn5640_sensors.conf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ chip "dps460-i2c-*-58"
402402
ignore fan3
403403
label fan1 "PSU-2(L) Fan 1"
404404
label temp1 "PSU-2(L) Temp 1"
405-
label temp2 "PSU-2(R) Temp 2"
405+
label temp2 "PSU-2(L) Temp 2"
406406
label temp3 "PSU-2(L) Temp 3"
407407
label power1 "PSU-2(L) 220V Rail Pwr (in)"
408408
label power2 "PSU-2(L) 12V Rail Pwr (out)"
@@ -440,6 +440,19 @@ chip "dps460-i2c-*-5a"
440440
label curr2 "PSU-4(R) 12V Rail Curr (out)"
441441
set power2_cap 0
442442

443+
# Chassis fans
444+
chip "mlxreg_fan-isa-*"
445+
label fan1 "Chassis Fan Drawer-1 Tach 1"
446+
label fan2 "Chassis Fan Drawer-1 Tach 2"
447+
label fan3 "Chassis Fan Drawer-2 Tach 1"
448+
label fan4 "Chassis Fan Drawer-2 Tach 2"
449+
label fan5 "Chassis Fan Drawer-3 Tach 1"
450+
label fan6 "Chassis Fan Drawer-3 Tach 2"
451+
label fan7 "Chassis Fan Drawer-4 Tach 1"
452+
label fan8 "Chassis Fan Drawer-4 Tach 2"
453+
label fan9 "Chassis Fan Drawer-5 Tach 1"
454+
label fan10 "Chassis Fan Drawer-5 Tach 2"
455+
443456
# AMD Comex Power controllers
444457
chip "mp2855-i2c-*-69"
445458
label in1 "PMIC-12 COMEX (in) VDDCR INPUT VOLT"

usr/usr/bin/hw-management-chassis-events.sh

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,46 @@ function set_fan_direction()
507507
esac
508508
}
509509

510+
511+
# Get FAN direction based on VPD PN field
512+
#
513+
# Input parameters:
514+
# 1 - "$vpd_file"
515+
# Return FAN direction
516+
# 0 - Reverse (C2P)
517+
# 1 - Forward(P2C)
518+
# 2 - unknown (read error or field missing)
519+
get_fan_direction_by_vpd()
520+
{
521+
vpd_file=$1
522+
# Default dir "unknown" till it will not be detected later
523+
dir=2
524+
pn=$(grep PN: $vpd_file | grep -oE "[^ ]+$")
525+
if [ -z $pn ]; then
526+
if [ -f $config_path/fixed_fans_dir ]; then
527+
dir=$(< $config_path/fixed_fans_dir)
528+
fi
529+
else
530+
dir_char=""
531+
if [ ! ${sys_fandir_vs_pn[$pn]}_ = _ ]; then
532+
dir_char=${sys_fandir_vs_pn[$pn]}
533+
else
534+
PN_REGEXP="MTEF-FAN([R,F])"
535+
536+
[[ $pn =~ $PN_REGEXP ]]
537+
if [[ ! -z "${BASH_REMATCH[1]}" ]]; then
538+
dir_char="${BASH_REMATCH[1]}"
539+
fi
540+
fi
541+
if [ $dir_char == "R" ]; then
542+
dir=0
543+
elif [ $dir_char == "F" ]; then
544+
dir=1
545+
fi
546+
fi
547+
return $dir
548+
}
549+
510550
function set_fpga_combined_version()
511551
{
512552
path="$1"
@@ -1179,31 +1219,17 @@ if [ "$1" == "add" ]; then
11791219
if [[ $sku == "HI138" ]] || [[ $sku == "HI139" ]]; then
11801220
exit 0
11811221
fi
1182-
# Replace "_info" to "_data" in eeprom name.
1183-
eeprom_vpd_filename=${eeprom_name/"_info"/"_data"}
1184-
hw-management-vpd-parser.py -t MLNX_FAN_VPD -i $eeprom_path/$eeprom_name -o $eeprom_path/$eeprom_vpd_filename
1222+
fan_prefix=$(echo $eeprom_name | cut -d_ -f1)
11851223
if [ "$board_type" == "VMOD0014" ]; then
1186-
fan_dir_offset=0x8
1224+
hw-management-vpd-parser.py -t FIXED_FIELD_FAN_VPD -i $eeprom_path/$eeprom_name -o $eeprom_path/"$fan_prefix"_data
11871225
else
1188-
fan_dir_offset=$fan_dir_offset_in_vpd_eeprom_pn
1189-
fi
1190-
# We need to read FAN direction from eeprom if cpld fan direction exists
1191-
if [[ ! -f $system_path/fan_dir ]] || [[ "$sku" == "HI117" ]]; then
1192-
fan_direction=$(xxd -u -p -l 1 -s $fan_dir_offset $eeprom_path/$eeprom_name)
1193-
fan_prefix=$(echo $eeprom_name | cut -d_ -f1)
1194-
case $fan_direction in
1195-
$fan_direction_exhaust)
1196-
echo 1 > $thermal_path/"${fan_prefix}"_dir
1197-
;;
1198-
$fan_direction_intake)
1199-
echo 0 > $thermal_path/"${fan_prefix}"_dir
1200-
;;
1201-
*)
1202-
# Unknown FAN dir
1203-
echo 2 > $thermal_path/"${fan_prefix}"_dir
1204-
;;
1205-
esac
1226+
hw-management-vpd-parser.py -t MLNX_FAN_VPD -i $eeprom_path/$eeprom_name -o $eeprom_path/"$fan_prefix"_data
12061227
fi
1228+
# Get PSU FAN direction
1229+
set -x
1230+
exec 3>&1 4>&2 >>/tmp/log 2>&1
1231+
get_fan_direction_by_vpd $eeprom_path/"$fan_prefix"_data
1232+
echo $? > $thermal_path/"${fan_prefix}"_dir
12071233
;;
12081234
vpd_info)
12091235
hw-management-vpd-parser.py -t SYSTEM_VPD -i "$eeprom_path/$eeprom_name" -o "$eeprom_path"/vpd_data

usr/usr/bin/hw-management-helpers.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ declare -A psu_fandir_vs_pn=(["00KX1W"]=R ["00MP582"]=F ["00MP592"]=R ["00WT061"
109109

110110
declare -A psu_type_vs_eeprom=( ["FSP016-9G0G"]="24c02" ["FSP017-9G0G"]="24c02" )
111111

112+
declare -A sys_fandir_vs_pn=(["00MP584"]=F ["00MP594"]=R ["00MP593"]=R \
113+
["841987-001"]=F ["841988-001"]=R )
114+
112115
base_cpu_bus_offset=10
113116
max_tachos=20
114117
i2c_asic_bus_default=2

usr/usr/bin/hw-management-thermal-events.sh

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,33 @@ if [ "$1" == "add" ]; then
289289
find_i2c_bus
290290
i2c_comex_mon_bus_default=$(< $i2c_comex_mon_bus_default_file)
291291
comex_bus=$((i2c_comex_mon_bus_default+i2c_bus_offset))
292-
# Verify if this is ASIC sensor
293-
asic_bus=$((i2c_asic_bus_default+i2c_bus_offset))
294292
if [ -f $config_path/cx_default_i2c_bus ]; then
295293
cx_i2c_bus=$(< $config_path/cx_default_i2c_bus)
296294
cx_i2c_bus=$((cx_i2c_bus+i2c_bus_offset))
297295
fi
298296
busdir=$(echo "$3""$4" |xargs dirname |xargs dirname)
299297
busfolder=$(basename "$busdir")
300298
bus="${busfolder:0:${#busfolder}-5}"
299+
# Verify if this is ASIC sensor
300+
if [ ! -f "$config_path/asic_num" ]; then
301+
asic_num=1
302+
else
303+
asic_num=$(< $config_path/asic_num)
304+
fi
305+
for ((i=1; i<=asic_num; i+=1)); do
306+
asic_i2c_bus_id=$(< $config_path/asic"$i"_i2c_bus_id)
307+
asic_bus=$((asic_i2c_bus_id+i2c_bus_offset))
308+
if [ "$bus" == "$asic_bus" ]; then
309+
exit 0
310+
fi
311+
done
312+
301313
if [ "$bus" == "$comex_bus" ]; then
302314
if [ $2 == cx_amb ]; then
303315
check_n_link "$3""$4"/temp2_input $thermal_path/cx_amb
304316
else
305317
check_n_link "$3""$4"/temp1_input $thermal_path/comex_amb
306318
fi
307-
elif [ "$bus" == "$asic_bus" ]; then
308-
exit 0
309319
elif [ $bus -eq $cx_i2c_bus ]; then
310320
check_n_link "$3""$4"/temp2_input $thermal_path/cx_amb
311321
else
@@ -897,8 +907,7 @@ if [ "$1" == "add" ]; then
897907
sleep 1
898908
# Set I2C bus for psu
899909
echo "$bus" > $config_path/"$psu_name"_i2c_bus
900-
# Set default fan speed
901-
psu_set_fan_speed "$psu_name" $(< $fan_psu_default)
910+
902911
# Add thermal attributes
903912
check_n_link "$5""$3"/temp1_input $thermal_path/"$psu_name"_temp1
904913
check_n_link "$5""$3"/temp1_max $thermal_path/"$psu_name"_temp1_max
@@ -1046,6 +1055,12 @@ if [ "$1" == "add" ]; then
10461055
# PSU FW VER
10471056
mfr=$(grep MFR_NAME $eeprom_path/"$psu_name"_vpd | awk '{print $2}')
10481057
cap=$(grep CAPACITY $eeprom_path/"$psu_name"_vpd | awk '{print $2}')
1058+
1059+
# Don't set default PSU FAN speed for Delta 2000 on HI172 - let's PSU FW handle it
1060+
if [[ "$cap" != "2000" || $sku != "HI172" || $mfr != "DELTA" ]]; then
1061+
psu_set_fan_speed "$psu_name" $(< $fan_psu_default)
1062+
fi
1063+
10491064
if echo $mfr | grep -iq "Murata"; then
10501065
# Support FW update only for specific Murata PSU capacities
10511066
fw_ver="N/A"

usr/usr/bin/hw-management-vpd-parser.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,17 @@ class MLNX_ID(object):
312312
]},
313313
}
314314

315+
# FAN "fixed fileds" FRU fields description
316+
FIXED_FIELD_FAN_VPD = {"type": "FIXED_FILED_VPD",
317+
"blk_type": "FIXED_FIELD_FAN_VPD_BLK",
318+
"format" : [
319+
["PN", 0, 16, "FT_ASCII"],
320+
["SN", 16, 16, "FT_ASCII"]
321+
]}
322+
315323
MLNX_VENDOR_BLK_FIELDS = ["name", "minor_version", "offset", "length", "info_type", "type"]
324+
FIXED_FIELD_BLK_FIELDS = ["name", "offset", "length", "type"]
325+
316326
MLNX_CPU_VPD = MLNX_VENDOR_BLK
317327
MLNX_FAN_VPD = MLNX_VENDOR_BLK
318328
MLNX_PDB_VPD = MLNX_VENDOR_BLK
@@ -350,6 +360,54 @@ def format_unpack(_data, item, blk_header, verbose=False):
350360
return val
351361

352362

363+
def parse_fru_fixed_fields_bin(data, blk_hdr, verbose=False):
364+
if "format" not in blk_hdr.keys():
365+
return "-"
366+
block_format = blk_hdr["format"]
367+
printv("Block_type {}\n".format(blk_hdr["blk_type"]), verbose)
368+
rec_list = []
369+
for rec in block_format:
370+
rec_dict = dict(list(zip(FIXED_FIELD_BLK_FIELDS, rec)))
371+
rec_size = rec_dict["length"]
372+
rec_offset = rec_dict["offset"]
373+
374+
rec_type = rec_dict["type"]
375+
if rec_type == "FT_RESERVED":
376+
continue
377+
378+
printv("rec: {}".format(rec), verbose)
379+
380+
_data = data[rec_offset : rec_offset+rec_size]
381+
rec_name = rec_dict["name"]
382+
if rec_type == "FT_ASCII":
383+
item_format = "{}s".format(rec_size)
384+
val = struct.unpack(item_format, _data)[0]
385+
val = val.split(b'\x00')[0]
386+
elif rec_type == "FT_NUM":
387+
_data_str = struct.unpack("{}B".format(rec_size), _data)
388+
val = int_unpack_be(_data_str)
389+
elif rec_type == "FT_NUM_INV":
390+
_data_str = struct.unpack("{}B".format(rec_size), _data)
391+
val = int_unpack_le(_data_str)
392+
elif rec_type == "FT_HEX":
393+
_data_str = struct.unpack("{}B".format(rec_size), _data)
394+
val = hex(int_unpack_be(_data_str))
395+
elif rec_type == "FT_HEX_INV":
396+
_data_str = struct.unpack("{}B".format(rec_size), _data)
397+
val = hex(int_unpack_le(_data_str))
398+
elif rec_type == "FT_MAC":
399+
_data_str = struct.unpack("{}B".format(rec_size), _data)
400+
val = ':'.join(['{:02X}'.format(byte) for byte in _data_str])
401+
else:
402+
continue
403+
404+
printv("BIN: {}".format(binascii.hexlify(_data)), verbose)
405+
printv("{} : {}\n".format(rec_name, bin_decode(val)), verbose)
406+
407+
rec_list.append([rec_name, bin_decode(val)])
408+
409+
return {'items' : rec_list}
410+
353411
def mlnx_blk_unpack(data, blk_hdr, size, verbose=False):
354412
if "format" not in blk_hdr.keys():
355413
return "-"
@@ -585,6 +643,8 @@ def parse_fru_bin(data, VPD_TYPE, verbose):
585643
res = parse_fru_onie_bin(data, FRU_ITEMS, verbose)
586644
elif FRU_ITEMS["type"] == "MLNX":
587645
res = parse_fru_mlnx_bin(data, FRU_ITEMS, verbose)
646+
elif FRU_ITEMS["type"] == "FIXED_FILED_VPD":
647+
res = parse_fru_fixed_fields_bin(data, FRU_ITEMS, verbose)
588648
else:
589649
res = parse_fru_onie_bin(data, SYSTEM_VPD, verbose)
590650
if not res:
@@ -670,6 +730,7 @@ def check_crc32(data_bin, crc32):
670730
"SYSTEM_VPD",
671731
"MLNX_CPU_VPD",
672732
"MLNX_FAN_VPD",
733+
"FIXED_FIELD_FAN_VPD",
673734
"MLNX_PDB_VPD",
674735
"MLNX_CARTRIDGE_VPD"])
675736
parser.add_argument('--verbose', dest='verbose', required=False, default=0, help=argparse.SUPPRESS)

usr/usr/bin/hw-management.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,6 +2760,11 @@ set_config_data()
27602760
echo $hotplug_linecards > $config_path/hotplug_linecards
27612761
echo $fan_speed_tolerance > $config_path/fan_speed_tolerance
27622762
echo $leakage_count > $config_path/leakage_num
2763+
if [ -v "thermal_control_config" ] && [ -f $thermal_control_config ]; then
2764+
cp $thermal_control_config $config_path/tc_config.json
2765+
else
2766+
cp $thermal_control_configs_path/tc_config_not_supported.json $config_path/tc_config.json
2767+
fi
27632768
}
27642769

27652770
connect_platform()
@@ -3298,11 +3303,6 @@ do_start()
32983303
else
32993304
ln -sf /etc/sensors3.conf $config_path/lm_sensors_config
33003305
fi
3301-
if [ -v "thermal_control_config" ] && [ -f $thermal_control_config ]; then
3302-
cp $thermal_control_config $config_path/tc_config.json
3303-
else
3304-
cp $thermal_control_configs_path/tc_config_not_supported.json $config_path/tc_config.json
3305-
fi
33063306
log_info "Init completed."
33073307
}
33083308

0 commit comments

Comments
 (0)