public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more
@ 2018-12-05 18:50 Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 1/6] Silicon/AMD/Styx: move SOC version macros to common header Ard Biesheuvel
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-05 18:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, alan, graeme.gregory, Ard Biesheuvel

Primarily, this series gets rid of the hacked up way this platform
patches the DSDT at build time, by #include'ing intermediate output
of the iasl compiler [or some version of it, at least]

While at it, apply some other cleanups/improvements.

Ard Biesheuvel (6):
  Silicon/AMD/Styx: move SOC version macros to common header
  Silicon/AMD/Styx: move B1 revision peripherals to separate SSDT table
  Silicon/AMD/Styx: move XGBE declarations to separate SSDT table
  Silicon/AMD/Styx: emit DSDT as aml directly
  Platform: add acpiview to Seattle/Styx platforms
  Platform/AMD/OverdriveBoard: use default resolution for GOP

 .../AMD/OverdriveBoard/OverdriveBoard.dsc     |   7 +-
 Platform/LeMaker/CelloBoard/CelloBoard.dsc    |   5 +-
 .../Overdrive1000Board/Overdrive1000Board.dsc |   4 +-
 .../AMD/OverdriveBoard/OverdriveBoard.fdf     |   2 +-
 Platform/LeMaker/CelloBoard/CelloBoard.fdf    |   2 +-
 .../Overdrive1000Board/Overdrive1000Board.fdf |   2 +-
 Silicon/AMD/Styx/AcpiTables/AcpiAml.inf       |  29 ---
 Silicon/AMD/Styx/AcpiTables/AcpiTables.inf    |   3 -
 .../AcpiPlatformDxe/AcpiPlatformDxe.inf       |  13 ++
 Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h      |   1 -
 Silicon/AMD/Styx/Common/SocVersion.h          |  19 ++
 Silicon/AMD/Styx/AcpiTables/Dsdt.c            | 192 ------------------
 Silicon/AMD/Styx/AcpiTables/Iort.c            |   6 +-
 .../Drivers/AcpiPlatformDxe/AcpiPlatform.c    | 137 ++++++++++++-
 .../StyxSataPlatformDxe/InitController.c      |   7 +-
 .../StyxDtbLoaderLib/StyxDtbLoaderLib.c       |   7 +-
 .../AcpiPlatformDxe}/Dsdt.asl                 | 180 ----------------
 .../Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl   |  86 ++++++++
 .../Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl | 135 ++++++++++++
 19 files changed, 395 insertions(+), 442 deletions(-)
 delete mode 100644 Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
 create mode 100644 Silicon/AMD/Styx/Common/SocVersion.h
 delete mode 100644 Silicon/AMD/Styx/AcpiTables/Dsdt.c
 rename Silicon/AMD/Styx/{AcpiTables => Drivers/AcpiPlatformDxe}/Dsdt.asl (72%)
 create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
 create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl

-- 
2.19.2



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH edk2-platforms 1/6] Silicon/AMD/Styx: move SOC version macros to common header
  2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
@ 2018-12-05 18:50 ` Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 2/6] Silicon/AMD/Styx: move B1 revision peripherals to separate SSDT table Ard Biesheuvel
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-05 18:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, alan, graeme.gregory, Ard Biesheuvel

Instead of adding yet another redefinition in the next patch, move
the silicon revision testing macros into a shared header file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Silicon/AMD/Styx/Common/SocVersion.h                          | 19 +++++++++++++++++++
 Silicon/AMD/Styx/AcpiTables/Iort.c                            |  6 +-----
 Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c |  7 ++-----
 Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c  |  7 ++-----
 4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/Silicon/AMD/Styx/Common/SocVersion.h b/Silicon/AMD/Styx/Common/SocVersion.h
new file mode 100644
index 000000000000..fc270b7c3431
--- /dev/null
+++ b/Silicon/AMD/Styx/Common/SocVersion.h
@@ -0,0 +1,19 @@
+#/** @file
+#  SoC specific defines
+#
+#  Copyright (c) 2018 Linaro, Ltd. All rights reserved.<BR>
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution.  The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#**/
+
+#define STYX_SOC_VERSION_MASK    0xFFF
+#define STYX_SOC_VERSION_A0      0x000
+#define STYX_SOC_VERSION_B0      0x010
+#define STYX_SOC_VERSION_B1      0x011
diff --git a/Silicon/AMD/Styx/AcpiTables/Iort.c b/Silicon/AMD/Styx/AcpiTables/Iort.c
index 370e71e13610..9c232379eff5 100644
--- a/Silicon/AMD/Styx/AcpiTables/Iort.c
+++ b/Silicon/AMD/Styx/AcpiTables/Iort.c
@@ -14,6 +14,7 @@
 
 #include <AmdStyxAcpiLib.h>
 #include <IndustryStandard/IoRemappingTable.h>
+#include <SocVersion.h>
 
 #define FIELD_OFFSET(type, name)            __builtin_offsetof(type, name)
 
@@ -354,11 +355,6 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
 
 #pragma pack()
 
-#define STYX_SOC_VERSION_MASK    0xFFF
-#define STYX_SOC_VERSION_A0      0x000
-#define STYX_SOC_VERSION_B0      0x010
-#define STYX_SOC_VERSION_B1      0x011
-
 EFI_ACPI_DESCRIPTION_HEADER *
 IortHeader (
   VOID
diff --git a/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c b/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c
index ea49cae9890f..1d2bca3d57ba 100644
--- a/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c
+++ b/Silicon/AMD/Styx/Drivers/StyxSataPlatformDxe/InitController.c
@@ -22,6 +22,8 @@
 
 #include <Protocol/NonDiscoverableDevice.h>
 
+#include <SocVersion.h>
+
 STATIC
 VOID
 ResetSataController (
@@ -144,11 +146,6 @@ InitializeSataController (
            AhciBaseAddr, SIZE_4KB);
 }
 
-#define STYX_SOC_VERSION_MASK    0xFFF
-#define STYX_SOC_VERSION_A0      0x000
-#define STYX_SOC_VERSION_B0      0x010
-#define STYX_SOC_VERSION_B1      0x011
-
 EFI_STATUS
 EFIAPI
 StyxSataPlatformDxeEntryPoint (
diff --git a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
index 7e8f918b11b4..b9dfa2367ab2 100644
--- a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
+++ b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
@@ -28,6 +28,8 @@
 
 #include <Protocol/AmdMpCoreInfo.h>
 
+#include <SocVersion.h>
+
 #define PMU_INT_FLAG_SPI        0
 #define PMU_INT_TYPE_HIGH_LEVEL 4
 
@@ -230,11 +232,6 @@ DisableSmmu (
   }
 }
 
-#define STYX_SOC_VERSION_MASK    0xFFF
-#define STYX_SOC_VERSION_A0      0x000
-#define STYX_SOC_VERSION_B0      0x010
-#define STYX_SOC_VERSION_B1      0x011
-
 STATIC
 VOID
 SetSocIdStatus (
-- 
2.19.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH edk2-platforms 2/6] Silicon/AMD/Styx: move B1 revision peripherals to separate SSDT table
  2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 1/6] Silicon/AMD/Styx: move SOC version macros to common header Ard Biesheuvel
@ 2018-12-05 18:50 ` Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 3/6] Silicon/AMD/Styx: move XGBE declarations " Ard Biesheuvel
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-05 18:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, alan, graeme.gregory, Ard Biesheuvel

Instead of poking DSDT _STA method bytecode to make it return something
else depending on whether we are running on B1 silicon, move the B1 only
peripherals to a separate SSDT and only install it when running on
compatible hardware.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.fdf               |  1 +
 Platform/LeMaker/CelloBoard/CelloBoard.fdf                   |  1 +
 Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf  |  1 +
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf |  7 ++
 Silicon/AMD/Styx/AcpiTables/Dsdt.c                           | 39 ---------
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c      | 62 ++++++++++++--
 Silicon/AMD/Styx/AcpiTables/Dsdt.asl                         | 67 ---------------
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl          | 86 ++++++++++++++++++++
 8 files changed, 150 insertions(+), 114 deletions(-)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
