| Patrick Venture | 3a5071a | 2018-09-12 13:27:42 -0700 | [diff] [blame] | 1 | #include "storagehandler.hpp" | 
 | 2 |  | 
 | 3 | #include "fruread.hpp" | 
 | 4 | #include "read_fru_data.hpp" | 
 | 5 | #include "selutility.hpp" | 
 | 6 | #include "sensorhandler.hpp" | 
 | 7 | #include "storageaddsel.hpp" | 
| Patrick Venture | 3a5071a | 2018-09-12 13:27:42 -0700 | [diff] [blame] | 8 |  | 
| Lei YU | 52d9124 | 2017-10-17 22:52:28 +0800 | [diff] [blame] | 9 | #include <arpa/inet.h> | 
| Patrick Venture | 3a5071a | 2018-09-12 13:27:42 -0700 | [diff] [blame] | 10 | #include <mapper.h> | 
 | 11 | #include <systemd/sd-bus.h> | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 12 |  | 
 | 13 | #include <algorithm> | 
| Lei YU | 52d9124 | 2017-10-17 22:52:28 +0800 | [diff] [blame] | 14 | #include <chrono> | 
 | 15 | #include <cstdio> | 
| Patrick Venture | b51bf9c | 2018-09-10 15:53:14 -0700 | [diff] [blame] | 16 | #include <cstring> | 
| Vernon Mauery | bdda800 | 2019-02-26 10:18:51 -0800 | [diff] [blame] | 17 | #include <filesystem> | 
| Vernon Mauery | e08fbff | 2019-04-03 09:19:34 -0700 | [diff] [blame] | 18 | #include <ipmid/api.hpp> | 
| Vernon Mauery | 6a98fe7 | 2019-03-11 15:57:48 -0700 | [diff] [blame] | 19 | #include <ipmid/utils.hpp> | 
| Patrick Venture | 3a5071a | 2018-09-12 13:27:42 -0700 | [diff] [blame] | 20 | #include <phosphor-logging/elog-errors.hpp> | 
 | 21 | #include <phosphor-logging/log.hpp> | 
 | 22 | #include <sdbusplus/server.hpp> | 
 | 23 | #include <string> | 
| Vernon Mauery | 16b8693 | 2019-05-01 08:36:11 -0700 | [diff] [blame] | 24 | #include <variant> | 
| Patrick Venture | 3a5071a | 2018-09-12 13:27:42 -0700 | [diff] [blame] | 25 | #include <xyz/openbmc_project/Common/error.hpp> | 
 | 26 |  | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 27 | void register_netfn_storage_functions() __attribute__((constructor)); | 
 | 28 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 29 | unsigned int g_sel_time = 0xFFFFFFFF; | 
| Patrick Venture | db0cbe6 | 2019-09-09 14:47:22 -0700 | [diff] [blame] | 30 | namespace ipmi | 
 | 31 | { | 
 | 32 | namespace sensor | 
 | 33 | { | 
 | 34 | extern const IdInfoMap sensors; | 
 | 35 | } // namespace sensor | 
 | 36 | } // namespace ipmi | 
 | 37 |  | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 38 | extern const FruMap frus; | 
