aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/char/tpm/tpm.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/char/tpm/tpm.h')
-rw-r--r--drivers/char/tpm/tpm.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
new file mode 100644
index 000000000000..575cf5aed41a
--- /dev/null
+++ b/drivers/char/tpm/tpm.h
@@ -0,0 +1,93 @@
1/*
2 * Copyright (C) 2004 IBM Corporation
3 *
4 * Authors:
5 * Leendert van Doorn <leendert@watson.ibm.com>
6 * Dave Safford <safford@watson.ibm.com>
7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com>
9 *
10 * Maintained by: <tpmdd_devel@lists.sourceforge.net>
11 *
12 * Device driver for TCG/TCPA TPM (trusted platform module).
13 * Specifications at www.trustedcomputinggroup.org
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation, version 2 of the
18 * License.
19 *
20 */
21#include <linux/module.h>
22#include <linux/version.h>
23#include <linux/pci.h>
24#include <linux/delay.h>
25#include <linux/fs.h>
26#include <linux/miscdevice.h>
27
28#define TPM_TIMEOUT msecs_to_jiffies(5)
29
30/* TPM addresses */
31#define TPM_ADDR 0x4E
32#define TPM_DATA 0x4F
33
34struct tpm_chip;
35
36struct tpm_vendor_specific {
37 u8 req_complete_mask;
38 u8 req_complete_val;
39 u16 base; /* TPM base address */
40
41 int (*recv) (struct tpm_chip *, u8 *, size_t);
42 int (*send) (struct tpm_chip *, u8 *, size_t);
43 void (*cancel) (struct tpm_chip *);
44 struct miscdevice miscdev;
45};
46
47struct tpm_chip {
48 struct pci_dev *pci_dev; /* PCI device stuff */
49
50 int dev_num; /* /dev/tpm# */
51 int num_opens; /* only one allowed */
52 int time_expired;
53
54 /* Data passed to and from the tpm via the read/write calls */
55 u8 *data_buffer;
56 atomic_t data_pending;
57 struct semaphore buffer_mutex;
58
59 struct timer_list user_read_timer; /* user needs to claim result */
60 struct semaphore tpm_mutex; /* tpm is processing */
61 struct timer_list device_timer; /* tpm is processing */
62 struct semaphore timer_manipulation_mutex;
63
64 struct tpm_vendor_specific *vendor;
65
66 struct list_head list;
67};
68
69static inline int tpm_read_index(int index)
70{
71 outb(index, TPM_ADDR);
72 return inb(TPM_DATA) & 0xFF;
73}
74
75static inline void tpm_write_index(int index, int value)
76{
77 outb(index, TPM_ADDR);
78 outb(value & 0xFF, TPM_DATA);
79}
80
81extern void tpm_time_expired(unsigned long);
82extern int tpm_lpc_bus_init(struct pci_dev *, u16);
83
84extern int tpm_register_hardware(struct pci_dev *,
85 struct tpm_vendor_specific *);
86extern int tpm_open(struct inode *, struct file *);
87extern int tpm_release(struct inode *, struct file *);
88extern ssize_t tpm_write(struct file *, const char __user *, size_t,
89 loff_t *);
90extern ssize_t tpm_read(struct file *, char __user *, size_t, loff_t *);
91extern void __devexit tpm_remove(struct pci_dev *);
92extern int tpm_pm_suspend(struct pci_dev *, u32);
93extern int tpm_pm_resume(struct pci_dev *);