Module Name: src
Committed By: jmcneill
Date: Mon Aug 8 11:18:34 UTC 2011
Modified Files:
src/sys/arch/x86/x86: tsc.c
Log Message:
If the USE_PLATFORM_CLOCK flag is set in the FADT, it indicates that OSPM
should use a platform provided timer (either HPET or the PM timer). A
platform may set this flag if internal processor clock(s) cannot provide
consistent monotonically non-decreasing counters. Set TSC quality to -100
if this flag is set.
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/tsc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.28 src/sys/arch/x86/x86/tsc.c:1.29
--- src/sys/arch/x86/x86/tsc.c:1.28 Wed Feb 2 12:26:42 2011
+++ src/sys/arch/x86/x86/tsc.c Mon Aug 8 11:18:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: tsc.c,v 1.28 2011/02/02 12:26:42 bouyer Exp $ */
+/* $NetBSD: tsc.c,v 1.29 2011/08/08 11:18:34 jmcneill Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.28 2011/02/02 12:26:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.29 2011/08/08 11:18:34 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -45,6 +45,11 @@
#include <machine/cputypes.h>
#include "tsc.h"
+#include "acpica.h"
+
+#if NACPICA > 0
+#include <dev/acpi/acpivar.h>
+#endif
u_int tsc_get_timecount(struct timecounter *);
@@ -143,6 +148,21 @@
safe = false;
}
+#if NACPICA > 0
+ /*
+ * If the USE_PLATFORM_CLOCK flag is set in the FADT, it indicates
+ * that OSPM should use a platform provided timer (either HPET or
+ * the PM timer). A platform may set this flag if internal
+ * processor clock(s) cannot provide consistent monotonically
+ * non-decreasing counters.
+ */
+ if (acpi_active && (AcpiGbl_FADT.Flags & ACPI_FADT_PLATFORM_CLOCK)) {
+ aprint_debug("TSC: ACPI requested platform-provided timer\n");
+ tsc_timecounter.tc_quality = -100;
+ safe = false;
+ }
+#endif
+
if (tsc_freq != 0) {
tsc_timecounter.tc_frequency = tsc_freq;
tc_init(&tsc_timecounter);