4 Step #1 - When a FV protocol is added to the system every driver in the FV
5 is added to the mDiscoveredList. The Before, and After Depex are
6 pre-processed as drivers are added to the mDiscoveredList. If an Apriori
7 file exists in the FV those drivers are addeded to the
8 mScheduledQueue. The mFvHandleList is used to make sure a
9 FV is only processed once.
11 Step #2 - Dispatch. Remove driver from the mScheduledQueue and load and
12 start it. After mScheduledQueue is drained check the
13 mDiscoveredList to see if any item has a Depex that is ready to
14 be placed on the mScheduledQueue.
16 Step #3 - Adding to the mScheduledQueue requires that you process Before
17 and After dependencies. This is done recursively as the call to add
18 to the mScheduledQueue checks for Before and recursively adds
19 all Befores. It then addes the item that was passed in and then
20 processess the After dependecies by recursively calling the routine.
23 The rules for the dispatcher are similar to the DXE dispatcher.
25 The rules for DXE dispatcher are in chapter 10 of the DXE CIS. Figure 10-3
26 is the state diagram for the DXE dispatcher
28 Depex - Dependency Expresion.
30 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
31 This program and the accompanying materials are licensed and made available
32 under the terms and conditions of the BSD License which accompanies this
33 distribution. The full text of the license may be found at
34 http://opensource.org/licenses/bsd-license.php
36 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
37 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
41 #include "PiSmmCore.h"
44 // SMM Dispatcher Data structures
46 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
49 LIST_ENTRY Link
; // mFvHandleList
54 // Function Prototypes
58 Insert InsertedDriverEntry onto the mScheduledQueue. To do this you
59 must add any driver with a before dependency on InsertedDriverEntry first.
60 You do this by recursively calling this routine. After all the Befores are
61 processed you can add InsertedDriverEntry to the mScheduledQueue.
62 Then you can add any driver with an After dependency on InsertedDriverEntry
63 by recursively calling this routine.
65 @param InsertedDriverEntry The driver to insert on the ScheduledLink Queue
69 SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
70 IN EFI_SMM_DRIVER_ENTRY
*InsertedDriverEntry
74 // The Driver List contains one copy of every driver that has been discovered.
75 // Items are never removed from the driver list. List of EFI_SMM_DRIVER_ENTRY
77 LIST_ENTRY mDiscoveredList
= INITIALIZE_LIST_HEAD_VARIABLE (mDiscoveredList
);
80 // Queue of drivers that are ready to dispatch. This queue is a subset of the
81 // mDiscoveredList.list of EFI_SMM_DRIVER_ENTRY.
83 LIST_ENTRY mScheduledQueue
= INITIALIZE_LIST_HEAD_VARIABLE (mScheduledQueue
);
86 // List of handles who's Fv's have been parsed and added to the mFwDriverList.
88 LIST_ENTRY mFvHandleList
= INITIALIZE_LIST_HEAD_VARIABLE (mFvHandleList
);
91 // Flag for the SMM Dispacher. TRUE if dispatcher is execuing.
93 BOOLEAN gDispatcherRunning
= FALSE
;
96 // Flag for the SMM Dispacher. TRUE if there is one or more SMM drivers ready to be dispatched
98 BOOLEAN gRequestDispatch
= FALSE
;
101 // List of file types supported by dispatcher
103 EFI_FV_FILETYPE mSmmFileTypes
[] = {
105 EFI_FV_FILETYPE_COMBINED_SMM_DXE
107 // Note: DXE core will process the FV image file, so skip it in SMM core
108 // EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
113 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH File
;
114 EFI_DEVICE_PATH_PROTOCOL End
;
115 } FV_FILEPATH_DEVICE_PATH
;
117 FV_FILEPATH_DEVICE_PATH mFvDevicePath
;
120 // DXE Architecture Protocols
122 EFI_SECURITY_ARCH_PROTOCOL
*mSecurity
= NULL
;
123 EFI_SECURITY2_ARCH_PROTOCOL
*mSecurity2
= NULL
;
126 // The global variable is defined for Loading modules at fixed address feature to track the SMM code
127 // memory range usage. It is a bit mapped array in which every bit indicates the correspoding
128 // memory page available or not.
130 GLOBAL_REMOVE_IF_UNREFERENCED UINT64
*mSmmCodeMemoryRangeUsageBitMap
=NULL
;
133 To check memory usage bit map array to figure out if the memory range in which the image will be loaded is available or not. If
134 memory range is avaliable, the function will mark the correponding bits to 1 which indicates the memory range is used.
135 The function is only invoked when load modules at fixed address feature is enabled.
137 @param ImageBase The base addres the image will be loaded at.
138 @param ImageSize The size of the image
140 @retval EFI_SUCCESS The memory range the image will be loaded in is available
141 @retval EFI_NOT_FOUND The memory range the image will be loaded in is not available
144 CheckAndMarkFixLoadingMemoryUsageBitMap (
145 IN EFI_PHYSICAL_ADDRESS ImageBase
,
149 UINT32 SmmCodePageNumber
;
151 EFI_PHYSICAL_ADDRESS SmmCodeBase
;
152 UINTN BaseOffsetPageNumber
;
153 UINTN TopOffsetPageNumber
;
156 // Build tool will calculate the smm code size and then patch the PcdLoadFixAddressSmmCodePageNumber
158 SmmCodePageNumber
= PcdGet32(PcdLoadFixAddressSmmCodePageNumber
);
159 SmmCodeSize
= EFI_PAGES_TO_SIZE (SmmCodePageNumber
);
160 SmmCodeBase
= gLoadModuleAtFixAddressSmramBase
;
163 // If the memory usage bit map is not initialized, do it. Every bit in the array
164 // indicate the status of the corresponding memory page, available or not
166 if (mSmmCodeMemoryRangeUsageBitMap
== NULL
) {
167 mSmmCodeMemoryRangeUsageBitMap
= AllocateZeroPool(((SmmCodePageNumber
/ 64) + 1)*sizeof(UINT64
));
170 // If the Dxe code memory range is not allocated or the bit map array allocation failed, return EFI_NOT_FOUND
172 if (mSmmCodeMemoryRangeUsageBitMap
== NULL
) {
173 return EFI_NOT_FOUND
;
176 // see if the memory range for loading the image is in the SMM code range.
178 if (SmmCodeBase
+ SmmCodeSize
< ImageBase
+ ImageSize
|| SmmCodeBase
> ImageBase
) {
179 return EFI_NOT_FOUND
;
182 // Test if the memory is avalaible or not.
184 BaseOffsetPageNumber
= (UINTN
)EFI_SIZE_TO_PAGES((UINT32
)(ImageBase
- SmmCodeBase
));
185 TopOffsetPageNumber
= (UINTN
)EFI_SIZE_TO_PAGES((UINT32
)(ImageBase
+ ImageSize
- SmmCodeBase
));
186 for (Index
= BaseOffsetPageNumber
; Index
< TopOffsetPageNumber
; Index
++) {
187 if ((mSmmCodeMemoryRangeUsageBitMap
[Index
/ 64] & LShiftU64(1, (Index
% 64))) != 0) {
189 // This page is already used.
191 return EFI_NOT_FOUND
;
196 // Being here means the memory range is available. So mark the bits for the memory range
198 for (Index
= BaseOffsetPageNumber
; Index
< TopOffsetPageNumber
; Index
++) {
199 mSmmCodeMemoryRangeUsageBitMap
[Index
/ 64] |= LShiftU64(1, (Index
% 64));
204 Get the fixed loadding address from image header assigned by build tool. This function only be called
205 when Loading module at Fixed address feature enabled.
207 @param ImageContext Pointer to the image context structure that describes the PE/COFF
208 image that needs to be examined by this function.
209 @retval EFI_SUCCESS An fixed loading address is assigned to this image by build tools .
210 @retval EFI_NOT_FOUND The image has no assigned fixed loadding address.
214 GetPeCoffImageFixLoadingAssignedAddress(
215 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
218 UINTN SectionHeaderOffset
;
220 EFI_IMAGE_SECTION_HEADER SectionHeader
;
221 EFI_IMAGE_OPTIONAL_HEADER_UNION
*ImgHdr
;
222 EFI_PHYSICAL_ADDRESS FixLoaddingAddress
;
225 UINT16 NumberOfSections
;
226 UINT64 ValueInSectionHeader
;
228 FixLoaddingAddress
= 0;
229 Status
= EFI_NOT_FOUND
;
232 // Get PeHeader pointer
234 ImgHdr
= (EFI_IMAGE_OPTIONAL_HEADER_UNION
*)((CHAR8
* )ImageContext
->Handle
+ ImageContext
->PeCoffHeaderOffset
);
235 SectionHeaderOffset
= (UINTN
)(
236 ImageContext
->PeCoffHeaderOffset
+
238 sizeof (EFI_IMAGE_FILE_HEADER
) +
239 ImgHdr
->Pe32
.FileHeader
.SizeOfOptionalHeader
241 NumberOfSections
= ImgHdr
->Pe32
.FileHeader
.NumberOfSections
;
244 // Get base address from the first section header that doesn't point to code section.
246 for (Index
= 0; Index
< NumberOfSections
; Index
++) {
248 // Read section header from file
250 Size
= sizeof (EFI_IMAGE_SECTION_HEADER
);
251 Status
= ImageContext
->ImageRead (
252 ImageContext
->Handle
,
257 if (EFI_ERROR (Status
)) {
261 Status
= EFI_NOT_FOUND
;
263 if ((SectionHeader
.Characteristics
& EFI_IMAGE_SCN_CNT_CODE
) == 0) {
265 // Build tool will save the address in PointerToRelocations & PointerToLineNumbers fields in the first section header
266 // that doesn't point to code section in image header.So there is an assumption that when the feature is enabled,
267 // if a module with a loading address assigned by tools, the PointerToRelocations & PointerToLineNumbers fields
268 // should not be Zero, or else, these 2 fileds should be set to Zero
270 ValueInSectionHeader
= ReadUnaligned64((UINT64
*)&SectionHeader
.PointerToRelocations
);
271 if (ValueInSectionHeader
!= 0) {
273 // Found first section header that doesn't point to code section in which uild tool saves the
274 // offset to SMRAM base as image base in PointerToRelocations & PointerToLineNumbers fields
276 FixLoaddingAddress
= (EFI_PHYSICAL_ADDRESS
)(gLoadModuleAtFixAddressSmramBase
+ (INT64
)ValueInSectionHeader
);
278 // Check if the memory range is avaliable.
280 Status
= CheckAndMarkFixLoadingMemoryUsageBitMap (FixLoaddingAddress
, (UINTN
)(ImageContext
->ImageSize
+ ImageContext
->SectionAlignment
));
281 if (!EFI_ERROR(Status
)) {
283 // The assigned address is valid. Return the specified loadding address
285 ImageContext
->ImageAddress
= FixLoaddingAddress
;
290 SectionHeaderOffset
+= sizeof (EFI_IMAGE_SECTION_HEADER
);
292 DEBUG ((EFI_D_INFO
|EFI_D_LOAD
, "LOADING MODULE FIXED INFO: Loading module at fixed address %x, Status = %r\n", FixLoaddingAddress
, Status
));
296 Loads an EFI image into SMRAM.
298 @param DriverEntry EFI_SMM_DRIVER_ENTRY instance
306 IN OUT EFI_SMM_DRIVER_ENTRY
*DriverEntry
309 UINT32 AuthenticationStatus
;
316 EFI_STATUS SecurityStatus
;
317 EFI_HANDLE DeviceHandle
;
318 EFI_PHYSICAL_ADDRESS DstBuffer
;
319 EFI_DEVICE_PATH_PROTOCOL
*FilePath
;
320 EFI_DEVICE_PATH_PROTOCOL
*OriginalFilePath
;
321 EFI_DEVICE_PATH_PROTOCOL
*HandleFilePath
;
322 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
323 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
328 Tick
= GetPerformanceCounter ();
333 Fv
= DriverEntry
->Fv
;
334 NameGuid
= &DriverEntry
->FileName
;
335 FilePath
= DriverEntry
->FvFileDevicePath
;
337 OriginalFilePath
= FilePath
;
338 HandleFilePath
= FilePath
;
340 SecurityStatus
= EFI_SUCCESS
;
341 Status
= EFI_SUCCESS
;
342 AuthenticationStatus
= 0;
345 // Try to get the image device handle by checking the match protocol.
347 Status
= gBS
->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid
, &HandleFilePath
, &DeviceHandle
);
348 if (EFI_ERROR(Status
)) {
353 // If the Security2 and Security Architectural Protocol has not been located yet, then attempt to locate it
355 if (mSecurity2
== NULL
) {
356 gBS
->LocateProtocol (&gEfiSecurity2ArchProtocolGuid
, NULL
, (VOID
**)&mSecurity2
);
358 if (mSecurity
== NULL
) {
359 gBS
->LocateProtocol (&gEfiSecurityArchProtocolGuid
, NULL
, (VOID
**)&mSecurity
);
362 // When Security2 is installed, Security Architectural Protocol must be published.
364 ASSERT (mSecurity2
== NULL
|| mSecurity
!= NULL
);
367 // Pull out just the file portion of the DevicePath for the LoadedImage FilePath
369 FilePath
= OriginalFilePath
;
370 Status
= gBS
->HandleProtocol (DeviceHandle
, &gEfiDevicePathProtocolGuid
, (VOID
**)&HandleFilePath
);
371 if (!EFI_ERROR (Status
)) {
372 FilePathSize
= GetDevicePathSize (HandleFilePath
) - sizeof(EFI_DEVICE_PATH_PROTOCOL
);
373 FilePath
= (EFI_DEVICE_PATH_PROTOCOL
*) (((UINT8
*)FilePath
) + FilePathSize
);
377 // Try reading PE32 section firstly
379 Status
= Fv
->ReadSection (
386 &AuthenticationStatus
389 if (EFI_ERROR (Status
)) {
391 // Try reading TE section secondly
395 Status
= Fv
->ReadSection (
402 &AuthenticationStatus
406 if (EFI_ERROR (Status
)) {
407 if (Buffer
!= NULL
) {
408 gBS
->FreePool (Buffer
);
414 // Verify File Authentication through the Security2 Architectural Protocol
416 if (mSecurity2
!= NULL
) {
417 SecurityStatus
= mSecurity2
->FileAuthentication (
427 // Verify the Authentication Status through the Security Architectural Protocol
428 // Only on images that have been read using Firmware Volume protocol.
429 // All SMM images are from FV protocol.
431 if (!EFI_ERROR (SecurityStatus
) && (mSecurity
!= NULL
)) {
432 SecurityStatus
= mSecurity
->FileAuthenticationState (
434 AuthenticationStatus
,
439 if (EFI_ERROR (SecurityStatus
) && SecurityStatus
!= EFI_SECURITY_VIOLATION
) {
440 Status
= SecurityStatus
;
445 // Initialize ImageContext
447 ImageContext
.Handle
= Buffer
;
448 ImageContext
.ImageRead
= PeCoffLoaderImageReadFromMemory
;
451 // Get information about the image being loaded
453 Status
= PeCoffLoaderGetImageInfo (&ImageContext
);
454 if (EFI_ERROR (Status
)) {
455 if (Buffer
!= NULL
) {
456 gBS
->FreePool (Buffer
);
461 // if Loading module at Fixed Address feature is enabled, then cut out a memory range started from TESG BASE
462 // to hold the Smm driver code
464 if (PcdGet64(PcdLoadModuleAtFixAddressEnable
) != 0) {
466 // Get the fixed loading address assigned by Build tool
468 Status
= GetPeCoffImageFixLoadingAssignedAddress (&ImageContext
);
469 if (!EFI_ERROR (Status
)) {
471 // Since the memory range to load Smm core alreay been cut out, so no need to allocate and free this range
472 // following statements is to bypass SmmFreePages
475 DstBuffer
= (UINTN
)gLoadModuleAtFixAddressSmramBase
;
477 DEBUG ((EFI_D_INFO
|EFI_D_LOAD
, "LOADING MODULE FIXED ERROR: Failed to load module at fixed address. \n"));
479 // allocate the memory to load the SMM driver
481 PageCount
= (UINTN
)EFI_SIZE_TO_PAGES((UINTN
)ImageContext
.ImageSize
+ ImageContext
.SectionAlignment
);
482 DstBuffer
= (UINTN
)(-1);
484 Status
= SmmAllocatePages (
486 EfiRuntimeServicesCode
,
490 if (EFI_ERROR (Status
)) {
491 if (Buffer
!= NULL
) {
492 gBS
->FreePool (Buffer
);
496 ImageContext
.ImageAddress
= (EFI_PHYSICAL_ADDRESS
)DstBuffer
;
499 PageCount
= (UINTN
)EFI_SIZE_TO_PAGES((UINTN
)ImageContext
.ImageSize
+ ImageContext
.SectionAlignment
);
500 DstBuffer
= (UINTN
)(-1);
502 Status
= SmmAllocatePages (
504 EfiRuntimeServicesCode
,
508 if (EFI_ERROR (Status
)) {
509 if (Buffer
!= NULL
) {
510 gBS
->FreePool (Buffer
);
515 ImageContext
.ImageAddress
= (EFI_PHYSICAL_ADDRESS
)DstBuffer
;
518 // Align buffer on section boundry
520 ImageContext
.ImageAddress
+= ImageContext
.SectionAlignment
- 1;
521 ImageContext
.ImageAddress
&= ~(ImageContext
.SectionAlignment
- 1);
524 // Load the image to our new buffer
526 Status
= PeCoffLoaderLoadImage (&ImageContext
);
527 if (EFI_ERROR (Status
)) {
528 if (Buffer
!= NULL
) {
529 gBS
->FreePool (Buffer
);
531 SmmFreePages (DstBuffer
, PageCount
);
536 // Relocate the image in our new buffer
538 Status
= PeCoffLoaderRelocateImage (&ImageContext
);
539 if (EFI_ERROR (Status
)) {
540 if (Buffer
!= NULL
) {
541 gBS
->FreePool (Buffer
);
543 SmmFreePages (DstBuffer
, PageCount
);
548 // Flush the instruction cache so the image data are written before we execute it
550 InvalidateInstructionCacheRange ((VOID
*)(UINTN
) ImageContext
.ImageAddress
, (UINTN
) ImageContext
.ImageSize
);
553 // Save Image EntryPoint in DriverEntry
555 DriverEntry
->ImageEntryPoint
= ImageContext
.EntryPoint
;
556 DriverEntry
->ImageBuffer
= DstBuffer
;
557 DriverEntry
->NumberOfPage
= PageCount
;
560 // Allocate a Loaded Image Protocol in EfiBootServicesData
562 Status
= gBS
->AllocatePool (EfiBootServicesData
, sizeof (EFI_LOADED_IMAGE_PROTOCOL
), (VOID
**)&DriverEntry
->LoadedImage
);
563 if (EFI_ERROR (Status
)) {
564 if (Buffer
!= NULL
) {
565 gBS
->FreePool (Buffer
);
567 SmmFreePages (DstBuffer
, PageCount
);
572 // Fill in the remaining fields of the Loaded Image Protocol instance.
573 // Note: ImageBase is an SMRAM address that can not be accessed outside of SMRAM if SMRAM window is closed.
575 DriverEntry
->LoadedImage
->Revision
= EFI_LOADED_IMAGE_PROTOCOL_REVISION
;
576 DriverEntry
->LoadedImage
->ParentHandle
= gSmmCorePrivate
->SmmIplImageHandle
;
577 DriverEntry
->LoadedImage
->SystemTable
= gST
;
578 DriverEntry
->LoadedImage
->DeviceHandle
= DeviceHandle
;
581 // Make an EfiBootServicesData buffer copy of FilePath
583 Status
= gBS
->AllocatePool (EfiBootServicesData
, GetDevicePathSize (FilePath
), (VOID
**)&DriverEntry
->LoadedImage
->FilePath
);
584 if (EFI_ERROR (Status
)) {
585 if (Buffer
!= NULL
) {
586 gBS
->FreePool (Buffer
);
588 SmmFreePages (DstBuffer
, PageCount
);
591 CopyMem (DriverEntry
->LoadedImage
->FilePath
, FilePath
, GetDevicePathSize (FilePath
));
593 DriverEntry
->LoadedImage
->ImageBase
= (VOID
*)(UINTN
)DriverEntry
->ImageBuffer
;
594 DriverEntry
->LoadedImage
->ImageSize
= ImageContext
.ImageSize
;
595 DriverEntry
->LoadedImage
->ImageCodeType
= EfiRuntimeServicesCode
;
596 DriverEntry
->LoadedImage
->ImageDataType
= EfiRuntimeServicesData
;
599 // Create a new image handle in the UEFI handle database for the SMM Driver
601 DriverEntry
->ImageHandle
= NULL
;
602 Status
= gBS
->InstallMultipleProtocolInterfaces (
603 &DriverEntry
->ImageHandle
,
604 &gEfiLoadedImageProtocolGuid
, DriverEntry
->LoadedImage
,
608 PERF_START (DriverEntry
->ImageHandle
, "LoadImage:", NULL
, Tick
);
609 PERF_END (DriverEntry
->ImageHandle
, "LoadImage:", NULL
, 0);
612 // Print the load address and the PDB file name if it is available
619 CHAR8 EfiFileName
[256];
622 DEBUG ((DEBUG_INFO
| DEBUG_LOAD
,
623 "Loading SMM driver at 0x%11p EntryPoint=0x%11p ",
624 (VOID
*)(UINTN
) ImageContext
.ImageAddress
,
625 FUNCTION_ENTRY_POINT (ImageContext
.EntryPoint
)));
629 // Print Module Name by Pdb file path.
630 // Windows and Unix style file path are all trimmed correctly.
632 if (ImageContext
.PdbPointer
!= NULL
) {
634 for (Index
= 0; ImageContext
.PdbPointer
[Index
] != 0; Index
++) {
635 if ((ImageContext
.PdbPointer
[Index
] == '\\') || (ImageContext
.PdbPointer
[Index
] == '/')) {
636 StartIndex
= Index
+ 1;
640 // Copy the PDB file name to our temporary string, and replace .pdb with .efi
641 // The PDB file name is limited in the range of 0~255.
642 // If the length is bigger than 255, trim the redudant characters to avoid overflow in array boundary.
644 for (Index
= 0; Index
< sizeof (EfiFileName
) - 4; Index
++) {
645 EfiFileName
[Index
] = ImageContext
.PdbPointer
[Index
+ StartIndex
];
646 if (EfiFileName
[Index
] == 0) {
647 EfiFileName
[Index
] = '.';
649 if (EfiFileName
[Index
] == '.') {
650 EfiFileName
[Index
+ 1] = 'e';
651 EfiFileName
[Index
+ 2] = 'f';
652 EfiFileName
[Index
+ 3] = 'i';
653 EfiFileName
[Index
+ 4] = 0;
658 if (Index
== sizeof (EfiFileName
) - 4) {
659 EfiFileName
[Index
] = 0;
661 DEBUG ((DEBUG_INFO
| DEBUG_LOAD
, "%a", EfiFileName
)); // &Image->ImageContext.PdbPointer[StartIndex]));
663 DEBUG ((DEBUG_INFO
| DEBUG_LOAD
, "\n"));
668 // Free buffer allocated by Fv->ReadSection.
670 // The UEFI Boot Services FreePool() function must be used because Fv->ReadSection
671 // used the UEFI Boot Services AllocatePool() function
673 Status
= gBS
->FreePool(Buffer
);
678 Preprocess dependency expression and update DriverEntry to reflect the
679 state of Before and After dependencies. If DriverEntry->Before
680 or DriverEntry->After is set it will never be cleared.
682 @param DriverEntry DriverEntry element to update .
684 @retval EFI_SUCCESS It always works.
689 IN EFI_SMM_DRIVER_ENTRY
*DriverEntry
694 Iterator
= DriverEntry
->Depex
;
695 DriverEntry
->Dependent
= TRUE
;
697 if (*Iterator
== EFI_DEP_BEFORE
) {
698 DriverEntry
->Before
= TRUE
;
699 } else if (*Iterator
== EFI_DEP_AFTER
) {
700 DriverEntry
->After
= TRUE
;
703 if (DriverEntry
->Before
|| DriverEntry
->After
) {
704 CopyMem (&DriverEntry
->BeforeAfterGuid
, Iterator
+ 1, sizeof (EFI_GUID
));
711 Read Depex and pre-process the Depex for Before and After. If Section Extraction
712 protocol returns an error via ReadSection defer the reading of the Depex.
714 @param DriverEntry Driver to work on.
716 @retval EFI_SUCCESS Depex read and preprossesed
717 @retval EFI_PROTOCOL_ERROR The section extraction protocol returned an error
718 and Depex reading needs to be retried.
719 @retval Error DEPEX not found.
723 SmmGetDepexSectionAndPreProccess (
724 IN EFI_SMM_DRIVER_ENTRY
*DriverEntry
728 EFI_SECTION_TYPE SectionType
;
729 UINT32 AuthenticationStatus
;
730 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
732 Fv
= DriverEntry
->Fv
;
735 // Grab Depex info, it will never be free'ed.
736 // (Note: DriverEntry->Depex is in DXE memory)
738 SectionType
= EFI_SECTION_SMM_DEPEX
;
739 Status
= Fv
->ReadSection (
741 &DriverEntry
->FileName
,
745 (UINTN
*)&DriverEntry
->DepexSize
,
746 &AuthenticationStatus
748 if (EFI_ERROR (Status
)) {
749 if (Status
== EFI_PROTOCOL_ERROR
) {
751 // The section extraction protocol failed so set protocol error flag
753 DriverEntry
->DepexProtocolError
= TRUE
;
756 // If no Depex assume depend on all architectural protocols
758 DriverEntry
->Depex
= NULL
;
759 DriverEntry
->Dependent
= TRUE
;
760 DriverEntry
->DepexProtocolError
= FALSE
;
764 // Set Before and After state information based on Depex
765 // Driver will be put in Dependent state
767 SmmPreProcessDepex (DriverEntry
);
768 DriverEntry
->DepexProtocolError
= FALSE
;
775 This is the main Dispatcher for SMM and it exits when there are no more
776 drivers to run. Drain the mScheduledQueue and load and start a PE
777 image for each driver. Search the mDiscoveredList to see if any driver can
778 be placed on the mScheduledQueue. If no drivers are placed on the
779 mScheduledQueue exit the function.
781 @retval EFI_SUCCESS All of the SMM Drivers that could be dispatched
782 have been run and the SMM Entry Point has been
784 @retval EFI_NOT_READY The SMM Driver that registered the SMM Entry Point
786 @retval EFI_NOT_FOUND There are no SMM Drivers available to be dispatched.
787 @retval EFI_ALREADY_STARTED The SMM Dispatcher is already running
797 EFI_SMM_DRIVER_ENTRY
*DriverEntry
;
799 BOOLEAN PreviousSmmEntryPointRegistered
;
801 if (!gRequestDispatch
) {
802 return EFI_NOT_FOUND
;
805 if (gDispatcherRunning
) {
807 // If the dispatcher is running don't let it be restarted.
809 return EFI_ALREADY_STARTED
;
812 gDispatcherRunning
= TRUE
;
816 // Drain the Scheduled Queue
818 while (!IsListEmpty (&mScheduledQueue
)) {
820 mScheduledQueue
.ForwardLink
,
821 EFI_SMM_DRIVER_ENTRY
,
823 EFI_SMM_DRIVER_ENTRY_SIGNATURE
827 // Load the SMM Driver image into memory. If the Driver was transitioned from
828 // Untrused to Scheduled it would have already been loaded so we may need to
829 // skip the LoadImage
831 if (DriverEntry
->ImageHandle
== NULL
) {
832 Status
= SmmLoadImage (DriverEntry
);
835 // Update the driver state to reflect that it's been loaded
837 if (EFI_ERROR (Status
)) {
839 // The SMM Driver could not be loaded, and do not attempt to load or start it again.
840 // Take driver from Scheduled to Initialized.
842 DriverEntry
->Initialized
= TRUE
;
843 DriverEntry
->Scheduled
= FALSE
;
844 RemoveEntryList (&DriverEntry
->ScheduledLink
);
847 // If it's an error don't try the StartImage
853 DriverEntry
->Scheduled
= FALSE
;
854 DriverEntry
->Initialized
= TRUE
;
855 RemoveEntryList (&DriverEntry
->ScheduledLink
);
857 REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
859 EFI_SOFTWARE_SMM_DRIVER
| EFI_SW_PC_INIT_BEGIN
,
860 &DriverEntry
->ImageHandle
,
861 sizeof (DriverEntry
->ImageHandle
)
865 // Cache state of SmmEntryPointRegistered before calling entry point
867 PreviousSmmEntryPointRegistered
= gSmmCorePrivate
->SmmEntryPointRegistered
;
870 // For each SMM driver, pass NULL as ImageHandle
872 PERF_START (DriverEntry
->ImageHandle
, "StartImage:", NULL
, 0);
873 Status
= ((EFI_IMAGE_ENTRY_POINT
)(UINTN
)DriverEntry
->ImageEntryPoint
)(DriverEntry
->ImageHandle
, gST
);
874 PERF_END (DriverEntry
->ImageHandle
, "StartImage:", NULL
, 0);
875 if (EFI_ERROR(Status
)){
876 SmmFreePages(DriverEntry
->ImageBuffer
, DriverEntry
->NumberOfPage
);
879 REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
881 EFI_SOFTWARE_SMM_DRIVER
| EFI_SW_PC_INIT_END
,
882 &DriverEntry
->ImageHandle
,
883 sizeof (DriverEntry
->ImageHandle
)
886 if (!PreviousSmmEntryPointRegistered
&& gSmmCorePrivate
->SmmEntryPointRegistered
) {
888 // Return immediately if the SMM Entry Point was registered by the SMM
889 // Driver that was just dispatched. The SMM IPL will reinvoke the SMM
890 // Core Dispatcher. This is required so SMM Mode may be enabled as soon
891 // as all the dependent SMM Drivers for SMM Mode have been dispatched.
892 // Once the SMM Entry Point has been registered, then SMM Mode will be
895 gRequestDispatch
= TRUE
;
896 gDispatcherRunning
= FALSE
;
897 return EFI_NOT_READY
;
902 // Search DriverList for items to place on Scheduled Queue
905 for (Link
= mDiscoveredList
.ForwardLink
; Link
!= &mDiscoveredList
; Link
= Link
->ForwardLink
) {
906 DriverEntry
= CR (Link
, EFI_SMM_DRIVER_ENTRY
, Link
, EFI_SMM_DRIVER_ENTRY_SIGNATURE
);
908 if (DriverEntry
->DepexProtocolError
){
910 // If Section Extraction Protocol did not let the Depex be read before retry the read
912 Status
= SmmGetDepexSectionAndPreProccess (DriverEntry
);
915 if (DriverEntry
->Dependent
) {
916 if (SmmIsSchedulable (DriverEntry
)) {
917 SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry
);
922 } while (ReadyToRun
);
925 // If there is no more SMM driver to dispatch, stop the dispatch request
927 gRequestDispatch
= FALSE
;
928 for (Link
= mDiscoveredList
.ForwardLink
; Link
!= &mDiscoveredList
; Link
= Link
->ForwardLink
) {
929 DriverEntry
= CR (Link
, EFI_SMM_DRIVER_ENTRY
, Link
, EFI_SMM_DRIVER_ENTRY_SIGNATURE
);
931 if (!DriverEntry
->Initialized
){
933 // We have SMM driver pending to dispatch
935 gRequestDispatch
= TRUE
;
940 gDispatcherRunning
= FALSE
;
946 Insert InsertedDriverEntry onto the mScheduledQueue. To do this you
947 must add any driver with a before dependency on InsertedDriverEntry first.
948 You do this by recursively calling this routine. After all the Befores are
949 processed you can add InsertedDriverEntry to the mScheduledQueue.
950 Then you can add any driver with an After dependency on InsertedDriverEntry
951 by recursively calling this routine.
953 @param InsertedDriverEntry The driver to insert on the ScheduledLink Queue
957 SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
958 IN EFI_SMM_DRIVER_ENTRY
*InsertedDriverEntry
962 EFI_SMM_DRIVER_ENTRY
*DriverEntry
;
965 // Process Before Dependency
967 for (Link
= mDiscoveredList
.ForwardLink
; Link
!= &mDiscoveredList
; Link
= Link
->ForwardLink
) {
968 DriverEntry
= CR(Link
, EFI_SMM_DRIVER_ENTRY
, Link
, EFI_SMM_DRIVER_ENTRY_SIGNATURE
);
969 if (DriverEntry
->Before
&& DriverEntry
->Dependent
&& DriverEntry
!= InsertedDriverEntry
) {
970 DEBUG ((DEBUG_DISPATCH
, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry
->FileName
));
971 DEBUG ((DEBUG_DISPATCH
, " BEFORE FFS(%g) = ", &DriverEntry
->BeforeAfterGuid
));
972 if (CompareGuid (&InsertedDriverEntry
->FileName
, &DriverEntry
->BeforeAfterGuid
)) {
974 // Recursively process BEFORE
976 DEBUG ((DEBUG_DISPATCH
, "TRUE\n END\n RESULT = TRUE\n"));
977 SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry
);
979 DEBUG ((DEBUG_DISPATCH
, "FALSE\n END\n RESULT = FALSE\n"));
985 // Convert driver from Dependent to Scheduled state
988 InsertedDriverEntry
->Dependent
= FALSE
;
989 InsertedDriverEntry
->Scheduled
= TRUE
;
990 InsertTailList (&mScheduledQueue
, &InsertedDriverEntry
->ScheduledLink
);
994 // Process After Dependency
996 for (Link
= mDiscoveredList
.ForwardLink
; Link
!= &mDiscoveredList
; Link
= Link
->ForwardLink
) {
997 DriverEntry
= CR(Link
, EFI_SMM_DRIVER_ENTRY
, Link
, EFI_SMM_DRIVER_ENTRY_SIGNATURE
);
998 if (DriverEntry
->After
&& DriverEntry
->Dependent
&& DriverEntry
!= InsertedDriverEntry
) {
999 DEBUG ((DEBUG_DISPATCH
, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry
->FileName
));
1000 DEBUG ((DEBUG_DISPATCH
, " AFTER FFS(%g) = ", &DriverEntry
->BeforeAfterGuid
));
1001 if (CompareGuid (&InsertedDriverEntry
->FileName
, &DriverEntry
->BeforeAfterGuid
)) {
1003 // Recursively process AFTER
1005 DEBUG ((DEBUG_DISPATCH
, "TRUE\n END\n RESULT = TRUE\n"));
1006 SmmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry
);
1008 DEBUG ((DEBUG_DISPATCH
, "FALSE\n END\n RESULT = FALSE\n"));
1015 Return TRUE if the Fv has been processed, FALSE if not.
1017 @param FvHandle The handle of a FV that's being tested
1019 @retval TRUE Fv protocol on FvHandle has been processed
1020 @retval FALSE Fv protocol on FvHandle has not yet been
1025 FvHasBeenProcessed (
1026 IN EFI_HANDLE FvHandle
1030 KNOWN_HANDLE
*KnownHandle
;
1032 for (Link
= mFvHandleList
.ForwardLink
; Link
!= &mFvHandleList
; Link
= Link
->ForwardLink
) {
1033 KnownHandle
= CR(Link
, KNOWN_HANDLE
, Link
, KNOWN_HANDLE_SIGNATURE
);
1034 if (KnownHandle
->Handle
== FvHandle
) {
1042 Remember that Fv protocol on FvHandle has had it's drivers placed on the
1043 mDiscoveredList. This fucntion adds entries on the mFvHandleList. Items are
1044 never removed/freed from the mFvHandleList.
1046 @param FvHandle The handle of a FV that has been processed
1050 FvIsBeingProcesssed (
1051 IN EFI_HANDLE FvHandle
1054 KNOWN_HANDLE
*KnownHandle
;
1056 KnownHandle
= AllocatePool (sizeof (KNOWN_HANDLE
));
1057 ASSERT (KnownHandle
!= NULL
);
1059 KnownHandle
->Signature
= KNOWN_HANDLE_SIGNATURE
;
1060 KnownHandle
->Handle
= FvHandle
;
1061 InsertTailList (&mFvHandleList
, &KnownHandle
->Link
);
1065 Convert FvHandle and DriverName into an EFI device path
1067 @param Fv Fv protocol, needed to read Depex info out of
1069 @param FvHandle Handle for Fv, needed in the
1070 EFI_SMM_DRIVER_ENTRY so that the PE image can be
1071 read out of the FV at a later time.
1072 @param DriverName Name of driver to add to mDiscoveredList.
1074 @return Pointer to device path constructed from FvHandle and DriverName
1077 EFI_DEVICE_PATH_PROTOCOL
*
1079 IN EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
,
1080 IN EFI_HANDLE FvHandle
,
1081 IN EFI_GUID
*DriverName
1085 EFI_DEVICE_PATH_PROTOCOL
*FvDevicePath
;
1086 EFI_DEVICE_PATH_PROTOCOL
*FileNameDevicePath
;
1089 // Remember the device path of the FV
1091 Status
= gBS
->HandleProtocol (FvHandle
, &gEfiDevicePathProtocolGuid
, (VOID
**)&FvDevicePath
);
1092 if (EFI_ERROR (Status
)) {
1093 FileNameDevicePath
= NULL
;
1096 // Build a device path to the file in the FV to pass into gBS->LoadImage
1098 EfiInitializeFwVolDevicepathNode (&mFvDevicePath
.File
, DriverName
);
1099 SetDevicePathEndNode (&mFvDevicePath
.End
);
1102 // Note: FileNameDevicePath is in DXE memory
1104 FileNameDevicePath
= AppendDevicePath (
1106 (EFI_DEVICE_PATH_PROTOCOL
*)&mFvDevicePath
1109 return FileNameDevicePath
;
1113 Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,
1114 and initilize any state variables. Read the Depex from the FV and store it
1115 in DriverEntry. Pre-process the Depex to set the Before and After state.
1116 The Discovered list is never free'ed and contains booleans that represent the
1117 other possible SMM driver states.
1119 @param Fv Fv protocol, needed to read Depex info out of
1121 @param FvHandle Handle for Fv, needed in the
1122 EFI_SMM_DRIVER_ENTRY so that the PE image can be
1123 read out of the FV at a later time.
1124 @param DriverName Name of driver to add to mDiscoveredList.
1126 @retval EFI_SUCCESS If driver was added to the mDiscoveredList.
1127 @retval EFI_ALREADY_STARTED The driver has already been started. Only one
1128 DriverName may be active in the system at any one
1133 SmmAddToDriverList (
1134 IN EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
,
1135 IN EFI_HANDLE FvHandle
,
1136 IN EFI_GUID
*DriverName
1139 EFI_SMM_DRIVER_ENTRY
*DriverEntry
;
1142 // Create the Driver Entry for the list. ZeroPool initializes lots of variables to
1145 DriverEntry
= AllocateZeroPool (sizeof (EFI_SMM_DRIVER_ENTRY
));
1146 ASSERT (DriverEntry
!= NULL
);
1148 DriverEntry
->Signature
= EFI_SMM_DRIVER_ENTRY_SIGNATURE
;
1149 CopyGuid (&DriverEntry
->FileName
, DriverName
);
1150 DriverEntry
->FvHandle
= FvHandle
;
1151 DriverEntry
->Fv
= Fv
;
1152 DriverEntry
->FvFileDevicePath
= SmmFvToDevicePath (Fv
, FvHandle
, DriverName
);
1154 SmmGetDepexSectionAndPreProccess (DriverEntry
);
1156 InsertTailList (&mDiscoveredList
, &DriverEntry
->Link
);
1157 gRequestDispatch
= TRUE
;
1163 This function is the main entry point for an SMM handler dispatch
1164 or communicate-based callback.
1166 Event notification that is fired every time a FV dispatch protocol is added.
1167 More than one protocol may have been added when this event is fired, so you
1168 must loop on SmmLocateHandle () to see how many protocols were added and
1169 do the following to each FV:
1170 If the Fv has already been processed, skip it. If the Fv has not been
1171 processed then mark it as being processed, as we are about to process it.
1172 Read the Fv and add any driver in the Fv to the mDiscoveredList.The
1173 mDiscoveredList is never free'ed and contains variables that define
1174 the other states the SMM driver transitions to..
1175 While you are at it read the A Priori file into memory.
1176 Place drivers in the A Priori list onto the mScheduledQueue.
1178 @param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
1179 @param Context Points to an optional handler context which was specified when the handler was registered.
1180 @param CommBuffer A pointer to a collection of data in memory that will
1181 be conveyed from a non-SMM environment into an SMM environment.
1182 @param CommBufferSize The size of the CommBuffer.
1189 SmmDriverDispatchHandler (
1190 IN EFI_HANDLE DispatchHandle
,
1191 IN CONST VOID
*Context
, OPTIONAL
1192 IN OUT VOID
*CommBuffer
, OPTIONAL
1193 IN OUT UINTN
*CommBufferSize OPTIONAL
1198 EFI_HANDLE
*HandleBuffer
;
1199 EFI_STATUS GetNextFileStatus
;
1200 EFI_STATUS SecurityStatus
;
1201 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
1202 EFI_DEVICE_PATH_PROTOCOL
*FvDevicePath
;
1203 EFI_HANDLE FvHandle
;
1206 EFI_FV_FILETYPE Type
;
1207 EFI_FV_FILE_ATTRIBUTES Attributes
;
1209 EFI_SMM_DRIVER_ENTRY
*DriverEntry
;
1210 EFI_GUID
*AprioriFile
;
1211 UINTN AprioriEntryCount
;
1214 UINT32 AuthenticationStatus
;
1217 HandleBuffer
= NULL
;
1218 Status
= gBS
->LocateHandleBuffer (
1220 &gEfiFirmwareVolume2ProtocolGuid
,
1225 if (EFI_ERROR (Status
)) {
1226 return EFI_NOT_FOUND
;
1229 for (Index
= 0; Index
< HandleCount
; Index
++) {
1230 FvHandle
= HandleBuffer
[Index
];
1232 if (FvHasBeenProcessed (FvHandle
)) {
1234 // This Fv has already been processed so lets skip it!
1240 // Since we are about to process this Fv mark it as processed.
1242 FvIsBeingProcesssed (FvHandle
);
1244 Status
= gBS
->HandleProtocol (FvHandle
, &gEfiFirmwareVolume2ProtocolGuid
, (VOID
**)&Fv
);
1245 if (EFI_ERROR (Status
)) {
1247 // FvHandle must have a Firmware Volume2 Protocol thus we should never get here.
1253 Status
= gBS
->HandleProtocol (FvHandle
, &gEfiDevicePathProtocolGuid
, (VOID
**)&FvDevicePath
);
1254 if (EFI_ERROR (Status
)) {
1256 // The Firmware volume doesn't have device path, can't be dispatched.
1262 // If the Security Architectural Protocol has not been located yet, then attempt to locate it
1264 if (mSecurity
== NULL
) {
1265 gBS
->LocateProtocol (&gEfiSecurityArchProtocolGuid
, NULL
, (VOID
**)&mSecurity
);
1269 // Evaluate the authentication status of the Firmware Volume through
1270 // Security Architectural Protocol
1272 if (mSecurity
!= NULL
) {
1273 SecurityStatus
= mSecurity
->FileAuthenticationState (
1278 if (SecurityStatus
!= EFI_SUCCESS
) {
1280 // Security check failed. The firmware volume should not be used for any purpose.
1287 // Discover Drivers in FV and add them to the Discovered Driver List.
1288 // Process EFI_FV_FILETYPE_SMM type and then EFI_FV_FILETYPE_COMBINED_SMM_DXE
1290 for (Index
= 0; Index
< sizeof (mSmmFileTypes
)/sizeof (EFI_FV_FILETYPE
); Index
++) {
1292 // Initialize the search key
1296 Type
= mSmmFileTypes
[Index
];
1297 GetNextFileStatus
= Fv
->GetNextFile (
1305 if (!EFI_ERROR (GetNextFileStatus
)) {
1306 SmmAddToDriverList (Fv
, FvHandle
, &NameGuid
);
1308 } while (!EFI_ERROR (GetNextFileStatus
));
1312 // Read the array of GUIDs from the Apriori file if it is present in the firmware volume
1313 // (Note: AprioriFile is in DXE memory)
1316 Status
= Fv
->ReadSection (
1321 (VOID
**)&AprioriFile
,
1323 &AuthenticationStatus
1325 if (!EFI_ERROR (Status
)) {
1326 AprioriEntryCount
= SizeOfBuffer
/ sizeof (EFI_GUID
);
1328 AprioriEntryCount
= 0;
1332 // Put drivers on Apriori List on the Scheduled queue. The Discovered List includes
1333 // drivers not in the current FV and these must be skipped since the a priori list
1334 // is only valid for the FV that it resided in.
1337 for (Index
= 0; Index
< AprioriEntryCount
; Index
++) {
1338 for (Link
= mDiscoveredList
.ForwardLink
; Link
!= &mDiscoveredList
; Link
= Link
->ForwardLink
) {
1339 DriverEntry
= CR(Link
, EFI_SMM_DRIVER_ENTRY
, Link
, EFI_SMM_DRIVER_ENTRY_SIGNATURE
);
1340 if (CompareGuid (&DriverEntry
->FileName
, &AprioriFile
[Index
]) &&
1341 (FvHandle
== DriverEntry
->FvHandle
)) {
1342 DriverEntry
->Dependent
= FALSE
;
1343 DriverEntry
->Scheduled
= TRUE
;
1344 InsertTailList (&mScheduledQueue
, &DriverEntry
->ScheduledLink
);
1345 DEBUG ((DEBUG_DISPATCH
, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry
->FileName
));
1346 DEBUG ((DEBUG_DISPATCH
, " RESULT = TRUE (Apriori)\n"));
1353 // Free data allocated by Fv->ReadSection ()
1355 // The UEFI Boot Services FreePool() function must be used because Fv->ReadSection
1356 // used the UEFI Boot Services AllocatePool() function
1358 gBS
->FreePool (AprioriFile
);
1362 // Execute the SMM Dispatcher on any newly discovered FVs and previously
1363 // discovered SMM drivers that have been discovered but not dispatched.
1365 Status
= SmmDispatcher ();
1368 // Check to see if CommBuffer and CommBufferSize are valid
1370 if (CommBuffer
!= NULL
&& CommBufferSize
!= NULL
) {
1371 if (*CommBufferSize
> 0) {
1372 if (Status
== EFI_NOT_READY
) {
1374 // If a the SMM Core Entry Point was just registered, then set flag to
1375 // request the SMM Dispatcher to be restarted.
1377 *(UINT8
*)CommBuffer
= COMM_BUFFER_SMM_DISPATCH_RESTART
;
1378 } else if (!EFI_ERROR (Status
)) {
1380 // Set the flag to show that the SMM Dispatcher executed without errors
1382 *(UINT8
*)CommBuffer
= COMM_BUFFER_SMM_DISPATCH_SUCCESS
;
1385 // Set the flag to show that the SMM Dispatcher encountered an error
1387 *(UINT8
*)CommBuffer
= COMM_BUFFER_SMM_DISPATCH_ERROR
;
1396 Traverse the discovered list for any drivers that were discovered but not loaded
1397 because the dependency experessions evaluated to false.
1401 SmmDisplayDiscoveredNotDispatched (
1406 EFI_SMM_DRIVER_ENTRY
*DriverEntry
;
1408 for (Link
= mDiscoveredList
.ForwardLink
;Link
!=&mDiscoveredList
; Link
= Link
->ForwardLink
) {
1409 DriverEntry
= CR(Link
, EFI_SMM_DRIVER_ENTRY
, Link
, EFI_SMM_DRIVER_ENTRY_SIGNATURE
);
1410 if (DriverEntry
->Dependent
) {
1411 DEBUG ((DEBUG_LOAD
, "SMM Driver %g was discovered but not loaded!!\n", &DriverEntry
->FileName
));