From owner-freebsd-stable Thu Dec 19 20:41:37 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA61137B405 for ; Thu, 19 Dec 2002 20:41:29 -0800 (PST) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CDDE43EF2 for ; Thu, 19 Dec 2002 20:41:29 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.5/8.12.5) with ESMTP id gBK4dxOM028859; Thu, 19 Dec 2002 20:39:59 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.5/8.12.5/Submit) id gBK4dwg5028858; Thu, 19 Dec 2002 20:39:58 -0800 (PST) (envelope-from dillon) Date: Thu, 19 Dec 2002 20:39:58 -0800 (PST) From: Matthew Dillon Message-Id: <200212200439.gBK4dwg5028858@apollo.backplane.com> To: "Brian J. McGovern" Cc: stable@FreeBSD.ORG Subject: Re: question in residue in umass.c References: <200212030314.gB33EEFx000314@spoon.beta.com> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :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 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@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message