summaryrefslogtreecommitdiffstats
path: root/ArmPkg
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2023-11-27 18:57:43 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-11-28 10:12:29 +0000
commitd451bba399687b4102459db5a447fc9abb8fdee1 (patch)
treeb21f9443a4540a31136ded7419f055b770955a76 /ArmPkg
parent0e9ce9146a6dc50a35488e3a4a7a2a4bbaf1eb1c (diff)
downloadedk2-d451bba399687b4102459db5a447fc9abb8fdee1.tar.gz
edk2-d451bba399687b4102459db5a447fc9abb8fdee1.tar.bz2
edk2-d451bba399687b4102459db5a447fc9abb8fdee1.zip
ArmPkg/ArmMmuLib: Use function pointer type
mReplaceLiveEntryFunc is a function pointer but assigned as a VOID* pointer: mReplaceLiveEntryFunc = *(VOID **)GET_GUID_HOB_DATA (Hob); This leads to the Visual Studio warning: nonstandard extension, function/data pointer conversion in expression This change updates the assignment to avoid using a data pointer and defines a type for the function pointer to succinctly and accurately refer to the type when it is used in the library code. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c13
-rw-r--r--ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c7
-rw-r--r--ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf2
-rw-r--r--ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h23
-rw-r--r--ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf1
5 files changed, 33 insertions, 13 deletions
diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
index 1e57e58997..9d9c623581 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
@@ -20,16 +20,9 @@
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
+#include "ArmMmuLibInternal.h"
-STATIC
-VOID (
- EFIAPI *mReplaceLiveEntryFunc
- )(
- IN UINT64 *Entry,
- IN UINT64 Value,
- IN UINT64 RegionStart,
- IN BOOLEAN DisableMmu
- ) = ArmReplaceLiveTranslationEntry;
+STATIC ARM_REPLACE_LIVE_TRANSLATION_ENTRY mReplaceLiveEntryFunc = ArmReplaceLiveTranslationEntry;
STATIC
UINT64
@@ -742,7 +735,7 @@ ArmMmuBaseLibConstructor (
Hob = GetFirstGuidHob (&gArmMmuReplaceLiveTranslationEntryFuncGuid);
if (Hob != NULL) {
- mReplaceLiveEntryFunc = *(VOID **)GET_GUID_HOB_DATA (Hob);
+ mReplaceLiveEntryFunc = *(ARM_REPLACE_LIVE_TRANSLATION_ENTRY *)GET_GUID_HOB_DATA (Hob);
} else {
//
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c
index 5f50a605a3..a0c9facdea 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c
@@ -13,6 +13,7 @@
#include <Library/CacheMaintenanceLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
+#include "ArmMmuLibInternal.h"
EFI_STATUS
EFIAPI
@@ -21,9 +22,9 @@ ArmMmuPeiLibConstructor (
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
- extern UINT32 ArmReplaceLiveTranslationEntrySize;
- VOID *ArmReplaceLiveTranslationEntryFunc;
- VOID *Hob;
+ extern UINT32 ArmReplaceLiveTranslationEntrySize;
+ ARM_REPLACE_LIVE_TRANSLATION_ENTRY ArmReplaceLiveTranslationEntryFunc;
+ VOID *Hob;
EFI_FV_FILE_INFO FileInfo;
EFI_STATUS Status;
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
index 57cb71f90e..510511bd41 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
@@ -19,10 +19,12 @@
CONSTRUCTOR = ArmMmuBaseLibConstructor
[Sources.AARCH64]
+ ArmMmuLibInternal.h
AArch64/ArmMmuLibCore.c
AArch64/ArmMmuLibReplaceEntry.S
[Sources.ARM]
+ ArmMmuLibInternal.h
Arm/ArmMmuLibConvert.c
Arm/ArmMmuLibCore.c
Arm/ArmMmuLibUpdate.c
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h b/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h
new file mode 100644
index 0000000000..8d3bec525d
--- /dev/null
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h
@@ -0,0 +1,23 @@
+/** @file
+ Arm MMU library instance internal header file.
+
+ Copyright (C) Microsoft Corporation. All rights reserved.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef ARM_MMU_LIB_INTERNAL_H_
+#define ARM_MMU_LIB_INTERNAL_H_
+
+typedef
+VOID(
+ EFIAPI *ARM_REPLACE_LIVE_TRANSLATION_ENTRY
+ )(
+ IN UINT64 *Entry,
+ IN UINT64 Value,
+ IN UINT64 RegionStart,
+ IN BOOLEAN DisableMmu
+ );
+
+#endif
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf b/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
index 02f874a1a9..37424628aa 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
@@ -17,6 +17,7 @@
CONSTRUCTOR = ArmMmuPeiLibConstructor
[Sources.AARCH64]
+ ArmMmuLibInternal.h
AArch64/ArmMmuLibCore.c
AArch64/ArmMmuPeiLibConstructor.c
AArch64/ArmMmuLibReplaceEntry.S