From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: hao.a.wu@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Thu, 01 Aug 2019 18:04:02 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2019 18:04:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,336,1559545200"; d="scan'208";a="372212970" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 01 Aug 2019 18:04:03 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 1 Aug 2019 18:04:01 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 1 Aug 2019 18:04:00 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 1 Aug 2019 18:04:00 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.139]) with mapi id 14.03.0439.000; Fri, 2 Aug 2019 09:03:59 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Ni, Ray" , "mw@semihalf.com" CC: "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" , "jsd@semihalf.com" , "jaz@semihalf.com" , "Kinney, Michael D" , "Gao, Liming" , "lersek@redhat.com" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Return error when the device is not present Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Return error when the device is not present Thread-Index: AQHVR2jQv6l+kHlRP0mFP7towrPBLKbka1iAgAKfadA= Date: Fri, 2 Aug 2019 01:03:58 +0000 Message-ID: References: <1564554319-26810-1-git-send-email-mw@semihalf.com> <734D49CCEBEEF84792F5B80ED585239D5C265FC4@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C265FC4@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Ni= , > Ray > Sent: Thursday, August 01, 2019 12:51 AM > To: devel@edk2.groups.io; mw@semihalf.com > Cc: leif.lindholm@linaro.org; ard.biesheuvel@linaro.org; jsd@semihalf.co= m; > jaz@semihalf.com; Tian, Feng; Kinney, Michael D; Gao, Liming; > lersek@redhat.com > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Return error > when the device is not present >=20 > Marcin, > What does the failure look like without your fix? >>From my observation of the code: A. Changes are made in UsbEnumerateNewDev(); B. Caller of UsbEnumerateNewDev(): UsbEnumeratePort(); C. UsbEnumeratePort() directly returns the status from UsbEnumerateNewDev(= ) as its own return value; D. Callers of UsbEnumeratePort(): UsbHubEnumeration() and UsbRootHubEnumer= ation(); E. Both of them do not care about the return status from UsbEnumeratePort(= ). I think there is no direct failure without the proposed fix. However, let us wait the confirmation from Marcin. Also, I think the proposed patch is a good refinement. If future updates t= o the driver requires checking the return status during the above code path, then proper status will be returned. Best Regards, Hao Wu >=20 > Thanks, > Ray >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of > Marcin Wojtas > > Sent: Wednesday, July 31, 2019 2:25 PM > > To: devel@edk2.groups.io > > Cc: leif.lindholm@linaro.org; ard.biesheuvel@linaro.org; > mw@semihalf.com; jsd@semihalf.com; jaz@semihalf.com; Tian, Feng > > ; Kinney, Michael D ; > Gao, Liming ; > > lersek@redhat.com > > Subject: [edk2-devel] [PATCH] MdeModulePkg/UsbBusDxe: Return error > when the device is not present > > > > Until now, during the USB device enumeration when its PortState > > USB_PORT_STAT_CONNECTION bit was not set, the stack was not > informed > > that the device is not present. Fix that by returning appropriate > > error code. > > > > Change-Id: I588f82b987993e9755f64ce76cde9eb690ef1d54 > > Signed-off-by: Marcin Wojtas > > --- > > MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > > index be9d9bd..ab1db15 100644 > > --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > > +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > > @@ -719,6 +719,7 @@ UsbEnumerateNewDev ( > > > > if (!USB_BIT_IS_SET (PortState.PortStatus, > USB_PORT_STAT_CONNECTION)) { > > DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: No device present at > port %d\n", Port)); > > + Status =3D EFI_NOT_FOUND; > > goto ON_ERROR; > > } else if (USB_BIT_IS_SET (PortState.PortStatus, > USB_PORT_STAT_SUPER_SPEED)){ > > Child->Speed =3D EFI_USB_SPEED_SUPER; > > -- > > 2.7.4 > > > > > > >=20 >=20 >=20