summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
authorOliver Smith-Denny <osde@linux.microsoft.com>2024-07-19 12:33:49 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-23 03:32:41 +0000
commit37287bf9add9edbfbc0dac9a66f8f2a3112e3ce8 (patch)
tree7c937f3b02864eba4b7f433d9b25fe7cc662668a /ArmPkg
parentc5582e435c2ed7faa5bee46b5c7a5d04b8edfeaa (diff)
downloadedk2-37287bf9add9edbfbc0dac9a66f8f2a3112e3ce8.zip
edk2-37287bf9add9edbfbc0dac9a66f8f2a3112e3ce8.tar.gz
edk2-37287bf9add9edbfbc0dac9a66f8f2a3112e3ce8.tar.bz2
ArmPkg: CpuDxe: Add Memory Attribute Protocol Logging
The memory attribute protocol is primarily used by bootloaders and there are many released bootloaders who use the protocol incorrectly. It is challenging to debug these situations because the bootloaders are generally black boxes and we silently fail on the FW side. This patch adds logging to some common memory attribute protocol failures in CpuDxe. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Drivers/CpuDxe/MemoryAttribute.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c b/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c
index 16cc4ef..c77feb8 100644
--- a/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c
+++ b/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c
@@ -82,6 +82,13 @@ GetMemoryAttributes (
EFI_STATUS Status;
if ((Length == 0) || (Attributes == NULL)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: BaseAddress 0x%llx Length 0x%llx is zero or Attributes is NULL\n",
+ __func__,
+ BaseAddress,
+ Length
+ ));
return EFI_INVALID_PARAMETER;
}
@@ -195,6 +202,13 @@ SetMemoryAttributes (
if ((Length == 0) ||
((Attributes & ~(EFI_MEMORY_RO | EFI_MEMORY_RP | EFI_MEMORY_XP)) != 0))
{
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: BaseAddress 0x%llx Length is zero or Attributes (0x%llx) is invalid\n",
+ __func__,
+ BaseAddress,
+ Attributes
+ ));
return EFI_INVALID_PARAMETER;
}
@@ -256,6 +270,13 @@ ClearMemoryAttributes (
if ((Length == 0) ||
((Attributes & ~(EFI_MEMORY_RO | EFI_MEMORY_RP | EFI_MEMORY_XP)) != 0))
{
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: BaseAddress 0x%llx Length is zero or Attributes (0x%llx) is invalid\n",
+ __func__,
+ BaseAddress,
+ Attributes
+ ));
return EFI_INVALID_PARAMETER;
}