From owner-freebsd-current Fri Dec 20 10:40:23 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8EE137B401 for ; Fri, 20 Dec 2002 10:40:21 -0800 (PST) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A07843EDA for ; Fri, 20 Dec 2002 10:40:21 -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 gBKIeHOM052555; Fri, 20 Dec 2002 10:40:17 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.5/8.12.5/Submit) id gBKIeHIi052554; Fri, 20 Dec 2002 10:40:17 -0800 (PST) (envelope-from dillon) Date: Fri, 20 Dec 2002 10:40:17 -0800 (PST) From: Matthew Dillon Message-Id: <200212201840.gBKIeHIi052554@apollo.backplane.com> To: Bernd Walter , toshii@netbsd.org Cc: Nate Lawson , freebsd-current@FreeBSD.ORG Subject: Re: UMASS USB bug? (getting the Sony disk-on-key device working) References: <200212200111.gBK1BW0h026510@apollo.backplane.com> <20021220121100.GA658@cicely8.cicely.de> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :The NetBSD code is already different: :1.48 (augustss 15-Sep-99): /* The OHCI hardware can handle at most one page crossing. */ :1.48 (augustss 15-Sep-99): if (OHCI_PAGE(dataphys) == dataphysend || :1.48 (augustss 15-Sep-99): OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) { :1.48 (augustss 15-Sep-99): /* we can handle it in this TD */ :1.48 (augustss 15-Sep-99): curlen = len; :1.48 (augustss 15-Sep-99): } else { :1.48 (augustss 15-Sep-99): /* must use multiple TDs, fill as much as possible. */ :1.120 (augustss 03-Feb-02): curlen = 2 * OHCI_PAGE_SIZE - :1.48 (augustss 15-Sep-99): (dataphys & (OHCI_PAGE_SIZE-1)); :1.78 (augustss 20-Mar-00): /* the length must be a multiple of the max size */ :1.78 (augustss 20-Mar-00): curlen -= curlen % UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize); :1.78 (augustss 20-Mar-00): #ifdef DIAGNOSTIC :1.78 (augustss 20-Mar-00): if (curlen == 0) :1.128 (provos 27-Sep-02): panic("ohci_alloc_std: curlen == 0"); :1.78 (augustss 20-Mar-00): #endif :1.48 (augustss 15-Sep-99): } : : :To bad we did not catch it. : :-- :B.Walter COSMO-Project http://www.cosmo-project.de Well, that's the curlen fix, which doesn't apply to us at all (in FreeBSD we do not try to optimize for two physically contiguous pages). I'm not sure why they are using a mod there, I think it is as simple as if (curlen > len) curlen = len, but I don't understand the 'the length must be a multiple of the max size' comment so maybe there is some magic there that I haven't considered. The fix that applies to both FreeBSD and NetBSD was the calculation of dataphysend just above the code you indicate. When I look at ohci.c via cvsweb for NetBSD, their 1.135, they have not fixed the dataphysend calculation yet. They still have (which is WRONG): dataphysend = OHCI_PAGE(dataphys + len - 1); The correct answer is: dataphysend = OHCI_PAGE(DMAADDR(dma, len - 1)); I am going to attempt to add toshii@netbsd.org to this thread, I don't know if that is a valid email address :-) -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message