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: I8c84201cb2343a8c8a5507a49de0721a1bee7063
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/oem/ibm/host-bmc/host_lamp_test.cpp b/oem/ibm/host-bmc/host_lamp_test.cpp
index 57f9610..e7485d8 100644
--- a/oem/ibm/host-bmc/host_lamp_test.cpp
+++ b/oem/ibm/host-bmc/host_lamp_test.cpp
@@ -111,9 +111,9 @@
constexpr uint8_t effecterCount = 1;
auto instanceId = instanceIdDb.next(mctp_eid);
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) + sizeof(effecterID) +
- sizeof(effecterCount) +
- sizeof(set_effecter_state_field));
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + sizeof(effecterID) + sizeof(effecterCount) +
+ sizeof(set_effecter_state_field));
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
set_effecter_state_field stateField{PLDM_REQUEST_SET,
PLDM_STATE_SET_IDENTIFY_STATE_ASSERTED};
@@ -127,8 +127,9 @@
return rc;
}
- auto setStateEffecterStatesResponseHandler =
- [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+ auto setStateEffecterStatesResponseHandler = [](mctp_eid_t /*eid*/,
+ const pldm_msg* response,
+ size_t respMsgLen) {
if (!response || !respMsgLen)
{
error(
diff --git a/oem/ibm/host-bmc/host_lamp_test.hpp b/oem/ibm/host-bmc/host_lamp_test.hpp
index 67e5593..f5b1294 100644
--- a/oem/ibm/host-bmc/host_lamp_test.hpp
+++ b/oem/ibm/host-bmc/host_lamp_test.hpp
@@ -55,9 +55,8 @@
uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
pldm_pdr* repo,
pldm::requester::Handler<pldm::requester::Request>* handler) :
- LEDGroupObj(bus, objPath.c_str()),
- path(objPath), mctp_eid(mctp_eid), instanceIdDb(instanceIdDb),
- pdrRepo(repo), handler(handler)
+ LEDGroupObj(bus, objPath.c_str()), path(objPath), mctp_eid(mctp_eid),
+ instanceIdDb(instanceIdDb), pdrRepo(repo), handler(handler)
{}
/** @brief Property SET Override function
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index 57b89ba..f223819 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -77,8 +77,8 @@
pldm::utils::CustomFD xdmaFd(dmaFd);
void* vgaMem;
- vgaMem = mmap(nullptr, pageAlignedLength, PROT_READ, MAP_SHARED, xdmaFd(),
- 0);
+ vgaMem =
+ mmap(nullptr, pageAlignedLength, PROT_READ, MAP_SHARED, xdmaFd(), 0);
if (MAP_FAILED == vgaMem)
{
rc = -errno;
@@ -287,11 +287,10 @@
}
}
-void encodeGetFileResponseHandler(uint8_t instance_id, uint8_t completion_code,
- uint32_t next_transfer_handle,
- uint8_t transfer_flag,
- const uint8_t* table_data, size_t table_size,
- struct pldm_msg* msg)
+void encodeGetFileResponseHandler(
+ uint8_t instance_id, uint8_t completion_code, uint32_t next_transfer_handle,
+ uint8_t transfer_flag, const uint8_t* table_data, size_t table_size,
+ struct pldm_msg* msg)
{
int rc = encode_get_file_table_resp(instance_id, completion_code,
next_transfer_handle, transfer_flag,
@@ -547,8 +546,8 @@
uint8_t transferFlag = 0;
uint8_t tableType = 0;
- Response response(sizeof(pldm_msg_hdr) +
- PLDM_GET_FILE_TABLE_MIN_RESP_BYTES);
+ Response response(
+ sizeof(pldm_msg_hdr) + PLDM_GET_FILE_TABLE_MIN_RESP_BYTES);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
if (payloadLength != PLDM_GET_FILE_TABLE_REQ_BYTES)
@@ -787,8 +786,8 @@
return response;
}
- auto fileDataPos = reinterpret_cast<const char*>(request->payload) +
- fileDataOffset;
+ auto fileDataPos =
+ reinterpret_cast<const char*>(request->payload) + fileDataOffset;
std::ofstream stream(value.fsPath,
std::ios::in | std::ios::out | std::ios::binary);
@@ -826,9 +825,9 @@
uint32_t offset{};
uint32_t length{};
uint64_t address{};
- auto rc = decode_rw_file_by_type_memory_req(request, payloadLength,
- &fileType, &fileHandle, &offset,
- &length, &address);
+ auto rc = decode_rw_file_by_type_memory_req(
+ request, payloadLength, &fileType, &fileHandle, &offset, &length,
+ &address);
if (rc != PLDM_SUCCESS)
{
error(
@@ -1135,8 +1134,8 @@
rc = handler->newFileAvailable(length);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
- int responseCode = encode_new_file_resp(request->hdr.instance_id, rc,
- responsePtr);
+ int responseCode =
+ encode_new_file_resp(request->hdr.instance_id, rc, responsePtr);
if (responseCode != PLDM_SUCCESS)
{
error(
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp
index dff0085..eab731b 100644
--- a/oem/ibm/libpldmresponder/file_io.hpp
+++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -174,63 +174,63 @@
handlers.emplace(
PLDM_READ_FILE_INTO_MEMORY,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->readFileIntoMemory(request, payloadLength);
- });
+ return this->readFileIntoMemory(request, payloadLength);
+ });
handlers.emplace(
PLDM_WRITE_FILE_FROM_MEMORY,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->writeFileFromMemory(request, payloadLength);
- });
+ return this->writeFileFromMemory(request, payloadLength);
+ });
handlers.emplace(
PLDM_WRITE_FILE_BY_TYPE_FROM_MEMORY,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->writeFileByTypeFromMemory(request, payloadLength);
- });
+ return this->writeFileByTypeFromMemory(request, payloadLength);
+ });
handlers.emplace(
PLDM_READ_FILE_BY_TYPE_INTO_MEMORY,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->readFileByTypeIntoMemory(request, payloadLength);
- });
+ return this->readFileByTypeIntoMemory(request, payloadLength);
+ });
handlers.emplace(
PLDM_READ_FILE_BY_TYPE,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->readFileByType(request, payloadLength);
- });
+ return this->readFileByType(request, payloadLength);
+ });
handlers.emplace(
PLDM_WRITE_FILE_BY_TYPE,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->writeFileByType(request, payloadLength);
- });
+ return this->writeFileByType(request, payloadLength);
+ });
handlers.emplace(
PLDM_GET_FILE_TABLE,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->getFileTable(request, payloadLength);
- });
+ return this->getFileTable(request, payloadLength);
+ });
handlers.emplace(
PLDM_READ_FILE,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->readFile(request, payloadLength);
- });
+ return this->readFile(request, payloadLength);
+ });
handlers.emplace(
PLDM_WRITE_FILE,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->writeFile(request, payloadLength);
- });
+ return this->writeFile(request, payloadLength);
+ });
handlers.emplace(
PLDM_FILE_ACK,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->fileAck(request, payloadLength);
- });
+ return this->fileAck(request, payloadLength);
+ });
handlers.emplace(
PLDM_HOST_GET_ALERT_STATUS,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->getAlertStatus(request, payloadLength);
- });
+ return this->getAlertStatus(request, payloadLength);
+ });
handlers.emplace(
PLDM_NEW_FILE_AVAILABLE,
[this](pldm_tid_t, const pldm_msg* request, size_t payloadLength) {
- return this->newFileAvailable(request, payloadLength);
- });
+ return this->newFileAvailable(request, payloadLength);
+ });
resDumpMatcher = std::make_unique<sdbusplus::bus::match_t>(
pldm::utils::DBusHandler::getBus(),
@@ -238,80 +238,84 @@
sdbusplus::bus::match::rules::argNpath(0, dumpObjPath),
[this, hostSockFd, hostEid, instanceIdDb,
handler](sdbusplus::message_t& msg) {
- std::map<std::string,
- std::map<std::string, std::variant<std::string, uint32_t>>>
- interfaces;
- sdbusplus::message::object_path path;
- msg.read(path, interfaces);
- std::string vspstring;
- std::string password;
+ std::map<
+ std::string,
+ std::map<std::string, std::variant<std::string, uint32_t>>>
+ interfaces;
+ sdbusplus::message::object_path path;
+ msg.read(path, interfaces);
+ std::string vspstring;
+ std::string password;
- for (const auto& interface : interfaces)
- {
- if (interface.first == resDumpEntry)
+ for (const auto& interface : interfaces)
{
- for (const auto& property : interface.second)
+ if (interface.first == resDumpEntry)
{
- if (property.first == "VSPString")
+ for (const auto& property : interface.second)
{
- vspstring = std::get<std::string>(property.second);
+ if (property.first == "VSPString")
+ {
+ vspstring =
+ std::get<std::string>(property.second);
+ }
+ else if (property.first == "Password")
+ {
+ password =
+ std::get<std::string>(property.second);
+ }
}
- else if (property.first == "Password")
- {
- password = std::get<std::string>(property.second);
- }
+ dbusToFileHandlers
+ .emplace_back(
+ std::make_unique<pldm::requester::oem_ibm::
+ DbusToFileHandler>(
+ hostSockFd, hostEid, instanceIdDb, path,
+ handler))
+ ->processNewResourceDump(vspstring, password);
+ break;
}
- dbusToFileHandlers
- .emplace_back(
- std::make_unique<
- pldm::requester::oem_ibm::DbusToFileHandler>(
- hostSockFd, hostEid, instanceIdDb, path,
- handler))
- ->processNewResourceDump(vspstring, password);
- break;
}
- }
- });
+ });
vmiCertMatcher = std::make_unique<sdbusplus::bus::match_t>(
pldm::utils::DBusHandler::getBus(),
sdbusplus::bus::match::rules::interfacesAdded() +
sdbusplus::bus::match::rules::argNpath(0, certObjPath),
[this, hostSockFd, hostEid, instanceIdDb,
handler](sdbusplus::message_t& msg) {
- std::map<std::string,
- std::map<std::string, std::variant<std::string, uint32_t>>>
- interfaces;
- sdbusplus::message::object_path path;
- msg.read(path, interfaces);
- std::string csr;
+ std::map<
+ std::string,
+ std::map<std::string, std::variant<std::string, uint32_t>>>
+ interfaces;
+ sdbusplus::message::object_path path;
+ msg.read(path, interfaces);
+ std::string csr;
- for (const auto& interface : interfaces)
- {
- if (interface.first == certAuthority)
+ for (const auto& interface : interfaces)
{
- for (const auto& property : interface.second)
+ if (interface.first == certAuthority)
{
- if (property.first == "CSR")
+ for (const auto& property : interface.second)
{
- csr = std::get<std::string>(property.second);
- auto fileHandle =
- sdbusplus::message::object_path(path)
- .filename();
+ if (property.first == "CSR")
+ {
+ csr = std::get<std::string>(property.second);
+ auto fileHandle =
+ sdbusplus::message::object_path(path)
+ .filename();
- dbusToFileHandlers
- .emplace_back(
- std::make_unique<pldm::requester::oem_ibm::
- DbusToFileHandler>(
+ dbusToFileHandlers
+ .emplace_back(std::make_unique<
+ pldm::requester::oem_ibm::
+ DbusToFileHandler>(
hostSockFd, hostEid, instanceIdDb, path,
handler))
- ->newCsrFileAvailable(csr, fileHandle);
- break;
+ ->newCsrFileAvailable(csr, fileHandle);
+ break;
+ }
}
+ break;
}
- break;
}
- }
- });
+ });
}
/** @brief Handler for readFileIntoMemory command
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.cpp b/oem/ibm/libpldmresponder/file_io_by_type.cpp
index 1a14555..bed64f1 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.cpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.cpp
@@ -47,8 +47,8 @@
length -= dma::maxSize;
address += dma::maxSize;
}
- auto rc = xdmaInterface.transferDataHost(fd, offset, length, address,
- upstream);
+ auto rc =
+ xdmaInterface.transferDataHost(fd, offset, length, address, upstream);
return rc < 0 ? PLDM_ERROR : PLDM_SUCCESS;
}
@@ -58,8 +58,8 @@
dma::DMA xdmaInterface;
while (length > dma::maxSize)
{
- auto rc = xdmaInterface.transferHostDataToSocket(fd, dma::maxSize,
- address);
+ auto rc =
+ xdmaInterface.transferHostDataToSocket(fd, dma::maxSize, address);
if (rc < 0)
{
return PLDM_ERROR;
@@ -123,8 +123,8 @@
return transferFileData(fd(), upstream, offset, length, address);
}
-std::unique_ptr<FileHandler> getHandlerByType(uint16_t fileType,
- uint32_t fileHandle)
+std::unique_ptr<FileHandler>
+ getHandlerByType(uint16_t fileType, uint32_t fileHandle)
{
switch (fileType)
{
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.hpp b/oem/ibm/libpldmresponder/file_io_by_type.hpp
index c9056e9..cf4a82c 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.hpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.hpp
@@ -130,7 +130,7 @@
* @param[in] fileHandle - file handle
*/
-std::unique_ptr<FileHandler> getHandlerByType(uint16_t fileType,
- uint32_t fileHandle);
+std::unique_ptr<FileHandler>
+ getHandlerByType(uint16_t fileType, uint32_t fileHandle);
} // namespace responder
} // namespace pldm
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.cpp b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
index 00d9f0b..402a003 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
@@ -163,9 +163,9 @@
}
PropertyValue valueStatus{
"xyz.openbmc_project.Certs.Entry.State.Complete"};
- DBusMapping dbusMappingStatus{certObjPath +
- std::to_string(fileHandle),
- certEntryIntf, "Status", "string"};
+ DBusMapping dbusMappingStatus{
+ certObjPath + std::to_string(fileHandle), certEntryIntf,
+ "Status", "string"};
try
{
info(
@@ -231,8 +231,8 @@
}
else if (certType == PLDM_FILE_TYPE_ROOT_CERT)
{
- fileFd = open((filePath + "RootCert").c_str(), flags,
- S_IRUSR | S_IWUSR);
+ fileFd =
+ open((filePath + "RootCert").c_str(), flags, S_IRUSR | S_IWUSR);
}
if (fileFd == -1)
{
@@ -245,11 +245,9 @@
return PLDM_SUCCESS;
}
-int CertHandler::newFileAvailableWithMetaData(uint64_t length,
- uint32_t metaDataValue1,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/)
+int CertHandler::newFileAvailableWithMetaData(
+ uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/,
+ uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/)
{
fs::create_directories(certFilePath);
fs::permissions(certFilePath,
@@ -297,8 +295,8 @@
}
else if (certType == PLDM_FILE_TYPE_ROOT_CERT)
{
- fileFd = open((filePath + "RootCert").c_str(), flags,
- S_IRUSR | S_IWUSR);
+ fileFd =
+ open((filePath + "RootCert").c_str(), flags, S_IRUSR | S_IWUSR);
}
if (fileFd == -1)
{
@@ -311,11 +309,10 @@
return PLDM_SUCCESS;
}
-int CertHandler::fileAckWithMetaData(uint8_t fileStatus,
- uint32_t /*metaDataValue1*/,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/)
+int CertHandler::fileAckWithMetaData(
+ uint8_t fileStatus, uint32_t /*metaDataValue1*/,
+ uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+ uint32_t /*metaDataValue4*/)
{
if (certType == PLDM_FILE_TYPE_CERT_SIGNING_REQUEST)
{
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.hpp b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
index 75f0e69..8613cd5 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
@@ -47,17 +47,14 @@
virtual int newFileAvailable(uint64_t length);
- virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
- uint32_t /*metaDataValue1*/,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/);
+ virtual int fileAckWithMetaData(
+ uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+ uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+ uint32_t /*metaDataValue4*/);
- virtual int newFileAvailableWithMetaData(uint64_t length,
- uint32_t metaDataValue1,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/);
+ virtual int newFileAvailableWithMetaData(
+ uint64_t length, uint32_t metaDataValue1, uint32_t /*metaDataValue2*/,
+ uint32_t /*metaDataValue3*/, uint32_t /*metaDataValue4*/);
/** @brief CertHandler destructor
*/
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index 40739d6..2abd726 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -122,8 +122,8 @@
try
{
- auto service = pldm::utils::DBusHandler().getService(notifyObjPath,
- dumpInterface);
+ auto service =
+ pldm::utils::DBusHandler().getService(notifyObjPath, dumpInterface);
using namespace sdbusplus::xyz::openbmc_project::Dump::server;
auto method = bus.new_method_call(service.c_str(), notifyObjPath,
dumpInterface, "Notify");
diff --git a/oem/ibm/libpldmresponder/file_io_type_lid.hpp b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
index da95907..cb0e697 100644
--- a/oem/ibm/libpldmresponder/file_io_type_lid.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
@@ -38,8 +38,8 @@
std::stringstream stream;
stream << std::hex << fileHandle;
auto lidName = stream.str() + ".lid";
- std::string patchDir = permSide ? LID_ALTERNATE_PATCH_DIR
- : LID_RUNNING_PATCH_DIR;
+ std::string patchDir =
+ permSide ? LID_ALTERNATE_PATCH_DIR : LID_RUNNING_PATCH_DIR;
auto patch = fs::path(patchDir) / lidName;
if (fs::is_regular_file(patch))
{
diff --git a/oem/ibm/libpldmresponder/file_io_type_pcie.cpp b/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
index 5aad55a..0c165aa 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pcie.cpp
@@ -206,8 +206,8 @@
};
// memory map the topology file into pldm memory
- void* fileInMemory = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE,
- topologyFd(), 0);
+ void* fileInMemory =
+ mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, topologyFd(), 0);
if (MAP_FAILED == fileInMemory)
{
error("mmap on topology file failed with error {RC}", "RC", -errno);
@@ -354,9 +354,9 @@
static_cast<int>(slotLocCodeCompartSize)));
std::string slotLocationCode(slotLocation.begin(), slotLocation.end());
- uint8_t* suffixData = reinterpret_cast<uint8_t*>(slotData) +
- slotLocationDataMemberSize +
- slotData->slotLocCodesCmnPrtSize;
+ uint8_t* suffixData =
+ reinterpret_cast<uint8_t*>(slotData) + slotLocationDataMemberSize +
+ slotData->slotLocCodesCmnPrtSize;
if (!suffixData)
{
error("slot location suffix data is nullptr");
@@ -390,8 +390,8 @@
slotSuffixLocationCode = slotSuffLocationCode;
}
- std::string slotFullLocationCode = slotLocationCode +
- slotSuffixLocationCode;
+ std::string slotFullLocationCode =
+ slotLocationCode + slotSuffixLocationCode;
slotFinaLocationCode.push_back(slotFullLocationCode);
// move the pointer to next slot
@@ -399,14 +399,14 @@
}
// store the information into a map
- topologyInformation[linkId] =
- std::make_tuple(linkStateMap[linkStatus], type, linkSpeed,
- linkWidth[width], pcieHostBridgeLocationCode,
- std::make_pair(localTopPortLocationCode,
- localBottomPortLocationCode),
- std::make_pair(remoteTopPortLocationCode,
- remoteBottomPortLocationCode),
- slotFinaLocationCode, parentLinkId);
+ topologyInformation[linkId] = std::make_tuple(
+ linkStateMap[linkStatus], type, linkSpeed, linkWidth[width],
+ pcieHostBridgeLocationCode,
+ std::make_pair(localTopPortLocationCode,
+ localBottomPortLocationCode),
+ std::make_pair(remoteTopPortLocationCode,
+ remoteBottomPortLocationCode),
+ slotFinaLocationCode, parentLinkId);
// move the pointer to next link
singleEntryData = reinterpret_cast<struct pcieLinkEntry*>(
@@ -447,8 +447,8 @@
munmap(fileInMemory, sb.st_size);
};
- void* fileInMemory = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE,
- cableInfoFd(), 0);
+ void* fileInMemory =
+ mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, cableInfoFd(), 0);
if (MAP_FAILED == fileInMemory)
{
@@ -494,9 +494,9 @@
htobe16(cableData->ioEnclosurePortLocationCodeOffset),
cableData->ioEnclosurePortLocationCodeSize);
- std::string cablePartNum(cableDataPtr +
- htobe16(cableData->cablePartNumberOffset),
- cableData->cablePartNumberSize);
+ std::string cablePartNum(
+ cableDataPtr + htobe16(cableData->cablePartNumberOffset),
+ cableData->cablePartNumberSize);
// cache the data into a map
cableInformation[cable] = std::make_tuple(
diff --git a/oem/ibm/libpldmresponder/file_io_type_pcie.hpp b/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
index e6a918f..89bd2a6 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pcie.hpp
@@ -169,20 +169,18 @@
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
}
- virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
- uint32_t /*metaDataValue1*/,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/)
+ virtual int fileAckWithMetaData(
+ uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+ uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+ uint32_t /*metaDataValue4*/)
{
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
}
- virtual int newFileAvailableWithMetaData(uint64_t /*length*/,
- uint32_t /*metaDataValue1*/,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/)
+ virtual int newFileAvailableWithMetaData(
+ uint64_t /*length*/, uint32_t /*metaDataValue1*/,
+ uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+ uint32_t /*metaDataValue4*/)
{
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
}
diff --git a/oem/ibm/libpldmresponder/file_io_type_pel.cpp b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
index d33479f..685bff2 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
@@ -101,8 +101,8 @@
try
{
- auto service = pldm::utils::DBusHandler().getService(logObjPath,
- logInterface);
+ auto service =
+ pldm::utils::DBusHandler().getService(logObjPath, logInterface);
auto method = bus.new_method_call(service.c_str(), logObjPath,
logInterface, "GetPEL");
method.append(fileHandle);
@@ -132,8 +132,8 @@
try
{
- auto service = pldm::utils::DBusHandler().getService(logObjPath,
- logInterface);
+ auto service =
+ pldm::utils::DBusHandler().getService(logObjPath, logInterface);
auto method = bus.new_method_call(service.c_str(), logObjPath,
logInterface, "GetPEL");
method.append(fileHandle);
@@ -229,8 +229,8 @@
{
try
{
- service = pldm::utils::DBusHandler().getService(logObjPath,
- logInterface);
+ service =
+ pldm::utils::DBusHandler().getService(logObjPath, logInterface);
}
catch (const sdbusplus::exception_t& e)
{
@@ -308,8 +308,8 @@
try
{
- auto service = pldm::utils::DBusHandler().getService(logObjPath,
- logInterface);
+ auto service =
+ pldm::utils::DBusHandler().getService(logObjPath, logInterface);
using namespace sdbusplus::xyz::openbmc_project::Logging::server;
std::map<std::string, std::string> addlData{};
auto severity =
diff --git a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
index 9c567e5..f6d9db3 100644
--- a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
@@ -27,8 +27,8 @@
try
{
- auto service = pldm::utils::DBusHandler().getService(RawObjectPath,
- RawInterface);
+ auto service =
+ pldm::utils::DBusHandler().getService(RawObjectPath, RawInterface);
auto method = bus.new_method_call(service.c_str(), RawObjectPath,
FreedesktopInterface, SetMethod);
method.append(RawInterface, RawProperty,
diff --git a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
index 4ae11ac..fede599 100644
--- a/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_vpd.cpp
@@ -31,9 +31,9 @@
auto& bus = pldm::utils::DBusHandler::getBus();
auto service = pldm::utils::DBusHandler().getService(keywrdObjPath,
keywrdInterface);
- auto method = bus.new_method_call(service.c_str(), keywrdObjPath,
- "org.freedesktop.DBus.Properties",
- "Get");
+ auto method =
+ bus.new_method_call(service.c_str(), keywrdObjPath,
+ "org.freedesktop.DBus.Properties", "Get");
method.append(keywrdInterface, keywrdPropName);
auto reply = bus.call(method, dbusTimeout);
reply.read(keywrd);
diff --git a/oem/ibm/libpldmresponder/file_io_type_vpd.hpp b/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
index 370bb08..b06c6a1 100644
--- a/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_vpd.hpp
@@ -48,19 +48,17 @@
{
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
}
- virtual int fileAckWithMetaData(uint8_t /*fileStatus*/,
- uint32_t /*metaDataValue1*/,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/)
+ virtual int fileAckWithMetaData(
+ uint8_t /*fileStatus*/, uint32_t /*metaDataValue1*/,
+ uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+ uint32_t /*metaDataValue4*/)
{
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
}
- virtual int newFileAvailableWithMetaData(uint64_t /*length*/,
- uint32_t /*metaDataValue1*/,
- uint32_t /*metaDataValue2*/,
- uint32_t /*metaDataValue3*/,
- uint32_t /*metaDataValue4*/)
+ virtual int newFileAvailableWithMetaData(
+ uint64_t /*length*/, uint32_t /*metaDataValue1*/,
+ uint32_t /*metaDataValue2*/, uint32_t /*metaDataValue3*/,
+ uint32_t /*metaDataValue4*/)
{
return PLDM_ERROR_UNSUPPORTED_PLDM_CMD;
}
diff --git a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
index 89b9f41..fe53b7a 100644
--- a/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/fru_oem_ibm.cpp
@@ -62,12 +62,12 @@
return PLDM_ERROR_INVALID_DATA;
}
- auto vendorId = std::format("0x{:04x}",
- htole16(pcieData->vendorId));
- auto deviceId = std::format("0x{:04x}",
- htole16(pcieData->deviceId));
- auto revisionId = std::format("0x{:02x}",
- htole16(pcieData->revisionId));
+ auto vendorId =
+ std::format("0x{:04x}", htole16(pcieData->vendorId));
+ auto deviceId =
+ std::format("0x{:04x}", htole16(pcieData->deviceId));
+ auto revisionId =
+ std::format("0x{:02x}", htole16(pcieData->revisionId));
std::string classCode = "0x";
for (const auto& ele : pcieData->classCode)
@@ -77,8 +77,8 @@
auto subSystemVendorId = std::format(
"0x{:04x}", htole16(pcieData->subSystemVendorId));
- auto subSystemId = std::format("0x{:04x}",
- htole16(pcieData->subSystemId));
+ auto subSystemId =
+ std::format("0x{:04x}", htole16(pcieData->subSystemId));
updateDBusProperty(fruRSI, entityAssociationMap, vendorId,
deviceId, revisionId, classCode,
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index 71b6ec3..d3ea1a8 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -172,8 +172,8 @@
runningVersion = std::get<std::vector<std::string>>(paths)[0];
- auto method1 = bus.new_method_call(mapperService, activeObjPath,
- propIntf, "Get");
+ auto method1 =
+ bus.new_method_call(mapperService, activeObjPath, propIntf, "Get");
method1.append("xyz.openbmc_project.Association", "endpoints");
auto reply1 = bus.call(method1, dbusTimeout);
@@ -201,117 +201,127 @@
pldm::utils::DBusHandler::getBus(),
propertiesChanged(runningVersion, redundancyIntf),
[this](sdbusplus::message_t& msg) {
- DbusChangedProps props;
- std::string iface;
- msg.read(iface, props);
- processPriorityChangeNotification(props);
- }));
+ DbusChangedProps props;
+ std::string iface;
+ msg.read(iface, props);
+ processPriorityChangeNotification(props);
+ }));
fwUpdateMatcher.push_back(std::make_unique<sdbusplus::bus::match_t>(
pldm::utils::DBusHandler::getBus(),
"interface='org.freedesktop.DBus.ObjectManager',type='signal',"
"member='InterfacesAdded',path='/xyz/openbmc_project/software'",
[this](sdbusplus::message_t& msg) {
- DBusInterfaceAdded interfaces;
- sdbusplus::message::object_path path;
- msg.read(path, interfaces);
+ DBusInterfaceAdded interfaces;
+ sdbusplus::message::object_path path;
+ msg.read(path, interfaces);
- for (auto& interface : interfaces)
- {
- if (interface.first == "xyz.openbmc_project.Software.Activation")
+ for (auto& interface : interfaces)
{
- auto imageInterface = "xyz.openbmc_project.Software.Activation";
- auto imageObjPath = path.str.c_str();
-
- try
+ if (interface.first ==
+ "xyz.openbmc_project.Software.Activation")
{
- auto propVal = dBusIntf->getDbusPropertyVariant(
- imageObjPath, "Activation", imageInterface);
- const auto& imageProp = std::get<std::string>(propVal);
- if (imageProp == "xyz.openbmc_project.Software."
- "Activation.Activations.Ready" &&
- isCodeUpdateInProgress())
+ auto imageInterface =
+ "xyz.openbmc_project.Software.Activation";
+ auto imageObjPath = path.str.c_str();
+
+ try
{
- newImageId = path.str;
- if (!imageActivationMatch)
+ auto propVal = dBusIntf->getDbusPropertyVariant(
+ imageObjPath, "Activation", imageInterface);
+ const auto& imageProp = std::get<std::string>(propVal);
+ if (imageProp == "xyz.openbmc_project.Software."
+ "Activation.Activations.Ready" &&
+ isCodeUpdateInProgress())
{
- imageActivationMatch =
- std::make_unique<sdbusplus::bus::match_t>(
+ newImageId = path.str;
+ if (!imageActivationMatch)
+ {
+ imageActivationMatch = std::make_unique<
+ sdbusplus::bus::match_t>(
pldm::utils::DBusHandler::getBus(),
propertiesChanged(newImageId,
"xyz.openbmc_project."
"Software.Activation"),
[this](sdbusplus::message_t& msg) {
- DbusChangedProps props;
- std::string iface;
- msg.read(iface, props);
- const auto itr = props.find("Activation");
- if (itr != props.end())
- {
- PropertyValue value = itr->second;
- auto propVal = std::get<std::string>(value);
- if (propVal ==
- "xyz.openbmc_project.Software."
- "Activation.Activations.Active")
- {
- CodeUpdateState state =
- CodeUpdateState::END;
- setCodeUpdateProgress(false);
- auto sensorId =
- getFirmwareUpdateSensor();
- sendStateSensorEvent(
- sensorId, PLDM_STATE_SENSOR_STATE,
- 0, uint8_t(state),
- uint8_t(CodeUpdateState::START));
- newImageId.clear();
- }
- else if (propVal == "xyz.openbmc_project."
- "Software.Activation."
- "Activations.Failed" ||
- propVal == "xyz.openbmc_"
- "project.Software."
- "Activation."
- "Activations."
- "Invalid")
- {
- CodeUpdateState state =
- CodeUpdateState::FAIL;
- setCodeUpdateProgress(false);
- auto sensorId =
- getFirmwareUpdateSensor();
- sendStateSensorEvent(
- sensorId, PLDM_STATE_SENSOR_STATE,
- 0, uint8_t(state),
- uint8_t(CodeUpdateState::START));
- newImageId.clear();
- }
- }
- });
+ DbusChangedProps props;
+ std::string iface;
+ msg.read(iface, props);
+ const auto itr =
+ props.find("Activation");
+ if (itr != props.end())
+ {
+ PropertyValue value = itr->second;
+ auto propVal =
+ std::get<std::string>(value);
+ if (propVal ==
+ "xyz.openbmc_project.Software."
+ "Activation.Activations.Active")
+ {
+ CodeUpdateState state =
+ CodeUpdateState::END;
+ setCodeUpdateProgress(false);
+ auto sensorId =
+ getFirmwareUpdateSensor();
+ sendStateSensorEvent(
+ sensorId,
+ PLDM_STATE_SENSOR_STATE, 0,
+ uint8_t(state),
+ uint8_t(CodeUpdateState::
+ START));
+ newImageId.clear();
+ }
+ else if (propVal ==
+ "xyz.openbmc_project."
+ "Software.Activation."
+ "Activations.Failed" ||
+ propVal ==
+ "xyz.openbmc_"
+ "project.Software."
+ "Activation."
+ "Activations."
+ "Invalid")
+ {
+ CodeUpdateState state =
+ CodeUpdateState::FAIL;
+ setCodeUpdateProgress(false);
+ auto sensorId =
+ getFirmwareUpdateSensor();
+ sendStateSensorEvent(
+ sensorId,
+ PLDM_STATE_SENSOR_STATE, 0,
+ uint8_t(state),
+ uint8_t(CodeUpdateState::
+ START));
+ newImageId.clear();
+ }
+ }
+ });
+ }
+ auto rc = setRequestedActivation();
+ if (rc != PLDM_SUCCESS)
+ {
+ error("Could not set Requested Activation");
+ CodeUpdateState state = CodeUpdateState::FAIL;
+ setCodeUpdateProgress(false);
+ auto sensorId = getFirmwareUpdateSensor();
+ sendStateSensorEvent(
+ sensorId, PLDM_STATE_SENSOR_STATE, 0,
+ uint8_t(state),
+ uint8_t(CodeUpdateState::START));
+ }
+ break;
}
- auto rc = setRequestedActivation();
- if (rc != PLDM_SUCCESS)
- {
- error("Could not set Requested Activation");
- CodeUpdateState state = CodeUpdateState::FAIL;
- setCodeUpdateProgress(false);
- auto sensorId = getFirmwareUpdateSensor();
- sendStateSensorEvent(
- sensorId, PLDM_STATE_SENSOR_STATE, 0,
- uint8_t(state),
- uint8_t(CodeUpdateState::START));
- }
- break;
+ }
+ catch (const sdbusplus::exception_t& e)
+ {
+ error(
+ "Failed to get activation status for interface '{INTERFACE}' and object path '{PATH}', error - {ERROR}",
+ "ERROR", e, "INTERFACE", imageInterface, "PATH",
+ imageObjPath);
}
}
- catch (const sdbusplus::exception_t& e)
- {
- error(
- "Failed to get activation status for interface '{INTERFACE}' and object path '{PATH}', error - {ERROR}",
- "ERROR", e, "INTERFACE", imageInterface, "PATH",
- imageObjPath);
- }
}
- }
- }));
+ }));
}
void CodeUpdate::processPriorityChangeNotification(
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index b7c437a..6a39328 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -312,8 +312,9 @@
}
std::cout << tempStream.str() << std::endl;
}
- auto oemPlatformEventMessageResponseHandler =
- [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+ auto oemPlatformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+ const pldm_msg* response,
+ size_t respMsgLen) {
uint8_t completionCode{};
uint8_t status{};
auto rc = decode_platform_event_message_resp(response, respMsgLen,
@@ -369,9 +370,9 @@
eventClass->event_state = eventState;
eventClass->previous_event_state = prevEventState;
auto instanceId = instanceIdDb.next(mctp_eid);
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
- PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
- sensorEventDataVec.size());
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+ sensorEventDataVec.size());
auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
instanceId);
if (rc != PLDM_SUCCESS)
@@ -477,51 +478,52 @@
propertiesChanged("/xyz/openbmc_project/state/chassis0",
"xyz.openbmc_project.State.Chassis"),
[this](sdbusplus::message_t& msg) {
- DbusChangedProps props{};
- std::string intf;
- msg.read(intf, props);
- const auto itr = props.find("CurrentPowerState");
- if (itr != props.end())
- {
- PropertyValue value = itr->second;
- auto propVal = std::get<std::string>(value);
- if (propVal == "xyz.openbmc_project.State.Chassis.PowerState.Off")
+ DbusChangedProps props{};
+ std::string intf;
+ msg.read(intf, props);
+ const auto itr = props.find("CurrentPowerState");
+ if (itr != props.end())
{
- pldm::utils::DBusMapping dbusMapping{
- "/xyz/openbmc_project/control/host0/"
- "power_restore_policy/one_time",
- "xyz.openbmc_project.Control.Power.RestorePolicy",
- "PowerRestorePolicy", "string"};
- value = "xyz.openbmc_project.Control.Power.RestorePolicy."
- "Policy.AlwaysOn";
- try
+ PropertyValue value = itr->second;
+ auto propVal = std::get<std::string>(value);
+ if (propVal ==
+ "xyz.openbmc_project.State.Chassis.PowerState.Off")
{
- dBusIntf->setDbusProperty(dbusMapping, value);
- }
- catch (const std::exception& e)
- {
- error(
- "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
- "ERROR", e);
- }
- dbusMapping = pldm::utils::DBusMapping{
- "/xyz/openbmc_project/state/bmc0",
- "xyz.openbmc_project.State.BMC", "RequestedBMCTransition",
- "string"};
- value = "xyz.openbmc_project.State.BMC.Transition.Reboot";
- try
- {
- dBusIntf->setDbusProperty(dbusMapping, value);
- }
- catch (const std::exception& e)
- {
- error(
- "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
- "ERROR", e);
+ pldm::utils::DBusMapping dbusMapping{
+ "/xyz/openbmc_project/control/host0/"
+ "power_restore_policy/one_time",
+ "xyz.openbmc_project.Control.Power.RestorePolicy",
+ "PowerRestorePolicy", "string"};
+ value = "xyz.openbmc_project.Control.Power.RestorePolicy."
+ "Policy.AlwaysOn";
+ try
+ {
+ dBusIntf->setDbusProperty(dbusMapping, value);
+ }
+ catch (const std::exception& e)
+ {
+ error(
+ "Failure in setting one-time restore policy, unable to set property PowerRestorePolicy, error - {ERROR}",
+ "ERROR", e);
+ }
+ dbusMapping = pldm::utils::DBusMapping{
+ "/xyz/openbmc_project/state/bmc0",
+ "xyz.openbmc_project.State.BMC",
+ "RequestedBMCTransition", "string"};
+ value = "xyz.openbmc_project.State.BMC.Transition.Reboot";
+ try
+ {
+ dBusIntf->setDbusProperty(dbusMapping, value);
+ }
+ catch (const std::exception& e)
+ {
+ error(
+ "Failure in BMC state transition to reboot, unable to set property RequestedBMCTransition , error - {ERROR}",
+ "ERROR", e);
+ }
}
}
- }
- });
+ });
}
void pldm::responder::oem_ibm_platform::Handler::checkAndDisableWatchDog()
@@ -587,9 +589,9 @@
void pldm::responder::oem_ibm_platform::Handler::disableWatchDogTimer()
{
setEventReceiverCnt = 0;
- pldm::utils::DBusMapping dbusMapping{"/xyz/openbmc_project/watchdog/host0",
- "xyz.openbmc_project.State.Watchdog",
- "Enabled", "bool"};
+ pldm::utils::DBusMapping dbusMapping{
+ "/xyz/openbmc_project/watchdog/host0",
+ "xyz.openbmc_project.State.Watchdog", "Enabled", "bool"};
bool wdStatus = watchDogRunning();
if (!wdStatus)
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index 8c164da..b5749c3 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -47,10 +47,9 @@
uint8_t mctp_eid, pldm::InstanceIdDb& instanceIdDb,
sdeventplus::Event& event,
pldm::requester::Handler<pldm::requester::Request>* handler) :
- oem_platform::Handler(dBusIntf),
- codeUpdate(codeUpdate), platformHandler(nullptr), mctp_fd(mctp_fd),
- mctp_eid(mctp_eid), instanceIdDb(instanceIdDb), event(event),
- handler(handler),
+ oem_platform::Handler(dBusIntf), codeUpdate(codeUpdate),
+ platformHandler(nullptr), mctp_fd(mctp_fd), mctp_eid(mctp_eid),
+ instanceIdDb(instanceIdDb), event(event), handler(handler),
timer(event, std::bind(std::mem_fn(&Handler::setSurvTimer), this,
HYPERVISOR_TID, false)),
hostTransitioningToOff(true)
@@ -64,83 +63,84 @@
propertiesChanged("/xyz/openbmc_project/state/host0",
"xyz.openbmc_project.State.Host"),
[this](sdbusplus::message_t& msg) {
- pldm::utils::DbusChangedProps props{};
- std::string intf;
- msg.read(intf, props);
- const auto itr = props.find("CurrentHostState");
- if (itr != props.end())
- {
- pldm::utils::PropertyValue value = itr->second;
- auto propVal = std::get<std::string>(value);
- if (propVal == "xyz.openbmc_project.State.Host.HostState.Off")
+ pldm::utils::DbusChangedProps props{};
+ std::string intf;
+ msg.read(intf, props);
+ const auto itr = props.find("CurrentHostState");
+ if (itr != props.end())
{
- hostOff = true;
- setEventReceiverCnt = 0;
- disableWatchDogTimer();
- startStopTimer(false);
+ pldm::utils::PropertyValue value = itr->second;
+ auto propVal = std::get<std::string>(value);
+ if (propVal ==
+ "xyz.openbmc_project.State.Host.HostState.Off")
+ {
+ hostOff = true;
+ setEventReceiverCnt = 0;
+ disableWatchDogTimer();
+ startStopTimer(false);
+ }
+ else if (propVal ==
+ "xyz.openbmc_project.State.Host.HostState.Running")
+ {
+ hostOff = false;
+ hostTransitioningToOff = false;
+ }
+ else if (
+ propVal ==
+ "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
+ {
+ hostTransitioningToOff = true;
+ }
}
- else if (propVal ==
- "xyz.openbmc_project.State.Host.HostState.Running")
- {
- hostOff = false;
- hostTransitioningToOff = false;
- }
- else if (
- propVal ==
- "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
- {
- hostTransitioningToOff = true;
- }
- }
- });
+ });
powerStateOffMatch = std::make_unique<sdbusplus::bus::match_t>(
pldm::utils::DBusHandler::getBus(),
propertiesChanged("/xyz/openbmc_project/state/chassis0",
"xyz.openbmc_project.State.Chassis"),
[](sdbusplus::message_t& msg) {
- pldm::utils::DbusChangedProps props{};
- std::string intf;
- msg.read(intf, props);
- const auto itr = props.find("CurrentPowerState");
- if (itr != props.end())
- {
- pldm::utils::PropertyValue value = itr->second;
- auto propVal = std::get<std::string>(value);
- if (propVal ==
- "xyz.openbmc_project.State.Chassis.PowerState.Off")
+ pldm::utils::DbusChangedProps props{};
+ std::string intf;
+ msg.read(intf, props);
+ const auto itr = props.find("CurrentPowerState");
+ if (itr != props.end())
{
- static constexpr auto searchpath =
- "/xyz/openbmc_project/inventory/system/chassis/motherboard";
- int depth = 0;
- std::vector<std::string> powerInterface = {
- "xyz.openbmc_project.State.Decorator.PowerState"};
- pldm::utils::GetSubTreeResponse response =
- pldm::utils::DBusHandler().getSubtree(searchpath, depth,
- powerInterface);
- for (const auto& [objPath, serviceMap] : response)
+ pldm::utils::PropertyValue value = itr->second;
+ auto propVal = std::get<std::string>(value);
+ if (propVal ==
+ "xyz.openbmc_project.State.Chassis.PowerState.Off")
{
- pldm::utils::DBusMapping dbusMapping{
- objPath,
- "xyz.openbmc_project.State.Decorator.PowerState",
- "PowerState", "string"};
- value =
- "xyz.openbmc_project.State.Decorator.PowerState.State.Off";
- try
+ static constexpr auto searchpath =
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard";
+ int depth = 0;
+ std::vector<std::string> powerInterface = {
+ "xyz.openbmc_project.State.Decorator.PowerState"};
+ pldm::utils::GetSubTreeResponse response =
+ pldm::utils::DBusHandler().getSubtree(
+ searchpath, depth, powerInterface);
+ for (const auto& [objPath, serviceMap] : response)
{
- pldm::utils::DBusHandler().setDbusProperty(
- dbusMapping, value);
- }
- catch (const std::exception& e)
- {
- error(
- "Unable to set the slot power state to Off error - {ERROR}",
- "ERROR", e);
+ pldm::utils::DBusMapping dbusMapping{
+ objPath,
+ "xyz.openbmc_project.State.Decorator.PowerState",
+ "PowerState", "string"};
+ value =
+ "xyz.openbmc_project.State.Decorator.PowerState.State.Off";
+ try
+ {
+ pldm::utils::DBusHandler().setDbusProperty(
+ dbusMapping, value);
+ }
+ catch (const std::exception& e)
+ {
+ error(
+ "Unable to set the slot power state to Off error - {ERROR}",
+ "ERROR", e);
+ }
}
}
}
- }
- });
+ });
}
int getOemStateSensorReadingsHandler(
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
index da9e4d3..47c1e53 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
@@ -83,8 +83,9 @@
return rc;
}
- auto platformEventMessageResponseHandler =
- [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+ auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+ const pldm_msg* response,
+ size_t respMsgLen) {
if (response == nullptr || !respMsgLen)
{
error("Failed to receive response for platform event message");
diff --git a/oem/ibm/libpldmresponder/utils.cpp b/oem/ibm/libpldmresponder/utils.cpp
index 59d418c..9fec1a1 100644
--- a/oem/ibm/libpldmresponder/utils.cpp
+++ b/oem/ibm/libpldmresponder/utils.cpp
@@ -30,8 +30,8 @@
struct sockaddr_un addr;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- size_t interfaceLength = strnlen(socketInterface.c_str(),
- sizeof(addr.sun_path));
+ size_t interfaceLength =
+ strnlen(socketInterface.c_str(), sizeof(addr.sun_path));
if (interfaceLength == sizeof(addr.sun_path))
{
error("Setup unix socket path '{PATH}' is too long '{LENGTH}'", "PATH",
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index 30c344d..47ddf2c 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -26,9 +26,8 @@
int /* mctp_fd */, uint8_t mctp_eid, pldm::InstanceIdDb* instanceIdDb,
sdbusplus::message::object_path resDumpCurrentObjPath,
pldm::requester::Handler<pldm::requester::Request>* handler) :
- mctp_eid(mctp_eid),
- instanceIdDb(instanceIdDb), resDumpCurrentObjPath(resDumpCurrentObjPath),
- handler(handler)
+ mctp_eid(mctp_eid), instanceIdDb(instanceIdDb),
+ resDumpCurrentObjPath(resDumpCurrentObjPath), handler(handler)
{}
void DbusToFileHandler::sendNewFileAvailableCmd(uint64_t fileSize)
@@ -42,15 +41,15 @@
return;
}
auto instanceId = instanceIdDb->next(mctp_eid);
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
- PLDM_NEW_FILE_REQ_BYTES);
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + PLDM_NEW_FILE_REQ_BYTES);
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Need to revisit this logic at the time of multiple resource dump support
uint32_t fileHandle = 1;
- auto rc = encode_new_file_req(instanceId,
- PLDM_FILE_TYPE_RESOURCE_DUMP_PARMS,
- fileHandle, fileSize, request);
+ auto rc =
+ encode_new_file_req(instanceId, PLDM_FILE_TYPE_RESOURCE_DUMP_PARMS,
+ fileHandle, fileSize, request);
if (rc != PLDM_SUCCESS)
{
instanceIdDb->free(mctp_eid, instanceId);
@@ -243,9 +242,8 @@
PLDM_FILE_TYPE_CERT_SIGNING_REQUEST);
}
-void DbusToFileHandler::newFileAvailableSendToHost(const uint32_t fileSize,
- const uint32_t fileHandle,
- const uint16_t type)
+void DbusToFileHandler::newFileAvailableSendToHost(
+ const uint32_t fileSize, const uint32_t fileHandle, const uint16_t type)
{
if (instanceIdDb == NULL)
{
@@ -255,12 +253,12 @@
return;
}
auto instanceId = instanceIdDb->next(mctp_eid);
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
- PLDM_NEW_FILE_REQ_BYTES);
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + PLDM_NEW_FILE_REQ_BYTES);
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
- auto rc = encode_new_file_req(instanceId, type, fileHandle, fileSize,
- request);
+ auto rc =
+ encode_new_file_req(instanceId, type, fileHandle, fileSize, request);
if (rc != PLDM_SUCCESS)
{
instanceIdDb->free(mctp_eid, instanceId);
@@ -268,8 +266,9 @@
"RC", rc);
return;
}
- auto newFileAvailableRespHandler =
- [](mctp_eid_t /*eid*/, const pldm_msg* response, size_t respMsgLen) {
+ auto newFileAvailableRespHandler = [](mctp_eid_t /*eid*/,
+ const pldm_msg* response,
+ size_t respMsgLen) {
if (response == nullptr || !respMsgLen)
{
error(
diff --git a/oem/ibm/test/libpldmresponder_fileio_test.cpp b/oem/ibm/test/libpldmresponder_fileio_test.cpp
index 2ca1016..36c6e74 100644
--- a/oem/ibm/test/libpldmresponder_fileio_test.cpp
+++ b/oem/ibm/test/libpldmresponder_fileio_test.cpp
@@ -620,8 +620,8 @@
requestMsg{};
auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
- auto request = reinterpret_cast<pldm_read_file_req*>(requestMsg.data() +
- sizeof(pldm_msg_hdr));
+ auto request = reinterpret_cast<pldm_read_file_req*>(
+ requestMsg.data() + sizeof(pldm_msg_hdr));
request->file_handle = fileHandle;
request->offset = offset;
@@ -668,8 +668,8 @@
requestMsg{};
auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
- auto request = reinterpret_cast<pldm_read_file_req*>(requestMsg.data() +
- sizeof(pldm_msg_hdr));
+ auto request = reinterpret_cast<pldm_read_file_req*>(
+ requestMsg.data() + sizeof(pldm_msg_hdr));
request->file_handle = fileHandle;
request->offset = offset;
@@ -706,8 +706,8 @@
stream.read(buffer.data(), (fileSize - request->offset));
responseMsg = handler.readFile(requestMsgPtr, payload_length);
- response = reinterpret_cast<pldm_read_file_resp*>(responseMsg.data() +
- sizeof(pldm_msg_hdr));
+ response = reinterpret_cast<pldm_read_file_resp*>(
+ responseMsg.data() + sizeof(pldm_msg_hdr));
ASSERT_EQ(response->completion_code, PLDM_SUCCESS);
ASSERT_EQ(response->length, (fileSize - request->offset));
ASSERT_EQ(0, memcmp(response->file_data, buffer.data(),
@@ -724,12 +724,12 @@
uint8_t host_eid = 0;
int hostSocketFd = 0;
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
- PLDM_WRITE_FILE_REQ_BYTES + length);
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES + length);
auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
- auto request = reinterpret_cast<pldm_write_file_req*>(requestMsg.data() +
- sizeof(pldm_msg_hdr));
+ auto request = reinterpret_cast<pldm_write_file_req*>(
+ requestMsg.data() + sizeof(pldm_msg_hdr));
using namespace pldm::filetable;
// Initialise the file table with 2 valid file handles 0 & 1.
@@ -773,12 +773,12 @@
uint8_t host_eid = 0;
int hostSocketFd = 0;
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
- PLDM_WRITE_FILE_REQ_BYTES + length);
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + PLDM_WRITE_FILE_REQ_BYTES + length);
auto requestMsgPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto payload_length = requestMsg.size() - sizeof(pldm_msg_hdr);
- auto request = reinterpret_cast<pldm_write_file_req*>(requestMsg.data() +
- sizeof(pldm_msg_hdr));
+ auto request = reinterpret_cast<pldm_write_file_req*>(
+ requestMsg.data() + sizeof(pldm_msg_hdr));
using namespace pldm::filetable;
// Initialise the file table with 2 valid file handles 0 & 1.
diff --git a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
index 21b6914..a8199f5 100644
--- a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
+++ b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
@@ -159,12 +159,12 @@
opStateSensorEventData->present_op_state = uint8_t(CodeUpdateState::START);
opStateSensorEventData->previous_op_state = uint8_t(CodeUpdateState::END);
- std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
- PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
- sensorEventDataVec.size());
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES +
+ sensorEventDataVec.size());
- auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
- 0x1);
+ auto rc =
+ encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg, 0x1);
EXPECT_EQ(rc, PLDM_SUCCESS);
}
@@ -174,8 +174,8 @@
std::vector<uint8_t> requestMsg;
std::vector<uint8_t> sensorEventDataVec{};
- auto rc = encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg,
- 0x1);
+ auto rc =
+ encodeEventMsg(PLDM_SENSOR_EVENT, sensorEventDataVec, requestMsg, 0x1);
EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
}
@@ -210,9 +210,9 @@
std::unique_ptr<CodeUpdate> mockCodeUpdate =
std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
- std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
- mockCodeUpdate.get(), 0x1, 0x9,
- instanceIdDb, event);
+ std::make_unique<MockOemPlatformHandler>(
+ mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+ event);
Repo inRepo(inPDRRepo);
mockoemPlatformHandler->buildOEMPDR(inRepo);
@@ -316,9 +316,9 @@
std::unique_ptr<CodeUpdate> mockCodeUpdate =
std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
- std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
- mockCodeUpdate.get(), 0x1, 0x9,
- instanceIdDb, event);
+ std::make_unique<MockOemPlatformHandler>(
+ mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+ event);
Repo inRepo(inPDRRepo);
mockoemPlatformHandler->buildOEMPDR(inRepo);
ASSERT_EQ(inRepo.empty(), false);
@@ -415,9 +415,9 @@
std::unique_ptr<CodeUpdate> mockCodeUpdate =
std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
- std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
- mockCodeUpdate.get(), 0x1, 0x9,
- instanceIdDb, event);
+ std::make_unique<MockOemPlatformHandler>(
+ mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, instanceIdDb,
+ event);
std::string dbuspath = "/inventory/system1/chassis1/motherboard1/dcm0";
mockoemPlatformHandler->updateOemDbusPaths(dbuspath);
EXPECT_EQ(dbuspath, "/inventory/system/chassis/motherboard/dcm0");
@@ -504,8 +504,8 @@
std::vector<std::string> cpuInterface = {"xyz.openbmc_project.Foo.Bar"};
auto oemMockedUtils =
std::make_unique<MockOemUtilsHandler>(&mockedDbusUtils);
- int coreCount = oemMockedUtils->setCoreCount(entityAssociations,
- entityMaps);
+ int coreCount =
+ oemMockedUtils->setCoreCount(entityAssociations, entityMaps);
EXPECT_EQ(coreCount, 2);
pldm_entity_association_tree_destroy(tree);
}