[edk2,edk2-platforms,1/6] Silicon/AMD/Styx: move SOC version macros to common header

Message ID 20181205185020.21441-2-ard.biesheuvel@linaro.org
State New
Headers show
Series
  • Styx: fixes for IASL abuse and more
Related show

Commit Message

Ard Biesheuvel Dec. 5, 2018, 6:50 p.m.
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(-)

-- 
2.19.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Patch

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 (