Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _TPM_DEV_H
0003 #define _TPM_DEV_H
0004 
0005 #include <linux/poll.h>
0006 #include "tpm.h"
0007 
0008 struct file_priv {
0009     struct tpm_chip *chip;
0010     struct tpm_space *space;
0011 
0012     struct mutex buffer_mutex;
0013     struct timer_list user_read_timer;      /* user needs to claim result */
0014     struct work_struct timeout_work;
0015     struct work_struct async_work;
0016     wait_queue_head_t async_wait;
0017     ssize_t response_length;
0018     bool response_read;
0019     bool command_enqueued;
0020 
0021     u8 data_buffer[TPM_BUFSIZE];
0022 };
0023 
0024 void tpm_common_open(struct file *file, struct tpm_chip *chip,
0025              struct file_priv *priv, struct tpm_space *space);
0026 ssize_t tpm_common_read(struct file *file, char __user *buf,
0027             size_t size, loff_t *off);
0028 ssize_t tpm_common_write(struct file *file, const char __user *buf,
0029              size_t size, loff_t *off);
0030 __poll_t tpm_common_poll(struct file *file, poll_table *wait);
0031 
0032 void tpm_common_release(struct file *file, struct file_priv *priv);
0033 #endif