xref: /titanic_44/usr/src/uts/common/sys/sunpm.h (revision 5cff782560a1c3cf913ba5574a5123a299f3315e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*5cff7825Smh27603  * Common Development and Distribution License (the "License").
6*5cff7825Smh27603  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*5cff7825Smh27603  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*5cff7825Smh27603  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_SUNPM_H
277c478bd9Sstevel@tonic-gate #define	_SYS_SUNPM_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Sun Specific Power Management definitions
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
367c478bd9Sstevel@tonic-gate #include <sys/dditypes.h>
377c478bd9Sstevel@tonic-gate #include <sys/ddipropdefs.h>
387c478bd9Sstevel@tonic-gate #include <sys/devops.h>
397c478bd9Sstevel@tonic-gate #include <sys/time.h>
407c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
417c478bd9Sstevel@tonic-gate #include <sys/ddidevmap.h>
427c478bd9Sstevel@tonic-gate #include <sys/ddi_implfuncs.h>
437c478bd9Sstevel@tonic-gate #include <sys/ddi_isa.h>
447c478bd9Sstevel@tonic-gate #include <sys/model.h>
457c478bd9Sstevel@tonic-gate #include <sys/devctl.h>
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
487c478bd9Sstevel@tonic-gate extern "C" {
497c478bd9Sstevel@tonic-gate #endif
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Power cycle transition check is supported for these devices.
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #define	DC_SCSI_FORMAT		0x1		/* SCSI */
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #define	DC_SCSI_MFR_LEN		6		/* YYYYWW */
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate struct pm_scsi_cycles {
617c478bd9Sstevel@tonic-gate 	int	lifemax;			/* lifetime max power cycles */
627c478bd9Sstevel@tonic-gate 	int	ncycles;			/* number of cycles so far */
637c478bd9Sstevel@tonic-gate 	char	svc_date[DC_SCSI_MFR_LEN];	/* service date YYYYWW */
647c478bd9Sstevel@tonic-gate 	int	flag;				/* reserved for future */
657c478bd9Sstevel@tonic-gate };
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate struct pm_trans_data {
687c478bd9Sstevel@tonic-gate 	int	format;				/* data format */
697c478bd9Sstevel@tonic-gate 	union {
707c478bd9Sstevel@tonic-gate 		struct pm_scsi_cycles scsi_cycles;
717c478bd9Sstevel@tonic-gate 	} un;
727c478bd9Sstevel@tonic-gate };
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * Power levels for devices supporting ACPI based D0, D1, D2, D3 states.
767c478bd9Sstevel@tonic-gate  *
777c478bd9Sstevel@tonic-gate  * Note that 0 is off in Solaris PM framework but D0 is full power
787c478bd9Sstevel@tonic-gate  * for these devices.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D3		0	/* D3 state - off */
817c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D2		1	/* D2 state */
827c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D1		2	/* D1 state */
837c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D0		3	/* D0 state - fully on */
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * Useful strings for creating pm-components property for these devices.
877c478bd9Sstevel@tonic-gate  * If a device driver wishes to provide more specific description of power
887c478bd9Sstevel@tonic-gate  * levels (highly recommended), it should NOT use following generic defines.
897c478bd9Sstevel@tonic-gate  */
907c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D3_STR		"0=Device D3 State"
917c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D2_STR		"1=Device D2 State"
927c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D1_STR		"2=Device D1 State"
937c478bd9Sstevel@tonic-gate #define	PM_LEVEL_D0_STR		"3=Device D0 State"
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate /*
967c478bd9Sstevel@tonic-gate  * If you add or remove a function or data reference, please
977c478bd9Sstevel@tonic-gate  * remember to duplicate the action below the #else clause for
987c478bd9Sstevel@tonic-gate  * __STDC__.
997c478bd9Sstevel@tonic-gate  */
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate #ifdef	__STDC__
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * Generic Sun PM definitions.
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * These are obsolete power management interfaces, they will be removed from
1097c478bd9Sstevel@tonic-gate  * a subsequent release.
1107c478bd9Sstevel@tonic-gate  */
1117c478bd9Sstevel@tonic-gate int
1127c478bd9Sstevel@tonic-gate pm_create_components(dev_info_t *dip, int num_components);
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate void
1157c478bd9Sstevel@tonic-gate pm_destroy_components(dev_info_t *dip);
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate void
1187c478bd9Sstevel@tonic-gate pm_set_normal_power(dev_info_t *dip, int component_number, int level);
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate int
1217c478bd9Sstevel@tonic-gate pm_get_normal_power(dev_info_t *dip, int component_number);
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /*
1247c478bd9Sstevel@tonic-gate  * These are power management interfaces.
1257c478bd9Sstevel@tonic-gate  */
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate int
1287c478bd9Sstevel@tonic-gate pm_busy_component(dev_info_t *dip, int component_number);
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate int
1317c478bd9Sstevel@tonic-gate pm_idle_component(dev_info_t *dip, int component_number);
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate int
1347c478bd9Sstevel@tonic-gate pm_get_current_power(dev_info_t *dip, int component, int *levelp);
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate int
1377c478bd9Sstevel@tonic-gate pm_power_has_changed(dev_info_t *, int, int);
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate int
1407c478bd9Sstevel@tonic-gate pm_trans_check(struct pm_trans_data *datap, time_t *intervalp);
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate int
1437c478bd9Sstevel@tonic-gate pm_lower_power(dev_info_t *dip, int comp, int level);
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate int
1467c478bd9Sstevel@tonic-gate pm_raise_power(dev_info_t *dip, int comp, int level);
1477c478bd9Sstevel@tonic-gate 
148*5cff7825Smh27603 int
149*5cff7825Smh27603 pm_update_maxpower(dev_info_t *dip, int comp, int level);
150*5cff7825Smh27603 
1517c478bd9Sstevel@tonic-gate #else	/* __STDC__ */
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate /*
1547c478bd9Sstevel@tonic-gate  * Obsolete interfaces.
1557c478bd9Sstevel@tonic-gate  */
1567c478bd9Sstevel@tonic-gate extern int pm_create_components();
1577c478bd9Sstevel@tonic-gate extern void pm_destroy_components();
1587c478bd9Sstevel@tonic-gate extern void pm_set_normal_power();
1597c478bd9Sstevel@tonic-gate extern int pm_get_normal_power();
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate /*
1627c478bd9Sstevel@tonic-gate  * PM interfaces
1637c478bd9Sstevel@tonic-gate  */
1647c478bd9Sstevel@tonic-gate extern int pm_busy_component();
1657c478bd9Sstevel@tonic-gate extern int pm_idle_component();
1667c478bd9Sstevel@tonic-gate extern int pm_get_current_power();
1677c478bd9Sstevel@tonic-gate extern int pm_power_has_changed();
1687c478bd9Sstevel@tonic-gate extern int pm_trans_check();
1697c478bd9Sstevel@tonic-gate extern int pm_lower_power();
1707c478bd9Sstevel@tonic-gate extern int pm_raise_power();
171*5cff7825Smh27603 extern int pm_update_maxpower();
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1787c478bd9Sstevel@tonic-gate }
1797c478bd9Sstevel@tonic-gate #endif
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate #endif	/* _SYS_SUNPM_H */
182