summary refs log tree commit diff stats
path: root/include/hw/ppc
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2018-11-27 14:06:22 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2018-12-21 09:24:23 +1100
commit9929301ee12fb2bc8afe0d954cb1b58a8b1e8880 (patch)
tree2ee6842d7815bbd3117b55d9a2d775e74948fcaf /include/hw/ppc
parent57aa218818c06c3fd7e10b5b6e1cbccdca6790ab (diff)
downloadfocaccia-qemu-9929301ee12fb2bc8afe0d954cb1b58a8b1e8880.tar.gz
focaccia-qemu-9929301ee12fb2bc8afe0d954cb1b58a8b1e8880.zip
mac_newworld: simplify IRQ wiring
The OpenPIC have 5 outputs per connected CPU. The machine init code hence
needs a bi-dimensional array (smp_cpu lines, 5 columns) to wire up the irqs
between the PIC and the CPUs.

The current code first allocates an array of smp_cpus pointers to qemu_irq
type, then it allocates another array of smp_cpus * 5 qemu_irq and fills the
first array with pointers to each line of the second array. This is rather
convoluted.

Simplify the logic by introducing a structured type that describes all the
OpenPIC outputs for a single CPU, ie, fixed size of 5 qemu_irq, and only
allocate a smp_cpu sized array of those.

This also allows to use g_new(T, n) instead of g_malloc(sizeof(T) * n)
as recommended in HACKING.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'include/hw/ppc')
-rw-r--r--include/hw/ppc/openpic.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h
index 5eb982197d..dad08fe9be 100644
--- a/include/hw/ppc/openpic.h
+++ b/include/hw/ppc/openpic.h
@@ -20,6 +20,8 @@ enum {
     OPENPIC_OUTPUT_NB,
 };
 
+typedef struct IrqLines { qemu_irq irq[OPENPIC_OUTPUT_NB]; } IrqLines;
+
 #define OPENPIC_MODEL_RAVEN       0
 #define OPENPIC_MODEL_FSL_MPIC_20 1
 #define OPENPIC_MODEL_FSL_MPIC_42 2