/** @file\r
Debug Agent library implementition for Dxe Core and Dxr modules.\r
\r
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IA32_DESCRIPTOR IdtDescriptor;\r
IA32_DESCRIPTOR *Ia32Idtr;\r
IA32_IDT_ENTRY *Ia32IdtEntry;\r
+ BOOLEAN PeriodicMode;\r
+ UINTN TimerCycle;\r
\r
if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {\r
+ //\r
+ // Check if CPU APIC Timer is working, otherwise initialize it.\r
+ //\r
+ InitializeLocalApicSoftwareEnable (TRUE);\r
+ GetApicTimerState (NULL, &PeriodicMode, NULL);\r
+ TimerCycle = GetApicTimerInitCount ();\r
+ if (!PeriodicMode || TimerCycle == 0) {\r
+ InitializeDebugTimer (NULL, FALSE);\r
+ }\r
//\r
// Invoked by AP, enable interrupt to let AP could receive IPI from other processors\r
//\r
if (Context != NULL) {\r
Ia32Idtr = (IA32_DESCRIPTOR *) Context;\r
Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);\r
- MailboxLocation = (UINT64 *) (UINTN) (Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetLow +\r
- (Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetHigh << 16));\r
+ MailboxLocation = (UINT64 *) ((UINTN) Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetLow +\r
+ ((UINTN) Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetHigh << 16));\r
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);\r
VerifyMailboxChecksum (Mailbox);\r
}\r