From nobody Mon Nov 21 08:31:33 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NG0wj3Z1pz4j47Z; Mon, 21 Nov 2022 08:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NG0wj36CSz3LWv; Mon, 21 Nov 2022 08:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669019493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l6Uq3k2gi19NiS4X7c4qSuP9Py8ynfKdzUcWXc8hRdE=; b=gLSLOU5xxhfAYSbRGVGq4p0Gnp7J3aqMAn1P/A0kVmuByBP4gYIkIg6gUBWCEg7mUMdt/C s1ncSdobUMnpmg2yIWePPTDVoA1k30JcUU8f4n4D9IPng+mwbj/g1MmgMQvou1iFeYpg4L soyk4mfso6ep5i6fBLFBiM++UeyIA+ZEUXf47crmYzie0ll7jAwFd9xS6+GfWm+0ae/5z+ Ryh6wc+75ssp9N+QPkWA5YioCWi8osIeZ4CyDCUxygpCEJm7U+t12LyF1pYIExF/1jfEWD tHqUBLQ2NqBhs3oFt7GazzQE3KeC9Mi6anjhCHkFUHLuKLerwEt6vxxPHzSuYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669019493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l6Uq3k2gi19NiS4X7c4qSuP9Py8ynfKdzUcWXc8hRdE=; b=MwBOLpuezkHrA84vdQkXK52PVKO2HDFp0vKD0kZmXi1n9tbgN8f2Xux5ab0x4/gKfCJxAV O9FCjF1/d5BfuSTlQEkpivyl/YDkiziLAEMz2TJbBNvffZic2i/LwRgRn8f54/GXUOlGOm kf4mdxxX5D1suoOEadE9DseDYJ27fVVQ9bRpTFEkQYZqeo7aaV5RqV0WnGeji9JMZNwcm3 SpJ1q+XCMaLfzfu1CqqsKoyHQQQJeLSmYITwZqi11cNSP8/7K+DEvxeVFXOmP+Seim4xnq j5i+peqvv35mfmbLEysQcMld7Q81Dvv8hbHHsuKP5yOkBd7yIDmZnbkaarOJPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669019493; a=rsa-sha256; cv=none; b=B5UiTqV+2T7lcza4BJAqD9tKI7Hmj7Eycz71Lbvo+0XGy5gRwqsglUe+izP60D3omRoBlz DVJCsRwiYBKbk4FQdJU8AWcY93mZbgLzoLNW2zOVAG7r16/4ORDmYn/lwPTUU3P2LsSBMf MOIzkCHIwVaGQW4C2mNEqLo16AqLy3iN3m34MaK+jN53CTM8T8VnwjQImpfHZFuupppL2s c7jFuFhTTq/EBdEqeuvxAZpfPZJXV6HJs7B2phvFTajMXkcAAXQIqIMFUj6YbxinNIwkur 1SmNQ05FWsWxKWGKV/llisnHCJwjJVcrfplsGzH0jwLolrX0JKGe4PZFE8FrIg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NG0wj28XBzwY2; Mon, 21 Nov 2022 08:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AL8VXJ8026324; Mon, 21 Nov 2022 08:31:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AL8VX8w026323; Mon, 21 Nov 2022 08:31:33 GMT (envelope-from git) Date: Mon, 21 Nov 2022 08:31:33 GMT Message-Id: <202211210831.2AL8VX8w026323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: bdbb1da75a8c - main - bhyve: build FACS table by basl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdbb1da75a8ca10efff8c56e4ecd6944fdfd3268 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=bdbb1da75a8ca10efff8c56e4ecd6944fdfd3268 commit bdbb1da75a8ca10efff8c56e4ecd6944fdfd3268 Author: Corvin Köhne AuthorDate: 2022-04-06 09:10:41 +0000 Commit: Corvin Köhne CommitDate: 2022-11-21 08:27:48 +0000 bhyve: build FACS table by basl Building the FACS table by basl will allow it to be loaded by qemu's ACPI table loader in the future. 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/D36994 --- usr.sbin/bhyve/acpi.c | 50 ++++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c index 35420c42fde0..f5b37e78c1d5 100644 --- a/usr.sbin/bhyve/acpi.c +++ b/usr.sbin/bhyve/acpi.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -619,35 +620,6 @@ err_exit: return (errno); } -static int -basl_fwrite_facs(FILE *fp) -{ - EFPRINTF(fp, "/*\n"); - EFPRINTF(fp, " * bhyve FACS template\n"); - EFPRINTF(fp, " */\n"); - EFPRINTF(fp, "[0004]\t\tSignature : \"FACS\"\n"); - EFPRINTF(fp, "[0004]\t\tLength : 00000040\n"); - EFPRINTF(fp, "[0004]\t\tHardware Signature : 00000000\n"); - EFPRINTF(fp, "[0004]\t\t32 Firmware Waking Vector : 00000000\n"); - EFPRINTF(fp, "[0004]\t\tGlobal Lock : 00000000\n"); - EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000000\n"); - EFPRINTF(fp, "\t\t\tS4BIOS Support Present : 0\n"); - EFPRINTF(fp, "\t\t\t64-bit Wake Supported (V2) : 0\n"); - EFPRINTF(fp, - "[0008]\t\t64 Firmware Waking Vector : 0000000000000000\n"); - EFPRINTF(fp, "[0001]\t\tVersion : 02\n"); - EFPRINTF(fp, "[0003]\t\tReserved : 000000\n"); - EFPRINTF(fp, "[0004]\t\tOspmFlags (decoded below) : 00000000\n"); - EFPRINTF(fp, "\t\t\t64-bit Wake Env Required (V2) : 0\n"); - - EFFLUSH(fp); - - return (0); - -err_exit: - return (errno); -} - /* * Helper routines for writing to the DSDT from other modules. */ @@ -960,6 +932,24 @@ build_dsdt(struct vmctx *const ctx) return (0); } +static int +build_facs(struct vmctx *const ctx) +{ + ACPI_TABLE_FACS facs; + struct basl_table *table; + + BASL_EXEC(basl_table_create(&table, ctx, ACPI_SIG_FACS, + BASL_TABLE_ALIGNMENT_FACS, FACS_OFFSET)); + + memset(&facs, 0, sizeof(facs)); + memcpy(facs.Signature, ACPI_SIG_FACS, ACPI_NAMESEG_SIZE); + facs.Length = sizeof(facs); + facs.Version = htole32(2); + BASL_EXEC(basl_table_append_bytes(table, &facs, sizeof(facs))); + + return (0); +} + int acpi_build(struct vmctx *ctx, int ncpu) { @@ -1000,7 +990,7 @@ acpi_build(struct vmctx *ctx, int ncpu) BASL_EXEC(basl_compile(ctx, basl_fwrite_fadt, FADT_OFFSET)); 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(build_facs(ctx)); BASL_EXEC(build_dsdt(ctx)); BASL_EXEC(basl_finish());