acpi_bus.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  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. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. */
  21. #ifndef __ACPI_BUS_H__
  22. #define __ACPI_BUS_H__
  23. #include <linux/device.h>
  24. #include <linux/property.h>
  25. /* TBD: Make dynamic */
  26. #define ACPI_MAX_HANDLES 10
  27. struct acpi_handle_list {
  28. u32 count;
  29. acpi_handle handles[ACPI_MAX_HANDLES];
  30. };
  31. /* acpi_utils.h */
  32. acpi_status
  33. acpi_extract_package(union acpi_object *package,
  34. struct acpi_buffer *format, struct acpi_buffer *buffer);
  35. acpi_status
  36. acpi_evaluate_integer(acpi_handle handle,
  37. acpi_string pathname,
  38. struct acpi_object_list *arguments, unsigned long long *data);
  39. acpi_status
  40. acpi_evaluate_reference(acpi_handle handle,
  41. acpi_string pathname,
  42. struct acpi_object_list *arguments,
  43. struct acpi_handle_list *list);
  44. acpi_status
  45. acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
  46. struct acpi_buffer *status_buf);
  47. acpi_status
  48. acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
  49. bool acpi_has_method(acpi_handle handle, char *name);
  50. acpi_status acpi_execute_simple_method(acpi_handle handle, char *method,
  51. u64 arg);
  52. acpi_status acpi_evaluate_ej0(acpi_handle handle);
  53. acpi_status acpi_evaluate_lck(acpi_handle handle, int lock);
  54. bool acpi_ata_match(acpi_handle handle);
  55. bool acpi_bay_match(acpi_handle handle);
  56. bool acpi_dock_match(acpi_handle handle);
  57. bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs);
  58. union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
  59. int rev, int func, union acpi_object *argv4);
  60. static inline union acpi_object *
  61. acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func,
  62. union acpi_object *argv4, acpi_object_type type)
  63. {
  64. union acpi_object *obj;
  65. obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
  66. if (obj && obj->type != type) {
  67. ACPI_FREE(obj);
  68. obj = NULL;
  69. }
  70. return obj;
  71. }
  72. #define ACPI_INIT_DSM_ARGV4(cnt, eles) \
  73. { \
  74. .package.type = ACPI_TYPE_PACKAGE, \
  75. .package.count = (cnt), \
  76. .package.elements = (eles) \
  77. }
  78. #ifdef CONFIG_ACPI
  79. #include <linux/proc_fs.h>
  80. #define ACPI_BUS_FILE_ROOT "acpi"
  81. extern struct proc_dir_entry *acpi_root_dir;
  82. enum acpi_bus_device_type {
  83. ACPI_BUS_TYPE_DEVICE = 0,
  84. ACPI_BUS_TYPE_POWER,
  85. ACPI_BUS_TYPE_PROCESSOR,
  86. ACPI_BUS_TYPE_THERMAL,
  87. ACPI_BUS_TYPE_POWER_BUTTON,
  88. ACPI_BUS_TYPE_SLEEP_BUTTON,
  89. ACPI_BUS_DEVICE_TYPE_COUNT
  90. };
  91. struct acpi_driver;
  92. struct acpi_device;
  93. /*
  94. * ACPI Scan Handler
  95. * -----------------
  96. */
  97. struct acpi_hotplug_profile {
  98. struct kobject kobj;
  99. int (*scan_dependent)(struct acpi_device *adev);
  100. void (*notify_online)(struct acpi_device *adev);
  101. bool enabled:1;
  102. bool demand_offline:1;
  103. };
  104. static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
  105. struct kobject *kobj)
  106. {
  107. return container_of(kobj, struct acpi_hotplug_profile, kobj);
  108. }
  109. struct acpi_scan_handler {
  110. const struct acpi_device_id *ids;
  111. struct list_head list_node;
  112. bool (*match)(const char *idstr, const struct acpi_device_id **matchid);
  113. int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
  114. void (*detach)(struct acpi_device *dev);
  115. void (*bind)(struct device *phys_dev);
  116. void (*unbind)(struct device *phys_dev);
  117. struct acpi_hotplug_profile hotplug;
  118. };
  119. /*
  120. * ACPI Hotplug Context
  121. * --------------------
  122. */
  123. struct acpi_hotplug_context {
  124. struct acpi_device *self;
  125. int (*notify)(struct acpi_device *, u32);
  126. void (*uevent)(struct acpi_device *, u32);
  127. void (*fixup)(struct acpi_device *);
  128. };
  129. /*
  130. * ACPI Driver
  131. * -----------
  132. */
  133. typedef int (*acpi_op_add) (struct acpi_device * device);
  134. typedef int (*acpi_op_remove) (struct acpi_device * device);
  135. typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
  136. struct acpi_device_ops {
  137. acpi_op_add add;
  138. acpi_op_remove remove;
  139. acpi_op_notify notify;
  140. };
  141. #define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */
  142. struct acpi_driver {
  143. char name[80];
  144. char class[80];
  145. const struct acpi_device_id *ids; /* Supported Hardware IDs */
  146. unsigned int flags;
  147. struct acpi_device_ops ops;
  148. struct device_driver drv;
  149. struct module *owner;
  150. };
  151. /*
  152. * ACPI Device
  153. * -----------
  154. */
  155. /* Status (_STA) */
  156. struct acpi_device_status {
  157. u32 present:1;
  158. u32 enabled:1;
  159. u32 show_in_ui:1;
  160. u32 functional:1;
  161. u32 battery_present:1;
  162. u32 reserved:27;
  163. };
  164. /* Flags */
  165. struct acpi_device_flags {
  166. u32 dynamic_status:1;
  167. u32 removable:1;
  168. u32 ejectable:1;
  169. u32 power_manageable:1;
  170. u32 match_driver:1;
  171. u32 initialized:1;
  172. u32 visited:1;
  173. u32 hotplug_notify:1;
  174. u32 is_dock_station:1;
  175. u32 of_compatible_ok:1;
  176. u32 coherent_dma:1;
  177. u32 cca_seen:1;
  178. u32 reserved:20;
  179. };
  180. /* File System */
  181. struct acpi_device_dir {
  182. struct proc_dir_entry *entry;
  183. };
  184. #define acpi_device_dir(d) ((d)->dir.entry)
  185. /* Plug and Play */
  186. typedef char acpi_bus_id[8];
  187. typedef unsigned long acpi_bus_address;
  188. typedef char acpi_device_name[40];
  189. typedef char acpi_device_class[20];
  190. struct acpi_hardware_id {
  191. struct list_head list;
  192. const char *id;
  193. };
  194. struct acpi_pnp_type {
  195. u32 hardware_id:1;
  196. u32 bus_address:1;
  197. u32 platform_id:1;
  198. u32 reserved:29;
  199. };
  200. struct acpi_device_pnp {
  201. acpi_bus_id bus_id; /* Object name */
  202. struct acpi_pnp_type type; /* ID type */
  203. acpi_bus_address bus_address; /* _ADR */
  204. char *unique_id; /* _UID */
  205. struct list_head ids; /* _HID and _CIDs */
  206. acpi_device_name device_name; /* Driver-determined */
  207. acpi_device_class device_class; /* " */
  208. union acpi_object *str_obj; /* unicode string for _STR method */
  209. };
  210. #define acpi_device_bid(d) ((d)->pnp.bus_id)
  211. #define acpi_device_adr(d) ((d)->pnp.bus_address)
  212. const char *acpi_device_hid(struct acpi_device *device);
  213. #define acpi_device_uid(d) ((d)->pnp.unique_id)
  214. #define acpi_device_name(d) ((d)->pnp.device_name)
  215. #define acpi_device_class(d) ((d)->pnp.device_class)
  216. /* Power Management */
  217. struct acpi_device_power_flags {
  218. u32 explicit_get:1; /* _PSC present? */
  219. u32 power_resources:1; /* Power resources */
  220. u32 inrush_current:1; /* Serialize Dx->D0 */
  221. u32 power_removed:1; /* Optimize Dx->D0 */
  222. u32 ignore_parent:1; /* Power is independent of parent power state */
  223. u32 dsw_present:1; /* _DSW present? */
  224. u32 reserved:26;
  225. };
  226. struct acpi_device_power_state {
  227. struct {
  228. u8 valid:1;
  229. u8 explicit_set:1; /* _PSx present? */
  230. u8 reserved:6;
  231. } flags;
  232. int power; /* % Power (compared to D0) */
  233. int latency; /* Dx->D0 time (microseconds) */
  234. struct list_head resources; /* Power resources referenced */
  235. };
  236. struct acpi_device_power {
  237. int state; /* Current state */
  238. struct acpi_device_power_flags flags;
  239. struct acpi_device_power_state states[ACPI_D_STATE_COUNT]; /* Power states (D0-D3Cold) */
  240. };
  241. /* Performance Management */
  242. struct acpi_device_perf_flags {
  243. u8 reserved:8;
  244. };
  245. struct acpi_device_perf_state {
  246. struct {
  247. u8 valid:1;
  248. u8 reserved:7;
  249. } flags;
  250. u8 power; /* % Power (compared to P0) */
  251. u8 performance; /* % Performance ( " ) */
  252. int latency; /* Px->P0 time (microseconds) */
  253. };
  254. struct acpi_device_perf {
  255. int state;
  256. struct acpi_device_perf_flags flags;
  257. int state_count;
  258. struct acpi_device_perf_state *states;
  259. };
  260. /* Wakeup Management */
  261. struct acpi_device_wakeup_flags {
  262. u8 valid:1; /* Can successfully enable wakeup? */
  263. u8 run_wake:1; /* Run-Wake GPE devices */
  264. u8 notifier_present:1; /* Wake-up notify handler has been installed */
  265. u8 enabled:1; /* Enabled for wakeup */
  266. };
  267. struct acpi_device_wakeup_context {
  268. struct work_struct work;
  269. struct device *dev;
  270. };
  271. struct acpi_device_wakeup {
  272. acpi_handle gpe_device;
  273. u64 gpe_number;
  274. u64 sleep_state;
  275. struct list_head resources;
  276. struct acpi_device_wakeup_flags flags;
  277. struct acpi_device_wakeup_context context;
  278. struct wakeup_source *ws;
  279. int prepare_count;
  280. };
  281. struct acpi_device_physical_node {
  282. unsigned int node_id;
  283. struct list_head node;
  284. struct device *dev;
  285. bool put_online:1;
  286. };
  287. /* ACPI Device Specific Data (_DSD) */
  288. struct acpi_device_data {
  289. const union acpi_object *pointer;
  290. const union acpi_object *properties;
  291. const union acpi_object *of_compatible;
  292. struct list_head subnodes;
  293. };
  294. struct acpi_gpio_mapping;
  295. /* Device */
  296. struct acpi_device {
  297. int device_type;
  298. acpi_handle handle; /* no handle for fixed hardware */
  299. struct fwnode_handle fwnode;
  300. struct acpi_device *parent;
  301. struct list_head children;
  302. struct list_head node;
  303. struct list_head wakeup_list;
  304. struct list_head del_list;
  305. struct acpi_device_status status;
  306. struct acpi_device_flags flags;
  307. struct acpi_device_pnp pnp;
  308. struct acpi_device_power power;
  309. struct acpi_device_wakeup wakeup;
  310. struct acpi_device_perf performance;
  311. struct acpi_device_dir dir;
  312. struct acpi_device_data data;
  313. struct acpi_scan_handler *handler;
  314. struct acpi_hotplug_context *hp;
  315. struct acpi_driver *driver;
  316. const struct acpi_gpio_mapping *driver_gpios;
  317. void *driver_data;
  318. struct device dev;
  319. unsigned int physical_node_count;
  320. unsigned int dep_unmet;
  321. struct list_head physical_node_list;
  322. struct mutex physical_node_lock;
  323. void (*remove)(struct acpi_device *);
  324. };
  325. /* Non-device subnode */
  326. struct acpi_data_node {
  327. const char *name;
  328. acpi_handle handle;
  329. struct fwnode_handle fwnode;
  330. struct acpi_device_data data;
  331. struct list_head sibling;
  332. struct kobject kobj;
  333. struct completion kobj_done;
  334. };
  335. static inline bool is_acpi_node(struct fwnode_handle *fwnode)
  336. {
  337. return fwnode && (fwnode->type == FWNODE_ACPI
  338. || fwnode->type == FWNODE_ACPI_DATA);
  339. }
  340. static inline bool is_acpi_device_node(struct fwnode_handle *fwnode)
  341. {
  342. return fwnode && fwnode->type == FWNODE_ACPI;
  343. }
  344. static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode)
  345. {
  346. return is_acpi_device_node(fwnode) ?
  347. container_of(fwnode, struct acpi_device, fwnode) : NULL;
  348. }
  349. static inline bool is_acpi_data_node(struct fwnode_handle *fwnode)
  350. {
  351. return fwnode && fwnode->type == FWNODE_ACPI_DATA;
  352. }
  353. static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode)
  354. {
  355. return is_acpi_data_node(fwnode) ?
  356. container_of(fwnode, struct acpi_data_node, fwnode) : NULL;
  357. }
  358. static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
  359. {
  360. return &adev->fwnode;
  361. }
  362. static inline void *acpi_driver_data(struct acpi_device *d)
  363. {
  364. return d->driver_data;
  365. }
  366. #define to_acpi_device(d) container_of(d, struct acpi_device, dev)
  367. #define to_acpi_driver(d) container_of(d, struct acpi_driver, drv)
  368. static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta)
  369. {
  370. *((u32 *)&adev->status) = sta;
  371. }
  372. static inline void acpi_set_hp_context(struct acpi_device *adev,
  373. struct acpi_hotplug_context *hp)
  374. {
  375. hp->self = adev;
  376. adev->hp = hp;
  377. }
  378. void acpi_initialize_hp_context(struct acpi_device *adev,
  379. struct acpi_hotplug_context *hp,
  380. int (*notify)(struct acpi_device *, u32),
  381. void (*uevent)(struct acpi_device *, u32));
  382. /* acpi_device.dev.bus == &acpi_bus_type */
  383. extern struct bus_type acpi_bus_type;
  384. /*
  385. * Events
  386. * ------
  387. */
  388. struct acpi_bus_event {
  389. struct list_head node;
  390. acpi_device_class device_class;
  391. acpi_bus_id bus_id;
  392. u32 type;
  393. u32 data;
  394. };
  395. extern struct kobject *acpi_kobj;
  396. extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
  397. void acpi_bus_private_data_handler(acpi_handle, void *);
  398. int acpi_bus_get_private_data(acpi_handle, void **);
  399. int acpi_bus_attach_private_data(acpi_handle, void *);
  400. void acpi_bus_detach_private_data(acpi_handle);
  401. extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
  402. extern int register_acpi_notifier(struct notifier_block *);
  403. extern int unregister_acpi_notifier(struct notifier_block *);
  404. /*
  405. * External Functions
  406. */
  407. int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
  408. struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle);
  409. void acpi_bus_put_acpi_device(struct acpi_device *adev);
  410. acpi_status acpi_bus_get_status_handle(acpi_handle handle,
  411. unsigned long long *sta);
  412. int acpi_bus_get_status(struct acpi_device *device);
  413. int acpi_bus_set_power(acpi_handle handle, int state);
  414. const char *acpi_power_state_string(int state);
  415. int acpi_device_get_power(struct acpi_device *device, int *state);
  416. int acpi_device_set_power(struct acpi_device *device, int state);
  417. int acpi_bus_init_power(struct acpi_device *device);
  418. int acpi_device_fix_up_power(struct acpi_device *device);
  419. int acpi_bus_update_power(acpi_handle handle, int *state_p);
  420. int acpi_device_update_power(struct acpi_device *device, int *state_p);
  421. bool acpi_bus_power_manageable(acpi_handle handle);
  422. #ifdef CONFIG_PM
  423. bool acpi_bus_can_wakeup(acpi_handle handle);
  424. #else
  425. static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; }
  426. #endif
  427. void acpi_scan_lock_acquire(void);
  428. void acpi_scan_lock_release(void);
  429. void acpi_lock_hp_context(void);
  430. void acpi_unlock_hp_context(void);
  431. int acpi_scan_add_handler(struct acpi_scan_handler *handler);
  432. int acpi_bus_register_driver(struct acpi_driver *driver);
  433. void acpi_bus_unregister_driver(struct acpi_driver *driver);
  434. int acpi_bus_scan(acpi_handle handle);
  435. void acpi_bus_trim(struct acpi_device *start);
  436. acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
  437. int acpi_match_device_ids(struct acpi_device *device,
  438. const struct acpi_device_id *ids);
  439. int acpi_create_dir(struct acpi_device *);
  440. void acpi_remove_dir(struct acpi_device *);
  441. static inline bool acpi_device_enumerated(struct acpi_device *adev)
  442. {
  443. return adev && adev->flags.initialized && adev->flags.visited;
  444. }
  445. /**
  446. * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver
  447. * @__acpi_driver: acpi_driver struct
  448. *
  449. * Helper macro for ACPI drivers which do not do anything special in module
  450. * init/exit. This eliminates a lot of boilerplate. Each module may only
  451. * use this macro once, and calling it replaces module_init() and module_exit()
  452. */
  453. #define module_acpi_driver(__acpi_driver) \
  454. module_driver(__acpi_driver, acpi_bus_register_driver, \
  455. acpi_bus_unregister_driver)
  456. /*
  457. * Bind physical devices with ACPI devices
  458. */
  459. struct acpi_bus_type {
  460. struct list_head list;
  461. const char *name;
  462. bool (*match)(struct device *dev);
  463. struct acpi_device * (*find_companion)(struct device *);
  464. void (*setup)(struct device *);
  465. void (*cleanup)(struct device *);
  466. };
  467. int register_acpi_bus_type(struct acpi_bus_type *);
  468. int unregister_acpi_bus_type(struct acpi_bus_type *);
  469. int acpi_bind_one(struct device *dev, struct acpi_device *adev);
  470. int acpi_unbind_one(struct device *dev);
  471. struct acpi_pci_root {
  472. struct acpi_device * device;
  473. struct pci_bus *bus;
  474. u16 segment;
  475. struct resource secondary; /* downstream bus range */
  476. u32 osc_support_set; /* _OSC state of support bits */
  477. u32 osc_control_set; /* _OSC state of control bits */
  478. phys_addr_t mcfg_addr;
  479. };
  480. /* helper */
  481. bool acpi_dma_supported(struct acpi_device *adev);
  482. enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev);
  483. struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
  484. u64 address, bool check_children);
  485. int acpi_is_root_bridge(acpi_handle);
  486. struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
  487. int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
  488. int acpi_disable_wakeup_device_power(struct acpi_device *dev);
  489. #ifdef CONFIG_PM
  490. acpi_status acpi_add_pm_notifier(struct acpi_device *adev, struct device *dev,
  491. void (*work_func)(struct work_struct *work));
  492. acpi_status acpi_remove_pm_notifier(struct acpi_device *adev);
  493. int acpi_pm_device_sleep_state(struct device *, int *, int);
  494. int acpi_pm_device_run_wake(struct device *, bool);
  495. #else
  496. static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
  497. struct device *dev,
  498. void (*work_func)(struct work_struct *work))
  499. {
  500. return AE_SUPPORT;
  501. }
  502. static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev)
  503. {
  504. return AE_SUPPORT;
  505. }
  506. static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
  507. {
  508. if (p)
  509. *p = ACPI_STATE_D0;
  510. return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ?
  511. m : ACPI_STATE_D0;
  512. }
  513. static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
  514. {
  515. return -ENODEV;
  516. }
  517. #endif
  518. #ifdef CONFIG_PM_SLEEP
  519. int acpi_pm_device_sleep_wake(struct device *, bool);
  520. #else
  521. static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
  522. {
  523. return -ENODEV;
  524. }
  525. #endif
  526. #ifdef CONFIG_ACPI_SLEEP
  527. u32 acpi_target_system_state(void);
  528. #else
  529. static inline u32 acpi_target_system_state(void) { return ACPI_STATE_S0; }
  530. #endif
  531. static inline bool acpi_device_power_manageable(struct acpi_device *adev)
  532. {
  533. return adev->flags.power_manageable;
  534. }
  535. static inline bool acpi_device_can_wakeup(struct acpi_device *adev)
  536. {
  537. return adev->wakeup.flags.valid;
  538. }
  539. static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
  540. {
  541. return adev->power.states[ACPI_STATE_D3_COLD].flags.valid;
  542. }
  543. #else /* CONFIG_ACPI */
  544. static inline int register_acpi_bus_type(void *bus) { return 0; }
  545. static inline int unregister_acpi_bus_type(void *bus) { return 0; }
  546. #endif /* CONFIG_ACPI */
  547. #endif /*__ACPI_BUS_H__*/