Index: vboot_firmware/include/rollback_index.h |
diff --git a/vboot_firmware/include/rollback_index.h b/vboot_firmware/include/rollback_index.h |
index c5c650e6bb5e9e46d743409497a64feb1c26ec75..6482869970bc145aa3aa88abd6d537fc7e4e086d 100644 |
--- a/vboot_firmware/include/rollback_index.h |
+++ b/vboot_firmware/include/rollback_index.h |
@@ -20,12 +20,18 @@ extern uint16_t g_kernel_version; |
#define FIRMWARE_VERSIONS 0 |
#define KERNEL_VERSIONS 1 |
+/* Initialization mode */ |
+#define RO_RECOVERY_MODE 0 |
+#define RO_NORMAL_MODE 1 |
+#define RW_NORMAL_MODE 2 |
+ |
/* TPM NVRAM location indices. */ |
#define FIRMWARE_VERSIONS_NV_INDEX 0x1001 |
#define KERNEL_VERSIONS_NV_INDEX 0x1002 |
#define TPM_IS_INITIALIZED_NV_INDEX 0x1003 |
#define KERNEL_VERSIONS_BACKUP_NV_INDEX 0x1004 |
#define KERNEL_MUST_USE_BACKUP_NV_INDEX 0x1005 |
+#define DEVELOPER_MODE_NV_INDEX 0x1006 |
/* Unique ID to detect kernel space redefinition */ |
#define KERNEL_SPACE_UID "GRWL" /* unique ID with secret meaning */ |
@@ -33,8 +39,20 @@ extern uint16_t g_kernel_version; |
#define KERNEL_SPACE_INIT_DATA ((uint8_t*) "\0\0\0\0" KERNEL_SPACE_UID) |
#define KERNEL_SPACE_SIZE (sizeof(uint32_t) + KERNEL_SPACE_UID_SIZE) |
-/* All functions return 0 if successful, non-zero if error */ |
-uint32_t SetupTPM(void); |
+/* All functions return TPM_SUCCESS (zero) if successful, non-zero if error */ |
+ |
+/* SetupTPM is called on boot and on starting the RW firmware, passing the |
+ * appripriate MODE and DEVELOPER_FLAG parameters. If it returns TPM_SUCCESS, |
+ * the caller may proceed. If it returns TPM_E_MUST_REBOOT, the caller must |
+ * reboot in normal mode. For all other return values, the caller must reboot |
+ * in recovery mode. |
+ * |
+ * This function has many side effects on the TPM state. In particular, when |
+ * called with mode = RECOVERY_MODE it locks the firmware versions before |
+ * returning. In all other cases, the caller is responsible for locking the |
+ * firmware versions once it decides it doesn't need to update them. |
+ */ |
+uint32_t SetupTPM(int mode, int developer_flag); |
gauravsh
2010/06/14 10:57:53
comment about what the mode parameter, what does i
|
uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version); |
uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version); |
uint32_t LockFirmwareVersions(void); |