[RFC 2/4] x86: HPET_MSI Refactor code in preparation for HPET_MSI

Previous thread: [PATCH] Add missing macro argument for devm_release_* family by Hiroshi DOYU on Friday, September 5, 2008 - 6:00 pm. (4 messages)

Next thread: [RFC 3/4] x86: HPET_MSI Basic HPET_MSI setup code by venkatesh.pallipadi on Friday, September 5, 2008 - 6:02 pm. (1 message)
From: venkatesh.pallipadi
Date: Friday, September 5, 2008 - 6:02 pm

Preparatory patch before the actual HPET MSI changes. Sets up hpet_set_mode
and hpet_next_event for the MSI related changes. Just the code
refactoring and should be zero functional change.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>

---
 arch/x86/kernel/hpet.c |   42 +++++++++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 15 deletions(-)

Index: tip/arch/x86/kernel/hpet.c
===================================================================
--- tip.orig/arch/x86/kernel/hpet.c	2008-09-05 17:03:52.000000000 -0700
+++ tip/arch/x86/kernel/hpet.c	2008-09-05 17:04:12.000000000 -0700
@@ -227,44 +227,44 @@ static void hpet_legacy_clockevent_regis
 	printk(KERN_DEBUG "hpet clockevent registered\n");
 }
 
-static void hpet_legacy_set_mode(enum clock_event_mode mode,
-			  struct clock_event_device *evt)
+static void hpet_set_mode(enum clock_event_mode mode,
+			  struct clock_event_device *evt, int timer)
 {
 	unsigned long cfg, cmp, now;
 	uint64_t delta;
 
 	switch(mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
-		delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * hpet_clockevent.mult;
-		delta >>= hpet_clockevent.shift;
+		delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * evt->mult;
+		delta >>= evt->shift;
 		now = hpet_readl(HPET_COUNTER);
 		cmp = now + (unsigned long) delta;
-		cfg = hpet_readl(HPET_T0_CFG);
+		cfg = hpet_readl(HPET_Tn_CFG(timer));
 		cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
 		       HPET_TN_SETVAL | HPET_TN_32BIT;
-		hpet_writel(cfg, HPET_T0_CFG);
+		hpet_writel(cfg, HPET_Tn_CFG(timer));
 		/*
 		 * The first write after writing TN_SETVAL to the
 		 * config register sets the counter value, the second
 		 * write sets the period.
 		 */
-		hpet_writel(cmp, HPET_T0_CMP);
+		hpet_writel(cmp, HPET_Tn_CMP(timer));
 		udelay(1);
-		hpet_writel((unsigned long) delta, HPET_T0_CMP);
+		hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer));
 		break;
 
 	case ...
Previous thread: [PATCH] Add missing macro argument for devm_release_* family by Hiroshi DOYU on Friday, September 5, 2008 - 6:00 pm. (4 messages)

Next thread: [RFC 3/4] x86: HPET_MSI Basic HPET_MSI setup code by venkatesh.pallipadi on Friday, September 5, 2008 - 6:02 pm. (1 message)