1 /******************************************************************************
4 * TPM I/O interface for Xen guest OSes, v2
6 * This file is in the public domain.
10 #ifndef __XEN_PUBLIC_IO_TPMIF_H__
11 #define __XEN_PUBLIC_IO_TPMIF_H__
14 * Xenbus state machine
17 * 1. Both ends start in XenbusStateInitialising
18 * 2. Backend transitions to InitWait (frontend does not wait on this step)
19 * 3. Frontend populates ring-ref, event-channel, feature-protocol-v2
20 * 4. Frontend transitions to Initialised
21 * 5. Backend maps grant and event channel, verifies feature-protocol-v2
22 * 6. Backend transitions to Connected
23 * 7. Frontend verifies feature-protocol-v2, transitions to Connected
26 * 1. State is changed to XenbusStateClosing
27 * 2. Frontend transitions to Closed
28 * 3. Backend unmaps grant and event, changes state to InitWait
31 enum 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 */
37 /* The backend should only change state to IDLE or FINISH, while the
38 * frontend should only change to SUBMIT or CANCEL. */
41 struct vtpm_shared_page
{
42 uint32_t length
; /* request/response length in bytes */
44 uint8_t state
; /* enum vtpm_shared_page_state */
45 uint8_t locality
; /* for the current request */
48 uint8_t nr_extra_pages
; /* extra pages for long packets; may be zero */
49 uint32_t extra_pages
[0]; /* grant IDs; length in nr_extra_pages */