summaryrefslogtreecommitdiff
path: root/board/cr50/tpm2/virtual_nvmem.h
blob: 75fc24db0610b55456c52b0c768481c6d27083ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Copyright 2018 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __EC_BOARD_CR50_TPM2_VIRTUAL_NVMEM_H
#define __EC_BOARD_CR50_TPM2_VIRTUAL_NVMEM_H

/*
 * Currently supported virtual NV indexes.
 *
 * The range for virtual NV indexes is chosen such that all indexes
 * fall within a range designated by the TCG for use by TPM manufacturers,
 * without expectation of consultation with the TCG, or consistent behavior
 * across TPM models. See Table 3 in the 'Registry of reserved TPM 2.0
 * handles and localities' for more details.
 *
 * To return data, entries in this enum must be registered in virtual_nvmem.c.
 *
 * Values in this enum must be consecutive.
 */
enum virtual_nv_index {
	VIRTUAL_NV_INDEX_START = 0x013fff00,
	VIRTUAL_NV_INDEX_BOARD_ID = VIRTUAL_NV_INDEX_START,
	VIRTUAL_NV_INDEX_SN_DATA,
	VIRTUAL_NV_INDEX_G2F_CERT,
	VIRTUAL_NV_INDEX_RSU_DEV_ID,
	/* Reserved for generic TPM2.0 stand-alone counter. */
	/* TODO(b/191163997): support reading RMA bytes via this index. */
	/* VIRTUAL_NV_INDEX_RMA_BYTES = 0x013fff04, */
	VIRTUAL_NV_INDEX_END,
};
/* Reserved space for future virtual indexes; this is the last valid index. */
#define VIRTUAL_NV_INDEX_MAX 0x013fffff

/*
 * Data sizes (in bytes) of currently defined indexes.
 */
#define VIRTUAL_NV_INDEX_BOARD_ID_SIZE	12
#define VIRTUAL_NV_INDEX_SN_DATA_SIZE	16
#define VIRTUAL_NV_INDEX_G2F_CERT_SIZE	315
#define VIRTUAL_NV_INDEX_RSU_DEV_ID_SIZE 32

#endif /* __EC_BOARD_CR50_TPM2_VIRTUAL_NVMEM_H */