bridgingcommands:move get&send commands to new api
Rewrite get and send message commands to use new IPMI provider API.
Tested:
verified ipmitool get and send message command, is same both before and
after the changes
1. Enter in Manufacturing mode by executing below command
Command: ipmitool raw 0x30 0xB4 3 2
Response: //Success
2. Send message command
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 06 2C D3 01 FC FC 04 00 2C FC 08
C1 13
Response: 00 00 00 00 00 00 //Success
3. Get message command
Commad:
FS0:\cmdtool\> cmdtool.efi 20 18 33
Response: 00 FC FC D4 30 2C FC 04 C1 13
Negative Test cases:
Send Message Command:
1. // Encryption Enabled
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 26 2C D3 01 FC FC 04 00 2C FC 08 C1 13
Response: C9
2. // Authentication Enabled
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 16 2C D3 01 FC FC 04 00 2C FC 08 C1 13
Response: C9
3. // Channel other than IPMB and Lan
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 07 2C D3 01 FC FC 04 00 2C FC 08 C1 13
Response: C9
4. // IPMB data length Invalid:
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 06 2C
Response: C7
5. // IPMB address invalid:
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 06 2B D3 01 FC FC 04 00 2C FC 08 C1 13
Response: C9
6. // Tracking = 2 and 3 (Tracking mode not supported)
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 86 2C D3 01 FC FC 04 00 2C FC 08 C1 13
Response: C9
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 C6 2C D3 01 FC FC 04 00 2C FC 08 C1 13
Response: C9
7. // IPMB frame invalid:
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 06 2C D3 01 FC FC 04 00 2C FC 08 C1 12
Response: C9
8. // Response queue max size: (After doing multiple send)
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 06 2C D3 01 FC FC 04 00 2C FC 08 C1 13
Response: C0
9. IPMB layer non zero status:
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 34 06 2C D4 00 FB FC 04 00 2C FC 09 C1 13
Response: CE
Get Message Command:
10. // After booting, do Get Message command (Before send command)
Command:
FS0:\cmdtool\> cmdtool.efi 20 18 33
Response: 80
Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Signed-off-by: Deepak Kumar Sahu <deepakx.sahu@intel.com>
Change-Id: I2a4028dbe889a0737821f95889c39e44254a12ca
diff --git a/include/bridgingcommands.hpp b/include/bridgingcommands.hpp
index fe92f6c..6dbac02 100644
--- a/include/bridgingcommands.hpp
+++ b/include/bridgingcommands.hpp
@@ -100,12 +100,6 @@
constexpr uint8_t modeSendRaw = 0x2;
/**
- * @brief Command specific codes
- */
-constexpr ipmi_return_codes ipmiGetMessageCmdDataNotAvailable =
- static_cast<ipmi_return_codes>(0x80);
-
-/**
* @brief Ipmb frame
*/
typedef struct
@@ -182,54 +176,6 @@
};
/**
- * @brief Send Message Request
- */
-typedef struct
-{
- uint8_t channelData;
- uint8_t data[];
-
- constexpr uint8_t channelNumGet()
- {
- return (channelData & 0xF);
- }
-
- constexpr uint8_t authenticationGet()
- {
- return ((channelData & 0x10) >> 4);
- }
-
- constexpr uint8_t encryptionGet()
- {
- return ((channelData & 0x20) >> 5);
- }
-
- constexpr uint8_t modeGet()
- {
- return ((channelData & 0xC0) >> 6);
- }
-} __attribute__((packed)) sSendMessageReq;
-
-/**
- * @brief Get Message Response
- */
-typedef struct
-{
- uint8_t channelData;
- uint8_t data[];
-
- constexpr void channelNumSet(uint8_t num)
- {
- channelData |= num & 0xF;
- }
-
- constexpr void privilegeLvlSet(CommandPrivilege privLvl)
- {
- channelData |= static_cast<uint8_t>(privLvl) & 0xF0;
- }
-} __attribute__((packed)) sGetMessageRes;
-
-/**
* @brief Get Message Flags Response
*/
constexpr uint8_t getMsgFlagReceiveMessageBit = 0;
@@ -239,44 +185,6 @@
constexpr uint8_t getMsgFlagOEM1Bit = 6;
constexpr uint8_t getMsgFlagOEM2Bit = 7;
-/**
- * @brief Clear Message Flags Request
- */
-typedef struct
-{
- uint8_t flags;
-
- constexpr uint8_t receiveMessageBitGet()
- {
- return (flags & 0x1);
- }
-
- constexpr uint8_t eventMessageBitGet()
- {
- return ((flags & 0x2) >> 1);
- }
-
- constexpr uint8_t watchdogTimeoutBitGet()
- {
- return ((flags & 0x8) >> 3);
- }
-
- constexpr uint8_t oem0BitGet()
- {
- return ((flags & 0x20) >> 5);
- }
-
- constexpr uint8_t oem1BitGet()
- {
- return ((flags & 0x40) >> 6);
- }
-
- constexpr uint8_t oem2BitGet()
- {
- return ((flags & 0x80) >> 7);
- }
-} __attribute__((packed)) sClearMessageFlagsReq;
-
/** @class Bridging
*
* @brief Implement commands to support IPMI bridging.
@@ -287,26 +195,18 @@
Bridging() = default;
std::size_t getResponseQueueSize();
- std::vector<IpmbResponse> getResponseQueue();
void clearResponseQueue();
- ipmi_return_codes sendMessageHandler(ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t dataLen);
+ ipmi::Cc handleIpmbChannel(const uint8_t tracking,
+ const std::vector<uint8_t> &msgData,
+ std::vector<uint8_t> &rspData);
- ipmi_return_codes getMessageHandler(ipmi_request_t request,
- ipmi_response_t response,
- ipmi_data_len_t dataLen);
- enum IpmiAppBridgingCmds
- {
- ipmiCmdGetMessage = 0x33,
- ipmiCmdSendMessage = 0x34,
- };
+ void insertMessageInQueue(IpmbResponse msg);
+
+ IpmbResponse getMessageFromQueue();
+
+ void eraseMessageFromQueue();
private:
std::vector<IpmbResponse> responseQueue;
-
- ipmi_return_codes handleIpmbChannel(sSendMessageReq *sendMsgReq,
- ipmi_response_t response,
- ipmi_data_len_t dataLen);
};