blob: fbe474ac795bcfdfe01c15675bb8b8ab2884c0ab [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>
10#include <string.h>
Chris Austen6caf28b2015-10-13 12:40:40 -050011#include <stdint.h>
Adriana Kobylak3a552e12015-10-19 16:11:00 -050012#include <systemd/sd-bus.h>
Sergey Solomineb9b8142016-08-23 09:07:28 -050013#include <mapper.h>
Nan Liee0cb902016-07-11 15:38:03 +080014#include <array>
Tom Joseph69fabfe2017-08-04 10:15:01 +053015#include <vector>
Ratan Gupta62736ec2017-09-02 12:02:47 +053016#include <experimental/filesystem>
17
Nan Li3d0df912016-10-18 19:51:41 +080018#include <arpa/inet.h>
Ratan Guptab8e99552017-07-27 07:07:48 +053019#include "transporthandler.hpp"
20
21#include <phosphor-logging/log.hpp>
22#include <phosphor-logging/elog-errors.hpp>
23#include "xyz/openbmc_project/Common/error.hpp"
24
Adriana Kobylak3a552e12015-10-19 16:11:00 -050025extern sd_bus *bus;
vishwabmcba0bd5f2015-09-30 16:50:23 +053026
Nan Li3d0df912016-10-18 19:51:41 +080027constexpr auto app_obj = "/org/openbmc/NetworkManager/Interface";
28constexpr auto app_ifc = "org.openbmc.NetworkManager";
29constexpr auto app_nwinterface = "eth0";
30
Chris Austen6caf28b2015-10-13 12:40:40 -050031void register_netfn_app_functions() __attribute__((constructor));
vishwabmcba0bd5f2015-09-30 16:50:23 +053032
Ratan Guptab8e99552017-07-27 07:07:48 +053033using namespace phosphor::logging;
34using namespace sdbusplus::xyz::openbmc_project::Common::Error;
Ratan Gupta62736ec2017-09-02 12:02:47 +053035namespace fs = std::experimental::filesystem;
Ratan Guptab8e99552017-07-27 07:07:48 +053036
Nan Liee0cb902016-07-11 15:38:03 +080037// Offset in get device id command.
38typedef struct
39{
40 uint8_t id;
41 uint8_t revision;
42 uint8_t fw[2];
43 uint8_t ipmi_ver;
44 uint8_t addn_dev_support;
45 uint8_t manuf_id[3];
46 uint8_t prod_id[2];
47 uint8_t aux[4];
48}__attribute__((packed)) ipmi_device_id_t;
Chris Austen7303bdc2016-04-17 11:50:54 -050049
Adriana Kobylak3a552e12015-10-19 16:11:00 -050050ipmi_ret_t ipmi_app_set_acpi_power_state(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
51 ipmi_request_t request, ipmi_response_t response,
Chris Austen6caf28b2015-10-13 12:40:40 -050052 ipmi_data_len_t data_len, ipmi_context_t context)
53{
54 ipmi_ret_t rc = IPMI_CC_OK;
55 *data_len = 0;
56
57 printf("IPMI SET ACPI STATE Ignoring for now\n");
58 return rc;
59}
60
Chris Austen7303bdc2016-04-17 11:50:54 -050061
62typedef struct
63{
64 char major;
65 char minor;
Chris Austen176c9652016-04-30 16:32:17 -050066 uint16_t d[2];
Chris Austen7303bdc2016-04-17 11:50:54 -050067} rev_t;
68
69
70/* Currently only supports the vx.x-x-[-x] format Will return -1 if not in */
71/* the format this routine knows how to parse */
72/* version = v0.6-19-gf363f61-dirty */
73/* ^ ^ ^^ ^ */
74/* | | |----------|-- additional details */
75/* | |---------------- Minor */
76/* |------------------ Major */
77/* Additional details : If the option group exists it will force Auxiliary */
78/* Firmware Revision Information 4th byte to 1 indicating the build was */
79/* derived with additional edits */
80int convert_version(const char *p, rev_t *rev)
81{
82 char *s, *token;
Chris Austen176c9652016-04-30 16:32:17 -050083 uint16_t commits;
Chris Austen7303bdc2016-04-17 11:50:54 -050084
85 if (*p != 'v')
86 return -1;
87 p++;
88
89 s = strdup(p);
90 token = strtok(s,".-");
91
92 rev->major = (int8_t) atoi(token);
93
94 token = strtok(NULL, ".-");
95 rev->minor = (int8_t) atoi(token);
96
97 // Capture the number of commits on top of the minor tag.
98 // I'm using BE format like the ipmi spec asked for
99 token = strtok(NULL,".-");
Chris Austen7303bdc2016-04-17 11:50:54 -0500100
Chris Austen176c9652016-04-30 16:32:17 -0500101 if (token) {
102 commits = (int16_t) atoi(token);
103 rev->d[0] = (commits>>8) | (commits<<8);
Chris Austen7303bdc2016-04-17 11:50:54 -0500104
Chris Austen176c9652016-04-30 16:32:17 -0500105 // commit number we skip
106 token = strtok(NULL,".-");
Chris Austen7303bdc2016-04-17 11:50:54 -0500107
Chris Austen176c9652016-04-30 16:32:17 -0500108 } else {
109 rev->d[0] = 0;
110 }
Chris Austen7303bdc2016-04-17 11:50:54 -0500111
112 // Any value of the optional parameter forces it to 1
Chris Austen176c9652016-04-30 16:32:17 -0500113 if (token)
114 token = strtok(NULL,".-");
115
116 rev->d[1] = (token != NULL) ? 1 : 0;
Chris Austen7303bdc2016-04-17 11:50:54 -0500117
118 free(s);
119 return 0;
120}
121
Adriana Kobylak3a552e12015-10-19 16:11:00 -0500122ipmi_ret_t ipmi_app_get_device_id(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
123 ipmi_request_t request, ipmi_response_t response,
Chris Austen6caf28b2015-10-13 12:40:40 -0500124 ipmi_data_len_t data_len, ipmi_context_t context)
125{
126 ipmi_ret_t rc = IPMI_CC_OK;
Chris Austen7303bdc2016-04-17 11:50:54 -0500127 const char *objname = "/org/openbmc/inventory/system/chassis/motherboard/bmc";
128 const char *iface = "org.openbmc.InventoryItem";
129 char *ver = NULL;
Sergey Solomineb9b8142016-08-23 09:07:28 -0500130 char *busname = NULL;
Chris Austen7303bdc2016-04-17 11:50:54 -0500131 int r;
132 rev_t rev = {0};
Nan Liee0cb902016-07-11 15:38:03 +0800133 ipmi_device_id_t dev_id{};
Chris Austen6caf28b2015-10-13 12:40:40 -0500134
135 // Data length
Chris Austen7303bdc2016-04-17 11:50:54 -0500136 *data_len = sizeof(dev_id);
137
Nan Liee0cb902016-07-11 15:38:03 +0800138 // From IPMI spec, controller that have different application commands, or different
139 // definitions of OEM fields, are expected to have different Device ID values.
140 // Set to 0 now.
141
142 // Device Revision is set to 0 now.
143 // Bit7 identifies if device provide Device SDRs, obmc don't have SDR,we use ipmi to
144 // simulate SDR, hence the value:
145 dev_id.revision = 0x80;
146
147 // Firmware revision is already implemented, so get it from appropriate position.
Sergey Solomineb9b8142016-08-23 09:07:28 -0500148 r = mapper_get_service(bus, objname, &busname);
149 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400150 fprintf(stderr, "Failed to get %s bus name: %s\n",
151 objname, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500152 goto finish;
153 }
Chris Austen7303bdc2016-04-17 11:50:54 -0500154 r = sd_bus_get_property_string(bus,busname,objname,iface,"version", NULL, &ver);
155 if ( r < 0 ) {
156 fprintf(stderr, "Failed to obtain version property: %s\n", strerror(-r));
157 } else {
158 r = convert_version(ver, &rev);
159 if( r >= 0 ) {
Nan Liee0cb902016-07-11 15:38:03 +0800160 // bit7 identifies if the device is available, 0=normal operation,
161 // 1=device firmware, SDR update or self-initialization in progress.
162 // our SDR is normal working condition, so mask:
163 dev_id.fw[0] = 0x7F & rev.major;
Adriana Kobylak0e912642016-06-22 16:54:39 -0500164
165 rev.minor = (rev.minor > 99 ? 99 : rev.minor);
Nan Liee0cb902016-07-11 15:38:03 +0800166 dev_id.fw[1] = rev.minor % 10 + (rev.minor / 10) * 16;
167 memcpy(&dev_id.aux, rev.d, 4);
Chris Austen7303bdc2016-04-17 11:50:54 -0500168 }
169 }
Chris Austen6caf28b2015-10-13 12:40:40 -0500170
Gunnar Mills8991dd62017-10-25 17:11:29 -0500171 // IPMI Spec version 2.0
Nan Liee0cb902016-07-11 15:38:03 +0800172 dev_id.ipmi_ver = 2;
173
174 // Additional device Support.
175 // List the 'logical device' commands and functions that the controller supports
176 // that are in addition to the mandatory IPM and Application commands.
177 // [7] Chassis Device (device functions as chassis device per ICMB spec.)
178 // [6] Bridge (device responds to Bridge NetFn commands)
179 // [5] IPMB Event Generator
180 // [4] IPMB Event Receiver
181 // [3] FRU Inventory Device
182 // [2] SEL Device
183 // [1] SDR Repository Device
184 // [0] Sensor Device
185 // We support FRU/SEL/Sensor now:
186 dev_id.addn_dev_support = 0x8D;
187
188 // This value is the IANA number assigned to "IBM Platform Firmware
189 // Division", which is also used by our service processor. We may want
190 // a different number or at least a different version?
191 dev_id.manuf_id[0] = 0x41;
192 dev_id.manuf_id[1] = 0xA7;
193 dev_id.manuf_id[2] = 0x00;
194
195 // Witherspoon's product ID is hardcoded to 4F42(ASCII 'OB').
196 // TODO: openbmc/openbmc#495
197 dev_id.prod_id[0] = 0x4F;
198 dev_id.prod_id[1] = 0x42;
199
Chris Austen6caf28b2015-10-13 12:40:40 -0500200 // Pack the actual response
Chris Austen7303bdc2016-04-17 11:50:54 -0500201 memcpy(response, &dev_id, *data_len);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500202finish:
203 free(busname);
Xo Wange5536382017-07-20 20:14:00 -0700204 free(ver);
Chris Austen6caf28b2015-10-13 12:40:40 -0500205 return rc;
206}
207
Nan Li41fa24a2016-11-10 20:12:37 +0800208ipmi_ret_t ipmi_app_get_self_test_results(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
209 ipmi_request_t request, ipmi_response_t response,
210 ipmi_data_len_t data_len, ipmi_context_t context)
211{
212 ipmi_ret_t rc = IPMI_CC_OK;
213
214 // Byte 2:
215 // 55h - No error.
Gunnar Mills8991dd62017-10-25 17:11:29 -0500216 // 56h - Self Test function not implemented in this controller.
Nan Li41fa24a2016-11-10 20:12:37 +0800217 // 57h - Corrupted or inaccesssible data or devices.
218 // 58h - Fatal hardware error.
219 // FFh - reserved.
220 // all other: Device-specific 'internal failure'.
221 // Byte 3:
222 // For byte 2 = 55h, 56h, FFh: 00h
223 // For byte 2 = 58h, all other: Device-specific
224 // For byte 2 = 57h: self-test error bitfield.
225 // Note: returning 57h does not imply that all test were run.
226 // [7] 1b = Cannot access SEL device.
227 // [6] 1b = Cannot access SDR Repository.
228 // [5] 1b = Cannot access BMC FRU device.
229 // [4] 1b = IPMB signal lines do not respond.
230 // [3] 1b = SDR Repository empty.
231 // [2] 1b = Internal Use Area of BMC FRU corrupted.
232 // [1] 1b = controller update 'boot block' firmware corrupted.
233 // [0] 1b = controller operational firmware corrupted.
234
235 char selftestresults[2] = {0};
236
237 *data_len = 2;
238
239 selftestresults[0] = 0x56;
240 selftestresults[1] = 0;
241
242 memcpy(response, selftestresults, *data_len);
243
244 return rc;
245}
246
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500247ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
248 ipmi_request_t request, ipmi_response_t response,
249 ipmi_data_len_t data_len, ipmi_context_t context)
250{
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500251 const char *objname = "/org/openbmc/control/chassis0";
Adriana Kobylak31bccae2015-11-05 13:31:06 -0600252 const char *iface = "org.freedesktop.DBus.Properties";
253 const char *chassis_iface = "org.openbmc.control.Chassis";
vishwa1eaea4f2016-02-26 11:57:40 -0600254 sd_bus_message *reply = NULL;
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500255 sd_bus_error error = SD_BUS_ERROR_NULL;
256 int r = 0;
257 char *uuid = NULL;
Sergey Solomineb9b8142016-08-23 09:07:28 -0500258 char *busname = NULL;
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500259
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500260 // UUID is in RFC4122 format. Ex: 61a39523-78f2-11e5-9862-e6402cfc3223
261 // Per IPMI Spec 2.0 need to convert to 16 hex bytes and reverse the byte order
262 // Ex: 0x2332fc2c40e66298e511f2782395a361
263
264 const int resp_size = 16; // Response is 16 hex bytes per IPMI Spec
265 uint8_t resp_uuid[resp_size]; // Array to hold the formatted response
266 int resp_loc = resp_size-1; // Point resp end of array to save in reverse order
267 int i = 0;
268 char *tokptr = NULL;
vishwa1eaea4f2016-02-26 11:57:40 -0600269 char *id_octet = NULL;
270
271 // Status code.
272 ipmi_ret_t rc = IPMI_CC_OK;
273 *data_len = 0;
274
275 printf("IPMI GET DEVICE GUID\n");
276
277 // Call Get properties method with the interface and property name
Sergey Solomineb9b8142016-08-23 09:07:28 -0500278 r = mapper_get_service(bus, objname, &busname);
279 if (r < 0) {
Brad Bishop819ddd42016-10-05 21:19:19 -0400280 fprintf(stderr, "Failed to get %s bus name: %s\n",
281 objname, strerror(-r));
Sergey Solomineb9b8142016-08-23 09:07:28 -0500282 goto finish;
283 }
vishwa1eaea4f2016-02-26 11:57:40 -0600284 r = sd_bus_call_method(bus,busname,objname,iface,
285 "Get",&error, &reply, "ss",
286 chassis_iface, "uuid");
287 if (r < 0)
288 {
289 fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r));
290 rc = IPMI_CC_UNSPECIFIED_ERROR;
291 goto finish;
292 }
293
294 r = sd_bus_message_read(reply, "v", "s", &uuid);
295 if (r < 0 || uuid == NULL)
296 {
297 fprintf(stderr, "Failed to get a response: %s", strerror(-r));
298 rc = IPMI_CC_RESPONSE_ERROR;
299 goto finish;
300 }
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500301
302 // Traverse the UUID
vishwa1eaea4f2016-02-26 11:57:40 -0600303 id_octet = strtok_r(uuid, "-", &tokptr); // Get the UUID octects separated by dash
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500304
305 if (id_octet == NULL)
vishwa1eaea4f2016-02-26 11:57:40 -0600306 {
307 // Error
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500308 fprintf(stderr, "Unexpected UUID format: %s", uuid);
vishwa1eaea4f2016-02-26 11:57:40 -0600309 rc = IPMI_CC_RESPONSE_ERROR;
310 goto finish;
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500311 }
312
313 while (id_octet != NULL)
314 {
315 // Calculate the octet string size since it varies
316 // Divide it by 2 for the array size since 1 byte is built from 2 chars
317 int tmp_size = strlen(id_octet)/2;
318
319 for(i = 0; i < tmp_size; i++)
320 {
Joel Stanley38310cd2015-11-25 17:32:08 +1030321 char tmp_array[3] = {0}; // Holder of the 2 chars that will become a byte
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500322 strncpy(tmp_array, id_octet, 2); // 2 chars at a time
323
324 int resp_byte = strtoul(tmp_array, NULL, 16); // Convert to hex byte
325 memcpy((void*)&resp_uuid[resp_loc], &resp_byte, 1); // Copy end to first
326 resp_loc--;
327 id_octet+=2; // Finished with the 2 chars, advance
328 }
329 id_octet=strtok_r(NULL, "-", &tokptr); // Get next octet
330 }
331
332 // Data length
333 *data_len = resp_size;
334
335 // Pack the actual response
336 memcpy(response, &resp_uuid, *data_len);
337
vishwa1eaea4f2016-02-26 11:57:40 -0600338finish:
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500339 sd_bus_error_free(&error);
vishwa1eaea4f2016-02-26 11:57:40 -0600340 reply = sd_bus_message_unref(reply);
Sergey Solomineb9b8142016-08-23 09:07:28 -0500341 free(busname);
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500342
343 return rc;
344}
Chris Austen6caf28b2015-10-13 12:40:40 -0500345
Adriana Kobylak3a552e12015-10-19 16:11:00 -0500346ipmi_ret_t ipmi_app_get_bt_capabilities(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
347 ipmi_request_t request, ipmi_response_t response,
vishwabmcba0bd5f2015-09-30 16:50:23 +0530348 ipmi_data_len_t data_len, ipmi_context_t context)
349{
350 printf("Handling Netfn:[0x%X], Cmd:[0x%X]\n",netfn,cmd);
351
352 // Status code.
353 ipmi_ret_t rc = IPMI_CC_OK;
354
Adriana Kobylak88ad8152016-12-13 10:09:08 -0600355 // Per IPMI 2.0 spec, the input and output buffer size must be the max
356 // buffer size minus one byte to allocate space for the length byte.
357 uint8_t str[] = {0x01, MAX_IPMI_BUFFER-1, MAX_IPMI_BUFFER-1, 0x0A, 0x01};
vishwabmcba0bd5f2015-09-30 16:50:23 +0530358
359 // Data length
360 *data_len = sizeof(str);
361
362 // Pack the actual response
363 memcpy(response, &str, *data_len);
364
365 return rc;
366}
367
Adriana Kobylak3a552e12015-10-19 16:11:00 -0500368ipmi_ret_t ipmi_app_wildcard_handler(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
369 ipmi_request_t request, ipmi_response_t response,
vishwabmcba0bd5f2015-09-30 16:50:23 +0530370 ipmi_data_len_t data_len, ipmi_context_t context)
371{
372 printf("Handling WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
373
374 // Status code.
Nan Li70aa8d92016-08-29 00:11:10 +0800375 ipmi_ret_t rc = IPMI_CC_INVALID;
vishwabmcba0bd5f2015-09-30 16:50:23 +0530376
377 *data_len = strlen("THIS IS WILDCARD");
378
379 // Now pack actual response
380 memcpy(response, "THIS IS WILDCARD", *data_len);
381
382 return rc;
383}
384
Chris Austen6caf28b2015-10-13 12:40:40 -0500385void register_netfn_app_functions()
vishwabmcba0bd5f2015-09-30 16:50:23 +0530386{
Tom05732372016-09-06 17:21:23 +0530387 // <Get BT Interface Capabilities>
vishwabmcba0bd5f2015-09-30 16:50:23 +0530388 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CAP_BIT);
Tom05732372016-09-06 17:21:23 +0530389 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CAP_BIT, NULL, ipmi_app_get_bt_capabilities,
390 PRIVILEGE_USER);
Chris Austen6caf28b2015-10-13 12:40:40 -0500391
Tom05732372016-09-06 17:21:23 +0530392 // <Wildcard Command>
Chris Austen6caf28b2015-10-13 12:40:40 -0500393 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_WILDCARD);
Tom05732372016-09-06 17:21:23 +0530394 ipmi_register_callback(NETFUN_APP, IPMI_CMD_WILDCARD, NULL, ipmi_app_wildcard_handler,
395 PRIVILEGE_USER);
Chris Austen6caf28b2015-10-13 12:40:40 -0500396
Tom05732372016-09-06 17:21:23 +0530397 // <Reset Watchdog Timer>
Chris Austen6caf28b2015-10-13 12:40:40 -0500398 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_RESET_WD);
Tom05732372016-09-06 17:21:23 +0530399 ipmi_register_callback(NETFUN_APP, IPMI_CMD_RESET_WD, NULL, ipmi_app_reset_watchdog,
400 PRIVILEGE_OPERATOR);
Chris Austen6caf28b2015-10-13 12:40:40 -0500401
Tom05732372016-09-06 17:21:23 +0530402 // <Set Watchdog Timer>
Chris Austen6caf28b2015-10-13 12:40:40 -0500403 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_SET_WD);
Tom05732372016-09-06 17:21:23 +0530404 ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_WD, NULL, ipmi_app_set_watchdog,
405 PRIVILEGE_OPERATOR);
Chris Austen6caf28b2015-10-13 12:40:40 -0500406
Tom05732372016-09-06 17:21:23 +0530407 // <Get Device ID>
Chris Austen6caf28b2015-10-13 12:40:40 -0500408 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_DEVICE_ID);
Tom05732372016-09-06 17:21:23 +0530409 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_DEVICE_ID, NULL, ipmi_app_get_device_id,
410 PRIVILEGE_USER);
Chris Austen6caf28b2015-10-13 12:40:40 -0500411
Tom05732372016-09-06 17:21:23 +0530412 // <Get Self Test Results>
Nan Li41fa24a2016-11-10 20:12:37 +0800413 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_SELF_TEST_RESULTS);
Tom05732372016-09-06 17:21:23 +0530414 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_SELF_TEST_RESULTS, NULL,
415 ipmi_app_get_self_test_results, PRIVILEGE_USER);
Nan Li41fa24a2016-11-10 20:12:37 +0800416
Tom05732372016-09-06 17:21:23 +0530417 // <Get Device GUID>
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500418 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_DEVICE_GUID);
Tom05732372016-09-06 17:21:23 +0530419 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_DEVICE_GUID, NULL, ipmi_app_get_device_guid,
420 PRIVILEGE_USER);
Adriana Kobylakd100ee52015-10-20 17:02:37 -0500421
Tom05732372016-09-06 17:21:23 +0530422 // <Set ACPI Power State>
Chris Austen6caf28b2015-10-13 12:40:40 -0500423 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_SET_ACPI);
Tom05732372016-09-06 17:21:23 +0530424 ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_ACPI, NULL, ipmi_app_set_acpi_power_state,
425 PRIVILEGE_ADMIN);
Chris Austen6caf28b2015-10-13 12:40:40 -0500426
Tom05732372016-09-06 17:21:23 +0530427 // <Set Channel Access>
Nan Li3d0df912016-10-18 19:51:41 +0800428 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP,
429 IPMI_CMD_SET_CHAN_ACCESS);
430 ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_CHAN_ACCESS, NULL,
Tom05732372016-09-06 17:21:23 +0530431 ipmi_set_channel_access, PRIVILEGE_ADMIN);
Chris Austenc2cd29d2016-02-05 20:02:29 -0600432
Tom Joseph69fabfe2017-08-04 10:15:01 +0530433 // <Get Channel Access>
434 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CHANNEL_ACCESS);
435 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHANNEL_ACCESS, NULL,
Patrick Venture5794fcf2017-10-26 11:11:14 -0700436 ipmi_get_channel_access, PRIVILEGE_USER);
Tom Joseph69fabfe2017-08-04 10:15:01 +0530437
Tom05732372016-09-06 17:21:23 +0530438 // <Get Channel Info Command>
Chris Austenc2cd29d2016-02-05 20:02:29 -0600439 printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CHAN_INFO);
Tom05732372016-09-06 17:21:23 +0530440 ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHAN_INFO, NULL, ipmi_app_channel_info,
441 PRIVILEGE_USER);
Chris Austenc2cd29d2016-02-05 20:02:29 -0600442
vishwabmcba0bd5f2015-09-30 16:50:23 +0530443 return;
444}
445
Chris Austen6caf28b2015-10-13 12:40:40 -0500446