TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmDebugAgentLib.c File Reference
#include "SmmDebugAgentLib.h"

Go to the source code of this file.

Functions

BOOLEAN MultiProcessorDebugSupport (VOID)
 
EFI_STATUS DebugReadBreakSymbol (IN DEBUG_PORT_HANDLE Handle, OUT UINT8 *BreakSymbol)
 
DEBUG_AGENT_MAILBOXGetMailboxFromHob (VOID)
 
DEBUG_AGENT_MAILBOXGetMailboxPointer (VOID)
 
DEBUG_PORT_HANDLE GetDebugPortHandle (VOID)
 
VOID SaveDebugRegister (VOID)
 
VOID RestoreDebugRegister (VOID)
 
VOID EFIAPI InitializeDebugAgent (IN UINT32 InitFlag, IN VOID *Context OPTIONAL, IN DEBUG_AGENT_CONTINUE Function OPTIONAL)
 

Variables

DEBUG_AGENT_MAILBOXmMailboxPointer = NULL
 
DEBUG_AGENT_MAILBOX mLocalMailbox
 
UINTN mSavedDebugRegisters [6]
 
IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable [33]
 
BOOLEAN mSkipBreakpoint = FALSE
 
BOOLEAN mSmmDebugIdtInitFlag = FALSE
 
BOOLEAN mApicTimerRestore = FALSE
 
BOOLEAN mPeriodicMode
 
UINT32 mTimerCycle
 
UINTN mApicTimerDivisor
 
UINT8 mVector
 
CHAR8 mWarningMsgIgnoreSmmEntryBreak [] = "Ignore smmentrybreak setting for SMI issued during DXE debugging!\r\n"
 

Detailed Description

Debug Agent library implementation.

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

Definition in file SmmDebugAgentLib.c.

Function Documentation

◆ 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 51 of file SmmDebugAgentLib.c.

◆ GetDebugPortHandle()

DEBUG_PORT_HANDLE GetDebugPortHandle ( VOID  )

Get debug port handle.

Returns
Debug port handle.

Definition at line 111 of file SmmDebugAgentLib.c.

◆ GetMailboxFromHob()

DEBUG_AGENT_MAILBOX * GetMailboxFromHob ( VOID  )

Get the pointer to Mailbox from the GUIDed HOB.

Returns
Pointer to Mailbox.

Definition at line 69 of file SmmDebugAgentLib.c.

◆ GetMailboxPointer()

DEBUG_AGENT_MAILBOX * GetMailboxPointer ( VOID  )

Get Debug Agent Mailbox pointer.

Returns
Mailbox pointer.

Definition at line 96 of file SmmDebugAgentLib.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 source level debug in SMM code.

If InitFlag is DEBUG_AGENT_INIT_SMM, it will override IDT table entries and initialize debug port. It will get debug agent Mailbox from GUIDed HOB, it it exists, debug agent wiil copied it into the local Mailbox in SMM space. it will override IDT table entries and initialize debug port. Context must point to a BOOLEAN if it's not NULL, which indicates SMM Debug Agent supported or not. If InitFlag is DEBUG_AGENT_INIT_ENTER_SMI, debug agent will save Debug Registers and get local Mailbox in SMM space. Context will be NULL. If InitFlag is DEBUG_AGENT_INIT_EXIT_SMI, debug agent will restore Debug Registers. Context will be NULL.

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

Definition at line 178 of file SmmDebugAgentLib.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 33 of file SmmDebugAgentLib.c.

◆ RestoreDebugRegister()

VOID RestoreDebugRegister ( VOID  )

Restore debug register when SMI exit.

Definition at line 140 of file SmmDebugAgentLib.c.

◆ SaveDebugRegister()

VOID SaveDebugRegister ( VOID  )

Store debug register when SMI exit.

Definition at line 123 of file SmmDebugAgentLib.c.

Variable Documentation

◆ mApicTimerDivisor

UINTN mApicTimerDivisor

Definition at line 20 of file SmmDebugAgentLib.c.

◆ mApicTimerRestore

BOOLEAN mApicTimerRestore = FALSE

Definition at line 17 of file SmmDebugAgentLib.c.

◆ mIdtEntryTable

IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable[33]

Definition at line 14 of file SmmDebugAgentLib.c.

◆ mLocalMailbox

DEBUG_AGENT_MAILBOX mLocalMailbox

Definition at line 12 of file SmmDebugAgentLib.c.

◆ mMailboxPointer

DEBUG_AGENT_MAILBOX* mMailboxPointer = NULL

Definition at line 11 of file SmmDebugAgentLib.c.

◆ mPeriodicMode

BOOLEAN mPeriodicMode

Definition at line 18 of file SmmDebugAgentLib.c.

◆ mSavedDebugRegisters

UINTN mSavedDebugRegisters[6]

Definition at line 13 of file SmmDebugAgentLib.c.

◆ mSkipBreakpoint

BOOLEAN mSkipBreakpoint = FALSE

Definition at line 15 of file SmmDebugAgentLib.c.

◆ mSmmDebugIdtInitFlag

BOOLEAN mSmmDebugIdtInitFlag = FALSE

Definition at line 16 of file SmmDebugAgentLib.c.

◆ mTimerCycle

UINT32 mTimerCycle

Definition at line 19 of file SmmDebugAgentLib.c.

◆ mVector

UINT8 mVector

Definition at line 21 of file SmmDebugAgentLib.c.

◆ mWarningMsgIgnoreSmmEntryBreak

CHAR8 mWarningMsgIgnoreSmmEntryBreak[] = "Ignore smmentrybreak setting for SMI issued during DXE debugging!\r\n"

Definition at line 23 of file SmmDebugAgentLib.c.