1c1
< /* $FreeBSD: head/sys/dev/usb/usb_msctest.c 242364 2012-10-30 16:56:16Z hselasky $ */
---
> /* $FreeBSD: head/sys/dev/usb/usb_msctest.c 244503 2012-12-20 18:38:02Z hselasky $ */
142,143c142,143
< struct bbb_cbw cbw;
< struct bbb_csw csw;
---
> struct bbb_cbw *cbw;
> struct bbb_csw *csw;
161c161
< uint8_t buffer[SCSI_MAX_LEN] __aligned(4);
---
> uint8_t *buffer;
187d186
< .flags = {.ext_buffer = 1,},
196,197c195,196
< .bufsize = BULK_SIZE,
< .flags = {.ext_buffer = 1,.proxy_buffer = 1,.short_xfer_ok = 1,},
---
> .bufsize = MAX(SCSI_MAX_LEN, BULK_SIZE),
> .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,},
235c234
< .flags = {.ext_buffer = 1,.short_xfer_ok = 1,},
---
> .flags = {.short_xfer_ok = 1,},
244d242
<
293,301c291,299
< tag = UGETDW(sc->cbw.dCBWTag) + 1;
< USETDW(sc->cbw.dCBWSignature, CBWSIGNATURE);
< USETDW(sc->cbw.dCBWTag, tag);
< USETDW(sc->cbw.dCBWDataTransferLength, (uint32_t)sc->data_len);
< sc->cbw.bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT);
< sc->cbw.bCBWLUN = sc->lun;
< sc->cbw.bCDBLength = sc->cmd_len;
< if (sc->cbw.bCDBLength > sizeof(sc->cbw.CBWCDB)) {
< sc->cbw.bCDBLength = sizeof(sc->cbw.CBWCDB);
---
> tag = UGETDW(sc->cbw->dCBWTag) + 1;
> USETDW(sc->cbw->dCBWSignature, CBWSIGNATURE);
> USETDW(sc->cbw->dCBWTag, tag);
> USETDW(sc->cbw->dCBWDataTransferLength, (uint32_t)sc->data_len);
> sc->cbw->bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT);
> sc->cbw->bCBWLUN = sc->lun;
> sc->cbw->bCDBLength = sc->cmd_len;
> if (sc->cbw->bCDBLength > sizeof(sc->cbw->CBWCDB)) {
> sc->cbw->bCDBLength = sizeof(sc->cbw->CBWCDB);
304d301
< usbd_xfer_set_frame_data(xfer, 0, &sc->cbw, sizeof(sc->cbw));
433c430
< if (actlen < (int)sizeof(sc->csw)) {
---
> if (actlen < (int)sizeof(struct bbb_csw)) {
435c432
< } else if (sc->csw.bCSWStatus == CSWSTATUS_GOOD) {
---
> } else if (sc->csw->bCSWStatus == CSWSTATUS_GOOD) {
443d439
< usbd_xfer_set_frame_data(xfer, 0, &sc->csw, sizeof(sc->csw));
481,483c477,479
< memset(&sc->cbw.CBWCDB, 0, sizeof(sc->cbw.CBWCDB));
< memcpy(&sc->cbw.CBWCDB, cmd_ptr, cmd_len);
< DPRINTFN(1, "SCSI cmd = %*D\n", (int)cmd_len, (char *)sc->cbw.CBWCDB, ":");
---
> memset(&sc->cbw->CBWCDB, 0, sizeof(sc->cbw->CBWCDB));
> memcpy(&sc->cbw->CBWCDB, cmd_ptr, cmd_len);
> DPRINTFN(1, "SCSI cmd = %*D\n", (int)cmd_len, (char *)sc->cbw->CBWCDB, ":");
556a553,560
> /* store pointer to DMA buffers */
> sc->buffer = usbd_xfer_get_frame_buffer(
> sc->xfer[ST_DATA_RD], 0);
> sc->cbw = usbd_xfer_get_frame_buffer(
> sc->xfer[ST_COMMAND], 0);
> sc->csw = usbd_xfer_get_frame_buffer(
> sc->xfer[ST_STATUS], 0);
>
< /* $FreeBSD: head/sys/dev/usb/usb_msctest.c 242364 2012-10-30 16:56:16Z hselasky $ */
---
> /* $FreeBSD: head/sys/dev/usb/usb_msctest.c 244503 2012-12-20 18:38:02Z hselasky $ */
142,143c142,143
< struct bbb_cbw cbw;
< struct bbb_csw csw;
---
> struct bbb_cbw *cbw;
> struct bbb_csw *csw;
161c161
< uint8_t buffer[SCSI_MAX_LEN] __aligned(4);
---
> uint8_t *buffer;
187d186
< .flags = {.ext_buffer = 1,},
196,197c195,196
< .bufsize = BULK_SIZE,
< .flags = {.ext_buffer = 1,.proxy_buffer = 1,.short_xfer_ok = 1,},
---
> .bufsize = MAX(SCSI_MAX_LEN, BULK_SIZE),
> .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,},
235c234
< .flags = {.ext_buffer = 1,.short_xfer_ok = 1,},
---
> .flags = {.short_xfer_ok = 1,},
244d242
<
293,301c291,299
< tag = UGETDW(sc->cbw.dCBWTag) + 1;
< USETDW(sc->cbw.dCBWSignature, CBWSIGNATURE);
< USETDW(sc->cbw.dCBWTag, tag);
< USETDW(sc->cbw.dCBWDataTransferLength, (uint32_t)sc->data_len);
< sc->cbw.bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT);
< sc->cbw.bCBWLUN = sc->lun;
< sc->cbw.bCDBLength = sc->cmd_len;
< if (sc->cbw.bCDBLength > sizeof(sc->cbw.CBWCDB)) {
< sc->cbw.bCDBLength = sizeof(sc->cbw.CBWCDB);
---
> tag = UGETDW(sc->cbw->dCBWTag) + 1;
> USETDW(sc->cbw->dCBWSignature, CBWSIGNATURE);
> USETDW(sc->cbw->dCBWTag, tag);
> USETDW(sc->cbw->dCBWDataTransferLength, (uint32_t)sc->data_len);
> sc->cbw->bCBWFlags = ((sc->dir == DIR_IN) ? CBWFLAGS_IN : CBWFLAGS_OUT);
> sc->cbw->bCBWLUN = sc->lun;
> sc->cbw->bCDBLength = sc->cmd_len;
> if (sc->cbw->bCDBLength > sizeof(sc->cbw->CBWCDB)) {
> sc->cbw->bCDBLength = sizeof(sc->cbw->CBWCDB);
304d301
< usbd_xfer_set_frame_data(xfer, 0, &sc->cbw, sizeof(sc->cbw));
433c430
< if (actlen < (int)sizeof(sc->csw)) {
---
> if (actlen < (int)sizeof(struct bbb_csw)) {
435c432
< } else if (sc->csw.bCSWStatus == CSWSTATUS_GOOD) {
---
> } else if (sc->csw->bCSWStatus == CSWSTATUS_GOOD) {
443d439
< usbd_xfer_set_frame_data(xfer, 0, &sc->csw, sizeof(sc->csw));
481,483c477,479
< memset(&sc->cbw.CBWCDB, 0, sizeof(sc->cbw.CBWCDB));
< memcpy(&sc->cbw.CBWCDB, cmd_ptr, cmd_len);
< DPRINTFN(1, "SCSI cmd = %*D\n", (int)cmd_len, (char *)sc->cbw.CBWCDB, ":");
---
> memset(&sc->cbw->CBWCDB, 0, sizeof(sc->cbw->CBWCDB));
> memcpy(&sc->cbw->CBWCDB, cmd_ptr, cmd_len);
> DPRINTFN(1, "SCSI cmd = %*D\n", (int)cmd_len, (char *)sc->cbw->CBWCDB, ":");
556a553,560
> /* store pointer to DMA buffers */
> sc->buffer = usbd_xfer_get_frame_buffer(
> sc->xfer[ST_DATA_RD], 0);
> sc->cbw = usbd_xfer_get_frame_buffer(
> sc->xfer[ST_COMMAND], 0);
> sc->csw = usbd_xfer_get_frame_buffer(
> sc->xfer[ST_STATUS], 0);
>