acpi_power.c revision 1.1 1 /* $NetBSD: acpi_power.c,v 1.1 2010/04/22 18:40:09 jruoho Exp $ */
2
3 /*-
4 * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jukka Ruohonen.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /*-
33 * Copyright (c) 2001 Michael Smith
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 */
57
58 #include <sys/cdefs.h>
59 __KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.1 2010/04/22 18:40:09 jruoho Exp $");
60
61 #include <sys/param.h>
62 #include <sys/kmem.h>
63 #include <sys/mutex.h>
64
65 #include <dev/acpi/acpireg.h>
66 #include <dev/acpi/acpivar.h>
67 #include <dev/acpi/acpi_power.h>
68
69 #define _COMPONENT ACPI_BUS_COMPONENT
70 ACPI_MODULE_NAME ("acpi_power")
71
72 /*
73 * References.
74 */
75 struct acpi_power_ref {
76 ACPI_HANDLE ref_handle;
77
78 SIMPLEQ_ENTRY(acpi_power_ref) ref_list;
79 };
80
81 /*
82 * Resources.
83 */
84 struct acpi_power_res {
85 ACPI_HANDLE res_handle;
86 ACPI_INTEGER res_level;
87 ACPI_INTEGER res_order;
88 char res_name[5];
89 kmutex_t res_mutex;
90
91 TAILQ_ENTRY(acpi_power_res) res_list;
92 SIMPLEQ_HEAD(, acpi_power_ref) ref_head;
93 };
94
95 static TAILQ_HEAD(, acpi_power_res) res_head =
96 TAILQ_HEAD_INITIALIZER(res_head);
97
98 static struct acpi_power_res *acpi_power_res_init(ACPI_HANDLE);
99 static struct acpi_power_res *acpi_power_res_get(ACPI_HANDLE);
100
101 #if 0
102 static ACPI_STATUS acpi_power_get_direct(struct acpi_devnode *);
103 #endif
104
105 static ACPI_STATUS acpi_power_get_indirect(struct acpi_devnode *);
106 static ACPI_STATUS acpi_power_switch(struct acpi_devnode *,
107 int, bool);
108 static ACPI_STATUS acpi_power_res_on(ACPI_OBJECT *, void *);
109 static ACPI_STATUS acpi_power_res_off(ACPI_OBJECT *, void *);
110 static ACPI_STATUS acpi_power_res_ref(struct acpi_power_res *,
111 ACPI_HANDLE);
112 static ACPI_STATUS acpi_power_res_deref(struct acpi_power_res *,
113 ACPI_HANDLE);
114 static ACPI_STATUS acpi_power_res_sta(ACPI_OBJECT *, void *);
115
116 static ACPI_OBJECT *acpi_power_pkg_get(ACPI_HANDLE, int);
117 static const char *acpi_xname(ACPI_HANDLE);
118
119 void
120 acpi_power_res_add(struct acpi_devnode *ad)
121 {
122 struct acpi_power_res *res;
123
124 KASSERT(ad != NULL && ad->ad_root != NULL);
125 KASSERT(ad->ad_devinfo->Type == ACPI_TYPE_POWER);
126
127 res = acpi_power_res_init(ad->ad_handle);
128
129 if (res == NULL)
130 aprint_error_dev(ad->ad_root, "failed to "
131 "add power resource %s\n", ad->ad_name);
132 }
133
134 static struct acpi_power_res *
135 acpi_power_res_init(ACPI_HANDLE hdl)
136 {
137 struct acpi_power_res *tmp = NULL;
138 struct acpi_power_res *res = NULL;
139 ACPI_OBJECT *obj;
140 ACPI_BUFFER buf;
141 ACPI_STATUS rv;
142
143 rv = acpi_eval_struct(hdl, NULL, &buf);
144
145 if (ACPI_FAILURE(rv))
146 goto out;
147
148 obj = buf.Pointer;
149
150 if (obj->Type != ACPI_TYPE_POWER) {
151 rv = AE_TYPE;
152 goto out;
153 }
154
155 res = kmem_zalloc(sizeof(*res), KM_SLEEP);
156
157 if (res == NULL) {
158 rv = AE_NO_MEMORY;
159 goto out;
160 }
161
162 res->res_handle = hdl;
163 res->res_level = obj->PowerResource.SystemLevel;
164 res->res_order = obj->PowerResource.ResourceOrder;
165
166 (void)strlcpy(res->res_name,
167 acpi_xname(hdl), sizeof(res->res_name));
168
169 SIMPLEQ_INIT(&res->ref_head);
170 mutex_init(&res->res_mutex, MUTEX_DEFAULT, IPL_NONE);
171
172 /*
173 * Power resources should be ordered.
174 *
175 * These *should* be enabled from low values to high
176 * values and disabled from high values to low values.
177 */
178 TAILQ_FOREACH(tmp, &res_head, res_list) {
179
180 if (res->res_order < tmp->res_order) {
181 TAILQ_INSERT_BEFORE(tmp, res, res_list);
182 break;
183 }
184 }
185
186 if (tmp == NULL)
187 TAILQ_INSERT_TAIL(&res_head, res, res_list);
188
189 out:
190 if (buf.Pointer != NULL)
191 ACPI_FREE(buf.Pointer);
192
193 return res;
194 }
195
196 static struct acpi_power_res *
197 acpi_power_res_get(ACPI_HANDLE hdl)
198 {
199 struct acpi_power_res *res;
200
201 TAILQ_FOREACH(res, &res_head, res_list) {
202
203 if (res->res_handle == hdl)
204 return res;
205 }
206
207 return acpi_power_res_init(hdl);
208 }
209
210 bool
211 acpi_power_register(struct acpi_devnode *ad)
212 {
213
214 KASSERT(ad != NULL && ad->ad_root != NULL);
215
216 if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0)
217 return false;
218
219 return true;
220 }
221
222 void
223 acpi_power_deregister(struct acpi_devnode *ad)
224 {
225 struct acpi_power_res *res;
226
227 KASSERT(ad != NULL && ad->ad_root != NULL);
228
229 if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0)
230 return;
231
232 /*
233 * Remove all references in each resource.
234 */
235 TAILQ_FOREACH(res, &res_head, res_list)
236 (void)acpi_power_res_deref(res, ad->ad_handle);
237 }
238
239 /*
240 * Get the D-state of an ACPI device node.
241 */
242 bool
243 acpi_power_get(struct acpi_devnode *ad, int *state)
244 {
245 ACPI_STATUS rv;
246
247 if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0) {
248 rv = AE_SUPPORT;
249 goto fail;
250 }
251
252 rv = acpi_power_get_indirect(ad);
253
254 if (ACPI_FAILURE(rv))
255 goto fail;
256
257 KASSERT(ad->ad_state != ACPI_STATE_ERROR);
258
259 if (ad->ad_state < ACPI_STATE_D0 || ad->ad_state > ACPI_STATE_D3) {
260 rv = AE_BAD_VALUE;
261 goto fail;
262 }
263
264 if (state != NULL)
265 *state = ad->ad_state;
266
267 return true;
268
269 fail:
270 ad->ad_state = ACPI_STATE_ERROR;
271
272 if (state != NULL)
273 *state = ad->ad_state;
274
275 aprint_error_dev(ad->ad_root, "failed to get power state "
276 "for %s: %s\n", ad->ad_name, AcpiFormatException(rv));
277
278 return false;
279 }
280
281 #if 0
282 /*
283 * Unfortunately, comparable to _STA, there are systems
284 * where the convenient _PSC is implemented incorrectly.
285 */
286 static ACPI_STATUS
287 acpi_power_get_direct(struct acpi_devnode *ad)
288 {
289 ACPI_INTEGER val = 0;
290 ACPI_STATUS rv;
291
292 rv = acpi_eval_integer(ad->ad_handle, "_PSC", &val);
293
294 KDASSERT((uint64_t)val < INT_MAX);
295
296 ad->ad_state = (int)val;
297
298 return rv;
299 }
300 #endif
301
302 static ACPI_STATUS
303 acpi_power_get_indirect(struct acpi_devnode *ad)
304 {
305 ACPI_OBJECT *pkg;
306 ACPI_STATUS rv;
307 int i;
308
309 CTASSERT(ACPI_STATE_D0 == 0 && ACPI_STATE_D1 == 1);
310 CTASSERT(ACPI_STATE_D2 == 2 && ACPI_STATE_D3 == 3);
311
312 /*
313 * The device is in a given D-state if all resources are on.
314 * To derive this, evaluate all elements in each _PRx package
315 * (x = 0 ... 3) and break if the noted condition becomes true.
316 */
317 for (ad->ad_state = ACPI_STATE_D3, i = 0; i < ACPI_STATE_D3; i++) {
318
319 pkg = acpi_power_pkg_get(ad->ad_handle, i);
320
321 if (pkg == NULL)
322 continue;
323
324 /*
325 * For each element in the _PRx package, evaluate _STA
326 * and return AE_OK only if all power resources are on.
327 */
328 rv = acpi_foreach_package_object(pkg, acpi_power_res_sta, ad);
329
330 if (ACPI_FAILURE(rv) && rv != AE_ABORT_METHOD)
331 goto out;
332
333 if (ACPI_SUCCESS(rv)) {
334 ad->ad_state = i;
335 goto out;
336 }
337
338 ACPI_FREE(pkg); pkg = NULL;
339 }
340
341 KASSERT(ad->ad_state == ACPI_STATE_D3);
342
343 return AE_OK;
344
345 out:
346 ACPI_FREE(pkg);
347
348 return rv;
349 }
350
351 /*
352 * Set the D-state of an ACPI device node.
353 */
354 bool
355 acpi_power_set(struct acpi_devnode *ad, int state)
356 {
357 ACPI_STATUS rv;
358 char path[5];
359 int old;
360
361 KASSERT(ad != NULL && ad->ad_root != NULL);
362
363 if (state < ACPI_STATE_D0 || state > ACPI_STATE_D3) {
364 rv = AE_BAD_PARAMETER;
365 goto fail;
366 }
367
368 if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0) {
369 rv = AE_SUPPORT;
370 goto fail;
371 }
372
373 if (acpi_power_get(ad, &old) != true) {
374 rv = AE_NOT_FOUND;
375 goto fail;
376 }
377
378 KASSERT(ad->ad_state == old);
379 KASSERT(ad->ad_state != ACPI_STATE_ERROR);
380
381 if (ad->ad_state == state) {
382 rv = AE_ALREADY_EXISTS;
383 goto fail;
384 }
385
386 /*
387 * It is only possible to go to D0 ("on") from D3 ("off").
388 */
389 if (ad->ad_state == ACPI_STATE_D3 && state != ACPI_STATE_D0) {
390 rv = AE_BAD_PARAMETER;
391 goto fail;
392 }
393
394 /*
395 * We first sweep through the resources required
396 * for the target state, turning things on and
397 * building references. After this we dereference
398 * the resources required for the current state,
399 * turning the resources off as we go.
400 */
401 rv = acpi_power_switch(ad, state, true);
402
403 if (ACPI_FAILURE(rv))
404 goto fail;
405
406 rv = acpi_power_switch(ad, ad->ad_state, false);
407
408 if (ACPI_FAILURE(rv))
409 goto fail;
410
411 ad->ad_state = state;
412
413 /*
414 * Last but not least, invoke the power
415 * state switch method, if available.
416 */
417 (void)snprintf(path, sizeof(path), "_PS%d", state);
418 (void)AcpiEvaluateObject(ad->ad_handle, path, NULL, NULL);
419
420 aprint_debug_dev(ad->ad_root, "%s turned from "
421 "D%d to D%d\n", ad->ad_name, old, state);
422
423 return true;
424
425 fail:
426 /*
427 * It is never an error to go to D0.
428 */
429 if (state != ACPI_STATE_D0) {
430
431 aprint_error_dev(ad->ad_root,
432 "failed to set power state to D%d for %s: %s\n",
433 state, ad->ad_name, AcpiFormatException(rv));
434
435 ad->ad_state = ACPI_STATE_ERROR;
436
437 return false;
438 }
439
440 return true;
441 }
442
443 /*
444 * Set the D-state of an ACPI device node from a handle.
445 */
446 bool
447 acpi_power_set_from_handle(ACPI_HANDLE hdl, int state)
448 {
449 struct acpi_softc *sc = acpi_softc; /* XXX. */
450 struct acpi_devnode *ad;
451
452 if (sc == NULL)
453 return false;
454
455 SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
456
457 if (ad->ad_handle == hdl)
458 return acpi_power_set(ad, state);
459 }
460
461 aprint_error_dev(sc->sc_dev, "%s: failed to "
462 "find node %s\n", __func__, ad->ad_name);
463
464 return false;
465 }
466
467 static ACPI_STATUS
468 acpi_power_switch(struct acpi_devnode *ad, int state, bool on)
469 {
470 ACPI_OBJECT *pkg;
471 ACPI_STATUS rv;
472
473 pkg = acpi_power_pkg_get(ad->ad_handle, state);
474
475 if (pkg == NULL)
476 return AE_NOT_EXIST;
477
478 if (on != false)
479 rv = acpi_foreach_package_object(pkg, acpi_power_res_on, ad);
480 else
481 rv = acpi_foreach_package_object(pkg, acpi_power_res_off, ad);
482
483 ACPI_FREE(pkg);
484
485 return rv;
486 }
487
488 static ACPI_STATUS
489 acpi_power_res_on(ACPI_OBJECT *elm, void *arg)
490 {
491 struct acpi_devnode *ad = arg;
492 struct acpi_power_res *res;
493 ACPI_HANDLE hdl;
494 ACPI_STATUS rv;
495
496 /*
497 * For each element in the _PRx package, first
498 * fetch the reference handle and then search
499 * for this handle from the power resource list.
500 */
501 rv = acpi_eval_reference_handle(elm, &hdl);
502
503 if (ACPI_FAILURE(rv))
504 return rv;
505
506 res = acpi_power_res_get(hdl);
507
508 if (res == NULL)
509 return AE_NOT_FOUND;
510
511 /*
512 * Reference the resource.
513 */
514 rv = acpi_power_res_ref(res, ad->ad_handle);
515
516 if (ACPI_FAILURE(rv))
517 return rv;
518
519 /*
520 * Turn the resource on.
521 */
522 return AcpiEvaluateObject(res->res_handle, "_ON", NULL, NULL);
523 }
524
525 static ACPI_STATUS
526 acpi_power_res_off(ACPI_OBJECT *elm, void *arg)
527 {
528 struct acpi_devnode *ad = arg;
529 struct acpi_power_res *res;
530 ACPI_HANDLE hdl;
531 ACPI_STATUS rv;
532
533 rv = acpi_eval_reference_handle(elm, &hdl);
534
535 if (ACPI_FAILURE(rv))
536 return rv;
537
538 res = acpi_power_res_get(hdl);
539
540 if (res == NULL)
541 return AE_NOT_FOUND;
542
543 rv = acpi_power_res_deref(res, ad->ad_handle);
544
545 if (ACPI_FAILURE(rv))
546 return rv;
547
548 return AcpiEvaluateObject(res->res_handle, "_OFF", NULL, NULL);
549 }
550
551 static ACPI_STATUS
552 acpi_power_res_ref(struct acpi_power_res *res, ACPI_HANDLE hdl)
553 {
554 struct acpi_power_ref *ref, *tmp;
555
556 ref = kmem_zalloc(sizeof(*ref), KM_SLEEP);
557
558 if (ref == NULL)
559 return AE_NO_MEMORY;
560
561 mutex_enter(&res->res_mutex);
562
563 SIMPLEQ_FOREACH(tmp, &res->ref_head, ref_list) {
564
565 if (tmp->ref_handle == hdl)
566 goto out;
567 }
568
569 ref->ref_handle = hdl;
570 SIMPLEQ_INSERT_TAIL(&res->ref_head, ref, ref_list);
571 mutex_exit(&res->res_mutex);
572
573 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: %s referenced "
574 "by %s?\n", __func__, res->res_name, acpi_xname(hdl)));
575
576 return AE_OK;
577
578 out:
579 mutex_exit(&res->res_mutex);
580 kmem_free(ref, sizeof(*ref));
581
582 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: %s already referenced "
583 "by %s?\n", __func__, res->res_name, acpi_xname(hdl)));
584
585 return AE_OK;
586 }
587
588 static ACPI_STATUS
589 acpi_power_res_deref(struct acpi_power_res *res, ACPI_HANDLE hdl)
590 {
591 struct acpi_power_ref *ref;
592
593 mutex_enter(&res->res_mutex);
594
595 if (SIMPLEQ_EMPTY(&res->ref_head) != 0) {
596 mutex_exit(&res->res_mutex);
597 return AE_OK;
598 }
599
600 SIMPLEQ_FOREACH(ref, &res->ref_head, ref_list) {
601
602 if (ref->ref_handle == hdl) {
603 SIMPLEQ_REMOVE(&res->ref_head,
604 ref, acpi_power_ref, ref_list);
605 mutex_exit(&res->res_mutex);
606 kmem_free(ref, sizeof(*ref));
607 mutex_enter(&res->res_mutex);
608 break;
609 }
610 }
611
612 /*
613 * If the queue remains non-empty,
614 * something else is using the resource
615 * and hence it can not be turned off.
616 */
617 if (SIMPLEQ_EMPTY(&res->ref_head) == 0) {
618 mutex_exit(&res->res_mutex);
619 return AE_ABORT_METHOD;
620 }
621
622 mutex_exit(&res->res_mutex);
623
624 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: %s dereferenced "
625 "by %s?\n", __func__, res->res_name, acpi_xname(hdl)));
626
627 return AE_OK;
628 }
629
630 static ACPI_STATUS
631 acpi_power_res_sta(ACPI_OBJECT *elm, void *arg)
632 {
633 ACPI_INTEGER val;
634 ACPI_HANDLE hdl;
635 ACPI_STATUS rv;
636
637 rv = acpi_eval_reference_handle(elm, &hdl);
638
639 if (ACPI_FAILURE(rv))
640 goto fail;
641
642 rv = acpi_eval_integer(hdl, "_STA", &val);
643
644 if (ACPI_FAILURE(rv))
645 goto fail;
646
647 KDASSERT((uint64_t)val < INT_MAX);
648
649 if ((int)val != ACPI_STA_POW_ON && (int)val != ACPI_STA_POW_OFF)
650 return AE_BAD_VALUE;
651
652 if ((int)val != ACPI_STA_POW_ON)
653 return AE_ABORT_METHOD; /* XXX: Not an error. */
654
655 return AE_OK;
656
657 fail:
658 if (rv == AE_ABORT_METHOD)
659 rv = AE_ERROR;
660
661 ACPI_DEBUG_PRINT((ACPI_DB_DEBUG_OBJECT, "%s: failed to "
662 "evaluate _STA for %s: %s\n", __func__,
663 acpi_xname(hdl), AcpiFormatException(rv)));
664
665 return rv;
666 }
667
668 static ACPI_OBJECT *
669 acpi_power_pkg_get(ACPI_HANDLE hdl, int state)
670 {
671 char path[5] = "_PR?";
672 ACPI_OBJECT *obj;
673 ACPI_BUFFER buf;
674 ACPI_STATUS rv;
675
676 path[3] = '0' + state;
677
678 rv = acpi_eval_struct(hdl, path, &buf);
679
680 if (ACPI_FAILURE(rv))
681 goto fail;
682
683 if (buf.Length == 0) {
684 rv = AE_LIMIT;
685 goto fail;
686 }
687
688 obj = buf.Pointer;
689
690 if (obj->Type != ACPI_TYPE_PACKAGE) {
691 rv = AE_TYPE;
692 goto fail;
693 }
694
695 if (obj->Package.Count == 0) {
696 rv = AE_LIMIT;
697 goto fail;
698 }
699
700 return obj;
701
702 fail:
703 if (buf.Pointer != NULL)
704 ACPI_FREE(buf.Pointer);
705
706 ACPI_DEBUG_PRINT((ACPI_DB_DEBUG_OBJECT, "%s: failed to "
707 "evaluate %s for %s: %s\n", __func__, path,
708 acpi_xname(hdl), AcpiFormatException(rv)));
709
710 return NULL;
711 }
712
713 /*
714 * XXX: Move this to acpi_util.c by refactoring
715 * acpi_name() to optionally return a single name.
716 */
717 static const char *
718 acpi_xname(ACPI_HANDLE hdl)
719 {
720 static char str[5];
721 ACPI_BUFFER buf;
722 ACPI_STATUS rv;
723
724 buf.Pointer = str;
725 buf.Length = sizeof(str);
726
727 rv = AcpiGetName(hdl, ACPI_SINGLE_NAME, &buf);
728
729 if (ACPI_FAILURE(rv))
730 return "????";
731
732 return str;
733 }
734