xref: /titanic_52/usr/src/uts/common/sys/sunpm.h (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_SYS_SUNPM_H
28 #define	_SYS_SUNPM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Sun Specific Power Management definitions
34  */
35 
36 #include <sys/isa_defs.h>
37 #include <sys/dditypes.h>
38 #include <sys/ddipropdefs.h>
39 #include <sys/devops.h>
40 #include <sys/time.h>
41 #include <sys/cmn_err.h>
42 #include <sys/ddidevmap.h>
43 #include <sys/ddi_implfuncs.h>
44 #include <sys/ddi_isa.h>
45 #include <sys/model.h>
46 #include <sys/devctl.h>
47 
48 #ifdef	__cplusplus
49 extern "C" {
50 #endif
51 
52 #ifdef	_KERNEL
53 
54 /*
55  * Power cycle transition check is supported for these devices.
56  */
57 #define	DC_SCSI_FORMAT		0x1		/* SCSI */
58 
59 #define	DC_SCSI_MFR_LEN		6		/* YYYYWW */
60 
61 struct pm_scsi_cycles {
62 	int	lifemax;			/* lifetime max power cycles */
63 	int	ncycles;			/* number of cycles so far */
64 	char	svc_date[DC_SCSI_MFR_LEN];	/* service date YYYYWW */
65 	int	flag;				/* reserved for future */
66 };
67 
68 struct pm_trans_data {
69 	int	format;				/* data format */
70 	union {
71 		struct pm_scsi_cycles scsi_cycles;
72 	} un;
73 };
74 
75 /*
76  * Power levels for devices supporting ACPI based D0, D1, D2, D3 states.
77  *
78  * Note that 0 is off in Solaris PM framework but D0 is full power
79  * for these devices.
80  */
81 #define	PM_LEVEL_D3		0	/* D3 state - off */
82 #define	PM_LEVEL_D2		1	/* D2 state */
83 #define	PM_LEVEL_D1		2	/* D1 state */
84 #define	PM_LEVEL_D0		3	/* D0 state - fully on */
85 
86 /*
87  * Useful strings for creating pm-components property for these devices.
88  * If a device driver wishes to provide more specific description of power
89  * levels (highly recommended), it should NOT use following generic defines.
90  */
91 #define	PM_LEVEL_D3_STR		"0=Device D3 State"
92 #define	PM_LEVEL_D2_STR		"1=Device D2 State"
93 #define	PM_LEVEL_D1_STR		"2=Device D1 State"
94 #define	PM_LEVEL_D0_STR		"3=Device D0 State"
95 
96 /*
97  * If you add or remove a function or data reference, please
98  * remember to duplicate the action below the #else clause for
99  * __STDC__.
100  */
101 
102 #ifdef	__STDC__
103 
104 /*
105  * Generic Sun PM definitions.
106  */
107 
108 /*
109  * These are obsolete power management interfaces, they will be removed from
110  * a subsequent release.
111  */
112 int
113 pm_create_components(dev_info_t *dip, int num_components);
114 
115 void
116 pm_destroy_components(dev_info_t *dip);
117 
118 void
119 pm_set_normal_power(dev_info_t *dip, int component_number, int level);
120 
121 int
122 pm_get_normal_power(dev_info_t *dip, int component_number);
123 
124 /*
125  * These are power management interfaces.
126  */
127 
128 int
129 pm_busy_component(dev_info_t *dip, int component_number);
130 
131 int
132 pm_idle_component(dev_info_t *dip, int component_number);
133 
134 int
135 pm_get_current_power(dev_info_t *dip, int component, int *levelp);
136 
137 int
138 pm_power_has_changed(dev_info_t *, int, int);
139 
140 int
141 pm_trans_check(struct pm_trans_data *datap, time_t *intervalp);
142 
143 int
144 pm_lower_power(dev_info_t *dip, int comp, int level);
145 
146 int
147 pm_raise_power(dev_info_t *dip, int comp, int level);
148 
149 #else	/* __STDC__ */
150 
151 /*
152  * Obsolete interfaces.
153  */
154 extern int pm_create_components();
155 extern void pm_destroy_components();
156 extern void pm_set_normal_power();
157 extern int pm_get_normal_power();
158 
159 /*
160  * PM interfaces
161  */
162 extern int pm_busy_component();
163 extern int pm_idle_component();
164 extern int pm_get_current_power();
165 extern int pm_power_has_changed();
166 extern int pm_trans_check();
167 extern int pm_lower_power();
168 extern int pm_raise_power();
169 
170 #endif	/* __STDC__ */
171 
172 #endif	/* _KERNEL */
173 
174 #ifdef	__cplusplus
175 }
176 #endif
177 
178 #endif	/* _SYS_SUNPM_H */
179