TianoCore EDK2 master
Loading...
Searching...
No Matches
SecPeiDebugAgentLib.c File Reference

Go to the source code of this file.

Functions

BOOLEAN MultiProcessorDebugSupport (VOID)
 
EFI_STATUS DebugReadBreakSymbol (IN DEBUG_PORT_HANDLE Handle, OUT UINT8 *BreakSymbol)
 
VOID * GetLocationSavedMailboxPointerInIdtEntry (VOID)
 
VOID SetLocationSavedMailboxPointerInIdtEntry (IN VOID *MailboxLocation)
 
UINT64 * GetMailboxLocationFromHob (VOID)
 
DEBUG_AGENT_MAILBOXGetMailboxPointer (VOID)
 
DEBUG_PORT_HANDLE GetDebugPortHandle (VOID)
 
EFI_STATUS EFIAPI DebugAgentCallbackMemoryDiscoveredPpi (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
 
VOID EFIAPI InitializeDebugAgent (IN UINT32 InitFlag, IN VOID *Context OPTIONAL, IN DEBUG_AGENT_CONTINUE Function OPTIONAL)
 
VOID EFIAPI InitializeDebugAgentPhase2 (IN VOID *Context, IN DEBUG_PORT_HANDLE DebugPortHandle)
 

Variables

GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSkipBreakpoint = FALSE
 
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_VECTOR_HANDOFF_INFO_PPI mVectorHandoffInfoPpi
 
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mVectorHandoffInfoPpiList []
 
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mDebugAgentMemoryDiscoveredNotifyList [1]
 

Detailed Description

SEC Core Debug Agent Library instance implementation.

Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SecPeiDebugAgentLib.c.

Function Documentation

◆ DebugAgentCallbackMemoryDiscoveredPpi()

EFI_STATUS EFIAPI DebugAgentCallbackMemoryDiscoveredPpi ( IN EFI_PEI_SERVICES **  PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor,
IN VOID *  Ppi 
)

Debug Agent provided notify callback function on Memory Discovered PPI.

Parameters
[in]PeiServicesIndirect reference to the PEI Services Table.
[in]NotifyDescriptorAddress of the notification descriptor data structure.
[in]PpiAddress of the PPI that was installed.
Return values
EFI_SUCCESSIf the function completed successfully.

Definition at line 258 of file SecPeiDebugAgentLib.c.

◆ DebugReadBreakSymbol()

EFI_STATUS DebugReadBreakSymbol ( IN DEBUG_PORT_HANDLE  Handle,
OUT UINT8 *  BreakSymbol 
)

Read the Attach/Break-in symbols from the debug port.

Parameters
[in]HandlePointer to Debug Port handle.
[out]BreakSymbolReturned break symbol.
Return values
EFI_SUCCESSRead the symbol in BreakSymbol.
EFI_NOT_FOUNDNo read the break symbol.

Definition at line 62 of file SecPeiDebugAgentLib.c.

◆ GetDebugPortHandle()

DEBUG_PORT_HANDLE GetDebugPortHandle ( VOID  )

Get debug port handle.

Returns
Debug port handle.

Definition at line 235 of file SecPeiDebugAgentLib.c.

◆ GetLocationSavedMailboxPointerInIdtEntry()

VOID * GetLocationSavedMailboxPointerInIdtEntry ( VOID  )

Get the pointer to location saved Mailbox pointer from IDT entry.

Definition at line 119 of file SecPeiDebugAgentLib.c.

◆ GetMailboxLocationFromHob()

UINT64 * GetMailboxLocationFromHob ( VOID  )

Get the location of Mailbox pointer from the GUIDed HOB.

Returns
Pointer to the location saved Mailbox pointer.

Definition at line 154 of file SecPeiDebugAgentLib.c.

◆ GetMailboxPointer()

DEBUG_AGENT_MAILBOX * GetMailboxPointer ( VOID  )

Get Debug Agent Mailbox pointer.

Returns
Mailbox pointer.

Definition at line 175 of file SecPeiDebugAgentLib.c.

◆ InitializeDebugAgent()

VOID EFIAPI InitializeDebugAgent ( IN UINT32  InitFlag,
IN VOID *Context  OPTIONAL,
IN DEBUG_AGENT_CONTINUE Function  OPTIONAL 
)

Initialize debug agent.

This function is used to set up debug environment for SEC and PEI phase.

If InitFlag is DEBUG_AGENT_INIT_PREMEM_SEC, it will override IDT table entries and initialize debug port. It will enable interrupt to support break-in feature. It will set up debug agent Mailbox in cache-as-ramfrom. It will be called before physical memory is ready. If InitFlag is DEBUG_AGENT_INIT_POSTMEM_SEC, debug agent will build one GUIDed HOB to copy debug agent Mailbox. It will be called after physical memory is ready.

This function is used to set up debug environment to support source level debugging. If certain Debug Agent Library instance has to save some private data in the stack, this function must work on the mode that doesn't return to the caller, then the caller needs to wrap up all rest of logic after InitializeDebugAgent() into one function and pass it into InitializeDebugAgent(). InitializeDebugAgent() is responsible to invoke the passing-in function at the end of InitializeDebugAgent().

If the parameter Function is not NULL, Debug Agent Library instance will invoke it by passing in the Context to be its parameter.

If Function() is NULL, Debug Agent Library instance will return after setup debug environment.

Parameters
[in]InitFlagInit flag is used to decide the initialize process.
[in]ContextContext needed according to InitFlag; it was optional.
[in]FunctionContinue function called by debug agent library; it was optional.

Definition at line 358 of file SecPeiDebugAgentLib.c.

◆ InitializeDebugAgentPhase2()

VOID EFIAPI InitializeDebugAgentPhase2 ( IN VOID *  Context,
IN DEBUG_PORT_HANDLE  DebugPortHandle 
)

Caller provided function to be invoked at the end of DebugPortInitialize().

Refer to the description for DebugPortInitialize() for more details.

Parameters
[in]ContextThe first input argument of DebugPortInitialize().
[in]DebugPortHandleDebug port handle created by Debug Communication Library.

Definition at line 668 of file SecPeiDebugAgentLib.c.

◆ MultiProcessorDebugSupport()

BOOLEAN MultiProcessorDebugSupport ( VOID  )

Check if debug agent support multi-processor.

Return values
TRUEMulti-processor is supported.
FALSEMulti-processor is not supported.

Definition at line 44 of file SecPeiDebugAgentLib.c.

◆ SetLocationSavedMailboxPointerInIdtEntry()

VOID SetLocationSavedMailboxPointerInIdtEntry ( IN VOID *  MailboxLocation)

Set the pointer of Mailbox into IDT entry before memory is ready.

Parameters
[in]MailboxLocationPointer to location saved Mailbox pointer.

Definition at line 140 of file SecPeiDebugAgentLib.c.

Variable Documentation

◆ mDebugAgentMemoryDiscoveredNotifyList

GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mDebugAgentMemoryDiscoveredNotifyList[1]
Initial value:
= {
{
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiMemoryDiscoveredPpiGuid,
}
}
EFI_STATUS EFIAPI DebugAgentCallbackMemoryDiscoveredPpi(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)

Definition at line 28 of file SecPeiDebugAgentLib.c.

◆ mSkipBreakpoint

GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSkipBreakpoint = FALSE

Definition at line 11 of file SecPeiDebugAgentLib.c.

◆ mVectorHandoffInfoPpi

Initial value:
= {
&mVectorHandoffInfoDebugAgent[0]
}

Definition at line 13 of file SecPeiDebugAgentLib.c.

◆ mVectorHandoffInfoPpiList

Initial value:
= {
{
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiVectorHandoffInfoPpiGuid,
&mVectorHandoffInfoPpi
}
}

Definition at line 20 of file SecPeiDebugAgentLib.c.