]> Git Repo - qemu.git/blob - tpm/tpm_int.h
configure: fix TPM logic
[qemu.git] / tpm / tpm_int.h
1 /*
2  * TPM configuration
3  *
4  * Copyright (C) 2011-2013 IBM Corporation
5  *
6  * Authors:
7  *  Stefan Berger    <[email protected]>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10  * See the COPYING file in the top-level directory.
11  */
12 #ifndef TPM_TPM_INT_H
13 #define TPM_TPM_INT_H
14
15 #include "exec/memory.h"
16 #include "tpm/tpm_tis.h"
17
18 /* overall state of the TPM interface */
19 struct TPMState {
20     ISADevice busdev;
21     MemoryRegion mmio;
22
23     union {
24         TPMTISEmuState tis;
25     } s;
26
27     uint8_t     locty_number;
28     TPMLocality *locty_data;
29
30     char *backend;
31     TPMBackend *be_driver;
32 };
33
34 #define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
35
36 struct TPMDriverOps {
37     enum TpmType type;
38     /* get a descriptive text of the backend to display to the user */
39     const char *(*desc)(void);
40
41     TPMBackend *(*create)(QemuOpts *opts, const char *id);
42     void (*destroy)(TPMBackend *t);
43
44     /* initialize the backend */
45     int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb);
46     /* start up the TPM on the backend */
47     int (*startup_tpm)(TPMBackend *t);
48     /* returns true if nothing will ever answer TPM requests */
49     bool (*had_startup_error)(TPMBackend *t);
50
51     size_t (*realloc_buffer)(TPMSizedBuffer *sb);
52
53     void (*deliver_request)(TPMBackend *t);
54
55     void (*reset)(TPMBackend *t);
56
57     void (*cancel_cmd)(TPMBackend *t);
58
59     bool (*get_tpm_established_flag)(TPMBackend *t);
60 };
61
62 struct tpm_req_hdr {
63     uint16_t tag;
64     uint32_t len;
65     uint32_t ordinal;
66 } QEMU_PACKED;
67
68 struct tpm_resp_hdr {
69     uint16_t tag;
70     uint32_t len;
71     uint32_t errcode;
72 } QEMU_PACKED;
73
74 #define TPM_TAG_RQU_COMMAND       0xc1
75 #define TPM_TAG_RQU_AUTH1_COMMAND 0xc2
76 #define TPM_TAG_RQU_AUTH2_COMMAND 0xc3
77
78 #define TPM_TAG_RSP_COMMAND       0xc4
79 #define TPM_TAG_RSP_AUTH1_COMMAND 0xc5
80 #define TPM_TAG_RSP_AUTH2_COMMAND 0xc6
81
82 #define TPM_FAIL                  9
83
84 #define TPM_ORD_GetTicks          0xf1
85
86 TPMBackend *qemu_find_tpm(const char *id);
87 int tpm_register_model(enum TpmModel model);
88 int tpm_register_driver(const TPMDriverOps *tdo);
89 void tpm_display_backend_drivers(void);
90 const TPMDriverOps *tpm_get_backend_driver(const char *type);
91 void tpm_write_fatal_error_response(uint8_t *out, uint32_t out_len);
92
93 extern const TPMDriverOps tpm_passthrough_driver;
94
95 #endif /* TPM_TPM_INT_H */
This page took 0.028826 seconds and 4 git commands to generate.