# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID ec7a1ffd0ade064c8ed79ec3fb2df9d5907866c1
# Parent  ddaaf7ca1c34fadf3741433c33bb676a0376adeb
[POWERPC][XEN] move idle_loop and add a "power save" hook

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |   32 +++++++++++++++++++++++++++++---
 xen/arch/powerpc/setup.c  |   18 ++----------------
 2 files changed, 31 insertions(+), 19 deletions(-)

diff -r ddaaf7ca1c34 -r ec7a1ffd0ade xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Fri Sep 01 12:19:41 2006 -0400
+++ b/xen/arch/powerpc/domain.c Fri Sep 01 12:31:56 2006 -0400
@@ -29,11 +29,10 @@
 #include <xen/shutdown.h>
 #include <xen/shadow.h>
 #include <xen/mm.h>
+#include <xen/softirq.h>
 #include <asm/htab.h>
 #include <asm/current.h>
 #include <asm/hcalls.h>
-
-extern void idle_loop(void);
 
 #define next_arg(fmt, args) ({                                              \
     unsigned long __arg;                                                    \
@@ -47,6 +46,7 @@ extern void idle_loop(void);
     }                                                                       \
     __arg;                                                                  \
 })
+extern void idle_loop(void);
 
 unsigned long hypercall_create_continuation(unsigned int op,
         const char *format, ...)
@@ -179,7 +179,6 @@ void dump_pageframe_info(struct domain *
     }
 }
 
-
 void context_switch(struct vcpu *prev, struct vcpu *next)
 {
     struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
@@ -253,3 +252,30 @@ void arch_dump_domain_info(struct domain
 void arch_dump_domain_info(struct domain *d)
 {
 }
+
+extern void sleep(void);
+static void safe_halt(void)
+{
+    int cpu = smp_processor_id();
+
+    while (!softirq_pending(cpu))
+        sleep();
+}
+
+static void default_idle(void)
+{
+    local_irq_disable();
+    if ( !softirq_pending(smp_processor_id()) )
+        safe_halt();
+    else
+        local_irq_enable();
+}
+
+void idle_loop(void)
+{
+    for ( ; ; ) {
+        page_scrub_schedule_work();
+        default_idle();
+        do_softirq();
+    }
+}
diff -r ddaaf7ca1c34 -r ec7a1ffd0ade xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Fri Sep 01 12:19:41 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Fri Sep 01 12:31:56 2006 -0400
@@ -81,7 +81,6 @@ struct ns16550_defaults ns16550;
 struct ns16550_defaults ns16550;
 
 extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[];
-extern void idle_loop(void);
 
 /* move us to a header file */
 extern void initialize_keytable(void);
@@ -99,21 +98,6 @@ unsigned long kernel_text_end(void)
 unsigned long kernel_text_end(void)
 {
     return (unsigned long) &_etext;
-}
-
-void idle_loop(void)
-{
-    int cpu = smp_processor_id();
-
-    for ( ; ; )
-    {
-        while (!softirq_pending(cpu)) {
-            void sleep(void);
-            page_scrub_schedule_work();
-            sleep();
-        }
-        do_softirq();
-    }
 }
 
 static void __init do_initcalls(void)
@@ -208,6 +192,8 @@ static void __init start_of_day(void)
     do_initcalls();
     schedulers_start();
 }
+
+extern void idle_loop(void);
 
 void startup_cpu_idle_loop(void)
 {

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to