summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commonlib/bsd/include/commonlib/bsd/elog.h5
-rw-r--r--src/vendorcode/google/chromeos/elog.c29
2 files changed, 32 insertions, 2 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/elog.h b/src/commonlib/bsd/include/commonlib/bsd/elog.h
index 44f1051957..63761ebf53 100644
--- a/src/commonlib/bsd/include/commonlib/bsd/elog.h
+++ b/src/commonlib/bsd/include/commonlib/bsd/elog.h
@@ -314,6 +314,11 @@ struct elog_event_extended_event {
uint32_t event_complement;
} __packed;
+/*
+ * Firmware boot related information retrieved from vboot and store as
+ * per `union vb2_fw_boot_info` data structure.
+ */
+#define ELOG_TYPE_FW_VBOOT_INFO 0xb7
/* Only the 7-LSB are used for size */
#define ELOG_MAX_EVENT_SIZE 0x7F
diff --git a/src/vendorcode/google/chromeos/elog.c b/src/vendorcode/google/chromeos/elog.c
index b7f7c8d8fc..d8304f8b30 100644
--- a/src/vendorcode/google/chromeos/elog.c
+++ b/src/vendorcode/google/chromeos/elog.c
@@ -6,8 +6,9 @@
#include <elog.h>
#include <security/vboot/misc.h>
#include <security/vboot/vboot_common.h>
+#include <vb2_api.h>
-static void elog_add_boot_reason(void *unused)
+static void elog_add_boot_reason(void)
{
const int rec = vboot_recovery_mode_enabled();
const int dev = vboot_developer_mode_enabled();
@@ -33,4 +34,28 @@ static void elog_add_boot_reason(void *unused)
}
}
-BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, elog_add_boot_reason, NULL);
+static void elog_add_vboot_info(void)
+{
+ /* Skip logging boot info in ACPI resume path */
+ if (acpi_is_wakeup_s3())
+ return;
+
+ struct vb2_context *ctx = vboot_get_context();
+ union vb2_fw_boot_info data = vb2api_get_fw_boot_info(ctx);
+ uint8_t width = offsetof(union vb2_fw_boot_info, recovery_reason);
+
+ if (vboot_recovery_mode_enabled())
+ width = sizeof(union vb2_fw_boot_info);
+
+ elog_add_event_raw(ELOG_TYPE_FW_VBOOT_INFO, &data, width);
+}
+
+static void elog_add_boot_records(void *unused)
+{
+ /* Log boot reason into the eventlog */
+ elog_add_boot_reason();
+ /* Log fw vboot info into the eventlog */
+ elog_add_vboot_info();
+}
+
+BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, elog_add_boot_records, NULL);