Copyright 2014 Garrett D'Amore <garrett@damore.org>
Copyright (c) 2006, Sun Microsystems, Inc., All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#include <sys/scsi/scsi.h> struct scsi_pkt *get_pktiopb(struct scsi_address *ap, caddr_t *datap, int cdblen, int statuslen, int datalen, int readflag, int (*callback);
void free_pktiopb(struct scsi_pkt *pkt, caddr_t datap, int datalen);
These interfaces are obsolete. Use scsi_alloc_consistent_buf(9F) instead of get_pktiopb(). Use scsi_free_consistent_buf(9F) instead of free_pktiopb().
Pointer to the target's scsi_address structure.
Pointer to the address of the packet, set by this function.
Number of bytes required for the SCSI command descriptor block (CDB).
Number of bytes required for the SCSI status area.
Number of bytes required for the data area of the SCSI command.
If non-zero, data will be transferred from the SCSI target.
Pointer to a callback function, or NULL_FUNC or SLEEP_FUNC
Pointer to a scsi_pkt(9S) structure.
The get_pktiopb() function allocates a scsi_pkt structure that has a small data area allocated. It is used by some SCSI commands such as REQUEST_SENSE, which involve a small amount of data and require cache-consistent memory for proper operation. It uses ddi_iopb_alloc(9F) for allocating the data area and scsi_resalloc(9F) to allocate the packet and DMA resources.
callback indicates what get_pktiopb() should do when resources are not available: NULL_FUNC
Do not wait for resources. Return a NULL pointer.
Wait indefinitely for resources.
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 resources 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.
The free_pktiopb() function is used for freeing the packet and its associated resources.
The get_pktiopb() function returns a pointer to the newly allocated scsi_pkt or a NULL pointer.
If callback is SLEEP_FUNC, then this routine can be called only from user or kernel context. Otherwise, it can be called from user, interrupt, or kernel context. The callback function should not block or call routines that block.
The free_pktiopb() function can be called from user, interrupt, or kernel context.
See attributes(5) for a description of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
Stability Level Obsolete |
attributes(5), scsi_alloc_consistent_buf(9F), scsi_free_consistent_buf(9F), scsi_pktalloc(9F), scsi_resalloc(9F), scsi_pkt(9S)
Writing Device Drivers
The get_pktiopb() and free_pktiopb() functions are obsolete and will be discontinued in a future release. These functions have been replaced by, respectively, scsi_alloc_consistent_buf(9F) and scsi_free_consistent_buf(9F).
The get_pktiopb() function uses scarce resources. For this reason and its obsolescence (see above), its use is discouraged.