adds _TPC support which support Throttling Present Capabilities change for ACPI processor driver
signed-off-by: Luming Yu <[EMAIL PROTECTED]>
--
drivers/acpi/processor_core.c | 4 ++++
drivers/acpi/processor_throttling.c | 30 ++++++++++++++++++++++++++++--
include/acpi/processor.h | 3 +++
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index ddc9e20..b2093ca 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -67,6 +67,7 @@ #define ACPI_PROCESSOR_FILE_THROTTLING "
#define ACPI_PROCESSOR_FILE_LIMIT "limit"
#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
#define ACPI_PROCESSOR_NOTIFY_POWER 0x81
+#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
#define ACPI_PROCESSOR_LIMIT_USER 0
#define ACPI_PROCESSOR_LIMIT_THERMAL 1
@@ -702,6 +703,9 @@ static void acpi_processor_notify(acpi_h
acpi_processor_cst_has_changed(pr);
acpi_bus_generate_event(device, event, 0);
break;
+ case ACPI_PROCESSOR_NOTIFY_THROTTLING:
+ acpi_processor_tstate_has_changed(pr);
+ acpi_bus_generate_event(device, event, 0);
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Unsupported event [0x%x]\n", event));
diff --git a/drivers/acpi/processor_throttling.c
b/drivers/acpi/processor_throttling.c
index b334860..0528b27 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -44,6 +44,27 @@ #define ACPI_PROCESSOR_CLASS
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
ACPI_MODULE_NAME("processor_throttling");
+static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
+{
+ acpi_status status = 0;
+ unsigned long tpc = 0;
+
+ if(!pr)
+ return -EINVAL;
+ status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
+ if(ACPI_FAILURE(status) && status != AE_NOT_FOUND){
+ ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC"));
+ return -ENODEV;
+ }
+ pr->throttling_platform_limit = (int)tpc;
+ return 0;
+}
+
+int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
+{
+ return acpi_processor_get_platform_limit(pr);
+}
+
/* --------------------------------------------------------------------------
Throttling Control
--------------------------------------------------------------------------
*/
@@ -113,6 +134,8 @@ int acpi_processor_set_throttling(struct
if (state == pr->throttling.state)
return 0;
+ if (state < pr->throttling_platform_limit)
+ return -EPERM;
/*
* Calculate the duty_value and duty_mask.
*/
@@ -280,8 +303,11 @@ static int acpi_processor_throttling_seq
}
seq_printf(seq, "state count: %d\n"
- "active state: T%d\n",
- pr->throttling.state_count, pr->throttling.state);
+ "active state: T%d\n"
+ "state available: T%d to T%d\n",
+ pr->throttling.state_count, pr->throttling.state,
+ pr->throttling_platform_limit,
+ pr->throttling.state_count-1);
seq_puts(seq, "states:\n");
for (i = 0; i < pr->throttling.state_count; i++)
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index e375570..4f4372a 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -170,6 +170,9 @@ struct acpi_processor {
u32 id;
u32 pblk;
int performance_platform_limit;
+ int throttling_platform_limit;
+ /*0 - states 0..n-th satte available*/
+
struct acpi_processor_flags flags;
struct acpi_processor_power power;
struct acpi_processor_performance *performance;
_TPC.patch
Description: Binary data
