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