drivers/char/tpm/eventlog/tpm1.c
Source file repositories/reference/linux-study-clean/drivers/char/tpm/eventlog/tpm1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/char/tpm/eventlog/tpm1.c- Extension
.c- Size
- 6962 bytes
- Lines
- 294
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/seq_file.hlinux/efi.hlinux/fs.hlinux/security.hlinux/module.hlinux/slab.hlinux/tpm_eventlog.h../tpm.hcommon.h
Detected Declarations
function tpm1_bios_measurements_stopfunction tpm1_binary_bios_measurements_showfunction tpm1_ascii_bios_measurements_show
Annotated Snippet
do_endian_conversion(event->event_size)) {
name = event_entry;
n_len = do_endian_conversion(event->event_size);
}
break;
case EVENT_TAG:
pc_event = (struct tcpa_pc_event *)event_entry;
/* ToDo Row data -> Base64 */
switch (do_endian_conversion(pc_event->event_id)) {
case SMBIOS:
case BIS_CERT:
case CMOS:
case NVRAM:
case OPTION_ROM_EXEC:
case OPTION_ROM_CONFIG:
case S_CRTM_VERSION:
name = tcpa_pc_event_id_strings[do_endian_conversion
(pc_event->event_id)];
n_len = strlen(name);
break;
/* hash data */
case POST_BIOS_ROM:
case ESCD:
case OPTION_ROM_MICROCODE:
case S_CRTM_CONTENTS:
case POST_CONTENTS:
name = tcpa_pc_event_id_strings[do_endian_conversion
(pc_event->event_id)];
n_len = strlen(name);
for (i = 0; i < 20; i++)
d_len += sprintf(&data[2*i], "%02x",
pc_event->event_data[i]);
break;
default:
break;
}
break;
default:
break;
}
return snprintf(dest, MAX_TEXT_EVENT, "[%.*s%.*s]",
n_len, name, d_len, data);
}
static int tpm1_binary_bios_measurements_show(struct seq_file *m, void *v)
{
struct tcpa_event *event = v;
struct tcpa_event temp_event;
char *temp_ptr;
int i;
memcpy(&temp_event, event, sizeof(struct tcpa_event));
/* convert raw integers for endianness */
temp_event.pcr_index = do_endian_conversion(event->pcr_index);
temp_event.event_type = do_endian_conversion(event->event_type);
temp_event.event_size = do_endian_conversion(event->event_size);
temp_ptr = (char *) &temp_event;
for (i = 0; i < (sizeof(struct tcpa_event) - 1) ; i++)
seq_putc(m, temp_ptr[i]);
temp_ptr = (char *) v;
for (i = (sizeof(struct tcpa_event) - 1);
i < (sizeof(struct tcpa_event) + temp_event.event_size); i++)
seq_putc(m, temp_ptr[i]);
return 0;
}
static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
{
char *eventname;
struct tcpa_event *event = v;
unsigned char *event_entry =
(unsigned char *)(v + sizeof(struct tcpa_event));
eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
if (!eventname)
return -ENOMEM;
/* 1st: PCR */
seq_printf(m, "%2d ", do_endian_conversion(event->pcr_index));
Annotation
- Immediate include surface: `linux/seq_file.h`, `linux/efi.h`, `linux/fs.h`, `linux/security.h`, `linux/module.h`, `linux/slab.h`, `linux/tpm_eventlog.h`, `../tpm.h`.
- Detected declarations: `function tpm1_bios_measurements_stop`, `function tpm1_binary_bios_measurements_show`, `function tpm1_ascii_bios_measurements_show`.
- 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.