diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-10-24 15:37:32 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-10-24 15:37:32 +0000 |
commit | 55228c4ed428f052b8aea65e57455a06b1e0e8ef (patch) | |
tree | 705fa458ac7137cc1f70a273a36d290ad5333965 /sys/powerpc/ofw/openpic_ofw.c | |
parent | 9d4ffc738979d501190db026f145b32d5da827c7 (diff) | |
download | FreeBSD-src-55228c4ed428f052b8aea65e57455a06b1e0e8ef.zip FreeBSD-src-55228c4ed428f052b8aea65e57455a06b1e0e8ef.tar.gz |
Allow PIC drivers to translate firmware sense codes for themselves. This
is designed to replace the tables in dev/fdt/fdt_ARCH.c, but will not
happen quite yet.
Diffstat (limited to 'sys/powerpc/ofw/openpic_ofw.c')
-rw-r--r-- | sys/powerpc/ofw/openpic_ofw.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/powerpc/ofw/openpic_ofw.c b/sys/powerpc/ofw/openpic_ofw.c index 60d8345..0e85dda 100644 --- a/sys/powerpc/ofw/openpic_ofw.c +++ b/sys/powerpc/ofw/openpic_ofw.c @@ -61,6 +61,9 @@ __FBSDID("$FreeBSD$"); static int openpic_ofw_probe(device_t); static int openpic_ofw_attach(device_t); +static void openpic_ofw_translate_code(device_t, u_int irq, int code, + enum intr_trigger *trig, enum intr_polarity *pol); + static device_method_t openpic_ofw_methods[] = { /* Device interface */ DEVMETHOD(device_probe, openpic_ofw_probe), @@ -76,6 +79,8 @@ static device_method_t openpic_ofw_methods[] = { DEVMETHOD(pic_mask, openpic_mask), DEVMETHOD(pic_unmask, openpic_unmask), + DEVMETHOD(pic_translate_code, openpic_ofw_translate_code), + DEVMETHOD_END }; @@ -127,3 +132,34 @@ openpic_ofw_attach(device_t dev) return (openpic_common_attach(dev, xref)); } +static void +openpic_ofw_translate_code(device_t dev, u_int irq, int code, + enum intr_trigger *trig, enum intr_polarity *pol) +{ + switch (code) { + case 0: + /* L to H edge */ + *trig = INTR_TRIGGER_EDGE; + *pol = INTR_POLARITY_HIGH; + break; + case 1: + /* Active L level */ + *trig = INTR_TRIGGER_LEVEL; + *pol = INTR_POLARITY_LOW; + break; + case 2: + /* Active H level */ + *trig = INTR_TRIGGER_LEVEL; + *pol = INTR_POLARITY_HIGH; + break; + case 3: + /* H to L edge */ + *trig = INTR_TRIGGER_EDGE; + *pol = INTR_POLARITY_LOW; + break; + default: + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + } +} + |