blob: 2336f0211249268c989003cb872855fbcef3ab03 [file] [log] [blame]
Tom Joseph64b3dec2017-04-03 01:53:44 +05301#pragma once
2
3#include <vector>
4#include "message_handler.hpp"
5
6namespace sol
7{
8
9namespace command
10{
11
12/** @brief SOL Payload Handler
13 *
14 * This command is used for activating and deactivating a payload type under a
15 * given IPMI session. The UDP Port number for SOL is the same as the port that
16 * was used to establish the IPMI session.
17 *
18 * @param[in] inPayload - Request data for the command.
19 * @param[in] handler - Reference to the message handler.
20 *
21 * @return Response data for the command.
22 */
Tom Joseph18a45e92017-04-11 11:30:44 +053023std::vector<uint8_t> payloadHandler(const std::vector<uint8_t>& inPayload,
Tom Joseph64b3dec2017-04-03 01:53:44 +053024 const message::Handler& handler);
Tom Josephe14ac962017-04-03 01:56:04 +053025
26constexpr uint8_t netfnTransport = 0x0C;
27constexpr uint8_t solActivatingCmd = 0x20;
28
29/** @struct ActivatingRequest
30 *
31 * IPMI payload for SOL Activating command.
32 */
33struct ActivatingRequest
34{
35#if BYTE_ORDER == LITTLE_ENDIAN
36 uint8_t sessionState : 4; //!< SOL session state.
37 uint8_t reserved : 4; //!< Reserved.
38#endif
39
40#if BYTE_ORDER == BIG_ENDIAN
41 uint8_t reserved : 4; //!< Reserved.
42 uint8_t sessionState : 4; //!< SOL session state.
43#endif
44
45 uint8_t payloadInstance; //!< Payload instance.
46 uint8_t majorVersion; //!< SOL format major version
47 uint8_t minorVersion; //!< SOL format minor version
48} __attribute__((packed));
49
50/** @brief SOL Activating Command.
51 *
52 * This command provides a mechanism for the BMC to notify a remote application
53 * that a SOL payload is activating on another channel.The request message is a
54 * message that is asynchronously generated by the BMC. The BMC will not wait
55 * for a response from the remote console before dropping the serial connection
56 * to proceed with SOL, therefore the remote console does not need to respond
57 * to this command.
58 *
59 * @param[in] payloadInstance - SOL payload instance.
60 * @param[in] sessionID - IPMI session ID.
61 */
62void activating(uint8_t payloadInstance, uint32_t sessionID);
63
Tom Joseph48b99512017-04-28 01:31:08 +053064/** @enum Parameter
65 *
66 * SOL parameters are volatile, they are initialized by the SOL manager.
67 * They can be read using Get SOL configuration parameters command and updated
68 * using Set SOL configuration parameters command.
69 */
70enum class Parameter
71{
72 PROGRESS, //!< Set In Progress.
73 ENABLE, //!< SOL Enable.
74 AUTHENTICATION, //!< SOL Authentication.
75 ACCUMULATE, //!< Character Accumulate Interval & Send Threshold.
76 RETRY, //!< SOL Retry.
77 NVBITRATE, //!< SOL non-volatile bit rate.
78 VBITRATE, //!< SOL volatile bit rate.
79 CHANNEL, //!< SOL payload channel.
80 PORT, //!< SOL payload port.
81};
82
83constexpr uint8_t progressMask = 0x03;
84constexpr uint8_t enableMask = 0x01;
85
86/** @struct Auth
87 *
88 * SOL authentication parameter.
89 */
90struct Auth
91{
92#if BYTE_ORDER == LITTLE_ENDIAN
93 uint8_t privilege : 4; //!< SOL privilege level.
94 uint8_t reserved : 2; //!< Reserved.
95 uint8_t auth : 1; //!< Force SOL payload Authentication.
96 uint8_t encrypt : 1; //!< Force SOL payload encryption.
97#endif
98
99#if BYTE_ORDER == BIG_ENDIAN
100 uint8_t encrypt : 1; //!< Force SOL payload encryption.
101 uint8_t auth : 1; //!< Force SOL payload Authentication.
102 uint8_t reserved : 2; //!< Reserved.
103 uint8_t privilege : 4; //!< SOL privilege level.
104#endif
105} __attribute__((packed));
106
107/** @struct Accumulate
108 *
109 * Character accumulate interval & Character send threshold.
110 */
111struct Accumulate
112{
113 uint8_t interval; //!< Character accumulate interval.
114 uint8_t threshold; //!< Character send threshold.
115} __attribute__((packed));
116
117constexpr uint8_t retryCountMask = 0x07;
118
119/** @struct Retry
120 *
121 * SOL retry count and interval.
122 */
123struct Retry
124{
125#if BYTE_ORDER == LITTLE_ENDIAN
126 uint8_t count : 3; //!< SOL retry count.
127 uint8_t reserved : 5; //!< Reserved.
128#endif
129
130#if BYTE_ORDER == BIG_ENDIAN
131 uint8_t reserved : 5; //!< Reserved.
132 uint8_t count : 3; //!< SOL retry count.
133#endif
134
135 uint8_t interval; //!< SOL retry interval.
136} __attribute__((packed));
137
138constexpr uint8_t ipmiCCParamNotSupported = 0x80;
139constexpr uint8_t ipmiCCInvalidSetInProgress = 0x81;
140constexpr uint8_t ipmiCCWriteReadParameter = 0x82;
141constexpr uint8_t ipmiCCReadWriteParameter = 0x83;
142constexpr uint8_t parameterRevision = 0x11;
143
144/** @struct SetConfParamsRequest
145 *
146 * IPMI payload for Set SOL configuration parameters command request.
147 */
148struct SetConfParamsRequest
149{
150#if BYTE_ORDER == LITTLE_ENDIAN
151 uint8_t channelNumber : 4; //!< Channel number.
152 uint8_t reserved : 4; //!< Reserved.
153#endif
154
155#if BYTE_ORDER == BIG_ENDIAN
156 uint8_t reserved : 4; //!< Reserved.
157 uint8_t channelNumber : 4; //!< Channel number.
158#endif
159
160 uint8_t paramSelector; //!< Parameter selector.
161 union
162 {
163 uint8_t value; //!< Represents one byte SOL parameters.
164 struct Accumulate acc; //!< Character accumulate values.
165 struct Retry retry; //!< Retry values.
166 struct Auth auth; //!< Authentication parameters.
167 };
168} __attribute__((packed));
169
170/** @struct SetConfParamsResponse
171 *
172 * IPMI payload for Set SOL configuration parameters command response.
173 */
174struct SetConfParamsResponse
175{
176 uint8_t completionCode; //!< Completion code.
177} __attribute__((packed));
178
179/** @brief Set SOL configuration parameters command.
180 *
181 * @param[in] inPayload - Request data for the command.
182 * @param[in] handler - Reference to the message handler.
183 *
184 * @return Response data for the command.
185 */
186std::vector<uint8_t> setConfParams(const std::vector<uint8_t>& inPayload,
187 const message::Handler& handler);
188
Tom Joseph64b3dec2017-04-03 01:53:44 +0530189} // namespace command
190
191} // namespace sol