index bf4e6f3283eb..cc082031621c 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
@@ -454,6 +454,7 @@ CAPSULE_HEADER_INIT_VERSION = 0x1
     DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
     PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
     UI           STRING="$(MODULE_NAME)" Optional
+    RAW          ASL                    Optional    |.aml
   }
 
 [Rule.Common.DXE_RUNTIME_DRIVER]
diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.fdf b/Platform/LeMaker/CelloBoard/CelloBoard.fdf
index 0f412ba90e54..45fc850c36cb 100644
--- a/Platform/LeMaker/CelloBoard/CelloBoard.fdf
+++ b/Platform/LeMaker/CelloBoard/CelloBoard.fdf
@@ -365,6 +365,7 @@ READ_LOCK_STATUS   = TRUE
     DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
     PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
     UI           STRING="$(MODULE_NAME)" Optional
+    RAW          ASL                    Optional    |.aml
   }
 
 [Rule.Common.DXE_RUNTIME_DRIVER]
diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf
index 2800d5d1f536..fec3acdd767c 100644
--- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf
+++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf
@@ -367,6 +367,7 @@ READ_LOCK_STATUS   = TRUE
     DXE_DEPEX    DXE_DEPEX              Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
     PE32         PE32                   $(INF_OUTPUT)/$(MODULE_NAME).efi
     UI           STRING="$(MODULE_NAME)" Optional
+    RAW          ASL                    Optional    |.aml
   }
 
 [Rule.Common.DXE_RUNTIME_DRIVER]
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 3c484c43ac41..245724aa8ea2 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -28,6 +28,7 @@
 
 [Sources]
   AcpiPlatform.c
+  SsdtB1.asl
 
 [Packages]
   ArmPkg/ArmPkg.dec
@@ -39,12 +40,18 @@
 [LibraryClasses]
   AmdStyxAcpiLib
   DebugLib
+  DxeServicesLib
+  MemoryAllocationLib
   PcdLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
 
 [Pcd]
   gAmdStyxTokenSpaceGuid.PcdEnableSmmus
+  gAmdStyxTokenSpaceGuid.PcdSocCpuId
+
+[FixedPcd]
+  gAmdStyxTokenSpaceGuid.PcdSata1PortCount
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     ## ALWAYS_CONSUMED
diff --git a/Silicon/AMD/Styx/AcpiTables/Dsdt.c b/Silicon/AMD/Styx/AcpiTables/Dsdt.c
index 360a446f7631..dd432ce03ad1 100644
--- a/Silicon/AMD/Styx/AcpiTables/Dsdt.c
+++ b/Silicon/AMD/Styx/AcpiTables/Dsdt.c
@@ -130,41 +130,12 @@ OverrideMacAddr (
   }
 }
 
-VOID
-OverrideStatus (
-  IN UINT8 *DSD_Data,
-  IN BOOLEAN Enable
-  )
-{
-  if (Enable) {
-    // AML encoding: ReturnOp + BytePrefix
-    if (DSD_Data[1] == 0xA4 && DSD_Data[2] == 0x0A) {
-      DSD_Data[3] = 0x0F;
-    }
-  } else {
-    // AML encoding: ReturnOp
-    if (DSD_Data[1] == 0xA4) {
-      // AML encoding: BytePrefix?
-      if (DSD_Data[2] == 0x0A) {
-        DSD_Data[3] = 0x00;
-      } else {
-        DSD_Data[2] = 0x00;
-      }
-    }
-  }
-}
-
 EFI_ACPI_DESCRIPTION_HEADER *
 DsdtHeader (
   VOID
   )
 {
   AML_OFFSET_TABLE_ENTRY *Table;
-  BOOLEAN                EnableOnB1;
-  UINT32                 CpuId = PcdGet32 (PcdSocCpuId);
-
-  // Enable features on Styx-B1 or later
-  EnableOnB1 = (CpuId & 0xFF0) && (CpuId & 0x00F);
 
   Table = &DSDT_SEATTLE__OffsetTable[0];
   while (Table->Pathname) {
@@ -174,16 +145,6 @@ DsdtHeader (
     else if (AsciiStrCmp(Table->Pathname, "_SB_.ETH1._DSD") == 0) {
       OverrideMacAddr ((UINT8 *)&AmlCode[Table->Offset], PcdGet64 (PcdEthMacB));
     }
-    else if (AsciiStrCmp(Table->Pathname, "_SB_.AHC1._STA") == 0) {
-      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset],
-        EnableOnB1 && FixedPcdGet8(PcdSata1PortCount) > 0);
-    }
-    else if (AsciiStrCmp(Table->Pathname, "_SB_.GIO2._STA") == 0) {
-      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset], EnableOnB1);
-    }
-    else if (AsciiStrCmp(Table->Pathname, "_SB_.GIO3._STA") == 0) {
-      OverrideStatus ((UINT8 *)&AmlCode[Table->Offset], EnableOnB1);
-    }
 
     ++Table;
   }
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
index 901eac105932..0d0033b4d6c6 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
@@ -24,13 +24,57 @@
 
 #include <Library/BaseMemoryLib.h>
 #include <Library/DebugLib.h>
+#include <Library/DxeServicesLib.h>
+#include <Library/MemoryAllocationLib.h>
 #include <Library/PcdLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 
+#include <IndustryStandard/Acpi61.h>
+
+#include <SocVersion.h>
+
 #define MAX_ACPI_TABLES    16
 
 EFI_ACPI_DESCRIPTION_HEADER *AcpiTableList[MAX_ACPI_TABLES];
 
