On Wed, 19 Feb 2025 at 18:46, Hao Wu <[email protected]> wrote:
>
> This allows different FIUs to have different flash sizes, useful
> in NPCM8XX which has multiple different sized FIU modules.
>
> Reviewed-by: Peter Maydell <[email protected]>
> Signed-off-by: Hao Wu <[email protected]>
> Reviewed-by: Philippe Mathieu-Daude <[email protected]>
> @@ -543,6 +554,7 @@ static const VMStateDescription vmstate_npcm7xx_fiu = {
>
> static const Property npcm7xx_fiu_properties[] = {
> DEFINE_PROP_INT32("cs-count", NPCM7xxFIUState, cs_count, 0),
> + DEFINE_PROP_SIZE("flash-size", NPCM7xxFIUState, flash_size, 0),
> };
>
> static void npcm7xx_fiu_class_init(ObjectClass *klass, void *data)
> diff --git a/include/hw/ssi/npcm7xx_fiu.h b/include/hw/ssi/npcm7xx_fiu.h
> index a3a1704289..1785ea16f4 100644
> --- a/include/hw/ssi/npcm7xx_fiu.h
> +++ b/include/hw/ssi/npcm7xx_fiu.h
> @@ -60,6 +60,7 @@ struct NPCM7xxFIUState {
> int32_t cs_count;
> int32_t active_cs;
> qemu_irq *cs_lines;
> + size_t flash_size;
> NPCM7xxFIUFlash *flash;
>
> SSIBus *spi;
The field for a DEFINE_PROP_SIZE must be a uint64_t, or it
won't build on 32-bit hosts:
In file included from ../include/qemu/osdep.h:53,
from ../hw/ssi/npcm7xx_fiu.c:17:
../include/qemu/compiler.h:65:35: error: invalid operands to binary -
(have ‘uint64_t *’ {aka ‘long long unsigned int *’} and ‘size_t *’
{aka ‘unsigned int *’})
65 | #define type_check(t1,t2) ((t1*)0 - (t2*)0)
| ^
../include/hw/qdev-properties.h:71:15: note: in expansion of macro ‘type_check’
71 | + type_check(_type, typeof_field(_state, _field)), \
| ^~~~~~~~~~
../include/hw/qdev-properties.h:90:5: note: in expansion of macro ‘DEFINE_PROP’
90 | DEFINE_PROP(_name, _state, _field, _prop, _type, \
| ^~~~~~~~~~~
../include/hw/qdev-properties.h:166:5: note: in expansion of macro
‘DEFINE_PROP_UNSIGNED’
166 | DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t)
| ^~~~~~~~~~~~~~~~~~~~
../hw/ssi/npcm7xx_fiu.c:557:5: note: in expansion of macro ‘DEFINE_PROP_SIZE’
557 | DEFINE_PROP_SIZE("flash-size", NPCM7xxFIUState, flash_size, 0),
| ^~~~~~~~~~~~~~~~
-- PMM