mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
ArmPkg/CpuDxe: Expose unified region-to-EFI attribute conversion
In preparation for introducing an implementation of the EFI memory attributes protocol that is shared between ARM and AArch64, unify the existing code that converts a page table descriptor into a EFI_MEMORY_xx bitfield, so it can be called from the generic code. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
This commit is contained in:
parent
ae2c904c3d
commit
f4a6f63999
@ -83,6 +83,23 @@ PageAttributeToGcdAttribute (
|
|||||||
return GcdAttributes;
|
return GcdAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert an arch specific set of page attributes into a mask
|
||||||
|
of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
@param PageAttributes The set of page attributes.
|
||||||
|
|
||||||
|
@retval The mask of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT64
|
||||||
|
RegionAttributeToGcdAttribute (
|
||||||
|
IN UINTN PageAttributes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return PageAttributeToGcdAttribute (PageAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
UINT64
|
UINT64
|
||||||
GetFirstPageAttribute (
|
GetFirstPageAttribute (
|
||||||
|
@ -13,6 +13,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include "CpuDxe.h"
|
#include "CpuDxe.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert a set of ARM short descriptor section attributes into a mask
|
||||||
|
of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
@param SectionAttributes The set of page attributes.
|
||||||
|
@param GcdAttributes Pointer to the return value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
SectionToGcdAttributes (
|
SectionToGcdAttributes (
|
||||||
IN UINT32 SectionAttributes,
|
IN UINT32 SectionAttributes,
|
||||||
@ -74,6 +83,35 @@ SectionToGcdAttributes (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert an arch specific set of page attributes into a mask
|
||||||
|
of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
@param PageAttributes The set of page attributes.
|
||||||
|
|
||||||
|
@retval The mask of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT64
|
||||||
|
RegionAttributeToGcdAttribute (
|
||||||
|
IN UINTN PageAttributes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UINT64 Result;
|
||||||
|
|
||||||
|
SectionToGcdAttributes (PageAttributes, &Result);
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert a set of ARM short descriptor page attributes into a mask
|
||||||
|
of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
@param PageAttributes The set of page attributes.
|
||||||
|
@param GcdAttributes Pointer to the return value.
|
||||||
|
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PageToGcdAttributes (
|
PageToGcdAttributes (
|
||||||
IN UINT32 PageAttributes,
|
IN UINT32 PageAttributes,
|
||||||
|
@ -126,4 +126,18 @@ SetGcdMemorySpaceAttributes (
|
|||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert an arch specific set of page attributes into a mask
|
||||||
|
of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
@param PageAttributes The set of page attributes.
|
||||||
|
|
||||||
|
@retval The mask of EFI_MEMORY_xx constants.
|
||||||
|
|
||||||
|
**/
|
||||||
|
UINT64
|
||||||
|
RegionAttributeToGcdAttribute (
|
||||||
|
IN UINTN PageAttributes
|
||||||
|
);
|
||||||
|
|
||||||
#endif // CPU_DXE_H_
|
#endif // CPU_DXE_H_
|
||||||
|
Loading…
x
Reference in New Issue
Block a user