diff options
author | Pierre Gondois <pierre.gondois@arm.com> | 2023-10-04 14:27:17 +0200 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-01 13:41:01 +0000 |
commit | 1715d672310a318ce441d27a3515d371329f8b5b (patch) | |
tree | 234b7d9f96a0254bdf60affb246dee5fc5803f18 /MdePkg | |
parent | 30e53f8b5efe0112eda7014cf846007fb0fb425f (diff) | |
download | edk2-1715d672310a318ce441d27a3515d371329f8b5b.tar.gz edk2-1715d672310a318ce441d27a3515d371329f8b5b.tar.bz2 edk2-1715d672310a318ce441d27a3515d371329f8b5b.zip |
MdePkg/BaseRngLib: Prefer ArmReadIdAA64Isar0Reg() over ArmReadIdIsar0()
A ArmReadIdAA64Isar0Reg() function was recently added
to BaseLib. Use it instead of its ArmReadIdIsar0() equivalent,
which was private to the BaseRngLib library.
This also allows to avoid the confusion between the following
registers:
- ID_ISAR0_EL1: allows to probe for Divide instructions, Debug
instructions, ...
- ID_AA64ISAR0_EL1: AARCH64 specific register allowing to probe
for AESE, RNDR, ... instructions
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S | 30 | ||||
-rw-r--r-- | MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.asm | 30 | ||||
-rw-r--r-- | MdePkg/Library/BaseRngLib/AArch64/ArmRng.h | 12 | ||||
-rw-r--r-- | MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 10 | ||||
-rw-r--r-- | MdePkg/Library/BaseRngLib/BaseRngLib.inf | 2 |
5 files changed, 2 insertions, 82 deletions
diff --git a/MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S b/MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S deleted file mode 100644 index d30b63fe5c..0000000000 --- a/MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S +++ /dev/null @@ -1,30 +0,0 @@ -#------------------------------------------------------------------------------
-#
-# ArmReadIdIsar0() for AArch64
-#
-# Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#------------------------------------------------------------------------------
-
-.text
-.p2align 2
-GCC_ASM_EXPORT(ArmReadIdIsar0)
-
-#/**
-# Reads the ID_AA64ISAR0 Register.
-#
-# @return The contents of the ID_AA64ISAR0 register.
-#
-#**/
-#UINT64
-#EFIAPI
-#ArmReadIdIsar0 (
-# VOID
-# );
-#
-ASM_PFX(ArmReadIdIsar0):
- AARCH64_BTI(c)
- mrs x0, id_aa64isar0_el1 // Read ID_AA64ISAR0 Register
- ret
diff --git a/MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.asm b/MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.asm deleted file mode 100644 index 1d9f9a808c..0000000000 --- a/MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.asm +++ /dev/null @@ -1,30 +0,0 @@ -;------------------------------------------------------------------------------
-;
-; ArmReadIdIsar0() for AArch64
-;
-; Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
-;
-; SPDX-License-Identifier: BSD-2-Clause-Patent
-;
-;------------------------------------------------------------------------------
-
- EXPORT ArmReadIdIsar0
- AREA BaseLib_LowLevel, CODE, READONLY
-
-;/**
-; Reads the ID_AA64ISAR0 Register.
-;
-; @return The contents of the ID_AA64ISAR0 register.
-;
-;**/
-;UINT64
-;EFIAPI
-;ArmReadIdIsar0 (
-; VOID
-; );
-;
-ArmReadIdIsar0
- mrs x0, id_aa64isar0_el1 // Read ID_AA64ISAR0 Register
- ret
-
- END
diff --git a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h index 2d6ef48ab9..b4b3c97071 100644 --- a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h +++ b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h @@ -27,16 +27,4 @@ ArmRndr ( OUT UINT64 *Rand
);
-/**
- Reads the ID_AA64ISAR0 Register.
-
- @return The contents of the ID_AA64ISAR0 register.
-
-**/
-UINT64
-EFIAPI
-ArmReadIdIsar0 (
- VOID
- );
-
#endif /* ARM_RNG_H_ */
diff --git a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c index 3a556a2e3f..2c53443840 100644 --- a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c +++ b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c @@ -21,11 +21,6 @@ STATIC BOOLEAN mRndrSupported;
-//
-// Bit mask used to determine if RNDR instruction is supported.
-//
-#define RNDR_MASK ((UINT64)MAX_UINT16 << 60U)
-
/**
The constructor function checks whether or not RNDR instruction is supported
by the host hardware.
@@ -49,9 +44,8 @@ BaseRngLibConstructor ( // Determine RNDR support by examining bits 63:60 of the ISAR0 register returned by
// MSR. A non-zero value indicates that the processor supports the RNDR instruction.
//
- Isar0 = ArmReadIdIsar0 ();
-
- mRndrSupported = ((Isar0 & RNDR_MASK) != 0);
+ Isar0 = ArmReadIdAA64Isar0Reg ();
+ mRndrSupported = !!((Isar0 >> ARM_ID_AA64ISAR0_EL1_RNDR_SHIFT) & ARM_ID_AA64ISAR0_EL1_RNDR_MASK);
return EFI_SUCCESS;
}
diff --git a/MdePkg/Library/BaseRngLib/BaseRngLib.inf b/MdePkg/Library/BaseRngLib/BaseRngLib.inf index a1614a900f..53833a76b2 100644 --- a/MdePkg/Library/BaseRngLib/BaseRngLib.inf +++ b/MdePkg/Library/BaseRngLib/BaseRngLib.inf @@ -38,10 +38,8 @@ AArch64/Rndr.c
AArch64/ArmRng.h
- AArch64/ArmReadIdIsar0.S | GCC
AArch64/ArmRng.S | GCC
- AArch64/ArmReadIdIsar0.asm | MSFT
AArch64/ArmRng.asm | MSFT
[Guids.AARCH64]
|