On 12/28/13 21:03, Laszlo Ersek wrote:
> https://github.com/lersek/edk2/commits/s3_v3
>
> v3:

> - Implement OVMF-specific LockBoxLib (on top of EmuNvramLib), rather
>   than emulating SMRAM for edk2's SMM-based LockBoxLib. Consequently,
>   don't pull in the SMM core and dependent SMM drivers, but rebase the
>   S3 machinery to the new LockBoxLib.

This is an excerpt from a logfile written while cold booting, suspending
and resuming a 8 GB guest. (Both PEI and DXE are X64.) Annotations are
to the right (column 124). The LockBox messages are logged by
[PATCH v3 09/24] OvmfPkg: implement LockBoxLib.

Cold boot:

  SecCoreStartupWithStack(0xFFFCC000, 0x80000)                                  
                                           #
                                                                                
                                           #
  PeiInstallPeiMemory MemoryBegin 0xDC000000, MemoryLength 0x4000000            
                                           #
  Reserved variable store memory: 0xDFFD0000; size: 128kb  <--+                 
                                           #
  Platform PEI Firmware Volume Initialization                 |                 
                                           #
  Firmware Volume HOB: 0x800000 0x800000  <-------------------|--+              
                                           # decompressed firmware
  Emulated NVRAM at 0x01400000, size 0x02100000  
<------------|--|--+--------------------+                                 # 
LockBox: 1MB, S3 Resume Pool: 32MB
  Install PPI: 7408D748-FC8C-4EE6-9288-C4BEC092A410           |  |  |           
         |                                 #
  Temp Stack : BaseAddress=0x78000 Length=0x8000  <-------+   |  |  |           
         |                                 #
  Temp Heap  : BaseAddress=0x70000 Length=0x8D8   <-------+   |  |  |           
         |                                 #
  Total temporary memory:    65536 bytes.                 |   |  |  |           
         |                                 #
    temporary memory stack ever used: 32768 bytes.        |   |  |  |           
         |                                 #
    temporary memory heap used:       2264 bytes.         |   |  |  |           
         |                                 #
  Old Stack size 32768, New stack size 131072             |   |  |  |           
         |                                 #
  Heap Offset = 0x0 Stack Offset = 0xDBFA0000             |   |  |  |           
         |                                 #
  Stack Hob: BaseAddress=0xDC000000 Length=0x20000        |   |  |  |           
         |                                 #
  TemporaryRamMigration(0x70000, 0xDC018000, 0x10000)     |   |  |  |           
         |                                 #
                                                          |   |  |  |           
         |                                 #
  DXE IPL Entry                                           |   |  |  |           
         |                                 #
                                                          |   |  |  |           
         |                                 #
  Memory Allocation 0x00000006 0xDFFD0000 - 0xDFFFFFFF  --|---+  |  |           
         |                                 # type 0x6 == EfiRuntimeServicesData
  Memory Allocation 0x0000000A 0x70000 - 0x7FFFF  --------+      |  |           
         |                                 # type 0xA == EfiACPIMemoryNVS
  Memory Allocation 0x0000000A 0x80000 - 0x85FFF                 |  |           
         |                                 # cover initial X64 page tables
  Memory Allocation 0x0000000A 0x800000 - 0xFFFFFF  -------------+  |           
         |                                 #
  Memory Allocation 0x0000000A 0x1000000 - 0x120FFFF                |           
         |                                 # temp/scratch buffers during fw 
