On Tue, 5 Apr 2022 at 23:38, Hao Wu <wuhao...@google.com> wrote:
>
> This allows different FIUs to have different flash sizes, useful
> in NPCM8XX which has multiple different sized FIU modules.
>
> Signed-off-by: Hao Wu <wuhao...@google.com>
> Reviewed-by: Patrick Venture <vent...@google.com>
> ---
>  hw/arm/npcm7xx.c             | 6 ++++++
>  hw/ssi/npcm7xx_fiu.c         | 6 ++----
>  include/hw/ssi/npcm7xx_fiu.h | 1 +
>  3 files changed, 9 insertions(+), 4 deletions(-)

> @@ -525,7 +522,7 @@ static void npcm7xx_fiu_realize(DeviceState *dev, Error 
> **errp)
>          flash->fiu = s;
>          memory_region_init_io(&flash->direct_access, OBJECT(s),
>                                &npcm7xx_fiu_flash_ops, &s->flash[i], "flash",
> -                              NPCM7XX_FIU_FLASH_WINDOW_SIZE);
> +                              s->flash_size);
>          sysbus_init_mmio(sbd, &flash->direct_access);

Creating a zero-sized memory region if the user forgets to set
the flash-size property is going to be a bit confusing, so I think
it would be better to have at least a basic sanity check of the
property in realize.

Otherwise looks good.

thanks
-- PMM

Reply via email to