2 * Copyright (c) 2008, 2009 Michael Shalayeff
3 * Copyright (c) 2009, 2010 Hans-Joerg Hoexer
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.
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.
19 #include <sys/cdefs.h>
20 __FBSDID("$FreeBSD$");
22 #include <sys/param.h>
23 #include <sys/systm.h>
24 #include <sys/kernel.h>
25 #include <sys/malloc.h>
29 #include <sys/module.h>
34 #include <machine/bus.h>
36 #include <machine/resource.h>
38 #include <machine/md_var.h>
40 #include <isa/isareg.h>
41 #include <isa/isavar.h>
43 #include <sys/device.h>
45 #include <machine/cpu.h>
46 #include <machine/bus.h>
47 #include <machine/intr.h>
48 #include <machine/conf.h>
50 #include <dev/isa/isareg.h>
51 #include <dev/isa/isavar.h>
56 tpm_isa_probe(device_t dev)
59 bus_space_handle_t ioh;
60 struct resource *mem_res;
64 mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &mem_rid,
68 iot = rman_get_bustag(mem_res);
69 ioh = rman_get_bushandle(mem_res);
71 if ((rv = tpm_tis12_probe(iot, ioh)))
72 device_set_desc(dev, "Trusted Platform Module");
74 bus_release_resource(dev, SYS_RES_MEMORY, mem_rid, mem_res);
75 return rv ? 0 : ENXIO;
78 static device_method_t tpm_methods[] = {
80 DEVMETHOD(device_identify, tpm_identify),
82 DEVMETHOD(device_probe, tpm_isa_probe),
83 DEVMETHOD(device_attach, tpm_attach),
84 DEVMETHOD(device_detach, tpm_detach),
85 DEVMETHOD(device_suspend, tpm_suspend),
86 DEVMETHOD(device_resume, tpm_resume),
90 static driver_t tpm_driver = {
91 "tpm", tpm_methods, sizeof(struct tpm_softc),
94 static devclass_t tpm_devclass;
96 DRIVER_MODULE(tpm, isa, tpm_driver, tpm_devclass, 0, 0);