Module Name: src Committed By: jmcneill Date: Thu Sep 6 22:54:05 UTC 2018
Modified Files: src/sys/dev/fdt: fdt_intr.c fdtvar.h Log Message: Add fdtbus_intr_establish_raw and fdtbus_intr_str_raw, for establishing interrupts directly using an interrupt controller's phandle and specifier. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/fdt_intr.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/fdt/fdtvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/fdt/fdt_intr.c diff -u src/sys/dev/fdt/fdt_intr.c:1.17 src/sys/dev/fdt/fdt_intr.c:1.18 --- src/sys/dev/fdt/fdt_intr.c:1.17 Sun Jul 15 16:59:16 2018 +++ src/sys/dev/fdt/fdt_intr.c Thu Sep 6 22:54:05 2018 @@ -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 <jmcne...@invisible.ca> @@ -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 @@ void * 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 @@ fdtbus_intr_disestablish(int phandle, vo 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) Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.38 src/sys/dev/fdt/fdtvar.h:1.39 --- src/sys/dev/fdt/fdtvar.h:1.38 Sun Jul 1 18:16:40 2018 +++ src/sys/dev/fdt/fdtvar.h Thu Sep 6 22:54:05 2018 @@ -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 <jmcne...@invisible.ca> @@ -271,8 +271,11 @@ int fdtbus_get_phandle_from_native(int) 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 *);