pldm_events: Parse state sensor PDRs from the Host PDR

Parse the State Sensor PDRs from the host firmware and build
the HostStateSensorMap data structure which will be used to
lookup the sensor info for the sensorEventType in the
PlatformEventMessage command. Also clear the HostStateSensorMap
when the host powers off.

Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Change-Id: Id85a73f1a0a1caf4b4155a8d235b3e807383e53a
diff --git a/libpldm/platform.h b/libpldm/platform.h
index cafd47c..f2ee670 100644
--- a/libpldm/platform.h
+++ b/libpldm/platform.h
@@ -129,6 +129,7 @@
 /** @brief PLDM PDR types
  */
 enum pldm_pdr_types {
+	PLDM_STATE_SENSOR_PDR = 4,
 	PLDM_NUMERIC_EFFECTER_PDR = 9,
 	PLDM_STATE_EFFECTER_PDR = 11,
 	PLDM_PDR_ENTITY_ASSOCIATION = 15,
@@ -268,6 +269,33 @@
 	uint16_t container_id;
 } __attribute__((packed));
 
+/** @struct pldm_state_sensor_pdr
+ *
+ *  Structure representing PLDM state sensor PDR
+ */
+struct pldm_state_sensor_pdr {
+	struct pldm_pdr_hdr hdr;
+	uint16_t terminus_handle;
+	uint16_t sensor_id;
+	uint16_t entity_type;
+	uint16_t entity_instance;
+	uint16_t container_id;
+	uint8_t sensor_init;
+	bool8_t sensor_auxiliary_names_pdr;
+	uint8_t composite_sensor_count;
+	uint8_t possible_states[1];
+} __attribute__((packed));
+
+/** @struct state_sensor_possible_states
+ *
+ *  Structure representing state enums for state sensor
+ */
+struct state_sensor_possible_states {
+	uint16_t state_set_id;
+	uint8_t possible_states_size;
+	bitfield8_t states[1];
+} __attribute__((packed));
+
 /** @struct pldm_state_effecter_pdr
  *
  *  Structure representing PLDM state effecter PDR