boot_verifier: Implement updated verified boot spec

Update the verified boot flow to send device state, boot state, unlocked
flag, hash of public key, system version, system security level to trust zone,
add support to pass eio mode for dm-verity and update the display messages for
all the states.

Change-Id: Idc29c1c2686c431158caf69d9669352df9d6b4cd
diff --git a/include/km_main.h b/include/km_main.h
index fa606ad..946683e 100644
--- a/include/km_main.h
+++ b/include/km_main.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -31,6 +31,7 @@
 #define KM_MAIN_H
 
 #include <sys/types.h>
+#include <boot_verifier.h>
 /**
  * Commands supported
  */
@@ -62,7 +63,9 @@
     KEYMASTER_UPDATE						= (KEYMASTER_CMD_ID + 17UL),
     KEYMASTER_FINISH						= (KEYMASTER_CMD_ID + 18UL),
     KEYMASTER_ABORT							= (KEYMASTER_CMD_ID + 19UL),
+    KEYMASTER_SET_BOOT_STATE                = (KEYMASTER_UTILS_CMD_ID + 8UL),
 
+    KEYMASTER_GET_VERSION                   = (KEYMASTER_UTILS_CMD_ID + 0UL),
     KEYMASTER_SET_ROT						= (KEYMASTER_UTILS_CMD_ID + 1UL),
     KEYMASTER_READ_LK_DEVICE_STATE			= (KEYMASTER_UTILS_CMD_ID + 2UL),
     KEYMASTER_WRITE_LK_DEVICE_STATE			= (KEYMASTER_UTILS_CMD_ID + 3UL),
@@ -205,4 +208,59 @@
 	uint32 swp_read_data_len;
 }__attribute__((packed)) secure_write_prot_rsp_t;
 
+/*
+ *  * Structures for get_version
+ *   */
+typedef struct _km_get_version_req_t
+{
+	uint32_t cmd_id;
+}__attribute__((packed)) km_get_version_req_t;
+
+typedef struct _km_get_version_rsp_t
+{
+	int status;
+	uint32_t major_version;
+	uint32_t minor_version;
+	uint32_t ta_major_version;
+	uint32_t ta_minor_version;
+}__attribute__((packed)) km_get_version_rsp_t;
+
+typedef struct _km_boot_state_t
+{
+	bool                   is_unlocked;
+	uint8_t                public_key[32];
+	uint32_t               color;
+	uint32_t               system_version;
+	uint32_t               system_security_level;
+}__attribute__((packed))  km_boot_state_t;
+
+/**
+ *  @brief
+ *  Data structure
+ *  @param[in]   cmd_id             Requested command
+ *  @param[in]   boot_state_ofset   Offset from the top of the struct.
+ *  @param[in]   boot_state_size    Size of the Boot state
+ *
+ *  The offset contains the following
+ *  km_boot_state_t
+ **/
+typedef struct _km_set_boot_state_req_t
+{
+	uint32_t        cmd_id;
+	uint32_t        version;
+	uint32_t        boot_state_offset;
+	uint32_t        boot_state_size;
+}__attribute__((packed)) km_set_boot_state_req_t;
+
+/**
+ *  @brief
+ *  Data structure
+ *
+ *  @param[out]   status      Status of the request
+ **/
+typedef struct _km_set_boot_state_rsp_t
+{
+	int status;
+}__attribute__((packed)) km_set_boot_state_rsp_t;
+
 #endif /* KM_MAIN_H */