Skip to content

Commit 2684c35

Browse files
committed
hw-mgmt: scripts: Add I2C bus ownership check and reporting for VMOD0021 systems.
Implement a check for I2C bus ownership on VMOD0021 systems to determine if it is controlled by the CPU or BMC. Typically, ownership should be with the CPU. If not, report an error and try ownership enforcement to CPU. Bug: 4597390 Signed-off-by: Michael Shych <michaelsh@nvidia.com>
1 parent df2a63d commit 2684c35

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

usr/usr/bin/hw-management.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2341,6 +2341,24 @@ smart_switch_common()
23412341

23422342
n51xxld_specific()
23432343
{
2344+
# Report I2C bus ownership for VMOD0021 systems at early initialization
2345+
bmc_to_cpu_ctrl_path=$(ls /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/bmc_to_cpu_ctrl 2>/dev/null | head -n1)
2346+
if [ -f "$bmc_to_cpu_ctrl_path" ]; then
2347+
bus_ownership=$(< "$bmc_to_cpu_ctrl_path")
2348+
if [ "$bus_ownership" = "0" ]; then
2349+
log_info "I2C bus ownership: CPU (bmc_to_cpu_ctrl=0)"
2350+
elif [ "$bus_ownership" = "1" ]; then
2351+
log_info "I2C bus ownership: BMC (bmc_to_cpu_ctrl=1)"
2352+
# Try to enforce ownership to CPU
2353+
echo 0 > /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/bmc_to_cpu_ctrl
2354+
else
2355+
# Should never happen as driver represents CPLD bit
2356+
log_err "I2C bus ownership: Unknown value (bmc_to_cpu_ctrl=$bus_ownership)"
2357+
fi
2358+
else
2359+
log_err "I2C bus ownership: bmc_to_cpu_ctrl file not found"
2360+
fi
2361+
23442362
local cpu_bus_offset=55
23452363
if [ ! -e "$devtree_file" ]; then
23462364
connect_table+=(${n5110ld_base_connect_table[@]})
@@ -2459,7 +2477,6 @@ n51xxld_specific()
24592477
mctp_bus="$n5110_mctp_bus"
24602478
mctp_addr="$n5110_mctp_addr"
24612479
ln -sf /dev/i2c-2 /dev/i2c-8
2462-
echo 0 > /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/bmc_to_cpu_ctrl
24632480
}
24642481

24652482
n51xxld_specific_cleanup()

0 commit comments

Comments
 (0)