From nobody Fri Apr 28 10:40:19 2023 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 4Q78JM64KLz48Jn6; Fri, 28 Apr 2023 10:40:19 +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 4Q78JM58qWz3Gx3; Fri, 28 Apr 2023 10:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682678419; 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=cVEbkyueP7AfoE3ouVDYLFEugOfZ3MSWwPQRwinedCw=; b=bgbToXutWQORVDaeouqU6ZBQWoRs93hL7ZEdkXZ2GP+FU9srcsSGtppv1WQ4T3CAVchY0c WlS6MPJ79DZxXV33YuXYisOYukjTJVVsXMMA2VkDNCtdRBwwpiL7y89uRwDCwJCVSbOvB2 Cs0V47K1zzEexEGEIIMZEAjQeUdYhzvk3N1/RSSgFYDS3r57u+fbuXas3I4hB5kvjfn7kY wOT7Y1qU7MmSTIxhl1LeauMzKW1zWi/oKad4S0yi+SnBXuJ3HdKKxAg71LNudKA7WKY3ib dUiPAYJ9aJQ+rG9bWlWdSZq+3hVvVQvLujqP+yTn53tP/6WK65BMWgFxcLnKSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682678419; 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=cVEbkyueP7AfoE3ouVDYLFEugOfZ3MSWwPQRwinedCw=; b=d8yYTutNNa+4u+FhPHm4e2286dhMoLwMqz6NfMHAHIshl/NEymScYuodzH85tT+l0kP8UY FpILfEAGPYhuuRpVqSSDRhVIxILwe6NI0Bwah9tyQtVKF+ikcMakVP4OZVz57kN9dPR54s Onsa2Lr1q1oRDkBkqQM7L9zFkby70qu8lRj4qyp1gNAzKXRspH3bI2z7BHDIyJ0pnpt4Zz 5IvVtVZNpYBE32ZjUirhK6q1dwN5ueGbzwpcW+Ed3DPnId/49ptIKJ6lKn2cQU1HIYjiyK sMrFYmDG6/p+4LXyyq6oSzWebta5YYichk188Y8TNBMAPmrSVhGOm05AfBzI+Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682678419; a=rsa-sha256; cv=none; b=f2HZN++NWqcZ4jYmQ3Dg7KAWoQZbPthjnopJiqNnsrXz86Io+iedQ2p8JVP9bTl2XcmKOf R7RFjHJPeTg6G+/dqkskOYTs7t/uL4qlWmSnrOBkELnQQcR+ZAgrPb0snR+Dt6Gtwq/pSQ 2cZlkiNdX/yAVNvoF2ggV9lHP4CItPdGsyJ38LMEf18Dwv68TxMiBkgekMupmUwnLtNxFP O5bglLUptdPKSVMd4ErQR8S1ZuPn+QbXAoU9u48wkdMg3tjWj9uSwtjFdVH1CNaktk//pV a+4Iu8UWVFr9GvX3MxsE3l8xQ7HB9h/vJGj78fo4cWzZV5oZNMDbO0JzYZ2D9g== 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 4Q78JM4G2JzwgT; Fri, 28 Apr 2023 10:40:19 +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 33SAeJh7092535; Fri, 28 Apr 2023 10:40:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33SAeJ9Q092534; Fri, 28 Apr 2023 10:40:19 GMT (envelope-from git) Date: Fri, 28 Apr 2023 10:40:19 GMT Message-Id: <202304281040.33SAeJ9Q092534@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: fbf9519ab923 - stable/13 - bhyve: check for errors when writing device specific DSDT entries 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: fbf9519ab923313c25ddb766bd0f5d936a3488b2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=fbf9519ab923313c25ddb766bd0f5d936a3488b2 commit fbf9519ab923313c25ddb766bd0f5d936a3488b2 Author: Corvin Köhne AuthorDate: 2023-04-05 06:45:22 +0000 Commit: Corvin Köhne CommitDate: 2023-04-28 07:28:33 +0000 bhyve: check for errors when writing device specific DSDT entries At the moment, this function can't fail. This behaviour will change in the future. In preparation to that, convert the return type to int in order to be able to check for errors. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D39422 (cherry picked from commit ab34ea4711b1001c416dc286380e54c118ff0c49) --- usr.sbin/bhyve/acpi.c | 2 +- usr.sbin/bhyve/acpi_device.c | 15 +++++++++------ usr.sbin/bhyve/acpi_device.h | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c index 2346df5fd314..457575e395d8 100644 --- a/usr.sbin/bhyve/acpi.c +++ b/usr.sbin/bhyve/acpi.c @@ -245,7 +245,7 @@ basl_fwrite_dsdt(FILE *fp) const struct acpi_device_list_entry *entry; SLIST_FOREACH(entry, &acpi_devices, chain) { - acpi_device_write_dsdt(entry->dev); + BASL_EXEC(acpi_device_write_dsdt(entry->dev)); } dsdt_line("}"); diff --git a/usr.sbin/bhyve/acpi_device.c b/usr.sbin/bhyve/acpi_device.c index b183da3055b1..dffb73ba9023 100644 --- a/usr.sbin/bhyve/acpi_device.c +++ b/usr.sbin/bhyve/acpi_device.c @@ -17,6 +17,7 @@ #include "acpi.h" #include "acpi_device.h" +#include "basl.h" /** * List entry to enumerate all resources used by an ACPI device. @@ -148,7 +149,7 @@ acpi_device_build_table(const struct acpi_device *const dev) return (0); } -static void +static int acpi_device_write_dsdt_crs(const struct acpi_device *const dev) { const struct acpi_resource_list_entry *res; @@ -167,14 +168,14 @@ acpi_device_write_dsdt_crs(const struct acpi_device *const dev) break; } } + + return (0); } -void +int acpi_device_write_dsdt(const struct acpi_device *const dev) { - if (dev == NULL) { - return; - } + assert(dev != NULL); dsdt_line(""); dsdt_line(" Scope (\\_SB)"); @@ -186,9 +187,11 @@ acpi_device_write_dsdt(const struct acpi_device *const dev) dsdt_line(" Name (_CRS, ResourceTemplate ()"); dsdt_line(" {"); dsdt_indent(4); - acpi_device_write_dsdt_crs(dev); + BASL_EXEC(acpi_device_write_dsdt_crs(dev)); dsdt_unindent(4); dsdt_line(" })"); dsdt_line(" }"); dsdt_line(" }"); + + return (0); } diff --git a/usr.sbin/bhyve/acpi_device.h b/usr.sbin/bhyve/acpi_device.h index 0306f19f47f0..de72ce1e5370 100644 --- a/usr.sbin/bhyve/acpi_device.h +++ b/usr.sbin/bhyve/acpi_device.h @@ -50,4 +50,4 @@ int acpi_device_add_res_fixed_memory32(struct acpi_device *dev, UINT8 write_protected, UINT32 address, UINT32 length); int acpi_device_build_table(const struct acpi_device *dev); -void acpi_device_write_dsdt(const struct acpi_device *dev); +int acpi_device_write_dsdt(const struct acpi_device *dev);