[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

iomem_att Kernel Service

Purpose

Establishes access to memory-mapped I/O.

Syntax

#include <sys/types.h>
#include <sys/adspace.h>

void *iomem_att (io_map_ptr)
struct io_map *io_map_ptr;

struct io_map {
    int key;
    int flags;
    int size;
    int BID;
    long long busaddress;
}

Parameters

The address of the io_map structure passes the following parameters to the iomem_att kernel service:

key Set to IO_MEM_MAP .
flags Describes the mapping.
size Specifies the number of bytes to map.
bid Specifies the bus identifier.
busaddress Specifies the address of the bus.

Description

Note: The iomem_att kernel service is only supported on PowerPC-based machines. All mappings are done with storage attributes: cache inhibited, guarded, and coherent. It is a violation of the PowerPC architecture to access memory with multiple storage modes. The caller of iomem_att must ensure no mappings using other storage attributes exist in the system.

Calling this function on a POWER-based machine causes the system to crash.

The iomem_att kernel service provides temporary addressability to memory-mapped I/O. The iomem_att kernel service does the following:

The addressability is valid only for the context that called iomem_att. The memory is addressable until iomem_det is called. I/O memory must be mapped each time a context is entered and freed before returning.

Note: Kernel address space is an exhaustible resource. When exhausted the system crashes. A driver must never map more than two I/O regions at once, or call another driver with an iomem_att outstanding. DMA, interrupt, and PIO kernel services can be called with up to two I/O regions mapped.

The size parameter supports from 4096 bytes to 256 MB. The caller can specify a minimum of size bytes, but may choose to map up to 256 MB. The caller must not reference memory beyond size bytes. The size parameter should be set to the minimum value required to address the target device.

Specifying IOM_RDONLY in the flags parameter results in a read-only mapping. A store to memory, mapped in this mode, results in a data storage interrupt. If the flag parameter is 0 (zero) the memory is mapped read-write. All mappings are read-write on 601-based machines.

Execution Environment

The iomem_att kernel service can be called from either the process or interrupt environment.

Return Values

The iomem_att kernel service returns the effective address that can be used to address the I/O memory.

Implementation Specifics

The iomem_att kernel service is part of the Base Operating System (BOS) Runtime.

Related Information

The iomem_det Kernel Service.

Kernel Extension and Device Driver Management Kernel Services in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Home | Search ]