From nobody Mon Nov 21 08:31:34 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 4NG0wk4Crrz4j435; Mon, 21 Nov 2022 08:31:34 +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 4NG0wk3nhJz3LpS; Mon, 21 Nov 2022 08:31:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669019494; 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=WTfBTjaE+DlSvz4w7vrU4Pqa2l+qKMtbS+B0FLu2EVk=; b=g8nBQzkdkdOml5g+S0cxA6xYRsCadpDjr0293o0AxuJfbsgVbj38K5lQFUJ18N51v/XjTz RzDiewBW6dszOklBR3xcUTF0uhclKnFXqpGD+AGDF5tuWKeXYxX8RA57F/LINzJOOniij7 weTRjpHEYGI///zIHDjR+fxuC56f7xA/hpVAzS2mLE3pZA42voD08pQYgtezQmtolYrwEB xeCFIAfJGaDA1yzNnbyjwQdoLQDCFI7FP7m9sQ66OAgvyOuNMWO8rqEUqNAGgJkfd8BZvw cqLGBX6VDkffjEpHRuXksbCqkfMMm7p+EjrhV8pDJ7rDC0ar58UyenEF4l4log== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669019494; 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=WTfBTjaE+DlSvz4w7vrU4Pqa2l+qKMtbS+B0FLu2EVk=; b=WjE5FVkH/X8+b8u9CXhvHdtnhzMeVZ0aCMn1dFe6kXaV3WbPZZ1OO1pSXg15LKUYWefrlD 5PdnbN95a877vTuPzdIeVxRoO4ZClG451gRmQnXuN40qJivbgQ+J5/9ASdhdIOCyr6qQfa aACb9ynIoBHxkhNjTgyl9jCEtn95qvFKvZcsJ3hmVtmH2UkYLitiDw5MIUyonwqRXynugj UbER159PItsXE/YknNS+ZooNapUW/pYPuKpbqEQMuak9I60j8XDxCGM/+/oB3WWW9AZoO1 gkq3ZOQaS2MewDEiulu6jMcH4mI8slPpbhgF/SowS5QmuwAWIxJlvZnsMcGYXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669019494; a=rsa-sha256; cv=none; b=kgKWtKZDSubGxyACVuCVE/lT8JYpZIydI0eQEAVmt0RGMp9OUFbKVKuUFvn6jJ7q+AKDpM 1ntLvdVLzoQHwjrqaiIG9NaChhBCYEbUEk0EkafRGYRcHg9NWsFrXlMeEMgE+uukqCwMNL k3ueUzQD6xH2Xu7nTQnGCx7mgWDfDGOC5JW7gvkOnn/rEANxxGsjvd+YVkr/8XxUASOOWv oOpjArqf16K2bpFoNBsoDa3Fbu2kH4KGaU/7j4nk/QwaDRBBckZtvJKi+1r2mHam5+sRe1 9so7Yrsgn+PKzslenrOyjQw30hHX9dRLwYEOQOdYm93vdLaYd13TpYf7mOroOQ== 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 4NG0wk2t27zwkc; Mon, 21 Nov 2022 08:31:34 +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 2AL8VYoW026353; Mon, 21 Nov 2022 08:31:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AL8VYAg026352; Mon, 21 Nov 2022 08:31:34 GMT (envelope-from git) Date: Mon, 21 Nov 2022 08:31:34 GMT Message-Id: <202211210831.2AL8VYAg026352@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: 7263419f387d - main - bhyve: make basl_table_add_* functions public 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: 7263419f387db306340ed39fc058580872b64f3b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=7263419f387db306340ed39fc058580872b64f3b commit 7263419f387db306340ed39fc058580872b64f3b Author: Corvin Köhne AuthorDate: 2022-11-16 08:15:12 +0000 Commit: Corvin Köhne CommitDate: 2022-11-21 08:27:50 +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 --- 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 8c01f16895cd..e93d0e2e1a58 100644 --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -322,12 +322,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__); @@ -343,12 +345,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__); @@ -363,13 +368,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 eef252bd1248..3b61362d824f 100644 --- a/usr.sbin/bhyve/basl.h +++ b/usr.sbin/bhyve/basl.h @@ -42,6 +42,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,