decompr.
  Memory Allocation 0x0000000A 0x1400000 - 0x34FFFFF  --------------+           
         |                                 #
  Memory Allocation 0x00000004 0xDF868000 - 0xDF887FFF                          
         |                                 # type 0x4 == EfiBootServicesData
  Memory Allocation 0x00000004 0xDFFCF000 - 0xDFFCFFFF                          
         |                                 #
  Memory Allocation 0x00000004 0xDFFB8000 - 0xDFFCEFFF                          
         |                                 #
  Memory Allocation 0x00000004 0xDFFAE000 - 0xDFFB7FFF                          
         |                                 #
  Memory Allocation 0x00000004 0xDFFA3000 - 0xDFFADFFF                          
         |                                 #
  Memory Allocation 0x00000004 0xDF8C1000 - 0xDFFA2FFF                          
         |                                 #
  Memory Allocation 0x00000004 0xDF888000 - 0xDF8C0FFF                          
         |                                 #
  Memory Allocation 0x00000003 0xDF888000 - 0xDF8C0FFF                          
         |                                 # type 0x3 == EfiBootServicesCode
  Memory Allocation 0x00000004 0xDF868000 - 0xDF887FFF                          
         |                                 #
  Memory Allocation 0x00000004 0xDF826000 - 0xDF867FFF                          
         |                                 #
  Memory Allocation 0x00000004 0xDC000000 - 0xDC01FFFF                          
         |                                 #
                                                                                
         |                                 #
  S3Ready!                                                                      
         |                                 # BdsLibBootViaBootOption() -> 
S3Ready()
                                                                                
         |                                 #
  SaveLockBox: Guid=DEA652B0-D587-4C54-B5B4-C682E7A0AA3D Buffer=DF817000 
Length=0xA  <-+-|-----------------------+         # mAcpiS3IdtrProfileGuid; 
source buffer in EfiReservedMemoryType
  SetLockBoxAttributes: Guid=DEA652B0-D587-4C54-B5B4-C682E7A0AA3D 
Attributes=0x1       | |                       |         # 
LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE
                                                                                
       | |                       |         #
  AcpiS3Context: AcpiFacsTable is 0xDF823000  
<----------------------------------------|-|-------------------+   |         #
  AcpiS3Context: IdtrProfile is 0xDF817000  
-------------------------------------------+ |                   |   |         #
  AcpiS3Context: S3NvsPageTableAddress is 0x       0                            
         |                   |   |         #
  AcpiS3Context: S3DebugBufferAddress is 0xDF815000  
<-----------------------------------|-------------------|-+ |         # debug 
buffer in EfiReservedMemoryType
                                                                                
         |                   | | |         #
  SaveLockBox: Guid=AF9FFD67-EC10-488A-9DFC-6CBF5EE22C2E Buffer=DF887BA8 
Length=0x8  <---|-------+           | | |         # gEfiAcpiVariableGuid, 
Buffer points to pointer to AcpiS3Context
                                                                                
         |       |           | | |         #
  SaveLockBox: Guid=0EF98D3A-3E33-497A-A401-77BE3EB74F38 Buffer=DF818000 
Length=0x30  <--|-------|-+         | | |         # gEfiAcpiS3ContextGuid, 
Buffer points to AcpiS3Context (in EfiReservedMemoryType)
  SetLockBoxAttributes: Guid=0EF98D3A-3E33-497A-A401-77BE3EB74F38 
Attributes=0x1         |       | |         | | |         # 
LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE
                                                                                
         |       | |         | | |         #
  SaveLockBox: Guid=3079818C-46D4-4A73-AEF3-E3E46CF1EEDB Buffer=DF8877C0 
Length=0x8  <---|-------|-|-+       | | |         # 
gEfiBootScriptExecutorVariableGuid, Buffer points to pointer to 
EfiBootScriptExecutorVariable
                                                                                
         |       | | |       | | |         #
  SaveLockBox: Guid=79CB58C4-AC51-442F-AFD7-98E47D2E9908 Buffer=DC8D1000 
Length=0x8  <---|-------|-|-|-+     | | |         # 
gEfiBootScriptExecutorContextGuid, Buffer points to 
EfiBootScriptExecutorVariable (in EfiReservedMemoryType)
  SetLockBoxAttributes: Guid=79CB58C4-AC51-442F-AFD7-98E47D2E9908 
Attributes=0x1         |       | | | |     | | |         # 
LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE
                                                                                
         |       | | | |     | | |         #
  SaveLockBox: Guid=9A8D3433-9FE8-42B6-870B-1E31C84EBE3B Buffer=DC8D2000 
