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