SCO OpenServer
getcpages(D3oddi)
getcpages, freecpages --
allocate and free physically contiguous memory
Synopsis
#include <sys/types.h>
#include <sys/immu.h>
caddr_t getcpages(int npgs, int flags);
void freecpages(pft_t pfn, int npgs);
Description
The
getcpages( )
function
allocates physically contiguous memory,
aligned on page boundaries.
the
freecpages( )
function frees this memory when it is no longer needed.
Arguments
npgs-
Number of pages to be allocated.
flags-
Provide details about the memory allocation.
Valid values are:
ANY_MEM-
Allocate memory from any range that is available.
If necessary, block until memory comes available.
NOSLEEP-
Do not block waiting for memory to be available.
If the memory cannot be allocated,
just return.
SHORTSLEEP-
Block only until the vhand daemon has executed once.
DMAABLE-
Allocate DMA-able memory
(uner 16 MB).
PREFERDMA-
Try to allocate DMA-able memory
(uner 16 MB),
but allocate memory from another region
if none is available in this range.
DMAABLE64K-
Allocate memory that is DMA-able over the 64K boundary.
pfn-
Page frame number as returned by
getcpages( ).
This is a memory address in the range
0xC0000000
to 0xEFFFFFFF
.
Return values
On success,
getcpages( )
returns the page frame number
for the first page in the allocated memory region.
Usage
Context and synchronization
Initialization
context
Hardware applicability
All
Version applicability
oddi:
1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp
SVR5 DDI compatibility
getcpages( )
and
freecpages( )
are not supported in any DDI version,
although they can be used in $interface nonconformant drivers
on SCO SVR5 1.0.
DDI 8 drivers use the
kmem_alloc_phys(D3)
function or the
msgscgth(D3str)
function (STREAMS only)
to allocate memory for DMA operations.
References
kmem_alloc(D3oddi),
kmem_zalloc(D3oddi),
kmem_free(D3oddi),
sptalloc(D3oddi),
sptfree(D3oddi),
vasbind(D3oddi)
kmem_alloc_phys(D3),
physreq(D4)
``Memory allocation'' in HDK Technical Reference
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005