tpm-dev.h 944 B

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _TPM_DEV_H
  3. #define _TPM_DEV_H
  4. #include <linux/poll.h>
  5. #include "tpm.h"
  6. struct file_priv {
  7. struct tpm_chip *chip;
  8. struct tpm_space *space;
  9. struct mutex buffer_mutex;
  10. struct timer_list user_read_timer; /* user needs to claim result */
  11. struct work_struct timeout_work;
  12. struct work_struct async_work;
  13. wait_queue_head_t async_wait;
  14. ssize_t response_length;
  15. bool response_read;
  16. bool command_enqueued;
  17. u8 data_buffer[TPM_BUFSIZE];
  18. };
  19. void tpm_common_open(struct file *file, struct tpm_chip *chip,
  20. struct file_priv *priv, struct tpm_space *space);
  21. ssize_t tpm_common_read(struct file *file, char __user *buf,
  22. size_t size, loff_t *off);
  23. ssize_t tpm_common_write(struct file *file, const char __user *buf,
  24. size_t size, loff_t *off);
  25. __poll_t tpm_common_poll(struct file *file, poll_table *wait);
  26. void tpm_common_release(struct file *file, struct file_priv *priv);
  27. #endif