From nobody Mon Dec 5 07:41:58 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 4NQb930yWNz4jf7B; Mon, 5 Dec 2022 07:41:59 +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 4NQb9250Nyz4FvM; Mon, 5 Dec 2022 07:41:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670226118; 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=bip8c69wgoloyiTKzOPVzpHea6aH8tPu7B/r8QwO/EI=; b=b4EvtNUIyJwWesnbiAE2yGv6z0Eu3Ds5DOAgegFOtIZ02qvllVI5mxPXc6BupXfXXj8Ljm OA10PNr7+f6Vbr6KSg2O6TUJqWddrHfEBRdG6JdTpwi76jogTD1pAA3Mv8wxS3V0DZbBfH 4KK69rZmGfk0luqMSTPGu7dsLW2XJ9WpxeFm5xzZAaPCzNpi239EoBSL+TDH/gzATjo/CQ Gm+UJ0fnHn2lmStKgYTmulwMJZFLHSYUFJZRWKRb6crk3YPd3gmsL0pM6n3soX/6c1lPQz gfYiYb5FT3flmHpRvsNZuc9K9OOUqHYmGizCZLB1q7S2brnzufoZuoCTlEvBQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1670226118; 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=bip8c69wgoloyiTKzOPVzpHea6aH8tPu7B/r8QwO/EI=; b=oD+zT423uYnWizjjuFk6BZHcekEg+J1KZX91q/UEGvEmohOUqGyXZCrNAVX5Gl5KSZKeNt EMc/zGwYNeDXVPspVH75q4Gxk61eWt01ey4Mgc++OZ11Q9NZZHqDba+2v8CZdmiRzn1316 X645c6r2//b6IiYxeLzWfRNp7PcQzXmZxnmoFD+jhsNYfpOdJiXGIpRDPYFDqjylIH3U9s IiijoC2SpE2nRjICL4IOAHt8ivRAU1F0OdkjCDkx3IIB74C+prjFd+T4SLHQNn3nNNcg39 lhCNZfraRjW2nXXtTZtjb/Fs006l9Mw22K8QjKN9ZAkWhwhknUhzdDjKaRrXYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1670226118; a=rsa-sha256; cv=none; b=c31JcRHkwBYAFDyyNpZtKZxIfX7hQnUkk3iJMpEatjSXjXfDSIp9BGsxjqAFXaIyWMyJnj L/v69V55uamnd+7lkuXngfT0mWAL8P0ZG4ODlr8J4P9tqCBdkveRZI62q6YCKEr/qhH14m 9NKXFSoWIdQ35op5QAxK9NviFtqL6C5RQxPl+HTPIbz4phLni/H4jI/7qNuT+9cvjNrGe/ GQDNJh/JSn65P314tsWQFCRHIusOegYT0lcACJUwg8oTJTb+aWIvNqxWojhmIz3TYBHQkO r+mJPcMSCLaS+HXxbJWnVcxV/UKjFedh5LKzb8n92lFwDoivlkdYtbGBVC39hQ== 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 4NQb9243yTzqJg; Mon, 5 Dec 2022 07:41:58 +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 2B57fwrA082787; Mon, 5 Dec 2022 07:41:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2B57fwsJ082786; Mon, 5 Dec 2022 07:41:58 GMT (envelope-from git) Date: Mon, 5 Dec 2022 07:41:58 GMT Message-Id: <202212050741.2B57fwsJ082786@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: fa0b9dec6931 - stable/13 - bhyve: make basl_table_add_* functions public 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fa0b9dec693116a1c2366d0a39c7d3ea39514667 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=fa0b9dec693116a1c2366d0a39c7d3ea39514667 commit fa0b9dec693116a1c2366d0a39c7d3ea39514667 Author: Corvin Köhne AuthorDate: 2022-11-16 08:15:12 +0000 Commit: Corvin Köhne CommitDate: 2022-12-05 07:39:33 +0000 bhyve: make basl_table_add_* functions public The code will be more readable if we use struct definitions from ACPI-CA to build ACPI tables. We can fill out the struct and append it to the basl_table by using basl_table_append_bytes. After that, we have to declare which checksums, length and pointers should be patched by basl. That's done by the add_* functions. 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/D37405 (cherry picked from commit 7263419f387db306340ed39fc058580872b64f3b) --- usr.sbin/bhyve/basl.c | 14 +++++++++++--- usr.sbin/bhyve/basl.h | 7 +++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c index e8724b857381..7accc7088a9d 100644 --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -323,12 +323,14 @@ basl_init(void) return (0); } -static int +int basl_table_add_checksum(struct basl_table *const table, const uint32_t off, const uint32_t start, const uint32_t len) { struct basl_table_checksum *checksum; + assert(table != NULL); + checksum = calloc(1, sizeof(struct basl_table_checksum)); if (checksum == NULL) { warnx("%s: failed to allocate checksum", __func__); @@ -344,12 +346,15 @@ basl_table_add_checksum(struct basl_table *const table, const uint32_t off, return (0); } -static int +int basl_table_add_length(struct basl_table *const table, const uint32_t off, const uint8_t size) { struct basl_table_length *length; + assert(table != NULL); + assert(size == 4 || size == 8); + length = calloc(1, sizeof(struct basl_table_length)); if (length == NULL) { warnx("%s: failed to allocate length", __func__); @@ -364,13 +369,16 @@ basl_table_add_length(struct basl_table *const table, const uint32_t off, return (0); } -static int +int basl_table_add_pointer(struct basl_table *const table, const uint8_t src_signature[ACPI_NAMESEG_SIZE], const uint32_t off, const uint8_t size) { struct basl_table_pointer *pointer; + assert(table != NULL); + assert(size == 4 || size == 8); + pointer = calloc(1, sizeof(struct basl_table_pointer)); if (pointer == NULL) { warnx("%s: failed to allocate pointer", __func__); diff --git a/usr.sbin/bhyve/basl.h b/usr.sbin/bhyve/basl.h index aab4a16a63f5..5c6c5123d887 100644 --- a/usr.sbin/bhyve/basl.h +++ b/usr.sbin/bhyve/basl.h @@ -39,6 +39,13 @@ struct basl_table; int basl_finish(void); int basl_init(void); +int basl_table_add_checksum(struct basl_table *const table, const uint32_t off, + const uint32_t start, const uint32_t len); +int basl_table_add_length(struct basl_table *const table, const uint32_t off, + const uint8_t size); +int basl_table_add_pointer(struct basl_table *const table, + const uint8_t src_signature[ACPI_NAMESEG_SIZE], const uint32_t off, + const uint8_t size); int basl_table_append_bytes(struct basl_table *table, const void *bytes, uint32_t len); int basl_table_append_checksum(struct basl_table *table, uint32_t start,