opnsense-src/sys
Ian Lepore ff3468ac94 Provide userland notification of gpio pin changes ("userland gpio interrupts").
This is an import of the Google Summer of Code 2018 project completed by
Christian Kramer (and, sadly, ignored by us for two years now).  The goals
stated for that project were:

    FreeBSD already has support for interrupts implemented in the GPIO
    controller drivers of several SoCs, but there are no interfaces to take
    advantage of them out of user space yet. The goal of this work is to
    implement such an interface by providing descriptors which integrate
    with the common I/O system calls and multiplexing mechanisms.

The initial imported code supports the following functionality:

 -  A kernel driver that provides an interface to the user space; the
    existing gpioc(4) driver was enhanced with this functionality.
 -  Implement support for the most common I/O system calls / multiplexing
    mechanisms:
     -  read() Places the pin number on which the interrupt occurred in the
        buffer. Blocking and non-blocking behaviour supported.
     -	poll()/select()
     -	kqueue()
     -	signal driven I/O. Posting SIGIO when the O_ASYNC was set.
 -  Many-to-many relationship between pins and file descriptors.
     -  A file descriptor can monitor several GPIO pins.
     -  A GPIO pin can be monitored by multiple file descriptors.
 -  Integration with gpioctl and libgpio.

I added some fixes (mostly to locking) and feature enhancements on top of
the original gsoc code.  The feature ehancements allow the user to choose
between detailed and summary event reporting.  Detailed reporting provides
a record describing each pin change event.  Summary reporting provides the
time of the first and last change of each pin, and a count of how many times
it changed state since the last read(2) call.  Another enhancement allows
the recording of multiple state change events on multiple pins between each
call to read(2) (the original code would track only a single event at a time).

The phabricator review for these changes timed out without approval, but I
cite it below anyway, because the review contains a series of diffs that
show how I evolved the code from its original state in Christian's github
repo for the gsoc project to what is being commited here.  (In effect,
the phab review extends the VC history back to the original code.)

Submitted by:	Christian Kramer
Obtained from:	https://github.com/ckraemer/freebsd/tree/gsoc2018
Differential Revision:	https://reviews.freebsd.org/D27398
2020-12-12 18:34:15 +00:00
..
amd64 hme(4): Remove as previous announced 2020-12-11 21:40:38 +00:00
arm arm: Let the GDB stub write to SP, LR and GP registers 2020-12-07 15:09:28 +00:00
arm64 arm64: fix struct l_sigaction_t layout 2020-12-08 18:24:33 +00:00
bsm bsm: add AUE_CLOSERANGE 2020-04-24 01:27:25 +00:00
cam mmccam: Convert some printf to CAM_DEBUG 2020-11-30 14:49:13 +00:00
cddl Check that the frame pointer is within the current stack. 2020-12-08 18:00:58 +00:00
compat linux_dma: Ensure proper flags pass to allocators. 2020-12-10 20:45:08 +00:00
conf hme(4): Remove as previous announced 2020-12-11 21:40:38 +00:00
contrib Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
crypto Revert r366943. It did not work as expected. 2020-12-11 00:42:53 +00:00
ddb Add a kstack_contains() helper function. 2020-12-01 17:04:46 +00:00
dev Provide userland notification of gpio pin changes ("userland gpio interrupts"). 2020-12-12 18:34:15 +00:00
dts Brand our DTS with the Linux version it was imported from 2020-10-10 07:18:51 +00:00
fs In ext2fs, BA_CLRBUF is used in ext2_balloc() not UFS_BALLOC(). 2020-12-08 00:49:31 +00:00
gdb gdb(4): Don't escape GDB special characters at application layer 2020-09-30 14:55:54 +00:00
geom Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
gnu Brand our DTS with the Linux version it was imported from 2020-10-10 07:18:51 +00:00
i386 hme(4): Remove as previous announced 2020-12-11 21:40:38 +00:00
isa sc(4) md bits: stop setting sc->kbd entirely 2019-12-30 02:07:55 +00:00
kern cache_fplookup: quiet gcc -Wreturn-type 2020-12-11 22:51:44 +00:00
kgssapi State kgssapi dependency on xdr. 2020-09-17 22:29:38 +00:00
libkern arc4random(9): Integrate with RANDOM_FENESTRASX push-reseed 2020-10-10 21:48:06 +00:00
mips Various fixes for the MIPS DDB stack unwinder. 2020-12-04 20:14:25 +00:00
modules zfs: quiet gcc -Wmissing-include-dirs 2020-12-11 22:52:08 +00:00
net style(9): Correct whitespace in struct definitions 2020-12-11 01:00:07 +00:00
net80211 net80211: fix a typo 2020-11-04 12:07:33 +00:00
netgraph netgraph: macfilter: small fixes 2020-12-09 15:28:56 +00:00
netinet Add TCP feature Proportional Rate Reduction (PRR) - RFC6937 2020-12-04 11:29:27 +00:00
netinet6 Expose nonstandard IPv6 kernel definitions to standalone builds. 2020-12-04 21:51:47 +00:00
netipsec Trigger soft lifetime expiration on sequence number 2020-10-16 11:27:01 +00:00
netpfil Fix NOINET6 build broken by r368571. 2020-12-12 01:05:31 +00:00
netsmb net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
nfs nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsclient nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsserver nfs: Mark unused statistics variable as reserved 2020-11-18 04:35:49 +00:00
nlm nlm: clean up empty lines in .c and .h files 2020-09-01 22:14:52 +00:00
ofed Fix for referencing file via its vnode in ibore. 2020-11-02 10:44:29 +00:00
opencrypto Remove the cloned file descriptors for /dev/crypto. 2020-11-25 00:10:54 +00:00
powerpc Add CFI start/end proc directives to arm64, i386, and ppc 2020-12-05 00:33:28 +00:00
riscv riscv: small counter(9) improvements 2020-12-11 20:01:45 +00:00
rpc Fix a potential memory leak in the NFS over TLS handling code. 2020-09-05 00:50:52 +00:00
security pipe: allow for lockless pipe_stat 2020-11-19 06:30:25 +00:00
sys Provide userland notification of gpio pin changes ("userland gpio interrupts"). 2020-12-12 18:34:15 +00:00
teken Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
tests Add small tool to invoke kernel test framework tests. 2020-09-02 09:20:40 +00:00
tools Brand our DTS with the Linux version it was imported from 2020-10-10 07:18:51 +00:00
ufs ffs: quiet -Wstrict-prototypes 2020-12-11 22:51:57 +00:00
vm contig allocs: Don't retry forever on M_WAITOK. 2020-12-10 20:44:29 +00:00
x86 dmar: reserve memory windows of PCIe root port 2020-12-09 18:43:58 +00:00
xdr xdr: clean up empty lines in .c and .h files 2020-09-01 22:13:28 +00:00
xen xen: clean up empty lines in .c and .h files 2020-09-01 21:21:55 +00:00
Makefile Remove sparc64 kernel support 2020-02-03 17:35:11 +00:00