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 2/6] Platform/ARM/Sgi: Install SDEI ACPI table
Date: Fri, 30 Oct 2020 14:11:52 +0530 [thread overview]
Message-ID: <20201030084156.8291-3-omkar.kulkarni@arm.com> (raw)
In-Reply-To: <20201030084156.8291-1-omkar.kulkarni@arm.com>
On SGI/RD platforms that require SDEI mechanism to let OS know about a
high priority system event, such as a RAS event, create and install the
SDEI ACPI 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 | 1 +
Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c | 79 ++++++++++++++++++++
3 files changed, 81 insertions(+)
diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiPlatform.dec
index dac7fdc308b1..f139b90d81e3 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.PcdSdeiSupported|FALSE|BOOLEAN|0x0000000D
[PcdsFixedAtBuild]
gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
index 9d89314a594e..2ea2c09e3920 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf
@@ -33,6 +33,7 @@
gArmSgiAcpiTablesGuid
[FeaturePcd]
+ gArmSgiTokenSpaceGuid.PcdSdeiSupported
gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported
gArmSgiTokenSpaceGuid.PcdVirtioNetSupported
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 2f72e7152ff3..9250243decb8 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -6,9 +6,16 @@
*
**/
+#include <IndustryStandard/Acpi.h>
+
#include <Library/AcpiLib.h>
+#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+#include <Protocol/AcpiTable.h>
+
#include <SgiPlatform.h>
VOID
@@ -16,6 +23,71 @@ InitVirtioDevices (
VOID
);
+/**
+ Build and install the SDEI ACPI table.
+
+ For platforms that allow firmware-first platform error handling, SDEI is used
+ as the notification mechanism for those errors. Build and install the SDEI
+ table to enable support for SDEI.
+
+ @retval EFI_SUCCESS SDEI table installed successfully.
+ @retval Other For any error during installation.
+
+**/
+STATIC
+EFI_STATUS
+InstallSdeiTable (VOID)
+{
+ EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol = NULL;
+ EFI_ACPI_DESCRIPTION_HEADER Header;
+ EFI_STATUS Status;
+ UINTN AcpiTableHandle;
+
+ Header =
+ (EFI_ACPI_DESCRIPTION_HEADER) {
+ EFI_ACPI_6_3_SOFTWARE_DELEGATED_EXCEPTIONS_INTERFACE_TABLE_SIGNATURE,
+ sizeof (EFI_ACPI_DESCRIPTION_HEADER), // Length
+ 0x01, // Revision
+ 0x00, // Checksum
+ {'A', 'R', 'M', 'L', 'T', 'D'}, // OemId
+ 0x4152464e49464552, // OemTableId:"REFINFRA"
+ 0x20201027, // OemRevision
+ 0x204d5241, // CreatorId:"ARM "
+ 0x00000001, // CreatorRevision
+ };
+
+ Header.Checksum = CalculateCheckSum8 ((UINT8 *)&Header, Header.Length);
+ Status = gBS->LocateProtocol (
+ &gEfiAcpiTableProtocolGuid,
+ NULL,
+ (VOID **)&mAcpiTableProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "Failed to locate ACPI table protocol, status: %r\n",
+ Status
+ ));
+ return Status;
+ }
+
+ Status = mAcpiTableProtocol->InstallAcpiTable (
+ mAcpiTableProtocol,
+ &Header,
+ Header.Length,
+ &AcpiTableHandle
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "Failed to install SDEI ACPI table, status: %r\n",
+ Status
+ ));
+ }
+
+ return Status;
+}
+
EFI_STATUS
EFIAPI
ArmSgiPkgEntryPoint (
@@ -31,6 +103,13 @@ ArmSgiPkgEntryPoint (
return Status;
}
+ if (FeaturePcdGet (PcdSdeiSupported)) {
+ Status = InstallSdeiTable ();
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
InitVirtioDevices ();
return Status;
--
2.17.1
next prev 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 ` Omkar Anand Kulkarni [this message]
2020-10-30 8:41 ` [edk2-platforms][PATCH 3/6] Platform/Arm/Sgi: Install HEST ACPI table Omkar Anand Kulkarni
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-3-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