X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FCore%2FDxe%2FDispatcher%2FDispatcher.c;h=79b895bcfa68bb065044601c7284dbab264caf13;hb=6a55eea3eba088eaaad7c7f1f14580016c37406b;hp=6a18fe909e6d3e81ea322fad12754c017dd3ee67;hpb=6d9a0f280d49fd1000fa685ee1392f45ff998e69;p=mirror_edk2.git diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c index 6a18fe909e..79b895bcfa 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c @@ -26,8 +26,8 @@ Depex - Dependency Expresion. SOR - Schedule On Request - Don't schedule if this bit is set. -Copyright (c) 2006 - 2008, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -78,6 +78,7 @@ VOID *mFwVolEventRegistration; // EFI_FV_FILETYPE mDxeFileTypes[] = { EFI_FV_FILETYPE_DRIVER, + EFI_FV_FILETYPE_COMBINED_SMM_DXE, EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER, EFI_FV_FILETYPE_DXE_CORE, EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE @@ -332,9 +333,14 @@ CoreSchedule ( DriverEntry->Dependent = TRUE; CoreReleaseDispatcherLock (); + DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_SUCCESS\n", DriverName)); + return EFI_SUCCESS; } } + + DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_NOT_FOUND\n", DriverName)); + return EFI_NOT_FOUND; } @@ -386,6 +392,23 @@ CoreTrust ( } +/** + An empty function to pass error checking of CreateEventEx (). + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context, + which is implementation-dependent. + +**/ +VOID +EFIAPI +EmptyFuntion ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + return; +} /** This is the main Dispatcher for DXE and it exits when there are no more @@ -412,6 +435,8 @@ CoreDispatcher ( LIST_ENTRY *Link; EFI_CORE_DRIVER_ENTRY *DriverEntry; BOOLEAN ReadyToRun; + EFI_EVENT DxeDispatchEvent; + if (gDispatcherRunning) { // @@ -422,6 +447,17 @@ CoreDispatcher ( gDispatcherRunning = TRUE; + Status = CoreCreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + EmptyFuntion, + NULL, + &gEfiEventDxeDispatchGuid, + &DxeDispatchEvent + ); + if (EFI_ERROR (Status)) { + return Status; + } ReturnStatus = EFI_NOT_FOUND; do { @@ -496,7 +532,7 @@ CoreDispatcher ( REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( EFI_PROGRESS_CODE, - FixedPcdGet32(PcdStatusCodeValueDxeDriverBegin), + (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN), &DriverEntry->ImageHandle, sizeof (DriverEntry->ImageHandle) ); @@ -505,7 +541,7 @@ CoreDispatcher ( REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( EFI_PROGRESS_CODE, - FixedPcdGet32(PcdStatusCodeValueDxeDriverEnd), + (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END), &DriverEntry->ImageHandle, sizeof (DriverEntry->ImageHandle) ); @@ -513,6 +549,15 @@ CoreDispatcher ( ReturnStatus = EFI_SUCCESS; } + // + // Now DXE Dispatcher finished one round of dispatch, signal an event group + // so that SMM Dispatcher get chance to dispatch SMM Drivers which depend + // on UEFI protocols + // + if (!EFI_ERROR (ReturnStatus)) { + CoreSignalEvent (DxeDispatchEvent); + } + // // Search DriverList for items to place on Scheduled Queue // @@ -532,10 +577,21 @@ CoreDispatcher ( CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry); ReadyToRun = TRUE; } + } else { + if (DriverEntry->Unrequested) { + DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName)); + DEBUG ((DEBUG_DISPATCH, " SOR = Not Requested\n")); + DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE\n")); + } } } } while (ReadyToRun); + // + // Close DXE dispatch Event + // + CoreCloseEvent (DxeDispatchEvent); + gDispatcherRunning = FALSE; return ReturnStatus; @@ -566,12 +622,17 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter ( // for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) { DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE); - if (DriverEntry->Before && DriverEntry->Dependent) { + if (DriverEntry->Before && DriverEntry->Dependent && DriverEntry != InsertedDriverEntry) { + DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName)); + DEBUG ((DEBUG_DISPATCH, " BEFORE FFS(%g) = ", &DriverEntry->BeforeAfterGuid)); if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) { // // Recursively process BEFORE // + DEBUG ((DEBUG_DISPATCH, "TRUE\n END\n RESULT = TRUE\n")); CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry); + } else { + DEBUG ((DEBUG_DISPATCH, "FALSE\n END\n RESULT = FALSE\n")); } } } @@ -592,12 +653,17 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter ( // for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) { DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE); - if (DriverEntry->After && DriverEntry->Dependent) { + if (DriverEntry->After && DriverEntry->Dependent && DriverEntry != InsertedDriverEntry) { + DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName)); + DEBUG ((DEBUG_DISPATCH, " AFTER FFS(%g) = ", &DriverEntry->BeforeAfterGuid)); if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) { // // Recursively process AFTER // + DEBUG ((DEBUG_DISPATCH, "TRUE\n END\n RESULT = TRUE\n")); CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry); + } else { + DEBUG ((DEBUG_DISPATCH, "FALSE\n END\n RESULT = FALSE\n")); } } } @@ -971,10 +1037,9 @@ CoreFwVolEventProtocolNotify ( FvIsBeingProcesssed (FvHandle); Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || Fv == NULL) { // - // The Handle has a FirmwareVolumeDispatch protocol and should also contiain - // a FirmwareVolume protocol thus we should never get here. + // FvHandle must have Firmware Volume2 protocol thus we should never get here. // ASSERT (FALSE); continue; @@ -1095,23 +1160,24 @@ CoreFwVolEventProtocolNotify ( // drivers not in the current FV and these must be skipped since the a priori list // is only valid for the FV that it resided in. // - CoreAcquireDispatcherLock (); for (Index = 0; Index < AprioriEntryCount; Index++) { for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) { DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE); if (CompareGuid (&DriverEntry->FileName, &AprioriFile[Index]) && (FvHandle == DriverEntry->FvHandle)) { + CoreAcquireDispatcherLock (); DriverEntry->Dependent = FALSE; DriverEntry->Scheduled = TRUE; InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink); + CoreReleaseDispatcherLock (); + DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName)); + DEBUG ((DEBUG_DISPATCH, " RESULT = TRUE (Apriori)\n")); break; } } } - CoreReleaseDispatcherLock (); - // // Free data allocated by Fv->ReadSection () //