pwrnow.c revision 5951ced0ac070feedc4707fba3149df0b5b406f8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <sys/x86_archext.h>
#include <sys/machsystm.h>
#include <sys/cpu_acpi.h>
static int pwrnow_init(cpu_t *);
static void pwrnow_fini(cpu_t *);
static void pwrnow_stop(cpu_t *);
static boolean_t pwrnow_cpb_supported(void);
/*
* Interfaces for modules implementing AMD's PowerNow!.
*/
"PowerNow! Technology",
};
/*
* Error returns
*/
#define PWRNOW_RET_SUCCESS 0x00
#define PWRNOW_RET_NO_PM 0x01
#define PWRNOW_RET_UNSUP_STATE 0x02
#define PWRNOW_RET_TRANS_INCOMPLETE 0x03
#define PWRNOW_LATENCY_WAIT 10
/*
* MSR registers for changing and reading processor power state.
*/
#define PWRNOW_PERF_CTL_MSR 0xC0010062
#define PWRNOW_PERF_STATUS_MSR 0xC0010063
/*
* Debugging support
*/
#ifdef DEBUG
volatile int pwrnow_debug = 0;
#else
#define PWRNOW_DEBUG(arglist)
#endif
/*
* Write the ctrl register.
*/
static void
{
switch (pct_ctrl->cr_addrspace_id) {
break;
default:
return;
}
}
/*
* Transition the current processor to the requested state.
*/
static void
{
req_pstate += req_state;
/*
* Initiate the processor p-state change.
*/
}
static void
{
/*
* If thread is already running on target CPU then just
* make the transition request. Otherwise, we'll need to
* make a cross-call.
*/
}
if (!CPUSET_ISNULL(set)) {
}
}
/*
* Validate that this processor supports PowerNow! and if so,
* get the P-state data from ACPI and cache it.
*/
static int
{
/*
* Cache the P-state specific ACPI data.
*/
if (cpu_acpi_cache_pstate_data(handle) != 0) {
"disabled due to errors parsing ACPI P-state objects "
"exported by BIOS.");
return (PWRNOW_RET_NO_PM);
}
switch (pct_stat->cr_addrspace_id) {
PWRNOW_DEBUG(("Transitions will use fixed hardware\n"));
break;
default:
return (PWRNOW_RET_NO_PM);
}
/*
* Check for Core Performance Boost support
*/
if (pwrnow_cpb_supported())
return (PWRNOW_RET_SUCCESS);
}
/*
* Free resources allocated by pwrnow_init().
*/
static void
{
}
{
struct cpuid_regs cpu_regs;
/* Required features */
PWRNOW_DEBUG(("No CPUID or MSR support."));
return (B_FALSE);
}
/*
* Get the Advanced Power Management Information.
*/
(void) __cpuid_insn(&cpu_regs);
/*
* We currently only support CPU power management of
* processors that are P-state TSC invariant
*/
PWRNOW_DEBUG(("No support for CPUs that are not P-state "
"TSC invariant.\n"));
return (B_FALSE);
}
/*
* We only support the "Fire and Forget" style of PowerNow! (i.e.,
* single MSR write to change speed).
*/
PWRNOW_DEBUG(("Hardware P-State control is not supported.\n"));
return (B_FALSE);
}
return (B_TRUE);
}
static boolean_t
pwrnow_cpb_supported(void)
{
struct cpuid_regs cpu_regs;
/* Required features */
PWRNOW_DEBUG(("No CPUID or MSR support."));
return (B_FALSE);
}
/*
* Get the Advanced Power Management Information.
*/
(void) __cpuid_insn(&cpu_regs);
return (B_FALSE);
return (B_TRUE);
}
static void
{
}