Commit f18d92a3 authored by Jes Sorensen's avatar Jes Sorensen Committed by David Mosberger

[PATCH] cpu_idle() cleanup

parent 14076de1
...@@ -33,16 +33,15 @@ ...@@ -33,16 +33,15 @@
#include <asm/unwind.h> #include <asm/unwind.h>
#include <asm/user.h> #include <asm/user.h>
#ifdef CONFIG_IA64_SGI_SN
#include <asm/sn/idle.h>
#endif
#ifdef CONFIG_PERFMON #ifdef CONFIG_PERFMON
# include <asm/perfmon.h> # include <asm/perfmon.h>
#endif #endif
#include "sigframe.h" #include "sigframe.h"
void (*ia64_mark_idle)(int);
void void
ia64_do_show_stack (struct unw_frame_info *info, void *arg) ia64_do_show_stack (struct unw_frame_info *info, void *arg)
{ {
...@@ -175,6 +174,8 @@ default_idle (void) ...@@ -175,6 +174,8 @@ default_idle (void)
void __attribute__((noreturn)) void __attribute__((noreturn))
cpu_idle (void *unused) cpu_idle (void *unused)
{ {
void (*mark_idle)(int) = ia64_mark_idle;
/* endless idle loop with no priority at all */ /* endless idle loop with no priority at all */
while (1) { while (1) {
void (*idle)(void) = pm_idle; void (*idle)(void) = pm_idle;
...@@ -187,15 +188,13 @@ cpu_idle (void *unused) ...@@ -187,15 +188,13 @@ cpu_idle (void *unused)
#endif #endif
while (!need_resched()) { while (!need_resched()) {
#ifdef CONFIG_IA64_SGI_SN if (mark_idle)
snidle(); (*mark_idle)(1);
#endif
(*idle)(); (*idle)();
} }
#ifdef CONFIG_IA64_SGI_SN if (mark_idle)
snidleoff(); (*mark_idle)(0);
#endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
normal_xtp(); normal_xtp();
......
#ifndef _ASM_IA64_SN_IDLE_H
#define _ASM_IA64_SN_IDLE_H
/* /*
* This file is subject to the terms and conditions of the GNU General Public * This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (c) 2001-2002 Silicon Graphics, Inc. All rights reserved. * Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <asm/sn/leds.h> #include <asm/sn/leds.h>
#include <asm/sn/simulator.h> #include <asm/sn/simulator.h>
static __inline__ void void snidle(int state) {
snidle(void) { if (state) {
#if 0 if (pda.idle_flag == 0) {
#ifdef CONFIG_IA64_SGI_AUTOTEST /*
{ * Turn the activity LED off.
extern int autotest_enabled; */
if (autotest_enabled) { set_led_bits(0, LED_CPU_ACTIVITY);
extern void llsc_main(int);
llsc_main(smp_processor_id());
} }
}
#endif
if (pda.idle_flag == 0) {
/*
* Turn the activity LED off.
*/
set_led_bits(0, LED_CPU_ACTIVITY);
}
#ifdef CONFIG_IA64_SGI_SN_SIM #ifdef CONFIG_IA64_SGI_SN_SIM
if (IS_RUNNING_ON_SIMULATOR()) if (IS_RUNNING_ON_SIMULATOR())
SIMULATOR_SLEEP(); SIMULATOR_SLEEP();
#endif
pda.idle_flag = 1;
#endif #endif
}
static __inline__ void pda.idle_flag = 1;
snidleoff(void) { } else {
#if 0 /*
/* * Turn the activity LED on.
* Turn the activity LED on. */
*/ set_led_bits(LED_CPU_ACTIVITY, LED_CPU_ACTIVITY);
set_led_bits(LED_CPU_ACTIVITY, LED_CPU_ACTIVITY);
pda.idle_flag = 0; pda.idle_flag = 0;
#endif }
} }
#endif /* _ASM_IA64_SN_IDLE_H */
/* /*
* Copyright (C) 1999,2001-2002 Silicon Graphics, Inc. All rights reserved. * Copyright (C) 1999,2001-2003 Silicon Graphics, Inc. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License * under the terms of version 2 of the GNU General Public License
...@@ -79,6 +79,8 @@ DEFINE_PER_CPU(struct pda_s, pda_percpu); ...@@ -79,6 +79,8 @@ DEFINE_PER_CPU(struct pda_s, pda_percpu);
extern void bte_init_node (nodepda_t *, cnodeid_t); extern void bte_init_node (nodepda_t *, cnodeid_t);
extern void bte_init_cpu (void); extern void bte_init_cpu (void);
extern void sn_timer_init (void); extern void sn_timer_init (void);
extern void (*ia64_mark_idle)(int);
extern void snidle(int);
unsigned long sn_rtc_cycles_per_second; unsigned long sn_rtc_cycles_per_second;
...@@ -304,6 +306,8 @@ sn_setup(char **cmdline_p) ...@@ -304,6 +306,8 @@ sn_setup(char **cmdline_p)
current->thread.flags |= IA64_THREAD_FPEMU_NOPRINT; current->thread.flags |= IA64_THREAD_FPEMU_NOPRINT;
sn_timer_init(); sn_timer_init();
ia64_mark_idle = &snidle;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment