[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 18/21] hw/mips: Open-code pflash_cfi01_register()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 18/21] hw/mips: Open-code pflash_cfi01_register() |
Date: |
Mon, 9 Jan 2023 13:08:30 +0100 |
pflash_cfi01_register() hides an implicit sysbus mapping of
MMIO region #0. This is not practical in a heterogeneous world
where multiple cores use different address spaces. In order to
remove pflash_cfi01_register() from the pflash API, open-code it
as a qdev creation call followed by an explicit sysbus mapping.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/mips/malta.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 9657f7f6da..4605b06b3b 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -1223,7 +1223,6 @@ void mips_malta_init(MachineState *machine)
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
char *filename;
- PFlashCFI01 *fl;
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *ram_low_preio = g_new(MemoryRegion, 1);
MemoryRegion *ram_low_postio;
@@ -1287,12 +1286,16 @@ void mips_malta_init(MachineState *machine)
/* Load firmware in flash / BIOS. */
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
- fl = pflash_cfi01_register(FLASH_ADDRESS, "mips_malta.bios",
- FLASH_SIZE,
- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
- FLASH_SECTOR_SIZE,
- 4, 0x0000, 0x0000, 0x0000, 0x0000, be);
- dev = DEVICE(fl);
+ dev = qdev_new(TYPE_PFLASH_CFI01);
+ qdev_prop_set_string(dev, "name", "mips_malta.bios");
+ qdev_prop_set_drive(dev, "drive",
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL);
+ qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE);
+ qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE);
+ qdev_prop_set_uint8(dev, "width", 4);
+ qdev_prop_set_bit(dev, "big-endian", be);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, FLASH_ADDRESS);
bios = pflash_cfi01_get_memory(dev);
fl_idx++;
if (kernel_filename) {
--
2.38.1
- [PATCH v2 13/21] hw/arm/xilinx_zynq: Open-code pflash_cfi02_register(), (continued)
- [PATCH v2 13/21] hw/arm/xilinx_zynq: Open-code pflash_cfi02_register(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 14/21] hw/block: Remove unused pflash_cfi02_register(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 15/21] hw/block: Make PFlashCFI02 QOM declaration internal, Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 16/21] hw/arm: Open-code pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 17/21] hw/microblaze: Open-code pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 20/21] hw/block: Remove unused pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 19/21] hw/ppc: Open-code pflash_cfi01_register(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 18/21] hw/mips: Open-code pflash_cfi01_register(),
Philippe Mathieu-Daudé <=
- [PATCH v2 21/21] hw/block: Make PFlashCFI01 QOM declaration internal, Philippe Mathieu-Daudé, 2023/01/09
- Re: [PATCH v2 00/21] hw: Remove implicit sysbus_mmio_map() from pflash APIs, Philippe Mathieu-Daudé, 2023/01/09