diff options
author | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-11-15 22:11:34 -0800 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-11-15 22:26:31 -0800 |
commit | b4aa36c4ba326b6ba143b0b0a843e8c72292f69b (patch) | |
tree | dc3c1deef4c3916f1b0fae494618580ce1e540db /riscv/dts.cc | |
parent | 0ca970dce354cff6ad68edbf27f0559d02be5915 (diff) | |
download | spike-b4aa36c4ba326b6ba143b0b0a843e8c72292f69b.zip spike-b4aa36c4ba326b6ba143b0b0a843e8c72292f69b.tar.gz spike-b4aa36c4ba326b6ba143b0b0a843e8c72292f69b.tar.bz2 |
dts: config pmp attribute by each core's setting
The original implementation only uses the value in first core and apply it
to other core. The patch makes the configuration hetergeneous for differenct
cores.
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv/dts.cc')
-rw-r--r-- | riscv/dts.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/riscv/dts.cc b/riscv/dts.cc index 883ceb1..93e72f3 100644 --- a/riscv/dts.cc +++ b/riscv/dts.cc @@ -274,15 +274,14 @@ int fdt_parse_clint(void *fdt, reg_t *clint_addr, return 0; } -int fdt_parse_pmp_num(void *fdt, reg_t *pmp_num, const char *compatible) +int fdt_parse_pmp_num(void *fdt, int cpu_offset, reg_t *pmp_num) { - int nodeoffset, rc; + int rc; - nodeoffset = fdt_node_offset_by_compatible(fdt, -1, compatible); - if (nodeoffset < 0) - return nodeoffset; + if ((rc = check_cpu_node(fdt, cpu_offset)) < 0) + return rc; - rc = fdt_get_node_addr_size(fdt, nodeoffset, pmp_num, NULL, + rc = fdt_get_node_addr_size(fdt, cpu_offset, pmp_num, NULL, "riscv,pmpregions"); if (rc < 0 || !pmp_num) return -ENODEV; @@ -290,16 +289,14 @@ int fdt_parse_pmp_num(void *fdt, reg_t *pmp_num, const char *compatible) return 0; } -int fdt_parse_pmp_alignment(void *fdt, reg_t *pmp_align, - const char *compatible) +int fdt_parse_pmp_alignment(void *fdt, int cpu_offset, reg_t *pmp_align) { - int nodeoffset, rc; + int rc; - nodeoffset = fdt_node_offset_by_compatible(fdt, -1, compatible); - if (nodeoffset < 0) - return nodeoffset; + if ((rc = check_cpu_node(fdt, cpu_offset)) < 0) + return rc; - rc = fdt_get_node_addr_size(fdt, nodeoffset, pmp_align, NULL, + rc = fdt_get_node_addr_size(fdt, cpu_offset, pmp_align, NULL, "riscv,pmpgranularity"); if (rc < 0 || !pmp_align) return -ENODEV; |