1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, TPM related interfaces.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2021-2023 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 | * @todo
|
---|
61 | */
|
---|
62 | DECLR3CALLBACKMEMBER(int, pfnDummy, (PPDMITPMPORT pInterface));
|
---|
63 |
|
---|
64 | } PDMITPMPORT;
|
---|
65 | /** PDMITPMPORT interface ID. */
|
---|
66 | #define PDMITPMPORT_IID "1e57710f-f820-47ec-afa6-2713195f8f94"
|
---|
67 |
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * TPM version enumeration.
|
---|
71 | */
|
---|
72 | typedef enum TPMVERSION
|
---|
73 | {
|
---|
74 | /** Invalid TPM version, don't use. */
|
---|
75 | TPMVERSION_INVALID = 0,
|
---|
76 | /** TPM works according to version 1.2 of the specification. */
|
---|
77 | TPMVERSION_1_2,
|
---|
78 | /** TPM works according to version 2.0 of the specification. */
|
---|
79 | TPMVERSION_2_0,
|
---|
80 | /** TPM version is unknown. */
|
---|
81 | TPMVERSION_UNKNOWN
|
---|
82 | } TPMVERSION;
|
---|
83 |
|
---|
84 |
|
---|
85 | /** Pointer to a TPM interface. */
|
---|
86 | typedef struct PDMITPMCONNECTOR *PPDMITPMCONNECTOR;
|
---|
87 | /**
|
---|
88 | * TPM interface (up).
|
---|
89 | * Pairs with PDMITPMPORT.
|
---|
90 | */
|
---|
91 | typedef struct PDMITPMCONNECTOR
|
---|
92 | {
|
---|
93 | /**
|
---|
94 | * Returns the version of the TPM implemented by the driver below.
|
---|
95 | *
|
---|
96 | * @returns The TPM version.
|
---|
97 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
98 | */
|
---|
99 | DECLR3CALLBACKMEMBER(TPMVERSION, pfnGetVersion, (PPDMITPMCONNECTOR pInterface));
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Returns the maximum supported locality of the driver below.
|
---|
103 | *
|
---|
104 | * @returns The maximum supported locality (0-4).
|
---|
105 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
106 | */
|
---|
107 | DECLR3CALLBACKMEMBER(uint32_t, pfnGetLocalityMax, (PPDMITPMCONNECTOR pInterface));
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * Returns the command/response buffer size of the driver below.
|
---|
111 | *
|
---|
112 | * @returns Buffer size in bytes.
|
---|
113 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
114 | */
|
---|
115 | DECLR3CALLBACKMEMBER(uint32_t, pfnGetBufferSize, (PPDMITPMCONNECTOR pInterface));
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Returns the status of the established flag.
|
---|
119 | *
|
---|
120 | * @returns Status of the established flag.
|
---|
121 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
122 | */
|
---|
123 | DECLR3CALLBACKMEMBER(bool, pfnGetEstablishedFlag, (PPDMITPMCONNECTOR pInterface));
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * Resets the TPM established flag.
|
---|
127 | *
|
---|
128 | * @returns VBox status code.
|
---|
129 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
130 | * @param bLoc The locality issuing this request.
|
---|
131 | */
|
---|
132 | DECLR3CALLBACKMEMBER(int, pfnResetEstablishedFlag, (PPDMITPMCONNECTOR pInterface, uint8_t bLoc));
|
---|
133 |
|
---|
134 | /**
|
---|
135 | * Executes the given command.
|
---|
136 | *
|
---|
137 | * @returns VBox status code.
|
---|
138 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
139 | * @param bLoc The locality the command is issued from.
|
---|
140 | * @param pvCmd Pointer to the command data.
|
---|
141 | * @param cbCmd Size of the command in bytes.
|
---|
142 | * @param pvResp Where to store the response data.
|
---|
143 | * @param cbResp Size of the response buffer in bytes.
|
---|
144 | */
|
---|
145 | DECLR3CALLBACKMEMBER(int, pfnCmdExec, (PPDMITPMCONNECTOR pInterface, uint8_t bLoc, const void *pvCmd, size_t cbCmd, void *pvResp, size_t cbResp));
|
---|
146 |
|
---|
147 | /**
|
---|
148 | * Cancels the currently executed command.
|
---|
149 | *
|
---|
150 | * @returns VBox status code.
|
---|
151 | * @param pInterface Pointer to the interface structure containing the called function pointer.
|
---|
152 | */
|
---|
153 | DECLR3CALLBACKMEMBER(int, pfnCmdCancel, (PPDMITPMCONNECTOR pInterface));
|
---|
154 |
|
---|
155 | } PDMITPMCONNECTOR;
|
---|
156 | /** PDMITPMCONNECTOR interface ID. */
|
---|
157 | #define PDMITPMCONNECTOR_IID "30afefd8-c11f-4e2a-a746-424e3d99fa86"
|
---|
158 |
|
---|
159 | /** @} */
|
---|
160 |
|
---|
161 | RT_C_DECLS_END
|
---|
162 |
|
---|
163 | #endif /* !VBOX_INCLUDED_vmm_pdmtpmifs_h */
|
---|