|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCHv7 5/8] plat/common: Introduce fdt_get_address helper
Hello Justin, This patch seems fine. Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx> Thanks & Regards Sharan On 6/27/19 9:55 AM, Jia He wrote: From: Wei Chen <wei.chen@xxxxxxx> This helper will be used very frequently for device libraries to parse their addresses. Introduce this helper to avoid using fdt_address_cells and fdt_size_cells everywhere. Signed-off-by: Wei Chen <wei.chen@xxxxxxx> Signed-off-by: Jianyong Wu <jianyong.wu@xxxxxxx> Signed-off-by: Jia He <justin.he@xxxxxxx> --- plat/drivers/include/ofw/fdt.h | 18 +++++++++++++++ plat/drivers/ofw/fdt.c | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/plat/drivers/include/ofw/fdt.h b/plat/drivers/include/ofw/fdt.h index b84c184..0b8c1d5 100644 --- a/plat/drivers/include/ofw/fdt.h +++ b/plat/drivers/include/ofw/fdt.h @@ -94,4 +94,22 @@ static inline uint64_t fdt_reg_read_number(const fdt32_t *regs, uint32_t size)return number;} + +/** + * fdt_get_address - retrieve device address of a given index + * @fdt: pointer to the device tree blob + * @nodeoffset: offset of the node to find the address for. + * @index: index of region + * @addr: return the region address + * @size: return the region size + * + * returns: + * 0, on success + * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid + * address property + * -FDT_ERR_NOTFOUND, if the node doesn't have address property + * -FDT_ERR_NOSPACE, if the node doesn't have address for index + */ +int fdt_get_address(const void *fdt, int nodeoffset, uint32_t index, + uint64_t *addr, uint64_t *size); #endif diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c index 075e542..0ac6006 100644 --- a/plat/drivers/ofw/fdt.c +++ b/plat/drivers/ofw/fdt.c @@ -38,6 +38,7 @@ #include <ofw/fdt.h>#include <uk/print.h>+#include <uk/assert.h>#define FDT_MAX_ADDR_CELLS FDT_MAX_NCELLS _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |