All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Dominik Brodowski <linux@brodo.de>
Cc: acpi-devel@lists.sourceforge.net, andrew.grover@intel.com,
	cpufreq@www.linux.org.uk
Subject: Re: [ACPI] [PATCHES] ACPI Processor update [idle, throttling, thermal, cpufreq]
Date: Fri, 5 Sep 2003 00:23:06 -0500	[thread overview]
Message-ID: <200309050023.06761.dtor_core@ameritech.net> (raw)
In-Reply-To: <20030904222434.GC6350@brodo.de>

Dominik,

I have couple of concerns regarding P-states IO library, esp. 
acpi_processor_get_frequency. It seems that ACPI does not allow
to read current state without setting it first, at least with
the following code on my notebook I was always getting garbage 
in the status register:

+static int
+acpi_processor_get_current_state(
+       struct acpi_processor_performance       *perf)
+{
+       int     result = 0;
+       int     i;
+       u8      value;
+
+       ACPI_FUNCTION_TRACE("acpi_processor_get_current_state");
+
+       if (!perf->pr->flags.performance)
+               goto out;
+
+       value = inb(perf->status_register);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+               "Got 0x%02x from port 0x%04x\n", value, perf->status_register));
+
+       for (i = 0; i < perf->state_count; i++) {
+               if (value == (u8) perf->states[i].status) {
+                       perf->state = i;
+                       goto out;
+               }
+       }
+
+       /* couldn't match our state table - garbage in status register */
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+               "Bad data 0x%02x in performance status register 0x%04x\n",
+               value, perf->status_register));
+       result = -EFAULT;
+out:
+       return_VALUE(result);
+}

I am wondering is it just me, my code or general deficiency.

Also, do you really need to do notify_transition twice 
(acpi_processor_set_performance)?

Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dtor_core-yWtbtysYrB+LZ21kGMrzwg@public.gmane.org>
To: Dominik Brodowski <linux-JhLEnvuH02M@public.gmane.org>
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	andrew.grover-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	cpufreq-1walMZg8u8rXmaaqVzeoHQ@public.gmane.org
Subject: Re: [ACPI] [PATCHES] ACPI Processor update [idle, throttling, thermal, cpufreq]
Date: Fri, 5 Sep 2003 00:23:06 -0500	[thread overview]
Message-ID: <200309050023.06761.dtor_core@ameritech.net> (raw)
In-Reply-To: <20030904222434.GC6350-JhLEnvuH02M@public.gmane.org>

Dominik,

I have couple of concerns regarding P-states IO library, esp. 
acpi_processor_get_frequency. It seems that ACPI does not allow
to read current state without setting it first, at least with
the following code on my notebook I was always getting garbage 
in the status register:

+static int
+acpi_processor_get_current_state(
+       struct acpi_processor_performance       *perf)
+{
+       int     result = 0;
+       int     i;
+       u8      value;
+
+       ACPI_FUNCTION_TRACE("acpi_processor_get_current_state");
+
+       if (!perf->pr->flags.performance)
+               goto out;
+
+       value = inb(perf->status_register);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+               "Got 0x%02x from port 0x%04x\n", value, perf->status_register));
+
+       for (i = 0; i < perf->state_count; i++) {
+               if (value == (u8) perf->states[i].status) {
+                       perf->state = i;
+                       goto out;
+               }
+       }
+
+       /* couldn't match our state table - garbage in status register */
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+               "Bad data 0x%02x in performance status register 0x%04x\n",
+               value, perf->status_register));
+       result = -EFAULT;
+out:
+       return_VALUE(result);
+}

I am wondering is it just me, my code or general deficiency.

Also, do you really need to do notify_transition twice 
(acpi_processor_set_performance)?

Dmitry

  reply	other threads:[~2003-09-05  5:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-04 22:24 [PATCHES] ACPI Processor update [idle,throttling,thermal,cpufreq] Dominik Brodowski
2003-09-04 22:24 ` Dominik Brodowski
2003-09-05  5:23 ` Dmitry Torokhov [this message]
2003-09-05  5:23   ` [ACPI] [PATCHES] ACPI Processor update [idle, throttling, thermal, cpufreq] Dmitry Torokhov
2003-09-05  6:52   ` Dominik Brodowski
2003-09-05  6:52     ` Dominik Brodowski
2003-09-08 13:29 ` Pavel Machek
2003-09-08 13:29   ` Pavel Machek
2003-09-09 17:21   ` linux
2003-09-09 17:21     ` linux-JhLEnvuH02M
2003-09-09 23:13     ` Pavel Machek
2003-09-09 23:13       ` Pavel Machek
2003-09-09 23:29       ` linux
2003-09-09 23:29         ` linux-JhLEnvuH02M
2003-09-10  0:00         ` Pavel Machek
2003-09-10  0:00           ` Pavel Machek
     [not found]           ` <20030910000041.GC217-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2003-09-10  0:17             ` [PATCH] acpi 2.6: consistent user-forced throttling (9/8) [Was: Re: [PATCHES] ACPI Processor update [idle, throttling, thermal, cpufreq]] linux-JhLEnvuH02M
     [not found]               ` <20030910001716.GA10324-JhLEnvuH02M@public.gmane.org>
2003-09-10 10:54                 ` Nils Faerber
     [not found]                   ` <1063191264.23733.1320.camel-65LrUGLyukAb1SvskN2V4Q@public.gmane.org>
2003-09-10 12:53                     ` linux-JhLEnvuH02M

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=200309050023.06761.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=andrew.grover@intel.com \
    --cc=cpufreq@www.linux.org.uk \
    --cc=linux@brodo.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.