kern/121504: [patch] Correctly set hw.acpi.osname on certain
machines
John Baldwin
jhb at freebsd.org
Mon Mar 10 19:23:25 UTC 2008
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=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=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
--
John Baldwin
More information about the freebsd-acpi
mailing list