[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kern/121504: [patch] Correctly set hw.acpi.osname on certain machines



The following reply was made to PR kern/121504; it has been noted by GNATS.

From: Jung-uk Kim <jkim_(_at_)_FreeBSD_(_dot_)_org>
To: "Anish Mistry" <amistry_(_at_)_am-productions_(_dot_)_biz>
Cc: bug-followup_(_at_)_FreeBSD_(_dot_)_org,
 John Baldwin <jhb_(_at_)_FreeBSD_(_dot_)_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--
_______________________________________________
freebsd-acpi_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-acpi
To unsubscribe, send any mail to "freebsd-acpi-unsubscribe_(_at_)_freebsd_(_dot_)_org"


Visit your host, monkey.org