switch-coreboot/src/vendorcode/google/chromeos/elog.c
Furquan Shaikh 44d10230b9 UPSTREAM: chromeos: Clean up elog handling
1. Currenty, boot reason is being added to elog only for some
ARM32/ARM64 platforms. Change this so that boot reason is logged by
default in elog for all devices which have CHROMEOS selected.

2. Add a new option to select ELOG_WATCHDOG_RESET for the devices that
want to add details about watchdog reset in elog. This requires a
special region WATCHDOG to be present in the memlayout.

3. Remove calls to elog add boot reason and watchdog reset from
mainboards.

BUG=chrome-os-partner:55639
BRANCH=None
TEST=None

Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/15897
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins)

Change-Id: I91ff5b158cfd2a0749e7fefc498d8659f7e6aa91
Reviewed-on: https://chromium-review.googlesource.com/364021
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2016-07-28 22:56:42 -07:00

47 lines
1.4 KiB
C

/*
* This file is part of the coreboot project.
*
* Copyright (C) 2014 The ChromiumOS Authors. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <bootstate.h>
#include <cbmem.h>
#include <console/console.h>
#include <elog.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <vboot/vbnv.h>
#include <vboot/vboot_common.h>
#include <vboot_struct.h>
static void elog_add_boot_reason(void *unused)
{
int rec = vboot_recovery_mode_enabled();
int dev = vboot_developer_mode_enabled();
if (!rec && !dev)
return;
if (rec) {
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);
}
if (dev) {
elog_add_event(ELOG_TYPE_CROS_DEVELOPER_MODE);
printk(BIOS_DEBUG, "%s: Logged dev mode boot\n", __func__);
}
}
BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, elog_add_boot_reason, NULL);