/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2021 Beckhoff Automation GmbH & Co. KG4* Author: Corvin Köhne <[email protected]>5*/67#pragma once89#pragma GCC diagnostic push10#pragma GCC diagnostic ignored "-Wunused-parameter"11#include <contrib/dev/acpica/include/acpi.h>12#pragma GCC diagnostic pop1314struct vmctx;1516struct acpi_device;1718/**19* Device specific information and emulation.20*21* @param name Used as device name in the DSDT.22* @param hid Used as _HID in the DSDT.23* @param build_table Called to build a device specific ACPI table like the TPM224* table.25* @param write_dsdt Called to append the DSDT with device specific26* information.27*/28struct acpi_device_emul {29const char *name;30const char *hid;3132int (*build_table)(const struct acpi_device *dev);33int (*write_dsdt)(const struct acpi_device *dev);34};3536/**37* Creates an ACPI device.38*39* @param[out] new_dev Returns the newly create ACPI device.40* @param[in] softc Pointer to the software context of the ACPI device.41* @param[in] vm_ctx VM context the ACPI device is created in.42* @param[in] emul Device emulation struct. It contains some information43* like the name of the ACPI device and some device specific44* functions.45*/46int acpi_device_create(struct acpi_device **new_dev, void *softc,47struct vmctx *vm_ctx, const struct acpi_device_emul *emul);48void acpi_device_destroy(struct acpi_device *dev);4950int acpi_device_add_res_fixed_ioport(struct acpi_device *dev, UINT16 port,51UINT8 length);52int acpi_device_add_res_fixed_memory32(struct acpi_device *dev,53UINT8 write_protected, UINT32 address, UINT32 length);5455void *acpi_device_get_softc(const struct acpi_device *dev);5657int acpi_device_build_table(const struct acpi_device *dev);58int acpi_device_write_dsdt(const struct acpi_device *dev);596061