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/mpc85xx/atpic.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/mpc85xx/atpic.c')
-rw-r--r-- | sys/powerpc/mpc85xx/atpic.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/powerpc/mpc85xx/atpic.c b/sys/powerpc/mpc85xx/atpic.c index a792e54..ef7ab88 100644 --- a/sys/powerpc/mpc85xx/atpic.c +++ b/sys/powerpc/mpc85xx/atpic.c @@ -79,6 +79,9 @@ static void atpic_ipi(device_t, u_int); static void atpic_mask(device_t, u_int); static void atpic_unmask(device_t, u_int); +static void atpic_ofw_translate_code(device_t, u_int irq, int code, + enum intr_trigger *trig, enum intr_polarity *pol); + static device_method_t atpic_isa_methods[] = { /* Device interface */ DEVMETHOD(device_identify, atpic_isa_identify), @@ -94,6 +97,8 @@ static device_method_t atpic_isa_methods[] = { DEVMETHOD(pic_mask, atpic_mask), DEVMETHOD(pic_unmask, atpic_unmask), + DEVMETHOD(pic_translate_code, atpic_ofw_translate_code), + { 0, 0 }, }; @@ -325,3 +330,35 @@ atpic_unmask(device_t dev, u_int irq) atpic_write(sc, ATPIC_MASTER, 1, sc->sc_mask[ATPIC_MASTER]); } } + +static void +atpic_ofw_translate_code(device_t dev, u_int irq, int code, + enum intr_trigger *trig, enum intr_polarity *pol) +{ + switch (code) { + case 0: + /* Active L level */ + *trig = INTR_TRIGGER_LEVEL; + *pol = INTR_POLARITY_LOW; + break; + case 1: + /* Active H level */ + *trig = INTR_TRIGGER_LEVEL; + *pol = INTR_POLARITY_HIGH; + break; + case 2: + /* H to L edge */ + *trig = INTR_TRIGGER_EDGE; + *pol = INTR_POLARITY_LOW; + break; + case 3: + /* L to H edge */ + *trig = INTR_TRIGGER_EDGE; + *pol = INTR_POLARITY_HIGH; + break; + default: + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + } +} + |