From c559e2c659b0d3b6ca76e1553c68ab1960d461d0 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Wed, 13 Nov 2019 19:27:08 +0530 Subject: PFR Firmware resiliency error events Adding support to log the PFR firmware resiliency major and minor error events to redfish. This change uses new event registry entries. Tested: Simulated the PFR error and checked the redfish events using below URI. URI: /redfish/v1/Systems/system/LogServices/EventLog/Entries RESPONSE: { "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/172", "@odata.type": "#LogEntry.v1_4_0.LogEntry", "Created": "1970-01-01T00:02:52+00:00", "EntryType": "Event", "Id": "172", "Message": "BMC firmware resiliency error. Error reason: BMC image authentication failed(MinorCode:0x01).", "MessageArgs": [ "BMC image authentication failed(MinorCode:0x01)" ], "MessageId": "OpenBMC.0.1.BMCFirmwareResiliencyError", "Name": "System Event Log Entry", "Severity": "Critical" } Change-Id: I7566c5572170d12278313522f097fce250ea87aa Signed-off-by: AppaRao Puli --- intel-pfr-manager/service/src/mainapp.cpp | 46 ++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/intel-pfr-manager/service/src/mainapp.cpp b/intel-pfr-manager/service/src/mainapp.cpp index f44733c..761b25e 100644 --- a/intel-pfr-manager/service/src/mainapp.cpp +++ b/intel-pfr-manager/service/src/mainapp.cpp @@ -106,6 +106,22 @@ static const boost::container::flat_map, {, }) +static const boost::container::flat_map> + majorErrorCodeMap = { + {0x01, + {"BMCFirmwareResiliencyError", "BMC image authentication failed"}}, + {0x02, + {"BIOSFirmwareResiliencyError", "BIOS image authentication failed"}}, + {0x03, {"BMCFirmwareResiliencyError", "BMC boot failed"}}, + {0x04, {"MEFirmwareResiliencyError", "ME boot failed"}}, + {0x05, {"BIOSFirmwareResiliencyError", "ACM boot failed"}}, + {0x06, {"BIOSFirmwareResiliencyError", "BIOS boot failed"}}, + {0x07, {"BIOSFirmwareResiliencyError", "Update from PCH failed"}}, + {0x08, {"BIOSFirmwarePanicReason", "Update from BMC failed"}}}; + static void updateDbusPropertiesCache() { for (const auto& pfrVerObj : pfrVersionObjects) @@ -165,6 +181,25 @@ static void logLastPanicEvent() it->second.second.c_str(), NULL); } +static void logResiliencyErrorEvent(const uint8_t majorErrorCode, + const uint8_t minorErrorCode) +{ + auto it = majorErrorCodeMap.find(majorErrorCode); + if (it == majorErrorCodeMap.end()) + { + // No matching found. So just return without logging event. + return; + } + + std::string errorStr = + it->second.second + "(MinorCode:0x" + toHexString(minorErrorCode) + ")"; + std::string msgId = "OpenBMC.0.1." + it->second.first; + sd_journal_send( + "MESSAGE=%s", "Platform firmware resiliency error occurred.", + "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s", msgId.c_str(), + "REDFISH_MESSAGE_ARGS=%s", errorStr.c_str(), NULL); +} + static void checkAndLogEvents() { uint8_t currPanicCount = 0; @@ -203,16 +238,7 @@ static void checkAndLogEvents() lastMajorErr = majorErr; lastMinorErr = minorErr; - if (majorErr || minorErr) - { - std::string errorStr = - toHexString(majorErr) + "." + toHexString(minorErr); - sd_journal_send("MESSAGE=%s", - "Error occurred on platform firmware.", - "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s", - "OpenBMC.0.1.PlatformFirmwareError", - "REDFISH_MESSAGE_ARGS=%s", errorStr, NULL); - } + logResiliencyErrorEvent(majorErr, minorErr); } } } -- cgit v1.2.3