View | Details | Raw Unified | Return to bug 8802
Collapse All | Expand All

(-)a/drivers/acpi/processor_throttling.c (-16 / +37 lines)
Lines 47-52 ACPI_MODULE_NAME("processor_throttling"); Link Here
47
static int acpi_processor_get_throttling(struct acpi_processor *pr);
47
static int acpi_processor_get_throttling(struct acpi_processor *pr);
48
int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
48
int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
49
49
50
/*
51
 * _TPC - Throttling Present Capabilities
52
 */
50
static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
53
static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
51
{
54
{
52
	acpi_status status = 0;
55
	acpi_status status = 0;
Lines 55-62 static int acpi_processor_get_platform_limit(struct acpi_processor *pr) Link Here
55
	if (!pr)
58
	if (!pr)
56
		return -EINVAL;
59
		return -EINVAL;
57
	status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
60
	status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
58
	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
61
	if (ACPI_FAILURE(status)) {
59
		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC"));
62
		if (status != AE_NOT_FOUND) {
63
			ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC"));
64
		}
60
		return -ENODEV;
65
		return -ENODEV;
61
	}
66
	}
62
	pr->throttling_platform_limit = (int)tpc;
67
	pr->throttling_platform_limit = (int)tpc;
Lines 68-76 int acpi_processor_tstate_has_changed(struct acpi_processor *pr) Link Here
68
	return acpi_processor_get_platform_limit(pr);
73
	return acpi_processor_get_platform_limit(pr);
69
}
74
}
70
75
71
/* --------------------------------------------------------------------------
76
/*
72
                             _PTC, _TSS, _TSD support 
77
 * _PTC - Processor Throttling Control (and status) register location
73
   -------------------------------------------------------------------------- */
78
 */
74
static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
79
static int acpi_processor_get_throttling_control(struct acpi_processor *pr)
75
{
80
{
76
	int result = 0;
81
	int result = 0;
Lines 81-87 static int acpi_processor_get_throttling_control(struct acpi_processor *pr) Link Here
81
86
82
	status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
87
	status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer);
83
	if (ACPI_FAILURE(status)) {
88
	if (ACPI_FAILURE(status)) {
84
		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC"));
89
		if (status != AE_NOT_FOUND) {
90
			ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC"));
91
		}
85
		return -ENODEV;
92
		return -ENODEV;
86
	}
93
	}
87
94
Lines 132-137 static int acpi_processor_get_throttling_control(struct acpi_processor *pr) Link Here
132
139
133
	return result;
140
	return result;
134
}
141
}
142
143
/*
144
 * _TSS - Throttling Supported States
145
 */
135
static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
146
static int acpi_processor_get_throttling_states(struct acpi_processor *pr)
136
{
147
{
137
	int result = 0;
148
	int result = 0;
Lines 144-150 static int acpi_processor_get_throttling_states(struct acpi_processor *pr) Link Here
144
155
145
	status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
156
	status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer);
146
	if (ACPI_FAILURE(status)) {
157
	if (ACPI_FAILURE(status)) {
147
		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS"));
158
		if (status != AE_NOT_FOUND) {
159
			ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS"));
160
		}
148
		return -ENODEV;
161
		return -ENODEV;
149
	}
162
	}
150
163
Lines 201-206 static int acpi_processor_get_throttling_states(struct acpi_processor *pr) Link Here
201
214
202
	return result;
215
	return result;
203
}
216
}
217
218
/*
219
 * _TSD - T-State Dependencies
220
 */
204
static int acpi_processor_get_tsd(struct acpi_processor *pr)
221
static int acpi_processor_get_tsd(struct acpi_processor *pr)
205
{
222
{
206
	int result = 0;
223
	int result = 0;
Lines 213-218 static int acpi_processor_get_tsd(struct acpi_processor *pr) Link Here
213
230
214
	status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
231
	status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer);
215
	if (ACPI_FAILURE(status)) {
232
	if (ACPI_FAILURE(status)) {
233
		if (status != AE_NOT_FOUND) {
234
			ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSD"));
235
		}
216
		return -ENODEV;
236
		return -ENODEV;
217
	}
237
	}
218
238
Lines 525-533 int acpi_processor_get_throttling_info(struct acpi_processor *pr) Link Here
525
	int result = 0;
545
	int result = 0;
526
	int step = 0;
546
	int step = 0;
527
	int i = 0;
547
	int i = 0;
528
	int no_ptc = 0;
529
	int no_tss = 0;
530
	int no_tsd = 0;
531
548
532
	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
549
	ACPI_DEBUG_PRINT((ACPI_DB_INFO,
533
			  "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
550
			  "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
Lines 538-549 int acpi_processor_get_throttling_info(struct acpi_processor *pr) Link Here
538
	if (!pr)
555
	if (!pr)
539
		return -EINVAL;
556
		return -EINVAL;
540
557
541
	/* TBD: Support ACPI 2.0 objects */
558
	/*
542
	no_ptc = acpi_processor_get_throttling_control(pr);
559
	 * Evaluate _PTC, _TSS and _TPC
543
	no_tss = acpi_processor_get_throttling_states(pr);
560
	 * They must all be present or none of them can be used.
544
	no_tsd = acpi_processor_get_tsd(pr);
561
	 */
545
562
	if (acpi_processor_get_throttling_control(pr) ||
546
	if (no_ptc || no_tss) {
563
		acpi_processor_get_throttling_states(pr) ||
564
		acpi_processor_get_platform_limit(pr))
565
	{
547
		pr->throttling.acpi_processor_get_throttling =
566
		pr->throttling.acpi_processor_get_throttling =
548
		    &acpi_processor_get_throttling_fadt;
567
		    &acpi_processor_get_throttling_fadt;
549
		pr->throttling.acpi_processor_set_throttling =
568
		pr->throttling.acpi_processor_set_throttling =
Lines 555-560 int acpi_processor_get_throttling_info(struct acpi_processor *pr) Link Here
555
		    &acpi_processor_set_throttling_ptc;
574
		    &acpi_processor_set_throttling_ptc;
556
	}
575
	}
557
576
577
	acpi_processor_get_tsd(pr);
578
558
	if (!pr->throttling.address) {
579
	if (!pr->throttling.address) {
559
		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
580
		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
560
		return 0;
581
		return 0;

Return to bug 8802