]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationServices.h
MdeModulePkg: Enhance the comments for PiSmmCoreMemoryAllocationLib instance.
[mirror_edk2.git] / MdeModulePkg / Library / PiSmmCoreMemoryAllocationLib / PiSmmCoreMemoryAllocationServices.h
CommitLineData
713b7781 1/** @file\r
2 Contains function prototypes for Memory Services in the SMM Core.\r
3\r
4 This header file borrows the PiSmmCore Memory Allocation services as the primitive\r
5 for memory allocation. \r
6\r
842b1242 7 Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 8 This program and the accompanying materials \r
713b7781 9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16**/\r
17\r
18#ifndef _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_\r
19#define _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_\r
20\r
f3b6e048
SZ
21//\r
22// It should be aligned with the definition in PiSmmCore.\r
23//\r
842b1242
JY
24typedef struct {\r
25 UINTN Signature;\r
f3b6e048 26\r
842b1242
JY
27 ///\r
28 /// The ImageHandle passed into the entry point of the SMM IPL. This ImageHandle\r
29 /// is used by the SMM Core to fill in the ParentImageHandle field of the Loaded\r
30 /// Image Protocol for each SMM Driver that is dispatched by the SMM Core.\r
31 ///\r
32 EFI_HANDLE SmmIplImageHandle;\r
f3b6e048 33\r
842b1242
JY
34 ///\r
35 /// The number of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM\r
36 /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.\r
37 ///\r
38 UINTN SmramRangeCount;\r
f3b6e048 39\r
842b1242
JY
40 ///\r
41 /// A table of SMRAM ranges passed from the SMM IPL to the SMM Core. The SMM\r
42 /// Core uses these ranges of SMRAM to initialize the SMM Core memory manager.\r
43 ///\r
44 EFI_SMRAM_DESCRIPTOR *SmramRanges;\r
f3b6e048
SZ
45\r
46 ///\r
47 /// The SMM Foundation Entry Point. The SMM Core fills in this field when the \r
48 /// SMM Core is initialized. The SMM IPL is responsbile for registering this entry \r
49 /// point with the SMM Configuration Protocol. The SMM Configuration Protocol may \r
50 /// not be available at the time the SMM IPL and SMM Core are started, so the SMM IPL\r
51 /// sets up a protocol notification on the SMM Configuration Protocol and registers \r
52 /// the SMM Foundation Entry Point as soon as the SMM Configuration Protocol is \r
53 /// available.\r
54 ///\r
55 EFI_SMM_ENTRY_POINT SmmEntryPoint;\r
56 \r
57 ///\r
58 /// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.\r
59 /// \r
60 BOOLEAN SmmEntryPointRegistered;\r
61\r
62 ///\r
63 /// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.\r
64 /// \r
65 BOOLEAN InSmm;\r
66\r
67 ///\r
68 /// This field is set by the SMM Core then the SMM Core is initialized. This field is\r
69 /// used by the SMM Base 2 Protocol and SMM Communication Protocol implementations in\r
70 /// the SMM IPL. \r
71 ///\r
72 EFI_SMM_SYSTEM_TABLE2 *Smst;\r
73\r
74 ///\r
75 /// This field is used by the SMM Communicatioon Protocol to pass a buffer into \r
76 /// a software SMI handler and for the software SMI handler to pass a buffer back to\r
77 /// the caller of the SMM Communication Protocol. \r
78 ///\r
79 VOID *CommunicationBuffer;\r
80\r
81 ///\r
82 /// This field is used by the SMM Communicatioon Protocol to pass the size of a buffer,\r
83 /// in bytes, into a software SMI handler and for the software SMI handler to pass the \r
84 /// size, in bytes, of a buffer back to the caller of the SMM Communication Protocol.\r
85 ///\r
86 UINTN BufferSize;\r
87\r
88 ///\r
89 /// This field is used by the SMM Communication Protocol to pass the return status from\r
90 /// a software SMI handler back to the caller of the SMM Communication Protocol.\r
91 ///\r
92 EFI_STATUS ReturnStatus;\r
93\r
94 EFI_PHYSICAL_ADDRESS PiSmmCoreImageBase;\r
95 UINT64 PiSmmCoreImageSize;\r
96 EFI_PHYSICAL_ADDRESS PiSmmCoreEntryPoint;\r
97\r
98 UINTN FullSmramRangeCount;\r
99 EFI_SMRAM_DESCRIPTOR *FullSmramRanges;\r
842b1242
JY
100} SMM_CORE_PRIVATE_DATA;\r
101\r
102/**\r
103 Called to initialize the memory service.\r
104\r
105 @param SmramRangeCount Number of SMRAM Regions\r
106 @param SmramRanges Pointer to SMRAM Descriptors\r
107\r
108**/\r
109VOID\r
110SmmInitializeMemoryServices (\r
111 IN UINTN SmramRangeCount,\r
112 IN EFI_SMRAM_DESCRIPTOR *SmramRanges\r
113 );\r
114\r
713b7781 115/**\r
116 Allocates pages from the memory map.\r
117\r
118 @param Type The type of allocation to perform\r
119 @param MemoryType The type of memory to turn the allocated pages\r
120 into\r
121 @param NumberOfPages The number of pages to allocate\r
122 @param Memory A pointer to receive the base allocated memory\r
123 address\r
124\r
125 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.\r
126 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r
127 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r
128 @retval EFI_SUCCESS Pages successfully allocated.\r
129\r
130**/\r
131EFI_STATUS\r
132EFIAPI\r
133SmmAllocatePages (\r
134 IN EFI_ALLOCATE_TYPE Type,\r
135 IN EFI_MEMORY_TYPE MemoryType,\r
136 IN UINTN NumberOfPages,\r
137 OUT EFI_PHYSICAL_ADDRESS *Memory\r
138 );\r
139\r
140/**\r
141 Frees previous allocated pages.\r
142\r
143 @param Memory Base address of memory being freed\r
144 @param NumberOfPages The number of pages to free\r
145\r
146 @retval EFI_NOT_FOUND Could not find the entry that covers the range\r
147 @retval EFI_INVALID_PARAMETER Address not aligned\r
148 @return EFI_SUCCESS Pages successfully freed.\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153SmmFreePages (\r
154 IN EFI_PHYSICAL_ADDRESS Memory,\r
155 IN UINTN NumberOfPages\r
156 );\r
157\r
158/**\r
159 Allocate pool of a particular type.\r
160\r
161 @param PoolType Type of pool to allocate\r
162 @param Size The amount of pool to allocate\r
163 @param Buffer The address to return a pointer to the allocated\r
164 pool\r
165\r
166 @retval EFI_INVALID_PARAMETER PoolType not valid\r
167 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
168 @retval EFI_SUCCESS Pool successfully allocated.\r
169\r
170**/\r
171EFI_STATUS\r
172EFIAPI\r
173SmmAllocatePool (\r
174 IN EFI_MEMORY_TYPE PoolType,\r
175 IN UINTN Size,\r
176 OUT VOID **Buffer\r
177 );\r
178\r
179/**\r
180 Frees pool.\r
181\r
182 @param Buffer The allocated pool entry to free\r
183\r
184 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
185 @retval EFI_SUCCESS Pool successfully freed.\r
186\r
187**/\r
188EFI_STATUS\r
189EFIAPI\r
190SmmFreePool (\r
191 IN VOID *Buffer\r
192 );\r
193\r
194#endif\r