mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
arm: mptimer: Remove WDT distinction
In QEMU emulation, there is no functional difference between the ARM mpcore private timers and watchdogs. Removed all the distinction between the two from arm_mptimer.c and converted it to be just the mptimer. a9mpcore and arm11mpcore just instantiate the same mptimer object twice to get both timer and WDT. If in the future we want to make the WDT functionally different then we can use either QOM hierarchy to derive WDT from from mptimer, or we can add a property "is-wdt" or some such. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
845769fc63
commit
cde4577f11
3 changed files with 41 additions and 64 deletions
|
@ -21,6 +21,7 @@ typedef struct A9MPPrivState {
|
|||
MemoryRegion scu_iomem;
|
||||
MemoryRegion container;
|
||||
DeviceState *mptimer;
|
||||
DeviceState *wdt;
|
||||
DeviceState *gic;
|
||||
uint32_t num_irq;
|
||||
} A9MPPrivState;
|
||||
|
@ -129,7 +130,7 @@ static void a9mp_priv_set_irq(void *opaque, int irq, int level)
|
|||
static int a9mp_priv_init(SysBusDevice *dev)
|
||||
{
|
||||
A9MPPrivState *s = FROM_SYSBUS(A9MPPrivState, dev);
|
||||
SysBusDevice *busdev, *gicbusdev;
|
||||
SysBusDevice *timerbusdev, *wdtbusdev, *gicbusdev;
|
||||
int i;
|
||||
|
||||
s->gic = qdev_create(NULL, "arm_gic");
|
||||
|
@ -147,7 +148,12 @@ static int a9mp_priv_init(SysBusDevice *dev)
|
|||
s->mptimer = qdev_create(NULL, "arm_mptimer");
|
||||
qdev_prop_set_uint32(s->mptimer, "num-cpu", s->num_cpu);
|
||||
qdev_init_nofail(s->mptimer);
|
||||
busdev = SYS_BUS_DEVICE(s->mptimer);
|
||||
timerbusdev = SYS_BUS_DEVICE(s->mptimer);
|
||||
|
||||
s->wdt = qdev_create(NULL, "arm_mptimer");
|
||||
qdev_prop_set_uint32(s->wdt, "num-cpu", s->num_cpu);
|
||||
qdev_init_nofail(s->wdt);
|
||||
wdtbusdev = SYS_BUS_DEVICE(s->wdt);
|
||||
|
||||
/* Memory map (addresses are offsets from PERIPHBASE):
|
||||
* 0x0000-0x00ff -- Snoop Control Unit
|
||||
|
@ -170,9 +176,9 @@ static int a9mp_priv_init(SysBusDevice *dev)
|
|||
* memory region, not the "timer/watchdog for core X" ones 11MPcore has.
|
||||
*/
|
||||
memory_region_add_subregion(&s->container, 0x600,
|
||||
sysbus_mmio_get_region(busdev, 0));
|
||||
sysbus_mmio_get_region(timerbusdev, 0));
|
||||
memory_region_add_subregion(&s->container, 0x620,
|
||||
sysbus_mmio_get_region(busdev, 1));
|
||||
sysbus_mmio_get_region(wdtbusdev, 0));
|
||||
memory_region_add_subregion(&s->container, 0x1000,
|
||||
sysbus_mmio_get_region(gicbusdev, 0));
|
||||
|
||||
|
@ -183,9 +189,9 @@ static int a9mp_priv_init(SysBusDevice *dev)
|
|||
*/
|
||||
for (i = 0; i < s->num_cpu; i++) {
|
||||
int ppibase = (s->num_irq - 32) + i * 32;
|
||||
sysbus_connect_irq(busdev, i * 2,
|
||||
sysbus_connect_irq(timerbusdev, i,
|
||||
qdev_get_gpio_in(s->gic, ppibase + 29));
|
||||
sysbus_connect_irq(busdev, i * 2 + 1,
|
||||
sysbus_connect_irq(wdtbusdev, i,
|
||||
qdev_get_gpio_in(s->gic, ppibase + 30));
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue