]>
Commit | Line | Data |
---|---|---|
6b46d772 SV |
1 | /** @file\r |
2 | The internal header file includes the common header files, defines\r | |
3 | internal structure and functions used by MmCore module.\r | |
4 | \r | |
5 | Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
6 | Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>\r | |
7 | \r | |
8 | This program and the accompanying materials are licensed and made available\r | |
9 | under the terms and conditions of the BSD License which accompanies this\r | |
10 | 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 _MM_CORE_H_\r | |
19 | #define _MM_CORE_H_\r | |
20 | \r | |
21 | #include <PiMm.h>\r | |
22 | #include <StandaloneMm.h>\r | |
23 | \r | |
24 | #include <Protocol/DxeMmReadyToLock.h>\r | |
25 | #include <Protocol/MmReadyToLock.h>\r | |
26 | #include <Protocol/MmEndOfDxe.h>\r | |
27 | #include <Protocol/MmCommunication.h>\r | |
28 | #include <Protocol/LoadedImage.h>\r | |
29 | #include <Protocol/MmConfiguration.h>\r | |
30 | \r | |
31 | #include <Guid/Apriori.h>\r | |
32 | #include <Guid/EventGroup.h>\r | |
33 | #include <Guid/EventLegacyBios.h>\r | |
34 | #include <Guid/ZeroGuid.h>\r | |
35 | #include <Guid/MemoryProfile.h>\r | |
36 | #include <Guid/HobList.h>\r | |
37 | #include <Guid/MmFvDispatch.h>\r | |
38 | #include <Guid/MmramMemoryReserve.h>\r | |
39 | \r | |
40 | #include <Library/StandaloneMmCoreEntryPoint.h>\r | |
41 | #include <Library/BaseLib.h>\r | |
42 | #include <Library/BaseMemoryLib.h>\r | |
43 | #include <Library/PeCoffLib.h>\r | |
44 | #include <Library/CacheMaintenanceLib.h>\r | |
45 | #include <Library/DebugLib.h>\r | |
46 | #include <Library/ReportStatusCodeLib.h>\r | |
47 | #include <Library/MemoryAllocationLib.h>\r | |
48 | #include <Library/PcdLib.h>\r | |
49 | \r | |
50 | #include <Library/StandaloneMmMemLib.h>\r | |
51 | #include <Library/HobLib.h>\r | |
52 | \r | |
53 | #include "StandaloneMmCorePrivateData.h"\r | |
54 | \r | |
55 | //\r | |
56 | // Used to build a table of MMI Handlers that the MM Core registers\r | |
57 | //\r | |
58 | typedef struct {\r | |
59 | EFI_MM_HANDLER_ENTRY_POINT Handler;\r | |
60 | EFI_GUID *HandlerType;\r | |
61 | EFI_HANDLE DispatchHandle;\r | |
62 | BOOLEAN UnRegister;\r | |
63 | } MM_CORE_MMI_HANDLERS;\r | |
64 | \r | |
65 | //\r | |
66 | // Structure for recording the state of an MM Driver\r | |
67 | //\r | |
68 | #define EFI_MM_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('s', 'd','r','v')\r | |
69 | \r | |
70 | typedef struct {\r | |
71 | UINTN Signature;\r | |
72 | LIST_ENTRY Link; // mDriverList\r | |
73 | \r | |
74 | LIST_ENTRY ScheduledLink; // mScheduledQueue\r | |
75 | \r | |
76 | EFI_HANDLE FvHandle;\r | |
77 | EFI_GUID FileName;\r | |
78 | VOID *Pe32Data;\r | |
79 | UINTN Pe32DataSize;\r | |
80 | \r | |
81 | VOID *Depex;\r | |
82 | UINTN DepexSize;\r | |
83 | \r | |
84 | BOOLEAN Before;\r | |
85 | BOOLEAN After;\r | |
86 | EFI_GUID BeforeAfterGuid;\r | |
87 | \r | |
88 | BOOLEAN Dependent;\r | |
89 | BOOLEAN Scheduled;\r | |
90 | BOOLEAN Initialized;\r | |
91 | BOOLEAN DepexProtocolError;\r | |
92 | \r | |
93 | EFI_HANDLE ImageHandle;\r | |
94 | EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;\r | |
95 | //\r | |
96 | // Image EntryPoint in MMRAM\r | |
97 | //\r | |
98 | PHYSICAL_ADDRESS ImageEntryPoint;\r | |
99 | //\r | |
100 | // Image Buffer in MMRAM\r | |
101 | //\r | |
102 | PHYSICAL_ADDRESS ImageBuffer;\r | |
103 | //\r | |
104 | // Image Page Number\r | |
105 | //\r | |
106 | UINTN NumberOfPage;\r | |
107 | } EFI_MM_DRIVER_ENTRY;\r | |
108 | \r | |
109 | #define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')\r | |
110 | \r | |
111 | ///\r | |
112 | /// IHANDLE - contains a list of protocol handles\r | |
113 | ///\r | |
114 | typedef struct {\r | |
115 | UINTN Signature;\r | |
116 | /// All handles list of IHANDLE\r | |
117 | LIST_ENTRY AllHandles;\r | |
118 | /// List of PROTOCOL_INTERFACE's for this handle\r | |
119 | LIST_ENTRY Protocols;\r | |
120 | UINTN LocateRequest;\r | |
121 | } IHANDLE;\r | |
122 | \r | |
123 | #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)\r | |
124 | \r | |
125 | #define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')\r | |
126 | \r | |
127 | ///\r | |
128 | /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol\r | |
129 | /// database. Each handler that supports this protocol is listed, along\r | |
130 | /// with a list of registered notifies.\r | |
131 | ///\r | |
132 | typedef struct {\r | |
133 | UINTN Signature;\r | |
134 | /// Link Entry inserted to mProtocolDatabase\r | |
135 | LIST_ENTRY AllEntries;\r | |
136 | /// ID of the protocol\r | |
137 | EFI_GUID ProtocolID;\r | |
138 | /// All protocol interfaces\r | |
139 | LIST_ENTRY Protocols;\r | |
140 | /// Registerd notification handlers\r | |
141 | LIST_ENTRY Notify;\r | |
142 | } PROTOCOL_ENTRY;\r | |
143 | \r | |
144 | #define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')\r | |
145 | \r | |
146 | ///\r | |
147 | /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked\r | |
148 | /// with a protocol interface structure\r | |
149 | ///\r | |
150 | typedef struct {\r | |
151 | UINTN Signature;\r | |
152 | /// Link on IHANDLE.Protocols\r | |
153 | LIST_ENTRY Link;\r | |
154 | /// Back pointer\r | |
155 | IHANDLE *Handle;\r | |
156 | /// Link on PROTOCOL_ENTRY.Protocols\r | |
157 | LIST_ENTRY ByProtocol;\r | |
158 | /// The protocol ID\r | |
159 | PROTOCOL_ENTRY *Protocol;\r | |
160 | /// The interface value\r | |
161 | VOID *Interface;\r | |
162 | } PROTOCOL_INTERFACE;\r | |
163 | \r | |
164 | #define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')\r | |
165 | \r | |
166 | ///\r | |
167 | /// PROTOCOL_NOTIFY - used for each register notification for a protocol\r | |
168 | ///\r | |
169 | typedef struct {\r | |
170 | UINTN Signature;\r | |
171 | PROTOCOL_ENTRY *Protocol;\r | |
172 | /// All notifications for this protocol\r | |
173 | LIST_ENTRY Link;\r | |
174 | /// Notification function\r | |
175 | EFI_MM_NOTIFY_FN Function;\r | |
176 | /// Last position notified\r | |
177 | LIST_ENTRY *Position;\r | |
178 | } PROTOCOL_NOTIFY;\r | |
179 | \r | |
180 | //\r | |
181 | // MM Core Global Variables\r | |
182 | //\r | |
183 | extern MM_CORE_PRIVATE_DATA *gMmCorePrivate;\r | |
184 | extern EFI_MM_SYSTEM_TABLE gMmCoreMmst;\r | |
185 | extern LIST_ENTRY gHandleList;\r | |
186 | extern EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressMmramBase;\r | |
187 | \r | |
188 | /**\r | |
189 | Called to initialize the memory service.\r | |
190 | \r | |
191 | @param MmramRangeCount Number of MMRAM Regions\r | |
192 | @param MmramRanges Pointer to MMRAM Descriptors\r | |
193 | \r | |
194 | **/\r | |
195 | VOID\r | |
196 | MmInitializeMemoryServices (\r | |
197 | IN UINTN MmramRangeCount,\r | |
198 | IN EFI_MMRAM_DESCRIPTOR *MmramRanges\r | |
199 | );\r | |
200 | \r | |
201 | /**\r | |
202 | The MmInstallConfigurationTable() function is used to maintain the list\r | |
203 | of configuration tables that are stored in the System Management System\r | |
204 | Table. The list is stored as an array of (GUID, Pointer) pairs. The list\r | |
205 | must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.\r | |
206 | \r | |
207 | @param SystemTable A pointer to the MM System Table (SMST).\r | |
208 | @param Guid A pointer to the GUID for the entry to add, update, or remove.\r | |
209 | @param Table A pointer to the buffer of the table to add.\r | |
210 | @param TableSize The size of the table to install.\r | |
211 | \r | |
212 | @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.\r | |
213 | @retval EFI_INVALID_PARAMETER Guid is not valid.\r | |
214 | @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.\r | |
215 | @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.\r | |
216 | \r | |
217 | **/\r | |
218 | EFI_STATUS\r | |
219 | EFIAPI\r | |
220 | MmInstallConfigurationTable (\r | |
221 | IN CONST EFI_MM_SYSTEM_TABLE *SystemTable,\r | |
222 | IN CONST EFI_GUID *Guid,\r | |
223 | IN VOID *Table,\r | |
224 | IN UINTN TableSize\r | |
225 | );\r | |
226 | \r | |
227 | /**\r | |
228 | Wrapper function to MmInstallProtocolInterfaceNotify. This is the public API which\r | |
229 | Calls the private one which contains a BOOLEAN parameter for notifications\r | |
230 | \r | |
231 | @param UserHandle The handle to install the protocol handler on,\r | |
232 | or NULL if a new handle is to be allocated\r | |
233 | @param Protocol The protocol to add to the handle\r | |
234 | @param InterfaceType Indicates whether Interface is supplied in\r | |
235 | native form.\r | |
236 | @param Interface The interface for the protocol being added\r | |
237 | \r | |
238 | @return Status code\r | |
239 | \r | |
240 | **/\r | |
241 | EFI_STATUS\r | |
242 | EFIAPI\r | |
243 | MmInstallProtocolInterface (\r | |
244 | IN OUT EFI_HANDLE *UserHandle,\r | |
245 | IN EFI_GUID *Protocol,\r | |
246 | IN EFI_INTERFACE_TYPE InterfaceType,\r | |
247 | IN VOID *Interface\r | |
248 | );\r | |
249 | \r | |
250 | /**\r | |
251 | Allocates pages from the memory map.\r | |
252 | \r | |
253 | @param Type The type of allocation to perform\r | |
254 | @param MemoryType The type of memory to turn the allocated pages\r | |
255 | into\r | |
256 | @param NumberOfPages The number of pages to allocate\r | |
257 | @param Memory A pointer to receive the base allocated memory\r | |
258 | address\r | |
259 | \r | |
260 | @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.\r | |
261 | @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r | |
262 | @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r | |
263 | @retval EFI_SUCCESS Pages successfully allocated.\r | |
264 | \r | |
265 | **/\r | |
266 | EFI_STATUS\r | |
267 | EFIAPI\r | |
268 | MmAllocatePages (\r | |
269 | IN EFI_ALLOCATE_TYPE Type,\r | |
270 | IN EFI_MEMORY_TYPE MemoryType,\r | |
271 | IN UINTN NumberOfPages,\r | |
272 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
273 | );\r | |
274 | \r | |
275 | /**\r | |
276 | Allocates pages from the memory map.\r | |
277 | \r | |
278 | @param Type The type of allocation to perform\r | |
279 | @param MemoryType The type of memory to turn the allocated pages\r | |
280 | into\r | |
281 | @param NumberOfPages The number of pages to allocate\r | |
282 | @param Memory A pointer to receive the base allocated memory\r | |
283 | address\r | |
284 | \r | |
285 | @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.\r | |
286 | @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r | |
287 | @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r | |
288 | @retval EFI_SUCCESS Pages successfully allocated.\r | |
289 | \r | |
290 | **/\r | |
291 | EFI_STATUS\r | |
292 | EFIAPI\r | |
293 | MmInternalAllocatePages (\r | |
294 | IN EFI_ALLOCATE_TYPE Type,\r | |
295 | IN EFI_MEMORY_TYPE MemoryType,\r | |
296 | IN UINTN NumberOfPages,\r | |
297 | OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
298 | );\r | |
299 | \r | |
300 | /**\r | |
301 | Frees previous allocated pages.\r | |
302 | \r | |
303 | @param Memory Base address of memory being freed\r | |
304 | @param NumberOfPages The number of pages to free\r | |
305 | \r | |
306 | @retval EFI_NOT_FOUND Could not find the entry that covers the range\r | |
307 | @retval EFI_INVALID_PARAMETER Address not aligned, Address is zero or NumberOfPages is zero.\r | |
308 | @return EFI_SUCCESS Pages successfully freed.\r | |
309 | \r | |
310 | **/\r | |
311 | EFI_STATUS\r | |
312 | EFIAPI\r | |
313 | MmFreePages (\r | |
314 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
315 | IN UINTN NumberOfPages\r | |
316 | );\r | |
317 | \r | |
318 | /**\r | |
319 | Frees previous allocated pages.\r | |
320 | \r | |
321 | @param Memory Base address of memory being freed\r | |
322 | @param NumberOfPages The number of pages to free\r | |
323 | \r | |
324 | @retval EFI_NOT_FOUND Could not find the entry that covers the range\r | |
325 | @retval EFI_INVALID_PARAMETER Address not aligned, Address is zero or NumberOfPages is zero.\r | |
326 | @return EFI_SUCCESS Pages successfully freed.\r | |
327 | \r | |
328 | **/\r | |
329 | EFI_STATUS\r | |
330 | EFIAPI\r | |
331 | MmInternalFreePages (\r | |
332 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
333 | IN UINTN NumberOfPages\r | |
334 | );\r | |
335 | \r | |
336 | /**\r | |
337 | Allocate pool of a particular type.\r | |
338 | \r | |
339 | @param PoolType Type of pool to allocate\r | |
340 | @param Size The amount of pool to allocate\r | |
341 | @param Buffer The address to return a pointer to the allocated\r | |
342 | pool\r | |
343 | \r | |
344 | @retval EFI_INVALID_PARAMETER PoolType not valid\r | |
345 | @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r | |
346 | @retval EFI_SUCCESS Pool successfully allocated.\r | |
347 | \r | |
348 | **/\r | |
349 | EFI_STATUS\r | |
350 | EFIAPI\r | |
351 | MmAllocatePool (\r | |
352 | IN EFI_MEMORY_TYPE PoolType,\r | |
353 | IN UINTN Size,\r | |
354 | OUT VOID **Buffer\r | |
355 | );\r | |
356 | \r | |
357 | /**\r | |
358 | Allocate pool of a particular type.\r | |
359 | \r | |
360 | @param PoolType Type of pool to allocate\r | |
361 | @param Size The amount of pool to allocate\r | |
362 | @param Buffer The address to return a pointer to the allocated\r | |
363 | pool\r | |
364 | \r | |
365 | @retval EFI_INVALID_PARAMETER PoolType not valid\r | |
366 | @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r | |
367 | @retval EFI_SUCCESS Pool successfully allocated.\r | |
368 | \r | |
369 | **/\r | |
370 | EFI_STATUS\r | |
371 | EFIAPI\r | |
372 | MmInternalAllocatePool (\r | |
373 | IN EFI_MEMORY_TYPE PoolType,\r | |
374 | IN UINTN Size,\r | |
375 | OUT VOID **Buffer\r | |
376 | );\r | |
377 | \r | |
378 | /**\r | |
379 | Frees pool.\r | |
380 | \r | |
381 | @param Buffer The allocated pool entry to free\r | |
382 | \r | |
383 | @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r | |
384 | @retval EFI_SUCCESS Pool successfully freed.\r | |
385 | \r | |
386 | **/\r | |
387 | EFI_STATUS\r | |
388 | EFIAPI\r | |
389 | MmFreePool (\r | |
390 | IN VOID *Buffer\r | |
391 | );\r | |
392 | \r | |
393 | /**\r | |
394 | Frees pool.\r | |
395 | \r | |
396 | @param Buffer The allocated pool entry to free\r | |
397 | \r | |
398 | @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r | |
399 | @retval EFI_SUCCESS Pool successfully freed.\r | |
400 | \r | |
401 | **/\r | |
402 | EFI_STATUS\r | |
403 | EFIAPI\r | |
404 | MmInternalFreePool (\r | |
405 | IN VOID *Buffer\r | |
406 | );\r | |
407 | \r | |
408 | /**\r | |
409 | Installs a protocol interface into the boot services environment.\r | |
410 | \r | |
411 | @param UserHandle The handle to install the protocol handler on,\r | |
412 | or NULL if a new handle is to be allocated\r | |
413 | @param Protocol The protocol to add to the handle\r | |
414 | @param InterfaceType Indicates whether Interface is supplied in\r | |
415 | native form.\r | |
416 | @param Interface The interface for the protocol being added\r | |
417 | @param Notify indicates whether notify the notification list\r | |
418 | for this protocol\r | |
419 | \r | |
420 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
421 | @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r | |
422 | @retval EFI_SUCCESS Protocol interface successfully installed\r | |
423 | \r | |
424 | **/\r | |
425 | EFI_STATUS\r | |
426 | MmInstallProtocolInterfaceNotify (\r | |
427 | IN OUT EFI_HANDLE *UserHandle,\r | |
428 | IN EFI_GUID *Protocol,\r | |
429 | IN EFI_INTERFACE_TYPE InterfaceType,\r | |
430 | IN VOID *Interface,\r | |
431 | IN BOOLEAN Notify\r | |
432 | );\r | |
433 | \r | |
434 | /**\r | |
435 | Uninstalls all instances of a protocol:interfacer from a handle.\r | |
436 | If the last protocol interface is remove from the handle, the\r | |
437 | handle is freed.\r | |
438 | \r | |
439 | @param UserHandle The handle to remove the protocol handler from\r | |
440 | @param Protocol The protocol, of protocol:interface, to remove\r | |
441 | @param Interface The interface, of protocol:interface, to remove\r | |
442 | \r | |
443 | @retval EFI_INVALID_PARAMETER Protocol is NULL.\r | |
444 | @retval EFI_SUCCESS Protocol interface successfully uninstalled.\r | |
445 | \r | |
446 | **/\r | |
447 | EFI_STATUS\r | |
448 | EFIAPI\r | |
449 | MmUninstallProtocolInterface (\r | |
450 | IN EFI_HANDLE UserHandle,\r | |
451 | IN EFI_GUID *Protocol,\r | |
452 | IN VOID *Interface\r | |
453 | );\r | |
454 | \r | |
455 | /**\r | |
456 | Queries a handle to determine if it supports a specified protocol.\r | |
457 | \r | |
458 | @param UserHandle The handle being queried.\r | |
459 | @param Protocol The published unique identifier of the protocol.\r | |
460 | @param Interface Supplies the address where a pointer to the\r | |
461 | corresponding Protocol Interface is returned.\r | |
462 | \r | |
463 | @return The requested protocol interface for the handle\r | |
464 | \r | |
465 | **/\r | |
466 | EFI_STATUS\r | |
467 | EFIAPI\r | |
468 | MmHandleProtocol (\r | |
469 | IN EFI_HANDLE UserHandle,\r | |
470 | IN EFI_GUID *Protocol,\r | |
471 | OUT VOID **Interface\r | |
472 | );\r | |
473 | \r | |
474 | /**\r | |
475 | Add a new protocol notification record for the request protocol.\r | |
476 | \r | |
477 | @param Protocol The requested protocol to add the notify\r | |
478 | registration\r | |
479 | @param Function Points to the notification function\r | |
480 | @param Registration Returns the registration record\r | |
481 | \r | |
482 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
483 | @retval EFI_SUCCESS Successfully returned the registration record\r | |
484 | that has been added\r | |
485 | \r | |
486 | **/\r | |
487 | EFI_STATUS\r | |
488 | EFIAPI\r | |
489 | MmRegisterProtocolNotify (\r | |
490 | IN CONST EFI_GUID *Protocol,\r | |
491 | IN EFI_MM_NOTIFY_FN Function,\r | |
492 | OUT VOID **Registration\r | |
493 | );\r | |
494 | \r | |
495 | /**\r | |
496 | Locates the requested handle(s) and returns them in Buffer.\r | |
497 | \r | |
498 | @param SearchType The type of search to perform to locate the\r | |
499 | handles\r | |
500 | @param Protocol The protocol to search for\r | |
501 | @param SearchKey Dependant on SearchType\r | |
502 | @param BufferSize On input the size of Buffer. On output the\r | |
503 | size of data returned.\r | |
504 | @param Buffer The buffer to return the results in\r | |
505 | \r | |
506 | @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is\r | |
507 | returned in BufferSize.\r | |
508 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
509 | @retval EFI_SUCCESS Successfully found the requested handle(s) and\r | |
510 | returns them in Buffer.\r | |
511 | \r | |
512 | **/\r | |
513 | EFI_STATUS\r | |
514 | EFIAPI\r | |
515 | MmLocateHandle (\r | |
516 | IN EFI_LOCATE_SEARCH_TYPE SearchType,\r | |
517 | IN EFI_GUID *Protocol OPTIONAL,\r | |
518 | IN VOID *SearchKey OPTIONAL,\r | |
519 | IN OUT UINTN *BufferSize,\r | |
520 | OUT EFI_HANDLE *Buffer\r | |
521 | );\r | |
522 | \r | |
523 | /**\r | |
524 | Return the first Protocol Interface that matches the Protocol GUID. If\r | |
525 | Registration is pasased in return a Protocol Instance that was just add\r | |
526 | to the system. If Retistration is NULL return the first Protocol Interface\r | |
527 | you find.\r | |
528 | \r | |
529 | @param Protocol The protocol to search for\r | |
530 | @param Registration Optional Registration Key returned from\r | |
531 | RegisterProtocolNotify()\r | |
532 | @param Interface Return the Protocol interface (instance).\r | |
533 | \r | |
534 | @retval EFI_SUCCESS If a valid Interface is returned\r | |
535 | @retval EFI_INVALID_PARAMETER Invalid parameter\r | |
536 | @retval EFI_NOT_FOUND Protocol interface not found\r | |
537 | \r | |
538 | **/\r | |
539 | EFI_STATUS\r | |
540 | EFIAPI\r | |
541 | MmLocateProtocol (\r | |
542 | IN EFI_GUID *Protocol,\r | |
543 | IN VOID *Registration OPTIONAL,\r | |
544 | OUT VOID **Interface\r | |
545 | );\r | |
546 | \r | |
547 | /**\r | |
548 | Manage MMI of a particular type.\r | |
549 | \r | |
550 | @param HandlerType Points to the handler type or NULL for root MMI handlers.\r | |
551 | @param Context Points to an optional context buffer.\r | |
552 | @param CommBuffer Points to the optional communication buffer.\r | |
553 | @param CommBufferSize Points to the size of the optional communication buffer.\r | |
554 | \r | |
555 | @retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.\r | |
556 | @retval EFI_INTERRUPT_PENDING One or more MMI sources could not be quiesced.\r | |
557 | @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.\r | |
558 | @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.\r | |
559 | \r | |
560 | **/\r | |
561 | EFI_STATUS\r | |
562 | EFIAPI\r | |
563 | MmiManage (\r | |
564 | IN CONST EFI_GUID *HandlerType,\r | |
565 | IN CONST VOID *Context OPTIONAL,\r | |
566 | IN OUT VOID *CommBuffer OPTIONAL,\r | |
567 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
568 | );\r | |
569 | \r | |
570 | /**\r | |
571 | Registers a handler to execute within MM.\r | |
572 | \r | |
573 | @param Handler Handler service funtion pointer.\r | |
574 | @param HandlerType Points to the handler type or NULL for root MMI handlers.\r | |
575 | @param DispatchHandle On return, contains a unique handle which can be used to later unregister the handler function.\r | |
576 | \r | |
577 | @retval EFI_SUCCESS Handler register success.\r | |
578 | @retval EFI_INVALID_PARAMETER Handler or DispatchHandle is NULL.\r | |
579 | \r | |
580 | **/\r | |
581 | EFI_STATUS\r | |
582 | EFIAPI\r | |
583 | MmiHandlerRegister (\r | |
584 | IN EFI_MM_HANDLER_ENTRY_POINT Handler,\r | |
585 | IN CONST EFI_GUID *HandlerType OPTIONAL,\r | |
586 | OUT EFI_HANDLE *DispatchHandle\r | |
587 | );\r | |
588 | \r | |
589 | /**\r | |
590 | Unregister a handler in MM.\r | |
591 | \r | |
592 | @param DispatchHandle The handle that was specified when the handler was registered.\r | |
593 | \r | |
594 | @retval EFI_SUCCESS Handler function was successfully unregistered.\r | |
595 | @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.\r | |
596 | \r | |
597 | **/\r | |
598 | EFI_STATUS\r | |
599 | EFIAPI\r | |
600 | MmiHandlerUnRegister (\r | |
601 | IN EFI_HANDLE DispatchHandle\r | |
602 | );\r | |
603 | \r | |
604 | /**\r | |
605 | This function is the main entry point for an MM handler dispatch\r | |
606 | or communicate-based callback.\r | |
607 | \r | |
608 | @param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r | |
609 | @param Context Points to an optional handler context which was specified when the handler was registered.\r | |
610 | @param CommBuffer A pointer to a collection of data in memory that will\r | |
611 | be conveyed from a non-MM environment into an MM environment.\r | |
612 | @param CommBufferSize The size of the CommBuffer.\r | |
613 | \r | |
614 | @return Status Code\r | |
615 | \r | |
616 | **/\r | |
617 | EFI_STATUS\r | |
618 | EFIAPI\r | |
619 | MmDriverDispatchHandler (\r | |
620 | IN EFI_HANDLE DispatchHandle,\r | |
621 | IN CONST VOID *Context, OPTIONAL\r | |
622 | IN OUT VOID *CommBuffer, OPTIONAL\r | |
623 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
624 | );\r | |
625 | \r | |
626 | /**\r | |
627 | This function is the main entry point for an MM handler dispatch\r | |
628 | or communicate-based callback.\r | |
629 | \r | |
630 | @param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r | |
631 | @param Context Points to an optional handler context which was specified when the handler was registered.\r | |
632 | @param CommBuffer A pointer to a collection of data in memory that will\r | |
633 | be conveyed from a non-MM environment into an MM environment.\r | |
634 | @param CommBufferSize The size of the CommBuffer.\r | |
635 | \r | |
636 | @return Status Code\r | |
637 | \r | |
638 | **/\r | |
639 | EFI_STATUS\r | |
640 | EFIAPI\r | |
641 | MmFvDispatchHandler (\r | |
642 | IN EFI_HANDLE DispatchHandle,\r | |
643 | IN CONST VOID *Context, OPTIONAL\r | |
644 | IN OUT VOID *CommBuffer, OPTIONAL\r | |
645 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
646 | );\r | |
647 | \r | |
648 | /**\r | |
649 | This function is the main entry point for an MM handler dispatch\r | |
650 | or communicate-based callback.\r | |
651 | \r | |
652 | @param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r | |
653 | @param Context Points to an optional handler context which was specified when the handler was registered.\r | |
654 | @param CommBuffer A pointer to a collection of data in memory that will\r | |
655 | be conveyed from a non-MM environment into an MM environment.\r | |
656 | @param CommBufferSize The size of the CommBuffer.\r | |
657 | \r | |
658 | @return Status Code\r | |
659 | \r | |
660 | **/\r | |
661 | EFI_STATUS\r | |
662 | EFIAPI\r | |
663 | MmLegacyBootHandler (\r | |
664 | IN EFI_HANDLE DispatchHandle,\r | |
665 | IN CONST VOID *Context, OPTIONAL\r | |
666 | IN OUT VOID *CommBuffer, OPTIONAL\r | |
667 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
668 | );\r | |
669 | \r | |
670 | /**\r | |
671 | This function is the main entry point for an MM handler dispatch\r | |
672 | or communicate-based callback.\r | |
673 | \r | |
674 | @param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r | |
675 | @param Context Points to an optional handler context which was specified when the handler was registered.\r | |
676 | @param CommBuffer A pointer to a collection of data in memory that will\r | |
677 | be conveyed from a non-MM environment into an MM environment.\r | |
678 | @param CommBufferSize The size of the CommBuffer.\r | |
679 | \r | |
680 | @return Status Code\r | |
681 | \r | |
682 | **/\r | |
683 | EFI_STATUS\r | |
684 | EFIAPI\r | |
685 | MmExitBootServiceHandler (\r | |
686 | IN EFI_HANDLE DispatchHandle,\r | |
687 | IN CONST VOID *Context, OPTIONAL\r | |
688 | IN OUT VOID *CommBuffer, OPTIONAL\r | |
689 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
690 | );\r | |
691 | \r | |
692 | /**\r | |
693 | This function is the main entry point for an MM handler dispatch\r | |
694 | or communicate-based callback.\r | |
695 | \r | |
696 | @param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r | |
697 | @param Context Points to an optional handler context which was specified when the handler was registered.\r | |
698 | @param CommBuffer A pointer to a collection of data in memory that will\r | |
699 | be conveyed from a non-MM environment into an MM environment.\r | |
700 | @param CommBufferSize The size of the CommBuffer.\r | |
701 | \r | |
702 | @return Status Code\r | |
703 | \r | |
704 | **/\r | |
705 | EFI_STATUS\r | |
706 | EFIAPI\r | |
707 | MmReadyToBootHandler (\r | |
708 | IN EFI_HANDLE DispatchHandle,\r | |
709 | IN CONST VOID *Context, OPTIONAL\r | |
710 | IN OUT VOID *CommBuffer, OPTIONAL\r | |
711 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
712 | );\r | |
713 | \r | |
714 | /**\r | |
715 | This function is the main entry point for an MM handler dispatch\r | |
716 | or communicate-based callback.\r | |
717 | \r | |
718 | @param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r | |
719 | @param Context Points to an optional handler context which was specified when the handler was registered.\r | |
720 | @param CommBuffer A pointer to a collection of data in memory that will\r | |
721 | be conveyed from a non-MM environment into an MM environment.\r | |
722 | @param CommBufferSize The size of the CommBuffer.\r | |
723 | \r | |
724 | @return Status Code\r | |
725 | \r | |
726 | **/\r | |
727 | EFI_STATUS\r | |
728 | EFIAPI\r | |
729 | MmReadyToLockHandler (\r | |
730 | IN EFI_HANDLE DispatchHandle,\r | |
731 | IN CONST VOID *Context, OPTIONAL\r | |
732 | IN OUT VOID *CommBuffer, OPTIONAL\r | |
733 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
734 | );\r | |
735 | \r | |
736 | /**\r | |
737 | This function is the main entry point for an MM handler dispatch\r | |
738 | or communicate-based callback.\r | |
739 | \r | |
740 | @param DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r | |
741 | @param Context Points to an optional handler context which was specified when the handler was registered.\r | |
742 | @param CommBuffer A pointer to a collection of data in memory that will\r | |
743 | be conveyed from a non-MM environment into an MM environment.\r | |
744 | @param CommBufferSize The size of the CommBuffer.\r | |
745 | \r | |
746 | @return Status Code\r | |
747 | \r | |
748 | **/\r | |
749 | EFI_STATUS\r | |
750 | EFIAPI\r | |
751 | MmEndOfDxeHandler (\r | |
752 | IN EFI_HANDLE DispatchHandle,\r | |
753 | IN CONST VOID *Context, OPTIONAL\r | |
754 | IN OUT VOID *CommBuffer, OPTIONAL\r | |
755 | IN OUT UINTN *CommBufferSize OPTIONAL\r | |
756 | );\r | |
757 | \r | |
758 | /**\r | |
759 | Place holder function until all the MM System Table Service are available.\r | |
760 | \r | |
761 | @param Arg1 Undefined\r | |
762 | @param Arg2 Undefined\r | |
763 | @param Arg3 Undefined\r | |
764 | @param Arg4 Undefined\r | |
765 | @param Arg5 Undefined\r | |
766 | \r | |
767 | @return EFI_NOT_AVAILABLE_YET\r | |
768 | \r | |
769 | **/\r | |
770 | EFI_STATUS\r | |
771 | EFIAPI\r | |
772 | MmEfiNotAvailableYetArg5 (\r | |
773 | UINTN Arg1,\r | |
774 | UINTN Arg2,\r | |
775 | UINTN Arg3,\r | |
776 | UINTN Arg4,\r | |
777 | UINTN Arg5\r | |
778 | );\r | |
779 | \r | |
780 | //\r | |
781 | //Functions used during debug buils\r | |
782 | //\r | |
783 | \r | |
784 | /**\r | |
785 | Traverse the discovered list for any drivers that were discovered but not loaded\r | |
786 | because the dependency expressions evaluated to false.\r | |
787 | \r | |
788 | **/\r | |
789 | VOID\r | |
790 | MmDisplayDiscoveredNotDispatched (\r | |
791 | VOID\r | |
792 | );\r | |
793 | \r | |
794 | /**\r | |
795 | Add free MMRAM region for use by memory service.\r | |
796 | \r | |
797 | @param MemBase Base address of memory region.\r | |
798 | @param MemLength Length of the memory region.\r | |
799 | @param Type Memory type.\r | |
800 | @param Attributes Memory region state.\r | |
801 | \r | |
802 | **/\r | |
803 | VOID\r | |
804 | MmAddMemoryRegion (\r | |
805 | IN EFI_PHYSICAL_ADDRESS MemBase,\r | |
806 | IN UINT64 MemLength,\r | |
807 | IN EFI_MEMORY_TYPE Type,\r | |
808 | IN UINT64 Attributes\r | |
809 | );\r | |
810 | \r | |
811 | /**\r | |
812 | Finds the protocol entry for the requested protocol.\r | |
813 | \r | |
814 | @param Protocol The ID of the protocol\r | |
815 | @param Create Create a new entry if not found\r | |
816 | \r | |
817 | @return Protocol entry\r | |
818 | \r | |
819 | **/\r | |
820 | PROTOCOL_ENTRY *\r | |
821 | MmFindProtocolEntry (\r | |
822 | IN EFI_GUID *Protocol,\r | |
823 | IN BOOLEAN Create\r | |
824 | );\r | |
825 | \r | |
826 | /**\r | |
827 | Signal event for every protocol in protocol entry.\r | |
828 | \r | |
829 | @param Prot Protocol interface\r | |
830 | \r | |
831 | **/\r | |
832 | VOID\r | |
833 | MmNotifyProtocol (\r | |
834 | IN PROTOCOL_INTERFACE *Prot\r | |
835 | );\r | |
836 | \r | |
837 | /**\r | |
838 | Finds the protocol instance for the requested handle and protocol.\r | |
839 | Note: This function doesn't do parameters checking, it's caller's responsibility\r | |
840 | to pass in valid parameters.\r | |
841 | \r | |
842 | @param Handle The handle to search the protocol on\r | |
843 | @param Protocol GUID of the protocol\r | |
844 | @param Interface The interface for the protocol being searched\r | |
845 | \r | |
846 | @return Protocol instance (NULL: Not found)\r | |
847 | \r | |
848 | **/\r | |
849 | PROTOCOL_INTERFACE *\r | |
850 | MmFindProtocolInterface (\r | |
851 | IN IHANDLE *Handle,\r | |
852 | IN EFI_GUID *Protocol,\r | |
853 | IN VOID *Interface\r | |
854 | );\r | |
855 | \r | |
856 | /**\r | |
857 | Removes Protocol from the protocol list (but not the handle list).\r | |
858 | \r | |
859 | @param Handle The handle to remove protocol on.\r | |
860 | @param Protocol GUID of the protocol to be moved\r | |
861 | @param Interface The interface of the protocol\r | |
862 | \r | |
863 | @return Protocol Entry\r | |
864 | \r | |
865 | **/\r | |
866 | PROTOCOL_INTERFACE *\r | |
867 | MmRemoveInterfaceFromProtocol (\r | |
868 | IN IHANDLE *Handle,\r | |
869 | IN EFI_GUID *Protocol,\r | |
870 | IN VOID *Interface\r | |
871 | );\r | |
872 | \r | |
873 | /**\r | |
874 | This is the POSTFIX version of the dependency evaluator. This code does\r | |
875 | not need to handle Before or After, as it is not valid to call this\r | |
876 | routine in this case. POSTFIX means all the math is done on top of the stack.\r | |
877 | \r | |
878 | @param DriverEntry DriverEntry element to update.\r | |
879 | \r | |
880 | @retval TRUE If driver is ready to run.\r | |
881 | @retval FALSE If driver is not ready to run or some fatal error\r | |
882 | was found.\r | |
883 | \r | |
884 | **/\r | |
885 | BOOLEAN\r | |
886 | MmIsSchedulable (\r | |
887 | IN EFI_MM_DRIVER_ENTRY *DriverEntry\r | |
888 | );\r | |
889 | \r | |
890 | /**\r | |
891 | Dump MMRAM information.\r | |
892 | \r | |
893 | **/\r | |
894 | VOID\r | |
895 | DumpMmramInfo (\r | |
896 | VOID\r | |
897 | );\r | |
898 | \r | |
899 | extern UINTN mMmramRangeCount;\r | |
900 | extern EFI_MMRAM_DESCRIPTOR *mMmramRanges;\r | |
901 | extern EFI_SYSTEM_TABLE *mEfiSystemTable;\r | |
902 | \r | |
903 | #endif\r |