1
2#ifndef __TPM_EVENTLOG_H__
3#define __TPM_EVENTLOG_H__
4
5#define TCG_EVENT_NAME_LEN_MAX	255
6#define MAX_TEXT_EVENT		1000	/* Max event string length */
7#define ACPI_TCPA_SIG		"TCPA"	/* 0x41504354 /'TCPA' */
8
9#ifdef CONFIG_PPC64
10#define do_endian_conversion(x) be32_to_cpu(x)
11#else
12#define do_endian_conversion(x) x
13#endif
14
15enum bios_platform_class {
16	BIOS_CLIENT = 0x00,
17	BIOS_SERVER = 0x01,
18};
19
20struct tpm_bios_log {
21	void *bios_event_log;
22	void *bios_event_log_end;
23};
24
25struct tcpa_event {
26	u32 pcr_index;
27	u32 event_type;
28	u8 pcr_value[20];	/* SHA1 */
29	u32 event_size;
30	u8 event_data[0];
31};
32
33enum tcpa_event_types {
34	PREBOOT = 0,
35	POST_CODE,
36	UNUSED,
37	NO_ACTION,
38	SEPARATOR,
39	ACTION,
40	EVENT_TAG,
41	SCRTM_CONTENTS,
42	SCRTM_VERSION,
43	CPU_MICROCODE,
44	PLATFORM_CONFIG_FLAGS,
45	TABLE_OF_DEVICES,
46	COMPACT_HASH,
47	IPL,
48	IPL_PARTITION_DATA,
49	NONHOST_CODE,
50	NONHOST_CONFIG,
51	NONHOST_INFO,
52};
53
54struct tcpa_pc_event {
55	u32 event_id;
56	u32 event_size;
57	u8 event_data[0];
58};
59
60enum tcpa_pc_event_ids {
61	SMBIOS = 1,
62	BIS_CERT,
63	POST_BIOS_ROM,
64	ESCD,
65	CMOS,
66	NVRAM,
67	OPTION_ROM_EXEC,
68	OPTION_ROM_CONFIG,
69	OPTION_ROM_MICROCODE = 10,
70	S_CRTM_VERSION,
71	S_CRTM_CONTENTS,
72	POST_CONTENTS,
73	HOST_TABLE_OF_DEVICES,
74};
75
76int read_log(struct tpm_bios_log *log);
77
78#if defined(CONFIG_TCG_IBMVTPM) || defined(CONFIG_TCG_IBMVTPM_MODULE) || \
79	defined(CONFIG_ACPI)
80extern struct dentry **tpm_bios_log_setup(char *);
81extern void tpm_bios_log_teardown(struct dentry **);
82#else
83static inline struct dentry **tpm_bios_log_setup(char *name)
84{
85	return NULL;
86}
87static inline void tpm_bios_log_teardown(struct dentry **dir)
88{
89}
90#endif
91
92#endif
93