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

physreq_alloc(D3)


physreq_alloc -- allocate a physical alignment requirements structure

Synopsis

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

physreq_t *physreq_alloc(int flag);

Description

physreq_alloc( ) allocates a physreq(D4) structure, which is used by such routines as kmem_alloc_physreq(D3), allocb_physreq(D3str), and buf_breakup(D3) to define alignment constraints on physical addresses.

Arguments


flag
Indicates whether the allocation may sleep or not, and is set to KM_SLEEP or KM_NOSLEEP.

Return values

On success, physreq_alloc returns a pointer to a physreq structure.

This physreq is initialized with minimal values in all fields. That is, it specifies no constraints; any memory will satisfy this physreq. The caller can then (directly or indirectly) set just those parameters which need to be constrained.

If KM_NOSLEEP is specified and sufficient memory is not immediately available, physreq_alloc( ) returns a NULL pointer.

Usage

physreq_alloc( ) is typically called at driver startup time to allocate a physreq structure for each controller. This physreq is then used repeatedly, for each transfer or allocation.

The physreq structure is allocated with all members set to 0 except for the physreq_align member, which is originally set to 1. The structure must be prepped after it is allocated and before it is used by calling the physreq_prep(D3) function.

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

References

allocb_physreq(D3str), buf_breakup(D3), kmem_alloc_physreq(D3), kmem_zalloc_physreq(D3), physreq_free(D3), physreq_prep(D3), physreq(D4)

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