oem/libpldm: Implement requester flow for GetAlertStatus

For the requester, need to encode reqeuest data and send responder,
waiting for recive responder data to decode, so need to implement
encode/decode(Requester flow only) for GetAlertStatus.

The GetAlertStatus is a custom oem command to report enclosure ids of
system, alert status and flags, and config ID.

Request Data:
 Type - Request Data
  uint8 - Version of the command/response format. 0x0 for this format.

Response Data:
 Type - Response Data
  enum8 - completionCode.value{PLDM_BASE_CODES, UNSUPPORTED_FORMAT_VERSION=0x81}
  uint32 - Enclosure ID, AlertStatus, Flags, Config ID.(rack entry)
  uint32 - Enclosure ID, AlertStatus, Flags, Config ID.(pri cec node)

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I0a3d1d8f79fe80194a0b2208bce090783ad74f0b
diff --git a/oem/ibm/libpldm/host.h b/oem/ibm/libpldm/host.h
new file mode 100644
index 0000000..700c3e6
--- /dev/null
+++ b/oem/ibm/libpldm/host.h
@@ -0,0 +1,78 @@
+#ifndef OEM_IBM_HOST_H
+#define OEM_IBM_HOST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "base.h"
+
+/* Maximum size for request */
+#define PLDM_GET_ALERT_STATUS_REQ_BYTES 1
+
+/* Response lengths are inclusive of completion code */
+#define PLDM_GET_ALERT_STATUS_RESP_BYTES 9
+
+enum pldm_host_commands {
+	PLDM_HOST_GET_ALERT_STATUS = 0xF0 // Custom oem cmd
+};
+
+/** @brief PLDM Command specific codes
+ */
+enum pldm_host_completion_codes { PLDM_HOST_UNSUPPORTED_FORMAT_VERSION = 0x81 };
+
+/** @struct pldm_get_alert_states_resp
+ *
+ * Structure representing GetAlertStatus response packet
+ */
+struct pldm_get_alert_status_resp {
+	uint8_t completion_code;
+	uint32_t rack_entry;
+	uint32_t pri_cec_node;
+} __attribute__((packed));
+
+/* Requester */
+
+/* GetAlertStatus */
+
+/** @brief Create a PLDM request message for GetAlertStatus
+ *
+ *  @param[in] instance_id - Message's instance id
+ *  @param[in] version_id - The command/response format. 0x00 for this format
+ *  @param[out] msg - Message will be written to this
+ *  @param[in] payload_length - Length of request message payload
+ *  @return pldm_completion_codes
+ *  @note  Caller is responsible for memory alloc and dealloc of param
+ *         'msg.payload'
+ */
+int encode_get_alert_status_req(uint8_t instance_id, uint8_t version_id,
+				struct pldm_msg *msg, size_t payload_length);
+
+/** @brief Decode GetAlertStatus response data
+ *
+ *  Note:
+ *  * If the return value is not PLDM_SUCCESS, it represents a
+ * transport layer error.
+ *  * If the completion_code value is not PLDM_SUCCESS, it represents a
+ * protocol layer error and all the out-parameters are invalid.
+ *
+ *  @param[in] msg - Request message
+ *  @param[in] payload_length - Length of request message payload
+ *  @param[out] completion_code - PLDM completion code
+ *  @param[out] rack_entry - Enclosure ID, Alert Status, Flags, Config ID
+ *  @param[out] pri_cec_node - Enclosure ID, Alert Status, Flags, Config ID
+ *  @return pldm_completion_codes
+ */
+int decode_get_alert_status_resp(const struct pldm_msg *msg,
+				 size_t payload_length,
+				 uint8_t *completion_code, uint32_t *rack_entry,
+				 uint32_t *pri_cec_node);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OEM_IBM_HOST_H */