]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
xen/arm: Introduce gic_irq_xlate
authorJulien Grall <julien.grall@linaro.org>
Fri, 26 Apr 2013 16:58:18 +0000 (17:58 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 13 May 2013 10:59:58 +0000 (11:59 +0100)
This function translates an interrupt specifier to an IRQ number and IRQ
type (ie: level trigger, edge trigger,...). It's GIC specific.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/gic.c
xen/arch/arm/setup.c
xen/include/asm-arm/gic.h

index 4d79060b17ae780afe152fb2722c4da125058ee5..68f2410b91315a8e732a3ac35e43e38e32048858 100644 (file)
@@ -329,6 +329,26 @@ static void __cpuinit gic_hyp_disable(void)
     GICH[GICH_HCR] = 0;
 }
 
+int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
+                  unsigned int *out_hwirq,
+                  unsigned int *out_type)
+{
+    if ( intsize < 3 )
+        return -EINVAL;
+
+    /* Get the interrupt number and add 16 to skip over SGIs */
+    *out_hwirq = intspec[1] + 16;
+
+    /* For SPIs, we need to add 16 more to get the GIC irq ID number */
+    if ( !intspec[0] )
+        *out_hwirq += 16;
+
+    if ( out_type )
+        *out_type = intspec[2] & DT_IRQ_TYPE_SENSE_MASK;
+
+    return 0;
+}
+
 /* Set up the GIC */
 void __init gic_init(void)
 {
index 81bc956013304369f3a2452b78069a9f195ac215..fc53117164b0577efa07bd93822ab610e68f85a0 100644 (file)
@@ -431,6 +431,7 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     vm_init();
     dt_unflatten_host_device_tree();
+    dt_irq_xlate = gic_irq_xlate;
 
 #ifdef EARLY_UART_ADDRESS
     /* TODO Need to get device tree or command line for UART address */
index 78dd21addfbd2027885cd7946c3ea23b4dd25ecd..6ff217c231d54557530362c0b28330bd78bd4c73 100644 (file)
@@ -189,6 +189,10 @@ extern void send_SGI_allbutself(enum gic_sgi sgi);
 /* print useful debug info */
 extern void gic_dump_info(struct vcpu *v);
 
+/* IRQ translation function for the device tree */
+int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
+                  unsigned int *out_hwirq, unsigned int *out_type);
+
 #endif /* __ASSEMBLY__ */
 #endif