summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-07-26 22:10:16 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:13 -0700
commitd62fd066dbf5af9d6f44ce1d2f7e75f563b4fa9a (patch)
treea9f554080cf2d03d9417685de61e4f1b62e7612e /common
parent2ac50b8b2d5e25f839e883be37671433c9f005cc (diff)
CHROMIUM: factor out gbb loader functions
This patch also eliminates duplications of decoding fmap from the device tree. BUG=chromium-os:16542 TEST=make chromeos_seaboard_vboot_config && make Change-Id: I0af75335be10823b8644c94f6fc9aac0304a2633 Reviewed-on: http://gerrit.chromium.org/gerrit/4745 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_vbexport_test.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/common/cmd_vbexport_test.c b/common/cmd_vbexport_test.c
index 021aa5d4df0..b0cbf5e4bb3 100644
--- a/common/cmd_vbexport_test.c
+++ b/common/cmd_vbexport_test.c
@@ -18,10 +18,13 @@
#include <command.h>
#include <gbb_header.h>
#include <chromeos/firmware_storage.h>
+#include <chromeos/gbb.h>
#include <vboot/global_data.h>
#include <vboot_api.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#ifndef CACHE_LINE_SIZE
#define CACHE_LINE_SIZE __BIGGEST_ALIGNMENT__
#endif
@@ -395,11 +398,18 @@ static int show_screen_and_delay(uint32_t screen_type)
static uint8_t *read_gbb_from_firmware(void)
{
+ void *fdt_ptr = (void *)gd->blob;
vb_global_t *global;
firmware_storage_t file;
+ struct fdt_twostop_fmap fmap;
global = get_vboot_global();
+ if (fdt_decode_twostop_fmap(fdt_ptr, &fmap)) {
+ VbExDebug("Failed to load fmap config from fdt!\n");
+ return NULL;
+ }
+
/* Open firmware storage device. */
if (firmware_storage_open_spi(&file)) {
VbExDebug("Failed to open firmware device!\n");
@@ -411,7 +421,8 @@ static uint8_t *read_gbb_from_firmware(void)
return NULL;
}
- if (load_bmpblk_in_gbb(global, &file)) {
+ if (gbb_read_bmp_block(global->gbb_data, &file,
+ fmap.readonly.gbb.offset)) {
VbExDebug("Failed to load BMP Block in GBB!\n");
return NULL;
}