public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Omkar Anand Kulkarni" <omkar.kulkarni@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Jiewen Yao <jiewen.yao@intel.com>
Subject: [edk2-platforms][PATCH 3/6] Platform/Arm/Sgi: Install HEST ACPI table
Date: Fri, 30 Oct 2020 14:11:53 +0530	[thread overview]
Message-ID: <20201030084156.8291-4-omkar.kulkarni@arm.com> (raw)
In-Reply-To: <20201030084156.8291-1-omkar.kulkarni@arm.com>

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@arm.com>
Signed-off-by:  Omkar Anand Kulkarni <omkar.kulkarni@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


  parent reply	other threads:[~2020-10-30  8:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30  8:41 [edk2-platforms][PATCH 0/6] Platform/ARM/Sgi: Add DMC620 1-bit ECC error handling Omkar Anand Kulkarni
2020-10-30  8:41 ` [edk2-platforms][PATCH 1/6] Platform/ARM: Add DMC-620 RAS error handling driver Omkar Anand Kulkarni
2020-10-30  8:41 ` [edk2-platforms][PATCH 2/6] Platform/ARM/Sgi: Install SDEI ACPI table Omkar Anand Kulkarni
2020-10-30  8:41 ` Omkar Anand Kulkarni [this message]
2020-10-30  8:41 ` [edk2-platforms][PATCH 4/6] Platform/Arm/Sgi: define memory region for GHES error status block Omkar Anand Kulkarni
2020-10-30  8:41 ` [edk2-platforms][PATCH 5/6] Platform/Arm/Sgi: dmc-620 firmware-first error handling Omkar Anand Kulkarni
2020-10-30  8:41 ` [edk2-platforms][PATCH 6/6] Platform/Arm/Sgi575: Define values for ACPI table header Omkar Anand Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201030084156.8291-4-omkar.kulkarni@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox