]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/X86TimerLib.c
UefiCpuPkg: Add ASSERT to handle local APIC not config properly
[mirror_edk2.git] / UefiCpuPkg / Library / SecPeiDxeTimerLibUefiCpu / X86TimerLib.c
index 52ae7717ddf5aff8b98a2b3011137a2a3937320e..f703d7e4776838a3cacc1e5e149c65f44dd47249 100644 (file)
@@ -3,7 +3,7 @@
 \r
   This library uses the local APIC library so that it supports x2APIC mode.\r
   \r
-  Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2015, 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
@@ -45,6 +45,9 @@ InternalX86GetTimerFrequency (
   Stalls the CPU for at least the given number of ticks. It's invoked by\r
   MicroSecondDelay() and NanoSecondDelay().\r
 \r
+  This function will ASSERT if the APIC timer intial count returned from\r
+  GetApicTimerInitCount() is zero.\r
+\r
   @param  Delay     A period of time to delay in ticks.\r
 \r
 **/\r
@@ -67,6 +70,7 @@ InternalX86Delay (
   // Delay and the Init Count.\r
   //\r
   InitCount = GetApicTimerInitCount ();\r
+  ASSERT (InitCount != 0);\r
   Times     = Delay / (InitCount / 2);\r
   Delay     = Delay % (InitCount / 2);\r
 \r