mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 22:54:51 +02:00
UefiCpuPkg: Fix unix style of EOL
Cc: Wu Hao <hao.a.wu@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
parent
e63da9f033
commit
827330ccd1
@ -442,8 +442,8 @@ ConvertPageEntryAttribute (
|
|||||||
*PageEntry = NewPageEntry;
|
*PageEntry = NewPageEntry;
|
||||||
if (CurrentPageEntry != NewPageEntry) {
|
if (CurrentPageEntry != NewPageEntry) {
|
||||||
*IsModified = TRUE;
|
*IsModified = TRUE;
|
||||||
DEBUG ((DEBUG_VERBOSE, "ConvertPageEntryAttribute 0x%lx", CurrentPageEntry));
|
DEBUG ((DEBUG_VERBOSE, "ConvertPageEntryAttribute 0x%lx", CurrentPageEntry));
|
||||||
DEBUG ((DEBUG_VERBOSE, "->0x%lx\n", NewPageEntry));
|
DEBUG ((DEBUG_VERBOSE, "->0x%lx\n", NewPageEntry));
|
||||||
} else {
|
} else {
|
||||||
*IsModified = FALSE;
|
*IsModified = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -196,16 +196,16 @@ SetPageTableAttributes (
|
|||||||
BOOLEAN IsSplitted;
|
BOOLEAN IsSplitted;
|
||||||
BOOLEAN PageTableSplitted;
|
BOOLEAN PageTableSplitted;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Don't mark page table as read-only if heap guard is enabled.
|
// Don't mark page table as read-only if heap guard is enabled.
|
||||||
//
|
//
|
||||||
// BIT2: SMM page guard enabled
|
// BIT2: SMM page guard enabled
|
||||||
// BIT3: SMM pool guard enabled
|
// BIT3: SMM pool guard enabled
|
||||||
//
|
//
|
||||||
if ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) {
|
if ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "SetPageTableAttributes\n"));
|
DEBUG ((DEBUG_INFO, "SetPageTableAttributes\n"));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -76,15 +76,15 @@ EFI_SMM_CPU_PROTOCOL mSmmCpu = {
|
|||||||
SmmWriteSaveState
|
SmmWriteSaveState
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
/// SMM Memory Attribute Protocol instance
|
/// SMM Memory Attribute Protocol instance
|
||||||
///
|
///
|
||||||
EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL mSmmMemoryAttribute = {
|
EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL mSmmMemoryAttribute = {
|
||||||
EdkiiSmmGetMemoryAttributes,
|
EdkiiSmmGetMemoryAttributes,
|
||||||
EdkiiSmmSetMemoryAttributes,
|
EdkiiSmmSetMemoryAttributes,
|
||||||
EdkiiSmmClearMemoryAttributes
|
EdkiiSmmClearMemoryAttributes
|
||||||
};
|
};
|
||||||
|
|
||||||
EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[EXCEPTION_VECTOR_NUMBER];
|
EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[EXCEPTION_VECTOR_NUMBER];
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -902,17 +902,17 @@ PiCpuSmmEntry (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install the SMM Memory Attribute Protocol into SMM protocol database
|
// Install the SMM Memory Attribute Protocol into SMM protocol database
|
||||||
//
|
//
|
||||||
Status = gSmst->SmmInstallProtocolInterface (
|
Status = gSmst->SmmInstallProtocolInterface (
|
||||||
&mSmmCpuHandle,
|
&mSmmCpuHandle,
|
||||||
&gEdkiiSmmMemoryAttributeProtocolGuid,
|
&gEdkiiSmmMemoryAttributeProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
&mSmmMemoryAttribute
|
&mSmmMemoryAttribute
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Expose address of CPU Hot Plug Data structure if CPU hot plug is supported.
|
// Expose address of CPU Hot Plug Data structure if CPU hot plug is supported.
|
||||||
//
|
//
|
||||||
|
@ -25,7 +25,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <Protocol/SmmAccess2.h>
|
#include <Protocol/SmmAccess2.h>
|
||||||
#include <Protocol/SmmReadyToLock.h>
|
#include <Protocol/SmmReadyToLock.h>
|
||||||
#include <Protocol/SmmCpuService.h>
|
#include <Protocol/SmmCpuService.h>
|
||||||
#include <Protocol/SmmMemoryAttribute.h>
|
#include <Protocol/SmmMemoryAttribute.h>
|
||||||
|
|
||||||
#include <Guid/AcpiS3Context.h>
|
#include <Guid/AcpiS3Context.h>
|
||||||
#include <Guid/PiSmmMemoryAttributesTable.h>
|
#include <Guid/PiSmmMemoryAttributesTable.h>
|
||||||
@ -1069,101 +1069,101 @@ TransferApToSafeState (
|
|||||||
IN UINTN NumberToFinishAddress
|
IN UINTN NumberToFinishAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function set given attributes of the memory region specified by
|
This function set given attributes of the memory region specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
||||||
@param BaseAddress The physical address that is the start address of
|
@param BaseAddress The physical address that is the start address of
|
||||||
a memory region.
|
a memory region.
|
||||||
@param Length The size in bytes of the memory region.
|
@param Length The size in bytes of the memory region.
|
||||||
@param Attributes The bit mask of attributes to set for the memory
|
@param Attributes The bit mask of attributes to set for the memory
|
||||||
region.
|
region.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The attributes were set for the memory region.
|
@retval EFI_SUCCESS The attributes were set for the memory region.
|
||||||
@retval EFI_INVALID_PARAMETER Length is zero.
|
@retval EFI_INVALID_PARAMETER Length is zero.
|
||||||
Attributes specified an illegal combination of
|
Attributes specified an illegal combination of
|
||||||
attributes that cannot be set together.
|
attributes that cannot be set together.
|
||||||
@retval EFI_UNSUPPORTED The processor does not support one or more
|
@retval EFI_UNSUPPORTED The processor does not support one or more
|
||||||
bytes of the memory resource range specified
|
bytes of the memory resource range specified
|
||||||
by BaseAddress and Length.
|
by BaseAddress and Length.
|
||||||
The bit mask of attributes is not support for
|
The bit mask of attributes is not support for
|
||||||
the memory resource range specified by
|
the memory resource range specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EdkiiSmmSetMemoryAttributes (
|
EdkiiSmmSetMemoryAttributes (
|
||||||
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
||||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||||
IN UINT64 Length,
|
IN UINT64 Length,
|
||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function clears given attributes of the memory region specified by
|
This function clears given attributes of the memory region specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
||||||
@param BaseAddress The physical address that is the start address of
|
@param BaseAddress The physical address that is the start address of
|
||||||
a memory region.
|
a memory region.
|
||||||
@param Length The size in bytes of the memory region.
|
@param Length The size in bytes of the memory region.
|
||||||
@param Attributes The bit mask of attributes to set for the memory
|
@param Attributes The bit mask of attributes to set for the memory
|
||||||
region.
|
region.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The attributes were set for the memory region.
|
@retval EFI_SUCCESS The attributes were set for the memory region.
|
||||||
@retval EFI_INVALID_PARAMETER Length is zero.
|
@retval EFI_INVALID_PARAMETER Length is zero.
|
||||||
Attributes specified an illegal combination of
|
Attributes specified an illegal combination of
|
||||||
attributes that cannot be set together.
|
attributes that cannot be set together.
|
||||||
@retval EFI_UNSUPPORTED The processor does not support one or more
|
@retval EFI_UNSUPPORTED The processor does not support one or more
|
||||||
bytes of the memory resource range specified
|
bytes of the memory resource range specified
|
||||||
by BaseAddress and Length.
|
by BaseAddress and Length.
|
||||||
The bit mask of attributes is not support for
|
The bit mask of attributes is not support for
|
||||||
the memory resource range specified by
|
the memory resource range specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EdkiiSmmClearMemoryAttributes (
|
EdkiiSmmClearMemoryAttributes (
|
||||||
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
||||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||||
IN UINT64 Length,
|
IN UINT64 Length,
|
||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function retrieve the attributes of the memory region specified by
|
This function retrieve the attributes of the memory region specified by
|
||||||
BaseAddress and Length. If different attributes are got from different part
|
BaseAddress and Length. If different attributes are got from different part
|
||||||
of the memory region, EFI_NO_MAPPING will be returned.
|
of the memory region, EFI_NO_MAPPING will be returned.
|
||||||
|
|
||||||
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
||||||
@param BaseAddress The physical address that is the start address of
|
@param BaseAddress The physical address that is the start address of
|
||||||
a memory region.
|
a memory region.
|
||||||
@param Length The size in bytes of the memory region.
|
@param Length The size in bytes of the memory region.
|
||||||
@param Attributes Pointer to attributes returned.
|
@param Attributes Pointer to attributes returned.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The attributes got for the memory region.
|
@retval EFI_SUCCESS The attributes got for the memory region.
|
||||||
@retval EFI_INVALID_PARAMETER Length is zero.
|
@retval EFI_INVALID_PARAMETER Length is zero.
|
||||||
Attributes is NULL.
|
Attributes is NULL.
|
||||||
@retval EFI_NO_MAPPING Attributes are not consistent cross the memory
|
@retval EFI_NO_MAPPING Attributes are not consistent cross the memory
|
||||||
region.
|
region.
|
||||||
@retval EFI_UNSUPPORTED The processor does not support one or more
|
@retval EFI_UNSUPPORTED The processor does not support one or more
|
||||||
bytes of the memory resource range specified
|
bytes of the memory resource range specified
|
||||||
by BaseAddress and Length.
|
by BaseAddress and Length.
|
||||||
The bit mask of attributes is not support for
|
The bit mask of attributes is not support for
|
||||||
the memory resource range specified by
|
the memory resource range specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EdkiiSmmGetMemoryAttributes (
|
EdkiiSmmGetMemoryAttributes (
|
||||||
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
||||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||||
IN UINT64 Length,
|
IN UINT64 Length,
|
||||||
IN UINT64 *Attributes
|
IN UINT64 *Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
gEfiSmmCpuProtocolGuid ## PRODUCES
|
gEfiSmmCpuProtocolGuid ## PRODUCES
|
||||||
gEfiSmmReadyToLockProtocolGuid ## NOTIFY
|
gEfiSmmReadyToLockProtocolGuid ## NOTIFY
|
||||||
gEfiSmmCpuServiceProtocolGuid ## PRODUCES
|
gEfiSmmCpuServiceProtocolGuid ## PRODUCES
|
||||||
gEdkiiSmmMemoryAttributeProtocolGuid ## PRODUCES
|
gEdkiiSmmMemoryAttributeProtocolGuid ## PRODUCES
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## HOB # it is used for S3 boot.
|
gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## HOB # it is used for S3 boot.
|
||||||
@ -161,7 +161,7 @@
|
|||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ## CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
|
gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask ## CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
gEfiMpServiceProtocolGuid
|
gEfiMpServiceProtocolGuid
|
||||||
|
@ -1120,166 +1120,166 @@ IsSmmCommBufferForbiddenAddress (
|
|||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function set given attributes of the memory region specified by
|
This function set given attributes of the memory region specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
||||||
@param BaseAddress The physical address that is the start address of
|
@param BaseAddress The physical address that is the start address of
|
||||||
a memory region.
|
a memory region.
|
||||||
@param Length The size in bytes of the memory region.
|
@param Length The size in bytes of the memory region.
|
||||||
@param Attributes The bit mask of attributes to set for the memory
|
@param Attributes The bit mask of attributes to set for the memory
|
||||||
region.
|
region.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The attributes were set for the memory region.
|
@retval EFI_SUCCESS The attributes were set for the memory region.
|
||||||
@retval EFI_INVALID_PARAMETER Length is zero.
|
@retval EFI_INVALID_PARAMETER Length is zero.
|
||||||
Attributes specified an illegal combination of
|
Attributes specified an illegal combination of
|
||||||
attributes that cannot be set together.
|
attributes that cannot be set together.
|
||||||
@retval EFI_UNSUPPORTED The processor does not support one or more
|
@retval EFI_UNSUPPORTED The processor does not support one or more
|
||||||
bytes of the memory resource range specified
|
bytes of the memory resource range specified
|
||||||
by BaseAddress and Length.
|
by BaseAddress and Length.
|
||||||
The bit mask of attributes is not support for
|
The bit mask of attributes is not support for
|
||||||
the memory resource range specified by
|
the memory resource range specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EdkiiSmmSetMemoryAttributes (
|
EdkiiSmmSetMemoryAttributes (
|
||||||
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
||||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||||
IN UINT64 Length,
|
IN UINT64 Length,
|
||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return SmmSetMemoryAttributes (BaseAddress, Length, Attributes);
|
return SmmSetMemoryAttributes (BaseAddress, Length, Attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function clears given attributes of the memory region specified by
|
This function clears given attributes of the memory region specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
||||||
@param BaseAddress The physical address that is the start address of
|
@param BaseAddress The physical address that is the start address of
|
||||||
a memory region.
|
a memory region.
|
||||||
@param Length The size in bytes of the memory region.
|
@param Length The size in bytes of the memory region.
|
||||||
@param Attributes The bit mask of attributes to set for the memory
|
@param Attributes The bit mask of attributes to set for the memory
|
||||||
region.
|
region.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The attributes were set for the memory region.
|
@retval EFI_SUCCESS The attributes were set for the memory region.
|
||||||
@retval EFI_INVALID_PARAMETER Length is zero.
|
@retval EFI_INVALID_PARAMETER Length is zero.
|
||||||
Attributes specified an illegal combination of
|
Attributes specified an illegal combination of
|
||||||
attributes that cannot be set together.
|
attributes that cannot be set together.
|
||||||
@retval EFI_UNSUPPORTED The processor does not support one or more
|
@retval EFI_UNSUPPORTED The processor does not support one or more
|
||||||
bytes of the memory resource range specified
|
bytes of the memory resource range specified
|
||||||
by BaseAddress and Length.
|
by BaseAddress and Length.
|
||||||
The bit mask of attributes is not support for
|
The bit mask of attributes is not support for
|
||||||
the memory resource range specified by
|
the memory resource range specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EdkiiSmmClearMemoryAttributes (
|
EdkiiSmmClearMemoryAttributes (
|
||||||
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
||||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||||
IN UINT64 Length,
|
IN UINT64 Length,
|
||||||
IN UINT64 Attributes
|
IN UINT64 Attributes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return SmmClearMemoryAttributes (BaseAddress, Length, Attributes);
|
return SmmClearMemoryAttributes (BaseAddress, Length, Attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function retrieve the attributes of the memory region specified by
|
This function retrieve the attributes of the memory region specified by
|
||||||
BaseAddress and Length. If different attributes are got from different part
|
BaseAddress and Length. If different attributes are got from different part
|
||||||
of the memory region, EFI_NO_MAPPING will be returned.
|
of the memory region, EFI_NO_MAPPING will be returned.
|
||||||
|
|
||||||
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
@param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance.
|
||||||
@param BaseAddress The physical address that is the start address of
|
@param BaseAddress The physical address that is the start address of
|
||||||
a memory region.
|
a memory region.
|
||||||
@param Length The size in bytes of the memory region.
|
@param Length The size in bytes of the memory region.
|
||||||
@param Attributes Pointer to attributes returned.
|
@param Attributes Pointer to attributes returned.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The attributes got for the memory region.
|
@retval EFI_SUCCESS The attributes got for the memory region.
|
||||||
@retval EFI_INVALID_PARAMETER Length is zero.
|
@retval EFI_INVALID_PARAMETER Length is zero.
|
||||||
Attributes is NULL.
|
Attributes is NULL.
|
||||||
@retval EFI_NO_MAPPING Attributes are not consistent cross the memory
|
@retval EFI_NO_MAPPING Attributes are not consistent cross the memory
|
||||||
region.
|
region.
|
||||||
@retval EFI_UNSUPPORTED The processor does not support one or more
|
@retval EFI_UNSUPPORTED The processor does not support one or more
|
||||||
bytes of the memory resource range specified
|
bytes of the memory resource range specified
|
||||||
by BaseAddress and Length.
|
by BaseAddress and Length.
|
||||||
The bit mask of attributes is not support for
|
The bit mask of attributes is not support for
|
||||||
the memory resource range specified by
|
the memory resource range specified by
|
||||||
BaseAddress and Length.
|
BaseAddress and Length.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EdkiiSmmGetMemoryAttributes (
|
EdkiiSmmGetMemoryAttributes (
|
||||||
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This,
|
||||||
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
||||||
IN UINT64 Length,
|
IN UINT64 Length,
|
||||||
OUT UINT64 *Attributes
|
OUT UINT64 *Attributes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PHYSICAL_ADDRESS Address;
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
UINT64 *PageEntry;
|
UINT64 *PageEntry;
|
||||||
UINT64 MemAttr;
|
UINT64 MemAttr;
|
||||||
PAGE_ATTRIBUTE PageAttr;
|
PAGE_ATTRIBUTE PageAttr;
|
||||||
INT64 Size;
|
INT64 Size;
|
||||||
|
|
||||||
if (Length < SIZE_4KB || Attributes == NULL) {
|
if (Length < SIZE_4KB || Attributes == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size = (INT64)Length;
|
Size = (INT64)Length;
|
||||||
MemAttr = (UINT64)-1;
|
MemAttr = (UINT64)-1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
PageEntry = GetPageTableEntry (BaseAddress, &PageAttr);
|
PageEntry = GetPageTableEntry (BaseAddress, &PageAttr);
|
||||||
if (PageEntry == NULL || PageAttr == PageNone) {
|
if (PageEntry == NULL || PageAttr == PageNone) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the memory range is cross page table boundary, make sure they
|
// If the memory range is cross page table boundary, make sure they
|
||||||
// share the same attribute. Return EFI_NO_MAPPING if not.
|
// share the same attribute. Return EFI_NO_MAPPING if not.
|
||||||
//
|
//
|
||||||
*Attributes = GetAttributesFromPageEntry (PageEntry);
|
*Attributes = GetAttributesFromPageEntry (PageEntry);
|
||||||
if (MemAttr != (UINT64)-1 && *Attributes != MemAttr) {
|
if (MemAttr != (UINT64)-1 && *Attributes != MemAttr) {
|
||||||
return EFI_NO_MAPPING;
|
return EFI_NO_MAPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (PageAttr) {
|
switch (PageAttr) {
|
||||||
case Page4K:
|
case Page4K:
|
||||||
Address = *PageEntry & ~mAddressEncMask & PAGING_4K_ADDRESS_MASK_64;
|
Address = *PageEntry & ~mAddressEncMask & PAGING_4K_ADDRESS_MASK_64;
|
||||||
Size -= (SIZE_4KB - (BaseAddress - Address));
|
Size -= (SIZE_4KB - (BaseAddress - Address));
|
||||||
BaseAddress += (SIZE_4KB - (BaseAddress - Address));
|
BaseAddress += (SIZE_4KB - (BaseAddress - Address));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Page2M:
|
case Page2M:
|
||||||
Address = *PageEntry & ~mAddressEncMask & PAGING_2M_ADDRESS_MASK_64;
|
Address = *PageEntry & ~mAddressEncMask & PAGING_2M_ADDRESS_MASK_64;
|
||||||
Size -= SIZE_2MB - (BaseAddress - Address);
|
Size -= SIZE_2MB - (BaseAddress - Address);
|
||||||
BaseAddress += SIZE_2MB - (BaseAddress - Address);
|
BaseAddress += SIZE_2MB - (BaseAddress - Address);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Page1G:
|
case Page1G:
|
||||||
Address = *PageEntry & ~mAddressEncMask & PAGING_1G_ADDRESS_MASK_64;
|
Address = *PageEntry & ~mAddressEncMask & PAGING_1G_ADDRESS_MASK_64;
|
||||||
Size -= SIZE_1GB - (BaseAddress - Address);
|
Size -= SIZE_1GB - (BaseAddress - Address);
|
||||||
BaseAddress += SIZE_1GB - (BaseAddress - Address);
|
BaseAddress += SIZE_1GB - (BaseAddress - Address);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemAttr = *Attributes;
|
MemAttr = *Attributes;
|
||||||
|
|
||||||
} while (Size > 0);
|
} while (Size > 0);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,20 +914,20 @@ SetPageTableAttributes (
|
|||||||
BOOLEAN IsSplitted;
|
BOOLEAN IsSplitted;
|
||||||
BOOLEAN PageTableSplitted;
|
BOOLEAN PageTableSplitted;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Don't do this if
|
// Don't do this if
|
||||||
// - no static page table; or
|
// - no static page table; or
|
||||||
// - SMM heap guard feature enabled
|
// - SMM heap guard feature enabled
|
||||||
// BIT2: SMM page guard enabled
|
// BIT2: SMM page guard enabled
|
||||||
// BIT3: SMM pool guard enabled
|
// BIT3: SMM pool guard enabled
|
||||||
//
|
//
|
||||||
if (!mCpuSmmStaticPageTable ||
|
if (!mCpuSmmStaticPageTable ||
|
||||||
(PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) {
|
(PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) {
|
||||||
//
|
//
|
||||||
// Static paging and heap guard should not be enabled at the same time.
|
// Static paging and heap guard should not be enabled at the same time.
|
||||||
//
|
//
|
||||||
ASSERT (!(mCpuSmmStaticPageTable &&
|
ASSERT (!(mCpuSmmStaticPageTable &&
|
||||||
(PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0));
|
(PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0));
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user