2 The internal header file includes the common header files, defines
3 internal structure and functions used by SmmCore module.
5 Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include <Protocol/DxeSmmReadyToLock.h>
22 #include <Protocol/SmmReadyToLock.h>
23 #include <Protocol/SmmEndOfDxe.h>
24 #include <Protocol/CpuIo2.h>
25 #include <Protocol/SmmCommunication.h>
26 #include <Protocol/SmmAccess2.h>
27 #include <Protocol/FirmwareVolume2.h>
28 #include <Protocol/LoadedImage.h>
29 #include <Protocol/DevicePath.h>
30 #include <Protocol/Security.h>
31 #include <Protocol/Security2.h>
32 #include <Protocol/SmmExitBootServices.h>
33 #include <Protocol/SmmLegacyBoot.h>
34 #include <Protocol/SmmReadyToBoot.h>
36 #include <Guid/Apriori.h>
37 #include <Guid/EventGroup.h>
38 #include <Guid/EventLegacyBios.h>
39 #include <Guid/ZeroGuid.h>
40 #include <Guid/MemoryProfile.h>
42 #include <Library/BaseLib.h>
43 #include <Library/BaseMemoryLib.h>
44 #include <Library/PeCoffLib.h>
45 #include <Library/CacheMaintenanceLib.h>
46 #include <Library/DebugLib.h>
47 #include <Library/ReportStatusCodeLib.h>
48 #include <Library/MemoryAllocationLib.h>
49 #include <Library/DevicePathLib.h>
50 #include <Library/UefiLib.h>
51 #include <Library/UefiBootServicesTableLib.h>
52 #include <Library/PcdLib.h>
53 #include <Library/SmmCorePlatformHookLib.h>
54 #include <Library/PerformanceLib.h>
55 #include <Library/TimerLib.h>
56 #include <Library/HobLib.h>
57 #include <Library/SmmMemLib.h>
59 #include "PiSmmCorePrivateData.h"
62 // Used to build a table of SMI Handlers that the SMM Core registers
65 EFI_SMM_HANDLER_ENTRY_POINT2 Handler
;
66 EFI_GUID
*HandlerType
;
67 EFI_HANDLE DispatchHandle
;
69 } SMM_CORE_SMI_HANDLERS
;
72 // Structure for recording the state of an SMM Driver
74 #define EFI_SMM_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('s', 'd','r','v')
78 LIST_ENTRY Link
; // mDriverList
80 LIST_ENTRY ScheduledLink
; // mScheduledQueue
84 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
85 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
92 EFI_GUID BeforeAfterGuid
;
97 BOOLEAN DepexProtocolError
;
99 EFI_HANDLE ImageHandle
;
100 EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
;
102 // Image EntryPoint in SMRAM
104 PHYSICAL_ADDRESS ImageEntryPoint
;
106 // Image Buffer in SMRAM
108 PHYSICAL_ADDRESS ImageBuffer
;
113 } EFI_SMM_DRIVER_ENTRY
;
115 #define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
118 /// IHANDLE - contains a list of protocol handles
122 /// All handles list of IHANDLE
123 LIST_ENTRY AllHandles
;
124 /// List of PROTOCOL_INTERFACE's for this handle
125 LIST_ENTRY Protocols
;
129 #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
131 #define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
134 /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
135 /// database. Each handler that supports this protocol is listed, along
136 /// with a list of registered notifies.
140 /// Link Entry inserted to mProtocolDatabase
141 LIST_ENTRY AllEntries
;
142 /// ID of the protocol
144 /// All protocol interfaces
145 LIST_ENTRY Protocols
;
146 /// Registerd notification handlers
150 #define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
153 /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
154 /// with a protocol interface structure
158 /// Link on IHANDLE.Protocols
162 /// Link on PROTOCOL_ENTRY.Protocols
163 LIST_ENTRY ByProtocol
;
165 PROTOCOL_ENTRY
*Protocol
;
166 /// The interface value
168 } PROTOCOL_INTERFACE
;
170 #define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
173 /// PROTOCOL_NOTIFY - used for each register notification for a protocol
177 PROTOCOL_ENTRY
*Protocol
;
178 /// All notifications for this protocol
180 /// Notification function
181 EFI_SMM_NOTIFY_FN Function
;
182 /// Last position notified
183 LIST_ENTRY
*Position
;
187 // SMM Core Global Variables
189 extern SMM_CORE_PRIVATE_DATA
*gSmmCorePrivate
;
190 extern EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst
;
191 extern LIST_ENTRY gHandleList
;
192 extern EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressSmramBase
;
195 Called to initialize the memory service.
197 @param SmramRangeCount Number of SMRAM Regions
198 @param SmramRanges Pointer to SMRAM Descriptors
202 SmmInitializeMemoryServices (
203 IN UINTN SmramRangeCount
,
204 IN EFI_SMRAM_DESCRIPTOR
*SmramRanges
208 The SmmInstallConfigurationTable() function is used to maintain the list
209 of configuration tables that are stored in the System Management System
210 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
211 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
213 @param SystemTable A pointer to the SMM System Table (SMST).
214 @param Guid A pointer to the GUID for the entry to add, update, or remove.
215 @param Table A pointer to the buffer of the table to add.
216 @param TableSize The size of the table to install.
218 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
219 @retval EFI_INVALID_PARAMETER Guid is not valid.
220 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
221 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
226 SmmInstallConfigurationTable (
227 IN CONST EFI_SMM_SYSTEM_TABLE2
*SystemTable
,
228 IN CONST EFI_GUID
*Guid
,
234 Wrapper function to SmmInstallProtocolInterfaceNotify. This is the public API which
235 Calls the private one which contains a BOOLEAN parameter for notifications
237 @param UserHandle The handle to install the protocol handler on,
238 or NULL if a new handle is to be allocated
239 @param Protocol The protocol to add to the handle
240 @param InterfaceType Indicates whether Interface is supplied in
242 @param Interface The interface for the protocol being added
249 SmmInstallProtocolInterface (
250 IN OUT EFI_HANDLE
*UserHandle
,
251 IN EFI_GUID
*Protocol
,
252 IN EFI_INTERFACE_TYPE InterfaceType
,
257 Allocates pages from the memory map.
259 @param Type The type of allocation to perform
260 @param MemoryType The type of memory to turn the allocated pages
262 @param NumberOfPages The number of pages to allocate
263 @param Memory A pointer to receive the base allocated memory
266 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.
267 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
268 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
269 @retval EFI_SUCCESS Pages successfully allocated.
275 IN EFI_ALLOCATE_TYPE Type
,
276 IN EFI_MEMORY_TYPE MemoryType
,
277 IN UINTN NumberOfPages
,
278 OUT EFI_PHYSICAL_ADDRESS
*Memory
282 Allocates pages from the memory map.
284 @param Type The type of allocation to perform
285 @param MemoryType The type of memory to turn the allocated pages
287 @param NumberOfPages The number of pages to allocate
288 @param Memory A pointer to receive the base allocated memory
291 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec.
292 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
293 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
294 @retval EFI_SUCCESS Pages successfully allocated.
299 SmmInternalAllocatePages (
300 IN EFI_ALLOCATE_TYPE Type
,
301 IN EFI_MEMORY_TYPE MemoryType
,
302 IN UINTN NumberOfPages
,
303 OUT EFI_PHYSICAL_ADDRESS
*Memory
307 Frees previous allocated pages.
309 @param Memory Base address of memory being freed
310 @param NumberOfPages The number of pages to free
312 @retval EFI_NOT_FOUND Could not find the entry that covers the range
313 @retval EFI_INVALID_PARAMETER Address not aligned
314 @return EFI_SUCCESS Pages successfully freed.
320 IN EFI_PHYSICAL_ADDRESS Memory
,
321 IN UINTN NumberOfPages
325 Frees previous allocated pages.
327 @param Memory Base address of memory being freed
328 @param NumberOfPages The number of pages to free
330 @retval EFI_NOT_FOUND Could not find the entry that covers the range
331 @retval EFI_INVALID_PARAMETER Address not aligned
332 @return EFI_SUCCESS Pages successfully freed.
337 SmmInternalFreePages (
338 IN EFI_PHYSICAL_ADDRESS Memory
,
339 IN UINTN NumberOfPages
343 Allocate pool of a particular type.
345 @param PoolType Type of pool to allocate
346 @param Size The amount of pool to allocate
347 @param Buffer The address to return a pointer to the allocated
350 @retval EFI_INVALID_PARAMETER PoolType not valid
351 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
352 @retval EFI_SUCCESS Pool successfully allocated.
358 IN EFI_MEMORY_TYPE PoolType
,
364 Allocate pool of a particular type.
366 @param PoolType Type of pool to allocate
367 @param Size The amount of pool to allocate
368 @param Buffer The address to return a pointer to the allocated
371 @retval EFI_INVALID_PARAMETER PoolType not valid
372 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
373 @retval EFI_SUCCESS Pool successfully allocated.
378 SmmInternalAllocatePool (
379 IN EFI_MEMORY_TYPE PoolType
,
387 @param Buffer The allocated pool entry to free
389 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
390 @retval EFI_SUCCESS Pool successfully freed.
402 @param Buffer The allocated pool entry to free
404 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
405 @retval EFI_SUCCESS Pool successfully freed.
410 SmmInternalFreePool (
415 Installs a protocol interface into the boot services environment.
417 @param UserHandle The handle to install the protocol handler on,
418 or NULL if a new handle is to be allocated
419 @param Protocol The protocol to add to the handle
420 @param InterfaceType Indicates whether Interface is supplied in
422 @param Interface The interface for the protocol being added
423 @param Notify indicates whether notify the notification list
426 @retval EFI_INVALID_PARAMETER Invalid parameter
427 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
428 @retval EFI_SUCCESS Protocol interface successfully installed
432 SmmInstallProtocolInterfaceNotify (
433 IN OUT EFI_HANDLE
*UserHandle
,
434 IN EFI_GUID
*Protocol
,
435 IN EFI_INTERFACE_TYPE InterfaceType
,
441 Uninstalls all instances of a protocol:interfacer from a handle.
442 If the last protocol interface is remove from the handle, the
445 @param UserHandle The handle to remove the protocol handler from
446 @param Protocol The protocol, of protocol:interface, to remove
447 @param Interface The interface, of protocol:interface, to remove
449 @retval EFI_INVALID_PARAMETER Protocol is NULL.
450 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
455 SmmUninstallProtocolInterface (
456 IN EFI_HANDLE UserHandle
,
457 IN EFI_GUID
*Protocol
,
462 Queries a handle to determine if it supports a specified protocol.
464 @param UserHandle The handle being queried.
465 @param Protocol The published unique identifier of the protocol.
466 @param Interface Supplies the address where a pointer to the
467 corresponding Protocol Interface is returned.
469 @return The requested protocol interface for the handle
475 IN EFI_HANDLE UserHandle
,
476 IN EFI_GUID
*Protocol
,
481 Add a new protocol notification record for the request protocol.
483 @param Protocol The requested protocol to add the notify
485 @param Function Points to the notification function
486 @param Registration Returns the registration record
488 @retval EFI_INVALID_PARAMETER Invalid parameter
489 @retval EFI_SUCCESS Successfully returned the registration record
495 SmmRegisterProtocolNotify (
496 IN CONST EFI_GUID
*Protocol
,
497 IN EFI_SMM_NOTIFY_FN Function
,
498 OUT VOID
**Registration
502 Locates the requested handle(s) and returns them in Buffer.
504 @param SearchType The type of search to perform to locate the
506 @param Protocol The protocol to search for
507 @param SearchKey Dependant on SearchType
508 @param BufferSize On input the size of Buffer. On output the
509 size of data returned.
510 @param Buffer The buffer to return the results in
512 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
513 returned in BufferSize.
514 @retval EFI_INVALID_PARAMETER Invalid parameter
515 @retval EFI_SUCCESS Successfully found the requested handle(s) and
516 returns them in Buffer.
522 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
523 IN EFI_GUID
*Protocol OPTIONAL
,
524 IN VOID
*SearchKey OPTIONAL
,
525 IN OUT UINTN
*BufferSize
,
526 OUT EFI_HANDLE
*Buffer
530 Return the first Protocol Interface that matches the Protocol GUID. If
531 Registration is pasased in return a Protocol Instance that was just add
532 to the system. If Retistration is NULL return the first Protocol Interface
535 @param Protocol The protocol to search for
536 @param Registration Optional Registration Key returned from
537 RegisterProtocolNotify()
538 @param Interface Return the Protocol interface (instance).
540 @retval EFI_SUCCESS If a valid Interface is returned
541 @retval EFI_INVALID_PARAMETER Invalid parameter
542 @retval EFI_NOT_FOUND Protocol interface not found
548 IN EFI_GUID
*Protocol
,
549 IN VOID
*Registration OPTIONAL
,
554 Manage SMI of a particular type.
556 @param HandlerType Points to the handler type or NULL for root SMI handlers.
557 @param Context Points to an optional context buffer.
558 @param CommBuffer Points to the optional communication buffer.
559 @param CommBufferSize Points to the size of the optional communication buffer.
561 @retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.
562 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
563 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.
564 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
570 IN CONST EFI_GUID
*HandlerType
,
571 IN CONST VOID
*Context OPTIONAL
,
572 IN OUT VOID
*CommBuffer OPTIONAL
,
573 IN OUT UINTN
*CommBufferSize OPTIONAL
577 Registers a handler to execute within SMM.
579 @param Handler Handler service funtion pointer.
580 @param HandlerType Points to the handler type or NULL for root SMI handlers.
581 @param DispatchHandle On return, contains a unique handle which can be used to later unregister the handler function.
583 @retval EFI_SUCCESS Handler register success.
584 @retval EFI_INVALID_PARAMETER Handler or DispatchHandle is NULL.
590 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
591 IN CONST EFI_GUID
*HandlerType OPTIONAL
,
592 OUT EFI_HANDLE
*DispatchHandle
596 Unregister a handler in SMM.
598 @param DispatchHandle The handle that was specified when the handler was registered.
600 @retval EFI_SUCCESS Handler function was successfully unregistered.
601 @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.
606 SmiHandlerUnRegister (
607 IN EFI_HANDLE DispatchHandle
611 This function is the main entry point for an SMM handler dispatch
612 or communicate-based callback.
614 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
615 @param Context Points to an optional handler context which was specified when the handler was registered.
616 @param CommBuffer A pointer to a collection of data in memory that will
617 be conveyed from a non-SMM environment into an SMM environment.
618 @param CommBufferSize The size of the CommBuffer.
625 SmmDriverDispatchHandler (
626 IN EFI_HANDLE DispatchHandle
,
627 IN CONST VOID
*Context
, OPTIONAL
628 IN OUT VOID
*CommBuffer
, OPTIONAL
629 IN OUT UINTN
*CommBufferSize OPTIONAL
633 This function is the main entry point for an SMM handler dispatch
634 or communicate-based callback.
636 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
637 @param Context Points to an optional handler context which was specified when the handler was registered.
638 @param CommBuffer A pointer to a collection of data in memory that will
639 be conveyed from a non-SMM environment into an SMM environment.
640 @param CommBufferSize The size of the CommBuffer.
647 SmmLegacyBootHandler (
648 IN EFI_HANDLE DispatchHandle
,
649 IN CONST VOID
*Context
, OPTIONAL
650 IN OUT VOID
*CommBuffer
, OPTIONAL
651 IN OUT UINTN
*CommBufferSize OPTIONAL
655 This function is the main entry point for an SMM handler dispatch
656 or communicate-based callback.
658 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
659 @param Context Points to an optional handler context which was specified when the handler was registered.
660 @param CommBuffer A pointer to a collection of data in memory that will
661 be conveyed from a non-SMM environment into an SMM environment.
662 @param CommBufferSize The size of the CommBuffer.
669 SmmReadyToLockHandler (
670 IN EFI_HANDLE DispatchHandle
,
671 IN CONST VOID
*Context
, OPTIONAL
672 IN OUT VOID
*CommBuffer
, OPTIONAL
673 IN OUT UINTN
*CommBufferSize OPTIONAL
677 This function is the main entry point for an SMM handler dispatch
678 or communicate-based callback.
680 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
681 @param Context Points to an optional handler context which was specified when the handler was registered.
682 @param CommBuffer A pointer to a collection of data in memory that will
683 be conveyed from a non-SMM environment into an SMM environment.
684 @param CommBufferSize The size of the CommBuffer.
692 IN EFI_HANDLE DispatchHandle
,
693 IN CONST VOID
*Context
, OPTIONAL
694 IN OUT VOID
*CommBuffer
, OPTIONAL
695 IN OUT UINTN
*CommBufferSize OPTIONAL
699 This function is the main entry point for an SMM handler dispatch
700 or communicate-based callback.
702 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
703 @param Context Points to an optional handler context which was specified when the handler was registered.
704 @param CommBuffer A pointer to a collection of data in memory that will
705 be conveyed from a non-SMM environment into an SMM environment.
706 @param CommBufferSize The size of the CommBuffer.
713 SmmExitBootServicesHandler (
714 IN EFI_HANDLE DispatchHandle
,
715 IN CONST VOID
*Context
, OPTIONAL
716 IN OUT VOID
*CommBuffer
, OPTIONAL
717 IN OUT UINTN
*CommBufferSize OPTIONAL
721 This function is the main entry point for an SMM handler dispatch
722 or communicate-based callback.
724 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
725 @param Context Points to an optional handler context which was specified when the handler was registered.
726 @param CommBuffer A pointer to a collection of data in memory that will
727 be conveyed from a non-SMM environment into an SMM environment.
728 @param CommBufferSize The size of the CommBuffer.
735 SmmReadyToBootHandler (
736 IN EFI_HANDLE DispatchHandle
,
737 IN CONST VOID
*Context
, OPTIONAL
738 IN OUT VOID
*CommBuffer
, OPTIONAL
739 IN OUT UINTN
*CommBufferSize OPTIONAL
743 Place holder function until all the SMM System Table Service are available.
745 @param Arg1 Undefined
746 @param Arg2 Undefined
747 @param Arg3 Undefined
748 @param Arg4 Undefined
749 @param Arg5 Undefined
751 @return EFI_NOT_AVAILABLE_YET
756 SmmEfiNotAvailableYetArg5 (
765 //Functions used during debug buils
769 Traverse the discovered list for any drivers that were discovered but not loaded
770 because the dependency experessions evaluated to false.
774 SmmDisplayDiscoveredNotDispatched (
779 Add free SMRAM region for use by memory service.
781 @param MemBase Base address of memory region.
782 @param MemLength Length of the memory region.
783 @param Type Memory type.
784 @param Attributes Memory region state.
789 IN EFI_PHYSICAL_ADDRESS MemBase
,
791 IN EFI_MEMORY_TYPE Type
,
796 Finds the protocol entry for the requested protocol.
798 @param Protocol The ID of the protocol
799 @param Create Create a new entry if not found
801 @return Protocol entry
805 SmmFindProtocolEntry (
806 IN EFI_GUID
*Protocol
,
811 Signal event for every protocol in protocol entry.
813 @param Prot Protocol interface
818 IN PROTOCOL_INTERFACE
*Prot
822 Finds the protocol instance for the requested handle and protocol.
823 Note: This function doesn't do parameters checking, it's caller's responsibility
824 to pass in valid parameters.
826 @param Handle The handle to search the protocol on
827 @param Protocol GUID of the protocol
828 @param Interface The interface for the protocol being searched
830 @return Protocol instance (NULL: Not found)
834 SmmFindProtocolInterface (
836 IN EFI_GUID
*Protocol
,
841 Removes Protocol from the protocol list (but not the handle list).
843 @param Handle The handle to remove protocol on.
844 @param Protocol GUID of the protocol to be moved
845 @param Interface The interface of the protocol
847 @return Protocol Entry
851 SmmRemoveInterfaceFromProtocol (
853 IN EFI_GUID
*Protocol
,
858 This is the POSTFIX version of the dependency evaluator. This code does
859 not need to handle Before or After, as it is not valid to call this
860 routine in this case. POSTFIX means all the math is done on top of the stack.
862 @param DriverEntry DriverEntry element to update.
864 @retval TRUE If driver is ready to run.
865 @retval FALSE If driver is not ready to run or some fatal error
871 IN EFI_SMM_DRIVER_ENTRY
*DriverEntry
879 Initialize SMRAM profile.
888 Register SMM image to SMRAM profile.
890 @param DriverEntry SMM image info.
891 @param RegisterToDxe Register image to DXE.
893 @retval TRUE Register success.
894 @retval FALSE Register fail.
898 RegisterSmramProfileImage (
899 IN EFI_SMM_DRIVER_ENTRY
*DriverEntry
,
900 IN BOOLEAN RegisterToDxe
904 Unregister image from SMRAM profile.
906 @param DriverEntry SMM image info.
907 @param UnregisterToDxe Unregister image from DXE.
909 @retval TRUE Unregister success.
910 @retval FALSE Unregister fail.
914 UnregisterSmramProfileImage (
915 IN EFI_SMM_DRIVER_ENTRY
*DriverEntry
,
916 IN BOOLEAN UnregisterToDxe
920 Update SMRAM profile information.
922 @param CallerAddress Address of caller who call Allocate or Free.
923 @param Action This Allocate or Free action.
924 @param MemoryType Memory type.
925 @param Size Buffer size.
926 @param Buffer Buffer address.
928 @retval TRUE Profile udpate success.
929 @retval FALSE Profile update fail.
933 SmmCoreUpdateProfile (
934 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
935 IN MEMORY_PROFILE_ACTION Action
,
936 IN EFI_MEMORY_TYPE MemoryType
, // Valid for AllocatePages/AllocatePool
937 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
942 Register SMRAM profile handler.
946 RegisterSmramProfileHandler (
951 SMRAM profile ready to lock callback function.
955 SmramProfileReadyToLock (
959 extern UINTN mFullSmramRangeCount
;
960 extern EFI_SMRAM_DESCRIPTOR
*mFullSmramRanges
;
962 extern EFI_LOADED_IMAGE_PROTOCOL
*mSmmCoreLoadedImage
;
973 extern LIST_ENTRY mSmmMemoryMap
;
980 // MIN_POOL_SHIFT must not be less than 5
982 #define MIN_POOL_SHIFT 6
983 #define MIN_POOL_SIZE (1 << MIN_POOL_SHIFT)
986 // MAX_POOL_SHIFT must not be less than EFI_PAGE_SHIFT - 1
988 #define MAX_POOL_SHIFT (EFI_PAGE_SHIFT - 1)
989 #define MAX_POOL_SIZE (1 << MAX_POOL_SHIFT)
992 // MAX_POOL_INDEX are calculated by maximum and minimum pool sizes
994 #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
1006 extern LIST_ENTRY mSmmPoolLists
[MAX_POOL_INDEX
];