aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-05-13 14:45:38 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-05-13 14:45:38 +0100
commitdab59ce031228066eb95a9c518846fcacfb0dbbf (patch)
tree98b26d7b0dbc559ad35041645892ae951aefe086
parent3e9f48bcdabe57f8f90cf19f01bbbf3c86937267 (diff)
parent27545c9df24f509c6d1c1f17478281a357125554 (diff)
Merge remote-tracking branch 'remotes/philmd/tags/pflash-20210511' into staging
Parallel NOR Flash patches queue - Simplify memory layout when no pflash_cfi02 mapping requested # gpg: Signature made Tue 11 May 2021 17:12:58 BST # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * remotes/philmd/tags/pflash-20210511: hw/block/pflash_cfi02: Do not create aliases when not necessary hw/block/pflash_cfi02: Set romd mode in pflash_cfi02_realize() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/block/pflash_cfi02.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 25c053693c..02c514fb6e 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -173,7 +173,6 @@ static void pflash_setup_mappings(PFlashCFI02 *pfl)
"pflash-alias", &pfl->orig_mem, 0, size);
memory_region_add_subregion(&pfl->mem, i * size, &pfl->mem_mappings[i]);
}
- pfl->rom_mode = true;
}
static void pflash_reset_state_machine(PFlashCFI02 *pfl)
@@ -917,8 +916,13 @@ static void pflash_cfi02_realize(DeviceState *dev, Error **errp)
/* Allocate memory for a bitmap for sectors being erased. */
pfl->sector_erase_map = bitmap_new(pfl->total_sectors);
- pflash_setup_mappings(pfl);
- sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem);
+ pfl->rom_mode = true;
+ if (pfl->mappings > 1) {
+ pflash_setup_mappings(pfl);
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->mem);
+ } else {
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &pfl->orig_mem);
+ }
timer_init_ns(&pfl->timer, QEMU_CLOCK_VIRTUAL, pflash_timer, pfl);
pfl->status = 0;