MdePkg: Add helper function to detect RME

Add helper function to check if the Realm Management
Extension (RME) is implemented by the hardware.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
Sami Mujawar 2022-07-08 17:07:00 +01:00 committed by mergify[bot]
parent c31b880bd2
commit 5bdf8acc13
3 changed files with 28 additions and 2 deletions

View file

@ -36,6 +36,7 @@
// ID_AA64PFR0 - AArch64 Processor Feature Register 0 definitions
#define AARCH64_PFR0_FP (0xF << 16)
#define AARCH64_PFR0_GIC (0xF << 24)
#define AARCH64_PFR0_RME (0xFULL << 52)
// ID_AA64PFR2 - AArch64 Processor Feature Register 2 definitions
#define AARCH64_PFR2_GCIE (0xF << 12)

View file

@ -1,7 +1,7 @@
/** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
Copyright (c) 2011 - 2016, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2011 - 2023, Arm Limited. All rights reserved.<BR>
Copyright (c) 2020 - 2021, NUVIA Inc. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -721,3 +721,14 @@ EFIAPI
ArmHas52BitTgran4 (
VOID
);
/** Checks if RME is implemented.
@retval TRUE RME is implemented.
@retval FALSE RME is not implemented.
**/
BOOLEAN
EFIAPI
ArmHasRme (
VOID
);

View file

@ -1,7 +1,7 @@
/** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
Portions copyright (c) 2011 - 2023, Arm Limited. All rights reserved.<BR>
Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -127,3 +127,17 @@ ArmHas52BitTgran4 (
return ((Mmfr0 & AARCH64_MMFR0_TGRAN4_MASK) == AARCH64_MMFR0_TGRAN4_52BITS);
}
/** Checks if RME is implemented.
@retval TRUE RME is implemented.
@retval FALSE RME is not implemented.
**/
BOOLEAN
EFIAPI
ArmHasRme (
VOID
)
{
return ((ArmReadIdAA64Pfr0 () & AARCH64_PFR0_RME) != 0);
}