1 /* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  *
5  * Recovery reasons
6  */
7 
8 #ifndef VBOOT_REFERENCE_VBOOT_2RECOVERY_REASONS_H_
9 #define VBOOT_REFERENCE_VBOOT_2RECOVERY_REASONS_H_
10 
11 /* Recovery reason codes */
12 enum vb2_nv_recovery {
13 	/* Recovery not requested. */
14 	VB2_RECOVERY_NOT_REQUESTED = 0x00,
15 
16 	/*
17 	 * Recovery requested from legacy utility.  (Prior to the NV storage
18 	 * spec, recovery mode was a single bitfield; this value is reserved so
19 	 * that scripts which wrote 1 to the recovery field are distinguishable
20 	 * from scripts whch use the recovery reasons listed here.
21 	 */
22 	VB2_RECOVERY_LEGACY = 0x01,
23 
24 	/* User manually requested recovery via recovery button */
25 	VB2_RECOVERY_RO_MANUAL = 0x02,
26 
27 	/*
28 	 * RW firmware failed signature check (neither RW firmware slot was
29 	 * valid)
30 	 */
31 	VB2_RECOVERY_RO_INVALID_RW = 0x03,
32 
33 	/* S3 resume failed */
34 	VB2_RECOVERY_RO_S3_RESUME = 0x04,
35 
36 	/* TPM error in read-only firmware (deprecated) */
37 	VB2_RECOVERY_DEP_RO_TPM_ERROR = 0x05,
38 
39 	/* Shared data error in read-only firmware */
40 	VB2_RECOVERY_RO_SHARED_DATA = 0x06,
41 
42 	/* Test error from S3Resume() */
43 	VB2_RECOVERY_RO_TEST_S3 = 0x07,
44 
45 	/* Test error from LoadFirmwareSetup() (deprecated) */
46 	VB2_RECOVERY_RO_TEST_LFS = 0x08,
47 
48 	/* Test error from LoadFirmware() (deprecated) */
49 	VB2_RECOVERY_RO_TEST_LF = 0x09,
50 
51 	/* Latest tried RW firmware keyblock verification failed */
52 	VB2_RECOVERY_FW_KEYBLOCK = 0x13,
53 
54 	/* Latest tried RW firmware key version too old */
55 	VB2_RECOVERY_FW_KEY_ROLLBACK = 0x14,
56 
57 	/* Latest tried RW firmware preamble verification failed */
58 	VB2_RECOVERY_FW_PREAMBLE = 0x16,
59 
60 	/* Latest tried RW firmware version too old */
61 	VB2_RECOVERY_FW_ROLLBACK = 0x17,
62 
63 	/* Latest tried RW firmware body verification failed */
64 	VB2_RECOVERY_FW_BODY = 0x1b,
65 
66 	/*
67 	 * Firmware boot failure outside of verified boot (RAM init, missing
68 	 * SSD, etc.).
69 	 */
70 	VB2_RECOVERY_RO_FIRMWARE = 0x20,
71 
72 	/*
73 	 * Recovery mode TPM initialization requires a system reboot.  The
74 	 * system was already in recovery mode for some other reason when this
75 	 * happened.
76 	 */
77 	VB2_RECOVERY_RO_TPM_REBOOT = 0x21,
78 
79 	/* EC software sync - other error */
80 	VB2_RECOVERY_EC_SOFTWARE_SYNC = 0x22,
81 
82 	/* EC software sync - unable to determine active EC image */
83 	VB2_RECOVERY_EC_UNKNOWN_IMAGE = 0x23,
84 
85 	/* EC software sync - error obtaining EC image hash (deprecated) */
86 	VB2_RECOVERY_DEP_EC_HASH = 0x24,
87 
88 	/* EC software sync - error obtaining expected EC image */
89 	VB2_RECOVERY_EC_EXPECTED_IMAGE = 0x25,
90 
91 	/* EC software sync - error updating EC */
92 	VB2_RECOVERY_EC_UPDATE = 0x26,
93 
94 	/* EC software sync - unable to jump to EC-RW */
95 	VB2_RECOVERY_EC_JUMP_RW = 0x27,
96 
97 	/* EC software sync - unable to protect / unprotect EC-RW */
98 	VB2_RECOVERY_EC_PROTECT = 0x28,
99 
100 	/* EC software sync - error obtaining expected EC hash */
101 	VB2_RECOVERY_EC_EXPECTED_HASH = 0x29,
102 
103 	/* EC software sync - expected EC image doesn't match hash */
104 	VB2_RECOVERY_EC_HASH_MISMATCH = 0x2a,
105 
106 	/* New error codes from VB2 */
107 	// TODO: may need to add strings for these in the original fwlib
108 
109 	/* Secure data inititalization error */
110 	VB2_RECOVERY_SECDATA_INIT = 0x2b,
111 
112 	/* GBB header is bad */
113 	VB2_RECOVERY_GBB_HEADER = 0x2c,
114 
115 	/* Unable to clear TPM owner */
116 	VB2_RECOVERY_TPM_CLEAR_OWNER = 0x2d,
117 
118 	/* Error determining/updating virtual dev switch */
119 	VB2_RECOVERY_DEV_SWITCH = 0x2e,
120 
121 	/* Error determining firmware slot */
122 	VB2_RECOVERY_FW_SLOT = 0x2f,
123 
124 	/* Unspecified/unknown error in read-only firmware */
125 	VB2_RECOVERY_RO_UNSPECIFIED = 0x3f,
126 
127 	/*
128 	 * User manually requested recovery by pressing a key at developer
129 	 * warning screen
130 	 */
131 	VB2_RECOVERY_RW_DEV_SCREEN = 0x41,
132 
133 	/* No OS kernel detected */
134 	VB2_RECOVERY_RW_NO_OS = 0x42,
135 
136 	/* OS kernel failed signature check */
137 	VB2_RECOVERY_RW_INVALID_OS = 0x43,
138 
139 	/* TPM error in rewritable firmware (deprecated) */
140 	VB2_RECOVERY_DEP_RW_TPM_ERROR = 0x44,
141 
142 	/* RW firmware in dev mode, but dev switch is off */
143 	VB2_RECOVERY_RW_DEV_MISMATCH = 0x45,
144 
145 	/* Shared data error in rewritable firmware */
146 	VB2_RECOVERY_RW_SHARED_DATA = 0x46,
147 
148 	/* Test error from LoadKernel() */
149 	VB2_RECOVERY_RW_TEST_LK = 0x47,
150 
151 	/* No bootable disk found (deprecated)*/
152 	VB2_RECOVERY_DEP_RW_NO_DISK = 0x48,
153 
154 	/* Rebooting did not correct TPM_E_FAIL or TPM_E_FAILEDSELFTEST  */
155 	VB2_RECOVERY_TPM_E_FAIL = 0x49,
156 
157 	/* TPM setup error in read-only firmware */
158 	VB2_RECOVERY_RO_TPM_S_ERROR = 0x50,
159 
160 	/* TPM write error in read-only firmware */
161 	VB2_RECOVERY_RO_TPM_W_ERROR = 0x51,
162 
163 	/* TPM lock error in read-only firmware */
164 	VB2_RECOVERY_RO_TPM_L_ERROR = 0x52,
165 
166 	/* TPM update error in read-only firmware */
167 	VB2_RECOVERY_RO_TPM_U_ERROR = 0x53,
168 
169 	/* TPM read error in rewritable firmware */
170 	VB2_RECOVERY_RW_TPM_R_ERROR = 0x54,
171 
172 	/* TPM write error in rewritable firmware */
173 	VB2_RECOVERY_RW_TPM_W_ERROR = 0x55,
174 
175 	/* TPM lock error in rewritable firmware */
176 	VB2_RECOVERY_RW_TPM_L_ERROR = 0x56,
177 
178 	/* EC software sync unable to get EC image hash */
179 	VB2_RECOVERY_EC_HASH_FAILED = 0x57,
180 
181 	/* EC software sync invalid image hash size */
182 	VB2_RECOVERY_EC_HASH_SIZE    = 0x58,
183 
184 	/* Unspecified error while trying to load kernel */
185 	VB2_RECOVERY_LK_UNSPECIFIED  = 0x59,
186 
187 	/* No bootable storage device in system */
188 	VB2_RECOVERY_RW_NO_DISK      = 0x5a,
189 
190 	/* No bootable kernel found on disk */
191 	VB2_RECOVERY_RW_NO_KERNEL    = 0x5b,
192 
193 	/* Unspecified/unknown error in rewritable firmware */
194 	VB2_RECOVERY_RW_UNSPECIFIED  = 0x7f,
195 
196 	/* DM-verity error */
197 	VB2_RECOVERY_KE_DM_VERITY    = 0x81,
198 
199 	/* Unspecified/unknown error in kernel */
200 	VB2_RECOVERY_KE_UNSPECIFIED  = 0xbf,
201 
202 	/* Recovery mode test from user-mode */
203 	VB2_RECOVERY_US_TEST         = 0xc1,
204 
205 	/* Unspecified/unknown error in user-mode */
206 	VB2_RECOVERY_US_UNSPECIFIED  = 0xff,
207 };
208 
209 #endif  /* VBOOT_REFERENCE_VBOOT_2RECOVERY_REASONS_H_ */
210