]> git.proxmox.com Git - qemu.git/blob - tpm/tpm_int.h
Support for TPM command line options
[qemu.git] / tpm / tpm_int.h
1 /*
2 * TPM configuration
3 *
4 * Copyright (C) 2011-2013 IBM Corporation
5 *
6 * Authors:
7 * Stefan Berger <stefanb@us.ibm.com>
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 struct TPMDriverOps;
19 typedef struct TPMDriverOps TPMDriverOps;
20
21 typedef struct TPMBackend {
22 char *id;
23 enum TpmModel fe_model;
24 char *path;
25 char *cancel_path;
26 const TPMDriverOps *ops;
27
28 QLIST_ENTRY(TPMBackend) list;
29 } TPMBackend;
30
31 /* overall state of the TPM interface */
32 typedef struct TPMState {
33 ISADevice busdev;
34 MemoryRegion mmio;
35
36 union {
37 TPMTISEmuState tis;
38 } s;
39
40 uint8_t locty_number;
41 TPMLocality *locty_data;
42
43 char *backend;
44 TPMBackend *be_driver;
45 } TPMState;
46
47 #define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
48
49 typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty);
50
51 struct TPMDriverOps {
52 enum TpmType type;
53 /* get a descriptive text of the backend to display to the user */
54 const char *(*desc)(void);
55
56 TPMBackend *(*create)(QemuOpts *opts, const char *id);
57 void (*destroy)(TPMBackend *t);
58
59 /* initialize the backend */
60 int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb);
61 /* start up the TPM on the backend */
62 int (*startup_tpm)(TPMBackend *t);
63 /* returns true if nothing will ever answer TPM requests */
64 bool (*had_startup_error)(TPMBackend *t);
65
66 size_t (*realloc_buffer)(TPMSizedBuffer *sb);
67
68 void (*deliver_request)(TPMBackend *t);
69
70 void (*reset)(TPMBackend *t);
71
72 void (*cancel_cmd)(TPMBackend *t);
73
74 bool (*get_tpm_established_flag)(TPMBackend *t);
75 };
76
77 TPMBackend *qemu_find_tpm(const char *id);
78 int tpm_register_model(enum TpmModel model);
79 int tpm_register_driver(const TPMDriverOps *tdo);
80 void tpm_display_backend_drivers(void);
81 const TPMDriverOps *tpm_get_backend_driver(const char *type);
82
83 #endif /* TPM_TPM_INT_H */