UDM-tpm.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. The U-Boot Driver Model Project
  2. ===============================
  3. TPM system analysis
  4. ===================
  5. Marek Vasut <marek.vasut@gmail.com>
  6. 2012-02-23
  7. I) Overview
  8. -----------
  9. There is currently only one TPM chip driver available and therefore the API
  10. controlling it is very much based on this. The API is very simple:
  11. int tis_open(void);
  12. int tis_close(void);
  13. int tis_sendrecv(const u8 *sendbuf, size_t send_size,
  14. u8 *recvbuf, size_t *recv_len);
  15. The command operating the TPM chip only provides operations to send and receive
  16. bytes from the chip.
  17. II) Approach
  18. ------------
  19. The API can't be generalised too much considering there's only one TPM chip
  20. supported. But it's a good idea to split the tis_sendrecv() function in two
  21. functions. Therefore the new API will use register the TPM chip by calling:
  22. tpm_device_register(struct instance *i, const struct tpm_ops *ops);
  23. And the struct tpm_ops will contain the following members:
  24. struct tpm_ops {
  25. int (*tpm_open)(struct instance *i);
  26. int (*tpm_close)(struct instance *i);
  27. int (*tpm_send)(const uint8_t *buf, const size_t size);
  28. int (*tpm_recv)(uint8_t *buf, size_t *size);
  29. };
  30. The behaviour of "tpm_open()" and "tpm_close()" will basically copy the
  31. behaviour of "tis_open()" and "tis_close()". The "tpm_send()" will be based on
  32. the "tis_senddata()" and "tis_recv()" will be based on "tis_readresponse()".
  33. III) Analysis of in-tree drivers
  34. --------------------------------
  35. There is only one in-tree driver present, the "drivers/tpm/generic_lpc_tpm.c",
  36. which will be simply converted as outlined in previous chapter.