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