cpupm.c revision 843e19887f64dde75055cf8842fc4db2171eff45
/*
* 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
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This callback is used to build the PPM CPU domains once
* all the CPU devices have been started. The callback is
* initialized by the PPM driver to point to a routine that
* will build the domains.
*/
void (*cpupm_rebuild_cpu_domains)(void);
/*
* This callback is used to reset the topspeed for all the
* CPU devices. The callback is initialized by the PPM driver to
* point to a routine that will reinitialize all the CPU devices
* once all the CPU devices have been started and the CPU domains
* built.
*/
void (*cpupm_init_topspeed)(void);
/*
* This callback is used to redefine the topspeed for a CPU device.
* Since all CPUs in a domain should have identical properties, this
* callback is initialized by the PPM driver to point to a routine
* that will redefine the topspeed for all devices in a CPU domain.
* This callback is exercised whenever an ACPI _PPC change notification
* is received by the CPU driver.
*/
void (*cpupm_redefine_topspeed)(void *);
/*
* This callback is used by the PPM driver to call into the CPU driver
* to find a CPU's current topspeed (i.e., it's current ACPI _PPC value).
*/
void (*cpupm_set_topspeed)(void *, int);
/*
* This callback is used by the PPM driver to call into the CPU driver
* to set a new topspeed for a CPU.
*/
int (*cpupm_get_topspeed)(void *);
/*
* Used to dynamically keep track of the CPU dependencies as CPU
* devices attach. Will subsequently be used by the PPM driver
* to build PPM CPU domains.
*/
/*
* If we are unable to correctly identify a dependency for any CPU, then
* we punt and all CPUs are managed as one domain.
*/
/*
* If any CPU fails to attach, then cpupm is disabled for all CPUs.
*/
/*
* Until all CPUs have succesfully attached, we do not allow
* power management.
*/
/*
* Print the CPU dependencies.
*/
static void
{
"print_cpu_dependencies: dependency %d "
}
}
}
/*
* Used to retrieve the dependencies built during CPUs attaching.
*/
{
return (cpupm_cpu_dependencies);
}
/*
* Build dependencies as CPUs attach. Note that we don't need to worry
* about locking the dependency lists as concurrency is not an issue.
* This routine relies on the fact that the CPU devices are attached
* sequentially by a single thread.
*/
void
{
if (!cpupm_dependencies_valid)
return;
if (cpu_dependency == -1) {
return;
}
break;
}
/* new dependency is created and linked at the head */
}
/* new cpu is created and linked at head of dependency */
}
/*
* Free the CPU dependencies.
*/
void
{
while (this_dependency != NULL) {
/* discard CPU node chain */
sizeof (cpupm_cpu_node_t));
}
kmem_free((void *)this_dependency,
sizeof (cpupm_cpu_dependency_t));
}
}
/*
* If all CPUs have attached successfully, then the CPUs are
* ready for power management.
*/
{
#ifndef __xpv
if (!cpupm_enabled)
return (B_FALSE);
return (cpupm_ready);
#else
return (B_FALSE);
#endif
}
/*
* By default, cpupm is enabled. But if there are any errors attaching
* any of the CPU devices, then it is disabled.
*/
void
{
if (!enable)
}
/*
* Once all CPUs have been started, the PPM driver should build CPU
* domains and initialize the topspeed for all CPU devices.
*/
void
{
#ifndef __xpv
/*
* The CPU domain built by the PPM during CPUs attaching
* should be rebuilt with the information retrieved from
* ACPI.
*/
if (cpupm_rebuild_cpu_domains != NULL)
/*
* If CPU power management was disabled, then there
* is nothing to do.
*/
if (!cpupm_enabled)
return;
if (cpupm_init_topspeed != NULL)
(*cpupm_init_topspeed)();
#else
#endif
}