summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@chromium.org>2011-08-02 23:31:44 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:22 -0700
commitef090d2b8fdb901fd4a44e45492532916716b5bd (patch)
tree050e4c5c7ebc26188b9d87b5dfa0011c73078431
parent792f7f6ae53a75ad559e0c5c7092b3078467ef98 (diff)
Make the FMAP configuration decoding function board specific.
This change makes the FMAP configuration decoding function board specific so that it can, for instance, use CBFS to store the FMAP on x86. The ARM implementation uses fdt_decode_twostop_fmap in its implementation and should behave the same. The new more generic interace is called decode_twostop_fmap. BUG=chrome-os-partner:5248 TEST=Built, installed and booted on Kaen, built and installed on Alex, ran vboot_twostop and saw new "unimplemented" message. Signed-off-by: Gabe Black <gabeblack@google.com> Change-Id: I07f6f8f7c8a62c5998ec4919d4609a7ac84783da Reviewed-on: http://gerrit.chromium.org/gerrit/5233 Reviewed-by: Stefan Reinauer <reinauer@google.com> Tested-by: Gabe Black <gabeblack@chromium.org>
-rw-r--r--board/chromebook-x86/chromeos/Makefile1
-rw-r--r--board/chromebook-x86/chromeos/fmap.c21
-rw-r--r--board/nvidia/chromeos/Makefile1
-rw-r--r--board/nvidia/chromeos/fmap.c24
-rw-r--r--common/cmd_vbexport_test.c5
-rw-r--r--common/cmd_vboot_twostop.c4
-rw-r--r--include/chromeos/fmap.h4
-rw-r--r--lib/vboot/bootstub_entry.c4
-rw-r--r--lib/vboot/global_data.c4
9 files changed, 59 insertions, 9 deletions
diff --git a/board/chromebook-x86/chromeos/Makefile b/board/chromebook-x86/chromeos/Makefile
index a3eb6ec90f..4a74a221b6 100644
--- a/board/chromebook-x86/chromeos/Makefile
+++ b/board/chromebook-x86/chromeos/Makefile
@@ -39,6 +39,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)libchromeos_board.a
COBJS-$(CONFIG_CHROMEOS) += cros_gpio.o
+COBJS-$(CONFIG_CHROMEOS) += fmap.o
COBJS-$(CONFIG_CHROMEOS) += power_management.o
COBJS := $(COBJS-y)
diff --git a/board/chromebook-x86/chromeos/fmap.c b/board/chromebook-x86/chromeos/fmap.c
new file mode 100644
index 0000000000..7101af8cbc
--- /dev/null
+++ b/board/chromebook-x86/chromeos/fmap.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ */
+
+/* Implementation of per-board fmap accessor functions */
+
+#include <chromeos/fmap.h>
+#include <common.h>
+
+int
+decode_twostop_fmap(struct twostop_fmap *fmap)
+{
+ printf("decode_twostop_fmap used but not implemented.\n");
+ return 0;
+}
diff --git a/board/nvidia/chromeos/Makefile b/board/nvidia/chromeos/Makefile
index 5bbae8c752..76b0cad25e 100644
--- a/board/nvidia/chromeos/Makefile
+++ b/board/nvidia/chromeos/Makefile
@@ -13,6 +13,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)libchromeos_board.a
COBJS-$(CONFIG_CHROMEOS) += cros_gpio.o
+COBJS-$(CONFIG_CHROMEOS) += fmap.o
COBJS-$(CONFIG_CHROMEOS) += power_management.o
COBJS := $(COBJS-y)
diff --git a/board/nvidia/chromeos/fmap.c b/board/nvidia/chromeos/fmap.c
new file mode 100644
index 0000000000..20095726c9
--- /dev/null
+++ b/board/nvidia/chromeos/fmap.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ */
+
+/* Implementation of per-board fmap accessor functions */
+
+#include <chromeos/fmap.h>
+#include <common.h>
+#include <chromeos/fdt_decode.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int
+decode_twostop_fmap(struct twostop_fmap *fmap)
+{
+ return fdt_decode_twostop_fmap(gd->blob, fmap);
+}
diff --git a/common/cmd_vbexport_test.c b/common/cmd_vbexport_test.c
index b04ab2cd81..bfd3e14862 100644
--- a/common/cmd_vbexport_test.c
+++ b/common/cmd_vbexport_test.c
@@ -400,15 +400,14 @@ 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 twostop_fmap fmap;
global = get_vboot_global();
- if (fdt_decode_twostop_fmap(fdt_ptr, &fmap)) {
- VbExDebug("Failed to load fmap config from fdt!\n");
+ if (decode_twostop_fmap(&fmap)) {
+ VbExDebug("Failed to load fmap config!\n");
return NULL;
}
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c
index 64a8ad2d60..55b5a9d795 100644
--- a/common/cmd_vboot_twostop.c
+++ b/common/cmd_vboot_twostop.c
@@ -447,7 +447,7 @@ twostop_init(struct twostop_fmap *fmap, firmware_storage_t *file,
cros_gpio_dump(&recsw);
cros_gpio_dump(&devsw);
- if (fdt_decode_twostop_fmap(gd->blob, fmap)) {
+ if (decode_twostop_fmap(fmap)) {
VBDEBUG(PREFIX "failed to decode fmap\n");
return -1;
}
@@ -633,7 +633,7 @@ twostop_readwrite_main_firmware(void)
return VB_SELECT_ERROR;
}
- if (fdt_decode_twostop_fmap(gd->blob, &fmap)) {
+ if (decode_twostop_fmap(&fmap)) {
VBDEBUG(PREFIX "failed to decode fmap\n");
return VB_SELECT_ERROR;
}
diff --git a/include/chromeos/fmap.h b/include/chromeos/fmap.h
index 37efc4b128..a2a88a16b5 100644
--- a/include/chromeos/fmap.h
+++ b/include/chromeos/fmap.h
@@ -11,6 +11,8 @@
#ifndef CHROMEOS_FMAP_H_
#define CHROMEOS_FMAP_H_
+#include <compiler.h>
+
/* Structures to hold Chrome OS specific configuration from the FMAP. */
struct fmap_entry {
@@ -42,4 +44,6 @@ struct twostop_fmap {
void dump_fmap(struct twostop_fmap *config);
+int decode_twostop_fmap(struct twostop_fmap *fmap);
+
#endif /* CHROMEOS_FMAP_H_ */
diff --git a/lib/vboot/bootstub_entry.c b/lib/vboot/bootstub_entry.c
index c30405076e..17110b67b5 100644
--- a/lib/vboot/bootstub_entry.c
+++ b/lib/vboot/bootstub_entry.c
@@ -300,8 +300,8 @@ void bootstub_entry(void)
VbSelectFirmwareParams fparams;
VbError_t ret;
- if (fdt_decode_twostop_fmap(fdt_ptr, &fmap))
- VbExError(PREFIX "Failed to load fmap config from fdt.\n");
+ if (decode_twostop_fmap(&fmap))
+ VbExError(PREFIX "Failed to load fmap config.\n");
/* Open firmware storage device */
if (firmware_storage_open_spi(&file))
diff --git a/lib/vboot/global_data.c b/lib/vboot/global_data.c
index 1442096daf..ac0fac5e3a 100644
--- a/lib/vboot/global_data.c
+++ b/lib/vboot/global_data.c
@@ -47,8 +47,8 @@ int init_vboot_global(vb_global_t *global, firmware_storage_t *file)
return 1;
}
- if (fdt_decode_twostop_fmap(gd->blob, &fmap)) {
- VBDEBUG(PREFIX "Failed to load fmap config from fdt!\n");
+ if (decode_twostop_fmap(&fmap)) {
+ VBDEBUG(PREFIX "Failed to load fmap config!\n");
return 1;
}