]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
PcAtChipsetPkg: Define FixePCD's for RTC register values
[mirror_edk2.git] / PcAtChipsetPkg / HpetTimerDxe / HpetTimer.c
index b9bf080c74ea03b9b600887b9254137aef51888f..23afbfaa656b6d3e2ee7d8e2e440d11788b00906 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Timer Architectural Protocol module using High Precesion Event Timer (HPET)\r
 \r
-  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2011 - 2016, 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
@@ -142,7 +142,7 @@ TimerDriverGetTimerPeriod (
   @param  This  The EFI_TIMER_ARCH_PROTOCOL instance.\r
 \r
   @retval  EFI_SUCCESS       The soft timer interrupt was generated.\r
-  @retval  EFI_UNSUPPORTEDT  The platform does not support the generation of soft \r
+  @retval  EFI_UNSUPPORTED   The platform does not support the generation of soft\r
                              timer interrupts.\r
 \r
 **/\r
@@ -288,8 +288,8 @@ HpetEnable (
   HPET interrupt is passed to that notification function in 100 ns units.  The HPET\r
   time is updated to generate another interrupt in the required time period. \r
 \r
-  @param  InterruptType  The type of interrupt that occured.\r
-  @param  SystemContext  A pointer to the system context when the interrupt occured.\r
+  @param  InterruptType  The type of interrupt that occurred.\r
+  @param  SystemContext  A pointer to the system context when the interrupt occurred.\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -492,11 +492,17 @@ TimerDriverSetTimerPeriod (
   IN UINT64                   TimerPeriod\r
   )\r
 {\r
+  EFI_TPL                        Tpl;\r
   UINT64                         MainCounter;\r
   UINT64                         Delta;\r
   UINT64                         CurrentComparator;\r
   HPET_TIMER_MSI_ROUTE_REGISTER  HpetTimerMsiRoute;\r
-  \r
+\r
+  //\r
+  // Disable interrupts\r
+  //\r
+  Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
+\r
   //\r
   // Disable HPET timer when adjusting the timer period\r
   //\r
@@ -594,6 +600,7 @@ TimerDriverSetTimerPeriod (
       // Program IOAPIC register with APIC ID of current BSP in case BSP has been switched\r
       //\r
       IoApicConfigureInterrupt (mTimerIrq, PcdGet8 (PcdHpetLocalApicVector), IO_APIC_DELIVERY_MODE_LOWEST_PRIORITY, TRUE, FALSE);\r
+      IoApicEnableInterrupt (mTimerIrq, TRUE);\r
     }\r
 \r
     //\r
@@ -615,7 +622,12 @@ TimerDriverSetTimerPeriod (
   // is disabled.\r
   //\r
   HpetEnable (TRUE);\r
-  \r
+\r
+  //\r
+  // Restore interrupts\r
+  //\r
+  gBS->RestoreTPL (Tpl);\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -661,7 +673,7 @@ TimerDriverGetTimerPeriod (
   @param  This  The EFI_TIMER_ARCH_PROTOCOL instance.\r
 \r
   @retval  EFI_SUCCESS       The soft timer interrupt was generated.\r
-  @retval  EFI_UNSUPPORTEDT  The platform does not support the generation of soft \r
+  @retval  EFI_UNSUPPORTED   The platform does not support the generation of soft\r
                              timer interrupts.\r
 \r
 **/\r
@@ -741,7 +753,7 @@ TimerDriverGenerateSoftInterrupt (
 \r
   @retval  EFI_SUCCESS           Timer Architectural Protocol created\r
   @retval  EFI_OUT_OF_RESOURCES  Not enough resources available to initialize driver.\r
-  @retval  EFI_DEVICE_ERROR      A device error occured attempting to initialize the driver.\r
+  @retval  EFI_DEVICE_ERROR      A device error occurred attempting to initialize the driver.\r
 \r
 **/\r
 EFI_STATUS\r