SerDesProtocolMap is a UINT64, but BIT0 is an unadorned int. Shifting BIT0 left by more than 31 bits is undefined behaviour. This would cause SerDesProtocolMap to be filled with incorrect values when using Serdes protocols numbered 32 and above, such as the SGMII protocols.
This fixes a hang at boot time on the Solidrun Honeycomb with SERDES configuration 4_5_2. Signed-off-by: Dan Callaghan <d...@djc.id.au> --- Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c | 2 +- Silicon/NXP/Library/SerDesHelperLib/SerDesHelperLib.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c index 7f11d7a602..127eb3e175 100644 --- a/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c +++ b/Silicon/NXP/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -748,7 +748,7 @@ IsPcieNumEnabled( // Reading serdes protocol map GetSerDesProtocolMap (&SerDesProtocolMap); - return (SerDesProtocolMap & (BIT0 << (PcieNum))) != 0; + return (SerDesProtocolMap & ((UINT64) BIT0 << (PcieNum))) != 0; } /** diff --git a/Silicon/NXP/Library/SerDesHelperLib/SerDesHelperLib.c b/Silicon/NXP/Library/SerDesHelperLib/SerDesHelperLib.c index 1e8158541c..62a32d5caf 100644 --- a/Silicon/NXP/Library/SerDesHelperLib/SerDesHelperLib.c +++ b/Silicon/NXP/Library/SerDesHelperLib/SerDesHelperLib.c @@ -157,7 +157,7 @@ GetSerDesMap ( DEBUG ((DEBUG_ERROR, "Unknown SerDes lane protocol %d\n", LaneProtocol)); return EFI_NO_MAPPING; } - *SerDesProtocolMap |= (BIT0 << (LaneProtocol)); + *SerDesProtocolMap |= ((UINT64) BIT0 << (LaneProtocol)); } return EFI_SUCCESS; -- 2.36.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#92209): https://edk2.groups.io/g/devel/message/92209 Mute This Topic: https://groups.io/mt/92898445/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-