xref: /freebsd/usr.sbin/bhyve/tpm_intf.h (revision 7ad4d94d5bf275f745907d8bf4614219f5ce4d34)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2022 Beckhoff Automation GmbH & Co. KG
5  * Author: Corvin Köhne <c.koehne@beckhoff.com>
6  */
7 
8 #pragma once
9 
10 #include "config.h"
11 #include "tpm_device.h"
12 
13 #define TPM_INTF_TYPE_FIFO_PTP 0x0
14 #define TPM_INTF_TYPE_CRB 0x1
15 #define TPM_INTF_TYPE_FIFO_TIS 0xF
16 
17 #define TPM_INTF_VERSION_FIFO 0
18 #define TPM_INTF_VERSION_CRB 1
19 
20 #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_4 0
21 #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_8 1
22 #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_32 2
23 #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_64 3
24 
25 #define TPM_INTF_SELECTOR_FIFO 0
26 #define TPM_INTF_SELECTOR_CRB 1
27 
28 struct tpm_intf {
29 	const char *name;
30 
31 	int (*init)(void **sc);
32 	void (*deinit)(void *sc);
33 	int (*build_acpi_table)(void *sc);
34 };
35 #define TPM_INTF_SET(x) DATA_SET(tpm_intf_set, x)
36