10917f925SCorvin Köhne /*- 2ccfc9600SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 30917f925SCorvin Köhne * 40917f925SCorvin Köhne * Copyright (c) 2022 Beckhoff Automation GmbH & Co. KG 50917f925SCorvin Köhne * Author: Corvin Köhne <c.koehne@beckhoff.com> 60917f925SCorvin Köhne */ 70917f925SCorvin Köhne 80917f925SCorvin Köhne #pragma once 90917f925SCorvin Köhne 105ea98d32SCorvin Köhne #include <vmmapi.h> 115ea98d32SCorvin Köhne 12*28dc1aa7SCorvin Köhne #include "acpi_device.h" 130917f925SCorvin Köhne #include "config.h" 140917f925SCorvin Köhne #include "tpm_device.h" 150daf5f02SCorvin Köhne #include "tpm_emul.h" 160917f925SCorvin Köhne 170917f925SCorvin Köhne #define TPM_INTF_TYPE_FIFO_PTP 0x0 180917f925SCorvin Köhne #define TPM_INTF_TYPE_CRB 0x1 190917f925SCorvin Köhne #define TPM_INTF_TYPE_FIFO_TIS 0xF 200917f925SCorvin Köhne 210917f925SCorvin Köhne #define TPM_INTF_VERSION_FIFO 0 220917f925SCorvin Köhne #define TPM_INTF_VERSION_CRB 1 230917f925SCorvin Köhne 240917f925SCorvin Köhne #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_4 0 250917f925SCorvin Köhne #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_8 1 260917f925SCorvin Köhne #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_32 2 270917f925SCorvin Köhne #define TPM_INTF_CAP_CRB_DATA_XFER_SIZE_64 3 280917f925SCorvin Köhne 290917f925SCorvin Köhne #define TPM_INTF_SELECTOR_FIFO 0 300917f925SCorvin Köhne #define TPM_INTF_SELECTOR_CRB 1 310917f925SCorvin Köhne 320917f925SCorvin Köhne struct tpm_intf { 330917f925SCorvin Köhne const char *name; 340917f925SCorvin Köhne 35*28dc1aa7SCorvin Köhne int (*init)(void **sc, struct tpm_emul *emul, void *emul_sc, 36*28dc1aa7SCorvin Köhne struct acpi_device *acpi_dev); 370917f925SCorvin Köhne void (*deinit)(void *sc); 385ea98d32SCorvin Köhne int (*build_acpi_table)(void *sc, struct vmctx *vm_ctx); 390917f925SCorvin Köhne }; 400917f925SCorvin Köhne #define TPM_INTF_SET(x) DATA_SET(tpm_intf_set, x) 41