PHAL: Add location code information support for sub FRUs
only for FRU(Field Replaceable Units) devices. Existing PEL
error handling code doesn't provide Location code information
to PEL back-end code, and which creates errors in PEL
processing for sub FRU callouts from PHAL requested error PEL.
This commits helps to fix the this problem by using libphal
based api to get location code instead of direct devtree
attribute read. Libphal api uses algorithm to get Location code
for sub FRUs by getting information from parent the FRU
Tested: verified PEL
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Change-Id: Ic013b6757f5159041242c5223d0b9ead730be134
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index 2f49b65..a5f79a7 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -30,6 +30,7 @@
namespace phal
{
using namespace phosphor::logging;
+using namespace openpower::phal::exception;
/**
* Used to pass buffer to pdbg callback api to get required target
@@ -75,6 +76,8 @@
int pdbgCallbackToGetTgtReqAttrsVal(struct pdbg_target* target,
void* appPrivData)
{
+ using namespace openpower::phal::pdbg;
+
TargetInfo* targetInfo = static_cast<TargetInfo*>(appPrivData);
ATTR_PHYS_BIN_PATH_Type physBinPath;
@@ -105,10 +108,18 @@
return continueTgtTraversal;
}
- if (DT_GET_PROP(ATTR_LOCATION_CODE, target, targetInfo->locationCode))
+ try
{
- log<level::ERR>("Could not read LOCATION_CODE attribute");
- return requireAttrNotFound;
+ // Get location code information
+ openpower::phal::pdbg::getLocationCode(target,
+ targetInfo->locationCode);
+ }
+ catch (const std::exception& e)
+ {
+ // log message and continue with default data
+ log<level::ERR>(fmt::format("getLocationCode({}): Exception({})",
+ pdbg_target_path(target), e.what())
+ .c_str());
}
if (DT_GET_PROP(ATTR_PHYS_DEV_PATH, target, targetInfo->physDevPath))
@@ -502,7 +513,6 @@
log<level::INFO>("processSbeBootError : Entered ");
using namespace openpower::phal::sbe;
- using namespace openpower::phal::exception;
// To store phal trace and other additional data about ffdc.
FFDCData pelAdditionalData;