summaryrefslogtreecommitdiff
path: root/hw/sparc
diff options
context:
space:
mode:
authorKONRAD Frederic <frederic.konrad@adacore.com>2019-05-15 14:31:29 +0200
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2019-05-17 09:17:11 +0100
commit948caec873131584ec343892bb88b6544cd867e4 (patch)
treee955e804b49d80401b36560c676023bece0708a7 /hw/sparc
parentea005daec3b15f172d991f705b3526427461e15d (diff)
downloadqemu-948caec873131584ec343892bb88b6544cd867e4.zip
grlib, gptimer: get rid of the old-style create function
Suggested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/sparc')
-rw-r--r--hw/sparc/leon3.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 34306937bc..fb52527add 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -49,6 +49,10 @@
#define LEON3_IRQMP_OFFSET (0x80000200)
+#define LEON3_TIMER_OFFSET (0x80000300)
+#define LEON3_TIMER_IRQ (6)
+#define LEON3_TIMER_COUNT (2)
+
typedef struct ResetData {
SPARCCPU *cpu;
uint32_t entry; /* save kernel entry in case of reset */
@@ -124,6 +128,7 @@ static void leon3_generic_hw_init(MachineState *machine)
int prom_size;
ResetData *reset_info;
DeviceState *dev;
+ int i;
/* Init CPU */
cpu = SPARC_CPU(cpu_create(machine->cpu_type));
@@ -220,7 +225,17 @@ static void leon3_generic_hw_init(MachineState *machine)
}
/* Allocate timers */
- grlib_gptimer_create(0x80000300, 2, CPU_CLK, cpu_irqs, 6);
+ dev = qdev_create(NULL, TYPE_GRLIB_GPTIMER);
+ qdev_prop_set_uint32(dev, "nr-timers", LEON3_TIMER_COUNT);
+ qdev_prop_set_uint32(dev, "frequency", CPU_CLK);
+ qdev_prop_set_uint32(dev, "irq-line", LEON3_TIMER_IRQ);
+ qdev_init_nofail(dev);
+
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_TIMER_OFFSET);
+ for (i = 0; i < LEON3_TIMER_COUNT; i++) {
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
+ cpu_irqs[LEON3_TIMER_IRQ + i]);
+ }
/* Allocate uart */
if (serial_hd(0)) {