drivers/char/tpm/eventlog/tpm2.c
Source file repositories/reference/linux-study-clean/drivers/char/tpm/eventlog/tpm2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/char/tpm/eventlog/tpm2.c- Extension
.c- Size
- 3972 bytes
- Lines
- 160
- Domain
- Driver Families
- Bucket
- drivers/char
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/seq_file.hlinux/fs.hlinux/security.hlinux/module.hlinux/slab.hlinux/tpm_eventlog.h../tpm.hcommon.h
Detected Declarations
function Copyrightfunction tpm2_bios_measurements_stop
Annotated Snippet
if (addr + size < limit) {
if ((event_header->event_type == 0) &&
(event_header->event_size == 0))
return NULL;
return SEQ_START_TOKEN;
}
}
if (*pos > 0) {
addr += size;
event = addr;
size = calc_tpm2_event_size(event, event_header);
if ((addr + size >= limit) || (size == 0))
return NULL;
}
for (i = 0; i < (*pos - 1); i++) {
event = addr;
size = calc_tpm2_event_size(event, event_header);
if ((addr + size >= limit) || (size == 0))
return NULL;
addr += size;
}
return addr;
}
static void *tpm2_bios_measurements_next(struct seq_file *m, void *v,
loff_t *pos)
{
struct tcg_pcr_event *event_header;
struct tcg_pcr_event2_head *event;
struct tpm_chip *chip = m->private;
struct tpm_bios_log *log = &chip->log;
void *limit = log->bios_event_log_end;
size_t event_size;
void *marker;
(*pos)++;
event_header = log->bios_event_log;
if (v == SEQ_START_TOKEN) {
event_size = struct_size(event_header, event,
event_header->event_size);
marker = event_header;
} else {
event = v;
event_size = calc_tpm2_event_size(event, event_header);
if (event_size == 0)
return NULL;
marker = event;
}
marker = marker + event_size;
if (marker >= limit)
return NULL;
v = marker;
event = v;
event_size = calc_tpm2_event_size(event, event_header);
if (((v + event_size) >= limit) || (event_size == 0))
return NULL;
return v;
}
static void tpm2_bios_measurements_stop(struct seq_file *m, void *v)
{
}
static int tpm2_binary_bios_measurements_show(struct seq_file *m, void *v)
{
struct tpm_chip *chip = m->private;
struct tpm_bios_log *log = &chip->log;
struct tcg_pcr_event *event_header = log->bios_event_log;
struct tcg_pcr_event2_head *event = v;
void *temp_ptr;
size_t size;
if (v == SEQ_START_TOKEN) {
size = struct_size(event_header, event,
event_header->event_size);
temp_ptr = event_header;
if (size > 0)
seq_write(m, temp_ptr, size);
} else {
size = calc_tpm2_event_size(event, event_header);
temp_ptr = event;
Annotation
- Immediate include surface: `linux/seq_file.h`, `linux/fs.h`, `linux/security.h`, `linux/module.h`, `linux/slab.h`, `linux/tpm_eventlog.h`, `../tpm.h`, `common.h`.
- Detected declarations: `function Copyright`, `function tpm2_bios_measurements_stop`.
- Atlas domain: Driver Families / drivers/char.
- Implementation status: source implementation candidate.
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.