public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@bsdio.com>
To: devel@edk2.groups.io, Liming Gao <gaoliming@byosoft.com.cn>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Guomin Jiang <guomin.jiang@intel.com>,
	Wei6 Xu <wei6.xu@intel.com>, Guo Dong <guo.dong@intel.com>,
	Ray Ni <ray.ni@intel.com>, Sean Rhodes <sean@starlabs.systems>,
	James Lu <james.lu@intel.com>, Gua Guo <gua.guo@intel.com>,
	Andrew Fish <afish@apple.com>, Hao A Wu <hao.a.wu@intel.com>,
	Maciej Rabeda <maciej.rabeda@linux.intel.com>,
	Siyuan Fu <siyuan.fu@intel.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Xiaoyu Lu <xiaoyu1.lu@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Supreeth Venkatesh <supreeth.venkatesh@arm.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>
Cc: Rebecca Cran <rebecca@bsdio.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Abner Chang <abner.chang@amd.com>,
	Nickle Wang <nicklew@nvidia.com>,
	Igor Kulchytskyy <igork@ami.com>,
	Daniel Schaefer <git@danielschaefer.me>,
	Min Xu <min.m.xu@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Peter Grehan <grehan@freebsd.org>,
	Erdem Aktas <erdemaktas@google.com>,
	James Bottomley <jejb@linux.ibm.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Michael Roth <michael.roth@amd.com>,
	Sunil V L <sunilvl@ventanamicro.com>,
	Andrei Warkentin <andrei.warkentin@intel.com>
Subject: [PATCH 04/18] OvmfPkg: Update code to be more C11 compliant by using __func__
Date: Thu,  6 Apr 2023 16:23:05 -0600	[thread overview]
Message-ID: <20230406222319.2281263-5-rebecca@bsdio.com> (raw)
In-Reply-To: <20230406222319.2281263-1-rebecca@bsdio.com>

__FUNCTION__ is a pre-standard extension that gcc and Visual C++ among
others support, while __func__ was standardized in C99.

Since it's more standard, replace __FUNCTION__ with __func__ throughout
OvmfPkg.

Visual Studio versions before VS 2015 don't support __func__ and so
will fail to compile. A workaround is to define __func__ as
__FUNCTION__ :

  #define __func__ __FUNCTION__

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 OvmfPkg/AcpiPlatformDxe/BootScript.c                                    |  4 +-
 OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c                                   |  4 +-
 OvmfPkg/AcpiPlatformDxe/EntryPoint.c                                    |  8 +--
 OvmfPkg/AcpiPlatformDxe/PciDecoding.c                                   | 10 +--
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                                 | 64 ++++++++++----------
 OvmfPkg/AmdSev/BlobVerifierLibSevHashes/BlobVerifierSevHashes.c         | 18 +++---
 OvmfPkg/AmdSevDxe/AmdSevDxe.c                                           |  2 +-
 OvmfPkg/Bhyve/AcpiPlatformDxe/EntryPoint.c                              |  8 +--
 OvmfPkg/Bhyve/AcpiPlatformDxe/PciDecoding.c                             | 10 +--
 OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.c                                     |  6 +-
 OvmfPkg/Bhyve/PlatformPei/ClearCache.c                                  |  6 +-
 OvmfPkg/Bhyve/PlatformPei/MemDetect.c                                   | 12 ++--
 OvmfPkg/Bhyve/PlatformPei/Platform.c                                    | 10 +--
 OvmfPkg/CpuHotplugSmm/CpuHotplug.c                                      | 40 ++++++------
 OvmfPkg/CpuHotplugSmm/QemuCpuhp.c                                       | 32 +++++-----
 OvmfPkg/CpuHotplugSmm/Smbase.c                                          | 10 +--
 OvmfPkg/CpuS3DataDxe/CpuS3Data.c                                        |  2 +-
 OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c                             |  2 +-
 OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c                                |  2 +-
 OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c                           |  2 +-
 OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c                   | 28 ++++-----
 OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c                 |  4 +-
 OvmfPkg/Fdt/HighMemDxe/HighMemDxe.c                                     | 10 +--
 OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.c                                 | 10 +--
 OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c  |  2 +-
 OvmfPkg/IoMmuDxe/CcIoMmu.c                                              | 18 +++---
 OvmfPkg/IoMmuDxe/IoMmuBuffer.c                                          |  8 +--
 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c                         |  2 +-
 OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c                      |  4 +-
 OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c                          |  2 +-
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c          | 22 +++----
 OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c   |  4 +-
 OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c                 | 26 ++++----
 OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c                           |  4 +-
 OvmfPkg/Library/CcExitLib/CcExitVeHandler.c                             | 18 +++---
 OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c       |  6 +-
 OvmfPkg/Library/HardwareInfoLib/HardwareInfoDxe.c                       |  2 +-
 OvmfPkg/Library/LockBoxLib/LockBoxLib.c                                 | 10 +--
 OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c       | 22 +++----
 OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c                   |  2 +-
 OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c                | 12 ++--
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c                    | 12 ++--
 OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c                     |  2 +-
 OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c               | 10 +--
 OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c                | 10 +--
 OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c                 |  2 +-
 OvmfPkg/Library/PlatformInitLib/MemDetect.c                             | 28 ++++-----
 OvmfPkg/Library/PlatformInitLib/Platform.c                              | 20 +++---
 OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.c                      |  2 +-
 OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c                     | 42 ++++++-------
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c                             | 18 +++---
 OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c                         |  2 +-
 OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Dxe.c                         | 34 +++++------
 OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibMicrovm.c               |  8 +--
 OvmfPkg/Library/ResetSystemLib/ResetSystemLibMicrovm.c                  |  8 +--
 OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c           |  4 +-
 OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c               |  4 +-
 OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c                   |  4 +-
 OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c                     | 24 ++++----
 OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c                  |  4 +-
 OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c               |  8 +--
 OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.c                             |  4 +-
 OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c |  2 +-
 OvmfPkg/LsiScsiDxe/LsiScsi.c                                            |  4 +-
 OvmfPkg/MptScsiDxe/MptScsi.c                                            | 10 +--
 OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c                              |  6 +-
 OvmfPkg/PlatformDxe/Platform.c                                          | 14 ++---
 OvmfPkg/PlatformPei/ClearCache.c                                        |  6 +-
 OvmfPkg/PlatformPei/FeatureControl.c                                    |  6 +-
 OvmfPkg/PlatformPei/MemDetect.c                                         | 12 ++--
 OvmfPkg/PlatformPei/MemTypeInfo.c                                       | 10 +--
 OvmfPkg/PlatformPei/Platform.c                                          | 18 +++---
 OvmfPkg/PvScsiDxe/PvScsi.c                                              |  4 +-
 OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c                   | 12 ++--
 OvmfPkg/QemuRamfbDxe/QemuRamfb.c                                        |  2 +-
 OvmfPkg/QemuVideoDxe/Gop.c                                              |  2 +-
 OvmfPkg/QemuVideoDxe/Initialize.c                                       | 14 ++---
 OvmfPkg/QemuVideoDxe/VbeShim.c                                          | 12 ++--
 OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/PlatformBm.c           | 20 +++---
 OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/QemuKernel.c           |  2 +-
 OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c  |  4 +-
 OvmfPkg/RiscVVirt/Sec/Memory.c                                          | 10 +--
 OvmfPkg/RiscVVirt/Sec/Platform.c                                        | 12 ++--
 OvmfPkg/RiscVVirt/Sec/SecMain.c                                         |  2 +-
 OvmfPkg/Sec/SecMain.c                                                   |  2 +-
 OvmfPkg/SmmAccess/SmmAccessPei.c                                        |  6 +-
 OvmfPkg/SmmControl2Dxe/SmiFeatures.c                                    | 22 +++----
 OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c                                 | 18 +++---
 OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c                                 |  8 +--
 OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPeim.c                |  6 +-
 OvmfPkg/TdxDxe/TdxAcpiTable.c                                           |  2 +-
 OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c                               |  4 +-
 OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c                               | 22 +++----
 OvmfPkg/VirtioBlkDxe/VirtioBlk.c                                        |  8 +--
 OvmfPkg/VirtioFsDxe/FuseFlush.c                                         |  2 +-
 OvmfPkg/VirtioFsDxe/FuseFsync.c                                         |  2 +-
 OvmfPkg/VirtioFsDxe/FuseGetAttr.c                                       |  2 +-
 OvmfPkg/VirtioFsDxe/FuseInit.c                                          |  2 +-
 OvmfPkg/VirtioFsDxe/FuseLookup.c                                        |  2 +-
 OvmfPkg/VirtioFsDxe/FuseMkDir.c                                         |  2 +-
 OvmfPkg/VirtioFsDxe/FuseOpen.c                                          |  2 +-
 OvmfPkg/VirtioFsDxe/FuseOpenDir.c                                       |  2 +-
 OvmfPkg/VirtioFsDxe/FuseOpenOrCreate.c                                  |  2 +-
 OvmfPkg/VirtioFsDxe/FuseRead.c                                          |  2 +-
 OvmfPkg/VirtioFsDxe/FuseRelease.c                                       |  2 +-
 OvmfPkg/VirtioFsDxe/FuseRename.c                                        |  2 +-
 OvmfPkg/VirtioFsDxe/FuseSetAttr.c                                       |  2 +-
 OvmfPkg/VirtioFsDxe/FuseStatFs.c                                        |  2 +-
 OvmfPkg/VirtioFsDxe/FuseUnlink.c                                        |  2 +-
 OvmfPkg/VirtioFsDxe/FuseWrite.c                                         |  2 +-
 OvmfPkg/VirtioFsDxe/Helpers.c                                           |  2 +-
 OvmfPkg/VirtioFsDxe/SimpleFsOpen.c                                      |  4 +-
 OvmfPkg/VirtioGpuDxe/Commands.c                                         |  6 +-
 OvmfPkg/VirtioGpuDxe/DriverBinding.c                                    |  8 +--
 OvmfPkg/VirtioGpuDxe/Gop.c                                              |  2 +-
 OvmfPkg/VirtioNetDxe/Events.c                                           |  2 +-
 OvmfPkg/VirtioRngDxe/VirtioRng.c                                        |  2 +-
 OvmfPkg/VirtioScsiDxe/VirtioScsi.c                                      |  2 +-
 OvmfPkg/XenAcpiPlatformDxe/Xen.c                                        |  2 +-
 OvmfPkg/XenPlatformPei/ClearCache.c                                     |  6 +-
 OvmfPkg/XenPlatformPei/MemDetect.c                                      |  6 +-
 OvmfPkg/XenPlatformPei/Platform.c                                       |  2 +-
 OvmfPkg/XenPvBlkDxe/BlockFront.c                                        |  4 +-
 123 files changed, 540 insertions(+), 540 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/AcpiPlatformDxe/BootScript.c
index 08d0f41bda5c..ff1491de0d2d 100644
--- a/OvmfPkg/AcpiPlatformDxe/BootScript.c
+++ b/OvmfPkg/AcpiPlatformDxe/BootScript.c
@@ -175,7 +175,7 @@ SaveCondensedWritePointerToS3Context (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: 0x%04x/[0x%08x+%d] := 0x%Lx (%Lu)\n",
-    __FUNCTION__,
+    __func__,
     PointerItem,
     PointerOffset,
     PointerSize,
@@ -225,7 +225,7 @@ AppendFwCfgBootScript (
     }
   }
 
-  DEBUG ((DEBUG_VERBOSE, "%a: boot script fragment saved\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: boot script fragment saved\n", __func__));
 
   ReleaseS3Context (S3Context);
   return;
diff --git a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c
index d56eb074a987..d3e73c155e8f 100644
--- a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c
+++ b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c
@@ -69,7 +69,7 @@ InstallCloudHvTablesTdx (
   // then we're out of sync with the hypervisor, and cannot continue.
   //
   if (DsdtTable == NULL) {
-    DEBUG ((DEBUG_INFO, "%a: no DSDT found\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: no DSDT found\n", __func__));
     ASSERT (FALSE);
   }
 
@@ -201,7 +201,7 @@ InstallCloudHvTables (
   // then we're out of sync with the hypervisor, and cannot continue.
   //
   if (DsdtTable == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __func__));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
index 143e860fe187..17f1c4017f87 100644
--- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
@@ -46,11 +46,11 @@ OnRootBridgesConnected (
   DEBUG ((
     DEBUG_INFO,
     "%a: root bridges have been connected, installing ACPI tables\n",
-    __FUNCTION__
+    __func__
     ));
   Status = InstallAcpiTables (FindAcpiTableProtocol ());
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __func__, Status));
   }
 
   gBS->CloseEvent (Event);
@@ -76,7 +76,7 @@ AcpiPlatformEntryPoint (
       DEBUG_INFO,
       "%a: PCI or its enumeration disabled, installing "
       "ACPI tables\n",
-      __FUNCTION__
+      __func__
       ));
     return InstallAcpiTables (FindAcpiTableProtocol ());
   }
@@ -99,7 +99,7 @@ AcpiPlatformEntryPoint (
     DEBUG ((
       DEBUG_INFO,
       "%a: waiting for root bridges to be connected, registered callback\n",
-      __FUNCTION__
+      __func__
       ));
   }
 
