Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/fdt Add fdtbus_intr_establish_raw and fdtbus_intr_st...



details:   https://anonhg.NetBSD.org/src/rev/f56b8ef87e0a
branches:  trunk
changeset: 433305:f56b8ef87e0a
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Sep 06 22:54:05 2018 +0000

description:
Add fdtbus_intr_establish_raw and fdtbus_intr_str_raw, for establishing
interrupts directly using an interrupt controller's phandle and specifier.

diffstat:

 sys/dev/fdt/fdt_intr.c |  30 ++++++++++++++++++++++++------
 sys/dev/fdt/fdtvar.h   |   5 ++++-
 2 files changed, 28 insertions(+), 7 deletions(-)

diffs (90 lines):

diff -r 6f02a09d31e4 -r f56b8ef87e0a sys/dev/fdt/fdt_intr.c
--- a/sys/dev/fdt/fdt_intr.c    Thu Sep 06 22:30:34 2018 +0000
+++ b/sys/dev/fdt/fdt_intr.c    Thu Sep 06 22:54:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.17 2018/07/15 16:59:16 jmcneill Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.18 2018/09/06 22:54:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.17 2018/07/15 16:59:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.18 2018/09/06 22:54:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -134,16 +134,25 @@
 fdtbus_intr_establish(int phandle, u_int index, int ipl, int flags,
     int (*func)(void *), void *arg)
 {
-       struct fdtbus_interrupt_controller *ic;
-       struct fdtbus_interrupt_cookie *c = NULL;
        const u_int *specifier;
        int ihandle;
-       void *ih;
 
        specifier = get_specifier_by_index(phandle, index, &ihandle);
        if (specifier == NULL)
                return NULL;
 
+       return fdtbus_intr_establish_raw(ihandle, specifier, ipl,
+           flags, func, arg);
+}
+
+void *
+fdtbus_intr_establish_raw(int ihandle, const u_int *specifier, int ipl,
+    int flags, int (*func)(void *), void *arg)
+{
+       struct fdtbus_interrupt_controller *ic;
+       struct fdtbus_interrupt_cookie *c;
+       void *ih;
+
        ic = fdtbus_get_interrupt_controller(ihandle);
        if (ic == NULL)
                return NULL;
@@ -184,11 +193,20 @@
 bool
 fdtbus_intr_str(int phandle, u_int index, char *buf, size_t buflen)
 {
-       struct fdtbus_interrupt_controller *ic;
        const u_int *specifier;
        int ihandle;
 
        specifier = get_specifier_by_index(phandle, index, &ihandle);
+       if (specifier == NULL)
+               return false;
+
+       return fdtbus_intr_str_raw(ihandle, specifier, buf, buflen);
+}
+
+bool
+fdtbus_intr_str_raw(int ihandle, const u_int *specifier, char *buf, size_t buflen)
+{
+       struct fdtbus_interrupt_controller *ic;
 
        ic = fdtbus_get_interrupt_controller(ihandle);
        if (ic == NULL)
diff -r 6f02a09d31e4 -r f56b8ef87e0a sys/dev/fdt/fdtvar.h
--- a/sys/dev/fdt/fdtvar.h      Thu Sep 06 22:30:34 2018 +0000
+++ b/sys/dev/fdt/fdtvar.h      Thu Sep 06 22:54:05 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.38 2018/07/01 18:16:40 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.39 2018/09/06 22:54:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -271,8 +271,11 @@
 i2c_tag_t      fdtbus_get_i2c_tag(int);
 void *         fdtbus_intr_establish(int, u_int, int, int,
                    int (*func)(void *), void *arg);
+void *         fdtbus_intr_establish_raw(int, const u_int *, int, int,
+                   int (*func)(void *), void *arg);
 void           fdtbus_intr_disestablish(int, void *);
 bool           fdtbus_intr_str(int, u_int, char *, size_t);
+bool           fdtbus_intr_str_raw(int, const u_int *, char *, size_t);
 struct fdtbus_gpio_pin *fdtbus_gpio_acquire(int, const char *, int);
 struct fdtbus_gpio_pin *fdtbus_gpio_acquire_index(int, const char *, int, int);
 void           fdtbus_gpio_release(struct fdtbus_gpio_pin *);



Home | Main Index | Thread Index | Old Index