1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, TPM related interfaces.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2021-2024 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_vmm_pdmtpmifs_h
|
---|
37 | #define VBOX_INCLUDED_vmm_pdmtpmifs_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 |
|
---|
44 | RT_C_DECLS_BEGIN
|
---|
45 |
|
---|
46 | /** @defgroup grp_pdm_ifs_tpm PDM TPM Interfaces
|
---|
47 | * @ingroup grp_pdm_interfaces
|
---|
48 | * @{
|
---|
49 | */
|
---|
50 |
|
---|
51 |
|
---|
52 | /** Pointer to a TPM port interface. */
|
---|
53 | typedef struct PDMITPMPORT *PPDMITPMPORT;
|
---|
54 | /**
|
---|
55 | * TPM port interface (down).
|
---|
56 | */
|
---|
57 | typedef struct PDMITPMPORT
|
---|
58 | {
|
---|
59 | /**
|
---|
60 | * Queries the maximum buffer size supported by the upper device emulation.
|
---|
61 | *
|
---|
62 | * @returns Maximum buffer size in bytes.
|
---|
63 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
64 | */
|
---|
65 | DECLR3CALLBACKMEMBER(uint32_t, pfnGetMaxBufferSize, (PPDMITPMPORT pInterface));
|
---|
66 |
|
---|
67 | } PDMITPMPORT;
|
---|
68 | /** PDMITPMPORT interface ID. */
|
---|
69 | #define PDMITPMPORT_IID "919271f9-385b-442c-a33d-1469ec7dd97b"
|
---|
70 |
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * TPM version enumeration.
|
---|
74 | */
|
---|
75 | typedef enum TPMVERSION
|
---|
76 | {
|
---|
77 | /** Invalid TPM version, don't use. */
|
---|
78 | TPMVERSION_INVALID = 0,
|
---|
79 | /** TPM works according to version 1.2 of the specification. */
|
---|
80 | TPMVERSION_1_2,
|
---|
81 | /** TPM works according to version 2.0 of the specification. */
|
---|
82 | TPMVERSION_2_0,
|
---|
83 | /** TPM version is unknown. */
|
---|
84 | TPMVERSION_UNKNOWN
|
---|
85 | } TPMVERSION;
|
---|
86 |
|
---|
87 |
|
---|
88 | /** Pointer to a TPM interface. */
|
---|
89 | typedef struct PDMITPMCONNECTOR *PPDMITPMCONNECTOR;
|
---|
90 | /**
|
---|
91 | * TPM interface (up).
|
---|
92 | * Pairs with PDMITPMPORT.
|
---|
93 | */
|
---|
94 | typedef struct PDMITPMCONNECTOR
|
---|
95 | {
|
---|
96 | /**
|
---|
97 | * Returns the version of the TPM implemented by the driver below.
|
---|
98 | *
|
---|
99 | * @returns The TPM version.
|
---|
100 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
101 | */
|
---|
102 | DECLR3CALLBACKMEMBER(TPMVERSION, pfnGetVersion, (PPDMITPMCONNECTOR pInterface));
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Returns the maximum supported locality of the driver below.
|
---|
106 | *
|
---|
107 | * @returns The maximum supported locality (0-4).
|
---|
108 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
109 | */
|
---|
110 | DECLR3CALLBACKMEMBER(uint32_t, pfnGetLocalityMax, (PPDMITPMCONNECTOR pInterface));
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Returns the command/response buffer size of the driver below.
|
---|
114 | *
|
---|
115 | * @returns Buffer size in bytes.
|
---|
116 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
117 | */
|
---|
118 | DECLR3CALLBACKMEMBER(uint32_t, pfnGetBufferSize, (PPDMITPMCONNECTOR pInterface));
|
---|
119 |
|
---|
120 | /**
|
---|
121 | * Returns the status of the established flag.
|
---|
122 | *
|
---|
123 | * @returns Status of the established flag.
|
---|
124 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
125 | */
|
---|
126 | DECLR3CALLBACKMEMBER(bool, pfnGetEstablishedFlag, (PPDMITPMCONNECTOR pInterface));
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * Resets the TPM established flag.
|
---|
130 | *
|
---|
131 | * @returns VBox status code.
|
---|
132 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
133 | * @param bLoc The locality issuing this request.
|
---|
134 | */
|
---|
135 | DECLR3CALLBACKMEMBER(int, pfnResetEstablishedFlag, (PPDMITPMCONNECTOR pInterface, uint8_t bLoc));
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * Executes the given command.
|
---|
139 | *
|
---|
140 | * @returns VBox status code.
|
---|
141 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
142 | * @param bLoc The locality the command is issued from.
|
---|
143 | * @param pvCmd Pointer to the command data.
|
---|
144 | * @param cbCmd Size of the command in bytes.
|
---|
145 | * @param pvResp Where to store the response data.
|
---|
146 | * @param cbResp Size of the response buffer in bytes.
|
---|
147 | */
|
---|
148 | DECLR3CALLBACKMEMBER(int, pfnCmdExec, (PPDMITPMCONNECTOR pInterface, uint8_t bLoc, const void *pvCmd, size_t cbCmd, void *pvResp, size_t cbResp));
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Cancels the currently executed command.
|
---|
152 | *
|
---|
153 | * @returns VBox status code.
|
---|
154 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
155 | */
|
---|
156 | DECLR3CALLBACKMEMBER(int, pfnCmdCancel, (PPDMITPMCONNECTOR pInterface));
|
---|
157 |
|
---|
158 | } PDMITPMCONNECTOR;
|
---|
159 | /** PDMITPMCONNECTOR interface ID. */
|
---|
160 | #define PDMITPMCONNECTOR_IID "30afefd8-c11f-4e2a-a746-424e3d99fa86"
|
---|
161 |
|
---|
162 | /** @} */
|
---|
163 |
|
---|
164 | RT_C_DECLS_END
|
---|
165 |
|
---|
166 | #endif /* !VBOX_INCLUDED_vmm_pdmtpmifs_h */
|
---|