diff options
-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; |