public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add support for type argument in PAL_GET_PSTATE
@ 2006-11-01 18:35 Venkatesh Pallipadi
  2006-12-01 16:36 ` Jes Sorensen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Venkatesh Pallipadi @ 2006-11-01 18:35 UTC (permalink / raw)
  To: linux-ia64



PAL_GET_PSTATE accepts a type argument to return different kinds of
frequency information.
Refer: Intel Itanium®Architecture Software Developer's Manual -
Volume 2: System Architecture, Revision 2.2
(http://developer.intel.com/design/itanium/manuals/245318.htm)

Add the support for type argument and use Instantaneous frequency
in the acpi driver.

Also fix a bug, where in return value of PAL_GET_PSTATE was getting compared
with 'control' bits instead of 'status' bits.

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

diff -purN linux-2.6.18/arch/ia64/kernel/cpufreq/acpi-cpufreq.c linux-2.6.18-new/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
--- linux-2.6.18/arch/ia64/kernel/cpufreq/acpi-cpufreq.c	2006-09-19 20:42:06.000000000 -0700
+++ linux-2.6.18-new/arch/ia64/kernel/cpufreq/acpi-cpufreq.c	2006-10-10 09:58:32.000000000 -0700
@@ -68,7 +68,8 @@ processor_get_pstate (
 
 	dprintk("processor_get_pstate\n");
 
-	retval = ia64_pal_get_pstate(&pstate_index);
+	retval = ia64_pal_get_pstate(&pstate_index,
+	                             PAL_GET_PSTATE_TYPE_INSTANT);
 	*value = (u32) pstate_index;
 
 	if (retval)
@@ -91,7 +92,7 @@ extract_clock (
 	dprintk("extract_clock\n");
 
 	for (i = 0; i < data->acpi_data.state_count; i++) {
-		if (value >= data->acpi_data.states[i].control)
+		if (value = data->acpi_data.states[i].status)
 			return data->acpi_data.states[i].core_frequency;
 	}
 	return data->acpi_data.states[i-1].core_frequency;
@@ -117,11 +118,7 @@ processor_get_freq (
 		goto migrate_end;
 	}
 
-	/*
-	 * processor_get_pstate gets the average frequency since the
-	 * last get. So, do two PAL_get_freq()...
-	 */
-	ret = processor_get_pstate(&value);
+	/* processor_get_pstate gets the instantaneous frequency */
 	ret = processor_get_pstate(&value);
 
 	if (ret) {
diff -purN linux-2.6.18/include/asm-ia64/pal.h linux-2.6.18-new/include/asm-ia64/pal.h
--- linux-2.6.18/include/asm-ia64/pal.h	2006-09-19 20:42:06.000000000 -0700
+++ linux-2.6.18-new/include/asm-ia64/pal.h	2006-10-10 09:59:47.000000000 -0700
@@ -79,6 +79,11 @@
 #define PAL_GET_PSTATE		262	/* get the current P-state */
 #define PAL_SET_PSTATE		263	/* set the P-state */
 
+#define PAL_GET_PSTATE_TYPE_LASTSET	(0)
+#define PAL_GET_PSTATE_TYPE_AVGANDRESET	(1)
+#define PAL_GET_PSTATE_TYPE_AVGNORESET	(2)
+#define PAL_GET_PSTATE_TYPE_INSTANT	(3)
+
 #ifndef __ASSEMBLY__
 
 #include <linux/types.h>
@@ -1116,10 +1121,10 @@ ia64_pal_halt_info (pal_power_mgmt_info_
 
 /* Get the current P-state information */
 static inline s64
-ia64_pal_get_pstate (u64 *pstate_index)
+ia64_pal_get_pstate (u64 *pstate_index, unsigned long type)
 {
 	struct ia64_pal_retval iprv;
-	PAL_CALL_STK(iprv, PAL_GET_PSTATE, 0, 0, 0);
+	PAL_CALL_STK(iprv, PAL_GET_PSTATE, type, 0, 0);
 	*pstate_index = iprv.v0;
 	return iprv.status;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add support for type argument in PAL_GET_PSTATE
  2006-11-01 18:35 [PATCH] Add support for type argument in PAL_GET_PSTATE Venkatesh Pallipadi
@ 2006-12-01 16:36 ` Jes Sorensen
  2006-12-01 16:38 ` Jes Sorensen
  2006-12-01 23:28 ` Venkatesh Pallipadi
  2 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2006-12-01 16:36 UTC (permalink / raw)
  To: linux-ia64

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1252", Size: 985 bytes --]

>>>>> "Venkatesh" = Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> writes:

