diff options
author | Atish Patra <atish.patra@wdc.com> | 2019-06-19 00:54:06 +0300 |
---|---|---|
committer | Anup Patel <anup.patel@wdc.com> | 2019-06-19 07:25:13 +0300 |
commit | 5dd93e88fe3c9775107402bd32b91f8ccc2abe82 (patch) | |
tree | 1615408b4115f54c0148c90d7b905e379026f2ce /lib/utils/irqchip/plic.c | |
parent | b2d0caf86b633e4242bc320d03ba7d13ff99b7f1 (diff) | |
download | opensbi-5dd93e88fe3c9775107402bd32b91f8ccc2abe82.tar.xz |
utils: Remove tinyfdt.c
tinyfdt.c was originally added to provide a minimal implementation of
fdt parsing. However, we have already included libfdt in OpenSBI for
more complicated operations.
Remove tinfdt and replace its functiolity using libfdt.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Acked-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'lib/utils/irqchip/plic.c')
-rw-r--r-- | lib/utils/irqchip/plic.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/utils/irqchip/plic.c b/lib/utils/irqchip/plic.c index 9cc2108..0479186 100644 --- a/lib/utils/irqchip/plic.c +++ b/lib/utils/irqchip/plic.c @@ -11,8 +11,9 @@ #include <sbi/riscv_encoding.h> #include <sbi/sbi_console.h> #include <sbi/sbi_string.h> -#include <sbi_utils/tinyfdt.h> #include <sbi_utils/irqchip/plic.h> +#include <libfdt.h> +#include <fdt.h> #define PLIC_PRIORITY_BASE 0x0 #define PLIC_PENDING_BASE 0x1000 @@ -46,34 +47,31 @@ static void plic_set_ie(u32 cntxid, u32 word_index, u32 val) writel(val, plic_ie + word_index * 4); } -static void plic_fdt_fixup_prop(const struct fdt_node *node, - const struct fdt_prop *prop, void *priv) +void plic_fdt_fixup(void *fdt, const char *compat) { u32 *cells; - u32 i, cells_count; + int i, cells_count; + u32 plic_off; - if (!prop) - return; - if (sbi_strcmp(prop->name, "interrupts-extended")) + plic_off = fdt_node_offset_by_compatible(fdt, 0, compat); + if (plic_off < 0) return; - cells = prop->value; - cells_count = prop->len / sizeof(u32); + cells = (u32 *)fdt_getprop(fdt, plic_off, + "interrupts-extended", &cells_count); + if (!cells) + return; + cells_count = cells_count / sizeof(u32); if (!cells_count) return; for (i = 0; i < (cells_count / 2); i++) { - if (fdt_rev32(cells[2 * i + 1]) == IRQ_M_EXT) - cells[2 * i + 1] = fdt_rev32(0xffffffff); + if (fdt32_to_cpu(cells[2 * i + 1]) == IRQ_M_EXT) + cells[2 * i + 1] = fdt32_to_cpu(0xffffffff); } } -void plic_fdt_fixup(void *fdt, const char *compat) -{ - fdt_compat_node_prop(fdt, compat, plic_fdt_fixup_prop, NULL); -} - int plic_warm_irqchip_init(u32 target_hart, int m_cntx_id, int s_cntx_id) { size_t i, ie_words = plic_num_sources / 32 + 1; |