[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/5] hw/timer/bcm2835: Introduce BCM2835_SYSTIMER_COUNT defini
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 2/5] hw/timer/bcm2835: Introduce BCM2835_SYSTIMER_COUNT definition |
Date: |
Mon, 21 Sep 2020 05:52:54 +0200 |
Use the BCM2835_SYSTIMER_COUNT definition instead of the
magic '4' value.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/timer/bcm2835_systmr.h | 4 +++-
hw/timer/bcm2835_systmr.c | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/hw/timer/bcm2835_systmr.h
b/include/hw/timer/bcm2835_systmr.h
index 64166bd7120..11272837a6b 100644
--- a/include/hw/timer/bcm2835_systmr.h
+++ b/include/hw/timer/bcm2835_systmr.h
@@ -18,6 +18,8 @@ typedef struct BCM2835SystemTimerState
BCM2835SystemTimerState;
DECLARE_INSTANCE_CHECKER(BCM2835SystemTimerState, BCM2835_SYSTIMER,
TYPE_BCM2835_SYSTIMER)
+#define BCM2835_SYSTIMER_COUNT 4
+
struct BCM2835SystemTimerState {
/*< private >*/
SysBusDevice parent_obj;
@@ -28,7 +30,7 @@ struct BCM2835SystemTimerState {
struct {
uint32_t status;
- uint32_t compare[4];
+ uint32_t compare[BCM2835_SYSTIMER_COUNT];
} reg;
};
diff --git a/hw/timer/bcm2835_systmr.c b/hw/timer/bcm2835_systmr.c
index 3387a6214a2..ff8c5536610 100644
--- a/hw/timer/bcm2835_systmr.c
+++ b/hw/timer/bcm2835_systmr.c
@@ -134,7 +134,8 @@ static const VMStateDescription bcm2835_systmr_vmstate = {
.minimum_version_id = 1,
.fields = (VMStateField[]) {
VMSTATE_UINT32(reg.status, BCM2835SystemTimerState),
- VMSTATE_UINT32_ARRAY(reg.compare, BCM2835SystemTimerState, 4),
+ VMSTATE_UINT32_ARRAY(reg.compare, BCM2835SystemTimerState,
+ BCM2835_SYSTIMER_COUNT),
VMSTATE_END_OF_LIST()
}
};
--
2.26.2
- [PATCH v2 0/5] hw/arm/raspi: Fix SYS_timer to unbrick Linux kernels v3.7+, Philippe Mathieu-Daudé, 2020/09/20
- [PATCH v2 1/5] hw/intc/bcm2835_ic: Trace GPU/CPU IRQ handlers, Philippe Mathieu-Daudé, 2020/09/20
- [PATCH v2 2/5] hw/timer/bcm2835: Introduce BCM2835_SYSTIMER_COUNT definition,
Philippe Mathieu-Daudé <=
- [PATCH v2 3/5] hw/timer/bcm2835: Rename variable holding CTRL_STATUS register, Philippe Mathieu-Daudé, 2020/09/20
- [PATCH v2 4/5] hw/timer/bcm2835: Support the timer COMPARE registers, Philippe Mathieu-Daudé, 2020/09/20
- [PATCH v2 5/5] hw/arm/bcm2835_peripherals: Correctly wire the SYS_timer IRQs, Philippe Mathieu-Daudé, 2020/09/20
- Re: [PATCH v2 0/5] hw/arm/raspi: Fix SYS_timer to unbrick Linux kernels v3.7+, Philippe Mathieu-Daudé, 2020/09/24