clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I8caffb39990bf9f0b54e6b1fee711e368a600b5c
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index ef6f54e..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
@@ -36,12 +38,13 @@
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
@@ -49,6 +52,7 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -74,9 +78,13 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -84,13 +92,19 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
@@ -108,7 +122,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/libpfr/src/pfr.cpp b/libpfr/src/pfr.cpp
index de06125..0b7fdc4 100644
--- a/libpfr/src/pfr.cpp
+++ b/libpfr/src/pfr.cpp
@@ -95,66 +95,63 @@
conn->async_method_call(
[conn, &i2cConfigLoaded](const boost::system::error_code ec,
const GetSubTreeType& resp) {
- if (ec || resp.size() != 1)
- {
- return;
- }
- if (resp[0].second.begin() == resp[0].second.end())
- return;
- const std::string& objPath = resp[0].first;
- const std::string& serviceName = resp[0].second.begin()->first;
+ if (ec || resp.size() != 1)
+ {
+ return;
+ }
+ if (resp[0].second.begin() == resp[0].second.end())
+ return;
+ const std::string& objPath = resp[0].first;
+ const std::string& serviceName = resp[0].second.begin()->first;
- const std::string match = "Baseboard/PFR";
- if (boost::ends_with(objPath, match))
- {
- // PFR object found.. check for PFR support
- conn->async_method_call(
- [objPath, serviceName, conn, &i2cConfigLoaded](
- boost::system::error_code ec,
- const std::vector<std::pair<
- std::string, std::variant<std::string, uint64_t>>>&
- propertiesList) {
- if (ec)
- {
- phosphor::logging::log<
- phosphor::logging::level::ERR>(
- "Error to Get PFR properties.",
- phosphor::logging::entry("MSG=%s",
- ec.message().c_str()));
- return;
- }
+ const std::string match = "Baseboard/PFR";
+ if (boost::ends_with(objPath, match))
+ {
+ // PFR object found.. check for PFR support
+ conn->async_method_call(
+ [objPath, serviceName, conn, &i2cConfigLoaded](
+ boost::system::error_code ec,
+ const std::vector<std::pair<
+ std::string, std::variant<std::string, uint64_t>>>&
+ propertiesList) {
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Error to Get PFR properties.",
+ phosphor::logging::entry("MSG=%s",
+ ec.message().c_str()));
+ return;
+ }
- const uint64_t* i2cBus = nullptr;
- const uint64_t* address = nullptr;
+ const uint64_t* i2cBus = nullptr;
+ const uint64_t* address = nullptr;
- for (const auto& [propName, propVariant] :
- propertiesList)
- {
- if (propName == "Address")
- {
- address = std::get_if<uint64_t>(&propVariant);
- }
- else if (propName == "Bus")
- {
- i2cBus = std::get_if<uint64_t>(&propVariant);
- }
- }
+ for (const auto& [propName, propVariant] : propertiesList)
+ {
+ if (propName == "Address")
+ {
+ address = std::get_if<uint64_t>(&propVariant);
+ }
+ else if (propName == "Bus")
+ {
+ i2cBus = std::get_if<uint64_t>(&propVariant);
+ }
+ }
- if ((address == nullptr) || (i2cBus == nullptr))
- {
- phosphor::logging::log<
- phosphor::logging::level::ERR>(
- "Unable to read the pfr properties");
- return;
- }
+ if ((address == nullptr) || (i2cBus == nullptr))
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Unable to read the pfr properties");
+ return;
+ }
- i2cBusNumber = static_cast<int>(*i2cBus);
- i2cSlaveAddress = static_cast<int>(*address);
- i2cConfigLoaded = true;
- },
- serviceName, objPath, "org.freedesktop.DBus.Properties",
- "GetAll", "xyz.openbmc_project.Configuration.PFR");
- }
+ i2cBusNumber = static_cast<int>(*i2cBus);
+ i2cSlaveAddress = static_cast<int>(*address);
+ i2cConfigLoaded = true;
+ },
+ serviceName, objPath, "org.freedesktop.DBus.Properties",
+ "GetAll", "xyz.openbmc_project.Configuration.PFR");
+ }
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -216,8 +213,8 @@
uint8_t majorVer = cpldDev.i2cReadByteData(majorReg);
uint8_t minorVer = cpldDev.i2cReadByteData(minorReg);
// Major and Minor versions should be binary encoded strings.
- std::string version =
- std::to_string(majorVer) + "." + std::to_string(minorVer);
+ std::string version = std::to_string(majorVer) + "." +
+ std::to_string(minorVer);
return version;
}
catch (const std::exception& e)
@@ -414,8 +411,8 @@
// When Non-PFR CPLD is present -> <MainPLDMajorMinor.PLDMajorMinor>
// Example: 2.7
- std::string version =
- std::to_string(mainCPLDVer) + "." + std::to_string(pldVer) + svnRoTHash;
+ std::string version = std::to_string(mainCPLDVer) + "." +
+ std::to_string(pldVer) + svnRoTHash;
return version;
}
diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp
index 3749c93..83750c9 100644
--- a/service/src/mainapp.cpp
+++ b/service/src/mainapp.cpp
@@ -193,8 +193,8 @@
return;
}
- std::string errorStr =
- it->second.second + "(MinorCode:0x" + toHexString(minorErrorCode) + ")";
+ 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.",
@@ -206,19 +206,19 @@
handleLastCountChange(std::shared_ptr<sdbusplus::asio::connection> conn,
std::string eventName, uint8_t currentCount)
{
- sdbusplus::asio::setProperty(
- *conn, "xyz.openbmc_project.Settings",
- "/xyz/openbmc_project/pfr/last_events",
- "xyz.openbmc_project.PFR.LastEvents", eventName, currentCount,
- [](boost::system::error_code ec) {
- if (ec)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "PFR: Unable to update currentCount",
- phosphor::logging::entry("MSG=%s", ec.message().c_str()));
- return;
- }
- });
+ sdbusplus::asio::setProperty(*conn, "xyz.openbmc_project.Settings",
+ "/xyz/openbmc_project/pfr/last_events",
+ "xyz.openbmc_project.PFR.LastEvents",
+ eventName, currentCount,
+ [](boost::system::error_code ec) {
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "PFR: Unable to update currentCount",
+ phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+ return;
+ }
+ });
return;
}
@@ -234,82 +234,81 @@
const std::vector<
std::pair<std::string, std::variant<std::monostate, uint8_t>>>&
properties) {
- if (ec)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "PFR: Unable get PFR last events",
- phosphor::logging::entry("MSG=%s", ec.message().c_str()));
- return;
- }
- uint8_t lastRecoveryCount = 0;
- uint8_t lastPanicCount = 0;
- uint8_t lastMajorErr = 0;
- uint8_t lastMinorErr = 0;
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "PFR: Unable get PFR last events",
+ phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+ return;
+ }
+ uint8_t lastRecoveryCount = 0;
+ uint8_t lastPanicCount = 0;
+ uint8_t lastMajorErr = 0;
+ uint8_t lastMinorErr = 0;
- try
- {
- sdbusplus::unpackProperties(
- properties, "lastRecoveryCount", lastRecoveryCount,
- "lastPanicCount", lastPanicCount, "lastMajorErr",
- lastMajorErr, "lastMinorErr", lastMinorErr);
- }
- catch (const sdbusplus::exception::UnpackPropertyError& error)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "PFR: Unpack error",
- phosphor::logging::entry("MSG=%s", error.what()));
- return;
- }
+ try
+ {
+ sdbusplus::unpackProperties(
+ properties, "lastRecoveryCount", lastRecoveryCount,
+ "lastPanicCount", lastPanicCount, "lastMajorErr", lastMajorErr,
+ "lastMinorErr", lastMinorErr);
+ }
+ catch (const sdbusplus::exception::UnpackPropertyError& error)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "PFR: Unpack error",
+ phosphor::logging::entry("MSG=%s", error.what()));
+ return;
+ }
- uint8_t currPanicCount = 0;
- if (0 == readCpldReg(ActionType::panicCount, currPanicCount))
+ uint8_t currPanicCount = 0;
+ if (0 == readCpldReg(ActionType::panicCount, currPanicCount))
+ {
+ if (lastPanicCount != currPanicCount)
{
- if (lastPanicCount != currPanicCount)
+ // Update cached data to dbus and log redfish
+ // event by reading reason.
+ handleLastCountChange(conn, "lastPanicCount", currPanicCount);
+ if (currPanicCount)
{
- // Update cached data to dbus and log redfish
- // event by reading reason.
- handleLastCountChange(conn, "lastPanicCount",
- currPanicCount);
- if (currPanicCount)
- {
- logLastPanicEvent();
- }
+ logLastPanicEvent();
}
}
+ }
- uint8_t currRecoveryCount = 0;
- if (0 == readCpldReg(ActionType::recoveryCount, currRecoveryCount))
+ uint8_t currRecoveryCount = 0;
+ if (0 == readCpldReg(ActionType::recoveryCount, currRecoveryCount))
+ {
+ if (lastRecoveryCount != currRecoveryCount)
{
- if (lastRecoveryCount != currRecoveryCount)
+ // Update cached data to dbus and log redfish
+ // event by reading reason.
+ handleLastCountChange(conn, "lastRecoveryCount",
+ currRecoveryCount);
+ if (currRecoveryCount)
{
- // Update cached data to dbus and log redfish
- // event by reading reason.
- handleLastCountChange(conn, "lastRecoveryCount",
- currRecoveryCount);
- if (currRecoveryCount)
- {
- logLastRecoveryEvent();
- }
+ logLastRecoveryEvent();
}
}
+ }
- uint8_t majorErr = 0;
- uint8_t minorErr = 0;
- if ((0 == readCpldReg(ActionType::majorError, majorErr)) &&
- (0 == readCpldReg(ActionType::minorError, minorErr)))
+ uint8_t majorErr = 0;
+ uint8_t minorErr = 0;
+ if ((0 == readCpldReg(ActionType::majorError, majorErr)) &&
+ (0 == readCpldReg(ActionType::minorError, minorErr)))
+ {
+ if ((lastMajorErr != majorErr) || (lastMinorErr != minorErr))
{
- if ((lastMajorErr != majorErr) || (lastMinorErr != minorErr))
+ // Update cached data to dbus and log redfish event by
+ // reading reason.
+ handleLastCountChange(conn, "lastMajorErr", majorErr);
+ handleLastCountChange(conn, "lastMinorErr", minorErr);
+ if (majorErr && minorErr)
{
- // Update cached data to dbus and log redfish event by
- // reading reason.
- handleLastCountChange(conn, "lastMajorErr", majorErr);
- handleLastCountChange(conn, "lastMinorErr", minorErr);
- if (majorErr && minorErr)
- {
- logResiliencyErrorEvent(majorErr, minorErr);
- }
+ logResiliencyErrorEvent(majorErr, minorErr);
}
}
+ }
});
}
@@ -321,19 +320,19 @@
stateTimer->expires_after(std::chrono::seconds(pollTimeout));
stateTimer->async_wait(
[&server, &conn](const boost::system::error_code& ec) {
- if (ec == boost::asio::error::operation_aborted)
- {
- // Timer reset.
- return;
- }
- if (ec)
- {
- // Platform State Monitor - Timer cancelled.
- return;
- }
- checkAndLogEvents(conn);
- monitorPlatformStateChange(server, conn);
- });
+ if (ec == boost::asio::error::operation_aborted)
+ {
+ // Timer reset.
+ return;
+ }
+ if (ec)
+ {
+ // Platform State Monitor - Timer cancelled.
+ return;
+ }
+ checkAndLogEvents(conn);
+ monitorPlatformStateChange(server, conn);
+ });
}
void checkAndSetCheckpoint(sdbusplus::asio::object_server& server,
@@ -343,51 +342,51 @@
conn->async_method_call(
[&server, &conn](boost::system::error_code ec,
const std::variant<uint64_t>& value) {
- if (!ec)
+ if (!ec)
+ {
+ if (std::get<uint64_t>(value))
{
- if (std::get<uint64_t>(value))
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "BMC boot completed. Setting checkpoint 9.");
+ if (!finishedSettingChkPoint)
{
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "BMC boot completed. Setting checkpoint 9.");
- if (!finishedSettingChkPoint)
- {
- finishedSettingChkPoint = true;
- setBMCBootCheckpoint(bmcBootFinishedChkPoint);
- }
- return;
+ finishedSettingChkPoint = true;
+ setBMCBootCheckpoint(bmcBootFinishedChkPoint);
}
+ return;
}
- else
+ }
+ else
+ {
+ // Failed to get data from systemd. System might not
+ // be ready yet. Attempt again for data.
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "aync call failed to get FinishTimestamp.",
+ phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+ }
+ // FIX-ME: Latest up-stream sync caused issue in receiving
+ // StartupFinished signal. Unable to get StartupFinished signal
+ // from systemd1 hence using poll method too, to trigger it
+ // properly.
+ constexpr size_t pollTimeout = 10; // seconds
+ initTimer->expires_after(std::chrono::seconds(pollTimeout));
+ initTimer->async_wait(
+ [&server, &conn](const boost::system::error_code& ec) {
+ if (ec == boost::asio::error::operation_aborted)
{
- // Failed to get data from systemd. System might not
- // be ready yet. Attempt again for data.
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "aync call failed to get FinishTimestamp.",
- phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+ // Timer reset.
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "Set boot Checkpoint - Timer aborted or stopped.");
+ return;
}
- // FIX-ME: Latest up-stream sync caused issue in receiving
- // StartupFinished signal. Unable to get StartupFinished signal
- // from systemd1 hence using poll method too, to trigger it
- // properly.
- constexpr size_t pollTimeout = 10; // seconds
- initTimer->expires_after(std::chrono::seconds(pollTimeout));
- initTimer->async_wait(
- [&server, &conn](const boost::system::error_code& ec) {
- if (ec == boost::asio::error::operation_aborted)
- {
- // Timer reset.
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "Set boot Checkpoint - Timer aborted or stopped.");
- return;
- }
- if (ec)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Set boot Checkpoint - async wait error.");
- return;
- }
- checkAndSetCheckpoint(server, conn);
- });
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Set boot Checkpoint - async wait error.");
+ return;
+ }
+ checkAndSetCheckpoint(server, conn);
+ });
},
"org.freedesktop.systemd1", "/org/freedesktop/systemd1",
"org.freedesktop.DBus.Properties", "Get",
@@ -405,14 +404,14 @@
"member='StartupFinished',path='/org/freedesktop/systemd1',"
"interface='org.freedesktop.systemd1.Manager'",
[&server, &conn](sdbusplus::message_t& msg) {
- if (!finishedSettingChkPoint)
- {
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "BMC boot completed(StartupFinished). Setting "
- "checkpoint 9.");
- finishedSettingChkPoint = true;
- setBMCBootCheckpoint(bmcBootFinishedChkPoint);
- }
+ if (!finishedSettingChkPoint)
+ {
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "BMC boot completed(StartupFinished). Setting "
+ "checkpoint 9.");
+ finishedSettingChkPoint = true;
+ setBMCBootCheckpoint(bmcBootFinishedChkPoint);
+ }
});
checkAndSetCheckpoint(server, conn);
@@ -426,37 +425,36 @@
"sender='xyz.openbmc_project.State.Chassis', "
"arg0namespace='xyz.openbmc_project.State.Chassis'",
[&server, &conn](sdbusplus::message_t& message) {
- std::string intfName;
- std::map<std::string, std::variant<std::string>> properties;
- message.read(intfName, properties);
+ std::string intfName;
+ std::map<std::string, std::variant<std::string>> properties;
+ message.read(intfName, properties);
- const auto it = properties.find("CurrentPowerState");
- if (it != properties.end())
+ const auto it = properties.find("CurrentPowerState");
+ if (it != properties.end())
+ {
+ const std::string* state = std::get_if<std::string>(&it->second);
+ if (state != nullptr)
{
- const std::string* state =
- std::get_if<std::string>(&it->second);
- if (state != nullptr)
+ if ((*state ==
+ "xyz.openbmc_project.State.Chassis.PowerState.On") &&
+ (!stateTimerRunning))
{
- if ((*state ==
- "xyz.openbmc_project.State.Chassis.PowerState.On") &&
- (!stateTimerRunning))
- {
- stateTimerRunning = true;
- monitorPlatformStateChange(server, conn);
- }
- else if ((*state == "xyz.openbmc_project.State.Chassis."
- "PowerState.Off") &&
- (stateTimerRunning))
- {
- stateTimer->cancel();
- checkAndLogEvents(conn);
- stateTimerRunning = false;
- }
+ stateTimerRunning = true;
+ monitorPlatformStateChange(server, conn);
}
-
- // Update the D-Bus properties when chassis state changes.
- updateDbusPropertiesCache();
+ else if ((*state == "xyz.openbmc_project.State.Chassis."
+ "PowerState.Off") &&
+ (stateTimerRunning))
+ {
+ stateTimer->cancel();
+ checkAndLogEvents(conn);
+ stateTimerRunning = false;
+ }
}
+
+ // Update the D-Bus properties when chassis state changes.
+ updateDbusPropertiesCache();
+ }
});
// Capture the Host state and Start the monitor timer
@@ -469,39 +467,38 @@
"sender='xyz.openbmc_project.State.Chassis', "
"arg0namespace='xyz.openbmc_project.State.Host'",
[&server, &conn](sdbusplus::message_t& message) {
- std::string intfName;
- std::map<std::string, std::variant<std::string>> properties;
- message.read(intfName, properties);
+ std::string intfName;
+ std::map<std::string, std::variant<std::string>> properties;
+ message.read(intfName, properties);
- const auto it = properties.find("CurrentHostState");
- if (it != properties.end())
+ const auto it = properties.find("CurrentHostState");
+ if (it != properties.end())
+ {
+ const std::string* state = std::get_if<std::string>(&it->second);
+ if (state != nullptr)
{
- const std::string* state =
- std::get_if<std::string>(&it->second);
- if (state != nullptr)
+ if ((*state ==
+ "xyz.openbmc_project.State.Host.HostState.Running") &&
+ (!stateTimerRunning))
{
- if ((*state ==
- "xyz.openbmc_project.State.Host.HostState.Running") &&
- (!stateTimerRunning))
- {
- stateTimerRunning = true;
- monitorPlatformStateChange(server, conn);
- }
- else if (((*state == "xyz.openbmc_project.State.Host."
- "HostState.Off") ||
- (*state == "xyz.openbmc_project.State.Host."
- "HostState.Quiesced")) &&
- (stateTimerRunning))
- {
- stateTimer->cancel();
- checkAndLogEvents(conn);
- stateTimerRunning = false;
- }
+ stateTimerRunning = true;
+ monitorPlatformStateChange(server, conn);
}
-
- // Update the D-Bus properties when host state changes.
- updateDbusPropertiesCache();
+ else if (((*state == "xyz.openbmc_project.State.Host."
+ "HostState.Off") ||
+ (*state == "xyz.openbmc_project.State.Host."
+ "HostState.Quiesced")) &&
+ (stateTimerRunning))
+ {
+ stateTimer->cancel();
+ checkAndLogEvents(conn);
+ stateTimerRunning = false;
+ }
}
+
+ // Update the D-Bus properties when host state changes.
+ updateDbusPropertiesCache();
+ }
});
// Capture the OS state change and stop monitor timer
@@ -514,40 +511,39 @@
"sender='xyz.openbmc_project.State.Chassis', "
"arg0namespace='xyz.openbmc_project.State.OperatingSystem.Status'",
[&server, &conn](sdbusplus::message_t& message) {
- std::string intfName;
- std::map<std::string, std::variant<std::string>> properties;
- message.read(intfName, properties);
+ std::string intfName;
+ std::map<std::string, std::variant<std::string>> properties;
+ message.read(intfName, properties);
- const auto it = properties.find("OperatingSystemState");
- if (it != properties.end())
+ const auto it = properties.find("OperatingSystemState");
+ if (it != properties.end())
+ {
+ const std::string* state = std::get_if<std::string>(&it->second);
+ if (state != nullptr)
{
- const std::string* state =
- std::get_if<std::string>(&it->second);
- if (state != nullptr)
+ // The short strings "BootComplete" and "Standby" are
+ // deprecated in favor of the full enum strings
+ // Support for the short strings will be removed in the
+ // future.
+ if (((*state == "BootComplete") ||
+ (*state == "xyz.openbmc_project.State.OperatingSystem."
+ "Status.OSStatus.BootComplete") ||
+ (*state == "Inactive") ||
+ (*state == "xyz.openbmc_project.State.OperatingSystem."
+ "Status.OSStatus.Inactive")) &&
+ (stateTimerRunning))
{
- // The short strings "BootComplete" and "Standby" are
- // deprecated in favor of the full enum strings
- // Support for the short strings will be removed in the
- // future.
- if (((*state == "BootComplete") ||
- (*state == "xyz.openbmc_project.State.OperatingSystem."
- "Status.OSStatus.BootComplete") ||
- (*state == "Inactive") ||
- (*state == "xyz.openbmc_project.State.OperatingSystem."
- "Status.OSStatus.Inactive")) &&
- (stateTimerRunning))
- {
- stateTimer->cancel();
- checkAndLogEvents(conn);
- stateTimerRunning = false;
- }
- else if (!stateTimerRunning)
- {
- stateTimerRunning = true;
- monitorPlatformStateChange(server, conn);
- }
+ stateTimer->cancel();
+ checkAndLogEvents(conn);
+ stateTimerRunning = false;
+ }
+ else if (!stateTimerRunning)
+ {
+ stateTimerRunning = true;
+ monitorPlatformStateChange(server, conn);
}
}
+ }
});
// First time, check and log events if any.
@@ -560,13 +556,13 @@
lg2::info("VERSION INFO - cpld_active - {VER}", "VER", cpldVersion);
conn->async_method_call(
[](const boost::system::error_code ec) {
- if (ec)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Unable to update cpld_active version",
- phosphor::logging::entry("MSG=%s", ec.message().c_str()));
- return;
- }
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Unable to update cpld_active version",
+ phosphor::logging::entry("MSG=%s", ec.message().c_str()));
+ return;
+ }
},
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/software/cpld_active",
@@ -627,8 +623,8 @@
constexpr size_t timeout = 10; // seconds
pfrObjTimer->expires_after(std::chrono::seconds(timeout));
- pfrObjTimer->async_wait([&conn,
- &server](const boost::system::error_code& ec) {
+ pfrObjTimer->async_wait(
+ [&conn, &server](const boost::system::error_code& ec) {
if (ec)
{
if (ec == boost::asio::error::operation_aborted)
@@ -695,8 +691,8 @@
pfr::pfrConfigObject->updateProvisioningStatus();
if (pfr::pfrConfigObject->getPfrProvisioned())
{
- pfr::pfrPostcodeObject =
- std::make_unique<pfr::PfrPostcode>(server, conn);
+ pfr::pfrPostcodeObject = std::make_unique<pfr::PfrPostcode>(server,
+ conn);
}
}
diff --git a/service/src/pfr_mgr.cpp b/service/src/pfr_mgr.cpp
index c729bba..e6ec29d 100644
--- a/service/src/pfr_mgr.cpp
+++ b/service/src/pfr_mgr.cpp
@@ -50,27 +50,26 @@
}
std::string objPath = "/xyz/openbmc_project/software/" + path;
- versionIface =
- server.add_interface(objPath, "xyz.openbmc_project.Software.Version");
+ versionIface = server.add_interface(objPath,
+ "xyz.openbmc_project.Software.Version");
if (versionIface != nullptr)
{
-
versionIface->register_property("Purpose", purpose);
versionIface->register_property(
versionStr, version,
// Override set
[this](const std::string& req, std::string& propertyValue) {
- if (internalSet)
+ if (internalSet)
+ {
+ if (req != propertyValue)
{
- if (req != propertyValue)
- {
- version = req;
- propertyValue = req;
- return 1;
- }
+ version = req;
+ propertyValue = req;
+ return 1;
}
- return 0;
+ }
+ return 0;
});
versionIface->initialize();
@@ -109,7 +108,6 @@
if (activationIface != nullptr)
{
-
activationIface->register_property("Activation", activation);
activationIface->register_property("RequestedActivation", reqActNone);
@@ -151,47 +149,47 @@
pfrCfgIface->register_property(ufmProvisionedStr, ufmProvisioned,
// Override set
[this](const bool req, bool propertyValue) {
- if (internalSet)
- {
- if (req != propertyValue)
- {
- ufmProvisioned = req;
- propertyValue = req;
- return 1;
- }
- }
- return 0;
- });
+ if (internalSet)
+ {
+ if (req != propertyValue)
+ {
+ ufmProvisioned = req;
+ propertyValue = req;
+ return 1;
+ }
+ }
+ return 0;
+ });
pfrCfgIface->register_property(ufmLockedStr, ufmLocked,
// Override set
[this](const bool req, bool propertyValue) {
- if (internalSet)
- {
- if (req != propertyValue)
- {
- ufmLocked = req;
- propertyValue = req;
- return 1;
- }
- }
- return 0;
- });
+ if (internalSet)
+ {
+ if (req != propertyValue)
+ {
+ ufmLocked = req;
+ propertyValue = req;
+ return 1;
+ }
+ }
+ return 0;
+ });
pfrCfgIface->register_property(ufmSupportStr, ufmSupport,
// Override set
[this](const bool req, bool propertyValue) {
- if (internalSet)
- {
- if (req != propertyValue)
- {
- ufmSupport = req;
- propertyValue = req;
- return 1;
- }
- }
- return 0;
- });
+ if (internalSet)
+ {
+ if (req != propertyValue)
+ {
+ ufmSupport = req;
+ propertyValue = req;
+ return 1;
+ }
+ }
+ return 0;
+ });
pfrCfgIface->initialize();
@@ -261,8 +259,8 @@
postcode = 0;
}
- pfrPostcodeIface =
- server.add_interface("/xyz/openbmc_project/pfr", postcodeIface);
+ pfrPostcodeIface = server.add_interface("/xyz/openbmc_project/pfr",
+ postcodeIface);
if (pfrPostcodeIface != nullptr)
{
@@ -270,22 +268,22 @@
postcodeDataProp, postcode,
// Override set
[this](const uint8_t req, uint8_t& propertyValue) {
- if (internalSet)
+ if (internalSet)
+ {
+ if (req != propertyValue)
{
- if (req != propertyValue)
- {
- postcode = req;
- propertyValue = req;
- return 1;
- }
+ postcode = req;
+ propertyValue = req;
+ return 1;
}
- return 0;
+ }
+ return 0;
},
[this](uint8_t& propertyValue) {
- updatePostcode();
- propertyValue = postcode;
- return propertyValue;
- });
+ updatePostcode();
+ propertyValue = postcode;
+ return propertyValue;
+ });
pfrPostcodeIface->register_property(postcodeStrProp,
std::string(postcodeStrDefault));