diff options
Diffstat (limited to 'include/linux/tpm.h')
-rw-r--r-- | include/linux/tpm.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 5a090f5ab335..bcdd3790e94d 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h | |||
@@ -24,11 +24,6 @@ | |||
24 | 24 | ||
25 | #define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ | 25 | #define TPM_DIGEST_SIZE 20 /* Max TPM v1.2 PCR size */ |
26 | 26 | ||
27 | /* | ||
28 | * Chip num is this value or a valid tpm idx | ||
29 | */ | ||
30 | #define TPM_ANY_NUM 0xFFFF | ||
31 | |||
32 | struct tpm_chip; | 27 | struct tpm_chip; |
33 | struct trusted_key_payload; | 28 | struct trusted_key_payload; |
34 | struct trusted_key_options; | 29 | struct trusted_key_options; |
@@ -50,46 +45,52 @@ struct tpm_class_ops { | |||
50 | unsigned long *timeout_cap); | 45 | unsigned long *timeout_cap); |
51 | int (*request_locality)(struct tpm_chip *chip, int loc); | 46 | int (*request_locality)(struct tpm_chip *chip, int loc); |
52 | void (*relinquish_locality)(struct tpm_chip *chip, int loc); | 47 | void (*relinquish_locality)(struct tpm_chip *chip, int loc); |
48 | void (*clk_enable)(struct tpm_chip *chip, bool value); | ||
53 | }; | 49 | }; |
54 | 50 | ||
55 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) | 51 | #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) |
56 | 52 | ||
57 | extern int tpm_is_tpm2(u32 chip_num); | 53 | extern int tpm_is_tpm2(struct tpm_chip *chip); |
58 | extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); | 54 | extern int tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf); |
59 | extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); | 55 | extern int tpm_pcr_extend(struct tpm_chip *chip, int pcr_idx, const u8 *hash); |
60 | extern int tpm_send(u32 chip_num, void *cmd, size_t buflen); | 56 | extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen); |
61 | extern int tpm_get_random(u32 chip_num, u8 *data, size_t max); | 57 | extern int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max); |
62 | extern int tpm_seal_trusted(u32 chip_num, | 58 | extern int tpm_seal_trusted(struct tpm_chip *chip, |
63 | struct trusted_key_payload *payload, | 59 | struct trusted_key_payload *payload, |
64 | struct trusted_key_options *options); | 60 | struct trusted_key_options *options); |
65 | extern int tpm_unseal_trusted(u32 chip_num, | 61 | extern int tpm_unseal_trusted(struct tpm_chip *chip, |
66 | struct trusted_key_payload *payload, | 62 | struct trusted_key_payload *payload, |
67 | struct trusted_key_options *options); | 63 | struct trusted_key_options *options); |
68 | #else | 64 | #else |
69 | static inline int tpm_is_tpm2(u32 chip_num) | 65 | static inline int tpm_is_tpm2(struct tpm_chip *chip) |
70 | { | 66 | { |
71 | return -ENODEV; | 67 | return -ENODEV; |
72 | } | 68 | } |
73 | static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { | 69 | static inline int tpm_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf) |
70 | { | ||
74 | return -ENODEV; | 71 | return -ENODEV; |
75 | } | 72 | } |
76 | static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) { | 73 | static inline int tpm_pcr_extend(struct tpm_chip *chip, int pcr_idx, |
74 | const u8 *hash) | ||
75 | { | ||
77 | return -ENODEV; | 76 | return -ENODEV; |
78 | } | 77 | } |
79 | static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) { | 78 | static inline int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) |
79 | { | ||
80 | return -ENODEV; | 80 | return -ENODEV; |
81 | } | 81 | } |
82 | static inline int tpm_get_random(u32 chip_num, u8 *data, size_t max) { | 82 | static inline int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max) |
83 | { | ||
83 | return -ENODEV; | 84 | return -ENODEV; |
84 | } | 85 | } |
85 | 86 | ||
86 | static inline int tpm_seal_trusted(u32 chip_num, | 87 | static inline int tpm_seal_trusted(struct tpm_chip *chip, |
87 | struct trusted_key_payload *payload, | 88 | struct trusted_key_payload *payload, |
88 | struct trusted_key_options *options) | 89 | struct trusted_key_options *options) |
89 | { | 90 | { |
90 | return -ENODEV; | 91 | return -ENODEV; |
91 | } | 92 | } |
92 | static inline int tpm_unseal_trusted(u32 chip_num, | 93 | static inline int tpm_unseal_trusted(struct tpm_chip *chip, |
93 | struct trusted_key_payload *payload, | 94 | struct trusted_key_payload *payload, |
94 | struct trusted_key_options *options) | 95 | struct trusted_key_options *options) |
95 | { | 96 | { |