DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

devmem_mapin(D3)


devmem_mapin -- obtain virtual address mapping for physical offsets within device memory

Synopsis

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

void *devmem_mapin(rm_key_t key, uint_t n, size_t offset, size_t nbytes);

Description

devmem_mapin( ) allocates a virtual address mapping for a given range of device memory addresses. On systems with memory caches, acesses to the device memory through this virtual address will bypass the cache, if possible.

devmap_mapin( ) does not limit device memory access to the first 4GB.

Arguments


key
resource manager key for the device, as passed to the CFG_ADD subfunction of the config(D2) entry point routine.

n
memory block number

offset
offset within the memory block

nbytes
number of bytes to map, as returned by the devmem_size(D3) function.

Return values

On success, devmap_mapin( ) returns a virtual address that can be used to access nbytes bytes corresponding to the device memory represented by key, n, and offset.

Returns NULL if the specified memory block is not found.

Usage

devmap_mapin( ) is typically called from a driver's config(D2) entry-point routine to get a pointer to device memory for memory-mapped I/O. The driver should first call the devmem_size(D3) function to obtain the correct size.

A memory-mapped device has one or more contiguous chunks of memory or registers that can be mapped into the host CPU's memory address space. The memory chunk number, n, selects one of these chunks, numbered from zero. offset is a byte offset from the beginning of this chunk.

Context and synchronization

User or blockable context.

Hardware applicability

All

Version applicability

ddi: 8, 8mp

Differences between versions

For DDI versions before version 8, use the physmap(D3) function to obtain virtual address mapping for physical addresses.

Future directions

The operating system does not currently support acess of memory above 4GB because current hardware does not support device memory blocks above 4GB. devmem_mapin( ) allows access to device memory wherever the kernel supports device memory so no recoding should be required when systems have device memory blocks in the higher memory ranges.

References

devmem_mapout(D3), devmem_ppid(D3), devmem_size(D3), drv_mmap(D3), mmap(D2)

``Large memory support (DDI 8)'' in HDK Technical Reference
``Memory access'' in HDK Technical Reference
``Memory-mapped I/O'' in HDK Technical Reference


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005