From owner-freebsd-acpi@FreeBSD.ORG Sat Nov 1 00:20:05 2008 Return-Path: Delivered-To: freebsd-acpi@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DF131065690 for ; Sat, 1 Nov 2008 00:20:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8C4028FC1C for ; Sat, 1 Nov 2008 00:20:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mA10K5O3065655 for ; Sat, 1 Nov 2008 00:20:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mA10K5Lc065654; Sat, 1 Nov 2008 00:20:05 GMT (envelope-from gnats) Date: Sat, 1 Nov 2008 00:20:05 GMT Message-Id: <200811010020.mA10K5Lc065654@freefall.freebsd.org> To: freebsd-acpi@FreeBSD.org From: Jung-uk Kim Cc: Subject: Re: kern/121504: [patch] Correctly set hw.acpi.osname on certain machines X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jung-uk Kim List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2008 00:20:05 -0000 The following reply was made to PR kern/121504; it has been noted by GNATS. From: Jung-uk Kim To: "Anish Mistry" Cc: bug-followup@FreeBSD.org, John Baldwin Subject: Re: kern/121504: [patch] Correctly set hw.acpi.osname on certain machines Date: Fri, 31 Oct 2008 20:09:50 -0400 --Boundary-00=_Q55CJS/aKGjigvh Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline If you are still feeling adventurous, please try the attached patch. Note that _OSI is very different from _OS_ and we cannot reuse "hw.acpi.osname" tunable here. First of all, _OSI method must be able to match multiple entries, not just predefined OS strings, e.g., "3.0 Thermal Model", "Extended Address Space Descriptor", etc. although nobody really uses these 'feature group strings' for their BIOS implementations. (Ideally, if there is a device driver which implemented the feature, the driver is responsible for registering its capabilities to this table.) With the attached patch, you can add multiple entries by setting "hw.acpi.supported_osi" tunable and they must be comma-separated, e.g.: hw.acpi.supported_osi="Windows 2006, Processor Device" You can even try something like this: hw.acpi.supported_osi="FreeBSD,Linux,Windows 2001,Windows 2006" It means the OS supports all of the above OS interfaces (but we don't). Well, it is not impossible, at least in theory. :-) Warning #1: It may affect your system badly if the BIOS implements OS-specific "workarounds" or "features" for You-Know-Who. ;-) Warning #2: Even if your DSDT contains _OSI("FreeBSD"), it does not mean that you can set hw.acpi.supported_osi="FreeBSD" and expect an improvement. Most likely the code path is never tested and it may even cause regression. See http://ubuntuforums.org/showthread.php?t=869249 for the latest Linux episode. With the exact same reason, I am not setting any default value here. Cheers, Jung-uk Kim --Boundary-00=_Q55CJS/aKGjigvh Content-Type: text/plain; charset="iso-8859-1"; name="OsdMemory.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="OsdMemory.patch" --- sys/dev/acpica/Osd/OsdMemory.c 22 Mar 2007 18:16:41 -0000 1.15 +++ sys/dev/acpica/Osd/OsdMemory.c 31 Oct 2008 22:52:58 -0000 @@ -40,6 +40,9 @@ #include #include +static char acpi_osi[128]; +TUNABLE_STR("hw.acpi.supported_osi", acpi_osi, sizeof(acpi_osi)); + MALLOC_DEFINE(M_ACPICA, "acpica", "ACPI CA memory pool"); void * @@ -77,6 +80,29 @@ ACPI_STATUS AcpiOsValidateInterface (char *Interface) { + size_t len; + char *cp; + + if (Interface == NULL || *Interface == '\0') + return (AE_BAD_PARAMETER); + + if (*acpi_osi != '\0') { + cp = acpi_osi; + len = strlen(Interface); + for (;;) { + if (strlen(cp) < len || (cp = strstr(cp, Interface)) == NULL) + break; + cp += len; + if (*cp == '\0' || *cp == ',') { + if (bootverbose) + printf("ACPI: _OSI(\"%s\") matched\n", Interface); + return (AE_OK); + } + while (*cp != '\0' && *cp != ',') + cp++; + } + } + return (AE_SUPPORT); } --Boundary-00=_Q55CJS/aKGjigvh--