summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith-Denny <osde@microsoft.com>2025-01-14 15:55:12 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-02-07 02:23:11 +0000
commitd9715c133f45b6eee239f4aa58e9112b7497de4b (patch)
treeb8f52693ddffb8b1be3d79ddc3e9425a5fc7d955
parent5c02a6482398243f9513f2f9c01ea3a2aacdffe7 (diff)
downloadedk2-d9715c133f45b6eee239f4aa58e9112b7497de4b.tar.gz
MdePkg: Centralize RNDR Register Definition
RNDR is a standard register defined in the ARM ARM for AARCH64. Move the definition from BaseRngLib to AArch64.h. Furthermore, move the inclusion of this register definition to the ARM specific header file. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
-rw-r--r--MdePkg/Include/AArch64/AArch64.h4
-rw-r--r--MdePkg/Library/BaseRngLib/AArch64/ArmRng.S2
-rw-r--r--MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm2
-rw-r--r--MdePkg/Library/BaseRngLib/AArch64/ArmRng.h2
-rw-r--r--MdePkg/Library/BaseRngLib/BaseRngLibInternals.h7
5 files changed, 8 insertions, 9 deletions
diff --git a/MdePkg/Include/AArch64/AArch64.h b/MdePkg/Include/AArch64/AArch64.h
index 9650608e7b..4e5830c375 100644
--- a/MdePkg/Include/AArch64/AArch64.h
+++ b/MdePkg/Include/AArch64/AArch64.h
@@ -130,6 +130,10 @@
// build for ARMv8.0, we need to define the register here.
#define ID_AA64MMFR2_EL1 S3_0_C0_C7_2
+// The RNDR register is not recognized by older assemblers,
+// so we need to define it here
+#define RNDR S3_3_C2_C4_0
+
#define VECTOR_BASE(tbl) \
.section .text.##tbl##,"ax"; \
.align 11; \
diff --git a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.S b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.S
index 27a847b996..98087b51ff 100644
--- a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.S
+++ b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.S
@@ -8,7 +8,7 @@
#
#------------------------------------------------------------------------------
-#include "BaseRngLibInternals.h"
+#include "ArmRng.h"
.text
.p2align 2
diff --git a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm
index 33144196cb..255b9054a1 100644
--- a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm
+++ b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm
@@ -8,7 +8,7 @@
;
;------------------------------------------------------------------------------
-#include "BaseRngLibInternals.h"
+#include "ArmRng.h"
EXPORT ArmRndr
AREA BaseLib_LowLevel, CODE, READONLY
diff --git a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h
index b4b3c97071..eae1fa9b7e 100644
--- a/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h
+++ b/MdePkg/Library/BaseRngLib/AArch64/ArmRng.h
@@ -11,6 +11,8 @@
#ifndef ARM_RNG_H_
#define ARM_RNG_H_
+#include <AArch64/AArch64.h>
+
/**
Generates a random number using RNDR.
Returns TRUE on success; FALSE on failure.
diff --git a/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h b/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h
index d0abcc3452..c913f18858 100644
--- a/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h
+++ b/MdePkg/Library/BaseRngLib/BaseRngLibInternals.h
@@ -69,11 +69,4 @@ ArchIsRngSupported (
VOID
);
-#if defined (MDE_CPU_AARCH64)
-
-// RNDR, Random Number
-#define RNDR S3_3_C2_C4_0
-
-#endif
-
#endif // BASE_RNGLIB_INTERNALS_H_