1141239Snjl# 2141239Snjl# Copyright (c) 2004 Nate Lawson 3141239Snjl# All rights reserved. 4141239Snjl# 5141239Snjl# Redistribution and use in source and binary forms, with or without 6141239Snjl# modification, are permitted provided that the following conditions 7141239Snjl# are met: 8141239Snjl# 1. Redistributions of source code must retain the above copyright 9141239Snjl# notice, this list of conditions and the following disclaimer. 10141239Snjl# 2. Redistributions in binary form must reproduce the above copyright 11141239Snjl# notice, this list of conditions and the following disclaimer in the 12141239Snjl# documentation and/or other materials provided with the distribution. 13141239Snjl# 14141239Snjl# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15141239Snjl# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16141239Snjl# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17141239Snjl# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18141239Snjl# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19141239Snjl# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20141239Snjl# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21141239Snjl# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22141239Snjl# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23141239Snjl# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24141239Snjl# SUCH DAMAGE. 25141239Snjl# 26141239Snjl# $FreeBSD$ 27141239Snjl# 28141239Snjl 29141239Snjl#include <sys/bus.h> 30141239Snjl 31141239SnjlINTERFACE cpufreq; 32141239Snjl 33141239SnjlHEADER { 34141239Snjl struct cf_level; 35141239Snjl struct cf_setting; 36141239Snjl}; 37141239Snjl 38141239Snjl# cpufreq interface methods 39141239Snjl 40141239Snjl# 41141239Snjl# Set the current CPU frequency level. 42141239Snjl# 43141239SnjlMETHOD int set { 44141239Snjl device_t dev; 45141239Snjl const struct cf_level *level; 46141239Snjl int priority; 47141239Snjl}; 48141239Snjl 49141239Snjl# 50141239Snjl# Get the current active level. 51141239Snjl# 52141239SnjlMETHOD int get { 53141239Snjl device_t dev; 54141239Snjl struct cf_level *level; 55141239Snjl}; 56141239Snjl 57141239Snjl# 58141239Snjl# Get the current possible levels, based on all drivers. 59141239Snjl# 60141239SnjlMETHOD int levels { 61141239Snjl device_t dev; 62141239Snjl struct cf_level *levels; 63141239Snjl int *count; 64141239Snjl}; 65141239Snjl 66141239Snjl# Individual frequency driver methods 67141239Snjl 68141239Snjl# 69141239Snjl# Set an individual driver's setting. 70141239Snjl# 71141239SnjlMETHOD int drv_set { 72141239Snjl device_t dev; 73141239Snjl const struct cf_setting *set; 74141239Snjl}; 75141239Snjl 76141239Snjl# 77141239Snjl# Get an individual driver's setting. 78141239Snjl# 79141239SnjlMETHOD int drv_get { 80141239Snjl device_t dev; 81141239Snjl struct cf_setting *set; 82141239Snjl}; 83141239Snjl 84141239Snjl# 85141239Snjl# Get the settings supported by a driver. 86141239Snjl# 87141239SnjlMETHOD int drv_settings { 88141239Snjl device_t dev; 89141239Snjl struct cf_setting *sets; 90141239Snjl int *count; 91142032Snjl}; 92142032Snjl 93142032Snjl# 94142032Snjl# Get an individual driver's type. 95142032Snjl# 96142032SnjlMETHOD int drv_type { 97142032Snjl device_t dev; 98141239Snjl int *type; 99141239Snjl}; 100142032Snjl 101