The internal header file includes the common header files, defines\r
internal structure and functions used by SmmCore module.\r
\r
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials are licensed and made available \r
under the terms and conditions of the BSD License which accompanies this \r
distribution. The full text of the license may be found at \r
#include <Guid/Apriori.h>\r
#include <Guid/EventGroup.h>\r
#include <Guid/EventLegacyBios.h>\r
-#include <Guid/ZeroGuid.h>\r
#include <Guid/MemoryProfile.h>\r
\r
#include <Library/BaseLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/PeCoffLib.h>\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
#include <Library/CacheMaintenanceLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/ReportStatusCodeLib.h>\r
// Image Page Number\r
//\r
UINTN NumberOfPage;\r
+ EFI_HANDLE SmmImageHandle;\r
+ EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;\r
} EFI_SMM_DRIVER_ENTRY;\r
\r
#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')\r
OUT VOID **Interface\r
);\r
\r
+/**\r
+ Function returns an array of handles that support the requested protocol\r
+ in a buffer allocated from pool. This is a version of SmmLocateHandle()\r
+ that allocates a buffer for the caller.\r
+\r
+ @param SearchType Specifies which handle(s) are to be returned.\r
+ @param Protocol Provides the protocol to search by. This\r
+ parameter is only valid for SearchType\r
+ ByProtocol.\r
+ @param SearchKey Supplies the search key depending on the\r
+ SearchType.\r
+ @param NumberHandles The number of handles returned in Buffer.\r
+ @param Buffer A pointer to the buffer to return the requested\r
+ array of handles that support Protocol.\r
+\r
+ @retval EFI_SUCCESS The result array of handles was returned.\r
+ @retval EFI_NOT_FOUND No handles match the search.\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
+ matching results.\r
+ @retval EFI_INVALID_PARAMETER One or more paramters are not valid.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmLocateHandleBuffer (\r
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
+ IN EFI_GUID *Protocol OPTIONAL,\r
+ IN VOID *SearchKey OPTIONAL,\r
+ IN OUT UINTN *NumberHandles,\r
+ OUT EFI_HANDLE **Buffer\r
+ );\r
+\r
/**\r
Manage SMI of a particular type.\r
\r
VOID\r
);\r
\r
+/**\r
+ Install SMRAM profile protocol.\r
+\r
+**/\r
+VOID\r
+SmramProfileInstallProtocol (\r
+ VOID\r
+ );\r
+\r
/**\r
Register SMM image to SMRAM profile.\r
\r
@param DriverEntry SMM image info.\r
@param RegisterToDxe Register image to DXE.\r
\r
- @retval TRUE Register success.\r
- @retval FALSE Register fail.\r
+ @return EFI_SUCCESS Register successfully.\r
+ @return EFI_UNSUPPORTED Memory profile unsupported,\r
+ or memory profile for the image is not required.\r
+ @return EFI_OUT_OF_RESOURCES No enough resource for this register.\r
\r
**/\r
-BOOLEAN\r
+EFI_STATUS\r
RegisterSmramProfileImage (\r
IN EFI_SMM_DRIVER_ENTRY *DriverEntry,\r
IN BOOLEAN RegisterToDxe\r
@param DriverEntry SMM image info.\r
@param UnregisterToDxe Unregister image from DXE.\r
\r
- @retval TRUE Unregister success.\r
- @retval FALSE Unregister fail.\r
+ @return EFI_SUCCESS Unregister successfully.\r
+ @return EFI_UNSUPPORTED Memory profile unsupported,\r
+ or memory profile for the image is not required.\r
+ @return EFI_NOT_FOUND The image is not found.\r
\r
**/\r
-BOOLEAN\r
+EFI_STATUS\r
UnregisterSmramProfileImage (\r
IN EFI_SMM_DRIVER_ENTRY *DriverEntry,\r
IN BOOLEAN UnregisterToDxe\r
@param CallerAddress Address of caller who call Allocate or Free.\r
@param Action This Allocate or Free action.\r
@param MemoryType Memory type.\r
+ EfiMaxMemoryType means the MemoryType is unknown.\r
@param Size Buffer size.\r
@param Buffer Buffer address.\r
-\r
- @retval TRUE Profile udpate success.\r
- @retval FALSE Profile update fail.\r
+ @param ActionString String for memory profile action.\r
+ Only needed for user defined allocate action.\r
+\r
+ @return EFI_SUCCESS Memory profile is updated.\r
+ @return EFI_UNSUPPORTED Memory profile is unsupported,\r
+ or memory profile for the image is not required,\r
+ or memory profile for the memory type is not required.\r
+ @return EFI_ACCESS_DENIED It is during memory profile data getting.\r
+ @return EFI_ABORTED Memory profile recording is not enabled.\r
+ @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.\r
+ @return EFI_NOT_FOUND No matched allocate info found for free action.\r
\r
**/\r
-BOOLEAN\r
+EFI_STATUS\r
+EFIAPI\r
SmmCoreUpdateProfile (\r
- IN EFI_PHYSICAL_ADDRESS CallerAddress,\r
- IN MEMORY_PROFILE_ACTION Action,\r
- IN EFI_MEMORY_TYPE MemoryType, // Valid for AllocatePages/AllocatePool\r
- IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool\r
- IN VOID *Buffer\r
+ IN PHYSICAL_ADDRESS CallerAddress,\r
+ IN MEMORY_PROFILE_ACTION Action,\r
+ IN EFI_MEMORY_TYPE MemoryType, // Valid for AllocatePages/AllocatePool\r
+ IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool\r
+ IN VOID *Buffer,\r
+ IN CHAR8 *ActionString OPTIONAL\r
);\r
\r
/**\r
VOID\r
);\r
\r
+/**\r
+ Initialize MemoryAttributes support.\r
+**/\r
+VOID\r
+EFIAPI\r
+SmmCoreInitializeMemoryAttributesTable (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ This function returns a copy of the current memory map. The map is an array of\r
+ memory descriptors, each of which describes a contiguous block of memory.\r
+\r
+ @param[in, out] MemoryMapSize A pointer to the size, in bytes, of the\r
+ MemoryMap buffer. On input, this is the size of\r
+ the buffer allocated by the caller. On output,\r
+ it is the size of the buffer returned by the\r
+ firmware if the buffer was large enough, or the\r
+ size of the buffer needed to contain the map if\r
+ the buffer was too small.\r
+ @param[in, out] MemoryMap A pointer to the buffer in which firmware places\r
+ the current memory map.\r
+ @param[out] MapKey A pointer to the location in which firmware\r
+ returns the key for the current memory map.\r
+ @param[out] DescriptorSize A pointer to the location in which firmware\r
+ returns the size, in bytes, of an individual\r
+ EFI_MEMORY_DESCRIPTOR.\r
+ @param[out] DescriptorVersion A pointer to the location in which firmware\r
+ returns the version number associated with the\r
+ EFI_MEMORY_DESCRIPTOR.\r
+\r
+ @retval EFI_SUCCESS The memory map was returned in the MemoryMap\r
+ buffer.\r
+ @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current\r
+ buffer size needed to hold the memory map is\r
+ returned in MemoryMapSize.\r
+ @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SmmCoreGetMemoryMap (\r
+ IN OUT UINTN *MemoryMapSize,\r
+ IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
+ OUT UINTN *MapKey,\r
+ OUT UINTN *DescriptorSize,\r
+ OUT UINT32 *DescriptorVersion\r
+ );\r
+\r
+///\r
+/// For generic EFI machines make the default allocations 4K aligned\r
+///\r
+#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)\r
+#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)\r
+\r
extern UINTN mFullSmramRangeCount;\r
extern EFI_SMRAM_DESCRIPTOR *mFullSmramRanges;\r
\r
+extern EFI_SMM_DRIVER_ENTRY *mSmmCoreDriverEntry;\r
+\r
extern EFI_LOADED_IMAGE_PROTOCOL *mSmmCoreLoadedImage;\r
\r
//\r