1 /* $NetBSD: acpi_util.h,v 1.15 2022/07/23 03:08:17 thorpej Exp $ */ 2 3 /*- 4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Charles M. Hannum of By Noon Software, Inc. 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 2001, 2003 Wasabi Systems, Inc. 34 * All rights reserved. 35 * 36 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 37 * 38 * Redistribution and use in source and binary forms, with or without 39 * modification, are permitted provided that the following conditions 40 * are met: 41 * 1. Redistributions of source code must retain the above copyright 42 * notice, this list of conditions and the following disclaimer. 43 * 2. Redistributions in binary form must reproduce the above copyright 44 * notice, this list of conditions and the following disclaimer in the 45 * documentation and/or other materials provided with the distribution. 46 * 3. All advertising materials mentioning features or use of this software 47 * must display the following acknowledgement: 48 * This product includes software developed for the NetBSD Project by 49 * Wasabi Systems, Inc. 50 * 4. The name of Wasabi Systems, Inc. may not be used to endorse 51 * or promote products derived from this software without specific prior 52 * written permission. 53 * 54 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 64 * POSSIBILITY OF SUCH DAMAGE. 65 */ 66 67 #ifndef _SYS_DEV_ACPI_ACPI_UTIL_H 68 #define _SYS_DEV_ACPI_ACPI_UTIL_H 69 70 devhandle_t devhandle_from_acpi(devhandle_t, ACPI_HANDLE); 71 ACPI_HANDLE devhandle_to_acpi(devhandle_t); 72 73 #define ACPI_DEVICE_CALL_REGISTER(_n_, _c_) \ 74 DEVICE_CALL_REGISTER(acpi_device_calls, _n_, _c_) 75 76 ACPI_STATUS acpi_eval_integer(ACPI_HANDLE, const char *, ACPI_INTEGER *); 77 ACPI_STATUS acpi_eval_set_integer(ACPI_HANDLE handle, const char *path, 78 ACPI_INTEGER arg); 79 ACPI_STATUS acpi_eval_string(ACPI_HANDLE, const char *, char **); 80 ACPI_STATUS acpi_eval_struct(ACPI_HANDLE, const char *, ACPI_BUFFER *); 81 ACPI_STATUS acpi_eval_reference_handle(ACPI_OBJECT *, ACPI_HANDLE *); 82 83 ACPI_STATUS acpi_foreach_package_object(ACPI_OBJECT *, 84 ACPI_STATUS (*)(ACPI_OBJECT *, void *), void *); 85 ACPI_STATUS acpi_get(ACPI_HANDLE, ACPI_BUFFER *, 86 ACPI_STATUS (*)(ACPI_HANDLE, ACPI_BUFFER *)); 87 88 struct acpi_devnode *acpi_match_node(ACPI_HANDLE handle); 89 void acpi_match_node_init(struct acpi_devnode *ad); 90 91 const char *acpi_name(ACPI_HANDLE); 92 int acpi_match_hid(ACPI_DEVICE_INFO *, const char * const *); 93 int acpi_match_class(ACPI_HANDLE, uint8_t, uint8_t, uint8_t); 94 ACPI_HANDLE acpi_match_cpu_info(struct cpu_info *); 95 struct cpu_info *acpi_match_cpu_handle(ACPI_HANDLE); 96 97 char *acpi_pack_compat_list(struct acpi_devnode *ad, size_t *); 98 99 ACPI_STATUS acpi_dsd_integer(ACPI_HANDLE, const char *, ACPI_INTEGER *); 100 ACPI_STATUS acpi_dsd_string(ACPI_HANDLE, const char *, char **); 101 ACPI_STATUS acpi_dsd_bool(ACPI_HANDLE, const char *, bool *); 102 103 ACPI_STATUS acpi_dsm(ACPI_HANDLE, uint8_t *, ACPI_INTEGER, 104 ACPI_INTEGER, const ACPI_OBJECT *, ACPI_OBJECT **); 105 ACPI_STATUS acpi_dsm_typed(ACPI_HANDLE, uint8_t *, ACPI_INTEGER, 106 ACPI_INTEGER, const ACPI_OBJECT *, 107 ACPI_OBJECT_TYPE, ACPI_OBJECT **); 108 ACPI_STATUS acpi_dsm_integer(ACPI_HANDLE, uint8_t *, ACPI_INTEGER, 109 ACPI_INTEGER, const ACPI_OBJECT *, 110 ACPI_INTEGER *); 111 ACPI_STATUS acpi_dsm_query(ACPI_HANDLE, uint8_t *, ACPI_INTEGER, 112 ACPI_INTEGER *); 113 114 ACPI_STATUS acpi_claim_childdevs(device_t, struct acpi_devnode *); 115 116 #endif /* !_SYS_DEV_ACPI_ACPI_UTIL_H */ 117