virtio-blk: switch off scsi-passthrough by default
[qemu.git] / hw / tpm / tpm_tis.h
bloba1df41fa21a4917609b16bf293c42286e1651da6
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 uint32_t sts;
45 uint32_t iface_id;
46 uint32_t inte;
47 uint32_t ints;
49 uint16_t w_offset;
50 uint16_t r_offset;
51 TPMSizedBuffer w_buffer;
52 TPMSizedBuffer r_buffer;
53 } TPMLocality;
55 typedef struct TPMTISEmuState {
56 QEMUBH *bh;
57 uint32_t offset;
58 uint8_t buf[TPM_TIS_BUFFER_MAX];
60 uint8_t active_locty;
61 uint8_t aborting_locty;
62 uint8_t next_locty;
64 TPMLocality loc[TPM_TIS_NUM_LOCALITIES];
66 qemu_irq irq;
67 uint32_t irq_num;
68 } TPMTISEmuState;
70 #endif /* TPM_TPM_TIS_H */