ReactOS 0.4.15-dev-7924-g5949c20
acpi_bus.h
Go to the documentation of this file.
1/*
2 * acpi_bus.h - ACPI Bus Driver ($Revision: 22 $)
3 *
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 *
23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 */
25
26#ifndef __ACPI_BUS_H__
27#define __ACPI_BUS_H__
28
29#include <acpi.h>
30
31#include "list.h"
32
33
34/* TBD: Make dynamic */
35#define ACPI_MAX_HANDLES 10
39};
40
41
42/* acpi_utils.h */
45 ACPI_OBJECT *package,
52 struct acpi_object_list *arguments,
53 unsigned long long *data);
58 struct acpi_object_list *arguments,
59 struct acpi_handle_list *list);
62
68};
69
81};
82
83struct acpi_driver;
84struct acpi_device;
85
86
87/*
88 * ACPI Driver
89 * -----------
90 */
91
92typedef int (*acpi_op_add) (struct acpi_device *device);
93typedef int (*acpi_op_remove) (struct acpi_device *device, int type);
94typedef int (*acpi_op_start) (struct acpi_device *device);
95typedef int (*acpi_op_suspend) (struct acpi_device *device, int state);
96typedef int (*acpi_op_resume) (struct acpi_device *device, int state);
97typedef int (*acpi_op_scan) (struct acpi_device *device);
98typedef int (*acpi_op_bind) (struct acpi_device *device);
99typedef int (*acpi_op_unbind) (struct acpi_device * device);
101
105};
106
117};
118
119#define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */
120
123 char name[80];
124 char class[80];
126 unsigned int flags;
127 char *ids; /* Supported Hardware IDs */
129};
130
131/*
132 * ACPI Device
133 * -----------
134 */
135
136/* Status (_STA) */
137
145};
146
147
148/* Flags */
149
165};
166
167/* Plug and Play */
168
169typedef char acpi_bus_id[8];
170typedef unsigned long acpi_bus_address;
171typedef char *acpi_hardware_id;
172typedef char acpi_unique_id[9];
173typedef char acpi_device_name[40];
174typedef char acpi_device_class[20];
175
177 acpi_bus_id bus_id; /* Object name */
182 acpi_device_name device_name; /* Driver-determined */
184};
185
186#define acpi_device_bid(d) ((d)->pnp.bus_id)
187#define acpi_device_adr(d) ((d)->pnp.bus_address)
188#define acpi_device_hid(d) ((d)->pnp.hardware_id)
189#define acpi_device_uid(d) ((d)->pnp.unique_id)
190#define acpi_device_name(d) ((d)->pnp.device_name)
191#define acpi_device_class(d) ((d)->pnp.device_class)
192
193
194/* Power Management */
195
197 UINT32 explicit_get:1; /* _PSC present? */
198 UINT32 power_resources:1; /* Power resources */
199 UINT32 inrush_current:1; /* Serialize Dx->D0 */
200 UINT32 power_removed:1; /* Optimize Dx->D0 */
202};
203
205 struct {
207 UINT8 explicit_set:1; /* _PSx present? */
210 int power; /* % Power (compared to D0) */
211 int latency; /* Dx->D0 time (microseconds) */
212 struct acpi_handle_list resources; /* Power resources referenced */
213};
214
216 int state; /* Current state */
218 struct acpi_device_power_state states[4]; /* Power states (D0-D3) */
219};
220
221
222/* Performance Management */
223
226};
227
229 struct {
233 UINT8 power; /* % Power (compared to P0) */
234 UINT8 performance; /* % Performance ( " ) */
235 int latency; /* Px->P0 time (microseconds) */
236};
237
239 int state;
243};
244
245/* Wakeup Management */
247 UINT8 valid:1; /* Can successfully enable wakeup? */
248 UINT8 run_wake:1; /* Run-Wake GPE devices */
249};
250
253};
254
263};
264
265
266/* Device */
267
284 struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */
285 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
286
287};
288
289#define acpi_driver_data(d) ((d)->driver_data)
290
291#define to_acpi_device(d) container_of(d, struct acpi_device, dev)
292#define to_acpi_driver(d) container_of(d, struct acpi_driver, drv)
293
294/* acpi_device.dev.bus == &acpi_bus_type */
295extern struct bus_type acpi_bus_type;
296
297/*
298 * Events
299 * ------
300 */
301
308};
309
310
311/*
312 * External Functions
313 */
315
318 unsigned long long *sta);
329int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
330 ACPI_HANDLE handle, int type);
331int acpi_bus_trim(struct acpi_device *start, int rmdevice);
335 const struct acpi_pnp_device_id *ids);
337int acpi_init(void);
339
340/*
341 * Bind physical devices with ACPI devices
342 */
343//struct acpi_bus_type {
344// struct list_head list;
345// struct bus_type *bus;
346// /* For general devices under the bus */
347// int (*find_device) (struct device *, ACPI_HANDLE *);
348// /* For bridges, such as PCI root bridge, IDE controller */
349// int (*find_bridge) (struct device *, ACPI_HANDLE *);
350//};
351//int register_acpi_bus_type(struct acpi_bus_type *);
352//int unregister_acpi_bus_type(struct acpi_bus_type *);
353//struct device *acpi_get_physical_device(ACPI_HANDLE);
354
359 struct pci_bus *bus;
362
363 UINT32 osc_support_set; /* _OSC state of support bits */
364 UINT32 osc_control_set; /* _OSC state of control bits */
365 UINT32 osc_control_qry; /* the latest _OSC query result */
366
367 UINT32 osc_queried:1; /* has _OSC control been queried? */
368};
369
370//static inline int acpi_pm_device_sleep_state(struct device *d, int *p)
371//{
372// if (p)
373// *p = ACPI_STATE_D0;
374// return ACPI_STATE_D3;
375//}
376//static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
377//{
378// return -1;
379//}
380
381/* system defines: move to bigger header */
383
390
391
392
393#endif /*__ACPI_BUS_H__*/
unsigned short UINT16
unsigned char BOOLEAN
unsigned char UINT8
unsigned int UINT32
int acpi_bus_register_driver(struct acpi_driver *driver)
Definition: bus.c:1029
int acpi_bus_generate_event(struct acpi_device *device, UINT8 type, int data)
Definition: bus.c:485
ACPI_STATUS acpi_suspend(UINT32 state)
Definition: system.c:347
ACPI_STATUS acpi_extract_package(ACPI_OBJECT *package, ACPI_BUFFER *format, ACPI_BUFFER *buffer)
Definition: utils.c:60
int acpi_bus_get_power(ACPI_HANDLE handle, int *state)
Definition: bus.c:198
int acpi_bus_trim(struct acpi_device *start, int rmdevice)
int(* acpi_op_remove)(struct acpi_device *device, int type)
Definition: acpi_bus.h:93
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
int acpi_init(void)
Definition: bus.c:1754
int acpi_bus_get_private_data(ACPI_HANDLE, void **)
Definition: bus.c:178
BOOLEAN acpi_bus_power_manageable(ACPI_HANDLE handle)
Definition: bus.c:351
char * acpi_hardware_id
Definition: acpi_bus.h:171
ACPI_STATUS acpi_bus_get_status_handle(ACPI_HANDLE handle, unsigned long long *sta)
Definition: bus.c:129
int(* acpi_op_add)(struct acpi_device *device)
Definition: acpi_bus.h:92
ACPI_STATUS acpi_evaluate_reference(ACPI_HANDLE handle, ACPI_STRING pathname, struct acpi_object_list *arguments, struct acpi_handle_list *list)
Definition: utils.c:277
#define ACPI_MAX_HANDLES
Definition: acpi_bus.h:35
int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, ACPI_HANDLE handle, int type)
Definition: bus.c:1130
ACPI_STATUS acpi_bus_get_ejd(ACPI_HANDLE handle, ACPI_HANDLE *ejd)
ACPI_STATUS acpi_evaluate_integer(ACPI_HANDLE handle, ACPI_STRING pathname, struct acpi_object_list *arguments, unsigned long long *data)
Definition: utils.c:242
char acpi_bus_id[8]
Definition: acpi_bus.h:169
char acpi_unique_id[9]
Definition: acpi_bus.h:172
void acpi_bus_data_handler(ACPI_HANDLE handle, void *context)
Definition: bus.c:95
enum acpi_irq_model_id acpi_irq_model
int acpi_bus_set_power(ACPI_HANDLE handle, int state)
Definition: bus.c:249
struct bus_type acpi_bus_type
unsigned long acpi_bus_address
Definition: acpi_bus.h:170
int acpi_match_device_ids(struct acpi_device *device, const struct acpi_pnp_device_id *ids)
int acpi_bus_get_status(struct acpi_device *device)
Definition: bus.c:147
acpi_bus_device_type
Definition: acpi_bus.h:70
@ ACPI_BUS_TYPE_THERMAL
Definition: acpi_bus.h:74
@ ACPI_BUS_TYPE_SLEEP_BUTTONF
Definition: acpi_bus.h:79
@ ACPI_BUS_TYPE_PROCESSOR
Definition: acpi_bus.h:73
@ ACPI_BUS_DEVICE_TYPE_COUNT
Definition: acpi_bus.h:80
@ ACPI_BUS_TYPE_DEVICE
Definition: acpi_bus.h:71
@ ACPI_BUS_TYPE_SLEEP_BUTTON
Definition: acpi_bus.h:77
@ ACPI_BUS_TYPE_SYSTEM
Definition: acpi_bus.h:75
@ ACPI_BUS_TYPE_POWER_BUTTON
Definition: acpi_bus.h:76
@ ACPI_BUS_TYPE_POWER
Definition: acpi_bus.h:72
@ ACPI_BUS_TYPE_POWER_BUTTONF
Definition: acpi_bus.h:78
int(* acpi_op_unbind)(struct acpi_device *device)
Definition: acpi_bus.h:99
NTSTATUS acpi_create_volatile_registry_tables(void)
Definition: utils.c:525
acpi_bus_removal_type
Definition: acpi_bus.h:63
@ ACPI_BUS_REMOVAL_TYPE_COUNT
Definition: acpi_bus.h:67
@ ACPI_BUS_REMOVAL_NORMAL
Definition: acpi_bus.h:64
@ ACPI_BUS_REMOVAL_EJECT
Definition: acpi_bus.h:65
@ ACPI_BUS_REMOVAL_SUPRISE
Definition: acpi_bus.h:66
acpi_irq_model_id
Definition: acpi_bus.h:384
@ ACPI_IRQ_MODEL_IOSAPIC
Definition: acpi_bus.h:387
@ ACPI_IRQ_MODEL_PIC
Definition: acpi_bus.h:385
@ ACPI_IRQ_MODEL_IOAPIC
Definition: acpi_bus.h:386
@ ACPI_IRQ_MODEL_COUNT
Definition: acpi_bus.h:388
int(* acpi_op_scan)(struct acpi_device *device)
Definition: acpi_bus.h:97
int(* acpi_op_start)(struct acpi_device *device)
Definition: acpi_bus.h:94
void acpi_bus_unregister_driver(struct acpi_driver *driver)
Definition: bus.c:1056
int(* acpi_op_resume)(struct acpi_device *device, int state)
Definition: acpi_bus.h:96
int(* acpi_op_suspend)(struct acpi_device *device, int state)
Definition: acpi_bus.h:95
int acpi_bus_start(struct acpi_device *device)
BOOLEAN acpi_bus_can_wakeup(ACPI_HANDLE handle)
Definition: bus.c:360
int acpi_bus_generate_proc_event(struct acpi_device *device, UINT8 type, int data)
#define acpi_device_class(d)
Definition: acpi_bus.h:191
#define acpi_device_name(d)
Definition: acpi_bus.h:190
int acpi_bus_receive_event(struct acpi_bus_event *event)
Definition: bus.c:513
int(* acpi_op_bind)(struct acpi_device *device)
Definition: acpi_bus.h:98
void(* acpi_op_notify)(struct acpi_device *device, UINT32 event)
Definition: acpi_bus.h:100
UINT64 ACPI_INTEGER
Definition: actypes.h:514
char * ACPI_STRING
Definition: actypes.h:462
UINT32 ACPI_STATUS
Definition: actypes.h:460
static int state
Definition: maze.c:121
LONG NTSTATUS
Definition: precomp.h:26
Definition: list.h:37
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
r parent
Definition: btrfs.c:3010
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
struct _cl_event * event
Definition: glext.h:7739
GLuint * ids
Definition: glext.h:5907
GLuint buffer
Definition: glext.h:5915
GLbitfield flags
Definition: glext.h:7161
GLuint id
Definition: glext.h:5910
Definition: pnp.idl:265
char pathname[512]
Definition: util.h:13
static HWND child
Definition: cursoricon.c:298
struct @1669::@1670 driver
UINT32 type
Definition: acpi_bus.h:306
UINT32 data
Definition: acpi_bus.h:307
acpi_device_class device_class
Definition: acpi_bus.h:304
acpi_bus_id bus_id
Definition: acpi_bus.h:305
UINT32 acpi_op_start
Definition: acpi_bus.h:104
UINT32 acpi_op_add
Definition: acpi_bus.h:103
UINT32 force_power_state
Definition: acpi_bus.h:163
UINT32 removable
Definition: acpi_bus.h:156
UINT32 unique_id
Definition: acpi_bus.h:155
UINT32 wake_capable
Definition: acpi_bus.h:162
UINT32 bus_address
Definition: acpi_bus.h:154
UINT32 performance_manageable
Definition: acpi_bus.h:161
UINT32 compatible_ids
Definition: acpi_bus.h:153
UINT32 surprise_removal_ok
Definition: acpi_bus.h:159
UINT32 ejectable
Definition: acpi_bus.h:157
UINT32 power_manageable
Definition: acpi_bus.h:160
UINT32 hardware_id
Definition: acpi_bus.h:152
UINT32 dynamic_status
Definition: acpi_bus.h:151
acpi_op_unbind unbind
Definition: acpi_bus.h:114
acpi_op_start start
Definition: acpi_bus.h:110
acpi_op_notify notify
Definition: acpi_bus.h:115
acpi_op_bind bind
Definition: acpi_bus.h:113
acpi_op_suspend suspend
Definition: acpi_bus.h:111
acpi_op_add add
Definition: acpi_bus.h:108
acpi_op_resume resume
Definition: acpi_bus.h:112
acpi_op_scan scan
Definition: acpi_bus.h:116
acpi_op_remove remove
Definition: acpi_bus.h:109
struct acpi_device_perf_state::@624 flags
struct acpi_device_perf_state * states
Definition: acpi_bus.h:242
acpi_unique_id unique_id
Definition: acpi_bus.h:181
acpi_hardware_id hardware_id
Definition: acpi_bus.h:179
acpi_bus_address bus_address
Definition: acpi_bus.h:178
ACPI_PNP_DEVICE_ID_LIST * cid_list
Definition: acpi_bus.h:180
acpi_device_name device_name
Definition: acpi_bus.h:182
acpi_bus_id bus_id
Definition: acpi_bus.h:177
acpi_device_class device_class
Definition: acpi_bus.h:183
struct acpi_handle_list resources
Definition: acpi_bus.h:212
struct acpi_device_power_state::@623 flags
struct acpi_device_power_state states[4]
Definition: acpi_bus.h:218
UINT32 battery_present
Definition: acpi_bus.h:143
ACPI_HANDLE gpe_device
Definition: acpi_bus.h:256
struct acpi_handle_list resources
Definition: acpi_bus.h:259
ACPI_INTEGER gpe_number
Definition: acpi_bus.h:257
struct acpi_device_wakeup_state state
Definition: acpi_bus.h:260
ACPI_INTEGER sleep_state
Definition: acpi_bus.h:258
struct acpi_device_power power
Definition: acpi_bus.h:278
void * driver_data
Definition: acpi_bus.h:283
struct list_head children
Definition: acpi_bus.h:272
struct acpi_device_ops ops
Definition: acpi_bus.h:281
int device_type
Definition: acpi_bus.h:269
struct list_head wakeup_list
Definition: acpi_bus.h:274
struct acpi_device_perf performance
Definition: acpi_bus.h:280
struct acpi_bus_ops bus_ops
Definition: acpi_bus.h:284
struct acpi_device * parent
Definition: acpi_bus.h:271
struct acpi_device_wakeup wakeup
Definition: acpi_bus.h:279
struct acpi_driver * driver
Definition: acpi_bus.h:282
ACPI_HANDLE handle
Definition: acpi_bus.h:270
enum acpi_bus_removal_type removal_type
Definition: acpi_bus.h:285
struct acpi_device_ops ops
Definition: acpi_bus.h:128
unsigned int flags
Definition: acpi_bus.h:126
int references
Definition: acpi_bus.h:125
char * ids
Definition: acpi_bus.h:127
UINT32 count
Definition: acpi_bus.h:37
ACPI_HANDLE handles[ACPI_MAX_HANDLES]
Definition: acpi_bus.h:38
struct pci_bus * bus
Definition: acpi_bus.h:359
struct acpi_device * device
Definition: acpi_bus.h:357
UINT32 osc_queried
Definition: acpi_bus.h:367
UINT32 osc_control_set
Definition: acpi_bus.h:364
UINT32 osc_control_qry
Definition: acpi_bus.h:365
UINT16 segment
Definition: acpi_bus.h:360
UINT8 bus_nr
Definition: acpi_bus.h:361
UINT32 osc_support_set
Definition: acpi_bus.h:363
Definition: http.c:7252
Definition: devices.h:37
Definition: list.h:15
Definition: name.c:39
Definition: ps.c:97
Definition: dlist.c:348