Lines Matching +full:layer +full:- +full:buffer +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0+
6 * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
9 * (c) 2000 David L. Brown, Jr. (usb-[email protected])
19 * similar to commands in the SCSI-II and ATAPI specifications.
22 * exhibits class-specific exemptions from the USB specification.
54 for (; srb->cmd_len < 12; srb->cmd_len++) in usb_stor_pad12_command()
55 srb->cmnd[srb->cmd_len] = 0; in usb_stor_pad12_command()
57 /* send the command to the transport layer */ in usb_stor_pad12_command()
64 * fix some commands -- this is a form of mode translation in usb_stor_ufi_command()
72 for (; srb->cmd_len < 12; srb->cmd_len++) in usb_stor_ufi_command()
73 srb->cmnd[srb->cmd_len] = 0; in usb_stor_ufi_command()
75 /* set command length to 12 bytes (this affects the transport layer) */ in usb_stor_ufi_command()
76 srb->cmd_len = 12; in usb_stor_ufi_command()
78 /* XXX We should be constantly re-evaluating the need for these */ in usb_stor_ufi_command()
81 switch (srb->cmnd[0]) { in usb_stor_ufi_command()
85 srb->cmnd[4] = 36; in usb_stor_ufi_command()
90 srb->cmnd[7] = 0; in usb_stor_ufi_command()
91 srb->cmnd[8] = 8; in usb_stor_ufi_command()
96 srb->cmnd[4] = 18; in usb_stor_ufi_command()
100 /* send the command to the transport layer */ in usb_stor_ufi_command()
107 /* send the command to the transport layer */ in usb_stor_transparent_scsi_command()
113 * Scatter-gather transfer buffer access routines
117 * Copy a buffer of length buflen to/from the srb's transfer buffer.
118 * Update the **sgptr and *offset variables so that the next copy will
121 unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, in usb_stor_access_xfer_buf() argument
123 unsigned int *offset, enum xfer_buf_dir dir) in usb_stor_access_xfer_buf() argument
138 if (!sg_miter_skip(&miter, *offset)) in usb_stor_access_xfer_buf()
143 buflen - cnt); in usb_stor_access_xfer_buf()
146 memcpy(buffer + cnt, miter.addr, len); in usb_stor_access_xfer_buf()
148 memcpy(miter.addr, buffer + cnt, len); in usb_stor_access_xfer_buf()
150 if (*offset + len < miter.piter.sg->length) { in usb_stor_access_xfer_buf()
151 *offset += len; in usb_stor_access_xfer_buf()
154 *offset = 0; in usb_stor_access_xfer_buf()
166 * Store the contents of buffer into srb's transfer buffer and set the
169 void usb_stor_set_xfer_buf(unsigned char *buffer, in usb_stor_set_xfer_buf() argument
172 unsigned int offset = 0; in usb_stor_set_xfer_buf() local
176 buflen = usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset, in usb_stor_set_xfer_buf()
179 scsi_set_resid(srb, scsi_bufflen(srb) - buflen); in usb_stor_set_xfer_buf()