From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751393AbdFDQKy (ORCPT ); Sun, 4 Jun 2017 12:10:54 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37994 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751328AbdFDQJY (ORCPT ); Sun, 4 Jun 2017 12:09:24 -0400 From: Pali =?utf-8?q?Roh=C3=A1r?= To: Darren Hart , Mario.Limonciello@dell.com, Rafael Wysocki , Andy Lutomirski , andriy.shevchenko@linux.intel.com Subject: Binary MOF buffer in WMI is finally decoded! Date: Sun, 4 Jun 2017 18:09:21 +0200 User-Agent: KMail/1.13.7 (Linux/3.13.0-117-generic; KDE/4.14.2; x86_64; ; ) Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart11521106.MStCUVhUt2"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201706041809.21573@pali> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nextPart11521106.MStCUVhUt2 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! As already mentioned in RFC: WMI Enhancements thread [1], I looked at=20 binary MOF buffer used by WMI which is included in ACPI DSDT table. That binary MOF buffer contains description of WMI methods and=20 structures used by ACPI-WMI. It also contains mapping from human=20 readable function names to ACPI-WMI magical numbers used for calling WMI=20 methods via ACPI. Basically in that binary MOF buffer is description of structures used as=20 input and output arguments for WMI methods/function calls. Until now, there were not information nor any parser of those binary MOF=20 files (.bmf file). There is some Microsoft proprietary tool which can=20 compile text MOF file to binary and vice versa. I was able to decode that binary MOF format and wrote simple bmfparse=20 tool. It is available in git repository [2]. Currently parsing of=20 function parameters is not implemented yet. Binary MOF format is compressed by prehistoric DS-01 algorithm=20 (modification of LZ-77) which was used as compression algorithm for=20 =46AT-16. Maybe you remember DMSDOS or DoubleSpace... After decompression,= =20 the whole format is so shitty, probably half of data are just lengths of=20 sub structures and sub-sub-... structures. I hope this bmfparse program would help in writing new wmi drivers for=20 Linux or inspection of available WMI methods. Probably we could implement parser of BMOF in kernel and allow=20 validation of function parameters or usage of human readable names of=20 WMI methods? [1] - https://www.spinics.net/lists/platform-driver-x86/msg11574.html [2] - https://github.com/pali/bmfdec =2D-=20 Pali Roh=C3=A1r pali.rohar@gmail.com --nextPart11521106.MStCUVhUt2 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAlk0MLEACgkQi/DJPQPkQ1Lt0QCfXM22n3+TpYYJy9slu/EJCeF9 hCsAn0MNrniu16+IxRdP0cT2tMtQWiLD =Edjv -----END PGP SIGNATURE----- --nextPart11521106.MStCUVhUt2--