| anil kumar appana | 2c7db1d | 2019-05-28 11:20:19 +0000 | [diff] [blame] | 39 | constexpr uint8_t eventDataSize = 3; | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 40 | namespace | 
 | 41 | { | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 42 | constexpr auto TIME_INTERFACE = "xyz.openbmc_project.Time.EpochTime"; | 
 | 43 | constexpr auto HOST_TIME_PATH = "/xyz/openbmc_project/time/host"; | 
 | 44 | constexpr auto DBUS_PROPERTIES = "org.freedesktop.DBus.Properties"; | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 45 | constexpr auto PROPERTY_ELAPSED = "Elapsed"; | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 46 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 47 | } // namespace | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 48 |  | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 49 | namespace cache | 
 | 50 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 51 | /* | 
 | 52 |  * This cache contains the object paths of the logging entries sorted in the | 
 | 53 |  * order of the filename(numeric order). The cache is initialized by | 
 | 54 |  * invoking readLoggingObjectPaths with the cache as the parameter. The | 
 | 55 |  * cache is invoked in the execution of the Get SEL info and Delete SEL | 
 | 56 |  * entry command. The Get SEL Info command is typically invoked before the | 
 | 57 |  * Get SEL entry command, so the cache is utilized for responding to Get SEL | 
 | 58 |  * entry command. The cache is invalidated by clearing after Delete SEL | 
 | 59 |  * entry and Clear SEL command. | 
 | 60 |  */ | 
 | 61 | ipmi::sel::ObjectPaths paths; | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 62 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 63 | } // namespace cache | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 64 |  | 
 | 65 | using InternalFailure = | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 66 |     sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 67 | using namespace phosphor::logging; | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 68 | using namespace ipmi::fru; | 
 | 69 |  | 
 | 70 | /** | 
 | 71 |  * @enum Device access mode | 
 | 72 |  */ | 
 | 73 | enum class AccessMode | 
 | 74 | { | 
 | 75 |     bytes, ///< Device is accessed by bytes | 
 | 76 |     words  ///< Device is accessed by words | 
 | 77 | }; | 
 | 78 |  | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 79 | /** @brief implements the get SEL Info command | 
 | 80 |  *  @returns IPMI completion code plus response data | 
 | 81 |  *   - selVersion - SEL revision | 
 | 82 |  *   - entries    - Number of log entries in SEL. | 
 | 83 |  *   - freeSpace  - Free Space in bytes. | 
 | 84 |  *   - addTimeStamp - Most recent addition timestamp | 
 | 85 |  *   - eraseTimeStamp - Most recent erase timestamp | 
 | 86 |  *   - operationSupport - Reserve & Delete SEL operations supported | 
 | 87 |  */ | 
 | 88 |  | 
 | 89 | ipmi::RspType<uint8_t,  // SEL revision. | 
 | 90 |               uint16_t, // number of log entries in SEL. | 
 | 91 |               uint16_t, // free Space in bytes. | 
 | 92 |               uint32_t, // most recent addition timestamp | 
 | 93 |               uint32_t, // most recent erase timestamp. | 
 | 94 |  | 
 | 95 |               bool,    // SEL allocation info supported | 
 | 96 |               bool,    // reserve SEL supported | 
 | 97 |               bool,    // partial Add SEL Entry supported | 
 | 98 |               bool,    // delete SEL supported | 
 | 99 |               uint3_t, // reserved | 
 | 100 |               bool     // overflow flag | 
 | 101 |               > | 
 | 102 |     ipmiStorageGetSelInfo() | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 103 | { | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 104 |     uint16_t entries = 0; | 
 | 105 |     // Most recent addition timestamp. | 
 | 106 |     uint32_t addTimeStamp = ipmi::sel::invalidTimeStamp; | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 107 |  | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 108 |     try | 
 | 109 |     { | 
 | 110 |         ipmi::sel::readLoggingObjectPaths(cache::paths); | 
 | 111 |     } | 
 | 112 |     catch (const sdbusplus::exception::SdBusError& e) | 
 | 113 |     { | 
 | 114 |         // No action if reading log objects have failed for this command. | 
 | 115 |         // readLoggingObjectPaths will throw exception if there are no log | 
 | 116 |         // entries. The command will be responded with number of SEL entries | 
 | 117 |         // as 0. | 
 | 118 |     } | 
 | 119 |  | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 120 |     if (!cache::paths.empty()) | 
 | 121 |     { | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 122 |         entries = static_cast<uint16_t>(cache::paths.size()); | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 123 |  | 
 | 124 |         try | 
 | 125 |         { | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 126 |             addTimeStamp = static_cast<uint32_t>( | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 127 |                 (ipmi::sel::getEntryTimeStamp(cache::paths.back()).count())); | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 128 |         } | 
 | 129 |         catch (InternalFailure& e) | 
 | 130 |         { | 
 | 131 |         } | 
 | 132 |         catch (const std::runtime_error& e) | 
 | 133 |         { | 
 | 134 |             log<level::ERR>(e.what()); | 
 | 135 |         } | 
 | 136 |     } | 
 | 137 |  | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 138 |     constexpr uint8_t selVersion = ipmi::sel::selVersion; | 
 | 139 |     constexpr uint16_t freeSpace = 0xFFFF; | 
 | 140 |     constexpr uint32_t eraseTimeStamp = ipmi::sel::invalidTimeStamp; | 
 | 141 |     constexpr uint3_t reserved{0}; | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 142 |  | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 143 |     return ipmi::responseSuccess( | 
 | 144 |         selVersion, entries, freeSpace, addTimeStamp, eraseTimeStamp, | 
 | 145 |         ipmi::sel::operationSupport::getSelAllocationInfo, | 
 | 146 |         ipmi::sel::operationSupport::reserveSel, | 
 | 147 |         ipmi::sel::operationSupport::partialAddSelEntry, | 
 | 148 |         ipmi::sel::operationSupport::deleteSel, reserved, | 
 | 149 |         ipmi::sel::operationSupport::overflow); | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 150 | } | 
 | 151 |  | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 152 | ipmi_ret_t getSELEntry(ipmi_netfn_t netfn, ipmi_cmd_t cmd, | 
 | 153 |                        ipmi_request_t request, ipmi_response_t response, | 
 | 154 |                        ipmi_data_len_t data_len, ipmi_context_t context) | 
 | 155 | { | 
| Jason M. Bills | 851acb1 | 2019-02-04 14:06:57 -0800 | [diff] [blame] | 156 |     if (*data_len != sizeof(ipmi::sel::GetSELEntryRequest)) | 
 | 157 |     { | 
 | 158 |         *data_len = 0; | 
 | 159 |         return IPMI_CC_REQ_DATA_LEN_INVALID; | 
 | 160 |     } | 
 | 161 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 162 |     auto requestData = | 
 | 163 |         reinterpret_cast<const ipmi::sel::GetSELEntryRequest*>(request); | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 164 |  | 
 | 165 |     if (requestData->reservationID != 0) | 
 | 166 |     { | 
| Jason M. Bills | 13e67c8 | 2018-09-10 14:12:16 -0700 | [diff] [blame] | 167 |         if (!checkSELReservation(requestData->reservationID)) | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 168 |         { | 
 | 169 |             *data_len = 0; | 
 | 170 |             return IPMI_CC_INVALID_RESERVATION_ID; | 
 | 171 |         } | 
 | 172 |     } | 
 | 173 |  | 
 | 174 |     if (cache::paths.empty()) | 
 | 175 |     { | 
 | 176 |         *data_len = 0; | 
 | 177 |         return IPMI_CC_SENSOR_INVALID; | 
 | 178 |     } | 
 | 179 |  | 
 | 180 |     ipmi::sel::ObjectPaths::const_iterator iter; | 
 | 181 |  | 
 | 182 |     // Check for the requested SEL Entry. | 
 | 183 |     if (requestData->selRecordID == ipmi::sel::firstEntry) | 
 | 184 |     { | 
 | 185 |         iter = cache::paths.begin(); | 
 | 186 |     } | 
 | 187 |     else if (requestData->selRecordID == ipmi::sel::lastEntry) | 
 | 188 |     { | 
 | 189 |         iter = cache::paths.end(); | 
 | 190 |     } | 
 | 191 |     else | 
 | 192 |     { | 
 | 193 |         std::string objPath = std::string(ipmi::sel::logBasePath) + "/" + | 
 | 194 |                               std::to_string(requestData->selRecordID); | 
 | 195 |  | 
 | 196 |         iter = std::find(cache::paths.begin(), cache::paths.end(), objPath); | 
 | 197 |         if (iter == cache::paths.end()) | 
 | 198 |         { | 
 | 199 |             *data_len = 0; | 
 | 200 |             return IPMI_CC_SENSOR_INVALID; | 
 | 201 |         } | 
 | 202 |     } | 
 | 203 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 204 |     ipmi::sel::GetSELEntryResponse record{}; | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 205 |  | 
 | 206 |     // Convert the log entry into SEL record. | 
 | 207 |     try | 
 | 208 |     { | 
 | 209 |         record = ipmi::sel::convertLogEntrytoSEL(*iter); | 
 | 210 |     } | 
 | 211 |     catch (InternalFailure& e) | 
 | 212 |     { | 
 | 213 |         *data_len = 0; | 
 | 214 |         return IPMI_CC_UNSPECIFIED_ERROR; | 
 | 215 |     } | 
 | 216 |     catch (const std::runtime_error& e) | 
 | 217 |     { | 
 | 218 |         log<level::ERR>(e.what()); | 
 | 219 |         *data_len = 0; | 
 | 220 |         return IPMI_CC_UNSPECIFIED_ERROR; | 
 | 221 |     } | 
 | 222 |  | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 223 |     // Identify the next SEL record ID | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 224 |     if (iter != cache::paths.end()) | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 225 |     { | 
 | 226 |         ++iter; | 
 | 227 |         if (iter == cache::paths.end()) | 
 | 228 |         { | 
 | 229 |             record.nextRecordID = ipmi::sel::lastEntry; | 
 | 230 |         } | 
 | 231 |         else | 
 | 232 |         { | 
| Vernon Mauery | 185b9f8 | 2018-07-20 10:52:36 -0700 | [diff] [blame] | 233 |             namespace fs = std::filesystem; | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 234 |             fs::path path(*iter); | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 235 |             record.nextRecordID = static_cast<uint16_t>( | 
 | 236 |                 std::stoul(std::string(path.filename().c_str()))); | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 237 |         } | 
 | 238 |     } | 
 | 239 |     else | 
 | 240 |     { | 
 | 241 |         record.nextRecordID = ipmi::sel::lastEntry; | 
 | 242 |     } | 
 | 243 |  | 
 | 244 |     if (requestData->readLength == ipmi::sel::entireRecord) | 
 | 245 |     { | 
| Patrick Venture | b51bf9c | 2018-09-10 15:53:14 -0700 | [diff] [blame] | 246 |         std::memcpy(response, &record, sizeof(record)); | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 247 |         *data_len = sizeof(record); | 
 | 248 |     } | 
 | 249 |     else | 
 | 250 |     { | 
 | 251 |         if (requestData->offset >= ipmi::sel::selRecordSize || | 
 | 252 |             requestData->readLength > ipmi::sel::selRecordSize) | 
 | 253 |         { | 
 | 254 |             *data_len = 0; | 
 | 255 |             return IPMI_CC_INVALID_FIELD_REQUEST; | 
 | 256 |         } | 
 | 257 |  | 
 | 258 |         auto diff = ipmi::sel::selRecordSize - requestData->offset; | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 259 |         auto readLength = | 
 | 260 |             std::min(diff, static_cast<int>(requestData->readLength)); | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 261 |  | 
| Patrick Venture | b51bf9c | 2018-09-10 15:53:14 -0700 | [diff] [blame] | 262 |         std::memcpy(response, &record.nextRecordID, | 
 | 263 |                     sizeof(record.nextRecordID)); | 
 | 264 |         std::memcpy(static_cast<uint8_t*>(response) + | 
 | 265 |                         sizeof(record.nextRecordID), | 
 | 266 |                     &record.recordID + requestData->offset, readLength); | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 267 |         *data_len = sizeof(record.nextRecordID) + readLength; | 
 | 268 |     } | 
 | 269 |  | 
 | 270 |     return IPMI_CC_OK; | 
 | 271 | } | 
 | 272 |  | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 273 | /** @brief implements the delete SEL entry command | 
 | 274 |  * @request | 
 | 275 |  *   - reservationID; // reservation ID. | 
 | 276 |  *   - selRecordID;   // SEL record ID. | 
 | 277 |  * | 
 | 278 |  *  @returns ipmi completion code plus response data | 
 | 279 |  *   - Record ID of the deleted record | 
 | 280 |  */ | 
 | 281 | ipmi::RspType<uint16_t // deleted record ID | 
 | 282 |               > | 
 | 283 |     deleteSELEntry(uint16_t reservationID, uint16_t selRecordID) | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 284 | { | 
| Jason M. Bills | 851acb1 | 2019-02-04 14:06:57 -0800 | [diff] [blame] | 285 |  | 
| Brad Bishop | 1a4117b | 2018-11-21 15:48:18 -0500 | [diff] [blame] | 286 |     namespace fs = std::filesystem; | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 287 |  | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 288 |     if (!checkSELReservation(reservationID)) | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 289 |     { | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 290 |         return ipmi::responseInvalidReservationId(); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 291 |     } | 
 | 292 |  | 
| Jason M. Bills | 13e67c8 | 2018-09-10 14:12:16 -0700 | [diff] [blame] | 293 |     // Per the IPMI spec, need to cancel the reservation when a SEL entry is | 
 | 294 |     // deleted | 
 | 295 |     cancelSELReservation(); | 
 | 296 |  | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 297 |     try | 
 | 298 |     { | 
 | 299 |         ipmi::sel::readLoggingObjectPaths(cache::paths); | 
 | 300 |     } | 
 | 301 |     catch (const sdbusplus::exception::SdBusError& e) | 
 | 302 |     { | 
 | 303 |         // readLoggingObjectPaths will throw exception if there are no error | 
 | 304 |         // log entries. | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 305 |         return ipmi::responseSensorInvalid(); | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 306 |     } | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 307 |  | 
 | 308 |     if (cache::paths.empty()) | 
 | 309 |     { | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 310 |         return ipmi::responseSensorInvalid(); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 311 |     } | 
 | 312 |  | 
 | 313 |     ipmi::sel::ObjectPaths::const_iterator iter; | 
 | 314 |     uint16_t delRecordID = 0; | 
 | 315 |  | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 316 |     if (selRecordID == ipmi::sel::firstEntry) | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 317 |     { | 
 | 318 |         iter = cache::paths.begin(); | 
 | 319 |         fs::path path(*iter); | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 320 |         delRecordID = static_cast<uint16_t>( | 
 | 321 |             std::stoul(std::string(path.filename().c_str()))); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 322 |     } | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 323 |     else if (selRecordID == ipmi::sel::lastEntry) | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 324 |     { | 
 | 325 |         iter = cache::paths.end(); | 
 | 326 |         fs::path path(*iter); | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 327 |         delRecordID = static_cast<uint16_t>( | 
 | 328 |             std::stoul(std::string(path.filename().c_str()))); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 329 |     } | 
 | 330 |     else | 
 | 331 |     { | 
 | 332 |         std::string objPath = std::string(ipmi::sel::logBasePath) + "/" + | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 333 |                               std::to_string(selRecordID); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 334 |  | 
 | 335 |         iter = std::find(cache::paths.begin(), cache::paths.end(), objPath); | 
 | 336 |         if (iter == cache::paths.end()) | 
 | 337 |         { | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 338 |             return ipmi::responseSensorInvalid(); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 339 |         } | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 340 |         delRecordID = selRecordID; | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 341 |     } | 
 | 342 |  | 
 | 343 |     sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; | 
 | 344 |     std::string service; | 
 | 345 |  | 
 | 346 |     try | 
 | 347 |     { | 
 | 348 |         service = ipmi::getService(bus, ipmi::sel::logDeleteIntf, *iter); | 
 | 349 |     } | 
 | 350 |     catch (const std::runtime_error& e) | 
 | 351 |     { | 
 | 352 |         log<level::ERR>(e.what()); | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 353 |         return ipmi::responseUnspecifiedError(); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 354 |     } | 
 | 355 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 356 |     auto methodCall = bus.new_method_call(service.c_str(), (*iter).c_str(), | 
 | 357 |                                           ipmi::sel::logDeleteIntf, "Delete"); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 358 |     auto reply = bus.call(methodCall); | 
 | 359 |     if (reply.is_method_error()) | 
 | 360 |     { | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 361 |         return ipmi::responseUnspecifiedError(); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 362 |     } | 
 | 363 |  | 
 | 364 |     // Invalidate the cache of dbus entry objects. | 
 | 365 |     cache::paths.clear(); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 366 |  | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 367 |     return ipmi::responseSuccess(delRecordID); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 368 | } | 
 | 369 |  | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 370 | /** @brief implements the Clear SEL command | 
 | 371 |  * @request | 
 | 372 |  *   - reservationID   // Reservation ID. | 
 | 373 |  *   - clr             // char array { 'C'(0x43h), 'L'(0x4Ch), 'R'(0x52h) } | 
 | 374 |  *   - eraseOperation; // requested operation. | 
 | 375 |  * | 
 | 376 |  *  @returns ipmi completion code plus response data | 
 | 377 |  *   - erase status | 
 | 378 |  */ | 
 | 379 |  | 
 | 380 | ipmi::RspType<uint8_t // erase status | 
 | 381 |               > | 
 | 382 |     clearSEL(uint16_t reservationID, const std::array<char, 3>& clr, | 
 | 383 |              uint8_t eraseOperation) | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 384 | { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 385 |     static constexpr std::array<char, 3> clrOk = {'C', 'L', 'R'}; | 
 | 386 |     if (clr != clrOk) | 
| Jason M. Bills | 851acb1 | 2019-02-04 14:06:57 -0800 | [diff] [blame] | 387 |     { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 388 |         return ipmi::responseInvalidFieldRequest(); | 
| Jason M. Bills | 851acb1 | 2019-02-04 14:06:57 -0800 | [diff] [blame] | 389 |     } | 
 | 390 |  | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 391 |     if (!checkSELReservation(reservationID)) | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 392 |     { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 393 |         return ipmi::responseInvalidReservationId(); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 394 |     } | 
 | 395 |  | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 396 |     /* | 
 | 397 |      * Erasure status cannot be fetched from DBUS, so always return erasure | 
 | 398 |      * status as `erase completed`. | 
 | 399 |      */ | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 400 |     if (eraseOperation == ipmi::sel::getEraseStatus) | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 401 |     { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 402 |         return ipmi::responseSuccess( | 
 | 403 |             static_cast<uint8_t>(ipmi::sel::eraseComplete)); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 404 |     } | 
 | 405 |  | 
| Jason M. Bills | 13e67c8 | 2018-09-10 14:12:16 -0700 | [diff] [blame] | 406 |     // Per the IPMI spec, need to cancel any reservation when the SEL is cleared | 
 | 407 |     cancelSELReservation(); | 
 | 408 |  | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 409 |     sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 410 |     ipmi::sel::ObjectPaths objectPaths; | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 411 |     auto depth = 0; | 
 | 412 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 413 |     auto mapperCall = | 
 | 414 |         bus.new_method_call(ipmi::sel::mapperBusName, ipmi::sel::mapperObjPath, | 
 | 415 |                             ipmi::sel::mapperIntf, "GetSubTreePaths"); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 416 |     mapperCall.append(ipmi::sel::logBasePath); | 
 | 417 |     mapperCall.append(depth); | 
 | 418 |     mapperCall.append(ipmi::sel::ObjectPaths({ipmi::sel::logEntryIntf})); | 
 | 419 |  | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 420 |     try | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 421 |     { | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 422 |         auto reply = bus.call(mapperCall); | 
 | 423 |         if (reply.is_method_error()) | 
 | 424 |         { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 425 |             return ipmi::responseSuccess( | 
 | 426 |                 static_cast<uint8_t>(ipmi::sel::eraseComplete)); | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 427 |         } | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 428 |  | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 429 |         reply.read(objectPaths); | 
 | 430 |         if (objectPaths.empty()) | 
 | 431 |         { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 432 |             return ipmi::responseSuccess( | 
 | 433 |                 static_cast<uint8_t>(ipmi::sel::eraseComplete)); | 
| Tom Joseph | e59abfb | 2018-08-06 18:46:27 +0530 | [diff] [blame] | 434 |         } | 
 | 435 |     } | 
 | 436 |     catch (const sdbusplus::exception::SdBusError& e) | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 437 |     { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 438 |         return ipmi::responseSuccess( | 
 | 439 |             static_cast<uint8_t>(ipmi::sel::eraseComplete)); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 440 |     } | 
 | 441 |  | 
 | 442 |     std::string service; | 
 | 443 |  | 
 | 444 |     try | 
 | 445 |     { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 446 |         service = ipmi::getService(bus, ipmi::sel::logDeleteIntf, | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 447 |                                    objectPaths.front()); | 
 | 448 |     } | 
 | 449 |     catch (const std::runtime_error& e) | 
 | 450 |     { | 
 | 451 |         log<level::ERR>(e.what()); | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 452 |         return ipmi::responseUnspecifiedError(); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 453 |     } | 
 | 454 |  | 
 | 455 |     for (const auto& iter : objectPaths) | 
 | 456 |     { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 457 |         auto methodCall = bus.new_method_call( | 
 | 458 |             service.c_str(), iter.c_str(), ipmi::sel::logDeleteIntf, "Delete"); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 459 |  | 
 | 460 |         auto reply = bus.call(methodCall); | 
 | 461 |         if (reply.is_method_error()) | 
 | 462 |         { | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 463 |             return ipmi::responseUnspecifiedError(); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 464 |         } | 
 | 465 |     } | 
 | 466 |  | 
 | 467 |     // Invalidate the cache of dbus entry objects. | 
 | 468 |     cache::paths.clear(); | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 469 |     return ipmi::responseSuccess( | 
 | 470 |         static_cast<uint8_t>(ipmi::sel::eraseComplete)); | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 471 | } | 
 | 472 |  | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 473 | /** @brief implements the get SEL time command | 
 | 474 |  *  @returns IPMI completion code plus response data | 
 | 475 |  *   -current time | 
 | 476 |  */ | 
 | 477 | ipmi::RspType<uint32_t> // current time | 
 | 478 |     ipmiStorageGetSelTime() | 
| Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 479 | { | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 480 |     using namespace std::chrono; | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 481 |     uint64_t host_time_usec = 0; | 
| Nagaraju Goruganti | 8960b7c | 2018-04-29 22:38:40 -0500 | [diff] [blame] | 482 |     std::stringstream hostTime; | 
| Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 483 |  | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 484 |     try | 
 | 485 |     { | 
 | 486 |         sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; | 
 | 487 |         auto service = ipmi::getService(bus, TIME_INTERFACE, HOST_TIME_PATH); | 
| Vernon Mauery | 16b8693 | 2019-05-01 08:36:11 -0700 | [diff] [blame] | 488 |         std::variant<uint64_t> value; | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 489 |  | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 490 |         // Get host time | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 491 |         auto method = bus.new_method_call(service.c_str(), HOST_TIME_PATH, | 
 | 492 |                                           DBUS_PROPERTIES, "Get"); | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 493 |  | 
 | 494 |         method.append(TIME_INTERFACE, PROPERTY_ELAPSED); | 
 | 495 |         auto reply = bus.call(method); | 
 | 496 |         if (reply.is_method_error()) | 
 | 497 |         { | 
 | 498 |             log<level::ERR>("Error getting time", | 
 | 499 |                             entry("SERVICE=%s", service.c_str()), | 
 | 500 |                             entry("PATH=%s", HOST_TIME_PATH)); | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 501 |             return ipmi::responseUnspecifiedError(); | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 502 |         } | 
 | 503 |         reply.read(value); | 
| Vernon Mauery | f442e11 | 2019-04-09 11:44:36 -0700 | [diff] [blame] | 504 |         host_time_usec = std::get<uint64_t>(value); | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 505 |     } | 
 | 506 |     catch (InternalFailure& e) | 
 | 507 |     { | 
 | 508 |         log<level::ERR>(e.what()); | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 509 |         return ipmi::responseUnspecifiedError(); | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 510 |     } | 
| Tom Joseph | 30fd0a1 | 2019-09-24 06:53:22 +0530 | [diff] [blame] | 511 |     catch (const std::exception& e) | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 512 |     { | 
 | 513 |         log<level::ERR>(e.what()); | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 514 |         return ipmi::responseUnspecifiedError(); | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 515 |     } | 
 | 516 |  | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 517 |     hostTime << "Host time:" | 
 | 518 |              << duration_cast<seconds>(microseconds(host_time_usec)).count(); | 
| Nagaraju Goruganti | 8960b7c | 2018-04-29 22:38:40 -0500 | [diff] [blame] | 519 |     log<level::DEBUG>(hostTime.str().c_str()); | 
 | 520 |  | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 521 |     // Time is really long int but IPMI wants just uint32. This works okay until | 
 | 522 |     // the number of seconds since 1970 overflows uint32 size.. Still a whole | 
 | 523 |     // lot of time here to even think about that. | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 524 |     return ipmi::responseSuccess( | 
 | 525 |         duration_cast<seconds>(microseconds(host_time_usec)).count()); | 
| Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 526 | } | 
 | 527 |  | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 528 | /** @brief implements the set SEL time command | 
 | 529 |  *  @param selDeviceTime - epoch time | 
 | 530 |  *        -local time as the number of seconds from 00:00:00, January 1, 1970 | 
 | 531 |  *  @returns IPMI completion code | 
 | 532 |  */ | 
 | 533 | ipmi::RspType<> ipmiStorageSetSelTime(uint32_t selDeviceTime) | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 534 | { | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 535 |     using namespace std::chrono; | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 536 |     microseconds usec{seconds(selDeviceTime)}; | 
| Norman James | 8233044 | 2015-11-19 16:53:26 -0600 | [diff] [blame] | 537 |  | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 538 |     try | 
 | 539 |     { | 
 | 540 |         sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; | 
 | 541 |         auto service = ipmi::getService(bus, TIME_INTERFACE, HOST_TIME_PATH); | 
| Vernon Mauery | 16b8693 | 2019-05-01 08:36:11 -0700 | [diff] [blame] | 542 |         std::variant<uint64_t> value{usec.count()}; | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 543 |  | 
 | 544 |         // Set host time | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 545 |         auto method = bus.new_method_call(service.c_str(), HOST_TIME_PATH, | 
 | 546 |                                           DBUS_PROPERTIES, "Set"); | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 547 |  | 
 | 548 |         method.append(TIME_INTERFACE, PROPERTY_ELAPSED, value); | 
 | 549 |         auto reply = bus.call(method); | 
 | 550 |         if (reply.is_method_error()) | 
 | 551 |         { | 
 | 552 |             log<level::ERR>("Error setting time", | 
 | 553 |                             entry("SERVICE=%s", service.c_str()), | 
 | 554 |                             entry("PATH=%s", HOST_TIME_PATH)); | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 555 |             return ipmi::responseUnspecifiedError(); | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 556 |         } | 
| Norman James | 8233044 | 2015-11-19 16:53:26 -0600 | [diff] [blame] | 557 |     } | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 558 |     catch (InternalFailure& e) | 
 | 559 |     { | 
 | 560 |         log<level::ERR>(e.what()); | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 561 |         return ipmi::responseUnspecifiedError(); | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 562 |     } | 
