Commit beafc54c authored by Hans J. Koch's avatar Hans J. Koch Committed by Greg Kroah-Hartman

UIO: Add the User IO core code

This interface allows the ability to write the majority of a driver in
userspace with only a very small shell of a driver in the kernel itself.
It uses a char device and sysfs to interact with a userspace process to
process interrupts and control memory accesses.

See the docbook documentation for more details on how to use this

From: Hans J. Koch <>
Cc: Thomas Gleixner <>
Cc: Benedikt Spranger <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 5bae7ac9
......@@ -84,4 +84,5 @@ source "drivers/auxdisplay/Kconfig"
source "drivers/kvm/Kconfig"
source "drivers/uio/Kconfig"
......@@ -40,6 +40,7 @@ obj-$(CONFIG_ATA) += ata/
obj-$(CONFIG_FUSION) += message/
obj-$(CONFIG_FIREWIRE) += firewire/
obj-$(CONFIG_IEEE1394) += ieee1394/
obj-$(CONFIG_UIO) += uio/
obj-y += cdrom/
obj-y += auxdisplay/
obj-$(CONFIG_MTD) += mtd/
menu "Userspace I/O"
depends on !S390
config UIO
tristate "Userspace I/O drivers"
default n
Enable this to allow the userspace driver core code to be
built. This code allows userspace programs easy access to
kernel interrupts and memory locations, allowing some drivers
to be written in userspace. Note that a small kernel driver
is also required for interrupt handling to work properly.
If you don't know what to do here, say N.
obj-$(CONFIG_UIO) += uio.o
This diff is collapsed.
* include/linux/uio_driver.h
* Copyright(C) 2005, Benedikt Spranger <>
* Copyright(C) 2005, Thomas Gleixner <>
* Copyright(C) 2006, Hans J. Koch <>
* Copyright(C) 2006, Greg Kroah-Hartman <>
* Userspace IO driver.
* Licensed under the GPLv2 only.
#ifndef _UIO_DRIVER_H_
#define _UIO_DRIVER_H_
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
* struct uio_mem - description of a UIO memory region
* @kobj: kobject for this mapping
* @addr: address of the device's memory
* @size: size of IO
* @memtype: type of memory addr points to
* @internal_addr: ioremap-ped version of addr, for driver internal use
struct uio_mem {
struct kobject kobj;
unsigned long addr;
unsigned long size;
int memtype;
void __iomem *internal_addr;
#define MAX_UIO_MAPS 5
struct uio_device;
* struct uio_info - UIO device capabilities
* @uio_dev: the UIO device this info belongs to
* @name: device name
* @version: device driver version
* @mem: list of mappable memory regions, size==0 for end of list
* @irq: interrupt number or UIO_IRQ_CUSTOM
* @irq_flags: flags for request_irq()
* @priv: optional private data
* @handler: the device's irq handler
* @mmap: mmap operation for this uio device
* @open: open operation for this uio device
* @release: release operation for this uio device
struct uio_info {
struct uio_device *uio_dev;
char *name;
char *version;
struct uio_mem mem[MAX_UIO_MAPS];
long irq;
unsigned long irq_flags;
void *priv;
irqreturn_t (*handler)(int irq, struct uio_info *dev_info);
int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
int (*open)(struct uio_info *info, struct inode *inode);
int (*release)(struct uio_info *info, struct inode *inode);
extern int __must_check
__uio_register_device(struct module *owner,
struct device *parent,
struct uio_info *info);
static inline int __must_check
uio_register_device(struct device *parent, struct uio_info *info)
return __uio_register_device(THIS_MODULE, parent, info);
extern void uio_unregister_device(struct uio_info *info);
extern void uio_event_notify(struct uio_info *info);
/* defines for uio_device->irq */
#define UIO_IRQ_CUSTOM -1
#define UIO_IRQ_NONE -2
/* defines for uio_device->memtype */
#define UIO_MEM_NONE 0
#define UIO_MEM_PHYS 1
#endif /* _LINUX_UIO_DRIVER_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment