blob: 94958a578940c220c63361e08cead09b3f86477d [file] [log] [blame]
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001/*
2 * Copyright (c) 2018 Intel Corporation.
3 * Copyright (c) 2018-present Facebook.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include "xyz/openbmc_project/Common/error.hpp"
19#include <ipmid/api.h>
20
Vijay Khemka1d4a0692019-04-09 15:20:28 -070021#include <nlohmann/json.hpp>
Vijay Khemkae7d23d02019-03-08 13:13:40 -080022#include <array>
23#include <commandutils.hpp>
24#include <cstring>
25#include <iostream>
Vijay Khemka1d4a0692019-04-09 15:20:28 -070026#include <iomanip>
27#include <sstream>
28#include <fstream>
Vijay Khemkae7d23d02019-03-08 13:13:40 -080029#include <oemcommands.hpp>
Vijay Khemka1b6fae32019-03-25 17:43:01 -070030#include <ipmid/utils.hpp>
Vijay Khemkae7d23d02019-03-08 13:13:40 -080031#include <phosphor-logging/log.hpp>
32#include <sdbusplus/bus.hpp>
33#include <string>
34#include <vector>
35
36#define SIZE_IANA_ID 3
37
38namespace ipmi
39{
Vijay Khemkaa7231892019-10-11 11:35:05 -070040
41using namespace phosphor::logging;
42
Vijay Khemkae7d23d02019-03-08 13:13:40 -080043static void registerOEMFunctions() __attribute__((constructor));
44sdbusplus::bus::bus dbus(ipmid_get_sd_bus_connection()); // from ipmid/api.h
45static constexpr size_t maxFRUStringLength = 0x3F;
46
Vijay Khemkacc0d6d92019-08-27 14:51:17 -070047int plat_udbg_get_post_desc(uint8_t, uint8_t *, uint8_t, uint8_t *, uint8_t *,
48 uint8_t *);
Vijay Khemka38183d62019-08-28 16:19:33 -070049int plat_udbg_get_gpio_desc(uint8_t, uint8_t *, uint8_t *, uint8_t *, uint8_t *,
50 uint8_t *);
Vijay Khemkae7d23d02019-03-08 13:13:40 -080051ipmi_ret_t plat_udbg_get_frame_data(uint8_t, uint8_t, uint8_t *, uint8_t *,
52 uint8_t *);
53ipmi_ret_t plat_udbg_control_panel(uint8_t, uint8_t, uint8_t, uint8_t *,
54 uint8_t *);
Vijay Khemka1b6fae32019-03-25 17:43:01 -070055namespace variant_ns = sdbusplus::message::variant_ns;
Vijay Khemkafeaa9812019-08-27 15:08:08 -070056nlohmann::json oemData __attribute__((init_priority(101)));
Vijay Khemka1b6fae32019-03-25 17:43:01 -070057
58enum class LanParam : uint8_t
59{
60 INPROGRESS = 0,
61 AUTHSUPPORT = 1,
62 AUTHENABLES = 2,
63 IP = 3,
64 IPSRC = 4,
65 MAC = 5,
66 SUBNET = 6,
67 GATEWAY = 12,
68 VLAN = 20,
69 CIPHER_SUITE_COUNT = 22,
70 CIPHER_SUITE_ENTRIES = 23,
71 IPV6 = 59,
72};
73
Vijay Khemkaa7231892019-10-11 11:35:05 -070074namespace network
75{
76
77constexpr auto ROOT = "/xyz/openbmc_project/network";
78constexpr auto SERVICE = "xyz.openbmc_project.Network";
79constexpr auto IPV4_TYPE = "ipv4";
80constexpr auto IPV6_TYPE = "ipv6";
81constexpr auto IPV4_PREFIX = "169.254";
82constexpr auto IPV6_PREFIX = "fe80";
83constexpr auto IP_INTERFACE = "xyz.openbmc_project.Network.IP";
84constexpr auto MAC_INTERFACE = "xyz.openbmc_project.Network.MACAddress";
85
86bool isLinkLocalIP(const std::string &address)
87{
88 return address.find(IPV4_PREFIX) == 0 || address.find(IPV6_PREFIX) == 0;
89}
90
91DbusObjectInfo getIPObject(sdbusplus::bus::bus &bus,
92 const std::string &interface,
93 const std::string &serviceRoot,
94 const std::string &match)
95{
96 auto objectTree = getAllDbusObjects(bus, serviceRoot, interface, match);
97
98 if (objectTree.empty())
99 {
100 log<level::ERR>("No Object has implemented the IP interface",
101 entry("INTERFACE=%s", interface.c_str()));
102 }
103
104 DbusObjectInfo objectInfo;
105
106 for (auto &object : objectTree)
107 {
108 auto variant =
109 ipmi::getDbusProperty(bus, object.second.begin()->first,
110 object.first, IP_INTERFACE, "Address");
111
112 objectInfo = std::make_pair(object.first, object.second.begin()->first);
113
114 // if LinkLocalIP found look for Non-LinkLocalIP
115 if (isLinkLocalIP(std::get<std::string>(variant)))
116 {
117 continue;
118 }
119 else
120 {
121 break;
122 }
123 }
124 return objectInfo;
125}
126
127} // namespace network
128
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700129//----------------------------------------------------------------------
130// Helper functions for storing oem data
131//----------------------------------------------------------------------
132
133void flushOemData()
134{
135 std::ofstream file(JSON_OEM_DATA_FILE);
136 file << oemData;
Vijay Khemkafeaa9812019-08-27 15:08:08 -0700137 file.close();
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700138 return;
139}
140
141std::string bytesToStr(uint8_t *byte, int len)
142{
143 std::stringstream ss;
144 int i;
145
146 ss << std::hex;
147 for (i = 0; i < len; i++)
148 {
149 ss << std::setw(2) << std::setfill('0') << (int)byte[i];
150 }
151
152 return ss.str();
153}
154
155int strToBytes(std::string &str, uint8_t *data)
156{
157 std::string sstr;
158 int i;
159
160 for (i = 0; i < (str.length()) / 2; i++)
161 {
162 sstr = str.substr(i * 2, 2);
163 data[i] = (uint8_t)std::strtol(sstr.c_str(), NULL, 16);
164 }
165 return i;
166}
167
Vijay Khemka1b6fae32019-03-25 17:43:01 -0700168ipmi_ret_t getNetworkData(uint8_t lan_param, char *data)
169{
170 ipmi_ret_t rc = IPMI_CC_OK;
171 sdbusplus::bus::bus bus(ipmid_get_sd_bus_connection());
172
173 const std::string ethdevice = "eth0";
174
175 switch (static_cast<LanParam>(lan_param))
176 {
177 case LanParam::IP:
178 {
Vijay Khemkaa7231892019-10-11 11:35:05 -0700179 auto ethIP = ethdevice + "/" + ipmi::network::IPV4_TYPE;
Vijay Khemka1b6fae32019-03-25 17:43:01 -0700180 std::string ipaddress;
Vijay Khemkaa7231892019-10-11 11:35:05 -0700181 auto ipObjectInfo = ipmi::network::getIPObject(
Vijay Khemka1b6fae32019-03-25 17:43:01 -0700182 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP);
183
184 auto properties = ipmi::getAllDbusProperties(
185 bus, ipObjectInfo.second, ipObjectInfo.first,
186 ipmi::network::IP_INTERFACE);
187
188 ipaddress = variant_ns::get<std::string>(properties["Address"]);
189
190 std::strcpy(data, ipaddress.c_str());
191 }
192 break;
193
194 case LanParam::IPV6:
195 {
Vijay Khemkaa7231892019-10-11 11:35:05 -0700196 auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE;
Vijay Khemka1b6fae32019-03-25 17:43:01 -0700197 std::string ipaddress;
Vijay Khemkaa7231892019-10-11 11:35:05 -0700198 auto ipObjectInfo = ipmi::network::getIPObject(
Vijay Khemka1b6fae32019-03-25 17:43:01 -0700199 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP);
200
201 auto properties = ipmi::getAllDbusProperties(
202 bus, ipObjectInfo.second, ipObjectInfo.first,
203 ipmi::network::IP_INTERFACE);
204
205 ipaddress = variant_ns::get<std::string>(properties["Address"]);
206
207 std::strcpy(data, ipaddress.c_str());
208 }
209 break;
210
211 case LanParam::MAC:
212 {
213 std::string macAddress;
214 auto macObjectInfo =
215 ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE,
216 ipmi::network::ROOT, ethdevice);
217
218 auto variant = ipmi::getDbusProperty(
219 bus, macObjectInfo.second, macObjectInfo.first,
220 ipmi::network::MAC_INTERFACE, "MACAddress");
221
222 macAddress = variant_ns::get<std::string>(variant);
223
224 sscanf(macAddress.c_str(), ipmi::network::MAC_ADDRESS_FORMAT,
225 (data), (data + 1), (data + 2), (data + 3), (data + 4),
226 (data + 5));
227 std::strcpy(data, macAddress.c_str());
228 }
229 break;
230
231 default:
232 rc = IPMI_CC_PARM_OUT_OF_RANGE;
233 }
234 return rc;
235}
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800236
237// return code: 0 successful
238int8_t getFruData(std::string &data, std::string &name)
239{
240 std::string objpath = "/xyz/openbmc_project/FruDevice";
241 std::string intf = "xyz.openbmc_project.FruDeviceManager";
242 std::string service = getService(dbus, intf, objpath);
243 ObjectValueTree valueTree = getManagedObjects(dbus, service, "/");
244 if (valueTree.empty())
245 {
246 phosphor::logging::log<phosphor::logging::level::ERR>(
247 "No object implements interface",
248 phosphor::logging::entry("INTF=%s", intf.c_str()));
249 return -1;
250 }
251
252 for (const auto &item : valueTree)
253 {
254 auto interface = item.second.find("xyz.openbmc_project.FruDevice");
255 if (interface == item.second.end())
256 {
257 continue;
258 }
259
260 auto property = interface->second.find(name.c_str());
261 if (property == interface->second.end())
262 {
263 continue;
264 }
265
266 try
267 {
268 Value variant = property->second;
269 std::string &result =
270 sdbusplus::message::variant_ns::get<std::string>(variant);
271 if (result.size() > maxFRUStringLength)
272 {
273 phosphor::logging::log<phosphor::logging::level::ERR>(
274 "FRU serial number exceed maximum length");
275 return -1;
276 }
277 data = result;
278 return 0;
279 }
280 catch (sdbusplus::message::variant_ns::bad_variant_access &e)
281 {
282 phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
283 return -1;
284 }
285 }
286 return -1;
287}
288
289typedef struct
290{
291 uint8_t cur_power_state;
292 uint8_t last_power_event;
293 uint8_t misc_power_state;
294 uint8_t front_panel_button_cap_status;
295} ipmi_get_chassis_status_t;
296
297// Todo: Needs to update this as per power policy when integrated
298//----------------------------------------------------------------------
299// Get Chassis Status commands
300//----------------------------------------------------------------------
301ipmi_ret_t ipmiGetChassisStatus(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
302 ipmi_request_t request,
303 ipmi_response_t response,
304 ipmi_data_len_t data_len,
305 ipmi_context_t context)
306{
307 ipmi_get_chassis_status_t chassis_status;
308 uint8_t s = 2;
309
310 *data_len = 4;
311
312 // Current Power State
313 // [7] reserved
314 // [6..5] power restore policy
315 // 00b = chassis stays powered off after AC/mains returns
316 // 01b = after AC returns, power is restored to the state that was
317 // in effect when AC/mains was lost.
318 // 10b = chassis always powers up after AC/mains returns
319 // 11b = unknow
320 // Set to 00b, by observing the hardware behavior.
321 // Do we need to define a dbus property to identify the restore
322 // policy?
323
324 // [4] power control fault
325 // 1b = controller attempted to turn system power on or off, but
326 // system did not enter desired state.
327 // Set to 0b, since We don't support it..
328
329 // [3] power fault
330 // 1b = fault detected in main power subsystem.
331 // set to 0b. for we don't support it.
332
333 // [2] 1b = interlock (chassis is presently shut down because a chassis
334 // panel interlock switch is active). (IPMI 1.5)
335 // set to 0b, for we don't support it.
336
337 // [1] power overload
338 // 1b = system shutdown because of power overload condition.
339 // set to 0b, for we don't support it.
340
341 // [0] power is on
342 // 1b = system power is on
343 // 0b = system power is off(soft-off S4/S5, or mechanical off)
344
345 chassis_status.cur_power_state = ((s & 0x3) << 5) | (1 & 0x1);
346
347 // Last Power Event
348 // [7..5] – reserved
349 // [4] – 1b = last ‘Power is on’ state was entered via IPMI command
350 // [3] – 1b = last power down caused by power fault
351 // [2] – 1b = last power down caused by a power interlock being activated
352 // [1] – 1b = last power down caused by a Power overload
353 // [0] – 1b = AC failed
354 // set to 0x0, for we don't support these fields.
355
356 chassis_status.last_power_event = 0;
357
358 // Misc. Chassis State
359 // [7] – reserved
360 // [6] – 1b = Chassis Identify command and state info supported (Optional)
361 // 0b = Chassis Identify command support unspecified via this command.
362 // (The Get Command Support command , if implemented, would still
363 // indicate support for the Chassis Identify command)
364 // [5..4] – Chassis Identify State. Mandatory when bit[6] =1b, reserved
365 // (return
366 // as 00b) otherwise. Returns the present chassis identify state.
367 // Refer to the Chassis Identify command for more info.
368 // 00b = chassis identify state = Off
369 // 01b = chassis identify state = Temporary(timed) On
370 // 10b = chassis identify state = Indefinite On
371 // 11b = reserved
372 // [3] – 1b = Cooling/fan fault detected
373 // [2] – 1b = Drive Fault
374 // [1] – 1b = Front Panel Lockout active (power off and reset via chassis
375 // push-buttons disabled.)
376 // [0] – 1b = Chassis Intrusion active
377 // set to 0, for we don't support them.
378 chassis_status.misc_power_state = 0x40;
379
380 // Front Panel Button Capabilities and disable/enable status(Optional)
381 // set to 0, for we don't support them.
382 chassis_status.front_panel_button_cap_status = 0;
383
384 // Pack the actual response
385 std::memcpy(response, &chassis_status, *data_len);
386
387 return IPMI_CC_OK;
388}
389
390//----------------------------------------------------------------------
391// Get Debug Frame Info
392//----------------------------------------------------------------------
393ipmi_ret_t ipmiOemDbgGetFrameInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
394 ipmi_request_t request,
395 ipmi_response_t response,
396 ipmi_data_len_t data_len,
397 ipmi_context_t context)
398{
399 uint8_t *req = reinterpret_cast<uint8_t *>(request);
400 uint8_t *res = reinterpret_cast<uint8_t *>(response);
401 uint8_t num_frames = 3;
402
403 std::memcpy(res, req, SIZE_IANA_ID); // IANA ID
404 res[SIZE_IANA_ID] = num_frames;
405 *data_len = SIZE_IANA_ID + 1;
406
407 return IPMI_CC_OK;
408}
409
410//----------------------------------------------------------------------
411// Get Debug Updated Frames
412//----------------------------------------------------------------------
413ipmi_ret_t ipmiOemDbgGetUpdFrames(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
414 ipmi_request_t request,
415 ipmi_response_t response,
416 ipmi_data_len_t data_len,
417 ipmi_context_t context)
418{
419 uint8_t *req = reinterpret_cast<uint8_t *>(request);
420 uint8_t *res = reinterpret_cast<uint8_t *>(response);
421 uint8_t num_updates = 3;
422 *data_len = 4;
423
424 std::memcpy(res, req, SIZE_IANA_ID); // IANA ID
425 res[SIZE_IANA_ID] = num_updates;
426 *data_len = SIZE_IANA_ID + num_updates + 1;
427 res[SIZE_IANA_ID + 1] = 1; // info page update
428 res[SIZE_IANA_ID + 2] = 2; // cri sel update
429 res[SIZE_IANA_ID + 3] = 3; // cri sensor update
430
431 return IPMI_CC_OK;
432}
433
434//----------------------------------------------------------------------
435// Get Debug POST Description
436//----------------------------------------------------------------------
437ipmi_ret_t ipmiOemDbgGetPostDesc(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
438 ipmi_request_t request,
439 ipmi_response_t response,
440 ipmi_data_len_t data_len,
441 ipmi_context_t context)
442{
443 uint8_t *req = reinterpret_cast<uint8_t *>(request);
444 uint8_t *res = reinterpret_cast<uint8_t *>(response);
445 uint8_t index = 0;
446 uint8_t next = 0;
447 uint8_t end = 0;
448 uint8_t phase = 0;
Vijay Khemkacc0d6d92019-08-27 14:51:17 -0700449 uint8_t descLen = 0;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800450 int ret;
451
452 index = req[3];
453 phase = req[4];
454
Vijay Khemkacc0d6d92019-08-27 14:51:17 -0700455 ret = plat_udbg_get_post_desc(index, &next, phase, &end, &descLen, &res[8]);
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800456 if (ret)
457 {
458 memcpy(res, req, SIZE_IANA_ID); // IANA ID
459 *data_len = SIZE_IANA_ID;
460 return IPMI_CC_UNSPECIFIED_ERROR;
461 }
462
463 memcpy(res, req, SIZE_IANA_ID); // IANA ID
464 res[3] = index;
465 res[4] = next;
466 res[5] = phase;
467 res[6] = end;
Vijay Khemkacc0d6d92019-08-27 14:51:17 -0700468 res[7] = descLen;
469 *data_len = SIZE_IANA_ID + 5 + descLen;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800470
471 return IPMI_CC_OK;
472}
473
474//----------------------------------------------------------------------
475// Get Debug GPIO Description
476//----------------------------------------------------------------------
477ipmi_ret_t ipmiOemDbgGetGpioDesc(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
478 ipmi_request_t request,
479 ipmi_response_t response,
480 ipmi_data_len_t data_len,
481 ipmi_context_t context)
482{
483 uint8_t *req = reinterpret_cast<uint8_t *>(request);
484 uint8_t *res = reinterpret_cast<uint8_t *>(response);
485
Vijay Khemka38183d62019-08-28 16:19:33 -0700486 uint8_t index = 0;
487 uint8_t next = 0;
488 uint8_t level = 0;
489 uint8_t pinDef = 0;
490 uint8_t descLen = 0;
491 int ret;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800492
Vijay Khemka38183d62019-08-28 16:19:33 -0700493 index = req[3];
494
495 ret = plat_udbg_get_gpio_desc(index, &next, &level, &pinDef, &descLen,
496 &res[8]);
497 if (ret)
498 {
499 memcpy(res, req, SIZE_IANA_ID); // IANA ID
500 *data_len = SIZE_IANA_ID;
501 return IPMI_CC_UNSPECIFIED_ERROR;
502 }
503
504 memcpy(res, req, SIZE_IANA_ID); // IANA ID
505 res[3] = index;
506 res[4] = next;
507 res[5] = level;
508 res[6] = pinDef;
509 res[7] = descLen;
510 *data_len = SIZE_IANA_ID + 5 + descLen;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800511
512 return IPMI_CC_OK;
513}
514
515//----------------------------------------------------------------------
516// Get Debug Frame Data
517//----------------------------------------------------------------------
518ipmi_ret_t ipmiOemDbgGetFrameData(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
519 ipmi_request_t request,
520 ipmi_response_t response,
521 ipmi_data_len_t data_len,
522 ipmi_context_t context)
523{
524 uint8_t *req = reinterpret_cast<uint8_t *>(request);
525 uint8_t *res = reinterpret_cast<uint8_t *>(response);
526 uint8_t frame;
527 uint8_t page;
528 uint8_t next;
529 uint8_t count;
530 int ret;
531
532 frame = req[3];
533 page = req[4];
534 int fr = frame;
535 int pg = page;
536
537 ret = plat_udbg_get_frame_data(frame, page, &next, &count, &res[7]);
538 if (ret)
539 {
540 memcpy(res, req, SIZE_IANA_ID); // IANA ID
541 *data_len = SIZE_IANA_ID;
542 return IPMI_CC_UNSPECIFIED_ERROR;
543 }
544
545 memcpy(res, req, SIZE_IANA_ID); // IANA ID
546 res[3] = frame;
547 res[4] = page;
548 res[5] = next;
549 res[6] = count;
550 *data_len = SIZE_IANA_ID + 4 + count;
551
552 return IPMI_CC_OK;
553}
554
555//----------------------------------------------------------------------
556// Get Debug Control Panel
557//----------------------------------------------------------------------
558ipmi_ret_t ipmiOemDbgGetCtrlPanel(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
559 ipmi_request_t request,
560 ipmi_response_t response,
561 ipmi_data_len_t data_len,
562 ipmi_context_t context)
563{
564 uint8_t *req = reinterpret_cast<uint8_t *>(request);
565 uint8_t *res = reinterpret_cast<uint8_t *>(response);
566
567 uint8_t panel;
568 uint8_t operation;
569 uint8_t item;
570 uint8_t count;
571 ipmi_ret_t ret;
572
573 panel = req[3];
574 operation = req[4];
575 item = req[5];
576
577 ret = plat_udbg_control_panel(panel, operation, item, &count, &res[3]);
578
579 std::memcpy(res, req, SIZE_IANA_ID); // IANA ID
580 *data_len = SIZE_IANA_ID + count;
581
582 return ret;
583}
584
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800585//----------------------------------------------------------------------
586// Set Dimm Info (CMD_OEM_SET_DIMM_INFO)
587//----------------------------------------------------------------------
588ipmi_ret_t ipmiOemSetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
589 ipmi_request_t request, ipmi_response_t response,
590 ipmi_data_len_t data_len, ipmi_context_t context)
591{
592 uint8_t *req = reinterpret_cast<uint8_t *>(request);
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700593
594 uint8_t index = req[0];
595 uint8_t type = req[1];
596 uint16_t speed;
597 uint32_t size;
598
599 memcpy(&speed, &req[2], 2);
600 memcpy(&size, &req[4], 4);
601
602 std::stringstream ss;
603 ss << std::hex;
604 ss << std::setw(2) << std::setfill('0') << (int)index;
605
606 oemData[KEY_SYS_CONFIG][ss.str()][KEY_DIMM_INDEX] = index;
607 oemData[KEY_SYS_CONFIG][ss.str()][KEY_DIMM_TYPE] = type;
608 oemData[KEY_SYS_CONFIG][ss.str()][KEY_DIMM_SPEED] = speed;
609 oemData[KEY_SYS_CONFIG][ss.str()][KEY_DIMM_SIZE] = size;
610
611 flushOemData();
612
613 *data_len = 0;
614
615 return IPMI_CC_OK;
616}
617
618//----------------------------------------------------------------------
619// Get Board ID (CMD_OEM_GET_BOARD_ID)
620//----------------------------------------------------------------------
621ipmi_ret_t ipmiOemGetBoardID(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
622 ipmi_request_t request, ipmi_response_t response,
623 ipmi_data_len_t data_len, ipmi_context_t context)
624{
625 uint8_t *req = reinterpret_cast<uint8_t *>(request);
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800626 uint8_t *res = reinterpret_cast<uint8_t *>(response);
627
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700628 /* TODO: Needs to implement this after GPIO implementation */
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800629 *data_len = 0;
630
631 return IPMI_CC_OK;
632}
633
Vijay Khemka877d5dd2019-12-16 14:46:21 -0800634/* Helper functions to set boot order */
635void setBootOrder(uint8_t *data)
636{
637 nlohmann::json bootMode;
638 uint8_t mode = data[0];
639 int i;
640
641 bootMode["UEFI"] = (mode & BOOT_MODE_UEFI ? true : false);
642 bootMode["CMOS_CLR"] = (mode & BOOT_MODE_CMOS_CLR ? true : false);
643 bootMode["FORCE_BOOT"] = (mode & BOOT_MODE_FORCE_BOOT ? true : false);
644 bootMode["BOOT_FLAG"] = (mode & BOOT_MODE_BOOT_FLAG ? true : false);
645 oemData[KEY_BOOT_ORDER][KEY_BOOT_MODE] = bootMode;
646
647 /* Initialize boot sequence array */
648 oemData[KEY_BOOT_ORDER][KEY_BOOT_SEQ] = {};
649 for (i = 1; i < SIZE_BOOT_ORDER; i++)
650 {
651 if (data[i] >= BOOT_SEQ_ARRAY_SIZE)
652 oemData[KEY_BOOT_ORDER][KEY_BOOT_SEQ][i - 1] = "NA";
653 else
654 oemData[KEY_BOOT_ORDER][KEY_BOOT_SEQ][i - 1] = bootSeq[data[i]];
655 }
656
657 flushOemData();
658}
659
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800660//----------------------------------------------------------------------
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700661// Set Boot Order (CMD_OEM_SET_BOOT_ORDER)
662//----------------------------------------------------------------------
663ipmi_ret_t ipmiOemSetBootOrder(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
664 ipmi_request_t request, ipmi_response_t response,
665 ipmi_data_len_t data_len, ipmi_context_t context)
666{
667 uint8_t *req = reinterpret_cast<uint8_t *>(request);
668 uint8_t len = *data_len;
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700669
670 *data_len = 0;
671
672 if (len != SIZE_BOOT_ORDER)
673 {
674 phosphor::logging::log<phosphor::logging::level::ERR>(
675 "Invalid Boot order length received");
676 return IPMI_CC_REQ_DATA_LEN_INVALID;
677 }
678
Vijay Khemka877d5dd2019-12-16 14:46:21 -0800679 setBootOrder(req);
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700680
681 return IPMI_CC_OK;
682}
683
684//----------------------------------------------------------------------
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800685// Get Boot Order (CMD_OEM_GET_BOOT_ORDER)
686//----------------------------------------------------------------------
687ipmi_ret_t ipmiOemGetBootOrder(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
688 ipmi_request_t request, ipmi_response_t response,
689 ipmi_data_len_t data_len, ipmi_context_t context)
690{
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800691 uint8_t *res = reinterpret_cast<uint8_t *>(response);
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700692 uint8_t mode = 0;
693 int i;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800694
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700695 *data_len = SIZE_BOOT_ORDER;
696
Vijay Khemka877d5dd2019-12-16 14:46:21 -0800697 if (oemData.find(KEY_BOOT_ORDER) == oemData.end())
698 {
699 /* Return default boot order 0100090203ff */
700 uint8_t defaultBoot[SIZE_BOOT_ORDER] = {
701 BOOT_MODE_UEFI, bootMap["USB_DEV"], bootMap["NET_IPV6"],
702 bootMap["SATA_HDD"], bootMap["SATA_CD"], 0xff};
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700703
Vijay Khemka877d5dd2019-12-16 14:46:21 -0800704 memcpy(res, defaultBoot, SIZE_BOOT_ORDER);
705 phosphor::logging::log<phosphor::logging::level::INFO>(
706 "Set default boot order");
707 setBootOrder(defaultBoot);
708 }
709 else
710 {
711 nlohmann::json bootMode = oemData[KEY_BOOT_ORDER][KEY_BOOT_MODE];
712 if (bootMode["UEFI"])
713 mode |= BOOT_MODE_UEFI;
714 if (bootMode["CMOS_CLR"])
715 mode |= BOOT_MODE_CMOS_CLR;
716 if (bootMode["BOOT_FLAG"])
717 mode |= BOOT_MODE_BOOT_FLAG;
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700718
Vijay Khemka877d5dd2019-12-16 14:46:21 -0800719 res[0] = mode;
720
721 for (i = 1; i < SIZE_BOOT_ORDER; i++)
722 {
723 std::string seqStr = oemData[KEY_BOOT_ORDER][KEY_BOOT_SEQ][i - 1];
724 if (bootMap.find(seqStr) != bootMap.end())
725 res[i] = bootMap[seqStr];
726 else
727 res[i] = 0xff;
728 }
729 }
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800730
731 return IPMI_CC_OK;
732}
733
734//----------------------------------------------------------------------
735// Set Machine Config Info (CMD_OEM_SET_MACHINE_CONFIG_INFO)
736//----------------------------------------------------------------------
737ipmi_ret_t ipmiOemSetMachineCfgInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
738 ipmi_request_t request,
739 ipmi_response_t response,
740 ipmi_data_len_t data_len,
741 ipmi_context_t context)
742{
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700743 machineConfigInfo_t *req = reinterpret_cast<machineConfigInfo_t *>(request);
744 uint8_t len = *data_len;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800745
746 *data_len = 0;
747
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700748 if (len < sizeof(machineConfigInfo_t))
749 {
750 phosphor::logging::log<phosphor::logging::level::ERR>(
751 "Invalid machine configuration length received");
752 return IPMI_CC_REQ_DATA_LEN_INVALID;
753 }
754
755 if (req->chassis_type >= sizeof(chassisType) / sizeof(uint8_t *))
756 oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] = "UNKNOWN";
757 else
758 oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] =
759 chassisType[req->chassis_type];
760
761 if (req->mb_type >= sizeof(mbType) / sizeof(uint8_t *))
762 oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = "UNKNOWN";
763 else
764 oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = mbType[req->mb_type];
765
766 oemData[KEY_MC_CONFIG][KEY_MC_PROC_CNT] = req->proc_cnt;
767 oemData[KEY_MC_CONFIG][KEY_MC_MEM_CNT] = req->mem_cnt;
768 oemData[KEY_MC_CONFIG][KEY_MC_HDD35_CNT] = req->hdd35_cnt;
769 oemData[KEY_MC_CONFIG][KEY_MC_HDD25_CNT] = req->hdd25_cnt;
770
771 if (req->riser_type >= sizeof(riserType) / sizeof(uint8_t *))
772 oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = "UNKNOWN";
773 else
774 oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = riserType[req->riser_type];
775
776 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC] = {};
777 int i = 0;
778 if (req->pcie_card_loc & BIT_0)
779 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT1";
780 if (req->pcie_card_loc & BIT_1)
781 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT2";
782 if (req->pcie_card_loc & BIT_2)
783 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT3";
784 if (req->pcie_card_loc & BIT_3)
785 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT4";
786
787 if (req->slot1_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
788 oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] = "UNKNOWN";
789 else
790 oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] =
791 pcieType[req->slot1_pcie_type];
792
793 if (req->slot2_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
794 oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] = "UNKNOWN";
795 else
796 oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] =
797 pcieType[req->slot2_pcie_type];
798
799 if (req->slot3_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
800 oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] = "UNKNOWN";
801 else
802 oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] =
803 pcieType[req->slot3_pcie_type];
804
805 if (req->slot4_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *))
806 oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] = "UNKNOWN";
807 else
808 oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] =
809 pcieType[req->slot4_pcie_type];
810
811 oemData[KEY_MC_CONFIG][KEY_MC_AEP_CNT] = req->aep_mem_cnt;
812
813 flushOemData();
814
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800815 return IPMI_CC_OK;
816}
817
818//----------------------------------------------------------------------
819// Set POST start (CMD_OEM_SET_POST_START)
820//----------------------------------------------------------------------
821ipmi_ret_t ipmiOemSetPostStart(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
822 ipmi_request_t request, ipmi_response_t response,
823 ipmi_data_len_t data_len, ipmi_context_t context)
824{
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800825 phosphor::logging::log<phosphor::logging::level::INFO>("POST Start Event");
826
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700827 /* Do nothing, return success */
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800828 *data_len = 0;
829 return IPMI_CC_OK;
830}
831
832//----------------------------------------------------------------------
833// Set POST End (CMD_OEM_SET_POST_END)
834//----------------------------------------------------------------------
835ipmi_ret_t ipmiOemSetPostEnd(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
836 ipmi_request_t request, ipmi_response_t response,
837 ipmi_data_len_t data_len, ipmi_context_t context)
838{
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700839 struct timespec ts;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800840
841 phosphor::logging::log<phosphor::logging::level::INFO>("POST End Event");
842
843 *data_len = 0;
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700844
845 // Timestamp post end time.
846 clock_gettime(CLOCK_REALTIME, &ts);
847 oemData[KEY_TS_SLED] = ts.tv_sec;
848 flushOemData();
849
850 // Sync time with system
851 // TODO: Add code for syncing time
852
853 return IPMI_CC_OK;
854}
855
856//----------------------------------------------------------------------
857// Set PPIN Info (CMD_OEM_SET_PPIN_INFO)
858//----------------------------------------------------------------------
859// Inform BMC about PPIN data of 8 bytes for each CPU
860//
861// Request:
862// Byte 1:8 – CPU0 PPIN data
863// Optional:
864// Byte 9:16 – CPU1 PPIN data
865//
866// Response:
867// Byte 1 – Completion Code
868ipmi_ret_t ipmiOemSetPPINInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
869 ipmi_request_t request, ipmi_response_t response,
870 ipmi_data_len_t data_len, ipmi_context_t context)
871{
872 uint8_t *req = reinterpret_cast<uint8_t *>(request);
873 std::string ppinStr;
874 int len;
875
876 if (*data_len > SIZE_CPU_PPIN * 2)
877 len = SIZE_CPU_PPIN * 2;
878 else
879 len = *data_len;
880 *data_len = 0;
881
882 ppinStr = bytesToStr(req, len);
883 oemData[KEY_PPIN_INFO] = ppinStr.c_str();
884 flushOemData();
885
886 return IPMI_CC_OK;
887}
888
889//----------------------------------------------------------------------
890// Set ADR Trigger (CMD_OEM_SET_ADR_TRIGGER)
891//----------------------------------------------------------------------
892ipmi_ret_t ipmiOemSetAdrTrigger(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
893 ipmi_request_t request,
894 ipmi_response_t response,
895 ipmi_data_len_t data_len,
896 ipmi_context_t context)
897{
898 /* Do nothing, return success */
899 *data_len = 0;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800900 return IPMI_CC_OK;
901}
902
903//----------------------------------------------------------------------
904// Set Bios Flash Info (CMD_OEM_SET_BIOS_FLASH_INFO)
905//----------------------------------------------------------------------
906ipmi_ret_t ipmiOemSetBiosFlashInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
907 ipmi_request_t request,
908 ipmi_response_t response,
909 ipmi_data_len_t data_len,
910 ipmi_context_t context)
911{
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700912 /* Do nothing, return success */
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800913 *data_len = 0;
914 return IPMI_CC_OK;
915}
916
917//----------------------------------------------------------------------
918// Set PPR (CMD_OEM_SET_PPR)
919//----------------------------------------------------------------------
920ipmi_ret_t ipmiOemSetPpr(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
921 ipmi_request_t request, ipmi_response_t response,
922 ipmi_data_len_t data_len, ipmi_context_t context)
923{
924 uint8_t *req = reinterpret_cast<uint8_t *>(request);
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700925 uint8_t pprCnt, pprAct, pprIndex;
926 uint8_t selParam = req[0];
927 uint8_t len = *data_len;
928 std::stringstream ss;
929 std::string str;
Vijay Khemkae7d23d02019-03-08 13:13:40 -0800930
931 *data_len = 0;
Vijay Khemka1d4a0692019-04-09 15:20:28 -0700932
933 switch (selParam)
934 {
935 case PPR_ACTION:
936 if (oemData[KEY_PPR].find(KEY_PPR_ROW_COUNT) ==
937 oemData[KEY_PPR].end())
938 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
939
940 pprCnt = oemData[KEY_PPR][KEY_PPR_ROW_COUNT];
941 if (pprCnt == 0)
942 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
943
944 pprAct = req[1];
945 /* Check if ppr is enabled or disabled */
946 if (!(pprAct & 0x80))
947 pprAct = 0;
948
949 oemData[KEY_PPR][KEY_PPR_ACTION] = pprAct;
950 break;
951 case PPR_ROW_COUNT:
952 if (req[1] > 100)
953 return IPMI_CC_PARM_OUT_OF_RANGE;
954
955 oemData[KEY_PPR][KEY_PPR_ROW_COUNT] = req[1];
956 break;
957 case PPR_ROW_ADDR:
958 pprIndex = req[1];
959 if (pprIndex > 100)
960 return IPMI_CC_PARM_OUT_OF_RANGE;
961
962 if (len < PPR_ROW_ADDR_LEN + 1)
963 {
964 phosphor::logging::log<phosphor::logging::level::ERR>(
965 "Invalid PPR Row Address length received");
966 return IPMI_CC_REQ_DATA_LEN_INVALID;
967 }
968
969 ss << std::hex;
970 ss << std::setw(2) << std::setfill('0') << (int)pprIndex;
971
972 oemData[KEY_PPR][ss.str()][KEY_PPR_INDEX] = pprIndex;
973
974 str = bytesToStr(&req[1], PPR_ROW_ADDR_LEN);
975 oemData[KEY_PPR][ss.str()][KEY_PPR_ROW_ADDR] = str.c_str();
976 break;
977 case PPR_HISTORY_DATA:
978 pprIndex = req[1];
979 if (pprIndex > 100)
980 return IPMI_CC_PARM_OUT_OF_RANGE;
981
982 if (len < PPR_HST_DATA_LEN + 1)
983 {
984 phosphor::logging::log<phosphor::logging::level::ERR>(
985 "Invalid PPR history data length received");
986 return IPMI_CC_REQ_DATA_LEN_INVALID;
987 }
988
989 ss << std::hex;
990 ss << std::setw(2) << std::setfill('0') << (int)pprIndex;
991
992 oemData[KEY_PPR][ss.str()][KEY_PPR_INDEX] = pprIndex;
993
994 str = bytesToStr(&req[1], PPR_HST_DATA_LEN);
995 oemData[KEY_PPR][ss.str()][KEY_PPR_HST_DATA] = str.c_str();
996 break;
997 default:
998 return IPMI_CC_PARM_OUT_OF_RANGE;
999 break;
1000 }
1001
1002 flushOemData();
1003
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001004 return IPMI_CC_OK;
1005}
1006
1007//----------------------------------------------------------------------
1008// Get PPR (CMD_OEM_GET_PPR)
1009//----------------------------------------------------------------------
1010ipmi_ret_t ipmiOemGetPpr(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
1011 ipmi_request_t request, ipmi_response_t response,
1012 ipmi_data_len_t data_len, ipmi_context_t context)
1013{
1014 uint8_t *req = reinterpret_cast<uint8_t *>(request);
1015 uint8_t *res = reinterpret_cast<uint8_t *>(response);
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001016 uint8_t pprCnt, pprIndex;
1017 uint8_t selParam = req[0];
1018 std::stringstream ss;
1019 std::string str;
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001020
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001021 /* Any failure will return zero length data */
1022 *data_len = 0;
1023
1024 switch (selParam)
1025 {
1026 case PPR_ACTION:
1027 res[0] = 0;
1028 *data_len = 1;
1029
1030 if (oemData[KEY_PPR].find(KEY_PPR_ROW_COUNT) !=
1031 oemData[KEY_PPR].end())
1032 {
1033 pprCnt = oemData[KEY_PPR][KEY_PPR_ROW_COUNT];
1034 if (pprCnt != 0)
1035 {
1036 if (oemData[KEY_PPR].find(KEY_PPR_ACTION) !=
1037 oemData[KEY_PPR].end())
1038 {
1039 res[0] = oemData[KEY_PPR][KEY_PPR_ACTION];
1040 }
1041 }
1042 }
1043 break;
1044 case PPR_ROW_COUNT:
1045 res[0] = 0;
1046 *data_len = 1;
1047 if (oemData[KEY_PPR].find(KEY_PPR_ROW_COUNT) !=
1048 oemData[KEY_PPR].end())
1049 res[0] = oemData[KEY_PPR][KEY_PPR_ROW_COUNT];
1050 break;
1051 case PPR_ROW_ADDR:
1052 pprIndex = req[1];
1053 if (pprIndex > 100)
1054 return IPMI_CC_PARM_OUT_OF_RANGE;
1055
1056 ss << std::hex;
1057 ss << std::setw(2) << std::setfill('0') << (int)pprIndex;
1058
1059 if (oemData[KEY_PPR].find(ss.str()) == oemData[KEY_PPR].end())
1060 return IPMI_CC_PARM_OUT_OF_RANGE;
1061
1062 if (oemData[KEY_PPR][ss.str()].find(KEY_PPR_ROW_ADDR) ==
1063 oemData[KEY_PPR][ss.str()].end())
1064 return IPMI_CC_PARM_OUT_OF_RANGE;
1065
1066 str = oemData[KEY_PPR][ss.str()][KEY_PPR_ROW_ADDR];
1067 *data_len = strToBytes(str, res);
1068 break;
1069 case PPR_HISTORY_DATA:
1070 pprIndex = req[1];
1071 if (pprIndex > 100)
1072 return IPMI_CC_PARM_OUT_OF_RANGE;
1073
1074 ss << std::hex;
1075 ss << std::setw(2) << std::setfill('0') << (int)pprIndex;
1076
1077 if (oemData[KEY_PPR].find(ss.str()) == oemData[KEY_PPR].end())
1078 return IPMI_CC_PARM_OUT_OF_RANGE;
1079
1080 if (oemData[KEY_PPR][ss.str()].find(KEY_PPR_HST_DATA) ==
1081 oemData[KEY_PPR][ss.str()].end())
1082 return IPMI_CC_PARM_OUT_OF_RANGE;
1083
1084 str = oemData[KEY_PPR][ss.str()][KEY_PPR_HST_DATA];
1085 *data_len = strToBytes(str, res);
1086 break;
1087 default:
1088 return IPMI_CC_PARM_OUT_OF_RANGE;
1089 break;
1090 }
1091
1092 return IPMI_CC_OK;
1093}
1094
1095/* FB OEM QC Commands */
1096
1097//----------------------------------------------------------------------
1098// Set Proc Info (CMD_OEM_Q_SET_PROC_INFO)
1099//----------------------------------------------------------------------
1100//"Request:
1101// Byte 1:3 – Manufacturer ID – XXYYZZ h, LSB first
1102// Byte 4 – Processor Index, 0 base
1103// Byte 5 – Parameter Selector
1104// Byte 6..N – Configuration parameter data (see below for Parameters
1105// of Processor Information)
1106// Response:
1107// Byte 1 – Completion code
1108//
1109// Parameter#1: (Processor Product Name)
1110//
1111// Byte 1..48 –Product name(ASCII code)
1112// Ex. Intel(R) Xeon(R) CPU E5-2685 v3 @ 2.60GHz
1113//
1114// Param#2: Processor Basic Information
1115// Byte 1 – Core Number
1116// Byte 2 – Thread Number (LSB)
1117// Byte 3 – Thread Number (MSB)
1118// Byte 4 – Processor frequency in MHz (LSB)
1119// Byte 5 – Processor frequency in MHz (MSB)
1120// Byte 6..7 – Revision
1121//
1122ipmi_ret_t ipmiOemQSetProcInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
1123 ipmi_request_t request, ipmi_response_t response,
1124 ipmi_data_len_t data_len, ipmi_context_t context)
1125{
1126 qProcInfo_t *req = reinterpret_cast<qProcInfo_t *>(request);
1127 uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t *);
1128 std::stringstream ss;
1129 std::string str;
1130 uint8_t len = *data_len;
1131
1132 *data_len = 0;
1133
1134 /* check for requested data params */
1135 if (len < 5 || req->paramSel < 1 || req->paramSel >= numParam)
1136 {
1137 phosphor::logging::log<phosphor::logging::level::ERR>(
1138 "Invalid parameter received");
1139 return IPMI_CC_PARM_OUT_OF_RANGE;
1140 }
1141
1142 len = len - 5; // Get Actual data length
1143
1144 ss << std::hex;
1145 ss << std::setw(2) << std::setfill('0') << (int)req->procIndex;
1146 oemData[KEY_Q_PROC_INFO][ss.str()][KEY_PROC_INDEX] = req->procIndex;
1147
1148 str = bytesToStr(req->data, len);
1149 oemData[KEY_Q_PROC_INFO][ss.str()][cpuInfoKey[req->paramSel]] = str.c_str();
1150 flushOemData();
1151
1152 return IPMI_CC_OK;
1153}
1154
1155//----------------------------------------------------------------------
1156// Get Proc Info (CMD_OEM_Q_GET_PROC_INFO)
1157//----------------------------------------------------------------------
1158// Request:
1159// Byte 1:3 – Manufacturer ID – XXYYZZ h, LSB first
1160// Byte 4 – Processor Index, 0 base
1161// Byte 5 – Parameter Selector
1162// Response:
1163// Byte 1 – Completion code
1164// Byte 2..N – Configuration Parameter Data (see below for Parameters
1165// of Processor Information)
1166//
1167// Parameter#1: (Processor Product Name)
1168//
1169// Byte 1..48 –Product name(ASCII code)
1170// Ex. Intel(R) Xeon(R) CPU E5-2685 v3 @ 2.60GHz
1171//
1172// Param#2: Processor Basic Information
1173// Byte 1 – Core Number
1174// Byte 2 – Thread Number (LSB)
1175// Byte 3 – Thread Number (MSB)
1176// Byte 4 – Processor frequency in MHz (LSB)
1177// Byte 5 – Processor frequency in MHz (MSB)
1178// Byte 6..7 – Revision
1179//
1180ipmi_ret_t ipmiOemQGetProcInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
1181 ipmi_request_t request, ipmi_response_t response,
1182 ipmi_data_len_t data_len, ipmi_context_t context)
1183{
1184 qProcInfo_t *req = reinterpret_cast<qProcInfo_t *>(request);
1185 uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t *);
1186 uint8_t *res = reinterpret_cast<uint8_t *>(response);
1187 std::stringstream ss;
1188 std::string str;
1189
1190 *data_len = 0;
1191
1192 /* check for requested data params */
1193 if (req->paramSel < 1 || req->paramSel >= numParam)
1194 {
1195 phosphor::logging::log<phosphor::logging::level::ERR>(
1196 "Invalid parameter received");
1197 return IPMI_CC_PARM_OUT_OF_RANGE;
1198 }
1199
1200 ss << std::hex;
1201 ss << std::setw(2) << std::setfill('0') << (int)req->procIndex;
1202
1203 if (oemData[KEY_Q_PROC_INFO].find(ss.str()) ==
1204 oemData[KEY_Q_PROC_INFO].end())
1205 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
1206
1207 if (oemData[KEY_Q_PROC_INFO][ss.str()].find(cpuInfoKey[req->paramSel]) ==
1208 oemData[KEY_Q_PROC_INFO][ss.str()].end())
1209 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
1210
1211 str = oemData[KEY_Q_PROC_INFO][ss.str()][cpuInfoKey[req->paramSel]];
1212 *data_len = strToBytes(str, res);
1213
1214 return IPMI_CC_OK;
1215}
1216
1217//----------------------------------------------------------------------
1218// Set Dimm Info (CMD_OEM_Q_SET_DIMM_INFO)
1219//----------------------------------------------------------------------
1220// Request:
1221// Byte 1:3 – Manufacturer ID – XXYYZZh, LSB first
1222// Byte 4 – DIMM Index, 0 base
1223// Byte 5 – Parameter Selector
1224// Byte 6..N – Configuration parameter data (see below for Parameters
1225// of DIMM Information)
1226// Response:
1227// Byte 1 – Completion code
1228//
1229// Param#1 (DIMM Location):
1230// Byte 1 – DIMM Present
1231// Byte 1 – DIMM Present
1232// 01h – Present
1233// FFh – Not Present
1234// Byte 2 – Node Number, 0 base
1235// Byte 3 – Channel Number , 0 base
1236// Byte 4 – DIMM Number , 0 base
1237//
1238// Param#2 (DIMM Type):
1239// Byte 1 – DIMM Type
1240// Bit [7:6]
1241// For DDR3
1242// 00 – Normal Voltage (1.5V)
1243// 01 – Ultra Low Voltage (1.25V)
1244// 10 – Low Voltage (1.35V)
1245// 11 – Reserved
1246// For DDR4
1247// 00 – Reserved
1248// 01 – Reserved
1249// 10 – Reserved
1250// 11 – Normal Voltage (1.2V)
1251// Bit [5:0]
1252// 0x00 – SDRAM
1253// 0x01 – DDR-1 RAM
1254// 0x02 – Rambus
1255// 0x03 – DDR-2 RAM
1256// 0x04 – FBDIMM
1257// 0x05 – DDR-3 RAM
1258// 0x06 – DDR-4 RAM
1259//
1260// Param#3 (DIMM Speed):
1261// Byte 1..2 – DIMM speed in MHz, LSB
1262// Byte 3..6 – DIMM size in Mbytes, LSB
1263//
1264// Param#4 (Module Part Number):
1265// Byte 1..20 –Module Part Number (JEDEC Standard No. 21-C)
1266//
1267// Param#5 (Module Serial Number):
1268// Byte 1..4 –Module Serial Number (JEDEC Standard No. 21-C)
1269//
1270// Param#6 (Module Manufacturer ID):
1271// Byte 1 - Module Manufacturer ID, LSB
1272// Byte 2 - Module Manufacturer ID, MSB
1273//
1274ipmi_ret_t ipmiOemQSetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
1275 ipmi_request_t request, ipmi_response_t response,
1276 ipmi_data_len_t data_len, ipmi_context_t context)
1277{
1278 qDimmInfo_t *req = reinterpret_cast<qDimmInfo_t *>(request);
1279 uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t *);
1280 std::stringstream ss;
1281 std::string str;
1282 uint8_t len = *data_len;
1283
1284 *data_len = 0;
1285
1286 /* check for requested data params */
1287 if (len < 5 || req->paramSel < 1 || req->paramSel >= numParam)
1288 {
1289 phosphor::logging::log<phosphor::logging::level::ERR>(
1290 "Invalid parameter received");
1291 return IPMI_CC_PARM_OUT_OF_RANGE;
1292 }
1293
1294 len = len - 5; // Get Actual data length
1295
1296 ss << std::hex;
1297 ss << std::setw(2) << std::setfill('0') << (int)req->dimmIndex;
1298 oemData[KEY_Q_DIMM_INFO][ss.str()][KEY_DIMM_INDEX] = req->dimmIndex;
1299
1300 str = bytesToStr(req->data, len);
1301 oemData[KEY_Q_DIMM_INFO][ss.str()][dimmInfoKey[req->paramSel]] =
1302 str.c_str();
1303 flushOemData();
1304
1305 return IPMI_CC_OK;
1306}
1307
1308//----------------------------------------------------------------------
1309// Get Dimm Info (CMD_OEM_Q_GET_DIMM_INFO)
1310//----------------------------------------------------------------------
1311// Request:
1312// Byte 1:3 – Manufacturer ID – XXYYZZh, LSB first
1313// Byte 4 – DIMM Index, 0 base
1314// Byte 5 – Parameter Selector
1315// Byte 6..N – Configuration parameter data (see below for Parameters
1316// of DIMM Information)
1317// Response:
1318// Byte 1 – Completion code
1319// Byte 2..N – Configuration Parameter Data (see Table_1213h Parameters
1320// of DIMM Information)
1321//
1322// Param#1 (DIMM Location):
1323// Byte 1 – DIMM Present
1324// Byte 1 – DIMM Present
1325// 01h – Present
1326// FFh – Not Present
1327// Byte 2 – Node Number, 0 base
1328// Byte 3 – Channel Number , 0 base
1329// Byte 4 – DIMM Number , 0 base
1330//
1331// Param#2 (DIMM Type):
1332// Byte 1 – DIMM Type
1333// Bit [7:6]
1334// For DDR3
1335// 00 – Normal Voltage (1.5V)
1336// 01 – Ultra Low Voltage (1.25V)
1337// 10 – Low Voltage (1.35V)
1338// 11 – Reserved
1339// For DDR4
1340// 00 – Reserved
1341// 01 – Reserved
1342// 10 – Reserved
1343// 11 – Normal Voltage (1.2V)
1344// Bit [5:0]
1345// 0x00 – SDRAM
1346// 0x01 – DDR-1 RAM
1347// 0x02 – Rambus
1348// 0x03 – DDR-2 RAM
1349// 0x04 – FBDIMM
1350// 0x05 – DDR-3 RAM
1351// 0x06 – DDR-4 RAM
1352//
1353// Param#3 (DIMM Speed):
1354// Byte 1..2 – DIMM speed in MHz, LSB
1355// Byte 3..6 – DIMM size in Mbytes, LSB
1356//
1357// Param#4 (Module Part Number):
1358// Byte 1..20 –Module Part Number (JEDEC Standard No. 21-C)
1359//
1360// Param#5 (Module Serial Number):
1361// Byte 1..4 –Module Serial Number (JEDEC Standard No. 21-C)
1362//
1363// Param#6 (Module Manufacturer ID):
1364// Byte 1 - Module Manufacturer ID, LSB
1365// Byte 2 - Module Manufacturer ID, MSB
1366//
1367ipmi_ret_t ipmiOemQGetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
1368 ipmi_request_t request, ipmi_response_t response,
1369 ipmi_data_len_t data_len, ipmi_context_t context)
1370{
1371 qDimmInfo_t *req = reinterpret_cast<qDimmInfo_t *>(request);
1372 uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t *);
1373 uint8_t *res = reinterpret_cast<uint8_t *>(response);
1374 std::stringstream ss;
1375 std::string str;
1376
1377 *data_len = 0;
1378
1379 /* check for requested data params */
1380 if (req->paramSel < 1 || req->paramSel >= numParam)
1381 {
1382 phosphor::logging::log<phosphor::logging::level::ERR>(
1383 "Invalid parameter received");
1384 return IPMI_CC_PARM_OUT_OF_RANGE;
1385 }
1386
1387 ss << std::hex;
1388 ss << std::setw(2) << std::setfill('0') << (int)req->dimmIndex;
1389
1390 if (oemData[KEY_Q_DIMM_INFO].find(ss.str()) ==
1391 oemData[KEY_Q_DIMM_INFO].end())
1392 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
1393
1394 if (oemData[KEY_Q_DIMM_INFO][ss.str()].find(dimmInfoKey[req->paramSel]) ==
1395 oemData[KEY_Q_DIMM_INFO][ss.str()].end())
1396 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
1397
1398 str = oemData[KEY_Q_DIMM_INFO][ss.str()][dimmInfoKey[req->paramSel]];
1399 *data_len = strToBytes(str, res);
1400
1401 return IPMI_CC_OK;
1402}
1403
1404//----------------------------------------------------------------------
1405// Set Drive Info (CMD_OEM_Q_SET_DRIVE_INFO)
1406//----------------------------------------------------------------------
1407// BIOS issue this command to provide HDD information to BMC.
1408//
1409// BIOS just can get information by standard ATA / SMART command for
1410// OB SATA controller.
1411// BIOS can get
1412// 1. Serial Number
1413// 2. Model Name
1414// 3. HDD FW Version
1415// 4. HDD Capacity
1416// 5. HDD WWN
1417//
1418// Use Get HDD info Param #5 to know the MAX HDD info index.
1419//
1420// Request:
1421// Byte 1:3 – Quanta Manufacturer ID – 001C4Ch, LSB first
1422// Byte 4 –
1423// [7:4] Reserved
1424// [3:0] HDD Controller Type
1425// 0x00 – BIOS
1426// 0x01 – Expander
1427// 0x02 – LSI
1428// Byte 5 – HDD Info Index, 0 base
1429// Byte 6 – Parameter Selector
1430// Byte 7..N – Configuration parameter data (see Table_1415h Parameters of HDD
1431// Information)
1432//
1433// Response:
1434// Byte 1 – Completion Code
1435//
1436// Param#0 (HDD Location):
1437// Byte 1 – Controller
1438// [7:3] Device Number
1439// [2:0] Function Number
1440// For Intel C610 series (Wellsburg)
1441// D31:F2 (0xFA) – SATA control 1
1442// D31:F5 (0xFD) – SATA control 2
1443// D17:F4 (0x8C) – sSata control
1444// Byte 2 – Port Number
1445// Byte 3 – Location (0xFF: No HDD Present)
1446// BIOS default set Byte 3 to 0xFF, if No HDD Present. And then skip send param
1447// #1~4, #6, #7 to BMC (still send param #5) BIOS default set Byte 3 to 0, if
1448// the HDD present. BMC or other people who know the HDD location has
1449// responsibility for update Location info
1450//
1451// Param#1 (Serial Number):
1452// Bytes 1..33: HDD Serial Number
1453//
1454// Param#2 (Model Name):
1455// Byte 1..33 – HDD Model Name
1456//
1457// Param#3 (HDD FW Version):
1458// Byte 1..17 –HDD FW version
1459//
1460// Param#4 (Capacity):
1461// Byte 1..4 –HDD Block Size, LSB
1462// Byte 5..12 - HDD Block Number, LSB
1463// HDD Capacity = HDD Block size * HDD BLock number (Unit Byte)
1464//
1465// Param#5 (Max HDD Quantity):
1466// Byte 1 - Max HDD Quantity
1467// Max supported port numbers in this PCH
1468//
1469// Param#6 (HDD Type)
1470// Byte 1 – HDD Type
1471// 0h – Reserved
1472// 1h – SAS
1473// 2h – SATA
1474// 3h – PCIE SSD (NVME)
1475//
1476// Param#7 (HDD WWN)
1477// Data 1...8: HDD World Wide Name, LSB
1478//
1479ipmi_ret_t ipmiOemQSetDriveInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
1480 ipmi_request_t request,
1481 ipmi_response_t response,
1482 ipmi_data_len_t data_len,
1483 ipmi_context_t context)
1484{
1485 qDriveInfo_t *req = reinterpret_cast<qDriveInfo_t *>(request);
1486 uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t *);
1487 uint8_t ctrlType = req->hddCtrlType & 0x0f;
1488 std::stringstream ss;
1489 std::string str;
1490 uint8_t len = *data_len;
1491
1492 *data_len = 0;
1493
1494 /* check for requested data params */
1495 if (len < 6 || req->paramSel < 1 || req->paramSel >= numParam ||
1496 ctrlType > 2)
1497 {
1498 phosphor::logging::log<phosphor::logging::level::ERR>(
1499 "Invalid parameter received");
1500 return IPMI_CC_PARM_OUT_OF_RANGE;
1501 }
1502
1503 len = len - 6; // Get Actual data length
1504
1505 ss << std::hex;
1506 ss << std::setw(2) << std::setfill('0') << (int)req->hddIndex;
1507 oemData[KEY_Q_DRIVE_INFO][KEY_HDD_CTRL_TYPE] = req->hddCtrlType;
1508 oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]][ss.str()][KEY_HDD_INDEX] =
1509 req->hddIndex;
1510
1511 str = bytesToStr(req->data, len);
1512 oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]][ss.str()]
1513 [driveInfoKey[req->paramSel]] = str.c_str();
1514 flushOemData();
1515
1516 return IPMI_CC_OK;
1517}
1518
1519//----------------------------------------------------------------------
1520// Get Drive Info (CMD_OEM_Q_GET_DRIVE_INFO)
1521//----------------------------------------------------------------------
1522// BMC needs to check HDD presented or not first. If NOT presented, return
1523// completion code 0xD5.
1524//
1525// Request:
1526// Byte 1:3 – Quanta Manufacturer ID – 001C4Ch, LSB first
1527// Byte 4 –
1528//[7:4] Reserved
1529//[3:0] HDD Controller Type
1530// 0x00 – BIOS
1531// 0x01 – Expander
1532// 0x02 – LSI
1533// Byte 5 – HDD Index, 0 base
1534// Byte 6 – Parameter Selector (See Above Set HDD Information)
1535// Response:
1536// Byte 1 – Completion Code
1537// 0xD5 – Not support in current status (HDD Not Present)
1538// Byte 2..N – Configuration parameter data (see Table_1415h Parameters of HDD
1539// Information)
1540//
1541ipmi_ret_t ipmiOemQGetDriveInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
1542 ipmi_request_t request,
1543 ipmi_response_t response,
1544 ipmi_data_len_t data_len,
1545 ipmi_context_t context)
1546{
1547 qDriveInfo_t *req = reinterpret_cast<qDriveInfo_t *>(request);
1548 uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t *);
1549 uint8_t *res = reinterpret_cast<uint8_t *>(response);
1550 uint8_t ctrlType = req->hddCtrlType & 0x0f;
1551 std::stringstream ss;
1552 std::string str;
1553
1554 *data_len = 0;
1555
1556 /* check for requested data params */
1557 if (req->paramSel < 1 || req->paramSel >= numParam || ctrlType > 2)
1558 {
1559 phosphor::logging::log<phosphor::logging::level::ERR>(
1560 "Invalid parameter received");
1561 return IPMI_CC_PARM_OUT_OF_RANGE;
1562 }
1563
1564 if (oemData[KEY_Q_DRIVE_INFO].find(ctrlTypeKey[ctrlType]) ==
1565 oemData[KEY_Q_DRIVE_INFO].end())
1566 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
1567
1568 ss << std::hex;
1569 ss << std::setw(2) << std::setfill('0') << (int)req->hddIndex;
1570
1571 if (oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]].find(ss.str()) ==
1572 oemData[KEY_Q_DRIVE_INFO].end())
1573 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
1574
1575 if (oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]][ss.str()].find(
1576 dimmInfoKey[req->paramSel]) ==
1577 oemData[KEY_Q_DRIVE_INFO][ss.str()].end())
1578 return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
1579
1580 str = oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]][ss.str()]
1581 [dimmInfoKey[req->paramSel]];
1582 *data_len = strToBytes(str, res);
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001583
1584 return IPMI_CC_OK;
1585}
1586
1587static void registerOEMFunctions(void)
1588{
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001589 /* Get OEM data from json file */
1590 std::ifstream file(JSON_OEM_DATA_FILE);
1591 if (file)
Vijay Khemkafeaa9812019-08-27 15:08:08 -07001592 {
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001593 file >> oemData;
Vijay Khemkafeaa9812019-08-27 15:08:08 -07001594 file.close();
1595 }
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001596
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001597 phosphor::logging::log<phosphor::logging::level::INFO>(
1598 "Registering OEM commands");
1599 ipmiPrintAndRegister(NETFUN_CHASSIS, 1, NULL, ipmiGetChassisStatus,
1600 PRIVILEGE_USER); // get chassis status
1601 ipmiPrintAndRegister(NETFN_OEM_USB_DBG_REQ, CMD_OEM_USB_DBG_GET_FRAME_INFO,
1602 NULL, ipmiOemDbgGetFrameInfo,
1603 PRIVILEGE_USER); // get debug frame info
1604 ipmiPrintAndRegister(NETFN_OEM_USB_DBG_REQ,
1605 CMD_OEM_USB_DBG_GET_UPDATED_FRAMES, NULL,
1606 ipmiOemDbgGetUpdFrames,
1607 PRIVILEGE_USER); // get debug updated frames
1608 ipmiPrintAndRegister(NETFN_OEM_USB_DBG_REQ, CMD_OEM_USB_DBG_GET_POST_DESC,
1609 NULL, ipmiOemDbgGetPostDesc,
1610 PRIVILEGE_USER); // get debug post description
1611 ipmiPrintAndRegister(NETFN_OEM_USB_DBG_REQ, CMD_OEM_USB_DBG_GET_GPIO_DESC,
1612 NULL, ipmiOemDbgGetGpioDesc,
1613 PRIVILEGE_USER); // get debug gpio description
1614 ipmiPrintAndRegister(NETFN_OEM_USB_DBG_REQ, CMD_OEM_USB_DBG_GET_FRAME_DATA,
1615 NULL, ipmiOemDbgGetFrameData,
1616 PRIVILEGE_USER); // get debug frame data
1617 ipmiPrintAndRegister(NETFN_OEM_USB_DBG_REQ, CMD_OEM_USB_DBG_CTRL_PANEL,
1618 NULL, ipmiOemDbgGetCtrlPanel,
1619 PRIVILEGE_USER); // get debug control panel
1620 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_DIMM_INFO, NULL,
1621 ipmiOemSetDimmInfo,
1622 PRIVILEGE_USER); // Set Dimm Info
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001623 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_GET_BOARD_ID, NULL,
1624 ipmiOemGetBoardID,
1625 PRIVILEGE_USER); // Get Board ID
1626 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_BOOT_ORDER, NULL,
1627 ipmiOemSetBootOrder,
1628 PRIVILEGE_USER); // Set Boot Order
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001629 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_GET_BOOT_ORDER, NULL,
1630 ipmiOemGetBootOrder,
1631 PRIVILEGE_USER); // Get Boot Order
1632 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_MACHINE_CONFIG_INFO, NULL,
1633 ipmiOemSetMachineCfgInfo,
1634 PRIVILEGE_USER); // Set Machine Config Info
1635 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_POST_START, NULL,
1636 ipmiOemSetPostStart,
1637 PRIVILEGE_USER); // Set POST start
1638 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_POST_END, NULL,
1639 ipmiOemSetPostEnd,
1640 PRIVILEGE_USER); // Set POST End
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001641 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_PPIN_INFO, NULL,
1642 ipmiOemSetPPINInfo,
1643 PRIVILEGE_USER); // Set PPIN Info
1644 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_ADR_TRIGGER, NULL,
1645 ipmiOemSetAdrTrigger,
1646 PRIVILEGE_USER); // Set ADR Trigger
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001647 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_BIOS_FLASH_INFO, NULL,
1648 ipmiOemSetBiosFlashInfo,
1649 PRIVILEGE_USER); // Set Bios Flash Info
1650 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_SET_PPR, NULL, ipmiOemSetPpr,
1651 PRIVILEGE_USER); // Set PPR
1652 ipmiPrintAndRegister(NETFUN_NONE, CMD_OEM_GET_PPR, NULL, ipmiOemGetPpr,
1653 PRIVILEGE_USER); // Get PPR
Vijay Khemka1d4a0692019-04-09 15:20:28 -07001654 /* FB OEM QC Commands */
1655 ipmiPrintAndRegister(NETFUN_FB_OEM_QC, CMD_OEM_Q_SET_PROC_INFO, NULL,
1656 ipmiOemQSetProcInfo,
1657 PRIVILEGE_USER); // Set Proc Info
1658 ipmiPrintAndRegister(NETFUN_FB_OEM_QC, CMD_OEM_Q_GET_PROC_INFO, NULL,
1659 ipmiOemQGetProcInfo,
1660 PRIVILEGE_USER); // Get Proc Info
1661 ipmiPrintAndRegister(NETFUN_FB_OEM_QC, CMD_OEM_Q_SET_DIMM_INFO, NULL,
1662 ipmiOemQSetDimmInfo,
1663 PRIVILEGE_USER); // Set Dimm Info
1664 ipmiPrintAndRegister(NETFUN_FB_OEM_QC, CMD_OEM_Q_GET_DIMM_INFO, NULL,
1665 ipmiOemQGetDimmInfo,
1666 PRIVILEGE_USER); // Get Dimm Info
1667 ipmiPrintAndRegister(NETFUN_FB_OEM_QC, CMD_OEM_Q_SET_DRIVE_INFO, NULL,
1668 ipmiOemQSetDriveInfo,
1669 PRIVILEGE_USER); // Set Drive Info
1670 ipmiPrintAndRegister(NETFUN_FB_OEM_QC, CMD_OEM_Q_GET_DRIVE_INFO, NULL,
1671 ipmiOemQGetDriveInfo,
1672 PRIVILEGE_USER); // Get Drive Info
Vijay Khemkae7d23d02019-03-08 13:13:40 -08001673 return;
1674}
1675
1676} // namespace ipmi