vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 1 | #include "apphandler.h" |
Patrick Williams | 37af733 | 2016-09-02 21:21:42 -0500 | [diff] [blame] | 2 | #include "host-ipmid/ipmid-api.h" |
Patrick Williams | 53a360e | 2016-08-12 22:01:02 -0500 | [diff] [blame] | 3 | #include "ipmid.hpp" |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 4 | #include <stdio.h> |
| 5 | #include <string.h> |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 6 | #include <stdint.h> |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 7 | #include <systemd/sd-bus.h> |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 8 | #include <mapper.h> |
Nan Li | ee0cb90 | 2016-07-11 15:38:03 +0800 | [diff] [blame] | 9 | #include <array> |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 10 | |
| 11 | extern sd_bus *bus; |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 12 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 13 | void register_netfn_app_functions() __attribute__((constructor)); |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 14 | |
Nan Li | ee0cb90 | 2016-07-11 15:38:03 +0800 | [diff] [blame] | 15 | // Offset in get device id command. |
| 16 | typedef struct |
| 17 | { |
| 18 | uint8_t id; |
| 19 | uint8_t revision; |
| 20 | uint8_t fw[2]; |
| 21 | uint8_t ipmi_ver; |
| 22 | uint8_t addn_dev_support; |
| 23 | uint8_t manuf_id[3]; |
| 24 | uint8_t prod_id[2]; |
| 25 | uint8_t aux[4]; |
| 26 | }__attribute__((packed)) ipmi_device_id_t; |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 27 | |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 28 | //--------------------------------------------------------------------- |
Patrick Williams | 53a360e | 2016-08-12 22:01:02 -0500 | [diff] [blame] | 29 | // Called by Host on seeing a SMS_ATN bit set. Return a hardcoded |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 30 | // value of 0x2 indicating we need Host read some data. |
| 31 | //------------------------------------------------------------------- |
| 32 | ipmi_ret_t ipmi_app_get_msg_flags(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 33 | ipmi_request_t request, ipmi_response_t response, |
| 34 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 35 | { |
| 36 | // Generic return from IPMI commands. |
| 37 | ipmi_ret_t rc = IPMI_CC_OK; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 38 | |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 39 | printf("IPMI APP GET MSG FLAGS returning with [bit:2] set\n"); |
| 40 | |
| 41 | // From IPMI spec V2.0 for Get Message Flags Command : |
Patrick Williams | 53a360e | 2016-08-12 22:01:02 -0500 | [diff] [blame] | 42 | // bit:[1] from LSB : 1b = Event Message Buffer Full. |
| 43 | // Return as 0 if Event Message Buffer is not supported, |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 44 | // or when the Event Message buffer is disabled. |
| 45 | // TODO. For now. assume its not disabled and send "0x2" anyway: |
| 46 | |
| 47 | uint8_t set_event_msg_buffer_full = 0x2; |
| 48 | *data_len = sizeof(set_event_msg_buffer_full); |
| 49 | |
| 50 | // Pack the actual response |
| 51 | memcpy(response, &set_event_msg_buffer_full, *data_len); |
| 52 | |
| 53 | return rc; |
| 54 | } |
| 55 | |
| 56 | //------------------------------------------------------------------- |
| 57 | // Called by Host post response from Get_Message_Flags |
| 58 | //------------------------------------------------------------------- |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 59 | ipmi_ret_t ipmi_app_read_event(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 60 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 61 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 62 | { |
| 63 | ipmi_ret_t rc = IPMI_CC_OK; |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 64 | printf("IPMI APP READ EVENT command received\n"); |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 65 | |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 66 | // TODO : For now, this is catering only to the Soft Power Off via OEM SEL |
| 67 | // mechanism. If we need to make this generically used for some |
| 68 | // other conditions, then we can take advantage of context pointer. |
| 69 | |
| 70 | struct oem_sel_timestamped soft_off = {0}; |
| 71 | *data_len = sizeof(struct oem_sel_timestamped); |
| 72 | |
| 73 | // either id[0] -or- id[1] can be filled in. We will use id[0] |
| 74 | soft_off.id[0] = SEL_OEM_ID_0; |
| 75 | soft_off.id[1] = SEL_OEM_ID_0; |
| 76 | soft_off.type = SEL_RECORD_TYPE_OEM; |
| 77 | |
| 78 | // Following 3 bytes are from IANA Manufactre_Id field. See below |
| 79 | soft_off.manuf_id[0]= 0x41; |
| 80 | soft_off.manuf_id[1]= 0xA7; |
| 81 | soft_off.manuf_id[2]= 0x00; |
| 82 | |
| 83 | // per IPMI spec NetFuntion for OEM |
| 84 | soft_off.netfun = 0x3A; |
| 85 | |
| 86 | // Mechanism to kick start soft shutdown. |
| 87 | soft_off.cmd = CMD_POWER; |
| 88 | soft_off.data[0] = SOFT_OFF; |
| 89 | |
| 90 | // All '0xFF' since unused. |
| 91 | memset(&soft_off.data[1], 0xFF, 3); |
| 92 | |
| 93 | // Pack the actual response |
| 94 | memcpy(response, &soft_off, *data_len); |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 95 | return rc; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 96 | } |
| 97 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 98 | ipmi_ret_t ipmi_app_set_acpi_power_state(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 99 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 100 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 101 | { |
| 102 | ipmi_ret_t rc = IPMI_CC_OK; |
| 103 | *data_len = 0; |
| 104 | |
| 105 | printf("IPMI SET ACPI STATE Ignoring for now\n"); |
| 106 | return rc; |
| 107 | } |
| 108 | |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 109 | |
| 110 | typedef struct |
| 111 | { |
| 112 | char major; |
| 113 | char minor; |
Chris Austen | 176c965 | 2016-04-30 16:32:17 -0500 | [diff] [blame] | 114 | uint16_t d[2]; |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 115 | } rev_t; |
| 116 | |
| 117 | |
| 118 | /* Currently only supports the vx.x-x-[-x] format Will return -1 if not in */ |
| 119 | /* the format this routine knows how to parse */ |
| 120 | /* version = v0.6-19-gf363f61-dirty */ |
| 121 | /* ^ ^ ^^ ^ */ |
| 122 | /* | | |----------|-- additional details */ |
| 123 | /* | |---------------- Minor */ |
| 124 | /* |------------------ Major */ |
| 125 | /* Additional details : If the option group exists it will force Auxiliary */ |
| 126 | /* Firmware Revision Information 4th byte to 1 indicating the build was */ |
| 127 | /* derived with additional edits */ |
| 128 | int convert_version(const char *p, rev_t *rev) |
| 129 | { |
| 130 | char *s, *token; |
Chris Austen | 176c965 | 2016-04-30 16:32:17 -0500 | [diff] [blame] | 131 | uint16_t commits; |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 132 | |
| 133 | if (*p != 'v') |
| 134 | return -1; |
| 135 | p++; |
| 136 | |
| 137 | s = strdup(p); |
| 138 | token = strtok(s,".-"); |
| 139 | |
| 140 | rev->major = (int8_t) atoi(token); |
| 141 | |
| 142 | token = strtok(NULL, ".-"); |
| 143 | rev->minor = (int8_t) atoi(token); |
| 144 | |
| 145 | // Capture the number of commits on top of the minor tag. |
| 146 | // I'm using BE format like the ipmi spec asked for |
| 147 | token = strtok(NULL,".-"); |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 148 | |
Chris Austen | 176c965 | 2016-04-30 16:32:17 -0500 | [diff] [blame] | 149 | if (token) { |
| 150 | commits = (int16_t) atoi(token); |
| 151 | rev->d[0] = (commits>>8) | (commits<<8); |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 152 | |
Chris Austen | 176c965 | 2016-04-30 16:32:17 -0500 | [diff] [blame] | 153 | // commit number we skip |
| 154 | token = strtok(NULL,".-"); |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 155 | |
Chris Austen | 176c965 | 2016-04-30 16:32:17 -0500 | [diff] [blame] | 156 | } else { |
| 157 | rev->d[0] = 0; |
| 158 | } |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 159 | |
| 160 | // Any value of the optional parameter forces it to 1 |
Chris Austen | 176c965 | 2016-04-30 16:32:17 -0500 | [diff] [blame] | 161 | if (token) |
| 162 | token = strtok(NULL,".-"); |
| 163 | |
| 164 | rev->d[1] = (token != NULL) ? 1 : 0; |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 165 | |
| 166 | free(s); |
| 167 | return 0; |
| 168 | } |
| 169 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 170 | ipmi_ret_t ipmi_app_get_device_id(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 171 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 172 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 173 | { |
| 174 | ipmi_ret_t rc = IPMI_CC_OK; |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 175 | const char *objname = "/org/openbmc/inventory/system/chassis/motherboard/bmc"; |
| 176 | const char *iface = "org.openbmc.InventoryItem"; |
| 177 | char *ver = NULL; |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 178 | char *busname = NULL; |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 179 | int r; |
| 180 | rev_t rev = {0}; |
Nan Li | ee0cb90 | 2016-07-11 15:38:03 +0800 | [diff] [blame] | 181 | ipmi_device_id_t dev_id{}; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 182 | |
| 183 | // Data length |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 184 | *data_len = sizeof(dev_id); |
| 185 | |
Nan Li | ee0cb90 | 2016-07-11 15:38:03 +0800 | [diff] [blame] | 186 | // From IPMI spec, controller that have different application commands, or different |
| 187 | // definitions of OEM fields, are expected to have different Device ID values. |
| 188 | // Set to 0 now. |
| 189 | |
| 190 | // Device Revision is set to 0 now. |
| 191 | // Bit7 identifies if device provide Device SDRs, obmc don't have SDR,we use ipmi to |
| 192 | // simulate SDR, hence the value: |
| 193 | dev_id.revision = 0x80; |
| 194 | |
| 195 | // Firmware revision is already implemented, so get it from appropriate position. |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 196 | r = mapper_get_service(bus, objname, &busname); |
| 197 | if (r < 0) { |
Brad Bishop | 819ddd4 | 2016-10-05 21:19:19 -0400 | [diff] [blame] | 198 | fprintf(stderr, "Failed to get %s bus name: %s\n", |
| 199 | objname, strerror(-r)); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 200 | goto finish; |
| 201 | } |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 202 | r = sd_bus_get_property_string(bus,busname,objname,iface,"version", NULL, &ver); |
| 203 | if ( r < 0 ) { |
| 204 | fprintf(stderr, "Failed to obtain version property: %s\n", strerror(-r)); |
| 205 | } else { |
| 206 | r = convert_version(ver, &rev); |
| 207 | if( r >= 0 ) { |
Nan Li | ee0cb90 | 2016-07-11 15:38:03 +0800 | [diff] [blame] | 208 | // bit7 identifies if the device is available, 0=normal operation, |
| 209 | // 1=device firmware, SDR update or self-initialization in progress. |
| 210 | // our SDR is normal working condition, so mask: |
| 211 | dev_id.fw[0] = 0x7F & rev.major; |
Adriana Kobylak | 0e91264 | 2016-06-22 16:54:39 -0500 | [diff] [blame] | 212 | |
| 213 | rev.minor = (rev.minor > 99 ? 99 : rev.minor); |
Nan Li | ee0cb90 | 2016-07-11 15:38:03 +0800 | [diff] [blame] | 214 | dev_id.fw[1] = rev.minor % 10 + (rev.minor / 10) * 16; |
| 215 | memcpy(&dev_id.aux, rev.d, 4); |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 216 | } |
| 217 | } |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 218 | |
Nan Li | ee0cb90 | 2016-07-11 15:38:03 +0800 | [diff] [blame] | 219 | // IPMI Spec verison 2.0 |
| 220 | dev_id.ipmi_ver = 2; |
| 221 | |
| 222 | // Additional device Support. |
| 223 | // List the 'logical device' commands and functions that the controller supports |
| 224 | // that are in addition to the mandatory IPM and Application commands. |
| 225 | // [7] Chassis Device (device functions as chassis device per ICMB spec.) |
| 226 | // [6] Bridge (device responds to Bridge NetFn commands) |
| 227 | // [5] IPMB Event Generator |
| 228 | // [4] IPMB Event Receiver |
| 229 | // [3] FRU Inventory Device |
| 230 | // [2] SEL Device |
| 231 | // [1] SDR Repository Device |
| 232 | // [0] Sensor Device |
| 233 | // We support FRU/SEL/Sensor now: |
| 234 | dev_id.addn_dev_support = 0x8D; |
| 235 | |
| 236 | // This value is the IANA number assigned to "IBM Platform Firmware |
| 237 | // Division", which is also used by our service processor. We may want |
| 238 | // a different number or at least a different version? |
| 239 | dev_id.manuf_id[0] = 0x41; |
| 240 | dev_id.manuf_id[1] = 0xA7; |
| 241 | dev_id.manuf_id[2] = 0x00; |
| 242 | |
| 243 | // Witherspoon's product ID is hardcoded to 4F42(ASCII 'OB'). |
| 244 | // TODO: openbmc/openbmc#495 |
| 245 | dev_id.prod_id[0] = 0x4F; |
| 246 | dev_id.prod_id[1] = 0x42; |
| 247 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 248 | // Pack the actual response |
Chris Austen | 7303bdc | 2016-04-17 11:50:54 -0500 | [diff] [blame] | 249 | memcpy(response, &dev_id, *data_len); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 250 | finish: |
| 251 | free(busname); |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 252 | return rc; |
| 253 | } |
| 254 | |
Nan Li | 41fa24a | 2016-11-10 20:12:37 +0800 | [diff] [blame^] | 255 | ipmi_ret_t ipmi_app_get_self_test_results(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 256 | ipmi_request_t request, ipmi_response_t response, |
| 257 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 258 | { |
| 259 | ipmi_ret_t rc = IPMI_CC_OK; |
| 260 | |
| 261 | // Byte 2: |
| 262 | // 55h - No error. |
| 263 | // 56h - Self Test funciton not implemented in this controller. |
| 264 | // 57h - Corrupted or inaccesssible data or devices. |
| 265 | // 58h - Fatal hardware error. |
| 266 | // FFh - reserved. |
| 267 | // all other: Device-specific 'internal failure'. |
| 268 | // Byte 3: |
| 269 | // For byte 2 = 55h, 56h, FFh: 00h |
| 270 | // For byte 2 = 58h, all other: Device-specific |
| 271 | // For byte 2 = 57h: self-test error bitfield. |
| 272 | // Note: returning 57h does not imply that all test were run. |
| 273 | // [7] 1b = Cannot access SEL device. |
| 274 | // [6] 1b = Cannot access SDR Repository. |
| 275 | // [5] 1b = Cannot access BMC FRU device. |
| 276 | // [4] 1b = IPMB signal lines do not respond. |
| 277 | // [3] 1b = SDR Repository empty. |
| 278 | // [2] 1b = Internal Use Area of BMC FRU corrupted. |
| 279 | // [1] 1b = controller update 'boot block' firmware corrupted. |
| 280 | // [0] 1b = controller operational firmware corrupted. |
| 281 | |
| 282 | char selftestresults[2] = {0}; |
| 283 | |
| 284 | *data_len = 2; |
| 285 | |
| 286 | selftestresults[0] = 0x56; |
| 287 | selftestresults[1] = 0; |
| 288 | |
| 289 | memcpy(response, selftestresults, *data_len); |
| 290 | |
| 291 | return rc; |
| 292 | } |
| 293 | |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 294 | ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 295 | ipmi_request_t request, ipmi_response_t response, |
| 296 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 297 | { |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 298 | const char *objname = "/org/openbmc/control/chassis0"; |
Adriana Kobylak | 31bccae | 2015-11-05 13:31:06 -0600 | [diff] [blame] | 299 | const char *iface = "org.freedesktop.DBus.Properties"; |
| 300 | const char *chassis_iface = "org.openbmc.control.Chassis"; |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 301 | sd_bus_message *reply = NULL; |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 302 | sd_bus_error error = SD_BUS_ERROR_NULL; |
| 303 | int r = 0; |
| 304 | char *uuid = NULL; |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 305 | char *busname = NULL; |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 306 | |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 307 | // UUID is in RFC4122 format. Ex: 61a39523-78f2-11e5-9862-e6402cfc3223 |
| 308 | // Per IPMI Spec 2.0 need to convert to 16 hex bytes and reverse the byte order |
| 309 | // Ex: 0x2332fc2c40e66298e511f2782395a361 |
| 310 | |
| 311 | const int resp_size = 16; // Response is 16 hex bytes per IPMI Spec |
| 312 | uint8_t resp_uuid[resp_size]; // Array to hold the formatted response |
| 313 | int resp_loc = resp_size-1; // Point resp end of array to save in reverse order |
| 314 | int i = 0; |
| 315 | char *tokptr = NULL; |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 316 | char *id_octet = NULL; |
| 317 | |
| 318 | // Status code. |
| 319 | ipmi_ret_t rc = IPMI_CC_OK; |
| 320 | *data_len = 0; |
| 321 | |
| 322 | printf("IPMI GET DEVICE GUID\n"); |
| 323 | |
| 324 | // Call Get properties method with the interface and property name |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 325 | r = mapper_get_service(bus, objname, &busname); |
| 326 | if (r < 0) { |
Brad Bishop | 819ddd4 | 2016-10-05 21:19:19 -0400 | [diff] [blame] | 327 | fprintf(stderr, "Failed to get %s bus name: %s\n", |
| 328 | objname, strerror(-r)); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 329 | goto finish; |
| 330 | } |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 331 | r = sd_bus_call_method(bus,busname,objname,iface, |
| 332 | "Get",&error, &reply, "ss", |
| 333 | chassis_iface, "uuid"); |
| 334 | if (r < 0) |
| 335 | { |
| 336 | fprintf(stderr, "Failed to call Get Method: %s\n", strerror(-r)); |
| 337 | rc = IPMI_CC_UNSPECIFIED_ERROR; |
| 338 | goto finish; |
| 339 | } |
| 340 | |
| 341 | r = sd_bus_message_read(reply, "v", "s", &uuid); |
| 342 | if (r < 0 || uuid == NULL) |
| 343 | { |
| 344 | fprintf(stderr, "Failed to get a response: %s", strerror(-r)); |
| 345 | rc = IPMI_CC_RESPONSE_ERROR; |
| 346 | goto finish; |
| 347 | } |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 348 | |
| 349 | // Traverse the UUID |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 350 | id_octet = strtok_r(uuid, "-", &tokptr); // Get the UUID octects separated by dash |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 351 | |
| 352 | if (id_octet == NULL) |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 353 | { |
| 354 | // Error |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 355 | fprintf(stderr, "Unexpected UUID format: %s", uuid); |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 356 | rc = IPMI_CC_RESPONSE_ERROR; |
| 357 | goto finish; |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | while (id_octet != NULL) |
| 361 | { |
| 362 | // Calculate the octet string size since it varies |
| 363 | // Divide it by 2 for the array size since 1 byte is built from 2 chars |
| 364 | int tmp_size = strlen(id_octet)/2; |
| 365 | |
| 366 | for(i = 0; i < tmp_size; i++) |
| 367 | { |
Joel Stanley | 38310cd | 2015-11-25 17:32:08 +1030 | [diff] [blame] | 368 | char tmp_array[3] = {0}; // Holder of the 2 chars that will become a byte |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 369 | strncpy(tmp_array, id_octet, 2); // 2 chars at a time |
| 370 | |
| 371 | int resp_byte = strtoul(tmp_array, NULL, 16); // Convert to hex byte |
| 372 | memcpy((void*)&resp_uuid[resp_loc], &resp_byte, 1); // Copy end to first |
| 373 | resp_loc--; |
| 374 | id_octet+=2; // Finished with the 2 chars, advance |
| 375 | } |
| 376 | id_octet=strtok_r(NULL, "-", &tokptr); // Get next octet |
| 377 | } |
| 378 | |
| 379 | // Data length |
| 380 | *data_len = resp_size; |
| 381 | |
| 382 | // Pack the actual response |
| 383 | memcpy(response, &resp_uuid, *data_len); |
| 384 | |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 385 | finish: |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 386 | sd_bus_error_free(&error); |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 387 | reply = sd_bus_message_unref(reply); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 388 | free(busname); |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 389 | |
| 390 | return rc; |
| 391 | } |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 392 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 393 | ipmi_ret_t ipmi_app_get_bt_capabilities(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 394 | ipmi_request_t request, ipmi_response_t response, |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 395 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 396 | { |
| 397 | printf("Handling Netfn:[0x%X], Cmd:[0x%X]\n",netfn,cmd); |
| 398 | |
| 399 | // Status code. |
| 400 | ipmi_ret_t rc = IPMI_CC_OK; |
| 401 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 402 | uint8_t str[] = {0x01, MAX_IPMI_BUFFER, MAX_IPMI_BUFFER, 0x0A, 0x01}; |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 403 | |
| 404 | // Data length |
| 405 | *data_len = sizeof(str); |
| 406 | |
| 407 | // Pack the actual response |
| 408 | memcpy(response, &str, *data_len); |
| 409 | |
| 410 | return rc; |
| 411 | } |
| 412 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 413 | |
| 414 | struct set_wd_data_t { |
| 415 | uint8_t t_use; |
| 416 | uint8_t t_action; |
| 417 | uint8_t preset; |
| 418 | uint8_t flags; |
| 419 | uint8_t ls; |
| 420 | uint8_t ms; |
| 421 | } __attribute__ ((packed)); |
| 422 | |
| 423 | |
| 424 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 425 | ipmi_ret_t ipmi_app_set_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 426 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 427 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 428 | { |
Chris Austen | 454acfe | 2015-10-29 23:03:34 -0500 | [diff] [blame] | 429 | const char *objname = "/org/openbmc/watchdog/host0"; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 430 | const char *iface = "org.openbmc.Watchdog"; |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 431 | sd_bus_message *reply = NULL; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 432 | sd_bus_error error = SD_BUS_ERROR_NULL; |
| 433 | int r = 0; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 434 | |
| 435 | set_wd_data_t *reqptr = (set_wd_data_t*) request; |
| 436 | uint16_t timer = 0; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 437 | uint32_t timer_ms = 0; |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 438 | char *busname = NULL; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 439 | *data_len = 0; |
| 440 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 441 | // Get number of 100ms intervals |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 442 | timer = (((uint16_t)reqptr->ms) << 8) + reqptr->ls; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 443 | // Get timer value in ms |
| 444 | timer_ms = timer * 100; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 445 | |
| 446 | printf("WATCHDOG SET Timer:[0x%X] 100ms intervals\n",timer); |
| 447 | |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 448 | // Get bus name |
| 449 | r = mapper_get_service(bus, objname, &busname); |
| 450 | if (r < 0) { |
Brad Bishop | 819ddd4 | 2016-10-05 21:19:19 -0400 | [diff] [blame] | 451 | fprintf(stderr, "Failed to get %s bus name: %s\n", |
| 452 | objname, strerror(-r)); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 453 | goto finish; |
| 454 | } |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 455 | // Set watchdog timer |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 456 | r = sd_bus_call_method(bus, busname, objname, iface, |
| 457 | "set", &error, &reply, "i", timer_ms); |
| 458 | if(r < 0) |
Adriana Kobylak | 0896be3 | 2015-10-22 13:27:23 -0500 | [diff] [blame] | 459 | { |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 460 | fprintf(stderr, "Failed to call the SET method: %s\n", strerror(-r)); |
| 461 | goto finish; |
Adriana Kobylak | 0896be3 | 2015-10-22 13:27:23 -0500 | [diff] [blame] | 462 | } |
| 463 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 464 | sd_bus_error_free(&error); |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 465 | reply = sd_bus_message_unref(reply); |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 466 | |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 467 | // Stop the current watchdog if any |
| 468 | r = sd_bus_call_method(bus, busname, objname, iface, |
| 469 | "stop", &error, &reply, NULL); |
| 470 | if(r < 0) |
| 471 | { |
| 472 | fprintf(stderr, "Failed to call the STOP method: %s\n", strerror(-r)); |
| 473 | goto finish; |
| 474 | } |
| 475 | |
| 476 | if (reqptr->t_use & 0x40) |
| 477 | { |
| 478 | sd_bus_error_free(&error); |
| 479 | reply = sd_bus_message_unref(reply); |
| 480 | |
| 481 | // Start the watchdog if requested |
| 482 | r = sd_bus_call_method(bus, busname, objname, iface, |
| 483 | "start", &error, &reply, NULL); |
| 484 | if(r < 0) |
| 485 | { |
| 486 | fprintf(stderr, "Failed to call the START method: %s\n", strerror(-r)); |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | finish: |
| 491 | sd_bus_error_free(&error); |
| 492 | reply = sd_bus_message_unref(reply); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 493 | free(busname); |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 494 | |
| 495 | return (r < 0) ? -1 : IPMI_CC_OK; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 499 | ipmi_ret_t ipmi_app_reset_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 500 | ipmi_request_t request, ipmi_response_t response, |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 501 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 502 | { |
Chris Austen | 454acfe | 2015-10-29 23:03:34 -0500 | [diff] [blame] | 503 | const char *objname = "/org/openbmc/watchdog/host0"; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 504 | const char *iface = "org.openbmc.Watchdog"; |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 505 | sd_bus_message *reply = NULL; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 506 | sd_bus_error error = SD_BUS_ERROR_NULL; |
| 507 | int r = 0; |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 508 | char *busname = NULL; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 509 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 510 | // Status code. |
| 511 | ipmi_ret_t rc = IPMI_CC_OK; |
| 512 | *data_len = 0; |
| 513 | |
| 514 | printf("WATCHDOG RESET\n"); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 515 | // Get bus name |
| 516 | r = mapper_get_service(bus, objname, &busname); |
| 517 | if (r < 0) { |
Brad Bishop | 819ddd4 | 2016-10-05 21:19:19 -0400 | [diff] [blame] | 518 | fprintf(stderr, "Failed to get %s bus name: %s\n", |
| 519 | objname, strerror(-r)); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 520 | goto finish; |
| 521 | } |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 522 | // Refresh watchdog |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 523 | r = sd_bus_call_method(bus, busname, objname, iface, |
| 524 | "poke", &error, &reply, NULL); |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 525 | if (r < 0) { |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 526 | fprintf(stderr, "Failed to add reset watchdog: %s\n", strerror(-r)); |
| 527 | rc = -1; |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 528 | } |
| 529 | |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 530 | finish: |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 531 | sd_bus_error_free(&error); |
vishwa | 1eaea4f | 2016-02-26 11:57:40 -0600 | [diff] [blame] | 532 | reply = sd_bus_message_unref(reply); |
Sergey Solomin | eb9b814 | 2016-08-23 09:07:28 -0500 | [diff] [blame] | 533 | free(busname); |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 534 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 535 | return rc; |
| 536 | } |
| 537 | |
Chris Austen | c2cd29d | 2016-02-05 20:02:29 -0600 | [diff] [blame] | 538 | // ATTENTION: This ipmi function is very hardcoded on purpose |
| 539 | // OpenBMC does not fully support IPMI. This command is useful |
| 540 | // to have around because it enables testing of interfaces with |
| 541 | // the IPMI tool. |
| 542 | #define GET_CHANNEL_INFO_CHANNEL_OFFSET 0 |
| 543 | // IPMI Table 6-2 |
| 544 | #define IPMI_CHANNEL_TYPE_IPMB 1 |
| 545 | // IPMI Table 6-3 |
| 546 | #define IPMI_CHANNEL_MEDIUM_TYPE_OTHER 6 |
| 547 | |
| 548 | ipmi_ret_t ipmi_app_channel_info(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 549 | ipmi_request_t request, ipmi_response_t response, |
| 550 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 551 | { |
| 552 | ipmi_ret_t rc = IPMI_CC_OK; |
| 553 | uint8_t resp[] = { |
| 554 | 1, |
| 555 | IPMI_CHANNEL_MEDIUM_TYPE_OTHER, |
| 556 | IPMI_CHANNEL_TYPE_IPMB, |
| 557 | 1,0x41,0xA7,0x00,0,0}; |
| 558 | uint8_t *p = (uint8_t*) request; |
| 559 | |
| 560 | printf("IPMI APP GET CHANNEL INFO\n"); |
| 561 | |
tomjose | 7ec0add | 2016-06-27 07:59:28 -0500 | [diff] [blame] | 562 | // The supported channels numbers are 1 and 8. |
| 563 | // Channel Number E is used as way to identify the current channel |
| 564 | // that the command is being is received from. |
tomjose | 13fb441 | 2016-03-08 14:02:34 -0600 | [diff] [blame] | 565 | if (*p == 0xe || *p == 1 || *p == 8) { |
Chris Austen | c2cd29d | 2016-02-05 20:02:29 -0600 | [diff] [blame] | 566 | |
| 567 | *data_len = sizeof(resp); |
| 568 | memcpy(response, resp, *data_len); |
| 569 | |
| 570 | } else { |
| 571 | rc = IPMI_CC_PARM_OUT_OF_RANGE; |
| 572 | *data_len = 0; |
| 573 | } |
| 574 | |
| 575 | return rc; |
| 576 | } |
| 577 | |
Adriana Kobylak | dfc8d77 | 2015-10-20 09:34:48 -0500 | [diff] [blame] | 578 | ipmi_ret_t ipmi_app_set_bmc_global_enables(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 579 | ipmi_request_t request, ipmi_response_t response, |
| 580 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 581 | { |
| 582 | ipmi_ret_t rc = IPMI_CC_OK; |
| 583 | *data_len = 0; |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 584 | |
Adriana Kobylak | dfc8d77 | 2015-10-20 09:34:48 -0500 | [diff] [blame] | 585 | // Event and message logging enabled by default so return for now |
| 586 | printf("IPMI APP SET BMC GLOBAL ENABLES Ignoring for now\n"); |
| 587 | |
| 588 | return rc; |
| 589 | } |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 590 | |
| 591 | |
| 592 | |
Adriana Kobylak | 3a552e1 | 2015-10-19 16:11:00 -0500 | [diff] [blame] | 593 | ipmi_ret_t ipmi_app_wildcard_handler(ipmi_netfn_t netfn, ipmi_cmd_t cmd, |
| 594 | ipmi_request_t request, ipmi_response_t response, |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 595 | ipmi_data_len_t data_len, ipmi_context_t context) |
| 596 | { |
| 597 | printf("Handling WILDCARD Netfn:[0x%X], Cmd:[0x%X]\n",netfn, cmd); |
| 598 | |
| 599 | // Status code. |
Nan Li | 70aa8d9 | 2016-08-29 00:11:10 +0800 | [diff] [blame] | 600 | ipmi_ret_t rc = IPMI_CC_INVALID; |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 601 | |
| 602 | *data_len = strlen("THIS IS WILDCARD"); |
| 603 | |
| 604 | // Now pack actual response |
| 605 | memcpy(response, "THIS IS WILDCARD", *data_len); |
| 606 | |
| 607 | return rc; |
| 608 | } |
| 609 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 610 | void register_netfn_app_functions() |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 611 | { |
| 612 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CAP_BIT); |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 613 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CAP_BIT, NULL, ipmi_app_get_bt_capabilities); |
| 614 | |
| 615 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_WILDCARD); |
| 616 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_WILDCARD, NULL, ipmi_app_wildcard_handler); |
| 617 | |
| 618 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_RESET_WD); |
| 619 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_RESET_WD, NULL, ipmi_app_reset_watchdog); |
| 620 | |
| 621 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_SET_WD); |
| 622 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_WD, NULL, ipmi_app_set_watchdog); |
| 623 | |
| 624 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_DEVICE_ID); |
| 625 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_DEVICE_ID, NULL, ipmi_app_get_device_id); |
| 626 | |
Nan Li | 41fa24a | 2016-11-10 20:12:37 +0800 | [diff] [blame^] | 627 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_SELF_TEST_RESULTS); |
| 628 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_SELF_TEST_RESULTS, NULL, ipmi_app_get_self_test_results); |
| 629 | |
Adriana Kobylak | d100ee5 | 2015-10-20 17:02:37 -0500 | [diff] [blame] | 630 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_DEVICE_GUID); |
| 631 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_DEVICE_GUID, NULL, ipmi_app_get_device_guid); |
| 632 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 633 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_SET_ACPI); |
| 634 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_ACPI, NULL, ipmi_app_set_acpi_power_state); |
| 635 | |
| 636 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_READ_EVENT); |
| 637 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_READ_EVENT, NULL, ipmi_app_read_event); |
Adriana Kobylak | dfc8d77 | 2015-10-20 09:34:48 -0500 | [diff] [blame] | 638 | |
| 639 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, |
| 640 | IPMI_CMD_SET_BMC_GLOBAL_ENABLES); |
| 641 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_BMC_GLOBAL_ENABLES, NULL, |
| 642 | ipmi_app_set_bmc_global_enables); |
| 643 | |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 644 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_MSG_FLAGS); |
| 645 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_MSG_FLAGS, NULL, ipmi_app_get_msg_flags); |
| 646 | |
Chris Austen | c2cd29d | 2016-02-05 20:02:29 -0600 | [diff] [blame] | 647 | |
| 648 | printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n",NETFUN_APP, IPMI_CMD_GET_CHAN_INFO); |
| 649 | ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_CHAN_INFO, NULL, ipmi_app_channel_info); |
| 650 | |
| 651 | |
| 652 | |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 653 | return; |
| 654 | } |
| 655 | |
Chris Austen | 6caf28b | 2015-10-13 12:40:40 -0500 | [diff] [blame] | 656 | |