Commit 4db367fd authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-scan', 'acpi-hotplug' and 'acpi-pci'

* acpi-scan:
  ACPI / scan: do not scan fixed hardware on HW-reduced platform

* acpi-hotplug:
  ACPI: add dynamic_debug support
  ACPI / notify: Clean up handling of hotplug events

* acpi-pci:
  ACPI / PCI: Stub out pci_acpi_crs_quirks() and make it x86 specific
...@@ -92,7 +92,6 @@ ia64_acpi_release_global_lock (unsigned int *lock) ...@@ -92,7 +92,6 @@ ia64_acpi_release_global_lock (unsigned int *lock)
#endif #endif
#define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */ #define acpi_processor_cstate_check(x) (x) /* no idle limits on IA64 :) */
static inline void disable_acpi(void) { } static inline void disable_acpi(void) { }
static inline void pci_acpi_crs_quirks(void) { }
#ifdef CONFIG_IA64_GENERIC #ifdef CONFIG_IA64_GENERIC
const char *acpi_get_sysname (void); const char *acpi_get_sysname (void);
......
...@@ -340,16 +340,18 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -340,16 +340,18 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
{ {
struct acpi_device *adev; struct acpi_device *adev;
struct acpi_driver *driver; struct acpi_driver *driver;
acpi_status status;
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
bool hotplug_event = false;
switch (type) { switch (type) {
case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_BUS_CHECK:
acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n"); acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n");
hotplug_event = true;
break; break;
case ACPI_NOTIFY_DEVICE_CHECK: case ACPI_NOTIFY_DEVICE_CHECK:
acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n"); acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n");
hotplug_event = true;
break; break;
case ACPI_NOTIFY_DEVICE_WAKE: case ACPI_NOTIFY_DEVICE_WAKE:
...@@ -358,6 +360,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -358,6 +360,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
case ACPI_NOTIFY_EJECT_REQUEST: case ACPI_NOTIFY_EJECT_REQUEST:
acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n");
hotplug_event = true;
break; break;
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
...@@ -393,16 +396,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -393,16 +396,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
(driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
driver->ops.notify(adev, type); driver->ops.notify(adev, type);
switch (type) { if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
case ACPI_NOTIFY_EJECT_REQUEST:
status = acpi_hotplug_schedule(adev, type);
if (ACPI_SUCCESS(status))
return; return;
default:
break;
}
acpi_bus_put_acpi_device(adev); acpi_bus_put_acpi_device(adev);
return; return;
......
...@@ -2259,13 +2259,17 @@ int __init acpi_scan_init(void) ...@@ -2259,13 +2259,17 @@ int __init acpi_scan_init(void)
if (result) if (result)
goto out; goto out;
/* Fixed feature devices do not exist on HW-reduced platform */
if (!acpi_gbl_reduced_hardware) {
result = acpi_bus_scan_fixed(); result = acpi_bus_scan_fixed();
if (result) { if (result) {
acpi_detach_data(acpi_root->handle, acpi_scan_drop_device); acpi_detach_data(acpi_root->handle,
acpi_scan_drop_device);
acpi_device_del(acpi_root); acpi_device_del(acpi_root);
put_device(&acpi_root->dev); put_device(&acpi_root->dev);
goto out; goto out;
} }
}
acpi_update_all_gpes(); acpi_update_all_gpes();
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/hardirq.h> #include <linux/hardirq.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/dynamic_debug.h>
#include "internal.h" #include "internal.h"
...@@ -456,6 +457,24 @@ acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, ...@@ -456,6 +457,24 @@ acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
} }
EXPORT_SYMBOL(acpi_evaluate_ost); EXPORT_SYMBOL(acpi_evaluate_ost);
/**
* acpi_handle_path: Return the object path of handle
*
* Caller must free the returned buffer
*/
static char *acpi_handle_path(acpi_handle handle)
{
struct acpi_buffer buffer = {
.length = ACPI_ALLOCATE_BUFFER,
.pointer = NULL
};
if (in_interrupt() ||
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer) != AE_OK)
return NULL;
return buffer.pointer;
}
/** /**
* acpi_handle_printk: Print message with ACPI prefix and object path * acpi_handle_printk: Print message with ACPI prefix and object path
* *
...@@ -469,29 +488,50 @@ acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...) ...@@ -469,29 +488,50 @@ acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...)
{ {
struct va_format vaf; struct va_format vaf;
va_list args; va_list args;
struct acpi_buffer buffer = {
.length = ACPI_ALLOCATE_BUFFER,
.pointer = NULL
};
const char *path; const char *path;
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
if (in_interrupt() || path = acpi_handle_path(handle);
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer) != AE_OK) printk("%sACPI: %s: %pV", level, path ? path : "<n/a>" , &vaf);
path = "<n/a>";
else
path = buffer.pointer;
printk("%sACPI: %s: %pV", level, path, &vaf);
va_end(args); va_end(args);
kfree(buffer.pointer); kfree(path);
} }
EXPORT_SYMBOL(acpi_handle_printk); EXPORT_SYMBOL(acpi_handle_printk);
#if defined(CONFIG_DYNAMIC_DEBUG)
/**
* __acpi_handle_debug: pr_debug with ACPI prefix and object path
*
* This function is called through acpi_handle_debug macro and debug
* prints a message with ACPI prefix and object path. This function
* acquires the global namespace mutex to obtain an object path. In
* interrupt context, it shows the object path as <n/a>.
*/
void
__acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle,
const char *fmt, ...)
{
struct va_format vaf;
va_list args;
const char *path;
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
path = acpi_handle_path(handle);
__dynamic_pr_debug(descriptor, "ACPI: %s: %pV", path ? path : "<n/a>", &vaf);
va_end(args);
kfree(path);
}
EXPORT_SYMBOL(__acpi_handle_debug);
#endif
/** /**
* acpi_has_method: Check whether @handle has a method named @name * acpi_has_method: Check whether @handle has a method named @name
* @handle: ACPI device handle * @handle: ACPI device handle
......
...@@ -96,7 +96,12 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle); ...@@ -96,7 +96,12 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle);
/* Arch-defined function to add a bus to the system */ /* Arch-defined function to add a bus to the system */
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root); struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root);
#ifdef CONFIG_X86
void pci_acpi_crs_quirks(void); void pci_acpi_crs_quirks(void);
#else
static inline void pci_acpi_crs_quirks(void) { }
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Processor Processor
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/dynamic_debug.h>
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
...@@ -589,6 +590,14 @@ static inline __printf(3, 4) void ...@@ -589,6 +590,14 @@ static inline __printf(3, 4) void
acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
#endif /* !CONFIG_ACPI */ #endif /* !CONFIG_ACPI */
#if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)
__printf(3, 4)
void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...);
#else
#define __acpi_handle_debug(descriptor, handle, fmt, ...) \
acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__);
#endif
/* /*
* acpi_handle_<level>: Print message with ACPI prefix and object path * acpi_handle_<level>: Print message with ACPI prefix and object path
* *
...@@ -610,11 +619,19 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} ...@@ -610,11 +619,19 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
#define acpi_handle_info(handle, fmt, ...) \ #define acpi_handle_info(handle, fmt, ...) \
acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */ #if defined(DEBUG)
#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
#define acpi_handle_debug(handle, fmt, ...) \ #define acpi_handle_debug(handle, fmt, ...) \
acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
#else #else
#if defined(CONFIG_DYNAMIC_DEBUG)
#define acpi_handle_debug(handle, fmt, ...) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
__acpi_handle_debug(&descriptor, handle, pr_fmt(fmt), \
##__VA_ARGS__); \
} while (0)
#else
#define acpi_handle_debug(handle, fmt, ...) \ #define acpi_handle_debug(handle, fmt, ...) \
({ \ ({ \
if (0) \ if (0) \
...@@ -622,5 +639,6 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} ...@@ -622,5 +639,6 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
0; \ 0; \
}) })
#endif #endif
#endif
#endif /*_LINUX_ACPI_H*/ #endif /*_LINUX_ACPI_H*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment