iomap(7)iomap(7)NAMEiomap - physical I/O address mapping
SYNOPSISDESCRIPTION
The mechanism allows the mapping (thus direct access) of physical I/O
addresses into the user process address space. For PA-RISC machines,
the physical I/O address space begins at and extends to
The special (device) files for devices are character special files
using the dynamic major number allocation scheme.
The minor number for devices is of the form:
The physical I/O address is formed by prefixing 0xAAAA with 0xF, and by
appending 0x000 (this forces the I/O address to be page-aligned). The
size of the region to be mapped is given by the expression M*(2^S) 4K
pages. For example, the minor number for a device starting at that
occupies 64MB is
The driver must be explicitly added to the file, the kernel rebuilt,
and the system subsequently rebooted prior to first using
I/O space is always mapped with both read and write access rights,
regardless of the actual permissions on the device special file.
Multiple processes can have concurrently a single device opened and
mapped. It is the responsibility of the processes to synchronize their
access.
Successive calls to to map the same I/O space must be identical to the
first mapping. Identical mappings have the same address and size.
Note that a process can additionally share I/O space (mapped by with a
kernel driver. However, this is only possible if the driver maps in
the I/O space with user read/write access rights using the appropriate
driver I/O mapping services. Any I/O space mapped by drivers with ker‐
nel read/write access rights cannot be concurrently mapped by processes
using
No or system calls are supported by the driver.
The function is used to control the device. The following requests are
defined in
Map the device into user address space at the location
specified by the pointer to which the third
argument to points. If the argument points to a
variable containing a null pointer, the system
selects an appropriate address. then returns
the user address where the device was mapped,
storing it at the address pointed to by the
third argument (see below). Multiple processes
can concurrently have the same device mapped.
Unmap the device from the user address space.
shuts down the file descriptor associated with the device. If the
close is for the last system wide open on the device, the device is
also unmapped from the user address space; otherwise it is left mapped
into the user address space (see above).
WARNINGS
Be extremely careful when creating and using devices. Inappropriate
accesses to I/O devices or RAM can result in a system crash.
ERRORS
The address field was out of range,
or the request was invalid.
Not enough memory could be allocated for the mapping.
Device was already mapped and this mapping was not identical
to the initial mapping (same address, size and access
rights).
Read and write calls are unsupported.
No such device at the address specified by the minor number.
Required resources for mapping could not be allocated.
Inappropriate request for this device type; fildes is not a file
descriptor for an device file.
EXAMPLES
Consider the following code fragment:
...
...
where is an open file descriptor for the device special file and is the
address originally requested by the program.
If is a null pointer, the system selects a suitable address then
returns the selected address in addr.
If the value in addr is not a null pointer, it is used as a specified
address for allocating memory. If the specified address cannot be
used, an error is returned (see
SEE ALSOmknod(1M).
OBSOLETED iomap(7)