xref: /freebsd/sys/dev/tpm/tpmvar.h (revision 5e3190f700637fcfc1a52daeaa4a031fdd2557c7)
1 /*
2  * Copyright (c) 2008, 2009 Michael Shalayeff
3  * Copyright (c) 2009, 2010 Hans-Joerg Hoexer
4  * All rights reserved.
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
15  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
16  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _TPMVAR_H
20 #define _TPMVAR_H
21 
22 struct tpm_softc {
23 #ifndef __FreeBSD__
24 	struct device sc_dev;
25 #endif
26 	void *sc_ih;
27 
28 	int	(*sc_init)(struct tpm_softc *, int, const char *);
29 	int	(*sc_start)(struct tpm_softc *, int);
30 	int	(*sc_read)(struct tpm_softc *, void *, int, size_t *, int);
31 	int	(*sc_write)(struct tpm_softc *, void *, int);
32 	int	(*sc_end)(struct tpm_softc *, int, int);
33 
34 	bus_space_tag_t sc_bt, sc_batm;
35 	bus_space_handle_t sc_bh, sc_bahm;
36 
37 	u_int32_t sc_devid;
38 	u_int32_t sc_rev;
39 	u_int32_t sc_stat;
40 	u_int32_t sc_capabilities;
41 
42 	int sc_flags;
43 #define	TPM_OPEN	0x0001
44 
45 	int	 sc_vector;
46 #ifdef __FreeBSD__
47 	void	*intr_cookie;
48 	int mem_rid, irq_rid;
49 	struct resource *mem_res, *irq_res;
50 	struct cdev *sc_cdev;
51 #endif
52 
53 #ifndef __FreeBSD__
54 	void	*sc_powerhook;
55 #endif
56 	int	 sc_suspend;
57 };
58 
59 int tpm_tis12_probe(bus_space_tag_t iot, bus_space_handle_t ioh);
60 int tpm_attach(device_t dev);
61 int tpm_detach(device_t dev);
62 int tpm_suspend(device_t dev);
63 int tpm_resume(device_t dev);
64 #endif
65