diff options
-rw-r--r-- | src/commonlib/bsd/include/commonlib/bsd/elog.h | 10 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/elog.c | 38 | ||||
-rw-r--r-- | util/cbfstool/eventlog.c | 117 |
3 files changed, 16 insertions, 149 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/elog.h b/src/commonlib/bsd/include/commonlib/bsd/elog.h index 63761ebf53..b49b375500 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/elog.h +++ b/src/commonlib/bsd/include/commonlib/bsd/elog.h @@ -204,9 +204,9 @@ struct elog_event_data_wake { } __packed; /* ChromeOS related events */ -#define ELOG_TYPE_CROS_DEVELOPER_MODE 0xa0 -#define ELOG_TYPE_CROS_RECOVERY_MODE 0xa1 -#define ELOG_CROS_RECOVERY_MODE_BUTTON 0x02 +#define ELOG_DEPRECATED_TYPE_CROS_DEVELOPER_MODE 0xa0 +#define ELOG_DEPRECATED_TYPE_CROS_RECOVERY_MODE 0xa1 +#define ELOG_DEPRECATED_CROS_RECOVERY_MODE_BUTTON 0x02 /* Management Engine Events */ #define ELOG_TYPE_MANAGEMENT_ENGINE 0xa2 @@ -306,8 +306,8 @@ struct elog_event_mem_cache_update { #define ELOG_TYPE_MI_HR 0xb5 /* ChromeOS diagnostics-related events */ -#define ELOG_TYPE_CROS_DIAGNOSTICS 0xb6 -#define ELOG_CROS_LAUNCH_DIAGNOSTICS 0x01 +#define ELOG_DEPRECATED_TYPE_CROS_DIAGNOSTICS 0xb6 +#define ELOG_DEPRECATED_CROS_LAUNCH_DIAGNOSTICS 0x01 struct elog_event_extended_event { uint8_t event_type; diff --git a/src/vendorcode/google/chromeos/elog.c b/src/vendorcode/google/chromeos/elog.c index d8304f8b30..4d3fc40537 100644 --- a/src/vendorcode/google/chromeos/elog.c +++ b/src/vendorcode/google/chromeos/elog.c @@ -8,33 +8,7 @@ #include <security/vboot/vboot_common.h> #include <vb2_api.h> -static void elog_add_boot_reason(void) -{ - const int rec = vboot_recovery_mode_enabled(); - const int dev = vboot_developer_mode_enabled(); - - if (rec) { - const u8 reason = vboot_check_recovery_request(); - elog_add_event_byte(ELOG_TYPE_CROS_RECOVERY_MODE, reason); - printk(BIOS_DEBUG, "%s: Logged recovery mode boot%s, reason: 0x%02x\n", - __func__, dev ? " (Dev-switch on)" : "", reason); - } - - /* Skip logging developer mode in ACPI resume path */ - if (dev && !acpi_is_wakeup_s3()) { - elog_add_event(ELOG_TYPE_CROS_DEVELOPER_MODE); - printk(BIOS_DEBUG, "%s: Logged dev mode boot\n", __func__); - } - - /* Diagnostic boot if requested */ - if (vboot_get_context()->boot_mode == VB2_BOOT_MODE_DIAGNOSTICS) { - elog_add_event_byte(ELOG_TYPE_CROS_DIAGNOSTICS, - ELOG_CROS_LAUNCH_DIAGNOSTICS); - printk(BIOS_DEBUG, "%s: Logged diagnostic boot\n", __func__); - } -} - -static void elog_add_vboot_info(void) +static void elog_add_vboot_info(void *unused) { /* Skip logging boot info in ACPI resume path */ if (acpi_is_wakeup_s3()) @@ -50,12 +24,4 @@ static void elog_add_vboot_info(void) 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); +BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, elog_add_vboot_info, NULL); diff --git a/util/cbfstool/eventlog.c b/util/cbfstool/eventlog.c index e9a4e8e734..bb42357659 100644 --- a/util/cbfstool/eventlog.c +++ b/util/cbfstool/eventlog.c @@ -141,8 +141,8 @@ static void eventlog_print_type(const struct event_header *event) {ELOG_TYPE_S0IX_ENTER, "S0ix Enter"}, {ELOG_TYPE_S0IX_EXIT, "S0ix Exit"}, {ELOG_TYPE_WAKE_SOURCE, "Wake Source"}, - {ELOG_TYPE_CROS_DEVELOPER_MODE, "ChromeOS Developer Mode"}, - {ELOG_TYPE_CROS_RECOVERY_MODE, "ChromeOS Recovery Mode"}, + {ELOG_DEPRECATED_TYPE_CROS_DEVELOPER_MODE, "ChromeOS Developer Mode"}, + {ELOG_DEPRECATED_TYPE_CROS_RECOVERY_MODE, "ChromeOS Recovery Mode"}, {ELOG_TYPE_MANAGEMENT_ENGINE, "Management Engine"}, {ELOG_TYPE_MANAGEMENT_ENGINE_EXT, "Management Engine Extra"}, {ELOG_TYPE_LAST_POST_CODE, "Last post code in previous boot"}, @@ -157,7 +157,7 @@ static void eventlog_print_type(const struct event_header *event) {ELOG_TYPE_CR50_NEED_RESET, "cr50 Reset Required"}, {ELOG_TYPE_EC_DEVICE_EVENT, "EC Device"}, {ELOG_TYPE_EXTENDED_EVENT, "Extended Event"}, - {ELOG_TYPE_CROS_DIAGNOSTICS, "Diagnostics Mode"}, + {ELOG_DEPRECATED_TYPE_CROS_DIAGNOSTICS, "Diagnostics Mode"}, {ELOG_TYPE_FW_VBOOT_INFO, "Firmware vboot info"}, {ELOG_TYPE_EOL, "End of log"}, @@ -353,105 +353,6 @@ static int eventlog_print_data(const struct event_header *event) {ELOG_EC_DEVICE_EVENT_WIFI, "WiFi"}, {0, NULL}, }; - - static const struct valstr cros_recovery_reasons[] = { - {VB2_RECOVERY_LEGACY, "Legacy Utility"}, - {VB2_RECOVERY_RO_MANUAL, "Recovery Button Pressed"}, - {VB2_RECOVERY_RO_INVALID_RW, "RW Failed Signature Check"}, - {VB2_RECOVERY_DEPRECATED_RO_S3_RESUME, "S3 Resume Failed"}, - {VB2_RECOVERY_DEPRECATED_RO_TPM_ERROR, "TPM Error in RO Firmware"}, - {VB2_RECOVERY_RO_SHARED_DATA, "Shared Data Error in RO Firmware"}, - {VB2_RECOVERY_DEPRECATED_RO_TEST_S3, "Test Error from S3 Resume()"}, - {VB2_RECOVERY_DEPRECATED_RO_TEST_LF, "Test Error from LoadFirmware()"}, - {VB2_RECOVERY_DEPRECATED_RO_TEST_LFS, "Test Error from LoadFirmwareSetup()"}, - {VB2_RECOVERY_DEPRECATED_RW_NOT_DONE, "RW firmware check not done"}, - {VB2_RECOVERY_DEPRECATED_RW_DEV_FLAG_MISMATCH, - "RW firmware developer flag mismatch"}, - {VB2_RECOVERY_DEPRECATED_RW_REC_FLAG_MISMATCH, - "RW firmware recovery flash mismatch"}, - {VB2_RECOVERY_FW_KEYBLOCK, "RW firmware unable to verify keyblock"}, - {VB2_RECOVERY_FW_KEY_ROLLBACK, "RW firmware key version rollback detected"}, - {VB2_RECOVERY_DEPRECATED_RW_DATA_KEY_PARSE, - "RW firmware unable to parse data key"}, - {VB2_RECOVERY_FW_PREAMBLE, "RW firmware unable to verify preamble"}, - {VB2_RECOVERY_FW_ROLLBACK, "RW firmware version rollback detected"}, - {VB2_RECOVERY_DEPRECATED_FW_HEADER_VALID, "RW firmware header is valid"}, - {VB2_RECOVERY_DEPRECATED_FW_GET_FW_BODY, - "RW firmware unable to get firmware body"}, - {VB2_RECOVERY_DEPRECATED_FW_HASH_WRONG_SIZE, "RW firmware hash is wrong size"}, - {VB2_RECOVERY_FW_BODY, "RW firmware unable to verify firmware body"}, - {VB2_RECOVERY_DEPRECATED_FW_VALID, "RW firmware is valid"}, - {VB2_RECOVERY_DEPRECATED_FW_NO_RO_NORMAL, - "RW firmware read-only normal path is not supported"}, - {VB2_RECOVERY_RO_FIRMWARE, "Firmware Boot Failure"}, - {VB2_RECOVERY_RO_TPM_REBOOT, "Recovery Mode TPM Reboot"}, - {VB2_RECOVERY_EC_SOFTWARE_SYNC, "EC Software Sync Error"}, - {VB2_RECOVERY_EC_UNKNOWN_IMAGE, "Unable to determine active EC image"}, - {VB2_RECOVERY_DEPRECATED_EC_HASH, - "EC software sync error obtaining EC image hash"}, - {VB2_RECOVERY_DEPRECATED_EC_EXPECTED_IMAGE, - "EC software sync error obtaining expected EC image from BIOS"}, - {VB2_RECOVERY_EC_UPDATE, "EC software sync error updating EC"}, - {VB2_RECOVERY_EC_JUMP_RW, "EC software sync unable to jump to EC-RW"}, - {VB2_RECOVERY_EC_PROTECT, "EC software sync protection error"}, - {VB2_RECOVERY_EC_EXPECTED_HASH, - "EC software sync error obtaining expected EC hash from BIOS"}, - {VB2_RECOVERY_DEPRECATED_EC_HASH_MISMATCH, - "EC software sync error comparing expected EC hash and image"}, - {VB2_RECOVERY_SECDATA_FIRMWARE_INIT, "Secure NVRAM (TPM) initialization error"}, - {VB2_RECOVERY_GBB_HEADER, "Error parsing GBB header"}, - {VB2_RECOVERY_TPM_CLEAR_OWNER, "Error trying to clear TPM owner"}, - {VB2_RECOVERY_DEV_SWITCH, "Error reading or updating developer switch"}, - {VB2_RECOVERY_FW_SLOT, "Error selecting RW firmware slot"}, - {VB2_RECOVERY_AUXFW_UPDATE, "Error updating AUX firmware"}, - {VB2_RECOVERY_INTEL_CSE_LITE_SKU, "Intel CSE Lite SKU fimrware failure"}, - {VB2_RECOVERY_RO_UNSPECIFIED, "Unknown Error in RO Firmware"}, - {VB2_RECOVERY_DEPRECATED_RW_DEV_SCREEN, "User Requested from Developer Screen"}, - {VB2_RECOVERY_DEPRECATED_RW_NO_OS, "No OS Kernel Detected"}, - {VB2_RECOVERY_RW_INVALID_OS, "OS kernel or rootfs failed signature check"}, - {VB2_RECOVERY_DEPRECATED_RW_TPM_ERROR, "TPM Error in RW Firmware"}, - {VB2_RECOVERY_DEPRECATED_RW_DEV_MISMATCH, "RW Dev Firmware but not Dev Mode"}, - {VB2_RECOVERY_RW_SHARED_DATA, "Shared Data Error in RW Firmware"}, - {VB2_RECOVERY_DEPRECATED_RW_TEST_LK, "Test Error from LoadKernel()"}, - {VB2_RECOVERY_DEPRECATED_RW_NO_DISK, "No Bootable Disk Found"}, - {VB2_RECOVERY_TPM_E_FAIL, "TPM_E_FAIL or TPM_E_FAILEDSELFTEST"}, - {VB2_RECOVERY_RO_TPM_S_ERROR, "TPM setup error in read-only firmware"}, - {VB2_RECOVERY_RO_TPM_W_ERROR, "TPM write error in read-only firmware"}, - {VB2_RECOVERY_RO_TPM_L_ERROR, "TPM lock error in read-only firmware"}, - {VB2_RECOVERY_RO_TPM_U_ERROR, "TPM update error in read-only firmware"}, - {VB2_RECOVERY_RW_TPM_R_ERROR, "TPM read error in rewritable firmware"}, - {VB2_RECOVERY_RW_TPM_W_ERROR, "TPM write error in rewritable firmware"}, - {VB2_RECOVERY_RW_TPM_L_ERROR, "TPM lock error in rewritable firmware"}, - {VB2_RECOVERY_EC_HASH_FAILED, "EC software sync unable to get EC image hash"}, - {VB2_RECOVERY_EC_HASH_SIZE, "EC software sync invalid image hash size"}, - {VB2_RECOVERY_LK_UNSPECIFIED, "Unspecified error while trying to load kernel"}, - {VB2_RECOVERY_RW_NO_DISK, "No bootable storage device in system"}, - {VB2_RECOVERY_RW_NO_KERNEL, "No bootable kernel found on disk"}, - {VB2_RECOVERY_DEPRECATED_RW_BCB_ERROR, "BCB partition error on disk"}, - {VB2_RECOVERY_SECDATA_KERNEL_INIT, - "Kernel secure NVRAM (TPM) initialization error"}, - {VB2_RECOVERY_DEPRECATED_FW_FASTBOOT, "Fastboot-mode requested in firmware"}, - {VB2_RECOVERY_RO_TPM_REC_HASH_L_ERROR, - "Recovery hash space lock error in RO firmware"}, - {VB2_RECOVERY_TPM_DISABLE_FAILED, - "Failed to disable TPM before running untrusted code"}, - {VB2_RECOVERY_ALTFW_HASH_MISMATCH, - "Verification of alternative firmware payload failed"}, - {VB2_RECOVERY_SECDATA_FWMP_INIT, "FWMP secure data initialization failed"}, - {VB2_RECOVERY_CR50_BOOT_MODE, "Failed to get boot mode from TPM/Cr50"}, - {VB2_RECOVERY_ESCAPE_NO_BOOT, - "Attempt to escape from NO_BOOT mode was detected"}, - {VB2_RECOVERY_RW_UNSPECIFIED, "Unspecified/unknown error in RW firmware"}, - {VB2_RECOVERY_DEPRECATED_KE_DM_VERITY, "DM-verity error"}, - {VB2_RECOVERY_DEPRECATED_KE_UNSPECIFIED, "Unspecified/unknown error in kernel"}, - {VB2_RECOVERY_US_TEST, "Recovery mode test from user-mode"}, - {VB2_RECOVERY_DEPRECATED_BCB_USER_MODE, "User-mode requested recovery via BCB"}, - {VB2_RECOVERY_DEPRECATED_US_FASTBOOT, "User-mode requested fastboot mode"}, - {VB2_RECOVERY_TRAIN_AND_REBOOT, - "User requested recovery for training memory and rebooting"}, - {VB2_RECOVERY_US_UNSPECIFIED, "Unknown Error in User Mode"}, - {0, NULL}, - }; static const struct valstr me_path_types[] = { {ELOG_ME_PATH_NORMAL, "Normal"}, {ELOG_ME_PATH_NORMAL, "S3 Wake"}, @@ -535,8 +436,8 @@ static int eventlog_print_data(const struct event_header *event) {0, NULL}, }; - static const struct valstr cros_diagnostics_types[] = { - {ELOG_CROS_LAUNCH_DIAGNOSTICS, "Launch Diagnostics"}, + static const struct valstr cros_deprecated_diagnostics_types[] = { + {ELOG_DEPRECATED_CROS_LAUNCH_DIAGNOSTICS, "Launch Diagnostics"}, {0, NULL}, }; @@ -596,9 +497,9 @@ static int eventlog_print_data(const struct event_header *event) eventlog_printf("%s", val2str(*dev_event, ec_device_event_types)); break; } - case ELOG_TYPE_CROS_RECOVERY_MODE: { + case ELOG_DEPRECATED_TYPE_CROS_RECOVERY_MODE: { const uint8_t *reason = event_get_data(event); - eventlog_printf("%s", val2str(*reason, cros_recovery_reasons)); + eventlog_printf("%s", vb2_get_recovery_reason_string(*reason)); eventlog_printf("0x%02x", *reason); break; } @@ -621,9 +522,9 @@ static int eventlog_print_data(const struct event_header *event) eventlog_printf("0x%X", ext_event->event_complement); break; } - case ELOG_TYPE_CROS_DIAGNOSTICS: { + case ELOG_DEPRECATED_TYPE_CROS_DIAGNOSTICS: { const uint8_t *type = event_get_data(event); - eventlog_printf("%s", val2str(*type, cros_diagnostics_types)); + eventlog_printf("%s", val2str(*type, cros_deprecated_diagnostics_types)); break; } case ELOG_TYPE_FW_VBOOT_INFO: { |