Length=0x17D40  | <-----|-|-|-|-----|-|-|-+       # 
mBootScriptExecutorImageGuid, Buffer points to image relocated to 
EfiReservedMemoryType
  SetLockBoxAttributes: Guid=9A8D3433-9FE8-42B6-870B-1E31C84EBE3B 
Attributes=0x1         |       | | | |     | | | |       # 
LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE
                                                                                
         |       | | | |     | | | |       #
  SaveLockBox: Guid=AEA6B965-DCF5-4311-B4B8-0F12464494D2 Buffer=DD7A4000 
Length=0x58D4 <-|-------|-|-|-|-----|-|-|-|-+     # mBootScriptDataGuid, Buffer 
points to script in EfiACPIMemoryNVS
  SetLockBoxAttributes: Guid=AEA6B965-DCF5-4311-B4B8-0F12464494D2 
Attributes=0x1         |       | | | |     | | | | |     # 
LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE
                                                                                
         |       | | | |     | | | | |     #
  SaveLockBox: Guid=B5AF1D7A-B8CF-4EB3-8925-A820E16B687D Buffer=DD7A4000 
Length=0x58D4   |       | | | |     | | | | |     # mBootScriptDataOrgGuid, 
duplicate of boot script
                                                                                
         |       | | | |     | | | | |     #
  SaveLockBox: Guid=1810AB4A-2314-4DF6-81EB-67C6EC058591 Buffer=DF824000 
Length=0x8  <---|-------|-|-|-|-----|-|-|-|-|-+   # mBootScriptHeaderDataGuid, 
Buffer points to pointer to boot script
  SetLockBoxAttributes: Guid=1810AB4A-2314-4DF6-81EB-67C6EC058591 
Attributes=0x1         |       | | | |     | | | | | |   # 
LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE
                                                                                
         |       | | | |     | | | | | |   #
  Booting fedora 19 shim                                                        
         |       | | | |     | | | | | |   #
                                                                                
         |       | | | |     | | | | | |
S3 Resume:                                                                      
         |       | | | |     | | | | | |
                                                                                
         |       | | | |     | | | | | |
  SecCoreStartupWithStack(0xFFFCC000, 0x80000)                                  
         |       | | | |     | | | | | |   #
                                                                                
         |       | | | |     | | | | | |   #
  PeiInstallPeiMemory MemoryBegin 0x1500000, MemoryLength 0x2000000  
--------------------+ <-+-+-|-|-|-|-----|-|-|-|-|-|-+ # == S3 Resume Pool
  Platform PEI Firmware Volume Initialization                                   
             | | | | | |     | | | | | | | #
  Firmware Volume HOB: 0x800000 0x800000  
<------------------------------------------------+ | | | | | |     | | | | | | 
| # decompressed firmware
  Install PPI: 7408D748-FC8C-4EE6-9288-C4BEC092A410                             
           | | | | | | |     | | | | | | | #
  Temp Stack : BaseAddress=0x78000 Length=0x8000  
<--------------------------------------+ | | | | | | |     | | | | | | | #
  Temp Heap  : BaseAddress=0x70000 Length=0x878   
<--------------------------------------+ | | | | | | |     | | | | | | | #
  Total temporary memory:    65536 bytes.                                       
         | | | | | | | |     | | | | | | | #
    temporary memory stack ever used: 32768 bytes.                              
         | | | | | | | |     | | | | | | | #
    temporary memory heap used:       2168 bytes.                               
         | | | | | | | |     | | | | | | | #
  Old Stack size 32768, New stack size 131072                                   
         | | | | | | | |     | | | | | | | #
  Heap Offset = 0x0 Stack Offset = 0x14A0000                                    
         | | | | | | | |     | | | | | | | #
  Stack Hob: BaseAddress=0x1500000 Length=0x20000  
