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]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
34 #include <sys/param.h>
35 #include <sys/kstat.h>
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
,
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 */
59 * Bitmap for each bay and its battery.
61 * 1 -- battery inserted to bay i
67 typedef struct acpi_bif
{
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
;
85 * 0x00000000 - 0x7fffffff
86 * 0xffffffff - Unknown design voltage in [mV]
91 * 0x00000000 - 0x7fffffff in [mWh] or [mAh]
93 uint32_t bif_warn_cap
;
96 * 0x00000000 - 0x7fffffff in [mWh] or [mAh]
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
];
108 typedef struct acpi_bst
{
112 * 0x00000000 - 0x7fffffff in [mW] or [mA]
113 * 0xffffffff - Unknown 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
;
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 */
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"
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
;
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
;
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 */
211 ACPI_DRV_TYPE_UNKNOWN
,
215 ACPI_DRV_TYPE_DISPLAY
,
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
{
231 #define ACPI_DRV_OK 0
232 #define ACPI_DRV_ERR -1
238 #endif /* _ACPI_DRV_H */