xref: /titanic_51/usr/src/uts/sun4u/io/cpudrv_mach.c (revision 8c8a8d17e0c6c68e047f0e531c3f8ce133b9aea6)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * CPU power management driver support for sun4u.
28  */
29 #include <sys/ddi.h>
30 #include <sys/sunddi.h>
31 #include <sys/cpudrv_mach.h>
32 #include <sys/machsystm.h>
33 
34 boolean_t cpudrv_enabled = B_TRUE;
35 
36 /*
37  * Change CPU speed.
38  */
39 int
40 cpudrv_pm_change_speed(cpudrv_devstate_t *cpudsp, cpudrv_pm_spd_t *new_spd)
41 {
42 	xc_one(cpudsp->cpu_id, (xcfunc_t *)cpu_change_speed, \
43 	    (uint64_t)new_spd->speed, 0);
44 	return (DDI_SUCCESS);
45 }
46 
47 /*
48  * Determine the cpu_id for the CPU device.
49  */
50 boolean_t
51 cpudrv_pm_get_cpu_id(dev_info_t *dip,  processorid_t *cpu_id)
52 {
53 	return (dip_to_cpu_id(dip, cpu_id) == DDI_SUCCESS);
54 }
55 
56 /*
57  * A noop for this machine type.
58  */
59 boolean_t
60 cpudrv_pm_power_ready(void)
61 {
62 	return (B_TRUE);
63 }
64 
65 /*
66  * A noop for this machine type.
67  */
68 /* ARGSUSED */
69 boolean_t
70 cpudrv_pm_is_governor_thread(cpudrv_pm_t *cpupm)
71 {
72 	return (B_FALSE);
73 }
74 
75 /*
76  * A noop for this machine type.
77  */
78 /*ARGSUSED*/
79 boolean_t
80 cpudrv_mach_pm_init(cpudrv_devstate_t *cpudsp)
81 {
82 	return (B_TRUE);
83 }
84 
85 /*
86  * A noop for this machine type.
87  */
88 /*ARGSUSED*/
89 void
90 cpudrv_mach_pm_free(cpudrv_devstate_t *cpudsp)
91 {
92 }
93 
94 /*
95  * On SPARC all instances support power management unless attach fails.
96  * In the case of attach failure, cpupm_enabled will be false.
97  */
98 boolean_t
99 cpudrv_pm_enabled()
100 {
101 	return (B_TRUE);
102 }
103