2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2021 Beckhoff Automation GmbH & Co. KG
5 * Author: Corvin Köhne <c.koehne@beckhoff.com>
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
20 * Device specific information and emulation.
22 * @param name Used as device name in the DSDT.
23 * @param hid Used as _HID in the DSDT.
24 * @param build_table Called to build a device specific ACPI table like the TPM2
26 * @param write_dsdt Called to append the DSDT with device specific
29 struct acpi_device_emul {
33 int (*build_table)(const struct acpi_device *dev);
34 int (*write_dsdt)(const struct acpi_device *dev);
38 * Creates an ACPI device.
40 * @param[out] new_dev Returns the newly create ACPI device.
41 * @param[in] softc Pointer to the software context of the ACPI device.
42 * @param[in] vm_ctx VM context the ACPI device is created in.
43 * @param[in] emul Device emulation struct. It contains some information
44 * like the name of the ACPI device and some device specific
47 int acpi_device_create(struct acpi_device **new_dev, void *softc,
48 struct vmctx *vm_ctx, const struct acpi_device_emul *emul);
49 void acpi_device_destroy(struct acpi_device *dev);
51 int acpi_device_add_res_fixed_ioport(struct acpi_device *dev, UINT16 port,
53 int acpi_device_add_res_fixed_memory32(struct acpi_device *dev,
54 UINT8 write_protected, UINT32 address, UINT32 length);
56 void *acpi_device_get_softc(const struct acpi_device *dev);
58 int acpi_device_build_table(const struct acpi_device *dev);
59 int acpi_device_write_dsdt(const struct acpi_device *dev);