Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Kernel Functions for Driversscsi_dmaget(9F)


NAME

 scsi_dmaget, scsi_dmafree - SCSI dma utility routines

SYNOPSIS

 
#include <sys/scsi/scsi.h>
struct scsi_pkt *scsi_dmaget(struct scsi_pkt *pkt, opaque_t dmatoken, int(*callback)(void));
 void scsi_dmafree(struct scsi_pkt *pkt);

INTERFACE LEVEL

 

Solaris DDI specific (Solaris DDI).

PARAMETERS

 
pkt
A pointer to a scsi_pkt(9S) structure.
dmatoken
Pointer to an implementation dependent object
callback
Pointer to a callback function, or NULL_FUNC or SLEEP_FUNC.

DESCRIPTION

 

scsi_dmaget() allocates DMA resources for an already allocated SCSI packet. pkt is a pointer to the previously allocated SCSI packet (see scsi_pktalloc(9F)).

dmatoken is a pointer to an implementation dependent object which defines the length, direction, and address of the data transfer associated with this SCSI packet (command). The dmatoken must be a pointer to a buf(9S) structure. If dmatoken is NULL, no resources are allocated.

callback indicates what scsi_dmaget() should do when resources are not available:

NULL_FUNC
Do not wait for resources. Return a NULL pointer.
SLEEP_FUNC
Wait indefinitely for resources.
Other Values
callback points to a function which is called when resources may have become available. callback must return either 0 (indicating that it attempted to allocate resouces but failed to do so again), in which case it is put back on a list to be called again later, or 1 indicating either success in allocating resources or indicating that it no longer cares for a retry.

scsi_dmafree() frees the DMA resources associated with the SCSI packet. The packet itself remains allocated.

RETURN VALUES

 

scsi_dmaget() returns a pointer to a scsi_pkt on success. It returns NULL if resources are not available.

CONTEXT

 

If callback is SLEEP_FUNC, then this routine may only be called from user-level code. Otherwise, it may be called from either user or interrupt level. The callback function may not block or call routines that block.

scsi_dmafree() can be called from user or interrupt context.

SEE ALSO

 

scsi_pktalloc(9F), scsi_pktfree(9F), scsi_resalloc(9F), scsi_resfree(9F), buf(9S), scsi_pkt(9S)

Writing Device Drivers


SunOS 5.9Go To TopLast Changed 21 Dec 1992

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.