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.h97
1 files changed, 96 insertions, 1 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 79345cd5ac20..c33fa3ce9b7c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -27,6 +27,7 @@
27 27
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/ioport.h> /* for struct resource */ 29#include <linux/ioport.h> /* for struct resource */
30#include <linux/device.h>
30 31
31#ifdef CONFIG_ACPI 32#ifdef CONFIG_ACPI
32 33
@@ -251,6 +252,26 @@ extern int pnpacpi_disabled;
251 252
252#define PXM_INVAL (-1) 253#define PXM_INVAL (-1)
253 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
254int acpi_check_resource_conflict(const struct resource *res); 275int acpi_check_resource_conflict(const struct resource *res);
255 276
256int acpi_check_region(resource_size_t start, resource_size_t n, 277int acpi_check_region(resource_size_t start, resource_size_t n,
@@ -258,10 +279,14 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
258 279
259int acpi_resources_are_enforced(void); 280int acpi_resources_are_enforced(void);
260 281
261#ifdef CONFIG_PM_SLEEP 282#ifdef CONFIG_HIBERNATION
262void __init acpi_no_s4_hw_signature(void); 283void __init acpi_no_s4_hw_signature(void);
284#endif
285
286#ifdef CONFIG_PM_SLEEP
263void __init acpi_old_suspend_ordering(void); 287void __init acpi_old_suspend_ordering(void);
264void __init acpi_nvs_nosave(void); 288void __init acpi_nvs_nosave(void);
289void __init acpi_nvs_nosave_s3(void);
265#endif /* CONFIG_PM_SLEEP */ 290#endif /* CONFIG_PM_SLEEP */
266 291
267struct acpi_osc_context { 292struct acpi_osc_context {
@@ -365,6 +390,17 @@ extern int acpi_nvs_register(__u64 start, __u64 size);
365extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), 390extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
366 void *data); 391 void *data);
367 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
368#else /* !CONFIG_ACPI */ 404#else /* !CONFIG_ACPI */
369 405
370#define acpi_disabled 1 406#define acpi_disabled 1
@@ -419,6 +455,22 @@ static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
419 return 0; 455 return 0;
420} 456}
421 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
422#endif /* !CONFIG_ACPI */ 474#endif /* !CONFIG_ACPI */
423 475
424#ifdef CONFIG_ACPI 476#ifdef CONFIG_ACPI
@@ -468,4 +520,47 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
468static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {} 520static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {}
469#endif 521#endif
470 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
471#endif /*_LINUX_ACPI_H*/ 566#endif /*_LINUX_ACPI_H*/