Gaurav Shah | 887e3d4 | 2010-04-27 16:26:48 -0700 | [diff] [blame] | 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 |
| 3 | * found in the LICENSE file. |
| 4 | * |
| 5 | * Some TPM constants and type definitions for standalone compilation for use in |
| 6 | * the firmware |
| 7 | */ |
| 8 | |
| 9 | /* FIXME(gauravsh): |
| 10 | * NOTE: This file is copied over from |
| 11 | * src/platform/tpm_lite/src/tlcl/tss_constants.h |
| 12 | * Ideally, we want to directly include it without having two maintain |
| 13 | * duplicate copies in sync. But in the current model, this is hard |
| 14 | * to do without breaking standalone compilation. |
| 15 | * Eventually tpm_lite should be moved into vboot_reference. |
| 16 | */ |
| 17 | |
| 18 | #ifndef TPM_LITE_TSS_CONSTANTS_H_ |
| 19 | #define TPM_LITE_TSS_CONSTANTS_H_ |
| 20 | |
Randall Spangler | f302905 | 2010-06-16 13:42:58 -0700 | [diff] [blame] | 21 | #include "sysincludes.h" |
Gaurav Shah | 887e3d4 | 2010-04-27 16:26:48 -0700 | [diff] [blame] | 22 | |
| 23 | #define TPM_MAX_COMMAND_SIZE 4096 |
| 24 | #define TPM_LARGE_ENOUGH_COMMAND_SIZE 256 /* saves space in the firmware */ |
| 25 | |
| 26 | #define TPM_SUCCESS ((uint32_t)0x00000000) |
Luigi Semenzato | 52a8d2d | 2010-05-28 10:34:31 -0700 | [diff] [blame] | 27 | #define TPM_E_BADINDEX ((uint32_t)0x00000002) |
Luigi Semenzato | 4f11c36 | 2010-06-10 11:01:04 -0700 | [diff] [blame] | 28 | #define TPM_E_MAXNVWRITES ((uint32_t)0x00000048) |
| 29 | #define TPM_E_ALREADY_INITIALIZED ((uint32_t)0x00005000) /* vboot local */ |
| 30 | #define TPM_E_INTERNAL_INCONSISTENCY ((uint32_t)0x00005001) /* vboot local */ |
Luigi Semenzato | 2666f10 | 2010-06-15 08:12:32 -0700 | [diff] [blame] | 31 | #define TPM_E_MUST_REBOOT ((uint32_t)0x00005002) /* vboot local */ |
Luigi Semenzato | 5e9c0b9 | 2010-07-02 10:36:37 -0700 | [diff] [blame^] | 32 | #define TPM_E_CORRUPTED_STATE ((uint32_t)0x00005003) /* vboot local */ |
Luigi Semenzato | 52a8d2d | 2010-05-28 10:34:31 -0700 | [diff] [blame] | 33 | |
Gaurav Shah | 887e3d4 | 2010-04-27 16:26:48 -0700 | [diff] [blame] | 34 | #define TPM_NV_INDEX0 ((uint32_t)0x00000000) |
| 35 | #define TPM_NV_INDEX_LOCK ((uint32_t)0xffffffff) |
| 36 | #define TPM_NV_PER_WRITE_STCLEAR (((uint32_t)1)<<14) |
| 37 | #define TPM_NV_PER_PPWRITE (((uint32_t)1)<<0) |
Luigi Semenzato | ded1cec | 2010-05-27 15:19:58 -0700 | [diff] [blame] | 38 | #define TPM_NV_PER_GLOBALLOCK (((uint32_t)1)<<15) |
Gaurav Shah | 887e3d4 | 2010-04-27 16:26:48 -0700 | [diff] [blame] | 39 | |
| 40 | typedef uint8_t TSS_BOOL; |
| 41 | typedef uint16_t TPM_STRUCTURE_TAG; |
| 42 | |
| 43 | typedef struct tdTPM_WRITE_INFO { |
| 44 | uint32_t nvIndex; |
| 45 | uint32_t offset; |
| 46 | uint32_t dataSize; |
| 47 | } TPM_WRITE_INFO; |
| 48 | |
| 49 | typedef struct tdTPM_PERMANENT_FLAGS |
| 50 | { |
| 51 | TPM_STRUCTURE_TAG tag; |
| 52 | TSS_BOOL disable; |
| 53 | TSS_BOOL ownership; |
| 54 | TSS_BOOL deactivated; |
| 55 | TSS_BOOL readPubek; |
| 56 | TSS_BOOL disableOwnerClear; |
| 57 | TSS_BOOL allowMaintenance; |
| 58 | TSS_BOOL physicalPresenceLifetimeLock; |
| 59 | TSS_BOOL physicalPresenceHWEnable; |
| 60 | TSS_BOOL physicalPresenceCMDEnable; |
| 61 | TSS_BOOL CEKPUsed; |
| 62 | TSS_BOOL TPMpost; |
| 63 | TSS_BOOL TPMpostLock; |
| 64 | TSS_BOOL FIPS; |
| 65 | TSS_BOOL Operator; |
| 66 | TSS_BOOL enableRevokeEK; |
| 67 | TSS_BOOL nvLocked; |
| 68 | TSS_BOOL readSRKPub; |
| 69 | TSS_BOOL tpmEstablished; |
| 70 | TSS_BOOL maintenanceDone; |
| 71 | TSS_BOOL disableFullDALogicInfo; |
| 72 | } TPM_PERMANENT_FLAGS; |
| 73 | |
| 74 | #define TPM_ALL_LOCALITIES (TPM_LOC_ZERO | TPM_LOC_ONE | TPM_LOC_TWO \ |
| 75 | | TPM_LOC_THREE | TPM_LOC_FOUR) /* 0x1f */ |
| 76 | |
| 77 | #define TPM_ENCAUTH_SIZE 20 |
| 78 | #define TPM_PUBEK_SIZE 256 |
| 79 | |
| 80 | #endif /* TPM_LITE_TSS_CONSTANTS_H_ */ |