git: 703a8a710030 - stable/13 - bhyve: build DSDT table by basl

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Wed, 30 Nov 2022 10:08:23 UTC
The branch stable/13 has been updated by corvink:

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

commit 703a8a710030ca23688ba364ae61bd34a2482447
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-30 07:03:49 +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
    
    (cherry picked from commit b922cf4fe340bc48355fdde8823dc472841445b3)
---
 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 ac157505b7ba..b6c9bb20eca3 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());