diff options
author | Suneel Garapati <sgarapati@marvell.com> | 2019-10-19 15:19:35 -0700 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2020-08-25 05:41:09 +0200 |
commit | 1db7ee464f28d72bd1af87b1136c9c158833da13 (patch) | |
tree | 03c6756b34b2d3f8ac9cbf0aa5d44a066bdb8529 /lib | |
parent | 1aa3966173fe92fa3c46638ee8eb8b8491f521d6 (diff) |
fdtdec: Add API to read pci bus-range property
Add fdtdec_get_pci_bus_range to read bus-range property
values.
Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fdtdec.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 30a1c6a217..d3b22ec323 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -243,6 +243,22 @@ int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr, return 0; } + +int fdtdec_get_pci_bus_range(const void *blob, int node, + struct fdt_resource *res) +{ + const u32 *values; + int len; + + values = fdt_getprop(blob, node, "bus-range", &len); + if (!values || len < sizeof(*values) * 2) + return -EINVAL; + + res->start = fdt32_to_cpu(*values++); + res->end = fdt32_to_cpu(*values); + + return 0; +} #endif uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name, |