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

physmap(D3)


physmap -- obtain virtual address mapping for physical addresses

Synopsis (Not in current DDI version)

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

caddr_t physmap(paddr_t physaddr, ulong_t nbytes, uint_t flag);

Description

physmap allocates a virtual address mapping for a given range of physical addresses. On systems with memory caches, accesses to the device memory through this virtual address will bypass the cache, if possible.

If flag is set to KM_SLEEP, the caller will sleep if necessary until resources are available. If flag is set to KM_NOSLEEP, the caller will not sleep, but physmap will return NULL if resources are not immediately available.

Arguments


physaddr
Starting physical address to map.

nbytes
Number of bytes to map.

flag
Specifies whether the caller is willing to sleep waiting for resources.

Return values

On success, physmap returns a virtual address that can be used to access nbytes bytes corresponding to physical address physaddr. If KM_NOSLEEP is specified and sufficient virtual space is not immediately available, physmap returns NULL.

Usage

physmap is typically called from a driver's init(D2) or start(D2) routine to get a pointer to device memory (for memory-mapped I/O).

Context and synchronization

If flag is set to KM_NOSLEEP, non-blockable, initialization, or interrupt context.

If flag is set to KM_SLEEP, user context.

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp

Differences between versions

For DDI 8 drivers, use devmem_mapin(D3) instead. See ``Memory-mapped I/O'' in HDK Technical Reference for more information about implementing memory-mapped I/O on all platforms.

SCO OpenServer ODDI compatibility

The sptalloc(D3oddi) function with the base argument set to a non-zero value provides comparable functionality for ODDI drivers.

References

init(D2), physmap_free(D3), start(D2)

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