physmap(D3) physmap(D3)
NAME
physmap - obtain virtual address mapping for physical
addresses
SYNOPSIS
#include <sys/types.h>
#include <sys/kmem.h>
#include <sys/ddi.h>
caddr_t physmap(paddr_t physaddr, ulong_t nbytes, uint_t flag);
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.
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.
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).
Level
Base only if flag is set to KM_SLEEP.
Initialization, Base or Interrupt if flag is set to
KM_NOSLEEP.
Copyright 1994 Novell, Inc. Page 1
physmap(D3) physmap(D3)
Synchronization Constraints
May sleep if flag is set to KM_SLEEP.
Driver-defined basic locks and read/write locks may be held
across calls to this function if flag is KM_NOSLEEP, but may
not be held if flag is KM_SLEEP.
Driver-defined sleep locks may be held across calls to this
function regardless of the value of flag.
REFERENCES
init(D2), physmap_free(D3), start(D2)
NOTICES
Portability
All processors
Applicability
ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2