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