xref: /freebsd/usr.sbin/bhyve/acpi_device.h (revision 5d96ca7a307279cf4bdb191b7074cd1efcd3b8e8)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2021 Beckhoff Automation GmbH & Co. KG
5  * Author: Corvin Köhne <c.koehne@beckhoff.com>
6  */
7 
8 #pragma once
9 
10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wunused-parameter"
12 #include <contrib/dev/acpica/include/acpi.h>
13 #pragma GCC diagnostic pop
14 
15 struct vmctx;
16 
17 struct acpi_device;
18 
19 /**
20  * Creates an ACPI device.
21  *
22  * @param[out] new_dev Returns the newly create ACPI device.
23  * @param[in]  vm_ctx  VM context the ACPI device is created in.
24  * @param[in]  name    Name of the ACPI device. Should always be a NULL
25  *                     terminated string.
26  * @param[in]  hid     Hardware ID of the ACPI device. Should always be a NULL
27  *                     terminated string.
28  */
29 int acpi_device_create(struct acpi_device **new_dev, struct vmctx *vm_ctx,
30     const char *name, const char *hid);
31 void acpi_device_destroy(struct acpi_device *dev);
32 
33 int acpi_device_add_res_fixed_ioport(struct acpi_device *dev, UINT16 port,
34     UINT8 length);
35 int acpi_device_add_res_fixed_memory32(struct acpi_device *dev,
36     UINT8 write_protected, UINT32 address, UINT32 length);
37 
38 void acpi_device_write_dsdt(const struct acpi_device *dev);
39