[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/19] hw/timer/arm_timer: Map ARM_TIMER MMIO regions into SP8
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 19/19] hw/timer/arm_timer: Map ARM_TIMER MMIO regions into SP804Timer |
Date: |
Tue, 4 Jul 2023 16:50:12 +0200 |
Instead of manually forwarding MMIO accesses to each ARM_TIMER,
let have the generic memory code dispatch that for us.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/timer/arm_timer.c | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index 7b455aff4d..f8d65732dc 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -262,15 +262,6 @@ static const uint8_t sp804_ids[] = {
static uint64_t sp804_read(void *opaque, hwaddr offset,
unsigned size)
{
- SP804Timer *s = opaque;
-
- if (offset < 0x20) {
- return arm_timer_read(&s->timer[0], offset, size);
- }
- if (offset < 0x40) {
- return arm_timer_read(&s->timer[1], offset - 0x20, size);
- }
-
/* TimerPeriphID */
if (offset >= 0xfe0 && offset <= 0xffc) {
return sp804_ids[(offset - 0xfe0) >> 2];
@@ -294,18 +285,6 @@ static uint64_t sp804_read(void *opaque, hwaddr offset,
static void sp804_write(void *opaque, hwaddr offset,
uint64_t value, unsigned size)
{
- SP804Timer *s = opaque;
-
- if (offset < 0x20) {
- arm_timer_write(&s->timer[0], offset, value, size);
- return;
- }
-
- if (offset < 0x40) {
- arm_timer_write(&s->timer[1], offset - 0x20, value, size);
- return;
- }
-
/* Technically we could be writing to the Test Registers, but not likely */
qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %x\n",
__func__, (int)offset);
@@ -374,6 +353,8 @@ static void sp804_realize(DeviceState *dev, Error **errp)
return;
}
sysbus_connect_irq(tmr, 0, qdev_get_gpio_in(DEVICE(&s->irq_orgate),
i));
+ memory_region_add_subregion_overlap(&s->iomem, 0x20 * i,
+ sysbus_mmio_get_region(tmr, 0), 1);
}
}
--
2.38.1
- [PATCH v2 15/19] hw/timer/arm_timer: Fix misuse of SysBus IRQ in IntegratorPIT, (continued)
- [PATCH v2 15/19] hw/timer/arm_timer: Fix misuse of SysBus IRQ in IntegratorPIT, Philippe Mathieu-Daudé, 2023/07/04
- [PATCH v2 13/19] hw/timer/arm_timer: Iterate on timers using for() loop statement, Philippe Mathieu-Daudé, 2023/07/04
- [PATCH v2 16/19] hw/timer/arm_timer: Extract icp_pit_realize() from icp_pit_init(), Philippe Mathieu-Daudé, 2023/07/04
- [PATCH v2 17/19] hw/timer/arm_timer: QDev'ify ARM_TIMER, Philippe Mathieu-Daudé, 2023/07/04
- [PATCH v2 18/19] hw/timer/arm_timer: Map ARM_TIMER MMIO regions into IntegratorPIT, Philippe Mathieu-Daudé, 2023/07/04
- [PATCH v2 19/19] hw/timer/arm_timer: Map ARM_TIMER MMIO regions into SP804Timer,
Philippe Mathieu-Daudé <=
- Re: [PATCH v2 00/19] hw/timer/arm_timer: QOM'ify ARM_TIMER and correct sysbus/irq in ICP_PIT, Philippe Mathieu-Daudé, 2023/07/04