From owner-freebsd-usb@FreeBSD.ORG Mon Feb 2 01:06:29 2015 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2621E68E; Mon, 2 Feb 2015 01:06:29 +0000 (UTC) Received: from smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by mx1.freebsd.org (Postfix) with ESMTP id A37A7E54; Mon, 2 Feb 2015 01:06:28 +0000 (UTC) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile12) with ESMTP id t1216BSF015712; Mon, 2 Feb 2015 10:06:11 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili15) with ESMTP id t1216BB24801; Mon, 2 Feb 2015 10:06:11 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi13) id t1216BHD003632; Mon, 2 Feb 2015 10:06:11 +0900 Received: from localhost by lomi13.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id t1216BST003607; Mon, 2 Feb 2015 10:06:11 +0900 Date: Mon, 02 Feb 2015 10:06:11 +0900 (JST) Message-Id: <20150202.100611.2049338919815112954.okuno.kohji@jp.panasonic.com> To: hps@selasky.org Subject: Re: [Bug?] Control Transfers in xHCI From: Kohji Okuno In-Reply-To: <54CA9144.4030601@selasky.org> References: <54CA4BE3.2090706@selasky.org> <20150129195714.GA3683@dchagin.static.corbina.net> <54CA9144.4030601@selasky.org> Organization: Panasonic Corporation X-Mailer: Mew version 6.6 on Emacs 24.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2015 01:06:29 -0000 From: Hans Petter Selasky Subject: Re: [Bug?] Control Transfers in xHCI Date: Thu, 29 Jan 2015 21:00:04 +0100 > On 01/29/15 20:57, Chagin Dmitry wrote: >> On Thu, Jan 29, 2015 at 04:04:03PM +0100, Hans Petter Selasky wrote: >>> On 01/29/15 13:25, Kohji Okuno wrote: >>>> Hi HPS, >>>> >>>> I found a bug in xHCI device driver. >>>> >>>> Acording to extensible-host-controler-interface-usb-xhci.pdf:"3.2.9 >>>> Control Transfers"... >>>> >>>> A Data Stage TD consists of a Data Stage TRB followed by zero or more >>>> Normal TRBs. If the data is not physically contiguous, Normal TRBs may >>>> be chained to the Data Stage TRB. >>>> >>>> >>>> But, in the current imprementation, when two or more TRBs are needed, >>>> the device driver set XHCI_TRB_TYPE_DATA_STAGE to all TRBs. >>>> This is the violation of the spec. >>>> >>>> In my minor xHCI, I encountered strange bubble error in a control >>>> transfer. After I changed as the following, I succeeded its control >>>> transfer. >>>> >>>> Would you check the following (****)? >>>> >>> >>> Hi Kohji, >>> >>> You are correct there is a bug, but your patch is not correct. >>> >>> In FreeBSD we allow SETUP and DATA stages to be done as separate jobs. >>> That means at the entry of creating a new DATA chain, we need to check >>> if it is there first DATA packet or not. >>> >>> Can you test the attached patch and see if it works for you? >>> >> patch is lost somewhere, Hans. >> > > Trying again. > > I think Kohji got it. Hi HPS, usbd_control_transfer_did_data() has a bug, I think. I got the following error. And, the kernel failed to detect a device. usbd_setup_device_desc: getting device descriptor at addr 1 failed, USB_ERR_TIM\ EOUT In this time, the values for judgement were `xfer->flags_int.control_rem = 0' and `UGETW(req.wLength) = 18' Best regards, Kohji Okuno