blob: 121f1f016b7165fb9305029b254f8602923857a1 [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"},
Jayanth Othayoth0661beb2017-03-22 06:00:58 -050044 {0xDA, 0x03, "TurboAllowed"},
Chris Austend7cf0e42015-11-07 14:27:12 -060045 {0xFF, 0x00, ""},
Chris Austen0012e9b2015-10-22 01:37:46 -050046};
47
48
Chris Austenac4604a2015-10-13 12:43:27 -050049struct sensor_data_t {
50 uint8_t sennum;
51} __attribute__ ((packed)) ;
52
Chris Austen10ccc0f2015-12-10 18:27:04 -060053struct sensorreadingresp_t {
54 uint8_t value;
55 uint8_t operation;
56 uint8_t indication[2];
57} __attribute__ ((packed)) ;
Chris Austenac4604a2015-10-13 12:43:27 -050058
Tomd700e762016-09-20 18:24:13 +053059// Use a lookup table to find the interface name of a specific sensor
60// This will be used until an alternative is found. this is the first
61// step for mapping IPMI
62int find_interface_property_fru_type(dbus_interface_t *interface, const char *property_name, char *property_value) {
63
64 char *str1;
65 sd_bus_error error = SD_BUS_ERROR_NULL;
66 sd_bus_message *reply = NULL, *m=NULL;
67
68
69 int r;
70
71 r = sd_bus_message_new_method_call(bus,&m,interface->bus,interface->path,"org.freedesktop.DBus.Properties","Get");
72 if (r < 0) {
73 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
74 fprintf(stderr,"Bus: %s Path: %s Interface: %s \n",
75 interface->bus, interface->path, interface->interface);
76 goto final;
77 }
78
79 r = sd_bus_message_append(m, "ss", "org.openbmc.InventoryItem", property_name);
80 if (r < 0) {
81 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
82 fprintf(stderr,"Bus: %s Path: %s Interface: %s \n",
83 interface->bus, interface->path, interface->interface);
84 goto final;
85 }
86
87 r = sd_bus_call(bus, m, 0, &error, &reply);
88 if (r < 0) {
89 fprintf(stderr, "Failed to call the method: %s", strerror(-r));
90 goto final;
91 }
92
93 r = sd_bus_message_read(reply, "v", "s", &str1) ;
94 if (r < 0) {
95 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
96 goto final;
97 }
98
99 strcpy(property_value, str1);
100
101final:
102
103 sd_bus_error_free(&error);
104 m = sd_bus_message_unref(m);
105 reply = sd_bus_message_unref(reply);
106
107 return r;
108}
109
110
111// Use a lookup table to find the interface name of a specific sensor
112// This will be used until an alternative is found. this is the first
113// step for mapping IPMI
114int find_openbmc_path(const char *type, const uint8_t num, dbus_interface_t *interface) {
115 char *busname = NULL;
116 const char *iface = "org.openbmc.managers.System";
117 const char *objname = "/org/openbmc/managers/System";
118 char *str1 = NULL, *str2, *str3;
119 sd_bus_error error = SD_BUS_ERROR_NULL;
120 sd_bus_message *reply = NULL;
121
122
123 int r;
124 r = mapper_get_service(bus, objname, &busname);
125 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400126 fprintf(stderr, "Failed to get %s busname: %s\n",
127 objname, strerror(-r));
Tomd700e762016-09-20 18:24:13 +0530128 goto final;
129 }
130
131 r = sd_bus_call_method(bus,busname,objname,iface, "getObjectFromByteId",
132 &error, &reply, "sy", type, num);
133 if (r < 0) {
134 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
135 goto final;
136 }
137
138 r = sd_bus_message_read(reply, "(ss)", &str2, &str3);
139 if (r < 0) {
140 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
141 goto final;
142 }
143
144 r = mapper_get_service(bus, str2, &str1);
145 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400146 fprintf(stderr, "Failed to get %s busname: %s\n",
147 str2, strerror(-r));
Tomd700e762016-09-20 18:24:13 +0530148 goto final;
149 }
150
151 strncpy(interface->bus, str1, MAX_DBUS_PATH);
152 strncpy(interface->path, str2, MAX_DBUS_PATH);
153 strncpy(interface->interface, str3, MAX_DBUS_PATH);
154
155 interface->sensornumber = num;
156
157final:
158
159 sd_bus_error_free(&error);
160 reply = sd_bus_message_unref(reply);
161 free(busname);
162 free(str1);
163
164 return r;
165}
166
167
168/////////////////////////////////////////////////////////////////////
169//
170// Routines used by ipmi commands wanting to interact on the dbus
171//
172/////////////////////////////////////////////////////////////////////
173int set_sensor_dbus_state_s(uint8_t number, const char *method, const char *value) {
174
175
176 dbus_interface_t a;
177 int r;
178 sd_bus_error error = SD_BUS_ERROR_NULL;
179 sd_bus_message *m=NULL;
180
181 fprintf(ipmidbus, "Attempting to set a dbus Variant Sensor 0x%02x via %s with a value of %s\n",
182 number, method, value);
183
184 r = find_openbmc_path("SENSOR", number, &a);
185
186 if (r < 0) {
187 fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
188 return 0;
189 }
190
191 r = sd_bus_message_new_method_call(bus,&m,a.bus,a.path,a.interface,method);
192 if (r < 0) {
193 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
194 goto final;
195 }
196
197 r = sd_bus_message_append(m, "v", "s", value);
198 if (r < 0) {
199 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
200 goto final;
201 }
202
203
204 r = sd_bus_call(bus, m, 0, &error, NULL);
205 if (r < 0) {
206 fprintf(stderr, "Failed to call the method: %s", strerror(-r));
207 }
208
209final:
210 sd_bus_error_free(&error);
211 m = sd_bus_message_unref(m);
212
213 return 0;
214}
215int set_sensor_dbus_state_y(uint8_t number, const char *method, const uint8_t value) {
216
217
218 dbus_interface_t a;
219 int r;
220 sd_bus_error error = SD_BUS_ERROR_NULL;
221 sd_bus_message *m=NULL;
222
223 fprintf(ipmidbus, "Attempting to set a dbus Variant Sensor 0x%02x via %s with a value of 0x%02x\n",
224 number, method, value);
225
226 r = find_openbmc_path("SENSOR", number, &a);
227
228 if (r < 0) {
229 fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
230 return 0;
231 }
232
233 r = sd_bus_message_new_method_call(bus,&m,a.bus,a.path,a.interface,method);
234 if (r < 0) {
235 fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
236 goto final;
237 }
238
239 r = sd_bus_message_append(m, "v", "i", value);
240 if (r < 0) {
241 fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
242 goto final;
243 }
244
245
246 r = sd_bus_call(bus, m, 0, &error, NULL);
247 if (r < 0) {
248 fprintf(stderr, "12 Failed to call the method: %s", strerror(-r));
249 }
250
251final:
252 sd_bus_error_free(&error);
253 m = sd_bus_message_unref(m);
254
255 return 0;
256}
257
Chris Austen0012e9b2015-10-22 01:37:46 -0500258uint8_t dbus_to_sensor_type(char *p) {
Chris Austenac4604a2015-10-13 12:43:27 -0500259
Chris Austen0012e9b2015-10-22 01:37:46 -0500260 sensorTypemap_t *s = g_SensorTypeMap;
261 char r=0;
Chris Austenac4604a2015-10-13 12:43:27 -0500262
Chris Austen0012e9b2015-10-22 01:37:46 -0500263 while (s->number != 0xFF) {
264 if (!strcmp(s->dbusname,p)) {
265 r = s->number;
266 break;
Chris Austenac4604a2015-10-13 12:43:27 -0500267 }
Chris Austen0012e9b2015-10-22 01:37:46 -0500268 s++;
Chris Austenac4604a2015-10-13 12:43:27 -0500269 }
270
Chris Austend7cf0e42015-11-07 14:27:12 -0600271
Chris Austen0012e9b2015-10-22 01:37:46 -0500272 if (s->number == 0xFF)
273 printf("Failed to find Sensor Type %s\n", p);
Chris Austenac4604a2015-10-13 12:43:27 -0500274
Chris Austen0012e9b2015-10-22 01:37:46 -0500275 return r;
Chris Austenac4604a2015-10-13 12:43:27 -0500276}
277
Chris Austen0012e9b2015-10-22 01:37:46 -0500278
279uint8_t dbus_to_sensor_type_from_dbus(dbus_interface_t *a) {
280 char fru_type_name[64];
281 int r= 0;
282
283 r = find_interface_property_fru_type(a, "fru_type", fru_type_name);
284 if (r<0) {
285 fprintf(stderr, "Failed to get a fru type: %s", strerror(-r));
286 return -1;
287 } else {
288 return dbus_to_sensor_type(fru_type_name);
289 }
290}
291
292
293uint8_t find_sensor(uint8_t sensor_number) {
294
295 dbus_interface_t a;
296 char *p;
Brad Bishop56003452016-10-05 21:49:19 -0400297 int r;
298 uint8_t type;
Chris Austen0012e9b2015-10-22 01:37:46 -0500299
300 r = find_openbmc_path("SENSOR", sensor_number, &a);
301
302 if (r < 0) { return 0; }
303
304 // This is where sensors that do not exist in dbus but do
305 // exist in the host code stop. This should indicate it
306 // is not a supported sensor
Chris Austend7cf0e42015-11-07 14:27:12 -0600307 if (a.interface[0] == 0) { return 0;}
Chris Austen0012e9b2015-10-22 01:37:46 -0500308
309 if (strstr(a.interface, "InventoryItem")) {
310 // InventoryItems are real frus. So need to get the
311 // fru_type property
Brad Bishop56003452016-10-05 21:49:19 -0400312 type = dbus_to_sensor_type_from_dbus(&a);
Chris Austen0012e9b2015-10-22 01:37:46 -0500313 } else {
314 // Non InventoryItems
315 p = strrchr (a.path, '/');
Brad Bishop56003452016-10-05 21:49:19 -0400316 type = dbus_to_sensor_type(p+1);
Chris Austen0012e9b2015-10-22 01:37:46 -0500317 }
318
Brad Bishop56003452016-10-05 21:49:19 -0400319 return type;
Chris Austen0012e9b2015-10-22 01:37:46 -0500320 }
321
Chris Austen10ccc0f2015-12-10 18:27:04 -0600322
323
324
325
Chris Austen0012e9b2015-10-22 01:37:46 -0500326ipmi_ret_t ipmi_sen_get_sensor_type(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
327 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500328 ipmi_data_len_t data_len, ipmi_context_t context)
329{
330 sensor_data_t *reqptr = (sensor_data_t*)request;
331 ipmi_ret_t rc = IPMI_CC_OK;
332
333 printf("IPMI GET_SENSOR_TYPE [0x%02X]\n",reqptr->sennum);
334
335 // TODO Not sure what the System-event-sensor is suppose to return
336 // need to ask Hostboot team
337 unsigned char buf[] = {0x00,0x6F};
338
Chris Austen0012e9b2015-10-22 01:37:46 -0500339 buf[0] = find_sensor(reqptr->sennum);
340
341 // HACK UNTIL Dbus gets updated or we find a better way
342 if (buf[0] == 0) {
Chris Austen800ba712015-12-03 15:31:00 -0600343 rc = IPMI_CC_SENSOR_INVALID;
Chris Austen0012e9b2015-10-22 01:37:46 -0500344 }
345
Chris Austenac4604a2015-10-13 12:43:27 -0500346
347 *data_len = sizeof(buf);
348 memcpy(response, &buf, *data_len);
349
Chris Austenac4604a2015-10-13 12:43:27 -0500350 return rc;
351}
352
Tom Josephbe703f72017-03-09 12:34:35 +0530353ipmi_ret_t setSensorReading(void *request)
354{
355 auto cmdData = static_cast<SetSensorReadingReq *>(request);
Chris Austenac4604a2015-10-13 12:43:27 -0500356
Tom Josephbe703f72017-03-09 12:34:35 +0530357 auto assertionStates =
358 (static_cast<uint16_t>(cmdData->assertOffset8_14)) << 8 |
359 cmdData->assertOffset0_7;
360
361 auto deassertionStates =
362 (static_cast<uint16_t>(cmdData->deassertOffset8_14)) << 8 |
363 cmdData->deassertOffset0_7;
364
365 std::bitset<16> assertionSet(assertionStates);
366 std::bitset<16> deassertionSet(deassertionStates);
367
368 // Check if the Sensor Number is present
369 auto iter = sensors.find(cmdData->number);
370 if (iter == sensors.end())
371 {
372 return IPMI_CC_SENSOR_INVALID;
373 }
374
375 auto& interfaceList = iter->second.sensorInterfaces;
376 if (interfaceList.empty())
377 {
378 log<level::ERR>("Interface List empty for the sensor",
379 entry("Sensor Number = %d", cmdData->number));
380 return IPMI_CC_UNSPECIFIED_ERROR;
381 }
382
383 ipmi::sensor::ObjectMap objects;
384 ipmi::sensor::InterfaceMap interfaces;
385 for (const auto& interface : interfaceList)
386 {
387 for (const auto& property : interface.second)
388 {
389 ipmi::sensor::PropertyMap props;
390 bool valid = false;
391 for (const auto& value : property.second)
392 {
393 if (assertionSet.test(value.first))
394 {
395 props.emplace(property.first, value.second.assert);
396 valid = true;
397 }
398 else if (deassertionSet.test(value.first))
399 {
400 props.emplace(property.first, value.second.deassert);
401 valid = true;
402 }
403 }
404 if (valid)
405 {
406 interfaces.emplace(interface.first, std::move(props));
407 }
408 }
409 }
410 objects.emplace(iter->second.sensorPath, std::move(interfaces));
411
412 auto bus = sdbusplus::bus::new_default();
413 using namespace std::string_literals;
414 static const auto intf = "xyz.openbmc_project.Inventory.Manager"s;
415 static const auto path = "/xyz/openbmc_project/inventory"s;
416 std::string service;
417
418 try
419 {
420 service = ipmi::getService(bus, intf, path);
421
422 // Update the inventory manager
423 auto pimMsg = bus.new_method_call(service.c_str(),
424 path.c_str(),
425 intf.c_str(),
426 "Notify");
427 pimMsg.append(std::move(objects));
428 auto inventoryMgrResponseMsg = bus.call(pimMsg);
429 if (inventoryMgrResponseMsg.is_method_error())
430 {
431 log<level::ERR>("Error in notify call");
432 return IPMI_CC_UNSPECIFIED_ERROR;
433 }
434 }
435 catch (const std::runtime_error& e)
436 {
437 log<level::ERR>(e.what());
438 return IPMI_CC_UNSPECIFIED_ERROR;
439 }
440
441 return IPMI_CC_OK;
442}
Chris Austenac4604a2015-10-13 12:43:27 -0500443
Chris Austen0012e9b2015-10-22 01:37:46 -0500444ipmi_ret_t ipmi_sen_set_sensor(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
445 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500446 ipmi_data_len_t data_len, ipmi_context_t context)
447{
Chris Austenac4604a2015-10-13 12:43:27 -0500448 sensor_data_t *reqptr = (sensor_data_t*)request;
Chris Austenac4604a2015-10-13 12:43:27 -0500449
Chris Austen0012e9b2015-10-22 01:37:46 -0500450 printf("IPMI SET_SENSOR [0x%02x]\n",reqptr->sennum);
Chris Austenac4604a2015-10-13 12:43:27 -0500451
Tom Josephbe703f72017-03-09 12:34:35 +0530452 /*
453 * This would support the Set Sensor Reading command for the presence
454 * and functional state of Processor, Core & DIMM. For the remaining
455 * sensors the existing support is invoked.
456 */
457 auto ipmiRC = setSensorReading(request);
458
459 if(ipmiRC == IPMI_CC_SENSOR_INVALID)
460 {
461 updateSensorRecordFromSSRAESC(reqptr);
462 ipmiRC = IPMI_CC_OK;
463 }
Chris Austen8a45e7c2015-10-15 00:31:46 -0500464
Chris Austenac4604a2015-10-13 12:43:27 -0500465 *data_len=0;
Tom Josephbe703f72017-03-09 12:34:35 +0530466 return ipmiRC;
Chris Austenac4604a2015-10-13 12:43:27 -0500467}
468
Chris Austen10ccc0f2015-12-10 18:27:04 -0600469
470ipmi_ret_t ipmi_sen_get_sensor_reading(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
471 ipmi_request_t request, ipmi_response_t response,
472 ipmi_data_len_t data_len, ipmi_context_t context)
473{
474 sensor_data_t *reqptr = (sensor_data_t*)request;
475 ipmi_ret_t rc = IPMI_CC_SENSOR_INVALID;
476 uint8_t type;
477 sensorreadingresp_t *resp = (sensorreadingresp_t*) response;
478 int r;
479 dbus_interface_t a;
480 sd_bus *bus = ipmid_get_sd_bus_connection();
481 sd_bus_message *reply = NULL;
Adriana Kobylak93125982016-03-01 12:48:10 -0600482 int reading = 0;
Chris Austen10ccc0f2015-12-10 18:27:04 -0600483
484
485 printf("IPMI GET_SENSOR_READING [0x%02x]\n",reqptr->sennum);
486
487 r = find_openbmc_path("SENSOR", reqptr->sennum, &a);
488
Nan Li36deb762016-05-12 10:23:41 +0800489 if (r < 0) {
490 fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum);
491 return IPMI_CC_SENSOR_INVALID;
492 }
493
Chris Austen10ccc0f2015-12-10 18:27:04 -0600494 type = find_sensor(reqptr->sennum);
Brad Bishop56003452016-10-05 21:49:19 -0400495 if(type == 0) {
496 fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum);
497 return IPMI_CC_SENSOR_INVALID;
498 }
Chris Austen10ccc0f2015-12-10 18:27:04 -0600499
500 fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n", a.bus, a.path, a.interface);
501
502 *data_len=0;
503
504 switch(type) {
505 case 0xC3:
506 case 0xC2:
Adriana Kobylak93125982016-03-01 12:48:10 -0600507 r = sd_bus_get_property(bus,a.bus, a.path, a.interface, "value", NULL, &reply, "i");
Chris Austen10ccc0f2015-12-10 18:27:04 -0600508 if (r < 0) {
509 fprintf(stderr, "Failed to call sd_bus_get_property:%d, %s\n", r, strerror(-r));
510 fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n",
511 a.bus, a.path, a.interface);
512 break;
513 }
514
Adriana Kobylak93125982016-03-01 12:48:10 -0600515 r = sd_bus_message_read(reply, "i", &reading);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600516 if (r < 0) {
Adriana Kobylak93125982016-03-01 12:48:10 -0600517 fprintf(stderr, "Failed to read sensor: %s\n", strerror(-r));
Chris Austen10ccc0f2015-12-10 18:27:04 -0600518 break;
519 }
520
521 printf("Contents of a 0x%02x is 0x%02x\n", type, reading);
522
523 rc = IPMI_CC_OK;
524 *data_len=sizeof(sensorreadingresp_t);
525
Adriana Kobylak93125982016-03-01 12:48:10 -0600526 resp->value = (uint8_t)reading;
Chris Austen10ccc0f2015-12-10 18:27:04 -0600527 resp->operation = 0;
528 resp->indication[0] = 0;
529 resp->indication[1] = 0;
530 break;
531
532 default:
533 *data_len=0;
534 rc = IPMI_CC_SENSOR_INVALID;
535 break;
536 }
537
538
vishwa1eaea4f2016-02-26 11:57:40 -0600539 reply = sd_bus_message_unref(reply);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600540
541 return rc;
542}
543
Chris Austen0012e9b2015-10-22 01:37:46 -0500544ipmi_ret_t ipmi_sen_wildcard(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
545 ipmi_request_t request, ipmi_response_t response,
Chris Austenac4604a2015-10-13 12:43:27 -0500546 ipmi_data_len_t data_len, ipmi_context_t context)
547{
Nan Li70aa8d92016-08-29 00:11:10 +0800548 ipmi_ret_t rc = IPMI_CC_INVALID;
Chris Austenac4604a2015-10-13 12:43:27 -0500549
550 printf("IPMI S/E Wildcard Netfn:[0x%X], Cmd:[0x%X]\n",netfn,cmd);
551 *data_len = 0;
552
553 return rc;
554}
555
556
557void register_netfn_sen_functions()
558{
Tom05732372016-09-06 17:21:23 +0530559 // <Wildcard Command>
Chris Austenac4604a2015-10-13 12:43:27 -0500560 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_WILDCARD);
Tom05732372016-09-06 17:21:23 +0530561 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_WILDCARD, NULL, ipmi_sen_wildcard,
562 PRIVILEGE_USER);
Chris Austenac4604a2015-10-13 12:43:27 -0500563
Tom05732372016-09-06 17:21:23 +0530564 // <Get Sensor Type>
Chris Austenac4604a2015-10-13 12:43:27 -0500565 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE);
Tom05732372016-09-06 17:21:23 +0530566 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_TYPE, NULL, ipmi_sen_get_sensor_type,
567 PRIVILEGE_USER);
Chris Austenac4604a2015-10-13 12:43:27 -0500568
Tom05732372016-09-06 17:21:23 +0530569 // <Set Sensor Reading and Event Status>
Chris Austenac4604a2015-10-13 12:43:27 -0500570 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_SET_SENSOR);
Tom05732372016-09-06 17:21:23 +0530571 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_SET_SENSOR, NULL, ipmi_sen_set_sensor,
572 PRIVILEGE_OPERATOR);
Chris Austen8a45e7c2015-10-15 00:31:46 -0500573
Tom05732372016-09-06 17:21:23 +0530574 // <Get Sensor Reading>
Chris Austen10ccc0f2015-12-10 18:27:04 -0600575 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING);
Tom05732372016-09-06 17:21:23 +0530576 ipmi_register_callback(NETFUN_SENSOR, IPMI_CMD_GET_SENSOR_READING, NULL,
577 ipmi_sen_get_sensor_reading, PRIVILEGE_USER);
Chris Austen10ccc0f2015-12-10 18:27:04 -0600578
Chris Austenac4604a2015-10-13 12:43:27 -0500579 return;
580}