Blame view

drivers/tpm/tpm_private.h 2.98 KB
f62679981   Rong Chang   tpm: Add Infineon...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  /*
   * Copyright (C) 2011 Infineon Technologies
   *
   * Authors:
   * Peter Huewe <huewe.external@infineon.com>
   *
   * Version: 2.1.1
   *
   * Description:
   * Device driver for TCG/TCPA TPM (trusted platform module).
   * Specifications at www.trustedcomputinggroup.org
   *
   * It is based on the Linux kernel driver tpm.c from Leendert van
   * Dorn, Dave Safford, Reiner Sailer, and Kyleen Hall.
   *
   *
   * See file CREDITS for list of people who contributed to this
   * project.
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License as
   * published by the Free Software Foundation, version 2 of the
   * License.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
   * MA 02111-1307 USA
   */
1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
35
36
  #ifndef _TPM_PRIVATE_H_
  #define _TPM_PRIVATE_H_
f62679981   Rong Chang   tpm: Add Infineon...
37
38
  
  #include <linux/compiler.h>
1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
39
  #include <linux/types.h>
f62679981   Rong Chang   tpm: Add Infineon...
40
41
42
43
44
45
46
  
  enum tpm_timeout {
  	TPM_TIMEOUT = 5,	/* msecs */
  };
  
  /* Size of external transmit buffer (used in tpm_transmit)*/
  #define TPM_BUFSIZE 4096
f62679981   Rong Chang   tpm: Add Infineon...
47
  /* Index of Count field in TPM response buffer */
1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
48
49
  #define TPM_RSP_SIZE_BYTE	2
  #define TPM_RSP_RC_BYTE		6
f62679981   Rong Chang   tpm: Add Infineon...
50
51
52
53
54
55
56
57
58
59
60
  
  struct tpm_chip;
  
  struct tpm_vendor_specific {
  	const u8 req_complete_mask;
  	const u8 req_complete_val;
  	const u8 req_canceled;
  	int irq;
  	int (*recv) (struct tpm_chip *, u8 *, size_t);
  	int (*send) (struct tpm_chip *, u8 *, size_t);
  	void (*cancel) (struct tpm_chip *);
1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
61
  	u8(*status) (struct tpm_chip *);
f62679981   Rong Chang   tpm: Add Infineon...
62
  	int locality;
1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
63
64
  	unsigned long timeout_a, timeout_b, timeout_c, timeout_d;  /* msec */
  	unsigned long duration[3];  /* msec */
f62679981   Rong Chang   tpm: Add Infineon...
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  };
  
  struct tpm_chip {
  	int is_open;
  	struct tpm_vendor_specific vendor;
  };
  
  struct tpm_input_header {
  	__be16 tag;
  	__be32 length;
  	__be32 ordinal;
  } __packed;
  
  struct tpm_output_header {
  	__be16 tag;
  	__be32 length;
  	__be32 return_code;
  } __packed;
  
  struct timeout_t {
  	__be32 a;
  	__be32 b;
  	__be32 c;
  	__be32 d;
  } __packed;
  
  struct duration_t {
  	__be32 tpm_short;
  	__be32 tpm_medium;
  	__be32 tpm_long;
  } __packed;
  
  union cap_t {
  	struct timeout_t timeout;
  	struct duration_t duration;
  };
  
  struct tpm_getcap_params_in {
  	__be32 cap;
  	__be32 subcap_size;
  	__be32 subcap;
  } __packed;
  
  struct tpm_getcap_params_out {
  	__be32 cap_size;
  	union cap_t cap;
  } __packed;
  
  union tpm_cmd_header {
  	struct tpm_input_header in;
  	struct tpm_output_header out;
  };
  
  union tpm_cmd_params {
  	struct tpm_getcap_params_out getcap_out;
  	struct tpm_getcap_params_in getcap_in;
  };
  
  struct tpm_cmd_t {
  	union tpm_cmd_header header;
  	union tpm_cmd_params params;
  } __packed;
1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
127
  struct tpm_chip *tpm_register_hardware(const struct tpm_vendor_specific *);
f62679981   Rong Chang   tpm: Add Infineon...
128

1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
129
  int tpm_vendor_init(uint32_t dev_addr);
f62679981   Rong Chang   tpm: Add Infineon...
130

1b393db58   Tom Wai-Hong Tam   tpm: Reorganize t...
131
  void tpm_vendor_cleanup(struct tpm_chip *chip);
f62679981   Rong Chang   tpm: Add Infineon...
132

f62679981   Rong Chang   tpm: Add Infineon...
133
134
  
  #endif