Date: Tue, 3 Feb 2026 07:33:48 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Adrian Chadd <adrian@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Abdelkader Boudih <freebsd@seuros.com> Subject: Re: git: 052a791b0055 - main - acpi: add Darwin OSI quirk for Apple Mac hardware Message-ID: <aYGIvC3v0zQCJrGo@kib.kiev.ua> In-Reply-To: <698154c0.35e9d.2d7b8775@gitrepo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
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 <freebsd@seuros.com> > AuthorDate: 2026-02-03 01:43:00 +0000 > Commit: Adrian Chadd <adrian@FreeBSD.org> > 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 inthome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aYGIvC3v0zQCJrGo>
