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

Anish Mistry amistry at am-productions.biz
Mon Mar 10 22:18:34 UTC 2008


On Monday 10 March 2008, John Baldwin wrote:
> On Monday 10 March 2008 05:14:02 pm Anish Mistry wrote:
> > On Monday 10 March 2008, John Baldwin wrote:
> > > On Monday 10 March 2008 03:10:02 pm Anish Mistry wrote:
> > > > The following reply was made to PR kern/121504; it has been
> > > > noted by GNATS.
> > > >
> > > > From: Anish Mistry <amistry at am-productions.biz>
> > > > To: John Baldwin <jhb at freebsd.org>
> > > > Cc: bug-followup at freebsd.org, njl at freebsd.org
> > > > Subject: Re: kern/121504: [patch] Correctly set
> > > > hw.acpi.osname on certain
> > >
> > > machines
> > >
> > > > Date: Mon, 10 Mar 2008 15:09:04 -0400
> > > >
> > > >  --nextPart11816881.8XfUQkhbdk
> > > >  Content-Type: text/plain;
> > > >    charset="iso-8859-1"
> > > >  Content-Transfer-Encoding: quoted-printable
> > > >  Content-Disposition: inline
> > > >
> > > >  On Monday 10 March 2008, John Baldwin wrote:
> > > >  > This is not the correct patch.  The _OSI method does not
> > > >  > return an OS name like _OS.  Instead, it is a function
> > > >  > that returns a boolean (True/False) to say if a given OS
> > > >  > name is supported (OS name is passed as an argument).  The
> > > >  > proper fix is to say that the osname is supported in the
> > > >  > AcpiOsValidateInterface() method.  Something like this
> > > >  > should work:
> > > >  >
> > > >  > Index: Osd/OsdMemory.c
> > > >  > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > > >  >3D=3 D=3D=3D=3D=
> > >
> > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > >=3D= 3D=3D=3D=
> > >
> > > >  =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > > >
> > > >  > RCS file: /usr/cvs/src/sys/dev/acpica/Osd/OsdMemory.c,v
> > > >  > retrieving revision 1.15
> > > >  > diff -u -r1.15 OsdMemory.c
> > > >  > --- Osd/OsdMemory.c	22 Mar 2007 18:16:41 -0000	1.15
> > > >  > +++ Osd/OsdMemory.c	10 Mar 2008 16:20:03 -0000
> > > >  > @@ -77,6 +77,9 @@
> > > >  >  ACPI_STATUS
> > > >  >  AcpiOsValidateInterface (char *Interface)
> > > >  >  {
> > > >  > +
> > > >  > +    if (strcmp(Interface, acpi_osname) =3D=3D 0)
> > > >  > +	return (AE_OK);
> > > >  >      return (AE_SUPPORT);
> > > >  >  }
> > > >
> > > >  I get acpi_osname undeclared on compile.
> > >
> > > Try this:
> > >
> > > Index: acpivar.h
> > > ===============================================================
> > >==== RCS file: /usr/cvs/src/sys/dev/acpica/acpivar.h,v
> > > retrieving revision 1.108
> > > diff -u -r1.108 acpivar.h
> > > --- acpivar.h	9 Oct 2007 07:48:07 -0000	1.108
> > > +++ acpivar.h	10 Mar 2008 19:18:53 -0000
> > > @@ -229,6 +229,11 @@
> > >  #define ACPI_IVAR_FLAGS		0x103
> > >
> > >  /*
> > > + * Storage for hw.acpi.osname tunable to override _OS or _OSI.
> > > + */
> > > +extern char	acpi_osname[];
> > > +
> > > +/*
> > >   * Accessor functions for our ivars.  Default value for
> > > BUS_READ_IVAR is * (type) 0.  The <sys/bus.h> accessor
> > > functions don't check return values. */
> > > Index: Osd/OsdMemory.c
> > > ===============================================================
> > >==== RCS file: /usr/cvs/src/sys/dev/acpica/Osd/OsdMemory.c,v
> > > retrieving revision 1.15
> > > diff -u -r1.15 OsdMemory.c
> > > --- Osd/OsdMemory.c	22 Mar 2007 18:16:41 -0000	1.15
> > > +++ Osd/OsdMemory.c	10 Mar 2008 19:21:38 -0000
> > > @@ -33,13 +33,17 @@
> > >  #include <sys/cdefs.h>
> > >  __FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdMemory.c,v 1.15
> > > 2007/03/22 18:16:41 jkim Exp $");
> > >
> > > -#include <contrib/dev/acpica/acpi.h>
> > > -
> > > +#include <sys/param.h>
> > > +#include <sys/bus.h>
> > >  #include <sys/kernel.h>
> > >  #include <sys/malloc.h>
> > >  #include <vm/vm.h>
> > >  #include <vm/pmap.h>
> > >
> > > +#include <contrib/dev/acpica/acpi.h>
> > > +
> > > +#include <dev/acpica/acpivar.h>
> > > +
> > >  MALLOC_DEFINE(M_ACPICA, "acpica", "ACPI CA memory pool");
> > >
> > >  void *
> > > @@ -77,6 +81,9 @@
> > >  ACPI_STATUS
> > >  AcpiOsValidateInterface (char *Interface)
> > >  {
> > > +
> > > +    if (strcmp(Interface, acpi_osname) == 0)
> > > +	return (AE_OK);
> > >      return (AE_SUPPORT);
> > >  }
> > >
> > > Index: Osd/OsdTable.c
> > > ===============================================================
> > >==== RCS file: /usr/cvs/src/sys/dev/acpica/Osd/OsdTable.c,v
> > > retrieving revision 1.12
> > > diff -u -r1.12 OsdTable.c
> > > --- Osd/OsdTable.c	22 Mar 2007 18:16:41 -0000	1.12
> > > +++ Osd/OsdTable.c	10 Mar 2008 19:20:39 -0000
> > > @@ -32,6 +32,7 @@
> > >  __FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdTable.c,v 1.12
> > > 2007/03/22 18:16:41 jkim Exp $");
> > >
> > >  #include <sys/param.h>
> > > +#include <sys/bus.h>
> > >  #include <sys/endian.h>
> > >  #include <sys/kernel.h>
> > >  #include <sys/linker.h>
> > > @@ -39,10 +40,12 @@
> > >  #include <contrib/dev/acpica/acpi.h>
> > >  #include <contrib/dev/acpica/actables.h>
> > >
> > > +#include <dev/acpica/acpivar.h>
> > > +
> > >  #undef _COMPONENT
> > >  #define	_COMPONENT      ACPI_TABLES
> > >
> > > -static char acpi_osname[128];
> > > +char acpi_osname[128];
> > >  TUNABLE_STR("hw.acpi.osname", acpi_osname,
> > > sizeof(acpi_osname));
> > >
> > >  ACPI_STATUS
> >
> > Ok, this compiles, but doesn't seem to set the override
> > correctly.
> >
> > Here is my asl.
> > http://am-productions.biz/docs/smallguy.asl
> >
> > Basically the entire reason for this is that the code calls the
> > external method:
> > External (\_SB_.PCI0.GFX0.LCD_.BLNF, MethodObj)
> >
> > When I press the backlight function keys and they don't do
> > anything besides displaying a Namespace lookup error since that
> > method is not defined.  No one responded to my previous email
> > about creating an external method that would get called.  Getting
> > the right _OSI name set just allows it to go to the fallback code
> > that works with acpi_fujitsu.
> >
> > ACPI Error (psargs-0459): [\_SB_.PCI0.GFX0.LCD_.BLNF] Namespace
> > lookup failure, AE_NOT_FOUND
> > ACPI Error (psparse-0626): Method parse/execution failed
> > [\_GPE._L1C] (Node 0xff ffff00011bd780), AE_NOT_FOUND ACPI
> > Exception (evgpe-0687): AE_NOT_FOUND, while evaluating GPE method
> > [_L1C] [20070320]
>
> The problem is that ACPI-CA matches "Windows 2006" internally and
> thus sets OSTB to 0x40.  The garbage you were using for _OSI must
> have made it always fail.  You probably will need to just patch
> your ASL and/or figure out what BLNF does and implement it. 
> Perhaps check to see what folks with Linux are seeing with this
> laptop as it has the same ACPI-CA code.
So there is no way to have that External method call out some C code?  
I already have to code in my updated acpi_fujitsu module to handle 
changing of the brightness, I just need it called.  I'd like to get 
this all working so it doesn't require ASL patching.

As for the Linux stuff, Google doesn't reveal anything.  This laptop 
is pretty new, it's only been out for about a month.


-- 
Anish Mistry
amistry at am-productions.biz
AM Productions http://am-productions.biz/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freebsd.org/pipermail/freebsd-acpi/attachments/20080310/cf2333b1/attachment.pgp


More information about the freebsd-acpi mailing list