Back to home page

OSCL-LXR

 
 

    


0001 /******************************************************************************
0002  * tpmif.h
0003  *
0004  * TPM I/O interface for Xen guest OSes, v2
0005  *
0006  * This file is in the public domain.
0007  *
0008  */
0009 
0010 #ifndef __XEN_PUBLIC_IO_TPMIF_H__
0011 #define __XEN_PUBLIC_IO_TPMIF_H__
0012 
0013 /*
0014  * Xenbus state machine
0015  *
0016  * Device open:
0017  *   1. Both ends start in XenbusStateInitialising
0018  *   2. Backend transitions to InitWait (frontend does not wait on this step)
0019  *   3. Frontend populates ring-ref, event-channel, feature-protocol-v2
0020  *   4. Frontend transitions to Initialised
0021  *   5. Backend maps grant and event channel, verifies feature-protocol-v2
0022  *   6. Backend transitions to Connected
0023  *   7. Frontend verifies feature-protocol-v2, transitions to Connected
0024  *
0025  * Device close:
0026  *   1. State is changed to XenbusStateClosing
0027  *   2. Frontend transitions to Closed
0028  *   3. Backend unmaps grant and event, changes state to InitWait
0029  */
0030 
0031 enum vtpm_shared_page_state {
0032     VTPM_STATE_IDLE,         /* no contents / vTPM idle / cancel complete */
0033     VTPM_STATE_SUBMIT,       /* request ready / vTPM working */
0034     VTPM_STATE_FINISH,       /* response ready / vTPM idle */
0035     VTPM_STATE_CANCEL,       /* cancel requested / vTPM working */
0036 };
0037 /* The backend should only change state to IDLE or FINISH, while the
0038  * frontend should only change to SUBMIT or CANCEL. */
0039 
0040 
0041 struct vtpm_shared_page {
0042     uint32_t length;         /* request/response length in bytes */
0043 
0044     uint8_t state;           /* enum vtpm_shared_page_state */
0045     uint8_t locality;        /* for the current request */
0046     uint8_t pad;
0047 
0048     uint8_t nr_extra_pages;  /* extra pages for long packets; may be zero */
0049     uint32_t extra_pages[]; /* grant IDs; length in nr_extra_pages */
0050 };
0051 
0052 #endif