feat(measured_boot): image hash measurement and recording in BL1

It looks safer and cleaner approach to record the measurement taken by
BL1 straightaway in TCG Event Log instead of deferring these recordings
to BL2.
Hence pull in the full-fledged measured boot driver into BL1 that
replaces the former ad-hoc platform interfaces i.e.
bl1_plat_set_bl2_hash, bl2_plat_get_hash.

As a result of this change the BL1 of Arm FVP platform now do the
measurements and recordings of below images:
1. FW_CONFIG
2. TB_FW_CONFIG
3. BL2

Change-Id: I798c20336308b5e91b547da4f8ed57c24d490731
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
diff --git a/include/drivers/measured_boot/event_log/event_log.h b/include/drivers/measured_boot/event_log/event_log.h
index 9aa6dc7..0d22d87 100644
--- a/include/drivers/measured_boot/event_log/event_log.h
+++ b/include/drivers/measured_boot/event_log/event_log.h
@@ -48,12 +48,14 @@
 #define	BL32_EXTRA1_IMAGE_STRING	"BL32_EXTRA1_IMAGE"
 #define	BL32_EXTRA2_IMAGE_STRING	"BL32_EXTRA2_IMAGE"
 #define BL33_STRING			"BL_33"
+#define FW_CONFIG_STRING                "FW_CONFIG"
 #define GPT_IMAGE_STRING		"GPT"
 #define HW_CONFIG_STRING		"HW_CONFIG"
 #define NT_FW_CONFIG_STRING		"NT_FW_CONFIG"
 #define SCP_BL2_IMAGE_STRING		"SCP_BL2_IMAGE"
 #define SOC_FW_CONFIG_STRING		"SOC_FW_CONFIG"
 #define STM32_IMAGE_STRING		"STM32"
+#define TB_FW_CONFIG_STRING             "TB_FW_CONFIG"
 #define	TOS_FW_CONFIG_STRING		"TOS_FW_CONFIG"
 
 typedef struct {
diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h
index c7c4dcb..3fa63f5 100644
--- a/include/plat/common/platform.h
+++ b/include/plat/common/platform.h
@@ -122,6 +122,16 @@
 void bl2_plat_preload_setup(void);
 int plat_try_next_boot_source(void);
 
+#if MEASURED_BOOT
+int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data);
+#else
+static inline int plat_mboot_measure_image(unsigned int image_id __unused,
+					   image_info_t *image_data __unused)
+{
+	return 0;
+}
+#endif /* MEASURED_BOOT */
+
 /*******************************************************************************
  * Mandatory BL1 functions
  ******************************************************************************/
@@ -181,6 +191,18 @@
 int bl1_plat_handle_pre_image_load(unsigned int image_id);
 int bl1_plat_handle_post_image_load(unsigned int image_id);
 
+#if MEASURED_BOOT
+void bl1_plat_mboot_init(void);
+void bl1_plat_mboot_finish(void);
+#else
+static inline void bl1_plat_mboot_init(void)
+{
+}
+static inline void bl1_plat_mboot_finish(void)
+{
+}
+#endif /* MEASURED_BOOT */
+
 /*******************************************************************************
  * Mandatory BL2 functions
  ******************************************************************************/
@@ -202,17 +224,12 @@
 #if MEASURED_BOOT
 void bl2_plat_mboot_init(void);
 void bl2_plat_mboot_finish(void);
-int plat_mboot_measure_image(unsigned int image_id);
 #else
 static inline void bl2_plat_mboot_init(void)
 {
 }
 static inline void bl2_plat_mboot_finish(void)
 {
-}
-static inline int plat_mboot_measure_image(unsigned int image_id __unused)
-{
-	return 0;
 }
 #endif /* MEASURED_BOOT */