xref: /freebsd-src/sys/compat/linuxkpi/common/include/acpi/acpi_bus.h (revision 3e90716331cdbdee7465213d389a33f90dad11cf)
1dab39c11SEmmanuel Vadot /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3dab39c11SEmmanuel Vadot  *
4dab39c11SEmmanuel Vadot  * Copyright (c) 2020 Vladimir Kondratyev <wulf@FreeBSD.org>
5dab39c11SEmmanuel Vadot  *
6dab39c11SEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
7dab39c11SEmmanuel Vadot  * modification, are permitted provided that the following conditions are
8dab39c11SEmmanuel Vadot  * met:
9dab39c11SEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
10dab39c11SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer.
11dab39c11SEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
12dab39c11SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in
13dab39c11SEmmanuel Vadot  *    the documentation and/or other materials provided with the
14dab39c11SEmmanuel Vadot  *    distribution.
15dab39c11SEmmanuel Vadot  *
16dab39c11SEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17dab39c11SEmmanuel Vadot  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18dab39c11SEmmanuel Vadot  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19dab39c11SEmmanuel Vadot  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20dab39c11SEmmanuel Vadot  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21dab39c11SEmmanuel Vadot  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22dab39c11SEmmanuel Vadot  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23dab39c11SEmmanuel Vadot  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24dab39c11SEmmanuel Vadot  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25dab39c11SEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26dab39c11SEmmanuel Vadot  * SUCH DAMAGE.
27dab39c11SEmmanuel Vadot  */
28dab39c11SEmmanuel Vadot 
29307f78f3SVladimir Kondratyev #ifndef _LINUXKPI_ACPI_ACPI_BUS_H_
30307f78f3SVladimir Kondratyev #define _LINUXKPI_ACPI_ACPI_BUS_H_
31dab39c11SEmmanuel Vadot 
32*3e907163SVladimir Kondratyev /* Aliase struct acpi_device to device_t */
33*3e907163SVladimir Kondratyev #define	acpi_device	_device
34*3e907163SVladimir Kondratyev 
35dab39c11SEmmanuel Vadot typedef char acpi_device_class[20];
36dab39c11SEmmanuel Vadot 
37dab39c11SEmmanuel Vadot struct acpi_bus_event {
38dab39c11SEmmanuel Vadot 	acpi_device_class device_class;
39dab39c11SEmmanuel Vadot 	uint32_t type;
40dab39c11SEmmanuel Vadot 	uint32_t data;
41dab39c11SEmmanuel Vadot };
42dab39c11SEmmanuel Vadot 
4304952a94SVladimir Kondratyev #define	acpi_dev_present(...)	lkpi_acpi_dev_present(__VA_ARGS__)
44*3e907163SVladimir Kondratyev #define	acpi_dev_get_first_match_dev(...)	\
45*3e907163SVladimir Kondratyev 	lkpi_acpi_dev_get_first_match_dev(__VA_ARGS__)
4604952a94SVladimir Kondratyev 
47dab39c11SEmmanuel Vadot ACPI_HANDLE	bsd_acpi_get_handle(device_t bsddev);
48dab39c11SEmmanuel Vadot bool		acpi_check_dsm(ACPI_HANDLE handle, const char *uuid, int rev,
49dab39c11SEmmanuel Vadot 		    uint64_t funcs);
50dab39c11SEmmanuel Vadot ACPI_OBJECT *	acpi_evaluate_dsm_typed(ACPI_HANDLE handle, const char *uuid,
51dab39c11SEmmanuel Vadot 		    int rev, int func, ACPI_OBJECT *argv4,
52dab39c11SEmmanuel Vadot 		    ACPI_OBJECT_TYPE type);
53dab39c11SEmmanuel Vadot int		register_acpi_notifier(struct notifier_block *nb);
54dab39c11SEmmanuel Vadot int		unregister_acpi_notifier(struct notifier_block *nb);
55dab39c11SEmmanuel Vadot uint32_t	acpi_target_system_state(void);
5604952a94SVladimir Kondratyev bool		lkpi_acpi_dev_present(const char *hid, const char *uid,
5704952a94SVladimir Kondratyev 		    int64_t hrv);
58*3e907163SVladimir Kondratyev struct acpi_device *lkpi_acpi_dev_get_first_match_dev(const char *hid,
59*3e907163SVladimir Kondratyev 		    const char *uid, int64_t hrv);
60dab39c11SEmmanuel Vadot 
61307f78f3SVladimir Kondratyev #endif /* _LINUXKPI_ACPI_ACPI_BUS_H_ */
62