Update Arm Memory Attribute Protocol Logging (#134)

## Description

Fixes https://github.com/microsoft/mu_silicon_arm_tiano/issues/129 and
reformats the debug prints.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

CI Pipelines

## Integration Instructions

N/A
This commit is contained in:
Taylor Beebe 2023-06-27 12:23:16 -07:00 коммит произвёл GitHub
Родитель bd7043deec
Коммит 9f454bc95f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 43 добавлений и 29 удалений

Просмотреть файл

@ -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;
}
}