mirror of https://github.com/acidanthera/audk.git
SourceLevelDebugPkg/SmmDebugAgent: Initialize Local APIC Timer
Now Debug Agent library uses Local APIC Timer to implement time-out mechanism. In SMM, SMM BSP maybe not be the one in DXE phase, its local APIC timer may not work. This fix is to initialize Local APIC timer if it doesn't work as expected at SMM entry. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17500 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e9d6470bd8
commit
edbb27132d
|
@ -190,6 +190,8 @@ InitializeDebugAgent (
|
||||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||||
UINT64 *MailboxLocation;
|
UINT64 *MailboxLocation;
|
||||||
UINT32 DebugTimerFrequency;
|
UINT32 DebugTimerFrequency;
|
||||||
|
BOOLEAN PeriodicMode;
|
||||||
|
UINTN TimerCycle;
|
||||||
|
|
||||||
switch (InitFlag) {
|
switch (InitFlag) {
|
||||||
case DEBUG_AGENT_INIT_SMM:
|
case DEBUG_AGENT_INIT_SMM:
|
||||||
|
@ -275,7 +277,15 @@ InitializeDebugAgent (
|
||||||
case DEBUG_AGENT_INIT_ENTER_SMI:
|
case DEBUG_AGENT_INIT_ENTER_SMI:
|
||||||
SaveDebugRegister ();
|
SaveDebugRegister ();
|
||||||
InitializeDebugIdt ();
|
InitializeDebugIdt ();
|
||||||
|
//
|
||||||
|
// Check if CPU APIC Timer is working, otherwise initialize it.
|
||||||
|
//
|
||||||
|
GetApicTimerState (NULL, &PeriodicMode, NULL);
|
||||||
|
TimerCycle = GetApicTimerInitCount ();
|
||||||
|
if (PeriodicMode != TRUE || TimerCycle == 0) {
|
||||||
|
InitializeDebugTimer (NULL);
|
||||||
|
DisableApicTimerInterrupt ();
|
||||||
|
}
|
||||||
Mailbox = GetMailboxPointer ();
|
Mailbox = GetMailboxPointer ();
|
||||||
if (GetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS) == 1) {
|
if (GetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS) == 1) {
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue