niofillmem(D3DKX) —
.IX \f4niofillmem\fP(D3DKX)
NAME
niofillmem − fill a buffer with a pattern, intercepting bus errors
SYNOPSIS
#include <sys/types.h>
#include <sys/iosystm.h>
int niofillmem(u_int access, void ∗addr, size_t size, u_long data);
ARGUMENTS
accessThe type of memory access to use.
addrThe address of the buffer to fill.
sizeThe size of the buffer, in bytes.
dataThe data to write to memory.
DESCRIPTION
niofillmem is used in driver initialization routines to initialize device memory and check if the memory exists.
Memory is accessed in various different ways, depending on the value of access. The following constants (defined in sys/iosystm.h) are used to define the access type:
| Size flags: | ||
| IOP_BYTE | 0x02 | |
| IOP_SHORT | 0x04 | |
| IOP_LONG | 0x06 | |
| Mapping flags: | ||
| IOP_VIRTUAL | 0x08 | |
| IOP_PHYSICAL | 0x10 | |
niofillmem is called with an access value that is a combination (bit-wise “or”) of these constants. access must include exactly one of the size flags, whose meanings are as follows:
| IOP_BYTE | Write bytes to addr. |
| IOP_SHORT | Write shorts to addr. |
| IOP_LONG | Write longs to addr. |
access may also include one or more of the mapping flags, whose meanings are described below.
The addr and size parameters must be suitable for the type of access requested. For example, if IOP_LONG is specified, then both must be multiples of 4. It is up to the caller to ensure this alignment; the result otherwise is undefined.
niofillmem by default writes virtual addresses. However if IOP_PHYSICAL is “ored” with one of the above constants, then addr is taken as a physical address. IOP_VIRTUAL can also be “ored” with one of the constants to specify the default behavior of virtual accesses. If both IOP_VIRTUAL and IOP_PHYSICAL are specified, the result is unspecified.
niofillmem is not guaranteed to work when called from interrupt level with IOP_PHYSICAL.
If any address in the buffer specified by addr and size is invalid or nonexistent, niofillmem returns nonzero.
RETURN VALUES
Zero if the operation suceeds. Nonzero if no device responded, or IOP_PHYSICAL was not specified and the specified virtual address is not mapped, or IOP_PHYSICAL was specified from interrupt context. Nonzero may also be returned if access has an incorrect value or if alignment is not correct, but this is not guaranteed.
LEVEL
Base or Interrupt
SEE ALSO
niocopy(D3DKX)
DDI/DKI