public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Alan Ott <alan@softiron.com>
To: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org
Cc: edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org,
	Alan Ott <alan@softiron.com>
Subject: [PATCH v2 edk2-platforms 2/3] Silicon/AMD/Styx: Use PcdSataPortMode properly for two controllers
Date: Sun, 20 Aug 2017 15:33:34 -0400	[thread overview]
Message-ID: <20170820193335.21471-3-alan@softiron.com> (raw)
In-Reply-To: <20170820193335.21471-1-alan@softiron.com>

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);
   }
 
   //
-- 
2.9.3



  parent reply	other threads:[~2017-08-20 19:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-20 19:33 [PATCH v2 edk2-platforms 0/3] Re-enable the second SATA controller on Overdrive Alan Ott
2017-08-20 19:33 ` [PATCH v2 edk2-platforms 1/3] Silicon/AMD/Styx: Make PcdSataPortMode 32 bits Alan Ott
2017-08-20 19:33 ` Alan Ott [this message]
2017-08-20 19:33 ` [PATCH v2 edk2-platforms 3/3] Platform/AMD/OverdriveBoard: Re-enable the second SATA Controller Alan Ott
2017-08-20 19:52 ` [PATCH v2 edk2-platforms 0/3] Re-enable the second SATA controller on Overdrive Ard Biesheuvel
2017-08-21 14:12 ` Leif Lindholm
2017-08-21 14:20   ` Alan Ott
2017-08-21 17:17     ` Leif Lindholm

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=20170820193335.21471-3-alan@softiron.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