[edk2-devel] [edk2-platforms][PATCH 3/6] Platform/Arm/Sgi: Install HEST ACPI table

Omkar Anand Kulkarni omkar.kulkarni at arm.com
Fri Oct 30 08:41:53 UTC 2020


On SGI/RD platforms that publish the platform error source descriptors
using the HEST table generation protocol, install the dynamically
created HEST table.

Co-authored-by: Thomas Abraham <thomas.abraham at arm.com>
Signed-off-by:  Omkar Anand Kulkarni <omkar.kulkarni at arm.com>
---
 Platform/ARM/SgiPkg/SgiPlatform.dec                                            |  1 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf                        |  2 +
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/{PlatformDxe.inf => PlatformDxeMm.inf} | 10 +++-
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c                          | 52 ++++++++++++++++++++
 4 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
index f139b90d81e3..099652734c0e 100644
--- a/Platform/ARM/SgiPkg/SgiPlatform.dec
+++ b/Platform/ARM/SgiPkg/SgiPlatform.dec
@@ -31,6 +31,7 @@
 [PcdsFeatureFlag.common]
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000001
   gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x00000010
+  gArmSgiTokenSpaceGuid.PcdHestSupported|FALSE|BOOLEAN|0x0000000C
   gArmSgiTokenSpaceGuid.PcdSdeiSupported|FALSE|BOOLEAN|0x0000000D
 
 [PcdsFixedAtBuild]
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 2ea2c09e3920..448a22672a17 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -17,6 +17,7 @@
   VirtioDevices.c
 
 [Packages]
+  ArmPlatformPkg/ArmPlatformPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
@@ -33,6 +34,7 @@
   gArmSgiAcpiTablesGuid
 
 [FeaturePcd]
+  gArmSgiTokenSpaceGuid.PcdHestSupported
   gArmSgiTokenSpaceGuid.PcdSdeiSupported
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
   gArmSgiTokenSpaceGuid.PcdVirtioNetSupported
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxeMm.inf
similarity index 77%
copy from Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
copy to Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxeMm.inf
index 2ea2c09e3920..980a4047aa37 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxeMm.inf
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2018-2020, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -17,6 +17,7 @@
   VirtioDevices.c
 
 [Packages]
+  ArmPlatformPkg/ArmPlatformPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
@@ -32,7 +33,12 @@
   gArmSgiPlatformIdDescriptorGuid
   gArmSgiAcpiTablesGuid
 
+[Protocols]
+  gEfiAcpiTableProtocolGuid
+  gHestTableProtocolGuid
+
 [FeaturePcd]
+  gArmSgiTokenSpaceGuid.PcdHestSupported
   gArmSgiTokenSpaceGuid.PcdSdeiSupported
   gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
   gArmSgiTokenSpaceGuid.PcdVirtioNetSupported
@@ -44,4 +50,4 @@
   gArmSgiTokenSpaceGuid.PcdVirtioNetSize
 
 [Depex]
-  TRUE
+  AFTER gArmPlatformHestErrorSourcesGuid
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 9250243decb8..9ea20357b87e 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -15,6 +15,7 @@
 #include <Library/UefiBootServicesTableLib.h>
 
 #include <Protocol/AcpiTable.h>
+#include <Protocol/HestTable.h>
 
 #include <SgiPlatform.h>
 
@@ -88,6 +89,50 @@ InstallSdeiTable (VOID)
   return Status;
 }
 
+/**
+  Install the HEST ACPI table.
+
+  HEST ACPI table is used to list the platform errors for which the error
+  handling has been supported. Use the HEST table generation protocol to
+  install the HEST table.
+
+  @retval EFI_SUCCESS  SDEI table installed successfully.
+  @retval Other        For any error during installation.
+
+**/
+STATIC
+EFI_STATUS
+InstallHestTable (VOID)
+{
+  HEST_TABLE_PROTOCOL     *HestProtocol;
+  EFI_STATUS              Status;
+
+  Status = gBS->LocateProtocol (
+                  &gHestTableProtocolGuid,
+                  NULL,
+                  (VOID **)&HestProtocol
+                  );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "Failed to locate Hest Dxe Protocol, status: %r\n",
+      Status
+      ));
+      return Status;
+  }
+
+  Status = HestProtocol->InstallHestTable ();
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "Failed to install HEST table, status: %r\n",
+      Status
+      ));
+  }
+
+  return Status;
+}
+
 EFI_STATUS
 EFIAPI
 ArmSgiPkgEntryPoint (
@@ -110,6 +155,13 @@ ArmSgiPkgEntryPoint (
     }
   }
 
+  if (FeaturePcdGet (PcdHestSupported)) {
+    Status = InstallHestTable ();
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+  }
+
   InitVirtioDevices ();
 
   return Status;
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66829): https://edk2.groups.io/g/devel/message/66829
Mute This Topic: https://groups.io/mt/77913847/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list