xen: remove other open-coded use of libxengnttab
[qemu.git] / tests / tpm-emu.h
blobef4bfa8800e6bbed99a4202f795ccf46ab4692e1
1 /*
2 * Minimal TPM emulator for TPM test cases
4 * Copyright (c) 2018 Red Hat, Inc.
6 * Authors:
7 * Marc-André Lureau <marcandre.lureau@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #ifndef TESTS_TPM_EMU_H
14 #define TESTS_TPM_EMU_H
16 #define TPM_RC_FAILURE 0x101
17 #define TPM2_ST_NO_SESSIONS 0x8001
19 struct tpm_hdr {
20 uint16_t tag;
21 uint32_t len;
22 uint32_t code; /*ordinal/error */
23 char buffer[];
24 } QEMU_PACKED;
26 typedef struct TestState {
27 CompatGMutex data_mutex;
28 CompatGCond data_cond;
29 SocketAddress *addr;
30 QIOChannel *tpm_ioc;
31 GThread *emu_tpm_thread;
32 struct tpm_hdr *tpm_msg;
33 } TestState;
35 void tpm_emu_test_wait_cond(TestState *s);
36 void *tpm_emu_ctrl_thread(void *data);
38 #endif /* TEST_TPM_EMU_H */