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: I172b14c1a881c734851b7dc6e0e90ee2e11cce03
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/cpu.cpp b/src/cpu.cpp
index 7c10a09..7e52bd4 100644
--- a/src/cpu.cpp
+++ b/src/cpu.cpp
@@ -159,8 +159,8 @@
// this class is for type CPU //offset 5h
family(cpuInfo->family, cpuInfo->family2); // offset 6h and 28h
manufacturer(cpuInfo->manufacturer, cpuInfo->length,
- dataIn); // offset 7h
- id(cpuInfo->id); // offset 8h
+ dataIn); // offset 7h
+ id(cpuInfo->id); // offset 8h
// Step, EffectiveFamily, EffectiveModel computation for Intel processors.
std::map<uint8_t, const char*>::const_iterator it =
@@ -208,10 +208,10 @@
version(cpuInfo->version, cpuInfo->length, dataIn); // offset 10h
maxSpeedInMhz(cpuInfo->maxSpeed); // offset 14h
serialNumber(cpuInfo->serialNum, cpuInfo->length,
- dataIn); // offset 20h
+ dataIn); // offset 20h
partNumber(cpuInfo->partNum, cpuInfo->length,
- dataIn); // offset 22h
- if (cpuInfo->coreCount < maxOldVersionCount) // offset 23h or 2Ah
+ dataIn); // offset 22h
+ if (cpuInfo->coreCount < maxOldVersionCount) // offset 23h or 2Ah
{
coreCount(cpuInfo->coreCount);
}
diff --git a/src/cpuinfo_main.cpp b/src/cpuinfo_main.cpp
index 85a2302..ca3058a 100644
--- a/src/cpuinfo_main.cpp
+++ b/src/cpuinfo_main.cpp
@@ -235,12 +235,12 @@
conn->get_io_context(), std::chrono::seconds(retrySeconds));
sspecTimer->async_wait(
[sspecTimer, conn, cpuInfo](boost::system::error_code ec) {
- if (ec)
- {
- return;
- }
- tryReadSSpec(conn, cpuInfo);
- });
+ if (ec)
+ {
+ return;
+ }
+ tryReadSSpec(conn, cpuInfo);
+ });
}
/**
@@ -284,12 +284,12 @@
createCpuUpdatedMatch(conn, cpu);
conn->async_method_call(
[](const boost::system::error_code ec) {
- if (ec)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "Cannot set CPU property!");
- return;
- }
+ if (ec)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Cannot set CPU property!");
+ return;
+ }
},
cpuProcessName, newProp.object.c_str(),
"org.freedesktop.DBus.Properties", "Set", newProp.interface,
@@ -325,25 +325,23 @@
sdbusplus::bus::match::rules::interfacesAdded() +
sdbusplus::bus::match::rules::argNpath(0, objectPath.c_str()),
[conn, cpu](sdbusplus::message_t& msg) {
- sdbusplus::message::object_path objectName;
- boost::container::flat_map<
- std::string,
- boost::container::flat_map<
- std::string, std::variant<std::string, uint64_t>>>
- msgData;
+ sdbusplus::message::object_path objectName;
+ boost::container::flat_map<
+ std::string, boost::container::flat_map<
+ std::string, std::variant<std::string, uint64_t>>>
+ msgData;
- msg.read(objectName, msgData);
+ msg.read(objectName, msgData);
- // Go through all the property changes, and retry all of them
- // targeting this object/interface which was just added.
- for (const CpuProperty& prop : propertiesToSet)
- {
- if (prop.object == objectName &&
- msgData.contains(prop.interface))
- {
- setDbusProperty(conn, cpu, prop);
- }
- }
+ // Go through all the property changes, and retry all of them
+ // targeting this object/interface which was just added.
+ for (const CpuProperty& prop : propertiesToSet)
+ {
+ if (prop.object == objectName && msgData.contains(prop.interface))
+ {
+ setDbusProperty(conn, cpu, prop);
+ }
+ }
}));
}
@@ -385,20 +383,20 @@
waitTimer->async_wait(
[waitTimer, &io, conn, cpu](const boost::system::error_code& ec) {
- if (ec)
+ if (ec)
+ {
+ // operation_aborted is expected if timer is canceled
+ // before completion.
+ if (ec != boost::asio::error::operation_aborted)
{
- // operation_aborted is expected if timer is canceled
- // before completion.
- if (ec != boost::asio::error::operation_aborted)
- {
- phosphor::logging::log<phosphor::logging::level::ERR>(
- "info update timer async_wait failed ",
- phosphor::logging::entry("EC=0x%x", ec.value()));
- }
- return;
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "info update timer async_wait failed ",
+ phosphor::logging::entry("EC=0x%x", ec.value()));
}
- getProcessorInfo(io, conn, cpu);
- });
+ return;
+ }
+ getProcessorInfo(io, conn, cpu);
+ });
return;
}
@@ -419,9 +417,9 @@
uint64_t cpuPPIN = 0;
uint32_t u32PkgValue = 0;
- int ret =
- peci_RdPkgConfig(cpuAddr, u8PPINPkgIndex, u16PPINPkgParamLow,
- u8Size, (uint8_t*)&u32PkgValue, &cc);
+ int ret = peci_RdPkgConfig(cpuAddr, u8PPINPkgIndex,
+ u16PPINPkgParamLow, u8Size,
+ (uint8_t*)&u32PkgValue, &cc);
if (0 != ret)
{
phosphor::logging::log<phosphor::logging::level::ERR>(
@@ -485,71 +483,71 @@
std::string,
std::variant<std::string, uint64_t, uint32_t, uint16_t,
std::vector<std::string>>>& properties) {
- const uint64_t* value = nullptr;
- uint8_t peciAddress = 0;
- uint8_t i2cBus = defaultI2cBus;
- uint8_t i2cDevice;
- bool i2cDeviceFound = false;
- size_t cpu = 0;
+ const uint64_t* value = nullptr;
+ uint8_t peciAddress = 0;
+ uint8_t i2cBus = defaultI2cBus;
+ uint8_t i2cDevice;
+ bool i2cDeviceFound = false;
+ size_t cpu = 0;
- if (ec)
- {
- std::cerr << "DBUS response error " << ec.value() << ": "
- << ec.message() << "\n";
- return;
- }
+ if (ec)
+ {
+ std::cerr << "DBUS response error " << ec.value() << ": "
+ << ec.message() << "\n";
+ return;
+ }
- for (const auto& property : properties)
+ for (const auto& property : properties)
+ {
+ std::cerr << "property " << property.first << "\n";
+ if (property.first == "Address")
{
- std::cerr << "property " << property.first << "\n";
- if (property.first == "Address")
+ value = std::get_if<uint64_t>(&property.second);
+ if (value != nullptr)
{
- value = std::get_if<uint64_t>(&property.second);
- if (value != nullptr)
- {
- peciAddress = static_cast<uint8_t>(*value);
- }
- }
- if (property.first == "CpuID")
- {
- value = std::get_if<uint64_t>(&property.second);
- if (value != nullptr)
- {
- cpu = static_cast<size_t>(*value);
- }
- }
- if (property.first == "PiromI2cAddress")
- {
- value = std::get_if<uint64_t>(&property.second);
- if (value != nullptr)
- {
- i2cDevice = static_cast<uint8_t>(*value);
- i2cDeviceFound = true;
- }
- }
- if (property.first == "PiromI2cBus")
- {
- value = std::get_if<uint64_t>(&property.second);
- if (value != nullptr)
- {
- i2cBus = static_cast<uint8_t>(*value);
- }
+ peciAddress = static_cast<uint8_t>(*value);
}
}
-
- ///\todo replace this with present + power state
- if (cpu != 0 && peciAddress != 0)
+ if (property.first == "CpuID")
{
- if (!i2cDeviceFound)
+ value = std::get_if<uint64_t>(&property.second);
+ if (value != nullptr)
{
- i2cDevice = defaultI2cSlaveAddr0 + cpu - 1;
+ cpu = static_cast<size_t>(*value);
}
- cpuInfoMap.insert_or_assign(
- cpu, std::make_shared<CPUInfo>(*conn, cpu, peciAddress,
- i2cBus, i2cDevice));
-
- getProcessorInfo(io, conn, cpu);
}
+ if (property.first == "PiromI2cAddress")
+ {
+ value = std::get_if<uint64_t>(&property.second);
+ if (value != nullptr)
+ {
+ i2cDevice = static_cast<uint8_t>(*value);
+ i2cDeviceFound = true;
+ }
+ }
+ if (property.first == "PiromI2cBus")
+ {
+ value = std::get_if<uint64_t>(&property.second);
+ if (value != nullptr)
+ {
+ i2cBus = static_cast<uint8_t>(*value);
+ }
+ }
+ }
+
+ ///\todo replace this with present + power state
+ if (cpu != 0 && peciAddress != 0)
+ {
+ if (!i2cDeviceFound)
+ {
+ i2cDevice = defaultI2cSlaveAddr0 + cpu - 1;
+ }
+ cpuInfoMap.insert_or_assign(
+ cpu, std::make_shared<CPUInfo>(*conn, cpu, peciAddress, i2cBus,
+ i2cDevice));
+
+ getProcessorInfo(io, conn, cpu);
+ }
},
service, object, "org.freedesktop.DBus.Properties", "GetAll",
interface);
@@ -572,25 +570,23 @@
"PropertiesChanged',arg0='xyz.openbmc_project."
"Configuration.XeonCPU'",
[&io, conn, &objServer](sdbusplus::message_t& msg) {
- std::cerr << "get cpu configuration match\n";
- static boost::asio::steady_timer filterTimer(io);
- filterTimer.expires_after(
- std::chrono::seconds(configCheckInterval));
+ std::cerr << "get cpu configuration match\n";
+ static boost::asio::steady_timer filterTimer(io);
+ filterTimer.expires_after(std::chrono::seconds(configCheckInterval));
- filterTimer.async_wait(
- [&io, conn,
- &objServer](const boost::system::error_code& ec) {
- if (ec == boost::asio::error::operation_aborted)
- {
- return; // we're being canceled
- }
- else if (ec)
- {
- std::cerr << "Error: " << ec.message() << "\n";
- return;
- }
- getCpuConfiguration(io, conn, objServer);
- });
+ filterTimer.async_wait(
+ [&io, conn, &objServer](const boost::system::error_code& ec) {
+ if (ec == boost::asio::error::operation_aborted)
+ {
+ return; // we're being canceled
+ }
+ else if (ec)
+ {
+ std::cerr << "Error: " << ec.message() << "\n";
+ return;
+ }
+ getCpuConfiguration(io, conn, objServer);
+ });
});
conn->async_method_call(
@@ -600,32 +596,32 @@
std::string,
std::vector<std::pair<std::string, std::vector<std::string>>>>>&
subtree) {
- if constexpr (debug)
- std::cerr << "async_method_call callback\n";
+ if constexpr (debug)
+ std::cerr << "async_method_call callback\n";
- if (ec)
- {
- std::cerr << "error with async_method_call\n";
- return;
- }
- if (subtree.empty())
- {
- // No config data yet, so wait for the match
- return;
- }
-
- for (const auto& object : subtree)
- {
- for (const auto& service : object.second)
- {
- getCpuAddress(io, conn, service.first, object.first,
- "xyz.openbmc_project.Configuration.XeonCPU");
- }
- }
- if constexpr (debug)
- std::cerr << "getCpuConfiguration callback complete\n";
-
+ if (ec)
+ {
+ std::cerr << "error with async_method_call\n";
return;
+ }
+ if (subtree.empty())
+ {
+ // No config data yet, so wait for the match
+ return;
+ }
+
+ for (const auto& object : subtree)
+ {
+ for (const auto& service : object.second)
+ {
+ getCpuAddress(io, conn, service.first, object.first,
+ "xyz.openbmc_project.Configuration.XeonCPU");
+ }
+ }
+ if constexpr (debug)
+ std::cerr << "getCpuConfiguration callback complete\n";
+
+ return;
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
diff --git a/src/cpuinfo_utils.cpp b/src/cpuinfo_utils.cpp
index 51136bb..c291718 100644
--- a/src/cpuinfo_utils.cpp
+++ b/src/cpuinfo_utils.cpp
@@ -174,13 +174,13 @@
*dbusConn, service, object, interface, propertyName,
[handler, propertyName = std::string(propertyName)](
boost::system::error_code ec, const PropertyType& newValue) {
- if (ec)
- {
- std::cerr << "Failed to read property " << propertyName << ": "
- << ec << "\n";
- return;
- }
- handler(newValue);
+ if (ec)
+ {
+ std::cerr << "Failed to read property " << propertyName << ": "
+ << ec << "\n";
+ return;
+ }
+ handler(newValue);
});
using ChangedPropertiesType =
@@ -218,12 +218,12 @@
sdbusplus::bus::match::rules::sender(service) +
sdbusplus::bus::match::rules::propertiesChanged(object, interface),
[commonPropHandler](sdbusplus::message_t& reply) {
- ChangedPropertiesType changedProps;
- // ignore first param (interface name), it has to be correct
- reply.read(std::string(), changedProps);
+ ChangedPropertiesType changedProps;
+ // ignore first param (interface name), it has to be correct
+ reply.read(std::string(), changedProps);
- DEBUG_PRINT << "PropertiesChanged handled\n";
- commonPropHandler(changedProps);
+ DEBUG_PRINT << "PropertiesChanged handled\n";
+ commonPropHandler(changedProps);
});
// Set up a match for the InterfacesAdded signal from the service's
@@ -236,28 +236,27 @@
sdbusplus::bus::match::rules::interfacesAdded(),
[object = std::string(object), interface = std::string(interface),
commonPropHandler](sdbusplus::message_t& reply) {
- sdbusplus::message::object_path changedObject;
- reply.read(changedObject);
- if (changedObject != object)
+ sdbusplus::message::object_path changedObject;
+ reply.read(changedObject);
+ if (changedObject != object)
+ {
+ return;
+ }
+
+ std::vector<std::pair<std::string, ChangedPropertiesType>>
+ changedInterfaces;
+ reply.read(changedInterfaces);
+
+ for (const auto& [changedInterface, changedProps] : changedInterfaces)
+ {
+ if (changedInterface != interface)
{
- return;
+ continue;
}
- std::vector<std::pair<std::string, ChangedPropertiesType>>
- changedInterfaces;
- reply.read(changedInterfaces);
-
- for (const auto& [changedInterface, changedProps] :
- changedInterfaces)
- {
- if (changedInterface != interface)
- {
- continue;
- }
-
- DEBUG_PRINT << "InterfacesAdded handled\n";
- commonPropHandler(changedProps);
- }
+ DEBUG_PRINT << "InterfacesAdded handled\n";
+ commonPropHandler(changedProps);
+ }
});
if (propertiesChangedMatch != nullptr)
diff --git a/src/dimm.cpp b/src/dimm.cpp
index bb68d13..d106d47 100644
--- a/src/dimm.cpp
+++ b/src/dimm.cpp
@@ -180,10 +180,10 @@
const uint8_t deviceLocatorPositionNum,
const uint8_t structLen, uint8_t* dataIn)
{
- std::string deviceLocator =
- positionToString(deviceLocatorPositionNum, structLen, dataIn);
- std::string bankLocator =
- positionToString(bankLocatorPositionNum, structLen, dataIn);
+ std::string deviceLocator = positionToString(deviceLocatorPositionNum,
+ structLen, dataIn);
+ std::string bankLocator = positionToString(bankLocatorPositionNum,
+ structLen, dataIn);
std::string result;
if (bankLocator.empty() || onlyDimmLocationCode)
diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp
index 373978a..dd1d8e3 100644
--- a/src/mdrv2.cpp
+++ b/src/mdrv2.cpp
@@ -420,18 +420,17 @@
0,
"/xyz/openbmc_project/inventory/system/board/"),
[this, systemInterface](sdbusplus::message_t& msg) {
- sdbusplus::message::object_path objectName;
- boost::container::flat_map<
- std::string,
- boost::container::flat_map<
- std::string,
- std::variant<std::string, uint64_t>>>
- msgData;
- msg.read(objectName, msgData);
- if (msgData.contains(systemInterface))
- {
- this->systemInfoUpdate();
- }
+ sdbusplus::message::object_path objectName;
+ boost::container::flat_map<
+ std::string,
+ boost::container::flat_map<
+ std::string, std::variant<std::string, uint64_t>>>
+ msgData;
+ msg.read(objectName, msgData);
+ if (msgData.contains(systemInterface))
+ {
+ this->systemInfoUpdate();
+ }
});
}
else
@@ -675,12 +674,12 @@
lg2::info("SMBIOS VERSION - {MAJOR}.{MINOR}", "MAJOR", foundMajorVersion,
"MINOR", foundMinorVersion);
- auto itr = std::find_if(
- std::begin(supportedSMBIOSVersions), std::end(supportedSMBIOSVersions),
- [&](SMBIOSVersion versionItr) {
- return versionItr.majorVersion == foundMajorVersion &&
- versionItr.minorVersion == foundMinorVersion;
- });
+ auto itr = std::find_if(std::begin(supportedSMBIOSVersions),
+ std::end(supportedSMBIOSVersions),
+ [&](SMBIOSVersion versionItr) {
+ return versionItr.majorVersion == foundMajorVersion &&
+ versionItr.minorVersion == foundMinorVersion;
+ });
if (itr == std::end(supportedSMBIOSVersions))
{
return false;
@@ -744,11 +743,9 @@
std::vector<boost::container::flat_map<std::string, RecordVariant>>
MDRV2::getRecordType(size_t type)
{
-
std::vector<boost::container::flat_map<std::string, RecordVariant>> ret;
if (type == memoryDeviceType)
{
-
uint8_t* dataIn = smbiosDir.dir[smbiosDirIndex].dataStorage;
if (dataIn == nullptr)
@@ -758,8 +755,8 @@
do
{
- dataIn =
- getSMBIOSTypePtr(dataIn, memoryDeviceType, sizeof(MemoryInfo));
+ dataIn = getSMBIOSTypePtr(dataIn, memoryDeviceType,
+ sizeof(MemoryInfo));
if (dataIn == nullptr)
{
break;
diff --git a/src/sst_mailbox.cpp b/src/sst_mailbox.cpp
index 0c35d55..418f3fe 100644
--- a/src/sst_mailbox.cpp
+++ b/src/sst_mailbox.cpp
@@ -79,9 +79,9 @@
void setWakeOnPECI(bool enable)
{
uint8_t completionCode;
- EPECIStatus libStatus =
- peci_WrPkgConfig(peciAddress, 5, enable ? 1 : 0, 0,
- sizeof(uint32_t), &completionCode);
+ EPECIStatus libStatus = peci_WrPkgConfig(peciAddress, 5, enable ? 1 : 0,
+ 0, sizeof(uint32_t),
+ &completionCode);
if (!checkPECIStatus(libStatus, completionCode))
{
throw PECIError("Failed to set Wake-On-PECI mode bit");
@@ -277,8 +277,8 @@
{
DEBUG_PRINT << "Running OS Mailbox command "
<< static_cast<int>(subcommand) << '\n';
- PECIManager::MailboxStatus* callStatus =
- errorPolicy == Throw ? nullptr : &status;
+ PECIManager::MailboxStatus* callStatus = errorPolicy == Throw ? nullptr
+ : &status;
uint32_t param = (static_cast<uint32_t>(param4) << 24) |
(static_cast<uint32_t>(param3) << 16) |
(static_cast<uint32_t>(param2) << 8) | param1;
@@ -401,8 +401,7 @@
address(_address), model(_model),
pm(static_cast<uint8_t>(address), model)
{}
- ~SSTMailbox()
- {}
+ ~SSTMailbox() {}
bool ready() override
{
@@ -529,12 +528,12 @@
std::vector<unsigned int>
bfHighPriorityCoreList(unsigned int level) override
{
- uint64_t coreMaskLo =
- PbfGetCoreMaskInfo(pm, static_cast<uint8_t>(level), 0)
- .p1HiCoreMask();
- uint64_t coreMaskHi =
- PbfGetCoreMaskInfo(pm, static_cast<uint8_t>(level), 1)
- .p1HiCoreMask();
+ uint64_t coreMaskLo = PbfGetCoreMaskInfo(pm,
+ static_cast<uint8_t>(level), 0)
+ .p1HiCoreMask();
+ uint64_t coreMaskHi = PbfGetCoreMaskInfo(pm,
+ static_cast<uint8_t>(level), 1)
+ .p1HiCoreMask();
std::bitset<64> hiFreqCoreList = (coreMaskHi << 32) | coreMaskLo;
return convertMaskToList(hiFreqCoreList);
}
diff --git a/src/system.cpp b/src/system.cpp
index 1ebaf2c..3e4b69c 100644
--- a/src/system.cpp
+++ b/src/system.cpp
@@ -73,10 +73,10 @@
const std::string& objectPath,
const std::string& interface)
{
- auto method =
- bus.new_method_call("xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetObject");
+ auto method = bus.new_method_call("xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper",
+ "GetObject");
method.append(objectPath);
method.append(std::vector<std::string>({interface}));
@@ -129,8 +129,8 @@
{
auto biosInfo = reinterpret_cast<struct BIOSInfo*>(dataIn);
uint8_t biosVerByte = biosInfo->biosVersion;
- std::string tempS =
- positionToString(biosInfo->biosVersion, biosInfo->length, dataIn);
+ std::string tempS = positionToString(biosInfo->biosVersion,
+ biosInfo->length, dataIn);
if (std::find_if(tempS.begin(), tempS.end(),
[](char ch) { return !isprint(ch); }) != tempS.end())
{