2 * Copyright 2012 IBM Corporation
4 * Author: Ashley Lai <adlai@us.ibm.com>
6 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
8 * Read the event log created by the firmware on PPC64
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
17 #include <linux/slab.h>
21 #include "tpm_eventlog.h"
23 int read_log(struct tpm_bios_log
*log
)
25 struct device_node
*np
;
29 if (log
->bios_event_log
!= NULL
) {
30 pr_err("%s: ERROR - Eventlog already initialized\n", __func__
);
34 np
= of_find_node_by_name(NULL
, "ibm,vtpm");
36 pr_err("%s: ERROR - IBMVTPM not supported\n", __func__
);
40 sizep
= of_get_property(np
, "linux,sml-size", NULL
);
42 pr_err("%s: ERROR - SML size not found\n", __func__
);
46 pr_err("%s: ERROR - event log area empty\n", __func__
);
50 basep
= of_get_property(np
, "linux,sml-base", NULL
);
52 pr_err(KERN_ERR
"%s: ERROR - SML not found\n", __func__
);
57 log
->bios_event_log
= kmalloc(*sizep
, GFP_KERNEL
);
58 if (!log
->bios_event_log
) {
59 pr_err("%s: ERROR - Not enough memory for BIOS measurements\n",
64 log
->bios_event_log_end
= log
->bios_event_log
+ *sizep
;
66 memcpy(log
->bios_event_log
, __va(be64_to_cpup(basep
)), *sizep
);