aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-02-05 13:25:15 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-02-15 13:15:14 +0000
commit5c20814cb1cc140258de040b62d3e8d3b23e7ad5 (patch)
tree2821ca8464fae2ba7647656c95467c927ebe5d96
parent15a9f7c59fa664f8ff5f6be61be758f2e31f072b (diff)
downloadqemu-arm-5c20814cb1cc140258de040b62d3e8d3b23e7ad5.tar.gz
hw/arm/mps2-tz: Support ROMs as well as RAMs
The AN505 and AN521 don't have any read-only memory, but the AN524 does; add a flag to ROMInfo to mark a region as ROM. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/arm/mps2-tz.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index 08dd2cbaa4..cc9d70ece5 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -92,8 +92,10 @@ typedef struct RAMInfo {
* Flag values:
* IS_ALIAS: this RAM area is an alias to the upstream end of the
* MPC specified by its .mpc value
+ * IS_ROM: this RAM area is read-only
*/
#define IS_ALIAS 1
+#define IS_ROM 2
struct MPS2TZMachineClass {
MachineClass parent;
@@ -209,6 +211,7 @@ static MemoryRegion *mr_for_raminfo(MPS2TZMachineState *mms,
if (raminfo->mrindex < 0) {
/* Means this RAMInfo is for QEMU's "system memory" */
MachineState *machine = MACHINE(mms);
+ assert(!(raminfo->flags & IS_ROM));
return machine->ram;
}
@@ -217,6 +220,9 @@ static MemoryRegion *mr_for_raminfo(MPS2TZMachineState *mms,
memory_region_init_ram(ram, NULL, raminfo->name,
raminfo->size, &error_fatal);
+ if (raminfo->flags & IS_ROM) {
+ memory_region_set_readonly(ram, true);
+ }
return ram;
}