2011-03-01 08:32:03 +03:00
|
|
|
/* $NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $ */
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
/*-
|
2011-02-25 15:08:35 +03:00
|
|
|
* Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen@iki.fi>
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#include <sys/cdefs.h>
|
2011-03-01 08:32:03 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.32 2011/03/01 05:32:03 jruoho Exp $");
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/cpu.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/kmem.h>
|
|
|
|
#include <sys/module.h>
|
2010-07-30 10:11:14 +04:00
|
|
|
#include <sys/mutex.h>
|
2010-12-30 15:05:02 +03:00
|
|
|
#include <sys/sysctl.h>
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
#include <dev/acpi/acpireg.h>
|
|
|
|
#include <dev/acpi/acpivar.h>
|
|
|
|
#include <dev/acpi/acpi_cpu.h>
|
|
|
|
|
|
|
|
#include <machine/acpi_machdep.h>
|
2011-02-27 20:10:33 +03:00
|
|
|
#include <machine/cpuvar.h>
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_BUS_COMPONENT
|
|
|
|
ACPI_MODULE_NAME ("acpi_cpu")
|
|
|
|
|
|
|
|
static int acpicpu_match(device_t, cfdata_t, void *);
|
|
|
|
static void acpicpu_attach(device_t, device_t, void *);
|
|
|
|
static int acpicpu_detach(device_t, int);
|
|
|
|
static int acpicpu_once_attach(void);
|
|
|
|
static int acpicpu_once_detach(void);
|
2010-08-16 21:58:42 +04:00
|
|
|
static void acpicpu_start(device_t);
|
2011-02-27 20:10:33 +03:00
|
|
|
static void acpicpu_debug_print(device_t);
|
2011-03-01 08:32:03 +03:00
|
|
|
static const char *acpicpu_debug_print_method(uint8_t);
|
2011-02-25 22:55:06 +03:00
|
|
|
static const char *acpicpu_debug_print_dep(uint32_t);
|
2010-12-30 15:05:02 +03:00
|
|
|
static void acpicpu_sysctl(device_t);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
static ACPI_STATUS acpicpu_object(ACPI_HANDLE, struct acpicpu_object *);
|
|
|
|
static int acpicpu_find(struct cpu_info *,
|
|
|
|
struct acpi_devnode **);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
static uint32_t acpicpu_cap(struct acpicpu_softc *);
|
2010-08-27 06:44:05 +04:00
|
|
|
static ACPI_STATUS acpicpu_cap_pdc(struct acpicpu_softc *, uint32_t);
|
|
|
|
static ACPI_STATUS acpicpu_cap_osc(struct acpicpu_softc *,
|
|
|
|
uint32_t, uint32_t *);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
static void acpicpu_notify(ACPI_HANDLE, uint32_t, void *);
|
|
|
|
static bool acpicpu_suspend(device_t, const pmf_qual_t *);
|
|
|
|
static bool acpicpu_resume(device_t, const pmf_qual_t *);
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
static uint32_t acpicpu_count = 0;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
struct acpicpu_softc **acpicpu_sc = NULL;
|
2010-12-30 15:05:02 +03:00
|
|
|
static struct sysctllog *acpicpu_log = NULL;
|
|
|
|
static bool acpicpu_dynamic = true;
|
|
|
|
static bool acpicpu_passive = true;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
static const char * const acpicpu_hid[] = {
|
|
|
|
"ACPI0007",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
CFATTACH_DECL_NEW(acpicpu, sizeof(struct acpicpu_softc),
|
|
|
|
acpicpu_match, acpicpu_attach, acpicpu_detach, NULL);
|
|
|
|
|
|
|
|
static int
|
|
|
|
acpicpu_match(device_t parent, cfdata_t match, void *aux)
|
|
|
|
{
|
2011-02-27 21:32:53 +03:00
|
|
|
struct cpu_info *ci;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
if (acpi_softc == NULL)
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
return 0;
|
|
|
|
|
2011-02-27 21:32:53 +03:00
|
|
|
ci = acpicpu_md_match(parent, match, aux);
|
|
|
|
|
|
|
|
if (ci == NULL)
|
2010-07-19 04:59:32 +04:00
|
|
|
return 0;
|
2010-07-23 09:32:02 +04:00
|
|
|
|
2011-02-27 21:32:53 +03:00
|
|
|
return acpicpu_find(ci, NULL);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
acpicpu_attach(device_t parent, device_t self, void *aux)
|
|
|
|
{
|
|
|
|
struct acpicpu_softc *sc = device_private(self);
|
2011-02-27 21:32:53 +03:00
|
|
|
struct cpu_info *ci;
|
2011-02-25 09:18:02 +03:00
|
|
|
cpuid_t id;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
int rv;
|
|
|
|
|
2011-02-27 21:32:53 +03:00
|
|
|
ci = acpicpu_md_attach(parent, self, aux);
|
|
|
|
|
|
|
|
if (ci == NULL)
|
|
|
|
return;
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
sc->sc_ci = ci;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
sc->sc_dev = self;
|
2010-08-16 21:58:42 +04:00
|
|
|
sc->sc_cold = true;
|
2011-02-27 20:10:33 +03:00
|
|
|
sc->sc_node = NULL;
|
|
|
|
|
|
|
|
rv = acpicpu_find(ci, &sc->sc_node);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
if (rv == 0) {
|
|
|
|
aprint_normal(": failed to match processor\n");
|
|
|
|
return;
|
|
|
|
}
|
2011-02-25 09:18:02 +03:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
if (acpicpu_once_attach() != 0) {
|
|
|
|
aprint_normal(": failed to initialize\n");
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
KASSERT(acpi_softc != NULL);
|
|
|
|
KASSERT(acpicpu_sc != NULL);
|
|
|
|
KASSERT(sc->sc_node != NULL);
|
|
|
|
|
2011-02-25 09:18:02 +03:00
|
|
|
id = sc->sc_ci->ci_acpiid;
|
|
|
|
|
|
|
|
if (acpicpu_sc[id] != NULL) {
|
2011-02-27 20:10:33 +03:00
|
|
|
aprint_normal(": already attached\n");
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
aprint_naive("\n");
|
|
|
|
aprint_normal(": ACPI CPU\n");
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
rv = acpicpu_object(sc->sc_node->ad_handle, &sc->sc_object);
|
|
|
|
|
|
|
|
if (ACPI_FAILURE(rv))
|
|
|
|
aprint_verbose_dev(self, "failed to obtain CPU object\n");
|
|
|
|
|
|
|
|
acpicpu_count++;
|
2011-02-25 09:18:02 +03:00
|
|
|
acpicpu_sc[id] = sc;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
sc->sc_cap = acpicpu_cap(sc);
|
2011-02-25 22:55:06 +03:00
|
|
|
sc->sc_ncpus = acpi_md_ncpus();
|
2011-02-27 20:10:33 +03:00
|
|
|
sc->sc_flags = acpicpu_md_flags();
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
KASSERT(acpicpu_count <= sc->sc_ncpus);
|
|
|
|
KASSERT(sc->sc_node->ad_device == NULL);
|
|
|
|
|
|
|
|
sc->sc_node->ad_device = self;
|
2010-07-30 10:11:14 +04:00
|
|
|
mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NONE);
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
acpicpu_cstate_attach(self);
|
2010-08-08 20:58:41 +04:00
|
|
|
acpicpu_pstate_attach(self);
|
2010-08-13 20:21:50 +04:00
|
|
|
acpicpu_tstate_attach(self);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
acpicpu_debug_print(self);
|
|
|
|
|
|
|
|
(void)config_interrupts(self, acpicpu_start);
|
2010-08-08 20:58:41 +04:00
|
|
|
(void)acpi_register_notify(sc->sc_node, acpicpu_notify);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
(void)pmf_device_register(self, acpicpu_suspend, acpicpu_resume);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
acpicpu_detach(device_t self, int flags)
|
|
|
|
{
|
|
|
|
struct acpicpu_softc *sc = device_private(self);
|
|
|
|
int rv = 0;
|
|
|
|
|
2010-08-11 20:22:18 +04:00
|
|
|
sc->sc_cold = true;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
acpi_deregister_notify(sc->sc_node);
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
|
|
|
|
rv = acpicpu_cstate_detach(self);
|
|
|
|
|
|
|
|
if (rv != 0)
|
|
|
|
return rv;
|
|
|
|
|
2010-08-08 20:58:41 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_P) != 0)
|
|
|
|
rv = acpicpu_pstate_detach(self);
|
|
|
|
|
|
|
|
if (rv != 0)
|
|
|
|
return rv;
|
|
|
|
|
2010-08-13 20:21:50 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_T) != 0)
|
|
|
|
rv = acpicpu_tstate_detach(self);
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
if (rv != 0)
|
|
|
|
return rv;
|
|
|
|
|
2010-07-30 10:11:14 +04:00
|
|
|
mutex_destroy(&sc->sc_mtx);
|
2011-02-27 20:10:33 +03:00
|
|
|
sc->sc_node->ad_device = NULL;
|
|
|
|
|
|
|
|
acpicpu_count--;
|
|
|
|
acpicpu_once_detach();
|
2010-07-30 10:11:14 +04:00
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
acpicpu_once_attach(void)
|
|
|
|
{
|
|
|
|
struct acpicpu_softc *sc;
|
|
|
|
unsigned int i;
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
if (acpicpu_count != 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
KASSERT(acpicpu_sc == NULL);
|
|
|
|
KASSERT(acpicpu_log == NULL);
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
acpicpu_sc = kmem_zalloc(maxcpus * sizeof(*sc), KM_SLEEP);
|
|
|
|
|
|
|
|
if (acpicpu_sc == NULL)
|
|
|
|
return ENOMEM;
|
|
|
|
|
|
|
|
for (i = 0; i < maxcpus; i++)
|
|
|
|
acpicpu_sc[i] = NULL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
acpicpu_once_detach(void)
|
|
|
|
{
|
|
|
|
struct acpicpu_softc *sc;
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
if (acpicpu_count != 0)
|
|
|
|
return EDEADLK;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-12-30 15:05:02 +03:00
|
|
|
if (acpicpu_log != NULL)
|
|
|
|
sysctl_teardown(&acpicpu_log);
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
if (acpicpu_sc != NULL)
|
|
|
|
kmem_free(acpicpu_sc, maxcpus * sizeof(*sc));
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-16 21:58:42 +04:00
|
|
|
static void
|
2011-02-27 20:10:33 +03:00
|
|
|
acpicpu_start(device_t self)
|
2010-08-16 21:58:42 +04:00
|
|
|
{
|
|
|
|
struct acpicpu_softc *sc = device_private(self);
|
2011-02-27 20:10:33 +03:00
|
|
|
static uint32_t count = 0;
|
2010-08-16 21:58:42 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
/*
|
|
|
|
* Run the state-specific initialization routines. These
|
|
|
|
* must run only once, after interrupts have been enabled,
|
|
|
|
* all CPUs are running, and all ACPI CPUs have attached.
|
|
|
|
*/
|
|
|
|
if (++count != acpicpu_count || acpicpu_count != sc->sc_ncpus) {
|
2010-08-16 21:58:42 +04:00
|
|
|
sc->sc_cold = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2011-02-27 20:10:33 +03:00
|
|
|
* Set the last ACPI CPU as non-cold
|
|
|
|
* only after C-states are enabled.
|
2010-08-16 21:58:42 +04:00
|
|
|
*/
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
|
|
|
|
acpicpu_cstate_start(self);
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
sc->sc_cold = false;
|
|
|
|
|
2010-08-16 21:58:42 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_P) != 0)
|
|
|
|
acpicpu_pstate_start(self);
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_T) != 0)
|
|
|
|
acpicpu_tstate_start(self);
|
|
|
|
|
2010-12-30 15:05:02 +03:00
|
|
|
acpicpu_sysctl(self);
|
2011-02-27 20:10:33 +03:00
|
|
|
aprint_debug_dev(self, "ACPI CPUs started\n");
|
2010-08-16 21:58:42 +04:00
|
|
|
}
|
|
|
|
|
2010-12-30 15:05:02 +03:00
|
|
|
static void
|
|
|
|
acpicpu_sysctl(device_t self)
|
|
|
|
{
|
|
|
|
const struct sysctlnode *node;
|
|
|
|
int err;
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
KASSERT(acpicpu_log == NULL);
|
|
|
|
|
2010-12-30 15:05:02 +03:00
|
|
|
err = sysctl_createv(&acpicpu_log, 0, NULL, &node,
|
|
|
|
CTLFLAG_PERMANENT, CTLTYPE_NODE, "hw", NULL,
|
|
|
|
NULL, 0, NULL, 0, CTL_HW, CTL_EOL);
|
|
|
|
|
|
|
|
if (err != 0)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
err = sysctl_createv(&acpicpu_log, 0, &node, &node,
|
|
|
|
CTLFLAG_PERMANENT, CTLTYPE_NODE, "acpi", NULL,
|
|
|
|
NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
|
|
|
|
|
|
|
|
if (err != 0)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
err = sysctl_createv(&acpicpu_log, 0, &node, &node,
|
|
|
|
0, CTLTYPE_NODE, "cpu", SYSCTL_DESCR("ACPI CPU"),
|
|
|
|
NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
|
|
|
|
|
|
|
|
if (err != 0)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
err = sysctl_createv(&acpicpu_log, 0, &node, NULL,
|
|
|
|
CTLFLAG_READWRITE, CTLTYPE_BOOL, "dynamic",
|
|
|
|
SYSCTL_DESCR("Dynamic states"), NULL, 0,
|
|
|
|
&acpicpu_dynamic, 0, CTL_CREATE, CTL_EOL);
|
|
|
|
|
|
|
|
if (err != 0)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
err = sysctl_createv(&acpicpu_log, 0, &node, NULL,
|
|
|
|
CTLFLAG_READWRITE, CTLTYPE_BOOL, "passive",
|
|
|
|
SYSCTL_DESCR("Passive cooling"), NULL, 0,
|
|
|
|
&acpicpu_passive, 0, CTL_CREATE, CTL_EOL);
|
|
|
|
|
|
|
|
if (err != 0)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
aprint_error_dev(self, "failed to initialize sysctl (err %d)\n", err);
|
|
|
|
}
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
static ACPI_STATUS
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
acpicpu_object(ACPI_HANDLE hdl, struct acpicpu_object *ao)
|
|
|
|
{
|
|
|
|
ACPI_OBJECT *obj;
|
|
|
|
ACPI_BUFFER buf;
|
|
|
|
ACPI_STATUS rv;
|
|
|
|
|
|
|
|
rv = acpi_eval_struct(hdl, NULL, &buf);
|
|
|
|
|
|
|
|
if (ACPI_FAILURE(rv))
|
2011-02-27 20:10:33 +03:00
|
|
|
goto out;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
obj = buf.Pointer;
|
|
|
|
|
|
|
|
if (obj->Type != ACPI_TYPE_PROCESSOR) {
|
|
|
|
rv = AE_TYPE;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (obj->Processor.ProcId > (uint32_t)maxcpus) {
|
|
|
|
rv = AE_LIMIT;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
KDASSERT((uint64_t)obj->Processor.PblkAddress < UINT32_MAX);
|
|
|
|
|
|
|
|
if (ao != NULL) {
|
|
|
|
ao->ao_procid = obj->Processor.ProcId;
|
|
|
|
ao->ao_pblklen = obj->Processor.PblkLength;
|
|
|
|
ao->ao_pblkaddr = obj->Processor.PblkAddress;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (buf.Pointer != NULL)
|
|
|
|
ACPI_FREE(buf.Pointer);
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
return rv;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
static int
|
|
|
|
acpicpu_find(struct cpu_info *ci, struct acpi_devnode **ptr)
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
{
|
2011-02-27 20:10:33 +03:00
|
|
|
struct acpi_softc *sc = acpi_softc;
|
|
|
|
struct acpicpu_object ao;
|
|
|
|
struct acpi_devnode *ad;
|
|
|
|
ACPI_INTEGER val;
|
|
|
|
ACPI_STATUS rv;
|
|
|
|
|
|
|
|
if (sc == NULL || acpi_active == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CPUs are declared in the ACPI namespace
|
|
|
|
* either as a Processor() or as a Device().
|
|
|
|
* In both cases the MADT entries are used
|
|
|
|
* for the match (see ACPI 4.0, section 8.4).
|
|
|
|
*/
|
|
|
|
SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
|
|
|
|
|
|
|
|
if (ad->ad_type == ACPI_TYPE_PROCESSOR) {
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
rv = acpicpu_object(ad->ad_handle, &ao);
|
2010-07-23 09:32:02 +04:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
if (ACPI_SUCCESS(rv) && ci->ci_acpiid == ao.ao_procid)
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (acpi_match_hid(ad->ad_devinfo, acpicpu_hid) != 0) {
|
|
|
|
|
|
|
|
rv = acpi_eval_integer(ad->ad_handle, "_UID", &val);
|
|
|
|
|
|
|
|
if (ACPI_SUCCESS(rv) && ci->ci_acpiid == val)
|
|
|
|
goto out;
|
|
|
|
}
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (ptr != NULL)
|
|
|
|
*ptr = ad;
|
|
|
|
|
2011-02-27 21:32:53 +03:00
|
|
|
return 10;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
acpicpu_cap(struct acpicpu_softc *sc)
|
|
|
|
{
|
2010-08-27 06:44:05 +04:00
|
|
|
uint32_t flags, cap = 0;
|
|
|
|
const char *str;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
ACPI_STATUS rv;
|
|
|
|
|
|
|
|
/*
|
2010-08-27 06:44:05 +04:00
|
|
|
* Query and set machine-dependent capabilities.
|
|
|
|
* Note that the Intel-specific _PDC method was
|
|
|
|
* deprecated in the ACPI 3.0 in favor of _OSC.
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
*/
|
2010-08-27 06:44:05 +04:00
|
|
|
flags = acpicpu_md_cap();
|
|
|
|
rv = acpicpu_cap_osc(sc, flags, &cap);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if (ACPI_FAILURE(rv) && rv != AE_NOT_FOUND) {
|
|
|
|
str = "_OSC";
|
|
|
|
goto fail;
|
|
|
|
}
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
rv = acpicpu_cap_pdc(sc, flags);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if (ACPI_FAILURE(rv) && rv != AE_NOT_FOUND) {
|
|
|
|
str = "_PDC";
|
|
|
|
goto fail;
|
|
|
|
}
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if (cap == 0)
|
|
|
|
cap = flags;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
return cap;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
fail:
|
|
|
|
aprint_error_dev(sc->sc_dev, "failed to evaluate "
|
|
|
|
"%s: %s\n", str, AcpiFormatException(rv));
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
return 0;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
static ACPI_STATUS
|
|
|
|
acpicpu_cap_pdc(struct acpicpu_softc *sc, uint32_t flags)
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
{
|
2010-08-27 06:44:05 +04:00
|
|
|
ACPI_OBJECT_LIST arg;
|
|
|
|
ACPI_OBJECT obj;
|
|
|
|
uint32_t cap[3];
|
|
|
|
|
|
|
|
arg.Count = 1;
|
|
|
|
arg.Pointer = &obj;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
cap[0] = ACPICPU_PDC_REVID;
|
|
|
|
cap[1] = 1;
|
2010-08-27 06:44:05 +04:00
|
|
|
cap[2] = flags;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
obj.Type = ACPI_TYPE_BUFFER;
|
|
|
|
obj.Buffer.Length = sizeof(cap);
|
2010-08-27 06:44:05 +04:00
|
|
|
obj.Buffer.Pointer = (void *)cap;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
return AcpiEvaluateObject(sc->sc_node->ad_handle, "_PDC", &arg, NULL);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static ACPI_STATUS
|
2010-08-27 06:44:05 +04:00
|
|
|
acpicpu_cap_osc(struct acpicpu_softc *sc, uint32_t flags, uint32_t *val)
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
{
|
2010-08-27 06:44:05 +04:00
|
|
|
ACPI_OBJECT_LIST arg;
|
|
|
|
ACPI_OBJECT obj[4];
|
|
|
|
ACPI_OBJECT *osc;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
ACPI_BUFFER buf;
|
|
|
|
ACPI_STATUS rv;
|
2010-08-27 06:44:05 +04:00
|
|
|
uint32_t cap[2];
|
|
|
|
uint32_t *ptr;
|
|
|
|
int i = 5;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
static uint8_t intel_uuid[16] = {
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
0x16, 0xA6, 0x77, 0x40, 0x0C, 0x29, 0xBE, 0x47,
|
|
|
|
0x9E, 0xBD, 0xD8, 0x70, 0x58, 0x71, 0x39, 0x53
|
|
|
|
};
|
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
cap[0] = ACPI_OSC_QUERY;
|
|
|
|
cap[1] = flags;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
again:
|
|
|
|
arg.Count = 4;
|
|
|
|
arg.Pointer = obj;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
obj[0].Type = ACPI_TYPE_BUFFER;
|
|
|
|
obj[0].Buffer.Length = sizeof(intel_uuid);
|
|
|
|
obj[0].Buffer.Pointer = intel_uuid;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
obj[1].Type = ACPI_TYPE_INTEGER;
|
|
|
|
obj[1].Integer.Value = ACPICPU_PDC_REVID;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
obj[2].Type = ACPI_TYPE_INTEGER;
|
|
|
|
obj[2].Integer.Value = __arraycount(cap);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
obj[3].Type = ACPI_TYPE_BUFFER;
|
|
|
|
obj[3].Buffer.Length = sizeof(cap);
|
|
|
|
obj[3].Buffer.Pointer = (void *)cap;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
buf.Pointer = NULL;
|
|
|
|
buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "_OSC", &arg, &buf);
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
if (ACPI_FAILURE(rv))
|
2010-08-27 06:44:05 +04:00
|
|
|
goto out;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
osc = buf.Pointer;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if (osc->Type != ACPI_TYPE_BUFFER) {
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
rv = AE_TYPE;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if (osc->Buffer.Length != sizeof(cap)) {
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
rv = AE_BUFFER_OVERFLOW;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
ptr = (uint32_t *)osc->Buffer.Pointer;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if ((ptr[0] & ACPI_OSC_ERROR) != 0) {
|
|
|
|
rv = AE_ERROR;
|
|
|
|
goto out;
|
|
|
|
}
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if ((ptr[0] & (ACPI_OSC_ERROR_REV | ACPI_OSC_ERROR_UUID)) != 0) {
|
|
|
|
rv = AE_BAD_PARAMETER;
|
|
|
|
goto out;
|
|
|
|
}
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
/*
|
|
|
|
* "It is strongly recommended that the OS evaluate
|
|
|
|
* _OSC with the Query Support Flag set until _OSC
|
|
|
|
* returns the Capabilities Masked bit clear, to
|
|
|
|
* negotiate the set of features to be granted to
|
|
|
|
* the OS for native support (ACPI 4.0, 6.2.10)."
|
|
|
|
*/
|
|
|
|
if ((ptr[0] & ACPI_OSC_ERROR_MASKED) != 0 && i >= 0) {
|
|
|
|
|
|
|
|
ACPI_FREE(buf.Pointer);
|
|
|
|
i--;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
goto again;
|
|
|
|
}
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
if ((cap[0] & ACPI_OSC_QUERY) != 0) {
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
ACPI_FREE(buf.Pointer);
|
|
|
|
cap[0] &= ~ACPI_OSC_QUERY;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
goto again;
|
|
|
|
}
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
/*
|
|
|
|
* It is permitted for _OSC to return all
|
|
|
|
* bits cleared, but this is specified to
|
|
|
|
* vary on per-device basis. Assume that
|
|
|
|
* everything rather than nothing will be
|
2010-10-28 08:28:29 +04:00
|
|
|
* supported in this case; we do not need
|
2010-08-27 06:44:05 +04:00
|
|
|
* the firmware to know the CPU features.
|
|
|
|
*/
|
|
|
|
*val = (ptr[1] != 0) ? ptr[1] : cap[1];
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
2010-08-27 06:44:05 +04:00
|
|
|
out:
|
|
|
|
if (buf.Pointer != NULL)
|
|
|
|
ACPI_FREE(buf.Pointer);
|
|
|
|
|
|
|
|
return rv;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
acpicpu_notify(ACPI_HANDLE hdl, uint32_t evt, void *aux)
|
|
|
|
{
|
|
|
|
ACPI_OSD_EXEC_CALLBACK func;
|
|
|
|
struct acpicpu_softc *sc;
|
|
|
|
device_t self = aux;
|
|
|
|
|
|
|
|
sc = device_private(self);
|
|
|
|
|
2010-08-14 15:16:14 +04:00
|
|
|
if (sc->sc_cold != false)
|
|
|
|
return;
|
|
|
|
|
2010-12-30 15:05:02 +03:00
|
|
|
if (acpicpu_dynamic != true)
|
|
|
|
return;
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
switch (evt) {
|
|
|
|
|
|
|
|
case ACPICPU_C_NOTIFY:
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_C) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
func = acpicpu_cstate_callback;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPICPU_P_NOTIFY:
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_P) == 0)
|
|
|
|
return;
|
|
|
|
|
2010-08-08 20:58:41 +04:00
|
|
|
func = acpicpu_pstate_callback;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPICPU_T_NOTIFY:
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_T) == 0)
|
|
|
|
return;
|
|
|
|
|
2010-08-13 20:21:50 +04:00
|
|
|
func = acpicpu_tstate_callback;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
aprint_error_dev(sc->sc_dev, "unknown notify: 0x%02X\n", evt);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
(void)AcpiOsExecute(OSL_NOTIFY_HANDLER, func, sc->sc_dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
acpicpu_suspend(device_t self, const pmf_qual_t *qual)
|
|
|
|
{
|
|
|
|
struct acpicpu_softc *sc = device_private(self);
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
|
|
|
|
(void)acpicpu_cstate_suspend(self);
|
|
|
|
|
2010-08-08 20:58:41 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_P) != 0)
|
|
|
|
(void)acpicpu_pstate_suspend(self);
|
|
|
|
|
2010-08-13 20:21:50 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_T) != 0)
|
|
|
|
(void)acpicpu_tstate_suspend(self);
|
|
|
|
|
2010-08-17 00:07:57 +04:00
|
|
|
sc->sc_cold = true;
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
acpicpu_resume(device_t self, const pmf_qual_t *qual)
|
|
|
|
{
|
|
|
|
struct acpicpu_softc *sc = device_private(self);
|
|
|
|
|
2010-08-17 00:07:57 +04:00
|
|
|
sc->sc_cold = false;
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
|
|
|
|
(void)acpicpu_cstate_resume(self);
|
|
|
|
|
2010-08-08 20:58:41 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_P) != 0)
|
|
|
|
(void)acpicpu_pstate_resume(self);
|
|
|
|
|
2010-08-13 20:21:50 +04:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_T) != 0)
|
|
|
|
(void)acpicpu_tstate_resume(self);
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-02-25 22:55:06 +03:00
|
|
|
static void
|
2011-02-27 20:10:33 +03:00
|
|
|
acpicpu_debug_print(device_t self)
|
2011-02-25 22:55:06 +03:00
|
|
|
{
|
2011-02-27 20:10:33 +03:00
|
|
|
struct acpicpu_softc *sc = device_private(self);
|
|
|
|
struct cpu_info *ci = sc->sc_ci;
|
2011-03-01 08:32:03 +03:00
|
|
|
struct acpicpu_cstate *cs;
|
|
|
|
struct acpicpu_pstate *ps;
|
|
|
|
struct acpicpu_tstate *ts;
|
|
|
|
static bool once = false;
|
2011-02-25 22:55:06 +03:00
|
|
|
struct acpicpu_dep *dep;
|
2011-03-01 08:32:03 +03:00
|
|
|
uint32_t i, method;
|
|
|
|
|
|
|
|
if (once != true) {
|
|
|
|
|
|
|
|
for (i = 0; i < __arraycount(sc->sc_cstate); i++) {
|
|
|
|
|
|
|
|
cs = &sc->sc_cstate[i];
|
|
|
|
|
|
|
|
if (cs->cs_method == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
aprint_verbose_dev(sc->sc_dev, "C%d: %3s, "
|
|
|
|
"lat %3u us, pow %5u mW, %s\n", i,
|
|
|
|
acpicpu_debug_print_method(cs->cs_method),
|
|
|
|
cs->cs_latency, cs->cs_power,
|
|
|
|
(cs->cs_flags != 0) ? "bus master check" : "");
|
|
|
|
}
|
|
|
|
|
|
|
|
method = sc->sc_pstate_control.reg_spaceid;
|
|
|
|
|
|
|
|
for (i = 0; i < sc->sc_pstate_count; i++) {
|
|
|
|
|
|
|
|
ps = &sc->sc_pstate[i];
|
|
|
|
|
|
|
|
if (ps->ps_freq == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
aprint_verbose_dev(sc->sc_dev, "P%d: %3s, "
|
|
|
|
"lat %3u us, pow %5u mW, %4u MHz\n", i,
|
|
|
|
acpicpu_debug_print_method(method),
|
|
|
|
ps->ps_latency, ps->ps_power, ps->ps_freq);
|
|
|
|
}
|
|
|
|
|
|
|
|
method = sc->sc_tstate_control.reg_spaceid;
|
|
|
|
|
|
|
|
for (i = 0; i < sc->sc_tstate_count; i++) {
|
|
|
|
|
|
|
|
ts = &sc->sc_tstate[i];
|
|
|
|
|
|
|
|
if (ts->ts_percent == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
aprint_verbose_dev(sc->sc_dev, "T%u: %3s, "
|
|
|
|
"lat %3u us, pow %5u mW, %3u %%\n", i,
|
|
|
|
acpicpu_debug_print_method(method),
|
|
|
|
ts->ts_latency, ts->ts_power, ts->ts_percent);
|
|
|
|
}
|
|
|
|
|
|
|
|
once = true;
|
|
|
|
}
|
2011-02-25 22:55:06 +03:00
|
|
|
|
2011-02-27 20:10:33 +03:00
|
|
|
aprint_debug_dev(sc->sc_dev, "id %u, lapic id %u, "
|
|
|
|
"cap 0x%04x, flags 0x%08x\n", ci->ci_acpiid,
|
|
|
|
(uint32_t)ci->ci_cpuid, sc->sc_cap, sc->sc_flags);
|
|
|
|
|
2011-02-25 22:55:06 +03:00
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_C_DEP) != 0) {
|
|
|
|
|
|
|
|
dep = &sc->sc_cstate_dep;
|
|
|
|
|
|
|
|
aprint_debug_dev(sc->sc_dev, "C-state coordination: "
|
|
|
|
"%u CPUs, domain %u, type %s\n", dep->dep_ncpus,
|
|
|
|
dep->dep_domain, acpicpu_debug_print_dep(dep->dep_type));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_P_DEP) != 0) {
|
|
|
|
|
|
|
|
dep = &sc->sc_pstate_dep;
|
|
|
|
|
|
|
|
aprint_debug_dev(sc->sc_dev, "P-state coordination: "
|
|
|
|
"%u CPUs, domain %u, type %s\n", dep->dep_ncpus,
|
|
|
|
dep->dep_domain, acpicpu_debug_print_dep(dep->dep_type));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((sc->sc_flags & ACPICPU_FLAG_T_DEP) != 0) {
|
|
|
|
|
|
|
|
dep = &sc->sc_tstate_dep;
|
|
|
|
|
|
|
|
aprint_debug_dev(sc->sc_dev, "T-state coordination: "
|
|
|
|
"%u CPUs, domain %u, type %s\n", dep->dep_ncpus,
|
|
|
|
dep->dep_domain, acpicpu_debug_print_dep(dep->dep_type));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-01 08:32:03 +03:00
|
|
|
static const char *
|
|
|
|
acpicpu_debug_print_method(uint8_t val)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (val) {
|
|
|
|
|
|
|
|
case ACPICPU_C_STATE_HALT:
|
|
|
|
return "HLT";
|
|
|
|
|
|
|
|
case ACPICPU_C_STATE_FFH:
|
|
|
|
case ACPI_ADR_SPACE_FIXED_HARDWARE:
|
|
|
|
return "FFH";
|
|
|
|
|
|
|
|
case ACPICPU_C_STATE_SYSIO: /* ACPI_ADR_SPACE_SYSTEM_IO */
|
|
|
|
return "I/O";
|
|
|
|
|
|
|
|
default:
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-25 22:55:06 +03:00
|
|
|
static const char *
|
|
|
|
acpicpu_debug_print_dep(uint32_t val)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (val) {
|
|
|
|
|
|
|
|
case ACPICPU_DEP_SW_ALL:
|
|
|
|
return "SW_ALL";
|
|
|
|
|
|
|
|
case ACPICPU_DEP_SW_ANY:
|
|
|
|
return "SW_ANY";
|
|
|
|
|
|
|
|
case ACPICPU_DEP_HW_ALL:
|
|
|
|
return "HW_ALL";
|
|
|
|
|
|
|
|
default:
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
MODULE(MODULE_CLASS_DRIVER, acpicpu, NULL);
|
|
|
|
|
2011-02-16 11:35:51 +03:00
|
|
|
#ifdef _MODULE
|
|
|
|
#include "ioconf.c"
|
|
|
|
#endif
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
static int
|
2011-02-16 11:35:51 +03:00
|
|
|
acpicpu_modcmd(modcmd_t cmd, void *aux)
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
{
|
2011-02-16 11:35:51 +03:00
|
|
|
int rv = 0;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
|
|
|
|
case MODULE_CMD_INIT:
|
|
|
|
|
2011-02-16 11:35:51 +03:00
|
|
|
#ifdef _MODULE
|
|
|
|
rv = config_init_component(cfdriver_ioconf_acpicpu,
|
|
|
|
cfattach_ioconf_acpicpu, cfdata_ioconf_acpicpu);
|
|
|
|
#endif
|
|
|
|
break;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
case MODULE_CMD_FINI:
|
|
|
|
|
2011-02-16 11:35:51 +03:00
|
|
|
#ifdef _MODULE
|
|
|
|
rv = config_fini_component(cfdriver_ioconf_acpicpu,
|
|
|
|
cfattach_ioconf_acpicpu, cfdata_ioconf_acpicpu);
|
|
|
|
#endif
|
|
|
|
break;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
|
|
|
|
default:
|
2011-02-16 11:35:51 +03:00
|
|
|
rv = ENOTTY;
|
Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).
Remarks:
1. Commented out in the GENERICs; more testing exposure is needed.
2. The C3-state is disabled for the time being because it turns off
timers, among them the local APIC timer. This may not be universally
true on all x86 processors; define ACPICPU_ENABLE_C3 to test.
3. The algorithm used to choose a power state may need tuning. When
evaluating the appropriate state, the implementation uses the
previous sleep time as an indicator. Additional hints would include
for example the system load.
Also bus master activity is evaluated when choosing a state. The
usb(4) stack is notorious for such activity even when unused.
Typically it must be disabled in order to reach the C3-state,
but it may also prevent the use of C2.
4. While no extensive empirical measurements have been carried out, the
power savings are somewhere between 1-2 W with C1 and C2, depending
on the processor, firmware, and load. With C3 even up to 4 W can be
saved. The less something ticks, the more power is saved.
ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 13:29:11 +04:00
|
|
|
}
|
|
|
|
|
2011-02-16 11:35:51 +03:00
|
|
|
return rv;
|
|
|
|
}
|