Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Deepak Kodihalli | 4c164b0 | 2020-03-07 03:23:31 -0600 | [diff] [blame] | 3 | #include "config.h" |
| 4 | |
George Liu | 6492f52 | 2020-06-16 10:34:05 +0800 | [diff] [blame] | 5 | #include "libpldm/base.h" |
| 6 | #include "oem/ibm/libpldm/file_io.h" |
| 7 | #include "oem/ibm/libpldm/host.h" |
| 8 | |
Deepak Kodihalli | d130e1a | 2020-06-17 05:55:32 -0500 | [diff] [blame] | 9 | #include "common/utils.hpp" |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 10 | #include "oem/ibm/requester/dbus_to_file_handler.hpp" |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 11 | #include "oem_ibm_handler.hpp" |
Deepak Kodihalli | 1521f6d | 2020-06-16 08:51:02 -0500 | [diff] [blame] | 12 | #include "pldmd/handler.hpp" |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 13 | #include "requester/handler.hpp" |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 14 | |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 15 | #include <fcntl.h> |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 16 | #include <stdint.h> |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 17 | #include <sys/stat.h> |
| 18 | #include <sys/types.h> |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 19 | #include <unistd.h> |
| 20 | |
| 21 | #include <filesystem> |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 22 | #include <iostream> |
Priyanga | 8b97665 | 2019-06-27 11:30:33 -0500 | [diff] [blame] | 23 | #include <vector> |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 24 | |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 25 | namespace pldm |
| 26 | { |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 27 | namespace responder |
| 28 | { |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 29 | namespace dma |
| 30 | { |
| 31 | |
| 32 | // The minimum data size of dma transfer in bytes |
| 33 | constexpr uint32_t minSize = 16; |
| 34 | |
Deepak Kodihalli | 4c164b0 | 2020-03-07 03:23:31 -0600 | [diff] [blame] | 35 | constexpr size_t maxSize = DMA_MAXSIZE; |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 36 | |
| 37 | namespace fs = std::filesystem; |
| 38 | |
| 39 | /** |
| 40 | * @class DMA |
| 41 | * |
| 42 | * Expose API to initiate transfer of data by DMA |
| 43 | * |
| 44 | * This class only exposes the public API transferDataHost to transfer data |
| 45 | * between BMC and host using DMA. This allows for mocking the transferDataHost |
| 46 | * for unit testing purposes. |
| 47 | */ |
| 48 | class DMA |
| 49 | { |
| 50 | public: |
| 51 | /** @brief API to transfer data between BMC and host using DMA |
| 52 | * |
| 53 | * @param[in] path - pathname of the file to transfer data from or to |
| 54 | * @param[in] offset - offset in the file |
| 55 | * @param[in] length - length of the data to transfer |
| 56 | * @param[in] address - DMA address on the host |
| 57 | * @param[in] upstream - indicates direction of the transfer; true indicates |
| 58 | * transfer to the host |
| 59 | * |
| 60 | * @return returns 0 on success, negative errno on failure |
| 61 | */ |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 62 | int transferDataHost(int fd, uint32_t offset, uint32_t length, |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 63 | uint64_t address, bool upstream); |
Ravi Teja | ce1c96f | 2020-10-05 23:13:01 -0500 | [diff] [blame] | 64 | |
| 65 | /** @brief API to transfer data on to unix socket from host using DMA |
| 66 | * |
| 67 | * @param[in] path - pathname of the file to transfer data from or to |
| 68 | * @param[in] length - length of the data to transfer |
| 69 | * @param[in] address - DMA address on the host |
| 70 | * |
| 71 | * @return returns 0 on success, negative errno on failure |
| 72 | */ |
| 73 | int transferHostDataToSocket(int fd, uint32_t length, uint64_t address); |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | /** @brief Transfer the data between BMC and host using DMA. |
| 77 | * |
| 78 | * There is a max size for each DMA operation, transferAll API abstracts this |
| 79 | * and the requested length is broken down into multiple DMA operations if the |
| 80 | * length exceed max size. |
| 81 | * |
| 82 | * @tparam[in] T - DMA interface type |
| 83 | * @param[in] intf - interface passed to invoke DMA transfer |
| 84 | * @param[in] command - PLDM command |
| 85 | * @param[in] path - pathname of the file to transfer data from or to |
| 86 | * @param[in] offset - offset in the file |
| 87 | * @param[in] length - length of the data to transfer |
| 88 | * @param[in] address - DMA address on the host |
| 89 | * @param[in] upstream - indicates direction of the transfer; true indicates |
| 90 | * transfer to the host |
Jinu Joy Thomas | 33705fd | 2019-07-02 16:03:05 +0530 | [diff] [blame] | 91 | * @param[in] instanceId - Message's instance id |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 92 | * @return PLDM response message |
| 93 | */ |
| 94 | |
| 95 | template <class DMAInterface> |
| 96 | Response transferAll(DMAInterface* intf, uint8_t command, fs::path& path, |
| 97 | uint32_t offset, uint32_t length, uint64_t address, |
Jinu Joy Thomas | 33705fd | 2019-07-02 16:03:05 +0530 | [diff] [blame] | 98 | bool upstream, uint8_t instanceId) |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 99 | { |
| 100 | uint32_t origLength = length; |
| 101 | Response response(sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_RESP_BYTES, 0); |
| 102 | auto responsePtr = reinterpret_cast<pldm_msg*>(response.data()); |
| 103 | |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 104 | int flags{}; |
| 105 | if (upstream) |
| 106 | { |
| 107 | flags = O_RDONLY; |
| 108 | } |
| 109 | else if (fs::exists(path)) |
| 110 | { |
| 111 | flags = O_RDWR; |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | flags = O_WRONLY; |
| 116 | } |
| 117 | int file = open(path.string().c_str(), flags); |
| 118 | if (file == -1) |
| 119 | { |
| 120 | std::cerr << "File does not exist, path = " << path.string() << "\n"; |
| 121 | encode_rw_file_memory_resp(instanceId, command, PLDM_ERROR, 0, |
| 122 | responsePtr); |
| 123 | return response; |
| 124 | } |
George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 125 | pldm::utils::CustomFD fd(file); |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 126 | |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 127 | while (length > dma::maxSize) |
| 128 | { |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 129 | auto rc = intf->transferDataHost(fd(), offset, dma::maxSize, address, |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 130 | upstream); |
| 131 | if (rc < 0) |
| 132 | { |
Jinu Joy Thomas | 33705fd | 2019-07-02 16:03:05 +0530 | [diff] [blame] | 133 | encode_rw_file_memory_resp(instanceId, command, PLDM_ERROR, 0, |
| 134 | responsePtr); |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 135 | return response; |
| 136 | } |
| 137 | |
| 138 | offset += dma::maxSize; |
| 139 | length -= dma::maxSize; |
| 140 | address += dma::maxSize; |
| 141 | } |
| 142 | |
Deepak Kodihalli | 15211b4 | 2019-12-14 02:24:49 -0600 | [diff] [blame] | 143 | auto rc = intf->transferDataHost(fd(), offset, length, address, upstream); |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 144 | if (rc < 0) |
| 145 | { |
Jinu Joy Thomas | 33705fd | 2019-07-02 16:03:05 +0530 | [diff] [blame] | 146 | encode_rw_file_memory_resp(instanceId, command, PLDM_ERROR, 0, |
| 147 | responsePtr); |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 148 | return response; |
| 149 | } |
| 150 | |
Jinu Joy Thomas | 33705fd | 2019-07-02 16:03:05 +0530 | [diff] [blame] | 151 | encode_rw_file_memory_resp(instanceId, command, PLDM_SUCCESS, origLength, |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 152 | responsePtr); |
| 153 | return response; |
| 154 | } |
| 155 | |
| 156 | } // namespace dma |
| 157 | |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 158 | namespace oem_ibm |
| 159 | { |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 160 | static constexpr auto dumpObjPath = "/xyz/openbmc_project/dump/resource/entry/"; |
| 161 | static constexpr auto resDumpEntry = "com.ibm.Dump.Entry.Resource"; |
Varsha Kaverappa | 219ace9 | 2021-04-01 02:50:11 -0500 | [diff] [blame] | 162 | |
| 163 | static constexpr auto certObjPath = "/xyz/openbmc_project/certs/ca/"; |
| 164 | static constexpr auto certAuthority = |
| 165 | "xyz.openbmc_project.PLDM.Provider.Certs.Authority.CSR"; |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 166 | class Handler : public CmdHandler |
| 167 | { |
| 168 | public: |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 169 | Handler(oem_platform::Handler* oemPlatformHandler, int hostSockFd, |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 170 | uint8_t hostEid, dbus_api::Requester* dbusImplReqester, |
| 171 | pldm::requester::Handler<pldm::requester::Request>* handler) : |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 172 | oemPlatformHandler(oemPlatformHandler), |
| 173 | hostSockFd(hostSockFd), hostEid(hostEid), |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 174 | dbusImplReqester(dbusImplReqester), handler(handler) |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 175 | { |
| 176 | handlers.emplace(PLDM_READ_FILE_INTO_MEMORY, |
| 177 | [this](const pldm_msg* request, size_t payloadLength) { |
| 178 | return this->readFileIntoMemory(request, |
| 179 | payloadLength); |
| 180 | }); |
| 181 | handlers.emplace(PLDM_WRITE_FILE_FROM_MEMORY, |
| 182 | [this](const pldm_msg* request, size_t payloadLength) { |
| 183 | return this->writeFileFromMemory(request, |
| 184 | payloadLength); |
| 185 | }); |
| 186 | handlers.emplace(PLDM_WRITE_FILE_BY_TYPE_FROM_MEMORY, |
| 187 | [this](const pldm_msg* request, size_t payloadLength) { |
| 188 | return this->writeFileByTypeFromMemory( |
| 189 | request, payloadLength); |
| 190 | }); |
| 191 | handlers.emplace(PLDM_READ_FILE_BY_TYPE_INTO_MEMORY, |
| 192 | [this](const pldm_msg* request, size_t payloadLength) { |
| 193 | return this->readFileByTypeIntoMemory( |
| 194 | request, payloadLength); |
| 195 | }); |
| 196 | handlers.emplace(PLDM_READ_FILE_BY_TYPE, [this](const pldm_msg* request, |
| 197 | size_t payloadLength) { |
| 198 | return this->readFileByType(request, payloadLength); |
| 199 | }); |
Sampa Misra | 1896716 | 2020-01-14 02:31:41 -0600 | [diff] [blame] | 200 | handlers.emplace(PLDM_WRITE_FILE_BY_TYPE, |
| 201 | [this](const pldm_msg* request, size_t payloadLength) { |
| 202 | return this->writeFileByType(request, |
| 203 | payloadLength); |
| 204 | }); |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 205 | handlers.emplace(PLDM_GET_FILE_TABLE, |
| 206 | [this](const pldm_msg* request, size_t payloadLength) { |
| 207 | return this->getFileTable(request, payloadLength); |
| 208 | }); |
| 209 | handlers.emplace(PLDM_READ_FILE, |
| 210 | [this](const pldm_msg* request, size_t payloadLength) { |
| 211 | return this->readFile(request, payloadLength); |
| 212 | }); |
| 213 | handlers.emplace(PLDM_WRITE_FILE, |
| 214 | [this](const pldm_msg* request, size_t payloadLength) { |
| 215 | return this->writeFile(request, payloadLength); |
| 216 | }); |
Deepak Kodihalli | 2da1bfe | 2019-12-14 08:28:09 -0600 | [diff] [blame] | 217 | handlers.emplace(PLDM_FILE_ACK, |
| 218 | [this](const pldm_msg* request, size_t payloadLength) { |
| 219 | return this->fileAck(request, payloadLength); |
| 220 | }); |
George Liu | 89aad71 | 2020-03-12 13:34:51 +0800 | [diff] [blame] | 221 | handlers.emplace(PLDM_HOST_GET_ALERT_STATUS, |
| 222 | [this](const pldm_msg* request, size_t payloadLength) { |
| 223 | return this->getAlertStatus(request, |
| 224 | payloadLength); |
| 225 | }); |
Sampa Misra | 1896716 | 2020-01-14 02:31:41 -0600 | [diff] [blame] | 226 | handlers.emplace(PLDM_NEW_FILE_AVAILABLE, |
| 227 | [this](const pldm_msg* request, size_t payloadLength) { |
| 228 | return this->newFileAvailable(request, |
| 229 | payloadLength); |
| 230 | }); |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 231 | |
Patrick Williams | 84b790c | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 232 | resDumpMatcher = std::make_unique<sdbusplus::bus::match_t>( |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 233 | pldm::utils::DBusHandler::getBus(), |
| 234 | sdbusplus::bus::match::rules::interfacesAdded() + |
| 235 | sdbusplus::bus::match::rules::argNpath(0, dumpObjPath), |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 236 | [this, hostSockFd, hostEid, dbusImplReqester, |
Patrick Williams | 84b790c | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 237 | handler](sdbusplus::message_t& msg) { |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 238 | std::map< |
| 239 | std::string, |
| 240 | std::map<std::string, std::variant<std::string, uint32_t>>> |
| 241 | interfaces; |
| 242 | sdbusplus::message::object_path path; |
| 243 | msg.read(path, interfaces); |
| 244 | std::string vspstring; |
| 245 | std::string password; |
| 246 | |
| 247 | for (auto& interface : interfaces) |
| 248 | { |
| 249 | if (interface.first == resDumpEntry) |
| 250 | { |
| 251 | for (const auto& property : interface.second) |
| 252 | { |
| 253 | if (property.first == "VSPString") |
| 254 | { |
| 255 | vspstring = |
| 256 | std::get<std::string>(property.second); |
| 257 | } |
| 258 | else if (property.first == "Password") |
| 259 | { |
| 260 | password = |
| 261 | std::get<std::string>(property.second); |
| 262 | } |
| 263 | } |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 264 | dbusToFileHandlers |
| 265 | .emplace_back( |
| 266 | std::make_unique<pldm::requester::oem_ibm:: |
| 267 | DbusToFileHandler>( |
| 268 | hostSockFd, hostEid, dbusImplReqester, path, |
| 269 | handler)) |
| 270 | ->processNewResourceDump(vspstring, password); |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 271 | break; |
| 272 | } |
| 273 | } |
| 274 | }); |
Patrick Williams | 84b790c | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 275 | vmiCertMatcher = std::make_unique<sdbusplus::bus::match_t>( |
Varsha Kaverappa | 219ace9 | 2021-04-01 02:50:11 -0500 | [diff] [blame] | 276 | pldm::utils::DBusHandler::getBus(), |
| 277 | sdbusplus::bus::match::rules::interfacesAdded() + |
| 278 | sdbusplus::bus::match::rules::argNpath(0, certObjPath), |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 279 | [this, hostSockFd, hostEid, dbusImplReqester, |
Patrick Williams | 84b790c | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 280 | handler](sdbusplus::message_t& msg) { |
Varsha Kaverappa | 219ace9 | 2021-04-01 02:50:11 -0500 | [diff] [blame] | 281 | std::map< |
| 282 | std::string, |
| 283 | std::map<std::string, std::variant<std::string, uint32_t>>> |
| 284 | interfaces; |
| 285 | sdbusplus::message::object_path path; |
| 286 | msg.read(path, interfaces); |
| 287 | std::string csr; |
| 288 | |
| 289 | for (auto& interface : interfaces) |
| 290 | { |
| 291 | if (interface.first == certAuthority) |
| 292 | { |
| 293 | for (const auto& property : interface.second) |
| 294 | { |
| 295 | if (property.first == "CSR") |
| 296 | { |
| 297 | csr = std::get<std::string>(property.second); |
| 298 | auto fileHandle = |
| 299 | sdbusplus::message::object_path(path) |
| 300 | .filename(); |
| 301 | |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 302 | dbusToFileHandlers |
| 303 | .emplace_back(std::make_unique< |
| 304 | pldm::requester::oem_ibm:: |
| 305 | DbusToFileHandler>( |
Varsha Kaverappa | 219ace9 | 2021-04-01 02:50:11 -0500 | [diff] [blame] | 306 | hostSockFd, hostEid, dbusImplReqester, |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 307 | path, handler)) |
| 308 | ->newCsrFileAvailable(csr, fileHandle); |
Varsha Kaverappa | 219ace9 | 2021-04-01 02:50:11 -0500 | [diff] [blame] | 309 | break; |
| 310 | } |
| 311 | } |
| 312 | break; |
| 313 | } |
| 314 | } |
| 315 | }); |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 316 | } |
Tom Joseph | 0c6d22c | 2019-06-26 09:58:41 +0530 | [diff] [blame] | 317 | |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 318 | /** @brief Handler for readFileIntoMemory command |
| 319 | * |
| 320 | * @param[in] request - pointer to PLDM request payload |
| 321 | * @param[in] payloadLength - length of the message |
| 322 | * |
| 323 | * @return PLDM response message |
| 324 | */ |
| 325 | Response readFileIntoMemory(const pldm_msg* request, size_t payloadLength); |
Sampa Misra | 854e61f | 2019-08-22 04:36:47 -0500 | [diff] [blame] | 326 | |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 327 | /** @brief Handler for writeFileIntoMemory command |
| 328 | * |
| 329 | * @param[in] request - pointer to PLDM request payload |
| 330 | * @param[in] payloadLength - length of the message |
| 331 | * |
| 332 | * @return PLDM response message |
| 333 | */ |
| 334 | Response writeFileFromMemory(const pldm_msg* request, size_t payloadLength); |
Sampa Misra | 854e61f | 2019-08-22 04:36:47 -0500 | [diff] [blame] | 335 | |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 336 | /** @brief Handler for writeFileByTypeFromMemory command |
| 337 | * |
| 338 | * @param[in] request - pointer to PLDM request payload |
| 339 | * @param[in] payloadLength - length of the message |
| 340 | * |
| 341 | * @return PLDM response message |
| 342 | */ |
Deepak Kodihalli | f6d3a83 | 2019-11-19 07:00:29 -0600 | [diff] [blame] | 343 | |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 344 | Response writeFileByTypeFromMemory(const pldm_msg* request, |
| 345 | size_t payloadLength); |
Deepak Kodihalli | 75e02f8 | 2019-11-20 02:51:05 -0600 | [diff] [blame] | 346 | |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 347 | /** @brief Handler for readFileByTypeIntoMemory command |
| 348 | * |
| 349 | * @param[in] request - pointer to PLDM request payload |
| 350 | * @param[in] payloadLength - length of the message |
| 351 | * |
| 352 | * @return PLDM response message |
| 353 | */ |
| 354 | Response readFileByTypeIntoMemory(const pldm_msg* request, |
| 355 | size_t payloadLength); |
vkaverap | 5b914c3 | 2019-06-30 22:23:54 -0500 | [diff] [blame] | 356 | |
Sampa Misra | 1896716 | 2020-01-14 02:31:41 -0600 | [diff] [blame] | 357 | /** @brief Handler for writeFileByType command |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 358 | * |
| 359 | * @param[in] request - pointer to PLDM request payload |
| 360 | * @param[in] payloadLength - length of the message |
| 361 | * |
| 362 | * @return PLDM response message |
| 363 | */ |
| 364 | Response readFileByType(const pldm_msg* request, size_t payloadLength); |
vkaverap | 5b914c3 | 2019-06-30 22:23:54 -0500 | [diff] [blame] | 365 | |
Sampa Misra | 1896716 | 2020-01-14 02:31:41 -0600 | [diff] [blame] | 366 | Response writeFileByType(const pldm_msg* request, size_t payloadLength); |
| 367 | |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 368 | /** @brief Handler for GetFileTable command |
| 369 | * |
| 370 | * @param[in] request - pointer to PLDM request payload |
| 371 | * @param[in] payloadLength - length of the message payload |
| 372 | * |
| 373 | * @return PLDM response message |
| 374 | */ |
| 375 | Response getFileTable(const pldm_msg* request, size_t payloadLength); |
| 376 | |
| 377 | /** @brief Handler for readFile command |
| 378 | * |
| 379 | * @param[in] request - PLDM request msg |
| 380 | * @param[in] payloadLength - length of the message payload |
| 381 | * |
| 382 | * @return PLDM response message |
| 383 | */ |
| 384 | Response readFile(const pldm_msg* request, size_t payloadLength); |
| 385 | |
| 386 | /** @brief Handler for writeFile command |
| 387 | * |
| 388 | * @param[in] request - PLDM request msg |
| 389 | * @param[in] payloadLength - length of the message payload |
| 390 | * |
| 391 | * @return PLDM response message |
| 392 | */ |
| 393 | Response writeFile(const pldm_msg* request, size_t payloadLength); |
Deepak Kodihalli | 2da1bfe | 2019-12-14 08:28:09 -0600 | [diff] [blame] | 394 | |
| 395 | Response fileAck(const pldm_msg* request, size_t payloadLength); |
George Liu | 89aad71 | 2020-03-12 13:34:51 +0800 | [diff] [blame] | 396 | |
| 397 | /** @brief Handler for getAlertStatus command |
| 398 | * |
| 399 | * @param[in] request - PLDM request msg |
| 400 | * @param[in] payloadLength - length of the message payload |
| 401 | * |
| 402 | * @return PLDM response message |
| 403 | */ |
| 404 | Response getAlertStatus(const pldm_msg* request, size_t payloadLength); |
Sampa Misra | 1896716 | 2020-01-14 02:31:41 -0600 | [diff] [blame] | 405 | |
| 406 | /** @brief Handler for newFileAvailable command |
| 407 | * |
| 408 | * @param[in] request - PLDM request msg |
| 409 | * @param[in] payloadLength - length of the message payload |
| 410 | * |
| 411 | * @return PLDM response message |
| 412 | */ |
| 413 | Response newFileAvailable(const pldm_msg* request, size_t payloadLength); |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 414 | |
| 415 | private: |
| 416 | oem_platform::Handler* oemPlatformHandler; |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 417 | int hostSockFd; |
| 418 | uint8_t hostEid; |
| 419 | dbus_api::Requester* dbusImplReqester; |
| 420 | using DBusInterfaceAdded = std::vector<std::pair< |
| 421 | std::string, |
| 422 | std::vector<std::pair<std::string, std::variant<std::string>>>>>; |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 423 | std::unique_ptr<pldm::requester::oem_ibm::DbusToFileHandler> |
| 424 | dbusToFileHandler; //!< pointer to send request to Host |
Patrick Williams | 84b790c | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 425 | std::unique_ptr<sdbusplus::bus::match_t> |
Jayashankar Padath | db12436 | 2021-01-28 21:12:34 -0600 | [diff] [blame] | 426 | resDumpMatcher; //!< Pointer to capture the interface added signal |
| 427 | //!< for new resource dump |
Patrick Williams | 84b790c | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 428 | std::unique_ptr<sdbusplus::bus::match_t> |
Varsha Kaverappa | 219ace9 | 2021-04-01 02:50:11 -0500 | [diff] [blame] | 429 | vmiCertMatcher; //!< Pointer to capture the interface added signal |
| 430 | //!< for new csr string |
Sampa Misra | c0c7948 | 2021-06-02 08:01:54 -0500 | [diff] [blame] | 431 | /** @brief PLDM request handler */ |
| 432 | pldm::requester::Handler<pldm::requester::Request>* handler; |
| 433 | std::vector<std::unique_ptr<pldm::requester::oem_ibm::DbusToFileHandler>> |
| 434 | dbusToFileHandlers; |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 435 | }; |
| 436 | |
| 437 | } // namespace oem_ibm |
Jinu Joy Thomas | 7f57f44 | 2019-06-13 20:38:49 +0530 | [diff] [blame] | 438 | } // namespace responder |
| 439 | } // namespace pldm |