blob: 048219e3c6aa6d582e1f9db8bbfa830fc6e99c50 [file] [log] [blame]
vishwabmcba0bd5f2015-09-30 16:50:23 +05301#include "apphandler.h"
Patrick Venture5794fcf2017-10-26 11:11:14 -07002#include "app/channel.hpp"
Patrick Venture5e6ac712017-10-25 12:16:19 -07003#include "app/watchdog.hpp"
Patrick Williams37af7332016-09-02 21:21:42 -05004#include "host-ipmid/ipmid-api.h"
Patrick Williams53a360e2016-08-12 22:01:02 -05005#include "ipmid.hpp"
Ratan Guptab8e99552017-07-27 07:07:48 +05306#include "types.hpp"
7#include "utils.hpp"
8
vishwabmcba0bd5f2015-09-30 16:50:23 +05309#include <stdio.h>
Chris Austen6caf28b2015-10-13 12:40:40 -050010#include <stdint.h>
Adriana Kobylak3a552e12015-10-19 16:11:00 -050011#include <systemd/sd-bus.h>
Sergey Solomineb9b8142016-08-23 09:07:28 -050012#include <mapper.h>
Nan Liee0cb902016-07-11 15:38:03 +080013#include <array>
Tom Joseph69fabfe2017-08-04 10:15:01 +053014#include <vector>
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -060015#include <string>
16#include <cstddef>
Ratan Gupta62736ec2017-09-02 12:02:47 +053017#include <experimental/filesystem>
18
Nan Li3d0df912016-10-18 19:51:41 +080019#include <arpa/inet.h>
Ratan Guptab8e99552017-07-27 07:07:48 +053020#include "transporthandler.hpp"
21
22#include <phosphor-logging/log.hpp>
23#include <phosphor-logging/elog-errors.hpp>
24#include "xyz/openbmc_project/Common/error.hpp"
25
Adriana Kobylak3a552e12015-10-19 16:11:00 -050026extern sd_bus *bus;
vishwabmcba0bd5f2015-09-30 16:50:23 +053027
Nan Li3d0df912016-10-18 19:51:41 +080028constexpr auto app_obj = "/org/openbmc/NetworkManager/Interface";
29constexpr auto app_ifc = "org.openbmc.NetworkManager";
30constexpr auto app_nwinterface = "eth0";
31
Chris Austen6caf28b2015-10-13 12:40:40 -050032void register_netfn_app_functions() __attribute__((constructor));
vishwabmcba0bd5f2015-09-30 16:50:23 +053033
Ratan Guptab8e99552017-07-27 07:07:48 +053034using namespace phosphor::logging;
35using namespace sdbusplus::xyz::openbmc_project::Common::Error;
Ratan Gupta62736ec2017-09-02 12:02:47 +053036namespace fs = std::experimental::filesystem;
Ratan Guptab8e99552017-07-27 07:07:48 +053037
Nan Liee0cb902016-07-11 15:38:03 +080038// Offset in get device id command.
39typedef struct
40{
41 uint8_t id;
42 uint8_t revision;
43 uint8_t fw[2];
44 uint8_t ipmi_ver;
45 uint8_t addn_dev_support;
46 uint8_t manuf_id[3];
47 uint8_t prod_id[2];
48 uint8_t aux[4];
49}__attribute__((packed)) ipmi_device_id_t;
Chris Austen7303bdc2016-04-17 11:50:54 -050050
Adriana Kobylak3a552e12015-10-19 16:11:00 -050051ipmi_ret_t ipmi_app_set_acpi_power_state(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
52 ipmi_request_t request, ipmi_response_t response,
Chris Austen6caf28b2015-10-13 12:40:40 -050053 ipmi_data_len_t data_len, ipmi_context_t context)
54{
55 ipmi_ret_t rc = IPMI_CC_OK;
56 *data_len = 0;
57
58 printf("IPMI SET ACPI STATE Ignoring for now\n");
59 return rc;
60}
61
Chris Austen7303bdc2016-04-17 11:50:54 -050062
63typedef struct
64{
65 char major;
66 char minor;
Chris Austen176c9652016-04-30 16:32:17 -050067 uint16_t d[2];
Chris Austen7303bdc2016-04-17 11:50:54 -050068} rev_t;
69
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -060070/* Currently supports the vx.x-x-[-x] and v1.x.x-x-[-x] format. It will */
71/* return -1 if not in those formats, this routine knows how to parse */
Chris Austen7303bdc2016-04-17 11:50:54 -050072/* version = v0.6-19-gf363f61-dirty */
73/* ^ ^ ^^ ^ */
74/* | | |----------|-- additional details */
75/* | |---------------- Minor */
76/* |------------------ Major */
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -060077/* and version = v1.99.10-113-g65edf7d-r3-0-g9e4f715 */
78/* ^ ^ ^^ ^ */
79/* | | |--|---------- additional details */
80/* | |---------------- Minor */
81/* |------------------ Major */
Chris Austen7303bdc2016-04-17 11:50:54 -050082/* Additional details : If the option group exists it will force Auxiliary */
83/* Firmware Revision Information 4th byte to 1 indicating the build was */
84/* derived with additional edits */
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -060085int convert_version(const char * p, rev_t *rev)
Chris Austen7303bdc2016-04-17 11:50:54 -050086{
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -060087 std::string s(p);
88 std::string token;
Chris Austen176c9652016-04-30 16:32:17 -050089 uint16_t commits;
Chris Austen7303bdc2016-04-17 11:50:54 -050090
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -060091 auto location = s.find_first_of('v');
92 if (location != std::string::npos)
93 {
94 s = s.substr(location+1);
Chris Austen176c9652016-04-30 16:32:17 -050095 }
Chris Austen7303bdc2016-04-17 11:50:54 -050096
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -060097 if (!s.empty())
98 {
99 location = s.find_first_of(".");
100 if (location != std::string::npos)
101 {
102 rev->major = static_cast<char>(std::stoi(s.substr(0, location), 0, 16));
103 token = s.substr(location+1);
104 }
Chris Austen176c9652016-04-30 16:32:17 -0500105
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -0600106 if (!token.empty())
107 {
108 location = token.find_first_of(".-");
109 if (location != std::string::npos)
110 {
111 rev->minor = static_cast<char>(std::stoi(token.substr(0, location), 0, 16));
112 token = token.substr(location+1);
113 }
114 }
Chris Austen7303bdc2016-04-17 11:50:54 -0500115
Dinesh Chinari2b7e07d2017-11-08 15:38:50 -0600116 // Capture the number of commits on top of the minor tag.
117 // I'm using BE format like the ipmi spec asked for
118 location = token.find_first_of(".-");
119 if (!token.empty())
120 {
121 commits = std::stoi(token.substr(0, location), 0, 16);
122 rev->d[0] = (commits>>8) | (commits<<8);
123
124 // commit number we skip
125 location = token.find_first_of(".-");
126 if (location != std::string::npos)
127 {
128 token = token.substr(location+1);
129 }
130 }
131 else {
132 rev->d[0] = 0;
133 }
134
135 if (location != std::string::npos)
136 {
137 token = token.substr(location+1);
138 }
139
140 // Any value of the optional parameter forces it to 1
141 location = token.find_first_of(".-");
142 if (location != std::string::npos)
143 {
144 token = token.substr(location+1);
145 }
146 commits = (!token.empty()) ? 1 : 0;
147
148 //We do this operation to get this displayed in least significant bytes
149 //of ipmitool device id command.
150 rev->d[1] = (commits>>8) | (commits<<8);
151 }
152
Chris Austen7303bdc2016-04-17 11:50:54 -0500153 return 0;
154}
155
Adriana Kobylak3a552e12015-10-19 16:11:00 -0500156ipmi_ret_t ipmi_app_get_device_id(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
157 ipmi_request_t request, ipmi_response_t response,
Chris Austen6caf28b2015-10-13 12:40:40 -0500158 ipmi_data_len_t data_len, ipmi_context_t context)
159{
160 ipmi_ret_t rc = IPMI_CC_OK;
Chris Austen7303bdc2016-04-17 11:50:54 -0500161 const char *objname = "/org/openbmc/inventory/system/chassis/motherboard/bmc";
162 const char *iface = "org.openbmc.InventoryItem";
163 char *ver = NULL;
Sergey Solomineb9b8142016-08-23 09:07:28 -0500164 char *busname = NULL;
Chris Austen7303bdc2016-04-17 11:50:54 -0500165 int r;
166 rev_t rev = {0};
Nan Liee0cb902016-07-11 15:38:03 +0800167 ipmi_device_id_t dev_id{};
Chris Austen6caf28b2015-10-13 12:40:40 -0500168
169 // Data length
Chris Austen7303bdc2016-04-17 11:50:54 -0500170 *data_len = sizeof(dev_id);
171
Nan Liee0cb902016-07-11 15:38:03 +0800172 // From IPMI spec, controller that have different application commands, or different
173 // definitions of OEM fields, are expected to have different Device ID values.
174 // Set to 0 now.
175
176 // Device Revision is set to 0 now.
177 // Bit7 identifies if device provide Device SDRs, obmc don't have SDR,we use ipmi to
178 // simulate SDR, hence the value:
179 dev_id.revision = 0x80;
180
181 // Firmware revision is already implemented, so get it from appropriate position.
Sergey Solomineb9b8142016-08-23 09:07:28 -0500182 r = mapper_get_service(bus, objname, &busname);
183 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400184 fprintf(stderr, "Failed to get %s bus name: %s\n",
185 objname, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500186 goto finish;
187 }
Chris Austen7303bdc2016-04-17 11:50:54 -0500188 r = sd_bus_get_property_string(bus,busname,objname,iface,"version", NULL, &ver);
189 if ( r < 0 ) {
190 fprintf(stderr, "Failed to obtain version property: %s\n", strerror(-r));
191 } else {
192 r = convert_version(ver, &rev);
193 if( r >= 0 ) {
Nan Liee0cb902016-07-11 15:38:03 +0800194 // bit7 identifies if the device is available, 0=normal operation,
195 // 1=device firmware, SDR update or self-initialization in progress.
196 // our SDR is normal working condition, so mask:
197 dev_id.fw[0] = 0x7F & rev.major;
Adriana Kobylak0e912642016-06-22 16:54:39 -0500198
199 rev.minor = (rev.minor > 99 ? 99 : rev.minor);
Nan Liee0cb902016-07-11 15:38:03 +0800200 dev_id.fw[1] = rev.minor % 10 + (rev.minor / 10) * 16;
201 memcpy(&dev_id.aux, rev.d, 4);
Chris Austen7303bdc2016-04-17 11:50:54 -0500202 }
203 }
Chris Austen6caf28b2015-10-13 12:40:40 -0500204
Gunnar Mills8991dd62017-10-25 17:11:29 -0500205 // IPMI Spec version 2.0
Nan Liee0cb902016-07-11 15:38:03 +0800206 dev_id.ipmi_ver = 2;
207
208 // Additional device Support.
209 // List the 'logical device' commands and functions that the controller supports
210 // that are in addition to the mandatory IPM and Application commands.
211 // [7] Chassis Device (device functions as chassis device per ICMB spec.)
212 // [6] Bridge (device responds to Bridge NetFn commands)
213 // [5] IPMB Event Generator
214 // [4] IPMB Event Receiver
215 // [3] FRU Inventory Device
216 // [2] SEL Device
217 // [1] SDR Repository Device
218 // [0] Sensor Device
219 // We support FRU/SEL/Sensor now:
220 dev_id.addn_dev_support = 0x8D;
221
222 // This value is the IANA number assigned to "IBM Platform Firmware
223 // Division", which is also used by our service processor. We may want
224 // a different number or at least a different version?
225 dev_id.manuf_id[0] = 0x41;
226 dev_id.manuf_id[1] = 0xA7;
227 dev_id.manuf_id[2] = 0x00;
228
229 // Witherspoon's product ID is hardcoded to 4F42(ASCII 'OB').
230 // TODO: openbmc/openbmc#495
231 dev_id.prod_id[0] = 0x4F;
232 dev_id.prod_id[1] = 0x42;
233
Chris Austen6caf28b2015-10-13 12:40:40 -0500234 // Pack the actual response
Chris Austen7303bdc2016-04-17 11:50:54 -0500235 memcpy(response, &dev_id, *data_len);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500236finish:
237 free(busname);
Xo Wange5536382017-07-20 20:14:00 -0700238 free(ver);
Chris Austen6caf28b2015-10-13 12:40:40 -0500239 return rc;
240}
241
Nan Li41fa24a2016-11-10 20:12:37 +0800242ipmi_ret_t ipmi_app_get_self_test_results(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
243 ipmi_request_t request, ipmi_response_t response,
244 ipmi_data_len_t data_len, ipmi_context_t context)
245{
246 ipmi_ret_t rc = IPMI_CC_OK;
247
248 // Byte 2:
249 // 55h - No error.
Gunnar Mills8991dd62017-10-25 17:11:29 -0500250 // 56h - Self Test function not implemented in this controller.
Nan Li41fa24a2016-11-10 20:12:37 +0800251 // 57h - Corrupted or inaccesssible data or devices.
252 // 58h - Fatal hardware error.
253 // FFh - reserved.
254 // all other: Device-specific 'internal failure'.
255 // Byte 3:
256 // For byte 2 = 55h, 56h, FFh: 00h
257 // For byte 2 = 58h, all other: Device-specific
258 // For byte 2 = 57h: self-test error bitfield.
259 // Note: returning 57h does not imply that all test were run.
260 // [7] 1b = Cannot access SEL device.
261 // [6] 1b = Cannot access SDR Repository.
262 // [5] 1b = Cannot access BMC FRU device.
263 // [4] 1b = IPMB signal lines do not respond.
264 // [3] 1b = SDR Repository empty.
265 // [2] 1b = Internal Use Area of BMC FRU corrupted.
266 // [1] 1b = controller update 'boot block' firmware corrupted.
267 // [0] 1b = controller operational firmware corrupted.
268
269 char selftestresults[2] = {0};
270
271 *data_len = 2;
272
273 selftestresults[0] = 0x56;
274 selftestresults[1] = 0;
275
276 memcpy(response, selftestresults, *data_len);
277
278 return rc;
279}
280
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500281ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
282 ipmi_request_t request, ipmi_response_t response,
283 ipmi_data_len_t data_len, ipmi_context_t context)
284{
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500285 const char *objname = "/org/openbmc/control/chassis0";
Adriana Kobylak31bccae2015-11-05 13:31:06 -0600286 const char *iface = "org.freedesktop.DBus.Properties";
287 const char *chassis_iface = "org.openbmc.control.Chassis";
vishwa1eaea4f2016-02-26 11:57:40 -0600288 sd_bus_message *reply = NULL;
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500289 sd_bus_error error = SD_BUS_ERROR_NULL;
290 int r = 0;
291 char *uuid = NULL;
Sergey Solomineb9b8142016-08-23 09:07:28 -0500292 char *busname = NULL;
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500293
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500294 // UUID is in RFC4122 format. Ex: 61a39523-78f2-11e5-9862-e6402cfc3223
295 // Per IPMI Spec 2.0 need to convert to 16 hex bytes and reverse the byte order
296 // Ex: 0x2332fc2c40e66298e511f2782395a361
297
298 const int resp_size = 16; // Response is 16 hex bytes per IPMI Spec
299 uint8_t resp_uuid[resp_size]; // Array to hold the formatted response
300 int resp_loc = resp_size-1; // Point resp end of array to save in reverse order
301 int i = 0;
302 char *tokptr = NULL;
vishwa1eaea4f2016-02-26 11:57:40 -0600303 char *id_octet = NULL;
304
305 // Status code.
306 ipmi_ret_t rc = IPMI_CC_OK;
307 *data_len = 0;
308
309 printf("IPMI GET DEVICE GUID\n");
310
311 // Call Get properties method with the interface and property name
Sergey Solomineb9b8142016-08-23 09:07:28 -0500312 r = mapper_get_service(bus, objname, &busname);
313 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400314 fprintf(stderr, "Failed to get %s bus name: %s\n",
315 objname, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500316 goto finish;
317 }
vishwa1eaea4f2016-02-26 11:57:40 -0600318 r = sd_bus_call_method(bus,busname,objname,iface,
319 "Get",&error, &reply, "ss",
320 chassis_iface, "uuid");
321 if (r < 0)
322 {
323 fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r));
324 rc = IPMI_CC_UNSPECIFIED_ERROR;
325 goto finish;
326 }
327
328 r = sd_bus_message_read(reply, "v", "s", &uuid);
329 if (r < 0 || uuid == NULL)
330 {
331 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
332 rc = IPMI_CC_RESPONSE_ERROR;
333 goto finish;
334 }
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500335
336 // Traverse the UUID
vishwa1eaea4f2016-02-26 11:57:40 -0600337 id_octet = strtok_r(uuid, "-", &tokptr); // Get the UUID octects separated by dash
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500338
339 if (id_octet == NULL)
vishwa1eaea4f2016-02-26 11:57:40 -0600340 {
341 // Error
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500342 fprintf(stderr, "Unexpected UUID format: %s", uuid);
vishwa1eaea4f2016-02-26 11:57:40 -0600343 rc = IPMI_CC_RESPONSE_ERROR;
344 goto finish;
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500345 }
346
347 while (id_octet != NULL)
348 {
349 // Calculate the octet string size since it varies
350 // Divide it by 2 for the array size since 1 byte is built from 2 chars
351 int tmp_size = strlen(id_octet)/2;
352
353 for(i = 0; i < tmp_size; i++)
354 {
Joel Stanley38310cd2015-11-25 17:32:08 +1030355 char tmp_array[3] = {0}; // Holder of the 2 chars that will become a byte
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500356 strncpy(tmp_array, id_octet, 2); // 2 chars at a time
357
358 int resp_byte = strtoul(tmp_array, NULL, 16); // Convert to hex byte
359 memcpy((void*)&resp_uuid[resp_loc], &resp_byte, 1); // Copy end to first
360 resp_loc--;
361 id_octet+=2; // Finished with the 2 chars, advance
362 }
363 id_octet=strtok_r(NULL, "-", &tokptr); // Get next octet
364 }
365
366 // Data length
367 *data_len = resp_size;
368
369 // Pack the actual response
370 memcpy(response, &resp_uuid, *data_len);
371
vishwa1eaea4f2016-02-26 11:57:40 -0600372finish:
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500373 sd_bus_error_free(&error);
vishwa1eaea4f2016-02-26 11:57:40 -0600374 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500375 free(busname);
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500376
377 return rc;
378}
Chris Austen6caf28b2015-10-13 12:40:40 -0500379
Adriana Kobylak3a552e12015-10-19 16:11:00 -0500380ipmi_ret_t ipmi_app_get_bt_capabilities(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
381 ipmi_request_t request, ipmi_response_t response,
vishwabmcba0bd5f2015-09-30 16:50:23 +0530382 ipmi_data_len_t data_len, ipmi_context_t context)
383{
384 printf("Handling Netfn:[0x%X], Cmd:[0x%X]\n",netfn,cmd);
385
386 // Status code.
387 ipmi_ret_t rc = IPMI_CC_OK;
388
Adriana Kobylak88ad8152016-12-13 10:09:08 -0600389 // Per IPMI 2.0 spec, the input and output buffer size must be the max
390 // buffer size minus one byte to allocate space for the length byte.
391 uint8_t str[] = {0x01, MAX_IPMI_BUFFER-1, MAX_IPMI_BUFFER-1, 0x0A, 0x01};
vishwabmcba0bd5f2015-09-30 16:50:23 +0530392
393 // Data length
394 *data_len = sizeof(str);
395
396 // Pack the actual response
397 memcpy(response, &str, *data_len);
398
399 return rc;
400}
401
Adriana Kobylak3a552e12015-10-19 16:11:00 -0500402ipmi_ret_t ipmi_app_wildcard_handler(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
403 ipmi_request_t request, ipmi_response_t response,
vishwabmcba0bd5f2015-09-30 16:50:23 +0530404 ipmi_data_len_t data_len, ipmi_context_t context)
405{
406 printf("Handling WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
407
408 // Status code.
Nan Li70aa8d92016-08-29 00:11:10 +0800409 ipmi_ret_t rc = IPMI_CC_INVALID;
vishwabmcba0bd5f2015-09-30 16:50:23 +0530410
411 *data_len = strlen("THIS IS WILDCARD");
412
413 // Now pack actual response
414 memcpy(response, "THIS IS WILDCARD", *data_len);
415
416 return rc;
417}
418
Chris Austen6caf28b2015-10-13 12:40:40 -0500419void register_netfn_app_functions()
vishwabmcba0bd5f2015-09-30 16:50:23 +0530420{
Tom05732372016-09-06 17:21:23 +0530421 // <Get BT Interface Capabilities>
vishwabmcba0bd5f2015-09-30 16:50:23 +0530422 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CAP_BIT);
Tom05732372016-09-06 17:21:23 +0530423 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CAP_BIT, NULL, ipmi_app_get_bt_capabilities,
424 PRIVILEGE_USER);
Chris Austen6caf28b2015-10-13 12:40:40 -0500425
Tom05732372016-09-06 17:21:23 +0530426 // <Wildcard Command>
Chris Austen6caf28b2015-10-13 12:40:40 -0500427 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_WILDCARD);
Tom05732372016-09-06 17:21:23 +0530428 ipmi_register_callback(NETFUN_APP, IPMI_CMD_WILDCARD, NULL, ipmi_app_wildcard_handler,
429 PRIVILEGE_USER);
Chris Austen6caf28b2015-10-13 12:40:40 -0500430
Tom05732372016-09-06 17:21:23 +0530431 // <Reset Watchdog Timer>
Chris Austen6caf28b2015-10-13 12:40:40 -0500432 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_RESET_WD);
Tom05732372016-09-06 17:21:23 +0530433 ipmi_register_callback(NETFUN_APP, IPMI_CMD_RESET_WD, NULL, ipmi_app_reset_watchdog,
434 PRIVILEGE_OPERATOR);
Chris Austen6caf28b2015-10-13 12:40:40 -0500435
Tom05732372016-09-06 17:21:23 +0530436 // <Set Watchdog Timer>
Chris Austen6caf28b2015-10-13 12:40:40 -0500437 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_SET_WD);
Tom05732372016-09-06 17:21:23 +0530438 ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_WD, NULL, ipmi_app_set_watchdog,
439 PRIVILEGE_OPERATOR);
Chris Austen6caf28b2015-10-13 12:40:40 -0500440
Tom05732372016-09-06 17:21:23 +0530441 // <Get Device ID>
Chris Austen6caf28b2015-10-13 12:40:40 -0500442 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_DEVICE_ID);
Tom05732372016-09-06 17:21:23 +0530443 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_DEVICE_ID, NULL, ipmi_app_get_device_id,
444 PRIVILEGE_USER);
Chris Austen6caf28b2015-10-13 12:40:40 -0500445
Tom05732372016-09-06 17:21:23 +0530446 // <Get Self Test Results>
Nan Li41fa24a2016-11-10 20:12:37 +0800447 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_SELF_TEST_RESULTS);
Tom05732372016-09-06 17:21:23 +0530448 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_SELF_TEST_RESULTS, NULL,
449 ipmi_app_get_self_test_results, PRIVILEGE_USER);
Nan Li41fa24a2016-11-10 20:12:37 +0800450
Tom05732372016-09-06 17:21:23 +0530451 // <Get Device GUID>
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500452 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_DEVICE_GUID);
Tom05732372016-09-06 17:21:23 +0530453 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_DEVICE_GUID, NULL, ipmi_app_get_device_guid,
454 PRIVILEGE_USER);
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500455
Tom05732372016-09-06 17:21:23 +0530456 // <Set ACPI Power State>
Chris Austen6caf28b2015-10-13 12:40:40 -0500457 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_SET_ACPI);
Tom05732372016-09-06 17:21:23 +0530458 ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_ACPI, NULL, ipmi_app_set_acpi_power_state,
459 PRIVILEGE_ADMIN);
Chris Austen6caf28b2015-10-13 12:40:40 -0500460
Tom05732372016-09-06 17:21:23 +0530461 // <Set Channel Access>
Nan Li3d0df912016-10-18 19:51:41 +0800462 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP,
463 IPMI_CMD_SET_CHAN_ACCESS);
464 ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_CHAN_ACCESS, NULL,
Tom05732372016-09-06 17:21:23 +0530465 ipmi_set_channel_access, PRIVILEGE_ADMIN);
Chris Austenc2cd29d2016-02-05 20:02:29 -0600466
Tom Joseph69fabfe2017-08-04 10:15:01 +0530467 // <Get Channel Access>
468 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CHANNEL_ACCESS);
469 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHANNEL_ACCESS, NULL,
Patrick Venture5794fcf2017-10-26 11:11:14 -0700470 ipmi_get_channel_access, PRIVILEGE_USER);
Tom Joseph69fabfe2017-08-04 10:15:01 +0530471
Tom05732372016-09-06 17:21:23 +0530472 // <Get Channel Info Command>
Chris Austenc2cd29d2016-02-05 20:02:29 -0600473 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CHAN_INFO);
Tom05732372016-09-06 17:21:23 +0530474 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHAN_INFO, NULL, ipmi_app_channel_info,
475 PRIVILEGE_USER);
Chris Austenc2cd29d2016-02-05 20:02:29 -0600476
vishwabmcba0bd5f2015-09-30 16:50:23 +0530477 return;
478}
479
Chris Austen6caf28b2015-10-13 12:40:40 -0500480