diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2011-10-12 13:36:23 -0700 |
---|---|---|
committer | Vadim Bendebury <vbendeb@chromium.org> | 2011-10-12 16:05:25 -0700 |
commit | 217decb37c0a7904f08452a82285d44f98ecbb41 (patch) | |
tree | 300023be1f7ef5d50bba76fa6a1bed16a0b61d0a | |
parent | 78d80b3be02932ac519d26c6b1eb0a47177133d8 (diff) |
[PATCH1/2] mrc cache: Add MRC cache FMAP entry support.
Add code to retrieve the location of the MRC cache from the FMAP
device tree definition.
fdt_decode.c should be refactored (fmap_offset could be determined
just once and used throughout without passing it as a parameter), will
leave this for another day.
BUG=chrome-os-partner:5808
TEST=manual
. see test description in the second patch commit message.
Change-Id: Ic4003d685609beb61d1dea324bd804a2838e471c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/9961
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | include/chromeos/fdt_decode.h | 10 | ||||
-rw-r--r-- | lib/chromeos/fdt_decode.c | 15 |
2 files changed, 25 insertions, 0 deletions
diff --git a/include/chromeos/fdt_decode.h b/include/chromeos/fdt_decode.h index 96def9a1e9a..b1c861f2174 100644 --- a/include/chromeos/fdt_decode.h +++ b/include/chromeos/fdt_decode.h @@ -43,4 +43,14 @@ int fdt_decode_chromeos_config_has_prop(const void *fdt, const char *name); void *fdt_decode_chromeos_alloc_region(const void *blob, const char *prop_name, size_t *size); +/** + * Retrieve the MRC cache base address from the FMAP section of the device + * tree. + * + * @param blob FDT blob + * @param fme pointer to the return value (offset and length are + * saved in the structure) + */ +int fdt_get_mrc_cache_base(const char *blob, struct fmap_entry *fme); + #endif /* CHROMEOS_FDT_DECODE_H_ */ diff --git a/lib/chromeos/fdt_decode.c b/lib/chromeos/fdt_decode.c index 5c93dcdf895..fbc44a320e5 100644 --- a/lib/chromeos/fdt_decode.c +++ b/lib/chromeos/fdt_decode.c @@ -105,6 +105,21 @@ int decode_firmware_entry(const char *blob, int fmap_offset, const char *name, return err; } +int fdt_get_mrc_cache_base(const char *blob, struct fmap_entry *fme) +{ + int fmap_offset; + + fmap_offset = fdt_node_offset_by_compatible(blob, -1, + "chromeos,flashmap"); + if (fmap_offset < 0) { + VBDEBUG(PREFIX "%s: chromeos,flashmap node is missing\n", + __func__); + return fmap_offset; + } + + return decode_fmap_entry(blob, fmap_offset, "rw", "mrc-cache", fme); +} + int fdt_decode_twostop_fmap(const void *blob, struct twostop_fmap *config) { int fmap_offset; |