From nobody Wed Apr 12 07:04:17 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 4PxDGV1cYZz45QNS; Wed, 12 Apr 2023 07:04:18 +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 4PxDGT4Hpxz3nQf; Wed, 12 Apr 2023 07:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681283057; 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=iSOj0WK16YEyxx1bV6YkuI5Ndg4jZZOztZbI5t20HUA=; b=D2MdBxRUc+19aTb8gAUBuuLiB2/hB44fJpLHVMD+QNrBcmLgZBMtNhWWo2hqoYyb2bFasW k3IovwYVDqSr2CV3zdxcr23V+7TIElks5XOmZlkKvuS6DUmW7Z7t7Btakq6M+HLlqJVz8d My/xIgFKGiZh/BYoP63uydNsH3cCKLDVGrhso44NMUUHyIa31jk4/AJZPusDmQmauLLFzg LFCWqMg0pXJb2aIWXQNgkvJaAI7T+oT1JocHfxxrXnRFxN4cNdEC4X9Vqvzx8fcWwmd5Gw 01pt1NZB9u1BEKl8nrcB+lEmJ6PlyI/FqAHddpZQG82CPt1V4f81/l+UqZk4bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681283057; 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=iSOj0WK16YEyxx1bV6YkuI5Ndg4jZZOztZbI5t20HUA=; b=mIVpO0UAQDXST5M96AXcbvCjmJCTq4NsaDrCJZDysUC2F09nzaqeXLvkiNEchF7htept8o 7Rl2UF/sq0pmOWpUTV1f4R4khxOpG5Q1LeCCsUr6OhfVaSIMAAhZA284kbuzEsctb+eiBD 1pPJ7i9r+6NEh4obba8+GDVFkrKd87CY2LGlpU19aLJZkSaW4n8rHGILaEcfWnvvP1MAyt MosAPPMNIIUvJ4hdieYAc3g1XTB7334lK7554pzX8WJ+UI4FDHAXinYoFGsDbCdD74tR1S 5YJ7UyfApXpzoN9/Yqd2cZDKvKgxMXq07OyAAUZGVpPV+ME2uxJrC3IX2pLv3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681283057; a=rsa-sha256; cv=none; b=pMhjY4VPumwW+Fg0LENMDqZXpYeCoklRQY4psI/60MKoQyG+iV3Yq9OTC5KKAwu4bSuKpp 8Hd4KCSBOCN/wZFu8QT8TEveYFg5GIa2VcNR1rIZwKXokMBTFK5OispICr1QF4Tef/gQDN GnXFgriXF50vs9nauqXt4SmXbuySBTZewrt4/vmrqVBozd3RcDKKEwvbkcjdoj2GbgNlpS Y3xUeXqoJ5L0hHDgIeprri2Su3OXXTItthCaNvl8H5QUlVGTGnORr6XXW2Qvsf5cuML2r0 U3K9i+PsFw2fzveXNtq9iBGjrJDSjY1TyxE8tcvoiocBjeE6xBcJJJ5z7hmNAQ== 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 4PxDGT30xVzqql; Wed, 12 Apr 2023 07:04:17 +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 33C74HHh062578; Wed, 12 Apr 2023 07:04:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33C74HLM062577; Wed, 12 Apr 2023 07:04:17 GMT (envelope-from git) Date: Wed, 12 Apr 2023 07:04:17 GMT Message-Id: <202304120704.33C74HLM062577@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: ab34ea4711b1 - main - 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/main X-Git-Reftype: branch X-Git-Commit: ab34ea4711b1001c416dc286380e54c118ff0c49 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=ab34ea4711b1001c416dc286380e54c118ff0c49 commit ab34ea4711b1001c416dc286380e54c118ff0c49 Author: Corvin Köhne AuthorDate: 2023-04-05 06:45:22 +0000 Commit: Corvin Köhne CommitDate: 2023-04-12 06:33:29 +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 --- 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 614aa8b476b1..232dc0b2d501 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);