Loading...
Note: File does not exist in v3.1.
1/*
2 * Copyright (C) 2017 Google, Inc.
3 * Thiebaud Weksteen <tweek@google.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/efi.h>
11#include <linux/init.h>
12#include <linux/memblock.h>
13
14#include <asm/early_ioremap.h>
15
16/*
17 * Reserve the memory associated with the TPM Event Log configuration table.
18 */
19int __init efi_tpm_eventlog_init(void)
20{
21 struct linux_efi_tpm_eventlog *log_tbl;
22 unsigned int tbl_size;
23
24 if (efi.tpm_log == EFI_INVALID_TABLE_ADDR)
25 return 0;
26
27 log_tbl = early_memremap(efi.tpm_log, sizeof(*log_tbl));
28 if (!log_tbl) {
29 pr_err("Failed to map TPM Event Log table @ 0x%lx\n",
30 efi.tpm_log);
31 efi.tpm_log = EFI_INVALID_TABLE_ADDR;
32 return -ENOMEM;
33 }
34
35 tbl_size = sizeof(*log_tbl) + log_tbl->size;
36 memblock_reserve(efi.tpm_log, tbl_size);
37 early_memunmap(log_tbl, sizeof(*log_tbl));
38 return 0;
39}
40