thinkpad_acpi.c revision 1.2 1 1.2 jmcneill /* $NetBSD: thinkpad_acpi.c,v 1.2 2007/12/21 16:38:02 jmcneill Exp $ */
2 1.1 jmcneill
3 1.1 jmcneill /*-
4 1.1 jmcneill * Copyright (c) 2007 Jared D. McNeill <jmcneill (at) invisible.ca>
5 1.1 jmcneill * All rights reserved.
6 1.1 jmcneill *
7 1.1 jmcneill * Redistribution and use in source and binary forms, with or without
8 1.1 jmcneill * modification, are permitted provided that the following conditions
9 1.1 jmcneill * are met:
10 1.1 jmcneill * 1. Redistributions of source code must retain the above copyright
11 1.1 jmcneill * notice, this list of conditions and the following disclaimer.
12 1.1 jmcneill * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 jmcneill * notice, this list of conditions and the following disclaimer in the
14 1.1 jmcneill * documentation and/or other materials provided with the distribution.
15 1.1 jmcneill * 3. All advertising materials mentioning features or use of this software
16 1.1 jmcneill * must display the following acknowledgement:
17 1.1 jmcneill * This product includes software developed by Jared D. McNeill.
18 1.1 jmcneill * 4. Neither the name of The NetBSD Foundation nor the names of its
19 1.1 jmcneill * contributors may be used to endorse or promote products derived
20 1.1 jmcneill * from this software without specific prior written permission.
21 1.1 jmcneill *
22 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23 1.1 jmcneill * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 1.1 jmcneill * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 1.1 jmcneill * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26 1.1 jmcneill * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 1.1 jmcneill * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 1.1 jmcneill * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 1.1 jmcneill * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 1.1 jmcneill * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 1.1 jmcneill * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 1.1 jmcneill * POSSIBILITY OF SUCH DAMAGE.
33 1.1 jmcneill */
34 1.1 jmcneill
35 1.1 jmcneill #include <sys/cdefs.h>
36 1.2 jmcneill __KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.2 2007/12/21 16:38:02 jmcneill Exp $");
37 1.1 jmcneill
38 1.1 jmcneill #include <sys/types.h>
39 1.1 jmcneill #include <sys/param.h>
40 1.1 jmcneill #include <sys/malloc.h>
41 1.1 jmcneill #include <sys/buf.h>
42 1.1 jmcneill #include <sys/callout.h>
43 1.1 jmcneill #include <sys/kernel.h>
44 1.1 jmcneill #include <sys/device.h>
45 1.1 jmcneill #include <sys/pmf.h>
46 1.1 jmcneill #include <sys/queue.h>
47 1.1 jmcneill #include <sys/kmem.h>
48 1.1 jmcneill
49 1.1 jmcneill #include <dev/acpi/acpivar.h>
50 1.1 jmcneill
51 1.1 jmcneill #if defined(__i386__) || defined(__amd64__)
52 1.1 jmcneill #include <machine/pio.h>
53 1.1 jmcneill #endif
54 1.1 jmcneill
55 1.1 jmcneill typedef struct thinkpad_softc {
56 1.1 jmcneill device_t sc_dev;
57 1.1 jmcneill struct acpi_devnode *sc_node;
58 1.1 jmcneill ACPI_HANDLE sc_cmoshdl;
59 1.1 jmcneill bool sc_cmoshdl_valid;
60 1.1 jmcneill
61 1.1 jmcneill struct sysmon_pswitch sc_smpsw[2];
62 1.1 jmcneill #define TP_PSW_SLEEP 0
63 1.1 jmcneill #define TP_PSW_HIBERNATE 1
64 1.1 jmcneill bool sc_smpsw_valid;
65 1.1 jmcneill } thinkpad_softc_t;
66 1.1 jmcneill
67 1.1 jmcneill /* Hotkey events */
68 1.1 jmcneill #define THINKPAD_NOTIFY_FnF1 0x001
69 1.1 jmcneill #define THINKPAD_NOTIFY_LockScreen 0x002
70 1.1 jmcneill #define THINKPAD_NOTIFY_BatteryInfo 0x003
71 1.1 jmcneill #define THINKPAD_NOTIFY_SleepButton 0x004
72 1.1 jmcneill #define THINKPAD_NOTIFY_WirelessSwitch 0x005
73 1.1 jmcneill #define THINKPAD_NOTIFY_FnF6 0x006
74 1.1 jmcneill #define THINKPAD_NOTIFY_DisplayCycle 0x007
75 1.1 jmcneill #define THINKPAD_NOTIFY_PointerSwitch 0x008
76 1.1 jmcneill #define THINKPAD_NOTIFY_EjectButton 0x009
77 1.1 jmcneill #define THINKPAD_NOTIFY_FnF10 0x00a
78 1.1 jmcneill #define THINKPAD_NOTIFY_FnF11 0x00b
79 1.1 jmcneill #define THINKPAD_NOTIFY_HibernateButton 0x00c
80 1.1 jmcneill #define THINKPAD_NOTIFY_BrightnessUp 0x010
81 1.1 jmcneill #define THINKPAD_NOTIFY_BrightnessDown 0x011
82 1.1 jmcneill #define THINKPAD_NOTIFY_ThinkLight 0x012
83 1.1 jmcneill #define THINKPAD_NOTIFY_Zoom 0x014
84 1.1 jmcneill #define THINKPAD_NOTIFY_ThinkVantage 0x018
85 1.1 jmcneill
86 1.1 jmcneill #define THINKPAD_CMOS_BRIGHTNESS_UP 0x04
87 1.1 jmcneill #define THINKPAD_CMOS_BRIGHTNESS_DOWN 0x05
88 1.1 jmcneill
89 1.2 jmcneill #define THINKPAD_HKEY_VERSION 0x0100
90 1.2 jmcneill
91 1.1 jmcneill static int thinkpad_match(device_t, struct cfdata *, void *);
92 1.1 jmcneill static void thinkpad_attach(device_t, device_t, void *);
93 1.1 jmcneill
94 1.1 jmcneill static ACPI_STATUS thinkpad_mask_init(thinkpad_softc_t *, uint32_t);
95 1.1 jmcneill static void thinkpad_notify_handler(ACPI_HANDLE, UINT32, void *);
96 1.1 jmcneill
97 1.1 jmcneill static void thinkpad_brightness_up(device_t);
98 1.1 jmcneill static void thinkpad_brightness_down(device_t);
99 1.1 jmcneill static uint8_t thinkpad_brightness_read(thinkpad_softc_t *sc);
100 1.1 jmcneill static void thinkpad_cmos(thinkpad_softc_t *, uint8_t);
101 1.1 jmcneill
102 1.1 jmcneill CFATTACH_DECL_NEW(thinkpad, sizeof(thinkpad_softc_t),
103 1.1 jmcneill thinkpad_match, thinkpad_attach, NULL, NULL);
104 1.1 jmcneill
105 1.1 jmcneill static const char * const thinkpad_ids[] = {
106 1.1 jmcneill "IBM0068",
107 1.1 jmcneill NULL
108 1.1 jmcneill };
109 1.1 jmcneill
110 1.1 jmcneill static int
111 1.1 jmcneill thinkpad_match(device_t parent, struct cfdata *match, void *opaque)
112 1.1 jmcneill {
113 1.1 jmcneill struct acpi_attach_args *aa = (struct acpi_attach_args *)opaque;
114 1.1 jmcneill ACPI_HANDLE hdl;
115 1.2 jmcneill ACPI_INTEGER ver;
116 1.1 jmcneill
117 1.1 jmcneill if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
118 1.1 jmcneill return 0;
119 1.1 jmcneill
120 1.1 jmcneill if (!acpi_match_hid(aa->aa_node->ad_devinfo, thinkpad_ids))
121 1.1 jmcneill return 0;
122 1.1 jmcneill
123 1.1 jmcneill /* No point in attaching if we can't find the CMOS method */
124 1.1 jmcneill if (ACPI_FAILURE(AcpiGetHandle(NULL, "\\UCMS", &hdl)))
125 1.1 jmcneill return 0;
126 1.1 jmcneill
127 1.2 jmcneill /* We only support hotkey version 0x0100 */
128 1.2 jmcneill if (ACPI_FAILURE(AcpiGetHandle(aa->aa_node->ad_handle, "MHKV", &ver)))
129 1.2 jmcneill return 0;
130 1.2 jmcneill
131 1.2 jmcneill if (ver != THINKPAD_HKEY_VERSION)
132 1.2 jmcneill return 0;
133 1.2 jmcneill
134 1.1 jmcneill /* Cool, looks like we're good to go */
135 1.1 jmcneill return 1;
136 1.1 jmcneill }
137 1.1 jmcneill
138 1.1 jmcneill static void
139 1.1 jmcneill thinkpad_attach(device_t parent, device_t self, void *opaque)
140 1.1 jmcneill {
141 1.1 jmcneill thinkpad_softc_t *sc = device_private(self);
142 1.1 jmcneill struct acpi_attach_args *aa = (struct acpi_attach_args *)opaque;
143 1.1 jmcneill ACPI_STATUS rv;
144 1.1 jmcneill ACPI_INTEGER val;
145 1.1 jmcneill
146 1.1 jmcneill sc->sc_node = aa->aa_node;
147 1.1 jmcneill sc->sc_dev = self;
148 1.1 jmcneill
149 1.1 jmcneill aprint_naive("\n");
150 1.1 jmcneill aprint_normal("\n");
151 1.1 jmcneill
152 1.1 jmcneill /* T61 uses \UCMS method for issuing CMOS commands */
153 1.1 jmcneill rv = AcpiGetHandle(NULL, "\\UCMS", &sc->sc_cmoshdl);
154 1.1 jmcneill if (ACPI_FAILURE(rv))
155 1.1 jmcneill sc->sc_cmoshdl_valid = false;
156 1.1 jmcneill else {
157 1.1 jmcneill aprint_verbose_dev(self, "using CMOS at \\UCMS\n");
158 1.1 jmcneill sc->sc_cmoshdl_valid = true;
159 1.1 jmcneill }
160 1.1 jmcneill
161 1.1 jmcneill /* Get the supported event mask */
162 1.1 jmcneill rv = acpi_eval_integer(sc->sc_node->ad_handle, "MHKA", &val);
163 1.1 jmcneill if (ACPI_FAILURE(rv)) {
164 1.1 jmcneill aprint_error_dev(self, "couldn't evaluate MHKA: %s\n",
165 1.1 jmcneill AcpiFormatException(rv));
166 1.1 jmcneill goto fail;
167 1.1 jmcneill }
168 1.1 jmcneill
169 1.1 jmcneill /* Enable all supported events */
170 1.1 jmcneill rv = thinkpad_mask_init(sc, val);
171 1.1 jmcneill if (ACPI_FAILURE(rv)) {
172 1.1 jmcneill aprint_error_dev(self, "couldn't set event mask: %s\n",
173 1.1 jmcneill AcpiFormatException(rv));
174 1.1 jmcneill goto fail;
175 1.1 jmcneill }
176 1.1 jmcneill
177 1.1 jmcneill /* Install notify handler for events */
178 1.1 jmcneill rv = AcpiInstallNotifyHandler(sc->sc_node->ad_handle,
179 1.1 jmcneill ACPI_DEVICE_NOTIFY, thinkpad_notify_handler, sc);
180 1.1 jmcneill if (ACPI_FAILURE(rv))
181 1.1 jmcneill aprint_error_dev(self, "couldn't install notify handler: %s\n",
182 1.1 jmcneill AcpiFormatException(rv));
183 1.1 jmcneill
184 1.1 jmcneill /* Register with sysmon */
185 1.1 jmcneill sc->sc_smpsw_valid = true;
186 1.1 jmcneill
187 1.1 jmcneill sc->sc_smpsw[TP_PSW_SLEEP].smpsw_name = device_xname(self);
188 1.1 jmcneill sc->sc_smpsw[TP_PSW_SLEEP].smpsw_type = PSWITCH_TYPE_SLEEP;
189 1.1 jmcneill #if notyet
190 1.1 jmcneill sc->sc_smpsw[TP_PSW_HIBERNATE].smpsw_name = device_xname(self);
191 1.1 jmcneill sc->sc_smpsw[TP_PSW_HIBERNATE].smpsw_type = PSWITCH_TYPE_HIBERNATE;
192 1.1 jmcneill #endif
193 1.1 jmcneill
194 1.1 jmcneill if (sysmon_pswitch_register(&sc->sc_smpsw[TP_PSW_SLEEP]) != 0) {
195 1.1 jmcneill aprint_error_dev(self, "couldn't register with sysmon\n");
196 1.1 jmcneill sc->sc_smpsw_valid = false;
197 1.1 jmcneill }
198 1.1 jmcneill #if notyet
199 1.1 jmcneill if (sysmon_pswitch_register(&sc->sc_smpsw[TP_PSW_HIBERNATE]) != 0) {
200 1.1 jmcneill aprint_error_dev(self, "couldn't register with sysmon\n");
201 1.1 jmcneill sc->sc_smpsw_valid = false;
202 1.1 jmcneill }
203 1.1 jmcneill #endif
204 1.1 jmcneill
205 1.1 jmcneill fail:
206 1.1 jmcneill if (!pmf_device_register(self, NULL, NULL))
207 1.1 jmcneill aprint_error_dev(self, "couldn't establish power handler\n");
208 1.1 jmcneill if (!pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_UP,
209 1.1 jmcneill thinkpad_brightness_up, true))
210 1.1 jmcneill aprint_error_dev(self, "couldn't register event handler\n");
211 1.1 jmcneill if (!pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_DOWN,
212 1.1 jmcneill thinkpad_brightness_down, true))
213 1.1 jmcneill aprint_error_dev(self, "couldn't register event handler\n");
214 1.1 jmcneill
215 1.1 jmcneill return;
216 1.1 jmcneill }
217 1.1 jmcneill
218 1.1 jmcneill static void
219 1.1 jmcneill thinkpad_notify_handler(ACPI_HANDLE hdl, UINT32 notify, void *opaque)
220 1.1 jmcneill {
221 1.1 jmcneill thinkpad_softc_t *sc = (thinkpad_softc_t *)opaque;
222 1.1 jmcneill device_t self = sc->sc_dev;
223 1.1 jmcneill ACPI_STATUS rv;
224 1.1 jmcneill ACPI_INTEGER val;
225 1.1 jmcneill int type, event;
226 1.1 jmcneill
227 1.1 jmcneill if (notify != 0x80) {
228 1.1 jmcneill aprint_debug_dev(self, "unknown notify 0x%02x\n", notify);
229 1.1 jmcneill return;
230 1.1 jmcneill }
231 1.1 jmcneill
232 1.2 jmcneill for (;;) {
233 1.2 jmcneill rv = acpi_eval_integer(sc->sc_node->ad_handle, "MHKP", &val);
234 1.2 jmcneill if (ACPI_FAILURE(rv)) {
235 1.2 jmcneill aprint_error_dev(self, "couldn't evaluate MHKP: %s\n",
236 1.2 jmcneill AcpiFormatException(rv));
237 1.2 jmcneill return;
238 1.2 jmcneill }
239 1.2 jmcneill
240 1.2 jmcneill if (val == 0)
241 1.2 jmcneill return;
242 1.2 jmcneill
243 1.2 jmcneill type = (val & 0xf000) >> 12;
244 1.2 jmcneill event = val & 0x0fff;
245 1.2 jmcneill
246 1.2 jmcneill if (type != 1)
247 1.2 jmcneill /* Only type 1 events are supported for now */
248 1.2 jmcneill continue;
249 1.2 jmcneill
250 1.2 jmcneill switch (event) {
251 1.2 jmcneill case THINKPAD_NOTIFY_BrightnessUp:
252 1.2 jmcneill thinkpad_brightness_up(self);
253 1.2 jmcneill break;
254 1.2 jmcneill case THINKPAD_NOTIFY_BrightnessDown:
255 1.2 jmcneill thinkpad_brightness_down(self);
256 1.2 jmcneill break;
257 1.2 jmcneill case THINKPAD_NOTIFY_DisplayCycle:
258 1.1 jmcneill #if notyet
259 1.2 jmcneill pmf_event_inject(NULL, PMFE_DISPLAY_CYCLE);
260 1.1 jmcneill #endif
261 1.1 jmcneill break;
262 1.2 jmcneill case THINKPAD_NOTIFY_SleepButton:
263 1.2 jmcneill if (sc->sc_smpsw_valid == false)
264 1.2 jmcneill break;
265 1.2 jmcneill sysmon_pswitch_event(&sc->sc_smpsw[TP_PSW_SLEEP],
266 1.2 jmcneill PSWITCH_EVENT_PRESSED);
267 1.2 jmcneill break;
268 1.2 jmcneill case THINKPAD_NOTIFY_HibernateButton:
269 1.1 jmcneill #if notyet
270 1.2 jmcneill if (sc->sc_smpsw_valid == false)
271 1.2 jmcneill break;
272 1.2 jmcneill sysmon_pswitch_event(&sc->sc_smpsw[TP_PSW_HIBERNATE],
273 1.2 jmcneill PSWITCH_EVENT_PRESSED);
274 1.1 jmcneill break;
275 1.1 jmcneill #endif
276 1.2 jmcneill case THINKPAD_NOTIFY_FnF1:
277 1.2 jmcneill case THINKPAD_NOTIFY_LockScreen:
278 1.2 jmcneill case THINKPAD_NOTIFY_BatteryInfo:
279 1.2 jmcneill case THINKPAD_NOTIFY_WirelessSwitch:
280 1.2 jmcneill case THINKPAD_NOTIFY_FnF6:
281 1.2 jmcneill case THINKPAD_NOTIFY_PointerSwitch:
282 1.2 jmcneill case THINKPAD_NOTIFY_EjectButton:
283 1.2 jmcneill case THINKPAD_NOTIFY_FnF10:
284 1.2 jmcneill case THINKPAD_NOTIFY_FnF11:
285 1.2 jmcneill case THINKPAD_NOTIFY_ThinkLight:
286 1.2 jmcneill case THINKPAD_NOTIFY_Zoom:
287 1.2 jmcneill case THINKPAD_NOTIFY_ThinkVantage:
288 1.2 jmcneill /* XXXJDM we should deliver hotkeys as keycodes */
289 1.2 jmcneill break;
290 1.2 jmcneill default:
291 1.2 jmcneill aprint_debug_dev(self, "notify event 0x%03x\n", event);
292 1.2 jmcneill break;
293 1.2 jmcneill }
294 1.1 jmcneill }
295 1.1 jmcneill
296 1.1 jmcneill return;
297 1.1 jmcneill }
298 1.1 jmcneill
299 1.1 jmcneill static ACPI_STATUS
300 1.1 jmcneill thinkpad_mask_init(thinkpad_softc_t *sc, uint32_t mask)
301 1.1 jmcneill {
302 1.1 jmcneill ACPI_OBJECT param[2];
303 1.1 jmcneill ACPI_OBJECT_LIST params;
304 1.1 jmcneill ACPI_STATUS rv;
305 1.1 jmcneill int i;
306 1.1 jmcneill
307 1.1 jmcneill /* Update hotkey mask */
308 1.1 jmcneill params.Count = 2;
309 1.1 jmcneill params.Pointer = param;
310 1.1 jmcneill param[0].Type = param[1].Type = ACPI_TYPE_INTEGER;
311 1.1 jmcneill
312 1.1 jmcneill for (i = 0; i < 32; i++) {
313 1.1 jmcneill param[0].Integer.Value = i + 1;
314 1.1 jmcneill param[1].Integer.Value = (((1 << i) & mask) != 0);
315 1.1 jmcneill
316 1.1 jmcneill rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "MHKM",
317 1.1 jmcneill ¶ms, NULL);
318 1.1 jmcneill if (ACPI_FAILURE(rv))
319 1.1 jmcneill return rv;
320 1.1 jmcneill }
321 1.1 jmcneill
322 1.1 jmcneill /* Enable hotkey events */
323 1.1 jmcneill params.Count = 1;
324 1.1 jmcneill param[0].Integer.Value = 1;
325 1.1 jmcneill rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "MHKC", ¶ms, NULL);
326 1.1 jmcneill if (ACPI_FAILURE(rv)) {
327 1.1 jmcneill aprint_error_dev(sc->sc_dev, "couldn't enable hotkeys: %s\n",
328 1.1 jmcneill AcpiFormatException(rv));
329 1.1 jmcneill return rv;
330 1.1 jmcneill }
331 1.1 jmcneill
332 1.1 jmcneill return AE_OK;
333 1.1 jmcneill }
334 1.1 jmcneill
335 1.1 jmcneill static uint8_t
336 1.1 jmcneill thinkpad_brightness_read(thinkpad_softc_t *sc)
337 1.1 jmcneill {
338 1.1 jmcneill #if defined(__i386__) || defined(__amd64__)
339 1.1 jmcneill /*
340 1.1 jmcneill * We have two ways to get the current brightness -- either via
341 1.1 jmcneill * magic RTC registers, or using the EC. Since I don't dare mess
342 1.1 jmcneill * with the EC, and Thinkpads are x86-only, this will have to do
343 1.1 jmcneill * for now.
344 1.1 jmcneill */
345 1.1 jmcneill outb(0x70, 0x6c);
346 1.1 jmcneill return inb(0x71) & 7;
347 1.1 jmcneill #else
348 1.1 jmcneill return 0;
349 1.1 jmcneill #endif
350 1.1 jmcneill }
351 1.1 jmcneill
352 1.1 jmcneill static void
353 1.1 jmcneill thinkpad_brightness_up(device_t self)
354 1.1 jmcneill {
355 1.1 jmcneill thinkpad_softc_t *sc = device_private(self);
356 1.1 jmcneill
357 1.1 jmcneill if (thinkpad_brightness_read(sc) == 7)
358 1.1 jmcneill return;
359 1.1 jmcneill thinkpad_cmos(sc, THINKPAD_CMOS_BRIGHTNESS_UP);
360 1.1 jmcneill }
361 1.1 jmcneill
362 1.1 jmcneill static void
363 1.1 jmcneill thinkpad_brightness_down(device_t self)
364 1.1 jmcneill {
365 1.1 jmcneill thinkpad_softc_t *sc = device_private(self);
366 1.1 jmcneill
367 1.1 jmcneill if (thinkpad_brightness_read(sc) == 0)
368 1.1 jmcneill return;
369 1.1 jmcneill thinkpad_cmos(sc, THINKPAD_CMOS_BRIGHTNESS_DOWN);
370 1.1 jmcneill }
371 1.1 jmcneill
372 1.1 jmcneill static void
373 1.1 jmcneill thinkpad_cmos(thinkpad_softc_t *sc, uint8_t cmd)
374 1.1 jmcneill {
375 1.1 jmcneill ACPI_OBJECT param;
376 1.1 jmcneill ACPI_OBJECT_LIST params;
377 1.1 jmcneill ACPI_STATUS rv;
378 1.1 jmcneill
379 1.1 jmcneill if (sc->sc_cmoshdl_valid == false)
380 1.1 jmcneill return;
381 1.1 jmcneill
382 1.1 jmcneill params.Count = 1;
383 1.1 jmcneill params.Pointer = ¶m;
384 1.1 jmcneill param.Type = ACPI_TYPE_INTEGER;
385 1.1 jmcneill param.Integer.Value = cmd;
386 1.1 jmcneill rv = AcpiEvaluateObject(sc->sc_cmoshdl, NULL, ¶ms, NULL);
387 1.1 jmcneill if (ACPI_FAILURE(rv))
388 1.1 jmcneill aprint_error_dev(sc->sc_dev, "couldn't evalute CMOS: %s\n",
389 1.1 jmcneill AcpiFormatException(rv));
390 1.1 jmcneill }
391