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