]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Refine debug agent library.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 27 Feb 2010 17:04:12 +0000 (17:04 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 27 Feb 2010 17:04:12 +0000 (17:04 +0000)
2. DxeCore and DxeIpl consume debug agent library.

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

MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg/Core/Dxe/DxeMain.inf
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
MdeModulePkg/Include/Library/DebugAgentLib.h
MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c

index da56c88fd7eff945a97179fa1e7752734a124a9d..5c17b02d53c505516226ea4ad880d21dfa54a9f5 100644 (file)
@@ -81,6 +81,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/ReportStatusCodeLib.h>\r
 #include <Library/TimerLib.h>\r
 #include <Library/DxeServicesLib.h>\r
+#include <Library/DebugAgentLib.h>\r
 \r
 \r
 //\r
index 6d5f6f50712ca21aa420bdefa565ea6deb7cb022..2f50ed02234d7a166fbdd4add96f87a004877a85 100644 (file)
@@ -89,6 +89,7 @@
   ReportStatusCodeLib\r
   TimerLib\r
   DxeServicesLib\r
+  DebugAgentLib\r
 \r
 [Guids]\r
   gEfiEventMemoryMapChangeGuid                  ## CONSUMES ## Event\r
index 77c4227c30939f0da943a5ae4d8c8bc4c2e397d9..2f72670c2a3fd5f71f8da4d72741ad9d47876515 100644 (file)
@@ -215,8 +215,8 @@ EFI_DECOMPRESS_PROTOCOL  gEfiDecompress = {
 };\r
 \r
 //\r
-// For Loading modules at fixed address feature, the configuration table is to cache the top address below which to load \r
-// Runtime code&boot time code \r
+// For Loading modules at fixed address feature, the configuration table is to cache the top address below which to load\r
+// Runtime code&boot time code\r
 //\r
 GLOBAL_REMOVE_IF_UNREFERENCED EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE    gLoadModuleAtFixAddressConfigurationTable = {0, 0};\r
 \r
@@ -241,6 +241,11 @@ DxeMain (
   EFI_PHYSICAL_ADDRESS               MemoryBaseAddress;\r
   UINT64                             MemoryLength;\r
 \r
+  //\r
+  // Initialize Debug Agent to support source level debug in DXE phase\r
+  //\r
+  InitializeDebugAgent (DEBUG_AGENT_INIT_DXE, HobStart);\r
+\r
   //\r
   // Initialize Memory Services\r
   //\r
@@ -294,11 +299,11 @@ DxeMain (
   //\r
   Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation);\r
   ASSERT_EFI_ERROR (Status);\r
-  \r
+\r
   //\r
-  // If Loading modules At fixed address feature is enabled, install Load moduels at fixed address \r
+  // If Loading modules At fixed address feature is enabled, install Load moduels at fixed address\r
   // Configuration Table so that user could easily to retrieve the top address to load Dxe and PEI\r
-  // Code and Tseg base to load SMM driver. \r
+  // Code and Tseg base to load SMM driver.\r
   //\r
   if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0) {\r
     Status = CoreInstallConfigurationTable (&gLoadFixedAddressConfigurationTableGuid, &gLoadModuleAtFixAddressConfigurationTable);\r
index 1240ce6c2bf2b17a15fba47b778ed92df9c7fe0a..8f3538e4d11ebb91f42d6ed5db8d4f6cfe25b043 100644 (file)
@@ -2,7 +2,7 @@
   Master header file for DxeIpl PEIM. All source files in this module should\r
   include this file for common definitions.\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2010, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -45,13 +45,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PcdLib.h>\r
 #include <Library/S3Lib.h>\r
 #include <Library/RecoveryLib.h>\r
+#include <Library/DebugAgentLib.h>\r
 \r
 #define STACK_SIZE      0x20000\r
 #define BSP_STORE_SIZE  0x4000\r
 \r
 \r
 //\r
-// This PPI is installed to indicate the end of the PEI usage of memory \r
+// This PPI is installed to indicate the end of the PEI usage of memory\r
 //\r
 extern CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi;\r
 \r
@@ -61,7 +62,7 @@ extern CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi;
    instance that contains DxeCore.\r
 \r
    @return FileHandle of DxeCore to load DxeCore.\r
-   \r
+\r
 **/\r
 EFI_PEI_FILE_HANDLE\r
 DxeIplFindDxeCore (\r
@@ -70,13 +71,13 @@ DxeIplFindDxeCore (
 \r
 \r
 /**\r
-   Main entry point to last PEIM \r
-    \r
+   Main entry point to last PEIM\r
+\r
    @param This          Entry point for DXE IPL PPI\r
    @param PeiServices   General purpose services available to every PEIM.\r
    @param HobList       Address to the Pei HOB list\r
-   \r
-   @return EFI_SUCCESS              DXE core was successfully loaded. \r
+\r
+   @return EFI_SUCCESS              DXE core was successfully loaded.\r
    @return EFI_OUT_OF_RESOURCES     There are not enough resources to load DXE core.\r
 \r
 **/\r
@@ -156,7 +157,7 @@ UpdateStackHob (
                                 output buffer. If the input\r
                                 section's GuidedSectionHeader.\r
                                 Attributes field has the\r
-                                EFI_GUIDED_SECTION_AUTH_STATUS_VALID \r
+                                EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
                                 bit as clear,\r
                                 AuthenticationStatus must return\r
                                 zero. These bits reflect the\r
@@ -166,14 +167,14 @@ UpdateStackHob (
                                 EFI_SUCCESS, the value of\r
                                 AuthenticationStatus is\r
                                 undefined.\r
-  \r
+\r
   @retval EFI_SUCCESS           The InputSection was\r
                                 successfully processed and the\r
                                 section contents were returned.\r
-  \r
+\r
   @retval EFI_OUT_OF_RESOURCES  The system has insufficient\r
                                 resources to process the request.\r
-  \r
+\r
   @retval EFI_INVALID_PARAMETER The GUID in InputSection does\r
                                 not match this instance of the\r
                                 GUIDed Section Extraction PPI.\r
@@ -196,7 +197,7 @@ CustomGuidedSectionExtract (
    This function looks up the compression type field in the input section and\r
    applies the appropriate compression algorithm to compress the section to a\r
    callee allocated buffer.\r
-    \r
+\r
    @param  This                  Points to this instance of the\r
                                  EFI_PEI_DECOMPRESS_PEI PPI.\r
    @param  CompressionSection    Points to the compressed section.\r
@@ -204,14 +205,14 @@ CustomGuidedSectionExtract (
                                  sections.\r
    @param  OutputSize            Holds the returned size of the decompress\r
                                  section streams.\r
-   \r
+\r
    @retval EFI_SUCCESS           The section was decompressed successfully.\r
                                  OutputBuffer contains the resulting data and\r
                                  OutputSize contains the resulting size.\r
 \r
 **/\r
 EFI_STATUS\r
-EFIAPI \r
+EFIAPI\r
 Decompress (\r
   IN CONST  EFI_PEI_DECOMPRESS_PPI  *This,\r
   IN CONST  EFI_COMPRESSION_SECTION *CompressionSection,\r
index 0fcaf44f570125b9a3c2c939eaa158d0def6f68a..c3dd5f6719d7d995c19e54d37529d634b93b5938 100644 (file)
@@ -1,6 +1,6 @@
 ## @file\r
 #  Last PEIM executed in PEI phase to load DXE Core from a Firmware Volume.\r
-#  \r
+#\r
 #  This module produces a special PPI named the DXE Initial Program Load (IPL)\r
 #  PPI to discover and dispatch the DXE Foundation and components that are\r
 #  needed to run the DXE Foundation.\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
-#  \r
+#\r
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#  \r
+#\r
 ##\r
 \r
 [Defines]\r
@@ -72,6 +72,7 @@
   BaseLib\r
   PeimEntryPoint\r
   DebugLib\r
+  DebugAgentLib\r
 \r
 [Ppis]\r
   gEfiDxeIplPpiGuid                 ## PRODUCES\r
   gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiLoadFilePpiGuid\r
 \r
 #\r
-# [BootMode] \r
+# [BootMode]\r
 #   S3_RESUME                       ## SOMETIMES_CONSUMES\r
 #   RECOVERY                        ## SOMETIMES_CONSUMES\r
 #\r
-#  \r
+#\r
 # [Hob]\r
 #   ##\r
 #   # New Stack HoB\r
 #   # BSP Stack HOB for IPF\r
 #   MEMORY_ALLOCATION               ## PRODUCES\r
 #\r
-# \r
+#\r
index 7e99ac5e02f243465306a6e4b902de766511b411..29ff8416a2eaaed508bb29d182e49dc1e3cbfd35 100644 (file)
@@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "DxeIpl.h"\r
 #include "VirtualMemory.h"\r
 \r
+#define IDT_ENTRY_COUNT       33\r
+\r
 //\r
 // Global Descriptor Table (GDT)\r
 //\r
@@ -40,7 +42,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST IA32_DESCRIPTOR gGdt = {
   };\r
 \r
 GLOBAL_REMOVE_IF_UNREFERENCED  IA32_DESCRIPTOR gLidtDescriptor = {\r
-  sizeof (X64_IDT_GATE_DESCRIPTOR) * 32 - 1,\r
+  sizeof (X64_IDT_GATE_DESCRIPTOR) * IDT_ENTRY_COUNT - 1,\r
   0\r
 };\r
 \r
@@ -118,13 +120,13 @@ HandOffToDxeCore (
 \r
     Status = PeiServicesAllocatePages (\r
                EfiBootServicesData,\r
-               EFI_SIZE_TO_PAGES((SizeOfTemplate + sizeof (X64_IDT_GATE_DESCRIPTOR)) * 32),\r
+               EFI_SIZE_TO_PAGES((SizeOfTemplate + sizeof (X64_IDT_GATE_DESCRIPTOR)) * IDT_ENTRY_COUNT),\r
                &VectorAddress\r
                );\r
     ASSERT_EFI_ERROR (Status);\r
 \r
-    IdtTable      = (X64_IDT_GATE_DESCRIPTOR *) (UINTN) (VectorAddress + SizeOfTemplate * 32);\r
-    for (Index = 0; Index < 32; Index++) {\r
+    IdtTable      = (X64_IDT_GATE_DESCRIPTOR *) (UINTN) (VectorAddress + SizeOfTemplate * IDT_ENTRY_COUNT);\r
+    for (Index = 0; Index < IDT_ENTRY_COUNT; Index++) {\r
       IdtTable[Index].Ia32IdtEntry.Bits.GateType    =  0x8e;\r
       IdtTable[Index].Ia32IdtEntry.Bits.Reserved_0  =  0;\r
       IdtTable[Index].Ia32IdtEntry.Bits.Selector    =  SYS_CODE64_SEL;\r
@@ -142,6 +144,11 @@ HandOffToDxeCore (
 \r
     gLidtDescriptor.Base = (UINTN) IdtTable;\r
 \r
+    //\r
+    // Disable interrupt of Debug timer, since new IDT table cannot handle it.\r
+    //\r
+    SaveAndSetDebugTimerInterrupt (FALSE);\r
+\r
     AsmWriteIdtr (&gLidtDescriptor);\r
 \r
     //\r
index 9a5c57e8deccf15e2039a1a37b86d8103cc53ecc..a5c311482d2f35e9aa179cc55e14e8768ee6b9ed 100644 (file)
@@ -19,7 +19,8 @@
 #define DEBUG_AGENT_INIT_POSTMEM_SEC     2\r
 #define DEBUG_AGENT_INIT_DXE             3\r
 #define DEBUG_AGENT_INIT_SMM             4\r
-#define DEBUG_AGENT_INIT_SMI             5\r
+#define DEBUG_AGENT_INIT_ENTER_SMI       5\r
+#define DEBUG_AGENT_INIT_EXIT_SMI        6\r
 \r
 /**\r
   Initialize debug agent.\r
@@ -38,17 +39,21 @@ InitializeDebugAgent (
   );\r
 \r
 /**\r
-  Enable/Disable the interrupt of debug timer.\r
+  Enable/Disable the interrupt of debug timer and return the interrupt state\r
+  prior to the operation.\r
 \r
   If EnableStatus is TRUE, enable the interrupt of debug timer.\r
   If EnableStatus is FALSE, disable the interrupt of debug timer.\r
 \r
   @param[in] EnableStatus    Enable/Disable.\r
 \r
+  @retval TRUE  Debug timer interrupt were enabled on entry to this call.\r
+  @retval FALSE Debug timer interrupt were disabled on entry to this call.\r
+\r
 **/\r
-VOID\r
+BOOLEAN\r
 EFIAPI\r
-SetDebugTimerInterrupt (\r
+SaveAndSetDebugTimerInterrupt (\r
   IN BOOLEAN                EnableStatus\r
   );\r
 \r
index cf945d01ad6b10d74cd0b3ebcb82ef4cc33c557f..58c756d4d4456d7aafa9c92454616549acace5cd 100644 (file)
@@ -32,20 +32,23 @@ InitializeDebugAgent (
 }\r
 \r
 /**\r
-  Enable/Disable the interrupt of debug timer.\r
+  Enable/Disable the interrupt of debug timer and return the interrupt state\r
+  prior to the operation.\r
 \r
   If EnableStatus is TRUE, enable the interrupt of debug timer.\r
   If EnableStatus is FALSE, disable the interrupt of debug timer.\r
 \r
   @param[in] EnableStatus    Enable/Disable.\r
 \r
+  @return FALSE always.\r
+\r
 **/\r
-VOID\r
+BOOLEAN\r
 EFIAPI\r
-SetDebugTimerInterrupt (\r
+SaveAndSetDebugTimerInterrupt (\r
   IN BOOLEAN                EnableStatus\r
   )\r
 {\r
-\r
+  return FALSE;\r
 }\r
 \r