Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/tpm/tpm_tis.c
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | static bool tpm_wait_for_u32(struct tpm_sc *sc, bus_size_t off, | ||||
uint32_t mask, uint32_t val, int32_t timeout); | uint32_t mask, uint32_t val, int32_t timeout); | ||||
static uint16_t tpmtis_wait_for_burst(struct tpm_sc *sc); | static uint16_t tpmtis_wait_for_burst(struct tpm_sc *sc); | ||||
char *tpmtis_ids[] = {"MSFT0101", NULL}; | char *tpmtis_ids[] = {"MSFT0101", NULL}; | ||||
static int | static int | ||||
tpmtis_acpi_probe(device_t dev) | tpmtis_acpi_probe(device_t dev) | ||||
{ | { | ||||
struct resource *res; | int err; | ||||
int err, rid = 0; | ACPI_TABLE_TPM23 *tbl; | ||||
uint32_t caps; | ACPI_STATUS status; | ||||
err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids, NULL); | err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids, NULL); | ||||
if (err > 0) | if (err > 0) | ||||
return (err); | return (err); | ||||
/*Find TPM2 Header*/ | |||||
status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) &tbl); | |||||
if(ACPI_FAILURE(status) || | |||||
tbl->StartMethod != TPM2_START_METHOD_TIS) | |||||
err = ENXIO; | |||||
/* Check if device is in TPM 2.0 TIS mode */ | |||||
res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); | |||||
if (res == NULL) | |||||
return (ENXIO); | |||||
caps = bus_read_4(res, TPM_INTF_CAPS); | |||||
bus_release_resource(dev, SYS_RES_MEMORY, rid, res); | |||||
if ((caps & TPM_INTF_CAPS_VERSION) != TPM_INTF_CAPS_TPM20) | |||||
return (ENXIO); | |||||
device_set_desc(dev, "Trusted Platform Module 2.0, FIFO mode"); | device_set_desc(dev, "Trusted Platform Module 2.0, FIFO mode"); | ||||
return (BUS_PROBE_DEFAULT); | return (err); | ||||
} | } | ||||
static int | static int | ||||
tpmtis_attach(device_t dev) | tpmtis_attach(device_t dev) | ||||
{ | { | ||||
struct tpm_sc *sc; | struct tpm_sc *sc; | ||||
int result; | int result; | ||||
▲ Show 20 Lines • Show All 381 Lines • Show Last 20 Lines |