+STATIC EFI_ACPI_TABLE_PROTOCOL   *mAcpiTableProtocol;
+
+STATIC
+VOID
+InstallSystemDescriptionTables (
+  VOID
+  )
+{
+  EFI_ACPI_DESCRIPTION_HEADER   *Table;
+  EFI_STATUS                    Status;
+  UINT32                        CpuId;
+  UINTN                         Index;
+  UINTN                         TableSize;
+  UINTN                         TableHandle;
+
+  Status = EFI_SUCCESS;
+  for (Index = 0; !EFI_ERROR (Status); Index++) {
+    Status = GetSectionFromFv (&gEfiCallerIdGuid, EFI_SECTION_RAW, Index,
+               (VOID **) &Table, &TableSize);
+    if (EFI_ERROR (Status)) {
+      break;
+    }
+
+    switch (Table->OemTableId) {
+    case SIGNATURE_64 ('S', 't', 'y', 'x', 'B', '1', ' ', ' '):
+      CpuId = PcdGet32 (PcdSocCpuId);
+      if ((CpuId & STYX_SOC_VERSION_MASK) < STYX_SOC_VERSION_B1) {
+        continue;
+      }
+      break;
+    }
+
+    Status = mAcpiTableProtocol->InstallAcpiTable (mAcpiTableProtocol, Table,
+                                   TableSize, &TableHandle);
+    ASSERT_EFI_ERROR (Status);
+    FreePool (Table);
+  }
+}
 
 /**
   Entrypoint of Acpi Platform driver.
@@ -51,7 +95,6 @@ AcpiPlatformEntryPoint (
   )
 {
   EFI_STATUS                Status;
-  EFI_ACPI_TABLE_PROTOCOL   *AcpiTable;
   UINTN                     TableHandle;
   UINTN                     TableIndex;
 
@@ -77,7 +120,8 @@ AcpiPlatformEntryPoint (
   //
   // Find the AcpiTable protocol
   //
-  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
+  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL,
+                  (VOID**)&mAcpiTableProtocol);
   if (EFI_ERROR (Status)) {
     DEBUG((EFI_D_ERROR, "Failed to locate AcpiTable protocol. Status = %r\n", Status));
     ASSERT_EFI_ERROR(Status);
@@ -96,12 +140,12 @@ AcpiPlatformEntryPoint (
                           AcpiTableList[TableIndex]->Revision,
                           AcpiTableList[TableIndex]->Length));
 
-    Status = AcpiTable->InstallAcpiTable (
-                            AcpiTable,
-                            AcpiTableList[TableIndex],
-                            (AcpiTableList[TableIndex])->Length,
-                            &TableHandle
-                            );
+    Status = mAcpiTableProtocol->InstallAcpiTable (
+                                   mAcpiTableProtocol,
+                                   AcpiTableList[TableIndex],
+                                   (AcpiTableList[TableIndex])->Length,
+                                   &TableHandle
+                                   );
     if (EFI_ERROR (Status)) {
       DEBUG((DEBUG_ERROR,"Error adding ACPI Table. Status = %r\n", Status));
       ASSERT_EFI_ERROR(Status);
@@ -110,6 +154,8 @@ AcpiPlatformEntryPoint (
     ASSERT( TableIndex < MAX_ACPI_TABLES );
   }
 
+  InstallSystemDescriptionTables ();
+
   return EFI_SUCCESS;
 }
 
diff --git a/Silicon/AMD/Styx/AcpiTables/Dsdt.asl b/Silicon/AMD/Styx/AcpiTables/Dsdt.asl
index 4741bb487cc7..e9991644e6a0 100644
--- a/Silicon/AMD/Styx/AcpiTables/Dsdt.asl
+++ b/Silicon/AMD/Styx/AcpiTables/Dsdt.asl
@@ -105,35 +105,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "AMDINC", "SEATTLE ", 3)
             })
         }
 
-        Device (AHC1)
-        {
-            Name (_HID, "AMDI0600")  // _HID: Hardware ID
-            Name (_UID, 0x01)  // _UID: Unique ID
-            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
-            Name (_CLS, Package (0x03)  // _CLS: Class Code
-            {
-                0x01,
-                0x06,
-                0x01
-            })
-            Method (_STA)
-            {
-                 Return (0x0F)
-            }
-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
-            {
-                Memory32Fixed (ReadWrite,
-                    0xE0D00000,         // Address Base (MMIO)
-                    0x00010000,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE000007C,         // Address Base (SGPIO)
-                    0x00000001,         // Address Length
-                    )
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000182, }
-            })
-        }
-
 #if DO_XGBE
         Device (ETH0)
         {
@@ -344,44 +315,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "AMDINC", "SEATTLE ", 3)
             })
         }
 
-        Device (GIO2)
-        {
-            Name (_HID, "AMDI0400")  // _HID: Hardware ID
-            Name (_CID, "ARMH0061")  // _CID: Compatible ID
-            Name (_UID, 0x02)  // _UID: Unique ID
-            Method (_STA)
-            {
-                 Return (0x0F)
-            }
-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
-            {
-                Memory32Fixed (ReadWrite,
-                    0xE0020000,         // Address Base
-                    0x00001000,         // Address Length
-                    )
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x0000018E, }
-            })
-        }
-
-        Device (GIO3)
-        {
-            Name (_HID, "AMDI0400")  // _HID: Hardware ID
-            Name (_CID, "ARMH0061")  // _CID: Compatible ID
-            Name (_UID, 0x03)  // _UID: Unique ID
-            Method (_STA)
-            {
-                 Return (0x0F)
-            }
-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
-            {
-                Memory32Fixed (ReadWrite,
-                    0xE0030000,         // Address Base
-                    0x00001000,         // Address Length
-                    )
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x0000018D, }
-            })
-        }
-
         Device (I2C0)
         {
             Name (_HID, "AMDI0510")  // _HID: Hardware ID
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
new file mode 100644
index 000000000000..78aa220a0457
--- /dev/null
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
@@ -0,0 +1,86 @@
+/** @file
+
+  SSDT for peripherals that are only enabled on B1 silicon
+
+  Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
+  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
+  Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+DefinitionBlock ("SsdtB1.aml", "SSDT", 2, "AMDINC", "StyxB1  ", 3)
+{
+    Scope (_SB)
+    {
+        Device (AHC1)
+        {
+            Name (_HID, "AMDI0600")  // _HID: Hardware ID
+            Name (_UID, 0x01)  // _UID: Unique ID
+            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
+            Name (_CLS, Package (0x03)  // _CLS: Class Code
+            {
+                0x01,
+                0x06,
+                0x01
+            })
+            Method (_STA)
+            {
+                If (LEqual (FixedPcdGet8 (PcdSata1PortCount), 0)) {
+                    Return (0x0)
+                }
+                Return (0xF)
+            }
+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+            {
+                Memory32Fixed (ReadWrite,
+                    0xE0D00000,         // Address Base (MMIO)
+                    0x00010000,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE000007C,         // Address Base (SGPIO)
+                    0x00000001,         // Address Length
+                    )
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000182, }
+            })
+        }
+
+        Device (GIO2)
+        {
+            Name (_HID, "AMDI0400")  // _HID: Hardware ID
+            Name (_CID, "ARMH0061")  // _CID: Compatible ID
+            Name (_UID, 0x02)  // _UID: Unique ID
+
+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+            {
+                Memory32Fixed (ReadWrite,
+                    0xE0020000,         // Address Base
+                    0x00001000,         // Address Length
+                    )
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x0000018E, }
+            })
+        }
+
+        Device (GIO3)
+        {
+            Name (_HID, "AMDI0400")  // _HID: Hardware ID
+            Name (_CID, "ARMH0061")  // _CID: Compatible ID
+            Name (_UID, 0x03)  // _UID: Unique ID
+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+            {
+                Memory32Fixed (ReadWrite,
+                    0xE0030000,         // Address Base
+                    0x00001000,         // Address Length
+                    )
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x0000018D, }
+            })
+        }
+    }
+}
-- 
2.19.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH edk2-platforms 3/6] Silicon/AMD/Styx: move XGBE declarations to separate SSDT table
  2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 1/6] Silicon/AMD/Styx: move SOC version macros to common header Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 2/6] Silicon/AMD/Styx: move B1 revision peripherals to separate SSDT table Ard Biesheuvel
@ 2018-12-05 18:50 ` Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 4/6] Silicon/AMD/Styx: emit DSDT as aml directly Ard Biesheuvel
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-05 18:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, alan, graeme.gregory, Ard Biesheuvel

Move the XGBE out of the DSDT, and along with it the logic that patches
the correct MAC address into the device nodes. However, this time we
patch the SSDT binary directly rather than relying on intermediate output
of an outdated version of the iasl compiler.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Silicon/AMD/Styx/AcpiTables/AcpiTables.inf                   |   2 -
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf |   5 +
 Silicon/AMD/Styx/AcpiTables/Dsdt.c                           | 127 ------------------
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c      |  74 +++++++++++
 Silicon/AMD/Styx/AcpiTables/Dsdt.asl                         | 113 ----------------
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl        | 135 ++++++++++++++++++++
 6 files changed, 214 insertions(+), 242 deletions(-)

diff --git a/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf b/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf
index 4ae64ac22665..692717950f40 100644
--- a/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf
+++ b/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf
@@ -58,8 +58,6 @@
 [Pcd]
   gAmdStyxTokenSpaceGuid.PcdSocCoreCount
   gAmdStyxTokenSpaceGuid.PcdSocCpuId
-  gAmdStyxTokenSpaceGuid.PcdEthMacA
-  gAmdStyxTokenSpaceGuid.PcdEthMacB
 
 [FixedPcd]
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 245724aa8ea2..cc2320e4262d 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -29,6 +29,7 @@
 [Sources]
   AcpiPlatform.c
   SsdtB1.asl
+  SsdtXgbe.asl
 
 [Packages]
   ArmPkg/ArmPkg.dec
@@ -39,6 +40,8 @@
 
 [LibraryClasses]
   AmdStyxAcpiLib
+  BaseLib
+  BaseMemoryLib
   DebugLib
   DxeServicesLib
   MemoryAllocationLib
@@ -47,6 +50,8 @@
   UefiDriverEntryPoint
 
 [Pcd]
+  gAmdStyxTokenSpaceGuid.PcdEthMacA
+  gAmdStyxTokenSpaceGuid.PcdEthMacB
   gAmdStyxTokenSpaceGuid.PcdEnableSmmus
   gAmdStyxTokenSpaceGuid.PcdSocCpuId
 
diff --git a/Silicon/AMD/Styx/AcpiTables/Dsdt.c b/Silicon/AMD/Styx/AcpiTables/Dsdt.c
index dd432ce03ad1..25e654acabbc 100644
--- a/Silicon/AMD/Styx/AcpiTables/Dsdt.c
+++ b/Silicon/AMD/Styx/AcpiTables/Dsdt.c
@@ -15,139 +15,12 @@
 **/
 
 #include <AmdStyxAcpiLib.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-
 #include <Dsdt.hex>
