mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
sysemu: avoid proliferation of include/ subdirectories
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
bdee56f546
commit
dccfcd0e5f
78 changed files with 78 additions and 78 deletions
20
include/sysemu/bt.h
Normal file
20
include/sysemu/bt.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef BT_HOST_H
|
||||
#define BT_HOST_H
|
||||
|
||||
/* BT HCI info */
|
||||
|
||||
struct HCIInfo {
|
||||
int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr);
|
||||
void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len);
|
||||
void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len);
|
||||
void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len);
|
||||
void *opaque;
|
||||
void (*evt_recv)(void *opaque, const uint8_t *data, int len);
|
||||
void (*acl_recv)(void *opaque, const uint8_t *data, int len);
|
||||
};
|
||||
|
||||
/* bt-host.c */
|
||||
struct HCIInfo *bt_host_hci(const char *id);
|
||||
struct HCIInfo *qemu_next_hci(void);
|
||||
|
||||
#endif
|
306
include/sysemu/char.h
Normal file
306
include/sysemu/char.h
Normal file
|
@ -0,0 +1,306 @@
|
|||
#ifndef QEMU_CHAR_H
|
||||
#define QEMU_CHAR_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/config-file.h"
|
||||
#include "block/aio.h"
|
||||
#include "qapi/qmp/qobject.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
/* character device */
|
||||
|
||||
#define CHR_EVENT_BREAK 0 /* serial break char */
|
||||
#define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */
|
||||
#define CHR_EVENT_OPENED 2 /* new connection established */
|
||||
#define CHR_EVENT_MUX_IN 3 /* mux-focus was set to this terminal */
|
||||
#define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */
|
||||
#define CHR_EVENT_CLOSED 5 /* connection closed */
|
||||
|
||||
|
||||
#define CHR_IOCTL_SERIAL_SET_PARAMS 1
|
||||
typedef struct {
|
||||
int speed;
|
||||
int parity;
|
||||
int data_bits;
|
||||
int stop_bits;
|
||||
} QEMUSerialSetParams;
|
||||
|
||||
#define CHR_IOCTL_SERIAL_SET_BREAK 2
|
||||
|
||||
#define CHR_IOCTL_PP_READ_DATA 3
|
||||
#define CHR_IOCTL_PP_WRITE_DATA 4
|
||||
#define CHR_IOCTL_PP_READ_CONTROL 5
|
||||
#define CHR_IOCTL_PP_WRITE_CONTROL 6
|
||||
#define CHR_IOCTL_PP_READ_STATUS 7
|
||||
#define CHR_IOCTL_PP_EPP_READ_ADDR 8
|
||||
#define CHR_IOCTL_PP_EPP_READ 9
|
||||
#define CHR_IOCTL_PP_EPP_WRITE_ADDR 10
|
||||
#define CHR_IOCTL_PP_EPP_WRITE 11
|
||||
#define CHR_IOCTL_PP_DATA_DIR 12
|
||||
|
||||
#define CHR_IOCTL_SERIAL_SET_TIOCM 13
|
||||
#define CHR_IOCTL_SERIAL_GET_TIOCM 14
|
||||
|
||||
#define CHR_TIOCM_CTS 0x020
|
||||
#define CHR_TIOCM_CAR 0x040
|
||||
#define CHR_TIOCM_DSR 0x100
|
||||
#define CHR_TIOCM_RI 0x080
|
||||
#define CHR_TIOCM_DTR 0x002
|
||||
#define CHR_TIOCM_RTS 0x004
|
||||
|
||||
typedef void IOEventHandler(void *opaque, int event);
|
||||
|
||||
struct CharDriverState {
|
||||
void (*init)(struct CharDriverState *s);
|
||||
int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len);
|
||||
GSource *(*chr_add_watch)(struct CharDriverState *s, GIOCondition cond);
|
||||
void (*chr_update_read_handler)(struct CharDriverState *s);
|
||||
int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg);
|
||||
int (*get_msgfd)(struct CharDriverState *s);
|
||||
int (*chr_add_client)(struct CharDriverState *chr, int fd);
|
||||
IOEventHandler *chr_event;
|
||||
IOCanReadHandler *chr_can_read;
|
||||
IOReadHandler *chr_read;
|
||||
void *handler_opaque;
|
||||
void (*chr_close)(struct CharDriverState *chr);
|
||||
void (*chr_accept_input)(struct CharDriverState *chr);
|
||||
void (*chr_set_echo)(struct CharDriverState *chr, bool echo);
|
||||
void (*chr_set_fe_open)(struct CharDriverState *chr, int fe_open);
|
||||
void *opaque;
|
||||
int idle_tag;
|
||||
char *label;
|
||||
char *filename;
|
||||
int be_open;
|
||||
int fe_open;
|
||||
int explicit_fe_open;
|
||||
int avail_connections;
|
||||
QemuOpts *opts;
|
||||
QTAILQ_ENTRY(CharDriverState) next;
|
||||
};
|
||||
|
||||
/**
|
||||
* @qemu_chr_new_from_opts:
|
||||
*
|
||||
* Create a new character backend from a QemuOpts list.
|
||||
*
|
||||
* @opts see qemu-config.c for a list of valid options
|
||||
* @init not sure..
|
||||
*
|
||||
* Returns: a new character backend
|
||||
*/
|
||||
CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts,
|
||||
void (*init)(struct CharDriverState *s),
|
||||
Error **errp);
|
||||
|
||||
/**
|
||||
* @qemu_chr_new:
|
||||
*
|
||||
* Create a new character backend from a URI.
|
||||
*
|
||||
* @label the name of the backend
|
||||
* @filename the URI
|
||||
* @init not sure..
|
||||
*
|
||||
* Returns: a new character backend
|
||||
*/
|
||||
CharDriverState *qemu_chr_new(const char *label, const char *filename,
|
||||
void (*init)(struct CharDriverState *s));
|
||||
|
||||
/**
|
||||
* @qemu_chr_delete:
|
||||
*
|
||||
* Destroy a character backend.
|
||||
*/
|
||||
void qemu_chr_delete(CharDriverState *chr);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_set_echo:
|
||||
*
|
||||
* Ask the backend to override its normal echo setting. This only really
|
||||
* applies to the stdio backend and is used by the QMP server such that you
|
||||
* can see what you type if you try to type QMP commands.
|
||||
*
|
||||
* @echo true to enable echo, false to disable echo
|
||||
*/
|
||||
void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_set_open:
|
||||
*
|
||||
* Set character frontend open status. This is an indication that the
|
||||
* front end is ready (or not) to begin doing I/O.
|
||||
*/
|
||||
void qemu_chr_fe_set_open(struct CharDriverState *chr, int fe_open);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_printf:
|
||||
*
|
||||
* Write to a character backend using a printf style interface.
|
||||
*
|
||||
* @fmt see #printf
|
||||
*/
|
||||
void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
|
||||
int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
|
||||
GIOFunc func, void *user_data);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_write:
|
||||
*
|
||||
* Write data to a character backend from the front end. This function will
|
||||
* send data from the front end to the back end.
|
||||
*
|
||||
* @buf the data
|
||||
* @len the number of bytes to send
|
||||
*
|
||||
* Returns: the number of bytes consumed
|
||||
*/
|
||||
int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_write_all:
|
||||
*
|
||||
* Write data to a character backend from the front end. This function will
|
||||
* send data from the front end to the back end. Unlike @qemu_chr_fe_write,
|
||||
* this function will block if the back end cannot consume all of the data
|
||||
* attempted to be written.
|
||||
*
|
||||
* @buf the data
|
||||
* @len the number of bytes to send
|
||||
*
|
||||
* Returns: the number of bytes consumed
|
||||
*/
|
||||
int qemu_chr_fe_write_all(CharDriverState *s, const uint8_t *buf, int len);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_ioctl:
|
||||
*
|
||||
* Issue a device specific ioctl to a backend.
|
||||
*
|
||||
* @cmd see CHR_IOCTL_*
|
||||
* @arg the data associated with @cmd
|
||||
*
|
||||
* Returns: if @cmd is not supported by the backend, -ENOTSUP, otherwise the
|
||||
* return value depends on the semantics of @cmd
|
||||
*/
|
||||
int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_get_msgfd:
|
||||
*
|
||||
* For backends capable of fd passing, return the latest file descriptor passed
|
||||
* by a client.
|
||||
*
|
||||
* Returns: -1 if fd passing isn't supported or there is no pending file
|
||||
* descriptor. If a file descriptor is returned, subsequent calls to
|
||||
* this function will return -1 until a client sends a new file
|
||||
* descriptor.
|
||||
*/
|
||||
int qemu_chr_fe_get_msgfd(CharDriverState *s);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_claim:
|
||||
*
|
||||
* Claim a backend before using it, should be called before calling
|
||||
* qemu_chr_add_handlers().
|
||||
*
|
||||
* Returns: -1 if the backend is already in use by another frontend, 0 on
|
||||
* success.
|
||||
*/
|
||||
int qemu_chr_fe_claim(CharDriverState *s);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_claim_no_fail:
|
||||
*
|
||||
* Like qemu_chr_fe_claim, but will exit qemu with an error when the
|
||||
* backend is already in use.
|
||||
*/
|
||||
void qemu_chr_fe_claim_no_fail(CharDriverState *s);
|
||||
|
||||
/**
|
||||
* @qemu_chr_fe_claim:
|
||||
*
|
||||
* Release a backend for use by another frontend.
|
||||
*
|
||||
* Returns: -1 if the backend is already in use by another frontend, 0 on
|
||||
* success.
|
||||
*/
|
||||
void qemu_chr_fe_release(CharDriverState *s);
|
||||
|
||||
/**
|
||||
* @qemu_chr_be_can_write:
|
||||
*
|
||||
* Determine how much data the front end can currently accept. This function
|
||||
* returns the number of bytes the front end can accept. If it returns 0, the
|
||||
* front end cannot receive data at the moment. The function must be polled
|
||||
* to determine when data can be received.
|
||||
*
|
||||
* Returns: the number of bytes the front end can receive via @qemu_chr_be_write
|
||||
*/
|
||||
int qemu_chr_be_can_write(CharDriverState *s);
|
||||
|
||||
/**
|
||||
* @qemu_chr_be_write:
|
||||
*
|
||||
* Write data from the back end to the front end. Before issuing this call,
|
||||
* the caller should call @qemu_chr_be_can_write to determine how much data
|
||||
* the front end can currently accept.
|
||||
*
|
||||
* @buf a buffer to receive data from the front end
|
||||
* @len the number of bytes to receive from the front end
|
||||
*/
|
||||
void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
|
||||
|
||||
|
||||
/**
|
||||
* @qemu_chr_be_event:
|
||||
*
|
||||
* Send an event from the back end to the front end.
|
||||
*
|
||||
* @event the event to send
|
||||
*/
|
||||
void qemu_chr_be_event(CharDriverState *s, int event);
|
||||
|
||||
void qemu_chr_add_handlers(CharDriverState *s,
|
||||
IOCanReadHandler *fd_can_read,
|
||||
IOReadHandler *fd_read,
|
||||
IOEventHandler *fd_event,
|
||||
void *opaque);
|
||||
|
||||
void qemu_chr_be_generic_open(CharDriverState *s);
|
||||
void qemu_chr_accept_input(CharDriverState *s);
|
||||
int qemu_chr_add_client(CharDriverState *s, int fd);
|
||||
void qemu_chr_info_print(Monitor *mon, const QObject *ret_data);
|
||||
void qemu_chr_info(Monitor *mon, QObject **ret_data);
|
||||
CharDriverState *qemu_chr_find(const char *name);
|
||||
|
||||
QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
|
||||
|
||||
void register_char_driver(const char *name, CharDriverState *(*open)(QemuOpts *));
|
||||
void register_char_driver_qapi(const char *name, int kind,
|
||||
void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp));
|
||||
|
||||
/* add an eventfd to the qemu devices that are polled */
|
||||
CharDriverState *qemu_chr_open_eventfd(int eventfd);
|
||||
|
||||
extern int term_escape_char;
|
||||
|
||||
/* memory chardev */
|
||||
void qemu_chr_init_mem(CharDriverState *chr);
|
||||
void qemu_chr_close_mem(CharDriverState *chr);
|
||||
QString *qemu_chr_mem_to_qs(CharDriverState *chr);
|
||||
size_t qemu_chr_mem_osize(const CharDriverState *chr);
|
||||
|
||||
CharDriverState *qemu_char_get_next_serial(void);
|
||||
|
||||
/* msmouse */
|
||||
CharDriverState *qemu_chr_open_msmouse(void);
|
||||
|
||||
/* baum.c */
|
||||
CharDriverState *chr_baum_init(void);
|
||||
|
||||
#endif
|
22
include/sysemu/rng-random.h
Normal file
22
include/sysemu/rng-random.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* QEMU Random Number Generator Backend
|
||||
*
|
||||
* Copyright IBM, Corp. 2012
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
#ifndef QEMU_RNG_RANDOM_H
|
||||
#define QEMU_RNG_RANDOM_H
|
||||
|
||||
#include "qom/object.h"
|
||||
|
||||
#define TYPE_RNG_RANDOM "rng-random"
|
||||
#define RNG_RANDOM(obj) OBJECT_CHECK(RndRandom, (obj), TYPE_RNG_RANDOM)
|
||||
|
||||
typedef struct RndRandom RndRandom;
|
||||
|
||||
#endif
|
93
include/sysemu/rng.h
Normal file
93
include/sysemu/rng.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* QEMU Random Number Generator Backend
|
||||
*
|
||||
* Copyright IBM, Corp. 2012
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_RNG_H
|
||||
#define QEMU_RNG_H
|
||||
|
||||
#include "qom/object.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
#define TYPE_RNG_BACKEND "rng-backend"
|
||||
#define RNG_BACKEND(obj) \
|
||||
OBJECT_CHECK(RngBackend, (obj), TYPE_RNG_BACKEND)
|
||||
#define RNG_BACKEND_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(RngBackendClass, (obj), TYPE_RNG_BACKEND)
|
||||
#define RNG_BACKEND_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(RngBackendClass, (klass), TYPE_RNG_BACKEND)
|
||||
|
||||
typedef struct RngBackendClass RngBackendClass;
|
||||
typedef struct RngBackend RngBackend;
|
||||
|
||||
typedef void (EntropyReceiveFunc)(void *opaque,
|
||||
const void *data,
|
||||
size_t size);
|
||||
|
||||
struct RngBackendClass
|
||||
{
|
||||
ObjectClass parent_class;
|
||||
|
||||
void (*request_entropy)(RngBackend *s, size_t size,
|
||||
EntropyReceiveFunc *recieve_entropy, void *opaque);
|
||||
void (*cancel_requests)(RngBackend *s);
|
||||
|
||||
void (*opened)(RngBackend *s, Error **errp);
|
||||
};
|
||||
|
||||
struct RngBackend
|
||||
{
|
||||
Object parent;
|
||||
|
||||
/*< protected >*/
|
||||
bool opened;
|
||||
};
|
||||
|
||||
/**
|
||||
* rng_backend_request_entropy:
|
||||
* @s: the backend to request entropy from
|
||||
* @size: the number of bytes of data to request
|
||||
* @receive_entropy: a function to be invoked when entropy is available
|
||||
* @opaque: data that should be passed to @receive_entropy
|
||||
*
|
||||
* This function is used by the front-end to request entropy from an entropy
|
||||
* source. This function can be called multiple times before @receive_entropy
|
||||
* is invoked with different values of @receive_entropy and @opaque. The
|
||||
* backend will queue each request and handle appropriately.
|
||||
*
|
||||
* The backend does not need to pass the full amount of data to @receive_entropy
|
||||
* but will pass a value greater than 0.
|
||||
*/
|
||||
void rng_backend_request_entropy(RngBackend *s, size_t size,
|
||||
EntropyReceiveFunc *receive_entropy,
|
||||
void *opaque);
|
||||
|
||||
/**
|
||||
* rng_backend_cancel_requests:
|
||||
* @s: the backend to cancel all pending requests in
|
||||
*
|
||||
* Cancels all pending requests submitted by @rng_backend_request_entropy. This
|
||||
* should be used by a device during reset or in preparation for live migration
|
||||
* to stop tracking any request.
|
||||
*/
|
||||
void rng_backend_cancel_requests(RngBackend *s);
|
||||
|
||||
/**
|
||||
* rng_backend_open:
|
||||
* @s: the backend to open
|
||||
* @errp: a pointer to return the #Error object if an error occurs.
|
||||
*
|
||||
* This function will open the backend if it is not already open. Calling this
|
||||
* function on an already opened backend will not result in an error.
|
||||
*/
|
||||
void rng_backend_open(RngBackend *s, Error **errp);
|
||||
|
||||
#endif
|
209
include/sysemu/tpm_backend.h
Normal file
209
include/sysemu/tpm_backend.h
Normal file
|
@ -0,0 +1,209 @@
|
|||
/*
|
||||
* QEMU TPM Backend
|
||||
*
|
||||
* Copyright IBM, Corp. 2013
|
||||
*
|
||||
* Authors:
|
||||
* Stefan Berger <stefanb@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef _QEMU_TPM_H
|
||||
#define _QEMU_TPM_H
|
||||
|
||||
#include "qom/object.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi-types.h"
|
||||
#include "qemu/option.h"
|
||||
#include "sysemu/tpm.h"
|
||||
|
||||
#define TYPE_TPM_BACKEND "tpm-backend"
|
||||
#define TPM_BACKEND(obj) \
|
||||
OBJECT_CHECK(TPMBackend, (obj), TYPE_TPM_BACKEND)
|
||||
#define TPM_BACKEND_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(TPMBackendClass, (obj), TYPE_TPM_BACKEND)
|
||||
#define TPM_BACKEND_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(TPMBackendClass, (klass), TYPE_TPM_BACKEND)
|
||||
|
||||
typedef struct TPMBackendClass TPMBackendClass;
|
||||
typedef struct TPMBackend TPMBackend;
|
||||
|
||||
typedef struct TPMDriverOps TPMDriverOps;
|
||||
|
||||
struct TPMBackendClass {
|
||||
ObjectClass parent_class;
|
||||
|
||||
const TPMDriverOps *ops;
|
||||
|
||||
void (*opened)(TPMBackend *s, Error **errp);
|
||||
};
|
||||
|
||||
struct TPMBackend {
|
||||
Object parent;
|
||||
|
||||
/*< protected >*/
|
||||
bool opened;
|
||||
|
||||
char *id;
|
||||
enum TpmModel fe_model;
|
||||
char *path;
|
||||
char *cancel_path;
|
||||
const TPMDriverOps *ops;
|
||||
|
||||
QLIST_ENTRY(TPMBackend) list;
|
||||
};
|
||||
|
||||
typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty);
|
||||
|
||||
typedef struct TPMSizedBuffer {
|
||||
uint32_t size;
|
||||
uint8_t *buffer;
|
||||
} TPMSizedBuffer;
|
||||
|
||||
struct TPMDriverOps {
|
||||
enum TpmType type;
|
||||
/* get a descriptive text of the backend to display to the user */
|
||||
const char *(*desc)(void);
|
||||
|
||||
TPMBackend *(*create)(QemuOpts *opts, const char *id);
|
||||
void (*destroy)(TPMBackend *t);
|
||||
|
||||
/* initialize the backend */
|
||||
int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb);
|
||||
/* start up the TPM on the backend */
|
||||
int (*startup_tpm)(TPMBackend *t);
|
||||
/* returns true if nothing will ever answer TPM requests */
|
||||
bool (*had_startup_error)(TPMBackend *t);
|
||||
|
||||
size_t (*realloc_buffer)(TPMSizedBuffer *sb);
|
||||
|
||||
void (*deliver_request)(TPMBackend *t);
|
||||
|
||||
void (*reset)(TPMBackend *t);
|
||||
|
||||
void (*cancel_cmd)(TPMBackend *t);
|
||||
|
||||
bool (*get_tpm_established_flag)(TPMBackend *t);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* tpm_backend_get_type:
|
||||
* @s: the backend
|
||||
*
|
||||
* Returns the TpmType of the backend.
|
||||
*/
|
||||
enum TpmType tpm_backend_get_type(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_get_desc:
|
||||
* @s: the backend
|
||||
*
|
||||
* Returns a human readable description of the backend.
|
||||
*/
|
||||
const char *tpm_backend_get_desc(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_destroy:
|
||||
* @s: the backend to destroy
|
||||
*/
|
||||
void tpm_backend_destroy(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_init:
|
||||
* @s: the backend to initialized
|
||||
* @state: TPMState
|
||||
* @datacb: callback for sending data to frontend
|
||||
*
|
||||
* Initialize the backend with the given variables.
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
int tpm_backend_init(TPMBackend *s, TPMState *state,
|
||||
TPMRecvDataCB *datacb);
|
||||
|
||||
/**
|
||||
* tpm_backend_startup_tpm:
|
||||
* @s: the backend whose TPM support is to be started
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
int tpm_backend_startup_tpm(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_had_startup_error:
|
||||
* @s: the backend to query for a statup error
|
||||
*
|
||||
* Check whether the backend had an error during startup. Returns
|
||||
* false if no error occurred and the backend can be used, true
|
||||
* otherwise.
|
||||
*/
|
||||
bool tpm_backend_had_startup_error(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_realloc_buffer:
|
||||
* @s: the backend
|
||||
* @sb: the TPMSizedBuffer to re-allocated to the size suitable for the
|
||||
* backend.
|
||||
*
|
||||
* This function returns the size of the allocated buffer
|
||||
*/
|
||||
size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb);
|
||||
|
||||
/**
|
||||
* tpm_backend_deliver_request:
|
||||
* @s: the backend to send the request to
|
||||
*
|
||||
* Send a request to the backend. The backend will then send the request
|
||||
* to the TPM implementation.
|
||||
*/
|
||||
void tpm_backend_deliver_request(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_reset:
|
||||
* @s: the backend to reset
|
||||
*
|
||||
* Reset the backend into a well defined state with all previous errors
|
||||
* reset.
|
||||
*/
|
||||
void tpm_backend_reset(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_cancel_cmd:
|
||||
* @s: the backend
|
||||
*
|
||||
* Cancel any ongoing command being processed by the TPM implementation
|
||||
* on behalf of the QEMU guest.
|
||||
*/
|
||||
void tpm_backend_cancel_cmd(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_get_tpm_established_flag:
|
||||
* @s: the backend
|
||||
*
|
||||
* Get the TPM establishment flag. This function may be called very
|
||||
* frequently by the frontend since for example in the TIS implementation
|
||||
* this flag is part of a register.
|
||||
*/
|
||||
bool tpm_backend_get_tpm_established_flag(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_open:
|
||||
* @s: the backend to open
|
||||
* @errp: a pointer to return the #Error object if an error occurs.
|
||||
*
|
||||
* This function will open the backend if it is not already open. Calling this
|
||||
* function on an already opened backend will not result in an error.
|
||||
*/
|
||||
void tpm_backend_open(TPMBackend *s, Error **errp);
|
||||
|
||||
TPMBackend *qemu_find_tpm(const char *id);
|
||||
|
||||
const TPMDriverOps *tpm_get_backend_driver(const char *type);
|
||||
int tpm_register_model(enum TpmModel model);
|
||||
int tpm_register_driver(const TPMDriverOps *tdo);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue