summaryrefslogtreecommitdiff
path: root/src/vendorcode/google/chromeos/elog.c
blob: 4d3fc4053741cc71a027473aee9d8d05ba1de17d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* SPDX-License-Identifier: GPL-2.0-only */

#include <acpi/acpi.h>
#include <bootstate.h>
#include <console/console.h>
#include <elog.h>
#include <security/vboot/misc.h>
#include <security/vboot/vboot_common.h>
#include <vb2_api.h>

static void elog_add_vboot_info(void *unused)
{
	/* 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);
}

BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, elog_add_vboot_info, NULL);