iomap - physical I/O address mapping
The iomap 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 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:
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 system 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 responsibility of the processes to synchronize
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
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>:
Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000
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
close() shuts down the file descriptor associated with the iomap
device. If the close is for the last system 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
Be extremely careful when creating and using iomap devices.
Inappropriate accesses to I/O devices or RAM can result in a system
[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).
[ENODEV] Read and write calls are unsupported.
[ENXIO] No such device at the address specified by the minor
[ENOSPC] Required resources for mapping could not be allocated.
[ENOTTY] Inappropriate ioctl request for this device type;
fildes is not a file descriptor for an iomap device
Consider the following code fragment:
Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000
addr = REQUESTED_ADDRESS;
(void) ioctl(fildes, IOMAPMAP, &&&&addr);
(void) printf("actual address = 0x%x\n", addr);
where fildes is an open file descriptor for the device special file
and REQUESTED_ADDRESS is the address originally requested by the
If addr 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 ERRORS).
Hewlett-Packard Company - 3 - HP-UX Release 11i: November 2000