/*
* 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"
/*
* Platform Power Management master pseudo driver platform support.
*/
/*
*/
/*
* PPMDC_CPU_NEXT operation
*/
static int
{
#ifdef DEBUG
#endif
int ret = 0;
case PPMDC_CPUSPEEDKIO:
if (ret)
return (ret);
break;
default:
return (-1);
}
}
return (ret);
}
/*
* PPMDC_PRE_CHNG operation
*/
static int
{
#ifdef DEBUG
#endif
int lowest;
int ret = 0;
case PPMDC_VCORE:
break;
/* raise core voltage */
if (ppm_do_vcore > 0) {
if (ret != 0)
return (ret);
}
break;
default:
return (-1);
}
}
return (ret);
}
/*
* PPMDC_CPU_GO operation
*/
/* ARGSUSED */
static int
{
int ret = 0;
return (ret);
}
case PPMDC_KIO:
break;
default:
return (-1);
}
return (ret);
}
/*
* PPMDC_POST_CHNG operation
*/
static int
{
#ifdef DEBUG
#endif
int lowest;
int ret = 0;
case PPMDC_VCORE:
break;
/* lower core voltage */
if (ppm_do_vcore > 0) {
if (ret != 0)
return (ret);
}
break;
default:
return (-1);
}
}
return (ret);
}
/*
* The effective cpu estar model is: program all cpus to be ready to go
* the same next(or new) speed level, program all other system bus resident
* devices to the same next speed level. At last, pull the trigger to
* initiate the speed change for all system bus resident devices
* simultaneously.
*
* Schizo. On Enchilada, the JBus resident devides are Jalapeno(s) and
* Tomatillo(s).
*/
int
{
#ifdef DEBUG
#endif
char *chstr;
int ret;
/*
* Not all cpus may have transitioned to a known level by this time
*/
chstr = "UP";
speedup = 1;
incr = 1;
chstr = "DOWN";
speedup = 0;
incr = -1;
} else
return (DDI_SUCCESS);
/*
* This loop will execute 1x or 2x depending on
* number of times we need to change clock rates
*/
/* bring each cpu to next level */
continue;
if (ret == DDI_SUCCESS) {
continue;
}
/*
* if the driver was unable to lower cpu speed,
* the cpu probably got busy; set the previous
* cpus back to the original level
*/
if (speedup == 0)
return (ret);
}
/*
* set bus resident devices at next speed level
*/
if (ret != 0) {
return (ret);
}
/*
* platform dependent various operations before
* initiating cpu speed change
*/
if (ret != 0) {
return (ret);
}
/*
* the following 1us delay is actually required for us3i only.
* on us3i system, entering estar mode from full requires
* to set mcu to single fsm state followed by 1us delay
* before trigger actual transition. The mcu part is
* handled in us_drv, the delay is here.
*/
drv_usecwait(1);
/*
* initiate cpu speed change
*/
if (ret != 0) {
return (ret);
}
/*
* platform dependent operations post cpu speed change
*/
if (ret != 0)
return (ret);
} /* end of looping each level */
return (DDI_SUCCESS);
}
/*
* This handles the power-on case where cpu power level is
* PM_LEVEL_UNKNOWN. Per agreement with OBP, cpus always
* boot up at full speed. In fact, we must not making calls
* into tomtppm or schppm to trigger cpu speed change to a
* different level at early boot time since some cpu may not
* be ready, causing xc_one() to fail silently.
*
* Here we simply call pm_power() to get the power level updated
* in pm and ppm. Had xc_one() failed silently inside us_power()
* at this time we're unaffected.
*/
{
int ret;
if (ret != DDI_SUCCESS) {
"failed to change power level to %d", new))
} else {
}
return (B_TRUE);
}
return (B_FALSE);
}