summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-08-11 19:16:20 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:28 -0700
commitc3a491a2ba4d15e787c3ce8e8ab54b49d3e6e079 (patch)
treec0891c723aabe0778165fadc47190c9393ed7092 /common
parentb1f0f438e3fd22c8c38b9820ea341e17c606ea6a (diff)
CHROMIUM: port test codes to current codebase
The test codes were not compiled because it depended on a prototype codebase which is not used/compiled now. This patch removes the dependency to the prototype codebase and let the test codes be enabled when VBOOT_DEBUG is defined. Because the test codes test GBB loader and we use a static buffer for holding GBB data, this patch also moves the location of GBB buffer to chromeos.h, which is globally accessible. BUG=chromium-os:16542 TEST=run "vboot_test all" and see all tests pass on Kaen TEST=run "vbexpot_test all" and see all tests pass on Kaen Change-Id: I24c7e51cd254f31b4b28fd0becdbc77fb4ede2f8 Reviewed-on: http://gerrit.chromium.org/gerrit/5729 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/Makefile4
-rw-r--r--common/cmd_vbexport_test.c14
-rw-r--r--common/cmd_vboot_twostop.c15
3 files changed, 7 insertions, 26 deletions
diff --git a/common/Makefile b/common/Makefile
index 7104a8b57f..71483a7851 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -74,11 +74,11 @@ COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
-COBJS-$(CONFIG_CMD_VBEXPORT_TEST) += cmd_vbexport_test.o
COBJS-$(CONFIG_CMD_VBOOT_BOOTSTUB) += cmd_vboot_bootstub.o
COBJS-$(CONFIG_CMD_VBOOT_MAIN) += cmd_vboot_main.o
-COBJS-$(CONFIG_CMD_VBOOT_TEST) += cmd_vboot_test.o
COBJS-$(CONFIG_CHROMEOS) += cmd_vboot_twostop.o
+COBJS-$(CONFIG_CHROMEOS_TEST) += cmd_vbexport_test.o
+COBJS-$(CONFIG_CHROMEOS_TEST) += cmd_vboot_test.o
COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
COBJS-$(CONFIG_CMD_DATE) += cmd_date.o
ifdef CONFIG_4xx
diff --git a/common/cmd_vbexport_test.c b/common/cmd_vbexport_test.c
index bfd3e14862..3813ce1810 100644
--- a/common/cmd_vbexport_test.c
+++ b/common/cmd_vbexport_test.c
@@ -19,7 +19,6 @@
#include <gbb_header.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/gbb.h>
-#include <vboot/global_data.h>
#include <vboot_api.h>
@@ -400,11 +399,9 @@ static int show_screen_and_delay(uint32_t screen_type)
static uint8_t *read_gbb_from_firmware(void)
{
- vb_global_t *global;
firmware_storage_t file;
struct twostop_fmap fmap;
-
- global = get_vboot_global();
+ void *gbb = (void *)GBB_ADDRESS;
if (decode_twostop_fmap(&fmap)) {
VbExDebug("Failed to load fmap config!\n");
@@ -417,13 +414,12 @@ static uint8_t *read_gbb_from_firmware(void)
return NULL;
}
- if (init_vboot_global(global, &file)) {
- VbExDebug("Failed to init vboot global data!\n");
+ if (gbb_init(gbb, &file, fmap.readonly.gbb.offset)) {
+ VbExDebug("Failed to read GBB!\n");
return NULL;
}
- if (gbb_read_bmp_block(global->gbb_data, &file,
- fmap.readonly.gbb.offset)) {
+ if (gbb_read_bmp_block(gbb, &file, fmap.readonly.gbb.offset)) {
VbExDebug("Failed to load BMP Block in GBB!\n");
return NULL;
}
@@ -432,7 +428,7 @@ static uint8_t *read_gbb_from_firmware(void)
VbExDebug("Failed to close firmware device!\n");
}
- return global->gbb_data;
+ return gbb;
}
static int show_images_and_delay(BmpBlockHeader *bmph, int index)
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c
index 2869835e02..3c1676f0b0 100644
--- a/common/cmd_vboot_twostop.c
+++ b/common/cmd_vboot_twostop.c
@@ -66,21 +66,6 @@
* initialized by the bootstub, and which are by the readwrite firmware.
*/
-/*
- * We use fixed memory address for the parameters --- this should be simpler
- * than atags or a register holding the address of the parameters. Besides,
- * Chrome OS kernel is loaded to a fixed location, we could simply use this
- * location as our anchor for the location of the parameters.
- */
-/*
- * Layout: first, the kernel buffer, then the crossystem data (and the
- * VbSharedData), and finally, the GBB.
- */
-#define CROSSYSTEM_DATA_ADDRESS \
- (CHROMEOS_KERNEL_LOADADDR + CHROMEOS_KERNEL_BUFSIZE)
-#define CROSSYSTEM_DATA_MAXSIZE 0x8000
-#define GBB_ADDRESS (CROSSYSTEM_DATA_ADDRESS + CROSSYSTEM_DATA_MAXSIZE)
-
DECLARE_GLOBAL_DATA_PTR;
/* The margin to keep extra stack region that not to be wiped. */