]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add debug init flag DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 in Debug Agent Library.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Aug 2012 08:36:23 +0000 (08:36 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Aug 2012 08:36:23 +0000 (08:36 +0000)
2. Update Capsule modules to consume debug agent library to support source debugging in x64 code.
3. Update BootScriptExecutorDxe module to support source debugging on S3 path.

signed-off-by: Jeff Fan <jeff.fan@intel.com>
reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13680 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Include/Library/DebugAgentLib.h
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
MdeModulePkg/Universal/CapsulePei/Capsule.h
MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c

index 1eb8988606120e3451710fe81a1150ff2df98588..01b06a73fb92fffc37158c59c77f00e9f74d59e7 100644 (file)
@@ -15,17 +15,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef __DEBUG_AGENT_LIB_H__\r
 #define __DEBUG_AGENT_LIB_H__\r
 \r
-#define DEBUG_AGENT_INIT_PREMEM_SEC      1\r
-#define DEBUG_AGENT_INIT_POSTMEM_SEC     2\r
-#define DEBUG_AGENT_INIT_DXE_CORE        3\r
-#define DEBUG_AGENT_INIT_SMM             4\r
-#define DEBUG_AGENT_INIT_ENTER_SMI       5\r
-#define DEBUG_AGENT_INIT_EXIT_SMI        6\r
-#define DEBUG_AGENT_INIT_S3              7\r
-#define DEBUG_AGENT_INIT_DXE_AP          8\r
-#define DEBUG_AGENT_INIT_PEI             9\r
-#define DEBUG_AGENT_INIT_DXE_LOAD       10\r
-#define DEBUG_AGENT_INIT_DXE_UNLOAD     11\r
+#define DEBUG_AGENT_INIT_PREMEM_SEC              1\r
+#define DEBUG_AGENT_INIT_POSTMEM_SEC             2\r
+#define DEBUG_AGENT_INIT_DXE_CORE                3\r
+#define DEBUG_AGENT_INIT_SMM                     4\r
+#define DEBUG_AGENT_INIT_ENTER_SMI               5\r
+#define DEBUG_AGENT_INIT_EXIT_SMI                6\r
+#define DEBUG_AGENT_INIT_S3                      7\r
+#define DEBUG_AGENT_INIT_DXE_AP                  8\r
+#define DEBUG_AGENT_INIT_PEI                     9\r
+#define DEBUG_AGENT_INIT_DXE_LOAD               10\r
+#define DEBUG_AGENT_INIT_DXE_UNLOAD             11\r
+#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64    12\r
 \r
 //\r
 // Context for DEBUG_AGENT_INIT_POSTMEM_SEC\r
index 933c328262bb842c4ac0fdd358811eeb013e0310..50165126c858b2f60ec015d6fc8da1d7c0082cae 100644 (file)
@@ -45,21 +45,23 @@ S3BootScriptExecutorEntryFunction (
   UINTN                                         TempStackTop;\r
   UINTN                                         TempStack[0x10];\r
   UINTN                                         AsmTransferControl16Address;\r
+  IA32_DESCRIPTOR                               IdtDescriptor;\r
 \r
   //\r
   // Disable interrupt of Debug timer, since new IDT table cannot handle it.\r
   //\r
   SaveAndSetDebugTimerInterrupt (FALSE);\r
 \r
+  AsmReadIdtr (&IdtDescriptor);\r
   //\r
   // Restore IDT for debug\r
   //\r
   SetIdtEntry (AcpiS3Context);\r
 \r
   //\r
-  // Initialize Debug Agent to support source level debug in S3 path.\r
+  // Initialize Debug Agent to support source level debug in S3 path, it will disable interrupt and Debug Timer.\r
   //\r
-  InitializeDebugAgent (DEBUG_AGENT_INIT_S3, NULL, NULL);\r
+  InitializeDebugAgent (DEBUG_AGENT_INIT_S3, (VOID *)&IdtDescriptor, NULL);\r
 \r
   //\r
   // Because not install BootScriptExecute PPI(used just in this module), So just pass NULL\r
index 57af114c40bbea68e004feaef22e63838896b77c..68d8e427459f68f8dffda252c25dde0a5512f715 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
+#include <Library/DebugAgentLib.h>\r
 #include <IndustryStandard/PeImage.h>\r
 #include "Common/CommonHeader.h"\r
 \r
index 8f96d9ec8a91805708e521fc5398c5e22a79f005..5ca9afa5b5f284722f8428b1ce8f4d1353a78131 100644 (file)
@@ -59,6 +59,7 @@
 [LibraryClasses.IA32]\r
   PeCoffGetEntryPointLib\r
   PcdLib\r
+  DebugAgentLib\r
 \r
 [Guids]\r
   gEfiCapsuleVendorGuid                         # ALWAYS_CONSUMED\r
index 1c155ce5f3a5afc397c6c7572e9946b7827fc485..6af8cbfc4737fbac179565e8397ee9fbdfa397aa 100644 (file)
@@ -47,6 +47,7 @@
   BaseLib\r
   DebugLib\r
   CpuExceptionHandlerLib\r
+  DebugAgentLib\r
 \r
 [Depex]\r
   FALSE\r
index 98b0d56457fdf6d2e50958df8bd64f8de5d669ee..f5dd85b2b60072e839fa38e3b95745cfe6556357 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Capsule update PEIM for UEFI2.0\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -349,6 +349,10 @@ Thunk32To64 (
     //\r
     AsmWriteCr3 ((UINTN) PageTableAddress);\r
 \r
+    //\r
+    // Disable interrupt of Debug timer, since the IDT table cannot work in long mode\r
+    //\r
+    SaveAndSetDebugTimerInterrupt (FALSE);\r
     //\r
     // Transfer to long mode\r
     //\r
index fa29e3dbfb561a5187d3a197b1032abe7b69f9c1..56913e6b03b8d420ceeed77e80bc5593c72c0cc0 100644 (file)
@@ -15,9 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/CpuExceptionHandlerLib.h>\r
+#include <Library/DebugAgentLib.h>\r
 #include "CommonHeader.h"\r
 \r
-#define EXCEPTION_VECTOR_NUMBER     0x20\r
+#define EXCEPTION_VECTOR_NUMBER     0x22\r
 \r
 /**\r
   The X64 entrypoint is used to process capsule in long mode then\r
@@ -58,6 +59,11 @@ _ModuleEntryPoint (
   // Setup the default CPU exception handlers\r
   //\r
   SetupCpuExceptionHandlers ();                \r
+  \r
+  //\r
+  // Initialize Debug Agent to support source level debug\r
+  //\r
+  InitializeDebugAgent (DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64, (VOID *) &Ia32Idtr, NULL);\r
 \r
   //\r
   // Call CapsuleDataCoalesce to process capsule.\r
@@ -71,6 +77,10 @@ _ModuleEntryPoint (
   \r
   ReturnContext->ReturnStatus = Status;\r
 \r
+  //\r
+  // Disable interrupt of Debug timer, since the new IDT table cannot work in long mode\r
+  //\r
+  SaveAndSetDebugTimerInterrupt (FALSE);\r
   //\r
   // Restore IA32 IDT table\r
   //\r