tpmvar.h revision 1.3 1 1.3 chs /* $NetBSD: tpmvar.h,v 1.3 2012/10/27 17:18:23 chs Exp $ */
2 1.1 christos /*
3 1.1 christos * Copyright (c) 2008, 2009 Michael Shalayeff
4 1.1 christos * Copyright (c) 2009, 2010 Hans-Jrg Hxer
5 1.1 christos * All rights reserved.
6 1.1 christos *
7 1.1 christos * Permission to use, copy, modify, and distribute this software for any
8 1.1 christos * purpose with or without fee is hereby granted, provided that the above
9 1.1 christos * copyright notice and this permission notice appear in all copies.
10 1.1 christos *
11 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 1.1 christos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 1.1 christos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 1.1 christos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 1.1 christos * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
16 1.1 christos * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17 1.1 christos * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 1.1 christos */
19 1.1 christos
20 1.1 christos struct tpm_softc {
21 1.3 chs device_t sc_dev;
22 1.1 christos void *sc_ih;
23 1.1 christos
24 1.1 christos int (*sc_init)(struct tpm_softc *, int, const char *);
25 1.1 christos int (*sc_start)(struct tpm_softc *, int);
26 1.2 christos int (*sc_read)(struct tpm_softc *, void *, size_t, size_t *, int);
27 1.2 christos int (*sc_write)(struct tpm_softc *, const void *, size_t);
28 1.1 christos int (*sc_end)(struct tpm_softc *, int, int);
29 1.1 christos
30 1.1 christos bus_space_tag_t sc_bt, sc_batm;
31 1.1 christos bus_space_handle_t sc_bh, sc_bahm;
32 1.1 christos
33 1.1 christos u_int32_t sc_devid;
34 1.1 christos u_int32_t sc_rev;
35 1.1 christos u_int32_t sc_stat;
36 1.1 christos u_int32_t sc_capabilities;
37 1.1 christos
38 1.1 christos int sc_flags;
39 1.1 christos #define TPM_OPEN 0x0001
40 1.1 christos
41 1.1 christos int sc_vector;
42 1.1 christos };
43 1.1 christos
44 1.1 christos int tpm_intr(void *);
45 1.1 christos
46 1.1 christos bool tpm_suspend(device_t, const pmf_qual_t *);
47 1.1 christos bool tpm_resume(device_t, const pmf_qual_t *);
48 1.1 christos
49 1.1 christos int tpm_tis12_probe(bus_space_tag_t, bus_space_handle_t);
50 1.1 christos int tpm_tis12_init(struct tpm_softc *, int, const char *);
51 1.1 christos int tpm_tis12_start(struct tpm_softc *, int);
52 1.2 christos int tpm_tis12_read(struct tpm_softc *, void *, size_t, size_t *, int);
53 1.2 christos int tpm_tis12_write(struct tpm_softc *, const void *, size_t);
54 1.1 christos int tpm_tis12_end(struct tpm_softc *, int, int);
55 1.1 christos
56 1.1 christos int tpm_legacy_probe(bus_space_tag_t, bus_addr_t);
57 1.1 christos int tpm_legacy_init(struct tpm_softc *, int, const char *);
58 1.1 christos int tpm_legacy_start(struct tpm_softc *, int);
59 1.2 christos int tpm_legacy_read(struct tpm_softc *, void *, size_t, size_t *, int);
60 1.2 christos int tpm_legacy_write(struct tpm_softc *, const void *, size_t);
61 1.1 christos int tpm_legacy_end(struct tpm_softc *, int, int);
62