Path: blob/main/sys/dev/acpi_support/acpi_wmi_if.m
39536 views
#-1# Copyright (c) 2009 Michael Gmelin2# All rights reserved.3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions6# are met:7# 1. Redistributions of source code must retain the above copyright8# notice, this list of conditions and the following disclaimer.9# 2. Redistributions in binary form must reproduce the above copyright10# notice, this list of conditions and the following disclaimer in the11# documentation and/or other materials provided with the distribution.12#13# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23# SUCH DAMAGE.24#25#2627#include <sys/bus.h>28#include <sys/types.h>29#include <contrib/dev/acpica/include/acpi.h>3031INTERFACE acpi_wmi;3233#34# Default implementation for acpi_wmi_generic_provides_guid_string().35#36CODE {37static int38acpi_wmi_generic_provides_guid_string(device_t dev, const char* guid_string)39{40return 0;41}42};434445#46# Check if given GUID exists in WMI47# Returns number of instances (max_instace+1) or 0 if guid doesn't exist48#49# device_t dev: Device to probe50# const char* guid_string: String form of the GUID51#52METHOD int provides_guid_string {53device_t dev;54const char* guid_string;55} DEFAULT acpi_wmi_generic_provides_guid_string;5657#58# Evaluate a WMI method call59#60# device_t dev: Device to use61# const char* guid_string: String form of the GUID62# UINT8 instance: instance id63# UINT32 method_id: method to call64# const ACPI_BUFFER* in: input data65# ACPI_BUFFER* out: output buffer66#67METHOD ACPI_STATUS evaluate_call {68device_t dev;69const char *guid_string;70UINT8 instance;71UINT32 method_id;72const ACPI_BUFFER *in;73ACPI_BUFFER *out;74};7576#77# Get content of a WMI block78#79# device_t dev: Device to use80# const char* guid_string: String form of the GUID81# UINT8 instance: instance id82# ACPI_BUFFER* out: output buffer83#84METHOD ACPI_STATUS get_block {85device_t dev;86const char *guid_string;87UINT8 instance;88ACPI_BUFFER *out;89};90#91# Write to a WMI data block92#93# device_t dev: Device to use94# const char* guid_string: String form of the GUID95# UINT8 instance: instance id96# const ACPI_BUFFER* in: input data97#98METHOD ACPI_STATUS set_block {99device_t dev;100const char *guid_string;101UINT8 instance;102const ACPI_BUFFER *in;103};104105#106# Install wmi event handler107#108# device_t dev: Device to use109# const char* guid_string: String form of the GUID110# ACPI_NOTIFY_HANDLER handler: Handler111# void* data: Payload112#113METHOD ACPI_STATUS install_event_handler {114device_t dev;115const char *guid_string;116ACPI_NOTIFY_HANDLER handler;117void *data;118};119120#121# Remove wmi event handler122#123# device_t dev: Device to use124# const char* guid_string: String form of the GUID125#126METHOD ACPI_STATUS remove_event_handler {127device_t dev;128const char *guid_string;129};130131132#133# Get event data associated to an event134#135# device_t dev: Device to use136# UINT32 event_id: event id137# ACPI_BUFFER* out: output buffer138#139METHOD ACPI_STATUS get_event_data {140device_t dev;141UINT32 event_id;142ACPI_BUFFER *out;143};144145146