[if gte mso 9]>

Re: [edk2] DXE Dispatch() Will Not Dispatch SMM drivers in certain cases

Subject: Re: [edk2] DXE Dispatch() Will Not Dispatch SMM drivers in certain cases

From: "Gao, Liming" <liming.gao@intel.com>

To: "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2013-08-23 10:37:49

Tim:

  I agree this is an issue. And, your solution is good. We will fix it.

 

Thanks

Liming

From: Tim Lewis [mailto:tim.lewis@insyde.com]
Sent: Thursday, August 22, 2013 12:44 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] DXE Dispatch() Will Not Dispatch SMM drivers in certain cases

 

We have discovered a case where Dispatch() will fail to dispatch pending SMM drivers. It happens when a FV contains only pending SMM drivers, but no pending DXE drivers and Dispatch() is called. The offending code is in CoreDispatcher()

 

CoreDispatcher ()
{
    ...
    ReturnStatus = EFI_NOT_FOUND;
    do {           // Dispatcher_Loop

     Dispatch DXE modules;
     if any module is dispatched, ReturnStatus is set to 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);           // trigger SMM dispatcher
    }
    ...
   }
   ...
  }
}

The existing logic only dispatches SMM modules if a DXE module was dispatched. This works well for most use cases, since there are always a mixture of DXE and SMM drivers. But in specialized FVs (or in some other specialized cases), if there are only SMM drivers, none will be launched. I believe the solution is to force the SMM dispatcher to run at least once, perhaps by using a BOOLEAN that is initially set to FALSE (SmmDriverDispatched) and then adding that as an || condition to the bolded line above.

 

Regards,

 

Tim