]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
Fix non-boolean comparison expression.
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / PiSmmCore.h
CommitLineData
e42e9404 1/** @file\r
2 The internal header file includes the common header files, defines\r
3 internal structure and functions used by SmmCore module.\r
4\r
5 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
6 This program and the accompanying materials are licensed and made available \r
7 under the terms and conditions of the BSD License which accompanies this \r
8 distribution. The full text of the license may be found at \r
9 http://opensource.org/licenses/bsd-license.php \r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
14**/\r
15\r
16#ifndef _SMM_CORE_H_\r
17#define _SMM_CORE_H_\r
18\r
19#include <PiSmm.h>\r
20\r
21#include <Protocol/DxeSmmReadyToLock.h>\r
22#include <Protocol/SmmReadyToLock.h>\r
23#include <Protocol/CpuIo2.h>\r
24#include <Protocol/SmmCommunication.h>\r
25#include <Protocol/SmmAccess2.h>\r
26#include <Protocol/FirmwareVolume2.h> \r
27#include <Protocol/LoadedImage.h> \r
28#include <Protocol/DevicePath.h> \r
29#include <Protocol/Security.h> \r
30\r
31#include <Guid/Apriori.h>\r
32#include <Guid/EventGroup.h>\r
33#include <Guid/EventLegacyBios.h>\r
34\r
35#include <Library/BaseLib.h>\r
36#include <Library/BaseMemoryLib.h>\r
37#include <Library/PeCoffLib.h>\r
38#include <Library/CacheMaintenanceLib.h>\r
39#include <Library/DebugLib.h>\r
40#include <Library/ReportStatusCodeLib.h>\r
41#include <Library/MemoryAllocationLib.h>\r
42#include <Library/DevicePathLib.h> \r
43#include <Library/UefiLib.h> \r
44#include <Library/UefiBootServicesTableLib.h> \r
45\r
46#include "PiSmmCorePrivateData.h"\r
47\r
48//\r
49// Used to build a table of SMI Handlers that the SMM Core registers\r
50//\r
51typedef struct {\r
52 EFI_SMM_HANDLER_ENTRY_POINT2 Handler;\r
53 EFI_GUID *HandlerType;\r
54 EFI_HANDLE DispatchHandle;\r
55 BOOLEAN UnRegister;\r
56} SMM_CORE_SMI_HANDLERS;\r
57\r
58//\r
59// Structure for recording the state of an SMM Driver\r
60//\r
61#define EFI_SMM_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('s', 'd','r','v')\r
62\r
63typedef struct {\r
64 UINTN Signature;\r
65 LIST_ENTRY Link; // mDriverList\r
66\r
67 LIST_ENTRY ScheduledLink; // mScheduledQueue\r
68\r
69 EFI_HANDLE FvHandle;\r
70 EFI_GUID FileName;\r
71 EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;\r
72 EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
73\r
74 VOID *Depex;\r
75 UINTN DepexSize;\r
76\r
77 BOOLEAN Before;\r
78 BOOLEAN After;\r
79 EFI_GUID BeforeAfterGuid;\r
80\r
81 BOOLEAN Dependent;\r
82 BOOLEAN Unrequested;\r
83 BOOLEAN Scheduled;\r
84 BOOLEAN Untrusted;\r
85 BOOLEAN Initialized;\r
86 BOOLEAN DepexProtocolError;\r
87\r
88 EFI_HANDLE ImageHandle;\r
89 EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;\r
90 //\r
91 // Image EntryPoint in SMRAM\r
92 //\r
93 PHYSICAL_ADDRESS ImageEntryPoint;\r
94 //\r
95 // Image Buffer in SMRAM \r
96 //\r
97 PHYSICAL_ADDRESS ImageBuffer;\r
98 //\r
99 // Image Page Number\r
100 //\r
101 UINTN NumberOfPage;\r
102} EFI_SMM_DRIVER_ENTRY;\r
103\r
104#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')\r
105\r
106///\r
107/// IHANDLE - contains a list of protocol handles\r
108///\r
109typedef struct {\r
110 UINTN Signature;\r
111 /// All handles list of IHANDLE\r
112 LIST_ENTRY AllHandles;\r
113 /// List of PROTOCOL_INTERFACE's for this handle\r
114 LIST_ENTRY Protocols;\r
115 UINTN LocateRequest;\r
116} IHANDLE;\r
117\r
118#define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)\r
119\r
120#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')\r
121\r
122///\r
123/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol\r
124/// database. Each handler that supports this protocol is listed, along\r
125/// with a list of registered notifies.\r
126///\r
127typedef struct {\r
128 UINTN Signature;\r
129 /// Link Entry inserted to mProtocolDatabase\r
130 LIST_ENTRY AllEntries;\r
131 /// ID of the protocol\r
132 EFI_GUID ProtocolID;\r
133 /// All protocol interfaces\r
134 LIST_ENTRY Protocols;\r
135 /// Registerd notification handlers\r
136 LIST_ENTRY Notify;\r
137} PROTOCOL_ENTRY;\r
138\r
139#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')\r
140\r
141///\r
142/// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked\r
143/// with a protocol interface structure\r
144///\r
145typedef struct {\r
146 UINTN Signature;\r
147 /// Link on IHANDLE.Protocols\r
148 LIST_ENTRY Link;\r
149 /// Back pointer\r
150 IHANDLE *Handle;\r
151 /// Link on PROTOCOL_ENTRY.Protocols\r
152 LIST_ENTRY ByProtocol;\r
153 /// The protocol ID\r
154 PROTOCOL_ENTRY *Protocol;\r
155 /// The interface value\r
156 VOID *Interface;\r
157} PROTOCOL_INTERFACE;\r
158\r
159#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')\r
160\r
161///\r
162/// PROTOCOL_NOTIFY - used for each register notification for a protocol\r
163///\r
164typedef struct {\r
165 UINTN Signature;\r
166 PROTOCOL_ENTRY *Protocol;\r
167 /// All notifications for this protocol\r
168 LIST_ENTRY Link;\r
169 /// Notification function\r
170 EFI_SMM_NOTIFY_FN Function;\r
171 /// Last position notified\r
172 LIST_ENTRY *Position;\r
173} PROTOCOL_NOTIFY;\r
174\r
175//\r
176// SMM Core Global Variables\r
177//\r
178extern SMM_CORE_PRIVATE_DATA *gSmmCorePrivate;\r
179extern EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst;\r
180extern LIST_ENTRY gHandleList;\r
181\r
182/**\r
183 Called to initialize the memory service.\r
184\r
185 @param SmramRangeCount Number of SMRAM Regions\r
186 @param SmramRanges Pointer to SMRAM Descriptors\r
187\r
188**/\r
189VOID\r
190SmmInitializeMemoryServices (\r
191 IN UINTN SmramRangeCount,\r
192 IN EFI_SMRAM_DESCRIPTOR *SmramRanges\r
193 );\r
194\r
195/**\r
196 The SmmInstallConfigurationTable() function is used to maintain the list\r
197 of configuration tables that are stored in the System Management System\r
198 Table. The list is stored as an array of (GUID, Pointer) pairs. The list\r
199 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.\r
200\r
201 @param SystemTable A pointer to the SMM System Table (SMST).\r
202 @param Guid A pointer to the GUID for the entry to add, update, or remove.\r
203 @param Table A pointer to the buffer of the table to add.\r
204 @param TableSize The size of the table to install.\r
205\r
206 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.\r
207 @retval EFI_INVALID_PARAMETER Guid is not valid.\r
208 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.\r
209 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.\r
210\r
211**/\r
212EFI_STATUS\r
213EFIAPI\r
214SmmInstallConfigurationTable (\r
215 IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable,\r
216 IN CONST EFI_GUID *Guid,\r
217 IN VOID *Table,\r
218 IN UINTN TableSize\r
219 );\r
220\r
221/**\r
222 Wrapper function to SmmInstallProtocolInterfaceNotify. This is the public API which\r
223 Calls the private one which contains a BOOLEAN parameter for notifications\r
224\r
225 @param UserHandle The handle to install the protocol handler on,\r
226 or NULL if a new handle is to be allocated\r
227 @param Protocol The protocol to add to the handle\r
228 @param InterfaceType Indicates whether Interface is supplied in\r
229 native form.\r
230 @param Interface The interface for the protocol being added\r
231\r
232 @return Status code\r
233\r
234**/\r
235EFI_STATUS\r
236EFIAPI\r
237SmmInstallProtocolInterface (\r
238 IN OUT EFI_HANDLE *UserHandle,\r
239 IN EFI_GUID *Protocol,\r
240 IN EFI_INTERFACE_TYPE InterfaceType,\r
241 IN VOID *Interface\r
242 );\r
243\r
244/**\r
245 Allocates pages from the memory map.\r
246\r
247 @param Type The type of allocation to perform\r
248 @param MemoryType The type of memory to turn the allocated pages\r
249 into\r
250 @param NumberOfPages The number of pages to allocate\r
251 @param Memory A pointer to receive the base allocated memory\r
252 address\r
253\r
254 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.\r
255 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r
256 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r
257 @retval EFI_SUCCESS Pages successfully allocated.\r
258\r
259**/\r
260EFI_STATUS\r
261EFIAPI\r
262SmmAllocatePages (\r
263 IN EFI_ALLOCATE_TYPE Type,\r
264 IN EFI_MEMORY_TYPE MemoryType,\r
265 IN UINTN NumberOfPages,\r
266 OUT EFI_PHYSICAL_ADDRESS *Memory\r
267 );\r
268\r
269/**\r
270 Frees previous allocated pages.\r
271\r
272 @param Memory Base address of memory being freed\r
273 @param NumberOfPages The number of pages to free\r
274\r
275 @retval EFI_NOT_FOUND Could not find the entry that covers the range\r
276 @retval EFI_INVALID_PARAMETER Address not aligned\r
277 @return EFI_SUCCESS Pages successfully freed.\r
278\r
279**/\r
280EFI_STATUS\r
281EFIAPI\r
282SmmFreePages (\r
283 IN EFI_PHYSICAL_ADDRESS Memory,\r
284 IN UINTN NumberOfPages\r
285 );\r
286\r
287/**\r
288 Allocate pool of a particular type.\r
289\r
290 @param PoolType Type of pool to allocate\r
291 @param Size The amount of pool to allocate\r
292 @param Buffer The address to return a pointer to the allocated\r
293 pool\r
294\r
295 @retval EFI_INVALID_PARAMETER PoolType not valid\r
296 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
297 @retval EFI_SUCCESS Pool successfully allocated.\r
298\r
299**/\r
300EFI_STATUS\r
301EFIAPI\r
302SmmAllocatePool (\r
303 IN EFI_MEMORY_TYPE PoolType,\r
304 IN UINTN Size,\r
305 OUT VOID **Buffer\r
306 );\r
307\r
308/**\r
309 Frees pool.\r
310\r
311 @param Buffer The allocated pool entry to free\r
312\r
313 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
314 @retval EFI_SUCCESS Pool successfully freed.\r
315\r
316**/\r
317EFI_STATUS\r
318EFIAPI\r
319SmmFreePool (\r
320 IN VOID *Buffer\r
321 );\r
322\r
323/**\r
324 Installs a protocol interface into the boot services environment.\r
325\r
326 @param UserHandle The handle to install the protocol handler on,\r
327 or NULL if a new handle is to be allocated\r
328 @param Protocol The protocol to add to the handle\r
329 @param InterfaceType Indicates whether Interface is supplied in\r
330 native form.\r
331 @param Interface The interface for the protocol being added\r
332 @param Notify indicates whether notify the notification list\r
333 for this protocol\r
334\r
335 @retval EFI_INVALID_PARAMETER Invalid parameter\r
336 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
337 @retval EFI_SUCCESS Protocol interface successfully installed\r
338\r
339**/\r
340EFI_STATUS\r
341SmmInstallProtocolInterfaceNotify (\r
342 IN OUT EFI_HANDLE *UserHandle,\r
343 IN EFI_GUID *Protocol,\r
344 IN EFI_INTERFACE_TYPE InterfaceType,\r
345 IN VOID *Interface,\r
346 IN BOOLEAN Notify\r
347 );\r
348\r
349/**\r
350 Uninstalls all instances of a protocol:interfacer from a handle.\r
351 If the last protocol interface is remove from the handle, the\r
352 handle is freed.\r
353\r
354 @param UserHandle The handle to remove the protocol handler from\r
355 @param Protocol The protocol, of protocol:interface, to remove\r
356 @param Interface The interface, of protocol:interface, to remove\r
357\r
358 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
359 @retval EFI_SUCCESS Protocol interface successfully uninstalled.\r
360\r
361**/\r
362EFI_STATUS\r
363EFIAPI\r
364SmmUninstallProtocolInterface (\r
365 IN EFI_HANDLE UserHandle,\r
366 IN EFI_GUID *Protocol,\r
367 IN VOID *Interface\r
368 );\r
369\r
370/**\r
371 Queries a handle to determine if it supports a specified protocol.\r
372\r
373 @param UserHandle The handle being queried.\r
374 @param Protocol The published unique identifier of the protocol.\r
375 @param Interface Supplies the address where a pointer to the\r
376 corresponding Protocol Interface is returned.\r
377\r
378 @return The requested protocol interface for the handle\r
379\r
380**/\r
381EFI_STATUS\r
382EFIAPI\r
383SmmHandleProtocol (\r
384 IN EFI_HANDLE UserHandle,\r
385 IN EFI_GUID *Protocol,\r
386 OUT VOID **Interface\r
387 );\r
388\r
389/**\r
390 Add a new protocol notification record for the request protocol.\r
391\r
392 @param Protocol The requested protocol to add the notify\r
393 registration\r
394 @param Function Points to the notification function\r
395 @param Registration Returns the registration record\r
396\r
397 @retval EFI_INVALID_PARAMETER Invalid parameter\r
398 @retval EFI_SUCCESS Successfully returned the registration record\r
399 that has been added\r
400\r
401**/\r
402EFI_STATUS\r
403EFIAPI\r
404SmmRegisterProtocolNotify (\r
405 IN CONST EFI_GUID *Protocol,\r
406 IN EFI_SMM_NOTIFY_FN Function,\r
407 OUT VOID **Registration\r
408 );\r
409\r
410/**\r
411 Locates the requested handle(s) and returns them in Buffer.\r
412\r
413 @param SearchType The type of search to perform to locate the\r
414 handles\r
415 @param Protocol The protocol to search for\r
416 @param SearchKey Dependant on SearchType\r
417 @param BufferSize On input the size of Buffer. On output the\r
418 size of data returned.\r
419 @param Buffer The buffer to return the results in\r
420\r
421 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is\r
422 returned in BufferSize.\r
423 @retval EFI_INVALID_PARAMETER Invalid parameter\r
424 @retval EFI_SUCCESS Successfully found the requested handle(s) and\r
425 returns them in Buffer.\r
426\r
427**/\r
428EFI_STATUS\r
429EFIAPI\r
430SmmLocateHandle (\r
431 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
432 IN EFI_GUID *Protocol OPTIONAL,\r
433 IN VOID *SearchKey OPTIONAL,\r
434 IN OUT UINTN *BufferSize,\r
435 OUT EFI_HANDLE *Buffer\r
436 );\r
437\r
438/**\r
439 Return the first Protocol Interface that matches the Protocol GUID. If\r
440 Registration is pasased in return a Protocol Instance that was just add\r
441 to the system. If Retistration is NULL return the first Protocol Interface\r
442 you find.\r
443\r
444 @param Protocol The protocol to search for\r
445 @param Registration Optional Registration Key returned from\r
446 RegisterProtocolNotify()\r
447 @param Interface Return the Protocol interface (instance).\r
448\r
449 @retval EFI_SUCCESS If a valid Interface is returned\r
450 @retval EFI_INVALID_PARAMETER Invalid parameter\r
451 @retval EFI_NOT_FOUND Protocol interface not found\r
452\r
453**/\r
454EFI_STATUS\r
455EFIAPI\r
456SmmLocateProtocol (\r
457 IN EFI_GUID *Protocol,\r
458 IN VOID *Registration OPTIONAL,\r
459 OUT VOID **Interface\r
460 );\r
461\r
462/**\r
463 Manage SMI of a particular type.\r
464\r
465 @param HandlerType Points to the handler type or NULL for root SMI handlers.\r
466 @param Context Points to an optional context buffer.\r
467 @param CommBuffer Points to the optional communication buffer.\r
468 @param CommBufferSize Points to the size of the optional communication buffer.\r
469\r
470 @retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.\r
471 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.\r
472 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.\r
473 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.\r
474\r
475**/\r
476EFI_STATUS\r
477EFIAPI\r
478SmiManage (\r
479 IN CONST EFI_GUID *HandlerType,\r
480 IN CONST VOID *Context OPTIONAL,\r
481 IN OUT VOID *CommBuffer OPTIONAL,\r
482 IN OUT UINTN *CommBufferSize OPTIONAL\r
483 );\r
484\r
485/**\r
486 Registers a handler to execute within SMM.\r
487\r
488 @param Handler Handler service funtion pointer.\r
489 @param HandlerType Points to the handler type or NULL for root SMI handlers.\r
490 @param DispatchHandle On return, contains a unique handle which can be used to later unregister the handler function.\r
491\r
492 @retval EFI_SUCCESS Handler register success.\r
493 @retval EFI_INVALID_PARAMETER Handler or DispatchHandle is NULL.\r
494\r
495**/\r
496EFI_STATUS\r
497EFIAPI\r
498SmiHandlerRegister (\r
499 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r
500 IN CONST EFI_GUID *HandlerType OPTIONAL,\r
501 OUT EFI_HANDLE *DispatchHandle\r
502 );\r
503\r
504/**\r
505 Unregister a handler in SMM.\r
506\r
507 @param DispatchHandle The handle that was specified when the handler was registered.\r
508\r
509 @retval EFI_SUCCESS Handler function was successfully unregistered.\r
510 @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.\r
511\r
512**/\r
513EFI_STATUS\r
514EFIAPI\r
515SmiHandlerUnRegister (\r
516 IN EFI_HANDLE DispatchHandle\r
517 );\r
518\r
519/**\r
520 This function is the main entry point for an SMM handler dispatch\r
521 or communicate-based callback.\r
522\r
523 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r
524 @param Context Points to an optional handler context which was specified when the handler was registered.\r
525 @param CommBuffer A pointer to a collection of data in memory that will\r
526 be conveyed from a non-SMM environment into an SMM environment.\r
527 @param CommBufferSize The size of the CommBuffer.\r
528\r
529 @return Status Code\r
530\r
531**/\r
532EFI_STATUS\r
533EFIAPI\r
534SmmDriverDispatchHandler (\r
535 IN EFI_HANDLE DispatchHandle,\r
536 IN CONST VOID *Context, OPTIONAL\r
537 IN OUT VOID *CommBuffer, OPTIONAL\r
538 IN OUT UINTN *CommBufferSize OPTIONAL\r
539 );\r
540\r
541/**\r
542 This function is the main entry point for an SMM handler dispatch\r
543 or communicate-based callback.\r
544\r
545 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r
546 @param Context Points to an optional handler context which was specified when the handler was registered.\r
547 @param CommBuffer A pointer to a collection of data in memory that will\r
548 be conveyed from a non-SMM environment into an SMM environment.\r
549 @param CommBufferSize The size of the CommBuffer.\r
550\r
551 @return Status Code\r
552\r
553**/\r
554EFI_STATUS\r
555EFIAPI\r
556SmmLegacyBootHandler (\r
557 IN EFI_HANDLE DispatchHandle,\r
558 IN CONST VOID *Context, OPTIONAL\r
559 IN OUT VOID *CommBuffer, OPTIONAL\r
560 IN OUT UINTN *CommBufferSize OPTIONAL\r
561 );\r
562\r
563/**\r
564 This function is the main entry point for an SMM handler dispatch\r
565 or communicate-based callback.\r
566\r
567 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r
568 @param Context Points to an optional handler context which was specified when the handler was registered.\r
569 @param CommBuffer A pointer to a collection of data in memory that will\r
570 be conveyed from a non-SMM environment into an SMM environment.\r
571 @param CommBufferSize The size of the CommBuffer.\r
572\r
573 @return Status Code\r
574\r
575**/\r
576EFI_STATUS\r
577EFIAPI\r
578SmmReadyToLockHandler (\r
579 IN EFI_HANDLE DispatchHandle,\r
580 IN CONST VOID *Context, OPTIONAL\r
581 IN OUT VOID *CommBuffer, OPTIONAL\r
582 IN OUT UINTN *CommBufferSize OPTIONAL\r
583 );\r
584\r
585/**\r
586 Place holder function until all the SMM System Table Service are available.\r
587\r
588 @param Arg1 Undefined\r
589 @param Arg2 Undefined\r
590 @param Arg3 Undefined\r
591 @param Arg4 Undefined\r
592 @param Arg5 Undefined\r
593\r
594 @return EFI_NOT_AVAILABLE_YET\r
595\r
596**/\r
597EFI_STATUS\r
598EFIAPI\r
599SmmEfiNotAvailableYetArg5 (\r
600 UINTN Arg1,\r
601 UINTN Arg2,\r
602 UINTN Arg3,\r
603 UINTN Arg4,\r
604 UINTN Arg5\r
605 );\r
606\r
607//\r
608//Functions used during debug buils\r
609//\r
610\r
611/**\r
612 Traverse the discovered list for any drivers that were discovered but not loaded\r
613 because the dependency experessions evaluated to false.\r
614\r
615**/\r
616VOID\r
617SmmDisplayDiscoveredNotDispatched (\r
618 VOID\r
619 );\r
620\r
621/**\r
622 Add free SMRAM region for use by memory service.\r
623\r
624 @param MemBase Base address of memory region.\r
625 @param MemLength Length of the memory region.\r
626 @param Type Memory type.\r
627 @param Attributes Memory region state.\r
628\r
629**/\r
630VOID\r
631SmmAddMemoryRegion (\r
632 IN EFI_PHYSICAL_ADDRESS MemBase,\r
633 IN UINT64 MemLength,\r
634 IN EFI_MEMORY_TYPE Type,\r
635 IN UINT64 Attributes\r
636 );\r
637\r
638/**\r
639 Finds the protocol entry for the requested protocol.\r
640\r
641 @param Protocol The ID of the protocol\r
642 @param Create Create a new entry if not found\r
643\r
644 @return Protocol entry\r
645\r
646**/\r
647PROTOCOL_ENTRY *\r
648SmmFindProtocolEntry (\r
649 IN EFI_GUID *Protocol,\r
650 IN BOOLEAN Create\r
651 );\r
652\r
653/**\r
654 Signal event for every protocol in protocol entry.\r
655\r
656 @param Prot Protocol interface\r
657\r
658**/\r
659VOID\r
660SmmNotifyProtocol (\r
661 IN PROTOCOL_INTERFACE *Prot\r
662 );\r
663\r
664/**\r
665 Finds the protocol instance for the requested handle and protocol.\r
666 Note: This function doesn't do parameters checking, it's caller's responsibility\r
667 to pass in valid parameters.\r
668\r
669 @param Handle The handle to search the protocol on\r
670 @param Protocol GUID of the protocol\r
671 @param Interface The interface for the protocol being searched\r
672\r
673 @return Protocol instance (NULL: Not found)\r
674\r
675**/\r
676PROTOCOL_INTERFACE *\r
677SmmFindProtocolInterface (\r
678 IN IHANDLE *Handle,\r
679 IN EFI_GUID *Protocol,\r
680 IN VOID *Interface\r
681 );\r
682\r
683/**\r
684 Removes Protocol from the protocol list (but not the handle list).\r
685\r
686 @param Handle The handle to remove protocol on.\r
687 @param Protocol GUID of the protocol to be moved\r
688 @param Interface The interface of the protocol\r
689\r
690 @return Protocol Entry\r
691\r
692**/\r
693PROTOCOL_INTERFACE *\r
694SmmRemoveInterfaceFromProtocol (\r
695 IN IHANDLE *Handle,\r
696 IN EFI_GUID *Protocol,\r
697 IN VOID *Interface\r
698 );\r
699\r
700/**\r
701 This is the POSTFIX version of the dependency evaluator. This code does\r
702 not need to handle Before or After, as it is not valid to call this\r
703 routine in this case. The SOR is just ignored and is a nop in the grammer.\r
704 POSTFIX means all the math is done on top of the stack.\r
705\r
706 @param DriverEntry DriverEntry element to update.\r
707\r
708 @retval TRUE If driver is ready to run.\r
709 @retval FALSE If driver is not ready to run or some fatal error\r
710 was found.\r
711\r
712**/\r
713BOOLEAN\r
714SmmIsSchedulable (\r
715 IN EFI_SMM_DRIVER_ENTRY *DriverEntry\r
716 );\r
717\r
718#endif\r