diff options
author | Simon Glass <sjg@chromium.org> | 2011-08-22 08:06:19 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-09-13 15:53:29 -0700 |
commit | 1ca0c7d8356936a85c91db14672aea95f3c822ef (patch) | |
tree | 6743abc2334637deb4ca83cb1ce39ff3a80547ed /include/fdt_decode.h | |
parent | 391839609251aa6121399fd864c126b39d88319e (diff) |
fdt: Add function to locate or allocate region
This function looks up a property in a node which contains a memory region
address and size. It returns a pointer to this address, but if the address
is zero, it is allocated with malloc() instead.
It is used to allocate Chrome OS GBB memory regions and the like.
BUG=chromium-os:19353
TEST=build for Seaboard
Change-Id: I91fe8656f3ea50839998ab0e16b023635adbc119
Reviewed-on: http://gerrit.chromium.org/gerrit/7640
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/fdt_decode.h')
-rw-r--r-- | include/fdt_decode.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/fdt_decode.h b/include/fdt_decode.h index e7485c3f83..b4daac86c6 100644 --- a/include/fdt_decode.h +++ b/include/fdt_decode.h @@ -594,3 +594,20 @@ int fdt_decode_get_machine_arch_id(const void *blob); * -FDT_ERR_MISSING. */ int fdt_decode_nand(const void *blob, int node, struct fdt_nand *config); + +/** + * Look up a property in a node which contains a memory region address and + * size. Then return a pointer to this address. if the address is zero, it is + * allocated with malloc() instead. + * + * The property must hold one address with a length. This is only tested on + * 32-bit machines. + * + * @param blob FDT blob + * @param node node to examine + * @param prop_name name of property to find + * @param size returns size of region + * @return pointer to region, or NULL if property not found/malloc failed + */ +void *fdt_decode_alloc_region(const void *blob, int node, + const char *prop_name, size_t *size); |