8579 ixgbe infinite loops in rar and vmdq clearing
[unleashed.git] / usr / src / uts / i86pc / sys / cpudrv_mach.h
blob8832fd1f19d172cdfd7c57e0671cc957bf5dce25
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_CPUDRV_MACH_H
27 #define _SYS_CPUDRV_MACH_H
29 #include <sys/cpuvar.h>
30 #include <sys/cpupm.h>
31 #include <sys/cpu_acpi.h>
32 #include <sys/cpudrv.h>
33 #include <sys/ksynch.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 * We currently refuse to power manage if the CPU in not ready to
41 * take cross calls (cross calls fail silently if CPU is not ready
42 * for it).
44 extern cpuset_t cpu_ready_set;
45 #define CPUDRV_XCALL_IS_READY(cpuid) CPU_IN_SET(cpu_ready_set, (cpuid))
48 * We're about to exit the _PPC thread so reset tag.
50 #define CPUDRV_RESET_GOVERNOR_THREAD(cpupm) { \
51 if (curthread == cpupm->pm_governor_thread) \
52 cpupm->pm_governor_thread = NULL; \
56 * The current top speed as defined by the _PPC.
58 #define CPUDRV_TOPSPEED(cpupm) (cpupm)->top_spd
61 * Install a _PPC/_TPC change notification handler.
63 #define CPUDRV_INSTALL_MAX_CHANGE_HANDLER(cpudsp) \
64 cpudrv_install_notify_handler(cpudsp);
67 * Uninstall _PPC/_TPC change notification handler.
69 #define CPUDRV_UNINSTALL_MAX_CHANGE_HANDLER(cpudsp) \
70 cpudrv_uninstall_notify_handler(cpudsp);
73 * Redefine the topspeed.
75 #define CPUDRV_REDEFINE_TOPSPEED(dip) cpudrv_redefine_topspeed(dip)
78 * Set callbacks so that PPM can callback into CPUDRV
80 #define CPUDRV_SET_PPM_CALLBACKS() { \
81 cpupm_get_topspeed_callb = cpudrv_get_topspeed; \
82 cpupm_set_topspeed_callb = cpudrv_set_topspeed; \
86 * ACPI provides the supported speeds.
88 #define CPUDRV_GET_SPEEDS(cpudsp, speeds, nspeeds) \
89 nspeeds = cpudrv_get_speeds(cpudsp, &speeds);
90 #define CPUDRV_FREE_SPEEDS(speeds, nspeeds) \
91 cpudrv_free_speeds(speeds, nspeeds);
94 * ACPI provides the supported C-states.
96 #define CPUDRV_GET_MAX_CSTATES(handle) \
97 cpu_acpi_get_max_cstates(handle);
100 * Compute the idle cnt percentage for a given speed.
102 #define CPUDRV_IDLE_CNT_PERCENT(hwm, speeds, i) \
103 (100 - (((100 - hwm) * speeds[0]) / speeds[i]))
106 * Compute the user cnt percentage for a given speed.
108 #define CPUDRV_USER_CNT_PERCENT(hwm, speeds, i) \
109 ((hwm * speeds[i]) / speeds[i - 1]);
112 * pm-components property defintions for this machine type.
114 * Fully constructed pm-components property should be an array of
115 * strings that look something like:
117 * pmc[0] = "NAME=CPU Speed"
118 * pmc[1] = "1=2800MHz"
119 * pmc[2] = "2=3200MHz"
121 * The amount of memory needed for each string is:
122 * digits for power level + '=' + digits for freq + 'MHz' + '\0'
124 #define CPUDRV_COMP_SIZE() \
125 (CPUDRV_COMP_MAX_DIG + 1 + CPUDRV_COMP_MAX_DIG + 3 + 1);
126 #define CPUDRV_COMP_SPEED(cpupm, cur_spd) cur_spd->speed;
127 #define CPUDRV_COMP_SPRINT(pmc, cpupm, cur_spd, comp_spd) \
128 (void) sprintf(pmc, "%d=%dMHz", cur_spd->pm_level, comp_spd);
130 extern void cpudrv_set_topspeed(void *, int);
131 extern int cpudrv_get_topspeed(void *);
132 extern int cpudrv_get_topthrottle(cpu_t *);
133 extern void cpudrv_manage_throttling(void *);
134 extern void cpudrv_install_notify_handler(cpudrv_devstate_t *);
135 extern void cpudrv_uninstall_notify_handler(cpudrv_devstate_t *);
136 extern void cpudrv_redefine_topspeed(void *);
137 extern uint_t cpudrv_get_speeds(cpudrv_devstate_t *, int **);
138 extern void cpudrv_free_speeds(int *, uint_t);
140 #ifdef __cplusplus
142 #endif
144 #endif /* _SYS_CPUDRV_MACH_H */