public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
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 <minhnguyen1@os.amperecomputing.com>
Subject: [edk2-platforms][PATCH 2/3] AmpereAltraPkg: Fix PCIe link training sequence
Date: Thu, 11 May 2023 14:51:42 +0700	[thread overview]
Message-ID: <20230511075143.2690207-3-minhnguyen1@os.amperecomputing.com> (raw)
In-Reply-To: <20230511075143.2690207-1-minhnguyen1@os.amperecomputing.com>

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 <minhnguyen1@os.amperecomputing.com>
---
 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);
 
+    // Complete the PERST pulse
+    BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE);
+
     // Start link training
     StartLinkTraining (RootComplex, PcieIndex, TRUE);
 
-    // Complete the PERST pulse
-    BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE);
-
     // Lock programming of config space
     EnableDbiAccess  (RootComplex, PcieIndex, FALSE);
 
-- 
2.39.0


  parent reply	other threads:[~2023-05-11  7:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11  7:51 [edk2-platforms][PATCH 0/3] Add necessary changes for PCIe core and remove unnecessary checks for PCIe Devmap mode Minh Nguyen
2023-05-11  7:51 ` [edk2-platforms][PATCH 1/3] AmpereAltraPkg: Remove PCIe "DevMapModeAuto" case in retrieving " Minh Nguyen
2023-05-22  8:01   ` Tinh Nguyen
2023-05-11  7:51 ` Minh Nguyen [this message]
2023-05-22  8:03   ` [edk2-platforms][PATCH 2/3] AmpereAltraPkg: Fix PCIe link training sequence Tinh Nguyen
2023-05-11  7:51 ` [edk2-platforms][PATCH 3/3] AmpereAltraPkg: Add retry logic when PCIe card is present Minh Nguyen
2023-05-12  2:51 ` [edk2-platforms][PATCH 0/3] Add necessary changes for PCIe core and remove unnecessary checks for PCIe Devmap mode Nhi Pham
2023-05-24  0:45 ` Minh Nguyen
2023-06-02 12:34   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230511075143.2690207-3-minhnguyen1@os.amperecomputing.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox