Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > I


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


iomap — physical I/O address mapping


#include <sys/iomap.h>


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 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>:


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.


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 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 IOMAPUNMAP above).


Be extremely careful when creating and using iomap devices. Inappropriate accesses to I/O devices or RAM can result in a system crash.



The address field was out of range, or the ioctl 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 ioctl request for this device type; fildes is not a file descriptor for an iomap device file.


Consider the following code fragment:

#include <sys/iomap.h> ... int fildes; void *addr; ... 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 program.

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).



Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.