From nobody Tue Feb 3 05:33:48 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 4f4sbt4wBJz6RCjv; Tue, 03 Feb 2026 05:34:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4f4sbt12B7z3ZZt; Tue, 03 Feb 2026 05:34:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 6135XmgV002957; Tue, 3 Feb 2026 07:33:51 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 6135XmgV002957 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 6135XmkG002955; Tue, 3 Feb 2026 07:33:48 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 3 Feb 2026 07:33:48 +0200 From: Konstantin Belousov To: Adrian Chadd Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Abdelkader Boudih Subject: Re: git: 052a791b0055 - main - acpi: add Darwin OSI quirk for Apple Mac hardware Message-ID: References: <698154c0.35e9d.2d7b8775@gitrepo.freebsd.org> 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 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <698154c0.35e9d.2d7b8775@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Queue-Id: 4f4sbt12B7z3ZZt X-Spamd-Bar: ---- On Tue, Feb 03, 2026 at 01:52:00AM +0000, Adrian Chadd wrote: > The branch main has been updated by adrian: > > URL: https://cgit.FreeBSD.org/src/commit/?id=052a791b00555805f19ccc38a04d42d48b54104b > > commit 052a791b00555805f19ccc38a04d42d48b54104b > Author: Abdelkader Boudih > AuthorDate: 2026-02-03 01:43:00 +0000 > Commit: Adrian Chadd > CommitDate: 2026-02-03 01:51:37 +0000 > > acpi: add Darwin OSI quirk for Apple Mac hardware > > Mac firmware hides the Intel integrated GPU (iGPU) on dual GPU x86 > systems, i.e., with AMD/NVIDIA dGPUs, when the Darwin OSI is not > installed via ACPI. > > Prior to this change, FreeBSD always used the dGPU. This is fine in > practice, but consumed more power than when the iGPU is used, > resulting in reduced battery life. > > Linux handles this in `drivers/acpi/osi.c` by detecting Apple > hardware via DMI, disabling all Windows OSI strings, and > by explicitly installing the Darwin OSI ACPI handler. This change > applies equivalent logic to the acpi(4) driver on FreeBSD. > > This feature can be enabled/disabled using the > `hw.acpi.apple_darwin_osi` tunable. Setting this tunable to `0` > restores the previous behavior by explicitly disabling the added > support. > > Reviewed by: obiwac, ngie, adrian > Differential Revision: https://reviews.freebsd.org/D54762 > --- > sys/dev/acpica/acpi.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > > diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c > index 60a2dba91b05..8cdb73333462 100644 > --- a/sys/dev/acpica/acpi.c > +++ b/sys/dev/acpica/acpi.c > @@ -293,6 +293,17 @@ static char acpi_remove_interface[256]; > TUNABLE_STR("hw.acpi.remove_interface", acpi_remove_interface, > sizeof(acpi_remove_interface)); > > +/* > + * Automatically apply the Darwin OSI on Apple Mac hardware to obtain > + * access to full ACPI hardware support on supported platforms. > + * > + * This flag automatically overrides any values set by > + * `hw.acpi.acpi_install_interface` and unset by > + * `hw.acpi.acpi_remove_interface`. > + */ > +static int acpi_apple_darwin_osi = 1; > +TUNABLE_INT("hw.acpi.apple_darwin_osi", &acpi_apple_darwin_osi); > + > /* Allow users to dump Debug objects without ACPI debugger. */ > static int acpi_debug_objects; > TUNABLE_INT("debug.acpi.enable_debug_objects", &acpi_debug_objects); > @@ -4903,6 +4914,67 @@ acpi_reset_interfaces(device_t dev) > } > acpi_free_interfaces(&list); > } > + > + /* > + * Apple Mac hardware quirk: install Darwin OSI. > + * > + * On Apple hardware, install the Darwin OSI and remove the Windows OSI > + * to match Linux behavior. > + * > + * This is required for dual-GPU MacBook Pro systems > + * (Intel iGPU + AMD/NVIDIA dGPU) where the iGPU is hidden when the > + * firmware doesn't see Darwin OSI, but it also unlocks additional ACPI > + * support on non-MacBook Pro Apple platforms. > + * > + * Apple's ACPI firmware checks _OSI("Darwin") and sets OSYS=10000 > + * for macOS. Many device methods use OSDW() which checks OSYS==10000 > + * for macOS-specific behavior including GPU visibility and power > + * management. > + * > + * Linux enables Darwin OSI by default on Apple hardware and disables > + * all Windows OSI strings (drivers/acpi/osi.c). Users can override > + * this behavior with acpi_osi=!Darwin to get Windows-like behavior, > + * in general, but this logic makes that process unnecessary. > + * > + * Detect Apple via SMBIOS and enable Darwin while disabling Windows > + * vendor strings. This makes both GPUs visible on dual-GPU MacBook Pro > + * systems (Intel iGPU + AMD dGPU) and unlocks full platform > + * ACPI support. > + */ > + if (acpi_apple_darwin_osi) { > + char *vendor = kern_getenv("smbios.system.maker"); > + if (vendor != NULL) { > + if (strcmp(vendor, "Apple Inc.") == 0 || > + strcmp(vendor, "Apple Computer, Inc.") == 0) { > + /* Disable all other OSI vendor strings. */ > + status = AcpiUpdateInterfaces( > + ACPI_DISABLE_ALL_VENDOR_STRINGS); > + /* Install Darwin */ > + if (ACPI_SUCCESS(status)) { > + status = AcpiInstallInterface("Darwin"); > + } > + if (bootverbose) { > + if (ACPI_SUCCESS(status)) { > + device_printf(dev, > + "Apple hardware: installed Darwin " > + "OSI and removed other vendor OSI " > + "(Windows, etc)\n"); Why this verbosity is needed? I see no benefit from it, other then consuming kernel memory. > + } else { > + device_printf(dev, > + "Apple hardware: failed to install " > + "Darwin OSI: %s\n", > + AcpiFormatException( > + status)); > + } > + } > + } else if (bootverbose) { > + device_printf(dev, > + "Not installing Darwin OSI on unsupported platform: %s\n", > + vendor); > + } > + freeenv(vendor); > + } > + } > } > > static int