biccommands.cpp (6c931e43fe734225d21a0e28961bca519c53bc1a) biccommands.cpp (2405ae98b39a97e9d7753d8dc5c673a4a8885b85)
1/*
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
1/*
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 <ipmid/api.hpp>
19#include <ipmid/api-types.hpp>
20
21#include <commandutils.hpp>
22#include <biccommands.hpp>
18#include <biccommands.hpp>
19#include <commandutils.hpp>
20#include <ipmid/api-types.hpp>
21#include <ipmid/api.hpp>
23#include <phosphor-logging/log.hpp>
24
22#include <phosphor-logging/log.hpp>
23
25#include <vector>
26#include <variant>
27#include <iostream>
24#include <iostream>
25#include <variant>
26#include <vector>
28
29namespace ipmi
30{
31
32int sendBicCmd(uint8_t, uint8_t, uint8_t, std::vector<uint8_t>&,
33 std::vector<uint8_t>&);
34
35using namespace phosphor::logging;

--- 14 unchanged lines hidden (view full) ---

50//----------------------------------------------------------------------
51
52ipmi::RspType<IanaType, uint8_t, uint2_t, uint6_t, uint8_t, uint8_t,
53 ipmi::message::Payload>
54 ipmiOemBicHandler(ipmi::Context::ptr ctx, IanaType reqIana,
55 uint8_t interface, uint2_t lun, uint6_t netFnReq,
56 uint8_t cmdReq, SecureBuffer data)
57{
27
28namespace ipmi
29{
30
31int sendBicCmd(uint8_t, uint8_t, uint8_t, std::vector<uint8_t>&,
32 std::vector<uint8_t>&);
33
34using namespace phosphor::logging;

--- 14 unchanged lines hidden (view full) ---

49//----------------------------------------------------------------------
50
51ipmi::RspType<IanaType, uint8_t, uint2_t, uint6_t, uint8_t, uint8_t,
52 ipmi::message::Payload>
53 ipmiOemBicHandler(ipmi::Context::ptr ctx, IanaType reqIana,
54 uint8_t interface, uint2_t lun, uint6_t netFnReq,
55 uint8_t cmdReq, SecureBuffer data)
56{
58
59 ipmi::message::Response::ptr res;
60
61 // Updating the correct netfn and cmd in the ipmi Context
62 ctx->netFn = ((uint8_t)netFnReq);
63 ctx->cmd = cmdReq;
64
65 // creating ipmi message request for calling executeIpmiCommand function
66 auto req = std::make_shared<ipmi::message::Request>(ctx, std::move(data));

--- 236 unchanged lines hidden (view full) ---

303 }
304
305 // sending the success response.
306 return ipmi::responseSuccess(resp);
307}
308
309[[maybe_unused]] static void registerBICFunctions(void)
310{
57 ipmi::message::Response::ptr res;
58
59 // Updating the correct netfn and cmd in the ipmi Context
60 ctx->netFn = ((uint8_t)netFnReq);
61 ctx->cmd = cmdReq;
62
63 // creating ipmi message request for calling executeIpmiCommand function
64 auto req = std::make_shared<ipmi::message::Request>(ctx, std::move(data));

--- 236 unchanged lines hidden (view full) ---

301 }
302
303 // sending the success response.
304 return ipmi::responseSuccess(resp);
305}
306
307[[maybe_unused]] static void registerBICFunctions(void)
308{
311
312 phosphor::logging::log<phosphor::logging::level::INFO>(
313 "Registering BIC commands");
314
315 ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnOemFive,
316 static_cast<Cmd>(fb_bic_cmds::CMD_OEM_BIC_INFO),
317 ipmi::Privilege::User, ipmiOemBicHandler);
318 ipmi::registerHandler(
319 ipmi::prioOpenBmcBase, ipmi::netFnOemFive,

--- 20 unchanged lines hidden ---
309 phosphor::logging::log<phosphor::logging::level::INFO>(
310 "Registering BIC commands");
311
312 ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnOemFive,
313 static_cast<Cmd>(fb_bic_cmds::CMD_OEM_BIC_INFO),
314 ipmi::Privilege::User, ipmiOemBicHandler);
315 ipmi::registerHandler(
316 ipmi::prioOpenBmcBase, ipmi::netFnOemFive,

--- 20 unchanged lines hidden ---