1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef __DEV_ACPI_ACPIDEV_H__
20 #define __DEV_ACPI_ACPIDEV_H__
21
22 #include <sys/sensors.h>
23 #include <sys/rwlock.h>
24 #include <dev/acpi/acpireg.h>
25
26 #define DEVNAME(s) ((s)->sc_dev.dv_xname)
27
28 #define ACPIDEV_NOPOLL 0
29 #define ACPIDEV_POLL 1
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 struct acpibat_bif {
53 u_int32_t bif_power_unit;
54 #define BIF_POWER_MW 0x00
55 #define BIF_POWER_MA 0x01
56 u_int32_t bif_capacity;
57 #define BIF_UNKNOWN 0xffffffff
58 u_int32_t bif_last_capacity;
59 u_int32_t bif_technology;
60 #define BIF_TECH_PRIMARY 0x00
61 #define BIF_TECH_SECONDARY 0x01
62 u_int32_t bif_voltage;
63 u_int32_t bif_warning;
64 u_int32_t bif_low;
65 u_int32_t bif_cap_granu1;
66 u_int32_t bif_cap_granu2;
67 char bif_model[20];
68 char bif_serial[20];
69 char bif_type[20];
70 char bif_oem[20];
71 };
72
73
74
75
76
77
78 #define CMB_OSC_UUID "f18fc78b-0f15-4978-b793-53f833a1d35b"
79 #define CMB_OSC_GRANULARITY 0x01
80 #define CMB_OSC_WAKE_ON_LOW 0x02
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100 struct acpibat_bst {
101 u_int32_t bst_state;
102 #define BST_DISCHARGE 0x01
103 #define BST_CHARGE 0x02
104 #define BST_CRITICAL 0x04
105 u_int32_t bst_rate;
106 #define BST_UNKNOWN 0xffffffff
107 u_int32_t bst_capacity;
108 u_int32_t bst_voltage;
109 };
110
111
112
113
114
115
116 #define BTP_CLEAR_TRIP_POINT 0x00
117
118
119
120
121
122
123 #define BTM_CURRENT_RATE 0x00
124
125 #define BTM_RATE_TOO_LARGE 0x00
126 #define BTM_CRITICAL 0x00
127 #define BTM_UNKNOWN 0xffffffff
128
129
130
131
132
133
134
135
136
137
138
139
140
141 struct acpibat_bmd {
142 u_int32_t bmd_status;
143 #define BMD_AML_CALIBRATE_CYCLE 0x01
144 #define BMD_CHARGING_DISABLED 0x02
145 #define BMD_DISCHARGE_WHILE_AC 0x04
146 #define BMD_RECALIBRATE_BAT 0x08
147 #define BMD_GOTO_STANDBY_SPEED 0x10
148 u_int32_t bmd_capability;
149 #define BMD_CB_AML_CALIBRATION 0x01
150 #define BMD_CB_DISABLE_CHARGER 0x02
151 #define BMD_CB_DISCH_WHILE_AC 0x04
152 #define BMD_CB_AFFECT_ALL_BATT 0x08
153 #define BMD_CB_FULL_CHRG_FIRST 0x10
154 u_int32_t bmd_recalibrate_count;
155 #define BMD_ONLY_CALIB_IF_ST3 0x00
156 u_int32_t bmd_quick_recalibrate_time;
157 #define BMD_UNKNOWN 0xffffffff
158 u_int32_t bmd_slow_recalibrate_time;
159 };
160
161
162
163
164
165
166 #define BMC_AML_CALIBRATE 0x01
167 #define BMC_DISABLE_CHARGING 0x02
168 #define BMC_ALLOW_AC_DISCHARGE 0x04
169
170
171
172
173
174
175
176 #define PSR_OFFLINE 0x00
177 #define PSR_ONLINE 0x01
178
179
180
181
182
183
184
185
186 #define HPET_REG_SIZE 1024
187
188 #define HPET_CAPABILITIES 0x000
189 #define HPET_CONFIGURATION 0x010
190 #define HPET_INTERRUPT_STATUS 0x020
191 #define HPET_MAIN_COUNTER 0x0F0
192 #define HPET_TIMER0_CONFIG 0x100
193 #define HPET_TIMER0_COMPARE 0x108
194 #define HPET_TIMER0_INTERRUPT 0x110
195 #define HPET_TIMER1_CONFIG 0x200
196 #define HPET_TIMER1_COMPARE 0x208
197 #define HPET_TIMER1_INTERRUPT 0x310
198 #define HPET_TIMER2_CONFIG 0x400
199 #define HPET_TIMER2_COMPARE 0x408
200 #define HPET_TIMER2_INTERRUPT 0x510
201
202 #define STA_PRESENT (1L << 0)
203 #define STA_ENABLED (1L << 1)
204 #define STA_SHOW_UI (1L << 2)
205 #define STA_DEV_OK (1L << 3)
206 #define STA_BATTERY (1L << 4)
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221 struct acpicpu_pss {
222 u_int32_t pss_core_freq;
223 u_int32_t pss_power;
224 u_int32_t pss_trans_latency;
225 u_int32_t pss_bus_latency;
226 u_int32_t pss_ctrl;
227 u_int32_t pss_status;
228 };
229
230 int acpicpu_fetch_pss(struct acpicpu_pss **);
231 void acpicpu_set_notify(void (*)(struct acpicpu_pss *, int));
232
233
234
235
236
237
238 struct acpi_grd {
239 u_int8_t grd_descriptor;
240 u_int16_t grd_length;
241 struct acpi_gas grd_gas;
242 } __packed;
243
244
245
246
247
248
249
250
251
252
253 struct acpicpu_pct {
254 struct acpi_grd pct_ctrl;
255 struct acpi_grd pct_status;
256 };
257
258
259 struct acpiac_softc {
260 struct device sc_dev;
261
262 bus_space_tag_t sc_iot;
263 bus_space_handle_t sc_ioh;
264
265 struct acpi_softc *sc_acpi;
266 struct aml_node *sc_devnode;
267
268 int sc_ac_stat;
269
270 struct ksensor sc_sens[1];
271 struct ksensordev sc_sensdev;
272 };
273
274 struct acpibat_softc {
275 struct device sc_dev;
276
277 bus_space_tag_t sc_iot;
278 bus_space_handle_t sc_ioh;
279
280 struct acpi_softc *sc_acpi;
281 struct aml_node *sc_devnode;
282
283 struct acpibat_bif sc_bif;
284 struct acpibat_bst sc_bst;
285 volatile int sc_bat_present;
286
287 struct ksensor sc_sens[8];
288 struct ksensordev sc_sensdev;
289 };
290
291 struct acpidock_softc {
292 struct device sc_dev;
293
294 bus_space_tag_t sc_iot;
295 bus_space_handle_t sc_ioh;
296
297 struct acpi_softc *sc_acpi;
298 struct aml_node *sc_devnode;
299
300 TAILQ_HEAD(, aml_nodelist) sc_deps_h;
301 struct aml_nodelist *sc_deps;
302
303 struct ksensor sc_sens;
304 struct ksensordev sc_sensdev;
305
306 int sc_docked;
307 int sc_sta;
308
309 #define ACPIDOCK_STATUS_UNKNOWN -1
310 #define ACPIDOCK_STATUS_UNDOCKED 0
311 #define ACPIDOCK_STATUS_DOCKED 1
312 };
313
314 #define ACPIDOCK_EVENT_INSERT 0
315 #define ACPIDOCK_EVENT_EJECT 3
316
317
318 #endif