diff options
author | Atish Patra <atish.patra@wdc.com> | 2019-01-09 12:17:41 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-01-18 07:35:12 +0300 |
commit | e0686ca844f6c7372edd353cffe08ddee5dcf5c9 (patch) | |
tree | 80e429366d1e0d604ae18676a20bb165236bbf55 /platform | |
parent | 3075da07b69562889e27d6f702704803db1f6f72 (diff) | |
download | opensbi-e0686ca844f6c7372edd353cffe08ddee5dcf5c9.tar.xz |
platform: No need to pass context id for plic fixup.
PLIC DT entry fixup can be done by comparing external
interrupt number instead of context id. No need to invoke
fixup for each plic context.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/common/include/plat/irqchip/plic.h | 2 | ||||
-rw-r--r-- | platform/common/irqchip/plic.c | 13 | ||||
-rw-r--r-- | platform/qemu/sifive_u/platform.c | 4 | ||||
-rw-r--r-- | platform/qemu/virt/platform.c | 4 | ||||
-rw-r--r-- | platform/sifive/fu540/platform.c | 5 |
5 files changed, 11 insertions, 17 deletions
diff --git a/platform/common/include/plat/irqchip/plic.h b/platform/common/include/plat/irqchip/plic.h index d3094ac..79a8e54 100644 --- a/platform/common/include/plat/irqchip/plic.h +++ b/platform/common/include/plat/irqchip/plic.h @@ -12,7 +12,7 @@ #include <sbi/sbi_types.h> -void plic_fdt_fixup(void *fdt, const char *compat, u32 cntx_id); +void plic_fdt_fixup(void *fdt, const char *compat); int plic_warm_irqchip_init(u32 target_hart, int m_cntx_id, int s_cntx_id); diff --git a/platform/common/irqchip/plic.c b/platform/common/irqchip/plic.c index 0a2a036..59265cf 100644 --- a/platform/common/irqchip/plic.c +++ b/platform/common/irqchip/plic.c @@ -8,6 +8,8 @@ */ #include <sbi/riscv_io.h> +#include <sbi/riscv_encoding.h> +#include <sbi/sbi_console.h> #include <plat/tinyfdt.h> #include <plat/irqchip/plic.h> #include <string.h> @@ -50,7 +52,6 @@ static void plic_fdt_fixup_prop(const struct fdt_node *node, { u32 *cells; u32 i, cells_count; - u32 *cntx_id = priv; if (!prop) return; @@ -63,15 +64,15 @@ static void plic_fdt_fixup_prop(const struct fdt_node *node, if (!cells_count) return; - for (i = 0; i < cells_count; i++) { - if (((i % 2) == 1) && ((i / 2) == *cntx_id)) - cells[i] = fdt_rev32(0xffffffff); + 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); } } -void plic_fdt_fixup(void *fdt, const char *compat, u32 cntx_id) +void plic_fdt_fixup(void *fdt, const char *compat) { - fdt_compat_node_prop(fdt, compat, plic_fdt_fixup_prop, &cntx_id); + fdt_compat_node_prop(fdt, compat, plic_fdt_fixup_prop, NULL); } int plic_warm_irqchip_init(u32 target_hart, diff --git a/platform/qemu/sifive_u/platform.c b/platform/qemu/sifive_u/platform.c index cf6efbd..91fa4a7 100644 --- a/platform/qemu/sifive_u/platform.c +++ b/platform/qemu/sifive_u/platform.c @@ -31,15 +31,13 @@ static int sifive_u_final_init(u32 hartid, bool cold_boot) { - u32 i; void *fdt; if (!cold_boot) return 0; fdt = sbi_scratch_thishart_arg1_ptr(); - for (i = 0; i < SIFIVE_U_HART_COUNT; i++) - plic_fdt_fixup(fdt, "riscv,plic0", 2 * i); + plic_fdt_fixup(fdt, "riscv,plic0"); return 0; } diff --git a/platform/qemu/virt/platform.c b/platform/qemu/virt/platform.c index 71ddc75..a28f9f1 100644 --- a/platform/qemu/virt/platform.c +++ b/platform/qemu/virt/platform.c @@ -31,15 +31,13 @@ static int virt_final_init(u32 hartid, bool cold_boot) { - u32 i; void *fdt; if (!cold_boot) return 0; fdt = sbi_scratch_thishart_arg1_ptr(); - for (i = 0; i < VIRT_HART_COUNT; i++) - plic_fdt_fixup(fdt, "riscv,plic0", 2 * i); + plic_fdt_fixup(fdt, "riscv,plic0"); return 0; } diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c index d8ea0b4..4791803 100644 --- a/platform/sifive/fu540/platform.c +++ b/platform/sifive/fu540/platform.c @@ -69,10 +69,7 @@ static void fu540_modify_dt(void *fdt) fdt_setprop_string(fdt, chosen_offset, "stdout-path", "/soc/serial@10010000:115200"); - plic_fdt_fixup(fdt, "riscv,plic0", 0); - - for (i = 1; i < FU540_HART_COUNT; i++) - plic_fdt_fixup(fdt, "riscv,plic0", 2 * i - 1); + plic_fdt_fixup(fdt, "riscv,plic0"); } static int fu540_final_init(u32 hartid, bool cold_boot) { |