physreq(D4) physreq(D4)
NAME
physreq - physical alignment requirements structure
SYNOPSIS
#include <sys/types.h>
#include <sys/kmem.h>
#include <sys/ddi.h>
DESCRIPTION
The physreq structure is used by routines to indicate physical
address alignment and contiguity constraints on memory.
USAGE
Whenever memory is allocated which will be made accessible to
hardware devices via DMA, one of the interfaces which allows
physical requirements to be specified using a physreq_t
structure should be used.
Before this structure can be passed to any other routine,
other than physreq_free(D3), it first must be passed to
physreq_prep(D3). After calling physreq_prep, no fields in
this structure should be changed.
Always allocate physreq structures by calling
physreq_alloc(D3). Never create these structures statically.
Structure Definitions
The physreq structure is defined as type physreq_t and
contains the following members:
paddr_t phys_align; /* physical address must be a */
/* multiple of phys_align */
paddr_t phys_boundary; /* if non-zero, physical addresses */
/* may not cross a multiple of */
/* phys_boundary */
uchar_t phys_dmasize; /* DMA-ability requirement; 0 if none, */
/* else number of address bits used; */
/* ignored if system does not have */
/* DMA restrictions */
uchar_t phys_max_scgth; /* maximum length of scatter/gather */
/* list; used only by buf_breakup in */
/* the BA_SCGTH case */
/*
* This field has flags that are used by the operating system
* as well as flags exported to the driver.
*/
uchar_t phys_flags /* misc flags */
Copyright 1994 Novell, Inc. Page 1
physreq(D4) physreq(D4)
phys_align specifies the constraint on the alignment of the
starting physical address, if any. The starting address of
any buffer will be a multiple of phys_align. phys_align must
be a power of 2.
phys_boundary specifies an optional boundary constraint. If
it is non-zero, buffers will not span any addresses which are
multiples of phys_boundary. If non-zero, phys_boundary must
be a power of 2.
phys_dmasize specifies DMA-ability requirements, if any. If
it is non-zero, buffers will be allocated in regions suitable
for DMA access with phys_dmasize bits of address.
phys_dmasize should be set to the number of bits in addresses
generated by the DMA controller or device to be used for I/O.
WARNING: phys_dmasize should always be set to non-zero (and
physreq allocations should be used) whenever the memory is to
be accessed by hardware devices besides the CPU. This is true
even for devices which generate ``full'' addresses (addresses
with at least as many bits as the memory bus interconnect).
In this way, drivers can be moved to other systems with
enhanced CPUs and/or memory subsystems that allow for larger
memory addresses.
phys_max_scgth is the maximum length of the scatter/gather
list. This field is used only by buf_breakup in the BA_SCGTH
case.
phys_flags contains flags describing additional physical
properties of the memory. At present, the only valid flag for
the driver to set is PREQ_PHYSCONTIG, indicating a physical
contiguity constraint.
REFERENCES
buf_breakup(D3), kmem_alloc_physreq(D3),
kmem_zalloc_physreq(D3), physreq_alloc(D3), physreq_free(D3),
physreq_prep(D3)
NOTICES
Portability
All processors
Copyright 1994 Novell, Inc. Page 2