summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/elog/Kconfig6
-rw-r--r--src/drivers/elog/Makefile.inc4
-rw-r--r--src/drivers/elog/elog.c18
3 files changed, 23 insertions, 5 deletions
diff --git a/src/drivers/elog/Kconfig b/src/drivers/elog/Kconfig
index c5ff7aeffe..da8a5fa220 100644
--- a/src/drivers/elog/Kconfig
+++ b/src/drivers/elog/Kconfig
@@ -36,6 +36,12 @@ config ELOG_CBMEM
but it means that events added at runtime via the SMI handler
will not be reflected in the CBMEM copy of the log.
+config ELOG_PRERAM
+ bool
+ default n
+ help
+ This option will enable event logging from the preram stage.
+
endif
config ELOG_GSMI
diff --git a/src/drivers/elog/Makefile.inc b/src/drivers/elog/Makefile.inc
index 79a7cc0f7f..cce1c3d6d7 100644
--- a/src/drivers/elog/Makefile.inc
+++ b/src/drivers/elog/Makefile.inc
@@ -1,3 +1,7 @@
+bootblock-$(CONFIG_ELOG_PRERAM) += elog.c
+verstage-$(CONFIG_ELOG_PRERAM) += elog.c
+romstage-$(CONFIG_ELOG_PRERAM) += elog.c
+postcar-$(CONFIG_ELOG_PRERAM) += elog.c
ramstage-$(CONFIG_ELOG) += elog.c
smm-$(CONFIG_ELOG_GSMI) += elog.c gsmi.c
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index e006ded265..0d16b2bed5 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -70,6 +70,14 @@ struct elog_state {
static struct elog_state g_elog_state CAR_GLOBAL;
+#define ELOG_SIZE (4 * KiB)
+static uint8_t elog_mirror_buf[ELOG_SIZE] CAR_GLOBAL;
+
+static void *get_elog_mirror_buffer(void)
+{
+ return car_get_var_ptr(elog_mirror_buf);
+}
+
static inline struct region_device *mirror_dev_get(void)
{
struct elog_state *es = car_get_var_ptr(&g_elog_state);
@@ -706,9 +714,9 @@ static int elog_find_flash(void)
return -1;
}
- if (region_device_sz(rdev) < 4*KiB) {
- printk(BIOS_WARNING, "ELOG: Needs a minimum size of 4KiB: %zu\n",
- region_device_sz(rdev));
+ if (region_device_sz(rdev) < ELOG_SIZE) {
+ printk(BIOS_WARNING, "ELOG: Needs a minimum size of %dKiB: %zu\n",
+ ELOG_SIZE / KiB, region_device_sz(rdev));
return -1;
}
@@ -716,7 +724,7 @@ static int elog_find_flash(void)
region_device_offset(rdev), region_device_sz(rdev));
/* Keep 4KiB max size until large malloc()s have been fixed. */
- total_size = MIN(4*KiB, region_device_sz(rdev));
+ total_size = MIN(ELOG_SIZE, region_device_sz(rdev));
rdev_chain(rdev, rdev, 0, total_size);
es->full_threshold = total_size - reserved_space;
@@ -828,7 +836,7 @@ int elog_init(void)
return -1;
elog_size = region_device_sz(&es->nv_dev);
- mirror_buffer = malloc(elog_size);
+ mirror_buffer = get_elog_mirror_buffer();
if (!mirror_buffer) {
printk(BIOS_ERR, "ELOG: Unable to allocate backing store\n");
return -1;