From nobody Tue Nov 15 07:28:06 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 4NBHpG5bfcz4hBwG; Tue, 15 Nov 2022 07:28:06 +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 4NBHpG4vdxz3k4p; Tue, 15 Nov 2022 07:28:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668497286; 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=zYmpldiAofZsE/aEqasV5yNp0DrgF0yqABpS4ZeW4IE=; b=nQJXn3EIU84+lXLrnvn7khXi+S0olze7RWg8mj4zHrcZGq/t/t3ngIuxrhv11IvJRtznGY xP0LuVuVZl1EvYcPbSOWzZxNy+6byVavATBICEK1fMcF7/z2LvSVImnu2/tLnSVWe1/Oc9 /QdrUFQoW8zGccIkA1YfGYF9afcGPBYNYyWiP01NXE224lRnIITefsw8YF0VefUi/1L71d uXhy1jLtQ3ePPKNJ+HzwBpwRy+HkErJuh6rOgrrLhmQe4AumS7QaDb+1q+RJfgr2fImIfx xMIYx5Z3eu19y5lqZHQTa1nDjaJZNldgVLzi1vHECdOwl62YgeUUB65Bv1Yrsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668497286; 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=zYmpldiAofZsE/aEqasV5yNp0DrgF0yqABpS4ZeW4IE=; b=ttwCYbgLaJAslvYGmoh47XnD3CPlfVqF/qqFDBFjHFbLbzjWLQe/quwovZ9CgYvteSzG0t 9qRjZ5f89b5USkzvAilWAtrBkB+OOScks8avSSOjMZA4Koqs1fRVnCLZZafyWpLKXo3uTa 888bdXrux7PeNGyWW1epVV4Bgbvse/onEMYfyvhakaFaQDQv8KfDRrtPG/qipVeKPG/gD7 r9hYKsit1xSM4+lrpIdD/IN5x1Pk6d9ExkKGLbDbaQPuRoJ2qZAbVU31SsNW0/GxX8NpIu PXV6e9zHrkN9tSBJqQ917DQT8lDFt/1GuQeiUvfSkLLEqfhk8tipYuaorsQtWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668497286; a=rsa-sha256; cv=none; b=Z2drHc2B5GQTEjzKHtEABThi0sMa4BrJJIvk7JmxqM15wAJK15ZoQwzc8KhzdF0XrzVyVH y4bDJ1cYEwyd3TdCRryUKq22v1LSZrvkQeJm1rdbD9yR2gDpyKkynTRHCrGP+93fBoz62R XmmYkd4qpMpiq9lmUI1XSIC+DOULWnYXTDWRwFQeisYzzBq26XaKWP5p+ZnxlVIV2d+qrC HqMurqYSjpDjcYss+3wBMNDFI/gIS2BXsrUeSmgGHYwnhR2/tPj8yuuG/28+t8YcT4NBV0 0PLjF1Nr2pBnc1Fm503oqgDxr4Z56K+rnydWbMj/j8Xx2KYHBxN9GV5KwxNwQA== 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 4NBHpG3vctz1CtB; Tue, 15 Nov 2022 07:28:06 +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 2AF7S6qK046721; Tue, 15 Nov 2022 07:28:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AF7S6Jl046720; Tue, 15 Nov 2022 07:28:06 GMT (envelope-from git) Date: Tue, 15 Nov 2022 07:28:06 GMT Message-Id: <202211150728.2AF7S6Jl046720@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: e22f5ce2bf4c - main - bhyve: add basl support for int values 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: e22f5ce2bf4c1a53a1551ae855f42d582eeda20e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=e22f5ce2bf4c1a53a1551ae855f42d582eeda20e commit e22f5ce2bf4c1a53a1551ae855f42d582eeda20e Author: Corvin Köhne AuthorDate: 2022-11-04 12:48:13 +0000 Commit: Corvin Köhne CommitDate: 2022-11-15 07:27:07 +0000 bhyve: add basl support for int values In upcoming commits, bhyve will build some ACPI tables by it's own. Therefore, it should be capable of appending int values to ACPI tables. 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/D36987 --- usr.sbin/bhyve/basl.c | 23 +++++++++++++++++++++++ usr.sbin/bhyve/basl.h | 1 + 2 files changed, 24 insertions(+) diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c index 655c6e509dc4..b3a561f51571 100644 --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -33,6 +33,17 @@ struct basl_table { static STAILQ_HEAD(basl_table_list, basl_table) basl_tables = STAILQ_HEAD_INITIALIZER( basl_tables); +static __inline void +basl_le_enc(void *pp, uint64_t val, size_t len) +{ + char buf[8]; + + assert(len <= 8); + + le64enc(buf, val); + memcpy(pp, buf, len); +} + static int basl_dump_table(const struct basl_table *const table, const bool mem) { @@ -145,6 +156,18 @@ basl_table_append_bytes(struct basl_table *const table, const void *const bytes, return (0); } +int +basl_table_append_int(struct basl_table *const table, const uint64_t val, + const uint8_t size) +{ + char buf[8]; + + assert(size <= sizeof(val)); + + basl_le_enc(buf, val, size); + return (basl_table_append_bytes(table, buf, size)); +} + int basl_table_create(struct basl_table **const table, struct vmctx *ctx, const uint8_t *const name, const uint32_t alignment, diff --git a/usr.sbin/bhyve/basl.h b/usr.sbin/bhyve/basl.h index f6809a473ff4..3ce33dea63e0 100644 --- a/usr.sbin/bhyve/basl.h +++ b/usr.sbin/bhyve/basl.h @@ -32,5 +32,6 @@ int basl_finish(void); int basl_init(void); int basl_table_append_bytes(struct basl_table *table, const void *bytes, uint32_t len); +int basl_table_append_int(struct basl_table *table, uint64_t val, uint8_t size); int basl_table_create(struct basl_table **table, struct vmctx *ctx, const uint8_t *name, uint32_t alignment, uint32_t off);