Add fdtbus_intr_establish_raw and fdtbus_intr_str_raw, for establishing
interrupts directly using an interrupt controller's phandle and specifier.
This commit is contained in:
parent
5db7ad36d8
commit
f092d0ca97
@ -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>
|
||||
@ -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, void *cookie)
|
||||
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)
|
||||
|
@ -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>
|
||||
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user