summaryrefslogtreecommitdiffstats
path: root/sys/pc98
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/pc98
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/pc98')
-rw-r--r--sys/pc98/pc98/machdep.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 3133d1b..b0d5acd 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -1145,7 +1145,7 @@ SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RW, &idle_mwait,
#define STATE_SLEEPING 0x2
static void
-cpu_idle_hlt(int busy)
+cpu_idle_hlt(sbintime_t sbt)
{
int *state;
@@ -1186,7 +1186,7 @@ cpu_idle_hlt(int busy)
#define MWAIT_C4 0x30
static void
-cpu_idle_mwait(int busy)
+cpu_idle_mwait(sbintime_t sbt)
{
int *state;
@@ -1209,7 +1209,7 @@ cpu_idle_mwait(int busy)
}
static void
-cpu_idle_spin(int busy)
+cpu_idle_spin(sbintime_t sbt)
{
int *state;
int i;
@@ -1229,11 +1229,12 @@ cpu_idle_spin(int busy)
}
}
-void (*cpu_idle_fn)(int) = cpu_idle_hlt;
+void (*cpu_idle_fn)(sbintime_t) = cpu_idle_hlt;
void
cpu_idle(int busy)
{
+ sbintime_t sbt = -1;
CTR2(KTR_SPARE2, "cpu_idle(%d) at %d",
busy, curcpu);
@@ -1251,11 +1252,11 @@ cpu_idle(int busy)
/* If we have time - switch timers into idle mode. */
if (!busy) {
critical_enter();
- cpu_idleclock();
+ sbt = cpu_idleclock();
}
/* Call main idle method. */
- cpu_idle_fn(busy);
+ cpu_idle_fn(sbt);
/* Switch timers mack into active mode. */
if (!busy) {
OpenPOWER on IntegriCloud