blob: 182b73e7c2e8c80f19e8cea95910a2694cb8ad9f [file] [log] [blame]
Tom Joseph64b3dec2017-04-03 01:53:44 +05301#pragma once
2
Tom Joseph64b3dec2017-04-03 01:53:44 +05303#include "message_handler.hpp"
4
Vernon Mauery9e801a22018-10-12 13:20:49 -07005#include <vector>
6
Tom Joseph64b3dec2017-04-03 01:53:44 +05307namespace sol
8{
9
10namespace command
11{
12
13/** @brief SOL Payload Handler
14 *
15 * This command is used for activating and deactivating a payload type under a
16 * given IPMI session. The UDP Port number for SOL is the same as the port that
17 * was used to establish the IPMI session.
18 *
19 * @param[in] inPayload - Request data for the command.
20 * @param[in] handler - Reference to the message handler.
21 *
22 * @return Response data for the command.
23 */
Tom Joseph18a45e92017-04-11 11:30:44 +053024std::vector<uint8_t> payloadHandler(const std::vector<uint8_t>& inPayload,
Tom Joseph64b3dec2017-04-03 01:53:44 +053025 const message::Handler& handler);
Tom Josephe14ac962017-04-03 01:56:04 +053026
27constexpr uint8_t netfnTransport = 0x0C;
28constexpr uint8_t solActivatingCmd = 0x20;
29
30/** @struct ActivatingRequest
31 *
32 * IPMI payload for SOL Activating command.
33 */
34struct ActivatingRequest
35{
36#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070037 uint8_t sessionState : 4; //!< SOL session state.
38 uint8_t reserved : 4; //!< Reserved.
Tom Josephe14ac962017-04-03 01:56:04 +053039#endif
40
41#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070042 uint8_t reserved : 4; //!< Reserved.
43 uint8_t sessionState : 4; //!< SOL session state.
Tom Josephe14ac962017-04-03 01:56:04 +053044#endif
45
Vernon Mauery9e801a22018-10-12 13:20:49 -070046 uint8_t payloadInstance; //!< Payload instance.
47 uint8_t majorVersion; //!< SOL format major version
48 uint8_t minorVersion; //!< SOL format minor version
Tom Josephe14ac962017-04-03 01:56:04 +053049} __attribute__((packed));
50
51/** @brief SOL Activating Command.
52 *
53 * This command provides a mechanism for the BMC to notify a remote application
54 * that a SOL payload is activating on another channel.The request message is a
55 * message that is asynchronously generated by the BMC. The BMC will not wait
56 * for a response from the remote console before dropping the serial connection
57 * to proceed with SOL, therefore the remote console does not need to respond
58 * to this command.
59 *
60 * @param[in] payloadInstance - SOL payload instance.
61 * @param[in] sessionID - IPMI session ID.
62 */
63void activating(uint8_t payloadInstance, uint32_t sessionID);
64
Tom Joseph48b99512017-04-28 01:31:08 +053065/** @enum Parameter
66 *
67 * SOL parameters are volatile, they are initialized by the SOL manager.
68 * They can be read using Get SOL configuration parameters command and updated
69 * using Set SOL configuration parameters command.
70 */
71enum class Parameter
72{
73 PROGRESS, //!< Set In Progress.
74 ENABLE, //!< SOL Enable.
75 AUTHENTICATION, //!< SOL Authentication.
76 ACCUMULATE, //!< Character Accumulate Interval & Send Threshold.
77 RETRY, //!< SOL Retry.
78 NVBITRATE, //!< SOL non-volatile bit rate.
79 VBITRATE, //!< SOL volatile bit rate.
80 CHANNEL, //!< SOL payload channel.
81 PORT, //!< SOL payload port.
82};
83
84constexpr uint8_t progressMask = 0x03;
85constexpr uint8_t enableMask = 0x01;
86
87/** @struct Auth
88 *
89 * SOL authentication parameter.
90 */
91struct Auth
92{
93#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -070094 uint8_t privilege : 4; //!< SOL privilege level.
95 uint8_t reserved : 2; //!< Reserved.
96 uint8_t auth : 1; //!< Force SOL payload Authentication.
97 uint8_t encrypt : 1; //!< Force SOL payload encryption.
Tom Joseph48b99512017-04-28 01:31:08 +053098#endif
99
100#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700101 uint8_t encrypt : 1; //!< Force SOL payload encryption.
102 uint8_t auth : 1; //!< Force SOL payload Authentication.
103 uint8_t reserved : 2; //!< Reserved.
104 uint8_t privilege : 4; //!< SOL privilege level.
Tom Joseph48b99512017-04-28 01:31:08 +0530105#endif
106} __attribute__((packed));
107
108/** @struct Accumulate
109 *
110 * Character accumulate interval & Character send threshold.
111 */
112struct Accumulate
113{
Vernon Mauery9e801a22018-10-12 13:20:49 -0700114 uint8_t interval; //!< Character accumulate interval.
115 uint8_t threshold; //!< Character send threshold.
Tom Joseph48b99512017-04-28 01:31:08 +0530116} __attribute__((packed));
117
118constexpr uint8_t retryCountMask = 0x07;
119
120/** @struct Retry
121 *
122 * SOL retry count and interval.
123 */
124struct Retry
125{
126#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700127 uint8_t count : 3; //!< SOL retry count.
128 uint8_t reserved : 5; //!< Reserved.
Tom Joseph48b99512017-04-28 01:31:08 +0530129#endif
130
131#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700132 uint8_t reserved : 5; //!< Reserved.
133 uint8_t count : 3; //!< SOL retry count.
Tom Joseph48b99512017-04-28 01:31:08 +0530134#endif
135
Vernon Mauery9e801a22018-10-12 13:20:49 -0700136 uint8_t interval; //!< SOL retry interval.
Tom Joseph48b99512017-04-28 01:31:08 +0530137} __attribute__((packed));
138
139constexpr uint8_t ipmiCCParamNotSupported = 0x80;
140constexpr uint8_t ipmiCCInvalidSetInProgress = 0x81;
141constexpr uint8_t ipmiCCWriteReadParameter = 0x82;
142constexpr uint8_t ipmiCCReadWriteParameter = 0x83;
143constexpr uint8_t parameterRevision = 0x11;
144
145/** @struct SetConfParamsRequest
146 *
147 * IPMI payload for Set SOL configuration parameters command request.
148 */
149struct SetConfParamsRequest
150{
151#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700152 uint8_t channelNumber : 4; //!< Channel number.
153 uint8_t reserved : 4; //!< Reserved.
Tom Joseph48b99512017-04-28 01:31:08 +0530154#endif
155
156#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700157 uint8_t reserved : 4; //!< Reserved.
158 uint8_t channelNumber : 4; //!< Channel number.
Tom Joseph48b99512017-04-28 01:31:08 +0530159#endif
160
Vernon Mauery9e801a22018-10-12 13:20:49 -0700161 uint8_t paramSelector; //!< Parameter selector.
Tom Joseph48b99512017-04-28 01:31:08 +0530162 union
163 {
Vernon Mauery9e801a22018-10-12 13:20:49 -0700164 uint8_t value; //!< Represents one byte SOL parameters.
165 struct Accumulate acc; //!< Character accumulate values.
166 struct Retry retry; //!< Retry values.
167 struct Auth auth; //!< Authentication parameters.
Tom Joseph48b99512017-04-28 01:31:08 +0530168 };
169} __attribute__((packed));
170
171/** @struct SetConfParamsResponse
172 *
173 * IPMI payload for Set SOL configuration parameters command response.
174 */
175struct SetConfParamsResponse
176{
Vernon Mauery9e801a22018-10-12 13:20:49 -0700177 uint8_t completionCode; //!< Completion code.
Tom Joseph48b99512017-04-28 01:31:08 +0530178} __attribute__((packed));
179
180/** @brief Set SOL configuration parameters command.
181 *
182 * @param[in] inPayload - Request data for the command.
183 * @param[in] handler - Reference to the message handler.
184 *
185 * @return Response data for the command.
186 */
187std::vector<uint8_t> setConfParams(const std::vector<uint8_t>& inPayload,
188 const message::Handler& handler);
189
Tom Joseph20aef332017-04-28 01:34:10 +0530190/** @struct GetConfParamsRequest
191 *
192 * IPMI payload for Get SOL configuration parameters command request.
193 */
194struct GetConfParamsRequest
195{
196#if BYTE_ORDER == LITTLE_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700197 uint8_t channelNum : 4; //!< Channel number.
198 uint8_t reserved : 3; //!< Reserved.
199 uint8_t getParamRev : 1; //!< Get parameter or Get parameter revision
Tom Joseph20aef332017-04-28 01:34:10 +0530200#endif
201
202#if BYTE_ORDER == BIG_ENDIAN
Vernon Mauery9e801a22018-10-12 13:20:49 -0700203 uint8_t getParamRev : 1; //!< Get parameter or Get parameter revision
204 uint8_t reserved : 3; //!< Reserved.
205 uint8_t channelNum : 4; //!< Channel number.
Tom Joseph20aef332017-04-28 01:34:10 +0530206#endif
207
Vernon Mauery9e801a22018-10-12 13:20:49 -0700208 uint8_t paramSelector; //!< Parameter selector.
209 uint8_t setSelector; //!< Set selector.
210 uint8_t blockSelector; //!< Block selector.
Tom Joseph20aef332017-04-28 01:34:10 +0530211} __attribute__((packed));
212
213/** @struct GetConfParamsResponse
214 *
215 * IPMI payload for Get SOL configuration parameters command response.
216 */
217struct GetConfParamsResponse
218{
Vernon Mauery9e801a22018-10-12 13:20:49 -0700219 uint8_t completionCode; //!< Completion code.
220 uint8_t paramRev; //!< Parameter revision.
Tom Joseph20aef332017-04-28 01:34:10 +0530221} __attribute__((packed));
222
223/** @brief Get SOL configuration parameters command.
224 *
225 * @param[in] inPayload - Request data for the command.
226 * @param[in] handler - Reference to the message handler.
227 *
228 * @return Response data for the command.
229 */
230std::vector<uint8_t> getConfParams(const std::vector<uint8_t>& inPayload,
231 const message::Handler& handler);
232
Tom Joseph64b3dec2017-04-03 01:53:44 +0530233} // namespace command
234
235} // namespace sol