xref: /illumos-gate/usr/src/uts/common/sys/ppmio.h (revision 4c87aefe8930bd07275b8dd2e96ea5f24d93a52e)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_PPMIO_H
27 #define	_SYS_PPMIO_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/types.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #define	PPMIOC			('p' << 8)
38 #define	PPMIOCSET		(PPMIOC | 1)
39 #define	PPMIOCGET		(PPMIOC | 2)
40 #define	PPMGET_DPWR		(PPMIOC | 3)
41 #define	PPMGET_DOMBYDEV		(PPMIOC | 4)
42 #define	PPMGET_DEVBYDOM		(PPMIOC | 5)
43 /*
44  * The following two ioctls are used for testing purposes only.
45  */
46 #if defined(__x86)
47 #define	PPMGET_NORMAL		(PPMIOC | 6)
48 #define	PPMSET_NORMAL		(PPMIOC | 7)
49 #endif
50 
51 /*
52  * PPMIOCGET
53  * Note: this ioctl command is available for Excalibur and Grover
54  * only, but will be removed in future, replacing with PPMGET_DPWR
55  */
56 typedef struct ppmreq {
57 	int	ppmdev;
58 	union ppmop {
59 		struct idev_power {
60 			int level;
61 		} idev_power;
62 	} ppmop;
63 } ppmreq_t;
64 
65 /* definition for ppmdev */
66 #define	PPM_INTERNAL_DEVICE_POWER	1
67 
68 /*
69  * PPMGET_DPWR
70  */
71 struct ppm_dpwr {
72 	char *domain;	/* domain name */
73 	int  level;	/* domain power level */
74 };
75 
76 /*
77  * PPMGET_DOMBYDEV
78  */
79 struct ppm_bydev {
80 	char *path;	/* device prom path */
81 	char *domlist;	/* domain names */
82 	size_t   size;	/* size of domlist buffer */
83 };
84 
85 /*
86  * PPMGET_DEVBYDOM
87  */
88 struct ppm_bydom {
89 	char *domain;	/* domain name */
90 	char *devlist;	/* domain device list */
91 	size_t   size;	/* size of devlist buffer */
92 };
93 
94 /*
95  * PPM[GS]ET_NORM
96  */
97 struct ppm_norm {
98 	char *path;	/* device prom path */
99 	int  norm;	/* normal level */
100 };
101 
102 #ifdef	_SYSCALL32
103 /*
104  * kernel view of ILP32 data structure
105  */
106 struct ppm_dpwr32 {
107 	caddr32_t domain;	/* domain name */
108 	int32_t  level;		/* domain power level */
109 };
110 
111 struct ppm_bydev32 {
112 	caddr32_t path;		/* device prom path */
113 	caddr32_t domlist;	/* domain names */
114 	size32_t   size;	/* size of domlist buffer */
115 };
116 
117 struct ppm_bydom32 {
118 	caddr32_t domain;	/* domain name */
119 	caddr32_t devlist;	/* domain device list */
120 	size32_t   size;	/* size of devlist buffer */
121 };
122 
123 struct ppm_norm32 {
124 	caddr32_t path;		/* device prom path */
125 	int32_t  norm;		/* normal level */
126 };
127 #endif	/* _SYSCALL32 */
128 
129 /*
130  * .level may be the following
131  */
132 #define	PPMIO_POWER_OFF		0
133 #define	PPMIO_POWER_ON		1
134 #define	PPMIO_LED_BLINKING	2
135 #define	PPMIO_LED_SOLIDON	3
136 /* (s10) */
137 #define	PPM_IDEV_POWER_OFF	PPMIO_POWER_OFF
138 #define	PPM_IDEV_POWER_ON	PPMIO_POWER_ON
139 
140 
141 #ifdef	__cplusplus
142 }
143 #endif
144 
145 #endif	/* _SYS_PPMIO_H */
146