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