Debian Codegraph @

src/vendorcode/google/chromeos/elog.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <acpi/acpi.h>
4 #include <bootstate.h>
5 #include <console/console.h>
6 #include <elog.h>
7 #include <security/vboot/misc.h>
8 #include <security/vboot/vboot_common.h>
9 #include <vb2_api.h>
10
11 static void elog_add_vboot_info(void *unused)
12 {
13 /*
14 * Skip logging boot info if CSE sync scheduled at payload.
15 * The payload should log boot info after CSE sync.
16 */
17 if (CONFIG(SOC_INTEL_CSE_LITE_SYNC_BY_PAYLOAD))
18 return;
19
20 /* Skip logging boot info in ACPI resume path */
21 if (acpi_is_wakeup_s3())
22 return;
23
24 struct vb2_context *ctx = vboot_get_context();
25 union vb2_fw_boot_info data = vb2api_get_fw_boot_info(ctx);
26 uint8_t width = offsetof(union vb2_fw_boot_info, recovery_reason);
27
28 if (vboot_recovery_mode_enabled())
29 width = sizeof(union vb2_fw_boot_info);
30
31 elog_add_event_raw(ELOG_TYPE_FW_VBOOT_INFO, &data, width);
32 }
33
34 #if CONFIG(POSTPONE_SPI_ACCESS)
35 BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, elog_add_vboot_info, NULL);
36 #else
37 BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, elog_add_vboot_info, NULL);
38 #endif