summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-05-25 16:19:58 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:39:23 -0700
commit900d20a8d6d5da9d84835ff16c4689f42379e8ee (patch)
tree39d23497f007b73ef993d3551ff2596e3ffeddc8 /common
parent7cdac50783854ed3d3b15179e6d8f2e1512765d6 (diff)
can separately enable vboot-related debug output
U-Boot debug output is very verbose, and sometimes does not help debugging verified boot related changes. This commit let us enable vboot-related debug output separately. BUG=chromium-os:15747 TEST=boot and see vboot-related debug output Cherry-pick: 84c65f7 Change-Id: I934d46654777347f09d9d3d71c55b3e478fd02c6 Reviewed-on: http://gerrit.chromium.org/gerrit/1532 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_cros.c1
-rw-r--r--common/cmd_cros_bootstub.c29
-rw-r--r--common/cmd_cros_developer_firmware.c23
-rw-r--r--common/cmd_cros_normal_firmware.c17
-rw-r--r--common/cmd_cros_rec.c15
5 files changed, 45 insertions, 40 deletions
diff --git a/common/cmd_cros.c b/common/cmd_cros.c
index a75a771bfde..e33bce6b536 100644
--- a/common/cmd_cros.c
+++ b/common/cmd_cros.c
@@ -14,6 +14,7 @@
#include <common.h>
#include <command.h>
#include <malloc.h>
+#include <chromeos/common.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/fmap.h>
#include <chromeos/gbb_bmpblk.h>
diff --git a/common/cmd_cros_bootstub.c b/common/cmd_cros_bootstub.c
index 252d2e9ad10..96d7d20eaa3 100644
--- a/common/cmd_cros_bootstub.c
+++ b/common/cmd_cros_bootstub.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <command.h>
#include <malloc.h>
+#include <chromeos/common.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/gpio.h>
#include <chromeos/kernel_shared_data.h>
@@ -49,7 +50,7 @@ int load_recovery_firmware(firmware_storage_t *file,
CONFIG_OFFSET_RECOVERY, CONFIG_LENGTH_RECOVERY,
recovery_firmware_buffer);
if (retval) {
- debug(PREFIX "cannot load recovery firmware\n");
+ VBDEBUG(PREFIX "cannot load recovery firmware\n");
}
return retval;
@@ -57,7 +58,7 @@ int load_recovery_firmware(firmware_storage_t *file,
void jump_to_firmware(void (*firmware_entry_point)(void))
{
- debug(PREFIX "jump to firmware %p\n", firmware_entry_point);
+ VBDEBUG(PREFIX "jump to firmware %p\n", firmware_entry_point);
cleanup_before_linux();
@@ -66,7 +67,7 @@ void jump_to_firmware(void (*firmware_entry_point)(void))
/* FIXME(clchiou) Bring up a sad face as boot has failed */
enable_interrupts();
- debug(PREFIX "error: firmware returns\n");
+ VBDEBUG(PREFIX "error: firmware returns\n");
while (1);
}
@@ -82,7 +83,7 @@ int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (firmware_storage_init(&file)) {
/* FIXME(clchiou) Bring up a sad face as boot has failed */
- debug(PREFIX "init_firmware_storage fail\n");
+ VBDEBUG(PREFIX "init_firmware_storage fail\n");
while (1);
}
@@ -97,26 +98,26 @@ int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (read_nvcontext(&nvcxt) || VbNvGet(&nvcxt, VBNV_RECOVERY_REQUEST,
&recovery_request)) {
- debug(PREFIX "fail to read nvcontext\n");
+ VBDEBUG(PREFIX "fail to read nvcontext\n");
reason = VBNV_RECOVERY_US_UNSPECIFIED;
goto RECOVERY;
}
/* clear VBNV_DEBUG_RESET_MODE after read */
if (VbNvSet(&nvcxt, VBNV_DEBUG_RESET_MODE, 0)) {
- debug(PREFIX "fail to write nvcontext\n");
+ VBDEBUG(PREFIX "fail to write nvcontext\n");
reason = VBNV_RECOVERY_US_UNSPECIFIED;
goto RECOVERY;
}
if (recovery_request != VBNV_RECOVERY_NOT_REQUESTED) {
- debug(PREFIX "boot recovery cookie set\n");
+ VBDEBUG(PREFIX "boot recovery cookie set\n");
reason = recovery_request;
goto RECOVERY;
}
if (is_recovery_mode_gpio_asserted()) {
- debug(PREFIX "recovery button pressed\n");
+ VBDEBUG(PREFIX "recovery button pressed\n");
reason = VBNV_RECOVERY_RO_MANUAL;
goto RECOVERY;
}
@@ -128,7 +129,7 @@ int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
boot_flags, &nvcxt, NULL, &firmware_data);
if (nvcxt.raw_changed && write_nvcontext(&nvcxt)) {
- debug(PREFIX "fail to write nvcontext\n");
+ VBDEBUG(PREFIX "fail to write nvcontext\n");
reason = VBNV_RECOVERY_US_UNSPECIFIED;
goto RECOVERY;
}
@@ -142,7 +143,7 @@ int do_cros_bootstub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* assert(status == LOAD_FIRMWARE_RECOVERY) */
RECOVERY:
- debug(PREFIX "write to recovery cookie\n");
+ VBDEBUG(PREFIX "write to recovery cookie\n");
/*
* Although writing back VbNvContext cookies may fail, we boot
@@ -154,20 +155,20 @@ RECOVERY:
if (reason != VBNV_RECOVERY_NOT_REQUESTED &&
VbNvSet(&nvcxt, VBNV_RECOVERY_REQUEST, reason)) {
/* FIXME: bring up a sad face? */
- debug(PREFIX "error: cannot write recovery reason\n");
+ VBDEBUG(PREFIX "error: cannot write recovery reason\n");
}
if (VbNvTeardown(&nvcxt)) {
/* FIXME: bring up a sad face? */
- debug(PREFIX "error: cannot tear down cookie\n");
+ VBDEBUG(PREFIX "error: cannot tear down cookie\n");
}
if (nvcxt.raw_changed && write_nvcontext(&nvcxt)) {
/* FIXME: bring up a sad face? */
- debug(PREFIX "error: cannot write recovery cookie\n");
+ VBDEBUG(PREFIX "error: cannot write recovery cookie\n");
}
- debug(PREFIX "jump to recovery firmware and never return\n");
+ VBDEBUG(PREFIX "jump to recovery firmware and never return\n");
firmware_data = malloc(CONFIG_LENGTH_RECOVERY);
WARN_ON_FAILURE(load_recovery_firmware(&file, firmware_data));
diff --git a/common/cmd_cros_developer_firmware.c b/common/cmd_cros_developer_firmware.c
index 0e1754dd728..23ca1cd78f4 100644
--- a/common/cmd_cros_developer_firmware.c
+++ b/common/cmd_cros_developer_firmware.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <command.h>
#include <mmc.h>
+#include <chromeos/common.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/gbb_bmpblk.h>
#include <chromeos/gpio.h>
@@ -41,7 +42,7 @@ int do_cros_normal_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
static void beep(void)
{
/* TODO: implement beep */
- debug(PREFIX "beep\n");
+ VBDEBUG(PREFIX "beep\n");
}
static int unblocked_getc(int *c)
@@ -67,12 +68,12 @@ int do_cros_developer_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
int c, is_after_20_seconds = 0;
if (!is_developer_mode_gpio_asserted()) {
- debug(PREFIX "developer switch is off; reboot to recovery!\n");
+ VBDEBUG(PREFIX "developer switch is off; reboot to recovery!\n");
reboot_to_recovery_mode(VBNV_RECOVERY_RW_DEV_MISMATCH);
}
if (TlclStubInit() != TPM_SUCCESS) {
- debug(PREFIX "fail to init tpm\n");
+ VBDEBUG(PREFIX "fail to init tpm\n");
reboot_to_recovery_mode(VBNV_RECOVERY_RW_TPM_ERROR);
}
@@ -82,17 +83,17 @@ int do_cros_developer_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
* FIXME: We can't read gbb and so can't show a face on screen;
* how should we do when this happen? Trap in infinite loop?
*/
- debug(PREFIX "cannot load gbb\n");
+ VBDEBUG(PREFIX "cannot load gbb\n");
while (1);
}
/* we don't care whether close operation fails */
if (file.close(file.context)) {
- debug(PREFIX "close firmware storage failed\n");
+ VBDEBUG(PREFIX "close firmware storage failed\n");
}
if (display_screen_in_bmpblk(gbb_data, SCREEN_DEVELOPER_MODE)) {
- debug(PREFIX "cannot display stuff on LCD screen\n");
+ VBDEBUG(PREFIX "cannot display stuff on LCD screen\n");
}
start = get_timer(0);
@@ -104,7 +105,7 @@ int do_cros_developer_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
#ifdef DEBUG
/* only output when time advances at least 1 second */
if (time / CONFIG_SYS_HZ > last_time / CONFIG_SYS_HZ)
- debug(PREFIX "time ~ %d sec\n", time / CONFIG_SYS_HZ);
+ VBDEBUG(PREFIX "time ~ %d sec\n", time / CONFIG_SYS_HZ);
#endif
/* Beep twice when time > 20 seconds */
@@ -121,7 +122,7 @@ int do_cros_developer_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
if (!unblocked_getc(&c))
continue;
- debug(PREFIX "unblocked_getc() == 0x%x\n", c);
+ VBDEBUG(PREFIX "unblocked_getc() == 0x%x\n", c);
/* Load and boot kernel from USB or SD card */
if (CTRL_U == c) {
@@ -129,7 +130,7 @@ int do_cros_developer_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
load_and_boot_kernel(gbb_data, gbb_size,
boot_flags);
- debug(PREFIX "Fail to probe usb and mmc\n");
+ VBDEBUG(PREFIX "Fail to probe usb and mmc\n");
beep();
}
@@ -138,12 +139,12 @@ int do_cros_developer_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
break;
if (c == ' ' || c == '\r' || c == '\n' || c == ESCAPE) {
- debug(PREFIX "reboot to recovery mode\n");
+ VBDEBUG(PREFIX "reboot to recovery mode\n");
reboot_to_recovery_mode(VBNV_RECOVERY_RW_DEV_SCREEN);
}
}
- debug(PREFIX "boot from internal storage\n");
+ VBDEBUG(PREFIX "boot from internal storage\n");
if (is_mmc_storage_present(MMC_EMMC_DEVNUM) &&
!set_bootdev("mmc", MMC_EMMC_DEVNUM, 0))
load_and_boot_kernel(gbb_data, gbb_size, boot_flags);
diff --git a/common/cmd_cros_normal_firmware.c b/common/cmd_cros_normal_firmware.c
index 461a863d3a5..d9e7954344a 100644
--- a/common/cmd_cros_normal_firmware.c
+++ b/common/cmd_cros_normal_firmware.c
@@ -15,6 +15,7 @@
#include <fat.h>
#include <malloc.h>
#include <mmc.h>
+#include <chromeos/common.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/load_firmware_helper.h>
#include <chromeos/load_kernel_helper.h>
@@ -37,13 +38,13 @@
int initialize_drive(void)
{
if (initialize_mmc_device(DEVICE_NUMBER)) {
- debug(PREFIX "mmc %d init fail\n", DEVICE_NUMBER);
+ VBDEBUG(PREFIX "mmc %d init fail\n", DEVICE_NUMBER);
return -1;
}
- debug(PREFIX "set_bootdev %s %x:0\n", DEVICE_TYPE, DEVICE_NUMBER);
+ VBDEBUG(PREFIX "set_bootdev %s %x:0\n", DEVICE_TYPE, DEVICE_NUMBER);
if (set_bootdev(DEVICE_TYPE, DEVICE_NUMBER, 0)) {
- debug(PREFIX "set_bootdev fail\n");
+ VBDEBUG(PREFIX "set_bootdev fail\n");
return -1;
}
@@ -60,26 +61,26 @@ int do_cros_normal_firmware(cmd_tbl_t *cmdtp, int flag, int argc,
uint32_t reason = VBNV_RECOVERY_RW_UNSPECIFIED;
if (TlclStubInit() != TPM_SUCCESS) {
- debug(PREFIX "fail to init tpm\n");
+ VBDEBUG(PREFIX "fail to init tpm\n");
reboot_to_recovery_mode(VBNV_RECOVERY_RW_TPM_ERROR);
}
if (initialize_drive()) {
- debug(PREFIX "error: initialize fixed drive fail\n");
+ VBDEBUG(PREFIX "error: initialize fixed drive fail\n");
reboot_to_recovery_mode(VBNV_RECOVERY_RW_NO_OS);
}
if (firmware_storage_init(&file) ||
load_gbb(&file, &gbb_data, &gbb_size)) {
- debug(PREFIX "error: cannot read gbb\n");
+ VBDEBUG(PREFIX "error: cannot read gbb\n");
reboot_to_recovery_mode(VBNV_RECOVERY_RO_SHARED_DATA);
}
status = load_and_boot_kernel(gbb_data, gbb_size, 0ULL);
- debug(PREFIX "status == %d\n", status);
+ VBDEBUG(PREFIX "status == %d\n", status);
if (status == LOAD_KERNEL_REBOOT) {
- debug(PREFIX "internal error: reboot to current mode\n");
+ VBDEBUG(PREFIX "internal error: reboot to current mode\n");
cold_reboot();
}
diff --git a/common/cmd_cros_rec.c b/common/cmd_cros_rec.c
index 83a06621d9a..28c71b60624 100644
--- a/common/cmd_cros_rec.c
+++ b/common/cmd_cros_rec.c
@@ -16,6 +16,7 @@
#include <lcd.h>
#include <malloc.h>
#include <usb.h> /* for wait_ms() */
+#include <chromeos/common.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/load_firmware_helper.h>
#include <chromeos/load_kernel_helper.h>
@@ -37,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define WARN_ON_FAILURE(action) do { \
int return_code = (action); \
if (return_code != 0) \
- debug(PREFIX "%s failed, returning %d\n", \
+ VBDEBUG(PREFIX "%s failed, returning %d\n", \
#action, return_code); \
} while (0)
#else
@@ -87,7 +88,7 @@ static int exclude_mem_region(uint32_t start, uint32_t end)
int i = g_excluded_size;
if (g_excluded_size >= MAX_EXCLUDED_REGIONS) {
- debug(PREFIX "the number of excluded regions reaches"
+ VBDEBUG(PREFIX "the number of excluded regions reaches"
"the maximum: %d\n", MAX_EXCLUDED_REGIONS);
return -1;
}
@@ -107,7 +108,7 @@ static int exclude_mem_region(uint32_t start, uint32_t end)
static void zero_mem(uint32_t start, uint32_t end)
{
if (end > start) {
- debug(PREFIX "\t[0x%08x, 0x%08x)\n", start, end);
+ VBDEBUG(PREFIX "\t[0x%08x, 0x%08x)\n", start, end);
memset((void *)start, '\0', (size_t)(end - start));
}
}
@@ -120,7 +121,7 @@ static void clear_mem_regions(void)
int i;
uint32_t addr = g_memory_region.start;
- debug(PREFIX "clear memory regions:\n");
+ VBDEBUG(PREFIX "clear memory regions:\n");
for (i = 0; i < g_excluded_size; ++i) {
zero_mem(addr, g_excluded_regions[i].start);
if (g_excluded_regions[i].end > addr)
@@ -156,7 +157,7 @@ static int test_clear_mem_regions(void)
clear_mem_regions();
for (i = 0; i < 10; ++i) {
if (s[i] != r[i]) {
- debug(PREFIX "test_clear_mem_regions FAILED!\n");
+ VBDEBUG(PREFIX "test_clear_mem_regions FAILED!\n");
return -1;
}
}
@@ -206,12 +207,12 @@ static int init_gbb_in_ram(void)
void *gbb_base = NULL;
if (firmware_storage_init(&file)) {
- debug(PREFIX "init firmware storage failed\n");
+ VBDEBUG(PREFIX "init firmware storage failed\n");
return -1;
}
if (load_gbb(&file, &gbb_base, &g_gbb_size)) {
- debug(PREFIX "Unable to load gbb\n");
+ VBDEBUG(PREFIX "Unable to load gbb\n");
return -1;
}