diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/baum.c | 2 | ||||
-rw-r--r-- | backends/msmouse.c | 2 | ||||
-rw-r--r-- | backends/rng-egd.c | 4 | ||||
-rw-r--r-- | backends/rng-random.c | 4 | ||||
-rw-r--r-- | backends/rng.c | 2 | ||||
-rw-r--r-- | backends/tpm.c | 40 |
6 files changed, 45 insertions, 9 deletions
diff --git a/backends/baum.c b/backends/baum.c index ea9ffe88fb..4cba79fc7d 100644 --- a/backends/baum.c +++ b/backends/baum.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #include "qemu-common.h" -#include "char/char.h" +#include "sysemu/char.h" #include "qemu/timer.h" #include "hw/usb.h" #include <brlapi.h> diff --git a/backends/msmouse.c b/backends/msmouse.c index 61052fe783..0ac05a0d10 100644 --- a/backends/msmouse.c +++ b/backends/msmouse.c @@ -23,7 +23,7 @@ */ #include <stdlib.h> #include "qemu-common.h" -#include "char/char.h" +#include "sysemu/char.h" #include "ui/console.h" #define MSMOUSE_LO6(n) ((n) & 0x3f) diff --git a/backends/rng-egd.c b/backends/rng-egd.c index cc6f5ee28e..9e5a5366f7 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -10,8 +10,8 @@ * See the COPYING file in the top-level directory. */ -#include "qemu/rng.h" -#include "char/char.h" +#include "sysemu/rng.h" +#include "sysemu/char.h" #include "qapi/qmp/qerror.h" #include "hw/qdev.h" /* just for DEFINE_PROP_CHR */ diff --git a/backends/rng-random.c b/backends/rng-random.c index acd20afad2..d5761f2cce 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -10,8 +10,8 @@ * See the COPYING file in the top-level directory. */ -#include "qemu/rng-random.h" -#include "qemu/rng.h" +#include "sysemu/rng-random.h" +#include "sysemu/rng.h" #include "qapi/qmp/qerror.h" #include "qemu/main-loop.h" diff --git a/backends/rng.c b/backends/rng.c index 3d3389802e..85cb83f5e1 100644 --- a/backends/rng.c +++ b/backends/rng.c @@ -10,7 +10,7 @@ * See the COPYING file in the top-level directory. */ -#include "qemu/rng.h" +#include "sysemu/rng.h" #include "qapi/qmp/qerror.h" void rng_backend_request_entropy(RngBackend *s, size_t size, diff --git a/backends/tpm.c b/backends/tpm.c index 28148c23cf..b73580134c 100644 --- a/backends/tpm.c +++ b/backends/tpm.c @@ -12,9 +12,11 @@ * Based on backends/rng.c by Anthony Liguori */ -#include "backends/tpm.h" -#include "tpm/tpm_int.h" +#include "sysemu/tpm_backend.h" #include "qapi/qmp/qerror.h" +#include "sysemu/tpm.h" +#include "qemu/thread.h" +#include "sysemu/tpm_backend_int.h" enum TpmType tpm_backend_get_type(TPMBackend *s) { @@ -137,6 +139,40 @@ static void tpm_backend_instance_init(Object *obj) NULL); } +void tpm_backend_thread_deliver_request(TPMBackendThread *tbt) +{ + g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD, NULL); +} + +void tpm_backend_thread_create(TPMBackendThread *tbt, + GFunc func, gpointer user_data) +{ + if (!tbt->pool) { + tbt->pool = g_thread_pool_new(func, user_data, 1, TRUE, NULL); + g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL); + } +} + +void tpm_backend_thread_end(TPMBackendThread *tbt) +{ + if (tbt->pool) { + g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_END, NULL); + g_thread_pool_free(tbt->pool, FALSE, TRUE); + tbt->pool = NULL; + } +} + +void tpm_backend_thread_tpm_reset(TPMBackendThread *tbt, + GFunc func, gpointer user_data) +{ + if (!tbt->pool) { + tpm_backend_thread_create(tbt, func, user_data); + } else { + g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_TPM_RESET, + NULL); + } +} + static const TypeInfo tpm_backend_info = { .name = TYPE_TPM_BACKEND, .parent = TYPE_OBJECT, |