drivers/char/tpm/tpm_tis_core.c
Source file repositories/reference/linux-study-clean/drivers/char/tpm/tpm_tis_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/char/tpm/tpm_tis_core.c- Extension
.c- Size
- 34346 bytes
- Lines
- 1384
- Domain
- Driver Families
- Bucket
- drivers/char
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/module.hlinux/moduleparam.hlinux/pnp.hlinux/slab.hlinux/interrupt.hlinux/wait.hlinux/acpi.hlinux/freezer.hlinux/dmi.htpm.htpm_tis_core.h
Detected Declarations
struct tis_vendor_durations_overridestruct tis_vendor_timeout_overridefunction wait_for_tpm_stat_condfunction tpm_tis_filter_sts_maskfunction wait_for_tpm_statfunction wait_startupfunction check_localityfunction __tpm_tis_relinquish_localityfunction tpm_tis_relinquish_localityfunction __tpm_tis_request_localityfunction tpm_tis_request_localityfunction tpm_tis_statusfunction tpm_tis_readyfunction get_burstcountfunction recv_datafunction tpm_tis_try_recvfunction tpm_tis_recvfunction usedfunction __tpm_tis_disable_interruptsfunction tpm_tis_disable_interruptsfunction usedfunction tpm_tis_sendfunction tpm_tis_update_durationsfunction tpm_tis_update_timeoutsfunction probe_itpmfunction tpm_tis_req_canceledfunction tpm_tis_revert_interruptsfunction tpm_tis_update_unhandled_irqsfunction tis_int_handlerfunction tpm_tis_gen_interruptfunction tpm_tis_free_irq_funcfunction tpm_tis_probe_irq_singlefunction tpm_tis_probe_irqfunction tpm_tis_removefunction tpm_tis_clkrun_enablefunction tpm_tis_core_initfunction tpm_tis_reenable_interruptsfunction tpm_tis_resumeexport tpm_tis_removeexport tpm_tis_core_initexport tpm_tis_resume
Annotated Snippet
struct tis_vendor_durations_override {
u32 did_vid;
struct tpm1_version version;
unsigned long durations[3];
};
static const struct tis_vendor_durations_override vendor_dur_overrides[] = {
/* STMicroelectronics 0x104a */
{ 0x0000104a,
{ 1, 2, 8, 28 },
{ (2 * 60 * HZ), (2 * 60 * HZ), (2 * 60 * HZ) } },
};
static void tpm_tis_update_durations(struct tpm_chip *chip,
unsigned long *duration_cap)
{
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
struct tpm1_version *version;
u32 did_vid;
int i, rc;
cap_t cap;
chip->duration_adjusted = false;
if (chip->ops->clk_enable != NULL)
chip->ops->clk_enable(chip, true);
rc = tpm_tis_read32(priv, TPM_DID_VID(0), &did_vid);
if (rc < 0) {
dev_warn(&chip->dev, "%s: failed to read did_vid. %d\n",
__func__, rc);
goto out;
}
/* Try to get a TPM version 1.2 or 1.1 TPM_CAP_VERSION_INFO */
rc = tpm1_getcap(chip, TPM_CAP_VERSION_1_2, &cap,
"attempting to determine the 1.2 version",
sizeof(cap.version2));
if (!rc) {
version = &cap.version2.version;
} else {
rc = tpm1_getcap(chip, TPM_CAP_VERSION_1_1, &cap,
"attempting to determine the 1.1 version",
sizeof(cap.version1));
if (rc)
goto out;
version = &cap.version1;
}
for (i = 0; i != ARRAY_SIZE(vendor_dur_overrides); i++) {
if (vendor_dur_overrides[i].did_vid != did_vid)
continue;
if ((version->major ==
vendor_dur_overrides[i].version.major) &&
(version->minor ==
vendor_dur_overrides[i].version.minor) &&
(version->rev_major ==
vendor_dur_overrides[i].version.rev_major) &&
(version->rev_minor ==
vendor_dur_overrides[i].version.rev_minor)) {
memcpy(duration_cap,
vendor_dur_overrides[i].durations,
sizeof(vendor_dur_overrides[i].durations));
chip->duration_adjusted = true;
goto out;
}
}
out:
if (chip->ops->clk_enable != NULL)
chip->ops->clk_enable(chip, false);
}
struct tis_vendor_timeout_override {
u32 did_vid;
unsigned long timeout_us[4];
};
static const struct tis_vendor_timeout_override vendor_timeout_overrides[] = {
/* Atmel 3204 */
{ 0x32041114, { (TIS_SHORT_TIMEOUT*1000), (TIS_LONG_TIMEOUT*1000),
(TIS_SHORT_TIMEOUT*1000), (TIS_SHORT_TIMEOUT*1000) } },
};
static void tpm_tis_update_timeouts(struct tpm_chip *chip,
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/pnp.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/wait.h`, `linux/acpi.h`.
- Detected declarations: `struct tis_vendor_durations_override`, `struct tis_vendor_timeout_override`, `function wait_for_tpm_stat_cond`, `function tpm_tis_filter_sts_mask`, `function wait_for_tpm_stat`, `function wait_startup`, `function check_locality`, `function __tpm_tis_relinquish_locality`, `function tpm_tis_relinquish_locality`, `function __tpm_tis_request_locality`.
- Atlas domain: Driver Families / drivers/char.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.