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 #include <sys/cdefs.h> 19 __FBSDID("$FreeBSD$"); 20 21 #include <sys/param.h> 22 #include <sys/systm.h> 23 #include <sys/kernel.h> 24 #include <sys/malloc.h> 25 #include <sys/proc.h> 26 27 #include <sys/module.h> 28 #include <sys/conf.h> 29 #include <sys/uio.h> 30 #include <sys/bus.h> 31 32 #include <machine/bus.h> 33 #include <sys/rman.h> 34 #include <machine/resource.h> 35 36 #include <machine/md_var.h> 37 38 #include <isa/isareg.h> 39 #include <isa/isavar.h> 40 #include "tpmvar.h" 41 42 #include "opt_acpi.h" 43 #include <contrib/dev/acpica/include/acpi.h> 44 #include <contrib/dev/acpica/include/accommon.h> 45 #include <dev/acpica/acpivar.h> 46 47 48 49 char *tpm_ids[] = {"ATM1200", "BCM0102", "INTC0102", "SNO3504", "WEC1000", 50 "PNP0C31", NULL}; 51 52 static int 53 tpm_acpi_probe(device_t dev) 54 { 55 int rv; 56 57 rv = ACPI_ID_PROBE(device_get_parent(dev), dev, tpm_ids, NULL); 58 if (rv <= 0) 59 device_set_desc(dev, "Trusted Platform Module"); 60 61 return (rv); 62 } 63 64 static device_method_t tpm_acpi_methods[] = { 65 #if 0 66 /*In some case, TPM existence is found only in TPCA header*/ 67 DEVMETHOD(device_identify, tpm_acpi_identify), 68 #endif 69 70 DEVMETHOD(device_probe, tpm_acpi_probe), 71 DEVMETHOD(device_attach, tpm_attach), 72 DEVMETHOD(device_detach, tpm_detach), 73 DEVMETHOD(device_suspend, tpm_suspend), 74 DEVMETHOD(device_resume, tpm_resume), 75 { 0, 0 } 76 }; 77 static driver_t tpm_acpi_driver = { 78 "tpm", tpm_acpi_methods, sizeof(struct tpm_softc), 79 }; 80 81 devclass_t tpm_devclass; 82 DRIVER_MODULE(tpm, acpi, tpm_acpi_driver, tpm_devclass, 0, 0); 83