summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeoWu wiwynn <leo.wu.wiwynn@gmail.com>2026-01-08 11:56:24 +0300
committerPatrick Williams <patrick@stwcx.xyz>2026-01-22 20:04:25 +0300
commit65628f5cfc59b47d21754037cc814fadb00aeeee (patch)
tree52a09e46369218a00f222c0cb3ef4a97447d9a75
parent288664938f5d8748ab5d64df2f5c1bc1fdcad3cb (diff)
downloadopenbmc-65628f5cfc59b47d21754037cc814fadb00aeeee.tar.xz
meta-facebook: yosemite4: Fix I2C failure SEL logs
Add initial I2C communication check to medusa/slot fault scripts to prevent misleading SEL records when the device is inaccessible. Problem: These scripts read PMBus registers to log fault details. However, during certain power events (e.g., 48V OVP causing 12V loss), the target HSC device may be offline. In this state, I2C reads fail and return empty variables. Bash arithmetic evaluates these empty variables as 0, resulting in a logged "STATUS_WORD: 0x0000" (No Faults). This is critically misleading as it implies normal operation during a fault condition. Solution: Perform a quick I2C connectivity check (e.g., reading MFR_ID) before proceeding. If the check fails, log a distinct "I2C failed" error and return early. This ensures the SEL record accurately reflects the communication loss instead of reporting false valid data. Refined scripts: - medusa-hsc-alert - medusa-hsc-fault - medusa-power-module-fault - slot-hsc-fault Tested: Verified that during 48V OVP events, the system now logs "I2C failed" instead of the contradictory "STATUS_WORD: 0x0000". Change-Id: I75ec6ffaf024251aecaf8fe596a15a0dddcc6eac Signed-off-by: LeoWu wiwynn <leo.wu.wiwynn@gmail.com>
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-alert9
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-fault11
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-power-module-fault10
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hsc-fault21
4 files changed, 41 insertions, 10 deletions
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-alert b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-alert
index 95330b3fe7..cb5435b52d 100644
--- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-alert
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-alert
@@ -35,10 +35,17 @@ read_medusa_hsc_module() {
local addr=$2
local hsc_alert_position=$3
local medusa_type=$4
-
local failure_data="Medusa 48V HSC${hsc_alert_position} Alert"
local power_rail="${HSC_PATH}${hsc_alert_position}_48V"
+ # Try first I2C read to check communication
+ if ! i2ctransfer -f -y "$bus" w1@"$addr" 0x79 r2 >/dev/null 2>&1; then
+ # I2C failed - log simplified message and return early
+ log-create xyz.openbmc_project.State.Power.PowerRailFault --json \
+ "{\"POWER_RAIL\": \"$power_rail\", \"FAILURE_DATA\": \"$failure_data - I2C failed\"}"
+ return
+ fi
+
# Read STATUS_CML (0x7E) if XDP710 type
if [ "$medusa_type" == "XDP710" ]; then
STATUS_CML=$(i2ctransfer -f -y "$bus" w1@"$addr" 0x7E r1)
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-fault b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-fault
index 48873df52a..559855b0f9 100644
--- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-fault
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-hsc-fault
@@ -37,10 +37,19 @@ read_medusa_hsc_module() {
local addr=$2
local hsc_fault_position=$3
local medusa_type=$4
-
local failure_data="Medusa 48V HSC${hsc_fault_position} Fault"
local power_rail="${HSC_PATH}${hsc_fault_position}_48V"
+ # Try first I2C read to check communication
+ if ! i2ctransfer -f -y "$bus" w1@"$addr" 0x79 r2 >/dev/null 2>&1; then
+ # I2C failed - log simplified message and return early
+ log-create xyz.openbmc_project.State.Power.PowerRailFault --json \
+ "{\"POWER_RAIL\": \"$power_rail\", \"FAILURE_DATA\": \"$failure_data - I2C failed\"}"
+ return
+ fi
+
+ # I2C communication OK - continue reading all registers
+
# Read STATUS_CML (0x7E) if XDP710 type
if [ "$medusa_type" == "XDP710" ]; then
STATUS_CML=$(i2ctransfer -f -y "$bus" w1@"$addr" 0x7E r1)
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-power-module-fault b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-power-module-fault
index 078f0d4dae..d342b627ae 100644
--- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-power-module-fault
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/medusa-power-module-fault
@@ -44,16 +44,16 @@ read_power_module() {
local addr=$2
local pu_num=$3
local module_vendor
+ local failure_data="Medusa Power Module ${pu_num} Fault"
+ local power_rail="${MODULE_PATH}${pu_num}_12V"
if ! module_vendor=$(read_mfr_id "$bus" "$addr"); then
+ # I2C failed - log simplified message and return early
log-create xyz.openbmc_project.State.Power.PowerRailFault --json \
- "{\"POWER_RAIL\": \"${MODULE_PATH}${pu_num}_12V\", \"FAILURE_DATA\": \"Medusa Power Module ${pu_num} Fault\"}"
- return # Return if read_mfr_id failed
+ "{\"POWER_RAIL\": \"$power_rail\", \"FAILURE_DATA\": \"$failure_data - I2C failed\"}"
+ return
fi
- local failure_data="Medusa Power Module ${pu_num} Fault"
- local power_rail="${MODULE_PATH}${pu_num}_12V"
-
# Read STATUS_BYTE (0x78) and STATUS_OTHER (0x7F) if flex type
if [ "$module_vendor" == "flex" ]; then
STATUS_BYTE=$(i2ctransfer -f -y "$bus" w1@"$addr" 0x78 r1)
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hsc-fault b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hsc-fault
index d0ab43b2d6..ab7eae1f6f 100644
--- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hsc-fault
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/slot-hsc-fault
@@ -25,13 +25,19 @@ read_mfr_id() {
local bus=$1
local addr=$2
local mfr_id
- mfr_id=$(i2ctransfer -f -y "$bus" w1@"$addr" 0x99 r4)
+
+ # Try to read MFR_ID, return error if I2C fails
+ if ! mfr_id=$(i2ctransfer -f -y "$bus" w1@"$addr" 0x99 r4 2>/dev/null); then
+ return 1 # I2C failed
+ fi
+
local vendor="0x41 0x44 0x49"
if [[ $mfr_id == *"$vendor"* ]]; then
echo "adi"
else
echo "mps"
fi
+ return 0
}
read_12v_hsc() {
@@ -39,11 +45,20 @@ read_12v_hsc() {
local addr=$2
local slot_num=$3
local module_vendor
- module_vendor=$(read_mfr_id "$bus" "$addr")
-
local failure_data="SLOT${slot_num} HSC Fault"
local power_rail="${HSC_PATH}${slot_num}_HSC_12V"
+
+ # Try to read vendor ID to check I2C communication
+ if ! module_vendor=$(read_mfr_id "$bus" "$addr"); then
+ # I2C failed - log simplified message and return early
+ log-create xyz.openbmc_project.State.Power.PowerRailFault --json \
+ "{\"POWER_RAIL\": \"$power_rail\", \"FAILURE_DATA\": \"$failure_data - I2C failed\"}"
+ return
+ fi
+
+ # I2C communication OK - continue reading all registers
+
# Read STATUS_VOUT (0x7A) if adi type
if [ "$module_vendor" == "adi" ]; then
STATUS_VOUT=$(i2ctransfer -f -y "$bus" w1@"$addr" 0x7A r1)