254 lines
9.8 KiB
Diff
254 lines
9.8 KiB
Diff
|
|
From d8b014ef95adfc1ec2d336968cd60c5961ec9824 Mon Sep 17 00:00:00 2001
|
||
|
|
From: "Wang.Bin" <Bin-B.Wang@luxshare-ict.com>
|
||
|
|
Date: Fri, 25 Oct 2024 15:46:54 +0800
|
||
|
|
Subject: [PATCH 3/3] Add BMC Boot sensor
|
||
|
|
|
||
|
|
---
|
||
|
|
fault-monitor/fru-fault-monitor.cpp | 191 +++++++++++++++++++++++++++-
|
||
|
|
1 file changed, 186 insertions(+), 5 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
|
||
|
|
index 03e1700..2e99e45 100644
|
||
|
|
--- a/fault-monitor/fru-fault-monitor.cpp
|
||
|
|
+++ b/fault-monitor/fru-fault-monitor.cpp
|
||
|
|
@@ -69,18 +69,99 @@ using InvalidArgumentErr =
|
||
|
|
|
||
|
|
constexpr const char* discreteSensorNs = "No state defined";
|
||
|
|
|
||
|
|
+/*discrete sensor specific offset*/
|
||
|
|
+// 07H
|
||
|
|
+constexpr auto IPMI_CPU_IERR = 0;
|
||
|
|
+constexpr auto IPMI_CPU_THERMALTRIP = 1;
|
||
|
|
+constexpr auto IPMI_CPU_FBR1_BIST_FAILURE = 2;
|
||
|
|
+constexpr auto IPMI_CPU_FRB2_HANG = 3;
|
||
|
|
+constexpr auto IPMI_CPU_FRB3_STARTUP_FAILURE = 4;
|
||
|
|
+constexpr auto IPMI_CPU_CONFIG_ERROR = 5;
|
||
|
|
+constexpr auto IPMI_CPU_SMBIOS_UC_ERROR = 6;
|
||
|
|
+constexpr auto IPMI_CPU_PRESENT = 7;
|
||
|
|
+constexpr auto IPMI_CPU_DISABLED = 8;
|
||
|
|
+constexpr auto IPMI_CPU_THROTTLED = 10;
|
||
|
|
+constexpr auto IPMI_CPU_MCE = 11;
|
||
|
|
+constexpr auto IPMI_CPU_CMCE = 12;
|
||
|
|
+
|
||
|
|
+// 08H
|
||
|
|
+constexpr auto POWER_SUPPLY_PRESENT = 0;
|
||
|
|
+constexpr auto POWER_SUPPLY_FAILURE = 1;
|
||
|
|
+constexpr auto POWER_SUPPLY_PREDICTIVE_FAILURE = 2;
|
||
|
|
+constexpr auto POWER_SUPPLY_AC_LOST = 3;
|
||
|
|
+constexpr auto POWER_SUPPLY_AC_OUT_OF_RANGE = 5;
|
||
|
|
+constexpr auto POWER_SUPPLY_CONFIG_ERROR = 6;
|
||
|
|
+
|
||
|
|
+// 0CH
|
||
|
|
+constexpr auto MEMORY_OFFSET_CORRECTABLE_ECC = 0;
|
||
|
|
+constexpr auto MEMORY_OFFSET_UNCORRECTABLE_ECC = 1;
|
||
|
|
+constexpr auto MEMORY_OFFSET_PARITY = 2;
|
||
|
|
+constexpr auto MEMORY_OFFSET_MEMORY_SCRUB_FAILED = 3;
|
||
|
|
+constexpr auto MEMORY_OFFSET_MEMORY_DEVICE_DISABLED = 4;
|
||
|
|
+constexpr auto MEMORY_OFFSET_CORRECTABLE_ECC_LOG_LIMIT_REACHED = 5;
|
||
|
|
+constexpr auto MEMORY_OFFSET_PRESENCE_DETECTED = 6;
|
||
|
|
+constexpr auto MEMORY_OFFSET_CONFIGURATION_ERROR = 7;
|
||
|
|
+constexpr auto MEMORY_OFFSET_SPARE = 8;
|
||
|
|
+constexpr auto MEMORY_OFFSET_MEMORY_AUTOMATICALLY_THROTTLED = 9;
|
||
|
|
+constexpr auto MEMORY_OFFSET_CRITICAL_OVER_TEMMPERATURE = 10;
|
||
|
|
+
|
||
|
|
+// 0FH
|
||
|
|
+constexpr auto SYSTEM_FIRMWARE_PROGRESS_OFFSET_ERROR = 0;
|
||
|
|
+constexpr auto SYSTEM_FIRMWARE_PROGRESS_OFFSET_HANG = 1;
|
||
|
|
+
|
||
|
|
+// 0DH
|
||
|
|
+constexpr auto DRIVE_OFFSET_PRESENT = 0;
|
||
|
|
+constexpr auto DRIVE_OFFSET_FAULT = 1;
|
||
|
|
+
|
||
|
|
// 10H
|
||
|
|
constexpr auto SYSTEM_EVENT_LOG_CLEARED = 2;
|
||
|
|
|
||
|
|
+// 13H
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_FRONT_PANEL_NMI = 0;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_BUS_TIMEOUT = 1;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_IO_CHANNLE_CHECK_NMI = 2;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_SOFTWARE_NMI = 3;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_PCI_PERR = 4;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_PCI_SERR = 5;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_EISA_FAIL_SAFE_TIMEOUT = 6;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_BUS_CORRECTABLE_ERROR = 7;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_BUS_UNCORRECTABLE_ERRPR = 8;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_FATAL_NMI = 9;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_BUS_FATAL_ERROR = 10;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_BUS_DEGRADED = 11;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_BANDWITH_REDUCTION = 12;
|
||
|
|
+constexpr auto CRITICAL_INTERRUPT_OFFSET_RATE_REDUCTION = 13;
|
||
|
|
+
|
||
|
|
// 14H
|
||
|
|
constexpr auto POWER_BUTTON_PRESSED = 0;
|
||
|
|
constexpr auto SLEEP_BUTTON_PRESSED = 1;
|
||
|
|
constexpr auto RESET_BUTTON_PRESSED = 2;
|
||
|
|
|
||
|
|
+// 1BH
|
||
|
|
+constexpr auto CABLE_CONNECTED = 0;
|
||
|
|
+constexpr auto CABLE_CONFIG_ERROR = 1;
|
||
|
|
+
|
||
|
|
+// 1DH
|
||
|
|
+constexpr auto INIT_BY_POWER_UP = 0;
|
||
|
|
+constexpr auto INIT_BY_HARD_RESET = 1;
|
||
|
|
+constexpr auto INIT_BY_WARM_RESET = 2;
|
||
|
|
+
|
||
|
|
+// 1EH
|
||
|
|
+constexpr auto NO_BOOTABLE_MEDIA = 0;
|
||
|
|
+constexpr auto NON_BOOTABLE_DISKETTE = 1;
|
||
|
|
+constexpr auto PXE_SERVER_NOT_FOUND = 2;
|
||
|
|
+constexpr auto INVALID_BOOT_SECTOR = 3;
|
||
|
|
+
|
||
|
|
+// 1FH
|
||
|
|
+constexpr auto OS_BOOT_COMPLETE = 6;
|
||
|
|
+
|
||
|
|
// 22H
|
||
|
|
constexpr auto ACPI_S0_STATE = 0;
|
||
|
|
constexpr auto ACPI_S5_STATE = 6;
|
||
|
|
|
||
|
|
+// 2BH
|
||
|
|
+constexpr auto FIRMWARE_UPDATE_SUCCESS = 7;
|
||
|
|
+
|
||
|
|
/*sensor object, SensorStatusInfo*/
|
||
|
|
std::unordered_map<std::string, SensorStatusInfo> sensorStatusRec;
|
||
|
|
std::unordered_map<std::string, std::unordered_map<uint8_t, DriveStatus>> driveStatusRec;
|
||
|
|
@@ -124,15 +205,115 @@ using ipmiSensorsInfo = std::unordered_map<std::string, sensorCodes>;
|
||
|
|
std::optional<ipmiSensorsInfo> ipmiSensors;
|
||
|
|
|
||
|
|
const std::unordered_map<SensorType, discrectSensorEvent> sensorSpecificTypes{
|
||
|
|
+ {SENSOR_TYPE_PROCESSOR,
|
||
|
|
+ {
|
||
|
|
+ {IPMI_CPU_IERR, "IERR"},
|
||
|
|
+ {IPMI_CPU_THERMALTRIP, "Thermal Trip"},
|
||
|
|
+ {IPMI_CPU_FBR1_BIST_FAILURE, "FRB1/BIST failure"},
|
||
|
|
+ {IPMI_CPU_FRB2_HANG, "FRB2/Hang in POST failure"},
|
||
|
|
+ {IPMI_CPU_FRB3_STARTUP_FAILURE, "FRB3/Processor startup/init failure"},
|
||
|
|
+ {IPMI_CPU_CONFIG_ERROR, "Configuration Error"},
|
||
|
|
+ {IPMI_CPU_SMBIOS_UC_ERROR, "SM BIOS Uncorrectable CPU-complex Error"},
|
||
|
|
+ {IPMI_CPU_PRESENT, "Presence detected"},
|
||
|
|
+ {IPMI_CPU_DISABLED, "Disabled"},
|
||
|
|
+ {IPMI_CPU_THROTTLED, "Throttled"},
|
||
|
|
+ {IPMI_CPU_MCE, "Uncorrectable machine check exception"},
|
||
|
|
+ {IPMI_CPU_CMCE, "Correctable machine check error"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_POWER_SUPPLY,
|
||
|
|
+ {
|
||
|
|
+ {POWER_SUPPLY_PRESENT, "Presence detected"},
|
||
|
|
+ {POWER_SUPPLY_FAILURE, "Failure detected"},
|
||
|
|
+ {POWER_SUPPLY_PREDICTIVE_FAILURE, "Predictive failure"},
|
||
|
|
+ {POWER_SUPPLY_AC_LOST, "Power Supply AC lost"},
|
||
|
|
+ {POWER_SUPPLY_AC_OUT_OF_RANGE, "AC out-of-range, but present"},
|
||
|
|
+ {POWER_SUPPLY_CONFIG_ERROR, "Config Error: Vendor Mismatch"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_MEMORY,
|
||
|
|
+ {
|
||
|
|
+ {MEMORY_OFFSET_CORRECTABLE_ECC, "Correctable ECC"},
|
||
|
|
+ {MEMORY_OFFSET_UNCORRECTABLE_ECC, "Uncorrectable ECC"},
|
||
|
|
+ {MEMORY_OFFSET_PARITY, "Parity"},
|
||
|
|
+ {MEMORY_OFFSET_MEMORY_SCRUB_FAILED, "Memory Scrub Failed"},
|
||
|
|
+ {MEMORY_OFFSET_MEMORY_DEVICE_DISABLED, "Memory Device Disabled"},
|
||
|
|
+ {MEMORY_OFFSET_CORRECTABLE_ECC_LOG_LIMIT_REACHED,
|
||
|
|
+ "Correctable ECC logging limit reached"},
|
||
|
|
+ {MEMORY_OFFSET_PRESENCE_DETECTED, "Presence Detected"},
|
||
|
|
+ {MEMORY_OFFSET_CONFIGURATION_ERROR, "Configuration Error"},
|
||
|
|
+ {MEMORY_OFFSET_SPARE, "Spare"},
|
||
|
|
+ {MEMORY_OFFSET_MEMORY_AUTOMATICALLY_THROTTLED, "Throttled"},
|
||
|
|
+ {MEMORY_OFFSET_CRITICAL_OVER_TEMMPERATURE, "Critical Overtemperature"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_DRIVE_SLOT,
|
||
|
|
+ {
|
||
|
|
+ {DRIVE_OFFSET_PRESENT, "Drive Present"},
|
||
|
|
+ {DRIVE_OFFSET_FAULT, "Drive Fault"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_SYSTEM_FIRMWARE_PROGRESS,
|
||
|
|
+ {
|
||
|
|
+ {SYSTEM_FIRMWARE_PROGRESS_OFFSET_ERROR, "System Firmware Error"},
|
||
|
|
+ {SYSTEM_FIRMWARE_PROGRESS_OFFSET_HANG, "System Firmware Hang"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_EVENT_LOGGING_DISABLED,
|
||
|
|
+ {
|
||
|
|
+ {SYSTEM_EVENT_LOG_CLEARED, "Log area reset/cleared"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_CRITICAL_INTERRUPT,
|
||
|
|
+ {
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_FRONT_PANEL_NMI, "NMI/Diag Interrupt"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_BUS_TIMEOUT, "Bus Timeout"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_IO_CHANNLE_CHECK_NMI,
|
||
|
|
+ "I/O Channel check NMI"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_SOFTWARE_NMI, "Software NMI"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_PCI_PERR, "PCI PERR"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_PCI_SERR, "PCI SERR"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_EISA_FAIL_SAFE_TIMEOUT,
|
||
|
|
+ "EISA failsafe timeout"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_BUS_CORRECTABLE_ERROR,
|
||
|
|
+ "Bus Correctable error"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_BUS_UNCORRECTABLE_ERRPR,
|
||
|
|
+ "Bus Uncorrectable error"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_FATAL_NMI, "Fatal NMI"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_BUS_FATAL_ERROR, "Bus Fatal Error"},
|
||
|
|
+ {CRITICAL_INTERRUPT_OFFSET_BUS_DEGRADED, "Bus Degraded"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_BUTTON_SWITCH,
|
||
|
|
+ {
|
||
|
|
+ {POWER_BUTTON_PRESSED, "Power Button pressed"},
|
||
|
|
+ {SLEEP_BUTTON_PRESSED, "Sleep Button pressed"},
|
||
|
|
+ {RESET_BUTTON_PRESSED, "Reset Button pressed"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_CABLE_INTERCONNECT,
|
||
|
|
+ {
|
||
|
|
+ {CABLE_CONNECTED, "Connected"},
|
||
|
|
+ {CABLE_CONFIG_ERROR, "Config Error"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_SYSTEM_BOOT,
|
||
|
|
+ {
|
||
|
|
+ {INIT_BY_POWER_UP, "Initiated by power up"},
|
||
|
|
+ {INIT_BY_HARD_RESET, "Initiated by hard reset"},
|
||
|
|
+ {INIT_BY_WARM_RESET, "Initiated by warm reset"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_BOOT_ERROR,
|
||
|
|
+ {
|
||
|
|
+ {NO_BOOTABLE_MEDIA, "No bootable media"},
|
||
|
|
+ {NON_BOOTABLE_DISKETTE, "Non-bootable disk in drive"},
|
||
|
|
+ {PXE_SERVER_NOT_FOUND, "PXE server not found"},
|
||
|
|
+ {INVALID_BOOT_SECTOR, "Invalid boot sector"},
|
||
|
|
+ }},
|
||
|
|
+ {SENSOR_TYPE_OS_BOOT,
|
||
|
|
+ {
|
||
|
|
+ {OS_BOOT_COMPLETE, "boot completed - device not specified"},
|
||
|
|
+ }},
|
||
|
|
{SENSOR_TYPE_SYSTEM_ACPI_POWER_STATE,
|
||
|
|
{
|
||
|
|
{ACPI_S0_STATE, "S0/G0: working"},
|
||
|
|
{ACPI_S5_STATE, "S4/S5: soft-off"},
|
||
|
|
}},
|
||
|
|
- {SENSOR_TYPE_EVENT_LOGGING_DISABLED,
|
||
|
|
+ {SENSOR_TYPE_VERSION_CHANGE,
|
||
|
|
{
|
||
|
|
- {SYSTEM_EVENT_LOG_CLEARED, "Log area reset/cleared"},
|
||
|
|
- }}
|
||
|
|
+ {FIRMWARE_UPDATE_SUCCESS, "Firmware or software change success"},
|
||
|
|
+ }},
|
||
|
|
};
|
||
|
|
|
||
|
|
std::optional<ipmiSensorsInfo> initIPMISensorInfo(sdbusplus::bus::bus& bus)
|
||
|
|
@@ -214,7 +395,7 @@ static void setDiscreteSensorStatusValue(sdbusplus::bus::bus& bus,
|
||
|
|
auto method = bus.new_method_call(service, sensorPath.c_str(),
|
||
|
|
dbusProperties, "Set");
|
||
|
|
std::variant<double> value{(double)statusValue};
|
||
|
|
-
|
||
|
|
+ std::cerr << "SEL:sensorData = " << sensorData << std::endl;
|
||
|
|
method.append(statusInterface, "Status", value);
|
||
|
|
try
|
||
|
|
{
|
||
|
|
@@ -498,7 +679,7 @@ void parseSpecificSensorSelSeverity(sdbusplus::bus::bus& bus,
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
default:
|
||
|
|
- return;
|
||
|
|
+ break;
|
||
|
|
}
|
||
|
|
sensorStatusRec[sensorPath].eventType = SPECIFIC_SENSOR_TYPE;
|
||
|
|
sensorStatusRec[sensorPath].sensorType = sensorType;
|
||
|
|
--
|
||
|
|
2.25.1
|
||
|
|
|