-#include <Dsdt.offset.h>
-
-
-UINTN
-ShiftLeftByteToUlong (
-  IN UINT8 Byte,
-  IN UINTN Shift
-  )
-{
-  UINTN Data;
-
-  Data = (UINTN)Byte;
-  Data <<= Shift;
-  return Data;
-}
-
-UINTN
-AmlGetPkgLength (
-  IN UINT8 *Buffer,
-  OUT UINTN *PkgLength
-  )
-{
-  UINTN Bytes, Length;
-
-  Bytes = (UINTN)((Buffer[0] >> 6) & 0x3) + 1;
-  switch (Bytes) {
-    case 1:
-      Length = (UINTN)Buffer[0];
-      break;
-
-    case 2:
-      Length = ShiftLeftByteToUlong(Buffer[1], 4) +
-                (UINTN)(Buffer[0] & 0x0F);
-      break;
-
-    case 3:
-      Length = ShiftLeftByteToUlong(Buffer[2], 12) +
-                ShiftLeftByteToUlong(Buffer[1], 4) +
-                 (UINTN)(Buffer[0] & 0x0F);
-      break;
-
-    default: /* 4 bytes */
-      Length = ShiftLeftByteToUlong(Buffer[3], 20) +
-                ShiftLeftByteToUlong(Buffer[2], 12) +
-                 ShiftLeftByteToUlong(Buffer[1], 4) +
-                  (UINTN)(Buffer[0] & 0x0F);
-      break;
-  }
-
-  *PkgLength = Length;
-  return Bytes;
-}
-
-UINT8 *
-AmlSearchStringPackage (
-  IN UINT8 *Buffer,
-  IN UINTN Length,
-  IN CHAR8 *String
-  )
-{
-  UINTN StrLength;
-
-  StrLength = AsciiStrLen (String) + 1;
-  if (Length > StrLength ) {
-    Length -= StrLength;
-    while (AsciiStrCmp((CHAR8 *)Buffer, String) != 0 && Length) {
-      --Length;
-      ++Buffer;
-    }
-    if (Length) {
-      return &Buffer[StrLength];
-    }
-  }
-  return NULL;
-}
-
-VOID
-OverrideMacAddr (
-  IN UINT8 *DSD_Data,
-  IN UINT64 MacAddr
-  )
-{
-  UINT8 *MacAddrPkg;
-  UINTN Bytes, Length, Index = 0;
-
-  // AML encoding: PackageOp
-  if (DSD_Data[0] == 0x12) {
-    // AML encoding: PkgLength
-    Bytes = AmlGetPkgLength (&DSD_Data[1], &Length);
-
-    // Search for "mac-address" property
-    MacAddrPkg = AmlSearchStringPackage (&DSD_Data[Bytes + 1],
-                                        Length - Bytes,
-                                        "mac-address");
-    if (MacAddrPkg &&
-        MacAddrPkg[0] == 0x12 &&        // PackageOp
-        MacAddrPkg[1] == 0x0E &&        // PkgLength
-        MacAddrPkg[2] == 0x06) {        // NumElements (element must have a BytePrefix)
-
-      MacAddrPkg += 3;
-      do {
-        MacAddrPkg[0] = 0x0A;           // BytePrefix
-        MacAddrPkg[1] = (UINT8)(MacAddr & 0xFF);
-        MacAddrPkg += 2;
-        MacAddr >>= 8;
-      } while (++Index < 6);
-    }
-  }
-}
 
 EFI_ACPI_DESCRIPTION_HEADER *
 DsdtHeader (
   VOID
   )
 {
-  AML_OFFSET_TABLE_ENTRY *Table;
-
-  Table = &DSDT_SEATTLE__OffsetTable[0];
-  while (Table->Pathname) {
-    if (AsciiStrCmp(Table->Pathname, "_SB_.ETH0._DSD") == 0) {
-      OverrideMacAddr ((UINT8 *)&AmlCode[Table->Offset], PcdGet64 (PcdEthMacA));
-    }
-    else if (AsciiStrCmp(Table->Pathname, "_SB_.ETH1._DSD") == 0) {
-      OverrideMacAddr ((UINT8 *)&AmlCode[Table->Offset], PcdGet64 (PcdEthMacB));
-    }
-
-    ++Table;
-  }
-
   return (EFI_ACPI_DESCRIPTION_HEADER *) &AmlCode[0];
 }
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
index 0d0033b4d6c6..460fb4c480c3 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
@@ -22,6 +22,7 @@
 #include <AmdStyxAcpiLib.h>
 #include <Protocol/AcpiTable.h>
 
+#include <Library/BaseLib.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/DebugLib.h>
 #include <Library/DxeServicesLib.h>
@@ -39,6 +40,57 @@ EFI_ACPI_DESCRIPTION_HEADER *AcpiTableList[MAX_ACPI_TABLES];
 
 STATIC EFI_ACPI_TABLE_PROTOCOL   *mAcpiTableProtocol;
 
+#if DO_XGBE
+
+STATIC CONST UINT8 mDefaultMacPackageA[] = {
+  0x12, 0xe, 0x6, 0xa, 0x2, 0xa, 0xa1, 0xa, 0xa2, 0xa, 0xa3, 0xa, 0xa4, 0xa, 0xa5
+};
+
+STATIC CONST UINT8 mDefaultMacPackageB[] = {
+  0x12, 0xe, 0x6, 0xa, 0x2, 0xa, 0xb1, 0xa, 0xb2, 0xa, 0xb3, 0xa, 0xb4, 0xa, 0xb5
+};
+
+#define PACKAGE_MAC_OFFSET  4
+#define PACKAGE_MAC_INCR    2
+
+STATIC
+VOID
+SetPackageAddress (
+  UINT8         *Package,
+  UINT64        MacAddress,
+  UINTN         Size
+  )
+{
+  UINTN   Index;
+
+  for (Index = PACKAGE_MAC_OFFSET; Index < Size; Index += PACKAGE_MAC_INCR) {
+    Package[Index] = (UINT8)MacAddress;
+    MacAddress >>= 8;
+  }
+}
+
+STATIC
+VOID
+PatchAmlPackage (
+  CONST UINT8   *Pattern,
+  CONST UINT8   *Replacement,
+  UINTN         PatternLength,
+  UINT8         *SsdtTable,
+  UINTN         TableSize
+  )
+{
+  UINTN         Offset;
+
+  for (Offset = 0; Offset < (TableSize - PatternLength); Offset++) {
+    if (CompareMem (SsdtTable + Offset, Pattern, PatternLength) == 0) {
+      CopyMem (SsdtTable + Offset, Replacement, PatternLength);
+      break;
+    }
+  }
+}
+
+#endif
+
 STATIC
 VOID
 InstallSystemDescriptionTables (
@@ -51,6 +103,9 @@ InstallSystemDescriptionTables (
   UINTN                         Index;
   UINTN                         TableSize;
   UINTN                         TableHandle;
+#if DO_XGBE
+  UINT8                         MacPackage[sizeof(mDefaultMacPackageA)];
+#endif
 
   Status = EFI_SUCCESS;
   for (Index = 0; !EFI_ERROR (Status); Index++) {
@@ -67,6 +122,25 @@ InstallSystemDescriptionTables (
         continue;
       }
       break;
+
+    case SIGNATURE_64 ('S', 't', 'y', 'x', 'X', 'g', 'b', 'e'):
+#if DO_XGBE
+      //
+      // Patch the SSDT binary with the correct MAC addresses
+      //
+      CopyMem (MacPackage, mDefaultMacPackageA, sizeof (MacPackage));
+
+      SetPackageAddress (MacPackage, PcdGet64 (PcdEthMacA), sizeof (MacPackage));
+      PatchAmlPackage (mDefaultMacPackageA, MacPackage, sizeof (MacPackage),
+        (UINT8 *)Table, TableSize);
+
+      SetPackageAddress (MacPackage, PcdGet64 (PcdEthMacB), sizeof (MacPackage));
+      PatchAmlPackage (mDefaultMacPackageB, MacPackage, sizeof (MacPackage),
+        (UINT8 *)Table, TableSize);
+
+      break;
+#endif
+      continue;
     }
 
     Status = mAcpiTableProtocol->InstallAcpiTable (mAcpiTableProtocol, Table,
diff --git a/Silicon/AMD/Styx/AcpiTables/Dsdt.asl b/Silicon/AMD/Styx/AcpiTables/Dsdt.asl
index e9991644e6a0..c1417e7e1cd7 100644
--- a/Silicon/AMD/Styx/AcpiTables/Dsdt.asl
+++ b/Silicon/AMD/Styx/AcpiTables/Dsdt.asl
@@ -105,119 +105,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "AMDINC", "SEATTLE ", 3)
             })
         }
 
