Print this page
4888 Undocument dma_req(9s)
4884 EOF scsi_hba_attach
4886 EOF ddi_dmae_getlim
4887 EOF ddi_iomin
4634 undocument scsi_hba_attach() and ddi_dma_lim(9s)
4630 clean stale references to ddi_iopb_alloc and ddi_iopb_free
   1 '\" te

   2 .\"  Copyright (c) 2006, Sun Microsystems, Inc.,  All Rights Reserved
   3 .\" 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.
   4 .\" 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.
   5 .\" 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]
   6 .TH SCSI_INIT_PKT 9F "Jan 16, 2006"
   7 .SH NAME
   8 scsi_init_pkt \- prepare a complete SCSI packet
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 #include <sys/scsi/scsi.h>
  13 
  14 
  15 
  16 \fBstruct scsi_pkt *\fR\fBscsi_init_pkt\fR(\fBstruct scsi_address *\fR\fIap\fR,
  17      \fBstruct scsi_pkt *\fR\fIpktp\fR, \fBstruct buf *\fR\fIbp\fR, \fBint\fR \fIcmdlen\fR, \fBint\fR \fIstatuslen\fR,
  18      \fBint\fR \fIprivatelen\fR, \fBint\fR \fIflags\fR, \fBint\fR \fB(*\fRcallback\fB)(caddr_t)\fR, \fBcaddr_t\fR \fIarg\fR);
  19 .fi
  20 
  21 .SH INTERFACE LEVEL
  22 .sp
  23 .LP
  24 Solaris DDI specific (Solaris DDI).
  25 .SH PARAMETERS
  26 .sp


 177 .na
 178 \fB\fBPKT_CONSISTENT\fR\fR
 179 .ad
 180 .sp .6
 181 .RS 4n
 182 This must be set if the \fBDMA\fR buffer was allocated using
 183 \fBscsi_alloc_consistent_buf\fR(9F). In this case, the \fBHBA\fR driver will
 184 guarantee that the data transfer is properly synchronized before performing the
 185 target driver's command completion callback.
 186 .RE
 187 
 188 .sp
 189 .ne 2
 190 .na
 191 \fB\fBPKT_DMA_PARTIAL\fR\fR
 192 .ad
 193 .sp .6
 194 .RS 4n
 195 This may be set if the driver can accept a partial \fBDMA\fR mapping. If set,
 196 \fBscsi_init_pkt()\fR will allocate \fBDMA\fR resources with the
 197 \fBDDI_DMA_PARTIAL\fR bit set in the \fBdmar_flag\fR element of the
 198 \fBddi_dma_req\fR(9S) structure. The \fBpkt_resid\fR field of the
 199 \fBscsi_pkt\fR(9S) structure may be returned with a non-zero value, which
 200 indicates the number of bytes for which \fBscsi_init_pkt()\fR was unable to
 201 allocate DMA resources. In this case, a subsequent call to
 202 \fBscsi_init_pkt()\fR may be made for the same \fIpktp\fR and \fIbp\fR to
 203 adjust the DMA resources to the next portion of the transfer. This sequence
 204 should be repeated until the \fBpkt_resid\fR field is returned with a zero
 205 value, which indicates that with transport of this final portion the entire
 206 original request will have been satisfied.
 207 .RE
 208 
 209 .sp
 210 .ne 2
 211 .na
 212 \fB\fBPKT_XARQ\fR\fR
 213 .ad
 214 .sp .6
 215 .RS 4n
 216 Setting this flag requests that the \fBHBA\fR return  extra sense data for this
 217 \fBscsi_pkt\fR(9S). The default  auto request sense mechanism returns up to  20
 218 bytes. More than 20 bytes of sense data can be requested by setting this flag


 354 .LP
 355 \fBExample 5 \fRAllocating a Packet with Partial \fBDMA\fR Resources Attached
 356 .sp
 357 .LP
 358 To allocate a packet with partial \fBDMA\fR resources attached, use:
 359 
 360 .sp
 361 .in +2
 362 .nf
 363 my_pkt = scsi_init_pkt(&devp->sd_address, NULL, bp, CDB_GROUP0,
 364           1, sizeof (struct buf *), PKT_DMA_PARTIAL,
 365           SLEEP_FUNC, NULL);
 366 .fi
 367 .in -2
 368 
 369 .SH SEE ALSO
 370 .sp
 371 .LP
 372 \fBscsi_alloc_consistent_buf\fR(9F), \fBscsi_destroy_pkt\fR(9F),
 373 \fBscsi_dmaget\fR(9F), \fBscsi_pktalloc\fR(9F), \fBbuf\fR(9S),
 374 \fBddi_dma_req\fR(9S), \fBscsi_address\fR(9S), \fBscsi_pkt\fR(9S)
 375 .sp
 376 .LP
 377 \fIWriting Device Drivers\fR
 378 .SH NOTES
 379 .sp
 380 .LP
 381 If a \fBDMA\fR allocation request fails with \fBDDI_DMA_NOMAPPING\fR, the
 382 \fBB_ERROR\fR flag will be set in \fIbp\fR, and the \fBb_error\fR field will be
 383 set to \fBEFAULT\fR.
 384 .sp
 385 .LP
 386 If a \fBDMA\fR allocation request fails with \fBDDI_DMA_TOOBIG\fR, the
 387 \fBB_ERROR\fR flag will be set in \fIbp\fR, and the \fBb_error\fR field will be
 388 set to \fBEINVAL\fR.
   1 '\" te
   2 .\"  Copyright 2014 Garrett D'Amore <garrett@damore.org>
   3 .\"  Copyright (c) 2006, Sun Microsystems, Inc.,  All Rights Reserved
   4 .\" 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.
   5 .\" 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.
   6 .\" 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]
   7 .TH SCSI_INIT_PKT 9F "May 24, 2014"
   8 .SH NAME
   9 scsi_init_pkt \- prepare a complete SCSI packet
  10 .SH SYNOPSIS
  11 .LP
  12 .nf
  13 #include <sys/scsi/scsi.h>
  14 
  15 
  16 
  17 \fBstruct scsi_pkt *\fR\fBscsi_init_pkt\fR(\fBstruct scsi_address *\fR\fIap\fR,
  18      \fBstruct scsi_pkt *\fR\fIpktp\fR, \fBstruct buf *\fR\fIbp\fR, \fBint\fR \fIcmdlen\fR, \fBint\fR \fIstatuslen\fR,
  19      \fBint\fR \fIprivatelen\fR, \fBint\fR \fIflags\fR, \fBint\fR \fB(*\fRcallback\fB)(caddr_t)\fR, \fBcaddr_t\fR \fIarg\fR);
  20 .fi
  21 
  22 .SH INTERFACE LEVEL
  23 .sp
  24 .LP
  25 Solaris DDI specific (Solaris DDI).
  26 .SH PARAMETERS
  27 .sp


 178 .na
 179 \fB\fBPKT_CONSISTENT\fR\fR
 180 .ad
 181 .sp .6
 182 .RS 4n
 183 This must be set if the \fBDMA\fR buffer was allocated using
 184 \fBscsi_alloc_consistent_buf\fR(9F). In this case, the \fBHBA\fR driver will
 185 guarantee that the data transfer is properly synchronized before performing the
 186 target driver's command completion callback.
 187 .RE
 188 
 189 .sp
 190 .ne 2
 191 .na
 192 \fB\fBPKT_DMA_PARTIAL\fR\fR
 193 .ad
 194 .sp .6
 195 .RS 4n
 196 This may be set if the driver can accept a partial \fBDMA\fR mapping. If set,
 197 \fBscsi_init_pkt()\fR will allocate \fBDMA\fR resources with the
 198 \fBDDI_DMA_PARTIAL\fR bit set in the DMA flags.
 199 The \fBpkt_resid\fR field of the
 200 \fBscsi_pkt\fR(9S) structure may be returned with a non-zero value, which
 201 indicates the number of bytes for which \fBscsi_init_pkt()\fR was unable to
 202 allocate DMA resources. In this case, a subsequent call to
 203 \fBscsi_init_pkt()\fR may be made for the same \fIpktp\fR and \fIbp\fR to
 204 adjust the DMA resources to the next portion of the transfer. This sequence
 205 should be repeated until the \fBpkt_resid\fR field is returned with a zero
 206 value, which indicates that with transport of this final portion the entire
 207 original request will have been satisfied.
 208 .RE
 209 
 210 .sp
 211 .ne 2
 212 .na
 213 \fB\fBPKT_XARQ\fR\fR
 214 .ad
 215 .sp .6
 216 .RS 4n
 217 Setting this flag requests that the \fBHBA\fR return  extra sense data for this
 218 \fBscsi_pkt\fR(9S). The default  auto request sense mechanism returns up to  20
 219 bytes. More than 20 bytes of sense data can be requested by setting this flag


 355 .LP
 356 \fBExample 5 \fRAllocating a Packet with Partial \fBDMA\fR Resources Attached
 357 .sp
 358 .LP
 359 To allocate a packet with partial \fBDMA\fR resources attached, use:
 360 
 361 .sp
 362 .in +2
 363 .nf
 364 my_pkt = scsi_init_pkt(&devp->sd_address, NULL, bp, CDB_GROUP0,
 365           1, sizeof (struct buf *), PKT_DMA_PARTIAL,
 366           SLEEP_FUNC, NULL);
 367 .fi
 368 .in -2
 369 
 370 .SH SEE ALSO
 371 .sp
 372 .LP
 373 \fBscsi_alloc_consistent_buf\fR(9F), \fBscsi_destroy_pkt\fR(9F),
 374 \fBscsi_dmaget\fR(9F), \fBscsi_pktalloc\fR(9F), \fBbuf\fR(9S),
 375 \fBscsi_address\fR(9S), \fBscsi_pkt\fR(9S)
 376 .sp
 377 .LP
 378 \fIWriting Device Drivers\fR
 379 .SH NOTES
 380 .sp
 381 .LP
 382 If a \fBDMA\fR allocation request fails with \fBDDI_DMA_NOMAPPING\fR, the
 383 \fBB_ERROR\fR flag will be set in \fIbp\fR, and the \fBb_error\fR field will be
 384 set to \fBEFAULT\fR.
 385 .sp
 386 .LP
 387 If a \fBDMA\fR allocation request fails with \fBDDI_DMA_TOOBIG\fR, the
 388 \fBB_ERROR\fR flag will be set in \fIbp\fR, and the \fBb_error\fR field will be
 389 set to \fBEINVAL\fR.