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: Id2036ab746164981596b3ee36259f3ca5d3f1334
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -98,13 +98,14 @@
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
diff --git a/include/biosxml.hpp b/include/biosxml.hpp
index 8881fdf..1e69454 100644
--- a/include/biosxml.hpp
+++ b/include/biosxml.hpp
@@ -92,8 +92,7 @@
std::string descriptionStr, std::string defaultStr,
std::string promptStr, std::string depexStr,
std::string& setupTypeStr) :
- depex(false),
- readOnly(("ReadOnly" == setupTypeStr) ? true : false),
+ depex(false), readOnly(("ReadOnly" == setupTypeStr) ? true : false),
currentVal(currentVal), nameStr(std::move(nameStr)),
currentValStr(std::move(currentValStr)),
descriptionStr(std::move(descriptionStr)),
@@ -177,8 +176,8 @@
{
return !s.empty() &&
std::find_if(s.begin(), s.end(), [](unsigned char c) {
- return !std::isdigit(c);
- }) == s.end();
+ return !std::isdigit(c);
+ }) == s.end();
}
/* Returns 'true' if the argument string is hex representation of a number.
@@ -203,8 +202,8 @@
}
}
- std::string error = "Unable to find knob: " + variableName +
- " in knob list\n";
+ std::string error =
+ "Unable to find knob: " + variableName + " in knob list\n";
phosphor::logging::log<phosphor::logging::level::ERR>(error.c_str());
return false;
@@ -676,8 +675,8 @@
{
if (!getKnobs(filePath))
{
- std::string error = "Unable to get knobs in file: " +
- std::string(filePath);
+ std::string error =
+ "Unable to get knobs in file: " + std::string(filePath);
throw std::runtime_error(error);
}
}
diff --git a/include/bridgingcommands.hpp b/include/bridgingcommands.hpp
index 9123174..8fbbc8d 100644
--- a/include/bridgingcommands.hpp
+++ b/include/bridgingcommands.hpp
@@ -74,9 +74,9 @@
constexpr size_t ipmbChecksum2StartOffset = 3;
constexpr size_t ipmbChecksumSize = 1;
constexpr size_t ipmbMinFrameLength = 7;
-constexpr size_t ipmbMaxFrameLength = ipmbConnectionHeaderLength +
- ipmbResponseDataHeaderLength +
- ipmbChecksumSize + ipmbMaxDataSize;
+constexpr size_t ipmbMaxFrameLength =
+ ipmbConnectionHeaderLength + ipmbResponseDataHeaderLength +
+ ipmbChecksumSize + ipmbMaxDataSize;
/**
* @brief Channel types
diff --git a/include/commandutils.hpp b/include/commandutils.hpp
index 7ed49c8..12d8b2b 100644
--- a/include/commandutils.hpp
+++ b/include/commandutils.hpp
@@ -37,10 +37,9 @@
}
}
-inline static void ipmiPrintAndRegister(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
- ipmi_context_t context,
- ipmid_callback_t handler,
- ipmi_cmd_privilege_t priv)
+inline static void ipmiPrintAndRegister(
+ ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_context_t context,
+ ipmid_callback_t handler, ipmi_cmd_privilege_t priv)
{
printRegistration(netfn, cmd);
ipmi_register_callback(netfn, cmd, context, handler, priv);
diff --git a/include/ipmi_to_redfish_hooks.hpp b/include/ipmi_to_redfish_hooks.hpp
index aefc85c..76f8b92 100644
--- a/include/ipmi_to_redfish_hooks.hpp
+++ b/include/ipmi_to_redfish_hooks.hpp
@@ -82,8 +82,8 @@
// Log the record as a default Redfish message instead of a SEL record
static const std::string openBMCMessageRegistryVersion("0.1");
- std::string messageID = "OpenBMC." + openBMCMessageRegistryVersion +
- ".SELEntryAdded";
+ std::string messageID =
+ "OpenBMC." + openBMCMessageRegistryVersion + ".SELEntryAdded";
std::vector<std::string> messageArgs;
messageArgs.push_back(ipmiRaw);
diff --git a/include/manufacturingcommands.hpp b/include/manufacturingcommands.hpp
index f8eae09..7c85219 100644
--- a/include/manufacturingcommands.hpp
+++ b/include/manufacturingcommands.hpp
@@ -270,8 +270,8 @@
{
auto it = std::find_if(ledPropertyList.begin(), ledPropertyList.end(),
[&signal](const LedProperty& led) {
- return led.getSignal() == signal;
- });
+ return led.getSignal() == signal;
+ });
if (it != ledPropertyList.end())
{
return &(*it);
diff --git a/include/sdrutils.hpp b/include/sdrutils.hpp
index 9ec1611..ed28314 100644
--- a/include/sdrutils.hpp
+++ b/include/sdrutils.hpp
@@ -119,9 +119,8 @@
if ((numStreakRead == 0) && (numReadings != 0))
{
std::cerr << "IPMI sensor " << sensorName
- << ": Recovered reading, value=" << reading
- << " byte=" << raw
- << ", Reading counts good=" << numReadings
+ << ": Recovered reading, value=" << reading << " byte="
+ << raw << ", Reading counts good=" << numReadings
<< " miss=" << numMissings
<< ", Prior miss streak=" << numStreakMiss << "\n";
}
@@ -249,10 +248,10 @@
sensorTreePtr = std::make_shared<SensorSubTree>();
- auto mapperCall = dbus.new_method_call("xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper",
- "GetSubTree");
+ auto mapperCall =
+ dbus.new_method_call("xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTree");
static constexpr const auto depth = 2;
static constexpr std::array<const char*, 3> interfaces = {
"xyz.openbmc_project.Sensor.Value",
@@ -539,10 +538,9 @@
// Follow Association properties for Sensor back to the Board dbus object to
// check for an EntityId and EntityInstance property.
-static inline void updateIpmiFromAssociation(const std::string& path,
- const SensorMap& sensorMap,
- uint8_t& entityId,
- uint8_t& entityInstance)
+static inline void updateIpmiFromAssociation(
+ const std::string& path, const SensorMap& sensorMap, uint8_t& entityId,
+ uint8_t& entityInstance)
{
namespace fs = std::filesystem;
diff --git a/include/sensorutils.hpp b/include/sensorutils.hpp
index c7ce53e..e06b2e1 100644
--- a/include/sensorutils.hpp
+++ b/include/sensorutils.hpp
@@ -155,10 +155,9 @@
// To use with Wolfram Alpha, make all variables single letters
// bExp becomes E, rExp becomes R
// https://www.wolframalpha.com/input/?i=y%3D%28%28M*x%29%2B%28B*%2810%5EE%29%29%29*%2810%5ER%29
-static inline bool getSensorAttributes(const double max, const double min,
- int16_t& mValue, int8_t& rExp,
- int16_t& bValue, int8_t& bExp,
- bool& bSigned)
+static inline bool getSensorAttributes(
+ const double max, const double min, int16_t& mValue, int8_t& rExp,
+ int16_t& bValue, int8_t& bExp, bool& bSigned)
{
if (!(std::isfinite(min)))
{
@@ -249,9 +248,8 @@
// Step 4: Constrain B, and set bExp accordingly
if (!(scaleFloatExp(dB, bExp)))
{
- std::cerr << "getSensorAttributes: Offset (B=" << dB
- << ", bExp=" << (int)bExp
- << ") exceeds multiplier scale (M=" << dM
+ std::cerr << "getSensorAttributes: Offset (B=" << dB << ", bExp="
+ << (int)bExp << ") exceeds multiplier scale (M=" << dM
<< ", rExp=" << (int)rExp << ")\n";
return false;
}
@@ -264,10 +262,9 @@
return true;
}
-static inline uint8_t
- scaleIPMIValueFromDouble(const double value, const int16_t mValue,
- const int8_t rExp, const int16_t bValue,
- const int8_t bExp, const bool bSigned)
+static inline uint8_t scaleIPMIValueFromDouble(
+ const double value, const int16_t mValue, const int8_t rExp,
+ const int16_t bValue, const int8_t bExp, const bool bSigned)
{
// Avoid division by zero below
if (mValue == 0)
@@ -322,8 +319,8 @@
int8_t bExp = 0;
bool bSigned = false;
- bool result = getSensorAttributes(max, min, mValue, rExp, bValue, bExp,
- bSigned);
+ bool result =
+ getSensorAttributes(max, min, mValue, rExp, bValue, bExp, bSigned);
if (!result)
{
throw std::runtime_error("Illegal sensor attributes");
diff --git a/include/smbiosmdrv2handler.hpp b/include/smbiosmdrv2handler.hpp
index 99e6bb6..bcd18c9 100644
--- a/include/smbiosmdrv2handler.hpp
+++ b/include/smbiosmdrv2handler.hpp
@@ -277,39 +277,40 @@
ipmi::DbusVariant& value,
const std::string& service);
- Mdr2DirStruct smbiosDir{smbiosAgentVersion,
- 1,
- 1,
- 1,
- 0,
- 0,
- {40,
- 41,
- 42,
- 43,
- 44,
- 45,
- 46,
- 47,
- 48,
- 49,
- 50,
- 51,
- 52,
- 53,
- 54,
- 0x42,
- 0,
- smbiosTableStorageSize,
- smbiosTableVersion,
- smbiosTableTimestamp,
- MDR2SMBIOSStatusEnum::mdr2Init,
- MDR2DirLockEnum::mdr2DirUnlock,
- 0,
- smbiosSMMemoryOffset,
- smbiosSMMemorySize,
- smbiosTableStorageSize,
- smbiosTableStorage}};
+ Mdr2DirStruct smbiosDir{
+ smbiosAgentVersion,
+ 1,
+ 1,
+ 1,
+ 0,
+ 0,
+ {40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 46,
+ 47,
+ 48,
+ 49,
+ 50,
+ 51,
+ 52,
+ 53,
+ 54,
+ 0x42,
+ 0,
+ smbiosTableStorageSize,
+ smbiosTableVersion,
+ smbiosTableTimestamp,
+ MDR2SMBIOSStatusEnum::mdr2Init,
+ MDR2DirLockEnum::mdr2DirUnlock,
+ 0,
+ smbiosSMMemoryOffset,
+ smbiosSMMemorySize,
+ smbiosTableStorageSize,
+ smbiosTableStorage}};
std::unique_ptr<SharedMemoryArea> area;
std::unique_ptr<sdbusplus::Timer> timer;
diff --git a/include/storagecommands.hpp b/include/storagecommands.hpp
index c359702..221cecc 100644
--- a/include/storagecommands.hpp
+++ b/include/storagecommands.hpp
@@ -272,8 +272,8 @@
uint8_t pwrStateNotification, uint8_t capabilities,
uint8_t eid, uint8_t entityInst, uint8_t mfrDefined,
const std::string& sensorname) :
- targetAddress(address),
- channelNumber(chNumber), powerStateNotification(pwrStateNotification),
+ targetAddress(address), channelNumber(chNumber),
+ powerStateNotification(pwrStateNotification),
deviceCapabilities(capabilities), reserved{}, entityID(eid),
entityInstance(entityInst), oem(mfrDefined)
{
@@ -281,9 +281,9 @@
header.sdr_version = ipmiSdrVersion;
header.record_type = 0x12;
size_t nameLen = std::min(sensorname.size(), sizeof(name));
- header.record_length = sizeof(Type12Record) -
- sizeof(get_sdr::SensorDataRecordHeader) -
- sizeof(name) + nameLen;
+ header.record_length =
+ sizeof(Type12Record) - sizeof(get_sdr::SensorDataRecordHeader) -
+ sizeof(name) + nameLen;
typeLengthCode = 0xc0 | nameLen;
std::copy(sensorname.begin(), sensorname.begin() + nameLen, name);
}
diff --git a/src/allowlist-filter.cpp b/src/allowlist-filter.cpp
index d02a826..0dbc270 100644
--- a/src/allowlist-filter.cpp
+++ b/src/allowlist-filter.cpp
@@ -108,8 +108,8 @@
ipmi::registerFilter(ipmi::prioOpenBmcBase,
[this](ipmi::message::Request::ptr request) {
- return filterMessage(request);
- });
+ return filterMessage(request);
+ });
channelSMM = getSMMChannel();
// wait until io->run is going to fetch RestrictionMode
@@ -120,8 +120,8 @@
{
try
{
- auto service = ipmi::getService(*bus, restrictionModeIntf,
- restrictionModePath);
+ auto service =
+ ipmi::getService(*bus, restrictionModeIntf, restrictionModePath);
ipmi::Value v =
ipmi::getDbusProperty(*bus, service, restrictionModePath,
restrictionModeIntf, "RestrictionMode");
@@ -139,11 +139,11 @@
try
{
- auto service = ipmi::getService(*bus, systemOsStatusIntf,
- systemOsStatusPath);
- ipmi::Value v = ipmi::getDbusProperty(*bus, service, systemOsStatusPath,
- systemOsStatusIntf,
- "OperatingSystemState");
+ auto service =
+ ipmi::getService(*bus, systemOsStatusIntf, systemOsStatusPath);
+ ipmi::Value v =
+ ipmi::getDbusProperty(*bus, service, systemOsStatusPath,
+ systemOsStatusIntf, "OperatingSystemState");
auto& value = std::get<std::string>(v);
updatePostComplete(value);
log<level::INFO>("Read POST complete value",
@@ -267,16 +267,16 @@
bus->async_method_call(
[this](boost::system::error_code ec, const ipmi::Value& v) {
- if (ec)
- {
- log<level::ERR>(
- "async call failed, coreBIOSDone asserted as default");
- return;
- }
- coreBIOSDone = std::get<bool>(v);
- log<level::INFO>("Read CoreBiosDone",
- entry("VALUE=%d", static_cast<int>(coreBIOSDone)));
- },
+ if (ec)
+ {
+ log<level::ERR>(
+ "async call failed, coreBIOSDone asserted as default");
+ return;
+ }
+ coreBIOSDone = std::get<bool>(v);
+ log<level::INFO>("Read CoreBiosDone",
+ entry("VALUE=%d", static_cast<int>(coreBIOSDone)));
+ },
coreBiosDoneService, coreBiosDonePath,
"org.freedesktop.DBus.Properties", "Get", hostMiscIntf, "CoreBiosDone");
}
@@ -292,8 +292,8 @@
auto it =
std::find_if(propertyList.begin(), propertyList.end(),
[](const std::pair<std::string, ipmi::Value>& prop) {
- return prop.first == "CoreBiosDone";
- });
+ return prop.first == "CoreBiosDone";
+ });
if (it != propertyList.end())
{
@@ -392,12 +392,12 @@
allowlist.cbegin(), allowlist.cend(),
std::make_tuple(request->ctx->netFn, request->ctx->cmd, channelMask),
[](const netfncmd_tuple& first, const netfncmd_tuple& value) {
- return (std::get<2>(first) & std::get<2>(value))
- ? first < std::make_tuple(std::get<0>(value),
- std::get<1>(value),
- std::get<2>(first))
- : first < value;
- });
+ return (std::get<2>(first) & std::get<2>(value))
+ ? first < std::make_tuple(std::get<0>(value),
+ std::get<1>(value),
+ std::get<2>(first))
+ : first < value;
+ });
// no special handling for non-system-interface channels
if (!(request->ctx->channel == ipmi::channelSystemIface ||
diff --git a/src/appcommands.cpp b/src/appcommands.cpp
index ab032c7..b3b3ed2 100644
--- a/src/appcommands.cpp
+++ b/src/appcommands.cpp
@@ -50,8 +50,8 @@
int initBMCDeviceState(ipmi::Context::ptr ctx)
{
DbusObjectInfo objInfo;
- boost::system::error_code ec = ipmi::getDbusObject(ctx, bmcStateIntf, "/",
- "bmc0", objInfo);
+ boost::system::error_code ec =
+ ipmi::getDbusObject(ctx, bmcStateIntf, "/", "bmc0", objInfo);
if (ec)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -84,32 +84,32 @@
sdbusplus::bus::match::rules::propertiesChanged(objInfo.first,
bmcStateIntf),
[](sdbusplus::message_t& msg) {
- std::map<std::string, ipmi::DbusVariant> props;
- std::vector<std::string> inVal;
- std::string iface;
- try
- {
- msg.read(iface, props, inVal);
- }
- catch (const std::exception& e)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Exception caught in Get CurrentBMCState");
- return;
- }
-
- auto it = props.find(currentBmcStateProp);
- if (it != props.end())
- {
- std::string* state = std::get_if<std::string>(&it->second);
- if (state)
+ std::map<std::string, ipmi::DbusVariant> props;
+ std::vector<std::string> inVal;
+ std::string iface;
+ try
{
- bmcDeviceBusy = (*state != bmcStateReadyStr);
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "BMC device state updated");
+ msg.read(iface, props, inVal);
}
- }
- });
+ catch (const std::exception& e)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Exception caught in Get CurrentBMCState");
+ return;
+ }
+
+ auto it = props.find(currentBmcStateProp);
+ if (it != props.end())
+ {
+ std::string* state = std::get_if<std::string>(&it->second);
+ if (state)
+ {
+ bmcDeviceBusy = (*state != bmcStateReadyStr);
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "BMC device state updated");
+ }
+ }
+ });
return 0;
}
@@ -381,10 +381,10 @@
}
}
- return ipmi::responseSuccess(devId.id, devId.revision, devId.fwMajor,
- bmcDeviceBusy, devId.fwMinor, devId.ipmiVer,
- devId.addnDevSupport, devId.manufId,
- devId.prodId, devId.aux);
+ return ipmi::responseSuccess(
+ devId.id, devId.revision, devId.fwMajor, bmcDeviceBusy, devId.fwMinor,
+ devId.ipmiVer, devId.addnDevSupport, devId.manufId, devId.prodId,
+ devId.aux);
}
static void registerAPPFunctions(void)
diff --git a/src/biosconfigcommands.cpp b/src/biosconfigcommands.cpp
index 8fbdbf5..ba2610a 100644
--- a/src/biosconfigcommands.cpp
+++ b/src/biosconfigcommands.cpp
@@ -199,8 +199,8 @@
return false;
}
- std::string service = getService(*dbus, biosConfigIntf,
- biosConfigBaseMgrPath);
+ std::string service =
+ getService(*dbus, biosConfigIntf, biosConfigBaseMgrPath);
try
{
@@ -404,20 +404,20 @@
{
pSdBusPlus->async_method_call(
[](const boost::system::error_code ec) {
- /* No more need to keep attributes data in memory */
- attributesData.clear();
+ /* No more need to keep attributes data in memory */
+ attributesData.clear();
- if (ec)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "sendAllAttributes error: send all attributes - "
- "failed");
- return;
- }
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "sendAllAttributes error: send all attributes - "
+ "failed");
+ return;
+ }
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "sendAllAttributes: send all attributes - done");
- },
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "sendAllAttributes: send all attributes - done");
+ },
service, biosConfigBaseMgrPath,
"org.freedesktop.DBus.Properties", "Set", biosConfigIntf,
"BaseBIOSTable",
@@ -467,11 +467,11 @@
try
{
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- Value variant =
- getDbusProperty(*dbus, "xyz.openbmc_project.State.Host0",
- "/xyz/openbmc_project/state/host0",
- "xyz.openbmc_project.State.OperatingSystem.Status",
- "OperatingSystemState");
+ Value variant = getDbusProperty(
+ *dbus, "xyz.openbmc_project.State.Host0",
+ "/xyz/openbmc_project/state/host0",
+ "xyz.openbmc_project.State.OperatingSystem.Status",
+ "OperatingSystemState");
auto& value = std::get<std::string>(variant);
// The short strings "Standby" is deprecated in favor of the
@@ -498,8 +498,8 @@
try
{
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, biosConfigIntf,
- biosConfigBaseMgrPath);
+ std::string service =
+ getService(*dbus, biosConfigIntf, biosConfigBaseMgrPath);
Value variant = getDbusProperty(*dbus, service, biosConfigBaseMgrPath,
biosConfigIntf, resetBIOSSettingsProp);
@@ -682,9 +682,9 @@
}
}
-ipmi::RspType<uint32_t> ipmiOEMSetPayload(ipmi::Context::ptr&, uint8_t paramSel,
- uint8_t payloadType,
- std::vector<uint8_t> payload)
+ipmi::RspType<uint32_t>
+ ipmiOEMSetPayload(ipmi::Context::ptr&, uint8_t paramSel,
+ uint8_t payloadType, std::vector<uint8_t> payload)
{
uint8_t biosCapOffsetBit = 2; // BIT:1 0-OOB BIOS config not supported
// 1-OOB BIOS config is supported
@@ -778,8 +778,8 @@
return ipmi::response(ipmiCCPayloadChecksumFailed);
}
// store the data in temp file
- std::string FilePath = "/var/oob/temp" +
- std::to_string(payloadType);
+ std::string FilePath =
+ "/var/oob/temp" + std::to_string(payloadType);
std::ofstream outFile(FilePath, std::ios::binary | std::ios::app);
outFile.seekp(pPayloadInProgress->payloadOffset);
@@ -816,12 +816,12 @@
{
return ipmi::response(ipmiCCPayloadPayloadInComplete);
}
- std::string tempFilePath = "/var/oob/temp" +
- std::to_string(payloadType);
- std::string payloadFilePath = "/var/oob/Payload" +
- std::to_string(payloadType);
- auto renamestatus = std::rename(tempFilePath.c_str(),
- payloadFilePath.c_str());
+ std::string tempFilePath =
+ "/var/oob/temp" + std::to_string(payloadType);
+ std::string payloadFilePath =
+ "/var/oob/Payload" + std::to_string(payloadType);
+ auto renamestatus =
+ std::rename(tempFilePath.c_str(), payloadFilePath.c_str());
if (renamestatus)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -899,8 +899,8 @@
gNVOOBdata.payloadInfo[payloadType].payloadType = 0;
gNVOOBdata.payloadInfo[payloadType].payloadTotalSize = 0;
// Delete the temp file
- std::string tempFilePath = "/var/oob/temp" +
- std::to_string(payloadType);
+ std::string tempFilePath =
+ "/var/oob/temp" + std::to_string(payloadType);
unlink(tempFilePath.c_str());
flushNVOOBdata();
return ipmi::responseSuccess();
@@ -952,8 +952,8 @@
{
case ipmi::GetPayloadParameter::GetPayloadInfo:
{
- std::string payloadFilePath = "/var/oob/Payload" +
- std::to_string(payloadType);
+ std::string payloadFilePath =
+ "/var/oob/Payload" + std::to_string(payloadType);
std::ifstream ifs(payloadFilePath,
std::ios::in | std::ios::binary | std::ios::ate);
@@ -991,8 +991,8 @@
}
uint32_t offset = reqData.at(0);
uint32_t length = reqData.at(1);
- std::string payloadFilePath = "/var/oob/Payload" +
- std::to_string(payloadType);
+ std::string payloadFilePath =
+ "/var/oob/Payload" + std::to_string(payloadType);
if (length > static_cast<uint32_t>(maxGetPayloadDataSize))
{
@@ -1004,9 +1004,9 @@
return ipmi::responseInvalidFieldRequest();
}
- std::ifstream ifs(payloadFilePath, std::ios::in |
- std::ios::binary |
- std::ios::ate);
+ std::ifstream ifs(payloadFilePath,
+ std::ios::in | std::ios::binary |
+ std::ios::ate);
if (!ifs.good())
{
diff --git a/src/bridgingcommands.cpp b/src/bridgingcommands.cpp
index eb6d903..465659f 100644
--- a/src/bridgingcommands.cpp
+++ b/src/bridgingcommands.cpp
@@ -98,8 +98,8 @@
ipmbConnectionHeaderLength);
}
-static inline bool ipmbDataChecksumValidate(const ipmbHeader* ipmbHeader,
- size_t length)
+static inline bool
+ ipmbDataChecksumValidate(const ipmbHeader* ipmbHeader, size_t length)
{
return ipmbChecksumValidate((reinterpret_cast<const uint8_t*>(ipmbHeader) +
ipmbConnectionHeaderLength),
@@ -136,9 +136,9 @@
rqLun = ipmbLunFromSeqLunGet(ipmbBuffer->Header.Req.rqSeqLUN);
cmd = ipmbBuffer->Header.Req.cmd;
- size_t dataLength = bufferLength -
- (ipmbConnectionHeaderLength +
- ipmbRequestDataHeaderLength + ipmbChecksumSize);
+ size_t dataLength =
+ bufferLength - (ipmbConnectionHeaderLength +
+ ipmbRequestDataHeaderLength + ipmbChecksumSize);
if (dataLength > 0)
{
@@ -151,9 +151,8 @@
uint8_t rsSA, uint8_t seq, uint8_t rsLun,
uint8_t cmd, uint8_t completionCode,
std::vector<uint8_t>& inputData) :
- address(address),
- netFn(netFn), rqLun(rqLun), rsSA(rsSA), seq(seq), rsLun(rsLun), cmd(cmd),
- completionCode(completionCode)
+ address(address), netFn(netFn), rqLun(rqLun), rsSA(rsSA), seq(seq),
+ rsLun(rsLun), cmd(cmd), completionCode(completionCode)
{
data.reserve(ipmbMaxDataSize);
@@ -240,10 +239,9 @@
}
}
-ipmi::Cc Bridging::handleIpmbChannel(ipmi::Context::ptr& ctx,
- const uint8_t tracking,
- const std::vector<uint8_t>& msgData,
- std::vector<uint8_t>& rspData)
+ipmi::Cc Bridging::handleIpmbChannel(
+ ipmi::Context::ptr& ctx, const uint8_t tracking,
+ const std::vector<uint8_t>& msgData, std::vector<uint8_t>& rspData)
{
ipmi::Manufacturing mtm;
@@ -323,9 +321,9 @@
std::tie(status, netFn, lun, cmd, cc, dataReceived) = ipmbResponse;
- auto respReceived = IpmbResponse(ipmbRequest.rqSA, netFn, lun,
- ipmbRequest.address, ipmbRequest.seq, lun,
- cmd, cc, dataReceived);
+ auto respReceived =
+ IpmbResponse(ipmbRequest.rqSA, netFn, lun, ipmbRequest.address,
+ ipmbRequest.seq, lun, cmd, cc, dataReceived);
// check IPMB layer status
if (status)
@@ -614,12 +612,10 @@
* @return IPMI completion code on success
*/
-ipmi::RspType<> ipmiAppClearMessageFlags(ipmi::Context::ptr& ctx,
- bool receiveMessage,
- bool eventMsgBufFull, bool reserved2,
- bool watchdogTimeout, bool reserved1,
- bool /* oem0 */, bool /* oem1 */,
- bool /* oem2 */)
+ipmi::RspType<> ipmiAppClearMessageFlags(
+ ipmi::Context::ptr& ctx, bool receiveMessage, bool eventMsgBufFull,
+ bool reserved2, bool watchdogTimeout, bool reserved1, bool /* oem0 */,
+ bool /* oem1 */, bool /* oem2 */)
{
ipmi::ChannelInfo chInfo;
diff --git a/src/chassiscommands.cpp b/src/chassiscommands.cpp
index 8a40017..8e5c836 100644
--- a/src/chassiscommands.cpp
+++ b/src/chassiscommands.cpp
@@ -97,8 +97,8 @@
try
{
std::string service = LEDService.getService(*bus);
- ipmi::Value enabled = getDbusProperty(*bus, service, objName,
- ledInterface, ledProp);
+ ipmi::Value enabled =
+ getDbusProperty(*bus, service, objName, ledInterface, ledProp);
state = std::get<bool>(enabled);
}
catch (const sdbusplus::exception_t& e)
@@ -227,8 +227,8 @@
try
{
- auto service = ipmi::getService(*busp, powerRestoreIntf,
- powerRestorePath);
+ auto service =
+ ipmi::getService(*busp, powerRestoreIntf, powerRestorePath);
ipmi::Value result =
ipmi::getDbusProperty(*busp, service, powerRestorePath,
@@ -279,8 +279,8 @@
"/xyz/openbmc_project/state/chassis0";
constexpr const char* chassisStateIntf =
"xyz.openbmc_project.State.Chassis";
- auto service = ipmi::getService(*busp, chassisStateIntf,
- chassisStatePath);
+ auto service =
+ ipmi::getService(*busp, chassisStateIntf, chassisStatePath);
ipmi::Value variant =
ipmi::getDbusProperty(*busp, service, chassisStatePath,
@@ -377,8 +377,8 @@
"xyz.openbmc_project.Control.Host.RestartCause";
std::string service;
- boost::system::error_code ec = ipmi::getService(ctx, restartCauseIntf,
- restartCausePath, service);
+ boost::system::error_code ec =
+ ipmi::getService(ctx, restartCauseIntf, restartCausePath, service);
if (!ec)
{
diff --git a/src/firmware-update.cpp b/src/firmware-update.cpp
index 1e8b480..8a8a53d 100644
--- a/src/firmware-update.cpp
+++ b/src/firmware-update.cpp
@@ -380,30 +380,30 @@
sdbusplus::bus::match::rules::propertiesChanged(
objPath, "xyz.openbmc_project.Software.ActivationProgress"),
[&](sdbusplus::message_t& msg) {
- std::map<std::string, ipmi::DbusVariant> props;
- std::vector<std::string> inVal;
- std::string iface;
- try
- {
- msg.read(iface, props, inVal);
- }
- catch (const std::exception& e)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Exception caught in get ActivationProgress");
- return;
- }
-
- auto it = props.find("Progress");
- if (it != props.end())
- {
- progressPercent = std::get<uint8_t>(it->second);
- if (progressPercent == 100)
+ std::map<std::string, ipmi::DbusVariant> props;
+ std::vector<std::string> inVal;
+ std::string iface;
+ try
{
- fwUpdateState = fwStateUpdateSuccess;
+ msg.read(iface, props, inVal);
}
- }
- });
+ catch (const std::exception& e)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Exception caught in get ActivationProgress");
+ return;
+ }
+
+ auto it = props.find("Progress");
+ if (it != props.end())
+ {
+ progressPercent = std::get<uint8_t>(it->second);
+ if (progressPercent == 100)
+ {
+ fwUpdateState = fwStateUpdateSuccess;
+ }
+ }
+ });
}
uint8_t activationTimerTimeout()
{
@@ -465,13 +465,13 @@
std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
bus->async_method_call(
[](const boost::system::error_code ec) {
- if (ec)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "async_method_call error: activateImage failed");
- return;
- }
- },
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "async_method_call error: activateImage failed");
+ return;
+ }
+ },
"xyz.openbmc_project.Software.BMC.Updater", objPath,
"org.freedesktop.DBus.Properties", "Set",
"xyz.openbmc_project.Software.Activation", "RequestedActivation",
@@ -562,8 +562,9 @@
std::unique_ptr<sdbusplus::bus::match_t>& fwUpdateMatchSignal)
{
// Setup timer for watching signal
- static sdbusplus::Timer timer(
- [&fwUpdateMatchSignal]() { fwUpdateMatchSignal = nullptr; });
+ static sdbusplus::Timer timer([&fwUpdateMatchSignal]() {
+ fwUpdateMatchSignal = nullptr;
+ });
static sdbusplus::Timer activationStatusTimer([]() {
if (fwUpdateStatus.activationTimerTimeout() > 95)
@@ -831,12 +832,13 @@
}
#ifdef INTEL_PFR_ENABLED
-using fwVersionInfoType = std::tuple<uint8_t, // ID Tag
- uint8_t, // Major Version Number
- uint8_t, // Minor Version Number
- uint32_t, // Build Number
- uint32_t, // Build Timestamp
- uint32_t>; // Update Timestamp
+using fwVersionInfoType =
+ std::tuple<uint8_t, // ID Tag
+ uint8_t, // Major Version Number
+ uint8_t, // Minor Version Number
+ uint32_t, // Build Number
+ uint32_t, // Build Timestamp
+ uint32_t>; // Update Timestamp
ipmi::RspType<uint8_t, std::vector<fwVersionInfoType>> ipmiGetFwVersionInfo()
{
// Byte 1 - Count (N) Number of devices data is being returned for.
@@ -926,9 +928,8 @@
return ipmi::responseSuccess(fwVerInfoList.size(), fwVerInfoList);
}
-std::array<uint8_t, imageCount> getSecurityVersionInfo(const char* mtdDevBuf,
- size_t svnVerOffsetInPfm,
- size_t bkcVerOffsetInPfm)
+std::array<uint8_t, imageCount> getSecurityVersionInfo(
+ const char* mtdDevBuf, size_t svnVerOffsetInPfm, size_t bkcVerOffsetInPfm)
{
constexpr size_t bufLength = 1;
std::array<uint8_t, imageCount> fwSecurityVersionBuf = {0}, temp;
@@ -1301,10 +1302,9 @@
* @returns IPMI completion code plus response data
* - Byte 2: Current control status
**/
-ipmi::RspType<bool, bool, bool, bool, uint4_t>
- ipmiGetSetFirmwareUpdateControl(const ipmi::Context::ptr& ctx,
- const uint8_t controlReq,
- const std::optional<std::string>& fileName)
+ipmi::RspType<bool, bool, bool, bool, uint4_t> ipmiGetSetFirmwareUpdateControl(
+ const ipmi::Context::ptr& ctx, const uint8_t controlReq,
+ const std::optional<std::string>& fileName)
{
bool isIPMBChannel = false;
@@ -1687,8 +1687,8 @@
static void registerFirmwareFunctions()
{
// guarantee that we start with an already timed out timestamp
- fwRandomNumGenTs = std::chrono::steady_clock::now() -
- fwRandomNumExpirySeconds;
+ fwRandomNumGenTs =
+ std::chrono::steady_clock::now() - fwRandomNumExpirySeconds;
fwUpdateStatus.setState(
static_cast<uint8_t>(FwUpdateStatusCache::fwStateInit));
diff --git a/src/ipmi_to_redfish_hooks.cpp b/src/ipmi_to_redfish_hooks.cpp
index 98ee532..d2eac78 100644
--- a/src/ipmi_to_redfish_hooks.cpp
+++ b/src/ipmi_to_redfish_hooks.cpp
@@ -49,8 +49,8 @@
// Walk through the SEL request record to build the appropriate Redfish
// message
static constexpr std::string_view openBMCMessageRegistryVersion = "0.1";
- std::string messageID = "OpenBMC." +
- std::string(openBMCMessageRegistryVersion);
+ std::string messageID =
+ "OpenBMC." + std::string(openBMCMessageRegistryVersion);
std::vector<std::string> messageArgs;
BIOSSensors sensor = static_cast<BIOSSensors>(selData.sensorNum);
BIOSEventTypes eventType = static_cast<BIOSEventTypes>(selData.eventType);
@@ -296,8 +296,8 @@
}
else
{
- std::string messageArgsString = boost::algorithm::join(messageArgs,
- ",");
+ std::string messageArgsString =
+ boost::algorithm::join(messageArgs, ",");
phosphor::logging::log<phosphor::logging::level::INFO>(
journalMsg.c_str(),
phosphor::logging::entry("REDFISH_MESSAGE_ID=%s",
@@ -319,8 +319,8 @@
// Walk through the SEL request record to build the appropriate Redfish
// message
static constexpr std::string_view openBMCMessageRegistryVersion = "0.1";
- std::string messageID = "OpenBMC." +
- std::string(openBMCMessageRegistryVersion);
+ std::string messageID =
+ "OpenBMC." + std::string(openBMCMessageRegistryVersion);
std::vector<std::string> messageArgs;
BIOSSMISensors sensor = static_cast<BIOSSMISensors>(selData.sensorNum);
BIOSEventTypes eventType = static_cast<BIOSEventTypes>(selData.eventType);
@@ -869,22 +869,23 @@
{
// Save the raw IPMI string of the request
std::string ipmiRaw;
- std::array selBytes = {static_cast<uint8_t>(recordID),
- static_cast<uint8_t>(recordID >> 8),
- recordType,
- static_cast<uint8_t>(timestamp),
- static_cast<uint8_t>(timestamp >> 8),
- static_cast<uint8_t>(timestamp >> 16),
- static_cast<uint8_t>(timestamp >> 24),
- static_cast<uint8_t>(generatorID),
- static_cast<uint8_t>(generatorID >> 8),
- evmRev,
- sensorType,
- sensorNum,
- eventType,
- eventData1,
- eventData2,
- eventData3};
+ std::array selBytes = {
+ static_cast<uint8_t>(recordID),
+ static_cast<uint8_t>(recordID >> 8),
+ recordType,
+ static_cast<uint8_t>(timestamp),
+ static_cast<uint8_t>(timestamp >> 8),
+ static_cast<uint8_t>(timestamp >> 16),
+ static_cast<uint8_t>(timestamp >> 24),
+ static_cast<uint8_t>(generatorID),
+ static_cast<uint8_t>(generatorID >> 8),
+ evmRev,
+ sensorType,
+ sensorNum,
+ eventType,
+ eventData1,
+ eventData2,
+ eventData3};
redfish_hooks::toHexStr(boost::beast::span<uint8_t>(selBytes), ipmiRaw);
// First check that this is a system event record type since that
@@ -896,12 +897,13 @@
}
// Extract the SEL data for the hook
- redfish_hooks::SELData selData = {.generatorID = generatorID,
- .sensorNum = sensorNum,
- .eventType = eventType,
- .offset = eventData1 & 0x0F,
- .eventData2 = eventData2,
- .eventData3 = eventData3};
+ redfish_hooks::SELData selData = {
+ .generatorID = generatorID,
+ .sensorNum = sensorNum,
+ .eventType = eventType,
+ .offset = eventData1 & 0x0F,
+ .eventData2 = eventData2,
+ .eventData3 = eventData3};
return redfish_hooks::startRedfishHook(selData, ipmiRaw);
}
@@ -912,24 +914,26 @@
{
// Save the raw IPMI string of the selData
std::string ipmiRaw;
- std::array selBytes = {static_cast<uint8_t>(generatorID),
- static_cast<uint8_t>(generatorID >> 8),
- evmRev,
- sensorType,
- sensorNum,
- eventType,
- eventData1,
- eventData2,
- eventData3};
+ std::array selBytes = {
+ static_cast<uint8_t>(generatorID),
+ static_cast<uint8_t>(generatorID >> 8),
+ evmRev,
+ sensorType,
+ sensorNum,
+ eventType,
+ eventData1,
+ eventData2,
+ eventData3};
redfish_hooks::toHexStr(boost::beast::span<uint8_t>(selBytes), ipmiRaw);
// Extract the SEL data for the hook
- redfish_hooks::SELData selData = {.generatorID = generatorID,
- .sensorNum = sensorNum,
- .eventType = eventType,
- .offset = eventData1 & 0x0F,
- .eventData2 = eventData2,
- .eventData3 = eventData3};
+ redfish_hooks::SELData selData = {
+ .generatorID = generatorID,
+ .sensorNum = sensorNum,
+ .eventType = eventType,
+ .offset = eventData1 & 0x0F,
+ .eventData2 = eventData2,
+ .eventData3 = eventData3};
return redfish_hooks::startRedfishHook(selData, ipmiRaw);
}
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index 2bcb348..865b3a1 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -223,11 +223,10 @@
initData();
}
-int8_t Manufacturing::getProperty(const std::string& service,
- const std::string& path,
- const std::string& interface,
- const std::string& propertyName,
- ipmi::Value* reply)
+int8_t Manufacturing::getProperty(
+ const std::string& service, const std::string& path,
+ const std::string& interface, const std::string& propertyName,
+ ipmi::Value* reply)
{
try
{
@@ -243,11 +242,10 @@
return 0;
}
-int8_t Manufacturing::setProperty(const std::string& service,
- const std::string& path,
- const std::string& interface,
- const std::string& propertyName,
- ipmi::Value value)
+int8_t Manufacturing::setProperty(
+ const std::string& service, const std::string& path,
+ const std::string& interface, const std::string& propertyName,
+ ipmi::Value value)
{
try
{
@@ -536,8 +534,8 @@
{
constexpr const char* netBasePath = "/sys/class/net/eth";
constexpr const char* carrierSuffix = "/carrier";
- std::ifstream netIfs(netBasePath + std::to_string(instance) +
- carrierSuffix);
+ std::ifstream netIfs(
+ netBasePath + std::to_string(instance) + carrierSuffix);
if (!netIfs.good())
{
return ipmi::responseInvalidFieldRequest();
@@ -672,9 +670,9 @@
pwmName = "Pwm_" + std::to_string(instance + 1);
}
fanPwmInstancePath = fanPwmPath + pwmName;
- ret = mtm.setProperty(fanService, fanPwmInstancePath,
- fanIntf, "Value",
- static_cast<double>(pwmValue));
+ ret =
+ mtm.setProperty(fanService, fanPwmInstancePath, fanIntf,
+ "Value", static_cast<double>(pwmValue));
if (ret < 0)
{
return ipmi::responseUnspecifiedError();
@@ -704,8 +702,8 @@
return ipmi::response(retCode);
}
- if ((mtm.mtmTestBeepFd = ::open(beepDevName,
- O_RDWR | O_CLOEXEC)) < 0)
+ if ((mtm.mtmTestBeepFd =
+ ::open(beepDevName, O_RDWR | O_CLOEXEC)) < 0)
{
lg2::error("Failed to open input device");
return ipmi::responseUnspecifiedError();
@@ -766,8 +764,8 @@
lg2::error("Failed to query HSBP drive sub tree objects");
return ipmi::responseUnspecifiedError();
}
- std::string driveObjPath = driveBasePath + "Drive_" +
- std::to_string(instance + 1);
+ std::string driveObjPath =
+ driveBasePath + "Drive_" + std::to_string(instance + 1);
if (std::find(driveList.begin(), driveList.end(), driveObjPath) ==
driveList.end())
{
@@ -981,8 +979,8 @@
writeData.push_back(static_cast<uint8_t>(macOffset));
std::vector<uint8_t> readBuf(macRecordSize);
std::string i2cBus = "/dev/i2c-" + std::to_string(fruBus);
- ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, fruAddress, writeData,
- readBuf);
+ ipmi::Cc retI2C =
+ ipmi::i2cWriteRead(i2cBus, fruAddress, writeData, readBuf);
if (retI2C == ipmi::ccSuccess)
{
uint8_t cs = calculateChecksum(readBuf.cbegin(), readBuf.cend());
@@ -1025,14 +1023,14 @@
writeData.push_back(macHeader);
std::for_each(ethData.cbegin(), ethData.cend(),
[&](uint8_t i) { writeData.push_back(i); });
- uint8_t macCheckSum = calculateChecksum(++writeData.cbegin(),
- writeData.cend());
+ uint8_t macCheckSum =
+ calculateChecksum(++writeData.cbegin(), writeData.cend());
writeData.push_back(macCheckSum);
std::string i2cBus = "/dev/i2c-" + std::to_string(fruBus);
std::vector<uint8_t> readBuf;
- ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, fruAddress, writeData,
- readBuf);
+ ipmi::Cc ret =
+ ipmi::i2cWriteRead(i2cBus, fruAddress, writeData, readBuf);
// prepare for read to detect chip is write protected
writeData.resize(1);
@@ -1108,9 +1106,9 @@
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", ethData.at(0),
ethData.at(1), ethData.at(2), ethData.at(3), ethData.at(4),
ethData.at(5));
- std::ofstream oEthFile(factoryEthAddrBaseFileName +
- std::to_string(dataType),
- std::ofstream::out);
+ std::ofstream oEthFile(
+ factoryEthAddrBaseFileName + std::to_string(dataType),
+ std::ofstream::out);
if (!oEthFile.good())
{
return ipmi::responseUnspecifiedError();
@@ -1137,9 +1135,9 @@
constexpr uint8_t invalidData = 0;
constexpr uint8_t validData = 1;
- std::ifstream iEthFile(factoryEthAddrBaseFileName +
- std::to_string(dataType),
- std::ifstream::in);
+ std::ifstream iEthFile(
+ factoryEthAddrBaseFileName + std::to_string(dataType),
+ std::ifstream::in);
if (!iEthFile.good())
{
if (readMacFromFru(ctx, dataType, ethData))
@@ -1263,8 +1261,8 @@
std::vector<uint8_t> readBuf(readCount);
- ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
- readBuf);
+ ipmi::Cc retI2C =
+ ipmi::i2cWriteRead(i2cBus, targetAddr, writeData, readBuf);
if (retI2C != ipmi::ccSuccess)
{
return ipmi::response(retI2C);
@@ -1283,8 +1281,8 @@
std::vector<uint8_t> writeData = {0x61, 0x1};
std::vector<uint8_t> readBuf(0);
- ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
- readBuf);
+ ipmi::Cc retI2C =
+ ipmi::i2cWriteRead(i2cBus, targetAddr, writeData, readBuf);
return ipmi::response(retI2C);
}
@@ -1334,10 +1332,9 @@
return configPaths;
}
-static ipmi::RspType<> startOrStopService(ipmi::Context::ptr& ctx,
- const uint8_t enable,
- const std::string& serviceName,
- bool disableOrEnableUnitFiles = true)
+static ipmi::RspType<> startOrStopService(
+ ipmi::Context::ptr& ctx, const uint8_t enable,
+ const std::string& serviceName, bool disableOrEnableUnitFiles = true)
{
constexpr bool runtimeOnly = false;
constexpr bool force = false;
@@ -1404,14 +1401,13 @@
boost::algorithm::replace_first_copy(
objectPath, "/xyz/openbmc_project/inventory/system/board/", ""),
"/", "_2f");
- std::string unitName = "xyz.openbmc_project.mctpd@" + serviceArgument +
- ".service";
+ std::string unitName =
+ "xyz.openbmc_project.mctpd@" + serviceArgument + ".service";
return unitName;
}
-static ipmi::RspType<> handleMCTPFeature(ipmi::Context::ptr& ctx,
- const uint8_t enable,
- const std::string& binding)
+static ipmi::RspType<> handleMCTPFeature(
+ ipmi::Context::ptr& ctx, const uint8_t enable, const std::string& binding)
{
std::vector<std::string> configPaths;
try
@@ -1501,9 +1497,8 @@
return ipmi::responseSuccess();
}
-static ipmi::RspType<> handleMCTPSlotFeature(ipmi::Context::ptr& ctx,
- const uint8_t enable,
- const uint8_t featureArg)
+static ipmi::RspType<> handleMCTPSlotFeature(
+ ipmi::Context::ptr& ctx, const uint8_t enable, const uint8_t featureArg)
{
uint8_t slotNum = (featureArg & slotNumMask);
switch ((featureArg & muxTypeMask) >> muxTypeShift)
@@ -1549,11 +1544,9 @@
*
* @returns IPMI completion code
*/
-ipmi::RspType<> mtmBMCFeatureControl(ipmi::Context::ptr ctx,
- const uint8_t feature,
- const uint8_t enable,
- const uint8_t featureArg,
- const uint16_t reserved)
+ipmi::RspType<> mtmBMCFeatureControl(
+ ipmi::Context::ptr ctx, const uint8_t feature, const uint8_t enable,
+ const uint8_t featureArg, const uint16_t reserved)
{
if (reserved != 0)
{
@@ -1636,6 +1629,6 @@
ipmi::registerFilter(ipmi::prioOemBase,
[](ipmi::message::Request::ptr request) {
- return ipmi::mfgFilterMessage(request);
- });
+ return ipmi::mfgFilterMessage(request);
+ });
}
diff --git a/src/me_to_redfish_hooks.cpp b/src/me_to_redfish_hooks.cpp
index 8c51db2..c964608 100644
--- a/src/me_to_redfish_hooks.cpp
+++ b/src/me_to_redfish_hooks.cpp
@@ -81,22 +81,23 @@
"to ME while MCTP stack is configured in Bus Owner Proxy mode"}};
static const boost::container::flat_map<uint8_t, std::string>
- unsupportedFeature = {{0x00, "Other Segment Defined Feature"},
- {0x01, "Fast NM limiting"},
- {0x02, "Volumetric Airflow and Outlet Temperature"},
- {0x03, "CUPS"},
- {0x04, "Thermal policies and Inlet Temperature"},
- {0x05, "Platform limiting with MICs"},
- {0x07, "Shared power supplies"},
- {0x08, "MIC Proxy"},
- {0x09, "Reset warning"},
- {0x0A, "PMBus Proxy"},
- {0x0B, "Always on"},
- {0x0C, "IPMI Intel ME FW update"},
- {0x0D, "MCTP bus owner"},
- {0x0E, "MCTP bus owner proxy"},
- {0x0F, "Dual BIOS"},
- {0x10, "Battery less"}};
+ unsupportedFeature = {
+ {0x00, "Other Segment Defined Feature"},
+ {0x01, "Fast NM limiting"},
+ {0x02, "Volumetric Airflow and Outlet Temperature"},
+ {0x03, "CUPS"},
+ {0x04, "Thermal policies and Inlet Temperature"},
+ {0x05, "Platform limiting with MICs"},
+ {0x07, "Shared power supplies"},
+ {0x08, "MIC Proxy"},
+ {0x09, "Reset warning"},
+ {0x0A, "PMBus Proxy"},
+ {0x0B, "Always on"},
+ {0x0C, "IPMI Intel ME FW update"},
+ {0x0D, "MCTP bus owner"},
+ {0x0E, "MCTP bus owner proxy"},
+ {0x0F, "Dual BIOS"},
+ {0x10, "Battery less"}};
static const boost::container::flat_map<uint8_t, std::string> umaError = {
{0x00, "UMA Read integrity error. Checksum of data read from UMA differs "
diff --git a/src/multinodecommands.cpp b/src/multinodecommands.cpp
index a0e7183..d6712b3 100644
--- a/src/multinodecommands.cpp
+++ b/src/multinodecommands.cpp
@@ -33,8 +33,8 @@
auto pdbus = getSdBus();
try
{
- std::string service = getService(*pdbus, multiNodeIntf,
- multiNodeObjPath);
+ std::string service =
+ getService(*pdbus, multiNodeIntf, multiNodeObjPath);
Value dbusValue = getDbusProperty(*pdbus, service, multiNodeObjPath,
multiNodeIntf, name);
return std::get<uint8_t>(dbusValue);
@@ -53,8 +53,8 @@
auto pdbus = getSdBus();
try
{
- std::string service = getService(*pdbus, multiNodeIntf,
- multiNodeObjPath);
+ std::string service =
+ getService(*pdbus, multiNodeIntf, multiNodeObjPath);
Value dbusValue = getDbusProperty(*pdbus, service, multiNodeObjPath,
multiNodeIntf, "NodeRole");
std::string valueStr = std::get<std::string>(dbusValue);
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index d0158de..11b00c8 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -268,8 +268,8 @@
// trigger the write FIFO operation.
std::vector<uint8_t> writeData = {cmdReg, val};
std::vector<uint8_t> readBuf(0);
- ipmi::Cc retI2C = ipmi::i2cWriteRead(i2cBus, targetAddr, writeData,
- readBuf);
+ ipmi::Cc retI2C =
+ ipmi::i2cWriteRead(i2cBus, targetAddr, writeData, readBuf);
if (retI2C)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -374,8 +374,8 @@
return IPMI_CC_OK;
}
-ipmi::RspType<> ipmiOEMDisableBMCSystemReset(bool disableResetOnSMI,
- uint7_t reserved1)
+ipmi::RspType<>
+ ipmiOEMDisableBMCSystemReset(bool disableResetOnSMI, uint7_t reserved1)
{
if (reserved1)
{
@@ -386,8 +386,8 @@
try
{
- auto service = ipmi::getService(*busp, bmcResetDisablesIntf,
- bmcResetDisablesPath);
+ auto service =
+ ipmi::getService(*busp, bmcResetDisablesIntf, bmcResetDisablesPath);
ipmi::setDbusProperty(*busp, service, bmcResetDisablesPath,
bmcResetDisablesIntf, "ResetOnSMI",
!disableResetOnSMI);
@@ -413,8 +413,8 @@
std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
try
{
- auto service = ipmi::getService(*busp, bmcResetDisablesIntf,
- bmcResetDisablesPath);
+ auto service =
+ ipmi::getService(*busp, bmcResetDisablesIntf, bmcResetDisablesPath);
Value variant =
ipmi::getDbusProperty(*busp, service, bmcResetDisablesPath,
bmcResetDisablesIntf, "ResetOnSMI");
@@ -469,8 +469,8 @@
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
try
{
- std::string hsbpObjPath = "/xyz/openbmc_project/software/HSBP_" +
- std::to_string(hscNumber);
+ std::string hsbpObjPath =
+ "/xyz/openbmc_project/software/HSBP_" + std::to_string(hscNumber);
auto service = getService(*dbus, biosVersionIntf, hsbpObjPath);
Value hscVersionValue =
getDbusProperty(*dbus, "xyz.openbmc_project.HsbpManager",
@@ -560,8 +560,8 @@
if (results.size() == matchedPhosphor)
{
meMajor = static_cast<uint8_t>(std::stoi(results[1]));
- meMinor = static_cast<uint8_t>(std::stoi(results[2]) << 4 |
- std::stoi(results[3]));
+ meMinor = static_cast<uint8_t>(
+ std::stoi(results[2]) << 4 | std::stoi(results[3]));
}
}
return true;
@@ -594,8 +594,8 @@
}
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, biosVersionIntf,
- biosActiveObjPath);
+ std::string service =
+ getService(*dbus, biosVersionIntf, biosActiveObjPath);
try
{
Value variant =
@@ -717,11 +717,11 @@
}
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, powerRestoreDelayIntf,
- powerRestoreDelayObjPath);
- Value variant = getDbusProperty(*dbus, service, powerRestoreDelayObjPath,
- powerRestoreDelayIntf,
- powerRestoreDelayProp);
+ std::string service =
+ getService(*dbus, powerRestoreDelayIntf, powerRestoreDelayObjPath);
+ Value variant =
+ getDbusProperty(*dbus, service, powerRestoreDelayObjPath,
+ powerRestoreDelayIntf, powerRestoreDelayProp);
uint64_t val = std::get<uint64_t>(variant);
val /= 1000000UL;
@@ -742,10 +742,9 @@
// Allows an update utility or system BIOS to send the status of an embedded
// firmware update attempt to the BMC. After received, BMC will create a logging
// record.
-ipmi::RspType<> ipmiOEMSendEmbeddedFwUpdStatus(uint8_t status, uint8_t target,
- uint8_t majorRevision,
- uint8_t minorRevision,
- uint32_t auxInfo)
+ipmi::RspType<> ipmiOEMSendEmbeddedFwUpdStatus(
+ uint8_t status, uint8_t target, uint8_t majorRevision,
+ uint8_t minorRevision, uint32_t auxInfo)
{
std::string firmware;
int instance = (target & targetInstanceMask) >> targetInstanceShift;
@@ -830,8 +829,8 @@
break;
}
- std::string firmwareInstanceStr = firmware +
- " instance: " + std::to_string(instance);
+ std::string firmwareInstanceStr =
+ firmware + " instance: " + std::to_string(instance);
std::string message("[firmware update] " + firmwareInstanceStr +
" status: <" + action + "> " + buildInfo);
@@ -842,12 +841,11 @@
return ipmi::responseSuccess();
}
-ipmi::RspType<uint8_t, std::vector<uint8_t>>
- ipmiOEMSlotIpmb(ipmi::Context::ptr& ctx, uint6_t reserved1,
- uint2_t slotNumber, uint3_t baseBoardSlotNum,
- [[maybe_unused]] uint3_t riserSlotNum, uint2_t reserved2,
- uint8_t targetAddr, uint8_t netFn, uint8_t cmd,
- std::optional<std::vector<uint8_t>> writeData)
+ipmi::RspType<uint8_t, std::vector<uint8_t>> ipmiOEMSlotIpmb(
+ ipmi::Context::ptr& ctx, uint6_t reserved1, uint2_t slotNumber,
+ uint3_t baseBoardSlotNum, [[maybe_unused]] uint3_t riserSlotNum,
+ uint2_t reserved2, uint8_t targetAddr, uint8_t netFn, uint8_t cmd,
+ std::optional<std::vector<uint8_t>> writeData)
{
if (reserved1 || reserved2)
{
@@ -902,8 +900,8 @@
delay = (delay << 8) | data->byteLSB;
uint64_t val = delay * 1000000;
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, powerRestoreDelayIntf,
- powerRestoreDelayObjPath);
+ std::string service =
+ getService(*dbus, powerRestoreDelayIntf, powerRestoreDelayObjPath);
setDbusProperty(*dbus, service, powerRestoreDelayObjPath,
powerRestoreDelayIntf, powerRestoreDelayProp, val);
*dataLen = 0;
@@ -921,8 +919,8 @@
std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
try
{
- auto service = ipmi::getService(*busp, cpuPresenceIntf,
- cpuPresencePath);
+ auto service =
+ ipmi::getService(*busp, cpuPresenceIntf, cpuPresencePath);
ipmi::Value result = ipmi::getDbusProperty(
*busp, service, cpuPresencePath, cpuPresenceIntf, "Present");
@@ -1000,10 +998,10 @@
return ipmi::responseUnspecifiedError();
}
- return ipmi::responseSuccess(resetOnIERR, resetOnERR2, allowResetOnMCERR, 0,
- 0x3F, cpu1IERRCount, cpu1Status, cpu2IERRCount,
- cpu2Status, cpu3IERRCount, cpu3Status,
- cpu4IERRCount, cpu4Status, crashdumpCount);
+ return ipmi::responseSuccess(
+ resetOnIERR, resetOnERR2, allowResetOnMCERR, 0, 0x3F, cpu1IERRCount,
+ cpu1Status, cpu2IERRCount, cpu2Status, cpu3IERRCount, cpu3Status,
+ cpu4IERRCount, cpu4Status, crashdumpCount);
}
ipmi::RspType<> ipmiOEMSetProcessorErrConfig(
@@ -1089,8 +1087,8 @@
try
{
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, oemShutdownPolicyIntf,
- oemShutdownPolicyObjPath);
+ std::string service =
+ getService(*dbus, oemShutdownPolicyIntf, oemShutdownPolicyObjPath);
Value variant = getDbusProperty(
*dbus, service, oemShutdownPolicyObjPath, oemShutdownPolicyIntf,
oemShutdownPolicyObjPathProp);
@@ -1172,8 +1170,8 @@
try
{
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, oemShutdownPolicyIntf,
- oemShutdownPolicyObjPath);
+ std::string service =
+ getService(*dbus, oemShutdownPolicyIntf, oemShutdownPolicyObjPath);
setDbusProperty(
*dbus, service, oemShutdownPolicyObjPath, oemShutdownPolicyIntf,
oemShutdownPolicyObjPathProp,
@@ -1203,8 +1201,8 @@
}
auto ethIP = ethdevice + "/ipv4";
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- auto ethernetObj = getDbusObject(*dbus, networkIPIntf, networkRoot,
- ethIP);
+ auto ethernetObj =
+ getDbusObject(*dbus, networkIPIntf, networkRoot, ethIP);
auto value = getDbusProperty(*dbus, networkService, ethernetObj.first,
networkIPIntf, "Origin");
if (std::get<std::string>(value) ==
@@ -1239,8 +1237,8 @@
}
auto ethIP = ethdevice + "/ipv6";
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- auto objectInfo = getDbusObject(*dbus, networkIPIntf, networkRoot,
- ethIP);
+ auto objectInfo =
+ getDbusObject(*dbus, networkIPIntf, networkRoot, ethIP);
auto properties = getAllDbusProperties(*dbus, objectInfo.second,
objectInfo.first, networkIPIntf);
if (std::get<std::string>(properties["Origin"]) ==
@@ -1521,8 +1519,8 @@
try
{
std::string service = getService(bus, intf, objPath);
- Value stateValue = getDbusProperty(bus, service, objPath, intf,
- "State");
+ Value stateValue =
+ getDbusProperty(bus, service, objPath, intf, "State");
std::string strState = std::get<std::string>(stateValue);
state = ledAction::actionDbusToIpmi.at(
sdbusplus::xyz::openbmc_project::Led::server::Physical::
@@ -1556,11 +1554,9 @@
return ipmi::responseSuccess(ledstate);
}
-ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(ipmi_netfn_t, ipmi_cmd_t,
- ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t dataLen,
- ipmi_context_t)
+ipmi_ret_t ipmiOEMCfgHostSerialPortSpeed(
+ ipmi_netfn_t, ipmi_cmd_t, ipmi_request_t request, ipmi_response_t response,
+ ipmi_data_len_t dataLen, ipmi_context_t)
{
CfgHostSerialReq* req = reinterpret_cast<CfgHostSerialReq*>(request);
uint8_t* resp = reinterpret_cast<uint8_t*>(response);
@@ -1864,10 +1860,10 @@
static std::string getConfigPath(const std::string& name)
{
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- auto method = dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper",
- "GetSubTree");
+ auto method =
+ dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTree");
method.append("/", 0, std::array<const char*, 1>{pidConfigurationIface});
std::string path;
@@ -1882,10 +1878,10 @@
phosphor::logging::log<phosphor::logging::level::ERR>(
"ipmiOEMGetFscParameter: mapper error");
};
- auto config = std::find_if(resp.begin(), resp.end(),
- [&name](const auto& pair) {
- return pair.first.find(name) != std::string::npos;
- });
+ auto config =
+ std::find_if(resp.begin(), resp.end(), [&name](const auto& pair) {
+ return pair.first.find(name) != std::string::npos;
+ });
if (config != resp.end())
{
path = std::move(config->first);
@@ -1898,10 +1894,10 @@
{
boost::container::flat_map<std::string, PropertyMap> ret;
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- auto method = dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper",
- "GetSubTree");
+ auto method =
+ dbus->new_method_call("xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTree");
method.append("/", 0, std::array<const char*, 1>{pidConfigurationIface});
GetSubTreeType resp;
@@ -2413,9 +2409,8 @@
static const constexpr uint32_t oneMonth = 0xf53700;
static const constexpr uint8_t userSpecific = 0x01;
static const constexpr uint8_t crSetCompleted = 0;
-ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(ipmi::Context::ptr& ctx,
- uint8_t parameter,
- ipmi::message::Payload& payload)
+ipmi::RspType<uint8_t> ipmiOEMSetCRConfig(
+ ipmi::Context::ptr& ctx, uint8_t parameter, ipmi::message::Payload& payload)
{
switch (static_cast<crParameter>(parameter))
{
@@ -2702,10 +2697,9 @@
}
}
-ipmi::RspType<> ipmiOEMSetFaultIndication(uint8_t sourceId, uint8_t faultType,
- uint8_t faultState,
- uint8_t faultGroup,
- std::array<uint8_t, 8>& ledStateData)
+ipmi::RspType<> ipmiOEMSetFaultIndication(
+ uint8_t sourceId, uint8_t faultType, uint8_t faultState, uint8_t faultGroup,
+ std::array<uint8_t, 8>& ledStateData)
{
constexpr auto maxFaultType = static_cast<size_t>(RemoteFaultType::max);
static const std::array<std::string, maxFaultType> faultNames = {
@@ -3174,11 +3168,11 @@
try
{
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, oemNmiSourceIntf,
- oemNmiSourceObjPath);
- Value variant = getDbusProperty(*dbus, service, oemNmiSourceObjPath,
- oemNmiSourceIntf,
- oemNmiBmcSourceObjPathProp);
+ std::string service =
+ getService(*dbus, oemNmiSourceIntf, oemNmiSourceObjPath);
+ Value variant =
+ getDbusProperty(*dbus, service, oemNmiSourceObjPath,
+ oemNmiSourceIntf, oemNmiBmcSourceObjPathProp);
switch (nmi::NMISource::convertBMCSourceSignalFromString(
std::get<std::string>(variant)))
@@ -3267,8 +3261,8 @@
{
// keep NMI signal source
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- std::string service = getService(*dbus, oemNmiSourceIntf,
- oemNmiSourceObjPath);
+ std::string service =
+ getService(*dbus, oemNmiSourceIntf, oemNmiSourceObjPath);
setDbusProperty(*dbus, service, oemNmiSourceObjPath, oemNmiSourceIntf,
oemNmiBmcSourceObjPathProp,
nmi::convertForMessage(bmcSourceSignal));
@@ -3303,9 +3297,8 @@
}; // namespace dimmOffset
-ipmi::RspType<>
- ipmiOEMSetDimmOffset(uint8_t type,
- const std::vector<std::tuple<uint8_t, uint8_t>>& data)
+ipmi::RspType<> ipmiOEMSetDimmOffset(
+ uint8_t type, const std::vector<std::tuple<uint8_t, uint8_t>>& data)
{
if (type != static_cast<uint8_t>(dimmOffsetTypes::dimmPower) &&
type != static_cast<uint8_t>(dimmOffsetTypes::staticCltt))
@@ -3775,8 +3768,8 @@
return ipmi::responseSuccess(result);
}
-std::optional<uint8_t> getMultiNodeInfoPresence(ipmi::Context::ptr& ctx,
- const std::string& name)
+std::optional<uint8_t>
+ getMultiNodeInfoPresence(ipmi::Context::ptr& ctx, const std::string& name)
{
Value dbusValue = 0;
std::string serviceName;
@@ -3846,8 +3839,8 @@
// This command should run only from multi-node product.
// For all other platforms this command will return invalid.
- std::optional<uint8_t> nodeInfo = getMultiNodeInfoPresence(ctx,
- "NodePresence");
+ std::optional<uint8_t> nodeInfo =
+ getMultiNodeInfoPresence(ctx, "NodePresence");
if (!nodeInfo || !*nodeInfo)
{
return ipmi::responseInvalidCommand();
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 26b289b..997875c 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -93,22 +93,22 @@
"type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
"sensors/'",
[](sdbusplus::message_t&) {
- sensorTree.clear();
- sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
- std::chrono::system_clock::now().time_since_epoch())
- .count();
-});
+ sensorTree.clear();
+ sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
+ });
static sdbusplus::bus::match_t sensorRemoved(
*getSdBus(),
"type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
"sensors/'",
[](sdbusplus::message_t&) {
- sensorTree.clear();
- sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
- std::chrono::system_clock::now().time_since_epoch())
- .count();
-});
+ sensorTree.clear();
+ sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
+ });
// this keeps track of deassertions for sensor event status command. A
// deasertion can only happen if an assertion was seen first.
@@ -121,42 +121,43 @@
"type='signal',member='PropertiesChanged',interface='org.freedesktop.DBus."
"Properties',arg0namespace='xyz.openbmc_project.Sensor.Threshold'",
[](sdbusplus::message_t& m) {
- boost::container::flat_map<std::string, ipmi::DbusVariant> values;
- m.read(std::string(), values);
+ boost::container::flat_map<std::string, ipmi::DbusVariant> values;
+ m.read(std::string(), values);
- auto findAssert = std::find_if(values.begin(), values.end(),
- [](const auto& pair) {
- return pair.first.find("Alarm") != std::string::npos;
- });
- if (findAssert != values.end())
- {
- auto ptr = std::get_if<bool>(&(findAssert->second));
- if (ptr == nullptr)
+ auto findAssert =
+ std::find_if(values.begin(), values.end(), [](const auto& pair) {
+ return pair.first.find("Alarm") != std::string::npos;
+ });
+ if (findAssert != values.end())
{
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "thresholdChanged: Assert non bool");
- return;
- }
- if (*ptr)
- {
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "thresholdChanged: Assert",
- phosphor::logging::entry("SENSOR=%s", m.get_path()));
- thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
- }
- else
- {
- auto& value = thresholdDeassertMap[m.get_path()][findAssert->first];
- if (value)
+ auto ptr = std::get_if<bool>(&(findAssert->second));
+ if (ptr == nullptr)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "thresholdChanged: Assert non bool");
+ return;
+ }
+ if (*ptr)
{
phosphor::logging::log<phosphor::logging::level::INFO>(
- "thresholdChanged: deassert",
+ "thresholdChanged: Assert",
phosphor::logging::entry("SENSOR=%s", m.get_path()));
- value = *ptr;
+ thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
+ }
+ else
+ {
+ auto& value =
+ thresholdDeassertMap[m.get_path()][findAssert->first];
+ if (value)
+ {
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "thresholdChanged: deassert",
+ phosphor::logging::entry("SENSOR=%s", m.get_path()));
+ value = *ptr;
+ }
}
}
- }
-});
+ });
static void getSensorMaxMin(const SensorMap& sensorMap, double& max,
double& min)
@@ -323,9 +324,9 @@
}
std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
- auto setHealth = dbus->new_method_call(meHealth::busname, meHealth::path,
- meHealth::interface,
- meHealth::method);
+ auto setHealth =
+ dbus->new_method_call(meHealth::busname, meHealth::path,
+ meHealth::interface, meHealth::method);
setHealth.append(std::to_string(static_cast<size_t>(eventData2)), state);
try
{
@@ -468,8 +469,8 @@
return ipmi::responseResponseError();
}
- uint8_t value = scaleIPMIValueFromDouble(reading, mValue, rExp, bValue,
- bExp, bSigned);
+ uint8_t value =
+ scaleIPMIValueFromDouble(reading, mValue, rExp, bValue, bExp, bSigned);
uint8_t operation =
static_cast<uint8_t>(IPMISensorReadingByte2::sensorScanningEnable);
operation |=
@@ -781,8 +782,8 @@
if (warningHigh != warningMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- warningHigh->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), warningHigh->second);
if (std::isfinite(value))
{
resp.warningHigh = scaleIPMIValueFromDouble(
@@ -791,8 +792,8 @@
}
if (warningLow != warningMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- warningLow->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), warningLow->second);
if (std::isfinite(value))
{
resp.warningLow = scaleIPMIValueFromDouble(
@@ -809,8 +810,8 @@
if (criticalHigh != criticalMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- criticalHigh->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), criticalHigh->second);
if (std::isfinite(value))
{
resp.criticalHigh = scaleIPMIValueFromDouble(
@@ -819,8 +820,8 @@
}
if (criticalLow != criticalMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- criticalLow->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), criticalLow->second);
if (std::isfinite(value))
{
resp.criticalLow = scaleIPMIValueFromDouble(
@@ -971,8 +972,8 @@
auto warningLow = warningMap.find("WarningLow");
if (warningHigh != warningMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- warningHigh->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), warningHigh->second);
if (std::isfinite(value))
{
assertionEnabledLsb |= static_cast<uint8_t>(
@@ -985,8 +986,8 @@
}
if (warningLow != warningMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- warningLow->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), warningLow->second);
if (std::isfinite(value))
{
assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1007,8 +1008,8 @@
if (criticalHigh != criticalMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- criticalHigh->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), criticalHigh->second);
if (std::isfinite(value))
{
assertionEnabledMsb |= static_cast<uint8_t>(
@@ -1020,8 +1021,8 @@
}
if (criticalLow != criticalMap.end())
{
- double value = std::visit(VariantToDoubleVisitor(),
- criticalLow->second);
+ double value =
+ std::visit(VariantToDoubleVisitor(), criticalLow->second);
if (std::isfinite(value))
{
assertionEnabledLsb |= static_cast<uint8_t>(
@@ -1141,15 +1142,15 @@
}
if (warningHighAlarm)
{
- assertions.set(
- static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
- upperNonCriticalGoingHigh));
+ assertions.set(static_cast<size_t>(
+ IPMIGetSensorEventEnableThresholds::
+ upperNonCriticalGoingHigh));
}
if (warningLowAlarm)
{
- assertions.set(
- static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
- lowerNonCriticalGoingLow));
+ assertions.set(static_cast<size_t>(
+ IPMIGetSensorEventEnableThresholds::
+ lowerNonCriticalGoingLow));
}
}
if (criticalInterface != sensorMap.end())
@@ -1171,9 +1172,9 @@
}
if (criticalHighAlarm)
{
- assertions.set(
- static_cast<size_t>(IPMIGetSensorEventEnableThresholds::
- upperCriticalGoingHigh));
+ assertions.set(static_cast<size_t>(
+ IPMIGetSensorEventEnableThresholds::
+ upperCriticalGoingHigh));
}
if (criticalLowAlarm)
{
@@ -1205,9 +1206,9 @@
return GENERAL_ERROR;
}
- size_t lastRecord = getNumberOfSensors() + fruCount +
- ipmi::storage::type12Count +
- ipmi::storage::nmDiscoverySDRCount - 1;
+ size_t lastRecord =
+ getNumberOfSensors() + fruCount + ipmi::storage::type12Count +
+ ipmi::storage::nmDiscoverySDRCount - 1;
if (recordID == lastRecordIndex)
{
recordID = lastRecord;
@@ -1234,8 +1235,8 @@
"getSensorDataRecord: NM DiscoveryIndex error");
return GENERAL_ERROR;
}
- recordData = ipmi::storage::getNMDiscoverySDR(nmDiscoveryIndex,
- recordID);
+ recordData =
+ ipmi::storage::getNMDiscoverySDR(nmDiscoveryIndex, recordID);
}
else if (fruIndex >= fruCount)
{
@@ -1441,8 +1442,8 @@
uint8_t bExpBits = bExp & 0x07;
// move rExp and bExp into place
- record.body.r_b_exponents = (rExpSign << 7) | (rExpBits << 4) |
- (bExpSign << 3) | bExpBits;
+ record.body.r_b_exponents =
+ (rExpSign << 7) | (rExpBits << 4) | (bExpSign << 3) | bExpBits;
// Set the analog reading byte interpretation accordingly
record.body.sensor_units_1 = (bSigned ? 1 : 0) << 7;
@@ -1602,8 +1603,8 @@
// Return the number of sensors attached to the LUN
if ((ctx->lun == 0) && (numSensors > 0))
{
- sdrCount = (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN
- : numSensors;
+ sdrCount =
+ (numSensors > maxSensorsPerLUN) ? maxSensorsPerLUN : numSensors;
}
else if ((ctx->lun == 1) && (numSensors > maxSensorsPerLUN))
{
@@ -1680,9 +1681,9 @@
return ipmi::response(ret);
}
- uint16_t recordCount = getNumberOfSensors() + fruCount +
- ipmi::storage::type12Count +
- ipmi::storage::nmDiscoverySDRCount;
+ uint16_t recordCount =
+ getNumberOfSensors() + fruCount + ipmi::storage::type12Count +
+ ipmi::storage::nmDiscoverySDRCount;
uint8_t operationSupport = static_cast<uint8_t>(
SdrRepositoryInfoOps::overflow); // write not supported
@@ -1763,9 +1764,9 @@
return ipmi::response(ret);
}
- size_t lastRecord = getNumberOfSensors() + fruCount +
- ipmi::storage::type12Count +
- ipmi::storage::nmDiscoverySDRCount - 1;
+ size_t lastRecord =
+ getNumberOfSensors() + fruCount + ipmi::storage::type12Count +
+ ipmi::storage::nmDiscoverySDRCount - 1;
uint16_t nextRecordId = lastRecord > recordID ? recordID + 1 : 0XFFFF;
if (!getSensorSubtree(sensorTree) && sensorTree.empty())
@@ -1791,8 +1792,8 @@
return ipmi::responseSuccess(nextRecordId, record);
}
- size_t sdrLength = sizeof(get_sdr::SensorDataRecordHeader) +
- hdr->record_length;
+ size_t sdrLength =
+ sizeof(get_sdr::SensorDataRecordHeader) + hdr->record_length;
if (offset >= sdrLength)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
diff --git a/src/smbiosmdrv2handler.cpp b/src/smbiosmdrv2handler.cpp
index d3c862e..16f8ae0 100644
--- a/src/smbiosmdrv2handler.cpp
+++ b/src/smbiosmdrv2handler.cpp
@@ -278,8 +278,8 @@
* @returns IPMI completion code plus response data
* - dataOut
*/
-ipmi::RspType<std::vector<uint8_t>> mdr2GetDir(uint16_t agentId,
- uint8_t dirIndex)
+ipmi::RspType<std::vector<uint8_t>>
+ mdr2GetDir(uint16_t agentId, uint8_t dirIndex)
{
std::shared_ptr<sdbusplus::asio::connection> bus = getSdBus();
std::string service = ipmi::getService(*bus, mdrv2Interface, mdrv2Path);
@@ -369,10 +369,10 @@
* - bool
*/
-ipmi::RspType<bool> mdr2SendDir(uint16_t agentId, uint8_t dirVersion,
- uint8_t dirIndex, uint8_t returnedEntries,
- uint8_t remainingEntries,
- std::vector<uint8_t> dataInfo)
+ipmi::RspType<bool>
+ mdr2SendDir(uint16_t agentId, uint8_t dirVersion, uint8_t dirIndex,
+ uint8_t returnedEntries, uint8_t remainingEntries,
+ std::vector<uint8_t> dataInfo)
{
if ((static_cast<size_t>(returnedEntries) * dataInfoSize) !=
dataInfo.size())
@@ -785,8 +785,8 @@
"Offset is out of range");
return ipmi::responseParmOutOfRange();
}
- uint8_t* destAddr = mdrv2->smbiosDir.dir[idIndex].dataStorage +
- xferOffset;
+ uint8_t* destAddr =
+ mdrv2->smbiosDir.dir[idIndex].dataStorage + xferOffset;
uint8_t* sourceAddr = reinterpret_cast<uint8_t*>(mdrv2->area->vPtr);
uint32_t calcChecksum = mdrv2->calcChecksum32(sourceAddr, xferLength);
if (calcChecksum != checksum)
@@ -1093,10 +1093,9 @@
@return xferStartAck and session on success.
**/
-ipmi::RspType<uint8_t, uint16_t>
- cmd_mdr2_data_start(uint16_t agentId, std::array<uint8_t, 16> dataInfo,
- uint32_t dataLength, uint32_t xferAddress,
- uint32_t xferLength, uint16_t timeout)
+ipmi::RspType<uint8_t, uint16_t> cmd_mdr2_data_start(
+ uint16_t agentId, std::array<uint8_t, 16> dataInfo, uint32_t dataLength,
+ uint32_t xferAddress, uint32_t xferLength, uint16_t timeout)
{
uint16_t session = 0;
@@ -1142,8 +1141,8 @@
{
try
{
- mdrv2->area = std::make_unique<SharedMemoryArea>(xferAddress,
- xferLength);
+ mdrv2->area =
+ std::make_unique<SharedMemoryArea>(xferAddress, xferLength);
}
catch (const std::system_error& e)
{
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 25eea96..a1a19f2 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -307,55 +307,57 @@
fruMatches.reserve(2);
auto bus = getSdBus();
- fruMatches.emplace_back(*bus,
- "type='signal',arg0path='/xyz/openbmc_project/"
- "FruDevice/',member='InterfacesAdded'",
- [](sdbusplus::message_t& message) {
- sdbusplus::message::object_path path;
- ObjectType object;
- try
- {
- message.read(path, object);
- }
- catch (const sdbusplus::exception_t&)
- {
- return;
- }
- auto findType = object.find("xyz.openbmc_project.FruDevice");
- if (findType == object.end())
- {
- return;
- }
- writeFruIfRunning();
- frus[path] = object;
- recalculateHashes();
- lastDevId = 0xFF;
- });
+ fruMatches.emplace_back(
+ *bus,
+ "type='signal',arg0path='/xyz/openbmc_project/"
+ "FruDevice/',member='InterfacesAdded'",
+ [](sdbusplus::message_t& message) {
+ sdbusplus::message::object_path path;
+ ObjectType object;
+ try
+ {
+ message.read(path, object);
+ }
+ catch (const sdbusplus::exception_t&)
+ {
+ return;
+ }
+ auto findType = object.find("xyz.openbmc_project.FruDevice");
+ if (findType == object.end())
+ {
+ return;
+ }
+ writeFruIfRunning();
+ frus[path] = object;
+ recalculateHashes();
+ lastDevId = 0xFF;
+ });
- fruMatches.emplace_back(*bus,
- "type='signal',arg0path='/xyz/openbmc_project/"
- "FruDevice/',member='InterfacesRemoved'",
- [](sdbusplus::message_t& message) {
- sdbusplus::message::object_path path;
- std::set<std::string> interfaces;
- try
- {
- message.read(path, interfaces);
- }
- catch (const sdbusplus::exception_t&)
- {
- return;
- }
- auto findType = interfaces.find("xyz.openbmc_project.FruDevice");
- if (findType == interfaces.end())
- {
- return;
- }
- writeFruIfRunning();
- frus.erase(path);
- recalculateHashes();
- lastDevId = 0xFF;
- });
+ fruMatches.emplace_back(
+ *bus,
+ "type='signal',arg0path='/xyz/openbmc_project/"
+ "FruDevice/',member='InterfacesRemoved'",
+ [](sdbusplus::message_t& message) {
+ sdbusplus::message::object_path path;
+ std::set<std::string> interfaces;
+ try
+ {
+ message.read(path, interfaces);
+ }
+ catch (const sdbusplus::exception_t&)
+ {
+ return;
+ }
+ auto findType = interfaces.find("xyz.openbmc_project.FruDevice");
+ if (findType == interfaces.end())
+ {
+ return;
+ }
+ writeFruIfRunning();
+ frus.erase(path);
+ recalculateHashes();
+ lastDevId = 0xFF;
+ });
// call once to populate
boost::asio::spawn(*getIoContext(), [](boost::asio::yield_context yield) {
@@ -421,10 +423,9 @@
* @returns ipmi completion code plus response data
* - countWritten - Count written
*/
-ipmi::RspType<uint8_t>
- ipmiStorageWriteFruData(ipmi::Context::ptr& ctx, uint8_t fruDeviceId,
- uint16_t fruInventoryOffset,
- std::vector<uint8_t>& dataToWrite)
+ipmi::RspType<uint8_t> ipmiStorageWriteFruData(
+ ipmi::Context::ptr& ctx, uint8_t fruDeviceId, uint16_t fruInventoryOffset,
+ std::vector<uint8_t>& dataToWrite)
{
if (fruDeviceId == 0xFF)
{
@@ -520,31 +521,33 @@
uint8_t& address = device->second.second;
boost::container::flat_map<std::string, DbusVariant>* fruData = nullptr;
- auto fru = std::find_if(frus.begin(), frus.end(),
- [bus, address, &fruData](ManagedEntry& entry) {
- auto findFruDevice = entry.second.find("xyz.openbmc_project.FruDevice");
- if (findFruDevice == entry.second.end())
- {
- return false;
- }
- fruData = &(findFruDevice->second);
- auto findBus = findFruDevice->second.find("BUS");
- auto findAddress = findFruDevice->second.find("ADDRESS");
- if (findBus == findFruDevice->second.end() ||
- findAddress == findFruDevice->second.end())
- {
- return false;
- }
- if (std::get<uint32_t>(findBus->second) != bus)
- {
- return false;
- }
- if (std::get<uint32_t>(findAddress->second) != address)
- {
- return false;
- }
- return true;
- });
+ auto fru = std::find_if(
+ frus.begin(), frus.end(),
+ [bus, address, &fruData](ManagedEntry& entry) {
+ auto findFruDevice =
+ entry.second.find("xyz.openbmc_project.FruDevice");
+ if (findFruDevice == entry.second.end())
+ {
+ return false;
+ }
+ fruData = &(findFruDevice->second);
+ auto findBus = findFruDevice->second.find("BUS");
+ auto findAddress = findFruDevice->second.find("ADDRESS");
+ if (findBus == findFruDevice->second.end() ||
+ findAddress == findFruDevice->second.end())
+ {
+ return false;
+ }
+ if (std::get<uint32_t>(findBus->second) != bus)
+ {
+ return false;
+ }
+ if (std::get<uint32_t>(findAddress->second) != address)
+ {
+ return false;
+ }
+ return true;
+ });
if (fru == frus.end())
{
return ipmi::ccResponseError;
@@ -570,43 +573,43 @@
return ipmi::ccResponseError;
}
- auto entity =
- std::find_if(entities.begin(), entities.end(),
- [bus, address, &entityData](ManagedEntry& entry) {
- auto findFruDevice = entry.second.find(
- "xyz.openbmc_project.Inventory.Decorator.FruDevice");
- if (findFruDevice == entry.second.end())
- {
- return false;
- }
+ auto entity = std::find_if(
+ entities.begin(), entities.end(),
+ [bus, address, &entityData](ManagedEntry& entry) {
+ auto findFruDevice = entry.second.find(
+ "xyz.openbmc_project.Inventory.Decorator.FruDevice");
+ if (findFruDevice == entry.second.end())
+ {
+ return false;
+ }
- // Integer fields added via Entity-Manager json are uint64_ts by
- // default.
- auto findBus = findFruDevice->second.find("Bus");
- auto findAddress = findFruDevice->second.find("Address");
+ // Integer fields added via Entity-Manager json are uint64_ts by
+ // default.
+ auto findBus = findFruDevice->second.find("Bus");
+ auto findAddress = findFruDevice->second.find("Address");
- if (findBus == findFruDevice->second.end() ||
- findAddress == findFruDevice->second.end())
- {
- return false;
- }
- if ((std::get<uint64_t>(findBus->second) != bus) ||
- (std::get<uint64_t>(findAddress->second) != address))
- {
- return false;
- }
+ if (findBus == findFruDevice->second.end() ||
+ findAddress == findFruDevice->second.end())
+ {
+ return false;
+ }
+ if ((std::get<uint64_t>(findBus->second) != bus) ||
+ (std::get<uint64_t>(findAddress->second) != address))
+ {
+ return false;
+ }
- // At this point we found the device entry and should return
- // true.
- auto findIpmiDevice =
- entry.second.find("xyz.openbmc_project.Inventory.Decorator.Ipmi");
- if (findIpmiDevice != entry.second.end())
- {
- entityData = &(findIpmiDevice->second);
- }
+ // At this point we found the device entry and should return
+ // true.
+ auto findIpmiDevice = entry.second.find(
+ "xyz.openbmc_project.Inventory.Decorator.Ipmi");
+ if (findIpmiDevice != entry.second.end())
+ {
+ entityData = &(findIpmiDevice->second);
+ }
- return true;
- });
+ return true;
+ });
if (entity == entities.end())
{
@@ -695,8 +698,8 @@
if (boost::starts_with(filename, intel_oem::ipmi::sel::selLogFilename))
{
// If we find an ipmi_sel log file, save the path
- selLogFiles.emplace_back(intel_oem::ipmi::sel::selLogDir /
- filename);
+ selLogFiles.emplace_back(
+ intel_oem::ipmi::sel::selLogDir / filename);
}
}
// As the log files rotate, they are appended with a ".#" that is higher for
@@ -1081,10 +1084,9 @@
return ipmi::responseSuccess(responseID);
}
-ipmi::RspType<uint8_t> ipmiStorageClearSEL(ipmi::Context::ptr&,
- uint16_t reservationID,
- const std::array<uint8_t, 3>& clr,
- uint8_t eraseOperation)
+ipmi::RspType<uint8_t> ipmiStorageClearSEL(
+ ipmi::Context::ptr&, uint16_t reservationID,
+ const std::array<uint8_t, 3>& clr, uint8_t eraseOperation)
{
if (!checkSELReservation(reservationID))
{
@@ -1183,8 +1185,8 @@
}
else
{
- throw std::runtime_error("getType12SDRs:: Illegal index " +
- std::to_string(index));
+ throw std::runtime_error(
+ "getType12SDRs:: Illegal index " + std::to_string(index));
}
return resp;
@@ -1218,8 +1220,8 @@
}
else
{
- throw std::runtime_error("getNMDiscoverySDR:: Illegal index " +
- std::to_string(index));
+ throw std::runtime_error(
+ "getNMDiscoverySDR:: Illegal index " + std::to_string(index));
}
return resp;
diff --git a/tests/test_sensorcommands.cpp b/tests/test_sensorcommands.cpp
index 2707a3e..afa31f2 100644
--- a/tests/test_sensorcommands.cpp
+++ b/tests/test_sensorcommands.cpp
@@ -67,8 +67,8 @@
if (bSigned)
{
int8_t expect = x;
- int8_t actual = ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp,
- bSigned);
+ int8_t actual =
+ ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp, bSigned);
result = actual;
yRoundtrip = ipmitool_y_from_x(actual, M, rExp, B, bExp, bSigned);
@@ -78,8 +78,8 @@
else
{
uint8_t expect = x;
- uint8_t actual = ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp,
- bSigned);
+ uint8_t actual =
+ ipmi::scaleIPMIValueFromDouble(y, M, rExp, B, bExp, bSigned);
result = actual;
yRoundtrip = ipmitool_y_from_x(actual, M, rExp, B, bExp, bSigned);
@@ -429,8 +429,8 @@
EXPECT_EQ(bExp, -1);
}
- scaledVal = ipmi::scaleIPMIValueFromDouble(5, mValue, rExp, bValue, bExp,
- bSigned);
+ scaledVal =
+ ipmi::scaleIPMIValueFromDouble(5, mValue, rExp, bValue, bExp, bSigned);
expected = 5 / (mValue * std::pow(10, rExp));
EXPECT_NEAR(scaledVal, expected, expected * 0.01);