45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
/*
|
|
* AcpiWmi.hpp
|
|
* ACPI-WMI mapper (PNP0C14): find a WMI GUID's data block in _WDG and call
|
|
* its WMxx method
|
|
* Copyright (c) 2026 Daniel Hammer
|
|
*/
|
|
|
|
#pragma once
|
|
#include <cstdint>
|
|
#include <ACPI/AML/AmlNamespace.hpp>
|
|
|
|
namespace Hal {
|
|
namespace AcpiWmi {
|
|
|
|
// _WDG flags (Microsoft "Windows Instrumentation: WMI and ACPI").
|
|
static constexpr uint8_t FlagExpensive = 0x1;
|
|
static constexpr uint8_t FlagMethod = 0x2;
|
|
static constexpr uint8_t FlagString = 0x4;
|
|
static constexpr uint8_t FlagEvent = 0x8;
|
|
|
|
// One _WDG entry, bound to the PNP0C14 device that declared it.
|
|
struct Block {
|
|
int32_t Device; // namespace node of the PNP0C14 device
|
|
char ObjectId[2]; // names the WQxx / WSxx / WMxx methods
|
|
uint8_t InstanceCount;
|
|
uint8_t Flags;
|
|
};
|
|
|
|
// Parse "603E9613-EF25-4338-A3D0-C46177516DB7" into the byte order
|
|
// _WDG stores (first three fields little-endian). False if malformed.
|
|
bool ParseGuid(const char* text, uint8_t out[16]);
|
|
|
|
// Search every present PNP0C14 device's _WDG for `guid`. The first
|
|
// declaration wins, as on Linux.
|
|
bool Find(const uint8_t guid[16], Block& out);
|
|
|
|
// Evaluate WMxx(instance, methodId, input) on a method block. The input
|
|
// is passed as a String instead of a Buffer when the block says so.
|
|
bool EvaluateMethod(const Block& block, uint8_t instance, uint32_t methodId,
|
|
const uint8_t* input, uint32_t inputLength,
|
|
AML::Object& result);
|
|
|
|
};
|
|
};
|