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>
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)
{
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 */
/* 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