bhyve: check for errors when writing device specific DSDT entries

At the moment, this function can't fail. This behaviour will change in
the future. In preparation to that, convert the return type to int in
order to be able to check for errors.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39422
This commit is contained in:
Corvin Köhne 2023-04-05 08:45:22 +02:00
parent 0926566f6f
commit ab34ea4711
No known key found for this signature in database
GPG Key ID: D854DA56315E026A
3 changed files with 11 additions and 8 deletions

View File

@ -245,7 +245,7 @@ basl_fwrite_dsdt(FILE *fp)
const struct acpi_device_list_entry *entry;
SLIST_FOREACH(entry, &acpi_devices, chain) {
acpi_device_write_dsdt(entry->dev);
BASL_EXEC(acpi_device_write_dsdt(entry->dev));
}
dsdt_line("}");

View File

@ -17,6 +17,7 @@
#include "acpi.h"
#include "acpi_device.h"
#include "basl.h"
/**
* List entry to enumerate all resources used by an ACPI device.
@ -148,7 +149,7 @@ acpi_device_build_table(const struct acpi_device *const dev)
return (0);
}
static void
static int
acpi_device_write_dsdt_crs(const struct acpi_device *const dev)
{
const struct acpi_resource_list_entry *res;
@ -167,14 +168,14 @@ acpi_device_write_dsdt_crs(const struct acpi_device *const dev)
break;
}
}
return (0);
}
void
int
acpi_device_write_dsdt(const struct acpi_device *const dev)
{
if (dev == NULL) {
return;
}
assert(dev != NULL);
dsdt_line("");
dsdt_line(" Scope (\\_SB)");
@ -186,9 +187,11 @@ acpi_device_write_dsdt(const struct acpi_device *const dev)
dsdt_line(" Name (_CRS, ResourceTemplate ()");
dsdt_line(" {");
dsdt_indent(4);
acpi_device_write_dsdt_crs(dev);
BASL_EXEC(acpi_device_write_dsdt_crs(dev));
dsdt_unindent(4);
dsdt_line(" })");
dsdt_line(" }");
dsdt_line(" }");
return (0);
}

View File

@ -50,4 +50,4 @@ int acpi_device_add_res_fixed_memory32(struct acpi_device *dev,
UINT8 write_protected, UINT32 address, UINT32 length);
int acpi_device_build_table(const struct acpi_device *dev);
void acpi_device_write_dsdt(const struct acpi_device *dev);
int acpi_device_write_dsdt(const struct acpi_device *dev);