xref: /aosp_15_r20/external/vboot_reference/firmware/include/tss_constants.h (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1 /* Copyright 2013 The ChromiumOS Authors
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef VBOOT_REFERENCE_TSS_CONSTANTS_H_
7 #define VBOOT_REFERENCE_TSS_CONSTANTS_H_
8 
9 #include <stdint.h>
10 
11 #define TPM_SUCCESS ((uint32_t) 0x00000000)
12 
13 #define TPM_E_ALREADY_INITIALIZED    ((uint32_t) 0x00005000)  /* vboot local */
14 #define TPM_E_INTERNAL_INCONSISTENCY ((uint32_t) 0x00005001)  /* vboot local */
15 #define TPM_E_MUST_REBOOT            ((uint32_t) 0x00005002)  /* vboot local */
16 #define TPM_E_CORRUPTED_STATE        ((uint32_t) 0x00005003)  /* vboot local */
17 #define TPM_E_COMMUNICATION_ERROR    ((uint32_t) 0x00005004)  /* vboot local */
18 #define TPM_E_RESPONSE_TOO_LARGE     ((uint32_t) 0x00005005)  /* vboot local */
19 #define TPM_E_NO_DEVICE              ((uint32_t) 0x00005006)  /* vboot local */
20 #define TPM_E_INPUT_TOO_SMALL        ((uint32_t) 0x00005007)  /* vboot local */
21 #define TPM_E_WRITE_FAILURE          ((uint32_t) 0x00005008)  /* vboot local */
22 #define TPM_E_READ_EMPTY             ((uint32_t) 0x00005009)  /* vboot local */
23 #define TPM_E_READ_FAILURE           ((uint32_t) 0x0000500a)  /* vboot local */
24 #define TPM_E_STRUCT_SIZE            ((uint32_t) 0x0000500b)  /* vboot local */
25 #define TPM_E_STRUCT_VERSION         ((uint32_t) 0x0000500c)  /* vboot local */
26 #define TPM_E_INTERNAL_ERROR         ((uint32_t) 0x0000500d)  /* vboot local */
27 #define TPM_E_INVALID_RESPONSE       ((uint32_t) 0x0000500e)  /* vboot local */
28 #define TPM_E_BUFFER_SIZE            ((uint32_t) 0x0000500f)  /* vboot local */
29 #define TPM_E_NO_SUCH_COMMAND        ((uint32_t) 0x00005010)  /* vboot local */
30 
31 
32 /*
33  * AP firmware relies on Tlcl returning these exact TPM1.2 error codes
34  * regardless of the TPM spec version in certain sitautions. So, TPM2.0 should
35  * map to these errors when necessary. All TPM2.0-spec-defined errors have
36  * either 0x100 or 0x80 bit set, so there is no confusion with actual error
37  * codes returned from a TPM2.0 chip.
38  */
39 #define TPM_E_AUTHFAIL              ((uint32_t) 0x00000001)
40 #define TPM_E_BADINDEX              ((uint32_t) 0x00000002)
41 #define TPM_E_BAD_ORDINAL           ((uint32_t) 0x0000000a)
42 #define TPM_E_OWNER_SET             ((uint32_t) 0x00000014)
43 #define TPM_E_BADTAG                ((uint32_t) 0x0000001e)
44 #define TPM_E_IOERROR               ((uint32_t) 0x0000001f)
45 #define TPM_E_INVALID_POSTINIT      ((uint32_t) 0x00000026)
46 #define TPM_E_BAD_PRESENCE          ((uint32_t) 0x0000002d)
47 #define TPM_E_AREA_LOCKED           ((uint32_t) 0x0000003c)
48 #define TPM_E_MAXNVWRITES           ((uint32_t) 0x00000048)
49 
50 #define TPM_E_NON_FATAL 0x800
51 #define TPM_E_NEEDS_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 1))
52 #define TPM_E_DOING_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 2))
53 
54 #ifdef TPM2_MODE
55 #include "tpm2_tss_constants.h"
56 #else
57 #include "tpm1_tss_constants.h"
58 #endif
59 
60 #endif  /* VBOOT_REFERENCE_TSS_CONSTANTS_H_ */
61