| Tom Joseph | 30fd0a1 | 2019-09-24 06:53:22 +0530 | [diff] [blame] | 563 |     catch (const std::exception& e) | 
| Lei YU | e893939 | 2017-06-15 10:45:05 +0800 | [diff] [blame] | 564 |     { | 
 | 565 |         log<level::ERR>(e.what()); | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 566 |         return ipmi::responseUnspecifiedError(); | 
| Norman James | 8233044 | 2015-11-19 16:53:26 -0600 | [diff] [blame] | 567 |     } | 
| Vishwanatha Subbanna | 5fba7a6 | 2016-09-01 14:06:07 +0530 | [diff] [blame] | 568 |  | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 569 |     return ipmi::responseSuccess(); | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 570 | } | 
 | 571 |  | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 572 | /** @brief implements the reserve SEL command | 
 | 573 |  *  @returns IPMI completion code plus response data | 
 | 574 |  *   - SEL reservation ID. | 
 | 575 |  */ | 
 | 576 | ipmi::RspType<uint16_t> ipmiStorageReserveSel() | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 577 | { | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 578 |     return ipmi::responseSuccess(reserveSel()); | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 579 | } | 
 | 580 |  | 
| anil kumar appana | 2c7db1d | 2019-05-28 11:20:19 +0000 | [diff] [blame] | 581 | /** @brief implements the Add SEL entry command | 
 | 582 |  * @request | 
 | 583 |  * | 
 | 584 |  *   - recordID      ID used for SEL Record access | 
 | 585 |  *   - recordType    Record Type | 
 | 586 |  *   - timeStamp     Time when event was logged. LS byte first | 
 | 587 |  *   - generatorID   software ID if event was generated from | 
 | 588 |  *                   system software | 
 | 589 |  *   - evmRev        event message format version | 
 | 590 |  *   - sensorType    sensor type code for service that generated | 
 | 591 |  *                   the event | 
 | 592 |  *   - sensorNumber  number of sensors that generated the event | 
 | 593 |  *   - eventDir     event dir | 
 | 594 |  *   - eventData    event data field contents | 
 | 595 |  * | 
 | 596 |  *  @returns ipmi completion code plus response data | 
 | 597 |  *   - RecordID of the Added SEL entry | 
 | 598 |  */ | 
 | 599 | ipmi::RspType<uint16_t // recordID of the Added SEL entry | 
 | 600 |               > | 
 | 601 |     ipmiStorageAddSEL(uint16_t recordID, uint8_t recordType, uint32_t timeStamp, | 
 | 602 |                       uint16_t generatorID, uint8_t evmRev, uint8_t sensorType, | 
 | 603 |                       uint8_t sensorNumber, uint8_t eventDir, | 
 | 604 |                       std::array<uint8_t, eventDataSize> eventData) | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 605 | { | 
| Jason M. Bills | 13e67c8 | 2018-09-10 14:12:16 -0700 | [diff] [blame] | 606 |     // Per the IPMI spec, need to cancel the reservation when a SEL entry is | 
 | 607 |     // added | 
 | 608 |     cancelSELReservation(); | 
| Tom Joseph | b647d5b | 2017-10-31 17:25:33 +0530 | [diff] [blame] | 609 |     // Hostboot sends SEL with OEM record type 0xDE to indicate that there is | 
 | 610 |     // a maintenance procedure associated with eSEL record. | 
 | 611 |     static constexpr auto procedureType = 0xDE; | 
| anil kumar appana | 2c7db1d | 2019-05-28 11:20:19 +0000 | [diff] [blame] | 612 |     if (recordType == procedureType) | 
| Tom Joseph | b647d5b | 2017-10-31 17:25:33 +0530 | [diff] [blame] | 613 |     { | 
 | 614 |         // In the OEM record type 0xDE, byte 11 in the SEL record indicate the | 
 | 615 |         // procedure number. | 
| anil kumar appana | 2c7db1d | 2019-05-28 11:20:19 +0000 | [diff] [blame] | 616 |         createProcedureLogEntry(sensorType); | 
| Tom Joseph | b647d5b | 2017-10-31 17:25:33 +0530 | [diff] [blame] | 617 |     } | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 618 |  | 
| anil kumar appana | 2c7db1d | 2019-05-28 11:20:19 +0000 | [diff] [blame] | 619 |     return ipmi::responseSuccess(recordID); | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 620 | } | 
 | 621 |  | 
| Kirill Pakhomov | fa6e209 | 2020-04-24 18:57:15 +0300 | [diff] [blame] | 622 | bool isFruPresent(const std::string& fruPath) | 
 | 623 | { | 
 | 624 |     using namespace ipmi::fru; | 
 | 625 |  | 
 | 626 |     sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()}; | 
 | 627 |  | 
 | 628 |     auto propValue = | 
 | 629 |         ipmi::getDbusProperty(bus, invMgrInterface, invObjPath + fruPath, | 
 | 630 |                               invItemInterface, itemPresentProp); | 
 | 631 |  | 
 | 632 |     return std::get<bool>(propValue); | 
 | 633 | } | 
 | 634 |  | 
| Pradeep Kumar | b0c794d | 2019-05-02 13:09:14 +0000 | [diff] [blame] | 635 | /** @brief implements the get FRU Inventory Area Info command | 
 | 636 |  * | 
 | 637 |  *  @returns IPMI completion code plus response data | 
 | 638 |  *   - FRU Inventory area size in bytes, | 
 | 639 |  *   - access bit | 
 | 640 |  **/ | 
 | 641 | ipmi::RspType<uint16_t, // FRU Inventory area size in bytes, | 
 | 642 |               uint8_t   // access size (bytes / words) | 
 | 643 |               > | 
 | 644 |     ipmiStorageGetFruInvAreaInfo(uint8_t fruID) | 
| Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 645 | { | 
| Tom Joseph | 187f564 | 2018-03-29 13:49:06 +0530 | [diff] [blame] | 646 |  | 
| Pradeep Kumar | b0c794d | 2019-05-02 13:09:14 +0000 | [diff] [blame] | 647 |     auto iter = frus.find(fruID); | 
| Tom Joseph | 187f564 | 2018-03-29 13:49:06 +0530 | [diff] [blame] | 648 |     if (iter == frus.end()) | 
 | 649 |     { | 
| Pradeep Kumar | b0c794d | 2019-05-02 13:09:14 +0000 | [diff] [blame] | 650 |         return ipmi::responseSensorInvalid(); | 
| Tom Joseph | 187f564 | 2018-03-29 13:49:06 +0530 | [diff] [blame] | 651 |     } | 
 | 652 |  | 
| Kirill Pakhomov | fa6e209 | 2020-04-24 18:57:15 +0300 | [diff] [blame] | 653 |     auto path = iter->second[0].path; | 
 | 654 |     if (!isFruPresent(path)) | 
 | 655 |     { | 
 | 656 |         return ipmi::responseSensorInvalid(); | 
 | 657 |     } | 
 | 658 |  | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 659 |     try | 
 | 660 |     { | 
| Pradeep Kumar | b0c794d | 2019-05-02 13:09:14 +0000 | [diff] [blame] | 661 |         return ipmi::responseSuccess( | 
 | 662 |             static_cast<uint16_t>(getFruAreaData(fruID).size()), | 
 | 663 |             static_cast<uint8_t>(AccessMode::bytes)); | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 664 |     } | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 665 |     catch (const InternalFailure& e) | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 666 |     { | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 667 |         log<level::ERR>(e.what()); | 
| Pradeep Kumar | b0c794d | 2019-05-02 13:09:14 +0000 | [diff] [blame] | 668 |         return ipmi::responseUnspecifiedError(); | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 669 |     } | 
| Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 670 | } | 
 | 671 |  | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 672 | /**@brief implements the Read FRU Data command | 
 | 673 |  * @param fruDeviceId - FRU device ID. FFh = reserved | 
 | 674 |  * @param offset      - FRU inventory offset to read | 
 | 675 |  * @param readCount   - count to read | 
 | 676 |  * | 
 | 677 |  * @return IPMI completion code plus response data | 
 | 678 |  * - returnCount - response data count. | 
 | 679 |  * - data        -  response data | 
 | 680 |  */ | 
 | 681 | ipmi::RspType<uint8_t,              // count returned | 
 | 682 |               std::vector<uint8_t>> // FRU data | 
 | 683 |     ipmiStorageReadFruData(uint8_t fruDeviceId, uint16_t offset, | 
 | 684 |                            uint8_t readCount) | 
| Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 685 | { | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 686 |     if (fruDeviceId == 0xFF) | 
| Tom Joseph | 187f564 | 2018-03-29 13:49:06 +0530 | [diff] [blame] | 687 |     { | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 688 |         return ipmi::responseInvalidFieldRequest(); | 
| Tom Joseph | 187f564 | 2018-03-29 13:49:06 +0530 | [diff] [blame] | 689 |     } | 
 | 690 |  | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 691 |     auto iter = frus.find(fruDeviceId); | 
 | 692 |     if (iter == frus.end()) | 
 | 693 |     { | 
 | 694 |         return ipmi::responseSensorInvalid(); | 
 | 695 |     } | 
 | 696 |  | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 697 |     try | 
 | 698 |     { | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 699 |         const auto& fruArea = getFruAreaData(fruDeviceId); | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 700 |         auto size = fruArea.size(); | 
| Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 701 |  | 
| Tom Joseph | efcd68b | 2018-04-26 18:46:27 +0530 | [diff] [blame] | 702 |         if (offset >= size) | 
 | 703 |         { | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 704 |             return ipmi::responseParmOutOfRange(); | 
| Tom Joseph | efcd68b | 2018-04-26 18:46:27 +0530 | [diff] [blame] | 705 |         } | 
 | 706 |  | 
| Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 707 |         // Write the count of response data. | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 708 |         uint8_t returnCount; | 
 | 709 |         if ((offset + readCount) <= size) | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 710 |         { | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 711 |             returnCount = readCount; | 
| Nagaraju Goruganti | 7f2d7c9 | 2018-03-21 11:18:30 -0500 | [diff] [blame] | 712 |         } | 
 | 713 |         else | 
 | 714 |         { | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 715 |             returnCount = size - offset; | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 716 |         } | 
| Ratan Gupta | 2848d60 | 2018-01-31 20:39:20 +0530 | [diff] [blame] | 717 |  | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 718 |         std::vector<uint8_t> fruData((fruArea.begin() + offset), | 
 | 719 |                                      (fruArea.begin() + offset + returnCount)); | 
| Ratan Gupta | 2848d60 | 2018-01-31 20:39:20 +0530 | [diff] [blame] | 720 |  | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 721 |         return ipmi::responseSuccess(returnCount, fruData); | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 722 |     } | 
 | 723 |     catch (const InternalFailure& e) | 
 | 724 |     { | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 725 |         log<level::ERR>(e.what()); | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 726 |         return ipmi::responseUnspecifiedError(); | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 727 |     } | 
| Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 728 | } | 
 | 729 |  | 
| Pradeep Kumar | b60e840 | 2019-05-06 15:17:01 +0000 | [diff] [blame] | 730 | ipmi::RspType<uint8_t,  // SDR version | 
 | 731 |               uint16_t, // record count LS first | 
 | 732 |               uint16_t, // free space in bytes, LS first | 
 | 733 |               uint32_t, // addition timestamp LS first | 
 | 734 |               uint32_t, // deletion timestamp LS first | 
 | 735 |               uint8_t>  // operation Support | 
 | 736 |     ipmiGetRepositoryInfo() | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 737 | { | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 738 |  | 
| Pradeep Kumar | b60e840 | 2019-05-06 15:17:01 +0000 | [diff] [blame] | 739 |     constexpr uint8_t sdrVersion = 0x51; | 
 | 740 |     constexpr uint16_t freeSpace = 0xFFFF; | 
 | 741 |     constexpr uint32_t additionTimestamp = 0x0; | 
 | 742 |     constexpr uint32_t deletionTimestamp = 0x0; | 
 | 743 |     constexpr uint8_t operationSupport = 0; | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 744 |  | 
| Patrick Venture | db0cbe6 | 2019-09-09 14:47:22 -0700 | [diff] [blame] | 745 |     uint16_t records = frus.size() + ipmi::sensor::sensors.size(); | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 746 |  | 
| Pradeep Kumar | b60e840 | 2019-05-06 15:17:01 +0000 | [diff] [blame] | 747 |     return ipmi::responseSuccess(sdrVersion, records, freeSpace, | 
 | 748 |                                  additionTimestamp, deletionTimestamp, | 
 | 749 |                                  operationSupport); | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 750 | } | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 751 |  | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 752 | void register_netfn_storage_functions() | 
 | 753 | { | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 754 |     // <Get SEL Info> | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 755 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 756 |                           ipmi::storage::cmdGetSelInfo, ipmi::Privilege::User, | 
 | 757 |                           ipmiStorageGetSelInfo); | 
