WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Add support for ACPI PM Timer as platform

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Add support for ACPI PM Timer as platform clock source.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 04 Jun 2007 03:16:14 -0700
Delivery-date: Mon, 04 Jun 2007 03:31:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1180545122 -3600
# Node ID 2d7d33ac982a0720408d841b13c3b97a2190eae4
# Parent  ae073ca6eb76f75a73063ba6e0f944b47b8f8954
Add support for ACPI PM Timer as platform clock source.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/time.c          |   56 ++++++++++++++++++++++++++++++++++++++++++-
 xen/include/asm-x86/config.h |    1 
 2 files changed, 56 insertions(+), 1 deletion(-)

diff -r ae073ca6eb76 -r 2d7d33ac982a xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Wed May 30 17:47:00 2007 +0100
+++ b/xen/arch/x86/time.c       Wed May 30 18:12:02 2007 +0100
@@ -511,6 +511,60 @@ static int init_cyclone(void)
 }
 
 /************************************************************
+ * PLATFORM TIMER 4: ACPI PM TIMER
+ */
+
+u32 pmtmr_ioport;
+
+/* Protected by platform_timer_lock. */
+static u64 pmtimer_counter64;
+static u32 pmtimer_stamp;
+static struct timer pmtimer_overflow_timer;
+
+/* ACPI PM timer ticks at 3.579545 MHz. */
+#define ACPI_PM_FREQUENCY 3579545
+
+/* Deltas are 24-bit unsigned values, as counter may be only 24 bits wide. */
+#define pmtimer_delta(c) ((u32)(((c) - pmtimer_stamp) & ((1U<<24)-1)))
+
+static void pmtimer_overflow(void *unused)
+{
+    u32 counter;
+
+    spin_lock_irq(&platform_timer_lock);
+    counter = inl(pmtmr_ioport);
+    pmtimer_counter64 += pmtimer_delta(counter);
+    pmtimer_stamp = counter;
+    spin_unlock_irq(&platform_timer_lock);
+
+    /* Trigger overflow avoidance roughly when counter increments 2^23. */
+    set_timer(&pmtimer_overflow_timer, NOW() + MILLISECS(2000));
+}
+
+static u64 read_pmtimer_count(void)
+{
+    return pmtimer_counter64 + pmtimer_delta(inl(pmtmr_ioport));
+}
+
+static int init_pmtimer(void)
+{
+    if ( pmtmr_ioport == 0 )
+        return 0;
+
+    read_platform_count = read_pmtimer_count;
+
+    init_timer(&pmtimer_overflow_timer, pmtimer_overflow, NULL, 0);
+    pmtimer_overflow(NULL);
+    platform_timer_stamp = pmtimer_counter64;
+    set_time_scale(&platform_timer_scale, ACPI_PM_FREQUENCY);
+
+    printk("Platform timer is %s ACPI PM Timer\n",
+           freq_string(ACPI_PM_FREQUENCY));
+
+    return 1;
+}
+
+/************************************************************
  * GENERIC PLATFORM TIMER INFRASTRUCTURE
  */
 
@@ -549,7 +603,7 @@ static void platform_time_calibration(vo
 
 static void init_platform_timer(void)
 {
-    if ( !init_cyclone() && !init_hpet() )
+    if ( !init_cyclone() && !init_hpet() && !init_pmtimer() )
         init_pit();
 }
 
diff -r ae073ca6eb76 -r 2d7d33ac982a xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      Wed May 30 17:47:00 2007 +0100
+++ b/xen/include/asm-x86/config.h      Wed May 30 18:12:02 2007 +0100
@@ -22,6 +22,7 @@
 #define CONFIG_X86_LOCAL_APIC 1
 #define CONFIG_X86_GOOD_APIC 1
 #define CONFIG_X86_IO_APIC 1
+#define CONFIG_X86_PM_TIMER 1
 #define CONFIG_HPET_TIMER 1
 #define CONFIG_X86_MCE_P4THERMAL 1
 #define CONFIG_ACPI_NUMA 1

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Add support for ACPI PM Timer as platform clock source., Xen patchbot-unstable <=