From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.119]) by mx.groups.io with SMTP id smtpd.web11.53488.1683791537928025073 for ; Thu, 11 May 2023 00:52:19 -0700 Authentication-Results: mx.groups.io; dkim=fail, err=malformed MIME header line: Subject: [edk2-platforms][PATCH 2/3] AmpereAltraPkg: Fix PCIe link training sequence; spf=pass (domain: os.amperecomputing.com, ip: 40.107.212.119, mailfrom: minhnguyen1@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CsJ/BXe7VsTah0DqKGPHHx3Xe8T3iOBxtLemPnE+1yH1GE1wNL/L0hTVBj2jqAjhU1q1xgYssV0uo7tFor+lpD4Z1htU89qh6wsmfB6CUGDxIC3HxsBWbRsYbzfgGwmHBOwR/GYBGka+n/blfT0PBIe4oVMPwaDpd2sX8DSpRLtda03iPAEh0y4L1iFShTGoJgKZUClRJpRtvOSXxqJeRiOyXO9ujBrRT2UgkXcq3XvVQZvRLKEmEuHmT8fetn7AxHXcDYi2HDbTFoSwm6ZgO6k8zSnHcNt2mbtfF6ix4AxmkFsNG5gvOi6hGd6Zuc5OruITPrwNCtJn7YRXG0vQmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CHWnm42LExcYr/BtALmMeoTBzpyJncCGoF166SGZX3U=; b=EvGAzS0ETkI0djhsIkxEGzHRpLeXX3HTuJtLFd16EYwm2GbSQoqVbLTTQ0dpjwt8yNU9R4v+XWrb7hsFVjatr2jkE0FYsaRDjNMMytvY51m33Ai8rEeifaP4k4yReQrdwvEw+3dq20IicfkTD9rt+weWz0sbYyA9jI7EyZ1oLcf6ck+aVm8y5s9RR+1I3EvCQHIqcmThE82MvVsMmoHcYgd1J6RtDBC8q5MEI8XbYnlsfpGgwA+DrxGUDomwr8hpNbuz06yCB1P4YSJflli44L//8JPpLy1F0/uKbX5x31OKzCFqTD2h2s4fQRa5wslo7F6+o8Sijeq95QK+uWa++g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CHWnm42LExcYr/BtALmMeoTBzpyJncCGoF166SGZX3U=; b=p9nZ1TBV68/y9KiBgVp8zCY2SVvRxKb43gV/cVYSNrdHxVP3I5mypiNBc4O9iRM07St/DFhTnkbiYppGpKxfRgz/Hi0Q3VwaYCgbaZTDMfekPE20j3B7g+7cogvpTU1jTIUrulHq9EBH+QxFPvAe7OB4pHTvc8jGEyGQaGuFFPg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB8048.prod.exchangelabs.com (2603:10b6:510:280::7) by PH7PR01MB7959.prod.exchangelabs.com (2603:10b6:510:277::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.32; Thu, 11 May 2023 07:52:09 +0000 Received: from PH0PR01MB8048.prod.exchangelabs.com ([fe80::bbdb:b58c:140e:c4e1]) by PH0PR01MB8048.prod.exchangelabs.com ([fe80::bbdb:b58c:140e:c4e1%6]) with mapi id 15.20.6387.019; Thu, 11 May 2023 07:52:09 +0000 From: Minh Nguyen To: devel@edk2.groups.io CC: patches@amperecomputing.com, quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, nhi@os.amperecomputing.com, tinhnguyen@os.amperecomputing.com, Minh Nguyen Subject: [edk2-platforms][PATCH 2/3] AmpereAltraPkg: Fix PCIe link training sequence Date: Thu, 11 May 2023 14:51:42 +0700 Message-ID: <20230511075143.2690207-3-minhnguyen1@os.amperecomputing.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230511075143.2690207-1-minhnguyen1@os.amperecomputing.com> References: <20230511075143.2690207-1-minhnguyen1@os.amperecomputing.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PH0PR01MB8048.prod.exchangelabs.com (2603:10b6:510:280::7) Return-Path: minhnguyen1@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB8048:EE_|PH7PR01MB7959:EE_ X-MS-Office365-Filtering-Correlation-Id: 4aad6f5f-086c-4f0c-1c7f-08db51f49f16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XctK8dm0I4LNfhUDcxYFCbRFvtl6q+t+8ZtJcHuHtQECl9JoRwo5MHTUskOBQSZW6Bvhbt5gkYozpemnOieTMmwpIDym0aEaasW0n6+ryQP79Fe/0289MGboNx8xl9gD+gd+aj1j2azSUdupsoLlphjmPNzuHDU8EAGaiXdBkPvXwf8v//CKWS71MjCgFRf9Svvn4T/XnZ165WWiVbZ5cmmHPR6qPBVpvYoEPBftiZK4Jl/jiGEgGhtm2VWFe+IzB/QwS8JCEB8xpeLbzAmzm7lR+XA5Asy9qrH001IZa77DjuzbzmE/+lSsJe8BX82RneiFyJ7GAHa9r0zvCqJyx9rvNM5F3bzFnS16O54M5t4CYLylTYZAyO/6tAH9VCt5ZeUFZV6zMmXpKisTFuBobODvp9BO7EdTMGNT7yar/k1C7fgujZwca5qWsSY+d4ArUjEGn18NDWCZIUp6jopDEml9UaaRrhLhUMy7iTxGXvwUiSVL8F0yMUXN4pVdFXZCbcXnK8MiAMA36ue6zhNEsvblAfmVuWENmSue/W0qLpCwA40x39uCLfELr3CB3eah3S9o9u14673f/Qrzl9iV5hDJEyAv5GXoxO79qywGQz1poEYSdmI4bykrU9zdlX/u X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB8048.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(366004)(346002)(396003)(376002)(136003)(451199021)(2906002)(186003)(1076003)(6666004)(8936002)(8676002)(4326008)(52116002)(6486002)(41300700001)(5660300002)(316002)(66476007)(6916009)(66556008)(66946007)(19627235002)(86362001)(83380400001)(478600001)(38350700002)(38100700002)(26005)(6512007)(6506007)(107886003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?41AiikoDP4kzUNFyEKi9XOg1A1p2iPToQbYfBGksesGxV2SqWEH198vdQ/eD?= =?us-ascii?Q?ewfegxjR6gp0Bh/L/Oe2E5+XX2BikFbnIwCp0kpfzuS+Ncl21nUjFBzPEk8R?= =?us-ascii?Q?vmM0lH8fkZM/pr41IJY6FCvJ+AbVFOppbIDVLM24MV+3C+ujz2f/8VXBMHQO?= =?us-ascii?Q?ko8ByZOcQj0jeYNFaTRbh5UqHKo2C4fgpxkaZ+mh47wbTR9Pj81iRp9hkxNW?= =?us-ascii?Q?I6DEtn2qmPcKtw8zQ8KU9jf6lNj+qC9jIqjdyUKzze0BI52PJknoFRZbQBUM?= =?us-ascii?Q?0lR2uhB4+ZcscZeaiJiTrVUGOAkMxXu/fncwYAV5PZn+3e3KnWDrnGaOk1iu?= =?us-ascii?Q?1xUz2gKBzpbxhYiqjy6dQoHZiBNB3rZIRRKBMopaCe6uwD3xyic/ul4RVonk?= =?us-ascii?Q?VNtBu5OvLhP51WVOBgCAemlaTaKo2yu2FlqO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9edlvzk4beso2rFkkprIuBtAujmIk0XVutuprMfEl2LvxQQYzfGYZDk?= =?us-ascii?Q?4KceJ/hK0Of5H2oIuaDVQRb1IMPHHUvxv42FoMQjarwA8bgehPku4uiuWgaJ?= =?us-ascii?Q?ozzaaHnrLhgAVcyOn1n00M+9xVsLa7yRMpfhBXLDir8l2mJvqxVS9kgs6f4V?= =?us-ascii?Q?HYoVZ1GNOCwn9rPknGHr/nTnn6w1RT6t3RbAvC/19g+Ps/Tc1k8S63zMoqIs?= =?us-ascii?Q?HJBVHa+BuCNOxTrX4zonN7Y83cmI/kjuCDRM6awK2uE387DKBY2fhREfm1KG?= =?us-ascii?Q?uiX1O1EBcRDsmh0eiaI9l8jRvCG/eIfSMHNEEJPOQsTd?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4aad6f5f-086c-4f0c-1c7f-08db51f49f16 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB8048.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 07:52:08.8994 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pHtsDbAgOwUG5OfxeoRdOAAEwTM/bGzuBzbmeKyIeCI8SGYzg40Wo5E42e3dzpjSqmdjZ+XB3cDrlaUQJuLEQFV9GqU+fT6tSENjiLL1DDxIqwWlq5sY9IJh603grSjs X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR01MB7959 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Currently, the implementation starts link training and put device out-of-reset right away. This make LinkStat and BlockEventStat registers indicate that link is not up yet (LinkStat: 0x300 and BlockEventStat: 0x0). This fix will start link training after putting device out-of-reset. The values of LinkStat and BlockEventStat registers after this fix are respectively 0x1103 and 0x1 (Link is up). Signed-off-by: Minh Nguyen --- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b= /Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c index f7c8defc1906..d797442d9fbc 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -1177,12 +1177,12 @@ Ac01PcieCoreSetupRC ( // Assert PERST low to reset endpoint BoardPcieAssertPerst (RootComplex, PcieIndex, FALSE); =20 + // Complete the PERST pulse + BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE); + // Start link training StartLinkTraining (RootComplex, PcieIndex, TRUE); =20 - // Complete the PERST pulse - BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE); - // Lock programming of config space EnableDbiAccess (RootComplex, PcieIndex, FALSE); =20 --=20 2.39.0