From: Janosch Machowinski <scotch-cGBD8117FJM@public.gmane.org>
To: Dominik Brodowski
<linux-X3ehHDuj6sIIGcDfoQAp7OTW4wlIGRCZ@public.gmane.org>
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: PATCH default C1
Date: Fri, 16 Sep 2005 21:03:36 +0200 [thread overview]
Message-ID: <432B1708.4060403@tzi.de> (raw)
In-Reply-To: <20050913180219.GB9572-X3ehHDuj6sIIGcDfoQAp7BvVK+yQ3ZXh@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
Same patch with corrected codestyle,
please test and apply
Janosch
Dominik Brodowski wrote:
>>+ /* We support up to ACPI_PROCESSOR_MAX_POWER. */
>>+ if (pr->power.count >= ACPI_PROCESSOR_MAX_POWER) {
>>+ printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER);
>>+ printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
>>+ break;
>>+ }
>
>
> broken indent
>
>
>>+ if (cx->valid) {
>>+ /*
>>+ * mark this CPU as being "idle manageable"
>>+ */
>>+ pr->flags.power = 1;
>>+ }
>
>
> same here.
>
> Dominik
[-- Attachment #2: mypatch.patch --]
[-- Type: text/plain, Size: 5065 bytes --]
--- linux-2.6.13/drivers/acpi/processor_idle.c 2005-09-02 21:49:32.000000000 +0200
+++ linux-2.6.13-patch/drivers/acpi/processor_idle.c 2005-09-14 17:16:13.000000000 +0200
@@ -513,20 +513,16 @@
if (!pr->pblk)
return_VALUE(-ENODEV);
-
- for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
- memset(pr->power.states, 0, sizeof(struct acpi_processor_cx));
+
+ /* We got C0 an C1 by default starting at 2 */
+ for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++)
+ memset(&(pr->power.states[i]), 0,
+ sizeof(struct acpi_processor_cx));
/* if info is obtained from pblk/fadt, type equals state */
- pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2;
pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3;
- /* the C0 state only exists as a filler in our array,
- * and all processors need to support C1 */
- pr->power.states[ACPI_STATE_C0].valid = 1;
- pr->power.states[ACPI_STATE_C1].valid = 1;
-
/* determine C2 and C3 address from pblk */
pr->power.states[ACPI_STATE_C2].address = pr->pblk + 4;
pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5;
@@ -554,10 +550,8 @@
memset(&(pr->power.states[i]), 0,
sizeof(struct acpi_processor_cx));
- /* if info is obtained from pblk/fadt, type equals state */
+ /* set the first C-State to C1 */
pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
- pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2;
- pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3;
/* the C0 state only exists as a filler in our array,
* and all processors need to support C1 */
@@ -581,8 +575,11 @@
if (nocst)
return_VALUE(-ENODEV);
- pr->power.count = 0;
- for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
+ /*We allready have C1 */
+ pr->power.count = 1;
+
+ /* We don't want to delete C0 and C1 so we start at 2 */
+ for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++)
memset(&(pr->power.states[i]), 0,
sizeof(struct acpi_processor_cx));
@@ -610,13 +607,6 @@
goto end;
}
- /* We support up to ACPI_PROCESSOR_MAX_POWER. */
- if (count > ACPI_PROCESSOR_MAX_POWER) {
- printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER);
- printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
- count = ACPI_PROCESSOR_MAX_POWER;
- }
-
/* Tell driver that at least _CST is supported. */
pr->flags.has_cst = 1;
@@ -660,7 +650,8 @@
(reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
continue;
- if ((cx.type < ACPI_STATE_C1) ||
+ /* We got C1 by default, so we only accept C2 and C3 states */
+ if ((cx.type < ACPI_STATE_C2) ||
(cx.type > ACPI_STATE_C3))
continue;
@@ -678,6 +669,13 @@
(pr->power.count)++;
memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx));
+
+ /* We support up to ACPI_PROCESSOR_MAX_POWER. */
+ if (pr->power.count >= ACPI_PROCESSOR_MAX_POWER) {
+ printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER);
+ printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
+ break;
+ }
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", pr->power.count));
@@ -796,6 +794,11 @@
*/
cx->valid = 1;
cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
+
+ /*
+ * mark this CPU as being "idle manageable"
+ */
+ pr->flags.power = 1;
return_VOID;
}
@@ -806,16 +809,19 @@
unsigned int i;
unsigned int working = 0;
- for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
+ /* C1 is allways valid, starting at 2 */
+ for (i=2; i < ACPI_PROCESSOR_MAX_POWER; i++) {
struct acpi_processor_cx *cx = &pr->power.states[i];
switch (cx->type) {
- case ACPI_STATE_C1:
- cx->valid = 1;
- break;
-
case ACPI_STATE_C2:
acpi_processor_power_verify_c2(cx);
+ if (cx->valid) {
+ /*
+ * mark this CPU as being "idle manageable"
+ */
+ pr->flags.power = 1;
+ }
break;
case ACPI_STATE_C3:
@@ -833,19 +839,19 @@
static int acpi_processor_get_power_info (
struct acpi_processor *pr)
{
- unsigned int i;
int result;
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info");
/* NOTE: the idle thread may not be running while calling
* this function */
-
+
+ /* Adding C1 state */
+ acpi_processor_get_power_info_default_c1(pr);
result = acpi_processor_get_power_info_cst(pr);
- if ((result) || (acpi_processor_power_verify(pr) < 2)) {
+ if ((result) || (!acpi_processor_power_verify(pr))) {
result = acpi_processor_get_power_info_fadt(pr);
- if ((result) || (acpi_processor_power_verify(pr) < 2))
- result = acpi_processor_get_power_info_default_c1(pr);
+ acpi_processor_power_verify(pr);
}
/*
@@ -860,17 +866,6 @@
if (result)
return_VALUE(result);
- /*
- * if one state of type C2 or C3 is available, mark this
- * CPU as being "idle manageable"
- */
- for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
- if (pr->power.states[i].valid) {
- pr->power.count = i;
- pr->flags.power = 1;
- }
- }
-
return_VALUE(0);
}
next prev parent reply other threads:[~2005-09-16 19:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-13 9:11 PATCH default C1 Janosch Machowinski
[not found] ` <432697CC.3020201-cGBD8117FJM@public.gmane.org>
2005-09-13 18:02 ` Dominik Brodowski
[not found] ` <20050913180219.GB9572-X3ehHDuj6sIIGcDfoQAp7BvVK+yQ3ZXh@public.gmane.org>
2005-09-16 19:03 ` Janosch Machowinski [this message]
[not found] ` <432B1708.4060403-cGBD8117FJM@public.gmane.org>
2005-09-17 9:13 ` Dominik Brodowski
[not found] ` <20050917091344.GB1522-JwFqNg2GrOVrgjWwlLH9qw@public.gmane.org>
2005-09-17 11:29 ` Janosch Machowinski
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=432B1708.4060403@tzi.de \
--to=scotch-cgbd8117fjm@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-X3ehHDuj6sIIGcDfoQAp7OTW4wlIGRCZ@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox