root / hw / tpm / tpm_tis.h @ 2c9b15ca
History | View | Annotate | Download (1.7 kB)
1 |
/*
|
---|---|
2 |
* tpm_tis.h - QEMU's TPM TIS interface emulator
|
3 |
*
|
4 |
* Copyright (C) 2006, 2010-2013 IBM Corporation
|
5 |
*
|
6 |
* Authors:
|
7 |
* Stefan Berger <stefanb@us.ibm.com>
|
8 |
* David Safford <safford@us.ibm.com>
|
9 |
*
|
10 |
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
11 |
* See the COPYING file in the top-level directory.
|
12 |
*
|
13 |
* Implementation of the TIS interface according to specs found at
|
14 |
* http://www.trustedcomputinggroup.org
|
15 |
*
|
16 |
*/
|
17 |
#ifndef TPM_TPM_TIS_H
|
18 |
#define TPM_TPM_TIS_H
|
19 |
|
20 |
#include "hw/isa/isa.h" |
21 |
#include "qemu-common.h" |
22 |
|
23 |
#define TPM_TIS_ADDR_BASE 0xFED40000 |
24 |
|
25 |
#define TPM_TIS_NUM_LOCALITIES 5 /* per spec */ |
26 |
#define TPM_TIS_LOCALITY_SHIFT 12 |
27 |
#define TPM_TIS_NO_LOCALITY 0xff |
28 |
|
29 |
#define TPM_TIS_IS_VALID_LOCTY(x) ((x) < TPM_TIS_NUM_LOCALITIES)
|
30 |
|
31 |
#define TPM_TIS_IRQ 5 |
32 |
|
33 |
#define TPM_TIS_BUFFER_MAX 4096 |
34 |
|
35 |
#define TYPE_TPM_TIS "tpm-tis" |
36 |
|
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 |
uint8_t sts; |
51 |
uint32_t inte; |
52 |
uint32_t ints; |
53 |
|
54 |
uint16_t w_offset; |
55 |
uint16_t r_offset; |
56 |
TPMSizedBuffer w_buffer; |
57 |
TPMSizedBuffer r_buffer; |
58 |
} TPMLocality; |
59 |
|
60 |
typedef struct TPMTISEmuState { |
61 |
QEMUBH *bh; |
62 |
uint32_t offset; |
63 |
uint8_t buf[TPM_TIS_BUFFER_MAX]; |
64 |
|
65 |
uint8_t active_locty; |
66 |
uint8_t aborting_locty; |
67 |
uint8_t next_locty; |
68 |
|
69 |
TPMLocality loc[TPM_TIS_NUM_LOCALITIES]; |
70 |
|
71 |
qemu_irq irq; |
72 |
uint32_t irq_num; |
73 |
} TPMTISEmuState; |
74 |
|
75 |
#endif /* TPM_TPM_TIS_H */ |