summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Include/Library
diff options
context:
space:
mode:
authorSami Mujawar <sami.mujawar@arm.com>2026-06-04 19:44:21 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-09-29 16:27:06 +0300
commitd45393dc7747cb079fa67924ac61007ee8e89062 (patch)
tree6a745ee4b63f8e258f236d20a55303f55f6a3b10 /MdeModulePkg/Include/Library
parent72fa3af90beeee7690ab4626fd372e0baa830fa4 (diff)
downloadedk2-d45393dc7747cb079fa67924ac61007ee8e89062.tar.xz
ArmVirtPkg, MdeModulePkg: Move Arm CCA Library to MdeModulePkg
ArmCcaLib provides helper functions for detecting Realm execution state and caching Realm IPA width. These helpers build on the architectural Arm CCA RSI library and are not specific to ArmVirtPkg. Therefore, move ArmCcaLib, ArmCcaLibNull, their public header, and related GUID declarations to MdeModulePkg. Update ArmVirtPkg library mappings and consumers to use the new MdeModulePkg library instances. Also perform minor non-functional cleanup to the moved INF files by fixing a comment typo and ordering the package dependencies. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Diffstat (limited to 'MdeModulePkg/Include/Library')
-rw-r--r--MdeModulePkg/Include/Library/ArmCcaLib.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Library/ArmCcaLib.h b/MdeModulePkg/Include/Library/ArmCcaLib.h
new file mode 100644
index 0000000000..28f3d7c366
--- /dev/null
+++ b/MdeModulePkg/Include/Library/ArmCcaLib.h
@@ -0,0 +1,69 @@
+/** @file
+ Library that implements the Arm CCA helper functions.
+
+ Copyright (c) 2022 - 2026, Arm Ltd. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ - Rsi or RSI - Realm Service Interface
+ - IPA - Intermediate Physical Address
+ - RIPAS - Realm IPA state
+**/
+
+#pragma once
+
+#include <Base.h>
+#include <Uefi/UefiBaseType.h>
+
+/**
+ Check if running in a Realm.
+
+ @retval TRUE The execution is within the context of a Realm.
+ @retval FALSE The execution is not within the context of a Realm.
+**/
+BOOLEAN
+EFIAPI
+ArmCcaIsRealm (
+ VOID
+ );
+
+/**
+ Return the IPA width of the Realm.
+
+ The IPA width of the Realm is used to configure the protection attribute
+ for memory regions, see ArmCcaSetMemoryProtectionAttribute().
+
+ @param [out] IpaWidth IPA width of the Realm.
+
+ @retval RETURN_SUCCESS Success.
+ @retval RETURN_INVALID_PARAMETER A parameter is invalid.
+ @retval RETURN_UNSUPPORTED The execution is not within the
+ context of a Realm.
+ @retval RETURN_OUT_OF_RESOURCES Out of resources.
+**/
+RETURN_STATUS
+EFIAPI
+ArmCcaGetIpaWidth (
+ OUT UINT64 *IpaWidth
+ );
+
+/** Check if the address range is protected MMIO
+
+ @param [in] BaseAddress Base address of the device MMIO region.
+ @param [in] Length Length of the device MMIO region.
+ @param [out] IsProtectedMmio TRUE - if the RIPAS for the address range is
+ protected MMIO.
+ FALSE - if the RIPAS for the address range is
+ not protected MMIO.
+
+ @retval RETURN_SUCCESS Success.
+ @retval RETURN_INVALID_PARAMETER A parameter is invalid.
+ @retval RETURN_UNSUPPORTED The request is not initiated in a
+ Realm.
+**/
+RETURN_STATUS
+EFIAPI
+ArmCcaMemRangeIsProtectedMmio (
+ IN UINT64 BaseAddress,
+ IN UINT64 Length,
+ OUT BOOLEAN *IsProtectedMmio
+ );