[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 08/15] xen/arm: use device api to detect GIC version
From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> Run through the device tree to detect compatible GIC version and initialize GIC driver. Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> --- xen/arch/arm/gic-v2.c | 26 +++++++++++++++----------- xen/arch/arm/gic.c | 17 ++++++++++++++++- xen/include/asm-arm/device.h | 3 ++- xen/include/asm-arm/gic.h | 1 - 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index e39099f..06ed12b 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -31,6 +31,7 @@ #include <asm/p2m.h> #include <asm/domain.h> #include <asm/platform.h> +#include <asm/device.h> #include <asm/gic_v2_defs.h> #include <asm/gic.h> @@ -289,20 +290,10 @@ static void __cpuinit gic_hyp_disable(void) } /* Set up the GIC */ -void __init gicv2_init(void) +int __init gicv2_init(struct dt_device_node *node, const void *data) { - static const struct dt_device_match gic_ids[] __initconst = - { - DT_MATCH_GIC, - { /* sentinel */ }, - }; - struct dt_device_node *node; int res; - node = dt_find_interrupt_controller(gic_ids); - if ( !node ) - panic("Unable to find compatible GIC in the device tree"); - dt_device_set_used_by(node, DOMID_XEN); res = dt_device_get_address(node, 0, &gic.dbase, NULL); @@ -360,6 +351,7 @@ void __init gicv2_init(void) gic_hyp_init(); register_gic_ops(&gic_ops); + return 0; } static void gic_secondary_cpu_init(void) @@ -528,6 +520,18 @@ static struct gic_hw_operations gic_ops = { .read_vmcr_priority = gic_read_vmcr_priority, }; +static const char * const gicv2_dt_compat[] __initconst = +{ + "arm,cortex-a15-gic", + "arm,cortex-a9-gic", + NULL +}; + +DT_DEVICE_START(gicv2, "GIC", DEVICE_GIC) + .compatible = gicv2_dt_compat, + .init = gicv2_init, +DT_DEVICE_END + /* * Local variables: * mode: C diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index eb2f2d4..87a7ad0 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -31,6 +31,7 @@ #include <asm/p2m.h> #include <asm/domain.h> #include <asm/platform.h> +#include <asm/device.h> #include <asm/gic.h> @@ -253,8 +254,22 @@ int gic_irq_xlate(const u32 *intspec, unsigned int intsize, /* Set up the GIC */ void __init gic_init(void) { - gicv2_init(); + int rc; + struct dt_device_node *node; + unsigned int num_gics = 0; + spin_lock_init(&gic_lock); + spin_lock(&gic_lock); + + dt_for_each_device_node(dt_host, node) + { + rc = device_init(node, DEVICE_GIC, NULL); + if ( !rc ) + num_gics++; + } + spin_unlock(&gic_lock); + if ( !num_gics ) + panic("Unable to find compatible GIC in the device tree"); } void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi) diff --git a/xen/include/asm-arm/device.h b/xen/include/asm-arm/device.h index 9e47ca6..61412e6 100644 --- a/xen/include/asm-arm/device.h +++ b/xen/include/asm-arm/device.h @@ -6,7 +6,8 @@ enum device_type { - DEVICE_SERIAL + DEVICE_SERIAL, + DEVICE_GIC }; struct device_desc { diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index cc6d8c4..27d2792 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -116,7 +116,6 @@ extern int gic_route_irq_to_guest(struct domain *d, extern void gic_interrupt(struct cpu_user_regs *regs, int is_fiq); /* Bring up the interrupt controller, and report # cpus attached */ extern void gic_init(void); -extern void gicv2_init(void); /* Bring up a secondary CPU's per-CPU GIC interface */ extern void gic_init_secondary_cpu(void); /* Take down a CPU's per-CPU GIC interface */ -- 1.7.9.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |