On Fri, 5 Feb 2021 at 17:00, Peter Maydell <[email protected]> wrote:
>
> MPS3 boards have an extra SWITCH register in the FPGAIO block which
> reports the value of some switches. Implement this, governed by a
> property the board code can use to specify whether whether it exists.
>
> Signed-off-by: Peter Maydell <[email protected]>
> ---
> include/hw/misc/mps2-fpgaio.h | 1 +
> hw/misc/mps2-fpgaio.c | 10 ++++++++++
> 2 files changed, 11 insertions(+)
I changed my mind about the property/struct field name here, I think
"has" is what we tend to use rather than "have". Trivial change
to squash into this patch:
diff --git a/include/hw/misc/mps2-fpgaio.h b/include/hw/misc/mps2-fpgaio.h
index 83c6e18a4ee..0d3c8eef56c 100644
--- a/include/hw/misc/mps2-fpgaio.h
+++ b/include/hw/misc/mps2-fpgaio.h
@@ -38,7 +38,7 @@ struct MPS2FPGAIO {
MemoryRegion iomem;
LEDState *led[MPS2FPGAIO_MAX_LEDS];
uint32_t num_leds;
- bool have_switches;
+ bool has_switches;
uint32_t led0;
uint32_t prescale;
diff --git a/hw/misc/mps2-fpgaio.c b/hw/misc/mps2-fpgaio.c
index b54657a4f07..acbd0be9f4b 100644
--- a/hw/misc/mps2-fpgaio.c
+++ b/hw/misc/mps2-fpgaio.c
@@ -158,7 +158,7 @@ static uint64_t mps2_fpgaio_read(void *opaque,
hwaddr offset, unsigned size)
r = s->pscntr;
break;
case A_SWITCH:
- if (!s->have_switches) {
+ if (!s->has_switches) {
goto bad_offset;
}
/* User-togglable board switches. We don't model that, so report 0. */
@@ -327,7 +327,7 @@ static Property mps2_fpgaio_properties[] = {
DEFINE_PROP_UINT32("prescale-clk", MPS2FPGAIO, prescale_clk, 20000000),
/* Number of LEDs controlled by LED0 register */
DEFINE_PROP_UINT32("num-leds", MPS2FPGAIO, num_leds, 2),
- DEFINE_PROP_BOOL("have-switches", MPS2FPGAIO, have_switches, false),
+ DEFINE_PROP_BOOL("has-switches", MPS2FPGAIO, has_switches, false),
DEFINE_PROP_END_OF_LIST(),
};
thanks
-- PMM