Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/tpm/tpm.c
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | |||||
#else | #else | ||||
#define TPMSOFTC(dev) \ | #define TPMSOFTC(dev) \ | ||||
(struct tpm_softc *)device_lookup(&tpm_cd, minor(dev)) | (struct tpm_softc *)device_lookup(&tpm_cd, minor(dev)) | ||||
struct cfdriver tpm_cd = { | struct cfdriver tpm_cd = { | ||||
NULL, "tpm", DV_DULL | NULL, "tpm", DV_DULL | ||||
}; | }; | ||||
int tpm_match(struct device *, void *, void *); | int tpm_match(device_t , void *, void *); | ||||
void tpm_attach(struct device *, struct device *, void *); | void tpm_attach(device_t , device_t , void *); | ||||
struct cfattach tpm_ca = { | struct cfattach tpm_ca = { | ||||
sizeof(struct tpm_softc), tpm_match, tpm_attach | sizeof(struct tpm_softc), tpm_match, tpm_attach | ||||
}; | }; | ||||
#endif | #endif | ||||
const struct { | const struct { | ||||
u_int32_t devid; | u_int32_t devid; | ||||
▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
#else | #else | ||||
/* | /* | ||||
* OpenBSD specific code for probing and attaching TPM to device tree. | * OpenBSD specific code for probing and attaching TPM to device tree. | ||||
*/ | */ | ||||
int | int | ||||
tpm_match(struct device *parent, void *match, void *aux) | tpm_match(device_t parent, void *match, void *aux) | ||||
{ | { | ||||
struct isa_attach_args *ia = aux; | struct isa_attach_args *ia = aux; | ||||
struct cfdata *cf = match; | struct cfdata *cf = match; | ||||
bus_space_tag_t bt = ia->ia_memt; | bus_space_tag_t bt = ia->ia_memt; | ||||
bus_space_handle_t bh; | bus_space_handle_t bh; | ||||
int rv; | int rv; | ||||
/* There can be only one. */ | /* There can be only one. */ | ||||
Show All 16 Lines | if ((rv = tpm_tis12_probe(bt, bh))) { | ||||
ia->ia_msize = TPM_SIZE; | ia->ia_msize = TPM_SIZE; | ||||
} | } | ||||
bus_space_unmap(bt, bh, TPM_SIZE); | bus_space_unmap(bt, bh, TPM_SIZE); | ||||
return rv; | return rv; | ||||
} | } | ||||
void | void | ||||
tpm_attach(struct device *parent, struct device *self, void *aux) | tpm_attach(device_t parent, device_t self, void *aux) | ||||
{ | { | ||||
struct tpm_softc *sc = (struct tpm_softc *)self; | struct tpm_softc *sc = (struct tpm_softc *)self; | ||||
struct isa_attach_args *ia = aux; | struct isa_attach_args *ia = aux; | ||||
bus_addr_t iobase; | bus_addr_t iobase; | ||||
bus_size_t size; | bus_size_t size; | ||||
int rv; | int rv; | ||||
if (tpm_legacy_probe(ia->ia_iot, ia->ia_iobase)) { | if (tpm_legacy_probe(ia->ia_iot, ia->ia_iobase)) { | ||||
▲ Show 20 Lines • Show All 1,113 Lines • Show Last 20 Lines |