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>
diff --git a/board/chromebook-x86/chromeos/Makefile b/board/chromebook-x86/chromeos/Makefile index a3eb6ec..4a74a22 100644 --- a/board/chromebook-x86/chromeos/Makefile +++ b/board/chromebook-x86/chromeos/Makefile
@@ -39,6 +39,7 @@ 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 0000000..7101af8 --- /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 5bbae8c..76b0cad 100644 --- a/board/nvidia/chromeos/Makefile +++ b/board/nvidia/chromeos/Makefile
@@ -13,6 +13,7 @@ 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 0000000..2009572 --- /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 b04ab2c..bfd3e14 100644 --- a/common/cmd_vbexport_test.c +++ b/common/cmd_vbexport_test.c
@@ -400,15 +400,14 @@ 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 64a8ad2..55b5a9d 100644 --- a/common/cmd_vboot_twostop.c +++ b/common/cmd_vboot_twostop.c
@@ -447,7 +447,7 @@ 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 @@ 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 37efc4b..a2a88a1 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 @@ 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 c304050..17110b6 100644 --- a/lib/vboot/bootstub_entry.c +++ b/lib/vboot/bootstub_entry.c
@@ -300,8 +300,8 @@ 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 1442096..ac0fac5 100644 --- a/lib/vboot/global_data.c +++ b/lib/vboot/global_data.c
@@ -47,8 +47,8 @@ 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; }