cpudrv_plat.c revision 5cff782560a1c3cf913ba5574a5123a299f3315e
/*
* 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"
/*
* CPU power management driver platform support.
*/
#include <sys/cpudrv_plat.h>
#include <sys/speedstep.h>
#include <sys/machsystm.h>
/*
* Different processor families have their own technologies for supporting
* CPU power management (i.e., Intel has Enhanced Speedstep for some of it's
* processors and AMD has PowerNOW for some of it's processors). We support
* these different technologies via modules that export the interfaces
* described below.
*
* If a module implements the technology that should be used to manage
* the current CPU device, then the cpum_init() module should return
* succesfully (i.e., return code of 0) and perform any initialization
* such that future power transistions can be performed by calling
* the cpum_power() interface(). And the cpum_fini() interface can be
* used to free any resources allocated by cpum_init().
*/
struct cpudrv_module_ops {
char *cm_label;
int (*cpum_init)(cpudrv_devstate_t *);
void (*cpum_fini)(cpudrv_devstate_t *);
};
/*
* Interfaces for modules implementing Intel's Enhanced Speedstep.
*/
static struct cpudrv_module_ops speedstep_ops = {
"Enhanced Speedstep Technology",
};
/*
* Table of supported modules.
*/
static struct cpudrv_module_ops *cpudrv_module_ops_table[] = {
};
static struct cpudrv_module_ops **cpumops;
/*
* Note that our driver numbers the power levels from lowest to
* highest starting at 1 (i.e., the lowest power level is 1 and
* the highest power level is cpupm->num_spd). The x86 modules get
* their power levels from ACPI which numbers power levels from
* highest to lowest starting at 0 (i.e., the lowest power level
* is (cpupm->num_spd - 1) and the highest power level is 0). So to
* map one of our driver power levels to one understood by ACPI we
* simply subtract our driver power level from cpupm->num_spd. Likewise,
* to map an ACPI power level to the proper driver power level, we
* subtract the ACPI power level from cpupm->num_spd.
*/
/*
* Change CPU speed using interface provided by module.
*/
int
{
int ret;
if (ret != 0)
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
/*
* Determine the cpu_id for the CPU device.
*/
{
}
/*
* All CPU instances have been initialized successfully.
*/
{
return (cpupm_is_ready());
}
/*
* Is the current thread the thread that is handling the
* PPC change notification?
*/
{
}
/*
* See if a module exists for managing power for this CPU.
*/
{
/*
* Loop through the CPU management module table and see if
* any of the modules implement CPU power management
* for this CPU.
*/
break;
}
/*
* Nope, we can't power manage this CPU.
*/
return (B_FALSE);
}
return (B_TRUE);
}
/*
* Free any resources associated with the power management module.
*/
void
{
}
/*
* This routine changes the top speed to which the CPUs can transition by:
*
* - Resetting the up_spd for all speeds lower than the new top speed
* to point to the new top speed.
* - Updating the framework with a new "normal" (maximum power) for this
* device.
*/
void
{
int pm_level;
int instance;
int i;
/*
* Don't mess with speeds that are higher than the new
* top speed. They should be out of range anyway.
*/
continue;
/*
* This is the new top speed.
*/
}
}
/*
* This routine reads the ACPI _PPC object. It's accessed as a callback
* by the ppm driver whenever a _PPC change notification is received.
*/
int
cpudrv_pm_get_topspeed(void *ctx)
{
int instance;
int plat_level;
return (plat_level);
}
/*
* This notification handler is called whenever the ACPI _PPC
* object changes. The _PPC is a sort of governor on power levels.
* It sets an upper threshold on which, _PSS defined, power levels
* are usuable. The _PPC value is dynamic and may change as properties
* (i.e., thermal or AC source) of the system change.
*/
/* ARGSUSED */
void
{
}
void
cpudrv_pm_redefine_topspeed(void *ctx)
{
/*
* This should never happen, unless ppm does not get loaded.
*/
if (cpupm_redefine_topspeed == NULL) {
"cpupm_redefine_topspeed has not been initialized - "
"ignoring notification");
return;
}
/*
* ppm callback needs to handle redefinition for all CPUs in
* the domain.
*/
}