summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authordavide <davide@FreeBSD.org>2013-02-28 10:46:54 +0000
committerdavide <davide@FreeBSD.org>2013-02-28 10:46:54 +0000
commit2bf12d0c7ceced74a813d6940dd07310a11d6a2a (patch)
tree33c7f3089361e0ab5379fdc8445540c6eeb03ed0 /sys/powerpc
parentf3c985cbe184c9d4c31d0e7140c146768a82833c (diff)
downloadFreeBSD-src-2bf12d0c7ceced74a813d6940dd07310a11d6a2a.zip
FreeBSD-src-2bf12d0c7ceced74a813d6940dd07310a11d6a2a.tar.gz
MFcalloutng:
When CPU becomes idle, cpu_idleclock() calculates time to the next timer event in order to reprogram hw timer. Return that time in sbintime_t to the caller and pass it to acpi_cpu_idle(), where it can be used as one more factor (quite precise) to extimate furter sleep time and choose optimal sleep state. This is a preparatory change for further callout improvements will be committed in the next days. The commmit is not targeted for MFC.
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powerpc/cpu.c15
-rw-r--r--sys/powerpc/ps3/platform_ps3.c4
-rw-r--r--sys/powerpc/wii/platform_wii.c4
3 files changed, 12 insertions, 11 deletions
diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c
index d177c8b..d67f359 100644
--- a/sys/powerpc/powerpc/cpu.c
+++ b/sys/powerpc/powerpc/cpu.c
@@ -79,9 +79,9 @@ static void cpu_970_setup(int cpuid, uint16_t vers);
static void cpu_booke_setup(int cpuid, uint16_t vers);
int powerpc_pow_enabled;
-void (*cpu_idle_hook)(void) = NULL;
-static void cpu_idle_60x(void);
-static void cpu_idle_booke(void);
+void (*cpu_idle_hook)(sbintime_t) = NULL;
+static void cpu_idle_60x(sbintime_t);
+static void cpu_idle_booke(sbintime_t);
struct cputab {
const char *name;
@@ -516,6 +516,7 @@ cpu_feature_bit(SYSCTL_HANDLER_ARGS)
void
cpu_idle(int busy)
{
+ sbintime_t sbt = -1;
#ifdef INVARIANTS
if ((mfmsr() & PSL_EE) != PSL_EE) {
@@ -531,9 +532,9 @@ cpu_idle(int busy)
if (cpu_idle_hook != NULL) {
if (!busy) {
critical_enter();
- cpu_idleclock();
+ sbt = cpu_idleclock();
}
- cpu_idle_hook();
+ cpu_idle_hook(sbt);
if (!busy) {
cpu_activeclock();
critical_exit();
@@ -551,7 +552,7 @@ cpu_idle_wakeup(int cpu)
}
static void
-cpu_idle_60x(void)
+cpu_idle_60x(sbintime_t sbt)
{
register_t msr;
uint16_t vers;
@@ -586,7 +587,7 @@ cpu_idle_60x(void)
}
static void
-cpu_idle_booke(void)
+cpu_idle_booke(sbintime_t sbt)
{
register_t msr;
diff --git a/sys/powerpc/ps3/platform_ps3.c b/sys/powerpc/ps3/platform_ps3.c
index 61ce873..207382d 100644
--- a/sys/powerpc/ps3/platform_ps3.c
+++ b/sys/powerpc/ps3/platform_ps3.c
@@ -70,7 +70,7 @@ static int ps3_smp_start_cpu(platform_t, struct pcpu *cpu);
static struct cpu_group *ps3_smp_topo(platform_t);
#endif
static void ps3_reset(platform_t);
-static void ps3_cpu_idle(void);
+static void ps3_cpu_idle(sbintime_t);
static platform_method_t ps3_methods[] = {
PLATFORMMETHOD(platform_probe, ps3_probe),
@@ -245,7 +245,7 @@ ps3_real_maxaddr(platform_t plat)
}
static void
-ps3_cpu_idle(void)
+ps3_cpu_idle(sbintime_t sbt)
{
lv1_pause(0);
}
diff --git a/sys/powerpc/wii/platform_wii.c b/sys/powerpc/wii/platform_wii.c
index 2bb6022..bc35105 100644
--- a/sys/powerpc/wii/platform_wii.c
+++ b/sys/powerpc/wii/platform_wii.c
@@ -60,7 +60,7 @@ static void wii_mem_regions(platform_t, struct mem_region **,
int *, struct mem_region **, int *);
static unsigned long wii_timebase_freq(platform_t, struct cpuref *cpuref);
static void wii_reset(platform_t);
-static void wii_cpu_idle(void);
+static void wii_cpu_idle(sbintime_t sbt);
static platform_method_t wii_methods[] = {
PLATFORMMETHOD(platform_probe, wii_probe),
@@ -155,6 +155,6 @@ wii_reset(platform_t plat)
}
static void
-wii_cpu_idle(void)
+wii_cpu_idle(sbintime_t sbt)
{
}
OpenPOWER on IntegriCloud