cpu_acpi.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"
#include <sys/cpu_acpi.h>
/*
* Map the dip to an ACPI handle for the device.
*/
{
return (NULL);
}
return (handle);
}
/*
* Free any resources.
*/
void
{
}
}
/*
* Cache the ACPI _PCT data. The _PCT data defines the interface to use
* when making power level transitions (i.e., system IO ports, fixed
* hardware port, etc).
*/
int
{
int ret = -1;
int i;
/*
* Fetch the _PCT (if present) for the CPU node. Since the PCT is
* optional, non-existence is not a failure (we just consider
* it a fixed hardware case).
*/
return (1);
}
goto out;
}
/*
* Does the package look coherent?
*/
"Unexpected data in _PCT package.");
goto out;
}
if (greg->DescriptorType !=
"_PCT package has format error.");
goto out;
}
if (greg->ResourceLength !=
"_PCT package not right size.");
goto out;
}
goto out;
}
}
/*
* Looks good!
*/
}
ret = 0;
out:
return (ret);
}
/*
* Cache the ACPI _PSD data. The _PSD data defines CPU dependencies
* (think CPU domains).
*/
int
{
int ret = -1;
/*
* Fetch the _PSD (if present) for the CPU node. Since the PSD is
* optional, non-existence is not a failure (it's up to the caller
* to determine how to handle non-existence).
*/
return (1);
}
goto out;
}
goto out;
}
goto out;
}
ret = 0;
out:
return (ret);
}
/*
* Cache the _PSS data. The _PSS data defines the different power levels
* supported by the CPU and the attributes associated with each power level
* (i.e., frequency, voltage, etc.). The power levels are number from
* highest to lowest. That is, the highest power level is _PSS entry 0
* and the lowest power level is the last _PSS entry.
*/
int
{
ACPI_OBJECT *obj, *q, *l;
int ret = -1;
int cnt;
int i, j;
/*
* Fetch the _PSS (if present) for the CPU node. If there isn't
* one, then CPU power management will not be possible.
*/
return (1);
}
goto out;
}
/*
* Does the package look coherent?
*/
cnt = 0;
l = NULL;
"Unexpected data in _PSS package.");
goto out;
}
for (j = 0; j < CPU_ACPI_PSS_SIZE; j++) {
if (q[j].Type != ACPI_TYPE_INTEGER) {
"_PSS element invalid (type)");
goto out;
}
}
/*
* Some _PSS tables are larger than required
* and unused elements are filled with patterns
* of 0xff. Simply check here for frequency = 0xffff
* and stop counting if found. And still some other
* _PSS tables fill unused elements with a copy of the
* lowest pstate entry.
*/
continue;
}
/*
* We should never find a valid entry after we've hit one
* of the end-of-table entries above.
*/
if (eot) {
"Unexpected data in _PSS package after eot.");
goto out;
}
/*
* pstates must be defined in order from highest to lowest.
*/
"_PSS package pstate definitions out of order.");
goto out;
}
/*
* This entry passes.
*/
l = q;
cnt++;
}
if (cnt == 0)
goto out;
/*
* Yes, fill in pstate structure.
*/
KM_SLEEP);
for (i = 0; i < cnt; i++) {
for (j = 0; j < CPU_ACPI_PSS_SIZE; j++)
pstate++;
}
ret = 0;
out:
return (ret);
}
/*
* Cache the _PPC data. The _PPC simply contains an integer value which
* represents the highest power level that a CPU should transition to.
* That is, it's an index into the array of _PSS entries and will be
* greater than or equal to zero.
*/
void
{
/*
* Fetch the _PPC (if present) for the CPU node. Since the PPC is
* optional (I think), non-existence is not a failure.
*/
CPU_ACPI_PPC(handle) = 0;
return;
}
}
/*
* Cache the _PCT, _PSS, _PSD and _PPC data.
*/
int
{
if (cpu_acpi_cache_pct(handle) < 0) {
return (-1);
}
if (cpu_acpi_cache_pstates(handle) != 0) {
return (-1);
}
if (cpu_acpi_cache_psd(handle) < 0) {
return (-1);
}
return (0);
}
/*
* Register a handler for _PPC change notifications. The _PPC
* change notification is the means by which _P
*/
void
{
char path[MAXNAMELEN];
}
/*
* Write _PDC.
*/
int
{
int i;
for (i = 0; i < count; i++)
*bufptr++ = *capabilities++;
/*
* _PDC is optional, so don't log failure.
*/
return (-1);
}
return (0);
}
/*
* Write to system IO port.
*/
int
{
"%lx.", (long)address);
return (-1);
}
return (0);
}
/*
* Read from a system IO port.
*/
int
{
"%lx.", (long)address);
return (-1);
}
return (0);
}
/*
* Return supported frequencies.
*/
{
int *hspeeds;
int i;
for (i = 0; i < nspeeds; i++) {
}
return (nspeeds);
}
/*
* Free resources allocated by cpu_acpi_get_speeds().
*/
void
{
}