[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question in residue in umass.c
:I recently got my TREK Thumb drive working with -current. I was hoping to
:make similar changes to -STABLE to get it working. However, in -current,
:one of the quirks that had to be set IGNORE_RESIDUE. There does not
:seem to be any corresponding option in -STABLE.
:
:If there is, could one of the USB Wizards get back to me on how to make
:the appropriate change? The -CURRENT settings are below, as a reference.
:
: -Brian
:
:> { USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE_8MB, RID_WILDCARD,
:> UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
:> IGNORE_RESIDUE
:> },
MFCing the quirk support, or at least most of it, is not that
difficult and I will be doing it after my -current patches get
cleared up.
In the mean time you can use this patch for -stable. Just add a quirk
entry for your TREK on top of this patch and there is a good chance
it will work.
-Matt
Matthew Dillon
<dillon@xxxxxxxxxxxxx>
Index: cam/scsi/scsi_da.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v
retrieving revision 1.42.2.29
diff -u -r1.42.2.29 scsi_da.c
--- cam/scsi/scsi_da.c 23 Nov 2002 23:21:42 -0000 1.42.2.29
+++ cam/scsi/scsi_da.c 19 Dec 2002 18:01:19 -0000
@@ -250,6 +250,16 @@
},
{
/*
+ * Sony Key-Storage media fails in terrible ways without
+ * both quirks. The auto 6->10 code doesn't do the job.
+ * (note: The Sony diskkey is actually the MSYSTEMS
+ * disk-on-key device).
+ */
+ {T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Storage Media", "*"},
+ /*quirks*/ DA_Q_NO_6_BYTE|DA_Q_NO_SYNC_CACHE
+ },
+ {
+ /*
* Sony DSC cameras (DSC-S30, DSC-S50, DSC-S70)
*/
{T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Sony DSC", "*"},
Index: dev/usb/ohci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ohci.c,v
retrieving revision 1.39.2.7
diff -u -r1.39.2.7 ohci.c
--- dev/usb/ohci.c 6 Nov 2002 20:23:50 -0000 1.39.2.7
+++ dev/usb/ohci.c 20 Dec 2002 01:21:12 -0000
@@ -469,7 +469,7 @@
cur = std;
- dataphysend = DMAADDR(dma, len - 1);
+ dataphysend = OHCI_PAGE(DMAADDR(dma, len - 1));
tdflags =
(rd ? OHCI_TD_IN : OHCI_TD_OUT) |
OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY |
@@ -484,8 +484,8 @@
/* The OHCI hardware can handle at most one page crossing. */
#if defined(__NetBSD__) || defined(__OpenBSD__)
- if (OHCI_PAGE(dataphys) == OHCI_PAGE(dataphysend) ||
- OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == OHCI_PAGE(dataphysend))
+ if (OHCI_PAGE(dataphys) == dataphysend ||
+ OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend)
#elif defined(__FreeBSD__)
/* XXX This is pretty broken: Because we do not allocate
* a contiguous buffer (contiguous in physical pages) we
@@ -493,7 +493,7 @@
* So check whether the start and end of the buffer are on
* the same page.
*/
- if (OHCI_PAGE(dataphys) == OHCI_PAGE(dataphysend))
+ if (OHCI_PAGE(dataphys) == dataphysend)
#endif
{
/* we can handle it in this TD */
@@ -510,6 +510,8 @@
/* must use multiple TDs, fill as much as possible. */
curlen = 2 * OHCI_PAGE_SIZE -
OHCI_PAGE_MASK(dataphys);
+ if (curlen > len) /* may have fit in one page */
+ curlen = len;
#elif defined(__FreeBSD__)
/* See comment above (XXX) */
curlen = OHCI_PAGE_SIZE -
Index: dev/usb/umass.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/umass.c,v
retrieving revision 1.11.2.13
diff -u -r1.11.2.13 umass.c
--- dev/usb/umass.c 21 Nov 2002 21:26:14 -0000 1.11.2.13
+++ dev/usb/umass.c 20 Dec 2002 01:21:43 -0000
@@ -1488,6 +1488,7 @@
panic("%s: transferred %d bytes instead of %d bytes\n",
USBDEVNAME(sc->sc_dev),
sc->transfer_actlen, sc->transfer_datalen);
+#if 0
} else if (sc->transfer_datalen - sc->transfer_actlen
!= UGETDW(sc->csw.dCSWDataResidue)) {
DPRINTF(UDMASS_BBB, ("%s: actlen=%d != residue=%d\n",
@@ -1497,6 +1498,7 @@
umass_bbb_reset(sc, STATUS_WIRE_FAILED);
return;
+#endif
} else if (sc->csw.bCSWStatus == CSWSTATUS_FAILED) {
DPRINTF(UDMASS_BBB, ("%s: Command Failed, res = %d\n",
@@ -2426,7 +2428,8 @@
ccg->secs_per_track = 32;
}
secs_per_cylinder = ccg->heads * ccg->secs_per_track;
- ccg->cylinders = ccg->volume_size / secs_per_cylinder;
+ ccg->cylinders = (ccg->volume_size +
+ secs_per_cylinder - 1) / secs_per_cylinder;
ccb->ccb_h.status = CAM_REQ_CMP;
}
To Unsubscribe: send mail to majordomo@xxxxxxxxxxx
with "unsubscribe freebsd-stable" in the body of the message