Platforms/AMD/Styx/AcpiTables: enable second SATA controller

Enable the second AHCI ACPI node when any ports are enabled on the
second SATA controller.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
diff --git a/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf b/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf
index 72272aa..12e0444 100644
--- a/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf
+++ b/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf
@@ -83,6 +83,7 @@
   gAmdStyxTokenSpaceGuid.PcdPsciOsSupport

   gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport

   gAmdStyxTokenSpaceGuid.PcdParkingProtocolVersion

+  gAmdStyxTokenSpaceGuid.PcdSata1PortCount

 

 [Depex]

   gAmdMpCoreInfoProtocolGuid

diff --git a/Platforms/AMD/Styx/AcpiTables/Dsdt.c b/Platforms/AMD/Styx/AcpiTables/Dsdt.c
index 922d721..360a446 100644
--- a/Platforms/AMD/Styx/AcpiTables/Dsdt.c
+++ b/Platforms/AMD/Styx/AcpiTables/Dsdt.c
@@ -174,15 +174,10 @@
     else if (AsciiStrCmp(Table->Pathname, "_SB_.ETH1._DSD") == 0) {

       OverrideMacAddr ((UINT8 *)&AmlCode[Table->Offset], PcdGet64 (PcdEthMacB));

     }

-#if DO_SATA1

     else if (AsciiStrCmp(Table->Pathname, "_SB_.AHC1._STA") == 0) {

-      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset], EnableOnB1);

+      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset],

+        EnableOnB1 && FixedPcdGet8(PcdSata1PortCount) > 0);

     }

-#else

-    else if (AsciiStrCmp(Table->Pathname, "_SB_.AHC1._STA") == 0) {

-      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset], FALSE);

-    }

-#endif

     else if (AsciiStrCmp(Table->Pathname, "_SB_.GIO2._STA") == 0) {

       OverrideStatus ((UINT8 *)&AmlCode[Table->Offset], EnableOnB1);

     }