Revision: 18595
http://sourceforge.net/p/edk2/code/18595
Author: hwu1225
Date: 2015-10-09 07:04:26 +0000 (Fri, 09 Oct 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>
Modified Paths:
--------------
trunk/edk2/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
trunk/edk2/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
Modified: trunk/edk2/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
===================================================================
--- trunk/edk2/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c 2015-10-09
07:04:00 UTC (rev 18594)
+++ trunk/edk2/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c 2015-10-09
07:04:26 UTC (rev 18595)
@@ -723,6 +723,8 @@
/**
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 @@
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);
Modified: trunk/edk2/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
===================================================================
--- trunk/edk2/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
2015-10-09 07:04:00 UTC (rev 18594)
+++ trunk/edk2/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
2015-10-09 07:04:26 UTC (rev 18595)
@@ -4,7 +4,7 @@
This local APIC library instance supports x2APIC capable processors
which have xAPIC and x2APIC modes.
- Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2015, 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
@@ -818,6 +818,8 @@
/**
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.
@@ -834,6 +836,13 @@
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);
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits