Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 1 | #include <algorithm> |
Lei YU | 52d9124 | 2017-10-17 22:52:28 +0800 | [diff] [blame] | 2 | #include <arpa/inet.h> |
| 3 | #include <chrono> |
| 4 | #include <cstdio> |
Vernon Mauery | 185b9f8 | 2018-07-20 10:52:36 -0700 | [diff] [blame] | 5 | #if __has_include(<filesystem>) |
| 6 | #include <filesystem> |
| 7 | #elif __has_include(<experimental/filesystem>) |
Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 8 | #include <experimental/filesystem> |
Vernon Mauery | 185b9f8 | 2018-07-20 10:52:36 -0700 | [diff] [blame] | 9 | namespace std { |
| 10 | // splice experimental::filesystem into std |
| 11 | namespace filesystem = std::experimental::filesystem; |
| 12 | } |
| 13 | #else |
| 14 | # error filesystem not available |
| 15 | #endif |
Lei YU | 52d9124 | 2017-10-17 22:52:28 +0800 | [diff] [blame] | 16 | #include <mapper.h> |
| 17 | #include <string> |
| 18 | #include <systemd/sd-bus.h> |
| 19 | |
Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 20 | #include <phosphor-logging/log.hpp> |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 21 | #include <phosphor-logging/elog-errors.hpp> |
Lei YU | 52d9124 | 2017-10-17 22:52:28 +0800 | [diff] [blame] | 22 | #include <sdbusplus/server.hpp> |
| 23 | |
Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 24 | #include "fruread.hpp" |
Lei YU | 52d9124 | 2017-10-17 22:52:28 +0800 | [diff] [blame] | 25 | #include "host-ipmid/ipmid-api.h" |
| 26 | #include "read_fru_data.hpp" |
| 27 | #include "selutility.hpp" |
| 28 | #include "storageaddsel.h" |
| 29 | #include "storagehandler.h" |
| 30 | #include "utils.hpp" |
| 31 | #include "xyz/openbmc_project/Common/error.hpp" |
Tom Joseph | 5ca5095 | 2018-02-22 00:33:38 +0530 | [diff] [blame] | 32 | #include "sensorhandler.h" |
Lei YU | 52d9124 | 2017-10-17 22:52:28 +0800 | [diff] [blame] | 33 | |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 34 | |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 35 | void register_netfn_storage_functions() __attribute__((constructor)); |
| 36 | |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 37 | unsigned int g_sel_time = 0xFFFFFFFF; |
Nan Li | 36c0cb6 | 2016-03-31 11:16:08 +0800 | [diff] [blame] | 38 | extern unsigned short g_sel_reserve; |
Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 39 | extern const ipmi::sensor::IdInfoMap sensors; |
| 40 | extern const FruMap frus; |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 41 | |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 42 | namespace { |
| 43 | constexpr auto TIME_INTERFACE = "xyz.openbmc_project.Time.EpochTime"; |
| 44 | constexpr auto HOST_TIME_PATH = "/xyz/openbmc_project/time/host"; |
| 45 | constexpr auto DBUS_PROPERTIES = "org.freedesktop.DBus.Properties"; |
| 46 | constexpr auto PROPERTY_ELAPSED= "Elapsed"; |
| 47 | |
| 48 | const char* getTimeString(const uint64_t& usecSinceEpoch) |
| 49 | { |
| 50 | using namespace std::chrono; |
| 51 | system_clock::time_point tp{microseconds(usecSinceEpoch)}; |
| 52 | auto t = system_clock::to_time_t(tp); |
| 53 | return std::ctime(&t); |
| 54 | } |
| 55 | } |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 56 | |
Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 57 | namespace cache |
| 58 | { |
| 59 | /* |
| 60 | * This cache contains the object paths of the logging entries sorted in the |
| 61 | * order of the filename(numeric order). The cache is initialized by |
| 62 | * invoking readLoggingObjectPaths with the cache as the parameter. The |
| 63 | * cache is invoked in the execution of the Get SEL info and Delete SEL |
| 64 | * entry command. The Get SEL Info command is typically invoked before the |
| 65 | * Get SEL entry command, so the cache is utilized for responding to Get SEL |
| 66 | * entry command. The cache is invalidated by clearing after Delete SEL |
| 67 | * entry and Clear SEL command. |
| 68 | */ |
| 69 | ipmi::sel::ObjectPaths paths; |
| 70 | |
| 71 | } // namespace objectPathsCache |
| 72 | |
| 73 | using InternalFailure = |
| 74 | sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; |
| 75 | using namespace phosphor::logging; |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 76 | using namespace ipmi::fru; |
| 77 | |
| 78 | /** |
| 79 | * @enum Device access mode |
| 80 | */ |
| 81 | enum class AccessMode |
| 82 | { |
| 83 | bytes, ///< Device is accessed by bytes |
| 84 | words ///< Device is accessed by words |
| 85 | }; |
| 86 | |
Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 87 | |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 88 | ipmi_ret_t ipmi_storage_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 89 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 90 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 91 | { |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 92 | // Status code. |
Nan Li | 70aa8d9 | 2016-08-29 00:11:10 +0800 | [diff] [blame] | 93 | ipmi_ret_t rc = IPMI_CC_INVALID; |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 94 | *data_len = 0; |
| 95 | return rc; |
| 96 | } |
| 97 | |
Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 98 | ipmi_ret_t getSELInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 99 | ipmi_request_t request, ipmi_response_t response, |
| 100 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 101 | { |
| 102 | std::vector<uint8_t> outPayload(sizeof(ipmi::sel::GetSELInfoResponse)); |
| 103 | auto responseData = reinterpret_cast<ipmi::sel::GetSELInfoResponse*> |
| 104 | (outPayload.data()); |
| 105 | |
| 106 | responseData->selVersion = ipmi::sel::selVersion; |
| 107 | // Last erase timestamp is not available from log manager. |
| 108 | responseData->eraseTimeStamp = ipmi::sel::invalidTimeStamp; |
| 109 | responseData->operationSupport = ipmi::sel::operationSupport; |
| 110 | |
| 111 | ipmi::sel::readLoggingObjectPaths(cache::paths); |
| 112 | responseData->entries = 0; |
| 113 | responseData->addTimeStamp = ipmi::sel::invalidTimeStamp; |
| 114 | |
| 115 | if (!cache::paths.empty()) |
| 116 | { |
| 117 | responseData->entries = static_cast<uint16_t>(cache::paths.size()); |
| 118 | |
| 119 | try |
| 120 | { |
| 121 | responseData->addTimeStamp = static_cast<uint32_t>( |
| 122 | (ipmi::sel::getEntryTimeStamp(cache::paths.back()) |
| 123 | .count())); |
| 124 | } |
| 125 | catch (InternalFailure& e) |
| 126 | { |
| 127 | } |
| 128 | catch (const std::runtime_error& e) |
| 129 | { |
| 130 | log<level::ERR>(e.what()); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | memcpy(response, outPayload.data(), outPayload.size()); |
| 135 | *data_len = outPayload.size(); |
| 136 | |
| 137 | return IPMI_CC_OK; |
| 138 | } |
| 139 | |
Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 140 | ipmi_ret_t getSELEntry(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 141 | ipmi_request_t request, ipmi_response_t response, |
| 142 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 143 | { |
| 144 | auto requestData = reinterpret_cast<const ipmi::sel::GetSELEntryRequest*> |
| 145 | (request); |
| 146 | |
| 147 | if (requestData->reservationID != 0) |
| 148 | { |
| 149 | if (g_sel_reserve != requestData->reservationID) |
| 150 | { |
| 151 | *data_len = 0; |
| 152 | return IPMI_CC_INVALID_RESERVATION_ID; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | if (cache::paths.empty()) |
| 157 | { |
| 158 | *data_len = 0; |
| 159 | return IPMI_CC_SENSOR_INVALID; |
| 160 | } |
| 161 | |
| 162 | ipmi::sel::ObjectPaths::const_iterator iter; |
| 163 | |
| 164 | // Check for the requested SEL Entry. |
| 165 | if (requestData->selRecordID == ipmi::sel::firstEntry) |
| 166 | { |
| 167 | iter = cache::paths.begin(); |
| 168 | } |
| 169 | else if (requestData->selRecordID == ipmi::sel::lastEntry) |
| 170 | { |
| 171 | iter = cache::paths.end(); |
| 172 | } |
| 173 | else |
| 174 | { |
| 175 | std::string objPath = std::string(ipmi::sel::logBasePath) + "/" + |
| 176 | std::to_string(requestData->selRecordID); |
| 177 | |
| 178 | iter = std::find(cache::paths.begin(), cache::paths.end(), objPath); |
| 179 | if (iter == cache::paths.end()) |
| 180 | { |
| 181 | *data_len = 0; |
| 182 | return IPMI_CC_SENSOR_INVALID; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | ipmi::sel::GetSELEntryResponse record {}; |
| 187 | |
| 188 | // Convert the log entry into SEL record. |
| 189 | try |
| 190 | { |
| 191 | record = ipmi::sel::convertLogEntrytoSEL(*iter); |
| 192 | } |
| 193 | catch (InternalFailure& e) |
| 194 | { |
| 195 | *data_len = 0; |
| 196 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 197 | } |
| 198 | catch (const std::runtime_error& e) |
| 199 | { |
| 200 | log<level::ERR>(e.what()); |
| 201 | *data_len = 0; |
| 202 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 203 | } |
| 204 | |
| 205 | |
| 206 | // Identify the next SEL record ID |
| 207 | if(iter != cache::paths.end()) |
| 208 | { |
| 209 | ++iter; |
| 210 | if (iter == cache::paths.end()) |
| 211 | { |
| 212 | record.nextRecordID = ipmi::sel::lastEntry; |
| 213 | } |
| 214 | else |
| 215 | { |
Vernon Mauery | 185b9f8 | 2018-07-20 10:52:36 -0700 | [diff] [blame] | 216 | namespace fs = std::filesystem; |
Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 217 | fs::path path(*iter); |
| 218 | record.nextRecordID = static_cast<uint16_t> |
| 219 | (std::stoul(std::string(path.filename().c_str()))); |
| 220 | } |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | record.nextRecordID = ipmi::sel::lastEntry; |
| 225 | } |
| 226 | |
| 227 | if (requestData->readLength == ipmi::sel::entireRecord) |
| 228 | { |
| 229 | memcpy(response, &record, sizeof(record)); |
| 230 | *data_len = sizeof(record); |
| 231 | } |
| 232 | else |
| 233 | { |
| 234 | if (requestData->offset >= ipmi::sel::selRecordSize || |
| 235 | requestData->readLength > ipmi::sel::selRecordSize) |
| 236 | { |
| 237 | *data_len = 0; |
| 238 | return IPMI_CC_INVALID_FIELD_REQUEST; |
| 239 | } |
| 240 | |
| 241 | auto diff = ipmi::sel::selRecordSize - requestData->offset; |
| 242 | auto readLength = std::min(diff, |
| 243 | static_cast<int>(requestData->readLength)); |
| 244 | |
| 245 | memcpy(response, &record.nextRecordID, sizeof(record.nextRecordID)); |
| 246 | memcpy(static_cast<uint8_t*>(response) + sizeof(record.nextRecordID), |
| 247 | &record.recordID + requestData->offset, readLength); |
| 248 | *data_len = sizeof(record.nextRecordID) + readLength; |
| 249 | } |
| 250 | |
| 251 | return IPMI_CC_OK; |
| 252 | } |
| 253 | |
Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 254 | ipmi_ret_t deleteSELEntry(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 255 | ipmi_request_t request, ipmi_response_t response, |
| 256 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 257 | { |
| 258 | namespace fs = std::experimental::filesystem; |
| 259 | auto requestData = reinterpret_cast<const ipmi::sel::DeleteSELEntryRequest*> |
| 260 | (request); |
| 261 | |
| 262 | if (g_sel_reserve != requestData->reservationID) |
| 263 | { |
| 264 | *data_len = 0; |
| 265 | return IPMI_CC_INVALID_RESERVATION_ID; |
| 266 | } |
| 267 | |
| 268 | ipmi::sel::readLoggingObjectPaths(cache::paths); |
| 269 | |
| 270 | if (cache::paths.empty()) |
| 271 | { |
| 272 | *data_len = 0; |
| 273 | return IPMI_CC_SENSOR_INVALID; |
| 274 | } |
| 275 | |
| 276 | ipmi::sel::ObjectPaths::const_iterator iter; |
| 277 | uint16_t delRecordID = 0; |
| 278 | |
| 279 | if (requestData->selRecordID == ipmi::sel::firstEntry) |
| 280 | { |
| 281 | iter = cache::paths.begin(); |
| 282 | fs::path path(*iter); |
| 283 | delRecordID = static_cast<uint16_t> |
| 284 | (std::stoul(std::string(path.filename().c_str()))); |
| 285 | } |
| 286 | else if (requestData->selRecordID == ipmi::sel::lastEntry) |
| 287 | { |
| 288 | iter = cache::paths.end(); |
| 289 | fs::path path(*iter); |
| 290 | delRecordID = static_cast<uint16_t> |
| 291 | (std::stoul(std::string(path.filename().c_str()))); |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | std::string objPath = std::string(ipmi::sel::logBasePath) + "/" + |
| 296 | std::to_string(requestData->selRecordID); |
| 297 | |
| 298 | iter = std::find(cache::paths.begin(), cache::paths.end(), objPath); |
| 299 | if (iter == cache::paths.end()) |
| 300 | { |
| 301 | *data_len = 0; |
| 302 | return IPMI_CC_SENSOR_INVALID; |
| 303 | } |
| 304 | delRecordID = requestData->selRecordID; |
| 305 | } |
| 306 | |
| 307 | sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; |
| 308 | std::string service; |
| 309 | |
| 310 | try |
| 311 | { |
| 312 | service = ipmi::getService(bus, ipmi::sel::logDeleteIntf, *iter); |
| 313 | } |
| 314 | catch (const std::runtime_error& e) |
| 315 | { |
| 316 | log<level::ERR>(e.what()); |
| 317 | *data_len = 0; |
| 318 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 319 | } |
| 320 | |
| 321 | auto methodCall = bus.new_method_call(service.c_str(), |
| 322 | (*iter).c_str(), |
| 323 | ipmi::sel::logDeleteIntf, |
| 324 | "Delete"); |
| 325 | auto reply = bus.call(methodCall); |
| 326 | if (reply.is_method_error()) |
| 327 | { |
| 328 | *data_len = 0; |
| 329 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 330 | } |
| 331 | |
| 332 | // Invalidate the cache of dbus entry objects. |
| 333 | cache::paths.clear(); |
| 334 | memcpy(response, &delRecordID, sizeof(delRecordID)); |
| 335 | *data_len = sizeof(delRecordID); |
| 336 | |
| 337 | return IPMI_CC_OK; |
| 338 | } |
| 339 | |
Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 340 | ipmi_ret_t clearSEL(ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t request, |
| 341 | ipmi_response_t response, ipmi_data_len_t data_len, |
| 342 | ipmi_context_t context) |
| 343 | { |
| 344 | auto requestData = reinterpret_cast<const ipmi::sel::ClearSELRequest*> |
| 345 | (request); |
| 346 | |
| 347 | if (g_sel_reserve != requestData->reservationID) |
| 348 | { |
| 349 | *data_len = 0; |
| 350 | return IPMI_CC_INVALID_RESERVATION_ID; |
| 351 | } |
| 352 | |
| 353 | if (requestData->charC != 'C' || |
| 354 | requestData->charL != 'L' || |
| 355 | requestData->charR != 'R') |
| 356 | { |
| 357 | *data_len = 0; |
| 358 | return IPMI_CC_INVALID_FIELD_REQUEST; |
| 359 | } |
| 360 | |
| 361 | uint8_t eraseProgress = ipmi::sel::eraseComplete; |
| 362 | |
| 363 | /* |
| 364 | * Erasure status cannot be fetched from DBUS, so always return erasure |
| 365 | * status as `erase completed`. |
| 366 | */ |
| 367 | if (requestData->eraseOperation == ipmi::sel::getEraseStatus) |
| 368 | { |
| 369 | memcpy(response, &eraseProgress, sizeof(eraseProgress)); |
| 370 | *data_len = sizeof(eraseProgress); |
| 371 | return IPMI_CC_OK; |
| 372 | } |
| 373 | |
| 374 | sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; |
| 375 | auto depth = 0; |
| 376 | |
| 377 | auto mapperCall = bus.new_method_call(ipmi::sel::mapperBusName, |
| 378 | ipmi::sel::mapperObjPath, |
| 379 | ipmi::sel::mapperIntf, |
| 380 | "GetSubTreePaths"); |
| 381 | mapperCall.append(ipmi::sel::logBasePath); |
| 382 | mapperCall.append(depth); |
| 383 | mapperCall.append(ipmi::sel::ObjectPaths({ipmi::sel::logEntryIntf})); |
| 384 | |
| 385 | auto reply = bus.call(mapperCall); |
| 386 | if (reply.is_method_error()) |
| 387 | { |
| 388 | memcpy(response, &eraseProgress, sizeof(eraseProgress)); |
| 389 | *data_len = sizeof(eraseProgress); |
| 390 | return IPMI_CC_OK; |
| 391 | } |
| 392 | |
| 393 | ipmi::sel::ObjectPaths objectPaths; |
| 394 | reply.read(objectPaths); |
| 395 | if (objectPaths.empty()) |
| 396 | { |
| 397 | memcpy(response, &eraseProgress, sizeof(eraseProgress)); |
| 398 | *data_len = sizeof(eraseProgress); |
| 399 | return IPMI_CC_OK; |
| 400 | } |
| 401 | |
| 402 | std::string service; |
| 403 | |
| 404 | try |
| 405 | { |
| 406 | service = ipmi::getService(bus, |
| 407 | ipmi::sel::logDeleteIntf, |
| 408 | objectPaths.front()); |
| 409 | } |
| 410 | catch (const std::runtime_error& e) |
| 411 | { |
| 412 | log<level::ERR>(e.what()); |
| 413 | *data_len = 0; |
| 414 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 415 | } |
| 416 | |
| 417 | for (const auto& iter : objectPaths) |
| 418 | { |
| 419 | auto methodCall = bus.new_method_call(service.c_str(), |
| 420 | iter.c_str(), |
| 421 | ipmi::sel::logDeleteIntf, |
| 422 | "Delete"); |
| 423 | |
| 424 | auto reply = bus.call(methodCall); |
| 425 | if (reply.is_method_error()) |
| 426 | { |
| 427 | *data_len = 0; |
| 428 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | // Invalidate the cache of dbus entry objects. |
| 433 | cache::paths.clear(); |
| 434 | memcpy(response, &eraseProgress, sizeof(eraseProgress)); |
| 435 | *data_len = sizeof(eraseProgress); |
| 436 | return IPMI_CC_OK; |
| 437 | } |
| 438 | |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 439 | ipmi_ret_t ipmi_storage_get_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 440 | ipmi_request_t request, ipmi_response_t response, |
| 441 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 442 | { |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 443 | using namespace std::chrono; |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 444 | uint64_t host_time_usec = 0; |
| 445 | uint32_t resp = 0; |
Nagaraju Goruganti | 8960b7c | 2018-04-29 22:38:40 -0500 | [diff] [blame] | 446 | std::stringstream hostTime; |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 447 | |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 448 | try |
| 449 | { |
| 450 | sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; |
| 451 | auto service = ipmi::getService(bus, TIME_INTERFACE, HOST_TIME_PATH); |
| 452 | sdbusplus::message::variant<uint64_t> value; |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 453 | |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 454 | // Get host time |
| 455 | auto method = bus.new_method_call(service.c_str(), |
| 456 | HOST_TIME_PATH, |
| 457 | DBUS_PROPERTIES, |
| 458 | "Get"); |
| 459 | |
| 460 | method.append(TIME_INTERFACE, PROPERTY_ELAPSED); |
| 461 | auto reply = bus.call(method); |
| 462 | if (reply.is_method_error()) |
| 463 | { |
| 464 | log<level::ERR>("Error getting time", |
| 465 | entry("SERVICE=%s", service.c_str()), |
| 466 | entry("PATH=%s", HOST_TIME_PATH)); |
| 467 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 468 | } |
| 469 | reply.read(value); |
| 470 | host_time_usec = value.get<uint64_t>(); |
| 471 | } |
| 472 | catch (InternalFailure& e) |
| 473 | { |
| 474 | log<level::ERR>(e.what()); |
| 475 | return IPMI_CC_UNSPECIFIED_ERROR; |
| 476 | } |
| 477 | catch (const std::runtime_error& e) |
| 478 | { |
| 479 | log<level::ERR>(e.what()); |
| 480 | return IPMI_CC_UNSPECIFIED_ERROR; |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 481 | } |
| 482 | |
Nagaraju Goruganti | 8960b7c | 2018-04-29 22:38:40 -0500 | [diff] [blame] | 483 | hostTime << "Host time:" << getTimeString(host_time_usec); |
| 484 | log<level::DEBUG>(hostTime.str().c_str()); |
| 485 | |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 486 | |
| 487 | // Time is really long int but IPMI wants just uint32. This works okay until |
| 488 | // the number of seconds since 1970 overflows uint32 size.. Still a whole |
| 489 | // lot of time here to even think about that. |
| 490 | resp = duration_cast<seconds>(microseconds(host_time_usec)).count(); |
| 491 | resp = htole32(resp); |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 492 | |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 493 | // From the IPMI Spec 2.0, response should be a 32-bit value |
| 494 | *data_len = sizeof(resp); |
| 495 | |
| 496 | // Pack the actual response |
| 497 | memcpy(response, &resp, *data_len); |
| 498 | |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 499 | return IPMI_CC_OK; |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | ipmi_ret_t ipmi_storage_set_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 503 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 504 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 505 | { |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 506 | using namespace std::chrono; |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 507 | ipmi_ret_t rc = IPMI_CC_OK; |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 508 | uint32_t secs = *static_cast<uint32_t*>(request); |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 509 | *data_len = 0; |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 510 | |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 511 | secs = le32toh(secs); |
| 512 | microseconds usec{seconds(secs)}; |
Norman James | 8233044 | 2015-11-19 16:53:26 -0600 | [diff] [blame] | 513 | |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 514 | try |
| 515 | { |
| 516 | sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; |
| 517 | auto service = ipmi::getService(bus, TIME_INTERFACE, HOST_TIME_PATH); |
| 518 | sdbusplus::message::variant<uint64_t> value{usec.count()}; |
| 519 | |
| 520 | // Set host time |
| 521 | auto method = bus.new_method_call(service.c_str(), |
| 522 | HOST_TIME_PATH, |
| 523 | DBUS_PROPERTIES, |
| 524 | "Set"); |
| 525 | |
| 526 | method.append(TIME_INTERFACE, PROPERTY_ELAPSED, value); |
| 527 | auto reply = bus.call(method); |
| 528 | if (reply.is_method_error()) |
| 529 | { |
| 530 | log<level::ERR>("Error setting time", |
| 531 | entry("SERVICE=%s", service.c_str()), |
| 532 | entry("PATH=%s", HOST_TIME_PATH)); |
| 533 | rc = IPMI_CC_UNSPECIFIED_ERROR; |
| 534 | } |
Norman James | 8233044 | 2015-11-19 16:53:26 -0600 | [diff] [blame] | 535 | } |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 536 | catch (InternalFailure& e) |
| 537 | { |
| 538 | log<level::ERR>(e.what()); |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 539 | rc = IPMI_CC_UNSPECIFIED_ERROR; |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 540 | } |
Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 541 | catch (const std::runtime_error& e) |
| 542 | { |
| 543 | log<level::ERR>(e.what()); |
Norman James | 8233044 | 2015-11-19 16:53:26 -0600 | [diff] [blame] | 544 | rc = IPMI_CC_UNSPECIFIED_ERROR; |
| 545 | } |
Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 546 | |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 547 | return rc; |
| 548 | } |
| 549 | |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 550 | ipmi_ret_t ipmi_storage_reserve_sel(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 551 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 552 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 553 | { |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 554 | ipmi_ret_t rc = IPMI_CC_OK; |
| 555 | |
Nan Li | 36c0cb6 | 2016-03-31 11:16:08 +0800 | [diff] [blame] | 556 | // IPMI spec, Reservation ID, the value simply increases against each execution of reserve_sel command. |
| 557 | if( ++g_sel_reserve == 0) |
| 558 | g_sel_reserve = 1; |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 559 | |
| 560 | *data_len = sizeof(g_sel_reserve); |
| 561 | |
| 562 | // Pack the actual response |
| 563 | memcpy(response, &g_sel_reserve, *data_len); |
| 564 | |
| 565 | return rc; |
| 566 | } |
| 567 | |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 568 | ipmi_ret_t ipmi_storage_add_sel(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 569 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 570 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 571 | { |
| 572 | |
| 573 | ipmi_ret_t rc = IPMI_CC_OK; |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 574 | ipmi_add_sel_request_t *p = (ipmi_add_sel_request_t*) request; |
| 575 | uint16_t recordid; |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 576 | |
Chris Austen | 313d95b | 2015-10-31 12:55:30 -0500 | [diff] [blame] | 577 | recordid = ((uint16_t)p->eventdata[1] << 8) | p->eventdata[2]; |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 578 | |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 579 | *data_len = sizeof(g_sel_reserve); |
| 580 | |
| 581 | // Pack the actual response |
Chris Austen | 7cc3332 | 2015-11-11 00:20:22 -0600 | [diff] [blame] | 582 | memcpy(response, &p->eventdata[1], 2); |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 583 | |
Tom Joseph | b647d5b | 2017-10-31 17:25:33 +0530 | [diff] [blame] | 584 | // Hostboot sends SEL with OEM record type 0xDE to indicate that there is |
| 585 | // a maintenance procedure associated with eSEL record. |
| 586 | static constexpr auto procedureType = 0xDE; |
| 587 | if (p->recordtype == procedureType) |
| 588 | { |
| 589 | // In the OEM record type 0xDE, byte 11 in the SEL record indicate the |
| 590 | // procedure number. |
| 591 | createProcedureLogEntry(p->sensortype); |
| 592 | } |
| 593 | else |
| 594 | { |
| 595 | send_esel(recordid); |
| 596 | } |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 597 | |
| 598 | return rc; |
| 599 | } |
| 600 | |
Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 601 | //Read FRU info area |
| 602 | ipmi_ret_t ipmi_storage_get_fru_inv_area_info( |
| 603 | ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t request, |
| 604 | ipmi_response_t response, ipmi_data_len_t data_len, |
| 605 | ipmi_context_t context) |
| 606 | { |
| 607 | ipmi_ret_t rc = IPMI_CC_OK; |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 608 | const FruInvenAreaInfoRequest* reqptr = |
| 609 | reinterpret_cast<const FruInvenAreaInfoRequest*>(request); |
Tom Joseph | 187f564 | 2018-03-29 13:49:06 +0530 | [diff] [blame] | 610 | |
| 611 | auto iter = frus.find(reqptr->fruID); |
| 612 | if (iter == frus.end()) |
| 613 | { |
| 614 | *data_len = 0; |
| 615 | return IPMI_CC_SENSOR_INVALID; |
| 616 | } |
| 617 | |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 618 | try |
| 619 | { |
| 620 | const auto& fruArea = getFruAreaData(reqptr->fruID); |
| 621 | auto size = static_cast<uint16_t>(fruArea.size()); |
| 622 | FruInvenAreaInfoResponse resp; |
| 623 | resp.sizems = size >> 8; |
| 624 | resp.sizels = size; |
| 625 | resp.access = static_cast<uint8_t>(AccessMode::bytes); |
| 626 | |
| 627 | *data_len = sizeof(resp); |
| 628 | |
| 629 | // Pack the actual response |
| 630 | memcpy(response, &resp, *data_len); |
| 631 | } |
| 632 | catch(const InternalFailure& e) |
| 633 | { |
| 634 | rc = IPMI_CC_UNSPECIFIED_ERROR; |
| 635 | *data_len = 0; |
| 636 | log<level::ERR>(e.what()); |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 637 | } |
Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 638 | return rc; |
| 639 | } |
| 640 | |
| 641 | //Read FRU data |
| 642 | ipmi_ret_t ipmi_storage_read_fru_data( |
| 643 | ipmi_netfn_t netfn, ipmi_cmd_t cmd, ipmi_request_t request, |
| 644 | ipmi_response_t response, ipmi_data_len_t data_len, |
| 645 | ipmi_context_t context) |
| 646 | { |
| 647 | ipmi_ret_t rc = IPMI_CC_OK; |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 648 | const ReadFruDataRequest* reqptr = |
Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 649 | reinterpret_cast<const ReadFruDataRequest*>(request); |
| 650 | auto resptr = |
| 651 | reinterpret_cast<ReadFruDataResponse*>(response); |
Tom Joseph | 187f564 | 2018-03-29 13:49:06 +0530 | [diff] [blame] | 652 | |
| 653 | auto iter = frus.find(reqptr->fruID); |
| 654 | if (iter == frus.end()) |
| 655 | { |
| 656 | *data_len = 0; |
| 657 | return IPMI_CC_SENSOR_INVALID; |
| 658 | } |
| 659 | |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 660 | auto offset = |
| 661 | static_cast<uint16_t>(reqptr->offsetMS << 8 | reqptr->offsetLS); |
| 662 | try |
| 663 | { |
| 664 | const auto& fruArea = getFruAreaData(reqptr->fruID); |
| 665 | auto size = fruArea.size(); |
Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 666 | |
Tom Joseph | efcd68b | 2018-04-26 18:46:27 +0530 | [diff] [blame] | 667 | if (offset >= size) |
| 668 | { |
| 669 | return IPMI_CC_PARM_OUT_OF_RANGE; |
| 670 | } |
| 671 | |
Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 672 | // Write the count of response data. |
| 673 | if ((offset + reqptr->count) <= size) |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 674 | { |
Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 675 | resptr->count = reqptr->count; |
| 676 | } |
| 677 | else |
| 678 | { |
| 679 | resptr->count = size - offset; |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 680 | } |
Ratan Gupta | 2848d60 | 2018-01-31 20:39:20 +0530 | [diff] [blame] | 681 | |
Ratan Gupta | 2848d60 | 2018-01-31 20:39:20 +0530 | [diff] [blame] | 682 | std::copy((fruArea.begin() + offset), |
Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 683 | (fruArea.begin() + offset + resptr->count), |
| 684 | resptr->data); |
Ratan Gupta | 2848d60 | 2018-01-31 20:39:20 +0530 | [diff] [blame] | 685 | |
Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 686 | *data_len = resptr->count + 1; // additional one byte for count |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 687 | } |
| 688 | catch (const InternalFailure& e) |
| 689 | { |
| 690 | rc = IPMI_CC_UNSPECIFIED_ERROR; |
| 691 | *data_len = 0; |
| 692 | log<level::ERR>(e.what()); |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 693 | } |
Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 694 | return rc; |
| 695 | } |
| 696 | |
Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 697 | ipmi_ret_t ipmi_get_repository_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 698 | ipmi_request_t request, ipmi_response_t response, |
| 699 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 700 | { |
| 701 | constexpr auto sdrVersion = 0x51; |
| 702 | auto responseData = |
| 703 | reinterpret_cast<GetRepositoryInfoResponse*>(response); |
| 704 | |
| 705 | memset(responseData, 0 , sizeof(GetRepositoryInfoResponse)); |
| 706 | |
| 707 | responseData->sdrVersion = sdrVersion; |
| 708 | |
| 709 | uint16_t records = frus.size() + sensors.size(); |
| 710 | responseData->recordCountMs = records >> 8; |
| 711 | responseData->recordCountLs = records; |
| 712 | |
| 713 | responseData->freeSpace[0] = 0xFF; |
| 714 | responseData->freeSpace[1] = 0xFF; |
| 715 | |
| 716 | *data_len = sizeof(GetRepositoryInfoResponse); |
| 717 | |
| 718 | return IPMI_CC_OK; |
| 719 | } |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 720 | |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 721 | void register_netfn_storage_functions() |
| 722 | { |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 723 | // <Wildcard Command> |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 724 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_WILDCARD, NULL, ipmi_storage_wildcard, |
| 725 | PRIVILEGE_USER); |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 726 | |
Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 727 | // <Get SEL Info> |
Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 728 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_INFO, NULL, getSELInfo, |
| 729 | PRIVILEGE_USER); |
| 730 | |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 731 | // <Get SEL Time> |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 732 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_TIME, NULL, ipmi_storage_get_sel_time, |
| 733 | PRIVILEGE_USER); |
Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 734 | |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 735 | // <Set SEL Time> |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 736 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_SET_SEL_TIME, NULL, ipmi_storage_set_sel_time, |
| 737 | PRIVILEGE_OPERATOR); |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 738 | |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 739 | // <Reserve SEL> |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 740 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_RESERVE_SEL, NULL, ipmi_storage_reserve_sel, |
| 741 | PRIVILEGE_USER); |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 742 | |
Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 743 | // <Get SEL Entry> |
Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 744 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY, NULL, getSELEntry, |
| 745 | PRIVILEGE_USER); |
| 746 | |
Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 747 | // <Delete SEL Entry> |
Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 748 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_DELETE_SEL, NULL, deleteSELEntry, |
| 749 | PRIVILEGE_OPERATOR); |
| 750 | |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 751 | // <Add SEL Entry> |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 752 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_ADD_SEL, NULL, ipmi_storage_add_sel, |
| 753 | PRIVILEGE_OPERATOR); |
Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 754 | // <Clear SEL> |
Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 755 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_CLEAR_SEL, NULL, clearSEL, |
| 756 | PRIVILEGE_OPERATOR); |
Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 757 | // <Get FRU Inventory Area Info> |
Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 758 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_FRU_INV_AREA_INFO, NULL, |
| 759 | ipmi_storage_get_fru_inv_area_info, PRIVILEGE_OPERATOR); |
| 760 | |
| 761 | // <Add READ FRU Data |
Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 762 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_READ_FRU_DATA, NULL, |
| 763 | ipmi_storage_read_fru_data, PRIVILEGE_OPERATOR); |
Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 764 | |
Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 765 | // <Get Repository Info> |
| 766 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_REPOSITORY_INFO, |
| 767 | nullptr, ipmi_get_repository_info, |
| 768 | PRIVILEGE_USER); |
| 769 | |
Tom Joseph | 5ca5095 | 2018-02-22 00:33:38 +0530 | [diff] [blame] | 770 | // <Reserve SDR Repository> |
| 771 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_RESERVE_SDR, |
| 772 | nullptr, ipmi_sen_reserve_sdr, |
| 773 | PRIVILEGE_USER); |
| 774 | |
| 775 | // <Get SDR> |
| 776 | ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SDR, |
| 777 | nullptr, ipmi_sen_get_sdr, |
| 778 | PRIVILEGE_USER); |
| 779 | |
Marri Devender Rao | 908f750 | 2017-07-10 01:49:54 -0500 | [diff] [blame] | 780 | ipmi::fru::registerCallbackHandler(); |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 781 | return; |
| 782 | } |
| 783 | |