[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 09/16] 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 | 24 +++++++++++++++++++++++- xen/include/asm-arm/device.h | 3 ++- xen/include/asm-arm/gic.h | 1 - 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 7c63bae..1e62dd9 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> @@ -276,20 +277,10 @@ static void __cpuinit gicv2_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); @@ -348,6 +339,7 @@ void __init gicv2_init(void) gic_ops.hw_version = GIC_V2; register_gic_ops(&gic_ops); + return 0; } static void gicv2_secondary_cpu_init(void) @@ -522,6 +514,18 @@ static struct gic_hw_operations gic_ops = { .read_vmcr_priority = gicv2_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 ce21ef6..4a86c42 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> @@ -264,8 +265,29 @@ 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; + uint8_t num_gics = 0; + spin_lock_init(&gic_lock); + + dt_for_each_device_node(dt_host, node) + { + if ( !dt_get_property(node, "interrupt-controller", NULL) ) + continue; + + if ( !dt_get_parent(node) ) + continue; + + rc = device_init(node, DEVICE_GIC, NULL); + if ( !rc ) + { + num_gics++; + break; + } + } + 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 42f0e79..2209f14 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -86,7 +86,6 @@ struct gic_lr { }; extern int gic_hw_version(void); -extern void gicv2_init(void); extern int domain_vgic_init(struct domain *d); extern void domain_vgic_free(struct domain *d); -- 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 |