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: I61b093f75011417cc9c7acf9605200f4fa429bac
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/oem/ibm/libpldmresponder/file_io.cpp b/oem/ibm/libpldmresponder/file_io.cpp
index 96a1c71..7abd620 100644
--- a/oem/ibm/libpldmresponder/file_io.cpp
+++ b/oem/ibm/libpldmresponder/file_io.cpp
@@ -80,8 +80,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;
@@ -614,8 +614,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);
diff --git a/oem/ibm/libpldmresponder/file_io.hpp b/oem/ibm/libpldmresponder/file_io.hpp
index ddde7f8..4e2af4f 100644
--- a/oem/ibm/libpldmresponder/file_io.hpp
+++ b/oem/ibm/libpldmresponder/file_io.hpp
@@ -178,59 +178,52 @@
{
handlers.emplace(PLDM_READ_FILE_INTO_MEMORY,
[this](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](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](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](const pldm_msg* request, size_t payloadLength) {
- return this->readFileByTypeIntoMemory(
- request, payloadLength);
- });
- handlers.emplace(PLDM_READ_FILE_BY_TYPE, [this](const pldm_msg* request,
- size_t payloadLength) {
+ return this->readFileByTypeIntoMemory(request, payloadLength);
+ });
+ handlers.emplace(PLDM_READ_FILE_BY_TYPE,
+ [this](const pldm_msg* request, size_t payloadLength) {
return this->readFileByType(request, payloadLength);
});
handlers.emplace(PLDM_WRITE_FILE_BY_TYPE,
[this](const pldm_msg* request, size_t payloadLength) {
- return this->writeFileByType(request,
- payloadLength);
- });
+ return this->writeFileByType(request, payloadLength);
+ });
handlers.emplace(PLDM_GET_FILE_TABLE,
[this](const pldm_msg* request, size_t payloadLength) {
- return this->getFileTable(request, payloadLength);
- });
+ return this->getFileTable(request, payloadLength);
+ });
handlers.emplace(PLDM_READ_FILE,
[this](const pldm_msg* request, size_t payloadLength) {
- return this->readFile(request, payloadLength);
- });
+ return this->readFile(request, payloadLength);
+ });
handlers.emplace(PLDM_WRITE_FILE,
[this](const pldm_msg* request, size_t payloadLength) {
- return this->writeFile(request, payloadLength);
- });
+ return this->writeFile(request, payloadLength);
+ });
handlers.emplace(PLDM_FILE_ACK,
[this](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](const pldm_msg* request, size_t payloadLength) {
- return this->getAlertStatus(request,
- payloadLength);
- });
+ return this->getAlertStatus(request, payloadLength);
+ });
handlers.emplace(PLDM_NEW_FILE_AVAILABLE,
[this](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,42 +231,39 @@
sdbusplus::bus::match::rules::argNpath(0, dumpObjPath),
[this, hostSockFd, hostEid, dbusImplReqester,
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 (auto& interface : interfaces)
+ for (auto& interface : interfaces)
+ {
+ if (interface.first == resDumpEntry)
{
- if (interface.first == resDumpEntry)
+ for (const auto& property : interface.second)
{
- for (const auto& property : interface.second)
+ if (property.first == "VSPString")
{
- if (property.first == "VSPString")
- {
- vspstring =
- std::get<std::string>(property.second);
- }
- else if (property.first == "Password")
- {
- password =
- std::get<std::string>(property.second);
- }
+ vspstring = std::get<std::string>(property.second);
}
- dbusToFileHandlers
- .emplace_back(
- std::make_unique<pldm::requester::oem_ibm::
- DbusToFileHandler>(
- hostSockFd, hostEid, dbusImplReqester, path,
- handler))
- ->processNewResourceDump(vspstring, password);
- break;
+ 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, dbusImplReqester, path,
+ handler))
+ ->processNewResourceDump(vspstring, password);
+ break;
}
+ }
});
vmiCertMatcher = std::make_unique<sdbusplus::bus::match_t>(
pldm::utils::DBusHandler::getBus(),
@@ -281,40 +271,39 @@
sdbusplus::bus::match::rules::argNpath(0, certObjPath),
[this, hostSockFd, hostEid, dbusImplReqester,
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 (auto& interface : interfaces)
+ for (auto& interface : interfaces)
+ {
+ if (interface.first == certAuthority)
{
- if (interface.first == certAuthority)
+ for (const auto& property : interface.second)
{
- for (const auto& property : interface.second)
+ if (property.first == "CSR")
{
- if (property.first == "CSR")
- {
- csr = std::get<std::string>(property.second);
- auto fileHandle =
- sdbusplus::message::object_path(path)
- .filename();
+ 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, dbusImplReqester,
path, handler))
- ->newCsrFileAvailable(csr, fileHandle);
- break;
- }
+ ->newCsrFileAvailable(csr, fileHandle);
+ break;
}
- break;
}
+ break;
}
+ }
});
}
@@ -426,11 +415,11 @@
std::unique_ptr<pldm::requester::oem_ibm::DbusToFileHandler>
dbusToFileHandler; //!< pointer to send request to Host
std::unique_ptr<sdbusplus::bus::match_t>
- resDumpMatcher; //!< Pointer to capture the interface added signal
- //!< for new resource dump
+ resDumpMatcher; //!< Pointer to capture the interface added signal
+ //!< for new resource dump
std::unique_ptr<sdbusplus::bus::match_t>
- vmiCertMatcher; //!< Pointer to capture the interface added signal
- //!< for new csr string
+ vmiCertMatcher; //!< Pointer to capture the interface added signal
+ //!< for new csr string
/** @brief PLDM request handler */
pldm::requester::Handler<pldm::requester::Request>* handler;
std::vector<std::unique_ptr<pldm::requester::oem_ibm::DbusToFileHandler>>
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.cpp b/oem/ibm/libpldmresponder/file_io_by_type.cpp
index ec001fa..0f93efb 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.cpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.cpp
@@ -48,8 +48,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;
}
@@ -59,8 +59,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;
diff --git a/oem/ibm/libpldmresponder/file_io_by_type.hpp b/oem/ibm/libpldmresponder/file_io_by_type.hpp
index 1aed02b..1665221 100644
--- a/oem/ibm/libpldmresponder/file_io_by_type.hpp
+++ b/oem/ibm/libpldmresponder/file_io_by_type.hpp
@@ -114,13 +114,11 @@
/** @brief Constructor to create a FileHandler object
*/
- FileHandler(uint32_t fileHandle) : fileHandle(fileHandle)
- {}
+ FileHandler(uint32_t fileHandle) : fileHandle(fileHandle) {}
/** FileHandler destructor
*/
- virtual ~FileHandler()
- {}
+ virtual ~FileHandler() {}
protected:
uint32_t fileHandle; //!< file handle indicating name of file or invalid
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.cpp b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
index 8d9b73e..af5c585 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
@@ -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)
{
@@ -297,8 +297,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)
{
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.hpp b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
index 4e4ad6b..f1f4cd7 100644
--- a/oem/ibm/libpldmresponder/file_io_type_cert.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_cert.hpp
@@ -61,8 +61,7 @@
/** @brief CertHandler destructor
*/
- ~CertHandler()
- {}
+ ~CertHandler() {}
private:
uint16_t certType; //!< type of the certificate
diff --git a/oem/ibm/libpldmresponder/file_io_type_dump.cpp b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
index 0a0e041..2c6b02a 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.cpp
@@ -131,8 +131,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_dump.hpp b/oem/ibm/libpldmresponder/file_io_type_dump.hpp
index 2e35428..dbb5ba7 100644
--- a/oem/ibm/libpldmresponder/file_io_type_dump.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_dump.hpp
@@ -45,8 +45,7 @@
/** @brief DumpHandler destructor
*/
- ~DumpHandler()
- {}
+ ~DumpHandler() {}
private:
static int fd; //!< fd to manage the dump offload to bmc
diff --git a/oem/ibm/libpldmresponder/file_io_type_lid.hpp b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
index dbb4fc7..382dbaf 100644
--- a/oem/ibm/libpldmresponder/file_io_type_lid.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_lid.hpp
@@ -40,8 +40,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))
{
@@ -309,8 +309,7 @@
/** @brief LidHandler destructor
*/
- ~LidHandler()
- {}
+ ~LidHandler() {}
protected:
std::string lidPath;
diff --git a/oem/ibm/libpldmresponder/file_io_type_pel.cpp b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
index 2bbb5af..c329bac 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.cpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.cpp
@@ -103,8 +103,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);
@@ -134,8 +134,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);
@@ -224,8 +224,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, "HostAck");
method.append(fileHandle);
@@ -251,8 +251,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_pel.hpp b/oem/ibm/libpldmresponder/file_io_type_pel.hpp
index 043454d..b7a43b1 100644
--- a/oem/ibm/libpldmresponder/file_io_type_pel.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_pel.hpp
@@ -17,8 +17,7 @@
public:
/** @brief PelHandler constructor
*/
- PelHandler(uint32_t fileHandle) : FileHandler(fileHandle)
- {}
+ PelHandler(uint32_t fileHandle) : FileHandler(fileHandle) {}
virtual int writeFromMemory(uint32_t offset, uint32_t length,
uint64_t address,
@@ -51,8 +50,7 @@
/** @brief PelHandler destructor
*/
- ~PelHandler()
- {}
+ ~PelHandler() {}
};
} // namespace responder
diff --git a/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp b/oem/ibm/libpldmresponder/file_io_type_progress_src.cpp
index 93a6680..ed4bcc6 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_progress_src.hpp b/oem/ibm/libpldmresponder/file_io_type_progress_src.hpp
index a223f1a..36f7ccb 100644
--- a/oem/ibm/libpldmresponder/file_io_type_progress_src.hpp
+++ b/oem/ibm/libpldmresponder/file_io_type_progress_src.hpp
@@ -18,8 +18,7 @@
public:
/** @brief ProgressCodeHandler constructor
*/
- ProgressCodeHandler(uint32_t fileHandle) : FileHandler(fileHandle)
- {}
+ ProgressCodeHandler(uint32_t fileHandle) : FileHandler(fileHandle) {}
int writeFromMemory(uint32_t /*offset*/, uint32_t /*length*/,
uint64_t /*address*/,
@@ -65,8 +64,7 @@
/** @brief ProgressCodeHandler destructor
*/
- ~ProgressCodeHandler()
- {}
+ ~ProgressCodeHandler() {}
};
} // namespace responder
diff --git a/oem/ibm/libpldmresponder/inband_code_update.cpp b/oem/ibm/libpldmresponder/inband_code_update.cpp
index c995fc1..c69c1bc 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.cpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.cpp
@@ -169,8 +169,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);
@@ -198,126 +198,116 @@
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)
+ for (auto& interface : interfaces)
+ {
+ if (interface.first == "xyz.openbmc_project.Software.Activation")
{
- if (interface.first ==
- "xyz.openbmc_project.Software.Activation")
- {
- auto imageInterface =
- "xyz.openbmc_project.Software.Activation";
- auto imageObjPath = path.str.c_str();
+ auto imageInterface = "xyz.openbmc_project.Software.Activation";
+ auto imageObjPath = path.str.c_str();
- try
+ try
+ {
+ 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 propVal = dBusIntf->getDbusPropertyVariant(
- imageObjPath, "Activation", imageInterface);
- const auto& imageProp = std::get<std::string>(propVal);
- if (imageProp == "xyz.openbmc_project.Software."
- "Activation.Activations.Ready" &&
- isCodeUpdateInProgress())
+ newImageId = path.str;
+ if (!imageActivationMatch)
{
- newImageId = path.str;
- if (!imageActivationMatch)
- {
- imageActivationMatch = std::make_unique<
- sdbusplus::bus::match_t>(
+ 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)
- {
- CodeUpdateState state = CodeUpdateState::FAIL;
- setCodeUpdateProgress(false);
- auto sensorId = getFirmwareUpdateSensor();
- sendStateSensorEvent(
- sensorId, PLDM_STATE_SENSOR_STATE, 0,
- uint8_t(state),
- uint8_t(CodeUpdateState::START));
- error("could not set RequestedActivation");
- }
- break;
}
- }
- catch (const sdbusplus::exception_t& e)
- {
- error(
- "Error in getting Activation status,ERROR= {ERR_EXCEP}, INTERFACE={IMG_INTERFACE}, OBJECT PATH={OBJ_PATH}",
- "ERR_EXCEP", e.what(), "IMG_INTERFACE",
- imageInterface, "OBJ_PATH", imageObjPath);
+ auto rc = setRequestedActivation();
+ if (rc != PLDM_SUCCESS)
+ {
+ CodeUpdateState state = CodeUpdateState::FAIL;
+ setCodeUpdateProgress(false);
+ auto sensorId = getFirmwareUpdateSensor();
+ sendStateSensorEvent(
+ sensorId, PLDM_STATE_SENSOR_STATE, 0,
+ uint8_t(state),
+ uint8_t(CodeUpdateState::START));
+ error("could not set RequestedActivation");
+ }
+ break;
}
}
+ catch (const sdbusplus::exception_t& e)
+ {
+ error(
+ "Error in getting Activation status,ERROR= {ERR_EXCEP}, INTERFACE={IMG_INTERFACE}, OBJECT PATH={OBJ_PATH}",
+ "ERR_EXCEP", e.what(), "IMG_INTERFACE", imageInterface,
+ "OBJ_PATH", imageObjPath);
+ }
}
+ }
}));
}
@@ -439,7 +429,7 @@
}
template <typename... T>
-int executeCmd(T const&... t)
+int executeCmd(const T&... t)
{
std::stringstream cmd;
((cmd << t << " "), ...) << std::endl;
diff --git a/oem/ibm/libpldmresponder/inband_code_update.hpp b/oem/ibm/libpldmresponder/inband_code_update.hpp
index 9c7f41c..c16ac44 100644
--- a/oem/ibm/libpldmresponder/inband_code_update.hpp
+++ b/oem/ibm/libpldmresponder/inband_code_update.hpp
@@ -174,8 +174,7 @@
*/
int assembleCodeUpdateImage();
- virtual ~CodeUpdate()
- {}
+ virtual ~CodeUpdate() {}
private:
std::string currBootSide; //!< current boot side
@@ -184,7 +183,7 @@
std::string nonRunningVersion; //!< alternate image
std::string newImageId; //!< new image id
bool codeUpdateInProgress =
- false; //!< indicates whether codeupdate is going on
+ false; //!< indicates whether codeupdate is going on
const pldm::utils::DBusHandler* dBusIntf; //!< D-Bus handler
std::vector<std::unique_ptr<sdbusplus::bus::match_t>>
captureNextBootSideChange; //!< vector to catch the D-Bus property
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index d171173..fd1b0c4 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -211,8 +211,8 @@
uint16_t stateSetID, pdr_utils::Repo& repo)
{
size_t pdrSize = 0;
- pdrSize =
- sizeof(pldm_state_sensor_pdr) + sizeof(state_sensor_possible_states);
+ pdrSize = sizeof(pldm_state_sensor_pdr) +
+ sizeof(state_sensor_possible_states);
std::vector<uint8_t> entry{};
entry.resize(pdrSize);
pldm_state_sensor_pdr* pdr =
@@ -312,9 +312,8 @@
}
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,
@@ -445,51 +444,50 @@
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())
+ 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")
{
- PropertyValue value = itr->second;
- auto propVal = std::get<std::string>(value);
- if (propVal ==
- "xyz.openbmc_project.State.Chassis.PowerState.Off")
+ 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
{
- 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(
- "Setting one-time restore policy failed, unable to set property PowerRestorePolicy ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
- }
- 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(
- "BMC state transition to reboot failed, unable to set property RequestedBMCTransition ERROR={ERR_EXCEP}",
- "ERR_EXCEP", e.what());
- }
+ dBusIntf->setDbusProperty(dbusMapping, value);
+ }
+ catch (const std::exception& e)
+ {
+ error(
+ "Setting one-time restore policy failed, unable to set property PowerRestorePolicy ERROR={ERR_EXCEP}",
+ "ERR_EXCEP", e.what());
+ }
+ 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(
+ "BMC state transition to reboot failed, unable to set property RequestedBMCTransition ERROR={ERR_EXCEP}",
+ "ERR_EXCEP", e.what());
}
}
+ }
});
}
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index 7dbd8d8..4de6835 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -47,27 +47,26 @@
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::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::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();
- }
- else if (propVal ==
- "xyz.openbmc_project.State.Host.HostState.Running")
- {
- hostOff = false;
- }
+ hostOff = true;
+ setEventReceiverCnt = 0;
+ disableWatchDogTimer();
}
+ else if (propVal ==
+ "xyz.openbmc_project.State.Host.HostState.Running")
+ {
+ hostOff = false;
+ }
+ }
});
}
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
index 4b7cec5..e7966a2 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
@@ -83,9 +83,8 @@
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/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index ff632b9..e71116a 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -52,9 +52,9 @@
// 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)
{
requester->markFree(mctp_eid, instanceId);
@@ -259,17 +259,16 @@
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)
{
requester->markFree(mctp_eid, instanceId);
error("Failed to encode_new_file_req, rc = {RC}", "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_oem_platform_test.cpp b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
index 592a591..d0881e4 100644
--- a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
+++ b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
@@ -145,8 +145,8 @@
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);
}
@@ -156,8 +156,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);
}