diff --git a/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c b/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c index 005c471980..3744ebfd48 100644 --- a/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c +++ b/ArmPkg/Drivers/CpuDxe/MemoryAttribute.c @@ -84,13 +84,13 @@ GetMemoryAttributes ( EFI_STATUS Status; if ((Length == 0) || (Attributes == NULL)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a invalid length 0x%llx or attributes %p are null\n", - __func__, - (UINT64)RegionLength, - Attributes - )); // MU_CHANGE: Better memory attributes protocol logging + "%a: Length is zero or Attributes is NULL\n", + __func__ + )); + // MU_CHANGE END return EFI_INVALID_PARAMETER; } @@ -208,13 +208,14 @@ SetMemoryAttributes ( if ((Length == 0) || ((Attributes & ~(EFI_MEMORY_RO | EFI_MEMORY_RP | EFI_MEMORY_XP)) != 0)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a invalid length: 0x%llx or attributes 0x%llx\n", + "%a: Length is zero or Attributes (0x%Lx) is invalid\n", __func__, - Length, Attributes - )); // MU_CHANGE: Better memory attributes protocol logging + )); + // MU_CHANGE END return EFI_INVALID_PARAMETER; } @@ -227,14 +228,16 @@ SetMemoryAttributes ( if ((Attributes & EFI_MEMORY_RP) != 0) { Status = ArmSetMemoryRegionNoAccess (BaseAddress, Length); if (EFI_ERROR (Status)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a failed to set EFI_MEMORY_RP on BaseAddress 0x%llx of length 0x%llx with status %r!\n", + "%a: Failed to set EFI_MEMORY_RP on range 0x%Lx-0x%Lx! Status: %r\n", __func__, BaseAddress, - Length, + BaseAddress + Length, Status - )); // MU_CHANGE: Better memory attribute protocol logging + )); + // MU_CHANGE END return EFI_UNSUPPORTED; } } @@ -242,14 +245,16 @@ SetMemoryAttributes ( if ((Attributes & EFI_MEMORY_RO) != 0) { Status = ArmSetMemoryRegionReadOnly (BaseAddress, Length); if (EFI_ERROR (Status)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a failed to set EFI_MEMORY_RO on BaseAddress 0x%llx of length 0x%llx with status %r!\n", + "%a: Failed to set EFI_MEMORY_RO on range 0x%Lx-0x%Lx! Status: %r\n", __func__, BaseAddress, - Length, + BaseAddress + Length, Status - )); // MU_CHANGE: Better memory attribute protocol logging + )); + // MU_CHANGE END return EFI_UNSUPPORTED; } } @@ -257,14 +262,16 @@ SetMemoryAttributes ( if ((Attributes & EFI_MEMORY_XP) != 0) { Status = ArmSetMemoryRegionNoExec (BaseAddress, Length); if (EFI_ERROR (Status)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a failed to set EFI_MEMORY_XP on BaseAddress 0x%llx of length 0x%llx with status %r!\n", + "%a: Failed to set EFI_MEMORY_XP on range 0x%Lx-0x%Lx! Status: %r\n", __func__, BaseAddress, - Length, + BaseAddress + Length, Status - )); // MU_CHANGE: Better memory attribute protocol logging + )); + // MU_CHANGE END return EFI_UNSUPPORTED; } } @@ -325,13 +332,14 @@ ClearMemoryAttributes ( if ((Length == 0) || ((Attributes & ~(EFI_MEMORY_RO | EFI_MEMORY_RP | EFI_MEMORY_XP)) != 0)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a invalid length: 0x%llx or attributes 0x%llx\n", + "%a: Length is zero or Attributes (0x%Lx) is invalid\n", __func__, - Length, Attributes - )); // MU_CHANGE: Better memory attributes protocol logging + )); + // MU_CHANGE END return EFI_INVALID_PARAMETER; } @@ -344,14 +352,16 @@ ClearMemoryAttributes ( if ((Attributes & EFI_MEMORY_RP) != 0) { Status = ArmClearMemoryRegionNoAccess (BaseAddress, Length); if (EFI_ERROR (Status)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a failed to clear EFI_MEMORY_RP from BaseAddress 0x%llx of length 0x%llx with status %r!\n", + "%a: Failed to clear EFI_MEMORY_RP on range 0x%Lx-0x%Lx! Status: %r\n", __func__, BaseAddress, - Length, + BaseAddress + Length, Status - )); // MU_CHANGE: Better memory attribute protocol logging + )); + // MU_CHANGE END return EFI_UNSUPPORTED; } } @@ -359,14 +369,16 @@ ClearMemoryAttributes ( if ((Attributes & EFI_MEMORY_RO) != 0) { Status = ArmClearMemoryRegionReadOnly (BaseAddress, Length); if (EFI_ERROR (Status)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a failed to clear EFI_MEMORY_RO from BaseAddress 0x%llx of length 0x%llx with status %r!\n", + "%a: Failed to clear EFI_MEMORY_RO on range 0x%Lx-0x%Lx! Status: %r\n", __func__, BaseAddress, - Length, + BaseAddress + Length, Status - )); // MU_CHANGE: Better memory attribute protocol logging + )); + // MU_CHANGE END return EFI_UNSUPPORTED; } } @@ -374,14 +386,16 @@ ClearMemoryAttributes ( if ((Attributes & EFI_MEMORY_XP) != 0) { Status = ArmClearMemoryRegionNoExec (BaseAddress, Length); if (EFI_ERROR (Status)) { + // MU_CHANGE START: Update protocol logging DEBUG (( DEBUG_ERROR, - "%a failed to clear EFI_MEMORY_XP from BaseAddress 0x%llx of length 0x%llx with status %r!\n", + "%a: Failed to clear EFI_MEMORY_XP on range 0x%Lx-0x%Lx! Status: %r\n", __func__, BaseAddress, - Length, + BaseAddress + Length, Status - )); // MU_CHANGE: Better memory attribute protocol logging + )); + // MU_CHANGE END return EFI_UNSUPPORTED; } }