Merge branch 'vendor/OPENSSL'
[dragonfly.git] / sys / dev / crypto / tpm / tpmvar.h
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  * $FreeBSD: src/sys/dev/tpm/tpmvar.h,v 1.1 2010/08/12 00:16:18 takawata Exp $
19  */
20
21 #ifndef _TPMVAR_H
22 #define _TPMVAR_H
23
24 struct tpm_softc {
25         void *sc_ih;
26
27         int     (*sc_init)(struct tpm_softc *, int, const char *);
28         int     (*sc_start)(struct tpm_softc *, int);
29         int     (*sc_read)(struct tpm_softc *, void *, int, size_t *, int);
30         int     (*sc_write)(struct tpm_softc *, void *, int);
31         int     (*sc_end)(struct tpm_softc *, int, int);
32
33         bus_space_tag_t sc_bt, sc_batm;
34         bus_space_handle_t sc_bh, sc_bahm;
35
36         u_int32_t sc_devid;
37         u_int32_t sc_rev;
38         u_int32_t sc_stat;
39         u_int32_t sc_capabilities;
40
41         int sc_flags;
42 #define TPM_OPEN        0x0001
43
44         int      sc_vector;
45         void    *intr_cookie;
46         int mem_rid, irq_rid;
47         struct resource *mem_res, *irq_res;
48         struct cdev *sc_cdev;
49
50         int      sc_suspend;
51 };
52
53 int tpm_tis12_probe(bus_space_tag_t iot, bus_space_handle_t ioh);
54 int tpm_attach(device_t dev);
55 int tpm_detach(device_t dev);
56 int tpm_suspend(device_t dev);
57 int tpm_resume(device_t dev);
58 #endif