25 Mar, 2009
3 commits
-
If a UIO memory region does not start on a page boundary but straddles one,
the number of actual pages that overlap the memory region may be calculated
incorrectly because the offset isn't taken into account. If userspace sets
the mmap length to offset+size, it may fail with -EINVAL if UIO thinks it's
trying to allocate too many pages.Signed-off-by: Ian Abbott
Cc: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
UIO driver for the Adrienne Electronics Corporation PCI time code
device.This device differs from other UIO devices since it uses I/O ports instead of
memory mapped I/O. In order to make it possible for UIO to work with this
device a utility, uioport, can be used to read and write the ports.uioport is designed to be a setuid program and checks the permissions of
the /dev/uio* node and if the user has write permissions it will use
iopl and out*/in* to access the device.[1] git clone git://ifup.org/philips/uioport.git
Signed-off-by: Brandon Philips
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
If a UIO device has several memory mappings, it can be difficult for userspace
to find the right one. The situation becomes even worse if the UIO driver can
handle different versions of a card that have different numbers of mappings.
Benedikt Spranger has such cards and pointed this out to me. Thanks, Bene!To address this problem, this patch adds "name" sysfs attributes for each
mapping. Userspace can use these to clearly identify each mapping. The name
string is optional. If a driver doesn't set it, an empty string will be
returned, so this patch won't break existing drivers.The same problem exists for port region information, so a "name" attribute is
added there, too.Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman
07 Jan, 2009
3 commits
-
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
Signed-off-by: Greg Kroah-Hartman -
I can't think of a reason why the driver prevents people from setting any
custom bits in their platform device, but I can think of some reasons for
allowing custom flags. Like setting the IRQF_TRIGGER_... bits.Signed-off-by: Mike Frysinger
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
Use the newly introduced pci_ioremap_bar() function in drivers/uio.
pci_ioremap_bar() just takes a pci device and a bar number, with the goal
of making it really hard to get wrong, while also having a central place
to stick sanity checks.Signed-off-by: Arjan van de Ven
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman
02 Nov, 2008
1 commit
-
As it is, all instances of ->release() for files that have ->fasync()
need to remember to evict file from fasync lists; forgetting that
creates a hole and we actually have a bunch that *does* forget.So let's keep our lives simple - let __fput() check FASYNC in
file->f_flags and call ->fasync() there if it's been set. And lose that
crap in ->release() instances - leaving it there is still valid, but we
don't have to bother anymore.Signed-off-by: Al Viro
Signed-off-by: Linus Torvalds
21 Oct, 2008
1 commit
-
* 'bkl-removal' of git://git.lwn.net/linux-2.6:
UIO: BKL removal
17 Oct, 2008
6 commits
-
Fill in needed locking around idr accesses, then remove the big kernel lock
from the UIO driver. Since there are no in-tree UIO drivers with open()
methods, no further BKL pushdown is required.Acked-by: Hans J. Koch
Acked-by: Greg Kroah-Hartman
Signed-off-by: Jonathan Corbet -
mmap() doesn't work as expected for UIO_MEM_LOGICAL or UIO_MEM_VIRTUAL
mappings. The offset into the memory needs to be added, otherwise
uio_vma_fault always returns the first page only. Note that for UIO
userspace calls mmap() with offset = N * getpagesize() to access
mapping N. This must be compensated when calculating the offset. A
comment was added to explain this since it is not obvious.Signed-off-by: Andrew G. Harvey
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
Here is a new version of the patch to support the Automata Sercos III
PCI card driver. I now check that the IRQ is enabled before accepting
the interrupt.I still use a logical OR to store the enabled interrupts and I've
added a second use of a logical OR when restoring the enabled
interrupts. I added an explanation of why I do this in comments at the
top of the source file.Since I use a logical OR, I also removed the extra checks if the
Interrupt Enable Register and ier0_cache are 0.Signed-off-by: John Ogness
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
The generic UIO platform device driver should be given a unique driver ID and
not just "uio". This is especially important since we now have a similar driver
named uio_pdrv_genirq. Currently, there's no user of this driver in the
mainline kernel.Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
This patch adds an "offset" attribute for UIO mappings. It shows the
difference between the actual start address of the memory and the start
address of the page.Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
Now that device_create() has been audited, rename things back to the
original call to be sane.Signed-off-by: Greg Kroah-Hartman
22 Aug, 2008
3 commits
-
This is V3 of uio_pdrv_genirq.c, a platform driver for UIO with
generic IRQ handling code. This driver is very similar to the regular
UIO platform driver, but is only suitable for devices that are
connected to the interrupt controller using unique interrupt lines.The uio_pdrv_genirq driver includes generic interrupt handling code
which disables the serviced interrupt in the interrupt controller
and makes the user space driver responsible for acknowledging the
interrupt in the device and reenabling the interrupt in the interrupt
controller.Shared interrupts are not supported since the in-kernel interrupt
handler will disable the interrupt line in the interrupt controller,
and in a shared interrupt configuration this will stop other devices
from delivering interrupts.Signed-off-by: Magnus Damm
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
Thanks to Magnus Damm for pointing that out.
Signed-off-by: Uwe Kleine-König
Cc: Magnus Damm
Acked-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
Thanks to Magnus Damm for pointing that out.
Signed-off-by: Uwe Kleine-König
Cc: Magnus Damm
Acked-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman
22 Jul, 2008
3 commits
-
This patch adds a generic UIO platform driver. It eliminates the need for a
dedicated kernel module for simple platform devices. Users only need to
implement their irq handler in platform code and fill a struct uio_info
there. This helps avoiding code duplication as UIO platform drivers often
share a lot of common code.Signed-off-by: Uwe Kleine-König
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
Sometimes it is necessary to enable/disable the interrupt of a UIO device
from the userspace part of the driver. With this patch, the UIO kernel driver
can implement an "irqcontrol()" function that does this. Userspace can write
an s32 value to /dev/uioX (usually 0 or 1 to turn the irq off or on). The
UIO core will then call the driver's irqcontrol function.Signed-off-by: Hans J. Koch
Acked-by: Uwe Kleine-König
Acked-by: Magnus Damm
Signed-off-by: Greg Kroah-Hartman -
ae210f188614bb3d1ee3f19c64e28e3cdd44877c introduced a big "if UIO"/"endif"
where all uio drivers are defined. So know there is no need for them to
depend explicitly on UIO.Signed-off-by: Uwe Kleine-König
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman
15 Jul, 2008
1 commit
21 Jun, 2008
1 commit
-
Signed-off-by: Jonathan Corbet
21 May, 2008
1 commit
-
There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.This patch fixes the problem by using the new function,
device_create_drvdata().Cc: Kay Sievers
Cc: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman
20 Apr, 2008
5 commits
-
Otherwise the device might just disappear while /dev/uioX is being used
which results in an Oops.Signed-off-by: Uwe Kleine-König
Signed-off-by: Hans J Koch
Signed-off-by: Greg Kroah-Hartman -
This patch implements a UIO interface for the SMX Cryptengine.
The Cryptengine found on the Nias Digital SMX board is best suited
for a UIO interface. It is not wired in to the cryptographic API
as the engine handles it's own keys, algorithms, everything. All
that we know about is that if there's room in the buffer, you can
write data to it and when there's data ready, you read it out again.There isn't necessarily even any direct correlation between data
going in and data coming out again, the engine may consume or
generate data all on its own.This driver is for proprietary hardware but we're always told to
submit the drivers anyway; here you are. :-)This is version 4 of this patch and addresses all issues raised by
Hans-Jürgen Koch and Paul Mundt in their reviews. Slightly altered
is Paul's suggestion to use DRV_NAME and DRV_VERSION as the UIO
version and name. While at the moment they are the same, there
is no reason for them to stay that way. Nevertheless we now at
least provide a MODULE_VERSION macro to keep modinfo happy.Signed-off-by: Ben Nizette
Acked-by: Paul Mundt
Signed-off-by: Hans J Koch
Signed-off-by: Greg Kroah-Hartman -
Meanwhile, PCI_DEVICE_ID_PLX_9030 is defined in pci_ids.h, no need to
define it again in the driver.Signed-off-by: Hans J. Koch
CC: Benedikt Spranger
Signed-off-by: Greg Kroah-Hartman -
Signed-off-by: Denis Cheng
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
Signed-off-by: Denis Cheng
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman
25 Mar, 2008
1 commit
-
Mapping of physical memory in UIO needs pgprot_noncached() to ensure
that IO memory is not cached. Without pgprot_noncached(), it (accidentally)
works on x86 and arm, but fails on PPC.Signed-off-by: Jean-Samuel Chenard
Signed-off-by: Hans J Koch
Cc: stable
Signed-off-by: Greg Kroah-Hartman
22 Feb, 2008
1 commit
-
This fixes two bugs with UIO that cropped up recently in -rc1
1) WARNING: at fs/sysfs/file.c:334 sysfs_open_file when trying to open
a map addr/size file - complaining about missing sysfs_ops for ktype2) Permission denied when reading uio/uio0/maps/map0/{addr,size} when
files are mode S_IRUGOAlso fix a typo: attr_attribute -> addr_attribute
Signed-off-by: Brandon Philips
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman
07 Feb, 2008
1 commit
-
Convert uio from nopage to fault.
Signed-off-by: Nick Piggin
Acked-by: Hans J Koch
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
25 Jan, 2008
6 commits
-
Signed-off-by: Jan Engelhardt
Signed-off-by: Greg Kroah-Hartman -
There is no need for kobject_unregister() anymore, thanks to Kay's
kobject cleanup changes, so replace all instances of it with
kobject_put().Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
Now that the old kobject_init() function is gone, rename
kobject_init_ng() to kobject_init() to clean up the namespace.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
Now that the old kobject_add() function is gone, rename kobject_add_ng()
to kobject_add() to clean up the namespace.Cc: Kay Sievers
Signed-off-by: Greg Kroah-Hartman -
The uio kobject code is "wierd". This patch should hopefully fix it up
to be sane and not leak memory anymore.Cc: Kay Sievers
Cc: Thomas Gleixner
Cc: Benedikt Spranger
Signed-off-by: Hans J. Koch
Signed-off-by: Greg Kroah-Hartman -
We don't need a "default" ktype for a kset. We should set this
explicitly every time for each kset. This change is needed so that we
can make ksets dynamic, and cleans up one of the odd, undocumented
assumption that the kset/kobject/ktype model has.This patch is based on a lot of help from Kay Sievers.
Nasty bug in the block code was found by Dave Young
Cc: Kay Sievers
Cc: Dave Young
Signed-off-by: Greg Kroah-Hartman
19 Jul, 2007
2 commits
-
this is a patch that adds support for Hilscher CIF DeviceNet and
Profibus cards. I tested it on a Kontron CPX board, and Thomas reviewed
it.You can find the user space part here:
http://www.osadl.org/projects/downloads/UIO/user/cif-0.1.0.tar.gz
Notes: cif_api.c is the main file you want to look at. It contains the
functions to open, close, mmap and so on. cif_dps.c adds functions
specific to Profibus cards, and cif_dn.c contains functions for
DeviceNet cards. cif.c is a universal playground, it's just a small
test program. The user space part of this UIO driver is still work in
progress, and not everything is tested yet. At the moment, the thread in
cif_api.c contains some code that artificially makes the card generate
interrupts, this was added for testing and will be removed later. But
the driver already contains all the functions needed for useful
operation, so it gives a good idea of how such a thing looks like.For comparison, here's what you get from the manufacturer
(www.hilscher.com) when you ask for a Linux 2.6 driver:http://www.tglx.de/private/hjk/cif-orig-2.6.tar.bz2
WARNING: Don't look at the code for too long, you might become sick :-)
Signed-off-by: Hans-Jürgen Koch
Signed-off-by: Greg Kroah-Hartman -
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
interface.From: Hans J. Koch
Cc: Thomas Gleixner
Cc: Benedikt Spranger
Signed-off-by: Greg Kroah-Hartman