xref: /freebsd/usr.sbin/bhyve/acpi_device.h (revision 4d3fc8b0)
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 **const new_dev,
30     struct vmctx *const vm_ctx, const char *const name, const char *const hid);
31 void acpi_device_destroy(struct acpi_device *const dev);
32 
33 int acpi_device_add_res_fixed_ioport(struct acpi_device *const dev,
34     const UINT16 port, UINT8 length);
35 int acpi_device_add_res_fixed_memory32(struct acpi_device *const dev,
36     const UINT8 write_protected, const UINT32 address, const UINT32 length);
37 
38 void acpi_device_write_dsdt(const struct acpi_device *const dev);
39