[Linaro-uefi,v2,6/8] Platforms/AMD/Styx/AcpiTables: enable second SATA controller

Message ID 1481017548-16050-7-git-send-email-ard.biesheuvel@linaro.org
State Superseded
Headers show

Commit Message

Ard Biesheuvel Dec. 6, 2016, 9:45 a.m.
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>
---
 Platforms/AMD/Styx/AcpiTables/AcpiTables.inf | 1 +
 Platforms/AMD/Styx/AcpiTables/Dsdt.c         | 9 ++-------
 2 files changed, 3 insertions(+), 7 deletions(-)

Patch

diff --git a/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf b/Platforms/AMD/Styx/AcpiTables/AcpiTables.inf
index 72272aa0b85a..12e0444009ef 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 922d7214adf4..360a446f7631 100644
--- a/Platforms/AMD/Styx/AcpiTables/Dsdt.c
+++ b/Platforms/AMD/Styx/AcpiTables/Dsdt.c
@@ -174,15 +174,10 @@  DsdtHeader (
     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);
-    }
-#else
-    else if (AsciiStrCmp(Table->Pathname, "_SB_.AHC1._STA") == 0) {
-      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset], FALSE);
+      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset],
+        EnableOnB1 && FixedPcdGet8(PcdSata1PortCount) > 0);
     }
-#endif
     else if (AsciiStrCmp(Table->Pathname, "_SB_.GIO2._STA") == 0) {
       OverrideStatus ((UINT8 *)&AmlCode[Table->Offset], EnableOnB1);
     }