brintos

brintos / linux-shallow public Read only

0
0
Text · 1.7 KiB · f8aa8ba Raw
53 lines · c
1/******************************************************************************2 * tpmif.h3 *4 * TPM I/O interface for Xen guest OSes, v25 *6 * This file is in the public domain.7 *8 */9 10#ifndef __XEN_PUBLIC_IO_TPMIF_H__11#define __XEN_PUBLIC_IO_TPMIF_H__12 13/*14 * Xenbus state machine15 *16 * Device open:17 *   1. Both ends start in XenbusStateInitialising18 *   2. Backend transitions to InitWait (frontend does not wait on this step)19 *   3. Frontend populates ring-ref, event-channel, feature-protocol-v220 *   4. Frontend transitions to Initialised21 *   5. Backend maps grant and event channel, verifies feature-protocol-v222 *   6. Backend transitions to Connected23 *   7. Frontend verifies feature-protocol-v2, transitions to Connected24 *25 * Device close:26 *   1. State is changed to XenbusStateClosing27 *   2. Frontend transitions to Closed28 *   3. Backend unmaps grant and event, changes state to InitWait29 */30 31enum vtpm_shared_page_state {32	VTPM_STATE_IDLE,         /* no contents / vTPM idle / cancel complete */33	VTPM_STATE_SUBMIT,       /* request ready / vTPM working */34	VTPM_STATE_FINISH,       /* response ready / vTPM idle */35	VTPM_STATE_CANCEL,       /* cancel requested / vTPM working */36};37/* The backend should only change state to IDLE or FINISH, while the38 * frontend should only change to SUBMIT or CANCEL. */39 40 41struct vtpm_shared_page {42	uint32_t length;         /* request/response length in bytes */43 44	uint8_t state;           /* enum vtpm_shared_page_state */45	uint8_t locality;        /* for the current request */46	uint8_t pad;47 48	uint8_t nr_extra_pages;  /* extra pages for long packets; may be zero */49	uint32_t extra_pages[]; /* grant IDs; length in nr_extra_pages */50};51 52#endif53