xref: /freebsd/sys/dev/acpi_support/acpi_wmi_if.m (revision 7aa383846770374466b1dcb2cefd71bde9acf463)
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# $FreeBSD$
27#
28
29#include <sys/bus.h>
30#include <sys/types.h>
31#include <contrib/dev/acpica/include/acpi.h>
32
33INTERFACE acpi_wmi;
34
35#
36# Default implementation for acpi_wmi_generic_provides_guid_string().
37#
38CODE {
39	static int
40	acpi_wmi_generic_provides_guid_string(device_t dev, const char* guid_string)
41	{
42		return 0;
43	}
44};
45
46
47#
48# Check if given GUID exists in WMI
49# Returns number of instances (max_instace+1) or 0 if guid doesn't exist
50#
51# device_t dev:	Device to probe
52# const char* guid_string: String form of the GUID
53#
54METHOD int provides_guid_string {
55	device_t	dev;
56	const char*	guid_string;
57} DEFAULT acpi_wmi_generic_provides_guid_string;
58
59#
60# Evaluate a WMI method call
61#
62# device_t dev:  Device to use
63# const char* guid_string:  String form of the GUID
64# UINT8 instance: instance id
65# UINT32 method_id: method to call
66# const ACPI_BUFFER* in: input data
67# ACPI_BUFFER* out: output buffer
68#
69METHOD ACPI_STATUS evaluate_call {
70	device_t	dev;
71	const char	*guid_string;
72	UINT8		instance;
73	UINT32		method_id;
74	const ACPI_BUFFER *in;
75	ACPI_BUFFER	*out;
76};
77
78#
79# Get content of a WMI block
80#
81# device_t dev:  Device to use
82# const char* guid_string:  String form of the GUID
83# UINT8 instance: instance id
84# ACPI_BUFFER* out: output buffer
85#
86METHOD ACPI_STATUS get_block {
87	device_t	dev;
88	const char	*guid_string;
89	UINT8		instance;
90	ACPI_BUFFER	*out;
91};
92#
93# Write to a WMI data block
94#
95# device_t dev:  Device to use
96# const char* guid_string:  String form of the GUID
97# UINT8 instance: instance id
98# const ACPI_BUFFER* in: input data
99#
100METHOD ACPI_STATUS set_block {
101	device_t	dev;
102	const char	*guid_string;
103	UINT8		instance;
104	const ACPI_BUFFER *in;
105};
106
107#
108# Install wmi event handler
109#
110# device_t dev:  Device to use
111# const char* guid_string:  String form of the GUID
112# ACPI_NOTIFY_HANDLER handler: Handler
113# void* data: Payload
114#
115METHOD ACPI_STATUS install_event_handler {
116	device_t	dev;
117	const char	*guid_string;
118	ACPI_NOTIFY_HANDLER handler;
119	void		*data;
120};
121
122#
123# Remove wmi event handler
124#
125# device_t dev:  Device to use
126# const char* guid_string:  String form of the GUID
127#
128METHOD ACPI_STATUS remove_event_handler {
129	device_t	dev;
130	const char	*guid_string;
131};
132
133
134#
135# Get event data associated to an event
136#
137# device_t dev:  Device to use
138# UINT32 event_id: event id
139# ACPI_BUFFER* out: output buffer
140#
141METHOD ACPI_STATUS get_event_data {
142	device_t	dev;
143	UINT32		event_id;
144	ACPI_BUFFER	*out;
145};
146