From 74833ca459577307da02c3d74a9e65fb3d3161c2 Mon Sep 17 00:00:00 2001 From: Oliver Smith-Denny Date: Fri, 19 Jul 2024 12:37:36 -0700 Subject: [PATCH] ArmPkg: ArmMmuLib: Add ARM32 Memory Attribute Update Failure Logging This adds logging in failure cases of SetMemoryAttributes. This is useful generally as if an attribute update fails, code will typically break, but is added in particular to make debugging incorrect bootloader usage of the Memory Attribute Protocol. This patch updates the ARM32 SetMemoryAttributes. Signed-off-by: Oliver Smith-Denny --- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibUpdate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibUpdate.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibUpdate.c index 5e751cddd7..b8b8a7016d 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibUpdate.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibUpdate.c @@ -377,6 +377,13 @@ SetMemoryAttributes ( BOOLEAN FlushTlbs; if (BaseAddress > (UINT64)MAX_ADDRESS) { + DEBUG (( + DEBUG_ERROR, + "%a BaseAddress: 0x%llx is greater than MAX_ADDRESS: 0x%llx, fail to apply attributes!\n", + __func__, + BaseAddress, + (UINT64)MAX_ADDRESS + )); return EFI_UNSUPPORTED; } @@ -437,6 +444,14 @@ SetMemoryAttributes ( } if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a failed to update attributes with status %r for BaseAddress 0x%llx of length 0x%llx\n", + __func__, + Status, + BaseAddress, + ChunkLength + )); break; }