10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 54667Smh27603 * Common Development and Distribution License (the "License"). 64667Smh27603 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*10131SJane.Chu@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 234667Smh27603 * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_SUNPM_H 270Sstevel@tonic-gate #define _SYS_SUNPM_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* 300Sstevel@tonic-gate * Sun Specific Power Management definitions 310Sstevel@tonic-gate */ 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/isa_defs.h> 340Sstevel@tonic-gate #include <sys/dditypes.h> 350Sstevel@tonic-gate #include <sys/ddipropdefs.h> 360Sstevel@tonic-gate #include <sys/devops.h> 370Sstevel@tonic-gate #include <sys/time.h> 380Sstevel@tonic-gate #include <sys/cmn_err.h> 390Sstevel@tonic-gate #include <sys/ddidevmap.h> 400Sstevel@tonic-gate #include <sys/ddi_implfuncs.h> 410Sstevel@tonic-gate #include <sys/ddi_isa.h> 420Sstevel@tonic-gate #include <sys/model.h> 430Sstevel@tonic-gate #include <sys/devctl.h> 440Sstevel@tonic-gate 450Sstevel@tonic-gate #ifdef __cplusplus 460Sstevel@tonic-gate extern "C" { 470Sstevel@tonic-gate #endif 480Sstevel@tonic-gate 490Sstevel@tonic-gate #ifdef _KERNEL 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 52*10131SJane.Chu@Sun.COM * Power cycle transition check is supported for SCSI and SATA devices. 530Sstevel@tonic-gate */ 540Sstevel@tonic-gate #define DC_SCSI_FORMAT 0x1 /* SCSI */ 55*10131SJane.Chu@Sun.COM #define DC_SMART_FORMAT 0x2 /* SMART */ 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define DC_SCSI_MFR_LEN 6 /* YYYYWW */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate struct pm_scsi_cycles { 600Sstevel@tonic-gate int lifemax; /* lifetime max power cycles */ 610Sstevel@tonic-gate int ncycles; /* number of cycles so far */ 620Sstevel@tonic-gate char svc_date[DC_SCSI_MFR_LEN]; /* service date YYYYWW */ 630Sstevel@tonic-gate int flag; /* reserved for future */ 640Sstevel@tonic-gate }; 650Sstevel@tonic-gate 66*10131SJane.Chu@Sun.COM struct pm_smart_count { 67*10131SJane.Chu@Sun.COM int allowed; /* normalized max cycles allowed */ 68*10131SJane.Chu@Sun.COM int consumed; /* normalized consumed cycles */ 69*10131SJane.Chu@Sun.COM int flag; /* type of cycles */ 70*10131SJane.Chu@Sun.COM }; 71*10131SJane.Chu@Sun.COM 720Sstevel@tonic-gate struct pm_trans_data { 730Sstevel@tonic-gate int format; /* data format */ 740Sstevel@tonic-gate union { 750Sstevel@tonic-gate struct pm_scsi_cycles scsi_cycles; 76*10131SJane.Chu@Sun.COM struct pm_smart_count smart_count; 770Sstevel@tonic-gate } un; 780Sstevel@tonic-gate }; 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* 810Sstevel@tonic-gate * Power levels for devices supporting ACPI based D0, D1, D2, D3 states. 820Sstevel@tonic-gate * 830Sstevel@tonic-gate * Note that 0 is off in Solaris PM framework but D0 is full power 840Sstevel@tonic-gate * for these devices. 850Sstevel@tonic-gate */ 860Sstevel@tonic-gate #define PM_LEVEL_D3 0 /* D3 state - off */ 870Sstevel@tonic-gate #define PM_LEVEL_D2 1 /* D2 state */ 880Sstevel@tonic-gate #define PM_LEVEL_D1 2 /* D1 state */ 890Sstevel@tonic-gate #define PM_LEVEL_D0 3 /* D0 state - fully on */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate /* 920Sstevel@tonic-gate * Useful strings for creating pm-components property for these devices. 930Sstevel@tonic-gate * If a device driver wishes to provide more specific description of power 940Sstevel@tonic-gate * levels (highly recommended), it should NOT use following generic defines. 950Sstevel@tonic-gate */ 960Sstevel@tonic-gate #define PM_LEVEL_D3_STR "0=Device D3 State" 970Sstevel@tonic-gate #define PM_LEVEL_D2_STR "1=Device D2 State" 980Sstevel@tonic-gate #define PM_LEVEL_D1_STR "2=Device D1 State" 990Sstevel@tonic-gate #define PM_LEVEL_D0_STR "3=Device D0 State" 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate /* 1020Sstevel@tonic-gate * If you add or remove a function or data reference, please 1030Sstevel@tonic-gate * remember to duplicate the action below the #else clause for 1040Sstevel@tonic-gate * __STDC__. 1050Sstevel@tonic-gate */ 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate #ifdef __STDC__ 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate /* 1100Sstevel@tonic-gate * Generic Sun PM definitions. 1110Sstevel@tonic-gate */ 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate /* 1140Sstevel@tonic-gate * These are obsolete power management interfaces, they will be removed from 1150Sstevel@tonic-gate * a subsequent release. 1160Sstevel@tonic-gate */ 1170Sstevel@tonic-gate int 1180Sstevel@tonic-gate pm_create_components(dev_info_t *dip, int num_components); 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate void 1210Sstevel@tonic-gate pm_destroy_components(dev_info_t *dip); 1220Sstevel@tonic-gate 1230Sstevel@tonic-gate void 1240Sstevel@tonic-gate pm_set_normal_power(dev_info_t *dip, int component_number, int level); 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate int 1270Sstevel@tonic-gate pm_get_normal_power(dev_info_t *dip, int component_number); 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate /* 1300Sstevel@tonic-gate * These are power management interfaces. 1310Sstevel@tonic-gate */ 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate int 1340Sstevel@tonic-gate pm_busy_component(dev_info_t *dip, int component_number); 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate int 1370Sstevel@tonic-gate pm_idle_component(dev_info_t *dip, int component_number); 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate int 1400Sstevel@tonic-gate pm_get_current_power(dev_info_t *dip, int component, int *levelp); 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate int 1430Sstevel@tonic-gate pm_power_has_changed(dev_info_t *, int, int); 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate int 1460Sstevel@tonic-gate pm_trans_check(struct pm_trans_data *datap, time_t *intervalp); 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate int 1490Sstevel@tonic-gate pm_lower_power(dev_info_t *dip, int comp, int level); 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate int 1520Sstevel@tonic-gate pm_raise_power(dev_info_t *dip, int comp, int level); 1530Sstevel@tonic-gate 1544667Smh27603 int 1554667Smh27603 pm_update_maxpower(dev_info_t *dip, int comp, int level); 1564667Smh27603 1570Sstevel@tonic-gate #else /* __STDC__ */ 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate /* 1600Sstevel@tonic-gate * Obsolete interfaces. 1610Sstevel@tonic-gate */ 1620Sstevel@tonic-gate extern int pm_create_components(); 1630Sstevel@tonic-gate extern void pm_destroy_components(); 1640Sstevel@tonic-gate extern void pm_set_normal_power(); 1650Sstevel@tonic-gate extern int pm_get_normal_power(); 1660Sstevel@tonic-gate 1670Sstevel@tonic-gate /* 1680Sstevel@tonic-gate * PM interfaces 1690Sstevel@tonic-gate */ 1700Sstevel@tonic-gate extern int pm_busy_component(); 1710Sstevel@tonic-gate extern int pm_idle_component(); 1720Sstevel@tonic-gate extern int pm_get_current_power(); 1730Sstevel@tonic-gate extern int pm_power_has_changed(); 1740Sstevel@tonic-gate extern int pm_trans_check(); 1750Sstevel@tonic-gate extern int pm_lower_power(); 1760Sstevel@tonic-gate extern int pm_raise_power(); 1774667Smh27603 extern int pm_update_maxpower(); 1780Sstevel@tonic-gate 1790Sstevel@tonic-gate #endif /* __STDC__ */ 1800Sstevel@tonic-gate 1810Sstevel@tonic-gate #endif /* _KERNEL */ 1820Sstevel@tonic-gate 1830Sstevel@tonic-gate #ifdef __cplusplus 1840Sstevel@tonic-gate } 1850Sstevel@tonic-gate #endif 1860Sstevel@tonic-gate 1870Sstevel@tonic-gate #endif /* _SYS_SUNPM_H */ 188