blob: cd0a33bc4040c4279a717f5b2091ddf89baf35de [file] [log] [blame]
AppaRao Puli071f3f22018-05-24 16:45:30 +05301/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16
AppaRao Puli071f3f22018-05-24 16:45:30 +053017#include "apphandler.hpp"
18#include "channel_layer.hpp"
19
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000020#include <ipmid/api.hpp>
AppaRao Puli071f3f22018-05-24 16:45:30 +053021#include <phosphor-logging/log.hpp>
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -050022
AppaRao Puli071f3f22018-05-24 16:45:30 +053023#include <regex>
24
25using namespace phosphor::logging;
26
27namespace ipmi
28{
29
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000030/** @brief implements the set channel access command
31 * @ param ctx - context pointer
32 * @ param channel - channel number
33 * @ param reserved - skip 4 bits
34 * @ param accessMode - access mode for IPMI messaging
35 * @ param usrAuth - user level authentication (enable/disable)
36 * @ param msgAuth - per message authentication (enable/disable)
37 * @ param alertDisabled - PEF alerting (enable/disable)
38 * @ param chanAccess - channel access
39 * @ param channelPrivLimit - channel privilege limit
40 * @ param reserved - skip 3 bits
41 * @ param channelPrivMode - channel priviledge mode
42 *
43 * @ returns IPMI completion code
44 **/
45RspType<> ipmiSetChannelAccess(Context::ptr ctx, uint4_t channel,
46 uint4_t reserved1, uint3_t accessMode,
47 bool usrAuth, bool msgAuth, bool alertDisabled,
48 uint2_t chanAccess, uint4_t channelPrivLimit,
49 uint2_t reserved2, uint2_t channelPrivMode)
AppaRao Puli071f3f22018-05-24 16:45:30 +053050{
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +000051 if (reserved1 || reserved2 ||
52 !isValidPrivLimit(static_cast<uint8_t>(channelPrivLimit)))
AppaRao Puli071f3f22018-05-24 16:45:30 +053053 {
Richard Marian Thomaiyaref024012019-01-29 11:06:39 +053054 log<level::DEBUG>("Set channel access - Invalid field in request");
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000055 return responseInvalidFieldRequest();
AppaRao Puli071f3f22018-05-24 16:45:30 +053056 }
57
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +000058 const uint8_t chNum =
59 convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
60 if ((getChannelSessionSupport(chNum) == EChannelSessSupported::none) ||
61 (!isValidChannel(chNum)))
AppaRao Puli071f3f22018-05-24 16:45:30 +053062 {
63 log<level::DEBUG>("Set channel access - No support on channel");
anil kumar appanaddb1f442019-07-04 18:07:27 +000064 return response(ccActionNotSupportedForChannel);
AppaRao Puli071f3f22018-05-24 16:45:30 +053065 }
66
67 ChannelAccess chActData;
68 ChannelAccess chNVData;
69 uint8_t setActFlag = 0;
70 uint8_t setNVFlag = 0;
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000071 Cc compCode;
AppaRao Puli071f3f22018-05-24 16:45:30 +053072
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000073 // cannot static cast directly from uint2_t to enum; must go via int
74 uint8_t channelAccessAction = static_cast<uint8_t>(chanAccess);
75 switch (static_cast<EChannelActionType>(channelAccessAction))
AppaRao Puli071f3f22018-05-24 16:45:30 +053076 {
77 case doNotSet:
AppaRao Puli071f3f22018-05-24 16:45:30 +053078 break;
79 case nvData:
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000080 chNVData.accessMode = static_cast<uint8_t>(accessMode);
81 chNVData.userAuthDisabled = usrAuth;
82 chNVData.perMsgAuthDisabled = msgAuth;
83 chNVData.alertingDisabled = alertDisabled;
AppaRao Puli071f3f22018-05-24 16:45:30 +053084 setNVFlag |= (setAccessMode | setUserAuthEnabled |
85 setMsgAuthEnabled | setAlertingEnabled);
86 break;
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000087
AppaRao Puli071f3f22018-05-24 16:45:30 +053088 case activeData:
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000089 chActData.accessMode = static_cast<uint8_t>(accessMode);
90 chActData.userAuthDisabled = usrAuth;
91 chActData.perMsgAuthDisabled = msgAuth;
92 chActData.alertingDisabled = alertDisabled;
AppaRao Puli071f3f22018-05-24 16:45:30 +053093 setActFlag |= (setAccessMode | setUserAuthEnabled |
94 setMsgAuthEnabled | setAlertingEnabled);
95 break;
NITIN SHARMA89e4bf22019-05-02 13:03:58 +000096
AppaRao Puli071f3f22018-05-24 16:45:30 +053097 case reserved:
98 default:
99 log<level::DEBUG>("Set channel access - Invalid access set mode");
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000100 return response(ccAccessModeNotSupportedForChannel);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530101 }
102
NITIN SHARMA89e4bf22019-05-02 13:03:58 +0000103 // cannot static cast directly from uint2_t to enum; must go via int
104 uint8_t channelPrivAction = static_cast<uint8_t>(channelPrivMode);
105 switch (static_cast<EChannelActionType>(channelPrivAction))
AppaRao Puli071f3f22018-05-24 16:45:30 +0530106 {
107 case doNotSet:
AppaRao Puli071f3f22018-05-24 16:45:30 +0530108 break;
109 case nvData:
NITIN SHARMA89e4bf22019-05-02 13:03:58 +0000110 chNVData.privLimit = static_cast<uint8_t>(channelPrivLimit);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530111 setNVFlag |= setPrivLimit;
112 break;
113 case activeData:
NITIN SHARMA89e4bf22019-05-02 13:03:58 +0000114 chActData.privLimit = static_cast<uint8_t>(channelPrivLimit);
115
AppaRao Puli071f3f22018-05-24 16:45:30 +0530116 setActFlag |= setPrivLimit;
117 break;
118 case reserved:
119 default:
120 log<level::DEBUG>("Set channel access - Invalid access priv mode");
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000121 return response(ccAccessModeNotSupportedForChannel);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530122 }
123
124 if (setNVFlag != 0)
125 {
126 compCode = setChannelAccessPersistData(chNum, chNVData, setNVFlag);
NITIN SHARMAb541a5a2019-07-18 12:46:59 +0000127 if (compCode != ccSuccess)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530128 {
129 log<level::DEBUG>("Set channel access - Failed to set access data");
NITIN SHARMA89e4bf22019-05-02 13:03:58 +0000130 return response(compCode);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530131 }
132 }
133
134 if (setActFlag != 0)
135 {
136 compCode = setChannelAccessData(chNum, chActData, setActFlag);
NITIN SHARMAb541a5a2019-07-18 12:46:59 +0000137 if (compCode != ccSuccess)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530138 {
139 log<level::DEBUG>("Set channel access - Failed to set access data");
NITIN SHARMA89e4bf22019-05-02 13:03:58 +0000140 return response(compCode);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530141 }
142 }
143
NITIN SHARMA89e4bf22019-05-02 13:03:58 +0000144 return responseSuccess();
AppaRao Puli071f3f22018-05-24 16:45:30 +0530145}
146
Richard Marian Thomaiyarbc5e9ba2019-05-07 13:32:48 +0530147/** @brief implements the get channel access command
148 * @ param ctx - context pointer
149 * @ param channel - channel number
150 * @ param reserved1 - skip 4 bits
151 * @ param reserved2 - skip 6 bits
152 * @ param accessMode - get access mode
153 *
154 * @returns ipmi completion code plus response data
155 * - accessMode - get access mode
156 * - usrAuthDisabled - user level authentication status
157 * - msgAuthDisabled - message level authentication status
158 * - alertDisabled - alerting status
159 * - reserved - skip 2 bits
160 * - privLimit - channel privilege limit
161 * - reserved - skip 4 bits
162 * */
163ipmi ::RspType<uint3_t, // access mode,
164 bool, // user authentication status,
165 bool, // message authentication status,
166 bool, // alerting status,
167 uint2_t, // reserved,
168
169 uint4_t, // channel privilege,
170 uint4_t // reserved
171 >
172 ipmiGetChannelAccess(Context::ptr ctx, uint4_t channel, uint4_t reserved1,
173 uint6_t reserved2, uint2_t accessSetMode)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530174{
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000175 if (reserved1 || reserved2)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530176 {
Richard Marian Thomaiyaref024012019-01-29 11:06:39 +0530177 log<level::DEBUG>("Get channel access - Invalid field in request");
Richard Marian Thomaiyarbc5e9ba2019-05-07 13:32:48 +0530178 return responseInvalidFieldRequest();
AppaRao Puli071f3f22018-05-24 16:45:30 +0530179 }
180
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700181 if ((types::enum_cast<EChannelActionType>(accessSetMode) == doNotSet) ||
182 (types::enum_cast<EChannelActionType>(accessSetMode) == reserved))
AppaRao Puli071f3f22018-05-24 16:45:30 +0530183 {
184 log<level::DEBUG>("Get channel access - Invalid Access mode");
AppaRao Pulic4f4f7a2020-07-13 16:43:59 +0530185 return responseInvalidFieldRequest();
AppaRao Puli071f3f22018-05-24 16:45:30 +0530186 }
187
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000188 const uint8_t chNum =
189 convertCurrentChannelNum(static_cast<uint8_t>(channel), ctx->channel);
190
191 if ((getChannelSessionSupport(chNum) == EChannelSessSupported::none) ||
192 (!isValidChannel(chNum)))
AppaRao Puli071f3f22018-05-24 16:45:30 +0530193 {
194 log<level::DEBUG>("Get channel access - No support on channel");
anil kumar appanaddb1f442019-07-04 18:07:27 +0000195 return response(ccActionNotSupportedForChannel);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530196 }
197
PavanKumarIntel3771f5f2023-11-02 06:26:42 +0000198 ChannelAccess chAccess = {};
AppaRao Puli071f3f22018-05-24 16:45:30 +0530199
William A. Kennington III4c521022023-07-28 13:07:30 -0700200 Cc compCode = ipmi::ccUnspecifiedError;
Richard Marian Thomaiyarbc5e9ba2019-05-07 13:32:48 +0530201
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700202 if (types::enum_cast<EChannelActionType>(accessSetMode) == nvData)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530203 {
204 compCode = getChannelAccessPersistData(chNum, chAccess);
205 }
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700206 else if (types::enum_cast<EChannelActionType>(accessSetMode) == activeData)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530207 {
208 compCode = getChannelAccessData(chNum, chAccess);
209 }
210
NITIN SHARMAb541a5a2019-07-18 12:46:59 +0000211 if (compCode != ccSuccess)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530212 {
Richard Marian Thomaiyarbc5e9ba2019-05-07 13:32:48 +0530213 return response(compCode);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530214 }
215
Richard Marian Thomaiyarbc5e9ba2019-05-07 13:32:48 +0530216 constexpr uint2_t reservedOut1 = 0;
217 constexpr uint4_t reservedOut2 = 0;
AppaRao Puli071f3f22018-05-24 16:45:30 +0530218
Richard Marian Thomaiyarbc5e9ba2019-05-07 13:32:48 +0530219 return responseSuccess(
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700220 types::enum_cast<uint3_t>(chAccess.accessMode),
221 chAccess.userAuthDisabled, chAccess.perMsgAuthDisabled,
222 chAccess.alertingDisabled, reservedOut1,
223 types::enum_cast<uint4_t>(chAccess.privLimit), reservedOut2);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530224}
225
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700226/** @brief implements the get channel info command
227 * @ param ctx - context pointer
228 * @ param channel - channel number
229 * @ param reserved - skip 4 bits
230 *
231 * @returns ipmi completion code plus response data
232 * - chNum - the channel number for this request
233 * - mediumType - see Table 6-3, Channel Medium Type Numbers
234 * - protocolType - Table 6-2, Channel Protocol Type Numbers
235 * - activeSessionCount - number of active sessions
236 * - sessionType - channel support for sessions
237 * - vendorId - vendor for this channel protocol (IPMI - 7154)
238 * - auxChInfo - auxiliary info for channel
239 * */
240RspType<uint4_t, // chNum
241 uint4_t, // reserved
242 uint7_t, // mediumType
243 bool, // reserved
244 uint5_t, // protocolType
245 uint3_t, // reserved
246 uint6_t, // activeSessionCount
247 uint2_t, // sessionType
248 uint24_t, // Vendor IANA
249 uint16_t // aux info
250 >
251 ipmiGetChannelInfo(Context::ptr ctx, uint4_t channel, uint4_t reserved)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530252{
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000253 if (reserved)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530254 {
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700255 log<level::DEBUG>("Get channel access - Invalid field in request");
256 return responseInvalidFieldRequest();
AppaRao Puli071f3f22018-05-24 16:45:30 +0530257 }
258
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -0500259 uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
260 ctx->channel);
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000261 if (!isValidChannel(chNum))
262 {
263 log<level::DEBUG>("Get channel Info - No support on channel");
Jayaprakash Mutyalaafd12b42020-07-07 01:06:57 +0000264 return responseInvalidFieldRequest();
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000265 }
266
AppaRao Puli071f3f22018-05-24 16:45:30 +0530267 ChannelInfo chInfo;
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700268 Cc compCode = getChannelInfo(chNum, chInfo);
269 if (compCode != ccSuccess)
AppaRao Puli071f3f22018-05-24 16:45:30 +0530270 {
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700271 log<level::ERR>("Failed to get channel info",
272 entry("CHANNEL=%x", chNum),
273 entry("ERRNO=%x", compCode));
274 return response(compCode);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530275 }
276
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700277 constexpr uint4_t reserved1 = 0;
278 constexpr bool reserved2 = false;
279 constexpr uint3_t reserved3 = 0;
280 uint8_t mediumType = chInfo.mediumType;
281 uint8_t protocolType = chInfo.protocolType;
282 uint2_t sessionType = chInfo.sessionSupported;
283 uint6_t activeSessionCount = getChannelActiveSessions(chNum);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530284 // IPMI Spec: The IPMI Enterprise Number is: 7154 (decimal)
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700285 constexpr uint24_t vendorId = 7154;
286 constexpr uint16_t auxChInfo = 0;
AppaRao Puli071f3f22018-05-24 16:45:30 +0530287
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700288 return responseSuccess(chNum, reserved1, mediumType, reserved2,
289 protocolType, reserved3, activeSessionCount,
290 sessionType, vendorId, auxChInfo);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530291}
292
Vernon Maueryf6092892019-05-02 16:35:10 -0700293namespace
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530294{
Vernon Maueryf6092892019-05-02 16:35:10 -0700295constexpr uint16_t standardPayloadBit(PayloadType p)
296{
297 return (1 << static_cast<size_t>(p));
298}
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530299
Vernon Maueryf6092892019-05-02 16:35:10 -0700300constexpr uint16_t sessionPayloadBit(PayloadType p)
301{
302 constexpr size_t sessionShift =
303 static_cast<size_t>(PayloadType::OPEN_SESSION_REQUEST);
304 return ((1 << static_cast<size_t>(p)) >> sessionShift);
305}
306} // namespace
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530307
Vernon Maueryf6092892019-05-02 16:35:10 -0700308/** @brief implements get channel payload support command
309 * @ param ctx - ipmi context pointer
310 * @ param chNum - channel number
311 * @ param reserved - skip 4 bits
312 *
313 * @ returns IPMI completion code plus response data
314 * - stdPayloadType - bitmask of supported standard payload types
315 * - sessSetupPayloadType - bitmask of supported session setup payload types
316 * - OEMPayloadType - bitmask of supported OEM payload types
317 * - reserved - 2 bytes of 0
318 **/
319RspType<uint16_t, // stdPayloadType
320 uint16_t, // sessSetupPayloadType
321 uint16_t, // OEMPayloadType
322 uint16_t // reserved
323 >
324 ipmiGetChannelPayloadSupport(Context::ptr ctx, uint4_t channel,
325 uint4_t reserved)
326{
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -0500327 uint8_t chNum = convertCurrentChannelNum(static_cast<uint8_t>(channel),
328 ctx->channel);
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000329
330 if (!doesDeviceExist(chNum) || !isValidChannel(chNum) || reserved)
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530331 {
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000332 log<level::DEBUG>("Get channel payload - Invalid field in request");
Vernon Maueryf6092892019-05-02 16:35:10 -0700333 return responseInvalidFieldRequest();
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530334 }
335
336 // Session support is available in active LAN channels.
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000337 if (getChannelSessionSupport(chNum) == EChannelSessSupported::none)
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530338 {
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000339 log<level::DEBUG>("Get channel payload - No support on channel");
340 return response(ccActionNotSupportedForChannel);
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530341 }
Vernon Maueryf6092892019-05-02 16:35:10 -0700342 constexpr uint16_t stdPayloadType = standardPayloadBit(PayloadType::IPMI) |
343 standardPayloadBit(PayloadType::SOL);
344 constexpr uint16_t sessSetupPayloadType =
345 sessionPayloadBit(PayloadType::OPEN_SESSION_REQUEST) |
346 sessionPayloadBit(PayloadType::OPEN_SESSION_RESPONSE) |
347 sessionPayloadBit(PayloadType::RAKP1) |
348 sessionPayloadBit(PayloadType::RAKP2) |
349 sessionPayloadBit(PayloadType::RAKP3) |
350 sessionPayloadBit(PayloadType::RAKP4);
351 constexpr uint16_t OEMPayloadType = 0;
352 constexpr uint16_t rspRsvd = 0;
353 return responseSuccess(stdPayloadType, sessSetupPayloadType, OEMPayloadType,
354 rspRsvd);
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530355}
356
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000357/** @brief implements the get channel payload version command
358 * @param ctx - IPMI context pointer (for channel)
359 * @param chNum - channel number to get info about
360 * @param reserved - skip 4 bits
361 * @param payloadTypeNum - to get payload type info
362
363 * @returns IPMI completion code plus response data
364 * - formatVersion - BCD encoded format version info
365 */
366
367RspType<uint8_t> // formatVersion
368 ipmiGetChannelPayloadVersion(Context::ptr ctx, uint4_t chNum,
369 uint4_t reserved, uint8_t payloadTypeNum)
370{
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -0500371 uint8_t channel = convertCurrentChannelNum(static_cast<uint8_t>(chNum),
372 ctx->channel);
Manoj Ashok271d9c22021-07-22 23:21:31 +0530373 constexpr uint8_t payloadTypeNotSupported = 0x80;
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000374
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000375 if (reserved || !isValidChannel(channel))
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000376 {
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000377 log<level::DEBUG>(
378 "Get channel payload version - Invalid field in request");
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000379 return responseInvalidFieldRequest();
380 }
381
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000382 if (getChannelSessionSupport(channel) == EChannelSessSupported::none)
383 {
384 log<level::DEBUG>(
385 "Get channel payload version - No support on channel");
Manoj Ashok271d9c22021-07-22 23:21:31 +0530386 return response(payloadTypeNotSupported);
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000387 }
388
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000389 if (!isValidPayloadType(static_cast<PayloadType>(payloadTypeNum)))
390 {
jayaprakash Mutyala0e2dbee2019-12-26 13:03:04 +0000391 log<level::ERR>(
392 "Get channel payload version - Payload type unavailable");
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000393
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000394 return response(payloadTypeNotSupported);
395 }
396
397 // BCD encoded version representation - 1.0
398 constexpr uint8_t formatVersion = 0x10;
399
400 return responseSuccess(formatVersion);
401}
402
William A. Kennington III343d0612018-12-10 15:56:24 -0800403void registerChannelFunctions() __attribute__((constructor));
AppaRao Puli071f3f22018-05-24 16:45:30 +0530404void registerChannelFunctions()
405{
406 ipmiChannelInit();
407
NITIN SHARMA89e4bf22019-05-02 13:03:58 +0000408 registerHandler(prioOpenBmcBase, netFnApp, app::cmdSetChannelAccess,
409 Privilege::Admin, ipmiSetChannelAccess);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530410
Richard Marian Thomaiyarbc5e9ba2019-05-07 13:32:48 +0530411 registerHandler(prioOpenBmcBase, netFnApp, app::cmdGetChannelAccess,
412 Privilege::User, ipmiGetChannelAccess);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530413
Vernon Mauery6f1e9782019-05-02 16:31:07 -0700414 registerHandler(prioOpenBmcBase, netFnApp, app::cmdGetChannelInfoCommand,
415 Privilege::User, ipmiGetChannelInfo);
Saravanan Palanisamyb5a0f162019-03-04 18:34:44 +0530416
Vernon Maueryf6092892019-05-02 16:35:10 -0700417 registerHandler(prioOpenBmcBase, netFnApp, app::cmdGetChannelPayloadSupport,
418 Privilege::User, ipmiGetChannelPayloadSupport);
Ayushi Smriti6fd812d2019-04-12 18:51:31 +0000419
420 registerHandler(prioOpenBmcBase, netFnApp, app::cmdGetChannelPayloadVersion,
421 Privilege::User, ipmiGetChannelPayloadVersion);
AppaRao Puli071f3f22018-05-24 16:45:30 +0530422}
423
424} // namespace ipmi