mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
bhyve: register TPM device as ACPI device
The TPM device is an ACPI device with some custom ACPI tables. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D40453
This commit is contained in:
parent
d5edf13d01
commit
dece4f2d87
|
@ -13,11 +13,21 @@
|
|||
#include <string.h>
|
||||
#include <vmmapi.h>
|
||||
|
||||
#include "acpi_device.h"
|
||||
#include "config.h"
|
||||
#include "tpm_device.h"
|
||||
|
||||
#define TPM_ACPI_DEVICE_NAME "TPM"
|
||||
#define TPM_ACPI_HARDWARE_ID "MSFT0101"
|
||||
|
||||
struct tpm_device {
|
||||
struct vmctx *vm_ctx;
|
||||
struct acpi_device *acpi_dev;
|
||||
};
|
||||
|
||||
static const struct acpi_device_emul tpm_acpi_device_emul = {
|
||||
.name = TPM_ACPI_DEVICE_NAME,
|
||||
.hid = TPM_ACPI_HARDWARE_ID,
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -26,6 +36,7 @@ tpm_device_destroy(struct tpm_device *const dev)
|
|||
if (dev == NULL)
|
||||
return;
|
||||
|
||||
acpi_device_destroy(dev->acpi_dev);
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
@ -57,6 +68,11 @@ tpm_device_create(struct tpm_device **const new_dev, struct vmctx *const vm_ctx,
|
|||
|
||||
dev->vm_ctx = vm_ctx;
|
||||
|
||||
error = acpi_device_create(&dev->acpi_dev, dev, dev->vm_ctx,
|
||||
&tpm_acpi_device_emul);
|
||||
if (error)
|
||||
goto err_out;
|
||||
|
||||
*new_dev = dev;
|
||||
|
||||
return (0);
|
||||
|
|
Loading…
Reference in a new issue