diff --git a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
index c178f857a224..c7dbfb1baaea 100644
--- a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
+++ b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
@@ -78,7 +78,7 @@ EnablePciDecoding (
     DEBUG ((
       DEBUG_WARN,
       "%a: LocateHandleBuffer(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return;
@@ -89,7 +89,7 @@ EnablePciDecoding (
     DEBUG ((
       DEBUG_WARN,
       "%a: AllocatePool(): out of resources\n",
-      __FUNCTION__
+      __func__
       ));
     goto FreeHandles;
   }
@@ -122,7 +122,7 @@ EnablePciDecoding (
       DEBUG ((
         DEBUG_WARN,
         "%a: EfiPciIoAttributeOperationGet: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto RestoreAttributes;
@@ -141,7 +141,7 @@ EnablePciDecoding (
       DEBUG ((
         DEBUG_WARN,
         "%a: EfiPciIoAttributeOperationSupported: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto RestoreAttributes;
@@ -161,7 +161,7 @@ EnablePciDecoding (
       DEBUG ((
         DEBUG_WARN,
         "%a: EfiPciIoAttributeOperationEnable: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto RestoreAttributes;
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
index 68abc34f2280..a073b292b743 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
@@ -238,7 +238,7 @@ CollectAllocationsRestrictedTo32Bit (
     }
 
     if (AddPointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-      DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
+      DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __func__));
       Status = EFI_PROTOCOL_ERROR;
       goto RollBack;
     }
@@ -253,7 +253,7 @@ CollectAllocationsRestrictedTo32Bit (
         DEBUG ((
           DEBUG_VERBOSE,
           "%a: restricting blob \"%a\" from 64-bit allocation\n",
-          __FUNCTION__,
+          __func__,
           AddPointer->PointeeFile
           ));
         break;
@@ -330,7 +330,7 @@ ProcessCmdAllocate (
   BLOB                  *Blob;
 
   if (Allocate->File[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __func__));
     return EFI_PROTOCOL_ERROR;
   }
 
@@ -338,7 +338,7 @@ ProcessCmdAllocate (
     DEBUG ((
       DEBUG_ERROR,
       "%a: unsupported alignment 0x%x\n",
-      __FUNCTION__,
+      __func__,
       Allocate->Alignment
       ));
     return EFI_UNSUPPORTED;
@@ -349,7 +349,7 @@ ProcessCmdAllocate (
     DEBUG ((
       DEBUG_ERROR,
       "%a: QemuFwCfgFindFile(\"%a\"): %r\n",
-      __FUNCTION__,
+      __func__,
       Allocate->File,
       Status
       ));
@@ -392,7 +392,7 @@ ProcessCmdAllocate (
     DEBUG ((
       DEBUG_ERROR,
       "%a: duplicated file \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       Allocate->File
       ));
     Status = EFI_PROTOCOL_ERROR;
@@ -410,7 +410,7 @@ ProcessCmdAllocate (
     DEBUG_VERBOSE,
     "%a: File=\"%a\" Alignment=0x%x Zone=%d Size=0x%Lx "
     "Address=0x%Lx\n",
-    __FUNCTION__,
+    __func__,
     Allocate->File,
     Allocate->Alignment,
     Allocate->Zone,
@@ -477,7 +477,7 @@ ProcessCmdAddPointer (
   if ((AddPointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') ||
       (AddPointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0'))
   {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __func__));
     return EFI_PROTOCOL_ERROR;
   }
 
@@ -487,7 +487,7 @@ ProcessCmdAddPointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid blob reference(s) \"%a\" / \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       AddPointer->PointerFile,
       AddPointer->PointeeFile
       ));
@@ -504,7 +504,7 @@ ProcessCmdAddPointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid pointer location or size in \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       AddPointer->PointerFile
       ));
     return EFI_PROTOCOL_ERROR;
@@ -517,7 +517,7 @@ ProcessCmdAddPointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid pointer value in \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       AddPointer->PointerFile
       ));
     return EFI_PROTOCOL_ERROR;
@@ -537,7 +537,7 @@ ProcessCmdAddPointer (
       DEBUG_ERROR,
       "%a: relocated pointer value unrepresentable in "
       "\"%a\"\n",
-      __FUNCTION__,
+      __func__,
       AddPointer->PointerFile
       ));
     return EFI_PROTOCOL_ERROR;
@@ -549,7 +549,7 @@ ProcessCmdAddPointer (
     DEBUG_VERBOSE,
     "%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
     "PointerOffset=0x%x PointerSize=%d\n",
-    __FUNCTION__,
+    __func__,
     AddPointer->PointerFile,
     AddPointer->PointeeFile,
     AddPointer->PointerOffset,
@@ -585,7 +585,7 @@ ProcessCmdAddChecksum (
   BLOB                      *Blob;
 
   if (AddChecksum->File[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __func__));
     return EFI_PROTOCOL_ERROR;
   }
 
@@ -594,7 +594,7 @@ ProcessCmdAddChecksum (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid blob reference \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       AddChecksum->File
       ));
     return EFI_PROTOCOL_ERROR;
@@ -608,7 +608,7 @@ ProcessCmdAddChecksum (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid checksum range in \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       AddChecksum->File
       ));
     return EFI_PROTOCOL_ERROR;
@@ -622,7 +622,7 @@ ProcessCmdAddChecksum (
     DEBUG_VERBOSE,
     "%a: File=\"%a\" ResultOffset=0x%x Start=0x%x "
     "Length=0x%x\n",
-    __FUNCTION__,
+    __func__,
     AddChecksum->File,
     AddChecksum->ResultOffset,
     AddChecksum->Start,
@@ -680,7 +680,7 @@ ProcessCmdWritePointer (
   if ((WritePointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') ||
       (WritePointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0'))
   {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __func__));
     return EFI_PROTOCOL_ERROR;
   }
 
@@ -694,7 +694,7 @@ ProcessCmdWritePointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid fw_cfg file or blob reference \"%a\" / \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       WritePointer->PointerFile,
       WritePointer->PointeeFile
       ));
@@ -710,7 +710,7 @@ ProcessCmdWritePointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid pointer location or size in \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       WritePointer->PointerFile
       ));
     return EFI_PROTOCOL_ERROR;
@@ -719,7 +719,7 @@ ProcessCmdWritePointer (
   PointeeBlob  = OrderedCollectionUserStruct (PointeeEntry);
   PointerValue = WritePointer->PointeeOffset;
   if (PointerValue >= PointeeBlob->Size) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid PointeeOffset\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: invalid PointeeOffset\n", __func__));
     return EFI_PROTOCOL_ERROR;
   }
 
@@ -736,7 +736,7 @@ ProcessCmdWritePointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: pointer value unrepresentable in \"%a\"\n",
-      __FUNCTION__,
+      __func__,
       WritePointer->PointerFile
       ));
     return EFI_PROTOCOL_ERROR;
@@ -776,7 +776,7 @@ ProcessCmdWritePointer (
     DEBUG_VERBOSE,
     "%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
     "PointerOffset=0x%x PointeeOffset=0x%x PointerSize=%d\n",
-    __FUNCTION__,
+    __func__,
     WritePointer->PointerFile,
     WritePointer->PointeeFile,
     WritePointer->PointerOffset,
@@ -822,7 +822,7 @@ UndoCmdWritePointer (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: PointerFile=\"%a\" PointerOffset=0x%x PointerSize=%d\n",
-    __FUNCTION__,
+    __func__,
     WritePointer->PointerFile,
     WritePointer->PointerOffset,
     WritePointer->PointerSize
@@ -953,7 +953,7 @@ Process2ndPassCmdAddPointer (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: PointerValue=0x%Lx already processed, skipping.\n",
-        __FUNCTION__,
+        __func__,
         PointerValue
         ));
       Status = EFI_SUCCESS;
@@ -967,7 +967,7 @@ Process2ndPassCmdAddPointer (
     DEBUG_VERBOSE,
     "%a: checking for ACPI header in \"%a\" at 0x%Lx "
     "(remaining: 0x%Lx): ",
-    __FUNCTION__,
+    __func__,
     AddPointer->PointeeFile,
     PointerValue,
     (UINT64)Blob2Remaining
@@ -1042,7 +1042,7 @@ Process2ndPassCmdAddPointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: can't install more than %d tables\n",
-      __FUNCTION__,
+      __func__,
       INSTALLED_TABLES_MAX
       ));
     Status = EFI_OUT_OF_RESOURCES;
@@ -1059,7 +1059,7 @@ Process2ndPassCmdAddPointer (
     DEBUG ((
       DEBUG_ERROR,
       "%a: InstallAcpiTable(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto RollbackSeenPointer;
@@ -1128,7 +1128,7 @@ InstallQemuFwCfgTables (
     DEBUG ((
       DEBUG_ERROR,
       "%a: \"etc/table-loader\" has invalid size 0x%Lx\n",
-      __FUNCTION__,
+      __func__,
       (UINT64)FwCfgSize
       ));
     return EFI_PROTOCOL_ERROR;
@@ -1236,7 +1236,7 @@ InstallQemuFwCfgTables (
         DEBUG ((
           DEBUG_VERBOSE,
           "%a: unknown loader command: 0x%x\n",
-          __FUNCTION__,
+          __func__,
           LoaderEntry->Type
           ));
         break;
@@ -1311,7 +1311,7 @@ InstallQemuFwCfgTables (
     S3Context = NULL;
   }
 
-  DEBUG ((DEBUG_INFO, "%a: installed %d tables\n", __FUNCTION__, Installed));
+  DEBUG ((DEBUG_INFO, "%a: installed %d tables\n", __func__, Installed));
 
 UninstallQemuAcpiTableNotifyProtocol:
   if (EFI_ERROR (Status)) {
@@ -1380,7 +1380,7 @@ InstallQemuFwCfgTables (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: freeing \"%a\"\n",
-        __FUNCTION__,
+        __func__,
         Blob->File
         ));
       gBS->FreePages ((UINTN)Blob->Base, EFI_SIZE_TO_PAGES (Blob->Size));
diff --git a/OvmfPkg/AmdSev/BlobVerifierLibSevHashes/BlobVerifierSevHashes.c b/OvmfPkg/AmdSev/BlobVerifierLibSevHashes/BlobVerifierSevHashes.c
index 65f040f94758..2e58794c3c70 100644
--- a/OvmfPkg/AmdSev/BlobVerifierLibSevHashes/BlobVerifierSevHashes.c
+++ b/OvmfPkg/AmdSev/BlobVerifierLibSevHashes/BlobVerifierSevHashes.c
@@ -101,7 +101,7 @@ VerifyBlob (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Verifier called but no hashes table discoverd in MEMFD\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_ACCESS_DENIED;
   }
@@ -111,7 +111,7 @@ VerifyBlob (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Unknown blob name \"%s\"\n",
-      __FUNCTION__,
+      __func__,
       BlobName
       ));
     return EFI_ACCESS_DENIED;
@@ -134,14 +134,14 @@ VerifyBlob (
       continue;
     }
 
-    DEBUG ((DEBUG_INFO, "%a: Found GUID %g in table\n", __FUNCTION__, Guid));
+    DEBUG ((DEBUG_INFO, "%a: Found GUID %g in table\n", __func__, Guid));
 
     EntrySize = Entry->Len - sizeof Entry->Guid - sizeof Entry->Len;
     if (EntrySize != SHA256_DIGEST_SIZE) {
       DEBUG ((
         DEBUG_ERROR,
         "%a: Hash has the wrong size %d != %d\n",
-        __FUNCTION__,
+        __func__,
         EntrySize,
         SHA256_DIGEST_SIZE
         ));
@@ -159,7 +159,7 @@ VerifyBlob (
       DEBUG ((
         DEBUG_INFO,
         "%a: Hash comparison succeeded for \"%s\"\n",
-        __FUNCTION__,
+        __func__,
         BlobName
         ));
     } else {
@@ -167,7 +167,7 @@ VerifyBlob (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Hash comparison failed for \"%s\"\n",
-        __FUNCTION__,
+        __func__,
         BlobName
         ));
     }
@@ -178,7 +178,7 @@ VerifyBlob (
   DEBUG ((
     DEBUG_ERROR,
     "%a: Hash GUID %g not found in table\n",
-    __FUNCTION__,
+    __func__,
     Guid
     ));
   return EFI_ACCESS_DENIED;
@@ -218,7 +218,7 @@ BlobVerifierLibSevHashesConstructor (
   DEBUG ((
     DEBUG_INFO,
     "%a: Found injected hashes table in secure location\n",
-    __FUNCTION__
+    __func__
     ));
 
   mHashesTable     = (HASH_TABLE *)Ptr->Data;
@@ -227,7 +227,7 @@ BlobVerifierLibSevHashesConstructor (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: mHashesTable=0x%p, Size=%u\n",
-    __FUNCTION__,
+    __func__,
     mHashesTable,
     mHashesTableSize
     ));
diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
index 9b0d0e92b6f7..05b728d32a65 100644
--- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c
+++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c
@@ -276,7 +276,7 @@ AmdSevDxeEntryPoint (
       DEBUG ((
         DEBUG_ERROR,
         "%a: MemEncryptSevClearPageEncMask(): %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/EntryPoint.c
index b6ef101b2abe..23d1856ad5e2 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/EntryPoint.c
@@ -41,11 +41,11 @@ OnRootBridgesConnected (
   DEBUG ((
     DEBUG_INFO,
     "%a: root bridges have been connected, installing ACPI tables\n",
-    __FUNCTION__
+    __func__
     ));
   Status = InstallAcpiTables (FindAcpiTableProtocol ());
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __func__, Status));
   }
 
   gBS->CloseEvent (Event);
@@ -71,7 +71,7 @@ AcpiPlatformEntryPoint (
       DEBUG_INFO,
       "%a: PCI or its enumeration disabled, installing "
       "ACPI tables\n",
-      __FUNCTION__
+      __func__
       ));
     return InstallAcpiTables (FindAcpiTableProtocol ());
   }
@@ -94,7 +94,7 @@ AcpiPlatformEntryPoint (
     DEBUG ((
       DEBUG_INFO,
       "%a: waiting for root bridges to be connected, registered callback\n",
-      __FUNCTION__
+      __func__
       ));
   }
 
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/PciDecoding.c
index d31fd6539363..0dcf3517f1e7 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/PciDecoding.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/PciDecoding.c
@@ -76,7 +76,7 @@ EnablePciDecoding (
     DEBUG ((
       DEBUG_WARN,
       "%a: LocateHandleBuffer(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return;
@@ -87,7 +87,7 @@ EnablePciDecoding (
     DEBUG ((
       DEBUG_WARN,
       "%a: AllocatePool(): out of resources\n",
-      __FUNCTION__
+      __func__
       ));
     goto FreeHandles;
   }
@@ -120,7 +120,7 @@ EnablePciDecoding (
       DEBUG ((
         DEBUG_WARN,
         "%a: EfiPciIoAttributeOperationGet: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto RestoreAttributes;
@@ -139,7 +139,7 @@ EnablePciDecoding (
       DEBUG ((
         DEBUG_WARN,
         "%a: EfiPciIoAttributeOperationSupported: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto RestoreAttributes;
@@ -159,7 +159,7 @@ EnablePciDecoding (
       DEBUG ((
         DEBUG_WARN,
         "%a: EfiPciIoAttributeOperationEnable: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto RestoreAttributes;
diff --git a/OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.c b/OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.c
index 41f0180001f9..ea7a364d8500 100644
--- a/OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.c
+++ b/OvmfPkg/Bhyve/BhyveRfbDxe/VbeShim.c
@@ -147,7 +147,7 @@ InstallVbeShim (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: Video BIOS handler found at %04x:%04x\n",
-        __FUNCTION__,
+        __func__,
         Int0x10->Segment,
         Int0x10->Offset
         ));
@@ -161,7 +161,7 @@ InstallVbeShim (
     DEBUG ((
       DEBUG_VERBOSE,
       "%a: failed to allocate page at zero: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   } else {
@@ -271,7 +271,7 @@ InstallVbeShim (
   DEBUG ((
     DEBUG_INFO,
     "%a: VBE shim installed to %x:%x\n",
-    __FUNCTION__,
+    __func__,
     Int0x10->Segment,
     Int0x10->Offset
     ));
diff --git a/OvmfPkg/Bhyve/PlatformPei/ClearCache.c b/OvmfPkg/Bhyve/PlatformPei/ClearCache.c
index 9f23f9a42847..9e59f31df7fd 100644
--- a/OvmfPkg/Bhyve/PlatformPei/ClearCache.c
+++ b/OvmfPkg/Bhyve/PlatformPei/ClearCache.c
@@ -59,7 +59,7 @@ ClearCacheOnMpServicesAvailable (
   EFI_PEI_MP_SERVICES_PPI  *MpServices;
   EFI_STATUS               Status;
 
-  DEBUG ((DEBUG_INFO, "%a: %a\n", gEfiCallerBaseName, __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: %a\n", gEfiCallerBaseName, __func__));
 
   //
   // Clear cache on all the APs in parallel.
@@ -74,7 +74,7 @@ ClearCacheOnMpServicesAvailable (
                              NULL             // ProcedureArgument
                              );
   if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {
-    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __func__, Status));
     return Status;
   }
 
@@ -108,7 +108,7 @@ InstallClearCacheCallback (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to set up MP Services callback: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/Bhyve/PlatformPei/MemDetect.c b/OvmfPkg/Bhyve/PlatformPei/MemDetect.c
index 1949e586a07e..29cbb9e3dcc8 100644
--- a/OvmfPkg/Bhyve/PlatformPei/MemDetect.c
+++ b/OvmfPkg/Bhyve/PlatformPei/MemDetect.c
@@ -58,7 +58,7 @@ Q35TsegMbytesInitialization (
       DEBUG_ERROR,
       "%a: no TSEG (SMRAM) on host bridge DID=0x%04x; "
       "only DID=0x%04x (Q35) is supported\n",
-      __FUNCTION__,
+      __func__,
       mHostBridgeDevId,
       INTEL_Q35_MCH_DEVICE_ID
       ));
@@ -92,7 +92,7 @@ Q35TsegMbytesInitialization (
   DEBUG ((
     DEBUG_INFO,
     "%a: QEMU offers an extended TSEG (%d MB)\n",
-    __FUNCTION__,
+    __func__,
     ExtendedTsegMbytes
     ));
   PcdStatus = PcdSet16S (PcdQ35TsegMbytes, ExtendedTsegMbytes);
@@ -185,7 +185,7 @@ GetFirstNonAddress (
       DEBUG ((
         DEBUG_INFO,
         "%a: disabling 64-bit PCI host aperture\n",
-        __FUNCTION__
+        __func__
         ));
       PcdStatus = PcdSet64S (PcdPciMmio64Size, 0);
       ASSERT_RETURN_ERROR (PcdStatus);
@@ -228,7 +228,7 @@ GetFirstNonAddress (
     DEBUG ((
       DEBUG_INFO,
       "%a: Pci64Base=0x%Lx Pci64Size=0x%Lx\n",
-      __FUNCTION__,
+      __func__,
       Pci64Base,
       Pci64Size
       ));
@@ -392,7 +392,7 @@ PublishPeiMemory (
     DEBUG ((
       DEBUG_INFO,
       "%a: mPhysMemAddressWidth=%d PeiMemoryCap=%u KB\n",
-      __FUNCTION__,
+      __func__,
       mPhysMemAddressWidth,
       PeiMemoryCap >> 10
       ));
@@ -441,7 +441,7 @@ QemuInitializeRam (
   MTRR_SETTINGS  MtrrSettings;
   EFI_STATUS     Status;
 
-  DEBUG ((DEBUG_INFO, "%a called\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a called\n", __func__));
 
   //
   // Determine total memory size available
diff --git a/OvmfPkg/Bhyve/PlatformPei/Platform.c b/OvmfPkg/Bhyve/PlatformPei/Platform.c
index eba7c60fced8..2523e49e368a 100644
--- a/OvmfPkg/Bhyve/PlatformPei/Platform.c
+++ b/OvmfPkg/Bhyve/PlatformPei/Platform.c
@@ -373,7 +373,7 @@ MiscInitialization (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         mHostBridgeDevId
         ));
       ASSERT (FALSE);
@@ -501,17 +501,17 @@ S3Verification (
     DEBUG ((
       DEBUG_ERROR,
       "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n",
-      __FUNCTION__
+      __func__
       ));
     DEBUG ((
       DEBUG_ERROR,
       "%a: Please disable S3 on the QEMU command line (see the README),\n",
-      __FUNCTION__
+      __func__
       ));
     DEBUG ((
       DEBUG_ERROR,
       "%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n",
-      __FUNCTION__
+      __func__
       ));
     ASSERT (FALSE);
     CpuDeadLoop ();
@@ -558,7 +558,7 @@ MaxCpuCountInitialization (
   DEBUG ((
     DEBUG_INFO,
     "%a: QEMU reports %d processor(s)\n",
-    __FUNCTION__,
+    __func__,
     ProcessorCount
     ));
 }
diff --git a/OvmfPkg/CpuHotplugSmm/CpuHotplug.c b/OvmfPkg/CpuHotplugSmm/CpuHotplug.c
index 97ecd32eb6de..d50416302677 100644
--- a/OvmfPkg/CpuHotplugSmm/CpuHotplug.c
+++ b/OvmfPkg/CpuHotplugSmm/CpuHotplug.c
@@ -135,7 +135,7 @@ ProcessHotAddedCpus (
         DEBUG_VERBOSE,
         "%a: APIC ID " FMT_APIC_ID " was hot-plugged "
                                    "before; ignoring it\n",
-        __FUNCTION__,
+        __func__,
         NewApicId
         ));
       PluggedIdx++;
@@ -155,7 +155,7 @@ ProcessHotAddedCpus (
       DEBUG ((
         DEBUG_ERROR,
         "%a: no room for APIC ID " FMT_APIC_ID "\n",
-        __FUNCTION__,
+        __func__,
         NewApicId
         ));
       return EFI_OUT_OF_RESOURCES;
@@ -190,7 +190,7 @@ ProcessHotAddedCpus (
       DEBUG ((
         DEBUG_ERROR,
         "%a: AddProcessor(" FMT_APIC_ID "): %r\n",
-        __FUNCTION__,
+        __func__,
         NewApicId,
         Status
         ));
@@ -201,7 +201,7 @@ ProcessHotAddedCpus (
       DEBUG_INFO,
       "%a: hot-added APIC ID " FMT_APIC_ID ", SMBASE 0x%Lx, "
                                            "EFI_SMM_CPU_SERVICE_PROTOCOL assigned number %Lu\n",
-      __FUNCTION__,
+      __func__,
       NewApicId,
       (UINT64)mCpuHotPlugData->SmBase[NewSlot],
       (UINT64)NewProcessorNumberByProtocol
@@ -310,7 +310,7 @@ EjectCpu (
           DEBUG_INFO,
           "%a: Unplugged ProcessorNum %u, "
           "QemuSelector %Lu\n",
-          __FUNCTION__,
+          __func__,
           Idx,
           QemuSelector
           ));
@@ -454,7 +454,7 @@ UnplugCpus (
         DEBUG_VERBOSE,
         "%a: did not find APIC ID " FMT_APIC_ID
         " to unplug\n",
-        __FUNCTION__,
+        __func__,
         RemoveApicId
         ));
       ToUnplugIdx++;
@@ -469,7 +469,7 @@ UnplugCpus (
       DEBUG ((
         DEBUG_ERROR,
         "%a: RemoveProcessor(" FMT_APIC_ID "): %r\n",
-        __FUNCTION__,
+        __func__,
         RemoveApicId,
         Status
         ));
@@ -493,7 +493,7 @@ UnplugCpus (
         DEBUG_ERROR,
         "%a: ProcessorNum %Lu maps to QemuSelector %Lu, "
         "cannot also map to %u\n",
-        __FUNCTION__,
+        __func__,
         (UINT64)ProcessorNum,
         mCpuHotEjectData->QemuSelectorMap[ProcessorNum],
         QemuSelector
@@ -511,7 +511,7 @@ UnplugCpus (
       DEBUG_INFO,
       "%a: Started hot-unplug on ProcessorNum %Lu, APIC ID "
       FMT_APIC_ID ", QemuSelector %u\n",
-      __FUNCTION__,
+      __func__,
       (UINT64)ProcessorNum,
       RemoveApicId,
       QemuSelector
@@ -635,7 +635,7 @@ CpuHotplugMmi (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to read ICH9_APM_CNT: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     //
@@ -736,7 +736,7 @@ CpuHotplugEntry (
                     (VOID **)&mMmCpuIo
                     );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: locate MmCpuIo: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: locate MmCpuIo: %r\n", __func__, Status));
     goto Fatal;
   }
 
@@ -749,7 +749,7 @@ CpuHotplugEntry (
     DEBUG ((
       DEBUG_ERROR,
       "%a: locate MmCpuService: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto Fatal;
@@ -767,7 +767,7 @@ CpuHotplugEntry (
 
   if (mCpuHotPlugData == NULL) {
     Status = EFI_NOT_FOUND;
-    DEBUG ((DEBUG_ERROR, "%a: CPU_HOT_PLUG_DATA: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: CPU_HOT_PLUG_DATA: %r\n", __func__, Status));
     goto Fatal;
   }
 
@@ -787,7 +787,7 @@ CpuHotplugEntry (
   }
 
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: CPU_HOT_EJECT_DATA: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: CPU_HOT_EJECT_DATA: %r\n", __func__, Status));
     goto Fatal;
   }
 
@@ -799,7 +799,7 @@ CpuHotplugEntry (
       RETURN_ERROR (SafeUintnMult (sizeof (UINT32), Len, &SizeSel)))
   {
     Status = EFI_ABORTED;
-    DEBUG ((DEBUG_ERROR, "%a: invalid CPU_HOT_PLUG_DATA\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: invalid CPU_HOT_PLUG_DATA\n", __func__));
     goto Fatal;
   }
 
@@ -809,7 +809,7 @@ CpuHotplugEntry (
                     (VOID **)&mPluggedApicIds
                     );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __func__, Status));
     goto Fatal;
   }
 
@@ -819,7 +819,7 @@ CpuHotplugEntry (
                     (VOID **)&mToUnplugApicIds
                     );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __func__, Status));
     goto ReleasePluggedApicIds;
   }
 
@@ -829,7 +829,7 @@ CpuHotplugEntry (
                     (VOID **)&mToUnplugSelectors
                     );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: MmAllocatePool(): %r\n", __func__, Status));
     goto ReleaseToUnplugApicIds;
   }
 
@@ -874,7 +874,7 @@ CpuHotplugEntry (
     DEBUG ((
       DEBUG_ERROR,
       "%a: modern CPU hotplug interface: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto ReleasePostSmmPen;
@@ -892,7 +892,7 @@ CpuHotplugEntry (
     DEBUG ((
       DEBUG_ERROR,
       "%a: MmiHandlerRegister(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto ReleasePostSmmPen;
diff --git a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c
index ec3dc379f309..1687dada4c92 100644
--- a/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c
+++ b/OvmfPkg/CpuHotplugSmm/QemuCpuhp.c
@@ -36,7 +36,7 @@ QemuCpuhpReadCommandData2 (
                                &CommandData2
                                );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
@@ -61,7 +61,7 @@ QemuCpuhpReadCpuStatus (
                             &CpuStatus
                             );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
@@ -86,7 +86,7 @@ QemuCpuhpReadCommandData (
                               &CommandData
                               );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
@@ -110,7 +110,7 @@ QemuCpuhpWriteCpuSelector (
                          &Selector
                          );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
@@ -132,7 +132,7 @@ QemuCpuhpWriteCpuStatus (
                          &CpuStatus
                          );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
@@ -154,7 +154,7 @@ QemuCpuhpWriteCommand (
                          &Command
                          );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
@@ -266,7 +266,7 @@ QemuCpuhpCollectApicIds (
         DEBUG_VERBOSE,
         "%a: CurrentSelector=%u PendingSelector=%u: "
         "wrap-around\n",
-        __FUNCTION__,
+        __func__,
         CurrentSelector,
         PendingSelector
         ));
@@ -291,7 +291,7 @@ QemuCpuhpCollectApicIds (
           DEBUG_ERROR,
           "%a: CurrentSelector=%u CpuStatus=0x%x: "
           "inconsistent CPU status\n",
-          __FUNCTION__,
+          __func__,
           CurrentSelector,
           CpuStatus
           ));
@@ -301,7 +301,7 @@ QemuCpuhpCollectApicIds (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: CurrentSelector=%u: insert\n",
-        __FUNCTION__,
+        __func__,
         CurrentSelector
         ));
 
@@ -317,7 +317,7 @@ QemuCpuhpCollectApicIds (
           DEBUG_ERROR,
           "%a: CurrentSelector=%u CpuStatus=0x%x: "
           "inconsistent CPU status\n",
-          __FUNCTION__,
+          __func__,
           CurrentSelector,
           CpuStatus
           ));
@@ -327,7 +327,7 @@ QemuCpuhpCollectApicIds (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: CurrentSelector=%u: fw_remove\n",
-        __FUNCTION__,
+        __func__,
         CurrentSelector
         ));
 
@@ -341,7 +341,7 @@ QemuCpuhpCollectApicIds (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: CurrentSelector=%u: remove (ignored)\n",
-        __FUNCTION__,
+        __func__,
         CurrentSelector
         ));
 
@@ -352,7 +352,7 @@ QemuCpuhpCollectApicIds (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: CurrentSelector=%u: no event\n",
-        __FUNCTION__,
+        __func__,
         CurrentSelector
         ));
       break;
@@ -368,7 +368,7 @@ QemuCpuhpCollectApicIds (
       // For unplug events, also save the CurrentSelector.
       //
       if (*ExtendCount == ApicIdCount) {
-        DEBUG ((DEBUG_ERROR, "%a: APIC ID array too small\n", __FUNCTION__));
+        DEBUG ((DEBUG_ERROR, "%a: APIC ID array too small\n", __func__));
         return EFI_BUFFER_TOO_SMALL;
       }
 
@@ -377,7 +377,7 @@ QemuCpuhpCollectApicIds (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: ApicId=" FMT_APIC_ID "\n",
-        __FUNCTION__,
+        __func__,
         NewApicId
         ));
       if (ExtendSels != NULL) {
@@ -399,7 +399,7 @@ QemuCpuhpCollectApicIds (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: PluggedCount=%u ToUnplugCount=%u\n",
-    __FUNCTION__,
+    __func__,
     *PluggedCount,
     *ToUnplugCount
     ));
diff --git a/OvmfPkg/CpuHotplugSmm/Smbase.c b/OvmfPkg/CpuHotplugSmm/Smbase.c
index 5d5060589317..dc6f4f4b4994 100644
--- a/OvmfPkg/CpuHotplugSmm/Smbase.c
+++ b/OvmfPkg/CpuHotplugSmm/Smbase.c
@@ -62,7 +62,7 @@ SmbaseAllocatePostSmmPen (
     DEBUG ((
       DEBUG_ERROR,
       "%a: mPostSmmPenSize=%u: %r\n",
-      __FUNCTION__,
+      __func__,
       mPostSmmPenSize,
       Status
       ));
@@ -77,11 +77,11 @@ SmbaseAllocatePostSmmPen (
                             &Address
                             );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: AllocatePages(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: AllocatePages(): %r\n", __func__, Status));
     return Status;
   }
 
-  DEBUG ((DEBUG_INFO, "%a: Post-SMM Pen at 0x%Lx\n", __FUNCTION__, Address));
+  DEBUG ((DEBUG_INFO, "%a: Post-SMM Pen at 0x%Lx\n", __func__, Address));
   *PenAddress = (UINT32)Address;
   return EFI_SUCCESS;
 }
@@ -211,7 +211,7 @@ SmbaseRelocate (
     DEBUG ((
       DEBUG_ERROR,
       "%a: ApicId=" FMT_APIC_ID " Smbase=0x%Lx: %r\n",
-      __FUNCTION__,
+      __func__,
       ApicId,
       (UINT64)Smbase,
       Status
@@ -289,7 +289,7 @@ SmbaseRelocate (
     DEBUG ((
       DEBUG_ERROR,
       "%a: ApicId=" FMT_APIC_ID " ApicIdGate=0x%Lx: %r\n",
-      __FUNCTION__,
+      __func__,
       ApicId,
       ExchangeResult,
       Status
diff --git a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c b/OvmfPkg/CpuS3DataDxe/CpuS3Data.c
index c192a09cf182..289048b75db3 100644
--- a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c
+++ b/OvmfPkg/CpuS3DataDxe/CpuS3Data.c
@@ -127,7 +127,7 @@ CpuS3DataOnEndOfDxe (
                                                     );
   ASSERT_EFI_ERROR (Status);
 
-  DEBUG ((DEBUG_VERBOSE, "%a\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
   MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable);
 
   //
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c b/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
index 5bed2e2b5107..410e4e457d9c 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c
@@ -190,7 +190,7 @@ LegacyInterruptInstall (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         HostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
index 4969c88dc33e..3c32b75bd692 100644
--- a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
+++ b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c
@@ -484,7 +484,7 @@ LegacyRegionInit (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         HostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
index 094e4c821bd5..88b6bafee8cc 100644
--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
@@ -393,7 +393,7 @@ EnrollListOfCerts (
   if (EFI_ERROR (Status)) {
     AsciiPrint (
       "error: %a(\"%s\", %g): %r\n",
-      __FUNCTION__,
+      __func__,
       VariableName,
       VendorGuid,
       Status
diff --git a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
index 14b41a533e96..0d116f60dd4d 100644
--- a/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
+++ b/OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
@@ -61,7 +61,7 @@ MapGcdMmioSpace (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to add GCD memory space for region [0x%Lx+0x%Lx)\n",
-      __FUNCTION__,
+      __func__,
       Base,
       Size
       ));
@@ -73,7 +73,7 @@ MapGcdMmioSpace (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to set memory space attributes for region [0x%Lx+0x%Lx)\n",
-      __FUNCTION__,
+      __func__,
       Base,
       Size
       ));
@@ -143,7 +143,7 @@ ProcessPciHost (
     DEBUG ((
       DEBUG_INFO,
       "%a: No 'pci-host-ecam-generic' compatible DT node found\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_NOT_FOUND;
   }
@@ -169,7 +169,7 @@ ProcessPciHost (
     DEBUG ((
       DEBUG_ERROR,
       "%a: 'reg' property not found or invalid\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_PROTOCOL_ERROR;
   }
@@ -194,7 +194,7 @@ ProcessPciHost (
     DEBUG ((
       DEBUG_ERROR,
       "%a: 'bus-range' not found or invalid\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_PROTOCOL_ERROR;
   }
@@ -212,7 +212,7 @@ ProcessPciHost (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid 'bus-range' and/or 'reg'\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_PROTOCOL_ERROR;
   }
@@ -224,7 +224,7 @@ ProcessPciHost (
   if (EFI_ERROR (Status) || (Len == 0) ||
       (Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0))
   {
-    DEBUG ((DEBUG_ERROR, "%a: 'ranges' not found or invalid\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: 'ranges' not found or invalid\n", __func__));
     return EFI_PROTOCOL_ERROR;
   }
 
@@ -251,7 +251,7 @@ ProcessPciHost (
         if ((*Mmio32Base > MAX_UINT32) || (*Mmio32Size > MAX_UINT32) ||
             (*Mmio32Base + *Mmio32Size > SIZE_4GB))
         {
-          DEBUG ((DEBUG_ERROR, "%a: MMIO32 space invalid\n", __FUNCTION__));
+          DEBUG ((DEBUG_ERROR, "%a: MMIO32 space invalid\n", __func__));
           return EFI_PROTOCOL_ERROR;
         }
 
@@ -262,7 +262,7 @@ ProcessPciHost (
             DEBUG_ERROR,
             "%a: unsupported nonzero MMIO32 translation "
             "0x%Lx\n",
-            __FUNCTION__,
+            __func__,
             Mmio32Translation
             ));
           return EFI_UNSUPPORTED;
@@ -282,7 +282,7 @@ ProcessPciHost (
             DEBUG_ERROR,
             "%a: unsupported nonzero MMIO64 translation "
             "0x%Lx\n",
-            __FUNCTION__,
+            __func__,
             Mmio64Translation
             ));
           return EFI_UNSUPPORTED;
@@ -293,7 +293,7 @@ ProcessPciHost (
   }
 
   if (*Mmio32Size == 0) {
-    DEBUG ((DEBUG_ERROR, "%a: MMIO32 space empty\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: MMIO32 space empty\n", __func__));
     return EFI_PROTOCOL_ERROR;
   }
 
@@ -307,7 +307,7 @@ ProcessPciHost (
     DEBUG_INFO,
     "%a: Config[0x%Lx+0x%Lx) Bus[0x%x..0x%x] "
     "Io[0x%Lx+0x%Lx)@0x%Lx Mem32[0x%Lx+0x%Lx)@0x0 Mem64[0x%Lx+0x%Lx)@0x0\n",
-    __FUNCTION__,
+    __func__,
     ConfigBase,
     ConfigSize,
     *BusMin,
@@ -370,7 +370,7 @@ PciHostBridgeGetRootBridges (
   PCI_ROOT_BRIDGE_APERTURE  PMemAbove4G;
 
   if (PcdGet64 (PcdPciExpressBaseAddress) == 0) {
-    DEBUG ((DEBUG_INFO, "%a: PCI host bridge not present\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: PCI host bridge not present\n", __func__));
 
     *Count = 0;
     return NULL;
@@ -390,7 +390,7 @@ PciHostBridgeGetRootBridges (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to discover PCI host bridge: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     *Count = 0;
diff --git a/OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c b/OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c
index b5a6718146f8..a3b09e547fb7 100644
--- a/OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c
+++ b/OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.c
@@ -58,7 +58,7 @@ GetPciIoTranslation (
   if (EFI_ERROR (Status) || (Len == 0) ||
       (Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0))
   {
-    DEBUG ((DEBUG_ERROR, "%a: 'ranges' not found or invalid\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: 'ranges' not found or invalid\n", __func__));
     return RETURN_PROTOCOL_ERROR;
   }
 
@@ -152,7 +152,7 @@ FdtPciPcdProducerLibConstructor (
         DEBUG ((
           DEBUG_WARN,
           "%a: 'pci-host-ecam-generic' device encountered with no I/O range\n",
-          __FUNCTION__
+          __func__
           ));
       }
     }
diff --git a/OvmfPkg/Fdt/HighMemDxe/HighMemDxe.c b/OvmfPkg/Fdt/HighMemDxe/HighMemDxe.c
index 87bc8b6827a2..779bf5c827f5 100644
--- a/OvmfPkg/Fdt/HighMemDxe/HighMemDxe.c
+++ b/OvmfPkg/Fdt/HighMemDxe/HighMemDxe.c
@@ -93,7 +93,7 @@ InitializeHighMemDxe (
         DEBUG ((
           DEBUG_WARN,
           "%a: Region 0x%lx - 0x%lx not found in the GCD memory space map\n",
-          __FUNCTION__,
+          __func__,
           CurBase,
           CurBase + CurSize - 1
           ));
@@ -112,7 +112,7 @@ InitializeHighMemDxe (
           DEBUG ((
             DEBUG_ERROR,
             "%a: Failed to add System RAM @ 0x%lx - 0x%lx (%r)\n",
-            __FUNCTION__,
+            __func__,
             CurBase,
             CurBase + CurSize - 1,
             Status
@@ -129,7 +129,7 @@ InitializeHighMemDxe (
           DEBUG ((
             DEBUG_WARN,
             "%a: gDS->SetMemorySpaceAttributes() failed on region 0x%lx - 0x%lx (%r)\n",
-            __FUNCTION__,
+            __func__,
             CurBase,
             CurBase + CurSize - 1,
             Status
@@ -160,7 +160,7 @@ InitializeHighMemDxe (
           DEBUG ((
             DEBUG_ERROR,
             "%a: Failed to set System RAM @ 0x%lx - 0x%lx attribute (%r)\n",
-            __FUNCTION__,
+            __func__,
             CurBase,
             CurBase + CurSize - 1,
             Status
@@ -169,7 +169,7 @@ InitializeHighMemDxe (
           DEBUG ((
             DEBUG_INFO,
             "%a: Add System RAM @ 0x%lx - 0x%lx\n",
-            __FUNCTION__,
+            __func__,
             CurBase,
             CurBase + CurSize - 1
             ));
diff --git a/OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.c b/OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.c
index 619740e6e708..668090dbea80 100644
--- a/OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.c
+++ b/OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.c
@@ -75,7 +75,7 @@ InitializeVirtioFdtDxe (
       DEBUG ((
         DEBUG_ERROR,
         "%a: GetNodeProperty () failed (Status == %r)\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       continue;
@@ -93,7 +93,7 @@ InitializeVirtioFdtDxe (
                                                    sizeof (VIRTIO_TRANSPORT_DEVICE_PATH)
                                                    );
     if (DevicePath == NULL) {
-      DEBUG ((DEBUG_ERROR, "%a: Out of memory\n", __FUNCTION__));
+      DEBUG ((DEBUG_ERROR, "%a: Out of memory\n", __func__));
       continue;
     }
 
@@ -117,7 +117,7 @@ InitializeVirtioFdtDxe (
         DEBUG_ERROR,
         "%a: Failed to install the EFI_DEVICE_PATH "
         "protocol on a new handle (Status == %r)\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       FreePool (DevicePath);
@@ -130,7 +130,7 @@ InitializeVirtioFdtDxe (
         DEBUG_ERROR,
         "%a: Failed to install VirtIO transport @ 0x%Lx "
         "on handle %p (Status == %r)\n",
-        __FUNCTION__,
+        __func__,
         RegBase,
         Handle,
         Status
@@ -152,7 +152,7 @@ InitializeVirtioFdtDxe (
       DEBUG_ERROR,
       "%a: Error occurred while iterating DT nodes "
       "(FindNodeStatus == %r)\n",
-      __FUNCTION__,
+      __func__,
       FindNodeStatus
       ));
   }
diff --git a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
index 686d85633e7c..3092a174bc51 100644
--- a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
+++ b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
@@ -275,7 +275,7 @@ CheckDevice (
     DEBUG ((
       DEBUG_WARN,
       "%a: 64-bit MMIO BARs may be degraded for PCI 0x%04x:0x%04x (rev %d)\n",
-      __FUNCTION__,
+      __func__,
       (UINT32)VendorId,
       (UINT32)DeviceId,
       (UINT8)RevisionId
diff --git a/OvmfPkg/IoMmuDxe/CcIoMmu.c b/OvmfPkg/IoMmuDxe/CcIoMmu.c
index 7c2843cd238a..b83a9690062b 100644
--- a/OvmfPkg/IoMmuDxe/CcIoMmu.c
+++ b/OvmfPkg/IoMmuDxe/CcIoMmu.c
@@ -92,7 +92,7 @@ IoMmuMap (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Operation=%a Host=0x%p Bytes=0x%Lx\n",
-    __FUNCTION__,
+    __func__,
     ((Operation >= 0 &&
       Operation < ARRAY_SIZE (mBusMasterOperationName)) ?
      mBusMasterOperationName[Operation] :
@@ -289,7 +289,7 @@ IoMmuMap (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Mapping=0x%p Device(PlainText)=0x%Lx Crypted=0x%Lx Pages=0x%Lx, ReservedMemBitmap=0x%Lx\n",
-    __FUNCTION__,
+    __func__,
     MapInfo,
     MapInfo->PlainTextAddress,
     MapInfo->CryptedAddress,
@@ -342,7 +342,7 @@ IoMmuUnmapWorker (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Mapping=0x%p MemoryMapLocked=%d\n",
-    __FUNCTION__,
+    __func__,
     Mapping,
     MemoryMapLocked
     ));
@@ -537,7 +537,7 @@ IoMmuAllocateBuffer (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: MemoryType=%u Pages=0x%Lx Attributes=0x%Lx\n",
-    __FUNCTION__,
+    __func__,
     (UINT32)MemoryType,
     (UINT64)Pages,
     Attributes
@@ -625,7 +625,7 @@ IoMmuAllocateBuffer (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Host=0x%Lx Stash=0x%p\n",
-    __FUNCTION__,
+    __func__,
     PhysicalAddress,
     StashBuffer
     ));
@@ -663,7 +663,7 @@ IoMmuFreeBuffer (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Host=0x%p Pages=0x%Lx\n",
-    __FUNCTION__,
+    __func__,
     HostAddress,
     (UINT64)Pages
     ));
@@ -818,7 +818,7 @@ IoMmuExitBoot (
   //   queue EventToSignal's NotifyFunction after the NotifyFunctions of *all*
   //   events in EFI_EVENT_GROUP_EXIT_BOOT_SERVICES.
   //
-  DEBUG ((DEBUG_VERBOSE, "%a\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
   gBS->SignalEvent (EventToSignal);
 }
 
@@ -847,7 +847,7 @@ IoMmuUnmapAllMappings (
   LIST_ENTRY  *NextNode;
   MAP_INFO    *MapInfo;
 
-  DEBUG ((DEBUG_VERBOSE, "%a\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
 
   //
   // All drivers that had set up IOMMU mappings have halted their respective
@@ -933,7 +933,7 @@ InstallIoMmuProtocol (
   if (EFI_ERROR (Status)) {
     mReservedSharedMemSupported = FALSE;
   } else {
-    DEBUG ((DEBUG_INFO, "%a: Feature of reserved memory for DMA is supported.\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: Feature of reserved memory for DMA is supported.\n", __func__));
   }
 
   return EFI_SUCCESS;
diff --git a/OvmfPkg/IoMmuDxe/IoMmuBuffer.c b/OvmfPkg/IoMmuDxe/IoMmuBuffer.c
index 83c7c5958340..c8f6cf4818e8 100644
--- a/OvmfPkg/IoMmuDxe/IoMmuBuffer.c
+++ b/OvmfPkg/IoMmuDxe/IoMmuBuffer.c
@@ -153,7 +153,7 @@ IoMmuInitReservedSharedMem (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: ReservedMem (%d pages) address = 0x%llx\n",
-    __FUNCTION__,
+    __func__,
     TotalPages,
     PhysicalAddress
     ));
@@ -330,7 +330,7 @@ InternalAllocateBuffer (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: range-size: %lx, start-address=0x%llx, pages=0x%llx, bits=0x%lx, bitmap: %lx => %lx\n",
-    __FUNCTION__,
+    __func__,
     MemRange->DataSize,
     *PhysicalAddress,
     Pages,
@@ -401,7 +401,7 @@ IoMmuFreeBounceBuffer (
     DEBUG ((
       DEBUG_VERBOSE,
       "%a: PlainTextAddress=0x%Lx, bits=0x%Lx, bitmap: %Lx => %Lx\n",
-      __FUNCTION__,
+      __func__,
       MapInfo->PlainTextAddress,
       MapInfo->ReservedMemBitmap,
       mReservedMemBitmap,
@@ -480,7 +480,7 @@ IoMmuFreeCommonBuffer (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: CommonBuffer=0x%Lx, bits=0x%Lx, bitmap: %Lx => %Lx\n",
-    __FUNCTION__,
+    __func__,
     (UINT64)(UINTN)CommonBufferHeader + SIZE_4KB,
     CommonBufferHeader->ReservedMemBitmap,
     mReservedMemBitmap,
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
index 6d1e1cb05e00..150fe07c672b 100644
--- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
@@ -62,7 +62,7 @@ AcpiTimerLibConstructor (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         HostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
index c771997a2a49..9b3cd055117a 100644
--- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c
@@ -59,7 +59,7 @@ AcpiTimerLibConstructor (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         HostBridgeDevId
         ));
       ASSERT (FALSE);
@@ -119,7 +119,7 @@ InternalAcpiGetTimerTick (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         HostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
index 01a41a6a4515..03d47cf11cce 100644
--- a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
+++ b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
@@ -76,7 +76,7 @@ AcpiTimerLibConstructor (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         HostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c
index b9c0a5b25ac0..a1f6e61c1e09 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c
@@ -164,7 +164,7 @@ AllocatePageTableMemory (
     DEBUG_VERBOSE,
     "%a:%a: Buffer=0x%Lx Pages=%ld\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     Buffer,
     Pages
     ));
@@ -561,7 +561,7 @@ InternalMemEncryptSevCreateIdentityMap1G (
     DEBUG_VERBOSE,
     "%a:%a: Cr3Base=0x%Lx Physical=0x%Lx Length=0x%Lx\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     Cr3BaseAddress,
     PhysicalAddress,
     (UINT64)Length
@@ -606,7 +606,7 @@ InternalMemEncryptSevCreateIdentityMap1G (
         DEBUG_ERROR,
         "%a:%a: bad PML4 for Physical=0x%Lx\n",
         gEfiCallerBaseName,
-        __FUNCTION__,
+        __func__,
         PhysicalAddress
         ));
       Status = RETURN_NO_MAPPING;
@@ -713,7 +713,7 @@ SetMemoryEncDec (
     DEBUG_VERBOSE,
     "%a:%a: Cr3Base=0x%Lx Physical=0x%Lx Length=0x%Lx Mode=%a CacheFlush=%u Mmio=%u\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     Cr3BaseAddress,
     PhysicalAddress,
     (UINT64)Length,
@@ -786,7 +786,7 @@ SetMemoryEncDec (
         DEBUG_ERROR,
         "%a:%a: bad PML4 for Physical=0x%Lx\n",
         gEfiCallerBaseName,
-        __FUNCTION__,
+        __func__,
         PhysicalAddress
         ));
       Status = RETURN_NO_MAPPING;
@@ -803,7 +803,7 @@ SetMemoryEncDec (
         DEBUG_ERROR,
         "%a:%a: bad PDPE for Physical=0x%Lx\n",
         gEfiCallerBaseName,
-        __FUNCTION__,
+        __func__,
         PhysicalAddress
         ));
       Status = RETURN_NO_MAPPING;
@@ -824,7 +824,7 @@ SetMemoryEncDec (
           DEBUG_VERBOSE,
           "%a:%a: updated 1GB entry for Physical=0x%Lx\n",
           gEfiCallerBaseName,
-          __FUNCTION__,
+          __func__,
           PhysicalAddress
           ));
         PhysicalAddress += BIT30;
@@ -837,7 +837,7 @@ SetMemoryEncDec (
           DEBUG_VERBOSE,
           "%a:%a: splitting 1GB page for Physical=0x%Lx\n",
           gEfiCallerBaseName,
-          __FUNCTION__,
+          __func__,
           PhysicalAddress
           ));
         Split1GPageTo2M (
@@ -865,7 +865,7 @@ SetMemoryEncDec (
           DEBUG_ERROR,
           "%a:%a: bad PDE for Physical=0x%Lx\n",
           gEfiCallerBaseName,
-          __FUNCTION__,
+          __func__,
           PhysicalAddress
           ));
         Status = RETURN_NO_MAPPING;
@@ -892,7 +892,7 @@ SetMemoryEncDec (
             DEBUG_VERBOSE,
             "%a:%a: splitting 2MB page for Physical=0x%Lx\n",
             gEfiCallerBaseName,
-            __FUNCTION__,
+            __func__,
             PhysicalAddress
             ));
           Split2MPageTo4K (
@@ -917,7 +917,7 @@ SetMemoryEncDec (
             DEBUG_ERROR,
             "%a:%a: bad PTE for Physical=0x%Lx\n",
             gEfiCallerBaseName,
-            __FUNCTION__,
+            __func__,
             PhysicalAddress
             ));
           Status = RETURN_NO_MAPPING;
diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
index 7a8878b1a9c2..85eb41585b91 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -113,7 +113,7 @@ PvalidateRange (
         DEBUG_ERROR,
         "%a:%a: Failed to %a address 0x%Lx Error code %d\n",
         gEfiCallerBaseName,
-        __FUNCTION__,
+        __func__,
         Validate ? "Validate" : "Invalidate",
         Address,
         Ret
@@ -237,7 +237,7 @@ InternalSetPageState (
     DEBUG_VERBOSE,
     "%a:%a Address 0x%Lx - 0x%Lx State = %a LargeEntry = %d\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     BaseAddress,
     EndAddress,
     State == SevSnpPageShared ? "Shared" : "Private",
diff --git a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
index 5b13042512ad..a01dc98852b8 100644
--- a/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
+++ b/OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
@@ -180,7 +180,7 @@ AllocatePageTableMemory (
     DEBUG_VERBOSE,
     "%a:%a: Buffer=0x%Lx Pages=%ld\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     Buffer,
     Pages
     ));
@@ -542,7 +542,7 @@ SetOrClearSharedBit (
 
   TdStatus = TdVmCall (TDVMCALL_MAPGPA, PhysicalAddress, Length, 0, 0, NULL);
   if (TdStatus != 0) {
-    DEBUG ((DEBUG_ERROR, "%a: TdVmcall(MAPGPA) failed with %llx\n", __FUNCTION__, TdStatus));
+    DEBUG ((DEBUG_ERROR, "%a: TdVmcall(MAPGPA) failed with %llx\n", __func__, TdStatus));
     ASSERT (FALSE);
     return EFI_DEVICE_ERROR;
   }
@@ -553,14 +553,14 @@ SetOrClearSharedBit (
   if (Mode == ClearSharedBit) {
     Status = gBS->LocateProtocol (&gEdkiiMemoryAcceptProtocolGuid, NULL, (VOID **)&MemoryAcceptProtocol);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a: Failed to locate MemoryAcceptProtocol with %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a: Failed to locate MemoryAcceptProtocol with %r\n", __func__, Status));
       ASSERT (FALSE);
       return Status;
     }
 
     Status = MemoryAcceptProtocol->AcceptMemory (MemoryAcceptProtocol, PhysicalAddress, Length);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a: Failed to AcceptMemory with %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a: Failed to AcceptMemory with %r\n", __func__, Status));
       ASSERT (FALSE);
       return Status;
     }
@@ -570,7 +570,7 @@ SetOrClearSharedBit (
     DEBUG_VERBOSE,
     "%a:%a: pte=0x%Lx AddressEncMask=0x%Lx Mode=0x%x MapGPA Status=0x%x\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     *PageTablePointer,
     AddressEncMask,
     Mode,
@@ -677,7 +677,7 @@ SetMemorySharedOrPrivate (
     DEBUG_VERBOSE,
     "%a:%a: Cr3Base=0x%Lx Physical=0x%Lx Length=0x%Lx Mode=%a\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     Cr3BaseAddress,
     PhysicalAddress,
     (UINT64)Length,
@@ -734,7 +734,7 @@ SetMemorySharedOrPrivate (
         DEBUG_ERROR,
         "%a:%a: bad PML4 for Physical=0x%Lx\n",
         gEfiCallerBaseName,
-        __FUNCTION__,
+        __func__,
         PhysicalAddress
         ));
       Status = RETURN_NO_MAPPING;
@@ -751,7 +751,7 @@ SetMemorySharedOrPrivate (
         DEBUG_ERROR,
         "%a:%a: bad PDPE for Physical=0x%Lx\n",
         gEfiCallerBaseName,
-        __FUNCTION__,
+        __func__,
         PhysicalAddress
         ));
       Status = RETURN_NO_MAPPING;
@@ -776,7 +776,7 @@ SetMemorySharedOrPrivate (
           DEBUG_VERBOSE,
           "%a:%a: updated 1GB entry for Physical=0x%Lx\n",
           gEfiCallerBaseName,
-          __FUNCTION__,
+          __func__,
           PhysicalAddress
           ));
         PhysicalAddress += BIT30;
@@ -789,7 +789,7 @@ SetMemorySharedOrPrivate (
           DEBUG_VERBOSE,
           "%a:%a: splitting 1GB page for Physical=0x%Lx\n",
           gEfiCallerBaseName,
-          __FUNCTION__,
+          __func__,
           PhysicalAddress
           ));
         Split1GPageTo2M (
@@ -817,7 +817,7 @@ SetMemorySharedOrPrivate (
           DEBUG_ERROR,
           "%a:%a: bad PDE for Physical=0x%Lx\n",
           gEfiCallerBaseName,
-          __FUNCTION__,
+          __func__,
           PhysicalAddress
           ));
         Status = RETURN_NO_MAPPING;
@@ -848,7 +848,7 @@ SetMemorySharedOrPrivate (
             DEBUG_VERBOSE,
             "%a:%a: splitting 2MB page for Physical=0x%Lx\n",
             gEfiCallerBaseName,
-            __FUNCTION__,
+            __func__,
             PhysicalAddress
             ));
 
@@ -877,7 +877,7 @@ SetMemorySharedOrPrivate (
             DEBUG_ERROR,
             "%a:%a: bad PTE for Physical=0x%Lx\n",
             gEfiCallerBaseName,
-            __FUNCTION__,
+            __func__,
             PhysicalAddress
             ));
           Status = RETURN_NO_MAPPING;
diff --git a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
index 4215e6cdaa2e..766a2ccb9c60 100644
--- a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
+++ b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
@@ -427,7 +427,7 @@ DebugDumpPciCapList (
       DEBUG_VERBOSE,
       "%a:%a: %a 0x%04x %03u/%03u v0x%x @0x%03x+0x%03x\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (Info.Domain == PciCapNormal ? "Norm" : "Extd"),
       Info.CapId,
       Info.Instance,
@@ -753,7 +753,7 @@ PciCapListInit (
     DEBUG_ERROR,
     "%a:%a: %r\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     Status
     ));
   return Status;
diff --git a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
index 2c1de0039d36..9acc6fbe20fc 100644
--- a/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
+++ b/OvmfPkg/Library/CcExitLib/CcExitVeHandler.c
@@ -265,7 +265,7 @@ TdxMmioReadWrite (
   UINT64  TdStatus;
 
   if ((MmioSize != 1) && (MmioSize != 2) && (MmioSize != 4) && (MmioSize != 8)) {
-    DEBUG ((DEBUG_ERROR, "%a: Invalid MmioSize - %d\n", __FUNCTION__, MmioSize));
+    DEBUG ((DEBUG_ERROR, "%a: Invalid MmioSize - %d\n", __func__, MmioSize));
     return EFI_INVALID_PARAMETER;
   }
 
@@ -283,7 +283,7 @@ TdxMmioReadWrite (
   }
 
   if (TdStatus != 0) {
-    DEBUG ((DEBUG_ERROR, "%a: TdVmcall failed with %llx\n", __FUNCTION__, TdStatus));
+    DEBUG ((DEBUG_ERROR, "%a: TdVmcall failed with %llx\n", __func__, TdStatus));
     return EFI_ABORTED;
   }
 
@@ -334,7 +334,7 @@ ParseMmioExitInstructions (
 
   Status = CcInitInstructionData (InstructionData, NULL, Regs);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: Initialize InstructionData failed! (%r)\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: Initialize InstructionData failed! (%r)\n", __func__, Status));
     return Status;
   }
 
@@ -361,7 +361,7 @@ ParseMmioExitInstructions (
                0);
 
       if (InstructionData->Ext.ModRm.Mod == 3) {
-        DEBUG ((DEBUG_ERROR, "%a: Parse Ext.ModRm.Mod error! (OpCode: 0x%x)\n", __FUNCTION__, OpCode));
+        DEBUG ((DEBUG_ERROR, "%a: Parse Ext.ModRm.Mod error! (OpCode: 0x%x)\n", __func__, OpCode));
         return EFI_UNSUPPORTED;
       }
 
@@ -440,7 +440,7 @@ ParseMmioExitInstructions (
         //
         // NPF on two register operands???
         //
-        DEBUG ((DEBUG_ERROR, "%a: Parse Ext.ModRm.Mod error! (OpCode: 0x%x)\n", __FUNCTION__, OpCode));
+        DEBUG ((DEBUG_ERROR, "%a: Parse Ext.ModRm.Mod error! (OpCode: 0x%x)\n", __func__, OpCode));
         return EFI_UNSUPPORTED;
       }
 
@@ -558,7 +558,7 @@ ParseMmioExitInstructions (
       break;
 
     default:
-      DEBUG ((DEBUG_ERROR, "%a: Invalid MMIO opcode (%x)\n", __FUNCTION__, OpCode));
+      DEBUG ((DEBUG_ERROR, "%a: Invalid MMIO opcode (%x)\n", __func__, OpCode));
       Status = EFI_UNSUPPORTED;
   }
 
@@ -606,12 +606,12 @@ MmioExit (
     Gpaw             = (UINT8)(TdReturnData.TdInfo.Gpaw & 0x3f);
     TdSharedPageMask = 1ULL << (Gpaw - 1);
   } else {
-    DEBUG ((DEBUG_ERROR, "%a: TDCALL failed with status=%llx\n", __FUNCTION__, TdStatus));
+    DEBUG ((DEBUG_ERROR, "%a: TDCALL failed with status=%llx\n", __func__, TdStatus));
     goto FatalError;
   }
 
   if ((Veinfo->GuestPA & TdSharedPageMask) == 0) {
-    DEBUG ((DEBUG_ERROR, "%a: EPT-violation #VE on private memory is not allowed!", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: EPT-violation #VE on private memory is not allowed!", __func__));
     goto FatalError;
   }
 
@@ -624,7 +624,7 @@ MmioExit (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Address is not correct! (%d: 0x%llx != 0x%llx)\n",
-      __FUNCTION__,
+      __func__,
       ParsedInstruction.OpCode,
       Veinfo->GuestPA,
       ParsedInstruction.Address
diff --git a/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c b/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c
index c751b106792f..b99fb350aa8f 100644
--- a/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c
+++ b/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c
@@ -201,7 +201,7 @@ QemuLoadKernelImage (
       DEBUG ((
         Status == EFI_NOT_FOUND ? DEBUG_INFO : DEBUG_ERROR,
         "%a: LoadImage(): %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       return Status;
@@ -279,7 +279,7 @@ QemuLoadKernelImage (
       DEBUG ((
         DEBUG_ERROR,
         "%a: kernel command line is not NUL-terminated\n",
-        __FUNCTION__
+        __func__
         ));
       Status = EFI_PROTOCOL_ERROR;
       goto FreeCommandLine;
@@ -330,7 +330,7 @@ QemuLoadKernelImage (
     DEBUG ((
       DEBUG_INFO,
       "%a: command line: \"%s\"\n",
-      __FUNCTION__,
+      __func__,
       (CHAR16 *)KernelLoadedImage->LoadOptions
       ));
   }
diff --git a/OvmfPkg/Library/HardwareInfoLib/HardwareInfoDxe.c b/OvmfPkg/Library/HardwareInfoLib/HardwareInfoDxe.c
index a74de5287153..5a1a69dcc370 100644
--- a/OvmfPkg/Library/HardwareInfoLib/HardwareInfoDxe.c
+++ b/OvmfPkg/Library/HardwareInfoLib/HardwareInfoDxe.c
@@ -91,7 +91,7 @@ CreateHardwareInfoList (
   DEBUG ((
     EFI_D_ERROR,
     "%a: Failed to allocate memory for hardware info\n",
-    __FUNCTION__
+    __func__
     ));
 
   return EFI_OUT_OF_RESOURCES;
diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxLib.c b/OvmfPkg/Library/LockBoxLib/LockBoxLib.c
index 2000afeeb85e..a8af4ea8d009 100644
--- a/OvmfPkg/Library/LockBoxLib/LockBoxLib.c
+++ b/OvmfPkg/Library/LockBoxLib/LockBoxLib.c
@@ -125,7 +125,7 @@ SaveLockBox (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Guid=%g Buffer=%p Length=0x%x\n",
-    __FUNCTION__,
+    __func__,
     Guid,
     Buffer,
     (UINT32)Length
@@ -196,7 +196,7 @@ SetLockBoxAttributes (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Guid=%g Attributes=0x%Lx\n",
-    __FUNCTION__,
+    __func__,
     Guid,
     Attributes
     ));
@@ -253,7 +253,7 @@ UpdateLockBox (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Guid=%g Offset=0x%x Length=0x%x\n",
-    __FUNCTION__,
+    __func__,
     Guid,
     (UINT32)Offset,
     (UINT32)Length
@@ -315,7 +315,7 @@ RestoreLockBox (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Guid=%g Buffer=%p\n",
-    __FUNCTION__,
+    __func__,
     Guid,
     Buffer
     ));
@@ -397,7 +397,7 @@ RestoreAllLockBoxInPlace (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: Guid=%g Buffer=%p\n",
-        __FUNCTION__,
+        __func__,
         &Header->Guid,
         Buffer
         ));
diff --git a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
index cad2bd6c9687..0424aa5df124 100644
--- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
+++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
@@ -156,7 +156,7 @@ PciHostBridgeUtilityInitRootBridge (
                  &mRootBridgeDevicePathTemplate
                  );
   if (DevicePath == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, EFI_OUT_OF_RESOURCES));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, EFI_OUT_OF_RESOURCES));
     return EFI_OUT_OF_RESOURCES;
   }
 
@@ -166,7 +166,7 @@ PciHostBridgeUtilityInitRootBridge (
   DEBUG ((
     DEBUG_INFO,
     "%a: populated root bus %d, with room for %d subordinate bus(es)\n",
-    __FUNCTION__,
+    __func__,
     RootBusNumber,
     MaxSubBusNumber - RootBusNumber
     ));
@@ -253,7 +253,7 @@ PciHostBridgeUtilityGetRootBridgesBusScan (
       DEBUG_ERROR,
       "%a: invalid bus range with BusMin %Lu and BusMax "
       "%Lu\n",
-      __FUNCTION__,
+      __func__,
       (UINT64)BusMin,
       (UINT64)BusMax
       ));
@@ -283,7 +283,7 @@ PciHostBridgeUtilityGetRootBridgesBusScan (
         DEBUG_ERROR,
         "%a: invalid count of extra root buses (%Lu) "
         "reported by QEMU\n",
-        __FUNCTION__,
+        __func__,
         ExtraRootBridges
         ));
       return NULL;
@@ -292,7 +292,7 @@ PciHostBridgeUtilityGetRootBridgesBusScan (
     DEBUG ((
       DEBUG_INFO,
       "%a: %Lu extra root buses reported by QEMU\n",
-      __FUNCTION__,
+      __func__,
       ExtraRootBridges
       ));
   }
@@ -302,7 +302,7 @@ PciHostBridgeUtilityGetRootBridgesBusScan (
   //
   Bridges = AllocatePool ((1 + (UINTN)ExtraRootBridges) * sizeof *Bridges);
   if (Bridges == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, EFI_OUT_OF_RESOURCES));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, EFI_OUT_OF_RESOURCES));
     return NULL;
   }
 
@@ -471,7 +471,7 @@ PciHostBridgeUtilityGetRootBridgesHostProvided (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Failed to allocate memory for hardware resources info\n",
-      __FUNCTION__
+      __func__
       ));
     return NULL;
   }
@@ -495,7 +495,7 @@ PciHostBridgeUtilityGetRootBridgesHostProvided (
       DEBUG_ERROR,
       "%a: Failed to create hardware info list to retrieve host "
       "bridges information from fw-cfg\n",
-      __FUNCTION__
+      __func__
       ));
 
     goto FreeBridges;
@@ -514,7 +514,7 @@ PciHostBridgeUtilityGetRootBridgesHostProvided (
   DEBUG ((
     DEBUG_INFO,
     "%a: Host provided description for %Lu root bridges\n",
-    __FUNCTION__,
+    __func__,
     PciHostBridgeCount
     ));
 
@@ -523,7 +523,7 @@ PciHostBridgeUtilityGetRootBridgesHostProvided (
   //
   Bridges = AllocatePool (((UINTN)PciHostBridgeCount) * sizeof *Bridges);
   if (Bridges == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, EFI_OUT_OF_RESOURCES));
+    DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, EFI_OUT_OF_RESOURCES));
     goto FreeBridges;
   }
 
@@ -567,7 +567,7 @@ PciHostBridgeUtilityGetRootBridgesHostProvided (
         DEBUG_ERROR,
         "%a: invalid bus range with BusMin %Lu and BusMax "
         "%Lu\n",
-        __FUNCTION__,
+        __func__,
         (UINT64)RootBridgeNumber,
         (UINT64)LastRootBridgeNumber
         ));
diff --git a/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c b/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c
index b444c052d1bf..e2c1bac5e059 100644
--- a/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c
+++ b/OvmfPkg/Library/PeilessStartupLib/X64/VirtualMemory.c
@@ -371,7 +371,7 @@ AllocatePageTableMemory (
     DEBUG_INFO,
     "%a:%a: Buffer=0x%Lx Pages=%ld, PageTablePool=%p\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     Buffer,
     Pages,
     *PageTablePool
diff --git a/OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c b/OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c
index 065673d90494..18091640d12d 100644
--- a/OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c
+++ b/OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c
@@ -122,7 +122,7 @@ HandleStatusCode (
       DEBUG_ERROR,
       "%a:%a: malformed Data\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     return EFI_INVALID_PARAMETER;
   }
@@ -143,7 +143,7 @@ HandleStatusCode (
       DEBUG_ERROR,
       "%a:%a: failed to get %g:\"%s\": %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       &gEfiGlobalVariableGuid,
       EFI_BOOT_CURRENT_VARIABLE_NAME,
       Status
@@ -156,7 +156,7 @@ HandleStatusCode (
       DEBUG_ERROR,
       "%a:%a: got %Lu bytes for %g:\"%s\", expected %Lu\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (UINT64)VariableSize,
       &gEfiGlobalVariableGuid,
       EFI_BOOT_CURRENT_VARIABLE_NAME,
@@ -180,7 +180,7 @@ HandleStatusCode (
       DEBUG_ERROR,
       "%a:%a: EfiBootManagerVariableToLoadOption(\"%s\"): %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       BootOptionName,
       Status
       ));
@@ -309,7 +309,7 @@ PlatformBmPrintScRegisterHandler (
       DEBUG_ERROR,
       "%a:%a: failed to register status code handler: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return Status;
@@ -337,7 +337,7 @@ PlatformBmPrintScRegisterHandler (
       "%a:%a: failed to create ExitBootServices() event: "
       "%r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     StatusCodeRouter->Unregister (HandleStatusCode);
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 98f6f07341ec..a90076c9e672 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -275,7 +275,7 @@ RemoveStaleFvFileOptions (
     DEBUG ((
       EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,
       "%a: removing stale Boot#%04x %s: %r\n",
-      __FUNCTION__,
+      __func__,
       (UINT32)BootOptions[Index].OptionNumber,
       DevicePathString == NULL ? L"<unavailable>" : DevicePathString,
       Status
@@ -479,7 +479,7 @@ PlatformBootManagerBeforeConsole (
   DEBUG ((
     EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,
     "%a: SetVariable(%s, %u): %r\n",
-    __FUNCTION__,
+    __func__,
     EFI_TIME_OUT_VARIABLE_NAME,
     FrontPageTimeout,
     Status
@@ -632,7 +632,7 @@ ConnectVirtioPciRng (
   return EFI_SUCCESS;
 
 Error:
-  DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+  DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
   return Status;
 }
 
@@ -1283,7 +1283,7 @@ SetPciIntLine (
       DEBUG ((
         DEBUG_ERROR,
         "%a: PCI host bridge (00:00.0) should have no interrupts!\n",
-        __FUNCTION__
+        __func__
         ));
       ASSERT (FALSE);
     }
@@ -1338,7 +1338,7 @@ SetPciIntLine (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: [%02x:%02x.%x] %s -> 0x%02x\n",
-        __FUNCTION__,
+        __func__,
         (UINT32)Bus,
         (UINT32)Device,
         (UINT32)Function,
@@ -1416,7 +1416,7 @@ PciAcpiInitialization (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         mHostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
index 1e66e3c45258..84b25db52159 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
@@ -44,7 +44,7 @@ TryRunningQemuKernel (
     DEBUG ((
       DEBUG_ERROR,
       "%a: QemuStartKernelImage(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
index bf2701965ff2..ac9c02cb1c59 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
@@ -273,7 +273,7 @@ RemoveStaleFvFileOptions (
     DEBUG ((
       EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,
       "%a: removing stale Boot#%04x %s: %r\n",
-      __FUNCTION__,
+      __func__,
       (UINT32)BootOptions[Index].OptionNumber,
       DevicePathString == NULL ? L"<unavailable>" : DevicePathString,
       Status
@@ -586,7 +586,7 @@ ConnectVirtioPciRng (
   return EFI_SUCCESS;
 
 Error:
-  DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+  DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
   return Status;
 }
 
@@ -1156,7 +1156,7 @@ SetPciIntLine (
       DEBUG ((
         DEBUG_ERROR,
         "%a: PCI host bridge (00:00.0) should have no interrupts!\n",
-        __FUNCTION__
+        __func__
         ));
       ASSERT (FALSE);
     }
@@ -1213,7 +1213,7 @@ SetPciIntLine (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: [%02x:%02x.%x] %s -> 0x%02x\n",
-        __FUNCTION__,
+        __func__,
         (UINT32)Bus,
         (UINT32)Device,
         (UINT32)Function,
@@ -1283,7 +1283,7 @@ PciAcpiInitialization (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         mHostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
index a402589206bb..df8e2fe15786 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
@@ -280,7 +280,7 @@ RemoveStaleFvFileOptions (
     DEBUG ((
       EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,
       "%a: removing stale Boot#%04x %s: %r\n",
-      __FUNCTION__,
+      __func__,
       (UINT32)BootOptions[Index].OptionNumber,
       DevicePathString == NULL ? L"<unavailable>" : DevicePathString,
       Status
@@ -551,7 +551,7 @@ ConnectVirtioPciRng (
   return EFI_SUCCESS;
 
 Error:
-  DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));
+  DEBUG ((DEBUG_ERROR, "%a: %r\n", __func__, Status));
   return Status;
 }
 
@@ -1157,7 +1157,7 @@ SetPciIntLine (
       DEBUG ((
         DEBUG_ERROR,
         "%a: PCI host bridge (00:00.0) should have no interrupts!\n",
-        __FUNCTION__
+        __func__
         ));
       ASSERT (FALSE);
     }
@@ -1212,7 +1212,7 @@ SetPciIntLine (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: [%02x:%02x.%x] %s -> 0x%02x\n",
-        __FUNCTION__,
+        __func__,
         (UINT32)Bus,
         (UINT32)Device,
         (UINT32)Function,
@@ -1280,7 +1280,7 @@ PciAcpiInitialization (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         mHostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c
index 1e66e3c45258..84b25db52159 100644
--- a/OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c
+++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c
@@ -44,7 +44,7 @@ TryRunningQemuKernel (
     DEBUG ((
       DEBUG_ERROR,
       "%a: QemuStartKernelImage(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index aced8535e6d1..acf90b4e93fd 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -91,7 +91,7 @@ PlatformQemuUc32BaseInitialization (
       DEBUG_VERBOSE,
       "%a: rounded UC32 base from 0x%x up to 0x%x, for "
       "an UC32 size of 0x%x\n",
-      __FUNCTION__,
+      __func__,
       PlatformInfoHob->LowMemory,
       PlatformInfoHob->Uc32Base,
       PlatformInfoHob->Uc32Size
@@ -123,7 +123,7 @@ PlatformGetFirstNonAddressCB (
 
   Candidate = E820Entry->BaseAddr + E820Entry->Length;
   if (PlatformInfoHob->FirstNonAddress < Candidate) {
-    DEBUG ((DEBUG_INFO, "%a: FirstNonAddress=0x%Lx\n", __FUNCTION__, Candidate));
+    DEBUG ((DEBUG_INFO, "%a: FirstNonAddress=0x%Lx\n", __func__, Candidate));
     PlatformInfoHob->FirstNonAddress = Candidate;
   }
 }
@@ -151,7 +151,7 @@ PlatformGetLowMemoryCB (
   }
 
   if (PlatformInfoHob->LowMemory < Candidate) {
-    DEBUG ((DEBUG_INFO, "%a: LowMemory=0x%Lx\n", __FUNCTION__, Candidate));
+    DEBUG ((DEBUG_INFO, "%a: LowMemory=0x%Lx\n", __func__, Candidate));
     PlatformInfoHob->LowMemory = (UINT32)Candidate;
   }
 }
@@ -180,7 +180,7 @@ PlatformAddHobCB (
         Base = ALIGN_VALUE (Base, (UINT64)EFI_PAGE_SIZE);
         End  = End & ~(UINT64)EFI_PAGE_MASK;
         if (Base < End) {
-          DEBUG ((DEBUG_INFO, "%a: HighMemory [0x%Lx, 0x%Lx)\n", __FUNCTION__, Base, End));
+          DEBUG ((DEBUG_INFO, "%a: HighMemory [0x%Lx, 0x%Lx)\n", __func__, Base, End));
           PlatformAddMemoryRangeHob (Base, End);
         }
       }
@@ -188,13 +188,13 @@ PlatformAddHobCB (
       break;
     case EfiAcpiAddressRangeReserved:
       BuildResourceDescriptorHob (EFI_RESOURCE_MEMORY_RESERVED, 0, Base, End - Base);
-      DEBUG ((DEBUG_INFO, "%a: Reserved [0x%Lx, 0x%Lx)\n", __FUNCTION__, Base, End));
+      DEBUG ((DEBUG_INFO, "%a: Reserved [0x%Lx, 0x%Lx)\n", __func__, Base, End));
       break;
     default:
       DEBUG ((
         DEBUG_WARN,
         "%a: Type %u [0x%Lx, 0x%Lx) (NOT HANDLED)\n",
-        __FUNCTION__,
+        __func__,
         E820Entry->Type,
         Base,
         End
@@ -241,7 +241,7 @@ PlatformReservationConflictCB (
   DEBUG ((
     DEBUG_INFO,
     "%a: move mmio: 0x%Lx => %Lx\n",
-    __FUNCTION__,
+    __func__,
     PlatformInfoHob->PcdPciMmio64Base,
     NewBase
     ));
@@ -495,7 +495,7 @@ PlatformGetFirstNonAddress (
       DEBUG ((
         DEBUG_WARN,
         "%a: ignoring malformed 64-bit PCI host aperture size from fw_cfg\n",
-        __FUNCTION__
+        __func__
         ));
       break;
   }
@@ -505,7 +505,7 @@ PlatformGetFirstNonAddress (
       DEBUG ((
         DEBUG_INFO,
         "%a: disabling 64-bit PCI host aperture\n",
-        __FUNCTION__
+        __func__
         ));
     }
 
@@ -534,7 +534,7 @@ PlatformGetFirstNonAddress (
     DEBUG ((
       DEBUG_VERBOSE,
       "%a: HotPlugMemoryEnd=0x%Lx\n",
-      __FUNCTION__,
+      __func__,
       HotPlugMemoryEnd
       ));
 
@@ -638,7 +638,7 @@ PlatformAddressWidthFromCpuid (
   DEBUG ((
     DEBUG_INFO,
     "%a: Signature: '%a', PhysBits: %d, QemuQuirk: %a, Valid: %a\n",
-    __FUNCTION__,
+    __func__,
     Signature,
     PhysBits,
     QemuQuirk ? "On" : "Off",
@@ -783,7 +783,7 @@ PlatformScanHostProvided64BitPciMmioEnd (
       DEBUG ((
         DEBUG_ERROR,
         "%a: ignoring malformed hardware information from fw_cfg\n",
-        __FUNCTION__
+        __func__
         ));
       *PciMmioAddressEnd = 0;
       return Status;
@@ -806,7 +806,7 @@ PlatformScanHostProvided64BitPciMmioEnd (
     DEBUG ((
       DEBUG_INFO,
       "%a: Pci64End=0x%Lx\n",
-      __FUNCTION__,
+      __func__,
       *PciMmioAddressEnd
       ));
 
@@ -942,7 +942,7 @@ PlatformQemuInitializeRam (
   MTRR_SETTINGS  MtrrSettings;
   EFI_STATUS     Status;
 
-  DEBUG ((DEBUG_INFO, "%a called\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a called\n", __func__));
 
   //
   // Determine total memory size available
diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Platform.c
index 5cf8af825a2f..f48bf16ae300 100644
--- a/OvmfPkg/Library/PlatformInitLib/Platform.c
+++ b/OvmfPkg/Library/PlatformInitLib/Platform.c
@@ -358,7 +358,7 @@ PlatformMiscInitialization (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         PlatformInfoHob->HostBridgeDevId
         ));
       ASSERT (FALSE);
@@ -366,7 +366,7 @@ PlatformMiscInitialization (
   }
 
   if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {
-    DEBUG ((DEBUG_INFO, "%a: Cloud Hypervisor is done.\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: Cloud Hypervisor is done.\n", __func__));
     return;
   }
 
@@ -489,12 +489,12 @@ PlatformCpuCountBugCheck (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Present=%u Possible=%u\n",
-      __FUNCTION__,
+      __func__,
       *Present,
       *Possible
       ));
     for (Idx = 0; Idx < ARRAY_SIZE (Message); ++Idx) {
-      DEBUG ((DEBUG_ERROR, "%a: %a\n", __FUNCTION__, Message[Idx]));
+      DEBUG ((DEBUG_ERROR, "%a: %a\n", __func__, Message[Idx]));
     }
 
     ParseStatus = QemuFwCfgParseBool (
@@ -505,7 +505,7 @@ PlatformCpuCountBugCheck (
       DEBUG ((
         DEBUG_WARN,
         "%a: \"%a\" active. You've been warned.\n",
-        __FUNCTION__,
+        __func__,
         CPUHP_BUGCHECK_OVERRIDE_FWCFG_FILE
         ));
       //
@@ -531,7 +531,7 @@ PlatformCpuCountBugCheck (
     DEBUG ((
       DEBUG_WARN,
       "%a: QEMU v2.7 reset bug: BootCpuCount=%d Present=%u\n",
-      __FUNCTION__,
+      __func__,
       *BootCpuCount,
       *Present
       ));
@@ -573,7 +573,7 @@ PlatformMaxCpuCountInitialization (
     // until PcdCpuApInitTimeOutInMicroSeconds elapses (whichever is reached
     // first).
     //
-    DEBUG ((DEBUG_WARN, "%a: boot CPU count unavailable\n", __FUNCTION__));
+    DEBUG ((DEBUG_WARN, "%a: boot CPU count unavailable\n", __func__));
     MaxCpuCount = PlatformInfoHob->DefaultMaxCpuNumber;
   } else {
     //
@@ -626,7 +626,7 @@ PlatformMaxCpuCountInitialization (
     //    steps. Both cases confirm modern mode.
     //
     CmdData2 = IoRead32 (CpuHpBase + QEMU_CPUHP_R_CMD_DATA2);
-    DEBUG ((DEBUG_VERBOSE, "%a: CmdData2=0x%x\n", __FUNCTION__, CmdData2));
+    DEBUG ((DEBUG_VERBOSE, "%a: CmdData2=0x%x\n", __func__, CmdData2));
     if (CmdData2 != 0) {
       //
       // QEMU doesn't support the modern CPU hotplug interface. Assume that the
@@ -635,7 +635,7 @@ PlatformMaxCpuCountInitialization (
       DEBUG ((
         DEBUG_WARN,
         "%a: modern CPU hotplug interface unavailable\n",
-        __FUNCTION__
+        __func__
         ));
       MaxCpuCount = BootCpuCount;
     } else {
@@ -693,7 +693,7 @@ PlatformMaxCpuCountInitialization (
   DEBUG ((
     DEBUG_INFO,
     "%a: BootCpuCount=%d MaxCpuCount=%u\n",
-    __FUNCTION__,
+    __func__,
     BootCpuCount,
     MaxCpuCount
     ));
diff --git a/OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.c b/OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.c
index 37d488e01c2a..c32c3eddd532 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/ExtraRootBusMap.c
@@ -227,7 +227,7 @@ CreateExtraRootBusMap (
     DEBUG ((
       DEBUG_VERBOSE,
       "%a: extra bus position 0x%Lx maps to bus number (UID) 0x%x\n",
-      __FUNCTION__,
+      __func__,
       (UINT64)(Idx + 1),
       Acpi->UID
       ));
diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
index cea4b7a099e3..2fe6ab30c032 100644
--- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
+++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
@@ -543,7 +543,7 @@ ParseOfwNode (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: DriverName=\"%.*a\" UnitAddress=\"%.*a\" DeviceArguments=\"%.*a\"\n",
-    __FUNCTION__,
+    __func__,
     OfwNode->DriverName.Len,
     OfwNode->DriverName.Ptr,
     OfwNode->UnitAddress.Len,
@@ -1477,7 +1477,7 @@ TranslateOfwPath (
   }
 
   if (Status == RETURN_NOT_FOUND) {
-    DEBUG ((DEBUG_VERBOSE, "%a: no more nodes\n", __FUNCTION__));
+    DEBUG ((DEBUG_VERBOSE, "%a: no more nodes\n", __func__));
     return RETURN_NOT_FOUND;
   }
 
@@ -1496,7 +1496,7 @@ TranslateOfwPath (
       break;
 
     case RETURN_INVALID_PARAMETER:
-      DEBUG ((DEBUG_VERBOSE, "%a: parse error\n", __FUNCTION__));
+      DEBUG ((DEBUG_VERBOSE, "%a: parse error\n", __func__));
       return RETURN_INVALID_PARAMETER;
 
     default:
@@ -1512,22 +1512,22 @@ TranslateOfwPath (
              );
   switch (Status) {
     case RETURN_SUCCESS:
-      DEBUG ((DEBUG_VERBOSE, "%a: success: \"%s\"\n", __FUNCTION__, Translated));
+      DEBUG ((DEBUG_VERBOSE, "%a: success: \"%s\"\n", __func__, Translated));
       break;
 
     case RETURN_BUFFER_TOO_SMALL:
-      DEBUG ((DEBUG_VERBOSE, "%a: buffer too small\n", __FUNCTION__));
+      DEBUG ((DEBUG_VERBOSE, "%a: buffer too small\n", __func__));
       break;
 
     case RETURN_UNSUPPORTED:
-      DEBUG ((DEBUG_VERBOSE, "%a: unsupported\n", __FUNCTION__));
+      DEBUG ((DEBUG_VERBOSE, "%a: unsupported\n", __func__));
       break;
 
     case RETURN_PROTOCOL_ERROR:
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: logic error / system state mismatch\n",
-        __FUNCTION__
+        __func__
         ));
       break;
 
@@ -1604,9 +1604,9 @@ ConnectDevicesFromQemu (
     goto FreeFwCfg;
   }
 
-  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg:\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg:\n", __func__));
   DEBUG ((DEBUG_VERBOSE, "%a\n", FwCfg));
-  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg: <end>\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg: <end>\n", __func__));
 
   if (FeaturePcdGet (PcdQemuBootOrderPciTranslation)) {
     EfiStatus = CreateExtraRootBusMap (&ExtraPciRoots);
@@ -1686,7 +1686,7 @@ ConnectDevicesFromQemu (
     DEBUG ((
       DEBUG_INFO,
       "%a: %Lu OpenFirmware device path(s) connected\n",
-      __FUNCTION__,
+      __func__,
       (UINT64)NumConnected
       ));
     Status = RETURN_SUCCESS;
@@ -1750,9 +1750,9 @@ StoreQemuBootOrder (
     goto FreeFwCfg;
   }
 
-  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg:\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg:\n", __func__));
   DEBUG ((DEBUG_VERBOSE, "%a\n", FwCfg));
-  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg: <end>\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg: <end>\n", __func__));
 
   if (FeaturePcdGet (PcdQemuBootOrderPciTranslation)) {
     EfiStatus = CreateExtraRootBusMap (&ExtraPciRoots);
@@ -1797,7 +1797,7 @@ StoreQemuBootOrder (
         L"VMMBootOrder%04x",
         VariableIndex++
         );
-      DEBUG ((DEBUG_INFO, "%a: %s = %s\n", __FUNCTION__, VariableName, Translated));
+      DEBUG ((DEBUG_INFO, "%a: %s = %s\n", __func__, VariableName, Translated));
       gRT->SetVariable (
              VariableName,
              &gVMMBootOrderGuid,
@@ -1944,7 +1944,7 @@ Match (
     DEBUG ((
       DEBUG_VERBOSE,
       "%a: expanded relative device path \"%s\" for prefix matching\n",
-      __FUNCTION__,
+      __func__,
       Converted
       ));
     FreePool (Converted);
@@ -1958,7 +1958,7 @@ Match (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: against \"%s\": %a\n",
-    __FUNCTION__,
+    __func__,
     Converted,
     Result ? "match" : "no match"
     ));
@@ -2068,7 +2068,7 @@ BootOrderComplete (
             DEBUG ((
               DEBUG_VERBOSE,
               "%a: keeping \"%s\"\n",
-              __FUNCTION__,
+              __func__,
               Converted
               ));
           }
@@ -2076,7 +2076,7 @@ BootOrderComplete (
           DEBUG ((
             DEBUG_VERBOSE,
             "%a: dropping \"%s\"\n",
-            __FUNCTION__,
+            __func__,
             Converted
             ));
         }
@@ -2211,9 +2211,9 @@ SetBootOrderFromQemu (
     goto ErrorFreeFwCfg;
   }
 
-  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg:\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg:\n", __func__));
   DEBUG ((DEBUG_VERBOSE, "%a\n", FwCfg));
-  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg: <end>\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: FwCfg: <end>\n", __func__));
   FwCfgPtr = FwCfg;
 
   BootOrder.Produced  = 0;
@@ -2332,13 +2332,13 @@ SetBootOrderFromQemu (
       DEBUG ((
         DEBUG_ERROR,
         "%a: setting BootOrder: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto ErrorFreeExtraPciRoots;
     }
 
-    DEBUG ((DEBUG_INFO, "%a: setting BootOrder: success\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: setting BootOrder: success\n", __func__));
     PruneBootVariables (ActiveOption, ActiveCount);
   }
 
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c
index 6a810928a060..4250e633b57f 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c
@@ -103,7 +103,7 @@ QemuFwCfgInitialize (
         DEBUG_ERROR,
         "QemuFwCfgDma %a:%a Failed to locate IOMMU protocol.\n",
         gEfiCallerBaseName,
-        __FUNCTION__
+        __func__
         ));
       ASSERT (FALSE);
       CpuDeadLoop ();
@@ -186,7 +186,7 @@ AllocFwCfgDmaAccessBuffer (
       DEBUG_ERROR,
       "%a:%a failed to allocate FW_CFG_DMA_ACCESS\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     ASSERT (FALSE);
     CpuDeadLoop ();
@@ -215,7 +215,7 @@ AllocFwCfgDmaAccessBuffer (
       DEBUG_ERROR,
       "%a:%a failed to Map() FW_CFG_DMA_ACCESS\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     ASSERT (FALSE);
     CpuDeadLoop ();
@@ -228,7 +228,7 @@ AllocFwCfgDmaAccessBuffer (
       DEBUG_ERROR,
       "%a:%a failed to Map() - requested 0x%Lx got 0x%Lx\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (UINT64)sizeof (FW_CFG_DMA_ACCESS),
       (UINT64)Size
       ));
@@ -263,7 +263,7 @@ FreeFwCfgDmaAccessBuffer (
       DEBUG_ERROR,
       "%a:%a failed to UnMap() Mapping 0x%Lx\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (UINT64)(UINTN)Mapping
       ));
     ASSERT (FALSE);
@@ -276,7 +276,7 @@ FreeFwCfgDmaAccessBuffer (
       DEBUG_ERROR,
       "%a:%a failed to Free() 0x%Lx\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (UINT64)(UINTN)Access
       ));
     ASSERT (FALSE);
@@ -320,7 +320,7 @@ MapFwCfgDmaDataBuffer (
       DEBUG_ERROR,
       "%a:%a failed to Map() Address 0x%Lx Size 0x%Lx\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (UINT64)(UINTN)HostAddress,
       (UINT64)Size
       ));
@@ -334,7 +334,7 @@ MapFwCfgDmaDataBuffer (
       DEBUG_ERROR,
       "%a:%a failed to Map() - requested 0x%x got 0x%Lx\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Size,
       (UINT64)NumberOfBytes
       ));
@@ -360,7 +360,7 @@ UnmapFwCfgDmaDataBuffer (
       DEBUG_ERROR,
       "%a:%a failed to UnMap() Mapping 0x%Lx\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (UINT64)(UINTN)Mapping
       ));
     ASSERT (FALSE);
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c
index 583d8a8e9f41..115a21075912 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibMmio.c
@@ -134,7 +134,7 @@ QemuFwCfgInitialize (
     DEBUG ((
       DEBUG_WARN,
       "%a: No 'qemu,fw-cfg-mmio' compatible DT node found (Status == %r)\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return EFI_SUCCESS;
diff --git a/OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Dxe.c b/OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Dxe.c
index 5706fa9be46a..f5237564388f 100644
--- a/OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Dxe.c
+++ b/OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Dxe.c
@@ -71,7 +71,7 @@ S3SaveStateInstalledNotify (
     DEBUG_INFO,
     "%a: %a: DmaAccess@0x%Lx ScratchBuffer@[0x%Lx+0x%Lx]\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     (UINT64)(UINTN)mDmaAccess,
     (UINT64)(UINTN)mScratchBuffer,
     (UINT64)mScratchBufferSize
@@ -161,7 +161,7 @@ QemuFwCfgS3CallWhenBootScriptReady (
       DEBUG_ERROR,
       "%a: %a: fw_cfg DMA unavailable\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     return RETURN_NOT_FOUND;
   }
@@ -177,7 +177,7 @@ QemuFwCfgS3CallWhenBootScriptReady (
       DEBUG_ERROR,
       "%a: %a: ScratchBufferSize too big: %Lu\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       (UINT64)ScratchBufferSize
       ));
     return RETURN_BAD_BUFFER_SIZE;
@@ -192,7 +192,7 @@ QemuFwCfgS3CallWhenBootScriptReady (
       DEBUG_ERROR,
       "%a: %a: AllocateReservedPool(): out of resources\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     return RETURN_OUT_OF_RESOURCES;
   }
@@ -215,7 +215,7 @@ QemuFwCfgS3CallWhenBootScriptReady (
       DEBUG_ERROR,
       "%a: %a: CreateEvent(): %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto FreeDmaAccess;
@@ -231,7 +231,7 @@ QemuFwCfgS3CallWhenBootScriptReady (
       DEBUG_ERROR,
       "%a: %a: RegisterProtocolNotify(): %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto CloseEvent;
@@ -256,7 +256,7 @@ QemuFwCfgS3CallWhenBootScriptReady (
       DEBUG_ERROR,
       "%a: %a: SignalEvent(): %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto NullGlobals;
@@ -383,7 +383,7 @@ QemuFwCfgS3ScriptWriteBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -409,7 +409,7 @@ QemuFwCfgS3ScriptWriteBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_IO_WRITE_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -436,7 +436,7 @@ QemuFwCfgS3ScriptWriteBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_MEM_POLL_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -544,7 +544,7 @@ QemuFwCfgS3ScriptReadBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -570,7 +570,7 @@ QemuFwCfgS3ScriptReadBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_IO_WRITE_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -597,7 +597,7 @@ QemuFwCfgS3ScriptReadBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_MEM_POLL_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -692,7 +692,7 @@ QemuFwCfgS3ScriptSkipBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -718,7 +718,7 @@ QemuFwCfgS3ScriptSkipBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_IO_WRITE_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -745,7 +745,7 @@ QemuFwCfgS3ScriptSkipBytes (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_MEM_POLL_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
@@ -877,7 +877,7 @@ QemuFwCfgS3ScriptCheckValue (
       DEBUG_ERROR,
       "%a: %a: EFI_BOOT_SCRIPT_MEM_POLL_OPCODE: %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return (RETURN_STATUS)Status;
diff --git a/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibMicrovm.c b/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibMicrovm.c
index a31fd0e7bbbe..ae9d2260d585 100644
--- a/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibMicrovm.c
+++ b/OvmfPkg/Library/ResetSystemLib/DxeResetSystemLibMicrovm.c
@@ -29,11 +29,11 @@ DxeResetSystemLibMicrovmConstructor (
   EFI_STATUS                       Status;
   EFI_GCD_MEMORY_SPACE_DESCRIPTOR  Descriptor;
 
-  DEBUG ((DEBUG_INFO, "%a: start\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: start\n", __func__));
 
   Status = gDS->GetMemorySpaceDescriptor (Address, &Descriptor);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO, "%a: GetMemorySpaceDescriptor failed\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: GetMemorySpaceDescriptor failed\n", __func__));
     return RETURN_UNSUPPORTED;
   }
 
@@ -43,10 +43,10 @@ DxeResetSystemLibMicrovmConstructor (
                   Descriptor.Attributes | EFI_MEMORY_RUNTIME
                   );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO, "%a: SetMemorySpaceAttributes failed\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: SetMemorySpaceAttributes failed\n", __func__));
     return RETURN_UNSUPPORTED;
   }
 
-  DEBUG ((DEBUG_INFO, "%a: done\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: done\n", __func__));
   return EFI_SUCCESS;
 }
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLibMicrovm.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLibMicrovm.c
index 44fe929e937d..4a4e78cca40a 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLibMicrovm.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLibMicrovm.c
@@ -25,9 +25,9 @@ MicrovmGedBase (
 
   if (EfiGoneVirtual ()) {
     EfiConvertPointer (0, &Address);
-    DEBUG ((DEBUG_INFO, "%a: virtual -> 0x%x\n", __FUNCTION__, Address));
+    DEBUG ((DEBUG_INFO, "%a: virtual -> 0x%x\n", __func__, Address));
   } else {
-    DEBUG ((DEBUG_INFO, "%a: physical -> 0x%x\n", __FUNCTION__, Address));
+    DEBUG ((DEBUG_INFO, "%a: physical -> 0x%x\n", __func__, Address));
   }
 
   return (UINTN)Address;
@@ -40,7 +40,7 @@ MicrovmReset (
 {
   UINTN  Address = MicrovmGedBase ();
 
-  DEBUG ((DEBUG_INFO, "%a: microvm reset via ged\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: microvm reset via ged\n", __func__));
   MmioWrite8 (
     Address + MICROVM_ACPI_GED_REG_RESET,
     MICROVM_ACPI_GED_RESET_VALUE
@@ -55,7 +55,7 @@ MicrovmShutdown (
 {
   UINTN  Address = MicrovmGedBase ();
 
-  DEBUG ((DEBUG_INFO, "%a: microvm poweroff via ged\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: microvm poweroff via ged\n", __func__));
   MmioWrite8 (
     Address + MICROVM_ACPI_GED_REG_SLEEP_CTL,
     (1 << 5) /* enable bit */ |
diff --git a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
index c70b4556b7f2..8df82e161a90 100644
--- a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
+++ b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
@@ -294,7 +294,7 @@ IterateVariablesCallbackSetSystemVariable (
       DEBUG_WARN,
       "%a: setting authenticated variable \"%s\" "
       "failed with EFI_SECURITY_VIOLATION, ignoring\n",
-      __FUNCTION__,
+      __func__,
       VariableName
       ));
     Status = EFI_SUCCESS;
@@ -303,7 +303,7 @@ IterateVariablesCallbackSetSystemVariable (
       DEBUG_WARN,
       "%a: setting ReadOnly variable \"%s\" "
       "failed with EFI_WRITE_PROTECTED, ignoring\n",
-      __FUNCTION__,
+      __func__,
       VariableName
       ));
     Status = EFI_SUCCESS;
diff --git a/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c b/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c
index 69c2d3640037..5de3022086b7 100644
--- a/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c
+++ b/OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.c
@@ -98,7 +98,7 @@ DetectSmbiosVersion (
       DEBUG ((
         DEBUG_INFO,
         "%a: SMBIOS 3.x DocRev from QEMU: 0x%02x\n",
-        __FUNCTION__,
+        __func__,
         QemuAnchor.V3.DocRev
         ));
       PcdStatus = PcdSet8S (PcdSmbiosDocRev, QemuAnchor.V3.DocRev);
@@ -112,7 +112,7 @@ DetectSmbiosVersion (
   DEBUG ((
     DEBUG_INFO,
     "%a: SMBIOS version from QEMU: 0x%04x\n",
-    __FUNCTION__,
+    __func__,
     SmbiosVersion
     ));
   PcdStatus = PcdSet16S (PcdSmbiosVersion, SmbiosVersion);
diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
index a1dd10c9f23b..a009123dae88 100644
--- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
+++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
@@ -220,7 +220,7 @@ InitCpuHotEjectData (
       RETURN_ERROR (SafeUintnAdd (Size, sizeof (*mCpuHotEjectData), &Size)) ||
       RETURN_ERROR (SafeUintnAdd (Size, sizeof (UINT64) - 1, &Size)))
   {
-    DEBUG ((DEBUG_ERROR, "%a: invalid CPU_HOT_EJECT_DATA\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: invalid CPU_HOT_EJECT_DATA\n", __func__));
     goto Fatal;
   }
 
@@ -303,7 +303,7 @@ SmmCpuFeaturesSmmRelocationComplete (
     DEBUG ((
       DEBUG_ERROR,
       "%a: MemEncryptSevSetPageEncMask(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     ASSERT (FALSE);
diff --git a/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c b/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c
index e22de4f5d48e..e4bec93fed1f 100644
--- a/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c
+++ b/OvmfPkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.c
@@ -51,7 +51,7 @@ SetCaCerts (
       DEBUG_VERBOSE,
       "%a:%a: not touching CA cert list\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -83,7 +83,7 @@ SetCaCerts (
       DEBUG_ERROR,
       "%a:%a: failed to delete %g:\"%s\"\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       &gEfiTlsCaCertificateGuid,
       EFI_TLS_CA_CERTIFICATE_VARIABLE
       ));
@@ -96,7 +96,7 @@ SetCaCerts (
       DEBUG_VERBOSE,
       "%a:%a: applied empty CA cert list\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -107,7 +107,7 @@ SetCaCerts (
       DEBUG_ERROR,
       "%a:%a: failed to allocate HttpsCaCerts\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -127,7 +127,7 @@ SetCaCerts (
       DEBUG_ERROR,
       "%a:%a: failed to set %g:\"%s\": %r\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       &gEfiTlsCaCertificateGuid,
       EFI_TLS_CA_CERTIFICATE_VARIABLE,
       Status
@@ -139,7 +139,7 @@ SetCaCerts (
     DEBUG_VERBOSE,
     "%a:%a: stored CA cert list (%Lu byte(s))\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     (UINT64)HttpsCaCertsSize
     ));
 
@@ -176,7 +176,7 @@ SetCipherSuites (
       DEBUG_VERBOSE,
       "%a:%a: not touching cipher suites\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -204,7 +204,7 @@ SetCipherSuites (
       DEBUG_ERROR,
       "%a:%a: failed to delete %g:\"%s\"\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       &gEdkiiHttpTlsCipherListGuid,
       EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE
       ));
@@ -216,7 +216,7 @@ SetCipherSuites (
       DEBUG_ERROR,
       "%a:%a: list of cipher suites must not be empty\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     Status = EFI_INVALID_PARAMETER;
     goto Done;
@@ -228,7 +228,7 @@ SetCipherSuites (
       DEBUG_ERROR,
       "%a:%a: failed to allocate HttpsCiphers\n",
       gEfiCallerBaseName,
-      __FUNCTION__
+      __func__
       ));
     Status = EFI_OUT_OF_RESOURCES;
     goto Done;
@@ -249,7 +249,7 @@ SetCipherSuites (
       DEBUG_ERROR,
       "%a:%a: failed to set %g:\"%s\"\n",
       gEfiCallerBaseName,
-      __FUNCTION__,
+      __func__,
       &gEdkiiHttpTlsCipherListGuid,
       EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE
       ));
@@ -260,7 +260,7 @@ SetCipherSuites (
     DEBUG_VERBOSE,
     "%a:%a: stored list of cipher suites (%Lu byte(s))\n",
     gEfiCallerBaseName,
-    __FUNCTION__,
+    __func__,
     (UINT64)HttpsCiphersSize
     ));
 
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
index 831dc1736d28..fac3242257a2 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
@@ -85,7 +85,7 @@ VirtioMmioInit (
       DEBUG ((
         DEBUG_INFO,
         "%a virtio 0.9.5, id %d\n",
-        __FUNCTION__,
+        __func__,
         Device->VirtioDevice.SubSystemDeviceId
         ));
       Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (0, 9, 5);
@@ -94,7 +94,7 @@ VirtioMmioInit (
       DEBUG ((
         DEBUG_INFO,
         "%a virtio 1.0, id %d\n",
-        __FUNCTION__,
+        __func__,
         Device->VirtioDevice.SubSystemDeviceId
         ));
       Device->VirtioDevice.Revision = VIRTIO_SPEC_REVISION (1, 0, 0);
diff --git a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
index 248a03e8db0b..a7ab43ca7415 100644
--- a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
+++ b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
@@ -394,7 +394,7 @@ QemuLoadKernelImage (
         DEBUG ((
           DEBUG_ERROR,
           "%a: QemuLoadLegacyImage(): %r\n",
-          __FUNCTION__,
+          __func__,
           Status
           ));
         return Status;
@@ -404,7 +404,7 @@ QemuLoadKernelImage (
       return EFI_SUCCESS;
 
     default:
-      DEBUG ((DEBUG_ERROR, "%a: LoadImage(): %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a: LoadImage(): %r\n", __func__, Status));
       return Status;
   }
 
@@ -443,7 +443,7 @@ QemuLoadKernelImage (
       DEBUG ((
         DEBUG_ERROR,
         "%a: kernel command line is not NUL-terminated\n",
-        __FUNCTION__
+        __func__
         ));
       Status = EFI_PROTOCOL_ERROR;
       goto FreeCommandLine;
@@ -492,7 +492,7 @@ QemuLoadKernelImage (
     DEBUG ((
       DEBUG_INFO,
       "%a: command line: \"%s\"\n",
-      __FUNCTION__,
+      __func__,
       (CHAR16 *)KernelLoadedImage->LoadOptions
       ));
   }
diff --git a/OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.c b/OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.c
index caf4a28e1f29..db4973406ad1 100644
--- a/OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.c
+++ b/OvmfPkg/Library/XenIoMmioLib/XenIoMmioLib.c
@@ -91,7 +91,7 @@ XenIoMmioInstall (
                        &mXenBusRootDevicePathTemplate
                        );
   if (!XenBusDevicePath) {
-    DEBUG ((DEBUG_ERROR, "%a: Out of memory\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Out of memory\n", __func__));
     Status = EFI_OUT_OF_RESOURCES;
     goto FreeXenIo;
   }
@@ -115,7 +115,7 @@ XenIoMmioInstall (
     DEBUG_ERROR,
     "%a: Failed to install the EFI_DEVICE_PATH and "
     "XENIO_PROTOCOL protocols on handle %p (Status == %r)\n",
-    __FUNCTION__,
+    __func__,
     OutHandle,
     Status
     ));
diff --git a/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c b/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c
index 40c464ce16b6..2edd92c7545c 100644
--- a/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c
+++ b/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c
@@ -204,7 +204,7 @@ CacheInitrdFile (
     DEBUG ((
       DEBUG_WARN,
       "%a: failed to read initrd file - %r 0x%lx 0x%lx\n",
-      __FUNCTION__,
+      __func__,
       Status,
       (UINT64)ReadSize,
       FileSize
diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.c b/OvmfPkg/LsiScsiDxe/LsiScsi.c
index 1f52b85ed24e..86c8c6612df6 100644
--- a/OvmfPkg/LsiScsiDxe/LsiScsi.c
+++ b/OvmfPkg/LsiScsiDxe/LsiScsi.c
@@ -512,7 +512,7 @@ LsiScsiProcessRequest (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: dstat: %02X, sist0: %02X, sist1: %02X\n",
-    __FUNCTION__,
+    __func__,
     DStat,
     SIst0,
     SIst1
@@ -800,7 +800,7 @@ LsiScsiExitBoot (
   LSI_SCSI_DEV  *Dev;
 
   Dev = Context;
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
   LsiScsiReset (Dev);
 }
 
diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c
index f64ccec24da8..348acafcf0dc 100644
--- a/OvmfPkg/MptScsiDxe/MptScsi.c
+++ b/OvmfPkg/MptScsiDxe/MptScsi.c
@@ -278,7 +278,7 @@ ReportHostAdapterError (
   OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET  *Packet
   )
 {
-  DEBUG ((DEBUG_ERROR, "%a: fatal error in scsi request\n", __FUNCTION__));
+  DEBUG ((DEBUG_ERROR, "%a: fatal error in scsi request\n", __func__));
   Packet->InTransferLength  = 0;
   Packet->OutTransferLength = 0;
   Packet->SenseDataLength   = 0;
@@ -509,7 +509,7 @@ MptScsiHandleReply (
     Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK;
     Packet->TargetStatus      = EFI_EXT_SCSI_STATUS_TARGET_GOOD;
   } else if ((Reply & BIT31) != 0) {
-    DEBUG ((DEBUG_INFO, "%a: Full reply returned\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: Full reply returned\n", __func__));
     //
     // When reply MSB is set, we got a full reply. Since we submitted only one
     // reply frame, we know it's IoReply.
@@ -549,7 +549,7 @@ MptScsiHandleReply (
         return EFI_DEVICE_ERROR;
     }
   } else {
-    DEBUG ((DEBUG_ERROR, "%a: unexpected reply (%x)\n", __FUNCTION__, Reply));
+    DEBUG ((DEBUG_ERROR, "%a: unexpected reply (%x)\n", __func__, Reply));
     return ReportHostAdapterError (Packet);
   }
 
@@ -785,7 +785,7 @@ MptScsiExitBoot (
   MPT_SCSI_DEV  *Dev;
 
   Dev = Context;
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
   MptScsiReset (Dev);
 }
 
@@ -940,7 +940,7 @@ MptScsiControllerStart (
     DEBUG ((
       DEBUG_WARN,
       "%a: failed to enable 64-bit DMA addresses\n",
-      __FUNCTION__
+      __func__
       ));
   }
 
diff --git a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
index 3f9c84cf2b54..6b2b6797b3b6 100644
--- a/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
+++ b/OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.c
@@ -572,7 +572,7 @@ GetResourcePadding (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Address=%02x:%02x.%x DevicePath=%s\n",
-    __FUNCTION__,
+    __func__,
     Address->Bus,
     Address->Device,
     Address->Function,
@@ -613,11 +613,11 @@ GetResourcePadding (
       DEBUG_VERBOSE,
       "%a: BusNumbers=0x%x Io=0x%Lx NonPrefetchable32BitMmio=0x%x\n"
       "%a: Prefetchable32BitMmio=0x%x Prefetchable64BitMmio=0x%Lx\n",
-      __FUNCTION__,
+      __func__,
       ReservationHint.BusNumbers,
       ReservationHint.Io,
       ReservationHint.NonPrefetchable32BitMmio,
-      __FUNCTION__,
+      __func__,
       ReservationHint.Prefetchable32BitMmio,
       ReservationHint.Prefetchable64BitMmio
       ));
diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index e58e75eb2203..cd3bfd554c98 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -239,7 +239,7 @@ ExtractConfig (
   UINTN            Size;
   BOOLEAN          AllocatedRequest;
 
-  DEBUG ((DEBUG_VERBOSE, "%a: Request=\"%s\"\n", __FUNCTION__, Request));
+  DEBUG ((DEBUG_VERBOSE, "%a: Request=\"%s\"\n", __func__, Request));
 
   if ((Progress == NULL) || (Results == NULL)) {
     return EFI_INVALID_PARAMETER;
@@ -321,12 +321,12 @@ ExtractConfig (
     DEBUG ((
       DEBUG_ERROR,
       "%a: BlockToConfig(): %r, Progress=\"%s\"\n",
-      __FUNCTION__,
+      __func__,
       Status,
       (Status == EFI_DEVICE_ERROR) ? NULL : *Progress
       ));
   } else {
-    DEBUG ((DEBUG_VERBOSE, "%a: Results=\"%s\"\n", __FUNCTION__, *Results));
+    DEBUG ((DEBUG_VERBOSE, "%a: Results=\"%s\"\n", __func__, *Results));
   }
 
   //
@@ -431,7 +431,7 @@ RouteConfig (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Configuration=\"%s\"\n",
-    __FUNCTION__,
+    __func__,
     Configuration
     ));
 
@@ -481,7 +481,7 @@ RouteConfig (
     DEBUG ((
       DEBUG_ERROR,
       "%a: ConfigToBlock(): %r, Progress=\"%s\"\n",
-      __FUNCTION__,
+      __func__,
       Status,
       (Status == EFI_BUFFER_TOO_SMALL) ? NULL : *Progress
       ));
@@ -514,7 +514,7 @@ Callback (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: Action=0x%Lx QuestionId=%d Type=%d\n",
-    __FUNCTION__,
+    __func__,
     (UINT64)Action,
     QuestionId,
     Type
@@ -835,7 +835,7 @@ ExecutePlatformConfig (
     DEBUG ((
       (Status == EFI_NOT_FOUND) ? DEBUG_VERBOSE : DEBUG_ERROR,
       "%a: failed to load platform config: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     return Status;
diff --git a/OvmfPkg/PlatformPei/ClearCache.c b/OvmfPkg/PlatformPei/ClearCache.c
index 9f23f9a42847..9e59f31df7fd 100644
--- a/OvmfPkg/PlatformPei/ClearCache.c
+++ b/OvmfPkg/PlatformPei/ClearCache.c
@@ -59,7 +59,7 @@ ClearCacheOnMpServicesAvailable (
   EFI_PEI_MP_SERVICES_PPI  *MpServices;
   EFI_STATUS               Status;
 
-  DEBUG ((DEBUG_INFO, "%a: %a\n", gEfiCallerBaseName, __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: %a\n", gEfiCallerBaseName, __func__));
 
   //
   // Clear cache on all the APs in parallel.
@@ -74,7 +74,7 @@ ClearCacheOnMpServicesAvailable (
                              NULL             // ProcedureArgument
                              );
   if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {
-    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __func__, Status));
     return Status;
   }
 
@@ -108,7 +108,7 @@ InstallClearCacheCallback (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to set up MP Services callback: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/PlatformPei/FeatureControl.c b/OvmfPkg/PlatformPei/FeatureControl.c
index d8a398cd5565..d2ec496b74a8 100644
--- a/OvmfPkg/PlatformPei/FeatureControl.c
+++ b/OvmfPkg/PlatformPei/FeatureControl.c
@@ -85,7 +85,7 @@ OnMpServicesAvailable (
 
   PlatformInfoHob = (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob);
 
-  DEBUG ((DEBUG_VERBOSE, "%a: %a\n", gEfiCallerBaseName, __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: %a\n", gEfiCallerBaseName, __func__));
 
   //
   // Write the MSR on all the APs in parallel.
@@ -100,7 +100,7 @@ OnMpServicesAvailable (
                              PlatformInfoHob      // ProcedureArgument
                              );
   if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {
-    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __func__, Status));
     return Status;
   }
 
@@ -154,7 +154,7 @@ InstallFeatureControlCallback (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to set up MP Services callback: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 41d186986ba8..0c755c4940bb 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -75,7 +75,7 @@ Q35TsegMbytesInitialization (
   DEBUG ((
     DEBUG_INFO,
     "%a: QEMU offers an extended TSEG (%d MB)\n",
-    __FUNCTION__,
+    __func__,
     ExtendedTsegMbytes
     ));
   PcdStatus = PcdSet16S (PcdQ35TsegMbytes, ExtendedTsegMbytes);
@@ -97,7 +97,7 @@ Q35SmramAtDefaultSmbaseInitialization (
     DEBUG ((
       DEBUG_INFO,
       "%a: SMRAM at default SMBASE not checked due to CSM\n",
-      __FUNCTION__
+      __func__
       ));
   } else {
     UINTN  CtlReg;
@@ -111,7 +111,7 @@ Q35SmramAtDefaultSmbaseInitialization (
     DEBUG ((
       DEBUG_INFO,
       "%a: SMRAM at default SMBASE %a\n",
-      __FUNCTION__,
+      __func__,
       PlatformInfoHob->Q35SmramAtDefaultSmbase ? "found" : "not found"
       ));
   }
@@ -152,7 +152,7 @@ AddressWidthInitialization (
       DEBUG ((
         DEBUG_INFO,
         "%a: disabling 64-bit PCI host aperture\n",
-        __FUNCTION__
+        __func__
         ));
       PcdStatus = PcdSet64S (PcdPciMmio64Size, 0);
       ASSERT_RETURN_ERROR (PcdStatus);
@@ -175,7 +175,7 @@ AddressWidthInitialization (
     DEBUG ((
       DEBUG_INFO,
       "%a: Pci64Base=0x%Lx Pci64Size=0x%Lx\n",
-      __FUNCTION__,
+      __func__,
       PlatformInfoHob->PcdPciMmio64Base,
       PlatformInfoHob->PcdPciMmio64Size
       ));
@@ -307,7 +307,7 @@ PublishPeiMemory (
     DEBUG ((
       DEBUG_INFO,
       "%a: PhysMemAddressWidth=%d PeiMemoryCap=%u KB\n",
-      __FUNCTION__,
+      __func__,
       PlatformInfoHob->PhysMemAddressWidth,
       PeiMemoryCap >> 10
       ));
diff --git a/OvmfPkg/PlatformPei/MemTypeInfo.c b/OvmfPkg/PlatformPei/MemTypeInfo.c
index eb37febb31ae..ea049b21cfc0 100644
--- a/OvmfPkg/PlatformPei/MemTypeInfo.c
+++ b/OvmfPkg/PlatformPei/MemTypeInfo.c
@@ -100,7 +100,7 @@ RefreshMemTypeInfo (
     // If the UEFI variable couldn't be read for some other reason, we
     // similarly can't use it for udpating mMemoryTypeInformation.
     //
-    DEBUG ((DEBUG_ERROR, "%a: GetVariable(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: GetVariable(): %r\n", __func__, Status));
     return;
   }
 
@@ -111,7 +111,7 @@ RefreshMemTypeInfo (
     DEBUG ((
       DEBUG_ERROR,
       "%a: invalid UEFI variable size %Lu\n",
-      __FUNCTION__,
+      __func__,
       (UINT64)DataSize
       ));
     return;
@@ -151,7 +151,7 @@ RefreshMemTypeInfo (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: Type 0x%x: NumberOfPages 0x%x -> 0x%x\n",
-        __FUNCTION__,
+        __func__,
         HobRecord->Type,
         HobRecord->NumberOfPages,
         VariableRecord->NumberOfPages
@@ -183,7 +183,7 @@ OnReadOnlyVariable2Available (
   IN VOID                       *Ppi
   )
 {
-  DEBUG ((DEBUG_VERBOSE, "%a\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a\n", __func__));
 
   RefreshMemTypeInfo (Ppi);
   BuildMemTypeInfoHob ();
@@ -222,7 +222,7 @@ MemTypeInfoInitialization (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to set up R/O Variable 2 callback: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     ASSERT (FALSE);
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 148240342b4b..cc9384ba5c4e 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -114,7 +114,7 @@ MicrovmInitialization (
 
   Status = QemuFwCfgFindFile ("etc/fdt", &FdtItem, &FdtSize);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO, "%a: no etc/fdt found in fw_cfg, using dummy\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: no etc/fdt found in fw_cfg, using dummy\n", __func__));
     FdtItem = 0;
     FdtSize = sizeof (EmptyFdt);
   }
@@ -122,7 +122,7 @@ MicrovmInitialization (
   FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
   NewBase  = AllocatePages (FdtPages);
   if (NewBase == NULL) {
-    DEBUG ((DEBUG_INFO, "%a: AllocatePages failed\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: AllocatePages failed\n", __func__));
     return;
   }
 
@@ -135,14 +135,14 @@ MicrovmInitialization (
 
   FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData));
   if (FdtHobData == NULL) {
-    DEBUG ((DEBUG_INFO, "%a: BuildGuidHob failed\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: BuildGuidHob failed\n", __func__));
     return;
   }
 
   DEBUG ((
     DEBUG_INFO,
     "%a: fdt at 0x%x (size %d)\n",
-    __FUNCTION__,
+    __func__,
     NewBase,
     FdtSize
     ));
@@ -158,7 +158,7 @@ MiscInitializationForMicrovm (
 
   ASSERT (PlatformInfoHob->HostBridgeDevId == 0xffff);
 
-  DEBUG ((DEBUG_INFO, "%a: microvm\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: microvm\n", __func__));
   //
   // Disable A20 Mask
   //
@@ -240,17 +240,17 @@ S3Verification (
     DEBUG ((
       DEBUG_ERROR,
       "%a: S3Resume2Pei doesn't support X64 PEI + SMM yet.\n",
-      __FUNCTION__
+      __func__
       ));
     DEBUG ((
       DEBUG_ERROR,
       "%a: Please disable S3 on the QEMU command line (see the README),\n",
-      __FUNCTION__
+      __func__
       ));
     DEBUG ((
       DEBUG_ERROR,
       "%a: or build OVMF with \"OvmfPkgIa32X64.dsc\".\n",
-      __FUNCTION__
+      __func__
       ));
     ASSERT (FALSE);
     CpuDeadLoop ();
@@ -273,7 +273,7 @@ Q35BoardVerification (
     DEBUG_ERROR,
     "%a: no TSEG (SMRAM) on host bridge DID=0x%04x; "
     "only DID=0x%04x (Q35) is supported\n",
-    __FUNCTION__,
+    __func__,
     PlatformInfoHob->HostBridgeDevId,
     INTEL_Q35_MCH_DEVICE_ID
     ));
diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c
index 47cc0ae59bf8..6ec5040f7ef2 100644
--- a/OvmfPkg/PvScsiDxe/PvScsi.c
+++ b/OvmfPkg/PvScsiDxe/PvScsi.c
@@ -904,7 +904,7 @@ PvScsiSetPciAttributes (
     DEBUG ((
       DEBUG_WARN,
       "%a: failed to enable 64-bit DMA addresses\n",
-      __FUNCTION__
+      __func__
       ));
   }
 
@@ -1279,7 +1279,7 @@ PvScsiExitBoot (
   PVSCSI_DEV  *Dev;
 
   Dev = Context;
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
 
   //
   // Reset the device to stop device usage of the rings.
diff --git a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
index d4f3cd92255f..3c12085f6c1e 100644
--- a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
+++ b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
@@ -968,7 +968,7 @@ FetchBlob (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to allocate %Ld bytes for \"%s\"\n",
-      __FUNCTION__,
+      __func__,
       (INT64)Blob->Size,
       Blob->Name
       ));
@@ -978,7 +978,7 @@ FetchBlob (
   DEBUG ((
     DEBUG_INFO,
     "%a: loading %Ld bytes for \"%s\"\n",
-    __FUNCTION__,
+    __func__,
     (INT64)Blob->Size,
     Blob->Name
     ));
@@ -1001,7 +1001,7 @@ FetchBlob (
       DEBUG ((
         DEBUG_VERBOSE,
         "%a: %Ld bytes remaining for \"%s\" (%d)\n",
-        __FUNCTION__,
+        __func__,
         (INT64)Left,
         Blob->Name,
         (INT32)Idx
@@ -1051,7 +1051,7 @@ QemuKernelLoaderFsDxeEntrypoint (
 
   Status = gRT->GetTime (&mInitTime, NULL /* Capabilities */);
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: GetTime(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: GetTime(): %r\n", __func__, Status));
     return Status;
   }
 
@@ -1101,7 +1101,7 @@ QemuKernelLoaderFsDxeEntrypoint (
     DEBUG ((
       DEBUG_ERROR,
       "%a: InstallMultipleProtocolInterfaces(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto FreeBlobs;
@@ -1121,7 +1121,7 @@ QemuKernelLoaderFsDxeEntrypoint (
       DEBUG ((
         DEBUG_ERROR,
         "%a: InstallMultipleProtocolInterfaces(): %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto UninstallFileSystemHandle;
diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
index f5113fbc78a6..5a1044f0dc7b 100644
--- a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
+++ b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
@@ -189,7 +189,7 @@ QemuRamfbGraphicsOutputSetMode (
     DEBUG ((
       DEBUG_WARN,
       "%a: clearing the screen failed: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index 7a9fe208c99c..b11eed7558bf 100644
--- a/OvmfPkg/QemuVideoDxe/Gop.c
+++ b/OvmfPkg/QemuVideoDxe/Gop.c
@@ -37,7 +37,7 @@ QemuVideoCompleteModeInfo (
     Info->PixelInformation.BlueMask     = 0;
     Info->PixelInformation.ReservedMask = 0;
   } else {
-    DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__, ModeData->ColorDepth));
+    DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __func__, ModeData->ColorDepth));
     ASSERT (FALSE);
   }
 
diff --git a/OvmfPkg/QemuVideoDxe/Initialize.c b/OvmfPkg/QemuVideoDxe/Initialize.c
index 2a3cbc65c32a..050ae878ecde 100644
--- a/OvmfPkg/QemuVideoDxe/Initialize.c
+++ b/OvmfPkg/QemuVideoDxe/Initialize.c
@@ -310,7 +310,7 @@ QemuVideoBochsEdid (
     DEBUG ((
       DEBUG_INFO,
       "%a: mmio read failed\n",
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -321,7 +321,7 @@ QemuVideoBochsEdid (
     DEBUG ((
       DEBUG_INFO,
       "%a: magic check failed\n",
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -329,7 +329,7 @@ QemuVideoBochsEdid (
   DEBUG ((
     DEBUG_INFO,
     "%a: blob found (extensions: %d)\n",
-    __FUNCTION__,
+    __func__,
     Private->Edid[126]
     ));
 
@@ -339,7 +339,7 @@ QemuVideoBochsEdid (
     DEBUG ((
       DEBUG_INFO,
       "%a: no detailed timing descriptor\n",
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -349,7 +349,7 @@ QemuVideoBochsEdid (
   DEBUG ((
     DEBUG_INFO,
     "%a: default resolution: %dx%d\n",
-    __FUNCTION__,
+    __func__,
     *XRes,
     *YRes
     ));
@@ -436,7 +436,7 @@ QemuVideoBochsModeSetup (
         DEBUG_ERROR,
         "%a: can't read size of drawable buffer from QXL "
         "ROM\n",
-        __FUNCTION__
+        __func__
         ));
       return EFI_NOT_FOUND;
     }
@@ -448,7 +448,7 @@ QemuVideoBochsModeSetup (
   DEBUG ((
     DEBUG_INFO,
     "%a: AvailableFbSize=0x%x\n",
-    __FUNCTION__,
+    __func__,
     AvailableFbSize
     ));
 
diff --git a/OvmfPkg/QemuVideoDxe/VbeShim.c b/OvmfPkg/QemuVideoDxe/VbeShim.c
index 2a048211a823..8f151b96f9a5 100644
--- a/OvmfPkg/QemuVideoDxe/VbeShim.c
+++ b/OvmfPkg/QemuVideoDxe/VbeShim.c
@@ -73,12 +73,12 @@ InstallVbeShim (
     DEBUG ((
       DEBUG_WARN,
       "%a: page 0 protected, not installing VBE shim\n",
-      __FUNCTION__
+      __func__
       ));
     DEBUG ((
       DEBUG_WARN,
       "%a: page 0 protection prevents Windows 7 from booting anyway\n",
-      __FUNCTION__
+      __func__
       ));
     return;
   }
@@ -117,7 +117,7 @@ InstallVbeShim (
       DEBUG ((
         DEBUG_INFO,
         "%a: Video BIOS handler found at %04x:%04x\n",
-        __FUNCTION__,
+        __func__,
         Int0x10->Segment,
         Int0x10->Offset
         ));
@@ -131,7 +131,7 @@ InstallVbeShim (
     DEBUG ((
       DEBUG_INFO,
       "%a: failed to allocate page at zero: %r\n",
-      __FUNCTION__,
+      __func__,
       Segment0AllocationStatus
       ));
   } else {
@@ -162,7 +162,7 @@ InstallVbeShim (
       DEBUG ((
         DEBUG_ERROR,
         "%a: unknown host bridge device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         HostBridgeDevId
         ));
       ASSERT (FALSE);
@@ -324,5 +324,5 @@ InstallVbeShim (
   Int0x10->Segment = (UINT16)((UINT32)SegmentC >> 4);
   Int0x10->Offset  = (UINT16)((UINTN)(VbeModeInfo + 1) - SegmentC);
 
-  DEBUG ((DEBUG_INFO, "%a: VBE shim installed\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: VBE shim installed\n", __func__));
 }
diff --git a/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/PlatformBm.c b/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/PlatformBm.c
index 2559889638ad..be4316f320f9 100644
--- a/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/PlatformBm.c
@@ -193,7 +193,7 @@ FilterAndProcess (
     DEBUG ((
       DEBUG_VERBOSE,
       "%a: %g: %r\n",
-      __FUNCTION__,
+      __func__,
       ProtocolGuid,
       Status
       ));
@@ -264,7 +264,7 @@ IsPciDisplay (
                         &Pci
                         );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: %s: %r\n", __FUNCTION__, ReportText, Status));
+    DEBUG ((DEBUG_ERROR, "%a: %s: %r\n", __func__, ReportText, Status));
     return FALSE;
   }
 
@@ -413,7 +413,7 @@ IsVirtioPciRng (
   return FALSE;
 
 PciError:
-  DEBUG ((DEBUG_ERROR, "%a: %s: %r\n", __FUNCTION__, ReportText, Status));
+  DEBUG ((DEBUG_ERROR, "%a: %s: %r\n", __func__, ReportText, Status));
   return FALSE;
 }
 
@@ -440,7 +440,7 @@ Connect (
   DEBUG ((
     EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,
     "%a: %s: %r\n",
-    __FUNCTION__,
+    __func__,
     ReportText,
     Status
     ));
@@ -466,7 +466,7 @@ AddOutput (
     DEBUG ((
       DEBUG_ERROR,
       "%a: %s: handle %p: device path not found\n",
-      __FUNCTION__,
+      __func__,
       ReportText,
       Handle
       ));
@@ -478,7 +478,7 @@ AddOutput (
     DEBUG ((
       DEBUG_ERROR,
       "%a: %s: adding to ConOut: %r\n",
-      __FUNCTION__,
+      __func__,
       ReportText,
       Status
       ));
@@ -490,7 +490,7 @@ AddOutput (
     DEBUG ((
       DEBUG_ERROR,
       "%a: %s: adding to ErrOut: %r\n",
-      __FUNCTION__,
+      __func__,
       ReportText,
       Status
       ));
@@ -500,7 +500,7 @@ AddOutput (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: %s: added to ConOut and ErrOut\n",
-    __FUNCTION__,
+    __func__,
     ReportText
     ));
 }
@@ -701,7 +701,7 @@ RemoveStaleFvFileOptions (
     DEBUG ((
       EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,
       "%a: removing stale Boot#%04x %s: %r\n",
-      __FUNCTION__,
+      __func__,
       (UINT32)BootOptions[Index].OptionNumber,
       DevicePathString == NULL ? L"<unavailable>" : DevicePathString,
       Status
@@ -879,7 +879,7 @@ PlatformBootManagerBeforeConsole (
   DEBUG ((
     EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,
     "%a: SetVariable(%s, %u): %r\n",
-    __FUNCTION__,
+    __func__,
     EFI_TIME_OUT_VARIABLE_NAME,
     FrontPageTimeout,
     Status
diff --git a/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/QemuKernel.c b/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/QemuKernel.c
index 736628174f4e..c1ed425da00b 100644
--- a/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/QemuKernel.c
+++ b/OvmfPkg/RiscVVirt/Library/PlatformBootManagerLib/QemuKernel.c
@@ -66,7 +66,7 @@ TryRunningQemuKernel (
     DEBUG ((
       DEBUG_ERROR,
       "%a: QemuStartKernelImage(): %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
index a58b7aae6bee..4035ba8d850a 100644
--- a/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
+++ b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c
@@ -31,7 +31,7 @@ PrePeiGetHobList (
   GetFirmwareContextPointer (&FirmwareContext);
 
   if (FirmwareContext == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __func__));
     return NULL;
   }
 
@@ -56,7 +56,7 @@ PrePeiSetHobList (
   GetFirmwareContextPointer (&FirmwareContext);
 
   if (FirmwareContext == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __func__));
     return EFI_NOT_READY;
   }
 
diff --git a/OvmfPkg/RiscVVirt/Sec/Memory.c b/OvmfPkg/RiscVVirt/Sec/Memory.c
index f7a72c7bb4fb..0e2690c73687 100644
--- a/OvmfPkg/RiscVVirt/Sec/Memory.c
+++ b/OvmfPkg/RiscVVirt/Sec/Memory.c
@@ -97,7 +97,7 @@ InitMmu (
   // Set supervisor translation mode to Bare mode
   //
   RiscVSetSupervisorAddressTranslationRegister ((UINT64)SATP_MODE_OFF << 60);
-  DEBUG ((DEBUG_INFO, "%a: Set Supervisor address mode to bare-metal mode.\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: Set Supervisor address mode to bare-metal mode.\n", __func__));
 }
 
 /**
@@ -276,13 +276,13 @@ MemoryPeimInitialization (
   GetFirmwareContextPointer (&FirmwareContext);
 
   if (FirmwareContext == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __func__));
     return EFI_UNSUPPORTED;
   }
 
   FdtPointer = (VOID *)FirmwareContext->FlattenedDeviceTree;
   if (FdtPointer == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Invalid FDT pointer\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Invalid FDT pointer\n", __func__));
     return EFI_UNSUPPORTED;
   }
 
@@ -306,7 +306,7 @@ MemoryPeimInitialization (
         DEBUG ((
           DEBUG_INFO,
           "%a: System RAM @ 0x%lx - 0x%lx\n",
-          __FUNCTION__,
+          __func__,
           CurBase,
           CurBase + CurSize - 1
           ));
@@ -319,7 +319,7 @@ MemoryPeimInitialization (
         DEBUG ((
           DEBUG_ERROR,
           "%a: Failed to parse FDT memory node\n",
-          __FUNCTION__
+          __func__
           ));
       }
     }
diff --git a/OvmfPkg/RiscVVirt/Sec/Platform.c b/OvmfPkg/RiscVVirt/Sec/Platform.c
index e8fd126cf800..3645c27b0b12 100644
--- a/OvmfPkg/RiscVVirt/Sec/Platform.c
+++ b/OvmfPkg/RiscVVirt/Sec/Platform.c
@@ -43,20 +43,20 @@ PlatformPeimInitialization (
   GetFirmwareContextPointer (&FirmwareContext);
 
   if (FirmwareContext == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __func__));
     return EFI_UNSUPPORTED;
   }
 
   FdtPointer = (VOID *)FirmwareContext->FlattenedDeviceTree;
   if (FdtPointer == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Invalid FDT pointer\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Invalid FDT pointer\n", __func__));
     return EFI_UNSUPPORTED;
   }
 
-  DEBUG ((DEBUG_INFO, "%a: Build FDT HOB - FDT at address: 0x%x \n", __FUNCTION__, FdtPointer));
+  DEBUG ((DEBUG_INFO, "%a: Build FDT HOB - FDT at address: 0x%x \n", __func__, FdtPointer));
   Base = FdtPointer;
   if (fdt_check_header (Base) != 0) {
-    DEBUG ((DEBUG_ERROR, "%a: Corrupted DTB\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Corrupted DTB\n", __func__));
     return EFI_UNSUPPORTED;
   }
 
@@ -64,7 +64,7 @@ PlatformPeimInitialization (
   FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
   NewBase  = AllocatePages (FdtPages);
   if (NewBase == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Could not allocate memory for DTB\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Could not allocate memory for DTB\n", __func__));
     return EFI_UNSUPPORTED;
   }
 
@@ -72,7 +72,7 @@ PlatformPeimInitialization (
 
   FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof *FdtHobData);
   if (FdtHobData == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: Could not build FDT Hob\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: Could not build FDT Hob\n", __func__));
     return EFI_UNSUPPORTED;
   }
 
diff --git a/OvmfPkg/RiscVVirt/Sec/SecMain.c b/OvmfPkg/RiscVVirt/Sec/SecMain.c
index adf73f2eb66c..b0520481782e 100644
--- a/OvmfPkg/RiscVVirt/Sec/SecMain.c
+++ b/OvmfPkg/RiscVVirt/Sec/SecMain.c
@@ -63,7 +63,7 @@ SecStartup (
   DEBUG ((
     DEBUG_INFO,
     "%a() BootHartId: 0x%x, DeviceTreeAddress=0x%x\n",
-    __FUNCTION__,
+    __func__,
     BootHartId,
     DeviceTreeAddress
     ));
diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c
index e96726d6eca8..31da5d0ace51 100644
--- a/OvmfPkg/Sec/SecMain.c
+++ b/OvmfPkg/Sec/SecMain.c
@@ -386,7 +386,7 @@ DecompressMemFvs (
     DEBUG_VERBOSE,
     "%a: OutputBuffer@%p+0x%x ScratchBuffer@%p+0x%x "
     "PcdOvmfDecompressionScratchEnd=0x%x\n",
-    __FUNCTION__,
+    __func__,
     OutputBuffer,
     OutputBufferSize,
     ScratchBuffer,
diff --git a/OvmfPkg/SmmAccess/SmmAccessPei.c b/OvmfPkg/SmmAccess/SmmAccessPei.c
index 4be5f2423e17..0e57b7804cb2 100644
--- a/OvmfPkg/SmmAccess/SmmAccessPei.c
+++ b/OvmfPkg/SmmAccess/SmmAccessPei.c
@@ -263,7 +263,7 @@ SmmAccessPeiEntryPoint (
       DEBUG_ERROR,
       "%a: no SMRAM with host bridge DID=0x%04x; only "
       "DID=0x%04x (Q35) is supported\n",
-      __FUNCTION__,
+      __func__,
       HostBridgeDevId,
       INTEL_Q35_MCH_DEVICE_ID
       ));
@@ -283,7 +283,7 @@ SmmAccessPeiEntryPoint (
     DEBUG ((
       DEBUG_ERROR,
       "%a: this Q35 implementation lacks SMRAM\n",
-      __FUNCTION__
+      __func__
       ));
     goto WrongConfig;
   }
@@ -378,7 +378,7 @@ SmmAccessPeiEntryPoint (
     DEBUG ((
       DEBUG_VERBOSE,
       "%a: SMRAM map follows, %d entries\n",
-      __FUNCTION__,
+      __func__,
       (INT32)Count
       ));
     DEBUG ((
diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
index daeb7195aee7..4bd24bf11903 100644
--- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
+++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
@@ -113,7 +113,7 @@ NegotiateSmiFeatures (
     DEBUG ((
       DEBUG_INFO,
       "%a: SMI feature negotiation unavailable\n",
-      __FUNCTION__
+      __func__
       ));
     return FALSE;
   }
@@ -129,7 +129,7 @@ NegotiateSmiFeatures (
     DEBUG ((
       DEBUG_ERROR,
       "%a: size mismatch in feature negotiation\n",
-      __FUNCTION__
+      __func__
       ));
     goto FatalError;
   }
@@ -168,7 +168,7 @@ NegotiateSmiFeatures (
     DEBUG ((
       DEBUG_ERROR,
       "%a: negotiation failed for feature bitmap 0x%Lx\n",
-      __FUNCTION__,
+      __func__,
       mSmiFeatures
       ));
     goto FatalError;
@@ -179,7 +179,7 @@ NegotiateSmiFeatures (
     // If we can't get broadcast SMIs from QEMU, that's acceptable too,
     // although not optimal.
     //
-    DEBUG ((DEBUG_INFO, "%a: SMI broadcast unavailable\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: SMI broadcast unavailable\n", __func__));
   } else {
     //
     // Configure the traditional AP sync / SMI delivery mode for
@@ -192,31 +192,31 @@ NegotiateSmiFeatures (
       DEBUG ((
         DEBUG_ERROR,
         "%a: PiSmmCpuDxeSmm PCD configuration failed\n",
-        __FUNCTION__
+        __func__
         ));
       goto FatalError;
     }
 
-    DEBUG ((DEBUG_INFO, "%a: using SMI broadcast\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: using SMI broadcast\n", __func__));
   }
 
   if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOTPLUG) == 0) {
-    DEBUG ((DEBUG_INFO, "%a: CPU hotplug not negotiated\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: CPU hotplug not negotiated\n", __func__));
   } else {
     DEBUG ((
       DEBUG_INFO,
       "%a: CPU hotplug with SMI negotiated\n",
-      __FUNCTION__
+      __func__
       ));
   }
 
   if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG) == 0) {
-    DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug not negotiated\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug not negotiated\n", __func__));
   } else {
     DEBUG ((
       DEBUG_INFO,
       "%a: CPU hot-unplug with SMI negotiated\n",
-      __FUNCTION__
+      __func__
       ));
   }
 
@@ -292,7 +292,7 @@ AppendFwCfgBootScript (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: SMI feature negotiation boot script saved\n",
-    __FUNCTION__
+    __func__
     ));
   return;
 
diff --git a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
index edbf8ac431e4..e7438b18ddcb 100644
--- a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
+++ b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c
@@ -205,7 +205,7 @@ SmmControl2DxeEntryPoint (
     DEBUG ((
       DEBUG_ERROR,
       "%a: this Q35 implementation lacks SMI\n",
-      __FUNCTION__
+      __func__
       ));
     goto FatalError;
   }
@@ -234,7 +234,7 @@ SmmControl2DxeEntryPoint (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to lock down GBL_SMI_EN\n",
-      __FUNCTION__
+      __func__
       ));
     goto FatalError;
   }
@@ -260,7 +260,7 @@ SmmControl2DxeEntryPoint (
                     &mS3SaveStateInstalled
                     );
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a: CreateEvent: %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a: CreateEvent: %r\n", __func__, Status));
       goto FatalError;
     }
 
@@ -273,7 +273,7 @@ SmmControl2DxeEntryPoint (
       DEBUG ((
         DEBUG_ERROR,
         "%a: RegisterProtocolNotify: %r\n",
-        __FUNCTION__,
+        __func__,
         Status
         ));
       goto ReleaseEvent;
@@ -284,7 +284,7 @@ SmmControl2DxeEntryPoint (
     //
     Status = gBS->SignalEvent (mS3SaveStateInstalled);
     if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_ERROR, "%a: SignalEvent: %r\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a: SignalEvent: %r\n", __func__, Status));
       goto ReleaseEvent;
     }
   }
@@ -303,7 +303,7 @@ SmmControl2DxeEntryPoint (
     DEBUG ((
       DEBUG_ERROR,
       "%a: InstallMultipleProtocolInterfaces: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     goto ReleaseEvent;
@@ -376,7 +376,7 @@ OnS3SaveStateInstalled (
     DEBUG ((
       DEBUG_ERROR,
       "%a: EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     ASSERT (FALSE);
@@ -400,14 +400,14 @@ OnS3SaveStateInstalled (
     DEBUG ((
       DEBUG_ERROR,
       "%a: EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
 
-  DEBUG ((DEBUG_VERBOSE, "%a: chipset boot script saved\n", __FUNCTION__));
+  DEBUG ((DEBUG_VERBOSE, "%a: chipset boot script saved\n", __func__));
 
   //
   // Append a boot script fragment that re-selects the negotiated SMI features.
diff --git a/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c b/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c
index 96771b193595..65bb1a92684e 100644
--- a/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c
+++ b/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c
@@ -49,11 +49,11 @@ Tcg2ConfigPeimEntryPoint (
   UINTN       Size;
   EFI_STATUS  Status;
 
-  DEBUG ((DEBUG_INFO, "%a\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a\n", __func__));
 
   Status = InternalTpm12Detect ();
   if (!EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO, "%a: TPM1.2 detected\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: TPM1.2 detected\n", __func__));
     Size   = sizeof (gEfiTpmDeviceInstanceTpm12Guid);
     Status = PcdSetPtrS (
                PcdTpmInstanceGuid,
@@ -64,7 +64,7 @@ Tcg2ConfigPeimEntryPoint (
   } else {
     Status = Tpm2RequestUseTpm ();
     if (!EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_INFO, "%a: TPM2 detected\n", __FUNCTION__));
+      DEBUG ((DEBUG_INFO, "%a: TPM2 detected\n", __func__));
       Size   = sizeof (gEfiTpmDeviceInstanceTpm20DtpmGuid);
       Status = PcdSetPtrS (
                  PcdTpmInstanceGuid,
@@ -73,7 +73,7 @@ Tcg2ConfigPeimEntryPoint (
                  );
       ASSERT_EFI_ERROR (Status);
     } else {
-      DEBUG ((DEBUG_INFO, "%a: no TPM detected\n", __FUNCTION__));
+      DEBUG ((DEBUG_INFO, "%a: no TPM detected\n", __func__));
       //
       // If no TPM2 was detected, we still need to install
       // TpmInitializationDonePpi. Namely, Tcg2Pei will exit early upon seeing
diff --git a/OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPeim.c b/OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPeim.c
index 88bb9e8e042b..c671aa21ea6c 100644
--- a/OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPeim.c
+++ b/OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPeim.c
@@ -38,7 +38,7 @@ TpmMmioSevDecryptPeimEntryPoint (
   RETURN_STATUS  DecryptStatus;
   EFI_STATUS     Status;
 
-  DEBUG ((DEBUG_INFO, "%a\n", __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a\n", __func__));
 
   //
   // If SEV is active, MMIO succeeds against an encrypted physical address
@@ -60,7 +60,7 @@ TpmMmioSevDecryptPeimEntryPoint (
     DEBUG ((
       DEBUG_INFO,
       "%a: mapping TPM MMIO address range unencrypted\n",
-      __FUNCTION__
+      __func__
       ));
 
     DecryptStatus = MemEncryptSevClearMmioPageEncMask (
@@ -73,7 +73,7 @@ TpmMmioSevDecryptPeimEntryPoint (
       DEBUG ((
         DEBUG_ERROR,
         "%a: failed to map TPM MMIO address range unencrypted\n",
-        __FUNCTION__
+        __func__
         ));
       ASSERT_RETURN_ERROR (DecryptStatus);
     }
diff --git a/OvmfPkg/TdxDxe/TdxAcpiTable.c b/OvmfPkg/TdxDxe/TdxAcpiTable.c
index 8a1abe8b1d89..5dc27e23ad71 100644
--- a/OvmfPkg/TdxDxe/TdxAcpiTable.c
+++ b/OvmfPkg/TdxDxe/TdxAcpiTable.c
@@ -175,7 +175,7 @@ AlterAcpiTable (
       NewMadtTableLength = Table->Length + sizeof (EFI_ACPI_6_4_MULTIPROCESSOR_WAKEUP_STRUCTURE);
       NewMadtTable       = AllocatePool (NewMadtTableLength);
       if (NewMadtTable == NULL) {
-        DEBUG ((DEBUG_ERROR, "%a: OUT_OF_SOURCES error.\n", __FUNCTION__));
+        DEBUG ((DEBUG_ERROR, "%a: OUT_OF_SOURCES error.\n", __func__));
         break;
       }
 
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
index f9a41f6aab0f..6b9ef261335e 100644
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c
@@ -422,11 +422,11 @@ NorFlashFvbInitialize (
   // Install the Default FVB header if required
   if (EFI_ERROR (Status)) {
     // There is no valid header, so time to install one.
-    DEBUG ((DEBUG_INFO, "%a: The FVB Header is not valid.\n", __FUNCTION__));
+    DEBUG ((DEBUG_INFO, "%a: The FVB Header is not valid.\n", __func__));
     DEBUG ((
       DEBUG_INFO,
       "%a: Installing a correct one for this volume.\n",
-      __FUNCTION__
+      __func__
       ));
 
     // Erase all the NorFlash that is reserved for variable storage
diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c
index cc5eefaaf352..5ee98e9b595a 100644
--- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c
+++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlashFvb.c
@@ -74,7 +74,7 @@ InitializeFvAndVariableStoreHeaders (
     DEBUG ((
       DEBUG_ERROR,
       "%a: NvStorageFtwWorkingBase is not contiguous with NvStorageVariableBase region\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_INVALID_PARAMETER;
   }
@@ -83,7 +83,7 @@ InitializeFvAndVariableStoreHeaders (
     DEBUG ((
       DEBUG_ERROR,
       "%a: NvStorageFtwSpareBase is not contiguous with NvStorageFtwWorkingBase region\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_INVALID_PARAMETER;
   }
@@ -93,7 +93,7 @@ InitializeFvAndVariableStoreHeaders (
     DEBUG ((
       DEBUG_ERROR,
       "%a: NvStorageVariableSize is 0x%x, should be atleast one block size\n",
-      __FUNCTION__,
+      __func__,
       NvStorageVariableSize
       ));
     return EFI_INVALID_PARAMETER;
@@ -103,7 +103,7 @@ InitializeFvAndVariableStoreHeaders (
     DEBUG ((
       DEBUG_ERROR,
       "%a: NvStorageFtwWorkingSize is 0x%x, should be atleast one block size\n",
-      __FUNCTION__,
+      __func__,
       NvStorageFtwWorkingSize
       ));
     return EFI_INVALID_PARAMETER;
@@ -113,7 +113,7 @@ InitializeFvAndVariableStoreHeaders (
     DEBUG ((
       DEBUG_ERROR,
       "%a: NvStorageFtwSpareSize is 0x%x, should be atleast one block size\n",
-      __FUNCTION__,
+      __func__,
       NvStorageFtwSpareSize
       ));
     return EFI_INVALID_PARAMETER;
@@ -124,7 +124,7 @@ InitializeFvAndVariableStoreHeaders (
       (NvStorageFtwWorkingBase % Instance->BlockSize != 0) ||
       (NvStorageFtwSpareBase % Instance->BlockSize != 0))
   {
-    DEBUG ((DEBUG_ERROR, "%a: NvStorage Base addresses must be aligned to block size boundaries", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: NvStorage Base addresses must be aligned to block size boundaries", __func__));
     return EFI_INVALID_PARAMETER;
   }
 
@@ -209,7 +209,7 @@ ValidateFvHeader (
     DEBUG ((
       DEBUG_INFO,
       "%a: No Firmware Volume header present\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_NOT_FOUND;
   }
@@ -219,7 +219,7 @@ ValidateFvHeader (
     DEBUG ((
       DEBUG_INFO,
       "%a: Firmware Volume Guid non-compatible\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_NOT_FOUND;
   }
@@ -230,7 +230,7 @@ ValidateFvHeader (
     DEBUG ((
       DEBUG_INFO,
       "%a: FV checksum is invalid (Checksum:0x%X)\n",
-      __FUNCTION__,
+      __func__,
       Checksum
       ));
     return EFI_NOT_FOUND;
@@ -245,7 +245,7 @@ ValidateFvHeader (
     DEBUG ((
       DEBUG_INFO,
       "%a: Variable Store Guid non-compatible\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_NOT_FOUND;
   }
@@ -255,7 +255,7 @@ ValidateFvHeader (
     DEBUG ((
       DEBUG_INFO,
       "%a: Variable Store Length does not match\n",
-      __FUNCTION__
+      __func__
       ));
     return EFI_NOT_FOUND;
   }
diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
index cc094cc4ddb8..74ed52f9da69 100644
--- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
+++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
@@ -943,7 +943,7 @@ VirtioBlkInit (
   DEBUG ((
     DEBUG_INFO,
     "%a: LbaSize=0x%x[B] NumBlocks=0x%Lx[Lba]\n",
-    __FUNCTION__,
+    __func__,
     Dev->BlockIoMedia.BlockSize,
     Dev->BlockIoMedia.LastBlock + 1
     ));
@@ -958,14 +958,14 @@ VirtioBlkInit (
     DEBUG ((
       DEBUG_INFO,
       "%a: FirstAligned=0x%Lx[Lba] PhysBlkSize=0x%x[Lba]\n",
-      __FUNCTION__,
+      __func__,
       Dev->BlockIoMedia.LowestAlignedLba,
       Dev->BlockIoMedia.LogicalBlocksPerPhysicalBlock
       ));
     DEBUG ((
       DEBUG_INFO,
       "%a: OptimalTransferLengthGranularity=0x%x[Lba]\n",
-      __FUNCTION__,
+      __func__,
       Dev->BlockIoMedia.OptimalTransferLengthGranularity
       ));
   }
@@ -1037,7 +1037,7 @@ VirtioBlkExitBoot (
 {
   VBLK_DEV  *Dev;
 
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
   //
   // Reset the device. This causes the hypervisor to forget about the virtio
   // ring.
diff --git a/OvmfPkg/VirtioFsDxe/FuseFlush.c b/OvmfPkg/VirtioFsDxe/FuseFlush.c
index ff5d6f3f5a88..26cc12087bd6 100644
--- a/OvmfPkg/VirtioFsDxe/FuseFlush.c
+++ b/OvmfPkg/VirtioFsDxe/FuseFlush.c
@@ -111,7 +111,7 @@ VirtioFsFuseFlush (
       DEBUG_ERROR,
       "%a: Label=\"%s\" NodeId=%Lu FuseHandle=%Lu "
       "Errno=%d\n",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       NodeId,
       FuseHandle,
diff --git a/OvmfPkg/VirtioFsDxe/FuseFsync.c b/OvmfPkg/VirtioFsDxe/FuseFsync.c
index c537b064e60e..11a4ab4e7786 100644
--- a/OvmfPkg/VirtioFsDxe/FuseFsync.c
+++ b/OvmfPkg/VirtioFsDxe/FuseFsync.c
@@ -116,7 +116,7 @@ VirtioFsFuseFsyncFileOrDir (
       DEBUG_ERROR,
       "%a: Label=\"%s\" NodeId=%Lu FuseHandle=%Lu "
       "IsDir=%d Errno=%d\n",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       NodeId,
       FuseHandle,
diff --git a/OvmfPkg/VirtioFsDxe/FuseGetAttr.c b/OvmfPkg/VirtioFsDxe/FuseGetAttr.c
index 1dc0349a55be..6f6e89c4fdc8 100644
--- a/OvmfPkg/VirtioFsDxe/FuseGetAttr.c
+++ b/OvmfPkg/VirtioFsDxe/FuseGetAttr.c
@@ -116,7 +116,7 @@ VirtioFsFuseGetAttr (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Label=\"%s\" NodeId=%Lu Errno=%d\n",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       NodeId,
       CommonResp.Error
diff --git a/OvmfPkg/VirtioFsDxe/FuseInit.c b/OvmfPkg/VirtioFsDxe/FuseInit.c
index d34fc05a50dd..590ef441ef3f 100644
--- a/OvmfPkg/VirtioFsDxe/FuseInit.c
+++ b/OvmfPkg/VirtioFsDxe/FuseInit.c
@@ -125,7 +125,7 @@ VirtioFsFuseInitSession (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Label=\"%s\" Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         CommonResp.Error
         ));
diff --git a/OvmfPkg/VirtioFsDxe/FuseLookup.c b/OvmfPkg/VirtioFsDxe/FuseLookup.c
index f2bda8a547ff..277a19fb1fda 100644
--- a/OvmfPkg/VirtioFsDxe/FuseLookup.c
+++ b/OvmfPkg/VirtioFsDxe/FuseLookup.c
@@ -128,7 +128,7 @@ VirtioFsFuseLookup (
          DEBUG_VERBOSE :
          DEBUG_ERROR),
         "%a: Label=\"%s\" DirNodeId=%Lu Name=\"%a\" Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         DirNodeId,
         Name,
diff --git a/OvmfPkg/VirtioFsDxe/FuseMkDir.c b/OvmfPkg/VirtioFsDxe/FuseMkDir.c
index 409e09a41895..847d0c079870 100644
--- a/OvmfPkg/VirtioFsDxe/FuseMkDir.c
+++ b/OvmfPkg/VirtioFsDxe/FuseMkDir.c
@@ -127,7 +127,7 @@ VirtioFsFuseMkDir (
         DEBUG_ERROR,
         "%a: Label=\"%s\" ParentNodeId=%Lu Name=\"%a\" "
         "Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         ParentNodeId,
         Name,
diff --git a/OvmfPkg/VirtioFsDxe/FuseOpen.c b/OvmfPkg/VirtioFsDxe/FuseOpen.c
index 64015bb6cc7f..99ea5f3b71b5 100644
--- a/OvmfPkg/VirtioFsDxe/FuseOpen.c
+++ b/OvmfPkg/VirtioFsDxe/FuseOpen.c
@@ -119,7 +119,7 @@ VirtioFsFuseOpen (
         DEBUG_ERROR,
         "%a: Label=\"%s\" NodeId=%Lu ReadWrite=%d "
         "Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         NodeId,
         ReadWrite,
diff --git a/OvmfPkg/VirtioFsDxe/FuseOpenDir.c b/OvmfPkg/VirtioFsDxe/FuseOpenDir.c
index e49c046b9d47..11249ef0a83e 100644
--- a/OvmfPkg/VirtioFsDxe/FuseOpenDir.c
+++ b/OvmfPkg/VirtioFsDxe/FuseOpenDir.c
@@ -113,7 +113,7 @@ VirtioFsFuseOpenDir (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Label=\"%s\" NodeId=%Lu Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         NodeId,
         CommonResp.Error
diff --git a/OvmfPkg/VirtioFsDxe/FuseOpenOrCreate.c b/OvmfPkg/VirtioFsDxe/FuseOpenOrCreate.c
index 4d9846ab3b05..db586dc76d9b 100644
--- a/OvmfPkg/VirtioFsDxe/FuseOpenOrCreate.c
+++ b/OvmfPkg/VirtioFsDxe/FuseOpenOrCreate.c
@@ -146,7 +146,7 @@ VirtioFsFuseOpenOrCreate (
         DEBUG_ERROR,
         "%a: Label=\"%s\" ParentNodeId=%Lu Name=\"%a\" "
         "Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         ParentNodeId,
         Name,
diff --git a/OvmfPkg/VirtioFsDxe/FuseRead.c b/OvmfPkg/VirtioFsDxe/FuseRead.c
index 013dac7e52f3..882d43304597 100644
--- a/OvmfPkg/VirtioFsDxe/FuseRead.c
+++ b/OvmfPkg/VirtioFsDxe/FuseRead.c
@@ -178,7 +178,7 @@ VirtioFsFuseReadFileOrDir (
         DEBUG_ERROR,
         "%a: Label=\"%s\" NodeId=%Lu FuseHandle=%Lu "
         "IsDir=%d Offset=0x%Lx Size=0x%x Data@%p Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         NodeId,
         FuseHandle,
diff --git a/OvmfPkg/VirtioFsDxe/FuseRelease.c b/OvmfPkg/VirtioFsDxe/FuseRelease.c
index c8363158f5e7..75bb171a139e 100644
--- a/OvmfPkg/VirtioFsDxe/FuseRelease.c
+++ b/OvmfPkg/VirtioFsDxe/FuseRelease.c
@@ -116,7 +116,7 @@ VirtioFsFuseReleaseFileOrDir (
       DEBUG_ERROR,
       "%a: Label=\"%s\" NodeId=%Lu FuseHandle=%Lu "
       "IsDir=%d Errno=%d\n",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       NodeId,
       FuseHandle,
diff --git a/OvmfPkg/VirtioFsDxe/FuseRename.c b/OvmfPkg/VirtioFsDxe/FuseRename.c
index a3a105050600..3ec536303776 100644
--- a/OvmfPkg/VirtioFsDxe/FuseRename.c
+++ b/OvmfPkg/VirtioFsDxe/FuseRename.c
@@ -130,7 +130,7 @@ VirtioFsFuseRename (
       DEBUG_ERROR,
       "%a: Label=\"%s\" OldParentNodeId=%Lu OldName=\"%a\" "
       "NewParentNodeId=%Lu NewName=\"%a\" Errno=%d\n",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       OldParentNodeId,
       OldName,
diff --git a/OvmfPkg/VirtioFsDxe/FuseSetAttr.c b/OvmfPkg/VirtioFsDxe/FuseSetAttr.c
index 9d0ea93fd957..719584fa322a 100644
--- a/OvmfPkg/VirtioFsDxe/FuseSetAttr.c
+++ b/OvmfPkg/VirtioFsDxe/FuseSetAttr.c
@@ -164,7 +164,7 @@ VirtioFsFuseSetAttr (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Label=\"%s\" NodeId=%Lu",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       NodeId
       ));
diff --git a/OvmfPkg/VirtioFsDxe/FuseStatFs.c b/OvmfPkg/VirtioFsDxe/FuseStatFs.c
index d93a62080e47..55b4edc5b938 100644
--- a/OvmfPkg/VirtioFsDxe/FuseStatFs.c
+++ b/OvmfPkg/VirtioFsDxe/FuseStatFs.c
@@ -102,7 +102,7 @@ VirtioFsFuseStatFs (
     DEBUG ((
       DEBUG_ERROR,
       "%a: Label=\"%s\" NodeId=%Lu Errno=%d\n",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       NodeId,
       CommonResp.Error
diff --git a/OvmfPkg/VirtioFsDxe/FuseUnlink.c b/OvmfPkg/VirtioFsDxe/FuseUnlink.c
index 14cbdec5f5b2..d83a175dc674 100644
--- a/OvmfPkg/VirtioFsDxe/FuseUnlink.c
+++ b/OvmfPkg/VirtioFsDxe/FuseUnlink.c
@@ -109,7 +109,7 @@ VirtioFsFuseRemoveFileOrDir (
       DEBUG_ERROR,
       "%a: Label=\"%s\" ParentNodeId=%Lu Name=\"%a\" "
       "IsDir=%d Errno=%d\n",
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       ParentNodeId,
       Name,
diff --git a/OvmfPkg/VirtioFsDxe/FuseWrite.c b/OvmfPkg/VirtioFsDxe/FuseWrite.c
index fe65c0bdbe41..98dbd6deccc3 100644
--- a/OvmfPkg/VirtioFsDxe/FuseWrite.c
+++ b/OvmfPkg/VirtioFsDxe/FuseWrite.c
@@ -147,7 +147,7 @@ VirtioFsFuseWrite (
         DEBUG_ERROR,
         "%a: Label=\"%s\" NodeId=%Lu FuseHandle=%Lu "
         "Offset=0x%Lx Size=0x%x Data@%p Errno=%d\n",
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         NodeId,
         FuseHandle,
diff --git a/OvmfPkg/VirtioFsDxe/Helpers.c b/OvmfPkg/VirtioFsDxe/Helpers.c
index f32fb1d48a3e..bc3c58cf41f9 100644
--- a/OvmfPkg/VirtioFsDxe/Helpers.c
+++ b/OvmfPkg/VirtioFsDxe/Helpers.c
@@ -320,7 +320,7 @@ VirtioFsExitBoot (
   DEBUG ((
     DEBUG_VERBOSE,
     "%a: VirtioFs=0x%p Label=\"%s\"\n",
-    __FUNCTION__,
+    __func__,
     VirtioFsAsVoid,
     VirtioFs->Label
     ));
diff --git a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
index d479f76f5bc3..a13d4f6a1e2d 100644
--- a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
+++ b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
@@ -378,7 +378,7 @@ VirtioFsSimpleFileOpen (
         ("%a: Label=\"%s\" CanonicalPathname=\"%a\" FileName=\"%s\" "
          "OpenMode=0x%Lx Attributes=0x%Lx: nonsensical request to possibly "
          "create a file marked read-only, for read-write access\n"),
-        __FUNCTION__,
+        __func__,
         VirtioFs->Label,
         VirtioFsFile->CanonicalPathname,
         FileName,
@@ -403,7 +403,7 @@ VirtioFsSimpleFileOpen (
       ("%a: Label=\"%s\" CanonicalPathname=\"%a\" FileName=\"%s\": "
        "nonsensical request to open a file or directory relative to a regular "
        "file\n"),
-      __FUNCTION__,
+      __func__,
       VirtioFs->Label,
       VirtioFsFile->CanonicalPathname,
       FileName
diff --git a/OvmfPkg/VirtioGpuDxe/Commands.c b/OvmfPkg/VirtioGpuDxe/Commands.c
index 4318d3d771c5..df79a5f8aff5 100644
--- a/OvmfPkg/VirtioGpuDxe/Commands.c
+++ b/OvmfPkg/VirtioGpuDxe/Commands.c
@@ -354,7 +354,7 @@ VirtioGpuExitBoot (
 {
   VGPU_DEV  *VgpuDev;
 
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
   VgpuDev = Context;
   VgpuDev->VirtIo->SetDeviceStatus (VgpuDev->VirtIo, 0);
 }
@@ -516,7 +516,7 @@ VirtioGpuSendCommandWithReply (
     DEBUG ((
       DEBUG_ERROR,
       "%a: malformed response to Request=0x%x\n",
-      __FUNCTION__,
+      __func__,
       (UINT32)RequestType
       ));
     Status = EFI_PROTOCOL_ERROR;
@@ -548,7 +548,7 @@ VirtioGpuSendCommandWithReply (
   DEBUG ((
     DEBUG_ERROR,
     "%a: Request=0x%x Response=0x%x (expected 0x%x)\n",
-    __FUNCTION__,
+    __func__,
     (UINT32)RequestType,
     Response->Type,
     ResponseType
diff --git a/OvmfPkg/VirtioGpuDxe/DriverBinding.c b/OvmfPkg/VirtioGpuDxe/DriverBinding.c
index 21bf2babc8ef..80eac08f901b 100644
--- a/OvmfPkg/VirtioGpuDxe/DriverBinding.c
+++ b/OvmfPkg/VirtioGpuDxe/DriverBinding.c
@@ -816,7 +816,7 @@ VirtioGpuDriverBindingStart (
       DEBUG ((
         DEBUG_INFO,
         "%a: bound VirtIo=%p without producing GOP\n",
-        __FUNCTION__,
+        __func__,
         (VOID *)VgpuDev->VirtIo
         ));
       return EFI_SUCCESS;
@@ -848,7 +848,7 @@ VirtioGpuDriverBindingStart (
   DEBUG ((
     DEBUG_INFO,
     "%a: produced GOP %a VirtIo=%p\n",
-    __FUNCTION__,
+    __func__,
     VirtIoBoundJustNow ? "while binding" : "for pre-bound",
     (VOID *)VgpuDev->VirtIo
     ));
@@ -952,7 +952,7 @@ VirtioGpuDriverBindingStop (
       DEBUG ((
         DEBUG_INFO,
         "%a: unbinding GOP-less VirtIo=%p\n",
-        __FUNCTION__,
+        __func__,
         (VOID *)VgpuDev->VirtIo
         ));
 
@@ -1010,7 +1010,7 @@ VirtioGpuDriverBindingStop (
       DEBUG ((
         DEBUG_INFO,
         "%a: destroying GOP under VirtIo=%p\n",
-        __FUNCTION__,
+        __func__,
         (VOID *)VgpuDev->VirtIo
         ));
       UninitVgpuGop (VgpuDev, ControllerHandle, This->DriverBindingHandle);
diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c
index 16e92830d411..f64dfce5f400 100644
--- a/OvmfPkg/VirtioGpuDxe/Gop.c
+++ b/OvmfPkg/VirtioGpuDxe/Gop.c
@@ -222,7 +222,7 @@ GopNativeResolution (
     DEBUG ((
       DEBUG_INFO,
       "%a: #%d: %dx%d\n",
-      __FUNCTION__,
+      __func__,
       Index,
       DisplayInfo.Pmodes[Index].Rectangle.Width,
       DisplayInfo.Pmodes[Index].Rectangle.Height
diff --git a/OvmfPkg/VirtioNetDxe/Events.c b/OvmfPkg/VirtioNetDxe/Events.c
index 4c93607a38cc..75a9644f749c 100644
--- a/OvmfPkg/VirtioNetDxe/Events.c
+++ b/OvmfPkg/VirtioNetDxe/Events.c
@@ -77,7 +77,7 @@ VirtioNetExitBoot (
   //
   VNET_DEV  *Dev;
 
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
   Dev = Context;
   if (Dev->Snm.State == EfiSimpleNetworkInitialized) {
     Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/VirtioRng.c
index aabc7230ab67..069aed148af1 100644
--- a/OvmfPkg/VirtioRngDxe/VirtioRng.c
+++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c
@@ -435,7 +435,7 @@ VirtioRngExitBoot (
 {
   VIRTIO_RNG_DEV  *Dev;
 
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
   //
   // Reset the device. This causes the hypervisor to forget about the virtio
   // ring.
diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
index d44f9ebca7db..3705f5fc14d5 100644
--- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
+++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c
@@ -1235,7 +1235,7 @@ VirtioScsiExitBoot (
 {
   VSCSI_DEV  *Dev;
 
-  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
+  DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
   //
   // Reset the device. This causes the hypervisor to forget about the virtio
   // ring.
diff --git a/OvmfPkg/XenAcpiPlatformDxe/Xen.c b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
index cc2fa2cdcf8c..a80a24628c08 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
@@ -299,7 +299,7 @@ InstallXenTables (
   // then we're out of sync with the hypervisor, and cannot continue.
   //
   if (DsdtTable == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __FUNCTION__));
+    DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __func__));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
diff --git a/OvmfPkg/XenPlatformPei/ClearCache.c b/OvmfPkg/XenPlatformPei/ClearCache.c
index 71e63ab86871..a37d1d0c0a8e 100644
--- a/OvmfPkg/XenPlatformPei/ClearCache.c
+++ b/OvmfPkg/XenPlatformPei/ClearCache.c
@@ -60,7 +60,7 @@ ClearCacheOnMpServicesAvailable (
   EFI_PEI_MP_SERVICES_PPI  *MpServices;
   EFI_STATUS               Status;
 
-  DEBUG ((DEBUG_INFO, "%a: %a\n", gEfiCallerBaseName, __FUNCTION__));
+  DEBUG ((DEBUG_INFO, "%a: %a\n", gEfiCallerBaseName, __func__));
 
   //
   // Clear cache on all the APs in parallel.
@@ -75,7 +75,7 @@ ClearCacheOnMpServicesAvailable (
                              NULL             // ProcedureArgument
                              );
   if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) {
-    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __FUNCTION__, Status));
+    DEBUG ((DEBUG_ERROR, "%a: StartupAllAps(): %r\n", __func__, Status));
     return Status;
   }
 
@@ -109,7 +109,7 @@ InstallClearCacheCallback (
     DEBUG ((
       DEBUG_ERROR,
       "%a: failed to set up MP Services callback: %r\n",
-      __FUNCTION__,
+      __func__,
       Status
       ));
   }
diff --git a/OvmfPkg/XenPlatformPei/MemDetect.c b/OvmfPkg/XenPlatformPei/MemDetect.c
index d412d1f4db6f..e552e7a55e4f 100644
--- a/OvmfPkg/XenPlatformPei/MemDetect.c
+++ b/OvmfPkg/XenPlatformPei/MemDetect.c
@@ -54,7 +54,7 @@ Q35TsegMbytesInitialization (
       DEBUG_ERROR,
       "%a: no TSEG (SMRAM) on host bridge DID=0x%04x; "
       "only DID=0x%04x (Q35) is supported\n",
-      __FUNCTION__,
+      __func__,
       mHostBridgeDevId,
       INTEL_Q35_MCH_DEVICE_ID
       ));
@@ -88,7 +88,7 @@ Q35TsegMbytesInitialization (
   DEBUG ((
     DEBUG_INFO,
     "%a: QEMU offers an extended TSEG (%d MB)\n",
-    __FUNCTION__,
+    __func__,
     ExtendedTsegMbytes
     ));
   PcdStatus = PcdSet16S (PcdQ35TsegMbytes, ExtendedTsegMbytes);
@@ -291,7 +291,7 @@ PublishPeiMemory (
     DEBUG ((
       DEBUG_INFO,
       "%a: mPhysMemAddressWidth=%d PeiMemoryCap=%u KB\n",
-      __FUNCTION__,
+      __func__,
       mPhysMemAddressWidth,
       PeiMemoryCap >> 10
       ));
diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Platform.c
index 6c1886c158b5..c3fdf3d0b8a6 100644
--- a/OvmfPkg/XenPlatformPei/Platform.c
+++ b/OvmfPkg/XenPlatformPei/Platform.c
@@ -292,7 +292,7 @@ MiscInitialization (
       DEBUG ((
         DEBUG_ERROR,
         "%a: Unknown Host Bridge Device ID: 0x%04x\n",
-        __FUNCTION__,
+        __func__,
         mHostBridgeDevId
         ));
       ASSERT (FALSE);
diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c
index 1827cc58e390..5a3ad5e4e579 100644
--- a/OvmfPkg/XenPvBlkDxe/BlockFront.c
+++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c
@@ -187,13 +187,13 @@ XenPvBlockFrontInitialization (
   if (Dev->MediaInfo.CdRom) {
     Status = XenBusIo->XsBackendRead (XenBusIo, XST_NIL, "params", (VOID **)&Params);
     if (Status != XENSTORE_STATUS_SUCCESS) {
-      DEBUG ((DEBUG_ERROR, "%a: Failed to read params (%d)\n", __FUNCTION__, Status));
+      DEBUG ((DEBUG_ERROR, "%a: Failed to read params (%d)\n", __func__, Status));
       goto Error;
     }
 
     if ((AsciiStrLen (Params) == 0) || (AsciiStrCmp (Params, "aio:") == 0)) {
       FreePool (Params);
-      DEBUG ((DEBUG_INFO, "%a: Empty cdrom\n", __FUNCTION__));
+      DEBUG ((DEBUG_INFO, "%a: Empty cdrom\n", __func__));
       goto Error;
     }
 
-- 
2.34.1


  parent reply	other threads:[~2023-04-06 22:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 22:23 [PATCH 00/18] Replace pre-standard macro __FUNCTION__ with C99 __func__ throughout edk2 Rebecca Cran
2023-04-06 22:23 ` [PATCH 01/18] ArmPkg: Update code to be more C11 compliant by using __func__ Rebecca Cran
2023-04-07 20:18   ` [edk2-devel] " Michael D Kinney
2023-04-06 22:23 ` [PATCH 02/18] ArmVirtPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 03/18] UefiCpuPkg: " Rebecca Cran
2023-04-07  3:09   ` Ni, Ray
2023-04-07 11:24   ` Sunil V L
2023-04-06 22:23 ` Rebecca Cran [this message]
2023-04-07 11:19   ` [PATCH 04/18] OvmfPkg: " Sunil V L
2023-04-06 22:23 ` [PATCH 05/18] MdeModulePkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 06/18] SecurityPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 07/18] EmbeddedPkg: " Rebecca Cran
2023-04-07  8:25   ` Chang, Abner
2023-04-06 22:23 ` [PATCH 08/18] RedfishPkg: " Rebecca Cran
2023-04-07  5:39   ` Nickle Wang
2023-04-06 22:23 ` [PATCH 09/18] ArmPlatformPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 10/18] UnitTestFrameworkPkg: Update " Rebecca Cran
2023-04-06 22:23 ` [PATCH 11/18] PrmPkg: Update code " Rebecca Cran
2023-04-06 22:23 ` [PATCH 12/18] StandaloneMmPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 13/18] CryptoPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 14/18] NetworkPkg: " Rebecca Cran
2023-04-06 22:23 ` [PATCH 15/18] SourceLevelDebugPkg: " Rebecca Cran
2023-04-07  3:08   ` Ni, Ray
2023-04-06 22:23 ` [PATCH 16/18] EmulatorPkg: " Rebecca Cran
2023-04-07  3:08   ` Ni, Ray
2023-04-07  8:23   ` Chang, Abner
2023-04-06 22:23 ` [PATCH 17/18] UefiPayloadPkg: " Rebecca Cran
2023-04-07  5:57   ` Guo, Gua
2023-04-07  7:55   ` Lu, James
2023-04-06 22:23 ` [PATCH 18/18] FmpDevicePkg: " Rebecca Cran
2023-04-10  1:05   ` Xu, Wei6
2023-04-07 10:09 ` [edk2-devel] [PATCH 00/18] Replace pre-standard macro __FUNCTION__ with C99 __func__ throughout edk2 Ard Biesheuvel
2023-04-10 14:21 ` Rebecca Cran
2023-04-11  9:15 ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406222319.2281263-5-rebecca@bsdio.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox