The big physical area is mainly managed by two functions. The first one,

caddr_t bigphysarea_alloc_pages(int count, int align, int priority)

allocates 'count' pages. The pages are aligned so that there base
address is a multiple of 'PAGE_SIZE * align'. If you don't need more
than page alignment, set 'align' to 0 or 1. 'priority' has the same
meaning as in kmalloc, it can be GFP_ATOMIC (for calls from interrupt
handlers) or GFP_KERNEL (for usual calls). The base address of the
allocated area is returned.

Allocation can fail for two reasons, in both cases NULL is
returned. First, the physical area is scattered too much or there is
not enough memory, second it is not possible to allocate some memory
with kmalloc for administration of the physical area (very unlikely).

To free an allocated area, just call

void bigphysarea_free_pages(caddr_t base)

with 'base' set to the value returned by 'bigphysarea_alloc_pages'. 

An example how to use this functions can be found in 'module.c'.

There is still the old interface introduced by M. Welsh:

caddr_t bigphysarea_alloc(int size)
void bigphysarea_free(caddr_t addr, int size)

The first function allocates 'size' bytes physically continous
memory. To free the area, bigphysarea_free with a pointer to the area
and its size has to be called. Due to a new allocation algorithm, the
size parameter is no longer really needed when freeing an area.

To find out from a driver what the maximum size of the bigphysarea is
as defined on the kernel commandline, you can use this interface. 
It returns the size in Bytes.

unsigned long bigphysarea_get_size(void);

In the current version it is not safe to call any of the functions
from an interrupt handler.

Please send questions, comments, and bug reports to
butenuth@uni-paderborn.de 

Roger Butenuth
