#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#ifdef __FreeBSD__
#include <sys/module.h>
#include <sys/conf.h>
#include <sys/uio.h>
#include <sys/bus.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <machine/resource.h>
#include <machine/md_var.h>
#include <isa/isareg.h>
#include <isa/isavar.h>
#else
#include <sys/device.h>
#include <machine/cpu.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <machine/conf.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#endif
#include "tpmvar.h"
static int
tpm_isa_probe(device_t dev)
{
bus_space_tag_t iot;
bus_space_handle_t ioh;
struct resource *mem_res;
int rv, mem_rid;
mem_rid = 0;
mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &mem_rid,
RF_ACTIVE);
if (mem_res == NULL)
return (ENXIO);
iot = rman_get_bustag(mem_res);
ioh = rman_get_bushandle(mem_res);
if ((rv = tpm_tis12_probe(iot, ioh)))
device_set_desc(dev, "Trusted Platform Module");
bus_release_resource(dev, SYS_RES_MEMORY, mem_rid, mem_res);
return rv ? 0 : ENXIO;
}
static device_method_t tpm_methods[] = {
#if 0
DEVMETHOD(device_identify, tpm_identify),
#endif
DEVMETHOD(device_probe, tpm_isa_probe),
DEVMETHOD(device_attach, tpm_attach),
DEVMETHOD(device_detach, tpm_detach),
DEVMETHOD(device_suspend, tpm_suspend),
DEVMETHOD(device_resume, tpm_resume),
DEVMETHOD_END
};
static driver_t tpm_driver = {
"tpm", tpm_methods, sizeof(struct tpm_softc),
};
DRIVER_MODULE(tpm, isa, tpm_driver, 0, 0);