tpmvar.h revision 211201
1199482Srdivacky/*
2199482Srdivacky * Copyright (c) 2008, 2009 Michael Shalayeff
3353358Sdim * Copyright (c) 2009, 2010 Hans-Joerg Hoexer
4353358Sdim * All rights reserved.
5353358Sdim *
6199482Srdivacky * Permission to use, copy, modify, and distribute this software for any
7199482Srdivacky * purpose with or without fee is hereby granted, provided that the above
8199482Srdivacky * copyright notice and this permission notice appear in all copies.
9199482Srdivacky *
10199482Srdivacky * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11199482Srdivacky * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12360784Sdim * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13199482Srdivacky * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14199482Srdivacky * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
15199482Srdivacky * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
16288943Sdim * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17199482Srdivacky *
18353358Sdim * $FreeBSD: head/sys/dev/tpm/tpmvar.h 211201 2010-08-12 00:16:18Z takawata $
19249423Sdim */
20249423Sdim
21314564Sdim#ifndef _TPMVAR_H
22341825Sdim#define _TPMVAR_H
23249423Sdim
24212904Sdimstruct tpm_softc {
25234353Sdim#ifndef __FreeBSD__
26212904Sdim	struct device sc_dev;
27314564Sdim#endif
28353358Sdim	void *sc_ih;
29199482Srdivacky
30276479Sdim	int	(*sc_init)(struct tpm_softc *, int, const char *);
31276479Sdim	int	(*sc_start)(struct tpm_softc *, int);
32226633Sdim	int	(*sc_read)(struct tpm_softc *, void *, int, size_t *, int);
33199482Srdivacky	int	(*sc_write)(struct tpm_softc *, void *, int);
34199482Srdivacky	int	(*sc_end)(struct tpm_softc *, int, int);
35341825Sdim
36341825Sdim	bus_space_tag_t sc_bt, sc_batm;
37341825Sdim	bus_space_handle_t sc_bh, sc_bahm;
38341825Sdim
39341825Sdim	u_int32_t sc_devid;
40341825Sdim	u_int32_t sc_rev;
41341825Sdim	u_int32_t sc_stat;
42341825Sdim	u_int32_t sc_capabilities;
43341825Sdim
44341825Sdim	int sc_flags;
45341825Sdim#define	TPM_OPEN	0x0001
46341825Sdim
47341825Sdim	int	 sc_vector;
48341825Sdim#ifdef __FreeBSD__
49341825Sdim	void	*intr_cookie;
50341825Sdim	int mem_rid, irq_rid;
51341825Sdim	struct resource *mem_res, *irq_res;
52199482Srdivacky	struct cdev *sc_cdev;
53205408Srdivacky#endif
54205408Srdivacky
55205408Srdivacky#ifndef __FreeBSD__
56280031Sdim	void	*sc_powerhook;
57280031Sdim#endif
58360784Sdim	int	 sc_suspend;
59205408Srdivacky};
60205408Srdivacky
61205408Srdivackyint tpm_tis12_probe(bus_space_tag_t iot, bus_space_handle_t ioh);
62205408Srdivackyint tpm_attach(device_t dev);
63205408Srdivackyint tpm_detach(device_t dev);
64205408Srdivackyint tpm_suspend(device_t dev);
65199482Srdivackyint tpm_resume(device_t dev);
66199482Srdivacky#endif
67199482Srdivacky