Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Add support for type argument in PAL_GET_PSTATE

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>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by

Venkatesh Pallipadi and committed by
Tony Luck
17e77b1c 6dbfc19b

+11 -9
+4 -7
arch/ia64/kernel/cpufreq/acpi-cpufreq.c
··· 68 68 69 69 dprintk("processor_get_pstate\n"); 70 70 71 - retval = ia64_pal_get_pstate(&pstate_index); 71 + retval = ia64_pal_get_pstate(&pstate_index, 72 + PAL_GET_PSTATE_TYPE_INSTANT); 72 73 *value = (u32) pstate_index; 73 74 74 75 if (retval) ··· 92 91 dprintk("extract_clock\n"); 93 92 94 93 for (i = 0; i < data->acpi_data.state_count; i++) { 95 - if (value >= data->acpi_data.states[i].control) 94 + if (value == data->acpi_data.states[i].status) 96 95 return data->acpi_data.states[i].core_frequency; 97 96 } 98 97 return data->acpi_data.states[i-1].core_frequency; ··· 118 117 goto migrate_end; 119 118 } 120 119 121 - /* 122 - * processor_get_pstate gets the average frequency since the 123 - * last get. So, do two PAL_get_freq()... 124 - */ 125 - ret = processor_get_pstate(&value); 120 + /* processor_get_pstate gets the instantaneous frequency */ 126 121 ret = processor_get_pstate(&value); 127 122 128 123 if (ret) {
+7 -2
include/asm-ia64/pal.h
··· 84 84 #define PAL_SET_PSTATE 263 /* set the P-state */ 85 85 #define PAL_BRAND_INFO 274 /* Processor branding information */ 86 86 87 + #define PAL_GET_PSTATE_TYPE_LASTSET 0 88 + #define PAL_GET_PSTATE_TYPE_AVGANDRESET 1 89 + #define PAL_GET_PSTATE_TYPE_AVGNORESET 2 90 + #define PAL_GET_PSTATE_TYPE_INSTANT 3 91 + 87 92 #ifndef __ASSEMBLY__ 88 93 89 94 #include <linux/types.h> ··· 1146 1141 1147 1142 /* Get the current P-state information */ 1148 1143 static inline s64 1149 - ia64_pal_get_pstate (u64 *pstate_index) 1144 + ia64_pal_get_pstate (u64 *pstate_index, unsigned long type) 1150 1145 { 1151 1146 struct ia64_pal_retval iprv; 1152 - PAL_CALL_STK(iprv, PAL_GET_PSTATE, 0, 0, 0); 1147 + PAL_CALL_STK(iprv, PAL_GET_PSTATE, type, 0, 0); 1153 1148 *pstate_index = iprv.v0; 1154 1149 return iprv.status; 1155 1150 }