| Tom Joseph | 6f7deaa | 2017-06-30 19:03:54 +0530 | [diff] [blame] | 758 |  | 
| Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 759 |     // <Get SEL Time> | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 760 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 761 |                           ipmi::storage::cmdGetSelTime, ipmi::Privilege::User, | 
 | 762 |                           ipmiStorageGetSelTime); | 
| Adriana Kobylak | 8e30f2a | 2015-10-20 10:23:51 -0500 | [diff] [blame] | 763 |  | 
| Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 764 |     // <Set SEL Time> | 
| jayaprakash Mutyala | db2e8c4 | 2019-05-03 01:38:01 +0000 | [diff] [blame] | 765 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 766 |                           ipmi::storage::cmdSetSelTime, | 
 | 767 |                           ipmi::Privilege::Operator, ipmiStorageSetSelTime); | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 768 |  | 
| Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 769 |     // <Reserve SEL> | 
| jayaprakash Mutyala | b755772 | 2019-05-02 21:13:30 +0000 | [diff] [blame] | 770 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 771 |                           ipmi::storage::cmdReserveSel, ipmi::Privilege::User, | 
 | 772 |                           ipmiStorageReserveSel); | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 773 |     // <Get SEL Entry> | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 774 |     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY, NULL, | 
 | 775 |                            getSELEntry, PRIVILEGE_USER); | 
| Tom Joseph | a495339 | 2017-06-30 19:09:47 +0530 | [diff] [blame] | 776 |  | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 777 |     // <Delete SEL Entry> | 
| Pradeep Kumar | 00a18d0 | 2019-04-26 17:04:28 +0000 | [diff] [blame] | 778 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 779 |                           ipmi::storage::cmdDeleteSelEntry, | 
 | 780 |                           ipmi::Privilege::Operator, deleteSELEntry); | 
| Tom Joseph | 8f4a2aa | 2017-06-30 19:12:49 +0530 | [diff] [blame] | 781 |  | 
| Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 782 |     // <Add SEL Entry> | 
| anil kumar appana | 2c7db1d | 2019-05-28 11:20:19 +0000 | [diff] [blame] | 783 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 784 |                           ipmi::storage::cmdAddSelEntry, | 
 | 785 |                           ipmi::Privilege::Operator, ipmiStorageAddSEL); | 
 | 786 |  | 
| Tom Joseph | 2f05bb5 | 2017-06-30 19:14:49 +0530 | [diff] [blame] | 787 |     // <Clear SEL> | 
| Pradeep Kumar | 4a5a99a | 2019-04-26 15:22:39 +0000 | [diff] [blame] | 788 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 789 |                           ipmi::storage::cmdClearSel, ipmi::Privilege::Operator, | 
 | 790 |                           clearSEL); | 
 | 791 |  | 
| Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 792 |     // <Get FRU Inventory Area Info> | 
| Pradeep Kumar | b0c794d | 2019-05-02 13:09:14 +0000 | [diff] [blame] | 793 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 794 |                           ipmi::storage::cmdGetFruInventoryAreaInfo, | 
 | 795 |                           ipmi::Privilege::User, ipmiStorageGetFruInvAreaInfo); | 
| Marri Devender Rao | fa7b4e2 | 2017-07-03 00:52:20 -0500 | [diff] [blame] | 796 |  | 
| Jason M. Bills | b5248c9 | 2019-06-24 15:53:08 -0700 | [diff] [blame] | 797 |     // <READ FRU Data> | 
| anil kumar appana | 5b7c326 | 2019-05-27 18:10:23 +0000 | [diff] [blame] | 798 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 799 |                           ipmi::storage::cmdReadFruData, | 
 | 800 |                           ipmi::Privilege::Operator, ipmiStorageReadFruData); | 
| Marri Devender Rao | cac383b | 2017-07-03 13:24:27 -0500 | [diff] [blame] | 801 |  | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 802 |     // <Get Repository Info> | 
| Pradeep Kumar | b60e840 | 2019-05-06 15:17:01 +0000 | [diff] [blame] | 803 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 804 |                           ipmi::storage::cmdGetSdrRepositoryInfo, | 
 | 805 |                           ipmi::Privilege::User, ipmiGetRepositoryInfo); | 
| Dhruvaraj Subhashchandran | e66c3b0 | 2018-02-07 01:21:56 -0600 | [diff] [blame] | 806 |  | 
| Tom Joseph | 5ca5095 | 2018-02-22 00:33:38 +0530 | [diff] [blame] | 807 |     // <Reserve SDR Repository> | 
| jayaprakash Mutyala | d957823 | 2019-05-13 20:22:50 +0000 | [diff] [blame] | 808 |     ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage, | 
 | 809 |                           ipmi::storage::cmdReserveSdrRepository, | 
 | 810 |                           ipmi::Privilege::User, ipmiSensorReserveSdr); | 
| Tom Joseph | 5ca5095 | 2018-02-22 00:33:38 +0530 | [diff] [blame] | 811 |  | 
 | 812 |     // <Get SDR> | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 813 |     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SDR, nullptr, | 
 | 814 |                            ipmi_sen_get_sdr, PRIVILEGE_USER); | 
| Tom Joseph | 5ca5095 | 2018-02-22 00:33:38 +0530 | [diff] [blame] | 815 |  | 
| Marri Devender Rao | 908f750 | 2017-07-10 01:49:54 -0500 | [diff] [blame] | 816 |     ipmi::fru::registerCallbackHandler(); | 
| Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 817 |     return; | 
 | 818 | } |