From nobody Tue Nov 15 07:28:04 2022 X-Original-To: dev-commits-src-main@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 4NBHpD5Vvqz4hBp8; Tue, 15 Nov 2022 07:28:04 +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 4NBHpD2xMkz3jwC; Tue, 15 Nov 2022 07:28:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668497284; 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=mJjqASlh5imTZFertnzqslABbMreQfn5ciIR3aZFd9w=; b=B1g3rqhOH2veT0OCGwTtBuOEtd6DaKe/+CM7b6M4rcClE3JW2raWs+I9hOZ/aVlGjks8ck Izow4T0XV5z144k+k76x15kVUpxbZ2wAM0z1mLvqVMAwhMftB+grcqaDDMNSDVm5t6r/dA hJOFcmvCUmT3nWYQRSm7qk7hmdZIXqOR6Un8I6BELJXtPVm8M5MgjTUXUa4lVHkzzajc4e yx9Gt0PiRT2zINRJqmkLATlhQmQjoK0FWxNWHS6iSiwBw+xqN5lSITChHGxajbRK6KqyQg 4Db3icdGHejIUhY5AdkP7zY27KJN71/NbaiaAWHAwsv3zHOD2uRzAQDoPFA5hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668497284; 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=mJjqASlh5imTZFertnzqslABbMreQfn5ciIR3aZFd9w=; b=sKjhu7Jm2yq1fo/ELEi2LChgIc+v1s9S9AvakMTR2U6IlBFWN4FUZY7a/iWalpl486Na+y 1Z+nfrsULGBK+rbSOppWxo0mYW01QLR1E2qZlrsWmQFk3fFEZuUeFh3jKCyNlcfpGMO6y4 XRRz1j2HRwD1hbe8hc0ZcPkRJJv7QDIVQEt0XOTKzUNE9XTt/9x6YThr7/DL39hvWnafz/ 6CBnIDZ/9cUwSo4iw9ykn4N4Yd0fYfkSjJl9tx/MtyUkxzJiw4CGBPwWF2D8yQf1Z0e31I NUHkucX8eYXdGMJIZ9gsqQ9Oo8sXg5hyU9uD8EaG+5Yxj+/TG3DFeqTjAqYDJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668497284; a=rsa-sha256; cv=none; b=u5jY2enM+7Hoziu6FyniczvohkGwL+VK6jxsURr8XqCxK5DMOYzOnh69luZntfSFcvZt9L T1CFhpjCcnDAsZsORmF6xYQ4skl3OH1LqQqu9ff2yTPM3m/p+SSY0WhJJN03k1SDoOVZCt Y6ErZUgMAaCXtqD55t0hYqq2GcY4uno4TvkLq0gnsyX/1ZkPuMYXVxW+c9M1Wlfr8tEGUZ Vm60BbyHS97fj59M++822Vjm/PvPsEEmFHOtsfzbuNEA1XlQdX+Jn59LZftne58e8ziH5o 24uPJxG1I8cc0CbwtzO6L8+MZMl5bxzjBPKQ4cgtHudi8EtdXwt+LfJ80d9i/A== 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 4NBHpD21Mxz1Cwf; Tue, 15 Nov 2022 07:28:04 +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 2AF7S4ML046663; Tue, 15 Nov 2022 07:28:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AF7S46l046662; Tue, 15 Nov 2022 07:28:04 GMT (envelope-from git) Date: Tue, 15 Nov 2022 07:28:04 GMT Message-Id: <202211150728.2AF7S46l046662@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: ac3c2b3e38fb - main - bhyve: add table dump functions for basl List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: ac3c2b3e38fb03b0d0e26ffa0527735575984ba2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=ac3c2b3e38fb03b0d0e26ffa0527735575984ba2 commit ac3c2b3e38fb03b0d0e26ffa0527735575984ba2 Author: Corvin Köhne AuthorDate: 2022-11-04 11:26:34 +0000 Commit: Corvin Köhne CommitDate: 2022-11-15 07:27:04 +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 --- 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) {