HP-UX Reference (11i v2 07/12) - 7 Device (Special) Files, 9 General Information, Index (vol 10)

i
iomap(7) iomap(7)
(TO BE OBSOLETED)
NAME
iomap - physical I/O address mapping
SYNOPSIS
#include <sys/iomap.h>
DESCRIPTION
The iomap mechanism allows the mapping (thus direct access) of physical I/O addresses into the user pro-
cess address space. For PA-RISC machines, the physical I/O address space begins at
0xf0000000 and
extends to
0xffffffff .
The special (device) files for iomap devices are character special files using the dynamic major number
allocation scheme.
The minor number for
iomap devices is of the form:
0xAAAASM
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 0xf4000000 that occupies 64MB is
0x4000e1.
The iomap driver must be explicitly added to the /stand/system
file, the kernel rebuilt, and the sys-
tem subsequently rebooted prior to first using
iomap.
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 iomap device opened and mapped. It is the responsibil-
ity of the processes to synchronize their access.
Successive calls to iomap 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 iomap) 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 kernel read/write access
rights cannot be concurrently mapped by processes using iomap.
No read() or write() system calls are supported by the iomap driver.
The ioctl() function is used to control the iomap device. The following ioctl() requests are defined
in <iomap.h>:
IOMAPMAP Map the iomap device into user address space at the location specified by the
pointer to which the (void **) third argument to ioctl() points. If the
argument points to a variable containing a null pointer, the system selects an
appropriate address. ioctl() then returns the user address where the device
was mapped, storing it at the address pointed to by the third argument (see
EXAMPLES below). Multiple processes can concurrently have the same iomap
device mapped.
IOMAPUNMAP Unmap the iomap device from the user address space.
close() shuts down the file descriptor associated with the iomap device. If the close is for the last sys-
tem wide open on the device, the iomap device is also unmapped from the user address space; otherwise it
is left mapped into the user address space (see IOMAPUNMAP above).
WARNINGS
Be extremely careful when creating and using iomap devices. Inappropriate accesses to I/O devices or
RAM can result in a system crash.
ERRORS
[EINVAL] The address field was out of range, or the ioctl request was invalid.
[ENOMEM] Not enough memory could be allocated for the mapping.
[EBUSY] Device was already mapped and this mapping was not identical to the initial mapping
(same address, size and access rights).
HP-UX 11i Version 2: December 2007 Update 1 Hewlett-Packard Company 63