git: b922cf4fe340 - main - bhyve: build DSDT table by basl

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Wed, 16 Nov 2022 11:47:54 UTC
The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=b922cf4fe340bc48355fdde8823dc472841445b3

commit b922cf4fe340bc48355fdde8823dc472841445b3
Author:     Corvin Köhne <corvink@FreeBSD.org>
AuthorDate: 2022-04-06 09:10:40 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-11-16 11:43:41 +0000

    bhyve: build DSDT table by basl
    
    Building the DSDT table by basl will allow it to be loaded by qemu's
    ACPI table loader.
    
    Building the DSDT is complex and basl doesn't support it yet. For that
    reason, it's still compiled by iasl. It's just a bit restructured.
    Upcoming commits will restructure the builds of all other ACPI tables in
    a similar way. So, this commit is done for consistency reasons. We're
    starting with DSDT because it doesn't point to any other tables and it's
    the last one in our current build list.
    
    Reviewed by:            jhb, markj (older version)
    Approved by:            manu (mentor)
    MFC after:              2 weeks
    Sponsored by:           Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D36993
---
 usr.sbin/bhyve/acpi.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c
index e823d2d41357..35420c42fde0 100644
--- a/usr.sbin/bhyve/acpi.c
+++ b/usr.sbin/bhyve/acpi.c
@@ -952,6 +952,14 @@ basl_make_templates(void)
 	return (err);
 }
 
+static int
+build_dsdt(struct vmctx *const ctx)
+{
+	BASL_EXEC(basl_compile(ctx, basl_fwrite_dsdt, DSDT_OFFSET));
+
+	return (0);
+}
+
 int
 acpi_build(struct vmctx *ctx, int ncpu)
 {
@@ -993,7 +1001,7 @@ acpi_build(struct vmctx *ctx, int ncpu)
 	BASL_EXEC(basl_compile(ctx, basl_fwrite_hpet, HPET_OFFSET));
 	BASL_EXEC(basl_compile(ctx, basl_fwrite_mcfg, MCFG_OFFSET));
 	BASL_EXEC(basl_compile(ctx, basl_fwrite_facs, FACS_OFFSET));
-	BASL_EXEC(basl_compile(ctx, basl_fwrite_dsdt, DSDT_OFFSET));
+	BASL_EXEC(build_dsdt(ctx));
 
 	BASL_EXEC(basl_finish());