Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: vboot_firmware/include/rollback_index.h

Issue 2792009: Fix normal/recovery mode, and RO firmware vs. RW firmware behavior. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: add a comment Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Functions for querying, manipulating and locking rollback indices 5 * Functions for querying, manipulating and locking rollback indices
6 * stored in the TPM NVRAM. 6 * stored in the TPM NVRAM.
7 */ 7 */
8 8
9 #ifndef VBOOT_REFERENCE_ROLLBACK_INDEX_H_ 9 #ifndef VBOOT_REFERENCE_ROLLBACK_INDEX_H_
10 #define VBOOT_REFERENCE_ROLLBACK_INDEX_H_ 10 #define VBOOT_REFERENCE_ROLLBACK_INDEX_H_
11 11
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 extern uint16_t g_firmware_key_version; 14 extern uint16_t g_firmware_key_version;
15 extern uint16_t g_firmware_version; 15 extern uint16_t g_firmware_version;
16 extern uint16_t g_kernel_key_version; 16 extern uint16_t g_kernel_key_version;
17 extern uint16_t g_kernel_version; 17 extern uint16_t g_kernel_version;
18 18
19 /* Rollback version types. */ 19 /* Rollback version types. */
20 #define FIRMWARE_VERSIONS 0 20 #define FIRMWARE_VERSIONS 0
21 #define KERNEL_VERSIONS 1 21 #define KERNEL_VERSIONS 1
22 22
23 /* Initialization mode */
24 #define RO_RECOVERY_MODE 0
25 #define RO_NORMAL_MODE 1
26 #define RW_NORMAL_MODE 2
27
23 /* TPM NVRAM location indices. */ 28 /* TPM NVRAM location indices. */
24 #define FIRMWARE_VERSIONS_NV_INDEX 0x1001 29 #define FIRMWARE_VERSIONS_NV_INDEX 0x1001
25 #define KERNEL_VERSIONS_NV_INDEX 0x1002 30 #define KERNEL_VERSIONS_NV_INDEX 0x1002
26 #define TPM_IS_INITIALIZED_NV_INDEX 0x1003 31 #define TPM_IS_INITIALIZED_NV_INDEX 0x1003
27 #define KERNEL_VERSIONS_BACKUP_NV_INDEX 0x1004 32 #define KERNEL_VERSIONS_BACKUP_NV_INDEX 0x1004
28 #define KERNEL_MUST_USE_BACKUP_NV_INDEX 0x1005 33 #define KERNEL_MUST_USE_BACKUP_NV_INDEX 0x1005
34 #define DEVELOPER_MODE_NV_INDEX 0x1006
29 35
30 /* Unique ID to detect kernel space redefinition */ 36 /* Unique ID to detect kernel space redefinition */
31 #define KERNEL_SPACE_UID "GRWL" /* unique ID with secret meaning */ 37 #define KERNEL_SPACE_UID "GRWL" /* unique ID with secret meaning */
32 #define KERNEL_SPACE_UID_SIZE (sizeof(KERNEL_SPACE_UID) - 1) 38 #define KERNEL_SPACE_UID_SIZE (sizeof(KERNEL_SPACE_UID) - 1)
33 #define KERNEL_SPACE_INIT_DATA ((uint8_t*) "\0\0\0\0" KERNEL_SPACE_UID) 39 #define KERNEL_SPACE_INIT_DATA ((uint8_t*) "\0\0\0\0" KERNEL_SPACE_UID)
34 #define KERNEL_SPACE_SIZE (sizeof(uint32_t) + KERNEL_SPACE_UID_SIZE) 40 #define KERNEL_SPACE_SIZE (sizeof(uint32_t) + KERNEL_SPACE_UID_SIZE)
35 41
36 /* All functions return 0 if successful, non-zero if error */ 42 /* All functions return TPM_SUCCESS (zero) if successful, non-zero if error */
37 uint32_t SetupTPM(void); 43
44 /* SetupTPM is called on boot and on starting the RW firmware, passing the
45 * appripriate MODE and DEVELOPER_FLAG parameters. If it returns TPM_SUCCESS,
46 * the caller may proceed. If it returns TPM_E_MUST_REBOOT, the caller must
47 * reboot in normal mode. For all other return values, the caller must reboot
48 * in recovery mode.
49 *
50 * This function has many side effects on the TPM state. In particular, when
51 * called with mode = RECOVERY_MODE it locks the firmware versions before
52 * returning. In all other cases, the caller is responsible for locking the
53 * firmware versions once it decides it doesn't need to update them.
54 */
55 uint32_t SetupTPM(int mode, int developer_flag);
gauravsh 2010/06/14 10:57:53 comment about what the mode parameter, what does i
38 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version); 56 uint32_t GetStoredVersions(int type, uint16_t* key_version, uint16_t* version);
39 uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version); 57 uint32_t WriteStoredVersions(int type, uint16_t key_version, uint16_t version);
40 uint32_t LockFirmwareVersions(void); 58 uint32_t LockFirmwareVersions(void);
41 uint32_t LockKernelVersionsByLockingPP(void); 59 uint32_t LockKernelVersionsByLockingPP(void);
42 60
43 #endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */ 61 #endif /* VBOOT_REFERENCE_ROLLBACK_INDEX_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698