From: Tinh Nguyen <tinhngu...@os.amperecomputing.com>

Add PCIe link retry logic. If the card is detected to be present,
allow a retry for 3 times.

When the link is down, check if the LTSSMEN bit is cleared.
Based on Altra PCIe IP, the LTSSMEN bit is cleared from 1 to 0
if there is a surprising link down.
This indicates that a card is present.

Signed-off-by: Minh Nguyen <minhnguy...@os.amperecomputing.com>
---
 Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c 
b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
index d797442d9fbc..9cc059788581 100644
--- a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
+++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c
@@ -1769,7 +1769,11 @@ Ac01PcieCoreUpdateLink (
       } else {
         FailedPciePtr[*FailedPcieCount] = PcieIndex;
         *FailedPcieCount += 1;
-        *IsNextRoundNeeded = !(*IsNextRoundNeeded) ? 
Ac01PcieCoreCheckCardPresent (Pcie) : TRUE;
+
+        if (Ac01PcieCoreCheckCardPresent (Pcie)) {
+          *IsNextRoundNeeded = TRUE;
+          DEBUG ((DEBUG_INFO, "PCIE%d.%d Link retry\n", RootComplex->ID, 
PcieIndex));
+        }
       }
     }
   }
-- 
2.39.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104713): https://edk2.groups.io/g/devel/message/104713
Mute This Topic: https://groups.io/mt/98831765/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to