iomap(7) — Series 300/400 Only
NAME
iomap − physical address mapping
SYNOPSIS
#include <sys/iomap.h>
DESCRIPTION
The iomap mechanism allows the mapping (thus direct access) of physical addresses into the user process address space. For most Series 300/400 computers, the physical address space begins at 0x000000 and extends to 0xffffff.
The special (device) files for iomap devices are character special files with major number 10.
The minor number for iomap devices is of the form:
0xAAAANN
where AAAA is a two-byte address, and NN is a one-byte field.
The address portion of the minor number is formed by dividing the physical address by 65536. NN × 65536 is the size of the region to be mapped. For example, the minor number for a device at 0x720000 that occupies 128 Kbytes is 0x007202.
Access to iomap devices is controlled by file permissions set on the character special file.
Multiple processes can concurrently have a single iomap device opened and mapped. It is the responsibility of the processes to synchronize their access.
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 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).
One shared memory descriptor (see shmget(2)) is used for each iomap device. Shared memory descriptors obtained in this way are usable only through the iomap interface. Consequently, attempts to access them through shared memory routines (see shmat(2), shmctl(2), shmdt(2), etc.) result in EACCES errors.
WARNING
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.
[ENODEV] Read and write calls are unsupported.
[ENXIO] No such device at the address specified by the minor number.
[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 file.
EXAMPLES
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 ).
SEE ALSO
Hewlett-Packard Company — HP-UX Release 9.0: August 1992