2 Contains function prototypes for Memory Services in the SMM Core.
4 This header file borrows the PiSmmCore Memory Allocation services as the primitive
7 Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #ifndef _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_
13 #define _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_
16 // It should be aligned with the definition in PiSmmCore.
22 /// The ImageHandle passed into the entry point of the SMM IPL. This ImageHandle
23 /// is used by the SMM Core to fill in the ParentImageHandle field of the Loaded
24 /// Image Protocol for each SMM Driver that is dispatched by the SMM Core.
26 EFI_HANDLE SmmIplImageHandle
;
29 /// The number of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM
30 /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.
32 UINTN SmramRangeCount
;
35 /// A table of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM
36 /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.
38 EFI_SMRAM_DESCRIPTOR
*SmramRanges
;
41 /// The SMM Foundation Entry Point. The SMM Core fills in this field when the
42 /// SMM Core is initialized. The SMM IPL is responsbile for registering this entry
43 /// point with the SMM Configuration Protocol. The SMM Configuration Protocol may
44 /// not be available at the time the SMM IPL and SMM Core are started, so the SMM IPL
45 /// sets up a protocol notification on the SMM Configuration Protocol and registers
46 /// the SMM Foundation Entry Point as soon as the SMM Configuration Protocol is
49 EFI_SMM_ENTRY_POINT SmmEntryPoint
;
52 /// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.
54 BOOLEAN SmmEntryPointRegistered
;
57 /// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.
62 /// This field is set by the SMM Core then the SMM Core is initialized. This field is
63 /// used by the SMM Base 2 Protocol and SMM Communication Protocol implementations in
66 EFI_SMM_SYSTEM_TABLE2
*Smst
;
69 /// This field is used by the SMM Communicatioon Protocol to pass a buffer into
70 /// a software SMI handler and for the software SMI handler to pass a buffer back to
71 /// the caller of the SMM Communication Protocol.
73 VOID
*CommunicationBuffer
;
76 /// This field is used by the SMM Communicatioon Protocol to pass the size of a buffer,
77 /// in bytes, into a software SMI handler and for the software SMI handler to pass the
78 /// size, in bytes, of a buffer back to the caller of the SMM Communication Protocol.
83 /// This field is used by the SMM Communication Protocol to pass the return status from
84 /// a software SMI handler back to the caller of the SMM Communication Protocol.
86 EFI_STATUS ReturnStatus
;
88 EFI_PHYSICAL_ADDRESS PiSmmCoreImageBase
;
89 UINT64 PiSmmCoreImageSize
;
90 EFI_PHYSICAL_ADDRESS PiSmmCoreEntryPoint
;
91 } SMM_CORE_PRIVATE_DATA
;
94 Called to initialize the memory service.
96 @param SmramRangeCount Number of SMRAM Regions
97 @param SmramRanges Pointer to SMRAM Descriptors
101 SmmInitializeMemoryServices (
102 IN UINTN SmramRangeCount
,
103 IN EFI_SMRAM_DESCRIPTOR
*SmramRanges
107 Allocates pages from the memory map.
109 @param Type The type of allocation to perform
110 @param MemoryType The type of memory to turn the allocated pages
112 @param NumberOfPages The number of pages to allocate
113 @param Memory A pointer to receive the base allocated memory
116 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.
117 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
118 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
119 @retval EFI_SUCCESS Pages successfully allocated.
125 IN EFI_ALLOCATE_TYPE Type
,
126 IN EFI_MEMORY_TYPE MemoryType
,
127 IN UINTN NumberOfPages
,
128 OUT EFI_PHYSICAL_ADDRESS
*Memory
132 Frees previous allocated pages.
134 @param Memory Base address of memory being freed
135 @param NumberOfPages The number of pages to free
137 @retval EFI_NOT_FOUND Could not find the entry that covers the range
138 @retval EFI_INVALID_PARAMETER Address not aligned
139 @return EFI_SUCCESS Pages successfully freed.
145 IN EFI_PHYSICAL_ADDRESS Memory
,
146 IN UINTN NumberOfPages
150 Allocate pool of a particular type.
152 @param PoolType Type of pool to allocate
153 @param Size The amount of pool to allocate
154 @param Buffer The address to return a pointer to the allocated
157 @retval EFI_INVALID_PARAMETER PoolType not valid
158 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
159 @retval EFI_SUCCESS Pool successfully allocated.
165 IN EFI_MEMORY_TYPE PoolType
,
173 @param Buffer The allocated pool entry to free
175 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
176 @retval EFI_SUCCESS Pool successfully freed.