unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Page:
Section:
Apropos / Subsearch:
optional field



 iomap(7)							    iomap(7)




 NAME
      iomap - physical I/O address mapping

 SYNOPSIS
      #include <&lt&lt&lt;sys/iomap.h>&gt&gt&gt;

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

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



 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000






 iomap(7)							    iomap(7)




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

 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.

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





 Hewlett-Packard Company	    - 2 -   HP-UX Release 11i: November 2000






 iomap(7)							    iomap(7)




	   #include <&lt&lt&lt;sys/iomap.h>&gt&gt&gt;
		...
	   int fildes;
	   void *addr;
		...
	       addr = REQUESTED_ADDRESS;
	       (void) ioctl(fildes, IOMAPMAP, &&amp&amp&amp;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
      mknod(1M).
































 Hewlett-Packard Company	    - 3 -   HP-UX Release 11i: November 2000