From nobody Fri May 3 06:50:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95897+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95897+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1667490810; cv=none; d=zohomail.com; s=zohoarc; b=ZJgXdN+aLOCqZBf1gsGoimlWWe91BGHYsiq/Iep7WRWp5KMabX8z4AxX/MwPNkfd5oEG3N9PBGIHMsiFpus8JqNEUaZR6HwkGX2pbM5oLsp2kz+l6yzQ/Wb0sX2vYjpjvKvPAmLCPYgxb21vSTWZazuJqPmuCJ7tFgRxoBqYt7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667490810; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=hqHXjzNNcV2eUeXMnhCZCcJT11i629NKtVkxlqdPdxM=; b=fI7lWF9RK+iFo45TiyKKC1zcscuRyedL0krUK7sPX3WXDwh5oMoqGxEfshx6ESFyJdHSq7BpeZDoGf5oSoGIQSNPZ7W3zPglo3VyLCXL5pxclrM1Q6G7dGuSlIhB0TbxoHdFMiU5vo1wVHULXv8fyGjJCcehibziycniQuF/aDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95897+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1667490810319190.37036074628372; Thu, 3 Nov 2022 08:53:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id X9xDYY1788612xdevv0Hr9VO; Thu, 03 Nov 2022 08:53:27 -0700 X-Received: from zg8tmtm4lje5ny4xodqumjaa.icoremail.net (zg8tmtm4lje5ny4xodqumjaa.icoremail.net [138.197.184.20]) by mx.groups.io with SMTP id smtpd.web08.195.1667490804129862769 for ; Thu, 03 Nov 2022 08:53:25 -0700 X-Received: from prodtpl.icoremail.net (unknown [10.12.1.20]) by hzbj-icmmx-2 (Coremail) with SMTP id AQAAfwC3HRfv42Njm1NlFQ--.9274S2; Thu, 03 Nov 2022 23:53:19 +0800 (CST) X-Received: from ubuntu.localdomain (unknown [113.246.28.250]) by mail (Coremail) with SMTP id AQAAfwD3w2Ts42Nj310CAA--.8243S3; Thu, 03 Nov 2022 23:53:18 +0800 (CST) From: "zhoucheng" To: devel@edk2.groups.io Cc: Liming Gao , Hao A Wu , Ray Ni Subject: [edk2-devel] [PATCH v1 1/1] MdeModulePkg:Add Warm Reset for Xhc Date: Thu, 3 Nov 2022 23:53:15 +0800 Message-Id: <20221103155315.3764-2-zhoucheng@phytium.com.cn> In-Reply-To: <20221103155315.3764-1-zhoucheng@phytium.com.cn> References: <20221103155315.3764-1-zhoucheng@phytium.com.cn> X-CM-TRANSID: AQAAfwD3w2Ts42Nj310CAA--.8243S3 X-CM-SenderInfo: 52kr3upkhqwqxsk13x1xpou0fpof0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7trW3AFWrKF48ZFyfWr4fuFg_yoW8XF45pF WrAryYgr48A3W3K347ArWUur1Fgw4vg3WrX3ZYqw4jya9Iqr9xXwnIyry5Ga17urW0ya4r uF1aqF9rWa4DGr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj DUYxn0WfASr-VFAU7a7-sFnT9fnUUIcSsGvfJ3UbIYCTnIWIevJa73UjIFyTuYvj4RJUUU UUUUU Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhoucheng@phytium.com.cn X-Gm-Message-State: if9Af5jXTfz5fnRQS7lNU6JTx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1667490807; bh=wphMaytz38V5Ens75NpYlo08zHqFVdj/qPHJbBZ3ROw=; h=Cc:Date:From:Reply-To:Subject:To; b=tuNYU2Rt9WG+iyj5czuIf8+G7v7EvssXp/+btFykx34w/Zbnea/jcw8QgT8WRFOZES3 cXe5cTKlUZwd0l58/5k/JLGFAVZSwNW+4i6lDlMj980NRShAN/PUjDeT7WI8+dnsTbXOQ Rj+eP17aOtslzk4q3W7SuAax00JyCcxI3eE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1667490811299100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Description according to Chapter 7.5.2 of USB 3.2 spec protocol. When the Usb state machine is in Inactive, the software is required to perform a warm reset operation. Cc: Liming Gao Cc: Hao A Wu Cc: Ray Ni Signed-off-by: Cheng Zhou Reviewed-by: Wu Hao A --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/Xhc= iDxe/Xhci.c index c05431ff30ec..938c8e2e28f7 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -558,6 +558,20 @@ XhcSetRootHubPortFeature ( State |=3D XHC_PORTSC_RESET; XhcWriteOpReg (Xhc, Offset, State); XhcWaitOpRegBit (Xhc, Offset, XHC_PORTSC_PRC, TRUE, XHC_GENERIC_TIME= OUT); + + // + // Usb 3.2 spec 7.5.2 + // When the USB state machine is Inactive state, the device is abnor= mal. + // eSS.Inactive is a state where a link has failed Enhanced SuperSpe= ed operation.Software + // is required for warm reset intervention.This flag only applies to= USB3 protocol ports. + // + State =3D XhcReadOpReg (Xhc, Offset); + if ((((State & 0x1e0) >> 5) =3D=3D 6) && ((State & 3) =3D=3D 0)) { + State |=3D 0x80000000; + XhcWriteOpReg (Xhc, Offset, State); + XhcWaitOpRegBit (Xhc, Offset, XHC_PORTSC_PRC, TRUE, XHC_GENERIC_TI= MEOUT); + DEBUG ((DEBUG_INFO, "Warm Reset Successful! \n")); + } break; =20 case EfiUsbPortPower: --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95897): https://edk2.groups.io/g/devel/message/95897 Mute This Topic: https://groups.io/mt/94760214/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-