-#if DO_XGBE
-        Device (ETH0)
-        {
-            Name (_HID, "AMDI8001")  // _HID: Hardware ID
-            Name (_UID, 0x00)  // _UID: Unique ID
-            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
-
-            {
-                Memory32Fixed (ReadWrite,
-                    0xE0700000,         // Address Base (XGMAC)
-                    0x00010000,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE0780000,         // Address Base (XPCS)
-                    0x00080000,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE1240800,         // Address Base (SERDES_RxTx)
-                    0x00000400,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE1250000,         // Address Base (SERDES_IR_1)
-                    0x00000060,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE12500F8,         // Address Base (SERDES_IR_2)
-                    0x00000004,         // Address Length
-                    )
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000165, } // XGMAC
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017A, } // DMA0
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017B, } // DMA1
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017C, } // DMA2
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017D, } // DMA3
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000163, } // XPCS
-            })
-            Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
-            {
-                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package ()
-                {
-                    Package (0x02) {"mac-address", Package (0x06) {0x02, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}},
-                    Package (0x02) {"phy-mode", "xgmii"},
-                    Package (0x02) {"amd,speed-set", 0x00},
-                    Package (0x02) {"amd,dma-freq", 0x0EE6B280},
-                    Package (0x02) {"amd,ptp-freq",  0x0EE6B280},
-                    Package (0x02) {"amd,serdes-blwc", Package (0x03) {1, 1, 0}},
-                    Package (0x02) {"amd,serdes-cdr-rate", Package (0x03) {2, 2, 7}},
-                    Package (0x02) {"amd,serdes-pq-skew", Package (0x03) {10, 10, 18}},
-                    Package (0x02) {"amd,serdes-tx-amp", Package (0x03) {15, 15, 10}},
-                    Package (0x02) {"amd,serdes-dfe-tap-config", Package (0x03) {3, 3, 1}},
-                    Package (0x02) {"amd,serdes-dfe-tap-enable", Package (0x03) {0, 0, 127}},
-                    Package (0x02) {"amd,per-channel-interrupt", 0x01}
-                }
-            })
-        }
-
-        Device (ETH1)
-        {
-            Name (_HID, "AMDI8001")  // _HID: Hardware ID
-            Name (_UID, 0x01)  // _UID: Unique ID
-            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
-            {
-                Memory32Fixed (ReadWrite,
-                    0xE0900000,         // Address Base (XGMAC)
-                    0x00010000,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE0980000,         // Address Base (XPCS)
-                    0x00080000,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE1240C00,         // Address Base (SERDES_RxTx)
-                    0x00000400,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE1250080,         // Address Base (SERDES_IR_1)
-                    0x00000060,         // Address Length
-                    )
-                Memory32Fixed (ReadWrite,
-                    0xE12500FC,         // Address Base (SERDES_IR_2)
-                    0x00000004,         // Address Length
-                    )
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000164, } // XGMAC
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000175, } // DMA0
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000176, } // DMA1
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000177, } // DMA2
-                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000178, } // DMA3
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000162, } // XPCS
-            })
-            Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
-            {
-                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package ()
-                {
-                    Package (0x02) {"mac-address", Package (0x06) {0x02, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5}},
-                    Package (0x02) {"phy-mode", "xgmii"},
-                    Package (0x02) {"amd,speed-set", 0x00},
-                    Package (0x02) {"amd,dma-freq", 0x0EE6B280},
-                    Package (0x02) {"amd,ptp-freq",  0x0EE6B280},
-                    Package (0x02) {"amd,serdes-blwc", Package (0x03) {1, 1, 0}},
-                    Package (0x02) {"amd,serdes-cdr-rate", Package (0x03) {2, 2, 7}},
-                    Package (0x02) {"amd,serdes-pq-skew", Package (0x03) {10, 10, 18}},
-                    Package (0x02) {"amd,serdes-tx-amp", Package (0x03) {15, 15, 10}},
-                    Package (0x02) {"amd,serdes-dfe-tap-config", Package (0x03) {3, 3, 1}},
-                    Package (0x02) {"amd,serdes-dfe-tap-enable", Package (0x03) {0, 0, 127}},
-                    Package (0x02) {"amd,per-channel-interrupt", 0x01}
-                }
-            })
-        }
-#endif  // DO_XGBE
-
         Device (SPI0)
         {
             Name (_HID, "AMDI0500")  // _HID: Hardware ID
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl
new file mode 100644
index 000000000000..503c47365f15
--- /dev/null
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl
@@ -0,0 +1,135 @@
+/** @file
+
+  SSDT for 10GbE network controllers
+
+  Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
+  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
+  Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+DefinitionBlock ("SsdtXgbe.aml", "SSDT", 2, "AMDINC", "StyxXgbe", 3)
+{
+    Scope (_SB)
+    {
+        Device (ETH0)
+        {
+            Name (_HID, "AMDI8001")  // _HID: Hardware ID
+            Name (_UID, 0x00)  // _UID: Unique ID
+            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+
+            {
+                Memory32Fixed (ReadWrite,
+                    0xE0700000,         // Address Base (XGMAC)
+                    0x00010000,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE0780000,         // Address Base (XPCS)
+                    0x00080000,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE1240800,         // Address Base (SERDES_RxTx)
+                    0x00000400,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE1250000,         // Address Base (SERDES_IR_1)
+                    0x00000060,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE12500F8,         // Address Base (SERDES_IR_2)
+                    0x00000004,         // Address Length
+                    )
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000165, } // XGMAC
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017A, } // DMA0
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017B, } // DMA1
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017C, } // DMA2
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x0000017D, } // DMA3
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000163, } // XPCS
+            })
+            Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
+            {
+                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+                Package ()
+                {
+                    Package (0x02) {"mac-address", Package (0x06) {0x02, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5}},
+                    Package (0x02) {"phy-mode", "xgmii"},
+                    Package (0x02) {"amd,speed-set", 0x00},
+                    Package (0x02) {"amd,dma-freq", 0x0EE6B280},
+                    Package (0x02) {"amd,ptp-freq",  0x0EE6B280},
+                    Package (0x02) {"amd,serdes-blwc", Package (0x03) {1, 1, 0}},
+                    Package (0x02) {"amd,serdes-cdr-rate", Package (0x03) {2, 2, 7}},
+                    Package (0x02) {"amd,serdes-pq-skew", Package (0x03) {10, 10, 18}},
+                    Package (0x02) {"amd,serdes-tx-amp", Package (0x03) {15, 15, 10}},
+                    Package (0x02) {"amd,serdes-dfe-tap-config", Package (0x03) {3, 3, 1}},
+                    Package (0x02) {"amd,serdes-dfe-tap-enable", Package (0x03) {0, 0, 127}},
+                    Package (0x02) {"amd,per-channel-interrupt", 0x01}
+                }
+            })
+        }
+
+        Device (ETH1)
+        {
+            Name (_HID, "AMDI8001")  // _HID: Hardware ID
+            Name (_UID, 0x01)  // _UID: Unique ID
+            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+            {
+                Memory32Fixed (ReadWrite,
+                    0xE0900000,         // Address Base (XGMAC)
+                    0x00010000,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE0980000,         // Address Base (XPCS)
+                    0x00080000,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE1240C00,         // Address Base (SERDES_RxTx)
+                    0x00000400,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE1250080,         // Address Base (SERDES_IR_1)
+                    0x00000060,         // Address Length
+                    )
+                Memory32Fixed (ReadWrite,
+                    0xE12500FC,         // Address Base (SERDES_IR_2)
+                    0x00000004,         // Address Length
+                    )
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000164, } // XGMAC
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000175, } // DMA0
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000176, } // DMA1
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000177, } // DMA2
+                Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )  {0x00000178, } // DMA3
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000162, } // XPCS
+            })
+            Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
+            {
+                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+                Package ()
+                {
+                    Package (0x02) {"mac-address", Package (0x06) {0x02, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5}},
+                    Package (0x02) {"phy-mode", "xgmii"},
+                    Package (0x02) {"amd,speed-set", 0x00},
+                    Package (0x02) {"amd,dma-freq", 0x0EE6B280},
+                    Package (0x02) {"amd,ptp-freq",  0x0EE6B280},
+                    Package (0x02) {"amd,serdes-blwc", Package (0x03) {1, 1, 0}},
+                    Package (0x02) {"amd,serdes-cdr-rate", Package (0x03) {2, 2, 7}},
+                    Package (0x02) {"amd,serdes-pq-skew", Package (0x03) {10, 10, 18}},
+                    Package (0x02) {"amd,serdes-tx-amp", Package (0x03) {15, 15, 10}},
+                    Package (0x02) {"amd,serdes-dfe-tap-config", Package (0x03) {3, 3, 1}},
+                    Package (0x02) {"amd,serdes-dfe-tap-enable", Package (0x03) {0, 0, 127}},
+                    Package (0x02) {"amd,per-channel-interrupt", 0x01}
+                }
+            })
+        }
+    }
+}
+
-- 
2.19.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH edk2-platforms 4/6] Silicon/AMD/Styx: emit DSDT as aml directly
  2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
                   ` (2 preceding siblings ...)
  2018-12-05 18:50 ` [PATCH edk2-platforms 3/6] Silicon/AMD/Styx: move XGBE declarations " Ard Biesheuvel
@ 2018-12-05 18:50 ` Ard Biesheuvel
  2018-12-05 18:50 ` [PATCH edk2-platforms 5/6] Platform: add acpiview to Seattle/Styx platforms Ard Biesheuvel
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-05 18:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, alan, graeme.gregory, Ard Biesheuvel

Instead of emitting the DSDT by incorporating the intermediate output
of [some version of] the iasl compiler, move the DSDT source file to
the ACPI platform driver, which will install it directly. This permits
us to drop a lot of cruft related to handling of this intermediate
output.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc                    |  3 --
 Platform/LeMaker/CelloBoard/CelloBoard.dsc                        |  4 ---
 Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc       |  3 --
 Platform/AMD/OverdriveBoard/OverdriveBoard.fdf                    |  1 -
 Platform/LeMaker/CelloBoard/CelloBoard.fdf                        |  1 -
 Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf       |  1 -
 Silicon/AMD/Styx/AcpiTables/AcpiAml.inf                           | 29 --------------------
 Silicon/AMD/Styx/AcpiTables/AcpiTables.inf                        |  1 -
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf      |  1 +
 Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h                          |  1 -
 Silicon/AMD/Styx/AcpiTables/Dsdt.c                                | 26 ------------------
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c           |  1 -
 Silicon/AMD/Styx/{AcpiTables => Drivers/AcpiPlatformDxe}/Dsdt.asl |  0
 13 files changed, 1 insertion(+), 71 deletions(-)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index b062f671f57f..7c66af6128c5 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -272,8 +272,6 @@ DEFINE DO_CAPSULE   = FALSE
   GCC:*_*_AARCH64_ARCHCC_FLAGS = -DDO_XGBE=$(DO_XGBE) -DDO_KCS=$(DO_KCS) -DNUM_CORES=$(NUM_CORES) -DARM_CPU_AARCH64
   GCC:*_*_AARCH64_PP_FLAGS = -DDO_XGBE=$(DO_XGBE) -DDO_KCS=$(DO_KCS) -DNUM_CORES=$(NUM_CORES) -DARM_CPU_AARCH64
 
-  GCC:*_*_AARCH64_PLATFORM_FLAGS = -I$(BIN_DIR)/Silicon/AMD/Styx/AcpiTables/AcpiAml/OUTPUT
-
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
 
@@ -683,7 +681,6 @@ DEFINE DO_CAPSULE   = FALSE
       NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
   }
 
-  Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
   Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
index 103c2fb74114..7c22bbbfa90f 100644
--- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
+++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
@@ -264,8 +264,6 @@ DEFINE DO_FLASHER   = FALSE
   GCC:*_*_AARCH64_ARCHCC_FLAGS = -DDO_KCS=$(DO_KCS) -DNUM_CORES=$(NUM_CORES) -DARM_CPU_AARCH64
   GCC:*_*_AARCH64_PP_FLAGS = -DDO_KCS=$(DO_KCS) -DNUM_CORES=$(NUM_CORES) -DARM_CPU_AARCH64
 
-  GCC:*_*_AARCH64_PLATFORM_FLAGS = -I$(BIN_DIR)/Silicon/AMD/Styx/AcpiTables/AcpiAml/OUTPUT
-
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
 
@@ -617,8 +615,6 @@ DEFINE DO_FLASHER   = FALSE
     <LibraryClasses>
       NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
   }
-
-  Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
   Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
   #
diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
index 1927ef3ebafb..793bd5359a23 100644
--- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
+++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
@@ -262,8 +262,6 @@ DEFINE DO_FLASHER   = FALSE
   GCC:*_*_AARCH64_ARCHCC_FLAGS = -DDO_KCS=$(DO_KCS) -DNUM_CORES=$(NUM_CORES) -DARM_CPU_AARCH64
   GCC:*_*_AARCH64_PP_FLAGS = -DDO_KCS=$(DO_KCS) -DNUM_CORES=$(NUM_CORES) -DARM_CPU_AARCH64
 
-  GCC:*_*_AARCH64_PLATFORM_FLAGS = -I$(BIN_DIR)/Silicon/AMD/Styx/AcpiTables/AcpiAml/OUTPUT
-
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
 
@@ -612,7 +610,6 @@ DEFINE DO_FLASHER   = FALSE
     <LibraryClasses>
       NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
   }
-  Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
   Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
   #
diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
index cc082031621c..96df83e0da5a 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf
@@ -219,7 +219,6 @@ READ_LOCK_STATUS   = TRUE
   # ACPI Support
   #
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  INF RuleOverride=ACPITABLE Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
   INF Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
   INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.fdf b/Platform/LeMaker/CelloBoard/CelloBoard.fdf
index 45fc850c36cb..fc977f14b5a1 100644
--- a/Platform/LeMaker/CelloBoard/CelloBoard.fdf
+++ b/Platform/LeMaker/CelloBoard/CelloBoard.fdf
@@ -204,7 +204,6 @@ READ_LOCK_STATUS   = TRUE
   # ACPI Support
   #
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  INF RuleOverride=ACPITABLE Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
   INF Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
   #
diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf
index fec3acdd767c..8fc9a979aebc 100644
--- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf
+++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf
@@ -217,7 +217,6 @@ READ_LOCK_STATUS   = TRUE
   # ACPI Support
   #
   INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  INF RuleOverride=ACPITABLE Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
   INF Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
   #
diff --git a/Silicon/AMD/Styx/AcpiTables/AcpiAml.inf b/Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
deleted file mode 100644
index 08a7aabe8256..000000000000
--- a/Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
+++ /dev/null
@@ -1,29 +0,0 @@
-#/** @file
-#
-#  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
-#
-#  This program and the accompanying materials
-#  are licensed and made available under the terms and conditions of the BSD License
-#  which accompanies this distribution.  The full text of the license may be found at
-#  http://opensource.org/licenses/bsd-license.php
-#
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#**/
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = AcpiAml
-  FILE_GUID                      = 2df2a2ee-5f34-4dea-b4b6-da724e455f33
-  MODULE_TYPE                    = USER_DEFINED
-  VERSION_STRING                 = 1.0
-
-[Sources]
-  Dsdt.asl
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  Silicon/AMD/Styx/AmdStyx.dec
-
diff --git a/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf b/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf
index 692717950f40..0bc5b1e98964 100644
--- a/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf
+++ b/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf
@@ -36,7 +36,6 @@
   Madt.c
   Mcfg.c
   Csrt.c
-  Dsdt.c
   Iort.c
   Pptt.c
 
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
index cc2320e4262d..92f185fa4bee 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -28,6 +28,7 @@
 
 [Sources]
   AcpiPlatform.c
+  Dsdt.asl
   SsdtB1.asl
   SsdtXgbe.asl
 
diff --git a/Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h b/Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h
index 58e160b6d727..0dfd7635e897 100644
--- a/Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h
+++ b/Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h
@@ -22,7 +22,6 @@ EFI_ACPI_DESCRIPTION_HEADER *FadtTable (void);
 EFI_ACPI_DESCRIPTION_HEADER *FacsTable (void);
 EFI_ACPI_DESCRIPTION_HEADER *MadtHeader (void);
 EFI_ACPI_DESCRIPTION_HEADER *GtdtHeader (void);
-EFI_ACPI_DESCRIPTION_HEADER *DsdtHeader (void);
 EFI_ACPI_DESCRIPTION_HEADER *McfgHeader (void);
 EFI_ACPI_DESCRIPTION_HEADER *Dbg2Header (void);
 EFI_ACPI_DESCRIPTION_HEADER *SpcrHeader (void);
diff --git a/Silicon/AMD/Styx/AcpiTables/Dsdt.c b/Silicon/AMD/Styx/AcpiTables/Dsdt.c
deleted file mode 100644
index 25e654acabbc..000000000000
--- a/Silicon/AMD/Styx/AcpiTables/Dsdt.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/** @file
-
-  C language wrapper to build DSDT generated data.
-
-  Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.<BR>
-
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD License
-  which accompanies this distribution.  The full text of the license may be found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <AmdStyxAcpiLib.h>
-#include <Dsdt.hex>
-
-EFI_ACPI_DESCRIPTION_HEADER *
-DsdtHeader (
-  VOID
-  )
-{
-  return (EFI_ACPI_DESCRIPTION_HEADER *) &AmlCode[0];
-}
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
index 460fb4c480c3..a00bd3bd2215 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c
@@ -176,7 +176,6 @@ AcpiPlatformEntryPoint (
 
   TableIndex = 0;
   AcpiTableList[TableIndex++] = FadtTable();
-  AcpiTableList[TableIndex++] = DsdtHeader();
   AcpiTableList[TableIndex++] = MadtHeader();
   AcpiTableList[TableIndex++] = GtdtHeader();
   AcpiTableList[TableIndex++] = Dbg2Header();
diff --git a/Silicon/AMD/Styx/AcpiTables/Dsdt.asl b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl
similarity index 100%
rename from Silicon/AMD/Styx/AcpiTables/Dsdt.asl
rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl
-- 
2.19.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH edk2-platforms 5/6] Platform: add acpiview to Seattle/Styx platforms
  2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
                   ` (3 preceding siblings ...)
  2018-12-05 18:50 ` [PATCH edk2-platforms 4/6] Silicon/AMD/Styx: emit DSDT as aml directly Ard Biesheuvel
@ 2018-12-05 18:50 ` Ard Biesheuvel
  2018-12-05 21:39   ` Carsey, Jaben
  2018-12-05 18:50 ` [PATCH edk2-platforms 6/6] Platform/AMD/OverdriveBoard: use default resolution for GOP Ard Biesheuvel
  2018-12-10 21:58 ` [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Leif Lindholm
  6 siblings, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-05 18:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, alan, graeme.gregory, Ard Biesheuvel

Enable the 'acpiview' UEFI shell command so we can inspect the ACPI
tables at boot time.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc              | 1 +
 Platform/LeMaker/CelloBoard/CelloBoard.dsc                  | 1 +
 Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc | 1 +
 3 files changed, 3 insertions(+)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index 7c66af6128c5..ed67c986b7db 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -731,6 +731,7 @@ DEFINE DO_CAPSULE   = FALSE
       NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
       NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
       NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
       HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
       PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
       BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
index 7c22bbbfa90f..057bf0eb67de 100644
--- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
+++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
@@ -663,6 +663,7 @@ DEFINE DO_FLASHER   = FALSE
       NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
       NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
       NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
       HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
       PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
       BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
index 793bd5359a23..985ba2253a90 100644
--- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
+++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
@@ -658,6 +658,7 @@ DEFINE DO_FLASHER   = FALSE
       NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
       NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
       NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+      NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
       HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
       PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
       BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
-- 
2.19.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH edk2-platforms 6/6] Platform/AMD/OverdriveBoard: use default resolution for GOP
  2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
                   ` (4 preceding siblings ...)
  2018-12-05 18:50 ` [PATCH edk2-platforms 5/6] Platform: add acpiview to Seattle/Styx platforms Ard Biesheuvel
@ 2018-12-05 18:50 ` Ard Biesheuvel
  2018-12-10 21:58 ` [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Leif Lindholm
  6 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-05 18:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: leif.lindholm, alan, graeme.gregory, Ard Biesheuvel

Set the GOP resolution to 0x0 so that the resolution will be
chosen by the driver, usually based on the capabilities of
the connected display.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index ed67c986b7db..05433d4472e8 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -485,6 +485,9 @@ DEFINE DO_CAPSULE   = FALSE
   gAmdModulePkgTokenSpaceGuid.PcdPciePort2Present|1
   gAmdModulePkgTokenSpaceGuid.PcdPcieHardcodeEnumeration|TRUE
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0
+
 [PcdsDynamicDefault.common]
   gAmdStyxTokenSpaceGuid.PcdSocCoreCount|$(NUM_CORES)
   gArmTokenSpaceGuid.PcdSystemMemorySize|0x0400000000
-- 
2.19.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH edk2-platforms 5/6] Platform: add acpiview to Seattle/Styx platforms
  2018-12-05 18:50 ` [PATCH edk2-platforms 5/6] Platform: add acpiview to Seattle/Styx platforms Ard Biesheuvel
@ 2018-12-05 21:39   ` Carsey, Jaben
  0 siblings, 0 replies; 10+ messages in thread
From: Carsey, Jaben @ 2018-12-05 21:39 UTC (permalink / raw)
  To: Ard Biesheuvel, edk2-devel@lists.01.org; +Cc: alan@softiron.co.uk

You didn't CC anyone, but that is the right syntax for adding the shell command.

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Ard Biesheuvel
> Sent: Wednesday, December 05, 2018 10:50 AM
> To: edk2-devel@lists.01.org
> Cc: alan@softiron.co.uk
> Subject: [edk2] [PATCH edk2-platforms 5/6] Platform: add acpiview to
> Seattle/Styx platforms
> Importance: High
> 
> Enable the 'acpiview' UEFI shell command so we can inspect the ACPI
> tables at boot time.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc              | 1 +
>  Platform/LeMaker/CelloBoard/CelloBoard.dsc                  | 1 +
>  Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> index 7c66af6128c5..ed67c986b7db 100644
> --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> @@ -731,6 +731,7 @@ DEFINE DO_CAPSULE   = FALSE
> 
> NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
> CommandsLib.inf
> +
> NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCo
> mmandLib.inf
> 
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
> ib.inf
>        PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfg
> CommandLib.inf
> diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> index 7c22bbbfa90f..057bf0eb67de 100644
> --- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> +++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> @@ -663,6 +663,7 @@ DEFINE DO_FLASHER   = FALSE
> 
> NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
> CommandsLib.inf
> +
> NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCo
> mmandLib.inf
> 
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
> ib.inf
>        PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfg
> CommandLib.inf
> diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> index 793bd5359a23..985ba2253a90 100644
> --- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> +++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> @@ -658,6 +658,7 @@ DEFINE DO_FLASHER   = FALSE
> 
> NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1Com
> mandsLib.inf
> 
> NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1
> CommandsLib.inf
> +
> NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCo
> mmandLib.inf
> 
> HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingL
> ib.inf
>        PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfg
> CommandLib.inf
> --
> 2.19.2
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more
  2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
                   ` (5 preceding siblings ...)
  2018-12-05 18:50 ` [PATCH edk2-platforms 6/6] Platform/AMD/OverdriveBoard: use default resolution for GOP Ard Biesheuvel
@ 2018-12-10 21:58 ` Leif Lindholm
  2018-12-11  8:01   ` Ard Biesheuvel
  6 siblings, 1 reply; 10+ messages in thread
From: Leif Lindholm @ 2018-12-10 21:58 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel, alan, graeme.gregory

On Wed, Dec 05, 2018 at 07:50:14PM +0100, Ard Biesheuvel wrote:
> Primarily, this series gets rid of the hacked up way this platform
> patches the DSDT at build time, by #include'ing intermediate output
> of the iasl compiler [or some version of it, at least]
> 
> While at it, apply some other cleanups/improvements.

All but the last one seem like they're following some form of common
thread. But anyway:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> Ard Biesheuvel (6):
>   Silicon/AMD/Styx: move SOC version macros to common header
>   Silicon/AMD/Styx: move B1 revision peripherals to separate SSDT table
>   Silicon/AMD/Styx: move XGBE declarations to separate SSDT table
>   Silicon/AMD/Styx: emit DSDT as aml directly
>   Platform: add acpiview to Seattle/Styx platforms
>   Platform/AMD/OverdriveBoard: use default resolution for GOP
> 
>  .../AMD/OverdriveBoard/OverdriveBoard.dsc     |   7 +-
>  Platform/LeMaker/CelloBoard/CelloBoard.dsc    |   5 +-
>  .../Overdrive1000Board/Overdrive1000Board.dsc |   4 +-
>  .../AMD/OverdriveBoard/OverdriveBoard.fdf     |   2 +-
>  Platform/LeMaker/CelloBoard/CelloBoard.fdf    |   2 +-
>  .../Overdrive1000Board/Overdrive1000Board.fdf |   2 +-
>  Silicon/AMD/Styx/AcpiTables/AcpiAml.inf       |  29 ---
>  Silicon/AMD/Styx/AcpiTables/AcpiTables.inf    |   3 -
>  .../AcpiPlatformDxe/AcpiPlatformDxe.inf       |  13 ++
>  Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h      |   1 -
>  Silicon/AMD/Styx/Common/SocVersion.h          |  19 ++
>  Silicon/AMD/Styx/AcpiTables/Dsdt.c            | 192 ------------------
>  Silicon/AMD/Styx/AcpiTables/Iort.c            |   6 +-
>  .../Drivers/AcpiPlatformDxe/AcpiPlatform.c    | 137 ++++++++++++-
>  .../StyxSataPlatformDxe/InitController.c      |   7 +-
>  .../StyxDtbLoaderLib/StyxDtbLoaderLib.c       |   7 +-
>  .../AcpiPlatformDxe}/Dsdt.asl                 | 180 ----------------
>  .../Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl   |  86 ++++++++
>  .../Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl | 135 ++++++++++++
>  19 files changed, 395 insertions(+), 442 deletions(-)
>  delete mode 100644 Silicon/AMD/Styx/AcpiTables/AcpiAml.inf
>  create mode 100644 Silicon/AMD/Styx/Common/SocVersion.h
>  delete mode 100644 Silicon/AMD/Styx/AcpiTables/Dsdt.c
>  rename Silicon/AMD/Styx/{AcpiTables => Drivers/AcpiPlatformDxe}/Dsdt.asl (72%)
>  create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
>  create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtXgbe.asl
> 
> -- 
> 2.19.2
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more
  2018-12-10 21:58 ` [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Leif Lindholm
@ 2018-12-11  8:01   ` Ard Biesheuvel
  0 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2018-12-11  8:01 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel@lists.01.org, Alan Ott, Graeme Gregory

On Mon, 10 Dec 2018 at 22:58, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Wed, Dec 05, 2018 at 07:50:14PM +0100, Ard Biesheuvel wrote:
> > Primarily, this series gets rid of the hacked up way this platform
> > patches the DSDT at build time, by #include'ing intermediate output
> > of the iasl compiler [or some version of it, at least]
> >
> > While at it, apply some other cleanups/improvements.
>
> All but the last one seem like they're following some form of common
> thread. But anyway:
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks

Pushed as 0eaa50231c02..217713e2cfc9


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-12-11  8:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-05 18:50 [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Ard Biesheuvel
2018-12-05 18:50 ` [PATCH edk2-platforms 1/6] Silicon/AMD/Styx: move SOC version macros to common header Ard Biesheuvel
2018-12-05 18:50 ` [PATCH edk2-platforms 2/6] Silicon/AMD/Styx: move B1 revision peripherals to separate SSDT table Ard Biesheuvel
2018-12-05 18:50 ` [PATCH edk2-platforms 3/6] Silicon/AMD/Styx: move XGBE declarations " Ard Biesheuvel
2018-12-05 18:50 ` [PATCH edk2-platforms 4/6] Silicon/AMD/Styx: emit DSDT as aml directly Ard Biesheuvel
2018-12-05 18:50 ` [PATCH edk2-platforms 5/6] Platform: add acpiview to Seattle/Styx platforms Ard Biesheuvel
2018-12-05 21:39   ` Carsey, Jaben
2018-12-05 18:50 ` [PATCH edk2-platforms 6/6] Platform/AMD/OverdriveBoard: use default resolution for GOP Ard Biesheuvel
2018-12-10 21:58 ` [PATCH edk2-platforms 0/6] Styx: fixes for IASL abuse and more Leif Lindholm
2018-12-11  8:01   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox