6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / uts / common / sys / acpi_drv.h
blobd8792520864a25bb2a5c80fabb7ed043685633f8
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _ACPI_DRV_H
28 #define _ACPI_DRV_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include <sys/param.h>
35 #include <sys/kstat.h>
37 enum acpi_drv_ioctl {
38 ACPI_DRV_IOC_BAY,
39 ACPI_DRV_IOC_INFO,
40 ACPI_DRV_IOC_STATUS,
41 ACPI_DRV_IOC_AC_COUNT,
42 ACPI_DRV_IOC_POWER_STATUS,
43 ACPI_DRV_IOC_SET_WARNING,
44 ACPI_DRV_IOC_GET_WARNING,
45 ACPI_DRV_IOC_LID_STATUS,
46 ACPI_DRV_IOC_LID_UPDATE,
47 ACPI_DRV_IOC_LEVELS,
48 ACPI_DRV_IOC_SET_BRIGHTNESS
51 #define ACPI_DRV_BST_CHARGING 2
52 #define ACPI_DRV_BST_DISCHARGING 1
54 typedef struct batt_bay {
55 /* Total number of bays in the system */
56 int bay_number;
59 * Bitmap for each bay and its battery.
60 * battery_map bit i:
61 * 1 -- battery inserted to bay i
62 * 0 -- bay i empty
64 uint64_t battery_map;
65 } batt_bay_t;
67 typedef struct acpi_bif {
68 uint32_t bif_unit;
71 * 0x00000000 - 0x7fffffff
72 * 0xffffffff - Unknown design capacity in [mWh] or [mAh]
74 uint32_t bif_design_cap;
77 * 0x00000000 - 0x7fffffff
78 * 0xffffffff - Unknown last full charge capacity in [mWh] or [mAh]
80 uint32_t bif_last_cap;
82 uint32_t bif_tech;
85 * 0x00000000 - 0x7fffffff
86 * 0xffffffff - Unknown design voltage in [mV]
88 uint32_t bif_voltage;
91 * 0x00000000 - 0x7fffffff in [mWh] or [mAh]
93 uint32_t bif_warn_cap;
96 * 0x00000000 - 0x7fffffff in [mWh] or [mAh]
98 uint32_t bif_low_cap;
100 uint32_t bif_gran1_cap;
101 uint32_t bif_gran2_cap;
102 char bif_model[MAXNAMELEN];
103 char bif_serial[MAXNAMELEN];
104 char bif_type[MAXNAMELEN];
105 char bif_oem_info[MAXNAMELEN];
106 } acpi_bif_t;
108 typedef struct acpi_bst {
109 uint32_t bst_state;
112 * 0x00000000 - 0x7fffffff in [mW] or [mA]
113 * 0xffffffff - Unknown rate
115 uint32_t bst_rate;
118 * 0x00000000 - 0x7fffffff in [mWh] or [mAh]
119 * 0xffffffff - Unknown capacity
121 uint32_t bst_rem_cap;
124 * 0x00000000 - 0x7fffffff in [mV]
125 * 0xffffffff - Unknown voltage
127 uint32_t bst_voltage;
128 } acpi_bst_t;
130 /* Battery warnning levels in percentage */
131 typedef struct acpi_drv_warn {
132 uint32_t bw_enabled; /* Enabled */
133 uint32_t bw_charge_warn; /* charge warn threshold */
134 uint32_t bw_charge_low; /* charge low threshold */
135 } acpi_drv_warn_t;
137 #define ACPI_DRV_NAME "acpi_drv"
138 #define ACPI_DRV_POWER_KSTAT_NAME "power"
139 #define ACPI_DRV_BTWARN_KSTAT_NAME "battery warning"
140 #define ACPI_DRV_BIF_KSTAT_NAME "battery BIF"
141 #define ACPI_DRV_BST_KSTAT_NAME "battery BST"
143 #define AC "AC"
144 #define BATTERY "battery"
145 #define SYSTEM_POWER "system power"
146 #define SUPPORTED_BATTERY_COUNT "supported_battery_count"
148 #define BW_ENABLED "enabled"
149 #define BW_POWEROFF_THRESHOLD "warn capacity threshold"
150 #define BW_SHUTDOWN_THRESHOLD "low capacity threshold"
152 #define BIF_UNIT "bif_unit"
153 #define BIF_DESIGN_CAP "bif_design_cap"
154 #define BIF_LAST_CAP "bif_last_cap"
155 #define BIF_TECH "bif_tech"
156 #define BIF_VOLTAGE "bif_voltage"
157 #define BIF_WARN_CAP "bif_warn_cap"
158 #define BIF_LOW_CAP "bif_low_cap"
159 #define BIF_GRAN1_CAP "bif_gran1_cap"
160 #define BIF_GRAN2_CAP "bif_gran2_cap"
161 #define BIF_MODEL "bif_model"
162 #define BIF_SERIAL "bif_serial"
163 #define BIF_TYPE "bif_type"
164 #define BIF_OEM_INFO "bif_oem_info"
166 #define BST_STATE "bst_state"
167 #define BST_RATE "bst_rate"
168 #define BST_REM_CAP "bst_rem_cap"
169 #define BST_VOLTAGE "bst_voltage"
171 #define PSR_AC_PRESENT "psr_ac_present"
173 typedef struct acpi_drv_power_kstat_s {
174 struct kstat_named acpi_drv_power;
175 struct kstat_named acpi_drv_supported_battery_count;
176 } acpi_drv_power_kstat_t;
178 typedef struct acpi_drv_warn_kstat_s {
179 struct kstat_named acpi_drv_bw_enabled;
180 struct kstat_named acpi_drv_bw_charge_warn;
181 struct kstat_named acpi_drv_bw_charge_low;
182 } acpi_drv_warn_kstat_t;
184 /* BIF kstat */
185 typedef struct acpi_drv_bif_kstat_s {
186 struct kstat_named acpi_drv_bif_unit;
187 struct kstat_named acpi_drv_bif_design_cap;
188 struct kstat_named acpi_drv_bif_last_cap;
189 struct kstat_named acpi_drv_bif_tech;
190 struct kstat_named acpi_drv_bif_voltage;
191 struct kstat_named acpi_drv_bif_warn_cap;
192 struct kstat_named acpi_drv_bif_low_cap;
193 struct kstat_named acpi_drv_bif_gran1_cap;
194 struct kstat_named acpi_drv_bif_gran2_cap;
195 struct kstat_named acpi_drv_bif_model;
196 struct kstat_named acpi_drv_bif_serial;
197 struct kstat_named acpi_drv_bif_type;
198 struct kstat_named acpi_drv_bif_oem_info;
199 } acpi_drv_bif_kstat_t;
201 /* BST kstat */
202 typedef struct acpi_drv_bst_kstat_s {
203 struct kstat_named acpi_drv_bst_state;
204 struct kstat_named acpi_drv_bst_rate;
205 struct kstat_named acpi_drv_bst_rem_cap;
206 struct kstat_named acpi_drv_bst_voltage;
207 } acpi_drv_bst_kstat_t;
209 /* acpi device types */
210 enum acpi_drv_type {
211 ACPI_DRV_TYPE_UNKNOWN,
212 ACPI_DRV_TYPE_CBAT,
213 ACPI_DRV_TYPE_AC,
214 ACPI_DRV_TYPE_LID,
215 ACPI_DRV_TYPE_DISPLAY,
216 ACPI_DRV_TYPE_HOTKEY
219 struct acpi_drv_output_info {
220 uint32_t adr; /* unique ID for this output device */
221 int nlev; /* number of brightness levels */
224 struct acpi_drv_output_status {
225 int state;
226 int num_levels;
227 int cur_level;
228 int cur_level_index;
231 #define ACPI_DRV_OK 0
232 #define ACPI_DRV_ERR -1
234 #ifdef __cplusplus
236 #endif
238 #endif /* _ACPI_DRV_H */