Venkatesh> PAL_GET_PSTATE accepts a type argument to return different
Venkatesh> kinds of frequency information.  Refer: Intel
Venkatesh> Itanium®Architecture Software Developer's Manual -
Venkatesh> Volume 2: System Architecture, Revision 2.2
Venkatesh> (http://developer.intel.com/design/itanium/manuals/245318.htm)

....

Venkatesh> @@ -79,6 +79,11 @@
Venkatesh>  #define PAL_GET_PSTATE		262	/* get the current P-state */
Venkatesh>  #define PAL_SET_PSTATE		263	/* set the P-state */
Venkatesh>  
Venkatesh> +#define PAL_GET_PSTATE_TYPE_LASTSET	(0)
Venkatesh> +#define PAL_GET_PSTATE_TYPE_AVGANDRESET	(1)
Venkatesh> +#define PAL_GET_PSTATE_TYPE_AVGNORESET	(2)
Venkatesh> +#define PAL_GET_PSTATE_TYPE_INSTANT	(3)
Venkatesh> +

Hi Venkatesh,

Please respect the previous formatting of the file and not add
pointless parenthesises around the constants like that.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add support for type argument in PAL_GET_PSTATE
  2006-11-01 18:35 [PATCH] Add support for type argument in PAL_GET_PSTATE Venkatesh Pallipadi
  2006-12-01 16:36 ` Jes Sorensen
@ 2006-12-01 16:38 ` Jes Sorensen
  2006-12-01 23:28 ` Venkatesh Pallipadi
  2 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2006-12-01 16:38 UTC (permalink / raw)
  To: linux-ia64

>>>>> "Jes" = Jes Sorensen <jes@sgi.com> writes:

Jes> Hi Venkatesh,

Jes> Please respect the previous formatting of the file and not add
Jes> pointless parenthesises around the constants like that.

DOH!

I read the date of the posting as Dec 1 not Nov 1 - so a bit
old. Point is still valid though.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Add support for type argument in PAL_GET_PSTATE
  2006-11-01 18:35 [PATCH] Add support for type argument in PAL_GET_PSTATE Venkatesh Pallipadi
  2006-12-01 16:36 ` Jes Sorensen
  2006-12-01 16:38 ` Jes Sorensen
@ 2006-12-01 23:28 ` Venkatesh Pallipadi
  2 siblings, 0 replies; 4+ messages in thread
From: Venkatesh Pallipadi @ 2006-12-01 23:28 UTC (permalink / raw)
  To: linux-ia64

> -----Original Message-----
> From: jes@trained-monkey.org [mailto:jes@trained-monkey.org] On Behalf
> Of Jes Sorensen
> Sent: Friday, December 01, 2006 8:39 AM
> To: Pallipadi, Venkatesh
> Cc: Luck, Tony; linux-ia64@vger.kernel.org
> Subject: Re: [PATCH] Add support for type argument in PAL_GET_PSTATE
> 
> >>>>> "Jes" = Jes Sorensen <jes@sgi.com> writes:
> 
> Jes> Hi Venkatesh,
> 
> Jes> Please respect the previous formatting of the file and not add
> Jes> pointless parenthesises around the constants like that.
> 
> I read the date of the posting as Dec 1 not Nov 1 - so a bit
> old. Point is still valid though.
> 

Agreed..

Below is the updated patch. 

Thanks,
Venki


PAL_GET_PSTATE accepts a type argument to return different kinds of
frequency information.
Refer: Intel Itanium®Architecture Software Developer's Manual - 
Volume 2: System Architecture, Revision 2.2
(http://developer.intel.com/design/itanium/manuals/245318.htm)

Add the support for type argument and use Instantaneous frequency
in the acpi driver.

Also fix a bug, where in return value of PAL_GET_PSTATE was getting compared
with 'control' bits instead of 'status' bits.

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

Index: linux-2.6.19-rc-mm/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
=================================--- linux-2.6.19-rc-mm.orig/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
+++ linux-2.6.19-rc-mm/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
@@ -68,7 +68,8 @@ processor_get_pstate (
 
 	dprintk("processor_get_pstate\n");
 
-	retval = ia64_pal_get_pstate(&pstate_index);
+	retval = ia64_pal_get_pstate(&pstate_index,
+	                             PAL_GET_PSTATE_TYPE_INSTANT);
 	*value = (u32) pstate_index;
 
 	if (retval)
@@ -91,7 +92,7 @@ extract_clock (
 	dprintk("extract_clock\n");
 
 	for (i = 0; i < data->acpi_data.state_count; i++) {
-		if (value >= data->acpi_data.states[i].control)
+		if (value = data->acpi_data.states[i].status)
 			return data->acpi_data.states[i].core_frequency;
 	}
 	return data->acpi_data.states[i-1].core_frequency;
@@ -117,11 +118,7 @@ processor_get_freq (
 		goto migrate_end;
 	}
 
-	/*
-	 * processor_get_pstate gets the average frequency since the
-	 * last get. So, do two PAL_get_freq()...
-	 */
-	ret = processor_get_pstate(&value);
+	/* processor_get_pstate gets the instantaneous frequency */
 	ret = processor_get_pstate(&value);
 
 	if (ret) {
Index: linux-2.6.19-rc-mm/include/asm-ia64/pal.h
=================================--- linux-2.6.19-rc-mm.orig/include/asm-ia64/pal.h
+++ linux-2.6.19-rc-mm/include/asm-ia64/pal.h
@@ -80,6 +80,11 @@
 #define PAL_SET_PSTATE		263	/* set the P-state */
 #define PAL_BRAND_INFO		274	/* Processor branding information */
 
+#define PAL_GET_PSTATE_TYPE_LASTSET	0
+#define PAL_GET_PSTATE_TYPE_AVGANDRESET	1
+#define PAL_GET_PSTATE_TYPE_AVGNORESET	2
+#define PAL_GET_PSTATE_TYPE_INSTANT	3
+
 #ifndef __ASSEMBLY__
 
 #include <linux/types.h>
@@ -1112,10 +1117,10 @@ ia64_pal_halt_info (pal_power_mgmt_info_
 
 /* Get the current P-state information */
 static inline s64
-ia64_pal_get_pstate (u64 *pstate_index)
+ia64_pal_get_pstate (u64 *pstate_index, unsigned long type)
 {
 	struct ia64_pal_retval iprv;
-	PAL_CALL_STK(iprv, PAL_GET_PSTATE, 0, 0, 0);
+	PAL_CALL_STK(iprv, PAL_GET_PSTATE, type, 0, 0);
 	*pstate_index = iprv.v0;
 	return iprv.status;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-01 23:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 18:35 [PATCH] Add support for type argument in PAL_GET_PSTATE Venkatesh Pallipadi
2006-12-01 16:36 ` Jes Sorensen
2006-12-01 16:38 ` Jes Sorensen
2006-12-01 23:28 ` Venkatesh Pallipadi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox