[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 12/21] hw/arm/musicpal: Open-code pflash_cfi02_register()
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 12/21] hw/arm/musicpal: Open-code pflash_cfi02_register() |
Date: |
Fri, 13 Jan 2023 13:48:45 +0000 |
On Mon, 9 Jan 2023 at 12:56, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> pflash_cfi02_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_cfi02_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/arm/musicpal.c | 21 +++++++++++++++------
> 1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
> index 73e2b7e4ce..b5f2b9d9de 100644
> --- a/hw/arm/musicpal.c
> +++ b/hw/arm/musicpal.c
> @@ -1278,12 +1278,21 @@ static void musicpal_init(MachineState *machine)
> * 0xFF800000 (if there is 8 MB flash). So remap flash access if the
> * image is smaller than 32 MB.
> */
> - pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX,
> - "musicpal.flash", flash_size,
> - blk, FLASH_SECTOR_SIZE,
> - MP_FLASH_SIZE_MAX / flash_size,
> - 2, 0x00BF, 0x236D, 0x0000, 0x0000,
> - 0x5555, 0x2AAA, 0);
> + dev = qdev_new(TYPE_PFLASH_CFI02);
> + qdev_prop_set_string(dev, "name", "musicpal.flash");
> + qdev_prop_set_drive(dev, "drive", blk);
> + qdev_prop_set_uint32(dev, "num-blocks", flash_size /
> FLASH_SECTOR_SIZE);
> + qdev_prop_set_uint32(dev, "sector-length", FLASH_SECTOR_SIZE);
> + qdev_prop_set_uint8(dev, "device-width", 2);
> + qdev_prop_set_uint8(dev, "mappings", MP_FLASH_SIZE_MAX / flash_size);
> + qdev_prop_set_uint8(dev, "big-endian", false);
> + qdev_prop_set_uint16(dev, "id0", 0x00bf);
> + qdev_prop_set_uint16(dev, "id1", 0x236d);
> + qdev_prop_set_uint16(dev, "unlock-addr0", 0x5555);
> + qdev_prop_set_uint16(dev, "unlock-addr1", 0x2aaa);
> + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
> + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0,
> + 0x100000000ULL - MP_FLASH_SIZE_MAX);
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- Re: [PATCH v2 07/21] hw/riscv: Use generic DeviceState instead of PFlashCFI01, (continued)
- [PATCH v2 11/21] hw/arm/digic: Open-code pflash_cfi02_register(), Philippe Mathieu-Daudé, 2023/01/09
- [PATCH v2 12/21] hw/arm/musicpal: Open-code pflash_cfi02_register(), Philippe Mathieu-Daudé, 2023/01/09
- Re: [PATCH v2 12/21] hw/arm/musicpal: Open-code pflash_cfi02_register(),
Peter Maydell <=
- [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