]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Drivers/CpuDxe/CpuDxe.c
ArmPlatformPkg: Remove PcdStandalone from Sec module and Introduce ArmPlatformSecExtr...
[mirror_edk2.git] / ArmPkg / Drivers / CpuDxe / CpuDxe.c
index b51867fda39593bb9ed466974b389ed2497aa2a4..cea333f91d6a8c10b305ef3292032c54214773f1 100644 (file)
@@ -1,8 +1,9 @@
 /** @file\r
 \r
-  Copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+  Copyright (c) 2011, ARM Limited. All rights reserved.\r
   \r
-  All rights reserved. This program and the accompanying materials\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
   http://opensource.org/licenses/bsd-license.php\r
@@ -14,6 +15,8 @@
 \r
 #include "CpuDxe.h"\r
 \r
+#include <Guid/IdleLoopEvent.h>\r
+\r
 BOOLEAN mInterruptState   = FALSE;\r
 \r
 \r
@@ -194,6 +197,23 @@ CpuGetTimerValue (
   return EFI_UNSUPPORTED;\r
 }\r
 \r
+/**\r
+  Callback function for idle events.\r
\r
+  @param  Event                 Event whose notification function is being invoked.\r
+  @param  Context               The pointer to the notification function's context,\r
+                                which is implementation-dependent.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IdleLoopEventCallback (\r
+  IN EFI_EVENT                Event,\r
+  IN VOID                     *Context\r
+  )\r
+{\r
+  CpuSleep ();\r
+}\r
 \r
 //\r
 // Globals used to initialize the protocol\r
@@ -219,10 +239,10 @@ CpuDxeInitialize (
   )\r
 {\r
   EFI_STATUS  Status;\r
+  EFI_EVENT    IdleLoopEvent;\r
 \r
   InitializeExceptions (&mCpu);  \r
   \r
-  \r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                 &mCpuHandle, \r
                 &gEfiCpuArchProtocolGuid,           &mCpu, \r
@@ -237,6 +257,18 @@ CpuDxeInitialize (
   //\r
   SyncCacheConfig (&mCpu);\r
   \r
+  //\r
+  // Setup a callback for idle events\r
+  //\r
+  Status = gBS->CreateEventEx (\r
+                  EVT_NOTIFY_SIGNAL,\r
+                  TPL_NOTIFY,\r
+                  IdleLoopEventCallback,\r
+                  NULL,\r
+                  &gIdleLoopEventGuid,\r
+                  &IdleLoopEvent\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   return Status;\r
 }\r
-\r