]> git.proxmox.com Git - qemu.git/blame - tpm/tpm_tis.h
Merge branch 'tcg-s390' of git://github.com/rth7680/qemu
[qemu.git] / tpm / tpm_tis.h
CommitLineData
d1a0cf73
SB
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
0d09e41a 20#include "hw/isa/isa.h"
d1a0cf73
SB
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
8243b046 38struct TPMSizedBuffer {
d1a0cf73
SB
39 uint32_t size;
40 uint8_t *buffer;
8243b046 41};
d1a0cf73
SB
42
43typedef enum {
44 TPM_TIS_STATE_IDLE = 0,
45 TPM_TIS_STATE_READY,
46 TPM_TIS_STATE_COMPLETION,
47 TPM_TIS_STATE_EXECUTION,
48 TPM_TIS_STATE_RECEPTION,
49} TPMTISState;
50
51/* locality data -- all fields are persisted */
52typedef struct TPMLocality {
53 TPMTISState state;
54 uint8_t access;
55 uint8_t sts;
56 uint32_t inte;
57 uint32_t ints;
58
59 uint16_t w_offset;
60 uint16_t r_offset;
61 TPMSizedBuffer w_buffer;
62 TPMSizedBuffer r_buffer;
63} TPMLocality;
64
65typedef struct TPMTISEmuState {
66 QEMUBH *bh;
67 uint32_t offset;
68 uint8_t buf[TPM_TIS_BUFFER_MAX];
69
70 uint8_t active_locty;
71 uint8_t aborting_locty;
72 uint8_t next_locty;
73
74 TPMLocality loc[TPM_TIS_NUM_LOCALITIES];
75
76 qemu_irq irq;
77 uint32_t irq_num;
78} TPMTISEmuState;
79
80#endif /* TPM_TPM_TIS_H */