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.h151
1 files changed, 150 insertions, 1 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 90be98981102..3994d7790b23 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
@@ -76,6 +78,14 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
76 78
77typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
78 80
81#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
82void acpi_initrd_override(void *data, size_t size);
83#else
84static inline void acpi_initrd_override(void *data, size_t size)
85{
86}
87#endif
88
79char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 89char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
80void __acpi_unmap_table(char *map, unsigned long size); 90void __acpi_unmap_table(char *map, unsigned long size);
81int early_acpi_boot_init(void); 91int early_acpi_boot_init(void);
@@ -250,6 +260,26 @@ extern int pnpacpi_disabled;
250 260
251#define PXM_INVAL (-1) 261#define PXM_INVAL (-1)
252 262
263bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res);
264bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res);
265bool acpi_dev_resource_address_space(struct acpi_resource *ares,
266 struct resource *res);
267bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
268 struct resource *res);
269unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
270bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
271 struct resource *res);
272
273struct resource_list_entry {
274 struct list_head node;
275 struct resource res;
276};
277
278void acpi_dev_free_resource_list(struct list_head *list);
279int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list,
280 int (*preproc)(struct acpi_resource *, void *),
281 void *preproc_data);
282
253int acpi_check_resource_conflict(const struct resource *res); 283int acpi_check_resource_conflict(const struct resource *res);
254 284
255int acpi_check_region(resource_size_t start, resource_size_t n, 285int acpi_check_region(resource_size_t start, resource_size_t n,
@@ -257,10 +287,14 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
257 287
258int acpi_resources_are_enforced(void); 288int acpi_resources_are_enforced(void);
259 289
260#ifdef CONFIG_PM_SLEEP 290#ifdef CONFIG_HIBERNATION
261void __init acpi_no_s4_hw_signature(void); 291void __init acpi_no_s4_hw_signature(void);
292#endif
293
294#ifdef CONFIG_PM_SLEEP
262void __init acpi_old_suspend_ordering(void); 295void __init acpi_old_suspend_ordering(void);
263void __init acpi_nvs_nosave(void); 296void __init acpi_nvs_nosave(void);
297void __init acpi_nvs_nosave_s3(void);
264#endif /* CONFIG_PM_SLEEP */ 298#endif /* CONFIG_PM_SLEEP */
265 299
266struct acpi_osc_context { 300struct acpi_osc_context {
@@ -364,6 +398,17 @@ extern int acpi_nvs_register(__u64 start, __u64 size);
364extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), 398extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
365 void *data); 399 void *data);
366 400
401const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
402 const struct device *dev);
403
404static inline bool acpi_driver_match_device(struct device *dev,
405 const struct device_driver *drv)
406{
407 return !!acpi_match_device(drv->acpi_match_table, dev);
408}
409
410#define ACPI_PTR(_ptr) (_ptr)
411
367#else /* !CONFIG_ACPI */ 412#else /* !CONFIG_ACPI */
368 413
369#define acpi_disabled 1 414#define acpi_disabled 1
@@ -418,6 +463,22 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
418 return 0; 463 return 0;
419} 464}
420 465
466struct acpi_device_id;
467
468static inline const struct acpi_device_id *acpi_match_device(
469 const struct acpi_device_id *ids, const struct device *dev)
470{
471 return NULL;
472}
473
474static inline bool acpi_driver_match_device(struct device *dev,
475 const struct device_driver *drv)
476{
477 return false;
478}
479
480#define ACPI_PTR(_ptr) (NULL)
481
421#endif /* !CONFIG_ACPI */ 482#endif /* !CONFIG_ACPI */
422 483
423#ifdef CONFIG_ACPI 484#ifdef CONFIG_ACPI
@@ -426,8 +487,96 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
426 487
427acpi_status acpi_os_prepare_sleep(u8 sleep_state, 488acpi_status acpi_os_prepare_sleep(u8 sleep_state,
428 u32 pm1a_control, u32 pm1b_control); 489 u32 pm1a_control, u32 pm1b_control);
490#ifdef CONFIG_X86
491void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
492#else
493static inline void arch_reserve_mem_area(acpi_physical_address addr,
494 size_t size)
495{
496}
497#endif /* CONFIG_X86 */
429#else 498#else
430#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) 499#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
431#endif 500#endif
432 501
502#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
503int acpi_dev_runtime_suspend(struct device *dev);
504int acpi_dev_runtime_resume(struct device *dev);
505int acpi_subsys_runtime_suspend(struct device *dev);
506int acpi_subsys_runtime_resume(struct device *dev);
507#else
508static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
509static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
510static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
511static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
512#endif
513
514#ifdef CONFIG_ACPI_SLEEP
515int acpi_dev_suspend_late(struct device *dev);
516int acpi_dev_resume_early(struct device *dev);
517int acpi_subsys_prepare(struct device *dev);
518int acpi_subsys_suspend_late(struct device *dev);
519int acpi_subsys_resume_early(struct device *dev);
520#else
521static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
522static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
523static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
524static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
525static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
526#endif
527
528#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
529int acpi_dev_pm_attach(struct device *dev, bool power_on);
530void acpi_dev_pm_detach(struct device *dev, bool power_off);
531#else
532static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
533{
534 return -ENODEV;
535}
536static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
537#endif
538
539#ifdef CONFIG_ACPI
540__printf(3, 4)
541void acpi_handle_printk(const char *level, acpi_handle handle,
542 const char *fmt, ...);
543#else /* !CONFIG_ACPI */
544static inline __printf(3, 4) void
545acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
546#endif /* !CONFIG_ACPI */
547
548/*
549 * acpi_handle_<level>: Print message with ACPI prefix and object path
550 *
551 * These interfaces acquire the global namespace mutex to obtain an object
552 * path. In interrupt context, it shows the object path as <n/a>.
553 */
554#define acpi_handle_emerg(handle, fmt, ...) \
555 acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__)
556#define acpi_handle_alert(handle, fmt, ...) \
557 acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__)
558#define acpi_handle_crit(handle, fmt, ...) \
559 acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__)
560#define acpi_handle_err(handle, fmt, ...) \
561 acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
562#define acpi_handle_warn(handle, fmt, ...) \
563 acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__)
564#define acpi_handle_notice(handle, fmt, ...) \
565 acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__)
566#define acpi_handle_info(handle, fmt, ...) \
567 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
568
569/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */
570#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
571#define acpi_handle_debug(handle, fmt, ...) \
572 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
573#else
574#define acpi_handle_debug(handle, fmt, ...) \
575({ \
576 if (0) \
577 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \
578 0; \
579})
580#endif
581
433#endif /*_LINUX_ACPI_H*/ 582#endif /*_LINUX_ACPI_H*/