1N/A * This file is part of PowerTOP 1N/A * This program file is free software; you can redistribute it and/or modify it 1N/A * under the terms of the GNU General Public License as published by the 1N/A * Free Software Foundation; version 2 of the License. 1N/A * This program is distributed in the hope that it will be useful, but WITHOUT 1N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1N/A * You should have received a copy of the GNU General Public License 1N/A * along with this program in a file named COPYING; if not, write to the 1N/A * Free Software Foundation, Inc., 1N/A * 51 Franklin Street, Fifth Floor, 1N/A * Boston, MA 02110-1301 USA 1N/A * Arjan van de Ven <arjan@linux.intel.com> 1N/A * Eric C Saxe <eric.saxe@sun.com> 1N/A * Aubrey Li <aubrey.li@intel.com> 1N/A * Copyright (c) 2009, Intel Corporation. 1N/A * All Rights Reserved. 2N/A * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 1N/A * For the avoidance of doubt, except that if any license choice other 1N/A * than GPL or LGPL is available it will apply instead, Sun elects to 1N/A * use only the General Public License version 2 (GPLv2) at this time 1N/A * for any software where a choice of GPL license versions is made 1N/A * available with the language indicating that GPLv2 or any later 1N/A * version may be used, or where a choice of which version of the GPL 1N/A * is applied is otherwise unspecified. 1N/A * Perform setup necessary to enumerate and track CPU speed changes 1N/A * Enumerate the CPU frequencies 1N/A * Return if speed transition is not supported 2N/A * The administrative interface offered by libpower is not especially 2N/A * suited to determine with certainty that any given specific PM 2N/A * feature (in this case CPU PM) is enabled, nor for being sure that 2N/A * it *has* been enabled if we try to set it using those 2N/A * responsiveness abstractions. 2N/A * For the time-being, therefore, we do not do this using the 2N/A * user-level administrative abstractions offered by libpower, 2N/A * instead, we will use a private interface offered directly by the pm 2N/A * device driver (see corresponding functions below) 1N/A * pt_cpufreq_check_pm() - 1N/A * This routine is called repeatedly (via pt_cpufreq_suggest()) 2N/A * from the main loop of pmconfig.c to see whether CPUPM is on or not. 1N/A * This implementation now checks directly (using /dev/pm), if CPUPM 1N/A * is enabled (thus allowing the use of P-states) 2N/A * 0 if PM is disabled or if CPUPM is not enabled 1N/A * 1 if there's nothing for us to do because: 1N/A * (a) the system does not support frequency scaling 1N/A * (b) we cannot open /dev/pm (need check for proper 1N/A * authorization above) 2N/A * 2 if CPUPM is enabled 1N/A * Notice the ordering of the return values, they will be picked up and 1N/A * switched upon ascendingly. 2N/A * Now, let's see if CPUPM is enabled 1N/A * We define a g_cpufreq_msg here, to say that CPUPM is disabled 1N/A * and a null function, which we need to associate with the 1N/A * suggestion that we will post when CPUPM is disabled. 1N/A * pt_check_cpupm_enabled() - 2N/A * access the kernel directly (using /dev/pm) to determine 2N/A * whether CPUPM is enabled or not. 1N/A * Check that CPUPM is enabled. 1N/A return (
B_FALSE);
/* Should be a sep. error condition really */ 1N/A * pt_cpufreq_suggest() - 1N/A * It installs a suggestion if CPUPM is disabled. 1N/A * If there is a null function, then nothing gets called when the 1N/A * associated key ('X' here) is struck. 1N/A * 0 - means that CPUPM (P-states) is not enabled. 1N/A * Put up a suggestion to let the user know that they 1N/A * can enable it using poweradm(1m). 1N/A * 2 - means that CPUPM (P-states) is enabled. 1N/A * Take down the suggestion.