xref: /freebsd/sys/dev/acpi_support/acpi_wmi_if.m (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
1df849145SRui Paulo#-
2df849145SRui Paulo# Copyright (c) 2009 Michael Gmelin
3df849145SRui Paulo# All rights reserved.
4df849145SRui Paulo#
5df849145SRui Paulo# Redistribution and use in source and binary forms, with or without
6df849145SRui Paulo# modification, are permitted provided that the following conditions
7df849145SRui Paulo# are met:
8df849145SRui Paulo# 1. Redistributions of source code must retain the above copyright
9df849145SRui Paulo#    notice, this list of conditions and the following disclaimer.
10df849145SRui Paulo# 2. Redistributions in binary form must reproduce the above copyright
11df849145SRui Paulo#    notice, this list of conditions and the following disclaimer in the
12df849145SRui Paulo#    documentation and/or other materials provided with the distribution.
13df849145SRui Paulo#
14df849145SRui Paulo# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15df849145SRui Paulo# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16df849145SRui Paulo# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17df849145SRui Paulo# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18df849145SRui Paulo# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19df849145SRui Paulo# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20df849145SRui Paulo# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21df849145SRui Paulo# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22df849145SRui Paulo# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23df849145SRui Paulo# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24df849145SRui Paulo# SUCH DAMAGE.
25df849145SRui Paulo#
26df849145SRui Paulo#
27df849145SRui Paulo
28df849145SRui Paulo#include <sys/bus.h>
29df849145SRui Paulo#include <sys/types.h>
30df849145SRui Paulo#include <contrib/dev/acpica/include/acpi.h>
31df849145SRui Paulo
32df849145SRui PauloINTERFACE acpi_wmi;
33df849145SRui Paulo
34df849145SRui Paulo#
35df849145SRui Paulo# Default implementation for acpi_wmi_generic_provides_guid_string().
36df849145SRui Paulo#
37df849145SRui PauloCODE {
38df849145SRui Paulo	static int
39df849145SRui Paulo	acpi_wmi_generic_provides_guid_string(device_t dev, const char* guid_string)
40df849145SRui Paulo	{
41df849145SRui Paulo		return 0;
42df849145SRui Paulo	}
43df849145SRui Paulo};
44df849145SRui Paulo
45df849145SRui Paulo
46df849145SRui Paulo#
47df849145SRui Paulo# Check if given GUID exists in WMI
480f73b657SRui Paulo# Returns number of instances (max_instace+1) or 0 if guid doesn't exist
49df849145SRui Paulo#
50df849145SRui Paulo# device_t dev:	Device to probe
51df849145SRui Paulo# const char* guid_string: String form of the GUID
52df849145SRui Paulo#
53df849145SRui PauloMETHOD int provides_guid_string {
54df849145SRui Paulo	device_t	dev;
55df849145SRui Paulo	const char*	guid_string;
56df849145SRui Paulo} DEFAULT acpi_wmi_generic_provides_guid_string;
57df849145SRui Paulo
58df849145SRui Paulo#
59df849145SRui Paulo# Evaluate a WMI method call
60df849145SRui Paulo#
61df849145SRui Paulo# device_t dev:  Device to use
62df849145SRui Paulo# const char* guid_string:  String form of the GUID
63df849145SRui Paulo# UINT8 instance: instance id
64df849145SRui Paulo# UINT32 method_id: method to call
65df849145SRui Paulo# const ACPI_BUFFER* in: input data
66df849145SRui Paulo# ACPI_BUFFER* out: output buffer
67df849145SRui Paulo#
68df849145SRui PauloMETHOD ACPI_STATUS evaluate_call {
69df849145SRui Paulo	device_t	dev;
70df849145SRui Paulo	const char	*guid_string;
71df849145SRui Paulo	UINT8		instance;
72df849145SRui Paulo	UINT32		method_id;
73df849145SRui Paulo	const ACPI_BUFFER *in;
74df849145SRui Paulo	ACPI_BUFFER	*out;
75df849145SRui Paulo};
76df849145SRui Paulo
77df849145SRui Paulo#
78df849145SRui Paulo# Get content of a WMI block
79df849145SRui Paulo#
80df849145SRui Paulo# device_t dev:  Device to use
81df849145SRui Paulo# const char* guid_string:  String form of the GUID
82df849145SRui Paulo# UINT8 instance: instance id
83df849145SRui Paulo# ACPI_BUFFER* out: output buffer
84df849145SRui Paulo#
85df849145SRui PauloMETHOD ACPI_STATUS get_block {
86df849145SRui Paulo	device_t	dev;
87df849145SRui Paulo	const char	*guid_string;
88df849145SRui Paulo	UINT8		instance;
89df849145SRui Paulo	ACPI_BUFFER	*out;
90df849145SRui Paulo};
91df849145SRui Paulo#
92df849145SRui Paulo# Write to a WMI data block
93df849145SRui Paulo#
94df849145SRui Paulo# device_t dev:  Device to use
95df849145SRui Paulo# const char* guid_string:  String form of the GUID
96df849145SRui Paulo# UINT8 instance: instance id
97df849145SRui Paulo# const ACPI_BUFFER* in: input data
98df849145SRui Paulo#
99df849145SRui PauloMETHOD ACPI_STATUS set_block {
100df849145SRui Paulo	device_t	dev;
101df849145SRui Paulo	const char	*guid_string;
102df849145SRui Paulo	UINT8		instance;
103df849145SRui Paulo	const ACPI_BUFFER *in;
104df849145SRui Paulo};
105df849145SRui Paulo
106df849145SRui Paulo#
107df849145SRui Paulo# Install wmi event handler
108df849145SRui Paulo#
109df849145SRui Paulo# device_t dev:  Device to use
110df849145SRui Paulo# const char* guid_string:  String form of the GUID
111df849145SRui Paulo# ACPI_NOTIFY_HANDLER handler: Handler
112df849145SRui Paulo# void* data: Payload
113df849145SRui Paulo#
114df849145SRui PauloMETHOD ACPI_STATUS install_event_handler {
115df849145SRui Paulo	device_t	dev;
116df849145SRui Paulo	const char	*guid_string;
117df849145SRui Paulo	ACPI_NOTIFY_HANDLER handler;
118df849145SRui Paulo	void		*data;
119df849145SRui Paulo};
120df849145SRui Paulo
121df849145SRui Paulo#
122df849145SRui Paulo# Remove wmi event handler
123df849145SRui Paulo#
124df849145SRui Paulo# device_t dev:  Device to use
125df849145SRui Paulo# const char* guid_string:  String form of the GUID
126df849145SRui Paulo#
127df849145SRui PauloMETHOD ACPI_STATUS remove_event_handler {
128df849145SRui Paulo	device_t	dev;
129df849145SRui Paulo	const char	*guid_string;
130df849145SRui Paulo};
131df849145SRui Paulo
132df849145SRui Paulo
133df849145SRui Paulo#
134df849145SRui Paulo# Get event data associated to an event
135df849145SRui Paulo#
136df849145SRui Paulo# device_t dev:  Device to use
137df849145SRui Paulo# UINT32 event_id: event id
138df849145SRui Paulo# ACPI_BUFFER* out: output buffer
139df849145SRui Paulo#
140df849145SRui PauloMETHOD ACPI_STATUS get_event_data {
141df849145SRui Paulo	device_t	dev;
142df849145SRui Paulo	UINT32		event_id;
143df849145SRui Paulo	ACPI_BUFFER	*out;
144df849145SRui Paulo};
145