diff options
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/cfg.h | 3 | ||||
-rw-r--r-- | riscv/dts.cc | 3 | ||||
-rw-r--r-- | riscv/dts.h | 1 | ||||
-rw-r--r-- | riscv/sim.cc | 2 |
4 files changed, 7 insertions, 2 deletions
diff --git a/riscv/cfg.h b/riscv/cfg.h index 13dcf3a..dbdb58b 100644 --- a/riscv/cfg.h +++ b/riscv/cfg.h @@ -61,6 +61,7 @@ public: const char *default_bootargs, const char *default_isa, const char *default_priv, const char *default_varch, + const reg_t default_pmpregions, const std::vector<mem_cfg_t> &default_mem_layout, const std::vector<int> default_hartids, bool default_real_time_clint) @@ -69,6 +70,7 @@ public: isa(default_isa), priv(default_priv), varch(default_varch), + pmpregions(default_pmpregions), mem_layout(default_mem_layout), hartids(default_hartids), explicit_hartids(false), @@ -80,6 +82,7 @@ public: cfg_arg_t<const char *> isa; cfg_arg_t<const char *> priv; cfg_arg_t<const char *> varch; + reg_t pmpregions; cfg_arg_t<std::vector<mem_cfg_t>> mem_layout; std::optional<reg_t> start_pc; cfg_arg_t<std::vector<int>> hartids; diff --git a/riscv/dts.cc b/riscv/dts.cc index 5d37463..9937d57 100644 --- a/riscv/dts.cc +++ b/riscv/dts.cc @@ -14,6 +14,7 @@ std::string make_dts(size_t insns_per_rtc_tick, size_t cpu_hz, reg_t initrd_start, reg_t initrd_end, const char* bootargs, + size_t pmpregions, std::vector<processor_t*> procs, std::vector<std::pair<reg_t, mem_t*>> mems) { @@ -57,7 +58,7 @@ std::string make_dts(size_t insns_per_rtc_tick, size_t cpu_hz, " compatible = \"riscv\";\n" " riscv,isa = \"" << procs[i]->get_isa().get_isa_string() << "\";\n" " mmu-type = \"riscv," << (procs[i]->get_isa().get_max_xlen() <= 32 ? "sv32" : "sv57") << "\";\n" - " riscv,pmpregions = <16>;\n" + " riscv,pmpregions = <" << pmpregions << ">;\n" " riscv,pmpgranularity = <4>;\n" " clock-frequency = <" << cpu_hz << ">;\n" " CPU" << i << "_intc: interrupt-controller {\n" diff --git a/riscv/dts.h b/riscv/dts.h index 6208151..1878ca1 100644 --- a/riscv/dts.h +++ b/riscv/dts.h @@ -10,6 +10,7 @@ std::string make_dts(size_t insns_per_rtc_tick, size_t cpu_hz, reg_t initrd_start, reg_t initrd_end, const char* bootargs, + size_t pmpregions, std::vector<processor_t*> procs, std::vector<std::pair<reg_t, mem_t*>> mems); diff --git a/riscv/sim.cc b/riscv/sim.cc index 0ef13b8..8a15560 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -303,7 +303,7 @@ void sim_t::make_dtb() std::pair<reg_t, reg_t> initrd_bounds = cfg->initrd_bounds(); dts = make_dts(INSNS_PER_RTC_TICK, CPU_HZ, initrd_bounds.first, initrd_bounds.second, - cfg->bootargs(), procs, mems); + cfg->bootargs(), cfg->pmpregions, procs, mems); dtb = dts_compile(dts); } |