Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Mar 2009 22:12:33 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190340 - head/sys/dev/acpica
Message-ID:  <200903232212.n2NMCXWK023114@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Mon Mar 23 22:12:33 2009
New Revision: 190340
URL: http://svn.freebsd.org/changeset/base/190340

Log:
  Add a function to reset system time after resuming, which will be used
  by amd64 shortly.  It can be turned off by setting "debug.acpi.reset_clock"
  tunable to zero.

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpivar.h

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Mon Mar 23 22:06:09 2009	(r190339)
+++ head/sys/dev/acpica/acpi.c	Mon Mar 23 22:12:33 2009	(r190340)
@@ -254,6 +254,12 @@ TUNABLE_INT("debug.acpi.do_powerstate", 
 SYSCTL_INT(_debug_acpi, OID_AUTO, do_powerstate, CTLFLAG_RW,
     &acpi_do_powerstate, 1, "Turn off devices when suspending.");
 
+/* Reset system clock while resuming.  XXX Remove once tested. */
+static int acpi_reset_clock = 1;
+TUNABLE_INT("debug.acpi.reset_clock", &acpi_reset_clock);
+SYSCTL_INT(_debug_acpi, OID_AUTO, reset_clock, CTLFLAG_RW,
+    &acpi_reset_clock, 1, "Reset system clock while resuming.");
+
 /* Allow users to override quirks. */
 TUNABLE_INT("debug.acpi.quirks", &acpi_quirks);
 
@@ -2596,10 +2602,6 @@ acpi_EnterSleepState(struct acpi_softc *
 
     mtx_unlock(&Giant);
 
-    /* Warm up timecounter again */
-    (void)timecounter->tc_get_timecount(timecounter);
-    (void)timecounter->tc_get_timecount(timecounter);
-
 #ifdef SMP
     thread_lock(curthread);
     sched_unbind(curthread);
@@ -2617,6 +2619,21 @@ acpi_EnterSleepState(struct acpi_softc *
     return_ACPI_STATUS (status);
 }
 
+void
+acpi_resync_clock(struct acpi_softc *sc)
+{
+
+    if (!acpi_reset_clock)
+	return;
+
+    /*
+     * Warm up timecounter again and reset system clock.
+     */
+    (void)timecounter->tc_get_timecount(timecounter);
+    (void)timecounter->tc_get_timecount(timecounter);
+    inittodr(time_second + sc->acpi_sleep_delay);
+}
+
 /* Initialize a device's wake GPE. */
 int
 acpi_wake_init(device_t dev, int type)

Modified: head/sys/dev/acpica/acpivar.h
==============================================================================
--- head/sys/dev/acpica/acpivar.h	Mon Mar 23 22:06:09 2009	(r190339)
+++ head/sys/dev/acpica/acpivar.h	Mon Mar 23 22:12:33 2009	(r190340)
@@ -330,6 +330,7 @@ ACPI_STATUS	acpi_SetIntrModel(int model)
 int		acpi_ReqSleepState(struct acpi_softc *sc, int state);
 int		acpi_AckSleepState(struct apm_clone_data *clone, int error);
 ACPI_STATUS	acpi_SetSleepState(struct acpi_softc *sc, int state);
+void		acpi_resync_clock(struct acpi_softc *sc);
 int		acpi_wake_init(device_t dev, int type);
 int		acpi_wake_set_enable(device_t dev, int enable);
 int		acpi_parse_prw(ACPI_HANDLE h, struct acpi_prw_data *prw);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903232212.n2NMCXWK023114>