getblk -- get a Host Bus Adapter device-specific request block


   struct hbadata *prefixgetblk(int flag);


The getblk( ) entry point routine is called from HBA drivers to allocate HBA driver-specific hbadata(D4sdi) request blocks, which are used in passing requests from the target drivers to the HBA driver. Each HBA driver defines and allocates its own supply of request blocks, allowing for flexibility in servicing the needs of individual HBAs.

Indicates whether the allocation can sleep or not, and is set to either KM_SLEEP or KM_NOSLEEP

Return values

On success, getblk( ) returns a pointer to the newly allocated hbadata(D4sdi) request block. On failure, it returns NULL.


The getblk( ) routine returns a hbadata(D4sdi) structure. Typically, the HBA drivers use some other structure and cast it to a struct hbadata * before returning. The command block consists, minimally, of a pointer to an xsb(D4sdi) structure and may consist of addition HBA specific data. Passing commands from target drivers to HBA drivers depends on the command block data structure to pass down the needed command information. Each HBA driver defines and allocates its own supply of command blocks, allowing each HBA driver to be flexible in servicing its needs.

This routine is called by the sdi_send(D3sdi), sdi_xsend(D3sdi), sdi_icmd(D3sdi), sdi_xicmd(D3sdi), sdi_translate(D3sdi), and sdi_xtranslate(D3sdi) functions, which can be called from interrupt context during fault handling. The target driver calls these functions with the flag argument, which is passed along to the HBA getblk( ) routine.

The command blocks are requested and then freed randomly. For this reason, using a free-list system makes manipulating command blocks for the getblk( ) and freeblk(D2sdi) faster and simpler than alternative schemes. When an HBA driver needs a command block, it requests one from its free list. If, the HBA driver has allocated all the blocks in its free list, the next getblk( ) request should block, awaiting the next block to be freed, if the sleep flag indicates that it can sleep. Otherwise, the call should fail with a NULL return.

Context and synchronization

If flag is KM_SLEEP, blockable context. If flag is KM_NOSLEEP, non-blockable context.

Applicable hardware


Version applicability

sdi: 1, 2, 3, 4 HBA drivers.

See Also

freeblk(D2sdi), hbadata(D4sdi), sdi_getblk(D3sdi), sdi_send(D3sdi), sdi_icmd(D3sdi), sdi_xgetblk(D3sdi), sdi_xicmd(D3sdi), sdi_xsend(D3sdi)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005