Allocates a Barrier Synchronization Register (BSR) resource, and retrieves mapping information.
#include <sys/adspace.h>
int bsr_alloc (
int bsr_bytes,
struct io_map * bsr_map,
int *bsr_stride,
int *bsr_id)
Item | Description |
---|---|
bsr_bytes | Number of BSR bytes wanted. |
bsr_map | Mapping information for the BSR facility |
bsr_stride | Stride at which the BSR bytes repeat within the mapping |
bsr_id | An opaque identifier for the allocated BSR resource |
The bsr_alloc service can be used to allocate and reserve all or a portion of the BSR facility. The requested number of BSR bytes to allocate is communicated through the bsr_bytes parameter. The requested number of bytes must correspond to a supported window size, as communicated by the supported_window_mask parameter of the bsr_query service. If the requested number of bytes is available, the bytes are reserved and the I/O mapping information for accessing the allocated facility is written to the bsr_map structure. In addition, the stride within the mapping that the allocated BSR bytes repeat is recorded in the bsr_stride field. The bsr_id field is written with a unique identifier to be used with the bsr_free call.
If multiple granules or windows are to be used, they must be allocated with independent calls to bsr_alloc. this is because I/O mappings for multiple granules might not be contiguous, and strides are only applicable within the granule.
The resulting bsr_map information can then be used as input to rmmap_create for establishing addressability to the BSR resource within the current process address space.
The bsr_alloc service can only be called from the process environment.
If successful, bsr_alloc returns 0 and modifies the bsr_map structure so that it contains the mapping information for the newly allocated resource, modifies the bsr_stride field displays the stride on which the BSR bytes repeat within the mapping, and modifies the bsr_id field so that it displays a unique identifier for the newly allocated BSR resource. If unsuccessful, one of the following values is returned:
Item | Description |
---|---|
ENODEV | The BSR facility does not exist. |
EINVAL | Unsupported number of bytes requested. |
EBUSY | Requested BSR bytes or mappable BSR windows are currently in use. |