<-------------------------------------|-|-+ | | | | |     | | | | | | | #
  TemporaryRamMigration(0x70000, 0x1518000, 0x10000)                            
         | | | | | | | |     | | | | | | | #
                                                                                
         | | | | | | | |     | | | | | | | #
  DXE IPL Entry                                                                 
         | | | | | | | |     | | | | | | | #
  Enter S3 PEIM                                                                 
         | | | | | | | |     | | | | | | | #
                                                                                
         | | | | | | | |     | | | | | | |
The following "Memory Allocation" (HOB) lines are dumped by a debug             
         | | | | | | | |     | | | | | | |
patch at the beginning of S3RestoreConfig2():                                   
         | | | | | | | |     | | | | | | |
                                                                                
         | | | | | | | |     | | | | | | |
  Memory Allocation 00000000-0000-0000-0000-000000000000 0x0000000A 0x70000 - 
0x7FFFF  --+ | | | | | | |     | | | | | | | # type 0xA == EfiACPIMemoryNVS
  Memory Allocation 00000000-0000-0000-0000-000000000000 0x0000000A 0x80000 - 
0x85FFF      | | | | | | |     | | | | | | | # cover initial X64 page tables
  Memory Allocation 00000000-0000-0000-0000-000000000000 0x0000000A 0x800000 - 
0xFFFFFF  --+ | | | | | |     | | | | | | | #
  Memory Allocation 00000000-0000-0000-0000-000000000000 0x0000000A 0x1000000 - 
0x120FFFF    | | | | | |     | | | | | | | # temp/scratch buffers during fw 
decompr.
  Memory Allocation 4ED4BF27-4092-42E9-807D-527B1D00C9BD 0x00000004 0x1500000 - 
0x151FFFF  --+ | | | | |     | | | | | | | # gEfiHobMemoryAllocStackGuid, type 
0x4 == EfiBootServicesData
  Memory Allocation 00000000-0000-0000-0000-000000000000 0x00000004 0x2E1E000 - 
0x34FFFFF  ----+ | | | |     | | | | | | | #
                                                                                
                 | | | |     | | | | | | |
Normal log again:                                                               
                 | | | |     | | | | | | |
                                                                                
                 | | | |     | | | | | | |
  RestoreLockBox: Guid=AF9FFD67-EC10-488A-9DFC-6CBF5EE22C2E Buffer=7C6C8  
-----------------------+ | | | <-+ | | | | | | | # loads address of 
AcpiS3Context into variable on temp stack
  RestoreLockBox: Guid=0EF98D3A-3E33-497A-A401-77BE3EB74F38 Buffer=DF818000  
----------------------+ | | <-+ | | | | | | | # restores AcpiS3Context in-place
  RestoreLockBox: Guid=3079818C-46D4-4A73-AEF3-E3E46CF1EEDB Buffer=7C6D0  
-------------------------|-+ |   | | | | | | | | # loads address of 
EfiBootScriptExecutorVariable into variable on temp stack
  RestoreLockBox: Guid=79CB58C4-AC51-442F-AFD7-98E47D2E9908 Buffer=DC8D1000  
----------------------|---+   | | | | | | | | # restores boot script executor 
context in-place
                                                                                
                   |   |   | | | | | | | | #
  AcpiS3Context = DF818000  
-----------------------------------------------------------------------|---|----
 | | | | | | | #
  Waking Vector = 9A1D0  
<---------------------------------------------------------------+         |   | 
    | | | | | | | # read from FACS
  AcpiS3Context->AcpiFacsTable = DF823000  
----------------------------------------------|---------|---|-----+ | | | | | | 
#
  AcpiS3Context->S3NvsPageTableAddress = 0                                      
         |         |   |       | | | | | | #
  AcpiS3Context->S3DebugBufferAddress = DF815000  
---------------------------------------|---------|---|-------+ | | | | | #
  EfiBootScriptExecutorVariable->BootScriptExecutorEntrypoint = DC8D2928        
         |         |   |         | | | | | #
                                                                                
         |         |   |         | | | | | #
  RestoreAllLockBoxInPlace: Guid=DEA652B0-D587-4C54-B5B4-C682E7A0AA3D 
