]>
Commit | Line | Data |
---|---|---|
ac90053d EA |
1 | /* |
2 | * tpm_tis.h - QEMU's TPM TIS common header | |
3 | * | |
4 | * Copyright (C) 2006,2010-2013 IBM Corporation | |
5 | * | |
6 | * Authors: | |
7 | * Stefan Berger <[email protected]> | |
8 | * David Safford <[email protected]> | |
9 | * | |
10 | * Xen 4 support: Andrease Niederl <[email protected]> | |
11 | * | |
12 | * This work is licensed under the terms of the GNU GPL, version 2 or later. | |
13 | * See the COPYING file in the top-level directory. | |
14 | * | |
15 | * Implementation of the TIS interface according to specs found at | |
16 | * http://www.trustedcomputinggroup.org. This implementation currently | |
17 | * supports version 1.3, 21 March 2013 | |
18 | * In the developers menu choose the PC Client section then find the TIS | |
19 | * specification. | |
20 | * | |
21 | * TPM TIS for TPM 2 implementation following TCG PC Client Platform | |
22 | * TPM Profile (PTP) Specification, Familiy 2.0, Revision 00.43 | |
23 | */ | |
24 | #ifndef TPM_TPM_TIS_H | |
25 | #define TPM_TPM_TIS_H | |
26 | ||
ac90053d EA |
27 | #include "sysemu/tpm_backend.h" |
28 | #include "tpm_ppi.h" | |
29 | ||
30 | #define TPM_TIS_NUM_LOCALITIES 5 /* per spec */ | |
31 | #define TPM_TIS_LOCALITY_SHIFT 12 | |
32 | #define TPM_TIS_NO_LOCALITY 0xff | |
33 | ||
34 | #define TPM_TIS_IS_VALID_LOCTY(x) ((x) < TPM_TIS_NUM_LOCALITIES) | |
35 | ||
36 | #define TPM_TIS_BUFFER_MAX 4096 | |
37 | ||
38 | typedef enum { | |
39 | TPM_TIS_STATE_IDLE = 0, | |
40 | TPM_TIS_STATE_READY, | |
41 | TPM_TIS_STATE_COMPLETION, | |
42 | TPM_TIS_STATE_EXECUTION, | |
43 | TPM_TIS_STATE_RECEPTION, | |
44 | } TPMTISState; | |
45 | ||
46 | /* locality data -- all fields are persisted */ | |
47 | typedef struct TPMLocality { | |
48 | TPMTISState state; | |
49 | uint8_t access; | |
50 | uint32_t sts; | |
51 | uint32_t iface_id; | |
52 | uint32_t inte; | |
53 | uint32_t ints; | |
54 | } TPMLocality; | |
55 | ||
56 | typedef struct TPMState { | |
57 | MemoryRegion mmio; | |
58 | ||
59 | unsigned char buffer[TPM_TIS_BUFFER_MAX]; | |
60 | uint16_t rw_offset; | |
61 | ||
62 | uint8_t active_locty; | |
63 | uint8_t aborting_locty; | |
64 | uint8_t next_locty; | |
65 | ||
66 | TPMLocality loc[TPM_TIS_NUM_LOCALITIES]; | |
67 | ||
68 | qemu_irq irq; | |
69 | uint32_t irq_num; | |
70 | ||
71 | TPMBackendCmd cmd; | |
72 | ||
73 | TPMBackend *be_driver; | |
74 | TPMVersion be_tpm_version; | |
75 | ||
76 | size_t be_buffer_size; | |
77 | ||
78 | bool ppi_enabled; | |
79 | TPMPPI ppi; | |
80 | } TPMState; | |
81 | ||
82 | extern const VMStateDescription vmstate_locty; | |
83 | extern const MemoryRegionOps tpm_tis_memory_ops; | |
84 | ||
85 | int tpm_tis_pre_save(TPMState *s); | |
86 | void tpm_tis_reset(TPMState *s); | |
87 | enum TPMVersion tpm_tis_get_tpm_version(TPMState *s); | |
88 | void tpm_tis_request_completed(TPMState *s, int ret); | |
89 | ||
90 | #endif /* TPM_TPM_TIS_H */ |