Index: sys/arm64/arm64/gic_v3_fdt.c =================================================================== --- sys/arm64/arm64/gic_v3_fdt.c +++ sys/arm64/arm64/gic_v3_fdt.c @@ -48,6 +48,10 @@ #include "gic_v3_reg.h" #include "gic_v3_var.h" +/* Interrupt trigger code in FDT */ +#define GIC_FDT_TRIG_RISING_EDGE (1) +#define GIC_FDT_TRIG_LEVEL_HIGH (4) + /* * FDT glue. */ @@ -57,6 +61,8 @@ static struct resource *gic_v3_ofw_bus_alloc_res(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); static const struct ofw_bus_devinfo *gic_v3_ofw_get_devinfo(device_t, device_t); +static void gic_v3_fdt_translate_code(device_t, u_int irq, int code, + enum intr_trigger *trig, enum intr_polarity *pol); static device_method_t gic_v3_fdt_methods[] = { /* Device interface */ @@ -75,6 +81,9 @@ DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + /* PIC interface */ + DEVMETHOD(pic_translate_code, gic_v3_fdt_translate_code), + /* End */ DEVMETHOD_END }; @@ -214,6 +223,29 @@ count, flags)); } +/* PIC interface */ +static void +gic_v3_fdt_translate_code(device_t dev, u_int irq, int code, + enum intr_trigger *trig, enum intr_polarity *pol) +{ + + switch (code) { + case GIC_FDT_TRIG_RISING_EDGE: + /* Rising edge triggered */ + *trig = INTR_TRIGGER_EDGE; + *pol = INTR_POLARITY_HIGH; + break; + case GIC_FDT_TRIG_LEVEL_HIGH: + /* Level high triggered */ + *trig = INTR_TRIGGER_LEVEL; + *pol = INTR_POLARITY_HIGH; + break; + default: + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + } +} + /* Helper functions */ /*