Before the event callback, all the drivers(include SMM drivers) share the same 
DXE SCRIPT_TABLE_PRIVATE_DATA instance, that means the instance pointed by 
mS3BootScriptTablePtr.
After the event callback, all the SMM drivers share the same SMM 
SCRIPT_TABLE_PRIVATE_DATA instance, that means the instance pointed by 
mS3BootScriptTableSmmPtr, and mS3BootScriptTablePtr also updated to equal to 
mS3BootScriptTableSmmPtr (in S3BootScriptSmmEventCallBack()).

And you may see the below code logic in S3BootScriptGetEntryAddAddress(), that 
is to say only SMM driver is allowed to write boot script after the event 
callback.
-------------------
  if (mS3BootScriptTablePtr->AtRuntime) {
    //
    // We need check InSmm when AtRuntime, because after SmmReadyToLock, only 
SMM driver is allowed to write boot script.
    //
    if (!mS3BootScriptTablePtr->InSmm) {
      //
      // Add DEBUG ERROR, so that we can find it at boot time.
      // Do not use ASSERT, because we may have test invoke this interface.
      //
      DEBUG ((EFI_D_ERROR, "FATAL ERROR: Set boot script after 
ReadyToLock!!!\n"));
      return NULL;
}
-------------------

Thanks,
Star
From: Andrew Fish [mailto:af...@apple.com]
Sent: Wednesday, April 1, 2015 12:22 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] MdeModulePkg Maintainer: The PiDxeS3BootScriptLib does not 
seem to set EFI_BOOT_SCRIPT_TABLE_HEADER.Version 
!mS3BootScriptTablePtr->AtRuntime


On Mar 31, 2015, at 8:44 PM, Zeng, Star 
<star.z...@intel.com<mailto:star.z...@intel.com>> wrote:

i Andrew,

After SmmReadyToLock, only SMM driver is allowed to write boot script. In DXE 
SCRIPT_TABLE_PRIVATE_DATA instance, only the TableBase field will be used for 
BootScriptExecute at S3 resume, other fields will be not used.
So the TableLength field in DXE SCRIPT_TABLE_PRIVATE_DATA instance could be set 
to 0  after SmmReadyToLock to say it will be not synced, or even the whole  DXE 
SCRIPT_TABLE_PRIVATE_DATA instance could be emptied as the TableBase field has 
been saved into lockbox and will be restored at S3 resume.


I’m still confused on how it works? The 1st driver to run (DXE or SMM) 
registers S3BootScriptEventCallBack() on gEfiDxeSmmReadyToLockProtocolGuid 
event. If !mS3BootScriptTablePtr->AtRuntime then the LockBox is updated. In my 
case this instance of the mS3BootScriptTablePtr had the incorrect length (too 
short).

The SMM drivers all register S3BootScriptSmmEventCallBack() on the 
gEfiSmmReadyToLockProtocolGuid event and this also calls 
S3BootScriptEventCallBack (NULL, NULL).

It still seems like the LockBox is updated as part of the boot process (calling 
the library APIs). S3BootScriptGetEntryAddAddress() calls 
S3BootScriptGetBootTimeEntryAddAddress() and the DXE driver version of 
SCRIPT_TABLE_PRIVATE_DATA. It seems if an SMM driver wrote a script entry, 
prior to the event callback, things could get out os sync? Can you only call 
the Library in SMM from locking events?


Thanks,


Andrew Fish


Thanks,
Star

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to