mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-16 01:38:22 +00:00
f255d31f90
Add a new uclass for TPMs which uses almost the same TIS (TPM Interface Specification) as is currently implemented. Since init() is handled by the normal driver model probe() method, we don't need to implement that. Also rename the transfer method to xfer() which is a less clumbsy name. Once all drivers and users are converted to driver model we can remove the old code. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Christophe Ricard<christophe-h.ricard@st.com> Reviewed-by: Heiko Schocher <hs@denx.de>
287 lines
4.9 KiB
C
287 lines
4.9 KiB
C
/*
|
|
* Copyright (c) 2015 Google, Inc
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#ifndef __tpm_internal_h
|
|
#define __tpm_internal_h
|
|
|
|
enum {
|
|
TPM_MAX_ORDINAL = 243,
|
|
TPM_MAX_PROTECTED_ORDINAL = 12,
|
|
TPM_PROTECTED_ORDINAL_MASK = 0xff,
|
|
TPM_CMD_COUNT_BYTE = 2,
|
|
TPM_CMD_ORDINAL_BYTE = 6,
|
|
};
|
|
|
|
/*
|
|
* Array with one entry per ordinal defining the maximum amount
|
|
* of time the chip could take to return the result. The ordinal
|
|
* designation of short, medium or long is defined in a table in
|
|
* TCG Specification TPM Main Part 2 TPM Structures Section 17. The
|
|
* values of the SHORT, MEDIUM, and LONG durations are retrieved
|
|
* from the chip during initialization with a call to tpm_get_timeouts.
|
|
*/
|
|
static const u8 tpm_protected_ordinal_duration[TPM_MAX_PROTECTED_ORDINAL] = {
|
|
TPM_UNDEFINED, /* 0 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 5 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 10 */
|
|
TPM_SHORT,
|
|
};
|
|
|
|
static const u8 tpm_ordinal_duration[TPM_M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/* 60 */
|
|
TPM_MEDIUM,
|
|
TPM_MEDIUM,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_MEDIUM, /* 65 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 70 */
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 75 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_LONG, /* 80 */
|
|
TPM_UNDEFINED,
|
|
TPM_MEDIUM,
|
|
TPM_LONG,
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED, /* 85 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 90 */
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED, /* 95 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_MEDIUM, /* 100 */
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 105 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 110 */
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT, /* 115 */
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_LONG, /* 120 */
|
|
TPM_LONG,
|
|
TPM_MEDIUM,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT,
|
|
TPM_SHORT, /* 125 */
|
|
TPM_SHORT,
|
|
TPM_LONG,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT, /* 130 */
|
|
TPM_MEDIUM,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT,
|
|
TPM_MEDIUM,
|
|
TPM_UNDEFINED, /* 135 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 140 */
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 145 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 150 */
|
|
TPM_MEDIUM,
|
|
TPM_MEDIUM,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED, /* 155 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 160 */
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 165 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_LONG, /* 170 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 175 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_MEDIUM, /* 180 */
|
|
TPM_SHORT,
|
|
TPM_MEDIUM,
|
|
TPM_MEDIUM,
|
|
TPM_MEDIUM,
|
|
TPM_MEDIUM, /* 185 */
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 190 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 195 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 200 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT,
|
|
TPM_SHORT, /* 205 */
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_MEDIUM, /* 210 */
|
|
TPM_UNDEFINED,
|
|
TPM_MEDIUM,
|
|
TPM_MEDIUM,
|
|
TPM_MEDIUM,
|
|
TPM_UNDEFINED, /* 215 */
|
|
TPM_MEDIUM,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT,
|
|
TPM_SHORT, /* 220 */
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_SHORT,
|
|
TPM_UNDEFINED, /* 225 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 230 */
|
|
TPM_LONG,
|
|
TPM_MEDIUM,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED, /* 235 */
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_UNDEFINED,
|
|
TPM_SHORT, /* 240 */
|
|
TPM_UNDEFINED,
|
|
TPM_MEDIUM,
|
|
};
|
|
|
|
#endif
|