summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-04-03 02:03:41 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-04-25 14:14:44 -0500
commite1ae56c20cce0d75e1065c44070f90bdc6a8061e (patch)
tree384099e2044e9f3e4d65a95506fb757a83aa6701
parente2f0a8ef607eb2863cc1c032757c9c369cfe916e (diff)
downloadphosphor-net-ipmid-e1ae56c20cce0d75e1065c44070f90bdc6a8061e.tar.gz
phosphor-net-ipmid-e1ae56c20cce0d75e1065c44070f90bdc6a8061e.zip
Add command handler for Payload activation status command.
Change-Id: I12d9f5ff759042295654daef638fd30153f44ce0 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
-rw-r--r--command/payload_cmds.cpp26
-rw-r--r--command/payload_cmds.hpp78
2 files changed, 103 insertions, 1 deletions
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index 31ab3a7..9602c54 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -141,7 +141,31 @@ std::vector<uint8_t> deactivatePayload(std::vector<uint8_t>& inPayload,
return outPayload;
}
+std::vector<uint8_t> getPayloadStatus(std::vector<uint8_t>& inPayload,
+ const message::Handler& handler)
+{
+ std::vector<uint8_t> outPayload(sizeof(GetPayloadStatusResponse));
+ auto request = reinterpret_cast<GetPayloadStatusRequest*>(inPayload.data());
+ auto response = reinterpret_cast<GetPayloadStatusResponse*>
+ (outPayload.data());
+
+ // SOL is the payload currently supported for payload status
+ if (static_cast<uint8_t>(message::PayloadType::SOL) != request->payloadType)
+ {
+ response->completionCode = IPMI_CC_UNSPECIFIED_ERROR;
+ return outPayload;
+ }
+
+ response->completionCode = IPMI_CC_OK;
+ response->capacity = MAX_PAYLOAD_INSTANCES;
+
+ // Currently we support only one SOL session
+ response->instance1 =
+ std::get<sol::Manager&>(singletonPool).isPayloadActive(1);
+
+ return outPayload;
+}
+
} // namespace command
} // namespace sol
-
diff --git a/command/payload_cmds.hpp b/command/payload_cmds.hpp
index 47b0ad1..54b3f10 100644
--- a/command/payload_cmds.hpp
+++ b/command/payload_cmds.hpp
@@ -173,6 +173,84 @@ struct DeactivatePayloadResponse
std::vector<uint8_t> deactivatePayload(std::vector<uint8_t>& inPayload,
const message::Handler& handler);
+/** @struct GetPayloadStatusRequest
+ *
+ * IPMI payload for Get Payload Activation Status command request.
+ */
+struct GetPayloadStatusRequest
+{
+ uint8_t payloadType; //!< Payload type
+} __attribute__((packed));
+
+/** @struct GetPayloadStatusResponse
+ *
+ * IPMI payload for Get Payload Activation Status command response.
+ */
+struct GetPayloadStatusResponse
+{
+ uint8_t completionCode; //!< Completion code.
+
+ uint8_t capacity; //!< Instance capacity.
+
+ /* @brief Activation Status. */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
+ uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
+ uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
+ uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
+ uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
+ uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
+ uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
+ uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+ uint8_t instance8 : 1; //!< If true, Instance 8 is activated.
+ uint8_t instance7 : 1; //!< If true, Instance 7 is activated.
+ uint8_t instance6 : 1; //!< If true, Instance 6 is activated.
+ uint8_t instance5 : 1; //!< If true, Instance 5 is activated.
+ uint8_t instance4 : 1; //!< If true, Instance 4 is activated.
+ uint8_t instance3 : 1; //!< If true, Instance 3 is activated.
+ uint8_t instance2 : 1; //!< If true, Instance 2 is activated.
+ uint8_t instance1 : 1; //!< If true, Instance 1 is activated.
+#endif
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+ uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
+ uint8_t instance10 : 1; //!< If true, Instance 10 is activated.
+ uint8_t instance11 : 1; //!< If true, Instance 11 is activated.
+ uint8_t instance12 : 1; //!< If true, Instance 12 is activated.
+ uint8_t instance13 : 1; //!< If true, Instance 13 is activated.
+ uint8_t instance14 : 1; //!< If true, Instance 14 is activated.
+ uint8_t instance15 : 1; //!< If true, Instance 15 is activated.
+ uint8_t instance16 : 1; //!< If true, Instance 16 is activated.
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+ uint8_t instance16 : 1; //!< If true, Instance 16 is activated.
+ uint8_t instance15 : 1; //!< If true, Instance 15 is activated.
+ uint8_t instance14 : 1; //!< If true, Instance 14 is activated.
+ uint8_t instance13 : 1; //!< If true, Instance 13 is activated.
+ uint8_t instance12 : 1; //!< If true, Instance 12 is activated.
+ uint8_t instance11 : 1; //!< If true, Instance 11 is activated.
+ uint8_t instance10 : 1; //!< If true, Instance 10 is activated.
+ uint8_t instance9 : 1; //!< If true, Instance 9 is activated.
+#endif
+} __attribute__((packed));
+
+/** @brief Get Payload Activation Status Command.
+ *
+ * This command returns how many instances of a given payload type are
+ * presently activated, and how many total instances can be activated.
+ *
+ * @param[in] inPayload - Request Data for the command.
+ * @param[in] handler - Reference to the Message Handler.
+ *
+ * @return Response data for the command
+ */
+std::vector<uint8_t> getPayloadStatus(std::vector<uint8_t>& inPayload,
+ const message::Handler& handler);
+
} // namespace command
} // namespace sol
OpenPOWER on IntegriCloud