aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.h
diff options
context:
space:
mode:
authorRajiv Andrade <srajiv@linux.vnet.ibm.com>2009-02-02 12:23:43 -0500
committerJames Morris <jmorris@namei.org>2009-02-02 19:23:09 -0500
commit0883743825e34b81f3ff78aaee3a97cba57586c5 (patch)
tree9b9e7f2d4dca611aee61c7c0245956f5fd830d91 /drivers/char/tpm/tpm.h
parentfaa3aad75a959f55e7783f4dc7840253c7506571 (diff)
TPM: sysfs functions consolidation
According to Dave Hansen's comments on the tpm_show_*, some of these functions present a pattern when allocating data[] memory space and also when setting its content. A new function was created so that this pattern could be consolidated. Also, replaced the data[] command vectors and its indexes by meaningful structures as pointed out by Matt Helsley too. Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/char/tpm/tpm.h')
-rw-r--r--drivers/char/tpm/tpm.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 8e30df4a4388..d64f6b7e5b82 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -123,6 +123,130 @@ static inline void tpm_write_index(int base, int index, int value)
123 outb(index, base); 123 outb(index, base);
124 outb(value & 0xFF, base+1); 124 outb(value & 0xFF, base+1);
125} 125}
126struct tpm_input_header {
127 __be16 tag;
128 __be32 length;
129 __be32 ordinal;
130}__attribute__((packed));
131
132struct tpm_output_header {
133 __be16 tag;
134 __be32 length;
135 __be32 return_code;
136}__attribute__((packed));
137
138struct stclear_flags_t {
139 __be16 tag;
140 u8 deactivated;
141 u8 disableForceClear;
142 u8 physicalPresence;
143 u8 physicalPresenceLock;
144 u8 bGlobalLock;
145}__attribute__((packed));
146
147struct tpm_version_t {
148 u8 Major;
149 u8 Minor;
150 u8 revMajor;
151 u8 revMinor;
152}__attribute__((packed));
153
154struct tpm_version_1_2_t {
155 __be16 tag;
156 u8 Major;
157 u8 Minor;
158 u8 revMajor;
159 u8 revMinor;
160}__attribute__((packed));
161
162struct timeout_t {
163 __be32 a;
164 __be32 b;
165 __be32 c;
166 __be32 d;
167}__attribute__((packed));
168
169struct duration_t {
170 __be32 tpm_short;
171 __be32 tpm_medium;
172 __be32 tpm_long;
173}__attribute__((packed));
174
175struct permanent_flags_t {
176 __be16 tag;
177 u8 disable;
178 u8 ownership;
179 u8 deactivated;
180 u8 readPubek;
181 u8 disableOwnerClear;
182 u8 allowMaintenance;
183 u8 physicalPresenceLifetimeLock;
184 u8 physicalPresenceHWEnable;
185 u8 physicalPresenceCMDEnable;
186 u8 CEKPUsed;
187 u8 TPMpost;
188 u8 TPMpostLock;
189 u8 FIPS;
190 u8 operator;
191 u8 enableRevokeEK;
192 u8 nvLocked;
193 u8 readSRKPub;
194 u8 tpmEstablished;
195 u8 maintenanceDone;
196 u8 disableFullDALogicInfo;
197}__attribute__((packed));
198
199typedef union {
200 struct permanent_flags_t perm_flags;
201 struct stclear_flags_t stclear_flags;
202 bool owned;
203 __be32 num_pcrs;
204 struct tpm_version_t tpm_version;
205 struct tpm_version_1_2_t tpm_version_1_2;
206 __be32 manufacturer_id;
207 struct timeout_t timeout;
208 struct duration_t duration;
209} cap_t;
210
211struct tpm_getcap_params_in {
212 __be32 cap;
213 __be32 subcap_size;
214 __be32 subcap;
215}__attribute__((packed));
216
217struct tpm_getcap_params_out {
218 __be32 cap_size;
219 cap_t cap;
220}__attribute__((packed));
221
222struct tpm_readpubek_params_out {
223 u8 algorithm[4];
224 u8 encscheme[2];
225 u8 sigscheme[2];
226 u8 parameters[12]; /*assuming RSA*/
227 __be32 keysize;
228 u8 modulus[256];
229 u8 checksum[20];
230}__attribute__((packed));
231
232typedef union {
233 struct tpm_input_header in;
234 struct tpm_output_header out;
235} tpm_cmd_header;
236
237typedef union {
238 struct tpm_getcap_params_out getcap_out;
239 struct tpm_readpubek_params_out readpubek_out;
240 u8 readpubek_out_buffer[sizeof(struct tpm_readpubek_params_out)];
241 struct tpm_getcap_params_in getcap_in;
242} tpm_cmd_params;
243
244struct tpm_cmd_t {
245 tpm_cmd_header header;
246 tpm_cmd_params params;
247}__attribute__((packed));
248
249ssize_t tpm_getcap(struct device *, __be32, cap_t *, const char *);
126 250
127extern void tpm_get_timeouts(struct tpm_chip *); 251extern void tpm_get_timeouts(struct tpm_chip *);
128extern void tpm_gen_interrupt(struct tpm_chip *); 252extern void tpm_gen_interrupt(struct tpm_chip *);