android_kernel_xiaomi_sm8350/drivers/uio
Hans J. Koch e70c412ee4 UIO: Pass information about ioports to userspace (V2)
Devices sometimes have memory where all or parts of it can not be mapped to
userspace. But it might still be possible to access this memory from
userspace by other means. An example are PCI cards that advertise not only
mappable memory but also ioport ranges. On x86 architectures, these can be
accessed with ioperm, iopl, inb, outb, and friends. Mike Frysinger (CCed)
reported a similar problem on Blackfin arch where it doesn't seem to be easy
to mmap non-cached memory but it can still be accessed from userspace.

This patch allows kernel drivers to pass information about such ports to
userspace. Similar to the existing mem[] array, it adds a port[] array to
struct uio_info. Each port range is described by start, size, and porttype.

If a driver fills in at least one such port range, the UIO core will simply
pass this information to userspace by creating a new directory "portio"
underneath /sys/class/uio/uioN/. Similar to the "mem" directory, it will
contain a subdirectory (portX) for each port range given.

Note that UIO simply passes this information to userspace, it performs no
action whatsoever with this data. It's userspace's responsibility to obtain
access to these ports and to solve arch dependent issues. The "porttype"
attribute tells userspace what kind of port it is dealing with.

This mechanism could also be used to give userspace information about GPIOs
related to a device. You frequently find such hardware in embedded devices,
so I added a UIO_PORT_GPIO definition. I'm not really sure if this is a good
idea since there are other solutions to this problem, but it won't hurt much
anyway.

Signed-off-by: Hans J. Koch <hjk@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-06 10:44:44 -08:00
..
Kconfig UIO: add automata sercos3 pci card support 2008-10-16 09:24:53 -07:00
Makefile UIO: add automata sercos3 pci card support 2008-10-16 09:24:53 -07:00
uio_cif.c UIO: use pci_ioremap_bar() in drivers/uio 2009-01-06 10:44:43 -08:00
uio_pdrv_genirq.c UIO: uio_pdrv_genirq: allow custom irq_flags 2009-01-06 10:44:43 -08:00
uio_pdrv.c UIO: Change driver name of uio_pdrv 2008-10-16 09:24:53 -07:00
uio_sercos3.c UIO: add automata sercos3 pci card support 2008-10-16 09:24:53 -07:00
uio_smx.c UIO: Implement a UIO interface for the SMX Cryptengine 2008-04-19 19:10:18 -07:00
uio.c UIO: Pass information about ioports to userspace (V2) 2009-01-06 10:44:44 -08:00