blob: 53bb4125b61bf194ff8490b8a41a4cfa4d5936f4 [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"},
Chris Austend7cf0e42015-11-07 14:27:12 -060043 {0xFF, 0x00, ""},
Chris Austen0012e9b2015-10-22 01:37:46 -050044};
45
46
Chris Austenac4604a2015-10-13 12:43:27 -050047struct sensor_data_t {
48 uint8_t sennum;
49} __attribute__ ((packed)) ;
50
Chris Austen10ccc0f2015-12-10 18:27:04 -060051struct sensorreadingresp_t {
52 uint8_t value;
53 uint8_t operation;
54 uint8_t indication[2];
55} __attribute__ ((packed)) ;
Chris Austenac4604a2015-10-13 12:43:27 -050056
Tomd700e762016-09-20 18:24:13 +053057// Use a lookup table to find the interface name of a specific sensor
58// This will be used until an alternative is found. this is the first
59// step for mapping IPMI
60int find_interface_property_fru_type(dbus_interface_t *interface, const char *property_name, char *property_value) {
61
62 char *str1;
63 sd_bus_error error = SD_BUS_ERROR_NULL;
64 sd_bus_message *reply = NULL, *m=NULL;
65
66
67 int r;
68
69 r = sd_bus_message_new_method_call(bus,&m,interface->bus,interface->path,"org.freedesktop.DBus.Properties","Get");
70 if (r < 0) {
71 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
72 fprintf(stderr,"Bus: %s Path: %s Interface: %s \n",
73 interface->bus, interface->path, interface->interface);
74 goto final;
75 }
76
77 r = sd_bus_message_append(m, "ss", "org.openbmc.InventoryItem", property_name);
78 if (r < 0) {
79 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
80 fprintf(stderr,"Bus: %s Path: %s Interface: %s \n",
81 interface->bus, interface->path, interface->interface);
82 goto final;
83 }
84
85 r = sd_bus_call(bus, m, 0, &error, &reply);
86 if (r < 0) {
87 fprintf(stderr, "Failed to call the method: %s", strerror(-r));
88 goto final;
89 }
90
91 r = sd_bus_message_read(reply, "v", "s", &str1) ;
92 if (r < 0) {
93 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
94 goto final;
95 }
96
97 strcpy(property_value, str1);
98
99final:
100
101 sd_bus_error_free(&error);
102 m = sd_bus_message_unref(m);
103 reply = sd_bus_message_unref(reply);
104
105 return r;
106}
107
108
109// Use a lookup table to find the interface name of a specific sensor
110// This will be used until an alternative is found. this is the first
111// step for mapping IPMI
112int find_openbmc_path(const char *type, const uint8_t num, dbus_interface_t *interface) {
113 char *busname = NULL;
114 const char *iface = "org.openbmc.managers.System";
115 const char *objname = "/org/openbmc/managers/System";
116 char *str1 = NULL, *str2, *str3;
117 sd_bus_error error = SD_BUS_ERROR_NULL;
118 sd_bus_message *reply = NULL;
119
120
121 int r;
122 r = mapper_get_service(bus, objname, &busname);
123 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400124 fprintf(stderr, "Failed to get %s busname: %s\n",
125 objname, strerror(-r));
Tomd700e762016-09-20 18:24:13 +0530126 goto final;
127 }
128
129 r = sd_bus_call_method(bus,busname,objname,iface, "getObjectFromByteId",
130 &error, &reply, "sy", type, num);
131 if (r < 0) {
132 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
133 goto final;
134 }
135
136 r = sd_bus_message_read(reply, "(ss)", &str2, &str3);
137 if (r < 0) {
138 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
139 goto final;
140 }
141
142 r = mapper_get_service(bus, str2, &str1);
143 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400144 fprintf(stderr, "Failed to get %s busname: %s\n",
145 str2, strerror(-r));
Tomd700e762016-09-20 18:24:13 +0530146 goto final;
147 }
148
149 strncpy(interface->bus, str1, MAX_DBUS_PATH);
150 strncpy(interface->path, str2, MAX_DBUS_PATH);
151 strncpy(interface->interface, str3, MAX_DBUS_PATH);
152
153 interface->sensornumber = num;
154
155final:
156
157 sd_bus_error_free(&error);
158 reply = sd_bus_message_unref(reply);
159 free(busname);
160 free(str1);
161
162 return r;
163}
164
165
166/////////////////////////////////////////////////////////////////////
167//
168// Routines used by ipmi commands wanting to interact on the dbus
169//
170/////////////////////////////////////////////////////////////////////
171int set_sensor_dbus_state_s(uint8_t number, const char *method, const char *value) {
172
173
174 dbus_interface_t a;
175 int r;
176 sd_bus_error error = SD_BUS_ERROR_NULL;
177 sd_bus_message *m=NULL;
178
179 fprintf(ipmidbus, "Attempting to set a dbus Variant Sensor 0x%02x via %s with a value of %s\n",
180 number, method, value);
181
182 r = find_openbmc_path("SENSOR", number, &a);
183
184 if (r < 0) {
185 fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
186 return 0;
187 }
188
189 r = sd_bus_message_new_method_call(bus,&m,a.bus,a.path,a.interface,method);
190 if (r < 0) {
191 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
192 goto final;
193 }
194
195 r = sd_bus_message_append(m, "v", "s", value);
196 if (r < 0) {
197 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
198 goto final;
199 }
200
201
202 r = sd_bus_call(bus, m, 0, &error, NULL);
203 if (r < 0) {
204 fprintf(stderr, "Failed to call the method: %s", strerror(-r));
205 }
206
207final:
208 sd_bus_error_free(&error);
209 m = sd_bus_message_unref(m);
210
211 return 0;
212}
213int set_sensor_dbus_state_y(uint8_t number, const char *method, const uint8_t value) {
214
215
216 dbus_interface_t a;
217 int r;
218 sd_bus_error error = SD_BUS_ERROR_NULL;
219 sd_bus_message *m=NULL;
220
221 fprintf(ipmidbus, "Attempting to set a dbus Variant Sensor 0x%02x via %s with a value of 0x%02x\n",
222 number, method, value);
223
224 r = find_openbmc_path("SENSOR", number, &a);
225
226 if (r < 0) {
227 fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
228 return 0;
229 }
230
231 r = sd_bus_message_new_method_call(bus,&m,a.bus,a.path,a.interface,method);
232 if (r < 0) {
233 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
234 goto final;
235 }
236
237 r = sd_bus_message_append(m, "v", "i", value);
238 if (r < 0) {
239 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
240 goto final;
241 }
242
243
244 r = sd_bus_call(bus, m, 0, &error, NULL);
245 if (r < 0) {
246 fprintf(stderr, "12 Failed to call the method: %s", strerror(-r));
247 }
248
249final:
250 sd_bus_error_free(&error);
251 m = sd_bus_message_unref(m);
252
253 return 0;
254}
255
Chris Austen0012e9b2015-10-22 01:37:46 -0500256uint8_t dbus_to_sensor_type(char *p) {
Chris Austenac4604a2015-10-13 12:43:27 -0500257
Chris Austen0012e9b2015-10-22 01:37:46 -0500258 sensorTypemap_t *s = g_SensorTypeMap;
259 char r=0;
Chris Austenac4604a2015-10-13 12:43:27 -0500260
Chris Austen0012e9b2015-10-22 01:37:46 -0500261 while (s->number != 0xFF) {
262 if (!strcmp(s->dbusname,p)) {
263 r = s->number;
264 break;
Chris Austenac4604a2015-10-13 12:43:27 -0500265 }
Chris Austen0012e9b2015-10-22 01:37:46 -0500266 s++;
Chris Austenac4604a2015-10-13 12:43:27 -0500267 }
268
Chris Austend7cf0e42015-11-07 14:27:12 -0600269
Chris Austen0012e9b2015-10-22 01:37:46 -0500270 if (s->number == 0xFF)
271 printf("Failed to find Sensor Type %s\n", p);
Chris Austenac4604a2015-10-13 12:43:27 -0500272
Chris Austen0012e9b2015-10-22 01:37:46 -0500273 return r;
Chris Austenac4604a2015-10-13 12:43:27 -0500274}
275
Chris Austen0012e9b2015-10-22 01:37:46 -0500276
277uint8_t dbus_to_sensor_type_from_dbus(dbus_interface_t *a) {
278 char fru_type_name[64];
279 int r= 0;
280
281 r = find_interface_property_fru_type(a, "fru_type", fru_type_name);
282 if (r<0) {
283 fprintf(stderr, "Failed to get a fru type: %s", strerror(-r));
284 return -1;
285 } else {
286 return dbus_to_sensor_type(fru_type_name);
287 }
288}
289
290
291uint8_t find_sensor(uint8_t sensor_number) {
292
293 dbus_interface_t a;
294 char *p;
Brad Bishop56003452016-10-05 21:49:19 -0400295 int r;
296 uint8_t type;
Chris Austen0012e9b2015-10-22 01:37:46 -0500297
298 r = find_openbmc_path("SENSOR", sensor_number, &a);
299
300 if (r < 0) { return 0; }
301
302 // This is where sensors that do not exist in dbus but do
303 // exist in the host code stop. This should indicate it
304 // is not a supported sensor
Chris Austend7cf0e42015-11-07 14:27:12 -0600305 if (a.interface[0] == 0) { return 0;}
Chris Austen0012e9b2015-10-22 01:37:46 -0500306
307 if (strstr(a.interface, "InventoryItem")) {
308 // InventoryItems are real frus. So need to get the
309 // fru_type property
Brad Bishop56003452016-10-05 21:49:19 -0400310 type = dbus_to_sensor_type_from_dbus(&a);
Chris Austen0012e9b2015-10-22 01:37:46 -0500311 } else {
312 // Non InventoryItems
313 p = strrchr (a.path, '/');
Brad Bishop56003452016-10-05 21:49:19 -0400314 type = dbus_to_sensor_type(p+1);
Chris Austen0012e9b2015-10-22 01:37:46 -0500315 }
316
Brad Bishop56003452016-10-05 21:49:19 -0400317 return type;
Chris Austen0012e9b2015-10-22 01:37:46 -0500318 }
319
Chris Austen10ccc0f2015-12-10 18:27:04 -0600320
321
322
323
Chris Austen0012e9b2015-10-22 01:37:46 -0500324ipmi_ret_t ipmi_sen_get_sensor_type(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
325 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500326 ipmi_data_len_t data_len, ipmi_context_t context)
327{
328 sensor_data_t *reqptr = (sensor_data_t*)request;
329 ipmi_ret_t rc = IPMI_CC_OK;
330
331 printf("IPMI GET_SENSOR_TYPE [0x%02X]\n",reqptr->sennum);
332
333 // TODO Not sure what the System-event-sensor is suppose to return
334 // need to ask Hostboot team
335 unsigned char buf[] = {0x00,0x6F};
336
Chris Austen0012e9b2015-10-22 01:37:46 -0500337 buf[0] = find_sensor(reqptr->sennum);
338
339 // HACK UNTIL Dbus gets updated or we find a better way
340 if (buf[0] == 0) {
Chris Austen800ba712015-12-03 15:31:00 -0600341 rc = IPMI_CC_SENSOR_INVALID;
Chris Austen0012e9b2015-10-22 01:37:46 -0500342 }
343
Chris Austenac4604a2015-10-13 12:43:27 -0500344
345 *data_len = sizeof(buf);
346 memcpy(response, &buf, *data_len);
347
Chris Austenac4604a2015-10-13 12:43:27 -0500348 return rc;
349}
350
Tom Josephbe703f72017-03-09 12:34:35 +0530351ipmi_ret_t setSensorReading(void *request)
352{
353 auto cmdData = static_cast<SetSensorReadingReq *>(request);
Chris Austenac4604a2015-10-13 12:43:27 -0500354
Tom Josephbe703f72017-03-09 12:34:35 +0530355 auto assertionStates =
356 (static_cast<uint16_t>(cmdData->assertOffset8_14)) << 8 |
357 cmdData->assertOffset0_7;
358
359 auto deassertionStates =
360 (static_cast<uint16_t>(cmdData->deassertOffset8_14)) << 8 |
361 cmdData->deassertOffset0_7;
362
363 std::bitset<16> assertionSet(assertionStates);
364 std::bitset<16> deassertionSet(deassertionStates);
365
366 // Check if the Sensor Number is present
367 auto iter = sensors.find(cmdData->number);
368 if (iter == sensors.end())
369 {
370 return IPMI_CC_SENSOR_INVALID;
371 }
372
373 auto& interfaceList = iter->second.sensorInterfaces;
374 if (interfaceList.empty())
375 {
376 log<level::ERR>("Interface List empty for the sensor",
377 entry("Sensor Number = %d", cmdData->number));
378 return IPMI_CC_UNSPECIFIED_ERROR;
379 }
380
381 ipmi::sensor::ObjectMap objects;
382 ipmi::sensor::InterfaceMap interfaces;
383 for (const auto& interface : interfaceList)
384 {
385 for (const auto& property : interface.second)
386 {
387 ipmi::sensor::PropertyMap props;
388 bool valid = false;
389 for (const auto& value : property.second)
390 {
391 if (assertionSet.test(value.first))
392 {
393 props.emplace(property.first, value.second.assert);
394 valid = true;
395 }
396 else if (deassertionSet.test(value.first))
397 {
398 props.emplace(property.first, value.second.deassert);
399 valid = true;
400 }
401 }
402 if (valid)
403 {
404 interfaces.emplace(interface.first, std::move(props));
405 }
406 }
407 }
408 objects.emplace(iter->second.sensorPath, std::move(interfaces));
409
410 auto bus = sdbusplus::bus::new_default();
411 using namespace std::string_literals;
412 static const auto intf = "xyz.openbmc_project.Inventory.Manager"s;
413 static const auto path = "/xyz/openbmc_project/inventory"s;
414 std::string service;
415
416 try
417 {
418 service = ipmi::getService(bus, intf, path);
419
420 // Update the inventory manager
421 auto pimMsg = bus.new_method_call(service.c_str(),
422 path.c_str(),
423 intf.c_str(),
424 "Notify");
425 pimMsg.append(std::move(objects));
426 auto inventoryMgrResponseMsg = bus.call(pimMsg);
427 if (inventoryMgrResponseMsg.is_method_error())
428 {
429 log<level::ERR>("Error in notify call");
430 return IPMI_CC_UNSPECIFIED_ERROR;
431 }
432 }
433 catch (const std::runtime_error& e)
434 {
435 log<level::ERR>(e.what());
436 return IPMI_CC_UNSPECIFIED_ERROR;
437 }
438
439 return IPMI_CC_OK;
440}
Chris Austenac4604a2015-10-13 12:43:27 -0500441
Chris Austen0012e9b2015-10-22 01:37:46 -0500442ipmi_ret_t ipmi_sen_set_sensor(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
443 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500444 ipmi_data_len_t data_len, ipmi_context_t context)
445{
Chris Austenac4604a2015-10-13 12:43:27 -0500446 sensor_data_t *reqptr = (sensor_data_t*)request;
Chris Austenac4604a2015-10-13 12:43:27 -0500447
Chris Austen0012e9b2015-10-22 01:37:46 -0500448 printf("IPMI SET_SENSOR [0x%02x]\n",reqptr->sennum);
Chris Austenac4604a2015-10-13 12:43:27 -0500449
Tom Josephbe703f72017-03-09 12:34:35 +0530450 /*
451 * This would support the Set Sensor Reading command for the presence
452 * and functional state of Processor, Core & DIMM. For the remaining
453 * sensors the existing support is invoked.
454 */
455 auto ipmiRC = setSensorReading(request);
456
457 if(ipmiRC == IPMI_CC_SENSOR_INVALID)
458 {
459 updateSensorRecordFromSSRAESC(reqptr);
460 ipmiRC = IPMI_CC_OK;
461 }
Chris Austen8a45e7c2015-10-15 00:31:46 -0500462
Chris Austenac4604a2015-10-13 12:43:27 -0500463 *data_len=0;
Tom Josephbe703f72017-03-09 12:34:35 +0530464 return ipmiRC;
Chris Austenac4604a2015-10-13 12:43:27 -0500465}
466
Chris Austen10ccc0f2015-12-10 18:27:04 -0600467
468ipmi_ret_t ipmi_sen_get_sensor_reading(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
469 ipmi_request_t request, ipmi_response_t response,
470 ipmi_data_len_t data_len, ipmi_context_t context)
471{
472 sensor_data_t *reqptr = (sensor_data_t*)request;
473 ipmi_ret_t rc = IPMI_CC_SENSOR_INVALID;
474 uint8_t type;
475 sensorreadingresp_t *resp = (sensorreadingresp_t*) response;
476 int r;
477 dbus_interface_t a;
478 sd_bus *bus = ipmid_get_sd_bus_connection();
479 sd_bus_message *reply = NULL;
Adriana Kobylak93125982016-03-01 12:48:10 -0600480 int reading = 0;
Chris Austen10ccc0f2015-12-10 18:27:04 -0600481
482
483 printf("IPMI GET_SENSOR_READING [0x%02x]\n",reqptr->sennum);
484
485 r = find_openbmc_path("SENSOR", reqptr->sennum, &a);
486
Nan Li36deb762016-05-12 10:23:41 +0800487 if (r < 0) {
488 fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum);
489 return IPMI_CC_SENSOR_INVALID;
490 }
491
Chris Austen10ccc0f2015-12-10 18:27:04 -0600492 type = find_sensor(reqptr->sennum);
Brad Bishop56003452016-10-05 21:49:19 -0400493 if(type == 0) {
494 fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum);
495 return IPMI_CC_SENSOR_INVALID;
496 }
Chris Austen10ccc0f2015-12-10 18:27:04 -0600497
498 fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n", a.bus, a.path, a.interface);
499
500 *data_len=0;
501
502 switch(type) {
503 case 0xC3:
504 case 0xC2:
Adriana Kobylak93125982016-03-01 12:48:10 -0600505 r = sd_bus_get_property(bus,a.bus, a.path, a.interface, "value", NULL, &reply, "i");
Chris Austen10ccc0f2015-12-10 18:27:04 -0600506 if (r < 0) {
507 fprintf(stderr, "Failed to call sd_bus_get_property:%d, %s\n", r, strerror(-r));
508 fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n",
509 a.bus, a.path, a.interface);
510 break;
511 }
512
Adriana Kobylak93125982016-03-01 12:48:10 -0600513 r = sd_bus_message_read(reply, "i", &reading);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600514 if (r < 0) {
Adriana Kobylak93125982016-03-01 12:48:10 -0600515 fprintf(stderr, "Failed to read sensor: %s\n", strerror(-r));
Chris Austen10ccc0f2015-12-10 18:27:04 -0600516 break;
517 }
518
519 printf("Contents of a 0x%02x is 0x%02x\n", type, reading);
520
521 rc = IPMI_CC_OK;
522 *data_len=sizeof(sensorreadingresp_t);
523
Adriana Kobylak93125982016-03-01 12:48:10 -0600524 resp->value = (uint8_t)reading;
Chris Austen10ccc0f2015-12-10 18:27:04 -0600525 resp->operation = 0;
526 resp->indication[0] = 0;
527 resp->indication[1] = 0;
528 break;
529
530 default:
531 *data_len=0;
532 rc = IPMI_CC_SENSOR_INVALID;
533 break;
534 }
535
536
vishwa1eaea4f2016-02-26 11:57:40 -0600537 reply = sd_bus_message_unref(reply);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600538
539 return rc;
540}
541
Chris Austen0012e9b2015-10-22 01:37:46 -0500542ipmi_ret_t ipmi_sen_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
543 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500544 ipmi_data_len_t data_len, ipmi_context_t context)
545{
Nan Li70aa8d92016-08-29 00:11:10 +0800546 ipmi_ret_t rc = IPMI_CC_INVALID;
Chris Austenac4604a2015-10-13 12:43:27 -0500547
548 printf("IPMI S/E Wildcard Netfn:[0x%X], Cmd:[0x%X]\n",netfn,cmd);
549 *data_len = 0;
550
551 return rc;
552}
553
554
555void register_netfn_sen_functions()
556{
Tom05732372016-09-06 17:21:23 +0530557 // <Wildcard Command>
Chris Austenac4604a2015-10-13 12:43:27 -0500558 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_WILDCARD);
Tom05732372016-09-06 17:21:23 +0530559 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_WILDCARD, NULL, ipmi_sen_wildcard,
560 PRIVILEGE_USER);
Chris Austenac4604a2015-10-13 12:43:27 -0500561
Tom05732372016-09-06 17:21:23 +0530562 // <Get Sensor Type>
Chris Austenac4604a2015-10-13 12:43:27 -0500563 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE);
Tom05732372016-09-06 17:21:23 +0530564 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE, NULL, ipmi_sen_get_sensor_type,
565 PRIVILEGE_USER);
Chris Austenac4604a2015-10-13 12:43:27 -0500566
Tom05732372016-09-06 17:21:23 +0530567 // <Set Sensor Reading and Event Status>
Chris Austenac4604a2015-10-13 12:43:27 -0500568 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_SET_SENSOR);
Tom05732372016-09-06 17:21:23 +0530569 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_SET_SENSOR, NULL, ipmi_sen_set_sensor,
570 PRIVILEGE_OPERATOR);
Chris Austen8a45e7c2015-10-15 00:31:46 -0500571
Tom05732372016-09-06 17:21:23 +0530572 // <Get Sensor Reading>
Chris Austen10ccc0f2015-12-10 18:27:04 -0600573 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING);
Tom05732372016-09-06 17:21:23 +0530574 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING, NULL,
575 ipmi_sen_get_sensor_reading, PRIVILEGE_USER);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600576
Chris Austenac4604a2015-10-13 12:43:27 -0500577 return;
578}