aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/acpi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r--include/linux/acpi.h135
1 files changed, 134 insertions, 1 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 90be98981102..c33fa3ce9b7c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -25,7 +25,9 @@
25#ifndef _LINUX_ACPI_H 25#ifndef _LINUX_ACPI_H
26#define _LINUX_ACPI_H 26#define _LINUX_ACPI_H
27 27
28#include <linux/errno.h>
28#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h>
29 31
30#ifdef CONFIG_ACPI 32#ifdef CONFIG_ACPI
31 33
@@ -250,6 +252,26 @@ extern int pnpacpi_disabled;
250 252
251#define PXM_INVAL (-1) 253#define PXM_INVAL (-1)
252 254
255bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res);
256bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res);
257bool acpi_dev_resource_address_space(struct acpi_resource *ares,
258 struct resource *res);
259bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
260 struct resource *res);
261unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
262bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
263 struct resource *res);
264
265struct resource_list_entry {
266 struct list_head node;
267 struct resource res;
268};
269
270void acpi_dev_free_resource_list(struct list_head *list);
271int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
272 int (*preproc)(struct acpi_resource *, void *),
273 void *preproc_data);
274
253int acpi_check_resource_conflict(const struct resource *res); 275int acpi_check_resource_conflict(const struct resource *res);
254 276
255int acpi_check_region(resource_size_t start, resource_size_t n, 277int acpi_check_region(resource_size_t start, resource_size_t n,
@@ -257,10 +279,14 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
257 279
258int acpi_resources_are_enforced(void); 280int acpi_resources_are_enforced(void);
259 281
260#ifdef CONFIG_PM_SLEEP 282#ifdef CONFIG_HIBERNATION
261void __init acpi_no_s4_hw_signature(void); 283void __init acpi_no_s4_hw_signature(void);
284#endif
285
286#ifdef CONFIG_PM_SLEEP
262void __init acpi_old_suspend_ordering(void); 287void __init acpi_old_suspend_ordering(void);
263void __init acpi_nvs_nosave(void); 288void __init acpi_nvs_nosave(void);
289void __init acpi_nvs_nosave_s3(void);
264#endif /* CONFIG_PM_SLEEP */ 290#endif /* CONFIG_PM_SLEEP */
265 291
266struct acpi_osc_context { 292struct acpi_osc_context {
@@ -364,6 +390,17 @@ extern int acpi_nvs_register(__u64 start, __u64 size);
364extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), 390extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
365 void *data); 391 void *data);
366 392
393const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
394 const struct device *dev);
395
396static inline bool acpi_driver_match_device(struct device *dev,
397 const struct device_driver *drv)
398{
399 return !!acpi_match_device(drv->acpi_match_table, dev);
400}
401
402#define ACPI_PTR(_ptr) (_ptr)
403
367#else /* !CONFIG_ACPI */ 404#else /* !CONFIG_ACPI */
368 405
369#define acpi_disabled 1 406#define acpi_disabled 1
@@ -418,6 +455,22 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
418 return 0; 455 return 0;
419} 456}
420 457
458struct acpi_device_id;
459
460static inline const struct acpi_device_id *acpi_match_device(
461 const struct acpi_device_id *ids, const struct device *dev)
462{
463 return NULL;
464}
465
466static inline bool acpi_driver_match_device(struct device *dev,
467 const struct device_driver *drv)
468{
469 return false;
470}
471
472#define ACPI_PTR(_ptr) (NULL)
473
421#endif /* !CONFIG_ACPI */ 474#endif /* !CONFIG_ACPI */
422 475
423#ifdef CONFIG_ACPI 476#ifdef CONFIG_ACPI
@@ -430,4 +483,84 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state,
430#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) 483#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
431#endif 484#endif
432 485
486#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
487int acpi_dev_runtime_suspend(struct device *dev);
488int acpi_dev_runtime_resume(struct device *dev);
489int acpi_subsys_runtime_suspend(struct device *dev);
490int acpi_subsys_runtime_resume(struct device *dev);
491#else
492static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
493static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
494static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
495static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
496#endif
497
498#ifdef CONFIG_ACPI_SLEEP
499int acpi_dev_suspend_late(struct device *dev);
500int acpi_dev_resume_early(struct device *dev);
501int acpi_subsys_prepare(struct device *dev);
502int acpi_subsys_suspend_late(struct device *dev);
503int acpi_subsys_resume_early(struct device *dev);
504#else
505static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
506static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
507static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
508static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
509static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
510#endif
511
512#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
513int acpi_dev_pm_attach(struct device *dev, bool power_on);
514void acpi_dev_pm_detach(struct device *dev, bool power_off);
515#else
516static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
517{
518 return -ENODEV;
519}
520static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
521#endif
522
523#ifdef CONFIG_ACPI
524__printf(3, 4)
525void acpi_handle_printk(const char *level, acpi_handle handle,
526 const char *fmt, ...);
527#else /* !CONFIG_ACPI */
528static inline __printf(3, 4) void
529acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
530#endif /* !CONFIG_ACPI */
531
532/*
533 * acpi_handle_<level>: Print message with ACPI prefix and object path
534 *
535 * These interfaces acquire the global namespace mutex to obtain an object
536 * path. In interrupt context, it shows the object path as <n/a>.
537 */
538#define acpi_handle_emerg(handle, fmt, ...) \
539 acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__)
540#define acpi_handle_alert(handle, fmt, ...) \
541 acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__)
542#define acpi_handle_crit(handle, fmt, ...) \
543 acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__)
544#define acpi_handle_err(handle, fmt, ...) \
545 acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
546#define acpi_handle_warn(handle, fmt, ...) \
547 acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__)
548#define acpi_handle_notice(handle, fmt, ...) \
549 acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__)
550#define acpi_handle_info(handle, fmt, ...) \
551 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
552
553/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */
554#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
555#define acpi_handle_debug(handle, fmt, ...) \
556 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
557#else
558#define acpi_handle_debug(handle, fmt, ...) \
559({ \
560 if (0) \
561 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \
562 0; \
563})
564#endif
565
433#endif /*_LINUX_ACPI_H*/ 566#endif /*_LINUX_ACPI_H*/