Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Side by Side Diff: drivers/tpm/slb9635_i2c/tpm.h

Issue 6683023: Add Infineon v05 TPM driver (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/u-boot-next.git@chromeos-v2010.09
Patch Set: Fix nits Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « drivers/tpm/slb9635_i2c/tddl.c ('k') | drivers/tpm/slb9635_i2c/tpm.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2011 Infineon Technologies
3 *
4 * Authors:
5 * Peter Huewe <huewe.external@infineon.com>
6 *
7 * Version: 2.1.1
8 *
9 * Description:
10 * Device driver for TCG/TCPA TPM (trusted platform module).
11 * Specifications at www.trustedcomputinggroup.org
12 *
13 * It is based on the Linux kernel driver tpm.c from Leendert van
14 * Dorn, Dave Safford, Reiner Sailer, and Kyleen Hall.
15 *
16 *
17 * See file CREDITS for list of people who contributed to this
18 * project.
19 *
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License as
22 * published by the Free Software Foundation, version 2 of the
23 * License.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 * MA 02111-1307 USA
34 */
35
36 #ifndef _TPM_H_
37 #define _TPM_H_
38
39 #include "compatibility.h"
40
41 enum tpm_timeout {
42 TPM_TIMEOUT = 5, /* msecs */
43 };
44
45 /* Size of external transmit buffer (used in tpm_transmit)*/
46 #define TPM_BUFSIZE 4096
47
48 /* Index of fields in TPM command buffer */
49 #define TPM_CMD_SIZE_BYTE 2
50 #define TPM_CMD_ORDINAL_BYTE 6
51
52 /* Index of Count field in TPM response buffer */
53 #define TPM_RSP_SIZE_BYTE 2
54 #define TPM_RSP_RC_BYTE 6
55
56 struct tpm_chip;
57
58 struct tpm_vendor_specific {
59 const u8 req_complete_mask;
60 const u8 req_complete_val;
61 const u8 req_canceled;
62 int irq;
63 int (*recv) (struct tpm_chip *, u8 *, size_t);
64 int (*send) (struct tpm_chip *, u8 *, size_t);
65 void (*cancel) (struct tpm_chip *);
66 u8(*status) (struct tpm_chip *);
67 int locality;
68 unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* msec */
69 unsigned long duration[3]; /* msec */
70 };
71
72 struct tpm_chip {
73 int is_open;
74 struct tpm_vendor_specific vendor;
75 };
76
77 struct tpm_input_header {
78 __be16 tag;
79 __be32 length;
80 __be32 ordinal;
81 } __attribute__ ((packed));
82
83 struct tpm_output_header {
84 __be16 tag;
85 __be32 length;
86 __be32 return_code;
87 } __attribute__ ((packed));
88
89 struct timeout_t {
90 __be32 a;
91 __be32 b;
92 __be32 c;
93 __be32 d;
94 } __attribute__ ((packed));
95
96 struct duration_t {
97 __be32 tpm_short;
98 __be32 tpm_medium;
99 __be32 tpm_long;
100 } __attribute__ ((packed));
101
102 typedef union {
103 struct timeout_t timeout;
104 struct duration_t duration;
105 } cap_t;
106
107 struct tpm_getcap_params_in {
108 __be32 cap;
109 __be32 subcap_size;
110 __be32 subcap;
111 } __attribute__ ((packed));
112
113 struct tpm_getcap_params_out {
114 __be32 cap_size;
115 cap_t cap;
116 } __attribute__ ((packed));
117
118 typedef union {
119 struct tpm_input_header in;
120 struct tpm_output_header out;
121 } tpm_cmd_header;
122
123 typedef union {
124 struct tpm_getcap_params_out getcap_out;
125 struct tpm_getcap_params_in getcap_in;
126 } tpm_cmd_params;
127
128 struct tpm_cmd_t {
129 tpm_cmd_header header;
130 tpm_cmd_params params;
131 } __attribute__ ((packed));
132
133
134 /* ---------- Interface for TPM vendor ------------ */
135
136 extern struct tpm_chip *tpm_register_hardware(
137 const struct tpm_vendor_specific *);
138
139 extern int tpm_vendor_init(uint32_t dev_addr);
140
141 extern void tpm_vendor_cleanup(struct tpm_chip *chip);
142
143 /* ---------- Interface for TDDL ------------------- */
144
145 /*
146 * if dev_addr != 0 - redefines TPM device address
147 * Returns < 0 on error, 0 on success.
148 */
149 extern int tpm_open(uint32_t dev_addr);
150
151 extern void tpm_close(void);
152
153 /*
154 * Transmit bufsiz bytes out of buf to TPM and get results back in buf, too.
155 * Returns < 0 on error, 0 on success.
156 */
157 extern ssize_t tpm_transmit(const unsigned char *buf, size_t bufsiz);
158
159 #endif
OLDNEW
« no previous file with comments | « drivers/tpm/slb9635_i2c/tddl.c ('k') | drivers/tpm/slb9635_i2c/tpm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698