diff options
author | AppaRao Puli <apparao.puli@linux.intel.com> | 2019-11-13 16:57:08 +0300 |
---|---|---|
committer | Puli, Apparao <apparao.puli@intel.com> | 2019-11-13 22:22:59 +0300 |
commit | c559e2c659b0d3b6ca76e1553c68ab1960d461d0 (patch) | |
tree | ac235092ba04a95c6324bca099c6531f37f89618 | |
parent | 96032dc90447da45f096e57a7751b91d1db09052 (diff) | |
download | provingground-c559e2c659b0d3b6ca76e1553c68ab1960d461d0.tar.xz |
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 <apparao.puli@linux.intel.com>
-rw-r--r-- | intel-pfr-manager/service/src/mainapp.cpp | 46 |
1 files 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<uint8_t, {0x0E, {"BMCFirmwarePanicReason", "BMC update intent"}}, {0x0F, {"BMCFirmwarePanicReason", "BMC reset detected"}}}; +// Firmware resiliency major map. +// {<CPLD association>, {<Redfish MessageID>, <Error reason> }) +static const boost::container::flat_map<uint8_t, + std::pair<std::string, std::string>> + 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); } } } |