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