All of lore.kernel.org
 help / color / mirror / Atom feed
From: Venki Pallipadi <venkatesh.pallipadi@intel.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Thomas Gleixner <tglx@linutronix.de>, Andi Kleen <ak@suse.de>,
	Ingo Molnar <mingo@elte.hu>, Chris Wright <chrisw@sous-sol.org>
Subject: [PATCH 7/8] HPET boot option for the new standard interrupt delivery mode
Date: Mon, 7 May 2007 13:34:20 -0700	[thread overview]
Message-ID: <20070507203420.GG3926@linux-os.sc.intel.com> (raw)


Add a new boot option related to HPET. Current mode of HPET functioning:

(1) If HPET is listed in BIOS:
default: HPET gets detected at boot time and gets enabled in 
"legacy replacement" mode.
"hpet=standard" boot option: HPET does not get used during early boot and
PIT will be used in early boot. HPET gets enabled in "standard" mode during
late boot stages.
"hpet=disable" boot option: HPET is disabled and not used.

(2) If HPET is not listed in BIOS and force detected with PCI quirks:
default: HPET does not get used during early boot and
PIT will be used in early boot. HPET gets enabled in "standard" mode during
late boot stages.
"hpet=disable" boot option: HPET is disabled and not used.


We can change the default behavior of (1) to match (2) after this patch gets
some testing.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

Index: linux-2.6.21/include/asm-i386/hpet.h
===================================================================
--- linux-2.6.21.orig/include/asm-i386/hpet.h	2007-04-27 15:27:12.000000000 -0700
+++ linux-2.6.21/include/asm-i386/hpet.h	2007-04-27 15:30:22.000000000 -0700
@@ -112,7 +112,7 @@
 extern int is_hpet_capable(void);
 extern int hpet_readl(unsigned long a);
 #else
-extern int hpet_enable(void);
+extern int hpet_enable(int early_call);
 #endif
 
 #ifdef CONFIG_HPET_EMULATE_RTC
@@ -127,7 +127,7 @@
 
 #else
 
-static inline int hpet_enable(void) { return 0; }
+static inline int hpet_enable(int early_call) { return 0; }
 
 #endif /* CONFIG_HPET_TIMER */
 #endif /* _I386_HPET_H */
Index: linux-2.6.21/arch/i386/kernel/time.c
===================================================================
--- linux-2.6.21.orig/arch/i386/kernel/time.c	2007-04-27 15:27:12.000000000 -0700
+++ linux-2.6.21/arch/i386/kernel/time.c	2007-04-27 15:30:22.000000000 -0700
@@ -264,7 +264,7 @@
 /* Duplicate of time_init() below, with hpet_enable part added */
 void __init hpet_time_init(void)
 {
-	if (!hpet_enable())
+	if (!hpet_enable(1))
 		setup_pit_timer();
 	time_init_hook();
 }
Index: linux-2.6.21/arch/i386/kernel/hpet.c
===================================================================
--- linux-2.6.21.orig/arch/i386/kernel/hpet.c	2007-04-27 15:30:15.000000000 -0700
+++ linux-2.6.21/arch/i386/kernel/hpet.c	2007-04-27 15:30:22.000000000 -0700
@@ -51,6 +51,8 @@
 	if (str) {
 		if (!strncmp("disable", str, 7))
 			boot_hpet_disable = 1;
+		else if (!strncmp("standard", str, 9))
+			hpet_preferred_int_mode = HPET_INT_STD;
 	}
 	return 1;
 }
@@ -723,13 +725,16 @@
 /*
  * Try to setup the HPET timer
  */
-int __init hpet_enable(void)
+int __init hpet_enable(int early_call)
 {
 	unsigned long id;
 
 	if (hpet_virt_address)
 		return 0;
 
+	if (early_call && hpet_preferred_int_mode == HPET_INT_STD)
+		return 0;
+
 	if (!is_hpet_capable())
 		return 0;
 
@@ -784,13 +789,15 @@
 	if (boot_hpet_disable)
 		return -ENODEV;
 
-	if (!hpet_address) {
-		if (!force_hpet_address)
-			return -ENODEV;
+	if (!hpet_virt_address) {
+		if (!hpet_address) {
+			if (!force_hpet_address)
+				return -ENODEV;
 
-		hpet_address = force_hpet_address;
+			hpet_address = force_hpet_address;
+		}
 		hpet_preferred_int_mode = HPET_INT_STD;
-		ret = hpet_enable();
+		ret = hpet_enable(0);
 		if (ret < 0 || !hpet_virt_address)
 			return -ENODEV;
 	}
Index: linux-2.6.21/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.21.orig/Documentation/kernel-parameters.txt	2007-04-25 20:08:32.000000000 -0700
+++ linux-2.6.21/Documentation/kernel-parameters.txt	2007-04-27 15:31:31.000000000 -0700
@@ -384,8 +384,8 @@
 			over the 8254 in addition to over the IO-APIC. The
 			kernel tries to set a sensible default.
 
-	hpet=		[IA-32,HPET] option to disable HPET and use PIT.
-			Format: disable
+	hpet=		[IA-32,HPET] option to choose HPET modes.
+			Format: {disable | standard}
 
 	cm206=		[HW,CD]
 			Format: { auto | [<io>,][<irq>] }

                 reply	other threads:[~2007-05-07 20:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070507203420.GG3926@linux-os.sc.intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=chrisw@sous-sol.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.