From nobody Tue Nov 29 13:58:00 2022 X-Original-To: dev-commits-src-branches@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 4NM3nh26MYz4htk2; Tue, 29 Nov 2022 13:58:00 +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 4NM3nh1WH7z4BrY; Tue, 29 Nov 2022 13:58:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669730280; 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=mZQRjhVEeCRsTGorvfBv7Zj2dqWvaQu+E3kpYurJGEE=; b=BSWy/LihP/l/Nwb6wk595+t7hrwatibMriO1K3rXl3sHJJ7Y2qJsizVu4uWhpNEC7w4pJe R+qe5Uk165EemkO73s8MzsfAljXiyP+63+HmeozbFZuJgjhBnocAHOGQa1iiLS4wIB3ltq xUk4JspZGu1QI62RXv5zfIUJ2Vz7r00AIO2qN8qIdAZangFN7Xx5i+rY1P7BKherd6oGoF WgFvgBB6PS5wahk9C7slWUPG0uDU677DVmeY/my2drWhO2mvuwzWTwqNJEPszbUA2gw3/h +vZAjZe1hD7r6TWs5ANQ8D4MaWrILO2b9jaGVKXZlq+zJ4B5Gb7EnZsx0pDK6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669730280; 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=mZQRjhVEeCRsTGorvfBv7Zj2dqWvaQu+E3kpYurJGEE=; b=d0F+uKJxWLfYXi5egCIwyYdtJk8Nqbu3aqVQFigGoT/PcvWfHRZFSgEUgKWDx6Rzu5F1Ct st9KXSF701x183ivgtCsNuFjoBqer/gG8d2g+W+ErHn+bntRPEt/AzVveysqJhuI+LgN1R HAPAwBe87+YNkKzNLCVDDLY7Wg/63mjBLZVFB8Y9DVsWWi9lH7nf8jJhrGDbzd/LTmx4c2 /N7kJwYptovBryaWhFw65Eg2zrxQCkPCNWPoSNmtDybn3p/lq7TJMPdjVb4jU/SA/jOpmT lVdIYLllQNZnArYgULUyBA6TcaBATsCJVVnf59ixWJ5L+YgNuZbMcRA8YJjaug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669730280; a=rsa-sha256; cv=none; b=PMr566rwVcdbwlsvhW5MdqKJZIvBVMIUD2LcP7+Cs1aMKvgqg6ReCmX4aNoZDTFcBQn5Rk X/PweF0RQeNXjb43+DG/k+pd9QR3vLQOkC3tGeMMfzOlVTyMSzxGWXvChjHMjkyU5mjnyX vTVUVFDAQ8Lhgm1sSH//24qlVYdM7RhgWkbhjPAXhR4X0p43mi0BbfbS5nhkKgt/1aI+nm fXsqeVTXa/gwcGSgH4kTwDT1O+DzDfeczl59zcbqLTfWn1GtgGS6X552XdomP72OgnU+Oz RjO1DBJPi7drcryjTtBbwUM5P/3JlctEuRpvY/Ff6mTkqjtxC0sZtBckakhKNg== 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 4NM3nh0bRPzKfR; Tue, 29 Nov 2022 13:58:00 +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 2ATDw0Z1029380; Tue, 29 Nov 2022 13:58:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ATDw0nM029379; Tue, 29 Nov 2022 13:58:00 GMT (envelope-from git) Date: Tue, 29 Nov 2022 13:58:00 GMT Message-Id: <202211291358.2ATDw0nM029379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 598177ab3916 - stable/13 - bhyve: add table dump functions for basl List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 598177ab39164e3d4ff23cec380146fedd6e97e2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=598177ab39164e3d4ff23cec380146fedd6e97e2 commit 598177ab39164e3d4ff23cec380146fedd6e97e2 Author: Corvin Köhne AuthorDate: 2022-11-04 11:26:34 +0000 Commit: Corvin Köhne CommitDate: 2022-11-29 13:53:49 +0000 bhyve: add table dump functions for basl Developing an ACPI table compiler isn't quite easy. It's helpful if you can take a look at the ACPI tables created by the compiler. The dump functions can either dump a ACPI table which was copied into guest memory or a ACPI table provided for qemu's ACPI table loader. Reviewed by: jhb, markj Approved by: manu (mentor) MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36985 (cherry picked from commit ac3c2b3e38fb03b0d0e26ffa0527735575984ba2) --- usr.sbin/bhyve/basl.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c index f24d8c009110..655c6e509dc4 100644 --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,41 @@ struct basl_table { static STAILQ_HEAD(basl_table_list, basl_table) basl_tables = STAILQ_HEAD_INITIALIZER( basl_tables); +static int +basl_dump_table(const struct basl_table *const table, const bool mem) +{ + const ACPI_TABLE_HEADER *const header = table->data; + const uint8_t *data; + + if (!mem) { + data = table->data; + } else { + data = vm_map_gpa(table->ctx, BHYVE_ACPI_BASE + table->off, + table->len); + if (data == NULL) { + return (ENOMEM); + } + } + + printf("%.4s @ %8x (%s)\n", header->Signature, + BHYVE_ACPI_BASE + table->off, mem ? "Memory" : "FwCfg"); + hexdump(data, table->len, NULL, 0); + + return (0); +} + +static int +basl_dump(const bool mem) +{ + struct basl_table *table; + + STAILQ_FOREACH(table, &basl_tables, chain) { + BASL_EXEC(basl_dump_table(table, mem)); + } + + return (0); +} + static int basl_finish_install_guest_tables(struct basl_table *const table) {