Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153089269
D21529.id61664.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D21529.id61664.diff
View Options
Index: share/man/man4/acpi_wmi_bmof.4
===================================================================
--- /dev/null
+++ share/man/man4/acpi_wmi_bmof.4
@@ -0,0 +1,99 @@
+\" Copyright (c) 2019 Takanori Watanabe
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 5, 2019
+.Dt ACPI_WMI_BMOF 4
+.Os
+.Sh NAME
+.Nm acpi_wmi_bmof
+.Nd "extracting ACPI WMI embedded binary form of Managed Object Format file"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device acpi_wmi"
+.Cd "device acpi_wmi_bmof"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+acpi_wmi_bmof_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides an interface for embedded Managed Object Format file in WMI.
+(e.g. Lenovo Laptops).
+It creates sysctl 'data' node under device sysctl node.
+
+.\".Sh FILES
+.\".Bl -tag -width /dev/wmistat%d -compact
+.\".It Pa /dev/wmistat%d
+.\"WMI status device.
+.\".El
+.Sh EXAMPLES
+.Bd -literal
+# sysctl -b dev.acpi_wmi_bmof.0.data | bmf2mof
+[abstract]
+class Lenovo_BIOSElement {
+};
+
+[WMI, Dynamic, Provider("WMIProv"), WmiExpense(1), Description("Bios Setting"),
+GUID("{51F5230E-9677-46cd-A1CF-C0B23EE34DB7}"), Locale("MS\\0x409")]
+class Lenovo_BiosSetting : Lenovo_BiosElement {
+ [key, read] String InstanceName;
+ [read] Boolean Active;
+ [WmiDataId(1), Description("BIOS setting")] String CurrentSetting;
+ };
+ bra. bra.
+
+Here, bmf2mof is part of https://github.com/pali/bmfdec .
+.Ed
+.Sh SEE ALSO
+.Xr acpi 4
+.Xr sysctl 4
+.Sh HISTORY
+The
+.Nm
+device driver first appeared in
+.Fx 13.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Takanori Watanabe Aq Mt takawata@freebsd.org .
+.Pp
+Work has been inspired by the Linux wmi-bmof driver written by Andy Lutomirski .
+.Pp
+See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for
+the specification of ACPI-WMI.
+.Pp
+This manual page was written by
+.An Takanori Watanabe Aq Mt takawata@freebsd.org .
Index: sys/conf/files
===================================================================
--- sys/conf/files
+++ sys/conf/files
@@ -731,6 +731,7 @@
dev/aacraid/aacraid_linux.c optional aacraid compat_linux
dev/aacraid/aacraid_pci.c optional aacraid pci
dev/acpi_support/acpi_wmi.c optional acpi_wmi acpi
+dev/acpi_support/acpi_wmi_bmof.c optional acpi_wmi_bmof acpi
dev/acpi_support/acpi_asus.c optional acpi_asus acpi
dev/acpi_support/acpi_asus_wmi.c optional acpi_asus_wmi acpi
dev/acpi_support/acpi_fujitsu.c optional acpi_fujitsu acpi
Index: sys/dev/acpi_support/acpi_wmi_bmof.c
===================================================================
--- /dev/null
+++ sys/dev/acpi_support/acpi_wmi_bmof.c
@@ -0,0 +1,123 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "opt_acpi.h"
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/uio.h>
+#include <sys/proc.h>
+#include <sys/kernel.h>
+#include <sys/bus.h>
+#include <sys/sbuf.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+
+#include <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/accommon.h>
+#include <dev/acpica/acpivar.h>
+#include "acpi_wmi_if.h"
+#define BMOF_WMI_UUID "05901221-D566-11D1-B2F0-00A0C9062910"
+
+struct acpi_wmi_bmof_softc{
+ char *mofbuf;
+};
+
+
+static void
+acpi_wmi_bmof_identify(driver_t *driver, device_t parent)
+{
+
+ /* Don't do anything if driver is disabled. */
+ if (acpi_disabled("bmof"))
+ return;
+ /* Add only a single device instance. */
+ if (device_find_child(parent, "acpi_wmi_bmof", -1) != NULL)
+ return;
+
+ /* Check management GUID to see whether system is compatible. */
+ if (!ACPI_WMI_PROVIDES_GUID_STRING(parent,
+ BMOF_WMI_UUID))
+ return;
+
+ if (BUS_ADD_CHILD(parent, 0, "acpi_wmi_bmof", -1) == NULL)
+ device_printf(parent, "add acpi_wmi_bmof\n");
+}
+
+static int
+acpi_wmi_bmof_probe(device_t dev)
+{
+
+ if (!ACPI_WMI_PROVIDES_GUID_STRING(device_get_parent(dev),
+ BMOF_WMI_UUID))
+ return (EINVAL);
+ device_set_desc(dev, "BMOF Sysctl");
+ return (0);
+
+}
+
+static int
+acpi_wmi_bmof_attach(device_t dev)
+{
+ struct acpi_wmi_bmof_softc *sc = device_get_softc(dev);
+ struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);;
+ struct sysctl_oid *oid = device_get_sysctl_tree(dev);
+ ACPI_BUFFER out = { ACPI_ALLOCATE_BUFFER, NULL};
+ ACPI_STATUS status;
+ ACPI_OBJECT *obj;
+
+ status = ACPI_WMI_GET_BLOCK(device_get_parent(dev),
+ BMOF_WMI_UUID, 0, &out);
+ if(ACPI_FAILURE(status)){
+ device_printf(dev, "Error %s\n", AcpiFormatException(status));
+ AcpiOsFree(out.Pointer);
+ return EINVAL;
+ }
+ obj = out.Pointer;
+
+ if (!obj || obj->Type != ACPI_TYPE_BUFFER) {
+ AcpiOsFree(out.Pointer);
+ return EINVAL;
+ }
+
+ sc->mofbuf = out.Pointer;
+ device_printf(dev, "Length %lu Buflen %u\n", out.Length,
+ obj->Buffer.Length);
+ SYSCTL_ADD_OPAQUE(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "data",
+ CTLFLAG_RD | CTLFLAG_MPSAFE,
+ obj->Buffer.Pointer,
+ obj->Buffer.Length, "A", "MOF Blob");
+
+ return 0;
+}
+
+static int
+acpi_wmi_bmof_detach(device_t dev)
+{
+ struct acpi_wmi_bmof_softc *sc = device_get_softc(dev);
+ AcpiOsFree(sc->mofbuf);
+ return 0;
+
+}
+
+static device_method_t acpi_wmi_bmof_methods[] = {
+ DEVMETHOD(device_identify, acpi_wmi_bmof_identify),
+ DEVMETHOD(device_probe, acpi_wmi_bmof_probe),
+ DEVMETHOD(device_attach, acpi_wmi_bmof_attach),
+ DEVMETHOD(device_detach, acpi_wmi_bmof_detach),
+
+ DEVMETHOD_END
+};
+
+static driver_t acpi_wmi_bmof_driver = {
+ "acpi_wmi_bmof",
+ acpi_wmi_bmof_methods,
+ sizeof(struct acpi_wmi_bmof_softc),
+};
+
+static devclass_t acpi_wmi_bmof_devclass;
+
+DRIVER_MODULE(acpi_wmi_bmof, acpi_wmi, acpi_wmi_bmof_driver,
+ acpi_wmi_bmof_devclass, 0, 0);
+MODULE_DEPEND(acpi_wmi_bmof, acpi_wmi, 1, 1, 1);
+MODULE_DEPEND(acpi_wmi_bmof, acpi, 1, 1, 1);
+
Index: sys/modules/acpi/Makefile
===================================================================
--- sys/modules/acpi/Makefile
+++ sys/modules/acpi/Makefile
@@ -2,6 +2,6 @@
SUBDIR= acpi_asus acpi_asus_wmi acpi_dock acpi_fujitsu acpi_hp \
acpi_ibm acpi_panasonic acpi_sony acpi_toshiba \
- acpi_video acpi_wmi aibs
+ acpi_video acpi_wmi acpi_wmi_bmof aibs
.include <bsd.subdir.mk>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 20, 1:46 AM (12 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31814727
Default Alt Text
D21529.id61664.diff (7 KB)
Attached To
Mode
D21529: Adding WMI embedded Binary MOF object interface driver.
Attached
Detach File
Event Timeline
Log In to Comment