tpmif.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /******************************************************************************
  2. * tpmif.h
  3. *
  4. * TPM I/O interface for Xen guest OSes, v2
  5. *
  6. * This file is in the public domain.
  7. *
  8. */
  9. #ifndef __XEN_PUBLIC_IO_TPMIF_H__
  10. #define __XEN_PUBLIC_IO_TPMIF_H__
  11. /*
  12. * Xenbus state machine
  13. *
  14. * Device open:
  15. * 1. Both ends start in XenbusStateInitialising
  16. * 2. Backend transitions to InitWait (frontend does not wait on this step)
  17. * 3. Frontend populates ring-ref, event-channel, feature-protocol-v2
  18. * 4. Frontend transitions to Initialised
  19. * 5. Backend maps grant and event channel, verifies feature-protocol-v2
  20. * 6. Backend transitions to Connected
  21. * 7. Frontend verifies feature-protocol-v2, transitions to Connected
  22. *
  23. * Device close:
  24. * 1. State is changed to XenbusStateClosing
  25. * 2. Frontend transitions to Closed
  26. * 3. Backend unmaps grant and event, changes state to InitWait
  27. */
  28. enum vtpm_shared_page_state {
  29. VTPM_STATE_IDLE, /* no contents / vTPM idle / cancel complete */
  30. VTPM_STATE_SUBMIT, /* request ready / vTPM working */
  31. VTPM_STATE_FINISH, /* response ready / vTPM idle */
  32. VTPM_STATE_CANCEL, /* cancel requested / vTPM working */
  33. };
  34. /* The backend should only change state to IDLE or FINISH, while the
  35. * frontend should only change to SUBMIT or CANCEL. */
  36. struct vtpm_shared_page {
  37. uint32_t length; /* request/response length in bytes */
  38. uint8_t state; /* enum vtpm_shared_page_state */
  39. uint8_t locality; /* for the current request */
  40. uint8_t pad;
  41. uint8_t nr_extra_pages; /* extra pages for long packets; may be zero */
  42. uint32_t extra_pages[0]; /* grant IDs; length in nr_extra_pages */
  43. };
  44. #endif