26 #ifndef __ACPI_BUS_H__
27 #define __ACPI_BUS_H__
29 #include <linux/device.h>
34 #define ACPI_MAX_HANDLES 10
63 #define ACPI_BUS_FILE_ROOT "acpi"
66 enum acpi_bus_removal_type {
67 ACPI_BUS_REMOVAL_NORMAL = 0,
68 ACPI_BUS_REMOVAL_EJECT,
69 ACPI_BUS_REMOVAL_SUPRISE,
70 ACPI_BUS_REMOVAL_TYPE_COUNT
73 enum acpi_bus_device_type {
74 ACPI_BUS_TYPE_DEVICE = 0,
76 ACPI_BUS_TYPE_PROCESSOR,
77 ACPI_BUS_TYPE_THERMAL,
78 ACPI_BUS_TYPE_POWER_BUTTON,
79 ACPI_BUS_TYPE_SLEEP_BUTTON,
80 ACPI_BUS_DEVICE_TYPE_COUNT
91 typedef int (*acpi_op_add) (
struct acpi_device *
device);
92 typedef int (*acpi_op_remove) (
struct acpi_device *
device,
int type);
93 typedef int (*acpi_op_start) (
struct acpi_device *
device);
94 typedef int (*acpi_op_bind) (
struct acpi_device *
device);
95 typedef int (*acpi_op_unbind) (
struct acpi_device *
device);
103 struct acpi_device_ops {
105 acpi_op_remove
remove;
108 acpi_op_unbind unbind;
112 #define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1
119 struct acpi_device_ops
ops;
131 struct acpi_device_status {
136 u32 battery_present:1;
142 struct acpi_device_flags {
143 u32 dynamic_status:1;
148 u32 suprise_removal_ok:1;
149 u32 power_manageable:1;
150 u32 performance_manageable:1;
157 struct acpi_device_dir {
161 #define acpi_device_dir(d) ((d)->dir.entry)
165 typedef char acpi_bus_id[8];
166 typedef unsigned long acpi_bus_address;
167 typedef char acpi_device_name[40];
168 typedef char acpi_device_class[20];
170 struct acpi_hardware_id {
175 struct acpi_device_pnp {
177 acpi_bus_address bus_address;
181 acpi_device_class device_class;
185 #define acpi_device_bid(d) ((d)->pnp.bus_id)
186 #define acpi_device_adr(d) ((d)->pnp.bus_address)
188 #define acpi_device_name(d) ((d)->pnp.device_name)
189 #define acpi_device_class(d) ((d)->pnp.device_class)
193 struct acpi_device_power_flags {
195 u32 power_resources:1;
196 u32 inrush_current:1;
201 struct acpi_device_power_state {
212 struct acpi_device_power {
214 struct acpi_device_power_flags
flags;
220 struct acpi_device_perf_flags {
224 struct acpi_device_perf_state {
234 struct acpi_device_perf {
236 struct acpi_device_perf_flags
flags;
238 struct acpi_device_perf_state *states;
242 struct acpi_device_wakeup_flags {
245 u8 notifier_present:1;
248 struct acpi_device_wakeup {
253 struct acpi_device_wakeup_flags
flags;
257 struct acpi_device_physical_node {
264 #define ACPI_MAX_PHYSICAL_NODE 32
270 struct acpi_device *
parent;
274 struct acpi_device_status
status;
275 struct acpi_device_flags
flags;
276 struct acpi_device_pnp pnp;
277 struct acpi_device_power power;
278 struct acpi_device_wakeup wakeup;
279 struct acpi_device_perf performance;
280 struct acpi_device_dir
dir;
281 struct acpi_device_ops
ops;
282 struct acpi_driver *
driver;
285 struct acpi_bus_ops bus_ops;
286 enum acpi_bus_removal_type removal_type;
287 u8 physical_node_count;
289 struct mutex physical_node_lock;
293 static inline void *acpi_driver_data(
struct acpi_device *
d)
295 return d->driver_data;
298 #define to_acpi_device(d) container_of(d, struct acpi_device, dev)
299 #define to_acpi_driver(d) container_of(d, struct acpi_driver, drv)
309 struct acpi_bus_event {
311 acpi_device_class device_class;
317 struct acpi_eject_event {
339 unsigned long long *sta);
347 #ifdef CONFIG_ACPI_PROC_EVENT
348 int acpi_bus_generate_proc_event(
struct acpi_device *
device,
u8 type,
int data);
349 int acpi_bus_generate_proc_event4(
const char *
class,
const char *
bid,
u8 type,
int data);
350 int acpi_bus_receive_event(
struct acpi_bus_event *
event);
352 static inline int acpi_bus_generate_proc_event(
struct acpi_device *
device,
u8 type,
int data)
365 int acpi_create_dir(
struct acpi_device *);
366 void acpi_remove_dir(
struct acpi_device *);
377 #define module_acpi_driver(__acpi_driver) \
378 module_driver(__acpi_driver, acpi_bus_register_driver, \
379 acpi_bus_unregister_driver)
395 struct acpi_pci_root {
397 struct acpi_device *
device;
413 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
419 int acpi_pm_device_sleep_state(
struct device *,
int *,
int);
421 static inline int acpi_pm_device_sleep_state(
struct device *
d,
int *
p,
int m)
429 #ifdef CONFIG_PM_SLEEP
430 int acpi_pm_device_run_wake(
struct device *,
bool);
431 int acpi_pm_device_sleep_wake(
struct device *,
bool);
433 static inline int acpi_pm_device_run_wake(
struct device *
dev,
bool enable)
437 static inline int acpi_pm_device_sleep_wake(
struct device *
dev,
bool enable)