2 * Copyright 2012 IBM Corporation
4 * Author: Ashley Lai <ashleydlai@gmail.com>
5 * Nayna Jain <nayna@linux.vnet.ibm.com>
7 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
9 * Read the event log created by the firmware on PPC64
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
18 #include <linux/slab.h>
22 #include "tpm_eventlog.h"
24 int tpm_read_log_of(struct tpm_chip
*chip
)
26 struct device_node
*np
;
29 struct tpm_bios_log
*log
;
32 if (chip
->dev
.parent
&& chip
->dev
.parent
->of_node
)
33 np
= chip
->dev
.parent
->of_node
;
37 sizep
= of_get_property(np
, "linux,sml-size", NULL
);
38 basep
= of_get_property(np
, "linux,sml-base", NULL
);
39 if (sizep
== NULL
&& basep
== NULL
)
41 if (sizep
== NULL
|| basep
== NULL
)
45 dev_warn(&chip
->dev
, "%s: Event log area empty\n", __func__
);
49 log
->bios_event_log
= kmalloc(*sizep
, GFP_KERNEL
);
50 if (!log
->bios_event_log
)
53 log
->bios_event_log_end
= log
->bios_event_log
+ *sizep
;
55 memcpy(log
->bios_event_log
, __va(*basep
), *sizep
);