diff options
author | Hao Wu <hao.a.wu@intel.com> | 2015-10-09 07:04:26 +0000 |
---|---|---|
committer | hwu1225 <hwu1225@Edk2> | 2015-10-09 07:04:26 +0000 |
commit | 6d72ff7d9daf7efae5243e9c00a281b350fc0f95 (patch) | |
tree | 713014c10e4d34323860d4f3f947b6eb33b0a7df /UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | |
parent | f17e2f8c9e1a34c3707f93ca373a79f14927f7b1 (diff) | |
download | edk2-6d72ff7d9daf7efae5243e9c00a281b350fc0f95.tar.gz edk2-6d72ff7d9daf7efae5243e9c00a281b350fc0f95.tar.bz2 edk2-6d72ff7d9daf7efae5243e9c00a281b350fc0f95.zip |
UefiCpuPkg BaseXApic(X2)Lib: Add ASSERT if local APIC not software enabled
Add an ASSERT in GetApicTimerState() to check if the local APIC is
software enabled.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18595 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c')
-rw-r--r-- | UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c index f219b07888..08bcef7bf7 100644 --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c @@ -723,6 +723,8 @@ InitializeApicTimer ( /**
Get the state of the local APIC timer.
+ This function will ASSERT if the local APIC is not software enabled.
+
@param DivideValue Return the divide value for the DCR. It is one of 1,2,4,8,16,32,64,128.
@param PeriodicMode Return the timer mode. If TRUE, timer mode is peridoic. Othewise, timer mode is one-shot.
@param Vector Return the timer interrupt vector number.
@@ -739,6 +741,13 @@ GetApicTimerState ( LOCAL_APIC_DCR Dcr;
LOCAL_APIC_LVT_TIMER LvtTimer;
+ //
+ // Check the APIC Software Enable/Disable bit (bit 8) in Spurious-Interrupt
+ // Vector Register.
+ // This bit will be 1, if local APIC is software enabled.
+ //
+ ASSERT ((ReadLocalApicReg(XAPIC_SPURIOUS_VECTOR_OFFSET) & BIT8) != 0);
+
if (DivideValue != NULL) {
Dcr.Uint32 = ReadLocalApicReg (XAPIC_TIMER_DIVIDE_CONFIGURATION_OFFSET);
Divisor = Dcr.Bits.DivideValue1 | (Dcr.Bits.DivideValue2 << 2);
|