The previous implementation used only the lower bits for both the first and second SATA controller, when the upper bits should have been used for the second SATA controller.
Also ASSERT that SataChPerSerdes is 2, because the even/odd logic doesn't work if it's not.
Signed-off-by: Alan Ott alan@softiron.com Contributed-under: TianoCore Contribution Agreement 1.0 --- Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c b/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c index 78c6819..ea49cae 100644 --- a/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c +++ b/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c @@ -109,10 +109,15 @@ InitializeSataController (
SataChPerSerdes = FixedPcdGet8 (PcdSataNumChPerSerdes);
- for (PortNum = 0; PortNum < SataPortCount; PortNum += SataChPerSerdes) { + // + // SataChPerSerdes must be 2 for the Even/Odd logic in the loop below + // + ASSERT(SataChPerSerdes == 2); + + for (PortNum = StartPort; PortNum < SataPortCount + StartPort; PortNum += SataChPerSerdes) { EvenPort = (UINT32)(FixedPcdGet32 (PcdSataPortMode) >> (PortNum * 2)) & 3; OddPort = (UINT32)(FixedPcdGet32 (PcdSataPortMode) >> ((PortNum+1) * 2)) & 3; - SataPhyInit ((StartPort + PortNum) / SataChPerSerdes, EvenPort, OddPort); + SataPhyInit (PortNum / SataChPerSerdes, EvenPort, OddPort); }
//