/** @file
Debug Agent library implementition for Dxe Core and Dxr modules.
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "DxeDebugAgentLib.h"
/**
Constructor allocates the NVS memory to store Mailbox and install configuration table
in system table to store its pointer.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval RETURN_SUCCESS Allocate the global memory space to store guid and function tables.
@retval RETURN_OUT_OF_RESOURCES No enough memory to allocated.
**/
)
{
if (!mConfigurationTableNeeded) {
return RETURN_SUCCESS;
}
Address = 0;
EFI_SIZE_TO_PAGES (sizeof (DEBUG_AGENT_MAILBOX)),
);
return Status;
}
CopyMem (
sizeof (DEBUG_AGENT_MAILBOX)
);
}
/**
Get the pointer to Mailbox from the GUIDed HOB.
@param[in] HobStart The starting HOB pointer to search from.
@return Pointer to Mailbox.
**/
)
{
return NULL;
}
}
/**
Get Debug Agent Mailbox pointer.
@return Mailbox pointer.
**/
)
{
return mMailboxPointer;
}
/**
Get debug port handle.
@return Debug port handle.
**/
)
{
}
/**
Initialize debug agent.
This function is used to set up debug enviroment for DXE phase.
If this function is called by DXE Core, Context must be the pointer
to HOB list which will be used to get GUIDed HOB. It will enable
interrupt to support break-in feature.
If this function is called by DXE module, Context must be NULL. It
will enable interrupt to support break-in feature.
@param[in] InitFlag Init flag is used to decide initialize process.
@param[in] Context Context needed according to InitFlag.
@param[in] Function Continue function called by debug agent library; it was
optional.
**/
)
{
if (InitFlag != DEBUG_AGENT_INIT_DXE_CORE &&
InitFlag != DEBUG_AGENT_INIT_S3 &&
return;
}
//
// Save and disable original interrupt status
//
if (InitFlag == DEBUG_AGENT_INIT_DXE_CORE) {
//
// Try to get Mailbox from GUIDed HOB.
//
} else if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {
EnableInterrupts ();
return;
} else {
//
// If it is in S3 path, needn't to install configuration table.
//
}
//
// If Mailbox exists, copy it into one global variable.
//
mMailbox.DebugPortHandle = 0;
} else {
//
// If Mailbox not exists, used the local Mailbox.
//
}
//
// Get original IDT address and size.
//
if (IdtEntryCount < 33) {
}
//
// Initialize the IDT table entries to support source level debug.
//
//
// Initialize debug communication port
//
if (InitFlag == DEBUG_AGENT_INIT_DXE_CORE) {
//
// Initialize Debug Timer hardware and enable interrupt.
//
EnableInterrupts ();
return;
} else {
//
// Disable Debug Timer interrupt in S3 path.
//
//
// Restore interrupt state.
//
}
}