Re: [ACPI] [PATCHES] ACPI Processor update [idle, throttling, thermal, cpufreq]

Dmitry Torokhov
2003-09-05T05:23:06Z

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