libqos: Update QGuestAllocator to be opaque
[qemu/ar7.git] / hw / tpm / tpm_tis.h
blob1a0db233674bf8320f7422065a8e54de473c49a8
1 /*
2 * tpm_tis.h - QEMU's TPM TIS interface emulator
4 * Copyright (C) 2006, 2010-2013 IBM Corporation
6 * Authors:
7 * Stefan Berger <stefanb@us.ibm.com>
8 * David Safford <safford@us.ibm.com>
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.
13 * Implementation of the TIS interface according to specs found at
14 * http://www.trustedcomputinggroup.org
17 #ifndef TPM_TPM_TIS_H
18 #define TPM_TPM_TIS_H
20 #include "hw/isa/isa.h"
21 #include "hw/acpi/tpm.h"
22 #include "qemu-common.h"
24 #define TPM_TIS_NUM_LOCALITIES 5 /* per spec */
25 #define TPM_TIS_LOCALITY_SHIFT 12
26 #define TPM_TIS_NO_LOCALITY 0xff
28 #define TPM_TIS_IS_VALID_LOCTY(x) ((x) < TPM_TIS_NUM_LOCALITIES)
30 #define TPM_TIS_BUFFER_MAX 4096
32 typedef enum {
33 TPM_TIS_STATE_IDLE = 0,
34 TPM_TIS_STATE_READY,
35 TPM_TIS_STATE_COMPLETION,
36 TPM_TIS_STATE_EXECUTION,
37 TPM_TIS_STATE_RECEPTION,
38 } TPMTISState;
40 /* locality data -- all fields are persisted */
41 typedef struct TPMLocality {
42 TPMTISState state;
43 uint8_t access;
44 uint8_t sts;
45 uint32_t inte;
46 uint32_t ints;
48 uint16_t w_offset;
49 uint16_t r_offset;
50 TPMSizedBuffer w_buffer;
51 TPMSizedBuffer r_buffer;
52 } TPMLocality;
54 typedef struct TPMTISEmuState {
55 QEMUBH *bh;
56 uint32_t offset;
57 uint8_t buf[TPM_TIS_BUFFER_MAX];
59 uint8_t active_locty;
60 uint8_t aborting_locty;
61 uint8_t next_locty;
63 TPMLocality loc[TPM_TIS_NUM_LOCALITIES];
65 qemu_irq irq;
66 uint32_t irq_num;
67 } TPMTISEmuState;
69 #endif /* TPM_TPM_TIS_H */