162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci==================
462306a36Sopenharmony_ciACPI WMI interface
562306a36Sopenharmony_ci==================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThe ACPI WMI interface is a proprietary extension of the ACPI specification made
862306a36Sopenharmony_ciby Microsoft to allow hardware vendors to embed WMI (Windows Management Instrumentation)
962306a36Sopenharmony_ciobjects inside their ACPI firmware. Typical functions implemented over ACPI WMI
1062306a36Sopenharmony_ciare hotkey events on modern notebooks and configuration of BIOS options.
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciPNP0C14 ACPI device
1362306a36Sopenharmony_ci-------------------
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciDiscovery of WMI objects is handled by defining ACPI devices with a PNP ID
1662306a36Sopenharmony_ciof ``PNP0C14``. These devices will contain a set of ACPI buffers and methods
1762306a36Sopenharmony_ciused for mapping and execution of WMI methods and/or queries. If there exist
1862306a36Sopenharmony_cimultiple of such devices, then each device is required to have a
1962306a36Sopenharmony_ciunique ACPI UID.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci_WDG buffer
2262306a36Sopenharmony_ci-----------
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ciThe ``_WDG`` buffer is used to discover WMI objects and is required to be
2562306a36Sopenharmony_cistatic. Its internal structure consists of data blocks with a size of 20 bytes,
2662306a36Sopenharmony_cicontaining the following data:
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci======= =============== =====================================================
2962306a36Sopenharmony_ciOffset  Size (in bytes) Content
3062306a36Sopenharmony_ci======= =============== =====================================================
3162306a36Sopenharmony_ci0x00    16              128 bit Variant 2 object GUID.
3262306a36Sopenharmony_ci0x10    2               2 character method ID or single byte notification ID.
3362306a36Sopenharmony_ci0x12    1               Object instance count.
3462306a36Sopenharmony_ci0x13    1               Object flags.
3562306a36Sopenharmony_ci======= =============== =====================================================
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciThe WMI object flags control whether the method or notification ID is used:
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci- 0x1: Data block usage is expensive and must be explicitly enabled/disabled.
4062306a36Sopenharmony_ci- 0x2: Data block contains WMI methods.
4162306a36Sopenharmony_ci- 0x4: Data block contains ASCIZ string.
4262306a36Sopenharmony_ci- 0x8: Data block describes a WMI event, use notification ID instead
4362306a36Sopenharmony_ci  of method ID.
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciEach WMI object GUID can appear multiple times inside a system.
4662306a36Sopenharmony_ciThe method/notification ID is used to construct the ACPI method names used for
4762306a36Sopenharmony_ciinteracting with the WMI object.
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciWQxx ACPI methods
5062306a36Sopenharmony_ci-----------------
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciIf a data block does not contain WMI methods, then its content can be retrieved
5362306a36Sopenharmony_ciby this required ACPI method. The last two characters of the ACPI method name
5462306a36Sopenharmony_ciare the method ID of the data block to query. Their single parameter is an
5562306a36Sopenharmony_ciinteger describing the instance which should be queried. This parameter can be
5662306a36Sopenharmony_ciomitted if the data block contains only a single instance.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciWSxx ACPI methods
5962306a36Sopenharmony_ci-----------------
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciSimilar to the ``WQxx`` ACPI methods, except that it is optional and takes an
6262306a36Sopenharmony_ciadditional buffer as its second argument. The instance argument also cannot
6362306a36Sopenharmony_cibe omitted.
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ciWMxx ACPI methods
6662306a36Sopenharmony_ci-----------------
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciUsed for executing WMI methods associated with a data block. The last two
6962306a36Sopenharmony_cicharacters of the ACPI method name are the method ID of the data block
7062306a36Sopenharmony_cicontaining the WMI methods. Their first parameter is a integer describing the
7162306a36Sopenharmony_ciinstance which methods should be executed. The second parameter is an integer
7262306a36Sopenharmony_cidescribing the WMI method ID to execute, and the third parameter is a buffer
7362306a36Sopenharmony_cicontaining the WMI method parameters. If the data block is marked as containing
7462306a36Sopenharmony_cian ASCIZ string, then this buffer should contain an ASCIZ string. The ACPI
7562306a36Sopenharmony_cimethod will return the result of the executed WMI method.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciWExx ACPI methods
7862306a36Sopenharmony_ci-----------------
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciUsed for optionally enabling/disabling WMI events, the last two characters of
8162306a36Sopenharmony_cithe ACPI method are the notification ID of the data block describing the WMI
8262306a36Sopenharmony_cievent as hexadecimal value. Their first parameter is an integer with a value
8362306a36Sopenharmony_ciof 0 if the WMI event should be disabled, other values will enable
8462306a36Sopenharmony_cithe WMI event.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciWCxx ACPI methods
8762306a36Sopenharmony_ci-----------------
8862306a36Sopenharmony_ciSimilar to the ``WExx`` ACPI methods, except that it controls data collection
8962306a36Sopenharmony_ciinstead of events and thus the last two characters of the ACPI method name are
9062306a36Sopenharmony_cithe method ID of the data block to enable/disable.
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci_WED ACPI method
9362306a36Sopenharmony_ci----------------
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ciUsed to retrieve additional WMI event data, its single parameter is a integer
9662306a36Sopenharmony_ciholding the notification ID of the event.
97