From 27889afa22c5f2b933b7d25cc0cde1db0281e60f Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Tue, 5 Nov 2019 01:07:05 +0530 Subject: Updated PFR event log code Updated PFR event log code to use latest Redfish Event log message registry entries defined per components(BMC, BIOS, ME, CPLD) basis. This commit updates only Panic reason and Recovery reason event log messages. Tested: Loaded image on PFR enabled platform and checked Last panic reason by skipping BMC check point setting, Recovery action by corrupting recovery image. Change-Id: If38a385154571ef5924ca3bd7c1c52a2a380a284 Signed-off-by: AppaRao Puli --- intel-pfr-manager/service/src/mainapp.cpp | 108 ++++++++++++++++++------------ 1 file changed, 65 insertions(+), 43 deletions(-) diff --git a/intel-pfr-manager/service/src/mainapp.cpp b/intel-pfr-manager/service/src/mainapp.cpp index ae92f65..f44733c 100644 --- a/intel-pfr-manager/service/src/mainapp.cpp +++ b/intel-pfr-manager/service/src/mainapp.cpp @@ -52,36 +52,59 @@ static std::vector> versionPurposeHost), std::make_tuple("cpld", ImageType::cpld, versionPurposeOther)}; -// Recovery reason map. { , } -static std::map recoveryReasonMap = { - {0x01, "PCH active authentication failure"}, - {0x02, "PCH recovery authentication failure"}, - {0x03, "ME launch failure"}, - {0x04, "ACM launch failure"}, - {0x05, "IBB launch failure"}, - {0x06, "OBB launch failure"}, - {0x07, "BMC active authentication failure"}, - {0x08, "BMC recovery authentication failure"}, - {0x09, "BMC launch failure"}, - {0x0A, "CPLD watchdog expired"}}; - -// Panic Reason map. { , } -static std::map panicReasonMap = { - {0x01, "CPLD watchdog expired"}, - {0x02, "BMC watchdog expired"}, - {0x03, "ME watchdog expired"}, - {0x04, "ACM watchdog expired"}, - {0x05, "IBB watchdog expired"}, - {0x06, "OBB watchdog expired"}, - {0x07, "BMC active authentication failure"}, - {0x08, "BMC recovery authentication failure"}, - {0x09, "PCH active authentication failure"}, - {0x0A, "PCH recovery authentication failure"}, - {0x0B, "ME authentication failure"}, - {0x0C, "ACM or IBB or OBB authentication failure"}, - {0x0D, "PCH update intent"}, - {0x0E, "BMC update intent"}, - {0x0F, "BMC reset detected"}}; +// Recovery reason map. +// {,{, }} +static const boost::container::flat_map> + recoveryReasonMap = { + {0x01, + {"BIOSFirmwareRecoveryReason", + "PCH active image authentication failure"}}, + {0x02, + {"BIOSFirmwareRecoveryReason", + "PCH recovery image authentication failure"}}, + {0x03, {"MEFirmwareRecoveryReason", "ME launch failure"}}, + {0x04, {"BIOSFirmwareRecoveryReason", "ACM launch failure"}}, + {0x05, {"BIOSFirmwareRecoveryReason", "IBB launch failure"}}, + {0x06, {"BIOSFirmwareRecoveryReason", "OBB launch failure"}}, + {0x07, + {"BMCFirmwareRecoveryReason", + "BMC active image authentication failure"}}, + {0x08, + {"BMCFirmwareRecoveryReason", + "BMC recovery image authentication failure"}}, + {0x09, {"BMCFirmwareRecoveryReason", "BMC launch failure"}}, + {0x0A, {"CPLDFirmwareRecoveryReason", "CPLD watchdog expired"}}}; + +// Panic Reason map. +// {, {, }) +static const boost::container::flat_map> + panicReasonMap = { + {0x01, {"CPLDFirmwarePanicReason", "CPLD watchdog expired"}}, + {0x02, {"BMCFirmwarePanicReason", "BMC watchdog expired"}}, + {0x03, {"MEFirmwarePanicReason", "ME watchdog expired"}}, + {0x04, {"BIOSFirmwarePanicReason", "ACM watchdog expired"}}, + {0x05, {"BIOSFirmwarePanicReason", "IBB watchdog expired"}}, + {0x06, {"BIOSFirmwarePanicReason", "OBB watchdog expired"}}, + {0x07, + {"BMCFirmwarePanicReason", "BMC active image authentication failure"}}, + {0x08, + {"BMCFirmwarePanicReason", + "BMC recovery image authentication failure"}}, + {0x09, + {"BIOSFirmwarePanicReason", + "PCH active image authentication failure"}}, + {0x0A, + {"BIOSFirmwarePanicReason", + "PCH recovery image authentication failure"}}, + {0x0B, {"MEFirmwarePanicReason", "ME authentication failure"}}, + {0x0C, + {"BIOSFirmwarePanicReason", + "ACM or IBB or OBB authentication failure"}}, + {0x0D, {"BIOSFirmwarePanicReason", "PCH update intent"}}, + {0x0E, {"BMCFirmwarePanicReason", "BMC update intent"}}, + {0x0F, {"BMCFirmwarePanicReason", "BMC reset detected"}}}; static void updateDbusPropertiesCache() { @@ -106,18 +129,17 @@ static void logLastRecoveryEvent() return; } - std::map::const_iterator it = - recoveryReasonMap.find(reason); + auto it = recoveryReasonMap.find(reason); if (it == recoveryReasonMap.end()) { // No matching found. So just return without logging event. return; } - - sd_journal_send( - "MESSAGE=%s", "Platform firmware recovered.", "PRIORITY=%i", LOG_ERR, - "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.PlatformFirmwareEvent", - "REDFISH_MESSAGE_ARGS=%s,%s", "recovery", it->second.c_str(), NULL); + std::string msgId = "OpenBMC.0.1." + it->second.first; + sd_journal_send("MESSAGE=%s", "Platform firmware recovery occurred.", + "PRIORITY=%i", LOG_WARNING, "REDFISH_MESSAGE_ID=%s", + msgId.c_str(), "REDFISH_MESSAGE_ARGS=%s", + it->second.second.c_str(), NULL); } static void logLastPanicEvent() @@ -129,18 +151,18 @@ static void logLastPanicEvent() return; } - std::map::const_iterator it = - panicReasonMap.find(reason); + auto it = panicReasonMap.find(reason); if (it == panicReasonMap.end()) { // No matching found. So just return without logging event. return; } - sd_journal_send( - "MESSAGE=%s", "Platform panic event triggered.", "PRIORITY=%i", LOG_ERR, - "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.PlatformFirmwareEvent", - "REDFISH_MESSAGE_ARGS=%s,%s", "panic", it->second.c_str(), NULL); + std::string msgId = "OpenBMC.0.1." + it->second.first; + sd_journal_send("MESSAGE=%s", "Platform firmware panic occurred.", + "PRIORITY=%i", LOG_WARNING, "REDFISH_MESSAGE_ID=%s", + msgId.c_str(), "REDFISH_MESSAGE_ARGS=%s", + it->second.second.c_str(), NULL); } static void checkAndLogEvents() -- cgit v1.2.3