/* AttributeMask must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and EFI_MEMORY_XP, and specifies the attributes that the call will operate on. AttributeMask must not be 0x0, and must contain at least the bits set in Attributes. */
STATIC EFI_STATUS EFIAPI SetMemoryPermissions(IN EDKII_MEMORY_ATTRIBUTE_PPI *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN UINT64 AttributeMask)
/* AttributeMask must contain a combination of EFI_MEMORY_RP, EFI_MEMORY_RO and EFI_MEMORY_XP, and specifies the attributes that the call will operate on. AttributeMask must not be 0x0, and must contain at least the bits set in Attributes. */
STATIC EFI_STATUS EFIAPI SetMemoryPermissions(IN EDKII_MEMORY_ATTRIBUTE_PPI *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN UINT64 AttributeMask)
{
  if ((Length == 0) ||
      (AttributeMask == 0) ||
      ((AttributeMask & (EFI_MEMORY_RP | EFI_MEMORY_RO | EFI_MEMORY_XP)) == 0) ||
      ((Attributes & ~AttributeMask) != 0) ||
      (((BaseAddress | Length) & EFI_PAGE_MASK) != 0))
  {
    return EFI_INVALID_PARAMETER;
  }
  return ArmSetMemoryAttributes (BaseAddress, Length, Attributes, AttributeMask);
}