From nobody Wed May 13 12:39:57 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 4gFtMd4gVHz6dLPJ for ; Wed, 13 May 2026 12:39:57 +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 4gFtMd3WTXz3w2h for ; Wed, 13 May 2026 12:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778675997; 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=fHV8ETbufWdOHS7LbbCeNVmSNPoIYovMkYDZNUWUCyg=; b=n141Y9fsuGWoVrQvkYLoo5OPp3fd0ncFfeUpv7u6EwJKWJQrBEaS1ODxLCYd+h5m/YfDUT SmcvP6gb1uwgPvkvh2zg2qvj6/2PToc1JtPeKkWwaLyTIFZfvbYkdrABcNcB2SV91rhDwP MvpM6RbwKUQgFdSOyWSf46ukV5LLObAbTa6Qf5Tyd/EXns1xHPLMPi+D7Qcuka+oPqVCOB 9o+1mnif5VTByzKWnV14MiEeiS7/xI+1phjP5OBU4RkkVWjLvYGnzJOb/JGm1GTS+7Db6R 5F7+rT/Pgg57ZZOlIoglYxSI3tUQHPZy6MrwyeGOA3/CFULOw9YTu3Q+heQfhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778675997; a=rsa-sha256; cv=none; b=r3zJA+XQJzK628vR8olQhupI7iWWTg2/J42vf7Rqsp5NT2wkPqzaGT88f4bhnZGS7EKNh9 2Kz5Q/mbEX0IAymz8RK1r3Ndarnz9L36SRQ+37/bcWB8YYFMHhC1JNqEbjbuajUWtXRjKU 1YfbZzWgpnL7MH/GG+QSNXfBFjMQ6kjEwZxpt+dmYTvJAeLy1CDYiSOCGyuuChgcJcpC3e aPlqwAGCtlNah3a9F4Cz6vjlbMokqtMmczaL2xnJ1USKL4aSBYJa7hLj0NhYMFTDB1ilyU U64NU6xDC3Lu5Hua1WOxGELQc3jo0hzSq1/omEpWlAFKdv6mc020Pzq877tbBA== 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=1778675997; 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=fHV8ETbufWdOHS7LbbCeNVmSNPoIYovMkYDZNUWUCyg=; b=uPPw3uXODBsxrvGmhMDBNC8FJ6JVu0SXjqzTqnQEEr8GQAkcbRz8sdYzN95sj6HSo8bH27 bD4FmwkrPeH0AUdNi1A05SRgoM6tHd0i79vqDsHfSrmR+g8C67ou6tQiNgkNN/TnTaozjH BP8zxJ0RxWPoNTWtpZyyh8AmfmzhV6WELU22xkM8vWz6chSEwb3VAGVYqCAKAoZ0yrAwUW 0jmte79xJ/GtaVVNN+2K0txstDGof34WhUJNI2XV3su9+TNj/vadnHjDMLhnqSJbclnzq0 iHfk2JAnjWN3lbSwn9urNLwEASPIaPSMjYeEbRScuvRhtvRAQWWU9KmBlLL/Yg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gFtMd37FdzqyS for ; Wed, 13 May 2026 12:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1bd0a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 13 May 2026 12:39:57 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 310cbb8924fa - main - acpi_spmc(4): Enable multiple instances 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: 310cbb8924fa8f0ace9c5f555cf74b7c1e4396a2 Auto-Submitted: auto-generated Date: Wed, 13 May 2026 12:39:57 +0000 Message-Id: <6a04711d.1bd0a.2145462d@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=310cbb8924fa8f0ace9c5f555cf74b7c1e4396a2 commit 310cbb8924fa8f0ace9c5f555cf74b7c1e4396a2 Author: Olivier Certner AuthorDate: 2026-05-04 20:19:40 +0000 Commit: Olivier Certner CommitDate: 2026-05-13 12:38:23 +0000 acpi_spmc(4): Enable multiple instances Support the (so far hypothetical) case of a machine with multiple instances of the PNP0D80 device (e.g., if multiple DSMs are not implemented on the same device), by allowing multiple instances of the device to co-exist. This is achieved by moving 'supported_functions' from 'struct dsm' into the softc, so each instance has its own view of which functions are supported. Consequently, the check on the instance unit on probe can be removed. Reviewed by: imp (older version), obiwac Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56817 --- sys/dev/acpica/acpi_spmc.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c index 751b4c8f0641..b12723a14bee 100644 --- a/sys/dev/acpica/acpi_spmc.c +++ b/sys/dev/acpica/acpi_spmc.c @@ -74,7 +74,6 @@ struct dsm_desc { */ int revision; struct uuid uuid; - uint64_t supported_functions; uint64_t expected_functions; uint64_t extra_functions; /* Human-friendly names of known functions. */ @@ -129,7 +128,7 @@ static const char *const dsm_ms_function_names[] = { [DSM_MS_TURN_ON_DISPLAY] = "TURN_ON", }; -static struct dsm_desc dsm_ms = { +static const struct dsm_desc dsm_ms = { .index = DSM_MS, .name = "Microsoft", .uuid = { /* 11e00d56-ce64-47ce-837b-1f898f9aa461 */ @@ -185,7 +184,7 @@ static struct dsm_desc dsm_amd = { .function_names_nb = nitems(dsm_amd_function_names), }; -static struct dsm_desc *const dsms[] = { +static const struct dsm_desc *const dsms[] = { [DSM_INTEL] = &dsm_intel, [DSM_MS] = &dsm_ms, [DSM_AMD] = &dsm_amd, @@ -219,6 +218,7 @@ struct acpi_spmc_softc { device_t dev; ACPI_HANDLE handle; int dsms; + uint64_t supported_functions[nitems(dsms)]; struct eventhandler_entry *eh_suspend; struct eventhandler_entry *eh_resume; @@ -239,9 +239,13 @@ resolve_dsm(int dsm_index) } static bool -supports_function(const struct dsm_desc *const dsm, const int function_index) +supports_function(const struct acpi_spmc_softc *const sc, const int dsm_index, + const int function_index) { - return ((dsm->supported_functions & IDX_TO_BIT(function_index)) != 0); + MPASS(0 <= dsm_index && dsm_index < nitems(sc->supported_functions)); + + return ((sc->supported_functions[dsm_index] & + IDX_TO_BIT(function_index)) != 0); } static bool @@ -329,7 +333,7 @@ failed_to_call_dsm(const struct acpi_spmc_softc *const sc, } static void acpi_spmc_probe_dsm(struct acpi_spmc_softc *sc, - ACPI_HANDLE handle, struct dsm_desc *const dsm); + ACPI_HANDLE handle, const struct dsm_desc *const dsm); static void acpi_spmc_dsm_print_functions( const struct acpi_spmc_softc *const sc, const struct dsm_desc *const dsm); @@ -351,11 +355,6 @@ acpi_spmc_probe(device_t dev) if (ACPI_ID_PROBE(device_get_parent(dev), dev, spmc_ids, &name) > 0) return (ENXIO); - if (device_get_unit(dev) > 0) { - device_printf(dev, "shouldn't have more than one SPMC"); - return (ENXIO); - } - device_set_desc(dev, "System Power Management Controller"); return (BUS_PROBE_DEFAULT); @@ -431,16 +430,17 @@ static void acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc, const struct dsm_desc *const dsm) { - const uint64_t missing = dsm->expected_functions & - ~dsm->supported_functions; - const uint64_t unknown = dsm->supported_functions & + const uint64_t supported_functions = + sc->supported_functions[dsm->index]; + const uint64_t missing = dsm->expected_functions & ~supported_functions; + const uint64_t unknown = supported_functions & ~(dsm->expected_functions | dsm->extra_functions); char buf[128]; - print_bit_field(buf, sizeof(buf), dsm->supported_functions, + print_bit_field(buf, sizeof(buf), supported_functions, "FUNC", pbf_function_name, dsm); device_printf(sc->dev, "DSM %s: Supported functions: %#" PRIx64 "%s\n", - dsm->name, dsm->supported_functions, buf); + dsm->name, supported_functions, buf); if (missing != 0) { print_bit_field(buf, sizeof(buf), missing, "FUNC", @@ -461,17 +461,17 @@ acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc, static void acpi_spmc_probe_dsm(struct acpi_spmc_softc *sc, ACPI_HANDLE handle, - struct dsm_desc *const dsm) + const struct dsm_desc *const dsm) { const uint64_t supported_functions = acpi_DSMQuery(handle, - (uint8_t *)&dsm->uuid, dsm->revision); + (const uint8_t *)&dsm->uuid, dsm->revision); /* * DSM is supported if bit 0 is set. */ if ((supported_functions & 1) == 0) return; - dsm->supported_functions = supported_functions & ~1; + sc->supported_functions[dsm->index] = supported_functions & ~1; sc->dsms |= IDX_TO_BIT(dsm->index); } @@ -798,7 +798,7 @@ acpi_spmc_exit_notif(device_t dev) acpi_spmc_run_dsm(dev, &dsm_amd, DSM_AMD_LPI_EXIT_NOTIF); if (has_dsm(sc, DSM_MS)) { acpi_spmc_run_dsm(dev, &dsm_ms, DSM_INTEL_MS_LPI_EXIT_NOTIF); - if (supports_function(&dsm_ms, DSM_MS_TURN_ON_DISPLAY)) + if (supports_function(sc, DSM_MS, DSM_MS_TURN_ON_DISPLAY)) acpi_spmc_run_dsm(dev, &dsm_ms, DSM_MS_TURN_ON_DISPLAY); acpi_spmc_run_dsm(dev, &dsm_ms, DSM_MS_SLEEP_EXIT_NOTIF);