Re: [edk2] APRIORI Query

Subject: Re: [edk2] APRIORI Query

From: Andrew Fish <afish@apple.com>

To: edk2-devel@lists.sourceforge.net

Date: 2012-10-03 17:25:48



On Oct 3, 2012, at 8:53 AM, Tim Lewis wrote:

The dispatcher will dispatch all modules listed in the Apriori to the head of the dispatching queue.
 
I believe that the order of modules in the FDF itself has no guarantee with regard to execution order. Based on module alignment, for example, modules listed later may be fitted earlier in the actual generated firmware volume. The FDF merely guarantees that they will be placed in the firmware volume. And, of course, the dispatcher may choose any order it wishes to process modules in the FV.
 
A more reliable way of guaranteeing execution order is dependency expressions (it is more plug-and-play) and, in necessity, apriori.
 

As Tim points out you are better off using dependency expressions, but if a set of dependency expressions all evaluate to true then the order of dispatch is not defined in the PI spec. So in the example in the mail it looks like the author wanted the status code drivers to run as early as possible so that DEBUG prints would come out as early as possible in the boot. 

I don't see a reason for the PCD PEIM to be in the apriori file as the PeiPcdLib depends on the gEfiPeiPcdPpiGuid so dispatch order will always be correct.  
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
[Depex.common.PEIM]
  gEfiPeiPcdPpiGuid
I guess some one thought the PCD services should always be available so lets load them first. 

In general apriori is useful for debugging and logging. In the NT32Pkg example the DEBUG prints in the PeiCore and early PEIMs will go to the bit bucket until the report status code infrastructure is loaded, so the Apriori files is used to force the DEBUG print code to have priority. If you removed the Apriori file in the NT32Pkg example the system would still boot, but DEBUG prints might turn on later in the boot flow. 

The dispatchers are located here:
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c

This is all documented in the PI specifications @ www.uefi.org

Andrew

Tim
 
From: appireddy annapureddy [mailto:appi.ami11@gmail.com] 
Sent: Wednesday, October 03, 2012 8:08 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] APRIORI Query
 
Hi All,
 
I observed that some of the INF files like Pcd.inf, ReportStatusCodeRouterPei.inf etc are added in Apriori list as well as in regular dispatching list in fdf file .
what is the importance of adding same INF file twice and How does it affect the BIOS boot flow?
 
Copied from NT32Pkg.fdf:
APRIORI PEI {
  INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
  INF  MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
  INF  MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
  INF  Nt32Pkg/WinNtOemHookStatusCodeHandlerPei/WinNtOemHookStatusCodeHandlerPei.inf
  }
 
INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
INF  MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
INF  MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
INF  Nt32Pkg/WinNtOemHookStatusCodeHandlerPei/WinNtOemHookStatusCodeHandlerPei.inf
 
Please give your comments.
 
 
Thanks
Nitin
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel