From nobody Wed May 13 12:40:02 2026 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 4gFtMl1tW8z6dLDh for ; Wed, 13 May 2026 12:40:03 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gFtMk6SKxz3w8P for ; Wed, 13 May 2026 12:40:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778676002; 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=LgbIJQeJu5dxRlkzQ1aRS7fhRLhmesH56SK5oXQ3Fc0=; b=LcrmVpPaBBAtUwilcDNB8CNPSFCL/aUS02+yIl9/qChII7bXkw6gPIzCK2dSG3D0V3cXgq 3EWeFL+57BNB7Fgg7xmhwhYlAVcWe3hVqQMJNT+ErE97+0R5rvViiqkOUqPYqVaeEH3d6I g1I40EVsBQGMsOsebDVkSisaBl9XkbiR2RIoSRvmAuHbDObiv9AXHS6yteKovbWVxYvSLy AhzfUlPO7JuEsuFr16pU29dl6ZUBWSkU9ZVLuSLaN0WhG7qh2T2UeqT1aR509OWMh0pHWs batSItEqV0exIYGN8riJL8iqAAPqJ1TF0nAHL4dqC1Z70MoXbNl7tHd9jDmpGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778676002; a=rsa-sha256; cv=none; b=P/YkdTbOwHZ12DcJDvKkXyqW6oQicYbQIrUQvpjZbengQjuWmTONgXaAvtLOvPtGvWoYD6 M66hwi7iPnpD4l5r+wQLccvOkNERasiOxjppB4C7UoHlWmLZbOsUQ/iT3kmHBuFVYpwLbb KKtW+i/Olv7rMvUAfTXSUVZh22Zr7B8BHo5MJzVRk4FYcAJ/g81SkLnpdKO0YKXdOIis7v YlYY+o7AoueATEfo2W22P9nx8j+V6lMs/Ho+kDHu0ViSsCflxSbnldXzRLrZ3ZMOC0rmnC BEghk0x3mBfvTGNLCulPxeDCFVakxuJr504laagG9RVIBqJjvblqBeIYCG+qbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778676002; 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=LgbIJQeJu5dxRlkzQ1aRS7fhRLhmesH56SK5oXQ3Fc0=; b=mZB+gQuCt3sWV53YXcfhRV5dk8/l1wphbLrBe6G6Kj/GoT6Qf0N2IK7LnPIIA4+i22U0E6 dgQUE2vQ38MgXce2xRLfjiRkGunENxcgSy+GSV3h6YrXTYFHpfNqt1CjiZriQ+Q7PYcUUv oz5DTtxmCJjE6JhBy20D6NVGXsyGStlx8daFCzeeb3cGg7r711KJGKV+NDGoIM01k2Yu9O M7WHSLSlLzJE1/2hQLmtB6DUrhwaFz0nm0fldGbgxx4WujKHN9cdSoW21VMB8VYZV/QJeK mmZjFsmbHhsfMS/m9nMNoFgkt0nPItLyEok2O5TBWGfW5SODkFaMTK0WAOnh7g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gFtMk5XLWzr9b for ; Wed, 13 May 2026 12:40:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 19769 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 13 May 2026 12:40:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: ba4f05b55fb4 - main - acpi_spmc(4): Factor out testing for present DSMs/functions 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba4f05b55fb4b006f1bbe26d3ad3527f48e85939 Auto-Submitted: auto-generated Date: Wed, 13 May 2026 12:40:02 +0000 Message-Id: <6a047122.19769.3dee4ae6@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=ba4f05b55fb4b006f1bbe26d3ad3527f48e85939 commit ba4f05b55fb4b006f1bbe26d3ad3527f48e85939 Author: Olivier Certner AuthorDate: 2026-05-06 09:31:19 +0000 Commit: Olivier Certner CommitDate: 2026-05-13 12:38:25 +0000 acpi_spmc(4): Factor out testing for present DSMs/functions Since we are now keeping in the softc the information about which DSM functions are available (in supported_functions[]), the 'dsms' field there is somewhat redundant. Make it completely redundant by keeping the bit representing the enumeration function itself in each element of supported_functions[], and then remove the field. As a result, convert has_dsm() to rely on supports_function(). Adapt acpi_spmc_dsm_check_functions() so that it does not take into account the enumeration function bit. While here, use the self-explanatory stance IDX_TO_BIT(DSM_ENUM_FUNCTIONS) instead of a hardcoded 1. Reviewed by: obiwac Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56878 --- sys/dev/acpica/acpi_spmc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c index b2da99864581..da9c80266952 100644 --- a/sys/dev/acpica/acpi_spmc.c +++ b/sys/dev/acpica/acpi_spmc.c @@ -223,7 +223,6 @@ struct acpi_spmc_constraint { struct acpi_spmc_softc { device_t dev; ACPI_HANDLE handle; - int dsms; uint64_t supported_functions[nitems(dsms)]; struct eventhandler_entry *eh_suspend; @@ -257,7 +256,7 @@ supports_function(const struct acpi_spmc_softc *const sc, const int dsm_index, static bool has_dsm(const struct acpi_spmc_softc *const sc, const int dsm_index) { - return ((sc->dsms & IDX_TO_BIT(dsm_index)) != 0); + return (supports_function(sc, dsm_index, DSM_ENUM_FUNCTIONS)); } typedef const char *pbf_get_name_t(const int, const void *const); @@ -371,6 +370,7 @@ acpi_spmc_attach(device_t dev) { struct acpi_spmc_softc *const sc = device_get_softc(dev); const ACPI_HANDLE handle = acpi_get_handle(dev); + int supported_dsms; char buf[32]; int error; @@ -382,6 +382,7 @@ acpi_spmc_attach(device_t dev) sc->dev = dev; sc->handle = handle; + supported_dsms = 0; for (int i = 0; i < nitems(dsms); ++i) { KASSERT(dsms[i] != NULL, ("%s: Sparse dsms[]!", __func__)); KASSERT(dsms[i]->index == i, @@ -389,14 +390,17 @@ acpi_spmc_attach(device_t dev) dsms[i]->name)); acpi_spmc_probe_dsm(sc, dsms[i]); + if (has_dsm(sc, i)) + supported_dsms |= IDX_TO_BIT(i); } - if (sc->dsms == 0) { + if (supported_dsms == 0) { device_printf(dev, "No DSM supported!"); return (ENXIO); } - print_bit_field(buf, sizeof(buf), sc->dsms, "DSM", pbf_dsm_name, NULL); + print_bit_field(buf, sizeof(buf), supported_dsms, "DSM", + pbf_dsm_name, NULL); device_printf(dev, "DSMs supported: %s\n", buf); /* Print supported functions of usable DSMs. */ @@ -436,7 +440,12 @@ static void acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc, const struct dsm_desc *const dsm) { - const uint64_t supported_functions = + /* + * Remove the enumeration function bit, which we do not care about when + * printing which functions are supported and which we do not want to + * report as unknown. + */ + const uint64_t supported_functions = ~IDX_TO_BIT(DSM_ENUM_FUNCTIONS) & sc->supported_functions[dsm->index]; const uint64_t missing = dsm->expected_functions & ~supported_functions; const uint64_t unknown = supported_functions & @@ -475,10 +484,9 @@ acpi_spmc_probe_dsm(struct acpi_spmc_softc *const sc, /* * DSM is supported if bit 0 is set. */ - if ((supported_functions & 1) == 0) + if ((supported_functions & IDX_TO_BIT(DSM_ENUM_FUNCTIONS)) == 0) return; - sc->supported_functions[dsm->index] = supported_functions & ~1; - sc->dsms |= IDX_TO_BIT(dsm->index); + sc->supported_functions[dsm->index] = supported_functions; } static void