Hi,
Please try the attached patch for 10-current. The patch is not tested yet,
only compiles. I will try to test more later today. Let me know if you see any
issues.
--HPS
=== dev/usb/serial/usb_serial.c
==
--- dev/usb/serial/usb_serial.c (revision 244051)
+++ dev/usb/serial/usb_serial.c (local)
@@ -797,10 +797,14 @@
DPRINTF(tp=%p\n, tp);
if (ttydisc_can_bypass(tp) != 0 ||
- (sc-sc_flag UCOM_FLAG_HL_READY) == 0) {
+ (sc-sc_flag UCOM_FLAG_HL_READY) == 0 ||
+ (sc-sc_flag UCOM_FLAG_INWAKEUP) != 0) {
return;
}
+ /* prevent recursion */
+ sc-sc_flag |= UCOM_FLAG_INWAKEUP;
+
pos = sc-sc_jitterbuf_out;
while (sc-sc_jitterbuf_in != pos) {
@@ -821,6 +825,8 @@
if ((sc-sc_jitterbuf_in == pos)
(sc-sc_flag UCOM_FLAG_RTS_IFLOW))
ucom_rts(sc, 0);
+
+ sc-sc_flag = ~UCOM_FLAG_INWAKEUP;
}
static int
=== dev/usb/serial/usb_serial.h
==
--- dev/usb/serial/usb_serial.h (revision 244051)
+++ dev/usb/serial/usb_serial.h (local)
@@ -183,6 +183,7 @@
#define UCOM_FLAG_CONSOLE 0x80 /* set if device is a console */
#define UCOM_FLAG_WAIT_REFS 0x0100 /* set if we must wait for refs */
#define UCOM_FLAG_FREE_UNIT 0x0200 /* set if we must free the unit */
+#define UCOM_FLAG_INWAKEUP0x0400 /* set if we are in the tty_inwakeup callback */
uint8_t sc_lsr;
uint8_t sc_msr;
uint8_t sc_mcr;
=== dev/usb/storage/ustorage_fs.c
==
--- dev/usb/storage/ustorage_fs.c (revision 244051)
+++ dev/usb/storage/ustorage_fs.c (local)
@@ -74,7 +74,7 @@
/* Define some limits */
#ifndef USTORAGE_FS_BULK_SIZE
-#define USTORAGE_FS_BULK_SIZE (1UL 17) /* bytes */
+#define USTORAGE_FS_BULK_SIZE (1U 17) /* bytes */
#endif
#ifndef USTORAGE_FS_MAX_LUN
@@ -85,8 +85,6 @@
#define USTORAGE_QDATA_MAX 40 /* bytes */
#endif
-#define sc_cmd_data sc_cbw.CBWCDB
-
/*
* The SCSI ID string must be exactly 28 characters long
* exluding the terminating zero.
@@ -176,8 +174,9 @@
struct ustorage_fs_softc {
- ustorage_fs_bbb_cbw_t sc_cbw; /* Command Wrapper Block */
- ustorage_fs_bbb_csw_t sc_csw; /* Command Status Block */
+ ustorage_fs_bbb_cbw_t *sc_cbw; /* Command Wrapper Block */
+ ustorage_fs_bbb_csw_t *sc_csw; /* Command Status Block */
+ void *sc_dma_ptr; /* Main data buffer */
struct mtx sc_mtx;
@@ -275,7 +274,6 @@
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.bufsize = sizeof(ustorage_fs_bbb_cbw_t),
- .flags = {.ext_buffer = 1,},
.callback = ustorage_fs_t_bbb_command_callback,
.usb_mode = USB_MODE_DEVICE,
},
@@ -295,7 +293,7 @@
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.bufsize = USTORAGE_FS_BULK_SIZE,
- .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,.ext_buffer = 1},
+ .flags = {.proxy_buffer = 1,.short_xfer_ok = 1},
.callback = ustorage_fs_t_bbb_data_read_callback,
.usb_mode = USB_MODE_DEVICE,
},
@@ -315,7 +313,7 @@
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.bufsize = sizeof(ustorage_fs_bbb_csw_t),
- .flags = {.short_xfer_ok = 1,.ext_buffer = 1,},
+ .flags = {.short_xfer_ok = 1},
.callback = ustorage_fs_t_bbb_status_callback,
.usb_mode = USB_MODE_DEVICE,
},
@@ -409,6 +407,14 @@
transfers, %s\n, usbd_errstr(err));
goto detach;
}
+
+ sc-sc_cbw = usbd_xfer_get_frame_buffer(sc-sc_xfer[
+ USTORAGE_FS_T_BBB_COMMAND], 0);
+ sc-sc_csw = usbd_xfer_get_frame_buffer(sc-sc_xfer[
+ USTORAGE_FS_T_BBB_STATUS], 0);
+ sc-sc_dma_ptr = usbd_xfer_get_frame_buffer(sc-sc_xfer[
+ USTORAGE_FS_T_BBB_DATA_READ], 0);
+
/* start Mass Storage State Machine */
mtx_lock(sc-sc_mtx);
@@ -518,44 +524,44 @@
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
- tag = UGETDW(sc-sc_cbw.dCBWSignature);
+ tag = UGETDW(sc-sc_cbw-dCBWSignature);
if (tag != CBWSIGNATURE) {
/* do nothing */
DPRINTF(invalid signature 0x%08x\n, tag);
break;
}
- tag = UGETDW(sc-sc_cbw.dCBWTag);
+ tag = UGETDW(sc-sc_cbw-dCBWTag);
/* echo back tag */
- USETDW(sc-sc_csw.dCSWTag, tag);
+ USETDW(sc-sc_csw-dCSWTag, tag);
/* reset status */
- sc-sc_csw.bCSWStatus = 0;
+ sc-sc_csw-bCSWStatus = 0;
/* reset data offset, data length and data remainder */
sc-sc_transfer.offset = 0;
sc-sc_transfer.data_rem =
- UGETDW(sc-sc_cbw.dCBWDataTransferLength);
+ UGETDW(sc-sc_cbw-dCBWDataTransferLength);
/* reset data flags */
sc-sc_transfer.data_short = 0;
/* extract LUN */
- sc-sc_transfer.lun = sc-sc_cbw.bCBWLUN;
+ sc-sc_transfer.lun = sc-sc_cbw-bCBWLUN;
if (sc-sc_transfer.data_rem == 0) {
sc-sc_transfer.cbw_dir = DIR_NONE;
} else {
- if (sc-sc_cbw.bCBWFlags CBWFLAGS_IN) {
+ if (sc-sc_cbw-bCBWFlags CBWFLAGS_IN) {
sc-sc_transfer.cbw_dir = DIR_WRITE;
} else {
sc-sc_transfer.cbw_dir = DIR_READ;
}
}
- sc-sc_transfer.cmd_len =