summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-12-14 18:08:12 -0800
committerVadim Bendebury <vbendeb@chromium.org>2011-12-15 11:02:35 -0800
commitdd884e4cd60a6f9fe447a9a81f85b0a218e0e9c0 (patch)
treeafd8bc5183e9cf1fbe3f66992ec328ba04d695bf /lib
parent2151d14555ad0e7c2c850195de6fbe89f95001fb (diff)
Don't use bogus gbb address when booting up rewriteable firmware.
https://gerrit.chromium.org/gerrit/11152 introduced a bug where the gbb pointer used during rewriteable firmware boot is bogus. The pointer is retrieved from the 'chromeos-config' section of the device tree, but on x86 platform this memory area is never initialized. The fix is to make sure that the proper gbb address in the CPU address space is used before gbb contents are accessed. What it boils down to is that when CONFIG_HARDWARE_MAPPED_SPI is set, gbb address should be determined before setup_gbb_and_cdata() is called. To accomplish that fdt_decode_twostop_fmap() is being modified to retrieve the flash base address among other things. Calling this function before setup_gbb_and_cdata() allows to assign the gbb pointer before it is used. `google-binary-block' is not yet being removed from the cromeos-config section of the device tree as this could break some tests. BUG=chromium-os:22528 BUG=chrome-os-partner:7155 TEST=manual . build a new firmware image and program it on a Lumpy . verify that the device comes up as expected . modify the firmware to use read/write path as suggested by hungte@ cd ~/trunk/src/platform/vboot_reference/scripts/image_signing ./resign_firmwarefd.sh /build/lumpy/firmware/image.bin \ /build/lumpy/firmware/new_image.bin \ ../../tests/devkeys/firmware_data_key.vbprivk \ ../../tests/devkeys/firmware.keyblock \ ../../tests/devkeys/firmware_data_key.vbprivk \ ../../tests/devkeys/firmware.keyblock \ ../../tests/devkeys/kernel_subkey.vbpubk \ 1 0 . put new_image.bin into a lumpy flashrom . reboot the device . observe it come up, printing on the console 'vboot_twostop: jump to readwrite main firmware at 0x1110000, size 0xdffc0' along the way Change-Id: Ieeaadafdf31ee6199a6f1fce0b9684dd494a7602 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/12969 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/chromeos/fdt_decode.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/chromeos/fdt_decode.c b/lib/chromeos/fdt_decode.c
index 3be76643d2..f3ff3fe2e1 100644
--- a/lib/chromeos/fdt_decode.c
+++ b/lib/chromeos/fdt_decode.c
@@ -125,6 +125,8 @@ int fdt_decode_twostop_fmap(const void *blob, struct twostop_fmap *config)
{
int fmap_offset;
int err;
+ uint32_t *property;
+ int length;
fmap_offset = fdt_node_offset_by_compatible(blob, -1,
"chromeos,flashmap");
@@ -132,6 +134,15 @@ int fdt_decode_twostop_fmap(const void *blob, struct twostop_fmap *config)
VBDEBUG(PREFIX "chromeos,flashmap node is missing\n");
return fmap_offset;
}
+
+ property = (uint32_t *)fdt_getprop(blob, fmap_offset, "reg", &length);
+ if (!property || (length != 8)) {
+ VBDEBUG(PREFIX "Flashmap node missing the `reg' property\n");
+ return -FDT_ERR_MISSING;
+ }
+
+ config->flash_base = fdt32_to_cpu(property[0]);
+
err = decode_firmware_entry(blob, fmap_offset, "rw-a",
&config->readwrite_a);
err |= decode_firmware_entry(blob, fmap_offset, "rw-b",