/** @file\r
\r
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+ Copyright (c) 2011, ARM Limited. All rights reserved.\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
#include "CpuDxe.h"\r
\r
+#include <Guid/IdleLoopEvent.h>\r
+\r
BOOLEAN mInterruptState = FALSE;\r
\r
\r
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
)\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
//\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