From fa582200543391e80f43c9eef0cc9b394c674df9 Mon Sep 17 00:00:00 2001 From: Che-Liang Chiou Date: Mon, 13 Jun 2011 19:07:11 -0700 Subject: CHROMIUM: add prototype onestop firmware The onestop firmware boot flow is (pseudo code): -------------------------------- init internal state if fail fatal and reboot if user presses recovery button or recovery is requested do recovery boot flow init VbSharedData if fail fatal and reboot do rewritable boot flow -------------------------------- The rewritable boot flow is normal plus developer boot flow; it is like the Cr-48 style of rewritable firmware that does both. The VbSharedData initialization partially simulates LoadFirmware function by pretending that rewritable firmware A is loaded. As a result, the initialization codes break the encapsulation of vboot_reference library and access to private functions of the library. To fix this break of encapsulation, the library should implement and expose a new top-level entry point for initializing VbSharedData without calling LoadFirmware. Known issue: It cannot always properly initialize external mmc device; it stops at initializing SD card. When trying to initialize external mmc device, u-boot shows -------------------------------- mmc_prepare_data: Unaligned data, using slower bounce buffer -------------------------------- and then stops. BUG=chromium-os:16508 TEST=manual Launch onestop firmware and see it boots from internal mmc device (in normal or developer mode) or from external USB device (in developer or recovery mode) Change-Id: If8a2c98b0df7371bcd880a4aa470974e2cc6e544 Reviewed-on: http://gerrit.chromium.org/gerrit/2579 Tested-by: Che-Liang Chiou Reviewed-by: Simon Glass --- lib/chromeos/kernel_shared_data.c | 9 ++------- lib/chromeos/vboot_nvstorage_helper.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'lib/chromeos') diff --git a/lib/chromeos/kernel_shared_data.c b/lib/chromeos/kernel_shared_data.c index b9e89e49074..690b76dd6ec 100644 --- a/lib/chromeos/kernel_shared_data.c +++ b/lib/chromeos/kernel_shared_data.c @@ -113,16 +113,11 @@ int cros_ksd_set_fwid(void *kernel_shared_data, uint8_t *fwid) return 0; } -int cros_ksd_set_active_main_firmware(void *kernel_shared_data, int which) +int cros_ksd_set_active_main_firmware(void *kernel_shared_data, + int which, int type) { KernelSharedDataType *sd = (KernelSharedDataType *)kernel_shared_data; sd->binf[1] = which; - return 0; -} - -int cros_ksd_set_active_firmware_type(void *kernel_shared_data, int type) -{ - KernelSharedDataType *sd = (KernelSharedDataType *)kernel_shared_data; sd->binf[3] = type; return 0; } diff --git a/lib/chromeos/vboot_nvstorage_helper.c b/lib/chromeos/vboot_nvstorage_helper.c index 4981221c954..ea4d9a38211 100644 --- a/lib/chromeos/vboot_nvstorage_helper.c +++ b/lib/chromeos/vboot_nvstorage_helper.c @@ -89,3 +89,18 @@ int write_nvcontext(VbNvContext *nvcxt) free(buf); return 1 != nblk; } + +char *nvcontext_to_str(VbNvContext *nvcxt) +{ + static char buf[VBNV_BLOCK_SIZE * 2]; + int i, j, x; + + for (i = 0; i < VBNV_BLOCK_SIZE; i++) { + x = nvcxt->raw[i]; + j = i << 1; + buf[j] = "0123456789abcdef"[(x >> 4) & 0xf]; + buf[j+1] = "0123456789abcdef"[x & 0xf]; + } + + return buf; +} -- cgit v1.2.3