PHAL: Add callout details for platform related errors
1) At present platform errors are treated as normal ipl errors
and no callout details are added.
2) Modified to add callout info to the FFDC object when there
is error in plat code.
Tested:
"Primary SRC": {
"Section Version": "1",
"Sub-section type": "1",
"Created by": "0x3000",
"SRC Version": "0x02",
"SRC Format": "0x55",
"Virtual Progress SRC": "False",
"I5/OS Service Event Bit": "False",
"Hypervisor Dump Initiated":"False",
"Power Control Net Fault": "False",
"Backplane CCIN": "2E33",
"Deconfigured": "True",
"Guarded": "False",
"Error Details": {
"Message": "Failure occured during boot process"
},
"Callout Section": {
"Callout Count": "1",
"Callouts": [{
"FRU Type": "Normal Hardware FRU",
"Priority": "Medium Priority",
"Location Code": "U780C.ND0.WZS0003-P0-C14",
"Part Number": "F200203",
"CCIN": "AB41",
"Serial Number": " ",
"MRU Id": "00010000"
}]
}
"User Data 2": {
"Section Version": "1",
"Sub-section type": "1",
"Created by": "0x2000",
"Data": [
{
"Deconfigured": true,
"EntityPath": [
35,
1,
0,
2,
0,
5,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"GuardType": "",
"Guarded": false,
"LocationCode": "Ufcs-P0-C14",
"MRUs": [
{
"ID": 65536,
"Priority": "M"
}
],
"Priority": "M"
}
]
}
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: I8d3f1603c751efe74e5e06d4ebb9956681acdaa5
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index e775625..4820954 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -195,6 +195,13 @@
// list of debug traces
static std::vector<std::pair<std::string, std::string>> traceLog;
+/**
+ * @brief Process platform realted boot failure
+ *
+ * @param[in] errInfo - error details
+ */
+static void processPlatBootError(const ipl_error_info& errInfo);
+
void processLogTraceCallback(void*, const char* fmt, va_list ap)
{
va_list vap;
@@ -260,53 +267,40 @@
fmt::format("processIplErrorCallback: Error type({})", errInfo.type)
.c_str());
- if (errInfo.type == IPL_ERR_OK)
+ switch (errInfo.type)
{
- // reset trace log and exit
- reset();
- return;
- }
-
- if ((errInfo.type == IPL_ERR_SBE_BOOT) ||
- (errInfo.type == IPL_ERR_SBE_CHIPOP))
- {
- // handle SBE related failures.
- processSbeBootError();
- return;
- }
-
- if (errInfo.type == IPL_ERR_HWP)
- {
- // Handle hwp failure
- processBootError(false);
- return;
- }
-
- // Log PEL for any other failures
- if (errInfo.type != IPL_ERR_OK)
- {
- createPEL("org.open_power.PHAL.Error.Boot");
- // reset trace log and exit
- reset();
- return;
+ case IPL_ERR_OK:
+ // reset trace log and exit
+ reset();
+ break;
+ case IPL_ERR_SBE_BOOT:
+ case IPL_ERR_SBE_CHIPOP:
+ // handle SBE related failures.
+ processSbeBootError();
+ break;
+ case IPL_ERR_HWP:
+ // Handle hwp failure
+ processBootError(false);
+ break;
+ case IPL_ERR_PLAT:
+ processPlatBootError(errInfo);
+ break;
+ default:
+ createPEL("org.open_power.PHAL.Error.Boot");
+ // reset trace log and exit
+ reset();
+ break;
}
}
-void processBootError(bool status)
+void processBootErrorHelper(FFDC* ffdc)
{
- log<level::INFO>("processBootError ", entry("STATUS=%d", status));
+ log<level::INFO>("processBootErrorHelper ");
try
{
- // return If no failure during hwp execution
- if (status)
- return;
-
- // Collecting ffdc details from phal
- FFDC ffdc;
- libekb_get_ffdc(ffdc);
-
log<level::INFO>(
- fmt::format("PHAL FFDC: Return Message[{}]", ffdc.message).c_str());
+ fmt::format("PHAL FFDC: Return Message[{}]", ffdc->message)
+ .c_str());
// To store callouts details in json format as per pel expectation.
json jsonCalloutDataList;
@@ -315,16 +309,16 @@
// To store phal trace and other additional data about ffdc.
FFDCData pelAdditionalData;
- if (ffdc.ffdc_type == FFDC_TYPE_HWP)
+ if (ffdc->ffdc_type == FFDC_TYPE_HWP)
{
// Adding hardware procedures return code details
- pelAdditionalData.emplace_back("HWP_RC", ffdc.hwp_errorinfo.rc);
+ pelAdditionalData.emplace_back("HWP_RC", ffdc->hwp_errorinfo.rc);
pelAdditionalData.emplace_back("HWP_RC_DESC",
- ffdc.hwp_errorinfo.rc_desc);
+ ffdc->hwp_errorinfo.rc_desc);
// Adding hardware procedures required ffdc data for debug
- for_each(ffdc.hwp_errorinfo.ffdcs_data.begin(),
- ffdc.hwp_errorinfo.ffdcs_data.end(),
+ for_each(ffdc->hwp_errorinfo.ffdcs_data.begin(),
+ ffdc->hwp_errorinfo.ffdcs_data.end(),
[&pelAdditionalData](
std::pair<std::string, std::string>& ele) -> void {
std::string keyWithPrefix("HWP_FFDC_");
@@ -336,8 +330,8 @@
// Adding hardware callout details
int calloutCount = 0;
- for_each(ffdc.hwp_errorinfo.hwcallouts.begin(),
- ffdc.hwp_errorinfo.hwcallouts.end(),
+ for_each(ffdc->hwp_errorinfo.hwcallouts.begin(),
+ ffdc->hwp_errorinfo.hwcallouts.end(),
[&pelAdditionalData, &calloutCount, &jsonCalloutDataList](
const HWCallout& hwCallout) -> void {
calloutCount++;
@@ -392,8 +386,8 @@
// Adding CDG (callout, deconfigure and guard) targets details
calloutCount = 0;
- for_each(ffdc.hwp_errorinfo.cdg_targets.begin(),
- ffdc.hwp_errorinfo.cdg_targets.end(),
+ for_each(ffdc->hwp_errorinfo.cdg_targets.begin(),
+ ffdc->hwp_errorinfo.cdg_targets.end(),
[&pelAdditionalData, &calloutCount,
&jsonCalloutDataList](const CDG_Target& cdg_tgt) -> void {
calloutCount++;
@@ -462,8 +456,8 @@
// Adding procedure callout
calloutCount = 0;
for_each(
- ffdc.hwp_errorinfo.procedures_callout.begin(),
- ffdc.hwp_errorinfo.procedures_callout.end(),
+ ffdc->hwp_errorinfo.procedures_callout.begin(),
+ ffdc->hwp_errorinfo.procedures_callout.end(),
[&pelAdditionalData, &calloutCount, &jsonCalloutDataList](
const ProcedureCallout& procCallout) -> void {
calloutCount++;
@@ -487,13 +481,13 @@
jsonCalloutDataList.emplace_back(jsonCalloutData);
});
}
- else if ((ffdc.ffdc_type != FFDC_TYPE_NONE) &&
- (ffdc.ffdc_type != FFDC_TYPE_UNSUPPORTED))
+ else if ((ffdc->ffdc_type != FFDC_TYPE_NONE) &&
+ (ffdc->ffdc_type != FFDC_TYPE_UNSUPPORTED))
{
log<level::ERR>(
fmt::format("Unsupported phal FFDC type to create PEL. "
"MSG: {}",
- ffdc.message)
+ ffdc->message)
.c_str());
}
@@ -539,6 +533,50 @@
reset();
}
+void processPlatBootError(const ipl_error_info& errInfo)
+{
+ log<level::INFO>("processPlatBootError ");
+
+ // Collecting ffdc details from phal
+ FFDC* ffdc = reinterpret_cast<FFDC*>(errInfo.private_data);
+ try
+ {
+ processBootErrorHelper(ffdc);
+ }
+ catch (const std::exception& ex)
+ {
+ log<level::ERR>(
+ fmt::format("processPlatBootError: exception({})", ex.what())
+ .c_str());
+ throw ex;
+ }
+}
+
+void processBootError(bool status)
+{
+ log<level::INFO>(
+ fmt::format("processBootError: status({})", status).c_str());
+
+ try
+ {
+ // return If no failure during hwp execution
+ if (status)
+ return;
+
+ // Collecting ffdc details from phal
+ FFDC ffdc;
+ libekb_get_ffdc(ffdc);
+
+ processBootErrorHelper(&ffdc);
+ }
+ catch (const std::exception& ex)
+ {
+ log<level::ERR>(
+ fmt::format("processBootError: exception({})", ex.what()).c_str());
+ throw ex;
+ }
+}
+
void processSbeBootError()
{
log<level::INFO>("processSbeBootError : Entered ");