/******************************************************************************1* tpmif.h2*3* TPM I/O interface for Xen guest OSes, v24*5* This file is in the public domain.6*7*/89#ifndef __XEN_PUBLIC_IO_TPMIF_H__10#define __XEN_PUBLIC_IO_TPMIF_H__1112/*13* Xenbus state machine14*15* Device open:16* 1. Both ends start in XenbusStateInitialising17* 2. Backend transitions to InitWait (frontend does not wait on this step)18* 3. Frontend populates ring-ref, event-channel, feature-protocol-v219* 4. Frontend transitions to Initialised20* 5. Backend maps grant and event channel, verifies feature-protocol-v221* 6. Backend transitions to Connected22* 7. Frontend verifies feature-protocol-v2, transitions to Connected23*24* Device close:25* 1. State is changed to XenbusStateClosing26* 2. Frontend transitions to Closed27* 3. Backend unmaps grant and event, changes state to InitWait28*/2930enum vtpm_shared_page_state {31VTPM_STATE_IDLE, /* no contents / vTPM idle / cancel complete */32VTPM_STATE_SUBMIT, /* request ready / vTPM working */33VTPM_STATE_FINISH, /* response ready / vTPM idle */34VTPM_STATE_CANCEL, /* cancel requested / vTPM working */35};36/* The backend should only change state to IDLE or FINISH, while the37* frontend should only change to SUBMIT or CANCEL. */383940struct vtpm_shared_page {41uint32_t length; /* request/response length in bytes */4243uint8_t state; /* enum vtpm_shared_page_state */44uint8_t locality; /* for the current request */45uint8_t pad;4647uint8_t nr_extra_pages; /* extra pages for long packets; may be zero */48uint32_t extra_pages[]; /* grant IDs; length in nr_extra_pages */49};5051#endif525354