Date: Sat, 1 Nov 2008 00:20:05 GMT From: Jung-uk Kim <jkim@FreeBSD.org> To: freebsd-acpi@FreeBSD.org Subject: Re: kern/121504: [patch] Correctly set hw.acpi.osname on certain machines Message-ID: <200811010020.mA10K5Lc065654@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/121504; it has been noted by GNATS. From: Jung-uk Kim <jkim@FreeBSD.org> To: "Anish Mistry" <amistry@am-productions.biz> Cc: bug-followup@FreeBSD.org, John Baldwin <jhb@FreeBSD.org> 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 <vm/vm.h> #include <vm/pmap.h> +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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811010020.mA10K5Lc065654>