blob: 5ac17d11e85c0e2b619525b934e638e75c8f712a [file] [log] [blame]
Tomd700e762016-09-20 18:24:13 +05301#include <mapper.h>
Chris Austenac4604a2015-10-13 12:43:27 -05002#include <stdio.h>
3#include <string.h>
Tom Josephbe703f72017-03-09 12:34:35 +05304#include <bitset>
Chris Austen10ccc0f2015-12-10 18:27:04 -06005#include <systemd/sd-bus.h>
Tom Josephbe703f72017-03-09 12:34:35 +05306#include "host-ipmid/ipmid-api.h"
7#include <phosphor-logging/log.hpp>
Tomd700e762016-09-20 18:24:13 +05308#include "ipmid.hpp"
Tom Josephbe703f72017-03-09 12:34:35 +05309#include "sensorhandler.h"
10#include "types.hpp"
11#include "utils.hpp"
Chris Austenac4604a2015-10-13 12:43:27 -050012
Chris Austen8a45e7c2015-10-15 00:31:46 -050013extern int updateSensorRecordFromSSRAESC(const void *);
Tomd700e762016-09-20 18:24:13 +053014extern sd_bus *bus;
Tom Josephbe703f72017-03-09 12:34:35 +053015extern const ipmi::sensor::IdInfoMap sensors;
16using namespace phosphor::logging;
Chris Austenac4604a2015-10-13 12:43:27 -050017
18void register_netfn_sen_functions() __attribute__((constructor));
19
Chris Austen0012e9b2015-10-22 01:37:46 -050020struct sensorTypemap_t {
21 uint8_t number;
Chris Austend7cf0e42015-11-07 14:27:12 -060022 uint8_t typecode;
Chris Austen0012e9b2015-10-22 01:37:46 -050023 char dbusname[32];
24} ;
25
26
27sensorTypemap_t g_SensorTypeMap[] = {
28
Chris Austend7cf0e42015-11-07 14:27:12 -060029 {0x01, 0x6F, "Temp"},
30 {0x0C, 0x6F, "DIMM"},
31 {0x0C, 0x6F, "MEMORY_BUFFER"},
32 {0x07, 0x6F, "PROC"},
33 {0x07, 0x6F, "CORE"},
34 {0x07, 0x6F, "CPU"},
35 {0x0F, 0x6F, "BootProgress"},
36 {0xe9, 0x09, "OccStatus"}, // E9 is an internal mapping to handle sensor type code os 0x09
37 {0xC3, 0x6F, "BootCount"},
38 {0x1F, 0x6F, "OperatingSystemStatus"},
Chris Austen800ba712015-12-03 15:31:00 -060039 {0x12, 0x6F, "SYSTEM_EVENT"},
40 {0xC7, 0x03, "SYSTEM"},
41 {0xC7, 0x03, "MAIN_PLANAR"},
Chris Austen10ccc0f2015-12-10 18:27:04 -060042 {0xC2, 0x6F, "PowerCap"},
Dhruvaraj S07248292017-03-21 02:14:52 -050043 {0xD8, 0x03, "PowerSupplyRedundancy"},
Chris Austend7cf0e42015-11-07 14:27:12 -060044 {0xFF, 0x00, ""},
Chris Austen0012e9b2015-10-22 01:37:46 -050045};
46
47
Chris Austenac4604a2015-10-13 12:43:27 -050048struct sensor_data_t {
49 uint8_t sennum;
50} __attribute__ ((packed)) ;
51
Chris Austen10ccc0f2015-12-10 18:27:04 -060052struct sensorreadingresp_t {
53 uint8_t value;
54 uint8_t operation;
55 uint8_t indication[2];
56} __attribute__ ((packed)) ;
Chris Austenac4604a2015-10-13 12:43:27 -050057
Tomd700e762016-09-20 18:24:13 +053058// Use a lookup table to find the interface name of a specific sensor
59// This will be used until an alternative is found. this is the first
60// step for mapping IPMI
61int find_interface_property_fru_type(dbus_interface_t *interface, const char *property_name, char *property_value) {
62
63 char *str1;
64 sd_bus_error error = SD_BUS_ERROR_NULL;
65 sd_bus_message *reply = NULL, *m=NULL;
66
67
68 int r;
69
70 r = sd_bus_message_new_method_call(bus,&m,interface->bus,interface->path,"org.freedesktop.DBus.Properties","Get");
71 if (r < 0) {
72 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
73 fprintf(stderr,"Bus: %s Path: %s Interface: %s \n",
74 interface->bus, interface->path, interface->interface);
75 goto final;
76 }
77
78 r = sd_bus_message_append(m, "ss", "org.openbmc.InventoryItem", property_name);
79 if (r < 0) {
80 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
81 fprintf(stderr,"Bus: %s Path: %s Interface: %s \n",
82 interface->bus, interface->path, interface->interface);
83 goto final;
84 }
85
86 r = sd_bus_call(bus, m, 0, &error, &reply);
87 if (r < 0) {
88 fprintf(stderr, "Failed to call the method: %s", strerror(-r));
89 goto final;
90 }
91
92 r = sd_bus_message_read(reply, "v", "s", &str1) ;
93 if (r < 0) {
94 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
95 goto final;
96 }
97
98 strcpy(property_value, str1);
99
100final:
101
102 sd_bus_error_free(&error);
103 m = sd_bus_message_unref(m);
104 reply = sd_bus_message_unref(reply);
105
106 return r;
107}
108
109
110// Use a lookup table to find the interface name of a specific sensor
111// This will be used until an alternative is found. this is the first
112// step for mapping IPMI
113int find_openbmc_path(const char *type, const uint8_t num, dbus_interface_t *interface) {
114 char *busname = NULL;
115 const char *iface = "org.openbmc.managers.System";
116 const char *objname = "/org/openbmc/managers/System";
117 char *str1 = NULL, *str2, *str3;
118 sd_bus_error error = SD_BUS_ERROR_NULL;
119 sd_bus_message *reply = NULL;
120
121
122 int r;
123 r = mapper_get_service(bus, objname, &busname);
124 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400125 fprintf(stderr, "Failed to get %s busname: %s\n",
126 objname, strerror(-r));
Tomd700e762016-09-20 18:24:13 +0530127 goto final;
128 }
129
130 r = sd_bus_call_method(bus,busname,objname,iface, "getObjectFromByteId",
131 &error, &reply, "sy", type, num);
132 if (r < 0) {
133 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
134 goto final;
135 }
136
137 r = sd_bus_message_read(reply, "(ss)", &str2, &str3);
138 if (r < 0) {
139 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
140 goto final;
141 }
142
143 r = mapper_get_service(bus, str2, &str1);
144 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400145 fprintf(stderr, "Failed to get %s busname: %s\n",
146 str2, strerror(-r));
Tomd700e762016-09-20 18:24:13 +0530147 goto final;
148 }
149
150 strncpy(interface->bus, str1, MAX_DBUS_PATH);
151 strncpy(interface->path, str2, MAX_DBUS_PATH);
152 strncpy(interface->interface, str3, MAX_DBUS_PATH);
153
154 interface->sensornumber = num;
155
156final:
157
158 sd_bus_error_free(&error);
159 reply = sd_bus_message_unref(reply);
160 free(busname);
161 free(str1);
162
163 return r;
164}
165
166
167/////////////////////////////////////////////////////////////////////
168//
169// Routines used by ipmi commands wanting to interact on the dbus
170//
171/////////////////////////////////////////////////////////////////////
172int set_sensor_dbus_state_s(uint8_t number, const char *method, const char *value) {
173
174
175 dbus_interface_t a;
176 int r;
177 sd_bus_error error = SD_BUS_ERROR_NULL;
178 sd_bus_message *m=NULL;
179
180 fprintf(ipmidbus, "Attempting to set a dbus Variant Sensor 0x%02x via %s with a value of %s\n",
181 number, method, value);
182
183 r = find_openbmc_path("SENSOR", number, &a);
184
185 if (r < 0) {
186 fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
187 return 0;
188 }
189
190 r = sd_bus_message_new_method_call(bus,&m,a.bus,a.path,a.interface,method);
191 if (r < 0) {
192 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
193 goto final;
194 }
195
196 r = sd_bus_message_append(m, "v", "s", value);
197 if (r < 0) {
198 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
199 goto final;
200 }
201
202
203 r = sd_bus_call(bus, m, 0, &error, NULL);
204 if (r < 0) {
205 fprintf(stderr, "Failed to call the method: %s", strerror(-r));
206 }
207
208final:
209 sd_bus_error_free(&error);
210 m = sd_bus_message_unref(m);
211
212 return 0;
213}
214int set_sensor_dbus_state_y(uint8_t number, const char *method, const uint8_t value) {
215
216
217 dbus_interface_t a;
218 int r;
219 sd_bus_error error = SD_BUS_ERROR_NULL;
220 sd_bus_message *m=NULL;
221
222 fprintf(ipmidbus, "Attempting to set a dbus Variant Sensor 0x%02x via %s with a value of 0x%02x\n",
223 number, method, value);
224
225 r = find_openbmc_path("SENSOR", number, &a);
226
227 if (r < 0) {
228 fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
229 return 0;
230 }
231
232 r = sd_bus_message_new_method_call(bus,&m,a.bus,a.path,a.interface,method);
233 if (r < 0) {
234 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
235 goto final;
236 }
237
238 r = sd_bus_message_append(m, "v", "i", value);
239 if (r < 0) {
240 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
241 goto final;
242 }
243
244
245 r = sd_bus_call(bus, m, 0, &error, NULL);
246 if (r < 0) {
247 fprintf(stderr, "12 Failed to call the method: %s", strerror(-r));
248 }
249
250final:
251 sd_bus_error_free(&error);
252 m = sd_bus_message_unref(m);
253
254 return 0;
255}
256
Chris Austen0012e9b2015-10-22 01:37:46 -0500257uint8_t dbus_to_sensor_type(char *p) {
Chris Austenac4604a2015-10-13 12:43:27 -0500258
Chris Austen0012e9b2015-10-22 01:37:46 -0500259 sensorTypemap_t *s = g_SensorTypeMap;
260 char r=0;
Chris Austenac4604a2015-10-13 12:43:27 -0500261
Chris Austen0012e9b2015-10-22 01:37:46 -0500262 while (s->number != 0xFF) {
263 if (!strcmp(s->dbusname,p)) {
264 r = s->number;
265 break;
Chris Austenac4604a2015-10-13 12:43:27 -0500266 }
Chris Austen0012e9b2015-10-22 01:37:46 -0500267 s++;
Chris Austenac4604a2015-10-13 12:43:27 -0500268 }
269
Chris Austend7cf0e42015-11-07 14:27:12 -0600270
Chris Austen0012e9b2015-10-22 01:37:46 -0500271 if (s->number == 0xFF)
272 printf("Failed to find Sensor Type %s\n", p);
Chris Austenac4604a2015-10-13 12:43:27 -0500273
Chris Austen0012e9b2015-10-22 01:37:46 -0500274 return r;
Chris Austenac4604a2015-10-13 12:43:27 -0500275}
276
Chris Austen0012e9b2015-10-22 01:37:46 -0500277
278uint8_t dbus_to_sensor_type_from_dbus(dbus_interface_t *a) {
279 char fru_type_name[64];
280 int r= 0;
281
282 r = find_interface_property_fru_type(a, "fru_type", fru_type_name);
283 if (r<0) {
284 fprintf(stderr, "Failed to get a fru type: %s", strerror(-r));
285 return -1;
286 } else {
287 return dbus_to_sensor_type(fru_type_name);
288 }
289}
290
291
292uint8_t find_sensor(uint8_t sensor_number) {
293
294 dbus_interface_t a;
295 char *p;
Brad Bishop56003452016-10-05 21:49:19 -0400296 int r;
297 uint8_t type;
Chris Austen0012e9b2015-10-22 01:37:46 -0500298
299 r = find_openbmc_path("SENSOR", sensor_number, &a);
300
301 if (r < 0) { return 0; }
302
303 // This is where sensors that do not exist in dbus but do
304 // exist in the host code stop. This should indicate it
305 // is not a supported sensor
Chris Austend7cf0e42015-11-07 14:27:12 -0600306 if (a.interface[0] == 0) { return 0;}
Chris Austen0012e9b2015-10-22 01:37:46 -0500307
308 if (strstr(a.interface, "InventoryItem")) {
309 // InventoryItems are real frus. So need to get the
310 // fru_type property
Brad Bishop56003452016-10-05 21:49:19 -0400311 type = dbus_to_sensor_type_from_dbus(&a);
Chris Austen0012e9b2015-10-22 01:37:46 -0500312 } else {
313 // Non InventoryItems
314 p = strrchr (a.path, '/');
Brad Bishop56003452016-10-05 21:49:19 -0400315 type = dbus_to_sensor_type(p+1);
Chris Austen0012e9b2015-10-22 01:37:46 -0500316 }
317
Brad Bishop56003452016-10-05 21:49:19 -0400318 return type;
Chris Austen0012e9b2015-10-22 01:37:46 -0500319 }
320
Chris Austen10ccc0f2015-12-10 18:27:04 -0600321
322
323
324
Chris Austen0012e9b2015-10-22 01:37:46 -0500325ipmi_ret_t ipmi_sen_get_sensor_type(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
326 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500327 ipmi_data_len_t data_len, ipmi_context_t context)
328{
329 sensor_data_t *reqptr = (sensor_data_t*)request;
330 ipmi_ret_t rc = IPMI_CC_OK;
331
332 printf("IPMI GET_SENSOR_TYPE [0x%02X]\n",reqptr->sennum);
333
334 // TODO Not sure what the System-event-sensor is suppose to return
335 // need to ask Hostboot team
336 unsigned char buf[] = {0x00,0x6F};
337
Chris Austen0012e9b2015-10-22 01:37:46 -0500338 buf[0] = find_sensor(reqptr->sennum);
339
340 // HACK UNTIL Dbus gets updated or we find a better way
341 if (buf[0] == 0) {
Chris Austen800ba712015-12-03 15:31:00 -0600342 rc = IPMI_CC_SENSOR_INVALID;
Chris Austen0012e9b2015-10-22 01:37:46 -0500343 }
344
Chris Austenac4604a2015-10-13 12:43:27 -0500345
346 *data_len = sizeof(buf);
347 memcpy(response, &buf, *data_len);
348
Chris Austenac4604a2015-10-13 12:43:27 -0500349 return rc;
350}
351
Tom Josephbe703f72017-03-09 12:34:35 +0530352ipmi_ret_t setSensorReading(void *request)
353{
354 auto cmdData = static_cast<SetSensorReadingReq *>(request);
Chris Austenac4604a2015-10-13 12:43:27 -0500355
Tom Josephbe703f72017-03-09 12:34:35 +0530356 auto assertionStates =
357 (static_cast<uint16_t>(cmdData->assertOffset8_14)) << 8 |
358 cmdData->assertOffset0_7;
359
360 auto deassertionStates =
361 (static_cast<uint16_t>(cmdData->deassertOffset8_14)) << 8 |
362 cmdData->deassertOffset0_7;
363
364 std::bitset<16> assertionSet(assertionStates);
365 std::bitset<16> deassertionSet(deassertionStates);
366
367 // Check if the Sensor Number is present
368 auto iter = sensors.find(cmdData->number);
369 if (iter == sensors.end())
370 {
371 return IPMI_CC_SENSOR_INVALID;
372 }
373
374 auto& interfaceList = iter->second.sensorInterfaces;
375 if (interfaceList.empty())
376 {
377 log<level::ERR>("Interface List empty for the sensor",
378 entry("Sensor Number = %d", cmdData->number));
379 return IPMI_CC_UNSPECIFIED_ERROR;
380 }
381
382 ipmi::sensor::ObjectMap objects;
383 ipmi::sensor::InterfaceMap interfaces;
384 for (const auto& interface : interfaceList)
385 {
386 for (const auto& property : interface.second)
387 {
388 ipmi::sensor::PropertyMap props;
389 bool valid = false;
390 for (const auto& value : property.second)
391 {
392 if (assertionSet.test(value.first))
393 {
394 props.emplace(property.first, value.second.assert);
395 valid = true;
396 }
397 else if (deassertionSet.test(value.first))
398 {
399 props.emplace(property.first, value.second.deassert);
400 valid = true;
401 }
402 }
403 if (valid)
404 {
405 interfaces.emplace(interface.first, std::move(props));
406 }
407 }
408 }
409 objects.emplace(iter->second.sensorPath, std::move(interfaces));
410
411 auto bus = sdbusplus::bus::new_default();
412 using namespace std::string_literals;
413 static const auto intf = "xyz.openbmc_project.Inventory.Manager"s;
414 static const auto path = "/xyz/openbmc_project/inventory"s;
415 std::string service;
416
417 try
418 {
419 service = ipmi::getService(bus, intf, path);
420
421 // Update the inventory manager
422 auto pimMsg = bus.new_method_call(service.c_str(),
423 path.c_str(),
424 intf.c_str(),
425 "Notify");
426 pimMsg.append(std::move(objects));
427 auto inventoryMgrResponseMsg = bus.call(pimMsg);
428 if (inventoryMgrResponseMsg.is_method_error())
429 {
430 log<level::ERR>("Error in notify call");
431 return IPMI_CC_UNSPECIFIED_ERROR;
432 }
433 }
434 catch (const std::runtime_error& e)
435 {
436 log<level::ERR>(e.what());
437 return IPMI_CC_UNSPECIFIED_ERROR;
438 }
439
440 return IPMI_CC_OK;
441}
Chris Austenac4604a2015-10-13 12:43:27 -0500442
Chris Austen0012e9b2015-10-22 01:37:46 -0500443ipmi_ret_t ipmi_sen_set_sensor(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
444 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500445 ipmi_data_len_t data_len, ipmi_context_t context)
446{
Chris Austenac4604a2015-10-13 12:43:27 -0500447 sensor_data_t *reqptr = (sensor_data_t*)request;
Chris Austenac4604a2015-10-13 12:43:27 -0500448
Chris Austen0012e9b2015-10-22 01:37:46 -0500449 printf("IPMI SET_SENSOR [0x%02x]\n",reqptr->sennum);
Chris Austenac4604a2015-10-13 12:43:27 -0500450
Tom Josephbe703f72017-03-09 12:34:35 +0530451 /*
452 * This would support the Set Sensor Reading command for the presence
453 * and functional state of Processor, Core & DIMM. For the remaining
454 * sensors the existing support is invoked.
455 */
456 auto ipmiRC = setSensorReading(request);
457
458 if(ipmiRC == IPMI_CC_SENSOR_INVALID)
459 {
460 updateSensorRecordFromSSRAESC(reqptr);
461 ipmiRC = IPMI_CC_OK;
462 }
Chris Austen8a45e7c2015-10-15 00:31:46 -0500463
Chris Austenac4604a2015-10-13 12:43:27 -0500464 *data_len=0;
Tom Josephbe703f72017-03-09 12:34:35 +0530465 return ipmiRC;
Chris Austenac4604a2015-10-13 12:43:27 -0500466}
467
Chris Austen10ccc0f2015-12-10 18:27:04 -0600468
469ipmi_ret_t ipmi_sen_get_sensor_reading(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
470 ipmi_request_t request, ipmi_response_t response,
471 ipmi_data_len_t data_len, ipmi_context_t context)
472{
473 sensor_data_t *reqptr = (sensor_data_t*)request;
474 ipmi_ret_t rc = IPMI_CC_SENSOR_INVALID;
475 uint8_t type;
476 sensorreadingresp_t *resp = (sensorreadingresp_t*) response;
477 int r;
478 dbus_interface_t a;
479 sd_bus *bus = ipmid_get_sd_bus_connection();
480 sd_bus_message *reply = NULL;
Adriana Kobylak93125982016-03-01 12:48:10 -0600481 int reading = 0;
Chris Austen10ccc0f2015-12-10 18:27:04 -0600482
483
484 printf("IPMI GET_SENSOR_READING [0x%02x]\n",reqptr->sennum);
485
486 r = find_openbmc_path("SENSOR", reqptr->sennum, &a);
487
Nan Li36deb762016-05-12 10:23:41 +0800488 if (r < 0) {
489 fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum);
490 return IPMI_CC_SENSOR_INVALID;
491 }
492
Chris Austen10ccc0f2015-12-10 18:27:04 -0600493 type = find_sensor(reqptr->sennum);
Brad Bishop56003452016-10-05 21:49:19 -0400494 if(type == 0) {
495 fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum);
496 return IPMI_CC_SENSOR_INVALID;
497 }
Chris Austen10ccc0f2015-12-10 18:27:04 -0600498
499 fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n", a.bus, a.path, a.interface);
500
501 *data_len=0;
502
503 switch(type) {
504 case 0xC3:
505 case 0xC2:
Adriana Kobylak93125982016-03-01 12:48:10 -0600506 r = sd_bus_get_property(bus,a.bus, a.path, a.interface, "value", NULL, &reply, "i");
Chris Austen10ccc0f2015-12-10 18:27:04 -0600507 if (r < 0) {
508 fprintf(stderr, "Failed to call sd_bus_get_property:%d, %s\n", r, strerror(-r));
509 fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n",
510 a.bus, a.path, a.interface);
511 break;
512 }
513
Adriana Kobylak93125982016-03-01 12:48:10 -0600514 r = sd_bus_message_read(reply, "i", &reading);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600515 if (r < 0) {
Adriana Kobylak93125982016-03-01 12:48:10 -0600516 fprintf(stderr, "Failed to read sensor: %s\n", strerror(-r));
Chris Austen10ccc0f2015-12-10 18:27:04 -0600517 break;
518 }
519
520 printf("Contents of a 0x%02x is 0x%02x\n", type, reading);
521
522 rc = IPMI_CC_OK;
523 *data_len=sizeof(sensorreadingresp_t);
524
Adriana Kobylak93125982016-03-01 12:48:10 -0600525 resp->value = (uint8_t)reading;
Chris Austen10ccc0f2015-12-10 18:27:04 -0600526 resp->operation = 0;
527 resp->indication[0] = 0;
528 resp->indication[1] = 0;
529 break;
530
531 default:
532 *data_len=0;
533 rc = IPMI_CC_SENSOR_INVALID;
534 break;
535 }
536
537
vishwa1eaea4f2016-02-26 11:57:40 -0600538 reply = sd_bus_message_unref(reply);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600539
540 return rc;
541}
542
Chris Austen0012e9b2015-10-22 01:37:46 -0500543ipmi_ret_t ipmi_sen_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
544 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500545 ipmi_data_len_t data_len, ipmi_context_t context)
546{
Nan Li70aa8d92016-08-29 00:11:10 +0800547 ipmi_ret_t rc = IPMI_CC_INVALID;
Chris Austenac4604a2015-10-13 12:43:27 -0500548
549 printf("IPMI S/E Wildcard Netfn:[0x%X], Cmd:[0x%X]\n",netfn,cmd);
550 *data_len = 0;
551
552 return rc;
553}
554
555
556void register_netfn_sen_functions()
557{
Tom05732372016-09-06 17:21:23 +0530558 // <Wildcard Command>
Chris Austenac4604a2015-10-13 12:43:27 -0500559 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_WILDCARD);
Tom05732372016-09-06 17:21:23 +0530560 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_WILDCARD, NULL, ipmi_sen_wildcard,
561 PRIVILEGE_USER);
Chris Austenac4604a2015-10-13 12:43:27 -0500562
Tom05732372016-09-06 17:21:23 +0530563 // <Get Sensor Type>
Chris Austenac4604a2015-10-13 12:43:27 -0500564 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE);
Tom05732372016-09-06 17:21:23 +0530565 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE, NULL, ipmi_sen_get_sensor_type,
566 PRIVILEGE_USER);
Chris Austenac4604a2015-10-13 12:43:27 -0500567
Tom05732372016-09-06 17:21:23 +0530568 // <Set Sensor Reading and Event Status>
Chris Austenac4604a2015-10-13 12:43:27 -0500569 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_SET_SENSOR);
Tom05732372016-09-06 17:21:23 +0530570 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_SET_SENSOR, NULL, ipmi_sen_set_sensor,
571 PRIVILEGE_OPERATOR);
Chris Austen8a45e7c2015-10-15 00:31:46 -0500572
Tom05732372016-09-06 17:21:23 +0530573 // <Get Sensor Reading>
Chris Austen10ccc0f2015-12-10 18:27:04 -0600574 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING);
Tom05732372016-09-06 17:21:23 +0530575 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING, NULL,
576 ipmi_sen_get_sensor_reading, PRIVILEGE_USER);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600577
Chris Austenac4604a2015-10-13 12:43:27 -0500578 return;
579}