clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I299e3888aee418ddcf391a44cd9ba563edabfe83
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/extensions/phal/create_pel.cpp b/extensions/phal/create_pel.cpp
index d3810ef..a61c080 100644
--- a/extensions/phal/create_pel.cpp
+++ b/extensions/phal/create_pel.cpp
@@ -104,11 +104,11 @@
static_cast<uint8_t>(0xCA),
static_cast<uint8_t>(0x01), ffdcFile.getFileFD()));
- std::string service = util::getService(bus, loggingObjectPath,
- loggingInterface);
- auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
- loggingInterface,
- "CreateWithFFDCFiles");
+ std::string service =
+ util::getService(bus, loggingObjectPath, loggingInterface);
+ auto method =
+ bus.new_method_call(service.c_str(), loggingObjectPath,
+ loggingInterface, "CreateWithFFDCFiles");
auto level =
sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
severity);
@@ -204,11 +204,11 @@
try
{
- std::string service = util::getService(bus, loggingObjectPath,
- opLoggingInterface);
- auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
- opLoggingInterface,
- "CreatePELWithFFDCFiles");
+ std::string service =
+ util::getService(bus, loggingObjectPath, opLoggingInterface);
+ auto method =
+ bus.new_method_call(service.c_str(), loggingObjectPath,
+ opLoggingInterface, "CreatePELWithFFDCFiles");
auto level =
sdbusplus::xyz::openbmc_project::Logging::server::convertForMessage(
severity);
@@ -224,11 +224,11 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>(std::format("D-Bus call exception",
- "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
- loggingObjectPath, loggingInterface,
- e.what())
- .c_str());
+ log<level::ERR>(
+ std::format("D-Bus call exception",
+ "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
+ loggingObjectPath, loggingInterface, e.what())
+ .c_str());
throw std::runtime_error(
"Error in invoking D-Bus logging create interface");
}
@@ -253,8 +253,8 @@
try
{
- std::string service = util::getService(bus, loggingObjectPath,
- loggingInterface);
+ std::string service =
+ util::getService(bus, loggingObjectPath, loggingInterface);
auto method = bus.new_method_call(service.c_str(), loggingObjectPath,
loggingInterface, "Create");
auto level =
@@ -265,11 +265,11 @@
}
catch (const sdbusplus::exception_t& e)
{
- log<level::ERR>(std::format("sdbusplus D-Bus call exception",
- "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
- loggingObjectPath, loggingInterface,
- e.what())
- .c_str());
+ log<level::ERR>(
+ std::format("sdbusplus D-Bus call exception",
+ "OBJPATH={}, INTERFACE={}, EXCEPTION={}",
+ loggingObjectPath, loggingInterface, e.what())
+ .c_str());
;
throw std::runtime_error(
diff --git a/extensions/phal/dump_utils.cpp b/extensions/phal/dump_utils.cpp
index dff3470..6d2a666 100644
--- a/extensions/phal/dump_utils.cpp
+++ b/extensions/phal/dump_utils.cpp
@@ -75,8 +75,8 @@
sdbusplus::bus::match::rules::propertiesChanged(
path.c_str(), matchInterface.c_str()),
[&](auto& msg) {
- return dumpStatusChanged(msg, path, inProgress);
- });
+ return dumpStatusChanged(msg, path, inProgress);
+ });
// wait for dump status to be completed (complete == true)
// or until timeout interval
@@ -117,8 +117,8 @@
try
{
std::string service = util::getService(bus, path, interface);
- auto method = bus.new_method_call(service.c_str(), path, interface,
- function);
+ auto method =
+ bus.new_method_call(service.c_str(), path, interface, function);
// dbus call arguments
std::map<std::string, std::variant<std::string, uint64_t>> createParams;
diff --git a/extensions/phal/phal_error.cpp b/extensions/phal/phal_error.cpp
index e249595..8677b6a 100644
--- a/extensions/phal/phal_error.cpp
+++ b/extensions/phal/phal_error.cpp
@@ -325,8 +325,8 @@
for_each(
traceLog.begin(), traceLog.end(),
[&pelAdditionalData](std::pair<std::string, std::string>& ele) -> void {
- pelAdditionalData.emplace_back(ele.first, ele.second);
- });
+ pelAdditionalData.emplace_back(ele.first, ele.second);
+ });
openpower::pel::createErrorPEL(
"org.open_power.PHAL.Error.NonFunctionalBootProc", jsonCalloutDataList,
pelAdditionalData, Severity::Error);
@@ -370,11 +370,11 @@
ffdc->hwp_errorinfo.ffdcs_data.end(),
[&pelAdditionalData, &ffdc_prefix](
std::pair<std::string, std::string>& ele) -> void {
- std::string keyWithPrefix(ffdc_prefix + "FFDC_");
- keyWithPrefix.append(ele.first);
+ std::string keyWithPrefix(ffdc_prefix + "FFDC_");
+ keyWithPrefix.append(ele.first);
- pelAdditionalData.emplace_back(keyWithPrefix, ele.second);
- });
+ pelAdditionalData.emplace_back(keyWithPrefix, ele.second);
+ });
// get clock position information
auto clk_pos = 0xFF; // Invalid position.
for (auto& hwCallout : ffdc->hwp_errorinfo.hwcallouts)
@@ -392,21 +392,22 @@
ffdc->hwp_errorinfo.cdg_targets.end(),
[&pelAdditionalData, &jsonCalloutDataList,
clk_pos](const CDG_Target& cdg_tgt) -> void {
- json jsonCalloutData;
- std::string pelPriority = "L";
- jsonCalloutData["Priority"] = pelPriority; // Not used
- jsonCalloutData["SymbolicFRU"] = "REFCLK" + std::to_string(clk_pos);
- jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
- jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
- jsonCalloutDataList.emplace_back(jsonCalloutData);
- });
+ json jsonCalloutData;
+ std::string pelPriority = "L";
+ jsonCalloutData["Priority"] = pelPriority; // Not used
+ jsonCalloutData["SymbolicFRU"] =
+ "REFCLK" + std::to_string(clk_pos);
+ jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
+ jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
+ jsonCalloutDataList.emplace_back(jsonCalloutData);
+ });
// Adding collected phal logs into PEL additional data
for_each(traceLog.begin(), traceLog.end(),
[&pelAdditionalData](
std::pair<std::string, std::string>& ele) -> void {
- pelAdditionalData.emplace_back(ele.first, ele.second);
- });
+ pelAdditionalData.emplace_back(ele.first, ele.second);
+ });
openpower::pel::createErrorPEL("org.open_power.PHAL.Error.SpareClock",
jsonCalloutDataList, pelAdditionalData,
@@ -534,8 +535,8 @@
for_each(traceLog.begin(), traceLog.end(),
[&pelAdditionalData](
std::pair<std::string, std::string>& ele) -> void {
- pelAdditionalData.emplace_back(ele.first, ele.second);
- });
+ pelAdditionalData.emplace_back(ele.first, ele.second);
+ });
openpower::pel::createErrorPEL("org.open_power.PHAL.Error.Boot", {},
pelAdditionalData,
@@ -586,38 +587,88 @@
ffdc->hwp_errorinfo.ffdcs_data.end(),
[&pelAdditionalData, &ffdc_prefix](
std::pair<std::string, std::string>& ele) -> void {
- std::string keyWithPrefix(ffdc_prefix + "FFDC_");
- keyWithPrefix.append(ele.first);
+ std::string keyWithPrefix(ffdc_prefix + "FFDC_");
+ keyWithPrefix.append(ele.first);
- pelAdditionalData.emplace_back(keyWithPrefix, ele.second);
- });
+ pelAdditionalData.emplace_back(keyWithPrefix,
+ ele.second);
+ });
// Adding hardware callout details
int calloutCount = 0;
- for_each(ffdc->hwp_errorinfo.hwcallouts.begin(),
- ffdc->hwp_errorinfo.hwcallouts.end(),
- [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
- &ffdc_prefix](const HWCallout& hwCallout) -> void {
- calloutCount++;
- std::stringstream keyPrefix;
- keyPrefix << ffdc_prefix << "HW_CO_" << std::setfill('0')
- << std::setw(2) << calloutCount << "_";
+ for_each(
+ ffdc->hwp_errorinfo.hwcallouts.begin(),
+ ffdc->hwp_errorinfo.hwcallouts.end(),
+ [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
+ &ffdc_prefix](const HWCallout& hwCallout) -> void {
+ calloutCount++;
+ std::stringstream keyPrefix;
+ keyPrefix << ffdc_prefix << "HW_CO_" << std::setfill('0')
+ << std::setw(2) << calloutCount << "_";
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("HW_ID"),
- hwCallout.hwid);
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("HW_ID"),
+ hwCallout.hwid);
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("PRIORITY"),
- hwCallout.callout_priority);
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("PRIORITY"),
+ hwCallout.callout_priority);
- // Log target details only if entity path is
- // available. For example target entity path will not
- // be available for non-hwp clock failure.
- if (!hwCallout.target_entity_path.empty())
- {
+ // Log target details only if entity path is
+ // available. For example target entity path will not
+ // be available for non-hwp clock failure.
+ if (!hwCallout.target_entity_path.empty())
+ {
+ phal::TargetInfo targetInfo;
+ phal::getTgtReqAttrsVal(hwCallout.target_entity_path,
+ targetInfo);
+
+ std::string locationCode =
+ std::string(targetInfo.locationCode);
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("LOC_CODE"),
+ locationCode);
+
+ std::string physPath =
+ std::string(targetInfo.physDevPath);
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("PHYS_PATH"),
+ physPath);
+ }
+
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("CLK_POS"),
+ std::to_string(hwCallout.clkPos));
+
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("CALLOUT_PLANAR"),
+ (hwCallout.isPlanarCallout == true ? "true" : "false"));
+
+ std::string pelPriority =
+ getPelPriority(hwCallout.callout_priority);
+
+ if (hwCallout.isPlanarCallout)
+ {
+ addPlanarCallout(jsonCalloutDataList, pelPriority);
+ }
+ });
+
+ // Adding CDG (callout, deconfigure and guard) targets details
+ calloutCount = 0;
+ for_each(
+ ffdc->hwp_errorinfo.cdg_targets.begin(),
+ ffdc->hwp_errorinfo.cdg_targets.end(),
+ [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
+ &ffdc_prefix](const CDG_Target& cdg_tgt) -> void {
+ calloutCount++;
+ std::stringstream keyPrefix;
+ keyPrefix << ffdc_prefix << "CDG_TGT_" << std::setfill('0')
+ << std::setw(2) << calloutCount << "_";
+
phal::TargetInfo targetInfo;
- phal::getTgtReqAttrsVal(hwCallout.target_entity_path,
+ targetInfo.deconfigure = cdg_tgt.deconfigure;
+
+ phal::getTgtReqAttrsVal(cdg_tgt.target_entity_path,
targetInfo);
std::string locationCode =
@@ -625,93 +676,51 @@
pelAdditionalData.emplace_back(
std::string(keyPrefix.str()).append("LOC_CODE"),
locationCode);
-
std::string physPath = std::string(targetInfo.physDevPath);
pelAdditionalData.emplace_back(
std::string(keyPrefix.str()).append("PHYS_PATH"),
physPath);
- }
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("CLK_POS"),
- std::to_string(hwCallout.clkPos));
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("CO_REQ"),
+ (cdg_tgt.callout == true ? "true" : "false"));
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("CALLOUT_PLANAR"),
- (hwCallout.isPlanarCallout == true ? "true" : "false"));
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("CO_PRIORITY"),
+ cdg_tgt.callout_priority);
- std::string pelPriority =
- getPelPriority(hwCallout.callout_priority);
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("DECONF_REQ"),
+ (cdg_tgt.deconfigure == true ? "true" : "false"));
- if (hwCallout.isPlanarCallout)
- {
- addPlanarCallout(jsonCalloutDataList, pelPriority);
- }
- });
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("GUARD_REQ"),
+ (cdg_tgt.guard == true ? "true" : "false"));
- // Adding CDG (callout, deconfigure and guard) targets details
- calloutCount = 0;
- for_each(ffdc->hwp_errorinfo.cdg_targets.begin(),
- ffdc->hwp_errorinfo.cdg_targets.end(),
- [&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
- &ffdc_prefix](const CDG_Target& cdg_tgt) -> void {
- calloutCount++;
- std::stringstream keyPrefix;
- keyPrefix << ffdc_prefix << "CDG_TGT_" << std::setfill('0')
- << std::setw(2) << calloutCount << "_";
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("GUARD_TYPE"),
+ cdg_tgt.guard_type);
- phal::TargetInfo targetInfo;
- targetInfo.deconfigure = cdg_tgt.deconfigure;
+ json jsonCalloutData;
+ jsonCalloutData["LocationCode"] = locationCode;
+ std::string pelPriority =
+ getPelPriority(cdg_tgt.callout_priority);
+ jsonCalloutData["Priority"] = pelPriority;
- phal::getTgtReqAttrsVal(cdg_tgt.target_entity_path, targetInfo);
+ if (targetInfo.mruId != 0)
+ {
+ jsonCalloutData["MRUs"] = json::array({
+ {{"ID", targetInfo.mruId},
+ {"Priority", pelPriority}},
+ });
+ }
+ jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
+ jsonCalloutData["Guarded"] = cdg_tgt.guard;
+ jsonCalloutData["GuardType"] = cdg_tgt.guard_type;
+ jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
- std::string locationCode = std::string(targetInfo.locationCode);
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("LOC_CODE"),
- locationCode);
- std::string physPath = std::string(targetInfo.physDevPath);
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("PHYS_PATH"), physPath);
-
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("CO_REQ"),
- (cdg_tgt.callout == true ? "true" : "false"));
-
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("CO_PRIORITY"),
- cdg_tgt.callout_priority);
-
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("DECONF_REQ"),
- (cdg_tgt.deconfigure == true ? "true" : "false"));
-
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("GUARD_REQ"),
- (cdg_tgt.guard == true ? "true" : "false"));
-
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("GUARD_TYPE"),
- cdg_tgt.guard_type);
-
- json jsonCalloutData;
- jsonCalloutData["LocationCode"] = locationCode;
- std::string pelPriority =
- getPelPriority(cdg_tgt.callout_priority);
- jsonCalloutData["Priority"] = pelPriority;
-
- if (targetInfo.mruId != 0)
- {
- jsonCalloutData["MRUs"] = json::array({
- {{"ID", targetInfo.mruId}, {"Priority", pelPriority}},
- });
- }
- jsonCalloutData["Deconfigured"] = cdg_tgt.deconfigure;
- jsonCalloutData["Guarded"] = cdg_tgt.guard;
- jsonCalloutData["GuardType"] = cdg_tgt.guard_type;
- jsonCalloutData["EntityPath"] = cdg_tgt.target_entity_path;
-
- jsonCalloutDataList.emplace_back(jsonCalloutData);
- });
+ jsonCalloutDataList.emplace_back(jsonCalloutData);
+ });
// Adding procedure callout
calloutCount = 0;
for_each(
@@ -719,26 +728,26 @@
ffdc->hwp_errorinfo.procedures_callout.end(),
[&pelAdditionalData, &calloutCount, &jsonCalloutDataList,
&ffdc_prefix](const ProcedureCallout& procCallout) -> void {
- calloutCount++;
- std::stringstream keyPrefix;
- keyPrefix << ffdc_prefix << "PROC_CO_" << std::setfill('0')
- << std::setw(2) << calloutCount << "_";
+ calloutCount++;
+ std::stringstream keyPrefix;
+ keyPrefix << ffdc_prefix << "PROC_CO_" << std::setfill('0')
+ << std::setw(2) << calloutCount << "_";
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("PRIORITY"),
- procCallout.callout_priority);
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("PRIORITY"),
+ procCallout.callout_priority);
- pelAdditionalData.emplace_back(
- std::string(keyPrefix.str()).append("MAINT_PROCEDURE"),
- procCallout.proc_callout);
+ pelAdditionalData.emplace_back(
+ std::string(keyPrefix.str()).append("MAINT_PROCEDURE"),
+ procCallout.proc_callout);
- json jsonCalloutData;
- jsonCalloutData["Procedure"] = procCallout.proc_callout;
- std::string pelPriority =
- getPelPriority(procCallout.callout_priority);
- jsonCalloutData["Priority"] = pelPriority;
- jsonCalloutDataList.emplace_back(jsonCalloutData);
- });
+ json jsonCalloutData;
+ jsonCalloutData["Procedure"] = procCallout.proc_callout;
+ std::string pelPriority =
+ getPelPriority(procCallout.callout_priority);
+ jsonCalloutData["Priority"] = pelPriority;
+ jsonCalloutDataList.emplace_back(jsonCalloutData);
+ });
}
else if ((ffdc->ffdc_type != FFDC_TYPE_NONE) &&
(ffdc->ffdc_type != FFDC_TYPE_UNSUPPORTED))
@@ -754,8 +763,8 @@
for_each(traceLog.begin(), traceLog.end(),
[&pelAdditionalData](
std::pair<std::string, std::string>& ele) -> void {
- pelAdditionalData.emplace_back(ele.first, ele.second);
- });
+ pelAdditionalData.emplace_back(ele.first, ele.second);
+ });
// TODO: #ibm-openbmc/dev/issues/2595 : Once enabled this support,
// callout details is not required to sort in H,M and L orders which
@@ -764,21 +773,24 @@
// i.e High -> Medium -> Low.
std::sort(jsonCalloutDataList.begin(), jsonCalloutDataList.end(),
[](const json& aEle, const json& bEle) -> bool {
- // Considering b element having higher priority than a element
- // or Both element will be same priorty (to keep same order
- // which are given by phal when two callouts are having same
- // priority)
- if (((aEle["Priority"] == "M") && (bEle["Priority"] == "H")) ||
- ((aEle["Priority"] == "L") &&
- ((bEle["Priority"] == "H") || (bEle["Priority"] == "M"))) ||
- (aEle["Priority"] == bEle["Priority"]))
- {
- return false;
- }
+ // Considering b element having higher priority than a
+ // element or Both element will be same priorty (to keep
+ // same order which are given by phal when two callouts
+ // are having same priority)
+ if (((aEle["Priority"] == "M") &&
+ (bEle["Priority"] == "H")) ||
+ ((aEle["Priority"] == "L") &&
+ ((bEle["Priority"] == "H") ||
+ (bEle["Priority"] == "M"))) ||
+ (aEle["Priority"] == bEle["Priority"]))
+ {
+ return false;
+ }
- // Considering a element having higher priority than b element
- return true;
- });
+ // Considering a element having higher priority than b
+ // element
+ return true;
+ });
openpower::pel::createErrorPEL("org.open_power.PHAL.Error.Boot",
jsonCalloutDataList, pelAdditionalData,
Severity::Error);
@@ -861,8 +873,8 @@
for_each(
traceLog.begin(), traceLog.end(),
[&pelAdditionalData](std::pair<std::string, std::string>& ele) -> void {
- pelAdditionalData.emplace_back(ele.first, ele.second);
- });
+ pelAdditionalData.emplace_back(ele.first, ele.second);
+ });
// reset the trace log and counter
reset();
@@ -925,8 +937,8 @@
uint32_t index = pdbg_target_index(procTarget);
pelAdditionalData.emplace_back("SRC6", std::to_string(index << 16));
// Create SBE Error with FFDC data.
- auto logId = createSbeErrorPEL(event, sbeError, pelAdditionalData,
- procTarget);
+ auto logId =
+ createSbeErrorPEL(event, sbeError, pelAdditionalData, procTarget);
if (dumpIsRequired)
{
@@ -954,8 +966,8 @@
for_each(
traceLog.begin(), traceLog.end(),
[&pelAdditionalData](std::pair<std::string, std::string>& ele) -> void {
- pelAdditionalData.emplace_back(ele.first, ele.second);
- });
+ pelAdditionalData.emplace_back(ele.first, ele.second);
+ });
openpower::pel::createPEL("org.open_power.PHAL.Error.GuardPartitionAccess",
pelAdditionalData);