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

kmem_alloc_physcontig(D3)


kmem_alloc_physcontig -- allocate physically contiguous memory

Synopsis (Not in current DDI version)

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

void *kmem_alloc_physcontig(size_t size, physreq_t *preqp, int flag)

Description

kmem_alloc_physcontig allocates size bytes of physically contiguous kernel memory.

Arguments


size
Number of bytes to allocate; must be non-zero.

preqp
Pointer to a physreq(D4) structure, previously allocated by physreq_alloc(D3). This structure defines the physical address alignment requirements. The memory returned by kmem_alloc_physcontig( ) is physically contiguous even if the PREQ_PHYSCONTIG bit is not set.

flag
Specifies whether the caller is willing to sleep waiting for memory. If set to KM_SLEEP, the caller will block if necessary until the specified amount of memory is available. If set to KM_NOSLEEP, the caller will not block but will return NULL if the specified amount of memory is not immediately available.

Return values

Upon successful completion, kmem_alloc_physcontig returns a pointer to the allocated memory.

Usage

Drivers should call kmem_alloc_physcontig( ) as early as possible, preferably during driver initialization. Due to randomization of the free page list, physically contiguous pages might not be available after the system has run at load for some time. This could cause kmem_alloc_physcontig( ) to either fail (in the KM_NOSLEEP case) or possibly wait forever (in the KM_SLEEP case).

This function should not be called during I/O transfers when contiguous memory larger than one page is being requested.

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: 5, 5mp, 6, 6mp

Differences between versions

DDI 7 drivers should use the kmem_alloc_physreq(D3) function rather than kmem_alloc_physcontig( ). DDI 8 drivers should use the kmem_alloc_phys(D3) function rather than kmem_alloc_physcontig( ).

References

kmem_alloc(D3), kmem_alloc_phys(D3), kmem_alloc_physreq(D3), kmem_free(D3), kmem_free_physcontig(D3), kmem_zalloc(D3), kmem_zalloc_physreq(D3), physreq(D4) physreq_alloc(D3)

``DMA'' in HDK Technical Reference
``Memory allocation'' in HDK Technical Reference


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