PDR: implement generation framework

This commit implements a framework that allows describing
platform/system specific PDR information in JSON files, which the PLDM
responder library parses and builds a PDR out of.

Separate JSON files are expected per PDR type. This commit also adds the
code to build a state effecter PDR. PDR record handles are implemented
as incrementing indices, starting at 1, but this commit enables
implementing other type of record handles (for eg offset based).

This commit doesn't handle merging of PDRs received from other terminii,
so the PDR that's generated now is for the BMC. Merging of PDRs will be
implemented in future commits.

Change-Id: I005b08c5d29d12fc2459ca8d6e18547107a3da7d
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/libpldm/platform.h b/libpldm/platform.h
index 790f1f5..7d25eb3 100644
--- a/libpldm/platform.h
+++ b/libpldm/platform.h
@@ -23,6 +23,61 @@
 	PLDM_SET_STATE_EFFECTER_STATES = 0x39,
 };
 
+/** @brief PLDM PDR types
+ */
+enum pldm_pdr_types {
+	PLDM_STATE_EFFECTER_PDR = 11,
+};
+
+/** @brief PLDM effecter initialization schemes
+ */
+enum pldm_effecter_init {
+	PLDM_NO_INIT,
+	PLDM_USE_INIT_PDR,
+	PLDM_ENABLE_EFFECTER,
+	PLDM_DISABLE_EFECTER
+};
+
+/** @struct pldm_pdr_hdr
+ *
+ *  Structure representing PLDM common PDR header
+ */
+struct pldm_pdr_hdr {
+	uint32_t record_handle;
+	uint8_t version;
+	uint8_t type;
+	uint16_t record_change_num;
+	uint16_t length;
+} __attribute__((packed));
+
+/** @struct pldm_state_effecter_pdr
+ *
+ *  Structure representing PLDM state effecter PDR
+ */
+struct pldm_state_effecter_pdr {
+	struct pldm_pdr_hdr hdr;
+	uint16_t terminus_handle;
+	uint16_t effecter_id;
+	uint16_t entity_type;
+	uint16_t entity_instance;
+	uint16_t container_id;
+	uint16_t effecter_semantic_id;
+	uint8_t effecter_init;
+	bool8_t has_description_pdr;
+	uint8_t composite_effecter_count;
+	uint8_t possible_states[1];
+} __attribute__((packed));
+
+/** @struct state_effecter_possible_states
+ *
+ *  Structure representing state enums for state effecter
+ */
+struct state_effecter_possible_states {
+	uint16_t state_set_id;
+	uint8_t possible_states_size;
+	bitfield8_t states[1];
+} __attribute__((packed));
+
 /** @struct set_effecter_state_field
  *
  *  Structure representing a stateField in SetStateEffecterStates command */