freebsd-nq/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
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
fs In ext2fs, BA_CLRBUF is used in ext2_balloc() not UFS_BALLOC(). 2020-12-08 00:49:31 +00:00
gdb
geom Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
gnu
i386 hme(4): Remove as previous announced 2020-12-11 21:40:38 +00:00
isa
kern cache_fplookup: quiet gcc -Wreturn-type 2020-12-11 22:51:44 +00:00
kgssapi
libkern
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
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
netpfil Fix NOINET6 build broken by r368571. 2020-12-12 01:05:31 +00:00
netsmb
nfs
nfsclient
nfsserver nfs: Mark unused statistics variable as reserved 2020-11-18 04:35:49 +00:00
nlm
ofed
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
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
tests
tools
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
xen
Makefile