| 1 | #ifndef TPM_VTPM_H |
|---|
| 2 | #define TPM_VTPM_H |
|---|
| 3 | |
|---|
| 4 | struct tpm_chip; |
|---|
| 5 | struct tpm_private; |
|---|
| 6 | |
|---|
| 7 | struct vtpm_state { |
|---|
| 8 | struct transmission *current_request; |
|---|
| 9 | spinlock_t req_list_lock; |
|---|
| 10 | wait_queue_head_t req_wait_queue; |
|---|
| 11 | |
|---|
| 12 | struct list_head queued_requests; |
|---|
| 13 | |
|---|
| 14 | struct transmission *current_response; |
|---|
| 15 | spinlock_t resp_list_lock; |
|---|
| 16 | wait_queue_head_t resp_wait_queue; // processes waiting for responses |
|---|
| 17 | |
|---|
| 18 | u8 vd_status; |
|---|
| 19 | u8 flags; |
|---|
| 20 | |
|---|
| 21 | unsigned long disconnect_time; |
|---|
| 22 | |
|---|
| 23 | /* |
|---|
| 24 | * The following is a private structure of the underlying |
|---|
| 25 | * driver. It is passed as parameter in the send function. |
|---|
| 26 | */ |
|---|
| 27 | struct tpm_private *tpm_private; |
|---|
| 28 | }; |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | enum vdev_status { |
|---|
| 32 | TPM_VD_STATUS_DISCONNECTED = 0x0, |
|---|
| 33 | TPM_VD_STATUS_CONNECTED = 0x1 |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | /* this function is called from tpm_vtpm.c */ |
|---|
| 37 | int vtpm_vd_send(struct tpm_private * tp, |
|---|
| 38 | const u8 * buf, size_t count, void *ptr); |
|---|
| 39 | |
|---|
| 40 | /* these functions are offered by tpm_vtpm.c */ |
|---|
| 41 | struct tpm_chip *init_vtpm(struct device *, |
|---|
| 42 | struct tpm_private *); |
|---|
| 43 | void cleanup_vtpm(struct device *); |
|---|
| 44 | int vtpm_vd_recv(const struct tpm_chip* chip, |
|---|
| 45 | const unsigned char *buffer, size_t count, void *ptr); |
|---|
| 46 | void vtpm_vd_status(const struct tpm_chip *, u8 status); |
|---|
| 47 | |
|---|
| 48 | static inline struct tpm_private *tpm_private_from_dev(struct device *dev) |
|---|
| 49 | { |
|---|
| 50 | struct tpm_chip *chip = dev_get_drvdata(dev); |
|---|
| 51 | struct vtpm_state *vtpms = chip_get_private(chip); |
|---|
| 52 | return vtpms->tpm_private; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | #endif |
|---|