2 * Copyright (C) 2005 IBM Corporation
5 * Seiji Munetoh <munetoh@jp.ibm.com>
6 * Stefan Berger <stefanb@us.ibm.com>
7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com>
9 * Nayna Jain <nayna@linux.vnet.ibm.com>
11 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
13 * Access to the event log extended by the TCG BIOS of PC platform
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
22 #include <linux/seq_file.h>
24 #include <linux/security.h>
25 #include <linux/module.h>
26 #include <linux/slab.h>
27 #include <linux/acpi.h>
30 #include "tpm_eventlog.h"
33 struct acpi_table_header hdr;
37 u32 log_max_len __packed;
38 u64 log_start_addr __packed;
42 u64 log_max_len __packed;
43 u64 log_start_addr __packed;
48 /* read binary bios log */
49 int tpm_read_log_acpi(struct tpm_chip *chip)
51 struct acpi_tcpa *buff;
55 struct tpm_bios_log *log;
59 /* Find TCPA entry in RSDT (ACPI_LOGICAL_ADDRESSING) */
60 status = acpi_get_table(ACPI_SIG_TCPA, 1,
61 (struct acpi_table_header **)&buff);
63 if (ACPI_FAILURE(status))
66 switch(buff->platform_class) {
68 len = buff->server.log_max_len;
69 start = buff->server.log_start_addr;
73 len = buff->client.log_max_len;
74 start = buff->client.log_start_addr;
78 dev_warn(&chip->dev, "%s: TCPA log area empty\n", __func__);
82 /* malloc EventLog space */
83 log->bios_event_log = kmalloc(len, GFP_KERNEL);
84 if (!log->bios_event_log)
87 log->bios_event_log_end = log->bios_event_log + len;
89 virt = acpi_os_map_iomem(start, len);
93 memcpy_fromio(log->bios_event_log, virt, len);
95 acpi_os_unmap_iomem(virt, len);
99 kfree(log->bios_event_log);
100 log->bios_event_log = NULL;