summaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/tpm.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2018-01-09 11:40:59 +1100
committerJames Morris <james.l.morris@oracle.com>2018-01-09 11:40:59 +1100
commitebceb1c87c0c482d47cb92dc3cc51d28f7387716 (patch)
tree3fa626d8a7fddc9eba60dcd8c77fbf8a8ab656cd /drivers/firmware/efi/tpm.c
parentd21bd6898336a7892914d308d5e0868f0b863571 (diff)
parent68021bf4734d15c9a9ed1c1072b9ebcfda3e39cc (diff)
Merge tag 'tpmdd-next-20180108' of git://git.infradead.org/users/jjs/linux-tpmdd into next-tpm
tpmdd updates for Linux 4.16
Diffstat (limited to 'drivers/firmware/efi/tpm.c')
-rw-r--r--drivers/firmware/efi/tpm.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
new file mode 100644
index 000000000000..0cbeb3d46b18
--- /dev/null
+++ b/drivers/firmware/efi/tpm.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 Google, Inc.
+ * Thiebaud Weksteen <tweek@google.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/efi.h>
+#include <linux/init.h>
+#include <linux/memblock.h>
+
+#include <asm/early_ioremap.h>
+
+/*
+ * Reserve the memory associated with the TPM Event Log configuration table.
+ */
+int __init efi_tpm_eventlog_init(void)
+{
+ struct linux_efi_tpm_eventlog *log_tbl;
+ unsigned int tbl_size;
+
+ if (efi.tpm_log == EFI_INVALID_TABLE_ADDR)
+ return 0;
+
+ log_tbl = early_memremap(efi.tpm_log, sizeof(*log_tbl));
+ if (!log_tbl) {
+ pr_err("Failed to map TPM Event Log table @ 0x%lx\n",
+ efi.tpm_log);
+ efi.tpm_log = EFI_INVALID_TABLE_ADDR;
+ return -ENOMEM;
+ }
+
+ tbl_size = sizeof(*log_tbl) + log_tbl->size;
+ memblock_reserve(efi.tpm_log, tbl_size);
+ early_memunmap(log_tbl, sizeof(*log_tbl));
+ return 0;
+}
+