Buffer=DF817000  --|---------|---|---------+ | | | | # mAcpiS3IdtrProfileGuid
  RestoreAllLockBoxInPlace: Guid=0EF98D3A-3E33-497A-A401-77BE3EB74F38 
Buffer=DF818000  --|---------+   |           | | | | # restores AcpiS3Context 
in-place again
  RestoreAllLockBoxInPlace: Guid=79CB58C4-AC51-442F-AFD7-98E47D2E9908 
Buffer=DC8D1000  --|-------------+           | | | | # restores boot script 
executor context in-place again
  RestoreAllLockBoxInPlace: Guid=9A8D3433-9FE8-42B6-870B-1E31C84EBE3B 
Buffer=DC8D2000  --|-------------------------+ | | | # restores relocated boot 
script executor image in-place
  RestoreAllLockBoxInPlace: Guid=AEA6B965-DCF5-4311-B4B8-0F12464494D2 
Buffer=DD7A4000  --|---------------------------+ | | # restores boot script 
in-place
  RestoreAllLockBoxInPlace: Guid=1810AB4A-2314-4DF6-81EB-67C6EC058591 
Buffer=DF824000  --|---------------------------|-+ | # restores pointer to boot 
script in-place
                                                                                
         |                           |   | #
  S3ResumeExecuteBootScript()                                                   
         |                           |   | #
  PeiS3ResumeState - 1520BF0  
-----------------------------------------------------------|---------------------------|---+
 # heap allocation in S3 Resume Pool
  transfer control to Standalone Boot Script Executor                           
         |                           |     #
  S3BootScriptExecute:                                                          
         |                           |     #
  TableHeader - 0xDD7A4000  
-------------------------------------------------------------|---------------------------+
     #
  TableHeader.TableLength - 0x000058D4  
-------------------------------------------------|---------------------------+  
   #
                                                                                
         |
The bulk of the boot script originates from the QemuVideoDxe / Cirrus           
         |
PoC patch:                                                                      
         |
                                                                                
         |
  ExecuteBootScript - DD7A400D                                                  
         |                                 #
  EFI_BOOT_SCRIPT_INFORMATION_OPCODE                                            
         |                                 #
  BootScriptExecuteInformation - 0xDD7A4014                                     
         |                                 #
  BootScriptInformation: 43 69 72 72 75 73 20 35 34 34 36 20 42 65 67 69 6E 00  
         |                                 # "Cirrus 5446 Begin"
                                                                                
         |                                 #
  [...]                                                                         
         |                                 #
                                                                                
         |                                 #
  ExecuteBootScript - DD7A98AF                                                  
         |                                 #
  EFI_BOOT_SCRIPT_INFORMATION_OPCODE                                            
         |                                 #
  BootScriptExecuteInformation - 0xDD7A98B6                                     
         |                                 #
  BootScriptInformation: 43 69 72 72 75 73 20 35 34 34 36 20 45 6E 64 00        
         |                                 # "Cirrus 5446 End"
                                                                                
         |
The final DEADBEEF info opcode is part of the posted patchset (an empty         
         |
boot script cannot be saved):                                                   
         |
                                                                                
         |
  ExecuteBootScript - DD7A98C6                                                  
         |                                 #
  EFI_BOOT_SCRIPT_INFORMATION_OPCODE                                            
         |                                 #
  BootScriptExecuteInformation - 0xDD7A98CD                                     
         |                                 #
  BootScriptInformation: DE AD BE EF                                            
         |                                 #
  ExecuteBootScript - DD7A98D1                                                  
         |                                 #
  S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE                                           
         |                                 #
  S3BootScriptDone - Success                                                    
         |                                 #
  Call SwitchStack() to return to S3 Resume in PEI Phase                        
         |                                 #
  Install PPI: 88C9D306-0900-4EB5-8260-3E2DBEDA1F89                             
         |                                 #
  Install PPI: 605EA650-C65C-42E1-BA80-91A52AB618C6                             
         |                                 #
  Transfer to 16bit OS waking vector - 9A1D0  
-------------------------------------------+                                 #

Thanks,
Laszlo

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to