xref: /illumos-gate/usr/src/uts/common/sys/ppmio.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
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 #include <sys/types.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	PPMIOC			('p' << 8)
36 #define	PPMIOCSET		(PPMIOC | 1)
37 #define	PPMIOCGET		(PPMIOC | 2)
38 #define	PPMGET_DPWR		(PPMIOC | 3)
39 #define	PPMGET_DOMBYDEV		(PPMIOC | 4)
40 #define	PPMGET_DEVBYDOM		(PPMIOC | 5)
41 /*
42  * The following two ioctls are used for testing purposes only.
43  */
44 #if defined(__x86)
45 #define	PPMGET_NORMAL		(PPMIOC | 6)
46 #define	PPMSET_NORMAL		(PPMIOC | 7)
47 #endif
48 
49 /*
50  * PPMIOCGET
51  * Note: this ioctl command is available for Excalibur and Grover
52  * only, but will be removed in future, replacing with PPMGET_DPWR
53  */
54 typedef struct ppmreq {
55 	int	ppmdev;
56 	union ppmop {
57 		struct idev_power {
58 			int level;
59 		} idev_power;
60 	} ppmop;
61 } ppmreq_t;
62 
63 /* definition for ppmdev */
64 #define	PPM_INTERNAL_DEVICE_POWER	1
65 
66 /*
67  * PPMGET_DPWR
68  */
69 struct ppm_dpwr {
70 	char *domain;	/* domain name */
71 	int  level;	/* domain power level */
72 };
73 
74 /*
75  * PPMGET_DOMBYDEV
76  */
77 struct ppm_bydev {
78 	char *path;	/* device prom path */
79 	char *domlist;	/* domain names */
80 	size_t   size;	/* size of domlist buffer */
81 };
82 
83 /*
84  * PPMGET_DEVBYDOM
85  */
86 struct ppm_bydom {
87 	char *domain;	/* domain name */
88 	char *devlist;	/* domain device list */
89 	size_t   size;	/* size of devlist buffer */
90 };
91 
92 /*
93  * PPM[GS]ET_NORM
94  */
95 struct ppm_norm {
96 	char *path;	/* device prom path */
97 	int  norm;	/* normal level */
98 };
99 
100 #ifdef	_SYSCALL32
101 /*
102  * kernel view of ILP32 data structure
103  */
104 struct ppm_dpwr32 {
105 	caddr32_t domain;	/* domain name */
106 	int32_t  level;		/* domain power level */
107 };
108 
109 struct ppm_bydev32 {
110 	caddr32_t path;		/* device prom path */
111 	caddr32_t domlist;	/* domain names */
112 	size32_t   size;	/* size of domlist buffer */
113 };
114 
115 struct ppm_bydom32 {
116 	caddr32_t domain;	/* domain name */
117 	caddr32_t devlist;	/* domain device list */
118 	size32_t   size;	/* size of devlist buffer */
119 };
120 
121 struct ppm_norm32 {
122 	caddr32_t path;		/* device prom path */
123 	int32_t  norm;		/* normal level */
124 };
125 #endif	/* _SYSCALL32 */
126 
127 /*
128  * .level may be the following
129  */
130 #define	PPMIO_POWER_OFF		0
131 #define	PPMIO_POWER_ON		1
132 #define	PPMIO_LED_BLINKING	2
133 #define	PPMIO_LED_SOLIDON	3
134 /* (s10) */
135 #define	PPM_IDEV_POWER_OFF	PPMIO_POWER_OFF
136 #define	PPM_IDEV_POWER_ON	PPMIO_POWER_ON
137 
138 
139 #ifdef	__cplusplus
140 }
141 #endif
142 
143 #endif	/* _SYS_PPMIO_H */
144