diff options
339 files changed, 3467 insertions, 2922 deletions
diff --git a/Documentation/ABI/testing/sysfs-devices-power b/Documentation/ABI/testing/sysfs-devices-power index efe449bdf811..7dbf96b724ed 100644 --- a/Documentation/ABI/testing/sysfs-devices-power +++ b/Documentation/ABI/testing/sysfs-devices-power | |||
| @@ -187,7 +187,7 @@ Description: | |||
| 187 | Not all drivers support this attribute. If it isn't supported, | 187 | Not all drivers support this attribute. If it isn't supported, |
| 188 | attempts to read or write it will yield I/O errors. | 188 | attempts to read or write it will yield I/O errors. |
| 189 | 189 | ||
| 190 | What: /sys/devices/.../power/pm_qos_latency_us | 190 | What: /sys/devices/.../power/pm_qos_resume_latency_us |
| 191 | Date: March 2012 | 191 | Date: March 2012 |
| 192 | Contact: Rafael J. Wysocki <rjw@rjwysocki.net> | 192 | Contact: Rafael J. Wysocki <rjw@rjwysocki.net> |
| 193 | Description: | 193 | Description: |
| @@ -205,6 +205,31 @@ Description: | |||
| 205 | This attribute has no effect on system-wide suspend/resume and | 205 | This attribute has no effect on system-wide suspend/resume and |
| 206 | hibernation. | 206 | hibernation. |
| 207 | 207 | ||
| 208 | What: /sys/devices/.../power/pm_qos_latency_tolerance_us | ||
| 209 | Date: January 2014 | ||
| 210 | Contact: Rafael J. Wysocki <rjw@rjwysocki.net> | ||
| 211 | Description: | ||
| 212 | The /sys/devices/.../power/pm_qos_latency_tolerance_us attribute | ||
| 213 | contains the PM QoS active state latency tolerance limit for the | ||
| 214 | given device in microseconds. That is the maximum memory access | ||
| 215 | latency the device can suffer without any visible adverse | ||
| 216 | effects on user space functionality. If that value is the | ||
| 217 | string "any", the latency does not matter to user space at all, | ||
| 218 | but hardware should not be allowed to set the latency tolerance | ||
| 219 | for the device automatically. | ||
| 220 | |||
| 221 | Reading "auto" from this file means that the maximum memory | ||
| 222 | access latency for the device may be determined automatically | ||
| 223 | by the hardware as needed. Writing "auto" to it allows the | ||
| 224 | hardware to be switched to this mode if there are no other | ||
| 225 | latency tolerance requirements from the kernel side. | ||
| 226 | |||
| 227 | This attribute is only present if the feature controlled by it | ||
| 228 | is supported by the hardware. | ||
| 229 | |||
| 230 | This attribute has no effect on runtime suspend and resume of | ||
| 231 | devices and on system-wide suspend/resume and hibernation. | ||
| 232 | |||
| 208 | What: /sys/devices/.../power/pm_qos_no_power_off | 233 | What: /sys/devices/.../power/pm_qos_no_power_off |
| 209 | Date: September 2012 | 234 | Date: September 2012 |
| 210 | Contact: Rafael J. Wysocki <rjw@rjwysocki.net> | 235 | Contact: Rafael J. Wysocki <rjw@rjwysocki.net> |
diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power index 205a73878441..64c9276e9421 100644 --- a/Documentation/ABI/testing/sysfs-power +++ b/Documentation/ABI/testing/sysfs-power | |||
| @@ -12,8 +12,9 @@ Contact: Rafael J. Wysocki <rjw@rjwysocki.net> | |||
| 12 | Description: | 12 | Description: |
| 13 | The /sys/power/state file controls the system power state. | 13 | The /sys/power/state file controls the system power state. |
| 14 | Reading from this file returns what states are supported, | 14 | Reading from this file returns what states are supported, |
| 15 | which is hard-coded to 'standby' (Power-On Suspend), 'mem' | 15 | which is hard-coded to 'freeze' (Low-Power Idle), 'standby' |
| 16 | (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). | 16 | (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk' |
| 17 | (Suspend-to-Disk). | ||
| 17 | 18 | ||
| 18 | Writing to this file one of these strings causes the system to | 19 | Writing to this file one of these strings causes the system to |
| 19 | transition into that state. Please see the file | 20 | transition into that state. Please see the file |
diff --git a/Documentation/cpu-freq/core.txt b/Documentation/cpu-freq/core.txt index ce0666e51036..0060d76b445f 100644 --- a/Documentation/cpu-freq/core.txt +++ b/Documentation/cpu-freq/core.txt | |||
| @@ -92,7 +92,3 @@ values: | |||
| 92 | cpu - number of the affected CPU | 92 | cpu - number of the affected CPU |
| 93 | old - old frequency | 93 | old - old frequency |
| 94 | new - new frequency | 94 | new - new frequency |
| 95 | |||
| 96 | If the cpufreq core detects the frequency has changed while the system | ||
| 97 | was suspended, these notifiers are called with CPUFREQ_RESUMECHANGE as | ||
| 98 | second argument. | ||
diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt index 8b1a4451422e..48da5fdcb9f1 100644 --- a/Documentation/cpu-freq/cpu-drivers.txt +++ b/Documentation/cpu-freq/cpu-drivers.txt | |||
| @@ -61,7 +61,13 @@ target_index - See below on the differences. | |||
| 61 | 61 | ||
| 62 | And optionally | 62 | And optionally |
| 63 | 63 | ||
| 64 | cpufreq_driver.exit - A pointer to a per-CPU cleanup function. | 64 | cpufreq_driver.exit - A pointer to a per-CPU cleanup |
| 65 | function called during CPU_POST_DEAD | ||
| 66 | phase of cpu hotplug process. | ||
| 67 | |||
| 68 | cpufreq_driver.stop_cpu - A pointer to a per-CPU stop function | ||
| 69 | called during CPU_DOWN_PREPARE phase of | ||
| 70 | cpu hotplug process. | ||
| 65 | 71 | ||
| 66 | cpufreq_driver.resume - A pointer to a per-CPU resume function | 72 | cpufreq_driver.resume - A pointer to a per-CPU resume function |
| 67 | which is called with interrupts disabled | 73 | which is called with interrupts disabled |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 7116fda7077f..91f0be8555f5 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -229,8 +229,24 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 229 | use by PCI | 229 | use by PCI |
| 230 | Format: <irq>,<irq>... | 230 | Format: <irq>,<irq>... |
| 231 | 231 | ||
| 232 | acpi_no_auto_serialize [HW,ACPI] | ||
| 233 | Disable auto-serialization of AML methods | ||
| 234 | AML control methods that contain the opcodes to create | ||
| 235 | named objects will be marked as "Serialized" by the | ||
| 236 | auto-serialization feature. | ||
| 237 | This feature is enabled by default. | ||
| 238 | This option allows to turn off the feature. | ||
| 239 | |||
| 232 | acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT | 240 | acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT |
| 233 | 241 | ||
| 242 | acpica_no_return_repair [HW, ACPI] | ||
| 243 | Disable AML predefined validation mechanism | ||
| 244 | This mechanism can repair the evaluation result to make | ||
| 245 | the return objects more ACPI specification compliant. | ||
| 246 | This option is useful for developers to identify the | ||
| 247 | root cause of an AML interpreter issue when the issue | ||
| 248 | has something to do with the repair mechanism. | ||
| 249 | |||
| 234 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS | 250 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS |
| 235 | Format: To spoof as Windows 98: ="Microsoft Windows" | 251 | Format: To spoof as Windows 98: ="Microsoft Windows" |
| 236 | 252 | ||
| @@ -298,8 +314,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 298 | acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode | 314 | acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode |
| 299 | Format: { level | edge | high | low } | 315 | Format: { level | edge | high | low } |
| 300 | 316 | ||
| 301 | acpi_serialize [HW,ACPI] force serialization of AML methods | ||
| 302 | |||
| 303 | acpi_skip_timer_override [HW,ACPI] | 317 | acpi_skip_timer_override [HW,ACPI] |
| 304 | Recognize and ignore IRQ0/pin2 Interrupt Override. | 318 | Recognize and ignore IRQ0/pin2 Interrupt Override. |
| 305 | For broken nForce2 BIOS resulting in XT-PIC timer. | 319 | For broken nForce2 BIOS resulting in XT-PIC timer. |
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index 483632087788..a5da5c7e7128 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
| @@ -88,17 +88,19 @@ node. | |||
| 88 | 88 | ||
| 89 | 2. PM QoS per-device latency and flags framework | 89 | 2. PM QoS per-device latency and flags framework |
| 90 | 90 | ||
| 91 | For each device, there are two lists of PM QoS requests. One is maintained | 91 | For each device, there are three lists of PM QoS requests. Two of them are |
| 92 | along with the aggregated target of latency value and the other is for PM QoS | 92 | maintained along with the aggregated targets of resume latency and active |
| 93 | flags. Values are updated in response to changes of the request list. | 93 | state latency tolerance (in microseconds) and the third one is for PM QoS flags. |
| 94 | Values are updated in response to changes of the request list. | ||
| 94 | 95 | ||
| 95 | Target latency value is simply the minimum of the request values held in the | 96 | The target values of resume latency and active state latency tolerance are |
| 96 | parameter list elements. The PM QoS flags aggregate value is a gather (bitwise | 97 | simply the minimum of the request values held in the parameter list elements. |
| 97 | OR) of all list elements' values. Two device PM QoS flags are defined currently: | 98 | The PM QoS flags aggregate value is a gather (bitwise OR) of all list elements' |
| 98 | PM_QOS_FLAG_NO_POWER_OFF and PM_QOS_FLAG_REMOTE_WAKEUP. | 99 | values. Two device PM QoS flags are defined currently: PM_QOS_FLAG_NO_POWER_OFF |
| 100 | and PM_QOS_FLAG_REMOTE_WAKEUP. | ||
| 99 | 101 | ||
| 100 | Note: the aggregated target value is implemented as an atomic variable so that | 102 | Note: The aggregated target values are implemented in such a way that reading |
| 101 | reading the aggregated value does not require any locking mechanism. | 103 | the aggregated value does not require any locking mechanism. |
| 102 | 104 | ||
| 103 | 105 | ||
| 104 | From kernel mode the use of this interface is the following: | 106 | From kernel mode the use of this interface is the following: |
| @@ -132,19 +134,21 @@ The meaning of the return values is as follows: | |||
| 132 | PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been | 134 | PM_QOS_FLAGS_UNDEFINED: The device's PM QoS structure has not been |
| 133 | initialized or the list of requests is empty. | 135 | initialized or the list of requests is empty. |
| 134 | 136 | ||
| 135 | int dev_pm_qos_add_ancestor_request(dev, handle, value) | 137 | int dev_pm_qos_add_ancestor_request(dev, handle, type, value) |
| 136 | Add a PM QoS request for the first direct ancestor of the given device whose | 138 | Add a PM QoS request for the first direct ancestor of the given device whose |
| 137 | power.ignore_children flag is unset. | 139 | power.ignore_children flag is unset (for DEV_PM_QOS_RESUME_LATENCY requests) |
| 140 | or whose power.set_latency_tolerance callback pointer is not NULL (for | ||
| 141 | DEV_PM_QOS_LATENCY_TOLERANCE requests). | ||
| 138 | 142 | ||
| 139 | int dev_pm_qos_expose_latency_limit(device, value) | 143 | int dev_pm_qos_expose_latency_limit(device, value) |
| 140 | Add a request to the device's PM QoS list of latency constraints and create | 144 | Add a request to the device's PM QoS list of resume latency constraints and |
| 141 | a sysfs attribute pm_qos_resume_latency_us under the device's power directory | 145 | create a sysfs attribute pm_qos_resume_latency_us under the device's power |
| 142 | allowing user space to manipulate that request. | 146 | directory allowing user space to manipulate that request. |
| 143 | 147 | ||
| 144 | void dev_pm_qos_hide_latency_limit(device) | 148 | void dev_pm_qos_hide_latency_limit(device) |
| 145 | Drop the request added by dev_pm_qos_expose_latency_limit() from the device's | 149 | Drop the request added by dev_pm_qos_expose_latency_limit() from the device's |
| 146 | PM QoS list of latency constraints and remove sysfs attribute pm_qos_resume_latency_us | 150 | PM QoS list of resume latency constraints and remove sysfs attribute |
| 147 | from the device's power directory. | 151 | pm_qos_resume_latency_us from the device's power directory. |
| 148 | 152 | ||
| 149 | int dev_pm_qos_expose_flags(device, value) | 153 | int dev_pm_qos_expose_flags(device, value) |
| 150 | Add a request to the device's PM QoS list of flags and create sysfs attributes | 154 | Add a request to the device's PM QoS list of flags and create sysfs attributes |
| @@ -163,7 +167,7 @@ a per-device notification tree and a global notification tree. | |||
| 163 | int dev_pm_qos_add_notifier(device, notifier): | 167 | int dev_pm_qos_add_notifier(device, notifier): |
| 164 | Adds a notification callback function for the device. | 168 | Adds a notification callback function for the device. |
| 165 | The callback is called when the aggregated value of the device constraints list | 169 | The callback is called when the aggregated value of the device constraints list |
| 166 | is changed. | 170 | is changed (for resume latency device PM QoS only). |
| 167 | 171 | ||
| 168 | int dev_pm_qos_remove_notifier(device, notifier): | 172 | int dev_pm_qos_remove_notifier(device, notifier): |
| 169 | Removes the notification callback function for the device. | 173 | Removes the notification callback function for the device. |
| @@ -171,14 +175,48 @@ Removes the notification callback function for the device. | |||
| 171 | int dev_pm_qos_add_global_notifier(notifier): | 175 | int dev_pm_qos_add_global_notifier(notifier): |
| 172 | Adds a notification callback function in the global notification tree of the | 176 | Adds a notification callback function in the global notification tree of the |
| 173 | framework. | 177 | framework. |
| 174 | The callback is called when the aggregated value for any device is changed. | 178 | The callback is called when the aggregated value for any device is changed |
| 179 | (for resume latency device PM QoS only). | ||
| 175 | 180 | ||
| 176 | int dev_pm_qos_remove_global_notifier(notifier): | 181 | int dev_pm_qos_remove_global_notifier(notifier): |
| 177 | Removes the notification callback function from the global notification tree | 182 | Removes the notification callback function from the global notification tree |
| 178 | of the framework. | 183 | of the framework. |
| 179 | 184 | ||
| 180 | 185 | ||
| 181 | From user mode: | 186 | Active state latency tolerance |
| 182 | No API for user space access to the per-device latency constraints is provided | 187 | |
| 183 | yet - still under discussion. | 188 | This device PM QoS type is used to support systems in which hardware may switch |
| 184 | 189 | to energy-saving operation modes on the fly. In those systems, if the operation | |
| 190 | mode chosen by the hardware attempts to save energy in an overly aggressive way, | ||
| 191 | it may cause excess latencies to be visible to software, causing it to miss | ||
| 192 | certain protocol requirements or target frame or sample rates etc. | ||
| 193 | |||
| 194 | If there is a latency tolerance control mechanism for a given device available | ||
| 195 | to software, the .set_latency_tolerance callback in that device's dev_pm_info | ||
| 196 | structure should be populated. The routine pointed to by it is should implement | ||
| 197 | whatever is necessary to transfer the effective requirement value to the | ||
| 198 | hardware. | ||
| 199 | |||
| 200 | Whenever the effective latency tolerance changes for the device, its | ||
| 201 | .set_latency_tolerance() callback will be executed and the effective value will | ||
| 202 | be passed to it. If that value is negative, which means that the list of | ||
| 203 | latency tolerance requirements for the device is empty, the callback is expected | ||
| 204 | to switch the underlying hardware latency tolerance control mechanism to an | ||
| 205 | autonomous mode if available. If that value is PM_QOS_LATENCY_ANY, in turn, and | ||
| 206 | the hardware supports a special "no requirement" setting, the callback is | ||
| 207 | expected to use it. That allows software to prevent the hardware from | ||
| 208 | automatically updating the device's latency tolerance in response to its power | ||
| 209 | state changes (e.g. during transitions from D3cold to D0), which generally may | ||
| 210 | be done in the autonomous latency tolerance control mode. | ||
| 211 | |||
| 212 | If .set_latency_tolerance() is present for the device, sysfs attribute | ||
| 213 | pm_qos_latency_tolerance_us will be present in the devivce's power directory. | ||
| 214 | Then, user space can use that attribute to specify its latency tolerance | ||
| 215 | requirement for the device, if any. Writing "any" to it means "no requirement, | ||
| 216 | but do not let the hardware control latency tolerance" and writing "auto" to it | ||
| 217 | allows the hardware to be switched to the autonomous mode if there are no other | ||
| 218 | requirements from the kernel side in the device's list. | ||
| 219 | |||
| 220 | Kernel code can use the functions described above along with the | ||
| 221 | DEV_PM_QOS_LATENCY_TOLERANCE device PM QoS type to add, remove and update | ||
| 222 | latency tolerance requirements for devices. | ||
diff --git a/Documentation/trace/events-power.txt b/Documentation/trace/events-power.txt index 3bd33b8dc7c4..21d514ced212 100644 --- a/Documentation/trace/events-power.txt +++ b/Documentation/trace/events-power.txt | |||
| @@ -92,5 +92,5 @@ dev_pm_qos_remove_request "device=%s type=%s new_value=%d" | |||
| 92 | 92 | ||
| 93 | The first parameter gives the device name which tries to add/update/remove | 93 | The first parameter gives the device name which tries to add/update/remove |
| 94 | QoS requests. | 94 | QoS requests. |
| 95 | The second parameter gives the request type (e.g. "DEV_PM_QOS_LATENCY"). | 95 | The second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY"). |
| 96 | The third parameter is value to be added/updated/removed. | 96 | The third parameter is value to be added/updated/removed. |
diff --git a/MAINTAINERS b/MAINTAINERS index b3fdb0f004ba..9d33ccbc3934 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -242,8 +242,8 @@ S: Maintained | |||
| 242 | F: drivers/platform/x86/acer-wmi.c | 242 | F: drivers/platform/x86/acer-wmi.c |
| 243 | 243 | ||
| 244 | ACPI | 244 | ACPI |
| 245 | M: Len Brown <lenb@kernel.org> | ||
| 246 | M: Rafael J. Wysocki <rjw@rjwysocki.net> | 245 | M: Rafael J. Wysocki <rjw@rjwysocki.net> |
| 246 | M: Len Brown <lenb@kernel.org> | ||
| 247 | L: linux-acpi@vger.kernel.org | 247 | L: linux-acpi@vger.kernel.org |
| 248 | W: https://01.org/linux-acpi | 248 | W: https://01.org/linux-acpi |
| 249 | Q: https://patchwork.kernel.org/project/linux-acpi/list/ | 249 | Q: https://patchwork.kernel.org/project/linux-acpi/list/ |
| @@ -3657,8 +3657,8 @@ S: Maintained | |||
| 3657 | F: fs/freevxfs/ | 3657 | F: fs/freevxfs/ |
| 3658 | 3658 | ||
| 3659 | FREEZER | 3659 | FREEZER |
| 3660 | M: Pavel Machek <pavel@ucw.cz> | ||
| 3661 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> | 3660 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> |
| 3661 | M: Pavel Machek <pavel@ucw.cz> | ||
| 3662 | L: linux-pm@vger.kernel.org | 3662 | L: linux-pm@vger.kernel.org |
| 3663 | S: Supported | 3663 | S: Supported |
| 3664 | F: Documentation/power/freezing-of-tasks.txt | 3664 | F: Documentation/power/freezing-of-tasks.txt |
| @@ -4022,8 +4022,8 @@ S: Maintained | |||
| 4022 | F: drivers/video/hgafb.c | 4022 | F: drivers/video/hgafb.c |
| 4023 | 4023 | ||
| 4024 | HIBERNATION (aka Software Suspend, aka swsusp) | 4024 | HIBERNATION (aka Software Suspend, aka swsusp) |
| 4025 | M: Pavel Machek <pavel@ucw.cz> | ||
| 4026 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> | 4025 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> |
| 4026 | M: Pavel Machek <pavel@ucw.cz> | ||
| 4027 | L: linux-pm@vger.kernel.org | 4027 | L: linux-pm@vger.kernel.org |
| 4028 | S: Supported | 4028 | S: Supported |
| 4029 | F: arch/x86/power/ | 4029 | F: arch/x86/power/ |
| @@ -8425,9 +8425,9 @@ F: arch/sh/ | |||
| 8425 | F: drivers/sh/ | 8425 | F: drivers/sh/ |
| 8426 | 8426 | ||
| 8427 | SUSPEND TO RAM | 8427 | SUSPEND TO RAM |
| 8428 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> | ||
| 8428 | M: Len Brown <len.brown@intel.com> | 8429 | M: Len Brown <len.brown@intel.com> |
| 8429 | M: Pavel Machek <pavel@ucw.cz> | 8430 | M: Pavel Machek <pavel@ucw.cz> |
| 8430 | M: "Rafael J. Wysocki" <rjw@rjwysocki.net> | ||
| 8431 | L: linux-pm@vger.kernel.org | 8431 | L: linux-pm@vger.kernel.org |
| 8432 | S: Supported | 8432 | S: Supported |
| 8433 | F: Documentation/power/ | 8433 | F: Documentation/power/ |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index b7b4c86e338b..7c4fada440f0 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
| @@ -674,8 +674,7 @@ static int cpufreq_callback(struct notifier_block *nb, | |||
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || | 676 | if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || |
| 677 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || | 677 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { |
| 678 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { | ||
| 679 | loops_per_jiffy = cpufreq_scale(global_l_p_j_ref, | 678 | loops_per_jiffy = cpufreq_scale(global_l_p_j_ref, |
| 680 | global_l_p_j_ref_freq, | 679 | global_l_p_j_ref_freq, |
| 681 | freq->new); | 680 | freq->new); |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 6591e26fc13f..dfc32130bc44 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
| @@ -166,7 +166,7 @@ static int twd_cpufreq_transition(struct notifier_block *nb, | |||
| 166 | * frequency. The timer is local to a cpu, so cross-call to the | 166 | * frequency. The timer is local to a cpu, so cross-call to the |
| 167 | * changing cpu. | 167 | * changing cpu. |
| 168 | */ | 168 | */ |
| 169 | if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE) | 169 | if (state == CPUFREQ_POSTCHANGE) |
| 170 | smp_call_function_single(freqs->cpu, twd_update_frequency, | 170 | smp_call_function_single(freqs->cpu, twd_update_frequency, |
| 171 | NULL, 1); | 171 | NULL, 1); |
| 172 | 172 | ||
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index 29905b127ad9..41f27f667ca8 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c | |||
| @@ -885,9 +885,6 @@ static int viper_cpufreq_notifier(struct notifier_block *nb, | |||
| 885 | viper_set_core_cpu_voltage(freq->new, 0); | 885 | viper_set_core_cpu_voltage(freq->new, 0); |
| 886 | } | 886 | } |
| 887 | break; | 887 | break; |
| 888 | case CPUFREQ_RESUMECHANGE: | ||
| 889 | viper_set_core_cpu_voltage(freq->new, 0); | ||
| 890 | break; | ||
| 891 | default: | 888 | default: |
| 892 | /* ignore */ | 889 | /* ignore */ |
| 893 | break; | 890 | break; |
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c index 7ad003001ab7..824b12a56a42 100644 --- a/arch/arm/mach-spear/spear1310.c +++ b/arch/arm/mach-spear/spear1310.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | static void __init spear1310_dt_init(void) | 28 | static void __init spear1310_dt_init(void) |
| 29 | { | 29 | { |
| 30 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 30 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 31 | platform_device_register_simple("spear-cpufreq", -1, NULL, 0); | ||
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | static const char * const spear1310_dt_board_compat[] = { | 34 | static const char * const spear1310_dt_board_compat[] = { |
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c index 3fb683424729..7b6bff7154e1 100644 --- a/arch/arm/mach-spear/spear1340.c +++ b/arch/arm/mach-spear/spear1340.c | |||
| @@ -143,6 +143,7 @@ static void __init spear1340_dt_init(void) | |||
| 143 | { | 143 | { |
| 144 | of_platform_populate(NULL, of_default_bus_match_table, | 144 | of_platform_populate(NULL, of_default_bus_match_table, |
| 145 | spear1340_auxdata_lookup, NULL); | 145 | spear1340_auxdata_lookup, NULL); |
| 146 | platform_device_register_simple("spear-cpufreq", -1, NULL, 0); | ||
| 146 | } | 147 | } |
| 147 | 148 | ||
| 148 | static const char * const spear1340_dt_board_compat[] = { | 149 | static const char * const spear1340_dt_board_compat[] = { |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 27bbcfc7202a..c6e2f5bb1a7b 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
| @@ -303,6 +303,14 @@ source "drivers/cpuidle/Kconfig" | |||
| 303 | 303 | ||
| 304 | endmenu | 304 | endmenu |
| 305 | 305 | ||
| 306 | menu "Power management options" | ||
| 307 | |||
| 308 | source "kernel/power/Kconfig" | ||
| 309 | |||
| 310 | source "drivers/cpufreq/Kconfig" | ||
| 311 | |||
| 312 | endmenu | ||
| 313 | |||
| 306 | source "net/Kconfig" | 314 | source "net/Kconfig" |
| 307 | 315 | ||
| 308 | source "drivers/Kconfig" | 316 | source "drivers/Kconfig" |
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig index efbd2929aeb7..f4a0daa556eb 100644 --- a/arch/ia64/configs/generic_defconfig +++ b/arch/ia64/configs/generic_defconfig | |||
| @@ -25,7 +25,6 @@ CONFIG_KEXEC=y | |||
| 25 | CONFIG_CRASH_DUMP=y | 25 | CONFIG_CRASH_DUMP=y |
| 26 | CONFIG_EFI_VARS=y | 26 | CONFIG_EFI_VARS=y |
| 27 | CONFIG_BINFMT_MISC=m | 27 | CONFIG_BINFMT_MISC=m |
| 28 | CONFIG_ACPI_PROCFS=y | ||
| 29 | CONFIG_ACPI_BUTTON=m | 28 | CONFIG_ACPI_BUTTON=m |
| 30 | CONFIG_ACPI_FAN=m | 29 | CONFIG_ACPI_FAN=m |
| 31 | CONFIG_ACPI_DOCK=y | 30 | CONFIG_ACPI_DOCK=y |
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig index 0f4e9e41f130..0fed9ae5a42a 100644 --- a/arch/ia64/configs/tiger_defconfig +++ b/arch/ia64/configs/tiger_defconfig | |||
| @@ -26,7 +26,6 @@ CONFIG_IA64_PALINFO=y | |||
| 26 | CONFIG_KEXEC=y | 26 | CONFIG_KEXEC=y |
| 27 | CONFIG_EFI_VARS=y | 27 | CONFIG_EFI_VARS=y |
| 28 | CONFIG_BINFMT_MISC=m | 28 | CONFIG_BINFMT_MISC=m |
| 29 | CONFIG_ACPI_PROCFS=y | ||
| 30 | CONFIG_ACPI_BUTTON=m | 29 | CONFIG_ACPI_BUTTON=m |
| 31 | CONFIG_ACPI_FAN=m | 30 | CONFIG_ACPI_FAN=m |
| 32 | CONFIG_ACPI_PROCESSOR=m | 31 | CONFIG_ACPI_PROCESSOR=m |
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig index fc7aba07c2b4..54bc72eda30d 100644 --- a/arch/ia64/configs/zx1_defconfig +++ b/arch/ia64/configs/zx1_defconfig | |||
| @@ -16,7 +16,6 @@ CONFIG_IA64_PALINFO=y | |||
| 16 | CONFIG_CRASH_DUMP=y | 16 | CONFIG_CRASH_DUMP=y |
| 17 | CONFIG_EFI_VARS=y | 17 | CONFIG_EFI_VARS=y |
| 18 | CONFIG_BINFMT_MISC=y | 18 | CONFIG_BINFMT_MISC=y |
| 19 | CONFIG_ACPI_PROCFS=y | ||
| 20 | CONFIG_HOTPLUG_PCI=y | 19 | CONFIG_HOTPLUG_PCI=y |
| 21 | CONFIG_HOTPLUG_PCI_ACPI=y | 20 | CONFIG_HOTPLUG_PCI_ACPI=y |
| 22 | CONFIG_PACKET=y | 21 | CONFIG_PACKET=y |
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 07d209c9507f..467497ade45f 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
| @@ -54,10 +54,6 @@ | |||
| 54 | #include <asm/sal.h> | 54 | #include <asm/sal.h> |
| 55 | #include <asm/cyclone.h> | 55 | #include <asm/cyclone.h> |
| 56 | 56 | ||
| 57 | #define BAD_MADT_ENTRY(entry, end) ( \ | ||
| 58 | (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ | ||
| 59 | ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) | ||
| 60 | |||
| 61 | #define PREFIX "ACPI: " | 57 | #define PREFIX "ACPI: " |
| 62 | 58 | ||
| 63 | unsigned int acpi_cpei_override; | 59 | unsigned int acpi_cpei_override; |
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c index 1f0ebdeea5f7..863d89386f60 100644 --- a/arch/powerpc/oprofile/op_model_cell.c +++ b/arch/powerpc/oprofile/op_model_cell.c | |||
| @@ -1121,8 +1121,7 @@ oprof_cpufreq_notify(struct notifier_block *nb, unsigned long val, void *data) | |||
| 1121 | int ret = 0; | 1121 | int ret = 0; |
| 1122 | struct cpufreq_freqs *frq = data; | 1122 | struct cpufreq_freqs *frq = data; |
| 1123 | if ((val == CPUFREQ_PRECHANGE && frq->old < frq->new) || | 1123 | if ((val == CPUFREQ_PRECHANGE && frq->old < frq->new) || |
| 1124 | (val == CPUFREQ_POSTCHANGE && frq->old > frq->new) || | 1124 | (val == CPUFREQ_POSTCHANGE && frq->old > frq->new)) |
| 1125 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) | ||
| 1126 | set_spu_profiling_frequency(frq->new, spu_cycle_reset); | 1125 | set_spu_profiling_frequency(frq->new, spu_cycle_reset); |
| 1127 | return ret; | 1126 | return ret; |
| 1128 | } | 1127 | } |
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index c3d82b5f54ca..b397e053b872 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c | |||
| @@ -659,8 +659,7 @@ static int sparc64_cpufreq_notifier(struct notifier_block *nb, unsigned long val | |||
| 659 | ft->clock_tick_ref = cpu_data(cpu).clock_tick; | 659 | ft->clock_tick_ref = cpu_data(cpu).clock_tick; |
| 660 | } | 660 | } |
| 661 | if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || | 661 | if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || |
| 662 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || | 662 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { |
| 663 | (val == CPUFREQ_RESUMECHANGE)) { | ||
| 664 | cpu_data(cpu).clock_tick = | 663 | cpu_data(cpu).clock_tick = |
| 665 | cpufreq_scale(ft->clock_tick_ref, | 664 | cpufreq_scale(ft->clock_tick_ref, |
| 666 | ft->ref_freq, | 665 | ft->ref_freq, |
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig index a7fef2621cc9..619e7f7426c6 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig | |||
| @@ -60,7 +60,6 @@ CONFIG_CRASH_DUMP=y | |||
| 60 | CONFIG_HIBERNATION=y | 60 | CONFIG_HIBERNATION=y |
| 61 | CONFIG_PM_DEBUG=y | 61 | CONFIG_PM_DEBUG=y |
| 62 | CONFIG_PM_TRACE_RTC=y | 62 | CONFIG_PM_TRACE_RTC=y |
| 63 | CONFIG_ACPI_PROCFS=y | ||
| 64 | CONFIG_ACPI_DOCK=y | 63 | CONFIG_ACPI_DOCK=y |
| 65 | CONFIG_CPU_FREQ=y | 64 | CONFIG_CPU_FREQ=y |
| 66 | # CONFIG_CPU_FREQ_STAT is not set | 65 | # CONFIG_CPU_FREQ_STAT is not set |
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig index c1119d4c1281..6181c69b786b 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig | |||
| @@ -58,7 +58,6 @@ CONFIG_CRASH_DUMP=y | |||
| 58 | CONFIG_HIBERNATION=y | 58 | CONFIG_HIBERNATION=y |
| 59 | CONFIG_PM_DEBUG=y | 59 | CONFIG_PM_DEBUG=y |
| 60 | CONFIG_PM_TRACE_RTC=y | 60 | CONFIG_PM_TRACE_RTC=y |
| 61 | CONFIG_ACPI_PROCFS=y | ||
| 62 | CONFIG_ACPI_DOCK=y | 61 | CONFIG_ACPI_DOCK=y |
| 63 | CONFIG_CPU_FREQ=y | 62 | CONFIG_CPU_FREQ=y |
| 64 | # CONFIG_CPU_FREQ_STAT is not set | 63 | # CONFIG_CPU_FREQ_STAT is not set |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 1dac94265b59..123f9e37eee4 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -53,10 +53,6 @@ EXPORT_SYMBOL(acpi_disabled); | |||
| 53 | # include <asm/proto.h> | 53 | # include <asm/proto.h> |
| 54 | #endif /* X86 */ | 54 | #endif /* X86 */ |
| 55 | 55 | ||
| 56 | #define BAD_MADT_ENTRY(entry, end) ( \ | ||
| 57 | (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ | ||
| 58 | ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) | ||
| 59 | |||
| 60 | #define PREFIX "ACPI: " | 56 | #define PREFIX "ACPI: " |
| 61 | 57 | ||
| 62 | int acpi_noirq; /* skip ACPI IRQ initialization */ | 58 | int acpi_noirq; /* skip ACPI IRQ initialization */ |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index cfbe99f88830..7a9296ab8834 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
| @@ -914,8 +914,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
| 914 | tsc_khz_ref = tsc_khz; | 914 | tsc_khz_ref = tsc_khz; |
| 915 | } | 915 | } |
| 916 | if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || | 916 | if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || |
| 917 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || | 917 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { |
| 918 | (val == CPUFREQ_RESUMECHANGE)) { | ||
| 919 | *lpj = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new); | 918 | *lpj = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new); |
| 920 | 919 | ||
| 921 | tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new); | 920 | tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new); |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 4770de5707b9..c205653e9644 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -43,19 +43,6 @@ config ACPI_SLEEP | |||
| 43 | depends on SUSPEND || HIBERNATION | 43 | depends on SUSPEND || HIBERNATION |
| 44 | default y | 44 | default y |
| 45 | 45 | ||
| 46 | config ACPI_PROCFS | ||
| 47 | bool "Deprecated /proc/acpi files" | ||
| 48 | depends on PROC_FS | ||
| 49 | help | ||
| 50 | For backwards compatibility, this option allows | ||
| 51 | deprecated /proc/acpi/ files to exist, even when | ||
| 52 | they have been replaced by functions in /sys. | ||
| 53 | |||
| 54 | This option has no effect on /proc/acpi/ files | ||
| 55 | and functions which do not yet exist in /sys. | ||
| 56 | |||
| 57 | Say N to delete /proc/acpi/ files that have moved to /sys/ | ||
| 58 | |||
| 59 | config ACPI_EC_DEBUGFS | 46 | config ACPI_EC_DEBUGFS |
| 60 | tristate "EC read/write access through /sys/kernel/debug/ec" | 47 | tristate "EC read/write access through /sys/kernel/debug/ec" |
| 61 | default n | 48 | default n |
| @@ -115,7 +102,7 @@ config ACPI_BUTTON | |||
| 115 | 102 | ||
| 116 | config ACPI_VIDEO | 103 | config ACPI_VIDEO |
| 117 | tristate "Video" | 104 | tristate "Video" |
| 118 | depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL | 105 | depends on X86 && BACKLIGHT_CLASS_DEVICE |
| 119 | depends on INPUT | 106 | depends on INPUT |
| 120 | select THERMAL | 107 | select THERMAL |
| 121 | help | 108 | help |
| @@ -343,6 +330,19 @@ config ACPI_BGRT | |||
| 343 | data from the firmware boot splash. It will appear under | 330 | data from the firmware boot splash. It will appear under |
| 344 | /sys/firmware/acpi/bgrt/ . | 331 | /sys/firmware/acpi/bgrt/ . |
| 345 | 332 | ||
| 333 | config ACPI_REDUCED_HARDWARE_ONLY | ||
| 334 | bool "Hardware-reduced ACPI support only" if EXPERT | ||
| 335 | def_bool n | ||
| 336 | depends on ACPI | ||
| 337 | help | ||
| 338 | This config item changes the way the ACPI code is built. When this | ||
| 339 | option is selected, the kernel will use a specialized version of | ||
| 340 | ACPICA that ONLY supports the ACPI "reduced hardware" mode. The | ||
| 341 | resulting kernel will be smaller but it will also be restricted to | ||
| 342 | running in ACPI reduced hardware mode ONLY. | ||
| 343 | |||
| 344 | If you are unsure what to do, do not enable this option. | ||
| 345 | |||
| 346 | source "drivers/acpi/apei/Kconfig" | 346 | source "drivers/acpi/apei/Kconfig" |
| 347 | 347 | ||
| 348 | config ACPI_EXTLOG | 348 | config ACPI_EXTLOG |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 6f190bc2b8b7..2c01c1da29ce 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
| 34 | #include <linux/power_supply.h> | 34 | #include <linux/power_supply.h> |
| 35 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
| 36 | #include "battery.h" | ||
| 36 | 37 | ||
| 37 | #define PREFIX "ACPI: " | 38 | #define PREFIX "ACPI: " |
| 38 | 39 | ||
| @@ -57,6 +58,7 @@ struct acpi_ac { | |||
| 57 | struct power_supply charger; | 58 | struct power_supply charger; |
| 58 | struct platform_device *pdev; | 59 | struct platform_device *pdev; |
| 59 | unsigned long long state; | 60 | unsigned long long state; |
| 61 | struct notifier_block battery_nb; | ||
| 60 | }; | 62 | }; |
| 61 | 63 | ||
| 62 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) | 64 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) |
| @@ -152,6 +154,26 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) | |||
| 152 | return; | 154 | return; |
| 153 | } | 155 | } |
| 154 | 156 | ||
| 157 | static int acpi_ac_battery_notify(struct notifier_block *nb, | ||
| 158 | unsigned long action, void *data) | ||
| 159 | { | ||
| 160 | struct acpi_ac *ac = container_of(nb, struct acpi_ac, battery_nb); | ||
| 161 | struct acpi_bus_event *event = (struct acpi_bus_event *)data; | ||
| 162 | |||
| 163 | /* | ||
| 164 | * On HP Pavilion dv6-6179er AC status notifications aren't triggered | ||
| 165 | * when adapter is plugged/unplugged. However, battery status | ||
| 166 | * notifcations are triggered when battery starts charging or | ||
| 167 | * discharging. Re-reading AC status triggers lost AC notifications, | ||
| 168 | * if AC status has changed. | ||
| 169 | */ | ||
| 170 | if (strcmp(event->device_class, ACPI_BATTERY_CLASS) == 0 && | ||
| 171 | event->type == ACPI_BATTERY_NOTIFY_STATUS) | ||
| 172 | acpi_ac_get_state(ac); | ||
| 173 | |||
| 174 | return NOTIFY_OK; | ||
| 175 | } | ||
| 176 | |||
| 155 | static int thinkpad_e530_quirk(const struct dmi_system_id *d) | 177 | static int thinkpad_e530_quirk(const struct dmi_system_id *d) |
| 156 | { | 178 | { |
| 157 | ac_sleep_before_get_state_ms = 1000; | 179 | ac_sleep_before_get_state_ms = 1000; |
| @@ -215,6 +237,8 @@ static int acpi_ac_probe(struct platform_device *pdev) | |||
| 215 | acpi_device_name(adev), acpi_device_bid(adev), | 237 | acpi_device_name(adev), acpi_device_bid(adev), |
| 216 | ac->state ? "on-line" : "off-line"); | 238 | ac->state ? "on-line" : "off-line"); |
| 217 | 239 | ||
| 240 | ac->battery_nb.notifier_call = acpi_ac_battery_notify; | ||
| 241 | register_acpi_notifier(&ac->battery_nb); | ||
| 218 | end: | 242 | end: |
| 219 | if (result) | 243 | if (result) |
| 220 | kfree(ac); | 244 | kfree(ac); |
| @@ -261,6 +285,7 @@ static int acpi_ac_remove(struct platform_device *pdev) | |||
| 261 | ac = platform_get_drvdata(pdev); | 285 | ac = platform_get_drvdata(pdev); |
| 262 | if (ac->charger.dev) | 286 | if (ac->charger.dev) |
| 263 | power_supply_unregister(&ac->charger); | 287 | power_supply_unregister(&ac->charger); |
| 288 | unregister_acpi_notifier(&ac->battery_nb); | ||
| 264 | 289 | ||
| 265 | kfree(ac); | 290 | kfree(ac); |
| 266 | 291 | ||
diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c index 84190ed89c04..961b45d18a5d 100644 --- a/drivers/acpi/acpi_cmos_rtc.c +++ b/drivers/acpi/acpi_cmos_rtc.c | |||
| @@ -18,8 +18,6 @@ | |||
| 18 | 18 | ||
| 19 | #include "internal.h" | 19 | #include "internal.h" |
| 20 | 20 | ||
| 21 | #define PREFIX "ACPI: " | ||
| 22 | |||
| 23 | ACPI_MODULE_NAME("cmos rtc"); | 21 | ACPI_MODULE_NAME("cmos rtc"); |
| 24 | 22 | ||
| 25 | static const struct acpi_device_id acpi_cmos_rtc_ids[] = { | 23 | static const struct acpi_device_id acpi_cmos_rtc_ids[] = { |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 6745fe137b9e..69e29f409d4c 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
| @@ -33,6 +33,13 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
| 33 | #define LPSS_GENERAL_UART_RTS_OVRD BIT(3) | 33 | #define LPSS_GENERAL_UART_RTS_OVRD BIT(3) |
| 34 | #define LPSS_SW_LTR 0x10 | 34 | #define LPSS_SW_LTR 0x10 |
| 35 | #define LPSS_AUTO_LTR 0x14 | 35 | #define LPSS_AUTO_LTR 0x14 |
| 36 | #define LPSS_LTR_SNOOP_REQ BIT(15) | ||
| 37 | #define LPSS_LTR_SNOOP_MASK 0x0000FFFF | ||
| 38 | #define LPSS_LTR_SNOOP_LAT_1US 0x800 | ||
| 39 | #define LPSS_LTR_SNOOP_LAT_32US 0xC00 | ||
| 40 | #define LPSS_LTR_SNOOP_LAT_SHIFT 5 | ||
| 41 | #define LPSS_LTR_SNOOP_LAT_CUTOFF 3000 | ||
| 42 | #define LPSS_LTR_MAX_VAL 0x3FF | ||
| 36 | #define LPSS_TX_INT 0x20 | 43 | #define LPSS_TX_INT 0x20 |
| 37 | #define LPSS_TX_INT_MASK BIT(1) | 44 | #define LPSS_TX_INT_MASK BIT(1) |
| 38 | 45 | ||
| @@ -102,6 +109,16 @@ static struct lpss_device_desc lpt_sdio_dev_desc = { | |||
| 102 | .ltr_required = true, | 109 | .ltr_required = true, |
| 103 | }; | 110 | }; |
| 104 | 111 | ||
| 112 | static struct lpss_shared_clock pwm_clock = { | ||
| 113 | .name = "pwm_clk", | ||
| 114 | .rate = 25000000, | ||
| 115 | }; | ||
| 116 | |||
| 117 | static struct lpss_device_desc byt_pwm_dev_desc = { | ||
| 118 | .clk_required = true, | ||
| 119 | .shared_clock = &pwm_clock, | ||
| 120 | }; | ||
| 121 | |||
| 105 | static struct lpss_shared_clock uart_clock = { | 122 | static struct lpss_shared_clock uart_clock = { |
| 106 | .name = "uart_clk", | 123 | .name = "uart_clk", |
| 107 | .rate = 44236800, | 124 | .rate = 44236800, |
| @@ -157,6 +174,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { | |||
| 157 | { "INT33C7", }, | 174 | { "INT33C7", }, |
| 158 | 175 | ||
| 159 | /* BayTrail LPSS devices */ | 176 | /* BayTrail LPSS devices */ |
| 177 | { "80860F09", (unsigned long)&byt_pwm_dev_desc }, | ||
| 160 | { "80860F0A", (unsigned long)&byt_uart_dev_desc }, | 178 | { "80860F0A", (unsigned long)&byt_uart_dev_desc }, |
| 161 | { "80860F0E", (unsigned long)&byt_spi_dev_desc }, | 179 | { "80860F0E", (unsigned long)&byt_spi_dev_desc }, |
| 162 | { "80860F14", (unsigned long)&byt_sdio_dev_desc }, | 180 | { "80860F14", (unsigned long)&byt_sdio_dev_desc }, |
| @@ -315,6 +333,17 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
| 315 | return ret; | 333 | return ret; |
| 316 | } | 334 | } |
| 317 | 335 | ||
| 336 | static u32 __lpss_reg_read(struct lpss_private_data *pdata, unsigned int reg) | ||
| 337 | { | ||
| 338 | return readl(pdata->mmio_base + pdata->dev_desc->prv_offset + reg); | ||
| 339 | } | ||
| 340 | |||
| 341 | static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata, | ||
| 342 | unsigned int reg) | ||
| 343 | { | ||
| 344 | writel(val, pdata->mmio_base + pdata->dev_desc->prv_offset + reg); | ||
| 345 | } | ||
| 346 | |||
| 318 | static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) | 347 | static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) |
| 319 | { | 348 | { |
| 320 | struct acpi_device *adev; | 349 | struct acpi_device *adev; |
| @@ -336,7 +365,7 @@ static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) | |||
| 336 | ret = -ENODEV; | 365 | ret = -ENODEV; |
| 337 | goto out; | 366 | goto out; |
| 338 | } | 367 | } |
| 339 | *val = readl(pdata->mmio_base + pdata->dev_desc->prv_offset + reg); | 368 | *val = __lpss_reg_read(pdata, reg); |
| 340 | 369 | ||
| 341 | out: | 370 | out: |
| 342 | spin_unlock_irqrestore(&dev->power.lock, flags); | 371 | spin_unlock_irqrestore(&dev->power.lock, flags); |
| @@ -389,6 +418,37 @@ static struct attribute_group lpss_attr_group = { | |||
| 389 | .name = "lpss_ltr", | 418 | .name = "lpss_ltr", |
| 390 | }; | 419 | }; |
| 391 | 420 | ||
| 421 | static void acpi_lpss_set_ltr(struct device *dev, s32 val) | ||
| 422 | { | ||
| 423 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | ||
| 424 | u32 ltr_mode, ltr_val; | ||
| 425 | |||
| 426 | ltr_mode = __lpss_reg_read(pdata, LPSS_GENERAL); | ||
| 427 | if (val < 0) { | ||
| 428 | if (ltr_mode & LPSS_GENERAL_LTR_MODE_SW) { | ||
| 429 | ltr_mode &= ~LPSS_GENERAL_LTR_MODE_SW; | ||
| 430 | __lpss_reg_write(ltr_mode, pdata, LPSS_GENERAL); | ||
| 431 | } | ||
| 432 | return; | ||
| 433 | } | ||
| 434 | ltr_val = __lpss_reg_read(pdata, LPSS_SW_LTR) & ~LPSS_LTR_SNOOP_MASK; | ||
| 435 | if (val >= LPSS_LTR_SNOOP_LAT_CUTOFF) { | ||
| 436 | ltr_val |= LPSS_LTR_SNOOP_LAT_32US; | ||
| 437 | val = LPSS_LTR_MAX_VAL; | ||
| 438 | } else if (val > LPSS_LTR_MAX_VAL) { | ||
| 439 | ltr_val |= LPSS_LTR_SNOOP_LAT_32US | LPSS_LTR_SNOOP_REQ; | ||
| 440 | val >>= LPSS_LTR_SNOOP_LAT_SHIFT; | ||
| 441 | } else { | ||
| 442 | ltr_val |= LPSS_LTR_SNOOP_LAT_1US | LPSS_LTR_SNOOP_REQ; | ||
| 443 | } | ||
| 444 | ltr_val |= val; | ||
| 445 | __lpss_reg_write(ltr_val, pdata, LPSS_SW_LTR); | ||
| 446 | if (!(ltr_mode & LPSS_GENERAL_LTR_MODE_SW)) { | ||
| 447 | ltr_mode |= LPSS_GENERAL_LTR_MODE_SW; | ||
| 448 | __lpss_reg_write(ltr_mode, pdata, LPSS_GENERAL); | ||
| 449 | } | ||
| 450 | } | ||
| 451 | |||
| 392 | static int acpi_lpss_platform_notify(struct notifier_block *nb, | 452 | static int acpi_lpss_platform_notify(struct notifier_block *nb, |
| 393 | unsigned long action, void *data) | 453 | unsigned long action, void *data) |
| 394 | { | 454 | { |
| @@ -426,9 +486,29 @@ static struct notifier_block acpi_lpss_nb = { | |||
| 426 | .notifier_call = acpi_lpss_platform_notify, | 486 | .notifier_call = acpi_lpss_platform_notify, |
| 427 | }; | 487 | }; |
| 428 | 488 | ||
| 489 | static void acpi_lpss_bind(struct device *dev) | ||
| 490 | { | ||
| 491 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | ||
| 492 | |||
| 493 | if (!pdata || !pdata->mmio_base || !pdata->dev_desc->ltr_required) | ||
| 494 | return; | ||
| 495 | |||
| 496 | if (pdata->mmio_size >= pdata->dev_desc->prv_offset + LPSS_LTR_SIZE) | ||
| 497 | dev->power.set_latency_tolerance = acpi_lpss_set_ltr; | ||
| 498 | else | ||
| 499 | dev_err(dev, "MMIO size insufficient to access LTR\n"); | ||
| 500 | } | ||
| 501 | |||
| 502 | static void acpi_lpss_unbind(struct device *dev) | ||
| 503 | { | ||
| 504 | dev->power.set_latency_tolerance = NULL; | ||
| 505 | } | ||
| 506 | |||
| 429 | static struct acpi_scan_handler lpss_handler = { | 507 | static struct acpi_scan_handler lpss_handler = { |
| 430 | .ids = acpi_lpss_device_ids, | 508 | .ids = acpi_lpss_device_ids, |
| 431 | .attach = acpi_lpss_create_device, | 509 | .attach = acpi_lpss_create_device, |
| 510 | .bind = acpi_lpss_bind, | ||
| 511 | .unbind = acpi_lpss_unbind, | ||
| 432 | }; | 512 | }; |
| 433 | 513 | ||
| 434 | void __init acpi_lpss_init(void) | 514 | void __init acpi_lpss_init(void) |
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index df96a0fe4890..37d73024b82e 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
| @@ -408,28 +408,14 @@ static int acpi_pad_pur(acpi_handle handle) | |||
| 408 | return num; | 408 | return num; |
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | /* Notify firmware how many CPUs are idle */ | ||
| 412 | static void acpi_pad_ost(acpi_handle handle, int stat, | ||
| 413 | uint32_t idle_cpus) | ||
| 414 | { | ||
| 415 | union acpi_object params[3] = { | ||
| 416 | {.type = ACPI_TYPE_INTEGER,}, | ||
| 417 | {.type = ACPI_TYPE_INTEGER,}, | ||
| 418 | {.type = ACPI_TYPE_BUFFER,}, | ||
| 419 | }; | ||
| 420 | struct acpi_object_list arg_list = {3, params}; | ||
| 421 | |||
| 422 | params[0].integer.value = ACPI_PROCESSOR_AGGREGATOR_NOTIFY; | ||
| 423 | params[1].integer.value = stat; | ||
| 424 | params[2].buffer.length = 4; | ||
| 425 | params[2].buffer.pointer = (void *)&idle_cpus; | ||
| 426 | acpi_evaluate_object(handle, "_OST", &arg_list, NULL); | ||
| 427 | } | ||
| 428 | |||
| 429 | static void acpi_pad_handle_notify(acpi_handle handle) | 411 | static void acpi_pad_handle_notify(acpi_handle handle) |
| 430 | { | 412 | { |
| 431 | int num_cpus; | 413 | int num_cpus; |
| 432 | uint32_t idle_cpus; | 414 | uint32_t idle_cpus; |
| 415 | struct acpi_buffer param = { | ||
| 416 | .length = 4, | ||
| 417 | .pointer = (void *)&idle_cpus, | ||
| 418 | }; | ||
| 433 | 419 | ||
| 434 | mutex_lock(&isolated_cpus_lock); | 420 | mutex_lock(&isolated_cpus_lock); |
| 435 | num_cpus = acpi_pad_pur(handle); | 421 | num_cpus = acpi_pad_pur(handle); |
| @@ -439,7 +425,7 @@ static void acpi_pad_handle_notify(acpi_handle handle) | |||
| 439 | } | 425 | } |
| 440 | acpi_pad_idle_cpus(num_cpus); | 426 | acpi_pad_idle_cpus(num_cpus); |
| 441 | idle_cpus = acpi_pad_idle_cpus_num(); | 427 | idle_cpus = acpi_pad_idle_cpus_num(); |
| 442 | acpi_pad_ost(handle, 0, idle_cpus); | 428 | acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, 0, ¶m); |
| 443 | mutex_unlock(&isolated_cpus_lock); | 429 | mutex_unlock(&isolated_cpus_lock); |
| 444 | } | 430 | } |
| 445 | 431 | ||
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 438304086ff1..b7ed86a20427 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
| @@ -122,6 +122,8 @@ acpi-y += \ | |||
| 122 | rsaddr.o \ | 122 | rsaddr.o \ |
| 123 | rscalc.o \ | 123 | rscalc.o \ |
| 124 | rscreate.o \ | 124 | rscreate.o \ |
| 125 | rsdump.o \ | ||
| 126 | rsdumpinfo.o \ | ||
| 125 | rsinfo.o \ | 127 | rsinfo.o \ |
| 126 | rsio.o \ | 128 | rsio.o \ |
| 127 | rsirq.o \ | 129 | rsirq.o \ |
| @@ -132,8 +134,6 @@ acpi-y += \ | |||
| 132 | rsutils.o \ | 134 | rsutils.o \ |
| 133 | rsxface.o | 135 | rsxface.o |
| 134 | 136 | ||
| 135 | acpi-$(ACPI_FUTURE_USAGE) += rsdump.o rsdumpinfo.o | ||
| 136 | |||
| 137 | acpi-y += \ | 137 | acpi-y += \ |
| 138 | tbfadt.o \ | 138 | tbfadt.o \ |
| 139 | tbfind.o \ | 139 | tbfind.o \ |
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h index 8a6c4a0d22db..6f1c616910ac 100644 --- a/drivers/acpi/acpica/accommon.h +++ b/drivers/acpi/acpica/accommon.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index 2bf3ca2b8a7a..68a91eb0fa48 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -115,6 +115,8 @@ ACPI_HW_DEPENDENT_RETURN_VOID(void | |||
| 115 | char *block_arg)) | 115 | char *block_arg)) |
| 116 | ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void)) | 116 | ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void)) |
| 117 | 117 | ||
| 118 | void acpi_db_execute_test(char *type_arg); | ||
| 119 | |||
| 118 | /* | 120 | /* |
| 119 | * dbconvert - miscellaneous conversion routines | 121 | * dbconvert - miscellaneous conversion routines |
| 120 | */ | 122 | */ |
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h index 427db72a6302..d3e2cc395d7f 100644 --- a/drivers/acpi/acpica/acdispat.h +++ b/drivers/acpi/acpica/acdispat.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -139,20 +139,21 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
| 139 | struct acpi_walk_state *walk_state); | 139 | struct acpi_walk_state *walk_state); |
| 140 | 140 | ||
| 141 | /* | 141 | /* |
| 142 | * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks | 142 | * dsload - Parser/Interpreter interface |
| 143 | */ | 143 | */ |
| 144 | acpi_status | 144 | acpi_status |
| 145 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); | 145 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); |
| 146 | 146 | ||
| 147 | /* dsload - pass 1 namespace load callbacks */ | ||
| 148 | |||
| 147 | acpi_status | 149 | acpi_status |
| 148 | acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, | 150 | acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, |
| 149 | union acpi_parse_object **out_op); | 151 | union acpi_parse_object **out_op); |
| 150 | 152 | ||
| 151 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); | 153 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); |
| 152 | 154 | ||
| 153 | /* | 155 | /* dsload - pass 2 namespace load callbacks */ |
| 154 | * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks | 156 | |
| 155 | */ | ||
| 156 | acpi_status | 157 | acpi_status |
| 157 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | 158 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, |
| 158 | union acpi_parse_object **out_op); | 159 | union acpi_parse_object **out_op); |
| @@ -200,7 +201,9 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state); | |||
| 200 | /* | 201 | /* |
| 201 | * dsmethod - Parser/Interpreter interface - control method parsing | 202 | * dsmethod - Parser/Interpreter interface - control method parsing |
| 202 | */ | 203 | */ |
| 203 | acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node); | 204 | acpi_status |
| 205 | acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | ||
| 206 | union acpi_operand_object *obj_desc); | ||
| 204 | 207 | ||
| 205 | acpi_status | 208 | acpi_status |
| 206 | acpi_ds_call_control_method(struct acpi_thread_state *thread, | 209 | acpi_ds_call_control_method(struct acpi_thread_state *thread, |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 0fb0adf435d6..68ec61fff188 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 4ed1aa384df2..49bbc71fad54 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -51,11 +51,19 @@ | |||
| 51 | * to simplify maintenance of the code. | 51 | * to simplify maintenance of the code. |
| 52 | */ | 52 | */ |
| 53 | #ifdef DEFINE_ACPI_GLOBALS | 53 | #ifdef DEFINE_ACPI_GLOBALS |
| 54 | #define ACPI_EXTERN | 54 | #define ACPI_GLOBAL(type,name) \ |
| 55 | #define ACPI_INIT_GLOBAL(a,b) a=b | 55 | extern type name; \ |
| 56 | type name | ||
| 57 | |||
| 58 | #define ACPI_INIT_GLOBAL(type,name,value) \ | ||
| 59 | type name=value | ||
| 60 | |||
| 56 | #else | 61 | #else |
| 57 | #define ACPI_EXTERN extern | 62 | #define ACPI_GLOBAL(type,name) \ |
| 58 | #define ACPI_INIT_GLOBAL(a,b) a | 63 | extern type name |
| 64 | |||
| 65 | #define ACPI_INIT_GLOBAL(type,name,value) \ | ||
| 66 | extern type name | ||
| 59 | #endif | 67 | #endif |
| 60 | 68 | ||
| 61 | #ifdef DEFINE_ACPI_GLOBALS | 69 | #ifdef DEFINE_ACPI_GLOBALS |
| @@ -82,33 +90,34 @@ | |||
| 82 | * 5) Allow unresolved references (invalid target name) in package objects | 90 | * 5) Allow unresolved references (invalid target name) in package objects |
| 83 | * 6) Enable warning messages for behavior that is not ACPI spec compliant | 91 | * 6) Enable warning messages for behavior that is not ACPI spec compliant |
| 84 | */ | 92 | */ |
| 85 | u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | 93 | ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); |
| 86 | 94 | ||
| 87 | /* | 95 | /* |
| 88 | * Automatically serialize ALL control methods? Default is FALSE, meaning | 96 | * Automatically serialize all methods that create named objects? Default |
| 89 | * to use the Serialized/not_serialized method flags on a per method basis. | 97 | * is TRUE, meaning that all non_serialized methods are scanned once at |
| 90 | * Only change this if the ASL code is poorly written and cannot handle | 98 | * table load time to determine those that create named objects. Methods |
| 91 | * reentrancy even though methods are marked "NotSerialized". | 99 | * that create named objects are marked Serialized in order to prevent |
| 100 | * possible run-time problems if they are entered by more than one thread. | ||
| 92 | */ | 101 | */ |
| 93 | u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); | 102 | ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE); |
| 94 | 103 | ||
| 95 | /* | 104 | /* |
| 96 | * Create the predefined _OSI method in the namespace? Default is TRUE | 105 | * Create the predefined _OSI method in the namespace? Default is TRUE |
| 97 | * because ACPI CA is fully compatible with other ACPI implementations. | 106 | * because ACPI CA is fully compatible with other ACPI implementations. |
| 98 | * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. | 107 | * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. |
| 99 | */ | 108 | */ |
| 100 | u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); | 109 | ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE); |
| 101 | 110 | ||
| 102 | /* | 111 | /* |
| 103 | * Optionally use default values for the ACPI register widths. Set this to | 112 | * Optionally use default values for the ACPI register widths. Set this to |
| 104 | * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. | 113 | * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. |
| 105 | */ | 114 | */ |
| 106 | u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); | 115 | ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE); |
| 107 | 116 | ||
| 108 | /* | 117 | /* |
| 109 | * Optionally enable output from the AML Debug Object. | 118 | * Optionally enable output from the AML Debug Object. |
| 110 | */ | 119 | */ |
| 111 | u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); | 120 | ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE); |
| 112 | 121 | ||
| 113 | /* | 122 | /* |
| 114 | * Optionally copy the entire DSDT to local memory (instead of simply | 123 | * Optionally copy the entire DSDT to local memory (instead of simply |
| @@ -116,7 +125,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); | |||
| 116 | * DSDT, creating the need for this option. Default is FALSE, do not copy | 125 | * DSDT, creating the need for this option. Default is FALSE, do not copy |
| 117 | * the DSDT. | 126 | * the DSDT. |
| 118 | */ | 127 | */ |
| 119 | u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); | 128 | ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE); |
| 120 | 129 | ||
| 121 | /* | 130 | /* |
| 122 | * Optionally ignore an XSDT if present and use the RSDT instead. | 131 | * Optionally ignore an XSDT if present and use the RSDT instead. |
| @@ -124,7 +133,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); | |||
| 124 | * of the RSDT, the XSDT has been found to be corrupt or ill-formed on | 133 | * of the RSDT, the XSDT has been found to be corrupt or ill-formed on |
| 125 | * some machines. Default behavior is to use the XSDT if present. | 134 | * some machines. Default behavior is to use the XSDT if present. |
| 126 | */ | 135 | */ |
| 127 | u8 ACPI_INIT_GLOBAL(acpi_gbl_do_not_use_xsdt, FALSE); | 136 | ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); |
| 128 | 137 | ||
| 129 | /* | 138 | /* |
| 130 | * Optionally use 32-bit FADT addresses if and when there is a conflict | 139 | * Optionally use 32-bit FADT addresses if and when there is a conflict |
| @@ -134,7 +143,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_do_not_use_xsdt, FALSE); | |||
| 134 | * some machines have been found to have a corrupted non-zero 64-bit | 143 | * some machines have been found to have a corrupted non-zero 64-bit |
| 135 | * address. Default is FALSE, do not favor the 32-bit addresses. | 144 | * address. Default is FALSE, do not favor the 32-bit addresses. |
| 136 | */ | 145 | */ |
| 137 | u8 ACPI_INIT_GLOBAL(acpi_gbl_use32_bit_fadt_addresses, FALSE); | 146 | ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE); |
| 138 | 147 | ||
| 139 | /* | 148 | /* |
| 140 | * Optionally truncate I/O addresses to 16 bits. Provides compatibility | 149 | * Optionally truncate I/O addresses to 16 bits. Provides compatibility |
| @@ -142,47 +151,28 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_use32_bit_fadt_addresses, FALSE); | |||
| 142 | * this value is set to TRUE if any Windows OSI strings have been | 151 | * this value is set to TRUE if any Windows OSI strings have been |
| 143 | * requested by the BIOS. | 152 | * requested by the BIOS. |
| 144 | */ | 153 | */ |
| 145 | u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE); | 154 | ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE); |
| 146 | 155 | ||
| 147 | /* | 156 | /* |
| 148 | * Disable runtime checking and repair of values returned by control methods. | 157 | * Disable runtime checking and repair of values returned by control methods. |
| 149 | * Use only if the repair is causing a problem on a particular machine. | 158 | * Use only if the repair is causing a problem on a particular machine. |
| 150 | */ | 159 | */ |
| 151 | u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE); | 160 | ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE); |
| 152 | 161 | ||
| 153 | /* | 162 | /* |
| 154 | * Optionally do not load any SSDTs from the RSDT/XSDT during initialization. | 163 | * Optionally do not load any SSDTs from the RSDT/XSDT during initialization. |
| 155 | * This can be useful for debugging ACPI problems on some machines. | 164 | * This can be useful for debugging ACPI problems on some machines. |
| 156 | */ | 165 | */ |
| 157 | u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_ssdt_table_load, FALSE); | 166 | ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_load, FALSE); |
| 158 | 167 | ||
| 159 | /* | 168 | /* |
| 160 | * We keep track of the latest version of Windows that has been requested by | 169 | * We keep track of the latest version of Windows that has been requested by |
| 161 | * the BIOS. | 170 | * the BIOS. |
| 162 | */ | 171 | */ |
| 163 | u8 ACPI_INIT_GLOBAL(acpi_gbl_osi_data, 0); | 172 | ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0); |
| 164 | |||
| 165 | /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ | ||
| 166 | |||
| 167 | struct acpi_table_fadt acpi_gbl_FADT; | ||
| 168 | u32 acpi_current_gpe_count; | ||
| 169 | u32 acpi_gbl_trace_flags; | ||
| 170 | acpi_name acpi_gbl_trace_method_name; | ||
| 171 | u8 acpi_gbl_system_awake_and_running; | ||
| 172 | |||
| 173 | /* | ||
| 174 | * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning | ||
| 175 | * that the ACPI hardware is no longer required. A flag in the FADT indicates | ||
| 176 | * a reduced HW machine, and that flag is duplicated here for convenience. | ||
| 177 | */ | ||
| 178 | u8 acpi_gbl_reduced_hardware; | ||
| 179 | 173 | ||
| 180 | #endif /* DEFINE_ACPI_GLOBALS */ | 174 | #endif /* DEFINE_ACPI_GLOBALS */ |
| 181 | 175 | ||
| 182 | /* Do not disassemble buffers to resource descriptors */ | ||
| 183 | |||
| 184 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE); | ||
| 185 | |||
| 186 | /***************************************************************************** | 176 | /***************************************************************************** |
| 187 | * | 177 | * |
| 188 | * ACPI Table globals | 178 | * ACPI Table globals |
| @@ -190,37 +180,36 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE); | |||
| 190 | ****************************************************************************/ | 180 | ****************************************************************************/ |
| 191 | 181 | ||
| 192 | /* | 182 | /* |
| 193 | * acpi_gbl_root_table_list is the master list of ACPI tables that were | 183 | * Master list of all ACPI tables that were found in the RSDT/XSDT. |
| 194 | * found in the RSDT/XSDT. | ||
| 195 | */ | 184 | */ |
| 196 | ACPI_EXTERN struct acpi_table_list acpi_gbl_root_table_list; | 185 | ACPI_GLOBAL(struct acpi_table_list, acpi_gbl_root_table_list); |
| 186 | |||
| 187 | /* DSDT information. Used to check for DSDT corruption */ | ||
| 188 | |||
| 189 | ACPI_GLOBAL(struct acpi_table_header *, acpi_gbl_DSDT); | ||
| 190 | ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header); | ||
| 197 | 191 | ||
| 198 | #if (!ACPI_REDUCED_HARDWARE) | 192 | #if (!ACPI_REDUCED_HARDWARE) |
| 199 | ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS; | 193 | ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS); |
| 200 | 194 | ||
| 201 | #endif /* !ACPI_REDUCED_HARDWARE */ | 195 | #endif /* !ACPI_REDUCED_HARDWARE */ |
| 202 | 196 | ||
| 203 | /* These addresses are calculated from the FADT Event Block addresses */ | 197 | /* These addresses are calculated from the FADT Event Block addresses */ |
| 204 | 198 | ||
| 205 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_status; | 199 | ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1a_status); |
| 206 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; | 200 | ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1a_enable); |
| 207 | |||
| 208 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_status; | ||
| 209 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; | ||
| 210 | 201 | ||
| 211 | /* DSDT information. Used to check for DSDT corruption */ | 202 | ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1b_status); |
| 212 | 203 | ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1b_enable); | |
| 213 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; | ||
| 214 | ACPI_EXTERN struct acpi_table_header acpi_gbl_original_dsdt_header; | ||
| 215 | 204 | ||
| 216 | /* | 205 | /* |
| 217 | * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is | 206 | * Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is |
| 218 | * determined by the revision of the DSDT: If the DSDT revision is less than | 207 | * determined by the revision of the DSDT: If the DSDT revision is less than |
| 219 | * 2, use only the lower 32 bits of the internal 64-bit Integer. | 208 | * 2, use only the lower 32 bits of the internal 64-bit Integer. |
| 220 | */ | 209 | */ |
| 221 | ACPI_EXTERN u8 acpi_gbl_integer_bit_width; | 210 | ACPI_GLOBAL(u8, acpi_gbl_integer_bit_width); |
| 222 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; | 211 | ACPI_GLOBAL(u8, acpi_gbl_integer_byte_width); |
| 223 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | 212 | ACPI_GLOBAL(u8, acpi_gbl_integer_nybble_width); |
| 224 | 213 | ||
| 225 | /***************************************************************************** | 214 | /***************************************************************************** |
| 226 | * | 215 | * |
| @@ -233,36 +222,36 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | |||
| 233 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. | 222 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. |
| 234 | * (The table maps local handles to the real OS handles) | 223 | * (The table maps local handles to the real OS handles) |
| 235 | */ | 224 | */ |
| 236 | ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; | 225 | ACPI_GLOBAL(struct acpi_mutex_info, acpi_gbl_mutex_info[ACPI_NUM_MUTEX]); |
| 237 | 226 | ||
| 238 | /* | 227 | /* |
| 239 | * Global lock mutex is an actual AML mutex object | 228 | * Global lock mutex is an actual AML mutex object |
| 240 | * Global lock semaphore works in conjunction with the actual global lock | 229 | * Global lock semaphore works in conjunction with the actual global lock |
| 241 | * Global lock spinlock is used for "pending" handshake | 230 | * Global lock spinlock is used for "pending" handshake |
| 242 | */ | 231 | */ |
| 243 | ACPI_EXTERN union acpi_operand_object *acpi_gbl_global_lock_mutex; | 232 | ACPI_GLOBAL(union acpi_operand_object *, acpi_gbl_global_lock_mutex); |
| 244 | ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore; | 233 | ACPI_GLOBAL(acpi_semaphore, acpi_gbl_global_lock_semaphore); |
| 245 | ACPI_EXTERN acpi_spinlock acpi_gbl_global_lock_pending_lock; | 234 | ACPI_GLOBAL(acpi_spinlock, acpi_gbl_global_lock_pending_lock); |
| 246 | ACPI_EXTERN u16 acpi_gbl_global_lock_handle; | 235 | ACPI_GLOBAL(u16, acpi_gbl_global_lock_handle); |
| 247 | ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; | 236 | ACPI_GLOBAL(u8, acpi_gbl_global_lock_acquired); |
| 248 | ACPI_EXTERN u8 acpi_gbl_global_lock_present; | 237 | ACPI_GLOBAL(u8, acpi_gbl_global_lock_present); |
| 249 | ACPI_EXTERN u8 acpi_gbl_global_lock_pending; | 238 | ACPI_GLOBAL(u8, acpi_gbl_global_lock_pending); |
| 250 | 239 | ||
| 251 | /* | 240 | /* |
| 252 | * Spinlocks are used for interfaces that can be possibly called at | 241 | * Spinlocks are used for interfaces that can be possibly called at |
| 253 | * interrupt level | 242 | * interrupt level |
| 254 | */ | 243 | */ |
| 255 | ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock; /* For GPE data structs and registers */ | 244 | ACPI_GLOBAL(acpi_spinlock, acpi_gbl_gpe_lock); /* For GPE data structs and registers */ |
| 256 | ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ | 245 | ACPI_GLOBAL(acpi_spinlock, acpi_gbl_hardware_lock); /* For ACPI H/W except GPE registers */ |
| 257 | ACPI_EXTERN acpi_spinlock acpi_gbl_reference_count_lock; | 246 | ACPI_GLOBAL(acpi_spinlock, acpi_gbl_reference_count_lock); |
| 258 | 247 | ||
| 259 | /* Mutex for _OSI support */ | 248 | /* Mutex for _OSI support */ |
| 260 | 249 | ||
| 261 | ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex; | 250 | ACPI_GLOBAL(acpi_mutex, acpi_gbl_osi_mutex); |
| 262 | 251 | ||
| 263 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ | 252 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ |
| 264 | 253 | ||
| 265 | ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; | 254 | ACPI_GLOBAL(struct acpi_rw_lock, acpi_gbl_namespace_rw_lock); |
| 266 | 255 | ||
| 267 | /***************************************************************************** | 256 | /***************************************************************************** |
| 268 | * | 257 | * |
| @@ -272,70 +261,69 @@ ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; | |||
| 272 | 261 | ||
| 273 | /* Object caches */ | 262 | /* Object caches */ |
| 274 | 263 | ||
| 275 | ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache; | 264 | ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_namespace_cache); |
| 276 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; | 265 | ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_state_cache); |
| 277 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; | 266 | ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_ps_node_cache); |
| 278 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; | 267 | ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_ps_node_ext_cache); |
| 279 | ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; | 268 | ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache); |
| 269 | |||
| 270 | /* System */ | ||
| 271 | |||
| 272 | ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0); | ||
| 273 | ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE); | ||
| 280 | 274 | ||
| 281 | /* Global handlers */ | 275 | /* Global handlers */ |
| 282 | 276 | ||
| 283 | ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2]; | 277 | ACPI_GLOBAL(struct acpi_global_notify_handler, acpi_gbl_global_notify[2]); |
| 284 | ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; | 278 | ACPI_GLOBAL(acpi_exception_handler, acpi_gbl_exception_handler); |
| 285 | ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; | 279 | ACPI_GLOBAL(acpi_init_handler, acpi_gbl_init_handler); |
| 286 | ACPI_EXTERN acpi_table_handler acpi_gbl_table_handler; | 280 | ACPI_GLOBAL(acpi_table_handler, acpi_gbl_table_handler); |
| 287 | ACPI_EXTERN void *acpi_gbl_table_handler_context; | 281 | ACPI_GLOBAL(void *, acpi_gbl_table_handler_context); |
| 288 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; | 282 | ACPI_GLOBAL(struct acpi_walk_state *, acpi_gbl_breakpoint_walk); |
| 289 | ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; | 283 | ACPI_GLOBAL(acpi_interface_handler, acpi_gbl_interface_handler); |
| 290 | ACPI_EXTERN struct acpi_sci_handler_info *acpi_gbl_sci_handler_list; | 284 | ACPI_GLOBAL(struct acpi_sci_handler_info *, acpi_gbl_sci_handler_list); |
| 291 | 285 | ||
| 292 | /* Owner ID support */ | 286 | /* Owner ID support */ |
| 293 | 287 | ||
| 294 | ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; | 288 | ACPI_GLOBAL(u32, acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]); |
| 295 | ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; | 289 | ACPI_GLOBAL(u8, acpi_gbl_last_owner_id_index); |
| 296 | ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; | 290 | ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset); |
| 297 | 291 | ||
| 298 | /* Initialization sequencing */ | 292 | /* Initialization sequencing */ |
| 299 | 293 | ||
| 300 | ACPI_EXTERN u8 acpi_gbl_reg_methods_executed; | 294 | ACPI_GLOBAL(u8, acpi_gbl_reg_methods_executed); |
| 301 | 295 | ||
| 302 | /* Misc */ | 296 | /* Misc */ |
| 303 | 297 | ||
| 304 | ACPI_EXTERN u32 acpi_gbl_original_mode; | 298 | ACPI_GLOBAL(u32, acpi_gbl_original_mode); |
| 305 | ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; | 299 | ACPI_GLOBAL(u32, acpi_gbl_rsdp_original_location); |
| 306 | ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; | 300 | ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count); |
| 307 | ACPI_EXTERN u32 acpi_gbl_ps_find_count; | 301 | ACPI_GLOBAL(u32, acpi_gbl_ps_find_count); |
| 308 | ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; | 302 | ACPI_GLOBAL(u16, acpi_gbl_pm1_enable_register_save); |
| 309 | ACPI_EXTERN u8 acpi_gbl_debugger_configuration; | 303 | ACPI_GLOBAL(u8, acpi_gbl_debugger_configuration); |
| 310 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; | 304 | ACPI_GLOBAL(u8, acpi_gbl_step_to_next_call); |
| 311 | ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; | 305 | ACPI_GLOBAL(u8, acpi_gbl_acpi_hardware_present); |
| 312 | ACPI_EXTERN u8 acpi_gbl_events_initialized; | 306 | ACPI_GLOBAL(u8, acpi_gbl_events_initialized); |
| 313 | ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces; | 307 | ACPI_GLOBAL(struct acpi_interface_info *, acpi_gbl_supported_interfaces); |
| 314 | ACPI_EXTERN struct acpi_address_range | 308 | ACPI_GLOBAL(struct acpi_address_range *, |
| 315 | *acpi_gbl_address_range_list[ACPI_ADDRESS_RANGE_MAX]; | 309 | acpi_gbl_address_range_list[ACPI_ADDRESS_RANGE_MAX]); |
| 316 | 310 | ||
| 317 | #ifndef DEFINE_ACPI_GLOBALS | 311 | /* Other miscellaneous, declared and initialized in utglobal */ |
| 318 | 312 | ||
| 319 | /* Other miscellaneous */ | ||
| 320 | |||
| 321 | extern u8 acpi_gbl_shutdown; | ||
| 322 | extern u32 acpi_gbl_startup_flags; | ||
| 323 | extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; | 313 | extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; |
| 324 | extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS]; | 314 | extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS]; |
| 325 | extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS]; | 315 | extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS]; |
| 326 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; | ||
| 327 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | 316 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; |
| 328 | 317 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; | |
| 329 | #endif | ||
| 330 | 318 | ||
| 331 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 319 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
| 332 | 320 | ||
| 333 | /* Lists for tracking memory allocations */ | 321 | /* Lists for tracking memory allocations (debug only) */ |
| 334 | 322 | ||
| 335 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; | 323 | ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list); |
| 336 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; | 324 | ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list); |
| 337 | ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats; | 325 | ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats); |
| 338 | ACPI_EXTERN u8 acpi_gbl_disable_mem_tracking; | 326 | ACPI_GLOBAL(u8, acpi_gbl_disable_mem_tracking); |
| 339 | #endif | 327 | #endif |
| 340 | 328 | ||
| 341 | /***************************************************************************** | 329 | /***************************************************************************** |
| @@ -350,22 +338,23 @@ ACPI_EXTERN u8 acpi_gbl_disable_mem_tracking; | |||
| 350 | #define NUM_PREDEFINED_NAMES 9 | 338 | #define NUM_PREDEFINED_NAMES 9 |
| 351 | #endif | 339 | #endif |
| 352 | 340 | ||
| 353 | ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; | 341 | ACPI_GLOBAL(struct acpi_namespace_node, acpi_gbl_root_node_struct); |
| 354 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; | 342 | ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_root_node); |
| 355 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; | 343 | ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_fadt_gpe_device); |
| 356 | ACPI_EXTERN union acpi_operand_object *acpi_gbl_module_code_list; | 344 | ACPI_GLOBAL(union acpi_operand_object *, acpi_gbl_module_code_list); |
| 357 | 345 | ||
| 358 | extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES]; | 346 | extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES]; |
| 359 | extern const struct acpi_predefined_names | 347 | extern const struct acpi_predefined_names |
| 360 | acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES]; | 348 | acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES]; |
| 361 | 349 | ||
| 362 | #ifdef ACPI_DEBUG_OUTPUT | 350 | #ifdef ACPI_DEBUG_OUTPUT |
| 363 | ACPI_EXTERN u32 acpi_gbl_current_node_count; | 351 | ACPI_GLOBAL(u32, acpi_gbl_current_node_count); |
| 364 | ACPI_EXTERN u32 acpi_gbl_current_node_size; | 352 | ACPI_GLOBAL(u32, acpi_gbl_current_node_size); |
| 365 | ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; | 353 | ACPI_GLOBAL(u32, acpi_gbl_max_concurrent_node_count); |
| 366 | ACPI_EXTERN acpi_size *acpi_gbl_entry_stack_pointer; | 354 | ACPI_GLOBAL(acpi_size *, acpi_gbl_entry_stack_pointer); |
| 367 | ACPI_EXTERN acpi_size *acpi_gbl_lowest_stack_pointer; | 355 | ACPI_GLOBAL(acpi_size *, acpi_gbl_lowest_stack_pointer); |
| 368 | ACPI_EXTERN u32 acpi_gbl_deepest_nesting; | 356 | ACPI_GLOBAL(u32, acpi_gbl_deepest_nesting); |
| 357 | ACPI_INIT_GLOBAL(u32, acpi_gbl_nesting_level, 0); | ||
| 369 | #endif | 358 | #endif |
| 370 | 359 | ||
| 371 | /***************************************************************************** | 360 | /***************************************************************************** |
| @@ -374,11 +363,11 @@ ACPI_EXTERN u32 acpi_gbl_deepest_nesting; | |||
| 374 | * | 363 | * |
| 375 | ****************************************************************************/ | 364 | ****************************************************************************/ |
| 376 | 365 | ||
| 377 | ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; | 366 | ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list); |
| 378 | 367 | ||
| 379 | /* Control method single step flag */ | 368 | /* Control method single step flag */ |
| 380 | 369 | ||
| 381 | ACPI_EXTERN u8 acpi_gbl_cm_single_step; | 370 | ACPI_GLOBAL(u8, acpi_gbl_cm_single_step); |
| 382 | 371 | ||
| 383 | /***************************************************************************** | 372 | /***************************************************************************** |
| 384 | * | 373 | * |
| @@ -388,8 +377,9 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step; | |||
| 388 | 377 | ||
| 389 | extern struct acpi_bit_register_info | 378 | extern struct acpi_bit_register_info |
| 390 | acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; | 379 | acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; |
| 391 | ACPI_EXTERN u8 acpi_gbl_sleep_type_a; | 380 | |
| 392 | ACPI_EXTERN u8 acpi_gbl_sleep_type_b; | 381 | ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a); |
| 382 | ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b); | ||
| 393 | 383 | ||
| 394 | /***************************************************************************** | 384 | /***************************************************************************** |
| 395 | * | 385 | * |
| @@ -399,14 +389,15 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b; | |||
| 399 | 389 | ||
| 400 | #if (!ACPI_REDUCED_HARDWARE) | 390 | #if (!ACPI_REDUCED_HARDWARE) |
| 401 | 391 | ||
| 402 | ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized; | 392 | ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized); |
| 403 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | 393 | ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head); |
| 404 | ACPI_EXTERN struct acpi_gpe_block_info | 394 | ACPI_GLOBAL(struct acpi_gpe_block_info *, |
| 405 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | 395 | acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]); |
| 406 | ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler; | 396 | ACPI_GLOBAL(acpi_gbl_event_handler, acpi_gbl_global_event_handler); |
| 407 | ACPI_EXTERN void *acpi_gbl_global_event_handler_context; | 397 | ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context); |
| 408 | ACPI_EXTERN struct acpi_fixed_event_handler | 398 | ACPI_GLOBAL(struct acpi_fixed_event_handler, |
| 409 | acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; | 399 | acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]); |
| 400 | |||
| 410 | extern struct acpi_fixed_event_info | 401 | extern struct acpi_fixed_event_info |
| 411 | acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; | 402 | acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; |
| 412 | 403 | ||
| @@ -418,23 +409,19 @@ extern struct acpi_fixed_event_info | |||
| 418 | * | 409 | * |
| 419 | ****************************************************************************/ | 410 | ****************************************************************************/ |
| 420 | 411 | ||
| 421 | /* Procedure nesting level for debug output */ | ||
| 422 | |||
| 423 | extern u32 acpi_gbl_nesting_level; | ||
| 424 | |||
| 425 | /* Event counters */ | 412 | /* Event counters */ |
| 426 | 413 | ||
| 427 | ACPI_EXTERN u32 acpi_method_count; | 414 | ACPI_GLOBAL(u32, acpi_method_count); |
| 428 | ACPI_EXTERN u32 acpi_gpe_count; | 415 | ACPI_GLOBAL(u32, acpi_gpe_count); |
| 429 | ACPI_EXTERN u32 acpi_sci_count; | 416 | ACPI_GLOBAL(u32, acpi_sci_count); |
| 430 | ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]; | 417 | ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]); |
| 431 | 418 | ||
| 432 | /* Support for dynamic control method tracing mechanism */ | 419 | /* Support for dynamic control method tracing mechanism */ |
| 433 | 420 | ||
| 434 | ACPI_EXTERN u32 acpi_gbl_original_dbg_level; | 421 | ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level); |
| 435 | ACPI_EXTERN u32 acpi_gbl_original_dbg_layer; | 422 | ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer); |
| 436 | ACPI_EXTERN u32 acpi_gbl_trace_dbg_level; | 423 | ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_level); |
| 437 | ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; | 424 | ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_layer); |
| 438 | 425 | ||
| 439 | /***************************************************************************** | 426 | /***************************************************************************** |
| 440 | * | 427 | * |
| @@ -442,61 +429,64 @@ ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; | |||
| 442 | * | 429 | * |
| 443 | ****************************************************************************/ | 430 | ****************************************************************************/ |
| 444 | 431 | ||
| 445 | ACPI_EXTERN u8 acpi_gbl_db_output_flags; | 432 | ACPI_GLOBAL(u8, acpi_gbl_db_output_flags); |
| 446 | 433 | ||
| 447 | #ifdef ACPI_DISASSEMBLER | 434 | #ifdef ACPI_DISASSEMBLER |
| 448 | 435 | ||
| 449 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE); | 436 | /* Do not disassemble buffers to resource descriptors */ |
| 437 | |||
| 438 | ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE); | ||
| 439 | ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE); | ||
| 450 | 440 | ||
| 451 | ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; | 441 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_disasm); |
| 452 | ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; | 442 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_verbose); |
| 453 | ACPI_EXTERN u8 acpi_gbl_num_external_methods; | 443 | ACPI_GLOBAL(u8, acpi_gbl_num_external_methods); |
| 454 | ACPI_EXTERN u32 acpi_gbl_resolved_external_methods; | 444 | ACPI_GLOBAL(u32, acpi_gbl_resolved_external_methods); |
| 455 | ACPI_EXTERN struct acpi_external_list *acpi_gbl_external_list; | 445 | ACPI_GLOBAL(struct acpi_external_list *, acpi_gbl_external_list); |
| 456 | ACPI_EXTERN struct acpi_external_file *acpi_gbl_external_file_list; | 446 | ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list); |
| 457 | #endif | 447 | #endif |
| 458 | 448 | ||
| 459 | #ifdef ACPI_DEBUGGER | 449 | #ifdef ACPI_DEBUGGER |
| 460 | 450 | ||
| 461 | extern u8 acpi_gbl_method_executing; | 451 | ACPI_INIT_GLOBAL(u8, acpi_gbl_db_terminate_threads, FALSE); |
| 462 | extern u8 acpi_gbl_abort_method; | 452 | ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE); |
| 463 | extern u8 acpi_gbl_db_terminate_threads; | 453 | ACPI_INIT_GLOBAL(u8, acpi_gbl_method_executing, FALSE); |
| 464 | 454 | ||
| 465 | ACPI_EXTERN u8 acpi_gbl_db_opt_tables; | 455 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_tables); |
| 466 | ACPI_EXTERN u8 acpi_gbl_db_opt_stats; | 456 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_stats); |
| 467 | ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; | 457 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_ini_methods); |
| 468 | ACPI_EXTERN u8 acpi_gbl_db_opt_no_region_support; | 458 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_region_support); |
| 469 | ACPI_EXTERN u8 acpi_gbl_db_output_to_file; | 459 | ACPI_GLOBAL(u8, acpi_gbl_db_output_to_file); |
| 470 | ACPI_EXTERN char *acpi_gbl_db_buffer; | 460 | ACPI_GLOBAL(char *, acpi_gbl_db_buffer); |
| 471 | ACPI_EXTERN char *acpi_gbl_db_filename; | 461 | ACPI_GLOBAL(char *, acpi_gbl_db_filename); |
| 472 | ACPI_EXTERN u32 acpi_gbl_db_debug_level; | 462 | ACPI_GLOBAL(u32, acpi_gbl_db_debug_level); |
| 473 | ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; | 463 | ACPI_GLOBAL(u32, acpi_gbl_db_console_debug_level); |
| 474 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; | 464 | ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node); |
| 475 | 465 | ||
| 476 | ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; | 466 | ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]); |
| 477 | ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]; | 467 | ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]); |
| 478 | 468 | ||
| 479 | /* These buffers should all be the same size */ | 469 | /* These buffers should all be the same size */ |
| 480 | 470 | ||
| 481 | ACPI_EXTERN char acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]; | 471 | ACPI_GLOBAL(char, acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]); |
| 482 | ACPI_EXTERN char acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]; | 472 | ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]); |
| 483 | ACPI_EXTERN char acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]; | 473 | ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]); |
| 484 | ACPI_EXTERN char acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]; | 474 | ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]); |
| 485 | 475 | ||
| 486 | /* | 476 | /* |
| 487 | * Statistic globals | 477 | * Statistic globals |
| 488 | */ | 478 | */ |
| 489 | ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; | 479 | ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1]); |
| 490 | ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; | 480 | ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1]); |
| 491 | ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; | 481 | ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc); |
| 492 | ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; | 482 | ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc); |
| 493 | ACPI_EXTERN u32 acpi_gbl_num_nodes; | 483 | ACPI_GLOBAL(u32, acpi_gbl_num_nodes); |
| 494 | ACPI_EXTERN u32 acpi_gbl_num_objects; | 484 | ACPI_GLOBAL(u32, acpi_gbl_num_objects); |
| 495 | 485 | ||
| 496 | ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; | 486 | ACPI_GLOBAL(u32, acpi_gbl_size_of_parse_tree); |
| 497 | ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; | 487 | ACPI_GLOBAL(u32, acpi_gbl_size_of_method_trees); |
| 498 | ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; | 488 | ACPI_GLOBAL(u32, acpi_gbl_size_of_node_entries); |
| 499 | ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; | 489 | ACPI_GLOBAL(u32, acpi_gbl_size_of_acpi_objects); |
| 500 | 490 | ||
| 501 | #endif /* ACPI_DEBUGGER */ | 491 | #endif /* ACPI_DEBUGGER */ |
| 502 | 492 | ||
| @@ -508,7 +498,7 @@ ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; | |||
| 508 | 498 | ||
| 509 | #ifdef ACPI_APPLICATION | 499 | #ifdef ACPI_APPLICATION |
| 510 | 500 | ||
| 511 | ACPI_FILE ACPI_INIT_GLOBAL(acpi_gbl_debug_file, NULL); | 501 | ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL); |
| 512 | 502 | ||
| 513 | #endif /* ACPI_APPLICATION */ | 503 | #endif /* ACPI_APPLICATION */ |
| 514 | 504 | ||
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 6357e932bfd9..2ad2351a9833 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index 8af8c9bdeb35..b01f71ce0523 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -87,6 +87,10 @@ typedef const struct acpi_exdump_info { | |||
| 87 | #define ACPI_EXD_PACKAGE 11 | 87 | #define ACPI_EXD_PACKAGE 11 |
| 88 | #define ACPI_EXD_FIELD 12 | 88 | #define ACPI_EXD_FIELD 12 |
| 89 | #define ACPI_EXD_REFERENCE 13 | 89 | #define ACPI_EXD_REFERENCE 13 |
| 90 | #define ACPI_EXD_LIST 14 /* Operand object list */ | ||
| 91 | #define ACPI_EXD_HDLR_LIST 15 /* Address Handler list */ | ||
| 92 | #define ACPI_EXD_RGN_LIST 16 /* Region list */ | ||
| 93 | #define ACPI_EXD_NODE 17 /* Namespace Node */ | ||
| 90 | 94 | ||
| 91 | /* restore default alignment */ | 95 | /* restore default alignment */ |
| 92 | 96 | ||
| @@ -454,10 +458,6 @@ void acpi_ex_enter_interpreter(void); | |||
| 454 | 458 | ||
| 455 | void acpi_ex_exit_interpreter(void); | 459 | void acpi_ex_exit_interpreter(void); |
| 456 | 460 | ||
| 457 | void acpi_ex_reacquire_interpreter(void); | ||
| 458 | |||
| 459 | void acpi_ex_relinquish_interpreter(void); | ||
| 460 | |||
| 461 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); | 461 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); |
| 462 | 462 | ||
| 463 | void acpi_ex_acquire_global_lock(u32 rule); | 463 | void acpi_ex_acquire_global_lock(u32 rule); |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index d95ca5449ace..52a21dafb540 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 2a86c65d873b..4bceb11c7380 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -63,17 +63,21 @@ | |||
| 63 | #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) | 63 | #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) |
| 64 | 64 | ||
| 65 | /* | 65 | /* |
| 66 | * printf() format helpers | 66 | * printf() format helpers. These macros are workarounds for the difficulties |
| 67 | * with emitting 64-bit integers and 64-bit pointers with the same code | ||
| 68 | * for both 32-bit and 64-bit hosts. | ||
| 67 | */ | 69 | */ |
| 68 | |||
| 69 | /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ | ||
| 70 | |||
| 71 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) | 70 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) |
| 72 | 71 | ||
| 73 | #if ACPI_MACHINE_WIDTH == 64 | 72 | #if ACPI_MACHINE_WIDTH == 64 |
| 74 | #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) | 73 | #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) |
| 74 | #define ACPI_FORMAT_TO_UINT(i) ACPI_FORMAT_UINT64(i) | ||
| 75 | #define ACPI_PRINTF_UINT "0x%8.8X%8.8X" | ||
| 76 | |||
| 75 | #else | 77 | #else |
| 76 | #define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) | 78 | #define ACPI_FORMAT_NATIVE_UINT(i) 0, (u32) (i) |
| 79 | #define ACPI_FORMAT_TO_UINT(i) (u32) (i) | ||
| 80 | #define ACPI_PRINTF_UINT "0x%8.8X" | ||
| 77 | #endif | 81 | #endif |
| 78 | 82 | ||
| 79 | /* | 83 | /* |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index e6138ac4a160..ee1c040f321c 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index cc7ab6dd724e..22fb6449d3d6 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -193,7 +193,8 @@ struct acpi_object_method { | |||
| 193 | #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ | 193 | #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ |
| 194 | #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ | 194 | #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ |
| 195 | #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ | 195 | #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ |
| 196 | #define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */ | 196 | #define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */ |
| 197 | #define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */ | ||
| 197 | 198 | ||
| 198 | /****************************************************************************** | 199 | /****************************************************************************** |
| 199 | * | 200 | * |
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h index 3fc9ca7e8aa3..dda0e6affcf1 100644 --- a/drivers/acpi/acpica/acopcode.h +++ b/drivers/acpi/acpica/acopcode.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h index aed319318835..6168b85463ed 100644 --- a/drivers/acpi/acpica/acparser.h +++ b/drivers/acpi/acpica/acparser.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index f600aded7261..a48d713e9599 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -48,7 +48,7 @@ | |||
| 48 | * | 48 | * |
| 49 | * Return Package types | 49 | * Return Package types |
| 50 | * | 50 | * |
| 51 | * 1) PTYPE1 packages do not contain sub-packages. | 51 | * 1) PTYPE1 packages do not contain subpackages. |
| 52 | * | 52 | * |
| 53 | * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types: | 53 | * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types: |
| 54 | * object type | 54 | * object type |
| @@ -63,8 +63,8 @@ | |||
| 63 | * (Used for _PRW) | 63 | * (Used for _PRW) |
| 64 | * | 64 | * |
| 65 | * | 65 | * |
| 66 | * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each | 66 | * 2) PTYPE2 packages contain a Variable-length number of subpackages. Each |
| 67 | * of the different types describe the contents of each of the sub-packages. | 67 | * of the different types describe the contents of each of the subpackages. |
| 68 | * | 68 | * |
| 69 | * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length | 69 | * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length |
| 70 | * parent package is allowed: | 70 | * parent package is allowed: |
| @@ -560,7 +560,7 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = { | |||
| 560 | 560 | ||
| 561 | /* | 561 | /* |
| 562 | * For _HPX, a single package is returned, containing a variable-length number | 562 | * For _HPX, a single package is returned, containing a variable-length number |
| 563 | * of sub-packages. Each sub-package contains a PCI record setting. | 563 | * of subpackages. Each subpackage contains a PCI record setting. |
| 564 | * There are several different type of record settings, of different | 564 | * There are several different type of record settings, of different |
| 565 | * lengths, but all elements of all settings are Integers. | 565 | * lengths, but all elements of all settings are Integers. |
| 566 | */ | 566 | */ |
| @@ -698,6 +698,12 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = { | |||
| 698 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | 698 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
| 699 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | 699 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
| 700 | 700 | ||
| 701 | {{"_PRP", METHOD_0ARGS, | ||
| 702 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Str, 1 Int/Str/Pkg */ | ||
| 703 | PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, | ||
| 704 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | | ||
| 705 | ACPI_RTYPE_PACKAGE | ACPI_RTYPE_REFERENCE, 1, 0), | ||
| 706 | |||
| 701 | {{"_PRS", METHOD_0ARGS, | 707 | {{"_PRS", METHOD_0ARGS, |
| 702 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | 708 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, |
| 703 | 709 | ||
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h index ff97430455cb..4b008e8884a1 100644 --- a/drivers/acpi/acpica/acresrc.h +++ b/drivers/acpi/acpica/acresrc.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h index fc83c0a5ca70..cf7346110bd8 100644 --- a/drivers/acpi/acpica/acstruct.h +++ b/drivers/acpi/acpica/acstruct.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -133,6 +133,9 @@ struct acpi_init_walk_info { | |||
| 133 | u32 table_index; | 133 | u32 table_index; |
| 134 | u32 object_count; | 134 | u32 object_count; |
| 135 | u32 method_count; | 135 | u32 method_count; |
| 136 | u32 serial_method_count; | ||
| 137 | u32 non_serial_method_count; | ||
| 138 | u32 serialized_method_count; | ||
| 136 | u32 device_count; | 139 | u32 device_count; |
| 137 | u32 op_region_count; | 140 | u32 op_region_count; |
| 138 | u32 field_count; | 141 | u32 field_count; |
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index c54f42c64fe2..5fa4b2027697 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index be8180c17d7e..ceeec0b7ccb1 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -49,7 +49,7 @@ extern const u8 acpi_gbl_resource_aml_serial_bus_sizes[]; | |||
| 49 | 49 | ||
| 50 | /* Strings used by the disassembler and debugger resource dump routines */ | 50 | /* Strings used by the disassembler and debugger resource dump routines */ |
| 51 | 51 | ||
| 52 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 52 | #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) |
| 53 | 53 | ||
| 54 | extern const char *acpi_gbl_bm_decode[]; | 54 | extern const char *acpi_gbl_bm_decode[]; |
| 55 | extern const char *acpi_gbl_config_decode[]; | 55 | extern const char *acpi_gbl_config_decode[]; |
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h index 48a3e331b72d..5908ccec6aea 100644 --- a/drivers/acpi/acpica/amlcode.h +++ b/drivers/acpi/acpica/amlcode.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | * Copyright (C) 2000 - 2013, Intel Corp. | 10 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 11 | * All rights reserved. | 11 | * All rights reserved. |
| 12 | * | 12 | * |
| 13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h index 87c26366d1df..f3f834408441 100644 --- a/drivers/acpi/acpica/amlresrc.h +++ b/drivers/acpi/acpica/amlresrc.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c index afdc6df17abf..720b1cdda711 100644 --- a/drivers/acpi/acpica/dsargs.c +++ b/drivers/acpi/acpica/dsargs.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c index eb56b66444b5..8daf9de82b73 100644 --- a/drivers/acpi/acpica/dscontrol.c +++ b/drivers/acpi/acpica/dscontrol.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index e7a57c554e84..3661c8e90540 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index 14424200d246..aee5e45f6d35 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -83,8 +83,8 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
| 83 | (struct acpi_init_walk_info *)context; | 83 | (struct acpi_init_walk_info *)context; |
| 84 | struct acpi_namespace_node *node = | 84 | struct acpi_namespace_node *node = |
| 85 | (struct acpi_namespace_node *)obj_handle; | 85 | (struct acpi_namespace_node *)obj_handle; |
| 86 | acpi_object_type type; | ||
| 87 | acpi_status status; | 86 | acpi_status status; |
| 87 | union acpi_operand_object *obj_desc; | ||
| 88 | 88 | ||
| 89 | ACPI_FUNCTION_ENTRY(); | 89 | ACPI_FUNCTION_ENTRY(); |
| 90 | 90 | ||
| @@ -100,9 +100,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
| 100 | 100 | ||
| 101 | /* And even then, we are only interested in a few object types */ | 101 | /* And even then, we are only interested in a few object types */ |
| 102 | 102 | ||
| 103 | type = acpi_ns_get_type(obj_handle); | 103 | switch (acpi_ns_get_type(obj_handle)) { |
| 104 | |||
| 105 | switch (type) { | ||
| 106 | case ACPI_TYPE_REGION: | 104 | case ACPI_TYPE_REGION: |
| 107 | 105 | ||
| 108 | status = acpi_ds_initialize_region(obj_handle); | 106 | status = acpi_ds_initialize_region(obj_handle); |
| @@ -117,8 +115,44 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
| 117 | break; | 115 | break; |
| 118 | 116 | ||
| 119 | case ACPI_TYPE_METHOD: | 117 | case ACPI_TYPE_METHOD: |
| 120 | 118 | /* | |
| 119 | * Auto-serialization support. We will examine each method that is | ||
| 120 | * not_serialized to determine if it creates any Named objects. If | ||
| 121 | * it does, it will be marked serialized to prevent problems if | ||
| 122 | * the method is entered by two or more threads and an attempt is | ||
| 123 | * made to create the same named object twice -- which results in | ||
| 124 | * an AE_ALREADY_EXISTS exception and method abort. | ||
| 125 | */ | ||
| 121 | info->method_count++; | 126 | info->method_count++; |
| 127 | obj_desc = acpi_ns_get_attached_object(node); | ||
| 128 | if (!obj_desc) { | ||
| 129 | break; | ||
| 130 | } | ||
| 131 | |||
| 132 | /* Ignore if already serialized */ | ||
| 133 | |||
| 134 | if (obj_desc->method.info_flags & ACPI_METHOD_SERIALIZED) { | ||
| 135 | info->serial_method_count++; | ||
| 136 | break; | ||
| 137 | } | ||
| 138 | |||
| 139 | if (acpi_gbl_auto_serialize_methods) { | ||
| 140 | |||
| 141 | /* Parse/scan method and serialize it if necessary */ | ||
| 142 | |||
| 143 | acpi_ds_auto_serialize_method(node, obj_desc); | ||
| 144 | if (obj_desc->method. | ||
| 145 | info_flags & ACPI_METHOD_SERIALIZED) { | ||
| 146 | |||
| 147 | /* Method was just converted to Serialized */ | ||
| 148 | |||
| 149 | info->serial_method_count++; | ||
| 150 | info->serialized_method_count++; | ||
| 151 | break; | ||
| 152 | } | ||
| 153 | } | ||
| 154 | |||
| 155 | info->non_serial_method_count++; | ||
| 122 | break; | 156 | break; |
| 123 | 157 | ||
| 124 | case ACPI_TYPE_DEVICE: | 158 | case ACPI_TYPE_DEVICE: |
| @@ -170,7 +204,6 @@ acpi_ds_initialize_objects(u32 table_index, | |||
| 170 | 204 | ||
| 171 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 172 | "**** Starting initialization of namespace objects ****\n")); | 206 | "**** Starting initialization of namespace objects ****\n")); |
| 173 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); | ||
| 174 | 207 | ||
| 175 | /* Set all init info to zero */ | 208 | /* Set all init info to zero */ |
| 176 | 209 | ||
| @@ -205,14 +238,16 @@ acpi_ds_initialize_objects(u32 table_index, | |||
| 205 | } | 238 | } |
| 206 | 239 | ||
| 207 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 240 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
| 208 | "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n", | 241 | "Table [%4.4s] (id %4.4X) - %4u Objects with %3u Devices, " |
| 242 | "%3u Regions, %3u Methods (%u/%u/%u Serial/Non/Cvt)\n", | ||
| 209 | table->signature, owner_id, info.object_count, | 243 | table->signature, owner_id, info.object_count, |
| 210 | info.device_count, info.method_count, | 244 | info.device_count, info.op_region_count, |
| 211 | info.op_region_count)); | 245 | info.method_count, info.serial_method_count, |
| 246 | info.non_serial_method_count, | ||
| 247 | info.serialized_method_count)); | ||
| 212 | 248 | ||
| 213 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 249 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n", |
| 214 | "%u Methods, %u Regions\n", info.method_count, | 250 | info.method_count, info.op_region_count)); |
| 215 | info.op_region_count)); | ||
| 216 | 251 | ||
| 217 | return_ACPI_STATUS(AE_OK); | 252 | return_ACPI_STATUS(AE_OK); |
| 218 | } | 253 | } |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 81a78ba84311..3c7f7378b94d 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -49,16 +49,155 @@ | |||
| 49 | #ifdef ACPI_DISASSEMBLER | 49 | #ifdef ACPI_DISASSEMBLER |
| 50 | #include "acdisasm.h" | 50 | #include "acdisasm.h" |
| 51 | #endif | 51 | #endif |
| 52 | #include "acparser.h" | ||
| 53 | #include "amlcode.h" | ||
| 52 | 54 | ||
| 53 | #define _COMPONENT ACPI_DISPATCHER | 55 | #define _COMPONENT ACPI_DISPATCHER |
| 54 | ACPI_MODULE_NAME("dsmethod") | 56 | ACPI_MODULE_NAME("dsmethod") |
| 55 | 57 | ||
| 56 | /* Local prototypes */ | 58 | /* Local prototypes */ |
| 57 | static acpi_status | 59 | static acpi_status |
| 60 | acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state, | ||
| 61 | union acpi_parse_object **out_op); | ||
| 62 | |||
| 63 | static acpi_status | ||
| 58 | acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); | 64 | acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); |
| 59 | 65 | ||
| 60 | /******************************************************************************* | 66 | /******************************************************************************* |
| 61 | * | 67 | * |
| 68 | * FUNCTION: acpi_ds_auto_serialize_method | ||
| 69 | * | ||
| 70 | * PARAMETERS: node - Namespace Node of the method | ||
| 71 | * obj_desc - Method object attached to node | ||
| 72 | * | ||
| 73 | * RETURN: Status | ||
| 74 | * | ||
| 75 | * DESCRIPTION: Parse a control method AML to scan for control methods that | ||
| 76 | * need serialization due to the creation of named objects. | ||
| 77 | * | ||
| 78 | * NOTE: It is a bit of overkill to mark all such methods serialized, since | ||
| 79 | * there is only a problem if the method actually blocks during execution. | ||
| 80 | * A blocking operation is, for example, a Sleep() operation, or any access | ||
| 81 | * to an operation region. However, it is probably not possible to easily | ||
| 82 | * detect whether a method will block or not, so we simply mark all suspicious | ||
| 83 | * methods as serialized. | ||
| 84 | * | ||
| 85 | * NOTE2: This code is essentially a generic routine for parsing a single | ||
| 86 | * control method. | ||
| 87 | * | ||
| 88 | ******************************************************************************/ | ||
| 89 | |||
| 90 | acpi_status | ||
| 91 | acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, | ||
| 92 | union acpi_operand_object *obj_desc) | ||
| 93 | { | ||
| 94 | acpi_status status; | ||
| 95 | union acpi_parse_object *op = NULL; | ||
| 96 | struct acpi_walk_state *walk_state; | ||
| 97 | |||
| 98 | ACPI_FUNCTION_TRACE_PTR(ds_auto_serialize_method, node); | ||
| 99 | |||
| 100 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | ||
| 101 | "Method auto-serialization parse [%4.4s] %p\n", | ||
| 102 | acpi_ut_get_node_name(node), node)); | ||
| 103 | |||
| 104 | /* Create/Init a root op for the method parse tree */ | ||
| 105 | |||
| 106 | op = acpi_ps_alloc_op(AML_METHOD_OP); | ||
| 107 | if (!op) { | ||
| 108 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
| 109 | } | ||
| 110 | |||
| 111 | acpi_ps_set_name(op, node->name.integer); | ||
| 112 | op->common.node = node; | ||
| 113 | |||
| 114 | /* Create and initialize a new walk state */ | ||
| 115 | |||
| 116 | walk_state = | ||
| 117 | acpi_ds_create_walk_state(node->owner_id, NULL, NULL, NULL); | ||
| 118 | if (!walk_state) { | ||
| 119 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
| 120 | } | ||
| 121 | |||
| 122 | status = | ||
| 123 | acpi_ds_init_aml_walk(walk_state, op, node, | ||
| 124 | obj_desc->method.aml_start, | ||
| 125 | obj_desc->method.aml_length, NULL, 0); | ||
| 126 | if (ACPI_FAILURE(status)) { | ||
| 127 | acpi_ds_delete_walk_state(walk_state); | ||
| 128 | return_ACPI_STATUS(status); | ||
| 129 | } | ||
| 130 | |||
| 131 | walk_state->descending_callback = acpi_ds_detect_named_opcodes; | ||
| 132 | |||
| 133 | /* Parse the method, scan for creation of named objects */ | ||
| 134 | |||
| 135 | status = acpi_ps_parse_aml(walk_state); | ||
| 136 | if (ACPI_FAILURE(status)) { | ||
| 137 | return_ACPI_STATUS(status); | ||
| 138 | } | ||
| 139 | |||
| 140 | acpi_ps_delete_parse_tree(op); | ||
| 141 | return_ACPI_STATUS(status); | ||
| 142 | } | ||
| 143 | |||
| 144 | /******************************************************************************* | ||
| 145 | * | ||
| 146 | * FUNCTION: acpi_ds_detect_named_opcodes | ||
| 147 | * | ||
| 148 | * PARAMETERS: walk_state - Current state of the parse tree walk | ||
| 149 | * out_op - Unused, required for parser interface | ||
| 150 | * | ||
| 151 | * RETURN: Status | ||
| 152 | * | ||
| 153 | * DESCRIPTION: Descending callback used during the loading of ACPI tables. | ||
| 154 | * Currently used to detect methods that must be marked serialized | ||
| 155 | * in order to avoid problems with the creation of named objects. | ||
| 156 | * | ||
| 157 | ******************************************************************************/ | ||
| 158 | |||
| 159 | static acpi_status | ||
| 160 | acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state, | ||
| 161 | union acpi_parse_object **out_op) | ||
| 162 | { | ||
| 163 | |||
| 164 | ACPI_FUNCTION_NAME(acpi_ds_detect_named_opcodes); | ||
| 165 | |||
| 166 | /* We are only interested in opcodes that create a new name */ | ||
| 167 | |||
| 168 | if (! | ||
| 169 | (walk_state->op_info-> | ||
| 170 | flags & (AML_NAMED | AML_CREATE | AML_FIELD))) { | ||
| 171 | return (AE_OK); | ||
| 172 | } | ||
| 173 | |||
| 174 | /* | ||
| 175 | * At this point, we know we have a Named object opcode. | ||
| 176 | * Mark the method as serialized. Later code will create a mutex for | ||
| 177 | * this method to enforce serialization. | ||
| 178 | * | ||
| 179 | * Note, ACPI_METHOD_IGNORE_SYNC_LEVEL flag means that we will ignore the | ||
| 180 | * Sync Level mechanism for this method, even though it is now serialized. | ||
| 181 | * Otherwise, there can be conflicts with existing ASL code that actually | ||
| 182 | * uses sync levels. | ||
| 183 | */ | ||
| 184 | walk_state->method_desc->method.sync_level = 0; | ||
| 185 | walk_state->method_desc->method.info_flags |= | ||
| 186 | (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); | ||
| 187 | |||
| 188 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
| 189 | "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", | ||
| 190 | walk_state->method_node->name.ascii, | ||
| 191 | walk_state->method_node, walk_state->op_info->name, | ||
| 192 | walk_state->opcode)); | ||
| 193 | |||
| 194 | /* Abort the parse, no need to examine this method any further */ | ||
| 195 | |||
| 196 | return (AE_CTRL_TERMINATE); | ||
| 197 | } | ||
| 198 | |||
| 199 | /******************************************************************************* | ||
| 200 | * | ||
| 62 | * FUNCTION: acpi_ds_method_error | 201 | * FUNCTION: acpi_ds_method_error |
| 63 | * | 202 | * |
| 64 | * PARAMETERS: status - Execution status | 203 | * PARAMETERS: status - Execution status |
| @@ -74,7 +213,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); | |||
| 74 | ******************************************************************************/ | 213 | ******************************************************************************/ |
| 75 | 214 | ||
| 76 | acpi_status | 215 | acpi_status |
| 77 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | 216 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state * walk_state) |
| 78 | { | 217 | { |
| 79 | ACPI_FUNCTION_ENTRY(); | 218 | ACPI_FUNCTION_ENTRY(); |
| 80 | 219 | ||
| @@ -217,13 +356,19 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
| 217 | /* | 356 | /* |
| 218 | * The current_sync_level (per-thread) must be less than or equal to | 357 | * The current_sync_level (per-thread) must be less than or equal to |
| 219 | * the sync level of the method. This mechanism provides some | 358 | * the sync level of the method. This mechanism provides some |
| 220 | * deadlock prevention | 359 | * deadlock prevention. |
| 360 | * | ||
| 361 | * If the method was auto-serialized, we just ignore the sync level | ||
| 362 | * mechanism, because auto-serialization of methods can interfere | ||
| 363 | * with ASL code that actually uses sync levels. | ||
| 221 | * | 364 | * |
| 222 | * Top-level method invocation has no walk state at this point | 365 | * Top-level method invocation has no walk state at this point |
| 223 | */ | 366 | */ |
| 224 | if (walk_state && | 367 | if (walk_state && |
| 225 | (walk_state->thread->current_sync_level > | 368 | (!(obj_desc->method. |
| 226 | obj_desc->method.mutex->mutex.sync_level)) { | 369 | info_flags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) |
| 370 | && (walk_state->thread->current_sync_level > | ||
| 371 | obj_desc->method.mutex->mutex.sync_level)) { | ||
| 227 | ACPI_ERROR((AE_INFO, | 372 | ACPI_ERROR((AE_INFO, |
| 228 | "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", | 373 | "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", |
| 229 | acpi_ut_get_node_name(method_node), | 374 | acpi_ut_get_node_name(method_node), |
| @@ -668,7 +813,8 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
| 668 | method_desc->method.info_flags &= | 813 | method_desc->method.info_flags &= |
| 669 | ~ACPI_METHOD_SERIALIZED_PENDING; | 814 | ~ACPI_METHOD_SERIALIZED_PENDING; |
| 670 | method_desc->method.info_flags |= | 815 | method_desc->method.info_flags |= |
| 671 | ACPI_METHOD_SERIALIZED; | 816 | (ACPI_METHOD_SERIALIZED | |
| 817 | ACPI_METHOD_IGNORE_SYNC_LEVEL); | ||
| 672 | method_desc->method.sync_level = 0; | 818 | method_desc->method.sync_level = 0; |
| 673 | } | 819 | } |
| 674 | 820 | ||
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index c4b0b3657237..b67522df01ac 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index b1746a68dad1..a1e7e6b6fcf7 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 5205edcf2c01..6c0759c0db47 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index d7f53fb2979a..9f74795e2268 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index 1bbb22fd6fa0..f7f5107e754d 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 2dbe109727c8..15623da26200 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -73,8 +73,20 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) | |||
| 73 | { | 73 | { |
| 74 | 74 | ||
| 75 | switch (pass_number) { | 75 | switch (pass_number) { |
| 76 | case 0: | ||
| 77 | |||
| 78 | /* Parse only - caller will setup callbacks */ | ||
| 79 | |||
| 80 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | ||
| 81 | ACPI_PARSE_DELETE_TREE | ACPI_PARSE_DISASSEMBLE; | ||
| 82 | walk_state->descending_callback = NULL; | ||
| 83 | walk_state->ascending_callback = NULL; | ||
| 84 | break; | ||
| 85 | |||
| 76 | case 1: | 86 | case 1: |
| 77 | 87 | ||
| 88 | /* Load pass 1 */ | ||
| 89 | |||
| 78 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | 90 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
| 79 | ACPI_PARSE_DELETE_TREE; | 91 | ACPI_PARSE_DELETE_TREE; |
| 80 | walk_state->descending_callback = acpi_ds_load1_begin_op; | 92 | walk_state->descending_callback = acpi_ds_load1_begin_op; |
| @@ -83,6 +95,8 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) | |||
| 83 | 95 | ||
| 84 | case 2: | 96 | case 2: |
| 85 | 97 | ||
| 98 | /* Load pass 2 */ | ||
| 99 | |||
| 86 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | 100 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
| 87 | ACPI_PARSE_DELETE_TREE; | 101 | ACPI_PARSE_DELETE_TREE; |
| 88 | walk_state->descending_callback = acpi_ds_load2_begin_op; | 102 | walk_state->descending_callback = acpi_ds_load2_begin_op; |
| @@ -91,6 +105,8 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) | |||
| 91 | 105 | ||
| 92 | case 3: | 106 | case 3: |
| 93 | 107 | ||
| 108 | /* Execution pass */ | ||
| 109 | |||
| 94 | #ifndef ACPI_NO_METHOD_EXECUTION | 110 | #ifndef ACPI_NO_METHOD_EXECUTION |
| 95 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | | 111 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | |
| 96 | ACPI_PARSE_DELETE_TREE; | 112 | ACPI_PARSE_DELETE_TREE; |
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index 7f569d573027..2ac28d297305 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c index d67891de1b54..9d6e2c1de1f8 100644 --- a/drivers/acpi/acpica/dswscope.c +++ b/drivers/acpi/acpica/dswscope.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c index ecb12e2137ff..24f7d5ea678a 100644 --- a/drivers/acpi/acpica/dswstate.c +++ b/drivers/acpi/acpica/dswstate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index 83cd45f4a870..c7bffff9ed32 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c index 4c67193a9fa7..3393a73ca0d6 100644 --- a/drivers/acpi/acpica/evglock.c +++ b/drivers/acpi/acpica/evglock.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index a9cb4a1a4bb8..955f83da68a5 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index a31e549e64cc..caaed3c673fd 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index a3e2f38aadf6..ae779c1e871d 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c index 4d764e847a08..17e4bbfdb096 100644 --- a/drivers/acpi/acpica/evgpeutil.c +++ b/drivers/acpi/acpica/evgpeutil.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c index e3157313eb27..78ac29351c9e 100644 --- a/drivers/acpi/acpica/evhandler.c +++ b/drivers/acpi/acpica/evhandler.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index a5687540e9a6..5d594eb2e5ec 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 144cbb9b73bc..9957297d1580 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -314,6 +314,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
| 314 | { | 314 | { |
| 315 | union acpi_operand_object *handler_obj; | 315 | union acpi_operand_object *handler_obj; |
| 316 | union acpi_operand_object *obj_desc; | 316 | union acpi_operand_object *obj_desc; |
| 317 | union acpi_operand_object *start_desc; | ||
| 317 | union acpi_operand_object **last_obj_ptr; | 318 | union acpi_operand_object **last_obj_ptr; |
| 318 | acpi_adr_space_setup region_setup; | 319 | acpi_adr_space_setup region_setup; |
| 319 | void **region_context; | 320 | void **region_context; |
| @@ -341,6 +342,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
| 341 | /* Find this region in the handler's list */ | 342 | /* Find this region in the handler's list */ |
| 342 | 343 | ||
| 343 | obj_desc = handler_obj->address_space.region_list; | 344 | obj_desc = handler_obj->address_space.region_list; |
| 345 | start_desc = obj_desc; | ||
| 344 | last_obj_ptr = &handler_obj->address_space.region_list; | 346 | last_obj_ptr = &handler_obj->address_space.region_list; |
| 345 | 347 | ||
| 346 | while (obj_desc) { | 348 | while (obj_desc) { |
| @@ -438,6 +440,15 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
| 438 | 440 | ||
| 439 | last_obj_ptr = &obj_desc->region.next; | 441 | last_obj_ptr = &obj_desc->region.next; |
| 440 | obj_desc = obj_desc->region.next; | 442 | obj_desc = obj_desc->region.next; |
| 443 | |||
| 444 | /* Prevent infinite loop if list is corrupted */ | ||
| 445 | |||
| 446 | if (obj_desc == start_desc) { | ||
| 447 | ACPI_ERROR((AE_INFO, | ||
| 448 | "Circular handler list in region object %p", | ||
| 449 | region_obj)); | ||
| 450 | return_VOID; | ||
| 451 | } | ||
| 441 | } | 452 | } |
| 442 | 453 | ||
| 443 | /* If we get here, the region was not in the handler's region list */ | 454 | /* If we get here, the region was not in the handler's region list */ |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index 8354c4f7f10c..1b148a440d67 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c index 9e9e3454d893..4d8a709c1fc4 100644 --- a/drivers/acpi/acpica/evsci.c +++ b/drivers/acpi/acpica/evsci.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 23a7fadca412..a734b27da061 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 39d06af5e347..e286640ad4ff 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 5713da77c665..20a1392ffe06 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -583,6 +583,18 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
| 583 | goto unlock_and_exit; | 583 | goto unlock_and_exit; |
| 584 | } | 584 | } |
| 585 | 585 | ||
| 586 | /* Validate the parent device */ | ||
| 587 | |||
| 588 | if (node->type != ACPI_TYPE_DEVICE) { | ||
| 589 | status = AE_TYPE; | ||
| 590 | goto unlock_and_exit; | ||
| 591 | } | ||
| 592 | |||
| 593 | if (node->object) { | ||
| 594 | status = AE_ALREADY_EXISTS; | ||
| 595 | goto unlock_and_exit; | ||
| 596 | } | ||
| 597 | |||
| 586 | /* | 598 | /* |
| 587 | * For user-installed GPE Block Devices, the gpe_block_base_number | 599 | * For user-installed GPE Block Devices, the gpe_block_base_number |
| 588 | * is always zero | 600 | * is always zero |
| @@ -666,6 +678,13 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | |||
| 666 | goto unlock_and_exit; | 678 | goto unlock_and_exit; |
| 667 | } | 679 | } |
| 668 | 680 | ||
| 681 | /* Validate the parent device */ | ||
| 682 | |||
| 683 | if (node->type != ACPI_TYPE_DEVICE) { | ||
| 684 | status = AE_TYPE; | ||
| 685 | goto unlock_and_exit; | ||
| 686 | } | ||
| 687 | |||
| 669 | /* Get the device_object attached to the node */ | 688 | /* Get the device_object attached to the node */ |
| 670 | 689 | ||
| 671 | obj_desc = acpi_ns_get_attached_object(node); | 690 | obj_desc = acpi_ns_get_attached_object(node); |
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index 02ed75ac56cd..2d6f187939c7 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 06d216c8d43a..8ba1464efd11 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 69e4a8cc9b71..c545386fee96 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index 3c2e6dcdad3e..95d23dabcfbb 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c index 81c72a4ecd82..4cfc3d3b5c97 100644 --- a/drivers/acpi/acpica/exdebug.c +++ b/drivers/acpi/acpica/exdebug.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index 4d046faac48c..973fdae00f94 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -94,12 +94,13 @@ static struct acpi_exdump_info acpi_ex_dump_buffer[5] = { | |||
| 94 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL}, | 94 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL}, |
| 95 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"}, | 95 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"}, |
| 96 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"}, | 96 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"}, |
| 97 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.node), "Parent Node"}, | 97 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(buffer.node), "Parent Node"}, |
| 98 | {ACPI_EXD_BUFFER, 0, NULL} | 98 | {ACPI_EXD_BUFFER, 0, NULL} |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | static struct acpi_exdump_info acpi_ex_dump_package[5] = { | 101 | static struct acpi_exdump_info acpi_ex_dump_package[6] = { |
| 102 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL}, | 102 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL}, |
| 103 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(package.node), "Parent Node"}, | ||
| 103 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"}, | 104 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"}, |
| 104 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"}, | 105 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"}, |
| 105 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"}, | 106 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"}, |
| @@ -108,11 +109,11 @@ static struct acpi_exdump_info acpi_ex_dump_package[5] = { | |||
| 108 | 109 | ||
| 109 | static struct acpi_exdump_info acpi_ex_dump_device[4] = { | 110 | static struct acpi_exdump_info acpi_ex_dump_device[4] = { |
| 110 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL}, | 111 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL}, |
| 111 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"}, | ||
| 112 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[0]), | 112 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[0]), |
| 113 | "System Notify"}, | 113 | "System Notify"}, |
| 114 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[1]), | 114 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[1]), |
| 115 | "Device Notify"} | 115 | "Device Notify"}, |
| 116 | {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(device.handler), "Handler"} | ||
| 116 | }; | 117 | }; |
| 117 | 118 | ||
| 118 | static struct acpi_exdump_info acpi_ex_dump_event[2] = { | 119 | static struct acpi_exdump_info acpi_ex_dump_event[2] = { |
| @@ -142,17 +143,18 @@ static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { | |||
| 142 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} | 143 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} |
| 143 | }; | 144 | }; |
| 144 | 145 | ||
| 145 | static struct acpi_exdump_info acpi_ex_dump_region[7] = { | 146 | static struct acpi_exdump_info acpi_ex_dump_region[8] = { |
| 146 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL}, | 147 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL}, |
| 147 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"}, | 148 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"}, |
| 148 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"}, | 149 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"}, |
| 150 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(region.node), "Parent Node"}, | ||
| 149 | {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"}, | 151 | {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"}, |
| 150 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"}, | 152 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"}, |
| 151 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.handler), "Handler"}, | 153 | {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(region.handler), "Handler"}, |
| 152 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"} | 154 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"} |
| 153 | }; | 155 | }; |
| 154 | 156 | ||
| 155 | static struct acpi_exdump_info acpi_ex_dump_power[5] = { | 157 | static struct acpi_exdump_info acpi_ex_dump_power[6] = { |
| 156 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL}, | 158 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL}, |
| 157 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level), | 159 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level), |
| 158 | "System Level"}, | 160 | "System Level"}, |
| @@ -161,7 +163,8 @@ static struct acpi_exdump_info acpi_ex_dump_power[5] = { | |||
| 161 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[0]), | 163 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[0]), |
| 162 | "System Notify"}, | 164 | "System Notify"}, |
| 163 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[1]), | 165 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[1]), |
| 164 | "Device Notify"} | 166 | "Device Notify"}, |
| 167 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.handler), "Handler"} | ||
| 165 | }; | 168 | }; |
| 166 | 169 | ||
| 167 | static struct acpi_exdump_info acpi_ex_dump_processor[7] = { | 170 | static struct acpi_exdump_info acpi_ex_dump_processor[7] = { |
| @@ -225,7 +228,7 @@ static struct acpi_exdump_info acpi_ex_dump_reference[8] = { | |||
| 225 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, | 228 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, |
| 226 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"}, | 229 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"}, |
| 227 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, | 230 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, |
| 228 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, | 231 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(reference.node), "Node"}, |
| 229 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, | 232 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, |
| 230 | {ACPI_EXD_REFERENCE, 0, NULL} | 233 | {ACPI_EXD_REFERENCE, 0, NULL} |
| 231 | }; | 234 | }; |
| @@ -234,16 +237,16 @@ static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = { | |||
| 234 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler), | 237 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler), |
| 235 | NULL}, | 238 | NULL}, |
| 236 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"}, | 239 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"}, |
| 237 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.next), "Next"}, | 240 | {ACPI_EXD_HDLR_LIST, ACPI_EXD_OFFSET(address_space.next), "Next"}, |
| 238 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.region_list), | 241 | {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET(address_space.region_list), |
| 239 | "Region List"}, | 242 | "Region List"}, |
| 240 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.node), "Node"}, | 243 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(address_space.node), "Node"}, |
| 241 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"} | 244 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"} |
| 242 | }; | 245 | }; |
| 243 | 246 | ||
| 244 | static struct acpi_exdump_info acpi_ex_dump_notify[7] = { | 247 | static struct acpi_exdump_info acpi_ex_dump_notify[7] = { |
| 245 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL}, | 248 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL}, |
| 246 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"}, | 249 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(notify.node), "Node"}, |
| 247 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(notify.handler_type), "Handler Type"}, | 250 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(notify.handler_type), "Handler Type"}, |
| 248 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.handler), "Handler"}, | 251 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.handler), "Handler"}, |
| 249 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"}, | 252 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"}, |
| @@ -252,14 +255,31 @@ static struct acpi_exdump_info acpi_ex_dump_notify[7] = { | |||
| 252 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[1]), "Next Device Notify"} | 255 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[1]), "Next Device Notify"} |
| 253 | }; | 256 | }; |
| 254 | 257 | ||
| 258 | static struct acpi_exdump_info acpi_ex_dump_extra[6] = { | ||
| 259 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_extra), NULL}, | ||
| 260 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.method_REG), "_REG Method"}, | ||
| 261 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(extra.scope_node), "Scope Node"}, | ||
| 262 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.region_context), | ||
| 263 | "Region Context"}, | ||
| 264 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(extra.aml_start), "Aml Start"}, | ||
| 265 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(extra.aml_length), "Aml Length"} | ||
| 266 | }; | ||
| 267 | |||
| 268 | static struct acpi_exdump_info acpi_ex_dump_data[3] = { | ||
| 269 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_data), NULL}, | ||
| 270 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(data.handler), "Handler"}, | ||
| 271 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(data.pointer), "Raw Data"} | ||
| 272 | }; | ||
| 273 | |||
| 255 | /* Miscellaneous tables */ | 274 | /* Miscellaneous tables */ |
| 256 | 275 | ||
| 257 | static struct acpi_exdump_info acpi_ex_dump_common[4] = { | 276 | static struct acpi_exdump_info acpi_ex_dump_common[5] = { |
| 258 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL}, | 277 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL}, |
| 259 | {ACPI_EXD_TYPE, 0, NULL}, | 278 | {ACPI_EXD_TYPE, 0, NULL}, |
| 260 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count), | 279 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count), |
| 261 | "Reference Count"}, | 280 | "Reference Count"}, |
| 262 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"} | 281 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"}, |
| 282 | {ACPI_EXD_LIST, ACPI_EXD_OFFSET(common.next_object), "Object List"} | ||
| 263 | }; | 283 | }; |
| 264 | 284 | ||
| 265 | static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { | 285 | static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { |
| @@ -274,15 +294,17 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { | |||
| 274 | "Field Bit Offset"}, | 294 | "Field Bit Offset"}, |
| 275 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset), | 295 | {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset), |
| 276 | "Base Byte Offset"}, | 296 | "Base Byte Offset"}, |
| 277 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} | 297 | {ACPI_EXD_NODE, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} |
| 278 | }; | 298 | }; |
| 279 | 299 | ||
| 280 | static struct acpi_exdump_info acpi_ex_dump_node[5] = { | 300 | static struct acpi_exdump_info acpi_ex_dump_node[7] = { |
| 281 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, | 301 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, |
| 282 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, | 302 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, |
| 283 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, | 303 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, |
| 284 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, | 304 | {ACPI_EXD_LIST, ACPI_EXD_NSOFFSET(object), "Object List"}, |
| 285 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} | 305 | {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(parent), "Parent"}, |
| 306 | {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(child), "Child"}, | ||
| 307 | {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET(peer), "Peer"} | ||
| 286 | }; | 308 | }; |
| 287 | 309 | ||
| 288 | /* Dispatch table, indexed by object type */ | 310 | /* Dispatch table, indexed by object type */ |
| @@ -315,7 +337,9 @@ static struct acpi_exdump_info *acpi_ex_dump_info[] = { | |||
| 315 | acpi_ex_dump_address_handler, | 337 | acpi_ex_dump_address_handler, |
| 316 | NULL, | 338 | NULL, |
| 317 | NULL, | 339 | NULL, |
| 318 | NULL | 340 | NULL, |
| 341 | acpi_ex_dump_extra, | ||
| 342 | acpi_ex_dump_data | ||
| 319 | }; | 343 | }; |
| 320 | 344 | ||
| 321 | /******************************************************************************* | 345 | /******************************************************************************* |
| @@ -340,6 +364,10 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
| 340 | char *name; | 364 | char *name; |
| 341 | const char *reference_name; | 365 | const char *reference_name; |
| 342 | u8 count; | 366 | u8 count; |
| 367 | union acpi_operand_object *start; | ||
| 368 | union acpi_operand_object *data = NULL; | ||
| 369 | union acpi_operand_object *next; | ||
| 370 | struct acpi_namespace_node *node; | ||
| 343 | 371 | ||
| 344 | if (!info) { | 372 | if (!info) { |
| 345 | acpi_os_printf | 373 | acpi_os_printf |
| @@ -363,9 +391,9 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
| 363 | 391 | ||
| 364 | case ACPI_EXD_TYPE: | 392 | case ACPI_EXD_TYPE: |
| 365 | 393 | ||
| 366 | acpi_ex_out_string("Type", | 394 | acpi_os_printf("%20s : %2.2X [%s]\n", "Type", |
| 367 | acpi_ut_get_object_type_name | 395 | obj_desc->common.type, |
| 368 | (obj_desc)); | 396 | acpi_ut_get_object_type_name(obj_desc)); |
| 369 | break; | 397 | break; |
| 370 | 398 | ||
| 371 | case ACPI_EXD_UINT8: | 399 | case ACPI_EXD_UINT8: |
| @@ -433,6 +461,121 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
| 433 | acpi_ex_dump_reference_obj(obj_desc); | 461 | acpi_ex_dump_reference_obj(obj_desc); |
| 434 | break; | 462 | break; |
| 435 | 463 | ||
| 464 | case ACPI_EXD_LIST: | ||
| 465 | |||
| 466 | start = *ACPI_CAST_PTR(void *, target); | ||
| 467 | next = start; | ||
| 468 | |||
| 469 | acpi_os_printf("%20s : %p", name, next); | ||
| 470 | if (next) { | ||
| 471 | acpi_os_printf("(%s %2.2X)", | ||
| 472 | acpi_ut_get_object_type_name | ||
| 473 | (next), next->common.type); | ||
| 474 | |||
| 475 | while (next->common.next_object) { | ||
| 476 | if ((next->common.type == | ||
| 477 | ACPI_TYPE_LOCAL_DATA) && !data) { | ||
| 478 | data = next; | ||
| 479 | } | ||
| 480 | |||
| 481 | next = next->common.next_object; | ||
| 482 | acpi_os_printf("->%p(%s %2.2X)", next, | ||
| 483 | acpi_ut_get_object_type_name | ||
| 484 | (next), | ||
| 485 | next->common.type); | ||
| 486 | |||
| 487 | if ((next == start) || (next == data)) { | ||
| 488 | acpi_os_printf | ||
| 489 | ("\n**** Error: Object list appears to be circular linked"); | ||
| 490 | break; | ||
| 491 | } | ||
| 492 | } | ||
| 493 | } | ||
| 494 | |||
| 495 | acpi_os_printf("\n", next); | ||
| 496 | break; | ||
| 497 | |||
| 498 | case ACPI_EXD_HDLR_LIST: | ||
| 499 | |||
| 500 | start = *ACPI_CAST_PTR(void *, target); | ||
| 501 | next = start; | ||
| 502 | |||
| 503 | acpi_os_printf("%20s : %p", name, next); | ||
| 504 | if (next) { | ||
| 505 | acpi_os_printf("(%s %2.2X)", | ||
| 506 | acpi_ut_get_object_type_name | ||
| 507 | (next), next->common.type); | ||
| 508 | |||
| 509 | while (next->address_space.next) { | ||
| 510 | if ((next->common.type == | ||
| 511 | ACPI_TYPE_LOCAL_DATA) && !data) { | ||
| 512 | data = next; | ||
| 513 | } | ||
| 514 | |||
| 515 | next = next->address_space.next; | ||
| 516 | acpi_os_printf("->%p(%s %2.2X)", next, | ||
| 517 | acpi_ut_get_object_type_name | ||
| 518 | (next), | ||
| 519 | next->common.type); | ||
| 520 | |||
| 521 | if ((next == start) || (next == data)) { | ||
| 522 | acpi_os_printf | ||
| 523 | ("\n**** Error: Handler list appears to be circular linked"); | ||
| 524 | break; | ||
| 525 | } | ||
| 526 | } | ||
| 527 | } | ||
| 528 | |||
| 529 | acpi_os_printf("\n", next); | ||
| 530 | break; | ||
| 531 | |||
| 532 | case ACPI_EXD_RGN_LIST: | ||
| 533 | |||
| 534 | start = *ACPI_CAST_PTR(void *, target); | ||
| 535 | next = start; | ||
| 536 | |||
| 537 | acpi_os_printf("%20s : %p", name, next); | ||
| 538 | if (next) { | ||
| 539 | acpi_os_printf("(%s %2.2X)", | ||
| 540 | acpi_ut_get_object_type_name | ||
| 541 | (next), next->common.type); | ||
| 542 | |||
| 543 | while (next->region.next) { | ||
| 544 | if ((next->common.type == | ||
| 545 | ACPI_TYPE_LOCAL_DATA) && !data) { | ||
| 546 | data = next; | ||
| 547 | } | ||
| 548 | |||
| 549 | next = next->region.next; | ||
| 550 | acpi_os_printf("->%p(%s %2.2X)", next, | ||
| 551 | acpi_ut_get_object_type_name | ||
| 552 | (next), | ||
| 553 | next->common.type); | ||
| 554 | |||
| 555 | if ((next == start) || (next == data)) { | ||
| 556 | acpi_os_printf | ||
| 557 | ("\n**** Error: Region list appears to be circular linked"); | ||
| 558 | break; | ||
| 559 | } | ||
| 560 | } | ||
| 561 | } | ||
| 562 | |||
| 563 | acpi_os_printf("\n", next); | ||
| 564 | break; | ||
| 565 | |||
| 566 | case ACPI_EXD_NODE: | ||
| 567 | |||
| 568 | node = | ||
| 569 | *ACPI_CAST_PTR(struct acpi_namespace_node *, | ||
| 570 | target); | ||
| 571 | |||
| 572 | acpi_os_printf("%20s : %p", name, node); | ||
| 573 | if (node) { | ||
| 574 | acpi_os_printf(" [%4.4s]", node->name.ascii); | ||
| 575 | } | ||
| 576 | acpi_os_printf("\n"); | ||
| 577 | break; | ||
| 578 | |||
| 436 | default: | 579 | default: |
| 437 | 580 | ||
| 438 | acpi_os_printf("**** Invalid table opcode [%X] ****\n", | 581 | acpi_os_printf("**** Invalid table opcode [%X] ****\n", |
| @@ -821,10 +964,8 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) | |||
| 821 | } | 964 | } |
| 822 | 965 | ||
| 823 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); | 966 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); |
| 824 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); | 967 | acpi_os_printf("%20s : %2.2X [%s]\n", "Type", |
| 825 | acpi_ex_out_pointer("Attached Object", | 968 | node->type, acpi_ut_get_type_name(node->type)); |
| 826 | acpi_ns_get_attached_object(node)); | ||
| 827 | acpi_ex_out_pointer("Parent", node->parent); | ||
| 828 | 969 | ||
| 829 | acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), | 970 | acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node), |
| 830 | acpi_ex_dump_node); | 971 | acpi_ex_dump_node); |
| @@ -1017,22 +1158,26 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
| 1017 | ((struct acpi_namespace_node *)obj_desc)-> | 1158 | ((struct acpi_namespace_node *)obj_desc)-> |
| 1018 | object); | 1159 | object); |
| 1019 | 1160 | ||
| 1020 | acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) | 1161 | obj_desc = ((struct acpi_namespace_node *)obj_desc)->object; |
| 1021 | obj_desc)->object, flags); | 1162 | goto dump_object; |
| 1022 | return_VOID; | ||
| 1023 | } | 1163 | } |
| 1024 | 1164 | ||
| 1025 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 1165 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
| 1026 | acpi_os_printf | 1166 | acpi_os_printf("%p is not an ACPI operand object: [%s]\n", |
| 1027 | ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", | 1167 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); |
| 1028 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); | ||
| 1029 | return_VOID; | 1168 | return_VOID; |
| 1030 | } | 1169 | } |
| 1031 | 1170 | ||
| 1032 | if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) { | 1171 | /* Validate the object type */ |
| 1172 | |||
| 1173 | if (obj_desc->common.type > ACPI_TYPE_LOCAL_MAX) { | ||
| 1174 | acpi_os_printf("Not a known object type: %2.2X\n", | ||
| 1175 | obj_desc->common.type); | ||
| 1033 | return_VOID; | 1176 | return_VOID; |
| 1034 | } | 1177 | } |
| 1035 | 1178 | ||
| 1179 | dump_object: | ||
| 1180 | |||
| 1036 | /* Common Fields */ | 1181 | /* Common Fields */ |
| 1037 | 1182 | ||
| 1038 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_common); | 1183 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_common); |
| @@ -1040,6 +1185,22 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
| 1040 | /* Object-specific fields */ | 1185 | /* Object-specific fields */ |
| 1041 | 1186 | ||
| 1042 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]); | 1187 | acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]); |
| 1188 | |||
| 1189 | if (obj_desc->common.type == ACPI_TYPE_REGION) { | ||
| 1190 | obj_desc = obj_desc->common.next_object; | ||
| 1191 | if (obj_desc->common.type > ACPI_TYPE_LOCAL_MAX) { | ||
| 1192 | acpi_os_printf | ||
| 1193 | ("Secondary object is not a known object type: %2.2X\n", | ||
| 1194 | obj_desc->common.type); | ||
| 1195 | |||
| 1196 | return_VOID; | ||
| 1197 | } | ||
| 1198 | |||
| 1199 | acpi_os_printf("\nExtra attached Object (%p):\n", obj_desc); | ||
| 1200 | acpi_ex_dump_object(obj_desc, | ||
| 1201 | acpi_ex_dump_info[obj_desc->common.type]); | ||
| 1202 | } | ||
| 1203 | |||
| 1043 | return_VOID; | 1204 | return_VOID; |
| 1044 | } | 1205 | } |
| 1045 | 1206 | ||
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index cfd875243421..68d97441432c 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 49fb742d61b9..1d1b27a96c5b 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index 65d93607f368..2207e624f538 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index 7be0205ad067..b49ea2a95f4f 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c index 14689dec4960..dbb03b544e8c 100644 --- a/drivers/acpi/acpica/exnames.c +++ b/drivers/acpi/acpica/exnames.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index d74cea416ca0..1b8e94104407 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index d6fa0fce1fc9..2ede656ee26a 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index bc042adf8804..363767cf01e5 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index 4459e32c683d..29e9e99f7fe3 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 5a588611ab48..ee3f872870bc 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 9d28867e60dc..cd5288a257a9 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c index 7ca6925a87ca..ab060261b43e 100644 --- a/drivers/acpi/acpica/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index 1606524312e3..3cde553bcbe1 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c index be3f66973ee8..3af8de3fcea4 100644 --- a/drivers/acpi/acpica/exresop.c +++ b/drivers/acpi/acpica/exresop.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index f0b09bf9887d..daf49f7ea311 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c index 20d809d90c5b..04bd16c08f9e 100644 --- a/drivers/acpi/acpica/exstoren.c +++ b/drivers/acpi/acpica/exstoren.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c index 26e371073b1a..fd11018b0168 100644 --- a/drivers/acpi/acpica/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 6578dee2e51b..f7da64123ed5 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -77,7 +77,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
| 77 | 77 | ||
| 78 | /* We must wait, so unlock the interpreter */ | 78 | /* We must wait, so unlock the interpreter */ |
| 79 | 79 | ||
| 80 | acpi_ex_relinquish_interpreter(); | 80 | acpi_ex_exit_interpreter(); |
| 81 | 81 | ||
| 82 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); | 82 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
| 83 | 83 | ||
| @@ -87,7 +87,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
| 87 | 87 | ||
| 88 | /* Reacquire the interpreter */ | 88 | /* Reacquire the interpreter */ |
| 89 | 89 | ||
| 90 | acpi_ex_reacquire_interpreter(); | 90 | acpi_ex_enter_interpreter(); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | return_ACPI_STATUS(status); | 93 | return_ACPI_STATUS(status); |
| @@ -123,7 +123,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
| 123 | 123 | ||
| 124 | /* We must wait, so unlock the interpreter */ | 124 | /* We must wait, so unlock the interpreter */ |
| 125 | 125 | ||
| 126 | acpi_ex_relinquish_interpreter(); | 126 | acpi_ex_exit_interpreter(); |
| 127 | 127 | ||
| 128 | status = acpi_os_acquire_mutex(mutex, timeout); | 128 | status = acpi_os_acquire_mutex(mutex, timeout); |
| 129 | 129 | ||
| @@ -133,7 +133,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
| 133 | 133 | ||
| 134 | /* Reacquire the interpreter */ | 134 | /* Reacquire the interpreter */ |
| 135 | 135 | ||
| 136 | acpi_ex_reacquire_interpreter(); | 136 | acpi_ex_enter_interpreter(); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | return_ACPI_STATUS(status); | 139 | return_ACPI_STATUS(status); |
| @@ -198,7 +198,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long) | |||
| 198 | 198 | ||
| 199 | /* Since this thread will sleep, we must release the interpreter */ | 199 | /* Since this thread will sleep, we must release the interpreter */ |
| 200 | 200 | ||
| 201 | acpi_ex_relinquish_interpreter(); | 201 | acpi_ex_exit_interpreter(); |
| 202 | 202 | ||
| 203 | /* | 203 | /* |
| 204 | * For compatibility with other ACPI implementations and to prevent | 204 | * For compatibility with other ACPI implementations and to prevent |
| @@ -212,7 +212,7 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long) | |||
| 212 | 212 | ||
| 213 | /* And now we must get the interpreter again */ | 213 | /* And now we must get the interpreter again */ |
| 214 | 214 | ||
| 215 | acpi_ex_reacquire_interpreter(); | 215 | acpi_ex_enter_interpreter(); |
| 216 | return (AE_OK); | 216 | return (AE_OK); |
| 217 | } | 217 | } |
| 218 | 218 | ||
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 99dc7b287d55..d9d72dff2a76 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -100,37 +100,6 @@ void acpi_ex_enter_interpreter(void) | |||
| 100 | 100 | ||
| 101 | /******************************************************************************* | 101 | /******************************************************************************* |
| 102 | * | 102 | * |
| 103 | * FUNCTION: acpi_ex_reacquire_interpreter | ||
| 104 | * | ||
| 105 | * PARAMETERS: None | ||
| 106 | * | ||
| 107 | * RETURN: None | ||
| 108 | * | ||
| 109 | * DESCRIPTION: Reacquire the interpreter execution region from within the | ||
| 110 | * interpreter code. Failure to enter the interpreter region is a | ||
| 111 | * fatal system error. Used in conjunction with | ||
| 112 | * relinquish_interpreter | ||
| 113 | * | ||
| 114 | ******************************************************************************/ | ||
| 115 | |||
| 116 | void acpi_ex_reacquire_interpreter(void) | ||
| 117 | { | ||
| 118 | ACPI_FUNCTION_TRACE(ex_reacquire_interpreter); | ||
| 119 | |||
| 120 | /* | ||
| 121 | * If the global serialized flag is set, do not release the interpreter, | ||
| 122 | * since it was not actually released by acpi_ex_relinquish_interpreter. | ||
| 123 | * This forces the interpreter to be single threaded. | ||
| 124 | */ | ||
| 125 | if (!acpi_gbl_all_methods_serialized) { | ||
| 126 | acpi_ex_enter_interpreter(); | ||
| 127 | } | ||
| 128 | |||
| 129 | return_VOID; | ||
| 130 | } | ||
| 131 | |||
| 132 | /******************************************************************************* | ||
| 133 | * | ||
| 134 | * FUNCTION: acpi_ex_exit_interpreter | 103 | * FUNCTION: acpi_ex_exit_interpreter |
| 135 | * | 104 | * |
| 136 | * PARAMETERS: None | 105 | * PARAMETERS: None |
| @@ -139,7 +108,16 @@ void acpi_ex_reacquire_interpreter(void) | |||
| 139 | * | 108 | * |
| 140 | * DESCRIPTION: Exit the interpreter execution region. This is the top level | 109 | * DESCRIPTION: Exit the interpreter execution region. This is the top level |
| 141 | * routine used to exit the interpreter when all processing has | 110 | * routine used to exit the interpreter when all processing has |
| 142 | * been completed. | 111 | * been completed, or when the method blocks. |
| 112 | * | ||
| 113 | * Cases where the interpreter is unlocked internally: | ||
| 114 | * 1) Method will be blocked on a Sleep() AML opcode | ||
| 115 | * 2) Method will be blocked on an Acquire() AML opcode | ||
| 116 | * 3) Method will be blocked on a Wait() AML opcode | ||
| 117 | * 4) Method will be blocked to acquire the global lock | ||
| 118 | * 5) Method will be blocked waiting to execute a serialized control | ||
| 119 | * method that is currently executing | ||
| 120 | * 6) About to invoke a user-installed opregion handler | ||
| 143 | * | 121 | * |
| 144 | ******************************************************************************/ | 122 | ******************************************************************************/ |
| 145 | 123 | ||
| @@ -160,44 +138,6 @@ void acpi_ex_exit_interpreter(void) | |||
| 160 | 138 | ||
| 161 | /******************************************************************************* | 139 | /******************************************************************************* |
| 162 | * | 140 | * |
| 163 | * FUNCTION: acpi_ex_relinquish_interpreter | ||
| 164 | * | ||
| 165 | * PARAMETERS: None | ||
| 166 | * | ||
| 167 | * RETURN: None | ||
| 168 | * | ||
| 169 | * DESCRIPTION: Exit the interpreter execution region, from within the | ||
| 170 | * interpreter - before attempting an operation that will possibly | ||
| 171 | * block the running thread. | ||
| 172 | * | ||
| 173 | * Cases where the interpreter is unlocked internally | ||
| 174 | * 1) Method to be blocked on a Sleep() AML opcode | ||
| 175 | * 2) Method to be blocked on an Acquire() AML opcode | ||
| 176 | * 3) Method to be blocked on a Wait() AML opcode | ||
| 177 | * 4) Method to be blocked to acquire the global lock | ||
| 178 | * 5) Method to be blocked waiting to execute a serialized control method | ||
| 179 | * that is currently executing | ||
| 180 | * 6) About to invoke a user-installed opregion handler | ||
| 181 | * | ||
| 182 | ******************************************************************************/ | ||
| 183 | |||
| 184 | void acpi_ex_relinquish_interpreter(void) | ||
| 185 | { | ||
| 186 | ACPI_FUNCTION_TRACE(ex_relinquish_interpreter); | ||
| 187 | |||
| 188 | /* | ||
| 189 | * If the global serialized flag is set, do not release the interpreter. | ||
| 190 | * This forces the interpreter to be single threaded. | ||
| 191 | */ | ||
| 192 | if (!acpi_gbl_all_methods_serialized) { | ||
| 193 | acpi_ex_exit_interpreter(); | ||
| 194 | } | ||
| 195 | |||
| 196 | return_VOID; | ||
| 197 | } | ||
| 198 | |||
| 199 | /******************************************************************************* | ||
| 200 | * | ||
| 201 | * FUNCTION: acpi_ex_truncate_for32bit_table | 141 | * FUNCTION: acpi_ex_truncate_for32bit_table |
| 202 | * | 142 | * |
| 203 | * PARAMETERS: obj_desc - Object to be truncated | 143 | * PARAMETERS: obj_desc - Object to be truncated |
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c index 3d36df828f52..1e66d960fc11 100644 --- a/drivers/acpi/acpica/hwacpi.c +++ b/drivers/acpi/acpica/hwacpi.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c index 414076818d40..858fdd6be598 100644 --- a/drivers/acpi/acpica/hwesleep.c +++ b/drivers/acpi/acpica/hwesleep.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 96540506058f..2e6caabba07a 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c index 0889a629505f..e701d8c33dbf 100644 --- a/drivers/acpi/acpica/hwpci.c +++ b/drivers/acpi/acpica/hwpci.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index 12e6cff54f78..e0fd9b4978cd 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index e3828cc4361b..d590693eb54e 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c index 3c498dc1636e..76ab5c1a814e 100644 --- a/drivers/acpi/acpica/hwtimer.c +++ b/drivers/acpi/acpica/hwtimer.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index eab70d58852a..6b919127cd9d 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index b4b47db2dee2..96d007df65ec 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index 15dddc10fc9b..6921c7f3d208 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index 14f65f6345b9..f1249e3463be 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index fd1ff54cda19..607eb9e5150d 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsarguments.c b/drivers/acpi/acpica/nsarguments.c index 74b24c82707e..80fcfc8c9c1b 100644 --- a/drivers/acpi/acpica/nsarguments.c +++ b/drivers/acpi/acpica/nsarguments.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c index acd2964c2690..b55642c4ee58 100644 --- a/drivers/acpi/acpica/nsconvert.c +++ b/drivers/acpi/acpica/nsconvert.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 48b9c6f12643..3d88ef4a3e0d 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 283762511b73..42d37109aa5d 100644 --- a/drivers/acpi/acpica/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index 963ceef063f8..e634a05974db 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 3a0423af968c..a3fb7e4c0809 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -111,9 +111,8 @@ acpi_status acpi_ns_initialize_objects(void) | |||
| 111 | info.object_count)); | 111 | info.object_count)); |
| 112 | 112 | ||
| 113 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
| 114 | "%u Control Methods found\n", info.method_count)); | 114 | "%u Control Methods found\n%u Op Regions found\n", |
| 115 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 115 | info.method_count, info.op_region_count)); |
| 116 | "%u Op Regions found\n", info.op_region_count)); | ||
| 117 | 116 | ||
| 118 | return_ACPI_STATUS(AE_OK); | 117 | return_ACPI_STATUS(AE_OK); |
| 119 | } | 118 | } |
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index 89ec645e7730..7c9d0181f341 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -128,12 +128,12 @@ unlock: | |||
| 128 | * parse trees. | 128 | * parse trees. |
| 129 | */ | 129 | */ |
| 130 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 130 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 131 | "**** Begin Table Method Parsing and Object Initialization\n")); | 131 | "**** Begin Table Object Initialization\n")); |
| 132 | 132 | ||
| 133 | status = acpi_ds_initialize_objects(table_index, node); | 133 | status = acpi_ds_initialize_objects(table_index, node); |
| 134 | 134 | ||
| 135 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 135 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 136 | "**** Completed Table Method Parsing and Object Initialization\n")); | 136 | "**** Completed Table Object Initialization\n")); |
| 137 | 137 | ||
| 138 | return_ACPI_STATUS(status); | 138 | return_ACPI_STATUS(status); |
| 139 | } | 139 | } |
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 90a0380fb8a0..7eee0a6f02f6 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index 7a736f4d1fd8..fe54a8c73b8c 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -222,13 +222,19 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
| 222 | } | 222 | } |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | /* Clear the entry in all cases */ | 225 | /* Clear the Node entry in all cases */ |
| 226 | 226 | ||
| 227 | node->object = NULL; | 227 | node->object = NULL; |
| 228 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) { | 228 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) { |
| 229 | |||
| 230 | /* Unlink object from front of possible object list */ | ||
| 231 | |||
| 229 | node->object = obj_desc->common.next_object; | 232 | node->object = obj_desc->common.next_object; |
| 233 | |||
| 234 | /* Handle possible 2-descriptor object */ | ||
| 235 | |||
| 230 | if (node->object && | 236 | if (node->object && |
| 231 | ((node->object)->common.type != ACPI_TYPE_LOCAL_DATA)) { | 237 | (node->object->common.type != ACPI_TYPE_LOCAL_DATA)) { |
| 232 | node->object = node->object->common.next_object; | 238 | node->object = node->object->common.next_object; |
| 233 | } | 239 | } |
| 234 | } | 240 | } |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 177857340271..e83cff31754b 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index d2855d9857c4..392910ffbed9 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index 3d5391f9bcb5..68f725839eb6 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -132,12 +132,12 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 132 | * Decode the type of the expected package contents | 132 | * Decode the type of the expected package contents |
| 133 | * | 133 | * |
| 134 | * PTYPE1 packages contain no subpackages | 134 | * PTYPE1 packages contain no subpackages |
| 135 | * PTYPE2 packages contain sub-packages | 135 | * PTYPE2 packages contain subpackages |
| 136 | */ | 136 | */ |
| 137 | switch (package->ret_info.type) { | 137 | switch (package->ret_info.type) { |
| 138 | case ACPI_PTYPE1_FIXED: | 138 | case ACPI_PTYPE1_FIXED: |
| 139 | /* | 139 | /* |
| 140 | * The package count is fixed and there are no sub-packages | 140 | * The package count is fixed and there are no subpackages |
| 141 | * | 141 | * |
| 142 | * If package is too small, exit. | 142 | * If package is too small, exit. |
| 143 | * If package is larger than expected, issue warning but continue | 143 | * If package is larger than expected, issue warning but continue |
| @@ -169,7 +169,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 169 | 169 | ||
| 170 | case ACPI_PTYPE1_VAR: | 170 | case ACPI_PTYPE1_VAR: |
| 171 | /* | 171 | /* |
| 172 | * The package count is variable, there are no sub-packages, and all | 172 | * The package count is variable, there are no subpackages, and all |
| 173 | * elements must be of the same type | 173 | * elements must be of the same type |
| 174 | */ | 174 | */ |
| 175 | for (i = 0; i < count; i++) { | 175 | for (i = 0; i < count; i++) { |
| @@ -185,7 +185,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 185 | 185 | ||
| 186 | case ACPI_PTYPE1_OPTION: | 186 | case ACPI_PTYPE1_OPTION: |
| 187 | /* | 187 | /* |
| 188 | * The package count is variable, there are no sub-packages. There are | 188 | * The package count is variable, there are no subpackages. There are |
| 189 | * a fixed number of required elements, and a variable number of | 189 | * a fixed number of required elements, and a variable number of |
| 190 | * optional elements. | 190 | * optional elements. |
| 191 | * | 191 | * |
| @@ -242,7 +242,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 242 | elements++; | 242 | elements++; |
| 243 | count--; | 243 | count--; |
| 244 | 244 | ||
| 245 | /* Examine the sub-packages */ | 245 | /* Examine the subpackages */ |
| 246 | 246 | ||
| 247 | status = | 247 | status = |
| 248 | acpi_ns_check_package_list(info, package, elements, count); | 248 | acpi_ns_check_package_list(info, package, elements, count); |
| @@ -250,7 +250,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 250 | 250 | ||
| 251 | case ACPI_PTYPE2_PKG_COUNT: | 251 | case ACPI_PTYPE2_PKG_COUNT: |
| 252 | 252 | ||
| 253 | /* First element is the (Integer) count of sub-packages to follow */ | 253 | /* First element is the (Integer) count of subpackages to follow */ |
| 254 | 254 | ||
| 255 | status = acpi_ns_check_object_type(info, elements, | 255 | status = acpi_ns_check_object_type(info, elements, |
| 256 | ACPI_RTYPE_INTEGER, 0); | 256 | ACPI_RTYPE_INTEGER, 0); |
| @@ -270,7 +270,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 270 | count = expected_count; | 270 | count = expected_count; |
| 271 | elements++; | 271 | elements++; |
| 272 | 272 | ||
| 273 | /* Examine the sub-packages */ | 273 | /* Examine the subpackages */ |
| 274 | 274 | ||
| 275 | status = | 275 | status = |
| 276 | acpi_ns_check_package_list(info, package, elements, count); | 276 | acpi_ns_check_package_list(info, package, elements, count); |
| @@ -283,9 +283,9 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 283 | case ACPI_PTYPE2_FIX_VAR: | 283 | case ACPI_PTYPE2_FIX_VAR: |
| 284 | /* | 284 | /* |
| 285 | * These types all return a single Package that consists of a | 285 | * These types all return a single Package that consists of a |
| 286 | * variable number of sub-Packages. | 286 | * variable number of subpackages. |
| 287 | * | 287 | * |
| 288 | * First, ensure that the first element is a sub-Package. If not, | 288 | * First, ensure that the first element is a subpackage. If not, |
| 289 | * the BIOS may have incorrectly returned the object as a single | 289 | * the BIOS may have incorrectly returned the object as a single |
| 290 | * package instead of a Package of Packages (a common error if | 290 | * package instead of a Package of Packages (a common error if |
| 291 | * there is only one entry). We may be able to repair this by | 291 | * there is only one entry). We may be able to repair this by |
| @@ -310,7 +310,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
| 310 | count = 1; | 310 | count = 1; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | /* Examine the sub-packages */ | 313 | /* Examine the subpackages */ |
| 314 | 314 | ||
| 315 | status = | 315 | status = |
| 316 | acpi_ns_check_package_list(info, package, elements, count); | 316 | acpi_ns_check_package_list(info, package, elements, count); |
| @@ -370,9 +370,9 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info, | |||
| 370 | u32 j; | 370 | u32 j; |
| 371 | 371 | ||
| 372 | /* | 372 | /* |
| 373 | * Validate each sub-Package in the parent Package | 373 | * Validate each subpackage in the parent Package |
| 374 | * | 374 | * |
| 375 | * NOTE: assumes list of sub-packages contains no NULL elements. | 375 | * NOTE: assumes list of subpackages contains no NULL elements. |
| 376 | * Any NULL elements should have been removed by earlier call | 376 | * Any NULL elements should have been removed by earlier call |
| 377 | * to acpi_ns_remove_null_elements. | 377 | * to acpi_ns_remove_null_elements. |
| 378 | */ | 378 | */ |
| @@ -389,7 +389,7 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info, | |||
| 389 | return (status); | 389 | return (status); |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | /* Examine the different types of expected sub-packages */ | 392 | /* Examine the different types of expected subpackages */ |
| 393 | 393 | ||
| 394 | info->parent_package = sub_package; | 394 | info->parent_package = sub_package; |
| 395 | switch (package->ret_info.type) { | 395 | switch (package->ret_info.type) { |
| @@ -450,14 +450,14 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info, | |||
| 450 | 450 | ||
| 451 | case ACPI_PTYPE2_FIXED: | 451 | case ACPI_PTYPE2_FIXED: |
| 452 | 452 | ||
| 453 | /* Each sub-package has a fixed length */ | 453 | /* Each subpackage has a fixed length */ |
| 454 | 454 | ||
| 455 | expected_count = package->ret_info2.count; | 455 | expected_count = package->ret_info2.count; |
| 456 | if (sub_package->package.count < expected_count) { | 456 | if (sub_package->package.count < expected_count) { |
| 457 | goto package_too_small; | 457 | goto package_too_small; |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | /* Check the type of each sub-package element */ | 460 | /* Check the type of each subpackage element */ |
| 461 | 461 | ||
| 462 | for (j = 0; j < expected_count; j++) { | 462 | for (j = 0; j < expected_count; j++) { |
| 463 | status = | 463 | status = |
| @@ -475,14 +475,14 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info, | |||
| 475 | 475 | ||
| 476 | case ACPI_PTYPE2_MIN: | 476 | case ACPI_PTYPE2_MIN: |
| 477 | 477 | ||
| 478 | /* Each sub-package has a variable but minimum length */ | 478 | /* Each subpackage has a variable but minimum length */ |
| 479 | 479 | ||
| 480 | expected_count = package->ret_info.count1; | 480 | expected_count = package->ret_info.count1; |
| 481 | if (sub_package->package.count < expected_count) { | 481 | if (sub_package->package.count < expected_count) { |
| 482 | goto package_too_small; | 482 | goto package_too_small; |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | /* Check the type of each sub-package element */ | 485 | /* Check the type of each subpackage element */ |
| 486 | 486 | ||
| 487 | status = | 487 | status = |
| 488 | acpi_ns_check_package_elements(info, sub_elements, | 488 | acpi_ns_check_package_elements(info, sub_elements, |
| @@ -531,7 +531,7 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info, | |||
| 531 | (*sub_elements)->integer.value = expected_count; | 531 | (*sub_elements)->integer.value = expected_count; |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | /* Check the type of each sub-package element */ | 534 | /* Check the type of each subpackage element */ |
| 535 | 535 | ||
| 536 | status = | 536 | status = |
| 537 | acpi_ns_check_package_elements(info, | 537 | acpi_ns_check_package_elements(info, |
| @@ -557,10 +557,10 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info, | |||
| 557 | 557 | ||
| 558 | package_too_small: | 558 | package_too_small: |
| 559 | 559 | ||
| 560 | /* The sub-package count was smaller than required */ | 560 | /* The subpackage count was smaller than required */ |
| 561 | 561 | ||
| 562 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags, | 562 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags, |
| 563 | "Return Sub-Package[%u] is too small - found %u elements, expected %u", | 563 | "Return SubPackage[%u] is too small - found %u elements, expected %u", |
| 564 | i, sub_package->package.count, expected_count)); | 564 | i, sub_package->package.count, expected_count)); |
| 565 | 565 | ||
| 566 | return (AE_AML_OPERAND_VALUE); | 566 | return (AE_AML_OPERAND_VALUE); |
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index a05afff50eb9..7e417aa5c91e 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -207,13 +207,30 @@ acpi_ns_simple_repair(struct acpi_evaluate_info *info, | |||
| 207 | * this predefined name. Either one return value is expected, or none, | 207 | * this predefined name. Either one return value is expected, or none, |
| 208 | * for both methods and other objects. | 208 | * for both methods and other objects. |
| 209 | * | 209 | * |
| 210 | * Exit now if there is no return object. Warning if one was expected. | 210 | * Try to fix if there was no return object. Warning if failed to fix. |
| 211 | */ | 211 | */ |
| 212 | if (!return_object) { | 212 | if (!return_object) { |
| 213 | if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) { | 213 | if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) { |
| 214 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, | 214 | if (package_index != ACPI_NOT_PACKAGE_ELEMENT) { |
| 215 | ACPI_WARN_ALWAYS, | 215 | ACPI_WARN_PREDEFINED((AE_INFO, |
| 216 | "Missing expected return value")); | 216 | info->full_pathname, |
| 217 | ACPI_WARN_ALWAYS, | ||
| 218 | "Found unexpected NULL package element")); | ||
| 219 | |||
| 220 | status = | ||
| 221 | acpi_ns_repair_null_element(info, | ||
| 222 | expected_btypes, | ||
| 223 | package_index, | ||
| 224 | return_object_ptr); | ||
| 225 | if (ACPI_SUCCESS(status)) { | ||
| 226 | return (AE_OK); /* Repair was successful */ | ||
| 227 | } | ||
| 228 | } else { | ||
| 229 | ACPI_WARN_PREDEFINED((AE_INFO, | ||
| 230 | info->full_pathname, | ||
| 231 | ACPI_WARN_ALWAYS, | ||
| 232 | "Missing expected return value")); | ||
| 233 | } | ||
| 217 | 234 | ||
| 218 | return (AE_AML_NO_RETURN_VALUE); | 235 | return (AE_AML_NO_RETURN_VALUE); |
| 219 | } | 236 | } |
| @@ -448,7 +465,7 @@ acpi_ns_repair_null_element(struct acpi_evaluate_info * info, | |||
| 448 | * RETURN: None. | 465 | * RETURN: None. |
| 449 | * | 466 | * |
| 450 | * DESCRIPTION: Remove all NULL package elements from packages that contain | 467 | * DESCRIPTION: Remove all NULL package elements from packages that contain |
| 451 | * a variable number of sub-packages. For these types of | 468 | * a variable number of subpackages. For these types of |
| 452 | * packages, NULL elements can be safely removed. | 469 | * packages, NULL elements can be safely removed. |
| 453 | * | 470 | * |
| 454 | *****************************************************************************/ | 471 | *****************************************************************************/ |
| @@ -469,7 +486,7 @@ acpi_ns_remove_null_elements(struct acpi_evaluate_info *info, | |||
| 469 | /* | 486 | /* |
| 470 | * We can safely remove all NULL elements from these package types: | 487 | * We can safely remove all NULL elements from these package types: |
| 471 | * PTYPE1_VAR packages contain a variable number of simple data types. | 488 | * PTYPE1_VAR packages contain a variable number of simple data types. |
| 472 | * PTYPE2 packages contain a variable number of sub-packages. | 489 | * PTYPE2 packages contain a variable number of subpackages. |
| 473 | */ | 490 | */ |
| 474 | switch (package_type) { | 491 | switch (package_type) { |
| 475 | case ACPI_PTYPE1_VAR: | 492 | case ACPI_PTYPE1_VAR: |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 6a25d320b169..b09e6bef72b8 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -432,8 +432,8 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info, | |||
| 432 | * DESCRIPTION: Repair for the _CST object: | 432 | * DESCRIPTION: Repair for the _CST object: |
| 433 | * 1. Sort the list ascending by C state type | 433 | * 1. Sort the list ascending by C state type |
| 434 | * 2. Ensure type cannot be zero | 434 | * 2. Ensure type cannot be zero |
| 435 | * 3. A sub-package count of zero means _CST is meaningless | 435 | * 3. A subpackage count of zero means _CST is meaningless |
| 436 | * 4. Count must match the number of C state sub-packages | 436 | * 4. Count must match the number of C state subpackages |
| 437 | * | 437 | * |
| 438 | *****************************************************************************/ | 438 | *****************************************************************************/ |
| 439 | 439 | ||
| @@ -611,6 +611,7 @@ acpi_ns_repair_PRT(struct acpi_evaluate_info *info, | |||
| 611 | union acpi_operand_object **top_object_list; | 611 | union acpi_operand_object **top_object_list; |
| 612 | union acpi_operand_object **sub_object_list; | 612 | union acpi_operand_object **sub_object_list; |
| 613 | union acpi_operand_object *obj_desc; | 613 | union acpi_operand_object *obj_desc; |
| 614 | union acpi_operand_object *sub_package; | ||
| 614 | u32 element_count; | 615 | u32 element_count; |
| 615 | u32 index; | 616 | u32 index; |
| 616 | 617 | ||
| @@ -619,8 +620,17 @@ acpi_ns_repair_PRT(struct acpi_evaluate_info *info, | |||
| 619 | top_object_list = package_object->package.elements; | 620 | top_object_list = package_object->package.elements; |
| 620 | element_count = package_object->package.count; | 621 | element_count = package_object->package.count; |
| 621 | 622 | ||
| 622 | for (index = 0; index < element_count; index++) { | 623 | /* Examine each subpackage */ |
| 623 | sub_object_list = (*top_object_list)->package.elements; | 624 | |
| 625 | for (index = 0; index < element_count; index++, top_object_list++) { | ||
| 626 | sub_package = *top_object_list; | ||
| 627 | sub_object_list = sub_package->package.elements; | ||
| 628 | |||
| 629 | /* Check for minimum required element count */ | ||
| 630 | |||
| 631 | if (sub_package->package.count < 4) { | ||
| 632 | continue; | ||
| 633 | } | ||
| 624 | 634 | ||
| 625 | /* | 635 | /* |
| 626 | * If the BIOS has erroneously reversed the _PRT source_name (index 2) | 636 | * If the BIOS has erroneously reversed the _PRT source_name (index 2) |
| @@ -634,15 +644,12 @@ acpi_ns_repair_PRT(struct acpi_evaluate_info *info, | |||
| 634 | sub_object_list[2] = obj_desc; | 644 | sub_object_list[2] = obj_desc; |
| 635 | info->return_flags |= ACPI_OBJECT_REPAIRED; | 645 | info->return_flags |= ACPI_OBJECT_REPAIRED; |
| 636 | 646 | ||
| 637 | ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, | 647 | ACPI_WARN_PREDEFINED((AE_INFO, |
| 648 | info->full_pathname, | ||
| 638 | info->node_flags, | 649 | info->node_flags, |
| 639 | "PRT[%X]: Fixed reversed SourceName and SourceIndex", | 650 | "PRT[%X]: Fixed reversed SourceName and SourceIndex", |
| 640 | index)); | 651 | index)); |
| 641 | } | 652 | } |
| 642 | |||
| 643 | /* Point to the next union acpi_operand_object in the top level package */ | ||
| 644 | |||
| 645 | top_object_list++; | ||
| 646 | } | 653 | } |
| 647 | 654 | ||
| 648 | return (AE_OK); | 655 | return (AE_OK); |
| @@ -679,7 +686,7 @@ acpi_ns_repair_PSS(struct acpi_evaluate_info *info, | |||
| 679 | u32 i; | 686 | u32 i; |
| 680 | 687 | ||
| 681 | /* | 688 | /* |
| 682 | * Entries (sub-packages) in the _PSS Package must be sorted by power | 689 | * Entries (subpackages) in the _PSS Package must be sorted by power |
| 683 | * dissipation, in descending order. If it appears that the list is | 690 | * dissipation, in descending order. If it appears that the list is |
| 684 | * incorrectly sorted, sort it. We sort by cpu_frequency, since this | 691 | * incorrectly sorted, sort it. We sort by cpu_frequency, since this |
| 685 | * should be proportional to the power. | 692 | * should be proportional to the power. |
| @@ -767,9 +774,9 @@ acpi_ns_repair_TSS(struct acpi_evaluate_info *info, | |||
| 767 | * | 774 | * |
| 768 | * PARAMETERS: info - Method execution information block | 775 | * PARAMETERS: info - Method execution information block |
| 769 | * return_object - Pointer to the top-level returned object | 776 | * return_object - Pointer to the top-level returned object |
| 770 | * start_index - Index of the first sub-package | 777 | * start_index - Index of the first subpackage |
| 771 | * expected_count - Minimum length of each sub-package | 778 | * expected_count - Minimum length of each subpackage |
| 772 | * sort_index - Sub-package entry to sort on | 779 | * sort_index - Subpackage entry to sort on |
| 773 | * sort_direction - Ascending or descending | 780 | * sort_direction - Ascending or descending |
| 774 | * sort_key_name - Name of the sort_index field | 781 | * sort_key_name - Name of the sort_index field |
| 775 | * | 782 | * |
| @@ -805,7 +812,7 @@ acpi_ns_check_sorted_list(struct acpi_evaluate_info *info, | |||
| 805 | } | 812 | } |
| 806 | 813 | ||
| 807 | /* | 814 | /* |
| 808 | * NOTE: assumes list of sub-packages contains no NULL elements. | 815 | * NOTE: assumes list of subpackages contains no NULL elements. |
| 809 | * Any NULL elements should have been removed by earlier call | 816 | * Any NULL elements should have been removed by earlier call |
| 810 | * to acpi_ns_remove_null_elements. | 817 | * to acpi_ns_remove_null_elements. |
| 811 | */ | 818 | */ |
| @@ -832,7 +839,7 @@ acpi_ns_check_sorted_list(struct acpi_evaluate_info *info, | |||
| 832 | return (AE_AML_OPERAND_TYPE); | 839 | return (AE_AML_OPERAND_TYPE); |
| 833 | } | 840 | } |
| 834 | 841 | ||
| 835 | /* Each sub-package must have the minimum length */ | 842 | /* Each subpackage must have the minimum length */ |
| 836 | 843 | ||
| 837 | if ((*outer_elements)->package.count < expected_count) { | 844 | if ((*outer_elements)->package.count < expected_count) { |
| 838 | return (AE_AML_PACKAGE_LIMIT); | 845 | return (AE_AML_PACKAGE_LIMIT); |
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index 47420faef073..af1cc42a8aa1 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 4a0665b6bcc1..4a5e3f5c0ff7 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c index e81f15ef659a..4758a1f2ce22 100644 --- a/drivers/acpi/acpica/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index 1f0c28ba50df..4bd558bf10d2 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
| @@ -923,19 +923,22 @@ ACPI_EXPORT_SYMBOL(acpi_detach_data) | |||
| 923 | 923 | ||
| 924 | /******************************************************************************* | 924 | /******************************************************************************* |
| 925 | * | 925 | * |
| 926 | * FUNCTION: acpi_get_data | 926 | * FUNCTION: acpi_get_data_full |
| 927 | * | 927 | * |
| 928 | * PARAMETERS: obj_handle - Namespace node | 928 | * PARAMETERS: obj_handle - Namespace node |
| 929 | * handler - Handler used in call to attach_data | 929 | * handler - Handler used in call to attach_data |
| 930 | * data - Where the data is returned | 930 | * data - Where the data is returned |
| 931 | * callback - function to execute before returning | ||
| 931 | * | 932 | * |
| 932 | * RETURN: Status | 933 | * RETURN: Status |
| 933 | * | 934 | * |
| 934 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. | 935 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node |
| 936 | * and execute a callback before returning. | ||
| 935 | * | 937 | * |
| 936 | ******************************************************************************/ | 938 | ******************************************************************************/ |
| 937 | acpi_status | 939 | acpi_status |
| 938 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | 940 | acpi_get_data_full(acpi_handle obj_handle, acpi_object_handler handler, |
| 941 | void **data, void (*callback)(void *)) | ||
| 939 | { | 942 | { |
| 940 | struct acpi_namespace_node *node; | 943 | struct acpi_namespace_node *node; |
| 941 | acpi_status status; | 944 | acpi_status status; |
| @@ -960,10 +963,34 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | |||
| 960 | } | 963 | } |
| 961 | 964 | ||
| 962 | status = acpi_ns_get_attached_data(node, handler, data); | 965 | status = acpi_ns_get_attached_data(node, handler, data); |
| 966 | if (ACPI_SUCCESS(status) && callback) { | ||
| 967 | callback(*data); | ||
| 968 | } | ||
| 963 | 969 | ||
| 964 | unlock_and_exit: | 970 | unlock_and_exit: |
| 965 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 971 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| 966 | return (status); | 972 | return (status); |
| 967 | } | 973 | } |
| 968 | 974 | ||
| 975 | ACPI_EXPORT_SYMBOL(acpi_get_data_full) | ||
| 976 | |||
| 977 | /******************************************************************************* | ||
| 978 | * | ||
| 979 | * FUNCTION: acpi_get_data | ||
| 980 | * | ||
| 981 | * PARAMETERS: obj_handle - Namespace node | ||
| 982 | * handler - Handler used in call to attach_data | ||
| 983 | * data - Where the data is returned | ||
| 984 | * | ||
| 985 | * RETURN: Status | ||
| 986 | * | ||
| 987 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. | ||
| 988 | * | ||
| 989 | ******************************************************************************/ | ||
| 990 | acpi_status | ||
| 991 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | ||
| 992 | { | ||
| 993 | return acpi_get_data_full(obj_handle, handler, data, NULL); | ||
| 994 | } | ||
| 995 | |||
| 969 | ACPI_EXPORT_SYMBOL(acpi_get_data) | 996 | ACPI_EXPORT_SYMBOL(acpi_get_data) |
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index 3a4bd3ff49a3..8c6c11ce9760 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 0e6d79e462d4..dae9401be7a2 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
| 7 | 7 | ||
| 8 | /* | 8 | /* |
| 9 | * Copyright (C) 2000 - 2013, Intel Corp. | 9 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 10 | * All rights reserved. | 10 | * All rights reserved. |
| 11 | * | 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index 91a5a69db80c..314d314340ae 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index 065b44ae538f..b058e2390fdd 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -480,6 +480,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
| 480 | status = AE_OK; | 480 | status = AE_OK; |
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | if (status == AE_CTRL_TERMINATE) { | ||
| 484 | return_ACPI_STATUS(status); | ||
| 485 | } | ||
| 486 | |||
| 483 | status = | 487 | status = |
| 484 | acpi_ps_complete_op(walk_state, &op, | 488 | acpi_ps_complete_op(walk_state, &op, |
| 485 | status); | 489 | status); |
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c index 95dc608a66a8..a6885077d59e 100644 --- a/drivers/acpi/acpica/psobject.c +++ b/drivers/acpi/acpica/psobject.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -219,7 +219,10 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | |||
| 219 | 219 | ||
| 220 | status = walk_state->descending_callback(walk_state, op); | 220 | status = walk_state->descending_callback(walk_state, op); |
| 221 | if (ACPI_FAILURE(status)) { | 221 | if (ACPI_FAILURE(status)) { |
| 222 | ACPI_EXCEPTION((AE_INFO, status, "During name lookup/catalog")); | 222 | if (status != AE_CTRL_TERMINATE) { |
| 223 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 224 | "During name lookup/catalog")); | ||
| 225 | } | ||
| 223 | return_ACPI_STATUS(status); | 226 | return_ACPI_STATUS(status); |
| 224 | } | 227 | } |
| 225 | 228 | ||
| @@ -230,7 +233,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | |||
| 230 | status = acpi_ps_next_parse_state(walk_state, *op, status); | 233 | status = acpi_ps_next_parse_state(walk_state, *op, status); |
| 231 | if (ACPI_FAILURE(status)) { | 234 | if (ACPI_FAILURE(status)) { |
| 232 | if (status == AE_CTRL_PENDING) { | 235 | if (status == AE_CTRL_PENDING) { |
| 233 | return_ACPI_STATUS(AE_CTRL_PARSE_PENDING); | 236 | status = AE_CTRL_PARSE_PENDING; |
| 234 | } | 237 | } |
| 235 | return_ACPI_STATUS(status); | 238 | return_ACPI_STATUS(status); |
| 236 | } | 239 | } |
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c index 1b659e59710a..1755d2ac5656 100644 --- a/drivers/acpi/acpica/psopcode.c +++ b/drivers/acpi/acpica/psopcode.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c index b0c9787dbe61..0d8d37ffd04d 100644 --- a/drivers/acpi/acpica/psopinfo.c +++ b/drivers/acpi/acpica/psopinfo.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 79d9a28dedef..6d27b597394e 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c index 6a4b6fb39f32..32d250feea21 100644 --- a/drivers/acpi/acpica/psscope.c +++ b/drivers/acpi/acpica/psscope.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c index 877dc0de8df3..0b64181e7720 100644 --- a/drivers/acpi/acpica/pstree.c +++ b/drivers/acpi/acpica/pstree.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c index 91fa73a6e55e..3cd48802eede 100644 --- a/drivers/acpi/acpica/psutils.c +++ b/drivers/acpi/acpica/psutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index abd65624754f..9cb07e1e76d9 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c index fcb7a840e996..e135acaa5e1c 100644 --- a/drivers/acpi/acpica/psxface.c +++ b/drivers/acpi/acpica/psxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c index f3a9276ac665..916fd095ff34 100644 --- a/drivers/acpi/acpica/rsaddr.c +++ b/drivers/acpi/acpica/rsaddr.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index b60c9cf82862..689556744b03 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -636,7 +636,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
| 636 | 636 | ||
| 637 | for (index = 0; index < number_of_elements; index++) { | 637 | for (index = 0; index < number_of_elements; index++) { |
| 638 | 638 | ||
| 639 | /* Dereference the sub-package */ | 639 | /* Dereference the subpackage */ |
| 640 | 640 | ||
| 641 | package_element = *top_object_list; | 641 | package_element = *top_object_list; |
| 642 | 642 | ||
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 3a2ace93e62c..75d369050657 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -273,7 +273,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 273 | */ | 273 | */ |
| 274 | user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); | 274 | user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); |
| 275 | 275 | ||
| 276 | /* Each sub-package must be of length 4 */ | 276 | /* Each subpackage must be of length 4 */ |
| 277 | 277 | ||
| 278 | if ((*top_object_list)->package.count != 4) { | 278 | if ((*top_object_list)->package.count != 4) { |
| 279 | ACPI_ERROR((AE_INFO, | 279 | ACPI_ERROR((AE_INFO, |
| @@ -283,7 +283,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | /* | 285 | /* |
| 286 | * Dereference the sub-package. | 286 | * Dereference the subpackage. |
| 287 | * The sub_object_list will now point to an array of the four IRQ | 287 | * The sub_object_list will now point to an array of the four IRQ |
| 288 | * elements: [Address, Pin, Source, source_index] | 288 | * elements: [Address, Pin, Source, source_index] |
| 289 | */ | 289 | */ |
| @@ -292,7 +292,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 292 | /* 1) First subobject: Dereference the PRT.Address */ | 292 | /* 1) First subobject: Dereference the PRT.Address */ |
| 293 | 293 | ||
| 294 | obj_desc = sub_object_list[0]; | 294 | obj_desc = sub_object_list[0]; |
| 295 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { | 295 | if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) { |
| 296 | ACPI_ERROR((AE_INFO, | 296 | ACPI_ERROR((AE_INFO, |
| 297 | "(PRT[%u].Address) Need Integer, found %s", | 297 | "(PRT[%u].Address) Need Integer, found %s", |
| 298 | index, | 298 | index, |
| @@ -305,7 +305,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 305 | /* 2) Second subobject: Dereference the PRT.Pin */ | 305 | /* 2) Second subobject: Dereference the PRT.Pin */ |
| 306 | 306 | ||
| 307 | obj_desc = sub_object_list[1]; | 307 | obj_desc = sub_object_list[1]; |
| 308 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { | 308 | if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) { |
| 309 | ACPI_ERROR((AE_INFO, | 309 | ACPI_ERROR((AE_INFO, |
| 310 | "(PRT[%u].Pin) Need Integer, found %s", | 310 | "(PRT[%u].Pin) Need Integer, found %s", |
| 311 | index, | 311 | index, |
| @@ -394,7 +394,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
| 394 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 394 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
| 395 | 395 | ||
| 396 | obj_desc = sub_object_list[3]; | 396 | obj_desc = sub_object_list[3]; |
| 397 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { | 397 | if (!obj_desc || obj_desc->common.type != ACPI_TYPE_INTEGER) { |
| 398 | ACPI_ERROR((AE_INFO, | 398 | ACPI_ERROR((AE_INFO, |
| 399 | "(PRT[%u].SourceIndex) Need Integer, found %s", | 399 | "(PRT[%u].SourceIndex) Need Integer, found %s", |
| 400 | index, | 400 | index, |
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c index 8a2d4986b0aa..c3c56b5a9788 100644 --- a/drivers/acpi/acpica/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -47,7 +47,8 @@ | |||
| 47 | 47 | ||
| 48 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
| 49 | ACPI_MODULE_NAME("rsdump") | 49 | ACPI_MODULE_NAME("rsdump") |
| 50 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 50 | |
| 51 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) | ||
| 51 | /* Local prototypes */ | 52 | /* Local prototypes */ |
| 52 | static void acpi_rs_out_string(char *title, char *value); | 53 | static void acpi_rs_out_string(char *title, char *value); |
| 53 | 54 | ||
diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c index 46192bd53653..2f9332d5c973 100644 --- a/drivers/acpi/acpica/rsdumpinfo.c +++ b/drivers/acpi/acpica/rsdumpinfo.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -48,7 +48,7 @@ | |||
| 48 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
| 49 | ACPI_MODULE_NAME("rsdumpinfo") | 49 | ACPI_MODULE_NAME("rsdumpinfo") |
| 50 | 50 | ||
| 51 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 51 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) |
| 52 | #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) | 52 | #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) |
| 53 | #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) | 53 | #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) |
| 54 | #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) | 54 | #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) |
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c index 41fed78e0de6..9d3f8a9a24bd 100644 --- a/drivers/acpi/acpica/rsinfo.c +++ b/drivers/acpi/acpica/rsinfo.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -132,8 +132,7 @@ struct acpi_rsconvert_info *acpi_gbl_convert_resource_serial_bus_dispatch[] = { | |||
| 132 | acpi_rs_convert_uart_serial_bus, | 132 | acpi_rs_convert_uart_serial_bus, |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | #ifdef ACPI_FUTURE_USAGE | 135 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) |
| 136 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
| 137 | 136 | ||
| 138 | /* Dispatch table for resource dump functions */ | 137 | /* Dispatch table for resource dump functions */ |
| 139 | 138 | ||
| @@ -168,7 +167,6 @@ struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[] = { | |||
| 168 | }; | 167 | }; |
| 169 | #endif | 168 | #endif |
| 170 | 169 | ||
| 171 | #endif /* ACPI_FUTURE_USAGE */ | ||
| 172 | /* | 170 | /* |
| 173 | * Base sizes for external AML resource descriptors, indexed by internal type. | 171 | * Base sizes for external AML resource descriptors, indexed by internal type. |
| 174 | * Includes size of the descriptor header (1 byte for small descriptors, | 172 | * Includes size of the descriptor header (1 byte for small descriptors, |
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c index ca183755a6f9..19d64873290a 100644 --- a/drivers/acpi/acpica/rsio.c +++ b/drivers/acpi/acpica/rsio.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c index 364decc1028a..3461f7db26df 100644 --- a/drivers/acpi/acpica/rsirq.c +++ b/drivers/acpi/acpica/rsirq.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c index 6053aa182093..77291293af64 100644 --- a/drivers/acpi/acpica/rslist.c +++ b/drivers/acpi/acpica/rslist.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c index ebc773a1b350..eab4483ff5f8 100644 --- a/drivers/acpi/acpica/rsmemory.c +++ b/drivers/acpi/acpica/rsmemory.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index c99cec9cefde..41eea4bc089c 100644 --- a/drivers/acpi/acpica/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c index fe49fc43e10f..9e8407223d95 100644 --- a/drivers/acpi/acpica/rsserial.c +++ b/drivers/acpi/acpica/rsserial.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index 14a7982c9961..897a5ceb0420 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 01e476988aae..877ab9202133 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 8f89263ac47e..ec14588254d4 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c index e4f4f02d49e7..c12003947bd5 100644 --- a/drivers/acpi/acpica/tbfind.c +++ b/drivers/acpi/acpica/tbfind.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 634357d51fe9..e3040947e9a0 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -292,10 +292,11 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | |||
| 292 | new_table = acpi_os_map_memory(new_address, new_table_length); | 292 | new_table = acpi_os_map_memory(new_address, new_table_length); |
| 293 | if (!new_table) { | 293 | if (!new_table) { |
| 294 | ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, | 294 | ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, |
| 295 | "%4.4s %p Attempted physical table override failed", | 295 | "%4.4s " ACPI_PRINTF_UINT |
| 296 | " Attempted physical table override failed", | ||
| 296 | table_header->signature, | 297 | table_header->signature, |
| 297 | ACPI_CAST_PTR(void, | 298 | ACPI_FORMAT_TO_UINT(table_desc-> |
| 298 | table_desc->address))); | 299 | address))); |
| 299 | return (NULL); | 300 | return (NULL); |
| 300 | } | 301 | } |
| 301 | 302 | ||
| @@ -308,11 +309,11 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header | |||
| 308 | 309 | ||
| 309 | finish_override: | 310 | finish_override: |
| 310 | 311 | ||
| 311 | ACPI_INFO((AE_INFO, | 312 | ACPI_INFO((AE_INFO, "%4.4s " ACPI_PRINTF_UINT |
| 312 | "%4.4s %p %s table override, new table: %p", | 313 | " %s table override, new table: " ACPI_PRINTF_UINT, |
| 313 | table_header->signature, | 314 | table_header->signature, |
| 314 | ACPI_CAST_PTR(void, table_desc->address), | 315 | ACPI_FORMAT_TO_UINT(table_desc->address), |
| 315 | override_type, new_table)); | 316 | override_type, ACPI_FORMAT_TO_UINT(new_table))); |
| 316 | 317 | ||
| 317 | /* We can now unmap/delete the original table (if fully mapped) */ | 318 | /* We can now unmap/delete the original table (if fully mapped) */ |
| 318 | 319 | ||
diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c index 6866e767ba90..df3bb20ea325 100644 --- a/drivers/acpi/acpica/tbprint.c +++ b/drivers/acpi/acpica/tbprint.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -128,15 +128,17 @@ acpi_tb_print_table_header(acpi_physical_address address, | |||
| 128 | struct acpi_table_header local_header; | 128 | struct acpi_table_header local_header; |
| 129 | 129 | ||
| 130 | /* | 130 | /* |
| 131 | * The reason that the Address is cast to a void pointer is so that we | 131 | * The reason that we use ACPI_PRINTF_UINT and ACPI_FORMAT_TO_UINT is to |
| 132 | * can use %p which will work properly on both 32-bit and 64-bit hosts. | 132 | * support both 32-bit and 64-bit hosts/addresses in a consistent manner. |
| 133 | * The %p specifier does not emit uniform output on all hosts. On some, | ||
| 134 | * leading zeros are not supported. | ||
| 133 | */ | 135 | */ |
| 134 | if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { | 136 | if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { |
| 135 | 137 | ||
| 136 | /* FACS only has signature and length fields */ | 138 | /* FACS only has signature and length fields */ |
| 137 | 139 | ||
| 138 | ACPI_INFO((AE_INFO, "%4.4s %p %06X", | 140 | ACPI_INFO((AE_INFO, "%-4.4s " ACPI_PRINTF_UINT " %06X", |
| 139 | header->signature, ACPI_CAST_PTR(void, address), | 141 | header->signature, ACPI_FORMAT_TO_UINT(address), |
| 140 | header->length)); | 142 | header->length)); |
| 141 | } else if (ACPI_VALIDATE_RSDP_SIG(header->signature)) { | 143 | } else if (ACPI_VALIDATE_RSDP_SIG(header->signature)) { |
| 142 | 144 | ||
| @@ -147,8 +149,9 @@ acpi_tb_print_table_header(acpi_physical_address address, | |||
| 147 | header)->oem_id, ACPI_OEM_ID_SIZE); | 149 | header)->oem_id, ACPI_OEM_ID_SIZE); |
| 148 | acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); | 150 | acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); |
| 149 | 151 | ||
| 150 | ACPI_INFO((AE_INFO, "RSDP %p %06X (v%.2d %6.6s)", | 152 | ACPI_INFO((AE_INFO, |
| 151 | ACPI_CAST_PTR(void, address), | 153 | "RSDP " ACPI_PRINTF_UINT " %06X (v%.2d %-6.6s)", |
| 154 | ACPI_FORMAT_TO_UINT(address), | ||
| 152 | (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> | 155 | (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> |
| 153 | revision > | 156 | revision > |
| 154 | 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, | 157 | 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, |
| @@ -162,8 +165,9 @@ acpi_tb_print_table_header(acpi_physical_address address, | |||
| 162 | acpi_tb_cleanup_table_header(&local_header, header); | 165 | acpi_tb_cleanup_table_header(&local_header, header); |
| 163 | 166 | ||
| 164 | ACPI_INFO((AE_INFO, | 167 | ACPI_INFO((AE_INFO, |
| 165 | "%4.4s %p %06X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", | 168 | "%-4.4s " ACPI_PRINTF_UINT |
| 166 | local_header.signature, ACPI_CAST_PTR(void, address), | 169 | " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", |
| 170 | local_header.signature, ACPI_FORMAT_TO_UINT(address), | ||
| 167 | local_header.length, local_header.revision, | 171 | local_header.length, local_header.revision, |
| 168 | local_header.oem_id, local_header.oem_table_id, | 172 | local_header.oem_id, local_header.oem_table_id, |
| 169 | local_header.oem_revision, | 173 | local_header.oem_revision, |
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 6412d3c301cb..a4702eee91a8 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index db826eaadd1c..a1593159d9ea 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index 60b5a871833c..0909420fc776 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index e4e1468877c3..65ab8fed3d5e 100644 --- a/drivers/acpi/acpica/tbxfroot.c +++ b/drivers/acpi/acpica/tbxfroot.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c index 2c2b6ae5dfc4..a1acec9d2ef3 100644 --- a/drivers/acpi/acpica/utaddress.c +++ b/drivers/acpi/acpica/utaddress.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c index 1851762fc5b5..efac83c606dc 100644 --- a/drivers/acpi/acpica/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utbuffer.c b/drivers/acpi/acpica/utbuffer.c index 11fde93be120..3c1699740653 100644 --- a/drivers/acpi/acpica/utbuffer.c +++ b/drivers/acpi/acpica/utbuffer.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c index cacd2fd9e665..78fde0aac487 100644 --- a/drivers/acpi/acpica/utcache.c +++ b/drivers/acpi/acpica/utcache.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index edff4e653d9a..270c16464dd9 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -535,10 +535,10 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
| 535 | 535 | ||
| 536 | case ACPI_TYPE_LOCAL_REFERENCE: | 536 | case ACPI_TYPE_LOCAL_REFERENCE: |
| 537 | 537 | ||
| 538 | /* TBD: should validate incoming handle */ | 538 | /* An incoming reference is defined to be a namespace node */ |
| 539 | 539 | ||
| 540 | internal_object->reference.class = ACPI_REFCLASS_NAME; | 540 | internal_object->reference.class = ACPI_REFCLASS_REFOF; |
| 541 | internal_object->reference.node = | 541 | internal_object->reference.object = |
| 542 | external_object->reference.handle; | 542 | external_object->reference.handle; |
| 543 | break; | 543 | break; |
| 544 | 544 | ||
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index d971c8631263..21a20ac5b1e1 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c index b3f31dd89a45..fbfa9eca011f 100644 --- a/drivers/acpi/acpica/utdecode.c +++ b/drivers/acpi/acpica/utdecode.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index c07d2227ea42..a3516de213fa 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -75,6 +75,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
| 75 | union acpi_operand_object *handler_desc; | 75 | union acpi_operand_object *handler_desc; |
| 76 | union acpi_operand_object *second_desc; | 76 | union acpi_operand_object *second_desc; |
| 77 | union acpi_operand_object *next_desc; | 77 | union acpi_operand_object *next_desc; |
| 78 | union acpi_operand_object *start_desc; | ||
| 78 | union acpi_operand_object **last_obj_ptr; | 79 | union acpi_operand_object **last_obj_ptr; |
| 79 | 80 | ||
| 80 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); | 81 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); |
| @@ -235,10 +236,11 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
| 235 | if (handler_desc) { | 236 | if (handler_desc) { |
| 236 | next_desc = | 237 | next_desc = |
| 237 | handler_desc->address_space.region_list; | 238 | handler_desc->address_space.region_list; |
| 239 | start_desc = next_desc; | ||
| 238 | last_obj_ptr = | 240 | last_obj_ptr = |
| 239 | &handler_desc->address_space.region_list; | 241 | &handler_desc->address_space.region_list; |
| 240 | 242 | ||
| 241 | /* Remove the region object from the handler's list */ | 243 | /* Remove the region object from the handler list */ |
| 242 | 244 | ||
| 243 | while (next_desc) { | 245 | while (next_desc) { |
| 244 | if (next_desc == object) { | 246 | if (next_desc == object) { |
| @@ -247,10 +249,19 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
| 247 | break; | 249 | break; |
| 248 | } | 250 | } |
| 249 | 251 | ||
| 250 | /* Walk the linked list of handler */ | 252 | /* Walk the linked list of handlers */ |
| 251 | 253 | ||
| 252 | last_obj_ptr = &next_desc->region.next; | 254 | last_obj_ptr = &next_desc->region.next; |
| 253 | next_desc = next_desc->region.next; | 255 | next_desc = next_desc->region.next; |
| 256 | |||
| 257 | /* Prevent infinite loop if list is corrupted */ | ||
| 258 | |||
| 259 | if (next_desc == start_desc) { | ||
| 260 | ACPI_ERROR((AE_INFO, | ||
| 261 | "Circular region list in address handler object %p", | ||
| 262 | handler_desc)); | ||
| 263 | return_VOID; | ||
| 264 | } | ||
| 254 | } | 265 | } |
| 255 | 266 | ||
| 256 | if (handler_desc->address_space.handler_flags & | 267 | if (handler_desc->address_space.handler_flags & |
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c index 154fdcaa5830..8e544d4688cd 100644 --- a/drivers/acpi/acpica/uterror.c +++ b/drivers/acpi/acpica/uterror.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 16fb90506db7..8fed1482d228 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c index 3cf7b597edb9..0403dcaabaf2 100644 --- a/drivers/acpi/acpica/utexcep.c +++ b/drivers/acpi/acpica/utexcep.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 030cb0dc673c..f3abeae9d2f8 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -55,31 +55,27 @@ ACPI_MODULE_NAME("utglobal") | |||
| 55 | * Static global variable initialization. | 55 | * Static global variable initialization. |
| 56 | * | 56 | * |
| 57 | ******************************************************************************/ | 57 | ******************************************************************************/ |
| 58 | /* | 58 | /* Debug output control masks */ |
| 59 | * We want the debug switches statically initialized so they | ||
| 60 | * are already set when the debugger is entered. | ||
| 61 | */ | ||
| 62 | /* Debug switch - level and trace mask */ | ||
| 63 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; | 59 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
| 64 | 60 | ||
| 65 | /* Debug switch - layer (component) mask */ | ||
| 66 | |||
| 67 | u32 acpi_dbg_layer = 0; | 61 | u32 acpi_dbg_layer = 0; |
| 68 | u32 acpi_gbl_nesting_level = 0; | ||
| 69 | 62 | ||
| 70 | /* Debugger globals */ | 63 | /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ |
| 71 | 64 | ||
| 72 | u8 acpi_gbl_db_terminate_threads = FALSE; | 65 | struct acpi_table_fadt acpi_gbl_FADT; |
| 73 | u8 acpi_gbl_abort_method = FALSE; | 66 | u32 acpi_gbl_trace_flags; |
| 74 | u8 acpi_gbl_method_executing = FALSE; | 67 | acpi_name acpi_gbl_trace_method_name; |
| 68 | u8 acpi_gbl_system_awake_and_running; | ||
| 69 | u32 acpi_current_gpe_count; | ||
| 75 | 70 | ||
| 76 | /* System flags */ | 71 | /* |
| 77 | 72 | * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning | |
| 78 | u32 acpi_gbl_startup_flags = 0; | 73 | * that the ACPI hardware is no longer required. A flag in the FADT indicates |
| 79 | 74 | * a reduced HW machine, and that flag is duplicated here for convenience. | |
| 80 | /* System starts uninitialized */ | 75 | */ |
| 76 | u8 acpi_gbl_reduced_hardware; | ||
| 81 | 77 | ||
| 82 | u8 acpi_gbl_shutdown = TRUE; | 78 | /* Various state name strings */ |
| 83 | 79 | ||
| 84 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { | 80 | const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = { |
| 85 | "\\_S0_", | 81 | "\\_S0_", |
| @@ -335,7 +331,6 @@ acpi_status acpi_ut_init_globals(void) | |||
| 335 | 331 | ||
| 336 | acpi_gbl_DSDT = NULL; | 332 | acpi_gbl_DSDT = NULL; |
| 337 | acpi_gbl_cm_single_step = FALSE; | 333 | acpi_gbl_cm_single_step = FALSE; |
| 338 | acpi_gbl_db_terminate_threads = FALSE; | ||
| 339 | acpi_gbl_shutdown = FALSE; | 334 | acpi_gbl_shutdown = FALSE; |
| 340 | acpi_gbl_ns_lookup_count = 0; | 335 | acpi_gbl_ns_lookup_count = 0; |
| 341 | acpi_gbl_ps_find_count = 0; | 336 | acpi_gbl_ps_find_count = 0; |
| @@ -382,6 +377,10 @@ acpi_status acpi_ut_init_globals(void) | |||
| 382 | acpi_gbl_disable_mem_tracking = FALSE; | 377 | acpi_gbl_disable_mem_tracking = FALSE; |
| 383 | #endif | 378 | #endif |
| 384 | 379 | ||
| 380 | #ifdef ACPI_DEBUGGER | ||
| 381 | acpi_gbl_db_terminate_threads = FALSE; | ||
| 382 | #endif | ||
| 383 | |||
| 385 | return_ACPI_STATUS(AE_OK); | 384 | return_ACPI_STATUS(AE_OK); |
| 386 | } | 385 | } |
| 387 | 386 | ||
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index bfca7b4b6731..4b12880e5b11 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index c5d1ac44c07d..5f56fc49021e 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c index 5c26ad420344..dc6e96547f18 100644 --- a/drivers/acpi/acpica/utlock.c +++ b/drivers/acpi/acpica/utlock.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index 909fe66e1934..d44dee6ee10a 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index 02f9101b65e4..2e2bb14e1099 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index 08c323245584..82717fff9ffc 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 517af700399d..dfa9009bfc87 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 8856bd37bc76..685766fc6ca8 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -47,6 +47,31 @@ | |||
| 47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
| 48 | ACPI_MODULE_NAME("utosi") | 48 | ACPI_MODULE_NAME("utosi") |
| 49 | 49 | ||
| 50 | /****************************************************************************** | ||
| 51 | * | ||
| 52 | * ACPICA policy for new _OSI strings: | ||
| 53 | * | ||
| 54 | * It is the stated policy of ACPICA that new _OSI strings will be integrated | ||
| 55 | * into this module as soon as possible after they are defined. It is strongly | ||
| 56 | * recommended that all ACPICA hosts mirror this policy and integrate any | ||
| 57 | * changes to this module as soon as possible. There are several historical | ||
| 58 | * reasons behind this policy: | ||
| 59 | * | ||
| 60 | * 1) New BIOSs tend to test only the case where the host responds TRUE to | ||
| 61 | * the latest version of Windows, which would respond to the latest/newest | ||
| 62 | * _OSI string. Not responding TRUE to the latest version of Windows will | ||
| 63 | * risk executing untested code paths throughout the DSDT and SSDTs. | ||
| 64 | * | ||
| 65 | * 2) If a new _OSI string is recognized only after a significant delay, this | ||
| 66 | * has the potential to cause problems on existing working machines because | ||
| 67 | * of the possibility that a new and different path through the ASL code | ||
| 68 | * will be executed. | ||
| 69 | * | ||
| 70 | * 3) New _OSI strings are tending to come out about once per year. A delay | ||
| 71 | * in recognizing a new string for a significant amount of time risks the | ||
| 72 | * release of another string which only compounds the initial problem. | ||
| 73 | * | ||
| 74 | *****************************************************************************/ | ||
| 50 | /* | 75 | /* |
| 51 | * Strings supported by the _OSI predefined control method (which is | 76 | * Strings supported by the _OSI predefined control method (which is |
| 52 | * implemented internally within this module.) | 77 | * implemented internally within this module.) |
| @@ -74,6 +99,7 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = { | |||
| 74 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ | 99 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ |
| 75 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ | 100 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ |
| 76 | {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ | 101 | {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ |
| 102 | {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ | ||
| 77 | 103 | ||
| 78 | /* Feature Group Strings */ | 104 | /* Feature Group Strings */ |
| 79 | 105 | ||
diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c index eb3aca761369..36bec57ebd23 100644 --- a/drivers/acpi/acpica/utownerid.c +++ b/drivers/acpi/acpica/utownerid.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utpredef.c b/drivers/acpi/acpica/utpredef.c index 2b1ce4cd3207..db30caff130a 100644 --- a/drivers/acpi/acpica/utpredef.c +++ b/drivers/acpi/acpica/utpredef.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index 2c2accb9e534..14cb6c0c8be2 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -47,7 +47,8 @@ | |||
| 47 | 47 | ||
| 48 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
| 49 | ACPI_MODULE_NAME("utresrc") | 49 | ACPI_MODULE_NAME("utresrc") |
| 50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 50 | |
| 51 | #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | ||
| 51 | /* | 52 | /* |
| 52 | * Strings used to decode resource descriptors. | 53 | * Strings used to decode resource descriptors. |
| 53 | * Used by both the disassembler and the debugger resource dump routines | 54 | * Used by both the disassembler and the debugger resource dump routines |
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c index 03c4c2febd84..1cc97a752c15 100644 --- a/drivers/acpi/acpica/utstate.c +++ b/drivers/acpi/acpica/utstate.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c index 45c0eb26b33d..77219336c7e0 100644 --- a/drivers/acpi/acpica/utstring.c +++ b/drivers/acpi/acpica/utstring.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c index c0027773cccb..7d0ee969d781 100644 --- a/drivers/acpi/acpica/uttrack.c +++ b/drivers/acpi/acpica/uttrack.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -276,7 +276,8 @@ acpi_ut_free_and_track(void *allocation, | |||
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | acpi_os_free(debug_block); | 278 | acpi_os_free(debug_block); |
| 279 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); | 279 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed (block %p)\n", |
| 280 | allocation, debug_block)); | ||
| 280 | return_VOID; | 281 | return_VOID; |
| 281 | } | 282 | } |
| 282 | 283 | ||
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index be322c83643a..502a8492dc83 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index f7edb88f6054..edd861102f1b 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 246ef68681f4..13380d818462 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utxfmutex.c b/drivers/acpi/acpica/utxfmutex.c index 312299721ba1..2a0f9e04d3a4 100644 --- a/drivers/acpi/acpica/utxfmutex.c +++ b/drivers/acpi/acpica/utxfmutex.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 3650b2183227..c4dac7150960 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig | |||
| @@ -12,7 +12,7 @@ config ACPI_APEI | |||
| 12 | 12 | ||
| 13 | config ACPI_APEI_GHES | 13 | config ACPI_APEI_GHES |
| 14 | bool "APEI Generic Hardware Error Source" | 14 | bool "APEI Generic Hardware Error Source" |
| 15 | depends on ACPI_APEI && X86 | 15 | depends on ACPI_APEI |
| 16 | select ACPI_HED | 16 | select ACPI_HED |
| 17 | select IRQ_WORK | 17 | select IRQ_WORK |
| 18 | select GENERIC_ALLOCATOR | 18 | select GENERIC_ALLOCATOR |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 797a6938d051..9a2c63b20050 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -39,15 +39,13 @@ | |||
| 39 | #include <linux/acpi.h> | 39 | #include <linux/acpi.h> |
| 40 | #include <linux/power_supply.h> | 40 | #include <linux/power_supply.h> |
| 41 | 41 | ||
| 42 | #include "battery.h" | ||
| 43 | |||
| 42 | #define PREFIX "ACPI: " | 44 | #define PREFIX "ACPI: " |
| 43 | 45 | ||
| 44 | #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF | 46 | #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF |
| 45 | 47 | ||
| 46 | #define ACPI_BATTERY_CLASS "battery" | ||
| 47 | #define ACPI_BATTERY_DEVICE_NAME "Battery" | 48 | #define ACPI_BATTERY_DEVICE_NAME "Battery" |
| 48 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | ||
| 49 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 | ||
| 50 | #define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82 | ||
| 51 | 49 | ||
| 52 | /* Battery power unit: 0 means mW, 1 means mA */ | 50 | /* Battery power unit: 0 means mW, 1 means mA */ |
| 53 | #define ACPI_BATTERY_POWER_UNIT_MA 1 | 51 | #define ACPI_BATTERY_POWER_UNIT_MA 1 |
| @@ -736,6 +734,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) | |||
| 736 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 734 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| 737 | dev_name(&device->dev), event, | 735 | dev_name(&device->dev), event, |
| 738 | acpi_battery_present(battery)); | 736 | acpi_battery_present(battery)); |
| 737 | acpi_notifier_call_chain(device, event, acpi_battery_present(battery)); | ||
| 739 | /* acpi_battery_update could remove power_supply object */ | 738 | /* acpi_battery_update could remove power_supply object */ |
| 740 | if (old && battery->bat.dev) | 739 | if (old && battery->bat.dev) |
| 741 | power_supply_changed(&battery->bat); | 740 | power_supply_changed(&battery->bat); |
diff --git a/drivers/acpi/battery.h b/drivers/acpi/battery.h new file mode 100644 index 000000000000..6c084976987d --- /dev/null +++ b/drivers/acpi/battery.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef __ACPI_BATTERY_H | ||
| 2 | #define __ACPI_BATTERY_H | ||
| 3 | |||
| 4 | #define ACPI_BATTERY_CLASS "battery" | ||
| 5 | |||
| 6 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | ||
| 7 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 | ||
| 8 | #define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82 | ||
| 9 | |||
| 10 | #endif | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index fcb59c21c68d..e7e5844c87d0 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -311,9 +311,7 @@ static void acpi_bus_osc_support(void) | |||
| 311 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT; | 311 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT; |
| 312 | #endif | 312 | #endif |
| 313 | 313 | ||
| 314 | #ifdef ACPI_HOTPLUG_OST | ||
| 315 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT; | 314 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT; |
| 316 | #endif | ||
| 317 | 315 | ||
| 318 | if (!ghes_disable) | 316 | if (!ghes_disable) |
| 319 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT; | 317 | capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT; |
| @@ -340,60 +338,77 @@ static void acpi_bus_osc_support(void) | |||
| 340 | */ | 338 | */ |
| 341 | static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) | 339 | static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) |
| 342 | { | 340 | { |
| 343 | struct acpi_device *device = NULL; | 341 | struct acpi_device *adev; |
| 344 | struct acpi_driver *driver; | 342 | struct acpi_driver *driver; |
| 345 | 343 | acpi_status status; | |
| 346 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n", | 344 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
| 347 | type, handle)); | ||
| 348 | 345 | ||
| 349 | switch (type) { | 346 | switch (type) { |
| 350 | |||
| 351 | case ACPI_NOTIFY_BUS_CHECK: | 347 | case ACPI_NOTIFY_BUS_CHECK: |
| 352 | /* TBD */ | 348 | acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n"); |
| 353 | break; | 349 | break; |
| 354 | 350 | ||
| 355 | case ACPI_NOTIFY_DEVICE_CHECK: | 351 | case ACPI_NOTIFY_DEVICE_CHECK: |
| 356 | /* TBD */ | 352 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n"); |
| 357 | break; | 353 | break; |
| 358 | 354 | ||
| 359 | case ACPI_NOTIFY_DEVICE_WAKE: | 355 | case ACPI_NOTIFY_DEVICE_WAKE: |
| 360 | /* TBD */ | 356 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_WAKE event\n"); |
| 361 | break; | 357 | break; |
| 362 | 358 | ||
| 363 | case ACPI_NOTIFY_EJECT_REQUEST: | 359 | case ACPI_NOTIFY_EJECT_REQUEST: |
| 364 | /* TBD */ | 360 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); |
| 365 | break; | 361 | break; |
| 366 | 362 | ||
| 367 | case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: | 363 | case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: |
| 364 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK_LIGHT event\n"); | ||
| 368 | /* TBD: Exactly what does 'light' mean? */ | 365 | /* TBD: Exactly what does 'light' mean? */ |
| 369 | break; | 366 | break; |
| 370 | 367 | ||
| 371 | case ACPI_NOTIFY_FREQUENCY_MISMATCH: | 368 | case ACPI_NOTIFY_FREQUENCY_MISMATCH: |
| 372 | /* TBD */ | 369 | acpi_handle_err(handle, "Device cannot be configured due " |
| 370 | "to a frequency mismatch\n"); | ||
| 373 | break; | 371 | break; |
| 374 | 372 | ||
| 375 | case ACPI_NOTIFY_BUS_MODE_MISMATCH: | 373 | case ACPI_NOTIFY_BUS_MODE_MISMATCH: |
| 376 | /* TBD */ | 374 | acpi_handle_err(handle, "Device cannot be configured due " |
| 375 | "to a bus mode mismatch\n"); | ||
| 377 | break; | 376 | break; |
| 378 | 377 | ||
| 379 | case ACPI_NOTIFY_POWER_FAULT: | 378 | case ACPI_NOTIFY_POWER_FAULT: |
| 380 | /* TBD */ | 379 | acpi_handle_err(handle, "Device has suffered a power fault\n"); |
| 381 | break; | 380 | break; |
| 382 | 381 | ||
| 383 | default: | 382 | default: |
| 384 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 383 | acpi_handle_warn(handle, "Unsupported event type 0x%x\n", type); |
| 385 | "Received unknown/unsupported notification [%08x]\n", | 384 | ost_code = ACPI_OST_SC_UNRECOGNIZED_NOTIFY; |
| 386 | type)); | 385 | goto err; |
| 387 | break; | ||
| 388 | } | 386 | } |
| 389 | 387 | ||
| 390 | acpi_bus_get_device(handle, &device); | 388 | adev = acpi_bus_get_acpi_device(handle); |
| 391 | if (device) { | 389 | if (!adev) |
| 392 | driver = device->driver; | 390 | goto err; |
| 393 | if (driver && driver->ops.notify && | 391 | |
| 394 | (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) | 392 | driver = adev->driver; |
| 395 | driver->ops.notify(device, type); | 393 | if (driver && driver->ops.notify && |
| 394 | (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) | ||
| 395 | driver->ops.notify(adev, type); | ||
| 396 | |||
| 397 | switch (type) { | ||
| 398 | case ACPI_NOTIFY_BUS_CHECK: | ||
| 399 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
| 400 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
| 401 | status = acpi_hotplug_schedule(adev, type); | ||
| 402 | if (ACPI_SUCCESS(status)) | ||
| 403 | return; | ||
| 404 | default: | ||
| 405 | break; | ||
| 396 | } | 406 | } |
| 407 | acpi_bus_put_acpi_device(adev); | ||
| 408 | return; | ||
| 409 | |||
| 410 | err: | ||
| 411 | acpi_evaluate_ost(handle, type, ost_code, NULL); | ||
| 397 | } | 412 | } |
| 398 | 413 | ||
| 399 | /* -------------------------------------------------------------------------- | 414 | /* -------------------------------------------------------------------------- |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 714e957a871a..db35594d4df7 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
| @@ -302,6 +302,10 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) | |||
| 302 | input_sync(input); | 302 | input_sync(input); |
| 303 | 303 | ||
| 304 | pm_wakeup_event(&device->dev, 0); | 304 | pm_wakeup_event(&device->dev, 0); |
| 305 | acpi_bus_generate_netlink_event( | ||
| 306 | device->pnp.device_class, | ||
| 307 | dev_name(&device->dev), | ||
| 308 | event, ++button->pushed); | ||
| 305 | } | 309 | } |
| 306 | break; | 310 | break; |
| 307 | default: | 311 | default: |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 368f9ddb8480..63119d09b354 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
| @@ -31,8 +31,6 @@ | |||
| 31 | 31 | ||
| 32 | #include "internal.h" | 32 | #include "internal.h" |
| 33 | 33 | ||
| 34 | #define PREFIX "ACPI: " | ||
| 35 | |||
| 36 | #define _COMPONENT ACPI_CONTAINER_COMPONENT | 34 | #define _COMPONENT ACPI_CONTAINER_COMPONENT |
| 37 | ACPI_MODULE_NAME("container"); | 35 | ACPI_MODULE_NAME("container"); |
| 38 | 36 | ||
| @@ -68,6 +66,9 @@ static int container_device_attach(struct acpi_device *adev, | |||
| 68 | struct device *dev; | 66 | struct device *dev; |
| 69 | int ret; | 67 | int ret; |
| 70 | 68 | ||
| 69 | if (adev->flags.is_dock_station) | ||
| 70 | return 0; | ||
| 71 | |||
| 71 | cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); | 72 | cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); |
| 72 | if (!cdev) | 73 | if (!cdev) |
| 73 | return -ENOMEM; | 74 | return -ENOMEM; |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index c14a00d3dca6..d047739f3380 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
| @@ -901,15 +901,30 @@ EXPORT_SYMBOL_GPL(acpi_dev_resume_early); | |||
| 901 | int acpi_subsys_prepare(struct device *dev) | 901 | int acpi_subsys_prepare(struct device *dev) |
| 902 | { | 902 | { |
| 903 | /* | 903 | /* |
| 904 | * Follow PCI and resume devices suspended at run time before running | 904 | * Devices having power.ignore_children set may still be necessary for |
| 905 | * their system suspend callbacks. | 905 | * suspending their children in the next phase of device suspend. |
| 906 | */ | 906 | */ |
| 907 | pm_runtime_resume(dev); | 907 | if (dev->power.ignore_children) |
| 908 | pm_runtime_resume(dev); | ||
| 909 | |||
| 908 | return pm_generic_prepare(dev); | 910 | return pm_generic_prepare(dev); |
| 909 | } | 911 | } |
| 910 | EXPORT_SYMBOL_GPL(acpi_subsys_prepare); | 912 | EXPORT_SYMBOL_GPL(acpi_subsys_prepare); |
| 911 | 913 | ||
| 912 | /** | 914 | /** |
| 915 | * acpi_subsys_suspend - Run the device driver's suspend callback. | ||
| 916 | * @dev: Device to handle. | ||
| 917 | * | ||
| 918 | * Follow PCI and resume devices suspended at run time before running their | ||
| 919 | * system suspend callbacks. | ||
| 920 | */ | ||
| 921 | int acpi_subsys_suspend(struct device *dev) | ||
| 922 | { | ||
| 923 | pm_runtime_resume(dev); | ||
| 924 | return pm_generic_suspend(dev); | ||
| 925 | } | ||
| 926 | |||
| 927 | /** | ||
| 913 | * acpi_subsys_suspend_late - Suspend device using ACPI. | 928 | * acpi_subsys_suspend_late - Suspend device using ACPI. |
| 914 | * @dev: Device to suspend. | 929 | * @dev: Device to suspend. |
| 915 | * | 930 | * |
| @@ -937,6 +952,23 @@ int acpi_subsys_resume_early(struct device *dev) | |||
| 937 | return ret ? ret : pm_generic_resume_early(dev); | 952 | return ret ? ret : pm_generic_resume_early(dev); |
| 938 | } | 953 | } |
| 939 | EXPORT_SYMBOL_GPL(acpi_subsys_resume_early); | 954 | EXPORT_SYMBOL_GPL(acpi_subsys_resume_early); |
| 955 | |||
| 956 | /** | ||
| 957 | * acpi_subsys_freeze - Run the device driver's freeze callback. | ||
| 958 | * @dev: Device to handle. | ||
| 959 | */ | ||
| 960 | int acpi_subsys_freeze(struct device *dev) | ||
| 961 | { | ||
| 962 | /* | ||
| 963 | * This used to be done in acpi_subsys_prepare() for all devices and | ||
| 964 | * some drivers may depend on it, so do it here. Ideally, however, | ||
| 965 | * runtime-suspended devices should not be touched during freeze/thaw | ||
| 966 | * transitions. | ||
| 967 | */ | ||
| 968 | pm_runtime_resume(dev); | ||
| 969 | return pm_generic_freeze(dev); | ||
| 970 | } | ||
| 971 | |||
| 940 | #endif /* CONFIG_PM_SLEEP */ | 972 | #endif /* CONFIG_PM_SLEEP */ |
| 941 | 973 | ||
| 942 | static struct dev_pm_domain acpi_general_pm_domain = { | 974 | static struct dev_pm_domain acpi_general_pm_domain = { |
| @@ -947,8 +979,11 @@ static struct dev_pm_domain acpi_general_pm_domain = { | |||
| 947 | #endif | 979 | #endif |
| 948 | #ifdef CONFIG_PM_SLEEP | 980 | #ifdef CONFIG_PM_SLEEP |
| 949 | .prepare = acpi_subsys_prepare, | 981 | .prepare = acpi_subsys_prepare, |
| 982 | .suspend = acpi_subsys_suspend, | ||
| 950 | .suspend_late = acpi_subsys_suspend_late, | 983 | .suspend_late = acpi_subsys_suspend_late, |
| 951 | .resume_early = acpi_subsys_resume_early, | 984 | .resume_early = acpi_subsys_resume_early, |
| 985 | .freeze = acpi_subsys_freeze, | ||
| 986 | .poweroff = acpi_subsys_suspend, | ||
| 952 | .poweroff_late = acpi_subsys_suspend_late, | 987 | .poweroff_late = acpi_subsys_suspend_late, |
| 953 | .restore_early = acpi_subsys_resume_early, | 988 | .restore_early = acpi_subsys_resume_early, |
| 954 | #endif | 989 | #endif |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 5bfd769fc91f..f0fc6260266b 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * dock.c - ACPI dock station driver | 2 | * dock.c - ACPI dock station driver |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2006 Kristen Carlson Accardi <kristen.c.accardi@intel.com> | 4 | * Copyright (C) 2006, 2014, Intel Corp. |
| 5 | * Author: Kristen Carlson Accardi <kristen.c.accardi@intel.com> | ||
| 6 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
| 5 | * | 7 | * |
| 6 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 | * | 9 | * |
| @@ -35,8 +37,6 @@ | |||
| 35 | 37 | ||
| 36 | #include "internal.h" | 38 | #include "internal.h" |
| 37 | 39 | ||
| 38 | #define PREFIX "ACPI: " | ||
| 39 | |||
| 40 | #define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver" | 40 | #define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver" |
| 41 | 41 | ||
| 42 | ACPI_MODULE_NAME("dock"); | 42 | ACPI_MODULE_NAME("dock"); |
| @@ -68,15 +68,10 @@ struct dock_station { | |||
| 68 | }; | 68 | }; |
| 69 | static LIST_HEAD(dock_stations); | 69 | static LIST_HEAD(dock_stations); |
| 70 | static int dock_station_count; | 70 | static int dock_station_count; |
| 71 | static DEFINE_MUTEX(hotplug_lock); | ||
| 72 | 71 | ||
| 73 | struct dock_dependent_device { | 72 | struct dock_dependent_device { |
| 74 | struct list_head list; | 73 | struct list_head list; |
| 75 | acpi_handle handle; | 74 | struct acpi_device *adev; |
| 76 | const struct acpi_dock_ops *hp_ops; | ||
| 77 | void *hp_context; | ||
| 78 | unsigned int hp_refcount; | ||
| 79 | void (*hp_release)(void *); | ||
| 80 | }; | 75 | }; |
| 81 | 76 | ||
| 82 | #define DOCK_DOCKING 0x00000001 | 77 | #define DOCK_DOCKING 0x00000001 |
| @@ -98,13 +93,13 @@ enum dock_callback_type { | |||
| 98 | *****************************************************************************/ | 93 | *****************************************************************************/ |
| 99 | /** | 94 | /** |
| 100 | * add_dock_dependent_device - associate a device with the dock station | 95 | * add_dock_dependent_device - associate a device with the dock station |
| 101 | * @ds: The dock station | 96 | * @ds: Dock station. |
| 102 | * @handle: handle of the dependent device | 97 | * @adev: Dependent ACPI device object. |
| 103 | * | 98 | * |
| 104 | * Add the dependent device to the dock's dependent device list. | 99 | * Add the dependent device to the dock's dependent device list. |
| 105 | */ | 100 | */ |
| 106 | static int __init | 101 | static int add_dock_dependent_device(struct dock_station *ds, |
| 107 | add_dock_dependent_device(struct dock_station *ds, acpi_handle handle) | 102 | struct acpi_device *adev) |
| 108 | { | 103 | { |
| 109 | struct dock_dependent_device *dd; | 104 | struct dock_dependent_device *dd; |
| 110 | 105 | ||
| @@ -112,180 +107,120 @@ add_dock_dependent_device(struct dock_station *ds, acpi_handle handle) | |||
| 112 | if (!dd) | 107 | if (!dd) |
| 113 | return -ENOMEM; | 108 | return -ENOMEM; |
| 114 | 109 | ||
| 115 | dd->handle = handle; | 110 | dd->adev = adev; |
| 116 | INIT_LIST_HEAD(&dd->list); | 111 | INIT_LIST_HEAD(&dd->list); |
| 117 | list_add_tail(&dd->list, &ds->dependent_devices); | 112 | list_add_tail(&dd->list, &ds->dependent_devices); |
| 118 | 113 | ||
| 119 | return 0; | 114 | return 0; |
| 120 | } | 115 | } |
| 121 | 116 | ||
| 122 | static void remove_dock_dependent_devices(struct dock_station *ds) | 117 | static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event, |
| 118 | enum dock_callback_type cb_type) | ||
| 123 | { | 119 | { |
| 124 | struct dock_dependent_device *dd, *aux; | 120 | struct acpi_device *adev = dd->adev; |
| 125 | 121 | ||
| 126 | list_for_each_entry_safe(dd, aux, &ds->dependent_devices, list) { | 122 | acpi_lock_hp_context(); |
| 127 | list_del(&dd->list); | ||
| 128 | kfree(dd); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | 123 | ||
| 132 | /** | 124 | if (!adev->hp) |
| 133 | * dock_init_hotplug - Initialize a hotplug device on a docking station. | 125 | goto out; |
| 134 | * @dd: Dock-dependent device. | ||
| 135 | * @ops: Dock operations to attach to the dependent device. | ||
| 136 | * @context: Data to pass to the @ops callbacks and @release. | ||
| 137 | * @init: Optional initialization routine to run after setting up context. | ||
| 138 | * @release: Optional release routine to run on removal. | ||
| 139 | */ | ||
| 140 | static int dock_init_hotplug(struct dock_dependent_device *dd, | ||
| 141 | const struct acpi_dock_ops *ops, void *context, | ||
| 142 | void (*init)(void *), void (*release)(void *)) | ||
| 143 | { | ||
| 144 | int ret = 0; | ||
| 145 | 126 | ||
| 146 | mutex_lock(&hotplug_lock); | 127 | if (cb_type == DOCK_CALL_FIXUP) { |
| 147 | if (WARN_ON(dd->hp_context)) { | 128 | void (*fixup)(struct acpi_device *); |
| 148 | ret = -EEXIST; | ||
| 149 | } else { | ||
| 150 | dd->hp_refcount = 1; | ||
| 151 | dd->hp_ops = ops; | ||
| 152 | dd->hp_context = context; | ||
| 153 | dd->hp_release = release; | ||
| 154 | if (init) | ||
| 155 | init(context); | ||
| 156 | } | ||
| 157 | mutex_unlock(&hotplug_lock); | ||
| 158 | return ret; | ||
| 159 | } | ||
| 160 | 129 | ||
| 161 | /** | 130 | fixup = adev->hp->fixup; |
| 162 | * dock_release_hotplug - Decrement hotplug reference counter of dock device. | 131 | if (fixup) { |
| 163 | * @dd: Dock-dependent device. | 132 | acpi_unlock_hp_context(); |
| 164 | * | 133 | fixup(adev); |
| 165 | * Decrement the reference counter of @dd and if 0, detach its hotplug | 134 | return; |
| 166 | * operations from it, reset its context pointer and run the optional release | 135 | } |
| 167 | * routine if present. | 136 | } else if (cb_type == DOCK_CALL_UEVENT) { |
| 168 | */ | 137 | void (*uevent)(struct acpi_device *, u32); |
| 169 | static void dock_release_hotplug(struct dock_dependent_device *dd) | 138 | |
| 170 | { | 139 | uevent = adev->hp->uevent; |
| 171 | mutex_lock(&hotplug_lock); | 140 | if (uevent) { |
| 172 | if (dd->hp_context && !--dd->hp_refcount) { | 141 | acpi_unlock_hp_context(); |
| 173 | void (*release)(void *) = dd->hp_release; | 142 | uevent(adev, event); |
| 174 | void *context = dd->hp_context; | 143 | return; |
| 175 | 144 | } | |
| 176 | dd->hp_ops = NULL; | 145 | } else { |
| 177 | dd->hp_context = NULL; | 146 | int (*notify)(struct acpi_device *, u32); |
| 178 | dd->hp_release = NULL; | ||
| 179 | if (release) | ||
| 180 | release(context); | ||
| 181 | } | ||
| 182 | mutex_unlock(&hotplug_lock); | ||
| 183 | } | ||
| 184 | 147 | ||
| 185 | static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event, | 148 | notify = adev->hp->notify; |
| 186 | enum dock_callback_type cb_type) | 149 | if (notify) { |
| 187 | { | 150 | acpi_unlock_hp_context(); |
| 188 | acpi_notify_handler cb = NULL; | 151 | notify(adev, event); |
| 189 | bool run = false; | 152 | return; |
| 190 | |||
| 191 | mutex_lock(&hotplug_lock); | ||
| 192 | |||
| 193 | if (dd->hp_context) { | ||
| 194 | run = true; | ||
| 195 | dd->hp_refcount++; | ||
| 196 | if (dd->hp_ops) { | ||
| 197 | switch (cb_type) { | ||
| 198 | case DOCK_CALL_FIXUP: | ||
| 199 | cb = dd->hp_ops->fixup; | ||
| 200 | break; | ||
| 201 | case DOCK_CALL_UEVENT: | ||
| 202 | cb = dd->hp_ops->uevent; | ||
| 203 | break; | ||
| 204 | default: | ||
| 205 | cb = dd->hp_ops->handler; | ||
| 206 | } | ||
| 207 | } | 153 | } |
| 208 | } | 154 | } |
| 209 | 155 | ||
| 210 | mutex_unlock(&hotplug_lock); | 156 | out: |
| 157 | acpi_unlock_hp_context(); | ||
| 158 | } | ||
| 211 | 159 | ||
| 212 | if (!run) | 160 | static struct dock_station *find_dock_station(acpi_handle handle) |
| 213 | return; | 161 | { |
| 162 | struct dock_station *ds; | ||
| 214 | 163 | ||
| 215 | if (cb) | 164 | list_for_each_entry(ds, &dock_stations, sibling) |
| 216 | cb(dd->handle, event, dd->hp_context); | 165 | if (ds->handle == handle) |
| 166 | return ds; | ||
| 217 | 167 | ||
| 218 | dock_release_hotplug(dd); | 168 | return NULL; |
| 219 | } | 169 | } |
| 220 | 170 | ||
| 221 | /** | 171 | /** |
| 222 | * find_dock_dependent_device - get a device dependent on this dock | 172 | * find_dock_dependent_device - get a device dependent on this dock |
| 223 | * @ds: the dock station | 173 | * @ds: the dock station |
| 224 | * @handle: the acpi_handle of the device we want | 174 | * @adev: ACPI device object to find. |
| 225 | * | 175 | * |
| 226 | * iterate over the dependent device list for this dock. If the | 176 | * iterate over the dependent device list for this dock. If the |
| 227 | * dependent device matches the handle, return. | 177 | * dependent device matches the handle, return. |
| 228 | */ | 178 | */ |
| 229 | static struct dock_dependent_device * | 179 | static struct dock_dependent_device * |
| 230 | find_dock_dependent_device(struct dock_station *ds, acpi_handle handle) | 180 | find_dock_dependent_device(struct dock_station *ds, struct acpi_device *adev) |
| 231 | { | 181 | { |
| 232 | struct dock_dependent_device *dd; | 182 | struct dock_dependent_device *dd; |
| 233 | 183 | ||
| 234 | list_for_each_entry(dd, &ds->dependent_devices, list) | 184 | list_for_each_entry(dd, &ds->dependent_devices, list) |
| 235 | if (handle == dd->handle) | 185 | if (adev == dd->adev) |
| 236 | return dd; | 186 | return dd; |
| 237 | 187 | ||
| 238 | return NULL; | 188 | return NULL; |
| 239 | } | 189 | } |
| 240 | 190 | ||
| 241 | /***************************************************************************** | 191 | void register_dock_dependent_device(struct acpi_device *adev, |
| 242 | * Dock functions * | 192 | acpi_handle dshandle) |
| 243 | *****************************************************************************/ | ||
| 244 | static int __init is_battery(acpi_handle handle) | ||
| 245 | { | 193 | { |
| 246 | struct acpi_device_info *info; | 194 | struct dock_station *ds = find_dock_station(dshandle); |
| 247 | int ret = 1; | ||
| 248 | 195 | ||
| 249 | if (!ACPI_SUCCESS(acpi_get_object_info(handle, &info))) | 196 | if (ds && !find_dock_dependent_device(ds, adev)) |
| 250 | return 0; | 197 | add_dock_dependent_device(ds, adev); |
| 251 | if (!(info->valid & ACPI_VALID_HID)) | ||
| 252 | ret = 0; | ||
| 253 | else | ||
| 254 | ret = !strcmp("PNP0C0A", info->hardware_id.string); | ||
| 255 | |||
| 256 | kfree(info); | ||
| 257 | return ret; | ||
| 258 | } | 198 | } |
| 259 | 199 | ||
| 260 | /* Check whether ACPI object is an ejectable battery or disk bay */ | 200 | /***************************************************************************** |
| 261 | static bool __init is_ejectable_bay(acpi_handle handle) | 201 | * Dock functions * |
| 262 | { | 202 | *****************************************************************************/ |
| 263 | if (acpi_has_method(handle, "_EJ0") && is_battery(handle)) | ||
| 264 | return true; | ||
| 265 | |||
| 266 | return acpi_bay_match(handle); | ||
| 267 | } | ||
| 268 | 203 | ||
| 269 | /** | 204 | /** |
| 270 | * is_dock_device - see if a device is on a dock station | 205 | * is_dock_device - see if a device is on a dock station |
| 271 | * @handle: acpi handle of the device | 206 | * @adev: ACPI device object to check. |
| 272 | * | 207 | * |
| 273 | * If this device is either the dock station itself, | 208 | * If this device is either the dock station itself, |
| 274 | * or is a device dependent on the dock station, then it | 209 | * or is a device dependent on the dock station, then it |
| 275 | * is a dock device | 210 | * is a dock device |
| 276 | */ | 211 | */ |
| 277 | int is_dock_device(acpi_handle handle) | 212 | int is_dock_device(struct acpi_device *adev) |
| 278 | { | 213 | { |
| 279 | struct dock_station *dock_station; | 214 | struct dock_station *dock_station; |
| 280 | 215 | ||
| 281 | if (!dock_station_count) | 216 | if (!dock_station_count) |
| 282 | return 0; | 217 | return 0; |
| 283 | 218 | ||
| 284 | if (acpi_dock_match(handle)) | 219 | if (acpi_dock_match(adev->handle)) |
| 285 | return 1; | 220 | return 1; |
| 286 | 221 | ||
| 287 | list_for_each_entry(dock_station, &dock_stations, sibling) | 222 | list_for_each_entry(dock_station, &dock_stations, sibling) |
| 288 | if (find_dock_dependent_device(dock_station, handle)) | 223 | if (find_dock_dependent_device(dock_station, adev)) |
| 289 | return 1; | 224 | return 1; |
| 290 | 225 | ||
| 291 | return 0; | 226 | return 0; |
| @@ -313,43 +248,6 @@ static int dock_present(struct dock_station *ds) | |||
| 313 | } | 248 | } |
| 314 | 249 | ||
| 315 | /** | 250 | /** |
| 316 | * dock_create_acpi_device - add new devices to acpi | ||
| 317 | * @handle - handle of the device to add | ||
| 318 | * | ||
| 319 | * This function will create a new acpi_device for the given | ||
| 320 | * handle if one does not exist already. This should cause | ||
| 321 | * acpi to scan for drivers for the given devices, and call | ||
| 322 | * matching driver's add routine. | ||
| 323 | */ | ||
| 324 | static void dock_create_acpi_device(acpi_handle handle) | ||
| 325 | { | ||
| 326 | struct acpi_device *device = NULL; | ||
| 327 | int ret; | ||
| 328 | |||
| 329 | acpi_bus_get_device(handle, &device); | ||
| 330 | if (!acpi_device_enumerated(device)) { | ||
| 331 | ret = acpi_bus_scan(handle); | ||
| 332 | if (ret) | ||
| 333 | pr_debug("error adding bus, %x\n", -ret); | ||
| 334 | } | ||
| 335 | } | ||
| 336 | |||
| 337 | /** | ||
| 338 | * dock_remove_acpi_device - remove the acpi_device struct from acpi | ||
| 339 | * @handle - the handle of the device to remove | ||
| 340 | * | ||
| 341 | * Tell acpi to remove the acpi_device. This should cause any loaded | ||
| 342 | * driver to have it's remove routine called. | ||
| 343 | */ | ||
| 344 | static void dock_remove_acpi_device(acpi_handle handle) | ||
| 345 | { | ||
| 346 | struct acpi_device *device; | ||
| 347 | |||
| 348 | if (!acpi_bus_get_device(handle, &device)) | ||
| 349 | acpi_bus_trim(device); | ||
| 350 | } | ||
| 351 | |||
| 352 | /** | ||
| 353 | * hot_remove_dock_devices - Remove dock station devices. | 251 | * hot_remove_dock_devices - Remove dock station devices. |
| 354 | * @ds: Dock station. | 252 | * @ds: Dock station. |
| 355 | */ | 253 | */ |
| @@ -366,7 +264,7 @@ static void hot_remove_dock_devices(struct dock_station *ds) | |||
| 366 | dock_hotplug_event(dd, ACPI_NOTIFY_EJECT_REQUEST, false); | 264 | dock_hotplug_event(dd, ACPI_NOTIFY_EJECT_REQUEST, false); |
| 367 | 265 | ||
| 368 | list_for_each_entry_reverse(dd, &ds->dependent_devices, list) | 266 | list_for_each_entry_reverse(dd, &ds->dependent_devices, list) |
| 369 | dock_remove_acpi_device(dd->handle); | 267 | acpi_bus_trim(dd->adev); |
| 370 | } | 268 | } |
| 371 | 269 | ||
| 372 | /** | 270 | /** |
| @@ -392,12 +290,20 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event) | |||
| 392 | dock_hotplug_event(dd, event, DOCK_CALL_HANDLER); | 290 | dock_hotplug_event(dd, event, DOCK_CALL_HANDLER); |
| 393 | 291 | ||
| 394 | /* | 292 | /* |
| 395 | * Now make sure that an acpi_device is created for each dependent | 293 | * Check if all devices have been enumerated already. If not, run |
| 396 | * device. That will cause scan handlers to be attached to device | 294 | * acpi_bus_scan() for them and that will cause scan handlers to be |
| 397 | * objects or acpi_drivers to be stopped/started if they are present. | 295 | * attached to device objects or acpi_drivers to be stopped/started if |
| 296 | * they are present. | ||
| 398 | */ | 297 | */ |
| 399 | list_for_each_entry(dd, &ds->dependent_devices, list) | 298 | list_for_each_entry(dd, &ds->dependent_devices, list) { |
| 400 | dock_create_acpi_device(dd->handle); | 299 | struct acpi_device *adev = dd->adev; |
| 300 | |||
| 301 | if (!acpi_device_enumerated(adev)) { | ||
| 302 | int ret = acpi_bus_scan(adev->handle); | ||
| 303 | if (ret) | ||
| 304 | dev_dbg(&adev->dev, "scan error %d\n", -ret); | ||
| 305 | } | ||
| 306 | } | ||
| 401 | } | 307 | } |
| 402 | 308 | ||
| 403 | static void dock_event(struct dock_station *ds, u32 event, int num) | 309 | static void dock_event(struct dock_station *ds, u32 event, int num) |
| @@ -501,71 +407,6 @@ static int dock_in_progress(struct dock_station *ds) | |||
| 501 | } | 407 | } |
| 502 | 408 | ||
| 503 | /** | 409 | /** |
| 504 | * register_hotplug_dock_device - register a hotplug function | ||
| 505 | * @handle: the handle of the device | ||
| 506 | * @ops: handlers to call after docking | ||
| 507 | * @context: device specific data | ||
| 508 | * @init: Optional initialization routine to run after registration | ||
| 509 | * @release: Optional release routine to run on unregistration | ||
| 510 | * | ||
| 511 | * If a driver would like to perform a hotplug operation after a dock | ||
| 512 | * event, they can register an acpi_notifiy_handler to be called by | ||
| 513 | * the dock driver after _DCK is executed. | ||
| 514 | */ | ||
| 515 | int register_hotplug_dock_device(acpi_handle handle, | ||
| 516 | const struct acpi_dock_ops *ops, void *context, | ||
| 517 | void (*init)(void *), void (*release)(void *)) | ||
| 518 | { | ||
| 519 | struct dock_dependent_device *dd; | ||
| 520 | struct dock_station *dock_station; | ||
| 521 | int ret = -EINVAL; | ||
| 522 | |||
| 523 | if (WARN_ON(!context)) | ||
| 524 | return -EINVAL; | ||
| 525 | |||
| 526 | if (!dock_station_count) | ||
| 527 | return -ENODEV; | ||
| 528 | |||
| 529 | /* | ||
| 530 | * make sure this handle is for a device dependent on the dock, | ||
| 531 | * this would include the dock station itself | ||
| 532 | */ | ||
| 533 | list_for_each_entry(dock_station, &dock_stations, sibling) { | ||
| 534 | /* | ||
| 535 | * An ATA bay can be in a dock and itself can be ejected | ||
| 536 | * separately, so there are two 'dock stations' which need the | ||
| 537 | * ops | ||
| 538 | */ | ||
| 539 | dd = find_dock_dependent_device(dock_station, handle); | ||
| 540 | if (dd && !dock_init_hotplug(dd, ops, context, init, release)) | ||
| 541 | ret = 0; | ||
| 542 | } | ||
| 543 | |||
| 544 | return ret; | ||
| 545 | } | ||
| 546 | EXPORT_SYMBOL_GPL(register_hotplug_dock_device); | ||
| 547 | |||
| 548 | /** | ||
| 549 | * unregister_hotplug_dock_device - remove yourself from the hotplug list | ||
| 550 | * @handle: the acpi handle of the device | ||
| 551 | */ | ||
| 552 | void unregister_hotplug_dock_device(acpi_handle handle) | ||
| 553 | { | ||
| 554 | struct dock_dependent_device *dd; | ||
| 555 | struct dock_station *dock_station; | ||
| 556 | |||
| 557 | if (!dock_station_count) | ||
| 558 | return; | ||
| 559 | |||
| 560 | list_for_each_entry(dock_station, &dock_stations, sibling) { | ||
| 561 | dd = find_dock_dependent_device(dock_station, handle); | ||
| 562 | if (dd) | ||
| 563 | dock_release_hotplug(dd); | ||
| 564 | } | ||
| 565 | } | ||
| 566 | EXPORT_SYMBOL_GPL(unregister_hotplug_dock_device); | ||
| 567 | |||
| 568 | /** | ||
| 569 | * handle_eject_request - handle an undock request checking for error conditions | 410 | * handle_eject_request - handle an undock request checking for error conditions |
| 570 | * | 411 | * |
| 571 | * Check to make sure the dock device is still present, then undock and | 412 | * Check to make sure the dock device is still present, then undock and |
| @@ -598,20 +439,23 @@ static int handle_eject_request(struct dock_station *ds, u32 event) | |||
| 598 | } | 439 | } |
| 599 | 440 | ||
| 600 | /** | 441 | /** |
| 601 | * dock_notify - act upon an acpi dock notification | 442 | * dock_notify - Handle ACPI dock notification. |
| 602 | * @ds: dock station | 443 | * @adev: Dock station's ACPI device object. |
| 603 | * @event: the acpi event | 444 | * @event: Event code. |
| 604 | * | 445 | * |
| 605 | * If we are notified to dock, then check to see if the dock is | 446 | * If we are notified to dock, then check to see if the dock is |
| 606 | * present and then dock. Notify all drivers of the dock event, | 447 | * present and then dock. Notify all drivers of the dock event, |
| 607 | * and then hotplug and devices that may need hotplugging. | 448 | * and then hotplug and devices that may need hotplugging. |
| 608 | */ | 449 | */ |
| 609 | static void dock_notify(struct dock_station *ds, u32 event) | 450 | int dock_notify(struct acpi_device *adev, u32 event) |
| 610 | { | 451 | { |
| 611 | acpi_handle handle = ds->handle; | 452 | acpi_handle handle = adev->handle; |
| 612 | struct acpi_device *adev = NULL; | 453 | struct dock_station *ds = find_dock_station(handle); |
| 613 | int surprise_removal = 0; | 454 | int surprise_removal = 0; |
| 614 | 455 | ||
| 456 | if (!ds) | ||
| 457 | return -ENODEV; | ||
| 458 | |||
| 615 | /* | 459 | /* |
| 616 | * According to acpi spec 3.0a, if a DEVICE_CHECK notification | 460 | * According to acpi spec 3.0a, if a DEVICE_CHECK notification |
| 617 | * is sent and _DCK is present, it is assumed to mean an undock | 461 | * is sent and _DCK is present, it is assumed to mean an undock |
| @@ -632,7 +476,6 @@ static void dock_notify(struct dock_station *ds, u32 event) | |||
| 632 | switch (event) { | 476 | switch (event) { |
| 633 | case ACPI_NOTIFY_BUS_CHECK: | 477 | case ACPI_NOTIFY_BUS_CHECK: |
| 634 | case ACPI_NOTIFY_DEVICE_CHECK: | 478 | case ACPI_NOTIFY_DEVICE_CHECK: |
| 635 | acpi_bus_get_device(handle, &adev); | ||
| 636 | if (!dock_in_progress(ds) && !acpi_device_enumerated(adev)) { | 479 | if (!dock_in_progress(ds) && !acpi_device_enumerated(adev)) { |
| 637 | begin_dock(ds); | 480 | begin_dock(ds); |
| 638 | dock(ds); | 481 | dock(ds); |
| @@ -662,49 +505,8 @@ static void dock_notify(struct dock_station *ds, u32 event) | |||
| 662 | else | 505 | else |
| 663 | dock_event(ds, event, UNDOCK_EVENT); | 506 | dock_event(ds, event, UNDOCK_EVENT); |
| 664 | break; | 507 | break; |
| 665 | default: | ||
| 666 | acpi_handle_err(handle, "Unknown dock event %d\n", event); | ||
| 667 | } | 508 | } |
| 668 | } | 509 | return 0; |
| 669 | |||
| 670 | static void acpi_dock_deferred_cb(void *data, u32 event) | ||
| 671 | { | ||
| 672 | acpi_scan_lock_acquire(); | ||
| 673 | dock_notify(data, event); | ||
| 674 | acpi_scan_lock_release(); | ||
| 675 | } | ||
| 676 | |||
| 677 | static void dock_notify_handler(acpi_handle handle, u32 event, void *data) | ||
| 678 | { | ||
| 679 | if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK | ||
| 680 | && event != ACPI_NOTIFY_EJECT_REQUEST) | ||
| 681 | return; | ||
| 682 | |||
| 683 | acpi_hotplug_execute(acpi_dock_deferred_cb, data, event); | ||
| 684 | } | ||
| 685 | |||
| 686 | /** | ||
| 687 | * find_dock_devices - find devices on the dock station | ||
| 688 | * @handle: the handle of the device we are examining | ||
| 689 | * @lvl: unused | ||
| 690 | * @context: the dock station private data | ||
| 691 | * @rv: unused | ||
| 692 | * | ||
| 693 | * This function is called by acpi_walk_namespace. It will | ||
| 694 | * check to see if an object has an _EJD method. If it does, then it | ||
| 695 | * will see if it is dependent on the dock station. | ||
| 696 | */ | ||
| 697 | static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl, | ||
| 698 | void *context, void **rv) | ||
| 699 | { | ||
| 700 | struct dock_station *ds = context; | ||
| 701 | acpi_handle ejd = NULL; | ||
| 702 | |||
| 703 | acpi_bus_get_ejd(handle, &ejd); | ||
| 704 | if (ejd == ds->handle) | ||
| 705 | add_dock_dependent_device(ds, handle); | ||
| 706 | |||
| 707 | return AE_OK; | ||
| 708 | } | 510 | } |
| 709 | 511 | ||
| 710 | /* | 512 | /* |
| @@ -803,23 +605,28 @@ static struct attribute_group dock_attribute_group = { | |||
| 803 | }; | 605 | }; |
| 804 | 606 | ||
| 805 | /** | 607 | /** |
| 806 | * dock_add - add a new dock station | 608 | * acpi_dock_add - Add a new dock station |
| 807 | * @handle: the dock station handle | 609 | * @adev: Dock station ACPI device object. |
| 808 | * | 610 | * |
| 809 | * allocated and initialize a new dock station device. Find all devices | 611 | * allocated and initialize a new dock station device. |
| 810 | * that are on the dock station, and register for dock event notifications. | ||
| 811 | */ | 612 | */ |
| 812 | static int __init dock_add(acpi_handle handle) | 613 | void acpi_dock_add(struct acpi_device *adev) |
| 813 | { | 614 | { |
| 814 | struct dock_station *dock_station, ds = { NULL, }; | 615 | struct dock_station *dock_station, ds = { NULL, }; |
| 616 | struct platform_device_info pdevinfo; | ||
| 617 | acpi_handle handle = adev->handle; | ||
| 815 | struct platform_device *dd; | 618 | struct platform_device *dd; |
| 816 | acpi_status status; | ||
| 817 | int ret; | 619 | int ret; |
| 818 | 620 | ||
| 819 | dd = platform_device_register_data(NULL, "dock", dock_station_count, | 621 | memset(&pdevinfo, 0, sizeof(pdevinfo)); |
| 820 | &ds, sizeof(ds)); | 622 | pdevinfo.name = "dock"; |
| 623 | pdevinfo.id = dock_station_count; | ||
| 624 | pdevinfo.acpi_node.companion = adev; | ||
| 625 | pdevinfo.data = &ds; | ||
| 626 | pdevinfo.size_data = sizeof(ds); | ||
| 627 | dd = platform_device_register_full(&pdevinfo); | ||
| 821 | if (IS_ERR(dd)) | 628 | if (IS_ERR(dd)) |
| 822 | return PTR_ERR(dd); | 629 | return; |
| 823 | 630 | ||
| 824 | dock_station = dd->dev.platform_data; | 631 | dock_station = dd->dev.platform_data; |
| 825 | 632 | ||
| @@ -837,72 +644,29 @@ static int __init dock_add(acpi_handle handle) | |||
| 837 | dock_station->flags |= DOCK_IS_DOCK; | 644 | dock_station->flags |= DOCK_IS_DOCK; |
| 838 | if (acpi_ata_match(handle)) | 645 | if (acpi_ata_match(handle)) |
| 839 | dock_station->flags |= DOCK_IS_ATA; | 646 | dock_station->flags |= DOCK_IS_ATA; |
| 840 | if (is_battery(handle)) | 647 | if (acpi_device_is_battery(adev)) |
| 841 | dock_station->flags |= DOCK_IS_BAT; | 648 | dock_station->flags |= DOCK_IS_BAT; |
| 842 | 649 | ||
| 843 | ret = sysfs_create_group(&dd->dev.kobj, &dock_attribute_group); | 650 | ret = sysfs_create_group(&dd->dev.kobj, &dock_attribute_group); |
| 844 | if (ret) | 651 | if (ret) |
| 845 | goto err_unregister; | 652 | goto err_unregister; |
| 846 | 653 | ||
| 847 | /* Find dependent devices */ | ||
| 848 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
| 849 | ACPI_UINT32_MAX, find_dock_devices, NULL, | ||
| 850 | dock_station, NULL); | ||
| 851 | |||
| 852 | /* add the dock station as a device dependent on itself */ | 654 | /* add the dock station as a device dependent on itself */ |
| 853 | ret = add_dock_dependent_device(dock_station, handle); | 655 | ret = add_dock_dependent_device(dock_station, adev); |
| 854 | if (ret) | 656 | if (ret) |
| 855 | goto err_rmgroup; | 657 | goto err_rmgroup; |
| 856 | 658 | ||
| 857 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
| 858 | dock_notify_handler, dock_station); | ||
| 859 | if (ACPI_FAILURE(status)) { | ||
| 860 | ret = -ENODEV; | ||
| 861 | goto err_rmgroup; | ||
| 862 | } | ||
| 863 | |||
| 864 | dock_station_count++; | 659 | dock_station_count++; |
| 865 | list_add(&dock_station->sibling, &dock_stations); | 660 | list_add(&dock_station->sibling, &dock_stations); |
| 866 | return 0; | 661 | adev->flags.is_dock_station = true; |
| 662 | dev_info(&adev->dev, "ACPI dock station (docks/bays count: %d)\n", | ||
| 663 | dock_station_count); | ||
| 664 | return; | ||
| 867 | 665 | ||
| 868 | err_rmgroup: | 666 | err_rmgroup: |
| 869 | remove_dock_dependent_devices(dock_station); | ||
| 870 | sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group); | 667 | sysfs_remove_group(&dd->dev.kobj, &dock_attribute_group); |
| 668 | |||
| 871 | err_unregister: | 669 | err_unregister: |
| 872 | platform_device_unregister(dd); | 670 | platform_device_unregister(dd); |
| 873 | acpi_handle_err(handle, "%s encountered error %d\n", __func__, ret); | 671 | acpi_handle_err(handle, "%s encountered error %d\n", __func__, ret); |
| 874 | return ret; | ||
| 875 | } | ||
| 876 | |||
| 877 | /** | ||
| 878 | * find_dock_and_bay - look for dock stations and bays | ||
| 879 | * @handle: acpi handle of a device | ||
| 880 | * @lvl: unused | ||
| 881 | * @context: unused | ||
| 882 | * @rv: unused | ||
| 883 | * | ||
| 884 | * This is called by acpi_walk_namespace to look for dock stations and bays. | ||
| 885 | */ | ||
| 886 | static acpi_status __init | ||
| 887 | find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
| 888 | { | ||
| 889 | if (acpi_dock_match(handle) || is_ejectable_bay(handle)) | ||
| 890 | dock_add(handle); | ||
| 891 | |||
| 892 | return AE_OK; | ||
| 893 | } | ||
| 894 | |||
| 895 | void __init acpi_dock_init(void) | ||
| 896 | { | ||
| 897 | /* look for dock stations and bays */ | ||
| 898 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
| 899 | ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL); | ||
| 900 | |||
| 901 | if (!dock_station_count) { | ||
| 902 | pr_info(PREFIX "No dock devices found.\n"); | ||
| 903 | return; | ||
| 904 | } | ||
| 905 | |||
| 906 | pr_info(PREFIX "%s: %d docks/bays found\n", | ||
| 907 | ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count); | ||
| 908 | } | 672 | } |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 09e423f3d8ad..8acf53e62966 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
| @@ -55,11 +55,16 @@ MODULE_DEVICE_TABLE(acpi, fan_device_ids); | |||
| 55 | #ifdef CONFIG_PM_SLEEP | 55 | #ifdef CONFIG_PM_SLEEP |
| 56 | static int acpi_fan_suspend(struct device *dev); | 56 | static int acpi_fan_suspend(struct device *dev); |
| 57 | static int acpi_fan_resume(struct device *dev); | 57 | static int acpi_fan_resume(struct device *dev); |
| 58 | static struct dev_pm_ops acpi_fan_pm = { | ||
| 59 | .resume = acpi_fan_resume, | ||
| 60 | .freeze = acpi_fan_suspend, | ||
| 61 | .thaw = acpi_fan_resume, | ||
| 62 | .restore = acpi_fan_resume, | ||
| 63 | }; | ||
| 64 | #define FAN_PM_OPS_PTR (&acpi_fan_pm) | ||
| 58 | #else | 65 | #else |
| 59 | #define acpi_fan_suspend NULL | 66 | #define FAN_PM_OPS_PTR NULL |
| 60 | #define acpi_fan_resume NULL | ||
| 61 | #endif | 67 | #endif |
| 62 | static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume); | ||
| 63 | 68 | ||
| 64 | static struct acpi_driver acpi_fan_driver = { | 69 | static struct acpi_driver acpi_fan_driver = { |
| 65 | .name = "fan", | 70 | .name = "fan", |
| @@ -69,7 +74,7 @@ static struct acpi_driver acpi_fan_driver = { | |||
| 69 | .add = acpi_fan_add, | 74 | .add = acpi_fan_add, |
| 70 | .remove = acpi_fan_remove, | 75 | .remove = acpi_fan_remove, |
| 71 | }, | 76 | }, |
| 72 | .drv.pm = &acpi_fan_pm, | 77 | .drv.pm = FAN_PM_OPS_PTR, |
| 73 | }; | 78 | }; |
| 74 | 79 | ||
| 75 | /* thermal cooling device callbacks */ | 80 | /* thermal cooling device callbacks */ |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 0c789224d40d..f774c65ecb8b 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -287,6 +287,7 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one); | |||
| 287 | static int acpi_platform_notify(struct device *dev) | 287 | static int acpi_platform_notify(struct device *dev) |
| 288 | { | 288 | { |
| 289 | struct acpi_bus_type *type = acpi_get_bus_type(dev); | 289 | struct acpi_bus_type *type = acpi_get_bus_type(dev); |
| 290 | struct acpi_device *adev; | ||
| 290 | int ret; | 291 | int ret; |
| 291 | 292 | ||
| 292 | ret = acpi_bind_one(dev, NULL); | 293 | ret = acpi_bind_one(dev, NULL); |
| @@ -303,9 +304,14 @@ static int acpi_platform_notify(struct device *dev) | |||
| 303 | if (ret) | 304 | if (ret) |
| 304 | goto out; | 305 | goto out; |
| 305 | } | 306 | } |
| 307 | adev = ACPI_COMPANION(dev); | ||
| 308 | if (!adev) | ||
| 309 | goto out; | ||
| 306 | 310 | ||
| 307 | if (type && type->setup) | 311 | if (type && type->setup) |
| 308 | type->setup(dev); | 312 | type->setup(dev); |
| 313 | else if (adev->handler && adev->handler->bind) | ||
| 314 | adev->handler->bind(dev); | ||
| 309 | 315 | ||
| 310 | out: | 316 | out: |
| 311 | #if ACPI_GLUE_DEBUG | 317 | #if ACPI_GLUE_DEBUG |
| @@ -324,11 +330,17 @@ static int acpi_platform_notify(struct device *dev) | |||
| 324 | 330 | ||
| 325 | static int acpi_platform_notify_remove(struct device *dev) | 331 | static int acpi_platform_notify_remove(struct device *dev) |
| 326 | { | 332 | { |
| 333 | struct acpi_device *adev = ACPI_COMPANION(dev); | ||
| 327 | struct acpi_bus_type *type; | 334 | struct acpi_bus_type *type; |
| 328 | 335 | ||
| 336 | if (!adev) | ||
| 337 | return 0; | ||
| 338 | |||
| 329 | type = acpi_get_bus_type(dev); | 339 | type = acpi_get_bus_type(dev); |
| 330 | if (type && type->cleanup) | 340 | if (type && type->cleanup) |
| 331 | type->cleanup(dev); | 341 | type->cleanup(dev); |
| 342 | else if (adev->handler && adev->handler->unbind) | ||
| 343 | adev->handler->unbind(dev); | ||
| 332 | 344 | ||
| 333 | acpi_unbind_one(dev); | 345 | acpi_unbind_one(dev); |
| 334 | return 0; | 346 | return 0; |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index dedbb2d802f1..957391306cbf 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
| @@ -37,9 +37,15 @@ void acpi_container_init(void); | |||
| 37 | static inline void acpi_container_init(void) {} | 37 | static inline void acpi_container_init(void) {} |
| 38 | #endif | 38 | #endif |
| 39 | #ifdef CONFIG_ACPI_DOCK | 39 | #ifdef CONFIG_ACPI_DOCK |
| 40 | void acpi_dock_init(void); | 40 | void register_dock_dependent_device(struct acpi_device *adev, |
| 41 | acpi_handle dshandle); | ||
| 42 | int dock_notify(struct acpi_device *adev, u32 event); | ||
| 43 | void acpi_dock_add(struct acpi_device *adev); | ||
| 41 | #else | 44 | #else |
| 42 | static inline void acpi_dock_init(void) {} | 45 | static inline void register_dock_dependent_device(struct acpi_device *adev, |
| 46 | acpi_handle dshandle) {} | ||
| 47 | static inline int dock_notify(struct acpi_device *adev, u32 event) { return -ENODEV; } | ||
| 48 | static inline void acpi_dock_add(struct acpi_device *adev) {} | ||
| 43 | #endif | 49 | #endif |
| 44 | #ifdef CONFIG_ACPI_HOTPLUG_MEMORY | 50 | #ifdef CONFIG_ACPI_HOTPLUG_MEMORY |
| 45 | void acpi_memory_hotplug_init(void); | 51 | void acpi_memory_hotplug_init(void); |
| @@ -72,7 +78,9 @@ void acpi_lpss_init(void); | |||
| 72 | static inline void acpi_lpss_init(void) {} | 78 | static inline void acpi_lpss_init(void) {} |
| 73 | #endif | 79 | #endif |
| 74 | 80 | ||
| 81 | acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src); | ||
| 75 | bool acpi_queue_hotplug_work(struct work_struct *work); | 82 | bool acpi_queue_hotplug_work(struct work_struct *work); |
| 83 | void acpi_device_hotplug(struct acpi_device *adev, u32 src); | ||
| 76 | bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent); | 84 | bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent); |
| 77 | 85 | ||
| 78 | /* -------------------------------------------------------------------------- | 86 | /* -------------------------------------------------------------------------- |
| @@ -90,6 +98,7 @@ void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); | |||
| 90 | int acpi_bind_one(struct device *dev, struct acpi_device *adev); | 98 | int acpi_bind_one(struct device *dev, struct acpi_device *adev); |
| 91 | int acpi_unbind_one(struct device *dev); | 99 | int acpi_unbind_one(struct device *dev); |
| 92 | bool acpi_device_is_present(struct acpi_device *adev); | 100 | bool acpi_device_is_present(struct acpi_device *adev); |
| 101 | bool acpi_device_is_battery(struct acpi_device *adev); | ||
| 93 | 102 | ||
| 94 | /* -------------------------------------------------------------------------- | 103 | /* -------------------------------------------------------------------------- |
| 95 | Power Resource | 104 | Power Resource |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index fc1aa7909690..f7fd72ac69cf 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | 52 | ||
| 53 | #define _COMPONENT ACPI_OS_SERVICES | 53 | #define _COMPONENT ACPI_OS_SERVICES |
| 54 | ACPI_MODULE_NAME("osl"); | 54 | ACPI_MODULE_NAME("osl"); |
| 55 | #define PREFIX "ACPI: " | 55 | |
| 56 | struct acpi_os_dpc { | 56 | struct acpi_os_dpc { |
| 57 | acpi_osd_exec_callback function; | 57 | acpi_osd_exec_callback function; |
| 58 | void *context; | 58 | void *context; |
| @@ -1168,8 +1168,7 @@ void acpi_os_wait_events_complete(void) | |||
| 1168 | 1168 | ||
| 1169 | struct acpi_hp_work { | 1169 | struct acpi_hp_work { |
| 1170 | struct work_struct work; | 1170 | struct work_struct work; |
| 1171 | acpi_hp_callback func; | 1171 | struct acpi_device *adev; |
| 1172 | void *data; | ||
| 1173 | u32 src; | 1172 | u32 src; |
| 1174 | }; | 1173 | }; |
| 1175 | 1174 | ||
| @@ -1178,25 +1177,24 @@ static void acpi_hotplug_work_fn(struct work_struct *work) | |||
| 1178 | struct acpi_hp_work *hpw = container_of(work, struct acpi_hp_work, work); | 1177 | struct acpi_hp_work *hpw = container_of(work, struct acpi_hp_work, work); |
| 1179 | 1178 | ||
| 1180 | acpi_os_wait_events_complete(); | 1179 | acpi_os_wait_events_complete(); |
| 1181 | hpw->func(hpw->data, hpw->src); | 1180 | acpi_device_hotplug(hpw->adev, hpw->src); |
| 1182 | kfree(hpw); | 1181 | kfree(hpw); |
| 1183 | } | 1182 | } |
| 1184 | 1183 | ||
| 1185 | acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src) | 1184 | acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src) |
| 1186 | { | 1185 | { |
| 1187 | struct acpi_hp_work *hpw; | 1186 | struct acpi_hp_work *hpw; |
| 1188 | 1187 | ||
| 1189 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 1188 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
| 1190 | "Scheduling function [%p(%p, %u)] for deferred execution.\n", | 1189 | "Scheduling hotplug event (%p, %u) for deferred execution.\n", |
| 1191 | func, data, src)); | 1190 | adev, src)); |
| 1192 | 1191 | ||
| 1193 | hpw = kmalloc(sizeof(*hpw), GFP_KERNEL); | 1192 | hpw = kmalloc(sizeof(*hpw), GFP_KERNEL); |
| 1194 | if (!hpw) | 1193 | if (!hpw) |
| 1195 | return AE_NO_MEMORY; | 1194 | return AE_NO_MEMORY; |
| 1196 | 1195 | ||
| 1197 | INIT_WORK(&hpw->work, acpi_hotplug_work_fn); | 1196 | INIT_WORK(&hpw->work, acpi_hotplug_work_fn); |
| 1198 | hpw->func = func; | 1197 | hpw->adev = adev; |
| 1199 | hpw->data = data; | ||
| 1200 | hpw->src = src; | 1198 | hpw->src = src; |
| 1201 | /* | 1199 | /* |
| 1202 | * We can't run hotplug code in kacpid_wq/kacpid_notify_wq etc., because | 1200 | * We can't run hotplug code in kacpid_wq/kacpid_notify_wq etc., because |
| @@ -1539,17 +1537,21 @@ static int __init osi_setup(char *str) | |||
| 1539 | 1537 | ||
| 1540 | __setup("acpi_osi=", osi_setup); | 1538 | __setup("acpi_osi=", osi_setup); |
| 1541 | 1539 | ||
| 1542 | /* enable serialization to combat AE_ALREADY_EXISTS errors */ | 1540 | /* |
| 1543 | static int __init acpi_serialize_setup(char *str) | 1541 | * Disable the auto-serialization of named objects creation methods. |
| 1542 | * | ||
| 1543 | * This feature is enabled by default. It marks the AML control methods | ||
| 1544 | * that contain the opcodes to create named objects as "Serialized". | ||
| 1545 | */ | ||
| 1546 | static int __init acpi_no_auto_serialize_setup(char *str) | ||
| 1544 | { | 1547 | { |
| 1545 | printk(KERN_INFO PREFIX "serialize enabled\n"); | 1548 | acpi_gbl_auto_serialize_methods = FALSE; |
| 1546 | 1549 | pr_info("ACPI: auto-serialization disabled\n"); | |
| 1547 | acpi_gbl_all_methods_serialized = TRUE; | ||
| 1548 | 1550 | ||
| 1549 | return 1; | 1551 | return 1; |
| 1550 | } | 1552 | } |
| 1551 | 1553 | ||
| 1552 | __setup("acpi_serialize", acpi_serialize_setup); | 1554 | __setup("acpi_no_auto_serialize", acpi_no_auto_serialize_setup); |
| 1553 | 1555 | ||
| 1554 | /* Check of resource interference between native drivers and ACPI | 1556 | /* Check of resource interference between native drivers and ACPI |
| 1555 | * OperationRegions (SystemIO and System Memory only). | 1557 | * OperationRegions (SystemIO and System Memory only). |
| @@ -1780,6 +1782,17 @@ static int __init acpi_no_auto_ssdt_setup(char *s) | |||
| 1780 | 1782 | ||
| 1781 | __setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup); | 1783 | __setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup); |
| 1782 | 1784 | ||
| 1785 | static int __init acpi_disable_return_repair(char *s) | ||
| 1786 | { | ||
| 1787 | printk(KERN_NOTICE PREFIX | ||
| 1788 | "ACPI: Predefined validation mechanism disabled\n"); | ||
| 1789 | acpi_gbl_disable_auto_repair = TRUE; | ||
| 1790 | |||
| 1791 | return 1; | ||
| 1792 | } | ||
| 1793 | |||
| 1794 | __setup("acpica_no_return_repair", acpi_disable_return_repair); | ||
| 1795 | |||
| 1783 | acpi_status __init acpi_os_initialize(void) | 1796 | acpi_status __init acpi_os_initialize(void) |
| 1784 | { | 1797 | { |
| 1785 | acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block); | 1798 | acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block); |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 361b40c10c3f..9c62340c2360 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
| @@ -370,6 +370,30 @@ static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin) | |||
| 370 | return NULL; | 370 | return NULL; |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | #if IS_ENABLED(CONFIG_ISA) || IS_ENABLED(CONFIG_EISA) | ||
| 374 | static int acpi_isa_register_gsi(struct pci_dev *dev) | ||
| 375 | { | ||
| 376 | u32 dev_gsi; | ||
| 377 | |||
| 378 | /* Interrupt Line values above 0xF are forbidden */ | ||
| 379 | if (dev->irq > 0 && (dev->irq <= 0xF) && | ||
| 380 | (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { | ||
| 381 | dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", | ||
| 382 | pin_name(dev->pin), dev->irq); | ||
| 383 | acpi_register_gsi(&dev->dev, dev_gsi, | ||
| 384 | ACPI_LEVEL_SENSITIVE, | ||
| 385 | ACPI_ACTIVE_LOW); | ||
| 386 | return 0; | ||
| 387 | } | ||
| 388 | return -EINVAL; | ||
| 389 | } | ||
| 390 | #else | ||
| 391 | static inline int acpi_isa_register_gsi(struct pci_dev *dev) | ||
| 392 | { | ||
| 393 | return -ENODEV; | ||
| 394 | } | ||
| 395 | #endif | ||
| 396 | |||
| 373 | int acpi_pci_irq_enable(struct pci_dev *dev) | 397 | int acpi_pci_irq_enable(struct pci_dev *dev) |
| 374 | { | 398 | { |
| 375 | struct acpi_prt_entry *entry; | 399 | struct acpi_prt_entry *entry; |
| @@ -416,19 +440,9 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
| 416 | * driver reported one, then use it. Exit in any case. | 440 | * driver reported one, then use it. Exit in any case. |
| 417 | */ | 441 | */ |
| 418 | if (gsi < 0) { | 442 | if (gsi < 0) { |
| 419 | u32 dev_gsi; | 443 | if (acpi_isa_register_gsi(dev)) |
| 420 | /* Interrupt Line values above 0xF are forbidden */ | ||
| 421 | if (dev->irq > 0 && (dev->irq <= 0xF) && | ||
| 422 | (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { | ||
| 423 | dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", | ||
| 424 | pin_name(pin), dev->irq); | ||
| 425 | acpi_register_gsi(&dev->dev, dev_gsi, | ||
| 426 | ACPI_LEVEL_SENSITIVE, | ||
| 427 | ACPI_ACTIVE_LOW); | ||
| 428 | } else { | ||
| 429 | dev_warn(&dev->dev, "PCI INT %c: no GSI\n", | 444 | dev_warn(&dev->dev, "PCI INT %c: no GSI\n", |
| 430 | pin_name(pin)); | 445 | pin_name(pin)); |
| 431 | } | ||
| 432 | 446 | ||
| 433 | kfree(entry); | 447 | kfree(entry); |
| 434 | return 0; | 448 | return 0; |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 9418c7a1f786..cfd7581cc19f 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
| @@ -43,8 +43,6 @@ | |||
| 43 | 43 | ||
| 44 | #include "internal.h" | 44 | #include "internal.h" |
| 45 | 45 | ||
| 46 | #define PREFIX "ACPI: " | ||
| 47 | |||
| 48 | #define _COMPONENT ACPI_PCI_COMPONENT | 46 | #define _COMPONENT ACPI_PCI_COMPONENT |
| 49 | ACPI_MODULE_NAME("pci_link"); | 47 | ACPI_MODULE_NAME("pci_link"); |
| 50 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" | 48 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index c1c4102e6478..d388f13d48b4 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -39,8 +39,6 @@ | |||
| 39 | 39 | ||
| 40 | #include "internal.h" | 40 | #include "internal.h" |
| 41 | 41 | ||
| 42 | #define PREFIX "ACPI: " | ||
| 43 | |||
| 44 | #define _COMPONENT ACPI_PCI_COMPONENT | 42 | #define _COMPONENT ACPI_PCI_COMPONENT |
| 45 | ACPI_MODULE_NAME("pci_root"); | 43 | ACPI_MODULE_NAME("pci_root"); |
| 46 | #define ACPI_PCI_ROOT_CLASS "pci_bridge" | 44 | #define ACPI_PCI_ROOT_CLASS "pci_bridge" |
| @@ -51,7 +49,7 @@ static void acpi_pci_root_remove(struct acpi_device *device); | |||
| 51 | 49 | ||
| 52 | static int acpi_pci_root_scan_dependent(struct acpi_device *adev) | 50 | static int acpi_pci_root_scan_dependent(struct acpi_device *adev) |
| 53 | { | 51 | { |
| 54 | acpiphp_check_host_bridge(adev->handle); | 52 | acpiphp_check_host_bridge(adev); |
| 55 | return 0; | 53 | return 0; |
| 56 | } | 54 | } |
| 57 | 55 | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index ad7da686e6e6..e0bcfb642b52 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -46,8 +46,6 @@ | |||
| 46 | #include "sleep.h" | 46 | #include "sleep.h" |
| 47 | #include "internal.h" | 47 | #include "internal.h" |
| 48 | 48 | ||
| 49 | #define PREFIX "ACPI: " | ||
| 50 | |||
| 51 | #define _COMPONENT ACPI_POWER_COMPONENT | 49 | #define _COMPONENT ACPI_POWER_COMPONENT |
| 52 | ACPI_MODULE_NAME("power"); | 50 | ACPI_MODULE_NAME("power"); |
| 53 | #define ACPI_POWER_CLASS "power_resource" | 51 | #define ACPI_POWER_CLASS "power_resource" |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index a4eea9a508d3..71e2065639a6 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -15,28 +15,9 @@ | |||
| 15 | 15 | ||
| 16 | #include "internal.h" | 16 | #include "internal.h" |
| 17 | 17 | ||
| 18 | #define PREFIX "ACPI: " | ||
| 19 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 18 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
| 20 | ACPI_MODULE_NAME("processor_core"); | 19 | ACPI_MODULE_NAME("processor_core"); |
| 21 | 20 | ||
| 22 | static int __init set_no_mwait(const struct dmi_system_id *id) | ||
| 23 | { | ||
| 24 | printk(KERN_NOTICE PREFIX "%s detected - " | ||
| 25 | "disabling mwait for CPU C-states\n", id->ident); | ||
| 26 | boot_option_idle_override = IDLE_NOMWAIT; | ||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | static struct dmi_system_id processor_idle_dmi_table[] __initdata = { | ||
| 31 | { | ||
| 32 | set_no_mwait, "Extensa 5220", { | ||
| 33 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), | ||
| 34 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
| 35 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | ||
| 36 | DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, | ||
| 37 | {}, | ||
| 38 | }; | ||
| 39 | |||
| 40 | static int map_lapic_id(struct acpi_subtable_header *entry, | 21 | static int map_lapic_id(struct acpi_subtable_header *entry, |
| 41 | u32 acpi_id, int *apic_id) | 22 | u32 acpi_id, int *apic_id) |
| 42 | { | 23 | { |
| @@ -323,7 +304,7 @@ static struct acpi_object_list *acpi_processor_alloc_pdc(void) | |||
| 323 | * _PDC is required for a BIOS-OS handshake for most of the newer | 304 | * _PDC is required for a BIOS-OS handshake for most of the newer |
| 324 | * ACPI processor features. | 305 | * ACPI processor features. |
| 325 | */ | 306 | */ |
| 326 | static int | 307 | static acpi_status |
| 327 | acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in) | 308 | acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in) |
| 328 | { | 309 | { |
| 329 | acpi_status status = AE_OK; | 310 | acpi_status status = AE_OK; |
| @@ -379,16 +360,43 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
| 379 | return AE_OK; | 360 | return AE_OK; |
| 380 | } | 361 | } |
| 381 | 362 | ||
| 382 | void __init acpi_early_processor_set_pdc(void) | 363 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) |
| 364 | static int __init set_no_mwait(const struct dmi_system_id *id) | ||
| 365 | { | ||
| 366 | pr_notice(PREFIX "%s detected - disabling mwait for CPU C-states\n", | ||
| 367 | id->ident); | ||
| 368 | boot_option_idle_override = IDLE_NOMWAIT; | ||
| 369 | return 0; | ||
| 370 | } | ||
| 371 | |||
| 372 | static struct dmi_system_id processor_idle_dmi_table[] __initdata = { | ||
| 373 | { | ||
| 374 | set_no_mwait, "Extensa 5220", { | ||
| 375 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), | ||
| 376 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
| 377 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | ||
| 378 | DMI_MATCH(DMI_BOARD_NAME, "Columbia") }, NULL}, | ||
| 379 | {}, | ||
| 380 | }; | ||
| 381 | |||
| 382 | static void __init processor_dmi_check(void) | ||
| 383 | { | 383 | { |
| 384 | /* | 384 | /* |
| 385 | * Check whether the system is DMI table. If yes, OSPM | 385 | * Check whether the system is DMI table. If yes, OSPM |
| 386 | * should not use mwait for CPU-states. | 386 | * should not use mwait for CPU-states. |
| 387 | */ | 387 | */ |
| 388 | dmi_check_system(processor_idle_dmi_table); | 388 | dmi_check_system(processor_idle_dmi_table); |
| 389 | } | ||
| 390 | #else | ||
| 391 | static inline void processor_dmi_check(void) {} | ||
| 392 | #endif | ||
| 393 | |||
| 394 | void __init acpi_early_processor_set_pdc(void) | ||
| 395 | { | ||
| 396 | processor_dmi_check(); | ||
| 389 | 397 | ||
| 390 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | 398 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
| 391 | ACPI_UINT32_MAX, | 399 | ACPI_UINT32_MAX, |
| 392 | early_init_pdc, NULL, NULL, NULL); | 400 | early_init_pdc, NULL, NULL, NULL); |
| 393 | acpi_get_devices("ACPI0007", early_init_pdc, NULL, NULL); | 401 | acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, early_init_pdc, NULL, NULL); |
| 394 | } | 402 | } |
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index c1c35623550f..7f70f3182d50 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
| @@ -41,8 +41,6 @@ | |||
| 41 | 41 | ||
| 42 | #include "internal.h" | 42 | #include "internal.h" |
| 43 | 43 | ||
| 44 | #define PREFIX "ACPI: " | ||
| 45 | |||
| 46 | #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 | 44 | #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 |
| 47 | #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 | 45 | #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 |
| 48 | #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 | 46 | #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index ff90054f04fd..cfc8aba72f86 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -156,17 +156,9 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
| 156 | */ | 156 | */ |
| 157 | static void acpi_processor_ppc_ost(acpi_handle handle, int status) | 157 | static void acpi_processor_ppc_ost(acpi_handle handle, int status) |
| 158 | { | 158 | { |
| 159 | union acpi_object params[2] = { | 159 | if (acpi_has_method(handle, "_OST")) |
| 160 | {.type = ACPI_TYPE_INTEGER,}, | 160 | acpi_evaluate_ost(handle, ACPI_PROCESSOR_NOTIFY_PERFORMANCE, |
| 161 | {.type = ACPI_TYPE_INTEGER,}, | 161 | status, NULL); |
| 162 | }; | ||
| 163 | struct acpi_object_list arg_list = {2, params}; | ||
| 164 | |||
| 165 | if (acpi_has_method(handle, "_OST")) { | ||
| 166 | params[0].integer.value = ACPI_PROCESSOR_NOTIFY_PERFORMANCE; | ||
| 167 | params[1].integer.value = status; | ||
| 168 | acpi_evaluate_object(handle, "_OST", &arg_list, NULL); | ||
| 169 | } | ||
| 170 | } | 162 | } |
| 171 | 163 | ||
| 172 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) | 164 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index dbd48498b938..366ca40a6f70 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
| @@ -37,12 +37,12 @@ | |||
| 37 | #include <linux/power_supply.h> | 37 | #include <linux/power_supply.h> |
| 38 | 38 | ||
| 39 | #include "sbshc.h" | 39 | #include "sbshc.h" |
| 40 | #include "battery.h" | ||
| 40 | 41 | ||
| 41 | #define PREFIX "ACPI: " | 42 | #define PREFIX "ACPI: " |
| 42 | 43 | ||
| 43 | #define ACPI_SBS_CLASS "sbs" | 44 | #define ACPI_SBS_CLASS "sbs" |
| 44 | #define ACPI_AC_CLASS "ac_adapter" | 45 | #define ACPI_AC_CLASS "ac_adapter" |
| 45 | #define ACPI_BATTERY_CLASS "battery" | ||
| 46 | #define ACPI_SBS_DEVICE_NAME "Smart Battery System" | 46 | #define ACPI_SBS_DEVICE_NAME "Smart Battery System" |
| 47 | #define ACPI_SBS_FILE_INFO "info" | 47 | #define ACPI_SBS_FILE_INFO "info" |
| 48 | #define ACPI_SBS_FILE_STATE "state" | 48 | #define ACPI_SBS_FILE_STATE "state" |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 57b053f424d1..7efe546a8c42 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -41,6 +41,7 @@ static DEFINE_MUTEX(acpi_scan_lock); | |||
| 41 | static LIST_HEAD(acpi_scan_handlers_list); | 41 | static LIST_HEAD(acpi_scan_handlers_list); |
| 42 | DEFINE_MUTEX(acpi_device_lock); | 42 | DEFINE_MUTEX(acpi_device_lock); |
| 43 | LIST_HEAD(acpi_wakeup_device_list); | 43 | LIST_HEAD(acpi_wakeup_device_list); |
| 44 | static DEFINE_MUTEX(acpi_hp_context_lock); | ||
| 44 | 45 | ||
| 45 | struct acpi_device_bus_id{ | 46 | struct acpi_device_bus_id{ |
| 46 | char bus_id[15]; | 47 | char bus_id[15]; |
| @@ -60,6 +61,27 @@ void acpi_scan_lock_release(void) | |||
| 60 | } | 61 | } |
| 61 | EXPORT_SYMBOL_GPL(acpi_scan_lock_release); | 62 | EXPORT_SYMBOL_GPL(acpi_scan_lock_release); |
| 62 | 63 | ||
| 64 | void acpi_lock_hp_context(void) | ||
| 65 | { | ||
| 66 | mutex_lock(&acpi_hp_context_lock); | ||
| 67 | } | ||
| 68 | |||
| 69 | void acpi_unlock_hp_context(void) | ||
| 70 | { | ||
| 71 | mutex_unlock(&acpi_hp_context_lock); | ||
| 72 | } | ||
| 73 | |||
| 74 | void acpi_initialize_hp_context(struct acpi_device *adev, | ||
| 75 | struct acpi_hotplug_context *hp, | ||
| 76 | int (*notify)(struct acpi_device *, u32), | ||
| 77 | void (*uevent)(struct acpi_device *, u32)) | ||
| 78 | { | ||
| 79 | acpi_lock_hp_context(); | ||
| 80 | acpi_set_hp_context(adev, hp, notify, uevent, NULL); | ||
| 81 | acpi_unlock_hp_context(); | ||
| 82 | } | ||
| 83 | EXPORT_SYMBOL_GPL(acpi_initialize_hp_context); | ||
| 84 | |||
| 63 | int acpi_scan_add_handler(struct acpi_scan_handler *handler) | 85 | int acpi_scan_add_handler(struct acpi_scan_handler *handler) |
| 64 | { | 86 | { |
| 65 | if (!handler || !handler->attach) | 87 | if (!handler || !handler->attach) |
| @@ -439,90 +461,75 @@ static int acpi_scan_bus_check(struct acpi_device *adev) | |||
| 439 | return 0; | 461 | return 0; |
| 440 | } | 462 | } |
| 441 | 463 | ||
| 442 | static void acpi_device_hotplug(void *data, u32 src) | 464 | static int acpi_generic_hotplug_event(struct acpi_device *adev, u32 type) |
| 443 | { | 465 | { |
| 444 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 466 | switch (type) { |
| 445 | struct acpi_device *adev = data; | ||
| 446 | int error; | ||
| 447 | |||
| 448 | lock_device_hotplug(); | ||
| 449 | mutex_lock(&acpi_scan_lock); | ||
| 450 | |||
| 451 | /* | ||
| 452 | * The device object's ACPI handle cannot become invalid as long as we | ||
| 453 | * are holding acpi_scan_lock, but it may have become invalid before | ||
| 454 | * that lock was acquired. | ||
| 455 | */ | ||
| 456 | if (adev->handle == INVALID_ACPI_HANDLE) | ||
| 457 | goto out; | ||
| 458 | |||
| 459 | switch (src) { | ||
| 460 | case ACPI_NOTIFY_BUS_CHECK: | 467 | case ACPI_NOTIFY_BUS_CHECK: |
| 461 | error = acpi_scan_bus_check(adev); | 468 | return acpi_scan_bus_check(adev); |
| 462 | break; | ||
| 463 | case ACPI_NOTIFY_DEVICE_CHECK: | 469 | case ACPI_NOTIFY_DEVICE_CHECK: |
| 464 | error = acpi_scan_device_check(adev); | 470 | return acpi_scan_device_check(adev); |
| 465 | break; | ||
| 466 | case ACPI_NOTIFY_EJECT_REQUEST: | 471 | case ACPI_NOTIFY_EJECT_REQUEST: |
| 467 | case ACPI_OST_EC_OSPM_EJECT: | 472 | case ACPI_OST_EC_OSPM_EJECT: |
| 468 | error = acpi_scan_hot_remove(adev); | 473 | if (adev->handler && !adev->handler->hotplug.enabled) { |
| 469 | break; | 474 | dev_info(&adev->dev, "Eject disabled\n"); |
| 470 | default: | 475 | return -EPERM; |
| 471 | error = -EINVAL; | 476 | } |
| 472 | break; | 477 | acpi_evaluate_ost(adev->handle, ACPI_NOTIFY_EJECT_REQUEST, |
| 478 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | ||
| 479 | return acpi_scan_hot_remove(adev); | ||
| 473 | } | 480 | } |
| 474 | if (!error) | 481 | return -EINVAL; |
| 475 | ost_code = ACPI_OST_SC_SUCCESS; | ||
| 476 | |||
| 477 | out: | ||
| 478 | acpi_evaluate_hotplug_ost(adev->handle, src, ost_code, NULL); | ||
| 479 | put_device(&adev->dev); | ||
| 480 | mutex_unlock(&acpi_scan_lock); | ||
| 481 | unlock_device_hotplug(); | ||
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | 484 | void acpi_device_hotplug(struct acpi_device *adev, u32 src) |
| 485 | { | 485 | { |
| 486 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | 486 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; |
| 487 | struct acpi_device *adev; | 487 | int error = -ENODEV; |
| 488 | acpi_status status; | ||
| 489 | 488 | ||
| 490 | if (acpi_bus_get_device(handle, &adev)) | 489 | lock_device_hotplug(); |
| 491 | goto err_out; | 490 | mutex_lock(&acpi_scan_lock); |
| 492 | 491 | ||
| 493 | switch (type) { | 492 | /* |
| 494 | case ACPI_NOTIFY_BUS_CHECK: | 493 | * The device object's ACPI handle cannot become invalid as long as we |
| 495 | acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n"); | 494 | * are holding acpi_scan_lock, but it might have become invalid before |
| 496 | break; | 495 | * that lock was acquired. |
| 497 | case ACPI_NOTIFY_DEVICE_CHECK: | 496 | */ |
| 498 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n"); | 497 | if (adev->handle == INVALID_ACPI_HANDLE) |
| 499 | break; | 498 | goto err_out; |
| 500 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
| 501 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); | ||
| 502 | if (!adev->handler) | ||
| 503 | goto err_out; | ||
| 504 | 499 | ||
| 505 | if (!adev->handler->hotplug.enabled) { | 500 | if (adev->flags.is_dock_station) { |
| 506 | acpi_handle_err(handle, "Eject disabled\n"); | 501 | error = dock_notify(adev, src); |
| 502 | } else if (adev->flags.hotplug_notify) { | ||
| 503 | error = acpi_generic_hotplug_event(adev, src); | ||
| 504 | if (error == -EPERM) { | ||
| 507 | ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED; | 505 | ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED; |
| 508 | goto err_out; | 506 | goto err_out; |
| 509 | } | 507 | } |
| 510 | acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST, | 508 | } else { |
| 511 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | 509 | int (*notify)(struct acpi_device *, u32); |
| 512 | break; | ||
| 513 | default: | ||
| 514 | /* non-hotplug event; possibly handled by other handler */ | ||
| 515 | return; | ||
| 516 | } | ||
| 517 | get_device(&adev->dev); | ||
| 518 | status = acpi_hotplug_execute(acpi_device_hotplug, adev, type); | ||
| 519 | if (ACPI_SUCCESS(status)) | ||
| 520 | return; | ||
| 521 | 510 | ||
| 522 | put_device(&adev->dev); | 511 | acpi_lock_hp_context(); |
| 512 | notify = adev->hp ? adev->hp->notify : NULL; | ||
| 513 | acpi_unlock_hp_context(); | ||
| 514 | /* | ||
| 515 | * There may be additional notify handlers for device objects | ||
| 516 | * without the .event() callback, so ignore them here. | ||
| 517 | */ | ||
| 518 | if (notify) | ||
| 519 | error = notify(adev, src); | ||
| 520 | else | ||
| 521 | goto out; | ||
| 522 | } | ||
| 523 | if (!error) | ||
| 524 | ost_code = ACPI_OST_SC_SUCCESS; | ||
| 523 | 525 | ||
| 524 | err_out: | 526 | err_out: |
| 525 | acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); | 527 | acpi_evaluate_ost(adev->handle, src, ost_code, NULL); |
| 528 | |||
| 529 | out: | ||
| 530 | acpi_bus_put_acpi_device(adev); | ||
| 531 | mutex_unlock(&acpi_scan_lock); | ||
| 532 | unlock_device_hotplug(); | ||
| 526 | } | 533 | } |
| 527 | 534 | ||
| 528 | static ssize_t real_power_state_show(struct device *dev, | 535 | static ssize_t real_power_state_show(struct device *dev, |
| @@ -570,17 +577,14 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, | |||
| 570 | if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable) | 577 | if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable) |
| 571 | return -ENODEV; | 578 | return -ENODEV; |
| 572 | 579 | ||
| 573 | acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT, | ||
| 574 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | ||
| 575 | get_device(&acpi_device->dev); | 580 | get_device(&acpi_device->dev); |
| 576 | status = acpi_hotplug_execute(acpi_device_hotplug, acpi_device, | 581 | status = acpi_hotplug_schedule(acpi_device, ACPI_OST_EC_OSPM_EJECT); |
| 577 | ACPI_OST_EC_OSPM_EJECT); | ||
| 578 | if (ACPI_SUCCESS(status)) | 582 | if (ACPI_SUCCESS(status)) |
| 579 | return count; | 583 | return count; |
| 580 | 584 | ||
| 581 | put_device(&acpi_device->dev); | 585 | put_device(&acpi_device->dev); |
| 582 | acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT, | 586 | acpi_evaluate_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT, |
| 583 | ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL); | 587 | ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL); |
| 584 | return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; | 588 | return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; |
| 585 | } | 589 | } |
| 586 | 590 | ||
| @@ -1114,14 +1118,16 @@ static void acpi_scan_drop_device(acpi_handle handle, void *context) | |||
| 1114 | mutex_unlock(&acpi_device_del_lock); | 1118 | mutex_unlock(&acpi_device_del_lock); |
| 1115 | } | 1119 | } |
| 1116 | 1120 | ||
| 1117 | int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) | 1121 | static int acpi_get_device_data(acpi_handle handle, struct acpi_device **device, |
| 1122 | void (*callback)(void *)) | ||
| 1118 | { | 1123 | { |
| 1119 | acpi_status status; | 1124 | acpi_status status; |
| 1120 | 1125 | ||
| 1121 | if (!device) | 1126 | if (!device) |
| 1122 | return -EINVAL; | 1127 | return -EINVAL; |
| 1123 | 1128 | ||
| 1124 | status = acpi_get_data(handle, acpi_scan_drop_device, (void **)device); | 1129 | status = acpi_get_data_full(handle, acpi_scan_drop_device, |
| 1130 | (void **)device, callback); | ||
| 1125 | if (ACPI_FAILURE(status) || !*device) { | 1131 | if (ACPI_FAILURE(status) || !*device) { |
| 1126 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n", | 1132 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No context for object [%p]\n", |
| 1127 | handle)); | 1133 | handle)); |
| @@ -1129,8 +1135,32 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) | |||
| 1129 | } | 1135 | } |
| 1130 | return 0; | 1136 | return 0; |
| 1131 | } | 1137 | } |
| 1138 | |||
| 1139 | int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) | ||
| 1140 | { | ||
| 1141 | return acpi_get_device_data(handle, device, NULL); | ||
| 1142 | } | ||
| 1132 | EXPORT_SYMBOL(acpi_bus_get_device); | 1143 | EXPORT_SYMBOL(acpi_bus_get_device); |
| 1133 | 1144 | ||
| 1145 | static void get_acpi_device(void *dev) | ||
| 1146 | { | ||
| 1147 | if (dev) | ||
| 1148 | get_device(&((struct acpi_device *)dev)->dev); | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle) | ||
| 1152 | { | ||
| 1153 | struct acpi_device *adev = NULL; | ||
| 1154 | |||
| 1155 | acpi_get_device_data(handle, &adev, get_acpi_device); | ||
| 1156 | return adev; | ||
| 1157 | } | ||
| 1158 | |||
| 1159 | void acpi_bus_put_acpi_device(struct acpi_device *adev) | ||
| 1160 | { | ||
| 1161 | put_device(&adev->dev); | ||
| 1162 | } | ||
| 1163 | |||
| 1134 | int acpi_device_add(struct acpi_device *device, | 1164 | int acpi_device_add(struct acpi_device *device, |
| 1135 | void (*release)(struct device *)) | 1165 | void (*release)(struct device *)) |
| 1136 | { | 1166 | { |
| @@ -1641,6 +1671,27 @@ bool acpi_bay_match(acpi_handle handle) | |||
| 1641 | return acpi_ata_match(phandle); | 1671 | return acpi_ata_match(phandle); |
| 1642 | } | 1672 | } |
| 1643 | 1673 | ||
| 1674 | bool acpi_device_is_battery(struct acpi_device *adev) | ||
| 1675 | { | ||
| 1676 | struct acpi_hardware_id *hwid; | ||
| 1677 | |||
| 1678 | list_for_each_entry(hwid, &adev->pnp.ids, list) | ||
| 1679 | if (!strcmp("PNP0C0A", hwid->id)) | ||
| 1680 | return true; | ||
| 1681 | |||
| 1682 | return false; | ||
| 1683 | } | ||
| 1684 | |||
| 1685 | static bool is_ejectable_bay(struct acpi_device *adev) | ||
| 1686 | { | ||
| 1687 | acpi_handle handle = adev->handle; | ||
| 1688 | |||
| 1689 | if (acpi_has_method(handle, "_EJ0") && acpi_device_is_battery(adev)) | ||
| 1690 | return true; | ||
| 1691 | |||
| 1692 | return acpi_bay_match(handle); | ||
| 1693 | } | ||
| 1694 | |||
| 1644 | /* | 1695 | /* |
| 1645 | * acpi_dock_match - see if an acpi object has a _DCK method | 1696 | * acpi_dock_match - see if an acpi object has a _DCK method |
| 1646 | */ | 1697 | */ |
| @@ -1706,6 +1757,20 @@ static bool acpi_ibm_smbus_match(acpi_handle handle) | |||
| 1706 | return false; | 1757 | return false; |
| 1707 | } | 1758 | } |
| 1708 | 1759 | ||
| 1760 | static bool acpi_object_is_system_bus(acpi_handle handle) | ||
| 1761 | { | ||
| 1762 | acpi_handle tmp; | ||
| 1763 | |||
| 1764 | if (ACPI_SUCCESS(acpi_get_handle(NULL, "\\_SB", &tmp)) && | ||
| 1765 | tmp == handle) | ||
| 1766 | return true; | ||
| 1767 | if (ACPI_SUCCESS(acpi_get_handle(NULL, "\\_TZ", &tmp)) && | ||
| 1768 | tmp == handle) | ||
| 1769 | return true; | ||
| 1770 | |||
| 1771 | return false; | ||
| 1772 | } | ||
| 1773 | |||
| 1709 | static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, | 1774 | static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, |
| 1710 | int device_type) | 1775 | int device_type) |
| 1711 | { | 1776 | { |
| @@ -1757,8 +1822,10 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, | |||
| 1757 | acpi_add_id(pnp, ACPI_DOCK_HID); | 1822 | acpi_add_id(pnp, ACPI_DOCK_HID); |
| 1758 | else if (acpi_ibm_smbus_match(handle)) | 1823 | else if (acpi_ibm_smbus_match(handle)) |
| 1759 | acpi_add_id(pnp, ACPI_SMBUS_IBM_HID); | 1824 | acpi_add_id(pnp, ACPI_SMBUS_IBM_HID); |
| 1760 | else if (list_empty(&pnp->ids) && handle == ACPI_ROOT_OBJECT) { | 1825 | else if (list_empty(&pnp->ids) && |
| 1761 | acpi_add_id(pnp, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ | 1826 | acpi_object_is_system_bus(handle)) { |
| 1827 | /* \_SB, \_TZ, LNXSYBUS */ | ||
| 1828 | acpi_add_id(pnp, ACPI_BUS_HID); | ||
| 1762 | strcpy(pnp->device_name, ACPI_BUS_DEVICE_NAME); | 1829 | strcpy(pnp->device_name, ACPI_BUS_DEVICE_NAME); |
| 1763 | strcpy(pnp->device_class, ACPI_BUS_CLASS); | 1830 | strcpy(pnp->device_class, ACPI_BUS_CLASS); |
| 1764 | } | 1831 | } |
| @@ -1941,33 +2008,23 @@ void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val) | |||
| 1941 | mutex_unlock(&acpi_scan_lock); | 2008 | mutex_unlock(&acpi_scan_lock); |
| 1942 | } | 2009 | } |
| 1943 | 2010 | ||
| 1944 | static void acpi_scan_init_hotplug(acpi_handle handle, int type) | 2011 | static void acpi_scan_init_hotplug(struct acpi_device *adev) |
| 1945 | { | 2012 | { |
| 1946 | struct acpi_device_pnp pnp = {}; | ||
| 1947 | struct acpi_hardware_id *hwid; | 2013 | struct acpi_hardware_id *hwid; |
| 1948 | struct acpi_scan_handler *handler; | ||
| 1949 | 2014 | ||
| 1950 | INIT_LIST_HEAD(&pnp.ids); | 2015 | if (acpi_dock_match(adev->handle) || is_ejectable_bay(adev)) { |
| 1951 | acpi_set_pnp_ids(handle, &pnp, type); | 2016 | acpi_dock_add(adev); |
| 1952 | 2017 | return; | |
| 1953 | if (!pnp.type.hardware_id) | 2018 | } |
| 1954 | goto out; | 2019 | list_for_each_entry(hwid, &adev->pnp.ids, list) { |
| 2020 | struct acpi_scan_handler *handler; | ||
| 1955 | 2021 | ||
| 1956 | /* | ||
| 1957 | * This relies on the fact that acpi_install_notify_handler() will not | ||
| 1958 | * install the same notify handler routine twice for the same handle. | ||
| 1959 | */ | ||
| 1960 | list_for_each_entry(hwid, &pnp.ids, list) { | ||
| 1961 | handler = acpi_scan_match_handler(hwid->id, NULL); | 2022 | handler = acpi_scan_match_handler(hwid->id, NULL); |
| 1962 | if (handler) { | 2023 | if (handler) { |
| 1963 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | 2024 | adev->flags.hotplug_notify = true; |
| 1964 | acpi_hotplug_notify_cb, handler); | ||
| 1965 | break; | 2025 | break; |
| 1966 | } | 2026 | } |
| 1967 | } | 2027 | } |
| 1968 | |||
| 1969 | out: | ||
| 1970 | acpi_free_pnp_ids(&pnp); | ||
| 1971 | } | 2028 | } |
| 1972 | 2029 | ||
| 1973 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | 2030 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, |
| @@ -1991,12 +2048,12 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
| 1991 | return AE_OK; | 2048 | return AE_OK; |
| 1992 | } | 2049 | } |
| 1993 | 2050 | ||
| 1994 | acpi_scan_init_hotplug(handle, type); | ||
| 1995 | |||
| 1996 | acpi_add_single_object(&device, handle, type, sta); | 2051 | acpi_add_single_object(&device, handle, type, sta); |
| 1997 | if (!device) | 2052 | if (!device) |
| 1998 | return AE_CTRL_DEPTH; | 2053 | return AE_CTRL_DEPTH; |
| 1999 | 2054 | ||
| 2055 | acpi_scan_init_hotplug(device); | ||
| 2056 | |||
| 2000 | out: | 2057 | out: |
| 2001 | if (!*return_value) | 2058 | if (!*return_value) |
| 2002 | *return_value = device; | 2059 | *return_value = device; |
| @@ -2015,13 +2072,14 @@ static int acpi_scan_attach_handler(struct acpi_device *device) | |||
| 2015 | 2072 | ||
| 2016 | handler = acpi_scan_match_handler(hwid->id, &devid); | 2073 | handler = acpi_scan_match_handler(hwid->id, &devid); |
| 2017 | if (handler) { | 2074 | if (handler) { |
| 2075 | device->handler = handler; | ||
| 2018 | ret = handler->attach(device, devid); | 2076 | ret = handler->attach(device, devid); |
| 2019 | if (ret > 0) { | 2077 | if (ret > 0) |
| 2020 | device->handler = handler; | ||
| 2021 | break; | 2078 | break; |
| 2022 | } else if (ret < 0) { | 2079 | |
| 2080 | device->handler = NULL; | ||
| 2081 | if (ret < 0) | ||
| 2023 | break; | 2082 | break; |
| 2024 | } | ||
| 2025 | } | 2083 | } |
| 2026 | } | 2084 | } |
| 2027 | return ret; | 2085 | return ret; |
| @@ -2030,8 +2088,12 @@ static int acpi_scan_attach_handler(struct acpi_device *device) | |||
| 2030 | static void acpi_bus_attach(struct acpi_device *device) | 2088 | static void acpi_bus_attach(struct acpi_device *device) |
| 2031 | { | 2089 | { |
| 2032 | struct acpi_device *child; | 2090 | struct acpi_device *child; |
| 2091 | acpi_handle ejd; | ||
| 2033 | int ret; | 2092 | int ret; |
| 2034 | 2093 | ||
| 2094 | if (ACPI_SUCCESS(acpi_bus_get_ejd(device->handle, &ejd))) | ||
| 2095 | register_dock_dependent_device(device, ejd); | ||
| 2096 | |||
| 2035 | acpi_bus_get_status(device); | 2097 | acpi_bus_get_status(device); |
| 2036 | /* Skip devices that are not present. */ | 2098 | /* Skip devices that are not present. */ |
| 2037 | if (!acpi_device_is_present(device)) { | 2099 | if (!acpi_device_is_present(device)) { |
| @@ -2184,7 +2246,6 @@ int __init acpi_scan_init(void) | |||
| 2184 | acpi_cmos_rtc_init(); | 2246 | acpi_cmos_rtc_init(); |
| 2185 | acpi_container_init(); | 2247 | acpi_container_init(); |
| 2186 | acpi_memory_hotplug_init(); | 2248 | acpi_memory_hotplug_init(); |
| 2187 | acpi_dock_init(); | ||
| 2188 | 2249 | ||
| 2189 | mutex_lock(&acpi_scan_lock); | 2250 | mutex_lock(&acpi_scan_lock); |
| 2190 | /* | 2251 | /* |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 91a32cefb11f..38cb9782d4b8 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
| @@ -12,8 +12,6 @@ | |||
| 12 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 12 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
| 13 | ACPI_MODULE_NAME("sysfs"); | 13 | ACPI_MODULE_NAME("sysfs"); |
| 14 | 14 | ||
| 15 | #define PREFIX "ACPI: " | ||
| 16 | |||
| 17 | #ifdef CONFIG_ACPI_DEBUG | 15 | #ifdef CONFIG_ACPI_DEBUG |
| 18 | /* | 16 | /* |
| 19 | * ACPI debug sysfs I/F, including: | 17 | * ACPI debug sysfs I/F, including: |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 5837f857ac2e..21782290df41 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | * | 23 | * |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #define pr_fmt(fmt) "ACPI: " fmt | ||
| 27 | |||
| 26 | #include <linux/init.h> | 28 | #include <linux/init.h> |
| 27 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
| 28 | #include <linux/smp.h> | 30 | #include <linux/smp.h> |
| @@ -33,8 +35,6 @@ | |||
| 33 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
| 34 | #include <linux/bootmem.h> | 36 | #include <linux/bootmem.h> |
| 35 | 37 | ||
| 36 | #define PREFIX "ACPI: " | ||
| 37 | |||
| 38 | #define ACPI_MAX_TABLES 128 | 38 | #define ACPI_MAX_TABLES 128 |
| 39 | 39 | ||
| 40 | static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" }; | 40 | static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" }; |
| @@ -55,10 +55,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 55 | { | 55 | { |
| 56 | struct acpi_madt_local_apic *p = | 56 | struct acpi_madt_local_apic *p = |
| 57 | (struct acpi_madt_local_apic *)header; | 57 | (struct acpi_madt_local_apic *)header; |
| 58 | printk(KERN_INFO PREFIX | 58 | pr_info("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", |
| 59 | "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", | 59 | p->processor_id, p->id, |
| 60 | p->processor_id, p->id, | 60 | (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); |
| 61 | (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); | ||
| 62 | } | 61 | } |
| 63 | break; | 62 | break; |
| 64 | 63 | ||
| @@ -66,11 +65,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 66 | { | 65 | { |
| 67 | struct acpi_madt_local_x2apic *p = | 66 | struct acpi_madt_local_x2apic *p = |
| 68 | (struct acpi_madt_local_x2apic *)header; | 67 | (struct acpi_madt_local_x2apic *)header; |
| 69 | printk(KERN_INFO PREFIX | 68 | pr_info("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n", |
| 70 | "X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n", | 69 | p->local_apic_id, p->uid, |
| 71 | p->local_apic_id, p->uid, | 70 | (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); |
| 72 | (p->lapic_flags & ACPI_MADT_ENABLED) ? | ||
| 73 | "enabled" : "disabled"); | ||
| 74 | } | 71 | } |
| 75 | break; | 72 | break; |
| 76 | 73 | ||
| @@ -78,9 +75,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 78 | { | 75 | { |
| 79 | struct acpi_madt_io_apic *p = | 76 | struct acpi_madt_io_apic *p = |
| 80 | (struct acpi_madt_io_apic *)header; | 77 | (struct acpi_madt_io_apic *)header; |
| 81 | printk(KERN_INFO PREFIX | 78 | pr_info("IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", |
| 82 | "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", | 79 | p->id, p->address, p->global_irq_base); |
| 83 | p->id, p->address, p->global_irq_base); | ||
| 84 | } | 80 | } |
| 85 | break; | 81 | break; |
| 86 | 82 | ||
| @@ -88,18 +84,15 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 88 | { | 84 | { |
| 89 | struct acpi_madt_interrupt_override *p = | 85 | struct acpi_madt_interrupt_override *p = |
| 90 | (struct acpi_madt_interrupt_override *)header; | 86 | (struct acpi_madt_interrupt_override *)header; |
| 91 | printk(KERN_INFO PREFIX | 87 | pr_info("INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n", |
| 92 | "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n", | 88 | p->bus, p->source_irq, p->global_irq, |
| 93 | p->bus, p->source_irq, p->global_irq, | 89 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], |
| 94 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], | 90 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2]); |
| 95 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2]); | ||
| 96 | if (p->inti_flags & | 91 | if (p->inti_flags & |
| 97 | ~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK)) | 92 | ~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK)) |
| 98 | printk(KERN_INFO PREFIX | 93 | pr_info("INT_SRC_OVR unexpected reserved flags: 0x%x\n", |
| 99 | "INT_SRC_OVR unexpected reserved flags: 0x%x\n", | 94 | p->inti_flags & |
| 100 | p->inti_flags & | ||
| 101 | ~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK)); | 95 | ~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK)); |
| 102 | |||
| 103 | } | 96 | } |
| 104 | break; | 97 | break; |
| 105 | 98 | ||
| @@ -107,11 +100,10 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 107 | { | 100 | { |
| 108 | struct acpi_madt_nmi_source *p = | 101 | struct acpi_madt_nmi_source *p = |
| 109 | (struct acpi_madt_nmi_source *)header; | 102 | (struct acpi_madt_nmi_source *)header; |
| 110 | printk(KERN_INFO PREFIX | 103 | pr_info("NMI_SRC (%s %s global_irq %d)\n", |
| 111 | "NMI_SRC (%s %s global_irq %d)\n", | 104 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], |
| 112 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], | 105 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], |
| 113 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], | 106 | p->global_irq); |
| 114 | p->global_irq); | ||
| 115 | } | 107 | } |
| 116 | break; | 108 | break; |
| 117 | 109 | ||
| @@ -119,12 +111,11 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 119 | { | 111 | { |
| 120 | struct acpi_madt_local_apic_nmi *p = | 112 | struct acpi_madt_local_apic_nmi *p = |
| 121 | (struct acpi_madt_local_apic_nmi *)header; | 113 | (struct acpi_madt_local_apic_nmi *)header; |
| 122 | printk(KERN_INFO PREFIX | 114 | pr_info("LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n", |
| 123 | "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n", | 115 | p->processor_id, |
| 124 | p->processor_id, | 116 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK ], |
| 125 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK ], | 117 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], |
| 126 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], | 118 | p->lint); |
| 127 | p->lint); | ||
| 128 | } | 119 | } |
| 129 | break; | 120 | break; |
| 130 | 121 | ||
| @@ -137,12 +128,11 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 137 | polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK; | 128 | polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK; |
| 138 | trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2; | 129 | trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2; |
| 139 | 130 | ||
| 140 | printk(KERN_INFO PREFIX | 131 | pr_info("X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n", |
| 141 | "X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n", | 132 | p->uid, |
| 142 | p->uid, | 133 | mps_inti_flags_polarity[polarity], |
| 143 | mps_inti_flags_polarity[polarity], | 134 | mps_inti_flags_trigger[trigger], |
| 144 | mps_inti_flags_trigger[trigger], | 135 | p->lint); |
| 145 | p->lint); | ||
| 146 | } | 136 | } |
| 147 | break; | 137 | break; |
| 148 | 138 | ||
| @@ -150,9 +140,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 150 | { | 140 | { |
| 151 | struct acpi_madt_local_apic_override *p = | 141 | struct acpi_madt_local_apic_override *p = |
| 152 | (struct acpi_madt_local_apic_override *)header; | 142 | (struct acpi_madt_local_apic_override *)header; |
| 153 | printk(KERN_INFO PREFIX | 143 | pr_info("LAPIC_ADDR_OVR (address[%p])\n", |
| 154 | "LAPIC_ADDR_OVR (address[%p])\n", | 144 | (void *)(unsigned long)p->address); |
| 155 | (void *)(unsigned long)p->address); | ||
| 156 | } | 145 | } |
| 157 | break; | 146 | break; |
| 158 | 147 | ||
| @@ -160,10 +149,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 160 | { | 149 | { |
| 161 | struct acpi_madt_io_sapic *p = | 150 | struct acpi_madt_io_sapic *p = |
| 162 | (struct acpi_madt_io_sapic *)header; | 151 | (struct acpi_madt_io_sapic *)header; |
| 163 | printk(KERN_INFO PREFIX | 152 | pr_info("IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", |
| 164 | "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", | 153 | p->id, (void *)(unsigned long)p->address, |
| 165 | p->id, (void *)(unsigned long)p->address, | 154 | p->global_irq_base); |
| 166 | p->global_irq_base); | ||
| 167 | } | 155 | } |
| 168 | break; | 156 | break; |
| 169 | 157 | ||
| @@ -171,10 +159,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 171 | { | 159 | { |
| 172 | struct acpi_madt_local_sapic *p = | 160 | struct acpi_madt_local_sapic *p = |
| 173 | (struct acpi_madt_local_sapic *)header; | 161 | (struct acpi_madt_local_sapic *)header; |
| 174 | printk(KERN_INFO PREFIX | 162 | pr_info("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", |
| 175 | "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", | 163 | p->processor_id, p->id, p->eid, |
| 176 | p->processor_id, p->id, p->eid, | 164 | (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); |
| 177 | (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled"); | ||
| 178 | } | 165 | } |
| 179 | break; | 166 | break; |
| 180 | 167 | ||
| @@ -182,19 +169,17 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
| 182 | { | 169 | { |
| 183 | struct acpi_madt_interrupt_source *p = | 170 | struct acpi_madt_interrupt_source *p = |
| 184 | (struct acpi_madt_interrupt_source *)header; | 171 | (struct acpi_madt_interrupt_source *)header; |
| 185 | printk(KERN_INFO PREFIX | 172 | pr_info("PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", |
| 186 | "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", | 173 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], |
| 187 | mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK], | 174 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], |
| 188 | mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2], | 175 | p->type, p->id, p->eid, p->io_sapic_vector, |
| 189 | p->type, p->id, p->eid, p->io_sapic_vector, | 176 | p->global_irq); |
| 190 | p->global_irq); | ||
| 191 | } | 177 | } |
| 192 | break; | 178 | break; |
| 193 | 179 | ||
| 194 | default: | 180 | default: |
| 195 | printk(KERN_WARNING PREFIX | 181 | pr_warn("Found unsupported MADT entry (type = 0x%x)\n", |
| 196 | "Found unsupported MADT entry (type = 0x%x)\n", | 182 | header->type); |
| 197 | header->type); | ||
| 198 | break; | 183 | break; |
| 199 | } | 184 | } |
| 200 | } | 185 | } |
| @@ -225,7 +210,7 @@ acpi_table_parse_entries(char *id, | |||
| 225 | acpi_get_table_with_size(id, 0, &table_header, &tbl_size); | 210 | acpi_get_table_with_size(id, 0, &table_header, &tbl_size); |
| 226 | 211 | ||
| 227 | if (!table_header) { | 212 | if (!table_header) { |
| 228 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); | 213 | pr_warn("%4.4s not present\n", id); |
| 229 | return -ENODEV; | 214 | return -ENODEV; |
| 230 | } | 215 | } |
| 231 | 216 | ||
| @@ -248,7 +233,7 @@ acpi_table_parse_entries(char *id, | |||
| 248 | * infinite loop. | 233 | * infinite loop. |
| 249 | */ | 234 | */ |
| 250 | if (entry->length == 0) { | 235 | if (entry->length == 0) { |
| 251 | pr_err(PREFIX "[%4.4s:0x%02x] Invalid zero length\n", id, entry_id); | 236 | pr_err("[%4.4s:0x%02x] Invalid zero length\n", id, entry_id); |
| 252 | goto err; | 237 | goto err; |
| 253 | } | 238 | } |
| 254 | 239 | ||
| @@ -256,8 +241,8 @@ acpi_table_parse_entries(char *id, | |||
| 256 | ((unsigned long)entry + entry->length); | 241 | ((unsigned long)entry + entry->length); |
| 257 | } | 242 | } |
| 258 | if (max_entries && count > max_entries) { | 243 | if (max_entries && count > max_entries) { |
| 259 | printk(KERN_WARNING PREFIX "[%4.4s:0x%02x] ignored %i entries of " | 244 | pr_warn("[%4.4s:0x%02x] ignored %i entries of %i found\n", |
| 260 | "%i found\n", id, entry_id, count - max_entries, count); | 245 | id, entry_id, count - max_entries, count); |
| 261 | } | 246 | } |
| 262 | 247 | ||
| 263 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | 248 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); |
| @@ -322,13 +307,11 @@ static void __init check_multiple_madt(void) | |||
| 322 | 307 | ||
| 323 | acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size); | 308 | acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size); |
| 324 | if (table) { | 309 | if (table) { |
| 325 | printk(KERN_WARNING PREFIX | 310 | pr_warn("BIOS bug: multiple APIC/MADT found, using %d\n", |
| 326 | "BIOS bug: multiple APIC/MADT found," | 311 | acpi_apic_instance); |
| 327 | " using %d\n", acpi_apic_instance); | 312 | pr_warn("If \"acpi_apic_instance=%d\" works better, " |
| 328 | printk(KERN_WARNING PREFIX | 313 | "notify linux-acpi@vger.kernel.org\n", |
| 329 | "If \"acpi_apic_instance=%d\" works better, " | 314 | acpi_apic_instance ? 0 : 2); |
| 330 | "notify linux-acpi@vger.kernel.org\n", | ||
| 331 | acpi_apic_instance ? 0 : 2); | ||
| 332 | early_acpi_os_unmap_memory(table, tbl_size); | 315 | early_acpi_os_unmap_memory(table, tbl_size); |
| 333 | 316 | ||
| 334 | } else | 317 | } else |
| @@ -365,8 +348,7 @@ static int __init acpi_parse_apic_instance(char *str) | |||
| 365 | 348 | ||
| 366 | acpi_apic_instance = simple_strtoul(str, NULL, 0); | 349 | acpi_apic_instance = simple_strtoul(str, NULL, 0); |
| 367 | 350 | ||
| 368 | printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n", | 351 | pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance); |
| 369 | acpi_apic_instance); | ||
| 370 | 352 | ||
| 371 | return 0; | 353 | return 0; |
| 372 | } | 354 | } |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 08626c851be7..964068553334 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
| 44 | #include <linux/thermal.h> | 44 | #include <linux/thermal.h> |
| 45 | #include <linux/acpi.h> | 45 | #include <linux/acpi.h> |
| 46 | #include <linux/workqueue.h> | ||
| 46 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
| 47 | 48 | ||
| 48 | #define PREFIX "ACPI: " | 49 | #define PREFIX "ACPI: " |
| @@ -90,6 +91,8 @@ static int psv; | |||
| 90 | module_param(psv, int, 0644); | 91 | module_param(psv, int, 0644); |
| 91 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); | 92 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); |
| 92 | 93 | ||
| 94 | static struct workqueue_struct *acpi_thermal_pm_queue; | ||
| 95 | |||
| 93 | static int acpi_thermal_add(struct acpi_device *device); | 96 | static int acpi_thermal_add(struct acpi_device *device); |
| 94 | static int acpi_thermal_remove(struct acpi_device *device); | 97 | static int acpi_thermal_remove(struct acpi_device *device); |
| 95 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); | 98 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); |
| @@ -101,11 +104,13 @@ static const struct acpi_device_id thermal_device_ids[] = { | |||
| 101 | MODULE_DEVICE_TABLE(acpi, thermal_device_ids); | 104 | MODULE_DEVICE_TABLE(acpi, thermal_device_ids); |
| 102 | 105 | ||
| 103 | #ifdef CONFIG_PM_SLEEP | 106 | #ifdef CONFIG_PM_SLEEP |
| 107 | static int acpi_thermal_suspend(struct device *dev); | ||
| 104 | static int acpi_thermal_resume(struct device *dev); | 108 | static int acpi_thermal_resume(struct device *dev); |
| 105 | #else | 109 | #else |
| 110 | #define acpi_thermal_suspend NULL | ||
| 106 | #define acpi_thermal_resume NULL | 111 | #define acpi_thermal_resume NULL |
| 107 | #endif | 112 | #endif |
| 108 | static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume); | 113 | static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, acpi_thermal_suspend, acpi_thermal_resume); |
| 109 | 114 | ||
| 110 | static struct acpi_driver acpi_thermal_driver = { | 115 | static struct acpi_driver acpi_thermal_driver = { |
| 111 | .name = "thermal", | 116 | .name = "thermal", |
| @@ -186,6 +191,7 @@ struct acpi_thermal { | |||
| 186 | struct thermal_zone_device *thermal_zone; | 191 | struct thermal_zone_device *thermal_zone; |
| 187 | int tz_enabled; | 192 | int tz_enabled; |
| 188 | int kelvin_offset; | 193 | int kelvin_offset; |
| 194 | struct work_struct thermal_check_work; | ||
| 189 | }; | 195 | }; |
| 190 | 196 | ||
| 191 | /* -------------------------------------------------------------------------- | 197 | /* -------------------------------------------------------------------------- |
| @@ -1064,6 +1070,13 @@ static void acpi_thermal_guess_offset(struct acpi_thermal *tz) | |||
| 1064 | tz->kelvin_offset = 2732; | 1070 | tz->kelvin_offset = 2732; |
| 1065 | } | 1071 | } |
| 1066 | 1072 | ||
| 1073 | static void acpi_thermal_check_fn(struct work_struct *work) | ||
| 1074 | { | ||
| 1075 | struct acpi_thermal *tz = container_of(work, struct acpi_thermal, | ||
| 1076 | thermal_check_work); | ||
| 1077 | acpi_thermal_check(tz); | ||
| 1078 | } | ||
| 1079 | |||
| 1067 | static int acpi_thermal_add(struct acpi_device *device) | 1080 | static int acpi_thermal_add(struct acpi_device *device) |
| 1068 | { | 1081 | { |
| 1069 | int result = 0; | 1082 | int result = 0; |
| @@ -1093,6 +1106,8 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
| 1093 | if (result) | 1106 | if (result) |
| 1094 | goto free_memory; | 1107 | goto free_memory; |
| 1095 | 1108 | ||
| 1109 | INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn); | ||
| 1110 | |||
| 1096 | pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device), | 1111 | pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device), |
| 1097 | acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature)); | 1112 | acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature)); |
| 1098 | goto end; | 1113 | goto end; |
| @@ -1110,6 +1125,7 @@ static int acpi_thermal_remove(struct acpi_device *device) | |||
| 1110 | if (!device || !acpi_driver_data(device)) | 1125 | if (!device || !acpi_driver_data(device)) |
| 1111 | return -EINVAL; | 1126 | return -EINVAL; |
| 1112 | 1127 | ||
| 1128 | flush_workqueue(acpi_thermal_pm_queue); | ||
| 1113 | tz = acpi_driver_data(device); | 1129 | tz = acpi_driver_data(device); |
| 1114 | 1130 | ||
| 1115 | acpi_thermal_unregister_thermal_zone(tz); | 1131 | acpi_thermal_unregister_thermal_zone(tz); |
| @@ -1118,6 +1134,13 @@ static int acpi_thermal_remove(struct acpi_device *device) | |||
| 1118 | } | 1134 | } |
| 1119 | 1135 | ||
| 1120 | #ifdef CONFIG_PM_SLEEP | 1136 | #ifdef CONFIG_PM_SLEEP |
| 1137 | static int acpi_thermal_suspend(struct device *dev) | ||
| 1138 | { | ||
| 1139 | /* Make sure the previously queued thermal check work has been done */ | ||
| 1140 | flush_workqueue(acpi_thermal_pm_queue); | ||
| 1141 | return 0; | ||
| 1142 | } | ||
| 1143 | |||
| 1121 | static int acpi_thermal_resume(struct device *dev) | 1144 | static int acpi_thermal_resume(struct device *dev) |
| 1122 | { | 1145 | { |
| 1123 | struct acpi_thermal *tz; | 1146 | struct acpi_thermal *tz; |
| @@ -1148,7 +1171,7 @@ static int acpi_thermal_resume(struct device *dev) | |||
| 1148 | tz->state.active |= tz->trips.active[i].flags.enabled; | 1171 | tz->state.active |= tz->trips.active[i].flags.enabled; |
| 1149 | } | 1172 | } |
| 1150 | 1173 | ||
| 1151 | acpi_thermal_check(tz); | 1174 | queue_work(acpi_thermal_pm_queue, &tz->thermal_check_work); |
| 1152 | 1175 | ||
| 1153 | return AE_OK; | 1176 | return AE_OK; |
| 1154 | } | 1177 | } |
| @@ -1240,16 +1263,22 @@ static int __init acpi_thermal_init(void) | |||
| 1240 | return -ENODEV; | 1263 | return -ENODEV; |
| 1241 | } | 1264 | } |
| 1242 | 1265 | ||
| 1266 | acpi_thermal_pm_queue = create_workqueue("acpi_thermal_pm"); | ||
| 1267 | if (!acpi_thermal_pm_queue) | ||
| 1268 | return -ENODEV; | ||
| 1269 | |||
| 1243 | result = acpi_bus_register_driver(&acpi_thermal_driver); | 1270 | result = acpi_bus_register_driver(&acpi_thermal_driver); |
| 1244 | if (result < 0) | 1271 | if (result < 0) { |
| 1272 | destroy_workqueue(acpi_thermal_pm_queue); | ||
| 1245 | return -ENODEV; | 1273 | return -ENODEV; |
| 1274 | } | ||
| 1246 | 1275 | ||
| 1247 | return 0; | 1276 | return 0; |
| 1248 | } | 1277 | } |
| 1249 | 1278 | ||
| 1250 | static void __exit acpi_thermal_exit(void) | 1279 | static void __exit acpi_thermal_exit(void) |
| 1251 | { | 1280 | { |
| 1252 | 1281 | destroy_workqueue(acpi_thermal_pm_queue); | |
| 1253 | acpi_bus_unregister_driver(&acpi_thermal_driver); | 1282 | acpi_bus_unregister_driver(&acpi_thermal_driver); |
| 1254 | 1283 | ||
| 1255 | return; | 1284 | return; |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 85e3b612bdc0..0f5f78fa6545 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
| @@ -422,7 +422,7 @@ out: | |||
| 422 | EXPORT_SYMBOL(acpi_get_physical_device_location); | 422 | EXPORT_SYMBOL(acpi_get_physical_device_location); |
| 423 | 423 | ||
| 424 | /** | 424 | /** |
| 425 | * acpi_evaluate_hotplug_ost: Evaluate _OST for hotplug operations | 425 | * acpi_evaluate_ost: Evaluate _OST for hotplug operations |
| 426 | * @handle: ACPI device handle | 426 | * @handle: ACPI device handle |
| 427 | * @source_event: source event code | 427 | * @source_event: source event code |
| 428 | * @status_code: status code | 428 | * @status_code: status code |
| @@ -433,17 +433,15 @@ EXPORT_SYMBOL(acpi_get_physical_device_location); | |||
| 433 | * When the platform does not support _OST, this function has no effect. | 433 | * When the platform does not support _OST, this function has no effect. |
| 434 | */ | 434 | */ |
| 435 | acpi_status | 435 | acpi_status |
| 436 | acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, | 436 | acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, |
| 437 | u32 status_code, struct acpi_buffer *status_buf) | 437 | struct acpi_buffer *status_buf) |
| 438 | { | 438 | { |
| 439 | #ifdef ACPI_HOTPLUG_OST | ||
| 440 | union acpi_object params[3] = { | 439 | union acpi_object params[3] = { |
| 441 | {.type = ACPI_TYPE_INTEGER,}, | 440 | {.type = ACPI_TYPE_INTEGER,}, |
| 442 | {.type = ACPI_TYPE_INTEGER,}, | 441 | {.type = ACPI_TYPE_INTEGER,}, |
| 443 | {.type = ACPI_TYPE_BUFFER,} | 442 | {.type = ACPI_TYPE_BUFFER,} |
| 444 | }; | 443 | }; |
| 445 | struct acpi_object_list arg_list = {3, params}; | 444 | struct acpi_object_list arg_list = {3, params}; |
| 446 | acpi_status status; | ||
| 447 | 445 | ||
| 448 | params[0].integer.value = source_event; | 446 | params[0].integer.value = source_event; |
| 449 | params[1].integer.value = status_code; | 447 | params[1].integer.value = status_code; |
| @@ -455,13 +453,9 @@ acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, | |||
| 455 | params[2].buffer.length = 0; | 453 | params[2].buffer.length = 0; |
| 456 | } | 454 | } |
| 457 | 455 | ||
| 458 | status = acpi_evaluate_object(handle, "_OST", &arg_list, NULL); | 456 | return acpi_evaluate_object(handle, "_OST", &arg_list, NULL); |
| 459 | return status; | ||
| 460 | #else | ||
| 461 | return AE_OK; | ||
| 462 | #endif | ||
| 463 | } | 457 | } |
| 464 | EXPORT_SYMBOL(acpi_evaluate_hotplug_ost); | 458 | EXPORT_SYMBOL(acpi_evaluate_ost); |
| 465 | 459 | ||
| 466 | /** | 460 | /** |
| 467 | * acpi_handle_printk: Print message with ACPI prefix and object path | 461 | * acpi_handle_printk: Print message with ACPI prefix and object path |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index b6ba88ed31ae..48c7e8af9c96 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -45,8 +45,6 @@ | |||
| 45 | 45 | ||
| 46 | #include "internal.h" | 46 | #include "internal.h" |
| 47 | 47 | ||
| 48 | #define PREFIX "ACPI: " | ||
| 49 | |||
| 50 | #define ACPI_VIDEO_BUS_NAME "Video Bus" | 48 | #define ACPI_VIDEO_BUS_NAME "Video Bus" |
| 51 | #define ACPI_VIDEO_DEVICE_NAME "Video Device" | 49 | #define ACPI_VIDEO_DEVICE_NAME "Video Device" |
| 52 | #define ACPI_VIDEO_NOTIFY_SWITCH 0x80 | 50 | #define ACPI_VIDEO_NOTIFY_SWITCH 0x80 |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 19080c8e2f2a..33e3db548a29 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
| @@ -40,8 +40,6 @@ | |||
| 40 | 40 | ||
| 41 | #include "internal.h" | 41 | #include "internal.h" |
| 42 | 42 | ||
| 43 | #define PREFIX "ACPI: " | ||
| 44 | |||
| 45 | ACPI_MODULE_NAME("video"); | 43 | ACPI_MODULE_NAME("video"); |
| 46 | #define _COMPONENT ACPI_VIDEO_COMPONENT | 44 | #define _COMPONENT ACPI_VIDEO_COMPONENT |
| 47 | 45 | ||
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 9e69a5308693..acb95dffdb6a 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
| @@ -38,6 +38,16 @@ static void ata_acpi_clear_gtf(struct ata_device *dev) | |||
| 38 | dev->gtf_cache = NULL; | 38 | dev->gtf_cache = NULL; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | struct ata_acpi_hotplug_context { | ||
| 42 | struct acpi_hotplug_context hp; | ||
| 43 | union { | ||
| 44 | struct ata_port *ap; | ||
| 45 | struct ata_device *dev; | ||
| 46 | } data; | ||
| 47 | }; | ||
| 48 | |||
| 49 | #define ata_hotplug_data(context) (container_of((context), struct ata_acpi_hotplug_context, hp)->data) | ||
| 50 | |||
| 41 | /** | 51 | /** |
| 42 | * ata_dev_acpi_handle - provide the acpi_handle for an ata_device | 52 | * ata_dev_acpi_handle - provide the acpi_handle for an ata_device |
| 43 | * @dev: the acpi_handle returned will correspond to this device | 53 | * @dev: the acpi_handle returned will correspond to this device |
| @@ -121,18 +131,17 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
| 121 | ata_port_wait_eh(ap); | 131 | ata_port_wait_eh(ap); |
| 122 | } | 132 | } |
| 123 | 133 | ||
| 124 | static void ata_acpi_dev_notify_dock(acpi_handle handle, u32 event, void *data) | 134 | static int ata_acpi_dev_notify_dock(struct acpi_device *adev, u32 event) |
| 125 | { | 135 | { |
| 126 | struct ata_device *dev = data; | 136 | struct ata_device *dev = ata_hotplug_data(adev->hp).dev; |
| 127 | |||
| 128 | ata_acpi_handle_hotplug(dev->link->ap, dev, event); | 137 | ata_acpi_handle_hotplug(dev->link->ap, dev, event); |
| 138 | return 0; | ||
| 129 | } | 139 | } |
| 130 | 140 | ||
| 131 | static void ata_acpi_ap_notify_dock(acpi_handle handle, u32 event, void *data) | 141 | static int ata_acpi_ap_notify_dock(struct acpi_device *adev, u32 event) |
| 132 | { | 142 | { |
| 133 | struct ata_port *ap = data; | 143 | ata_acpi_handle_hotplug(ata_hotplug_data(adev->hp).ap, NULL, event); |
| 134 | 144 | return 0; | |
| 135 | ata_acpi_handle_hotplug(ap, NULL, event); | ||
| 136 | } | 145 | } |
| 137 | 146 | ||
| 138 | static void ata_acpi_uevent(struct ata_port *ap, struct ata_device *dev, | 147 | static void ata_acpi_uevent(struct ata_port *ap, struct ata_device *dev, |
| @@ -154,31 +163,23 @@ static void ata_acpi_uevent(struct ata_port *ap, struct ata_device *dev, | |||
| 154 | } | 163 | } |
| 155 | } | 164 | } |
| 156 | 165 | ||
| 157 | static void ata_acpi_ap_uevent(acpi_handle handle, u32 event, void *data) | 166 | static void ata_acpi_ap_uevent(struct acpi_device *adev, u32 event) |
| 158 | { | 167 | { |
| 159 | ata_acpi_uevent(data, NULL, event); | 168 | ata_acpi_uevent(ata_hotplug_data(adev->hp).ap, NULL, event); |
| 160 | } | 169 | } |
| 161 | 170 | ||
| 162 | static void ata_acpi_dev_uevent(acpi_handle handle, u32 event, void *data) | 171 | static void ata_acpi_dev_uevent(struct acpi_device *adev, u32 event) |
| 163 | { | 172 | { |
| 164 | struct ata_device *dev = data; | 173 | struct ata_device *dev = ata_hotplug_data(adev->hp).dev; |
| 165 | ata_acpi_uevent(dev->link->ap, dev, event); | 174 | ata_acpi_uevent(dev->link->ap, dev, event); |
| 166 | } | 175 | } |
| 167 | 176 | ||
| 168 | static const struct acpi_dock_ops ata_acpi_dev_dock_ops = { | ||
| 169 | .handler = ata_acpi_dev_notify_dock, | ||
| 170 | .uevent = ata_acpi_dev_uevent, | ||
| 171 | }; | ||
| 172 | |||
| 173 | static const struct acpi_dock_ops ata_acpi_ap_dock_ops = { | ||
| 174 | .handler = ata_acpi_ap_notify_dock, | ||
| 175 | .uevent = ata_acpi_ap_uevent, | ||
| 176 | }; | ||
| 177 | |||
| 178 | /* bind acpi handle to pata port */ | 177 | /* bind acpi handle to pata port */ |
| 179 | void ata_acpi_bind_port(struct ata_port *ap) | 178 | void ata_acpi_bind_port(struct ata_port *ap) |
| 180 | { | 179 | { |
| 181 | struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); | 180 | struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); |
| 181 | struct acpi_device *adev; | ||
| 182 | struct ata_acpi_hotplug_context *context; | ||
| 182 | 183 | ||
| 183 | if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_companion) | 184 | if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_companion) |
| 184 | return; | 185 | return; |
| @@ -188,9 +189,17 @@ void ata_acpi_bind_port(struct ata_port *ap) | |||
| 188 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) | 189 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) |
| 189 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 190 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
| 190 | 191 | ||
| 191 | /* we might be on a docking station */ | 192 | adev = ACPI_COMPANION(&ap->tdev); |
| 192 | register_hotplug_dock_device(ACPI_HANDLE(&ap->tdev), | 193 | if (!adev || adev->hp) |
| 193 | &ata_acpi_ap_dock_ops, ap, NULL, NULL); | 194 | return; |
| 195 | |||
| 196 | context = kzalloc(sizeof(*context), GFP_KERNEL); | ||
| 197 | if (!context) | ||
| 198 | return; | ||
| 199 | |||
| 200 | context->data.ap = ap; | ||
| 201 | acpi_initialize_hp_context(adev, &context->hp, ata_acpi_ap_notify_dock, | ||
| 202 | ata_acpi_ap_uevent); | ||
| 194 | } | 203 | } |
| 195 | 204 | ||
| 196 | void ata_acpi_bind_dev(struct ata_device *dev) | 205 | void ata_acpi_bind_dev(struct ata_device *dev) |
| @@ -198,7 +207,8 @@ void ata_acpi_bind_dev(struct ata_device *dev) | |||
| 198 | struct ata_port *ap = dev->link->ap; | 207 | struct ata_port *ap = dev->link->ap; |
| 199 | struct acpi_device *port_companion = ACPI_COMPANION(&ap->tdev); | 208 | struct acpi_device *port_companion = ACPI_COMPANION(&ap->tdev); |
| 200 | struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); | 209 | struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); |
| 201 | struct acpi_device *parent; | 210 | struct acpi_device *parent, *adev; |
| 211 | struct ata_acpi_hotplug_context *context; | ||
| 202 | u64 adr; | 212 | u64 adr; |
| 203 | 213 | ||
| 204 | /* | 214 | /* |
| @@ -221,9 +231,17 @@ void ata_acpi_bind_dev(struct ata_device *dev) | |||
| 221 | } | 231 | } |
| 222 | 232 | ||
| 223 | acpi_preset_companion(&dev->tdev, parent, adr); | 233 | acpi_preset_companion(&dev->tdev, parent, adr); |
| 234 | adev = ACPI_COMPANION(&dev->tdev); | ||
| 235 | if (!adev || adev->hp) | ||
| 236 | return; | ||
| 237 | |||
| 238 | context = kzalloc(sizeof(*context), GFP_KERNEL); | ||
| 239 | if (!context) | ||
| 240 | return; | ||
| 224 | 241 | ||
| 225 | register_hotplug_dock_device(ata_dev_acpi_handle(dev), | 242 | context->data.dev = dev; |
| 226 | &ata_acpi_dev_dock_ops, dev, NULL, NULL); | 243 | acpi_initialize_hp_context(adev, &context->hp, ata_acpi_dev_notify_dock, |
| 244 | ata_acpi_dev_uevent); | ||
| 227 | } | 245 | } |
| 228 | 246 | ||
| 229 | /** | 247 | /** |
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile index 2e58ebb1f6c0..1cb8544598d5 100644 --- a/drivers/base/power/Makefile +++ b/drivers/base/power/Makefile | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | obj-$(CONFIG_PM) += sysfs.o generic_ops.o common.o qos.o | 1 | obj-$(CONFIG_PM) += sysfs.o generic_ops.o common.o qos.o runtime.o |
| 2 | obj-$(CONFIG_PM_SLEEP) += main.o wakeup.o | 2 | obj-$(CONFIG_PM_SLEEP) += main.o wakeup.o |
| 3 | obj-$(CONFIG_PM_RUNTIME) += runtime.o | ||
| 4 | obj-$(CONFIG_PM_TRACE_RTC) += trace.o | 3 | obj-$(CONFIG_PM_TRACE_RTC) += trace.o |
| 5 | obj-$(CONFIG_PM_OPP) += opp.o | 4 | obj-$(CONFIG_PM_OPP) += opp.o |
| 6 | obj-$(CONFIG_PM_GENERIC_DOMAINS) += domain.o domain_governor.o | 5 | obj-$(CONFIG_PM_GENERIC_DOMAINS) += domain.o domain_governor.o |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index bfb8955c406c..dc127e5dec4b 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | struct gpd_timing_data *__td = &dev_gpd_data(dev)->td; \ | 42 | struct gpd_timing_data *__td = &dev_gpd_data(dev)->td; \ |
| 43 | if (!__retval && __elapsed > __td->field) { \ | 43 | if (!__retval && __elapsed > __td->field) { \ |
| 44 | __td->field = __elapsed; \ | 44 | __td->field = __elapsed; \ |
| 45 | dev_warn(dev, name " latency exceeded, new value %lld ns\n", \ | 45 | dev_dbg(dev, name " latency exceeded, new value %lld ns\n", \ |
| 46 | __elapsed); \ | 46 | __elapsed); \ |
| 47 | genpd->max_off_time_changed = true; \ | 47 | genpd->max_off_time_changed = true; \ |
| 48 | __td->constraint_changed = true; \ | 48 | __td->constraint_changed = true; \ |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 1b41fca3d65a..86d5e4fb5b98 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/async.h> | 29 | #include <linux/async.h> |
| 30 | #include <linux/suspend.h> | 30 | #include <linux/suspend.h> |
| 31 | #include <trace/events/power.h> | 31 | #include <trace/events/power.h> |
| 32 | #include <linux/cpufreq.h> | ||
| 32 | #include <linux/cpuidle.h> | 33 | #include <linux/cpuidle.h> |
| 33 | #include <linux/timer.h> | 34 | #include <linux/timer.h> |
| 34 | 35 | ||
| @@ -91,6 +92,8 @@ void device_pm_sleep_init(struct device *dev) | |||
| 91 | { | 92 | { |
| 92 | dev->power.is_prepared = false; | 93 | dev->power.is_prepared = false; |
| 93 | dev->power.is_suspended = false; | 94 | dev->power.is_suspended = false; |
| 95 | dev->power.is_noirq_suspended = false; | ||
| 96 | dev->power.is_late_suspended = false; | ||
| 94 | init_completion(&dev->power.completion); | 97 | init_completion(&dev->power.completion); |
| 95 | complete_all(&dev->power.completion); | 98 | complete_all(&dev->power.completion); |
| 96 | dev->power.wakeup = NULL; | 99 | dev->power.wakeup = NULL; |
| @@ -467,7 +470,7 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd) | |||
| 467 | * The driver of @dev will not receive interrupts while this function is being | 470 | * The driver of @dev will not receive interrupts while this function is being |
| 468 | * executed. | 471 | * executed. |
| 469 | */ | 472 | */ |
| 470 | static int device_resume_noirq(struct device *dev, pm_message_t state) | 473 | static int device_resume_noirq(struct device *dev, pm_message_t state, bool async) |
| 471 | { | 474 | { |
| 472 | pm_callback_t callback = NULL; | 475 | pm_callback_t callback = NULL; |
| 473 | char *info = NULL; | 476 | char *info = NULL; |
| @@ -479,6 +482,11 @@ static int device_resume_noirq(struct device *dev, pm_message_t state) | |||
| 479 | if (dev->power.syscore) | 482 | if (dev->power.syscore) |
| 480 | goto Out; | 483 | goto Out; |
| 481 | 484 | ||
| 485 | if (!dev->power.is_noirq_suspended) | ||
| 486 | goto Out; | ||
| 487 | |||
| 488 | dpm_wait(dev->parent, async); | ||
| 489 | |||
| 482 | if (dev->pm_domain) { | 490 | if (dev->pm_domain) { |
| 483 | info = "noirq power domain "; | 491 | info = "noirq power domain "; |
| 484 | callback = pm_noirq_op(&dev->pm_domain->ops, state); | 492 | callback = pm_noirq_op(&dev->pm_domain->ops, state); |
| @@ -499,12 +507,32 @@ static int device_resume_noirq(struct device *dev, pm_message_t state) | |||
| 499 | } | 507 | } |
| 500 | 508 | ||
| 501 | error = dpm_run_callback(callback, dev, state, info); | 509 | error = dpm_run_callback(callback, dev, state, info); |
| 510 | dev->power.is_noirq_suspended = false; | ||
| 502 | 511 | ||
| 503 | Out: | 512 | Out: |
| 513 | complete_all(&dev->power.completion); | ||
| 504 | TRACE_RESUME(error); | 514 | TRACE_RESUME(error); |
| 505 | return error; | 515 | return error; |
| 506 | } | 516 | } |
| 507 | 517 | ||
| 518 | static bool is_async(struct device *dev) | ||
| 519 | { | ||
| 520 | return dev->power.async_suspend && pm_async_enabled | ||
| 521 | && !pm_trace_is_enabled(); | ||
| 522 | } | ||
| 523 | |||
| 524 | static void async_resume_noirq(void *data, async_cookie_t cookie) | ||
| 525 | { | ||
| 526 | struct device *dev = (struct device *)data; | ||
| 527 | int error; | ||
| 528 | |||
| 529 | error = device_resume_noirq(dev, pm_transition, true); | ||
| 530 | if (error) | ||
| 531 | pm_dev_err(dev, pm_transition, " async", error); | ||
| 532 | |||
| 533 | put_device(dev); | ||
| 534 | } | ||
| 535 | |||
| 508 | /** | 536 | /** |
| 509 | * dpm_resume_noirq - Execute "noirq resume" callbacks for all devices. | 537 | * dpm_resume_noirq - Execute "noirq resume" callbacks for all devices. |
| 510 | * @state: PM transition of the system being carried out. | 538 | * @state: PM transition of the system being carried out. |
| @@ -514,29 +542,48 @@ static int device_resume_noirq(struct device *dev, pm_message_t state) | |||
| 514 | */ | 542 | */ |
| 515 | static void dpm_resume_noirq(pm_message_t state) | 543 | static void dpm_resume_noirq(pm_message_t state) |
| 516 | { | 544 | { |
| 545 | struct device *dev; | ||
| 517 | ktime_t starttime = ktime_get(); | 546 | ktime_t starttime = ktime_get(); |
| 518 | 547 | ||
| 519 | mutex_lock(&dpm_list_mtx); | 548 | mutex_lock(&dpm_list_mtx); |
| 520 | while (!list_empty(&dpm_noirq_list)) { | 549 | pm_transition = state; |
| 521 | struct device *dev = to_device(dpm_noirq_list.next); | ||
| 522 | int error; | ||
| 523 | 550 | ||
| 551 | /* | ||
| 552 | * Advanced the async threads upfront, | ||
| 553 | * in case the starting of async threads is | ||
| 554 | * delayed by non-async resuming devices. | ||
| 555 | */ | ||
| 556 | list_for_each_entry(dev, &dpm_noirq_list, power.entry) { | ||
| 557 | reinit_completion(&dev->power.completion); | ||
| 558 | if (is_async(dev)) { | ||
| 559 | get_device(dev); | ||
| 560 | async_schedule(async_resume_noirq, dev); | ||
| 561 | } | ||
| 562 | } | ||
| 563 | |||
| 564 | while (!list_empty(&dpm_noirq_list)) { | ||
| 565 | dev = to_device(dpm_noirq_list.next); | ||
| 524 | get_device(dev); | 566 | get_device(dev); |
| 525 | list_move_tail(&dev->power.entry, &dpm_late_early_list); | 567 | list_move_tail(&dev->power.entry, &dpm_late_early_list); |
| 526 | mutex_unlock(&dpm_list_mtx); | 568 | mutex_unlock(&dpm_list_mtx); |
| 527 | 569 | ||
| 528 | error = device_resume_noirq(dev, state); | 570 | if (!is_async(dev)) { |
| 529 | if (error) { | 571 | int error; |
| 530 | suspend_stats.failed_resume_noirq++; | 572 | |
| 531 | dpm_save_failed_step(SUSPEND_RESUME_NOIRQ); | 573 | error = device_resume_noirq(dev, state, false); |
| 532 | dpm_save_failed_dev(dev_name(dev)); | 574 | if (error) { |
| 533 | pm_dev_err(dev, state, " noirq", error); | 575 | suspend_stats.failed_resume_noirq++; |
| 576 | dpm_save_failed_step(SUSPEND_RESUME_NOIRQ); | ||
| 577 | dpm_save_failed_dev(dev_name(dev)); | ||
| 578 | pm_dev_err(dev, state, " noirq", error); | ||
| 579 | } | ||
| 534 | } | 580 | } |
| 535 | 581 | ||
| 536 | mutex_lock(&dpm_list_mtx); | 582 | mutex_lock(&dpm_list_mtx); |
| 537 | put_device(dev); | 583 | put_device(dev); |
| 538 | } | 584 | } |
| 539 | mutex_unlock(&dpm_list_mtx); | 585 | mutex_unlock(&dpm_list_mtx); |
| 586 | async_synchronize_full(); | ||
| 540 | dpm_show_time(starttime, state, "noirq"); | 587 | dpm_show_time(starttime, state, "noirq"); |
| 541 | resume_device_irqs(); | 588 | resume_device_irqs(); |
| 542 | cpuidle_resume(); | 589 | cpuidle_resume(); |
| @@ -549,7 +596,7 @@ static void dpm_resume_noirq(pm_message_t state) | |||
| 549 | * | 596 | * |
| 550 | * Runtime PM is disabled for @dev while this function is being executed. | 597 | * Runtime PM is disabled for @dev while this function is being executed. |
| 551 | */ | 598 | */ |
| 552 | static int device_resume_early(struct device *dev, pm_message_t state) | 599 | static int device_resume_early(struct device *dev, pm_message_t state, bool async) |
| 553 | { | 600 | { |
| 554 | pm_callback_t callback = NULL; | 601 | pm_callback_t callback = NULL; |
| 555 | char *info = NULL; | 602 | char *info = NULL; |
| @@ -561,6 +608,11 @@ static int device_resume_early(struct device *dev, pm_message_t state) | |||
| 561 | if (dev->power.syscore) | 608 | if (dev->power.syscore) |
| 562 | goto Out; | 609 | goto Out; |
| 563 | 610 | ||
| 611 | if (!dev->power.is_late_suspended) | ||
| 612 | goto Out; | ||
| 613 | |||
| 614 | dpm_wait(dev->parent, async); | ||
| 615 | |||
| 564 | if (dev->pm_domain) { | 616 | if (dev->pm_domain) { |
| 565 | info = "early power domain "; | 617 | info = "early power domain "; |
| 566 | callback = pm_late_early_op(&dev->pm_domain->ops, state); | 618 | callback = pm_late_early_op(&dev->pm_domain->ops, state); |
| @@ -581,43 +633,75 @@ static int device_resume_early(struct device *dev, pm_message_t state) | |||
| 581 | } | 633 | } |
| 582 | 634 | ||
| 583 | error = dpm_run_callback(callback, dev, state, info); | 635 | error = dpm_run_callback(callback, dev, state, info); |
| 636 | dev->power.is_late_suspended = false; | ||
| 584 | 637 | ||
| 585 | Out: | 638 | Out: |
| 586 | TRACE_RESUME(error); | 639 | TRACE_RESUME(error); |
| 587 | 640 | ||
| 588 | pm_runtime_enable(dev); | 641 | pm_runtime_enable(dev); |
| 642 | complete_all(&dev->power.completion); | ||
| 589 | return error; | 643 | return error; |
| 590 | } | 644 | } |
| 591 | 645 | ||
| 646 | static void async_resume_early(void *data, async_cookie_t cookie) | ||
| 647 | { | ||
| 648 | struct device *dev = (struct device *)data; | ||
| 649 | int error; | ||
| 650 | |||
| 651 | error = device_resume_early(dev, pm_transition, true); | ||
| 652 | if (error) | ||
| 653 | pm_dev_err(dev, pm_transition, " async", error); | ||
| 654 | |||
| 655 | put_device(dev); | ||
| 656 | } | ||
| 657 | |||
| 592 | /** | 658 | /** |
| 593 | * dpm_resume_early - Execute "early resume" callbacks for all devices. | 659 | * dpm_resume_early - Execute "early resume" callbacks for all devices. |
| 594 | * @state: PM transition of the system being carried out. | 660 | * @state: PM transition of the system being carried out. |
| 595 | */ | 661 | */ |
| 596 | static void dpm_resume_early(pm_message_t state) | 662 | static void dpm_resume_early(pm_message_t state) |
| 597 | { | 663 | { |
| 664 | struct device *dev; | ||
| 598 | ktime_t starttime = ktime_get(); | 665 | ktime_t starttime = ktime_get(); |
| 599 | 666 | ||
| 600 | mutex_lock(&dpm_list_mtx); | 667 | mutex_lock(&dpm_list_mtx); |
| 601 | while (!list_empty(&dpm_late_early_list)) { | 668 | pm_transition = state; |
| 602 | struct device *dev = to_device(dpm_late_early_list.next); | ||
| 603 | int error; | ||
| 604 | 669 | ||
| 670 | /* | ||
| 671 | * Advanced the async threads upfront, | ||
| 672 | * in case the starting of async threads is | ||
| 673 | * delayed by non-async resuming devices. | ||
| 674 | */ | ||
| 675 | list_for_each_entry(dev, &dpm_late_early_list, power.entry) { | ||
| 676 | reinit_completion(&dev->power.completion); | ||
| 677 | if (is_async(dev)) { | ||
| 678 | get_device(dev); | ||
| 679 | async_schedule(async_resume_early, dev); | ||
| 680 | } | ||
| 681 | } | ||
| 682 | |||
| 683 | while (!list_empty(&dpm_late_early_list)) { | ||
| 684 | dev = to_device(dpm_late_early_list.next); | ||
| 605 | get_device(dev); | 685 | get_device(dev); |
| 606 | list_move_tail(&dev->power.entry, &dpm_suspended_list); | 686 | list_move_tail(&dev->power.entry, &dpm_suspended_list); |
| 607 | mutex_unlock(&dpm_list_mtx); | 687 | mutex_unlock(&dpm_list_mtx); |
| 608 | 688 | ||
| 609 | error = device_resume_early(dev, state); | 689 | if (!is_async(dev)) { |
| 610 | if (error) { | 690 | int error; |
| 611 | suspend_stats.failed_resume_early++; | ||
| 612 | dpm_save_failed_step(SUSPEND_RESUME_EARLY); | ||
| 613 | dpm_save_failed_dev(dev_name(dev)); | ||
| 614 | pm_dev_err(dev, state, " early", error); | ||
| 615 | } | ||
| 616 | 691 | ||
| 692 | error = device_resume_early(dev, state, false); | ||
| 693 | if (error) { | ||
| 694 | suspend_stats.failed_resume_early++; | ||
| 695 | dpm_save_failed_step(SUSPEND_RESUME_EARLY); | ||
| 696 | dpm_save_failed_dev(dev_name(dev)); | ||
| 697 | pm_dev_err(dev, state, " early", error); | ||
| 698 | } | ||
| 699 | } | ||
| 617 | mutex_lock(&dpm_list_mtx); | 700 | mutex_lock(&dpm_list_mtx); |
| 618 | put_device(dev); | 701 | put_device(dev); |
| 619 | } | 702 | } |
| 620 | mutex_unlock(&dpm_list_mtx); | 703 | mutex_unlock(&dpm_list_mtx); |
| 704 | async_synchronize_full(); | ||
| 621 | dpm_show_time(starttime, state, "early"); | 705 | dpm_show_time(starttime, state, "early"); |
| 622 | } | 706 | } |
| 623 | 707 | ||
| @@ -732,12 +816,6 @@ static void async_resume(void *data, async_cookie_t cookie) | |||
| 732 | put_device(dev); | 816 | put_device(dev); |
| 733 | } | 817 | } |
| 734 | 818 | ||
| 735 | static bool is_async(struct device *dev) | ||
| 736 | { | ||
| 737 | return dev->power.async_suspend && pm_async_enabled | ||
| 738 | && !pm_trace_is_enabled(); | ||
| 739 | } | ||
| 740 | |||
| 741 | /** | 819 | /** |
| 742 | * dpm_resume - Execute "resume" callbacks for non-sysdev devices. | 820 | * dpm_resume - Execute "resume" callbacks for non-sysdev devices. |
| 743 | * @state: PM transition of the system being carried out. | 821 | * @state: PM transition of the system being carried out. |
| @@ -789,6 +867,8 @@ void dpm_resume(pm_message_t state) | |||
| 789 | mutex_unlock(&dpm_list_mtx); | 867 | mutex_unlock(&dpm_list_mtx); |
| 790 | async_synchronize_full(); | 868 | async_synchronize_full(); |
| 791 | dpm_show_time(starttime, state, NULL); | 869 | dpm_show_time(starttime, state, NULL); |
| 870 | |||
| 871 | cpufreq_resume(); | ||
| 792 | } | 872 | } |
| 793 | 873 | ||
| 794 | /** | 874 | /** |
| @@ -913,13 +993,24 @@ static pm_message_t resume_event(pm_message_t sleep_state) | |||
| 913 | * The driver of @dev will not receive interrupts while this function is being | 993 | * The driver of @dev will not receive interrupts while this function is being |
| 914 | * executed. | 994 | * executed. |
| 915 | */ | 995 | */ |
| 916 | static int device_suspend_noirq(struct device *dev, pm_message_t state) | 996 | static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool async) |
| 917 | { | 997 | { |
| 918 | pm_callback_t callback = NULL; | 998 | pm_callback_t callback = NULL; |
| 919 | char *info = NULL; | 999 | char *info = NULL; |
| 1000 | int error = 0; | ||
| 1001 | |||
| 1002 | if (async_error) | ||
| 1003 | goto Complete; | ||
| 1004 | |||
| 1005 | if (pm_wakeup_pending()) { | ||
| 1006 | async_error = -EBUSY; | ||
| 1007 | goto Complete; | ||
| 1008 | } | ||
| 920 | 1009 | ||
| 921 | if (dev->power.syscore) | 1010 | if (dev->power.syscore) |
| 922 | return 0; | 1011 | goto Complete; |
| 1012 | |||
| 1013 | dpm_wait_for_children(dev, async); | ||
| 923 | 1014 | ||
| 924 | if (dev->pm_domain) { | 1015 | if (dev->pm_domain) { |
| 925 | info = "noirq power domain "; | 1016 | info = "noirq power domain "; |
| @@ -940,7 +1031,41 @@ static int device_suspend_noirq(struct device *dev, pm_message_t state) | |||
| 940 | callback = pm_noirq_op(dev->driver->pm, state); | 1031 | callback = pm_noirq_op(dev->driver->pm, state); |
| 941 | } | 1032 | } |
| 942 | 1033 | ||
| 943 | return dpm_run_callback(callback, dev, state, info); | 1034 | error = dpm_run_callback(callback, dev, state, info); |
| 1035 | if (!error) | ||
| 1036 | dev->power.is_noirq_suspended = true; | ||
| 1037 | else | ||
| 1038 | async_error = error; | ||
| 1039 | |||
| 1040 | Complete: | ||
| 1041 | complete_all(&dev->power.completion); | ||
| 1042 | return error; | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | static void async_suspend_noirq(void *data, async_cookie_t cookie) | ||
| 1046 | { | ||
| 1047 | struct device *dev = (struct device *)data; | ||
| 1048 | int error; | ||
| 1049 | |||
| 1050 | error = __device_suspend_noirq(dev, pm_transition, true); | ||
| 1051 | if (error) { | ||
| 1052 | dpm_save_failed_dev(dev_name(dev)); | ||
| 1053 | pm_dev_err(dev, pm_transition, " async", error); | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | put_device(dev); | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | static int device_suspend_noirq(struct device *dev) | ||
| 1060 | { | ||
| 1061 | reinit_completion(&dev->power.completion); | ||
| 1062 | |||
| 1063 | if (pm_async_enabled && dev->power.async_suspend) { | ||
| 1064 | get_device(dev); | ||
| 1065 | async_schedule(async_suspend_noirq, dev); | ||
| 1066 | return 0; | ||
| 1067 | } | ||
| 1068 | return __device_suspend_noirq(dev, pm_transition, false); | ||
| 944 | } | 1069 | } |
| 945 | 1070 | ||
| 946 | /** | 1071 | /** |
| @@ -958,19 +1083,20 @@ static int dpm_suspend_noirq(pm_message_t state) | |||
| 958 | cpuidle_pause(); | 1083 | cpuidle_pause(); |
| 959 | suspend_device_irqs(); | 1084 | suspend_device_irqs(); |
| 960 | mutex_lock(&dpm_list_mtx); | 1085 | mutex_lock(&dpm_list_mtx); |
| 1086 | pm_transition = state; | ||
| 1087 | async_error = 0; | ||
| 1088 | |||
| 961 | while (!list_empty(&dpm_late_early_list)) { | 1089 | while (!list_empty(&dpm_late_early_list)) { |
| 962 | struct device *dev = to_device(dpm_late_early_list.prev); | 1090 | struct device *dev = to_device(dpm_late_early_list.prev); |
| 963 | 1091 | ||
| 964 | get_device(dev); | 1092 | get_device(dev); |
| 965 | mutex_unlock(&dpm_list_mtx); | 1093 | mutex_unlock(&dpm_list_mtx); |
| 966 | 1094 | ||
| 967 | error = device_suspend_noirq(dev, state); | 1095 | error = device_suspend_noirq(dev); |
| 968 | 1096 | ||
| 969 | mutex_lock(&dpm_list_mtx); | 1097 | mutex_lock(&dpm_list_mtx); |
| 970 | if (error) { | 1098 | if (error) { |
| 971 | pm_dev_err(dev, state, " noirq", error); | 1099 | pm_dev_err(dev, state, " noirq", error); |
| 972 | suspend_stats.failed_suspend_noirq++; | ||
| 973 | dpm_save_failed_step(SUSPEND_SUSPEND_NOIRQ); | ||
| 974 | dpm_save_failed_dev(dev_name(dev)); | 1100 | dpm_save_failed_dev(dev_name(dev)); |
| 975 | put_device(dev); | 1101 | put_device(dev); |
| 976 | break; | 1102 | break; |
| @@ -979,16 +1105,21 @@ static int dpm_suspend_noirq(pm_message_t state) | |||
| 979 | list_move(&dev->power.entry, &dpm_noirq_list); | 1105 | list_move(&dev->power.entry, &dpm_noirq_list); |
| 980 | put_device(dev); | 1106 | put_device(dev); |
| 981 | 1107 | ||
| 982 | if (pm_wakeup_pending()) { | 1108 | if (async_error) |
| 983 | error = -EBUSY; | ||
| 984 | break; | 1109 | break; |
| 985 | } | ||
| 986 | } | 1110 | } |
| 987 | mutex_unlock(&dpm_list_mtx); | 1111 | mutex_unlock(&dpm_list_mtx); |
| 988 | if (error) | 1112 | async_synchronize_full(); |
| 1113 | if (!error) | ||
| 1114 | error = async_error; | ||
| 1115 | |||
| 1116 | if (error) { | ||
| 1117 | suspend_stats.failed_suspend_noirq++; | ||
| 1118 | dpm_save_failed_step(SUSPEND_SUSPEND_NOIRQ); | ||
| 989 | dpm_resume_noirq(resume_event(state)); | 1119 | dpm_resume_noirq(resume_event(state)); |
| 990 | else | 1120 | } else { |
| 991 | dpm_show_time(starttime, state, "noirq"); | 1121 | dpm_show_time(starttime, state, "noirq"); |
| 1122 | } | ||
| 992 | return error; | 1123 | return error; |
| 993 | } | 1124 | } |
| 994 | 1125 | ||
| @@ -999,15 +1130,26 @@ static int dpm_suspend_noirq(pm_message_t state) | |||
| 999 | * | 1130 | * |
| 1000 | * Runtime PM is disabled for @dev while this function is being executed. | 1131 | * Runtime PM is disabled for @dev while this function is being executed. |
| 1001 | */ | 1132 | */ |
| 1002 | static int device_suspend_late(struct device *dev, pm_message_t state) | 1133 | static int __device_suspend_late(struct device *dev, pm_message_t state, bool async) |
| 1003 | { | 1134 | { |
| 1004 | pm_callback_t callback = NULL; | 1135 | pm_callback_t callback = NULL; |
| 1005 | char *info = NULL; | 1136 | char *info = NULL; |
| 1137 | int error = 0; | ||
| 1006 | 1138 | ||
| 1007 | __pm_runtime_disable(dev, false); | 1139 | __pm_runtime_disable(dev, false); |
| 1008 | 1140 | ||
| 1141 | if (async_error) | ||
| 1142 | goto Complete; | ||
| 1143 | |||
| 1144 | if (pm_wakeup_pending()) { | ||
| 1145 | async_error = -EBUSY; | ||
| 1146 | goto Complete; | ||
| 1147 | } | ||
| 1148 | |||
| 1009 | if (dev->power.syscore) | 1149 | if (dev->power.syscore) |
| 1010 | return 0; | 1150 | goto Complete; |
| 1151 | |||
| 1152 | dpm_wait_for_children(dev, async); | ||
| 1011 | 1153 | ||
| 1012 | if (dev->pm_domain) { | 1154 | if (dev->pm_domain) { |
| 1013 | info = "late power domain "; | 1155 | info = "late power domain "; |
| @@ -1028,7 +1170,41 @@ static int device_suspend_late(struct device *dev, pm_message_t state) | |||
| 1028 | callback = pm_late_early_op(dev->driver->pm, state); | 1170 | callback = pm_late_early_op(dev->driver->pm, state); |
| 1029 | } | 1171 | } |
| 1030 | 1172 | ||
| 1031 | return dpm_run_callback(callback, dev, state, info); | 1173 | error = dpm_run_callback(callback, dev, state, info); |
| 1174 | if (!error) | ||
| 1175 | dev->power.is_late_suspended = true; | ||
| 1176 | else | ||
| 1177 | async_error = error; | ||
| 1178 | |||
| 1179 | Complete: | ||
| 1180 | complete_all(&dev->power.completion); | ||
| 1181 | return error; | ||
| 1182 | } | ||
| 1183 | |||
| 1184 | static void async_suspend_late(void *data, async_cookie_t cookie) | ||
| 1185 | { | ||
| 1186 | struct device *dev = (struct device *)data; | ||
| 1187 | int error; | ||
| 1188 | |||
| 1189 | error = __device_suspend_late(dev, pm_transition, true); | ||
| 1190 | if (error) { | ||
| 1191 | dpm_save_failed_dev(dev_name(dev)); | ||
| 1192 | pm_dev_err(dev, pm_transition, " async", error); | ||
| 1193 | } | ||
| 1194 | put_device(dev); | ||
| 1195 | } | ||
| 1196 | |||
| 1197 | static int device_suspend_late(struct device *dev) | ||
| 1198 | { | ||
| 1199 | reinit_completion(&dev->power.completion); | ||
| 1200 | |||
| 1201 | if (pm_async_enabled && dev->power.async_suspend) { | ||
| 1202 | get_device(dev); | ||
| 1203 | async_schedule(async_suspend_late, dev); | ||
| 1204 | return 0; | ||
| 1205 | } | ||
| 1206 | |||
| 1207 | return __device_suspend_late(dev, pm_transition, false); | ||
| 1032 | } | 1208 | } |
| 1033 | 1209 | ||
| 1034 | /** | 1210 | /** |
| @@ -1041,19 +1217,20 @@ static int dpm_suspend_late(pm_message_t state) | |||
| 1041 | int error = 0; | 1217 | int error = 0; |
| 1042 | 1218 | ||
| 1043 | mutex_lock(&dpm_list_mtx); | 1219 | mutex_lock(&dpm_list_mtx); |
| 1220 | pm_transition = state; | ||
| 1221 | async_error = 0; | ||
| 1222 | |||
| 1044 | while (!list_empty(&dpm_suspended_list)) { | 1223 | while (!list_empty(&dpm_suspended_list)) { |
| 1045 | struct device *dev = to_device(dpm_suspended_list.prev); | 1224 | struct device *dev = to_device(dpm_suspended_list.prev); |
| 1046 | 1225 | ||
| 1047 | get_device(dev); | 1226 | get_device(dev); |
| 1048 | mutex_unlock(&dpm_list_mtx); | 1227 | mutex_unlock(&dpm_list_mtx); |
| 1049 | 1228 | ||
| 1050 | error = device_suspend_late(dev, state); | 1229 | error = device_suspend_late(dev); |
| 1051 | 1230 | ||
| 1052 | mutex_lock(&dpm_list_mtx); | 1231 | mutex_lock(&dpm_list_mtx); |
| 1053 | if (error) { | 1232 | if (error) { |
| 1054 | pm_dev_err(dev, state, " late", error); | 1233 | pm_dev_err(dev, state, " late", error); |
| 1055 | suspend_stats.failed_suspend_late++; | ||
| 1056 | dpm_save_failed_step(SUSPEND_SUSPEND_LATE); | ||
| 1057 | dpm_save_failed_dev(dev_name(dev)); | 1234 | dpm_save_failed_dev(dev_name(dev)); |
| 1058 | put_device(dev); | 1235 | put_device(dev); |
| 1059 | break; | 1236 | break; |
| @@ -1062,17 +1239,18 @@ static int dpm_suspend_late(pm_message_t state) | |||
| 1062 | list_move(&dev->power.entry, &dpm_late_early_list); | 1239 | list_move(&dev->power.entry, &dpm_late_early_list); |
| 1063 | put_device(dev); | 1240 | put_device(dev); |
| 1064 | 1241 | ||
| 1065 | if (pm_wakeup_pending()) { | 1242 | if (async_error) |
| 1066 | error = -EBUSY; | ||
| 1067 | break; | 1243 | break; |
| 1068 | } | ||
| 1069 | } | 1244 | } |
| 1070 | mutex_unlock(&dpm_list_mtx); | 1245 | mutex_unlock(&dpm_list_mtx); |
| 1071 | if (error) | 1246 | async_synchronize_full(); |
| 1247 | if (error) { | ||
| 1248 | suspend_stats.failed_suspend_late++; | ||
| 1249 | dpm_save_failed_step(SUSPEND_SUSPEND_LATE); | ||
| 1072 | dpm_resume_early(resume_event(state)); | 1250 | dpm_resume_early(resume_event(state)); |
| 1073 | else | 1251 | } else { |
| 1074 | dpm_show_time(starttime, state, "late"); | 1252 | dpm_show_time(starttime, state, "late"); |
| 1075 | 1253 | } | |
| 1076 | return error; | 1254 | return error; |
| 1077 | } | 1255 | } |
| 1078 | 1256 | ||
| @@ -1259,6 +1437,8 @@ int dpm_suspend(pm_message_t state) | |||
| 1259 | 1437 | ||
| 1260 | might_sleep(); | 1438 | might_sleep(); |
| 1261 | 1439 | ||
| 1440 | cpufreq_suspend(); | ||
| 1441 | |||
| 1262 | mutex_lock(&dpm_list_mtx); | 1442 | mutex_lock(&dpm_list_mtx); |
| 1263 | pm_transition = state; | 1443 | pm_transition = state; |
| 1264 | async_error = 0; | 1444 | async_error = 0; |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index cfc3226ec492..a21223d95926 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
| @@ -89,8 +89,8 @@ extern void dpm_sysfs_remove(struct device *dev); | |||
| 89 | extern void rpm_sysfs_remove(struct device *dev); | 89 | extern void rpm_sysfs_remove(struct device *dev); |
| 90 | extern int wakeup_sysfs_add(struct device *dev); | 90 | extern int wakeup_sysfs_add(struct device *dev); |
| 91 | extern void wakeup_sysfs_remove(struct device *dev); | 91 | extern void wakeup_sysfs_remove(struct device *dev); |
| 92 | extern int pm_qos_sysfs_add_latency(struct device *dev); | 92 | extern int pm_qos_sysfs_add_resume_latency(struct device *dev); |
| 93 | extern void pm_qos_sysfs_remove_latency(struct device *dev); | 93 | extern void pm_qos_sysfs_remove_resume_latency(struct device *dev); |
| 94 | extern int pm_qos_sysfs_add_flags(struct device *dev); | 94 | extern int pm_qos_sysfs_add_flags(struct device *dev); |
| 95 | extern void pm_qos_sysfs_remove_flags(struct device *dev); | 95 | extern void pm_qos_sysfs_remove_flags(struct device *dev); |
| 96 | 96 | ||
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 5c1361a9e5dd..36b9eb4862cb 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c | |||
| @@ -105,7 +105,7 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_flags); | |||
| 105 | s32 __dev_pm_qos_read_value(struct device *dev) | 105 | s32 __dev_pm_qos_read_value(struct device *dev) |
| 106 | { | 106 | { |
| 107 | return IS_ERR_OR_NULL(dev->power.qos) ? | 107 | return IS_ERR_OR_NULL(dev->power.qos) ? |
| 108 | 0 : pm_qos_read_value(&dev->power.qos->latency); | 108 | 0 : pm_qos_read_value(&dev->power.qos->resume_latency); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | /** | 111 | /** |
| @@ -141,16 +141,24 @@ static int apply_constraint(struct dev_pm_qos_request *req, | |||
| 141 | int ret; | 141 | int ret; |
| 142 | 142 | ||
| 143 | switch(req->type) { | 143 | switch(req->type) { |
| 144 | case DEV_PM_QOS_LATENCY: | 144 | case DEV_PM_QOS_RESUME_LATENCY: |
| 145 | ret = pm_qos_update_target(&qos->latency, &req->data.pnode, | 145 | ret = pm_qos_update_target(&qos->resume_latency, |
| 146 | action, value); | 146 | &req->data.pnode, action, value); |
| 147 | if (ret) { | 147 | if (ret) { |
| 148 | value = pm_qos_read_value(&qos->latency); | 148 | value = pm_qos_read_value(&qos->resume_latency); |
| 149 | blocking_notifier_call_chain(&dev_pm_notifiers, | 149 | blocking_notifier_call_chain(&dev_pm_notifiers, |
| 150 | (unsigned long)value, | 150 | (unsigned long)value, |
| 151 | req); | 151 | req); |
| 152 | } | 152 | } |
| 153 | break; | 153 | break; |
| 154 | case DEV_PM_QOS_LATENCY_TOLERANCE: | ||
| 155 | ret = pm_qos_update_target(&qos->latency_tolerance, | ||
| 156 | &req->data.pnode, action, value); | ||
| 157 | if (ret) { | ||
| 158 | value = pm_qos_read_value(&qos->latency_tolerance); | ||
| 159 | req->dev->power.set_latency_tolerance(req->dev, value); | ||
| 160 | } | ||
| 161 | break; | ||
| 154 | case DEV_PM_QOS_FLAGS: | 162 | case DEV_PM_QOS_FLAGS: |
| 155 | ret = pm_qos_update_flags(&qos->flags, &req->data.flr, | 163 | ret = pm_qos_update_flags(&qos->flags, &req->data.flr, |
| 156 | action, value); | 164 | action, value); |
| @@ -186,13 +194,21 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) | |||
| 186 | } | 194 | } |
| 187 | BLOCKING_INIT_NOTIFIER_HEAD(n); | 195 | BLOCKING_INIT_NOTIFIER_HEAD(n); |
| 188 | 196 | ||
| 189 | c = &qos->latency; | 197 | c = &qos->resume_latency; |
| 190 | plist_head_init(&c->list); | 198 | plist_head_init(&c->list); |
| 191 | c->target_value = PM_QOS_DEV_LAT_DEFAULT_VALUE; | 199 | c->target_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; |
| 192 | c->default_value = PM_QOS_DEV_LAT_DEFAULT_VALUE; | 200 | c->default_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; |
| 201 | c->no_constraint_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; | ||
| 193 | c->type = PM_QOS_MIN; | 202 | c->type = PM_QOS_MIN; |
| 194 | c->notifiers = n; | 203 | c->notifiers = n; |
| 195 | 204 | ||
| 205 | c = &qos->latency_tolerance; | ||
| 206 | plist_head_init(&c->list); | ||
| 207 | c->target_value = PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE; | ||
| 208 | c->default_value = PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE; | ||
| 209 | c->no_constraint_value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; | ||
| 210 | c->type = PM_QOS_MIN; | ||
| 211 | |||
| 196 | INIT_LIST_HEAD(&qos->flags.list); | 212 | INIT_LIST_HEAD(&qos->flags.list); |
| 197 | 213 | ||
| 198 | spin_lock_irq(&dev->power.lock); | 214 | spin_lock_irq(&dev->power.lock); |
| @@ -224,7 +240,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
| 224 | * If the device's PM QoS resume latency limit or PM QoS flags have been | 240 | * If the device's PM QoS resume latency limit or PM QoS flags have been |
| 225 | * exposed to user space, they have to be hidden at this point. | 241 | * exposed to user space, they have to be hidden at this point. |
| 226 | */ | 242 | */ |
| 227 | pm_qos_sysfs_remove_latency(dev); | 243 | pm_qos_sysfs_remove_resume_latency(dev); |
| 228 | pm_qos_sysfs_remove_flags(dev); | 244 | pm_qos_sysfs_remove_flags(dev); |
| 229 | 245 | ||
| 230 | mutex_lock(&dev_pm_qos_mtx); | 246 | mutex_lock(&dev_pm_qos_mtx); |
| @@ -237,7 +253,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
| 237 | goto out; | 253 | goto out; |
| 238 | 254 | ||
| 239 | /* Flush the constraints lists for the device. */ | 255 | /* Flush the constraints lists for the device. */ |
| 240 | c = &qos->latency; | 256 | c = &qos->resume_latency; |
| 241 | plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { | 257 | plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { |
| 242 | /* | 258 | /* |
| 243 | * Update constraints list and call the notification | 259 | * Update constraints list and call the notification |
| @@ -246,6 +262,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
| 246 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); | 262 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); |
| 247 | memset(req, 0, sizeof(*req)); | 263 | memset(req, 0, sizeof(*req)); |
| 248 | } | 264 | } |
| 265 | c = &qos->latency_tolerance; | ||
| 266 | plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { | ||
| 267 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); | ||
| 268 | memset(req, 0, sizeof(*req)); | ||
| 269 | } | ||
| 249 | f = &qos->flags; | 270 | f = &qos->flags; |
| 250 | list_for_each_entry_safe(req, tmp, &f->list, data.flr.node) { | 271 | list_for_each_entry_safe(req, tmp, &f->list, data.flr.node) { |
| 251 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); | 272 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); |
| @@ -265,6 +286,40 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
| 265 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | 286 | mutex_unlock(&dev_pm_qos_sysfs_mtx); |
| 266 | } | 287 | } |
| 267 | 288 | ||
| 289 | static bool dev_pm_qos_invalid_request(struct device *dev, | ||
| 290 | struct dev_pm_qos_request *req) | ||
| 291 | { | ||
| 292 | return !req || (req->type == DEV_PM_QOS_LATENCY_TOLERANCE | ||
| 293 | && !dev->power.set_latency_tolerance); | ||
| 294 | } | ||
| 295 | |||
| 296 | static int __dev_pm_qos_add_request(struct device *dev, | ||
| 297 | struct dev_pm_qos_request *req, | ||
| 298 | enum dev_pm_qos_req_type type, s32 value) | ||
| 299 | { | ||
| 300 | int ret = 0; | ||
| 301 | |||
| 302 | if (!dev || dev_pm_qos_invalid_request(dev, req)) | ||
| 303 | return -EINVAL; | ||
| 304 | |||
| 305 | if (WARN(dev_pm_qos_request_active(req), | ||
| 306 | "%s() called for already added request\n", __func__)) | ||
| 307 | return -EINVAL; | ||
| 308 | |||
| 309 | if (IS_ERR(dev->power.qos)) | ||
| 310 | ret = -ENODEV; | ||
| 311 | else if (!dev->power.qos) | ||
| 312 | ret = dev_pm_qos_constraints_allocate(dev); | ||
| 313 | |||
| 314 | trace_dev_pm_qos_add_request(dev_name(dev), type, value); | ||
| 315 | if (!ret) { | ||
| 316 | req->dev = dev; | ||
| 317 | req->type = type; | ||
| 318 | ret = apply_constraint(req, PM_QOS_ADD_REQ, value); | ||
| 319 | } | ||
| 320 | return ret; | ||
| 321 | } | ||
| 322 | |||
| 268 | /** | 323 | /** |
| 269 | * dev_pm_qos_add_request - inserts new qos request into the list | 324 | * dev_pm_qos_add_request - inserts new qos request into the list |
| 270 | * @dev: target device for the constraint | 325 | * @dev: target device for the constraint |
| @@ -290,31 +345,11 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
| 290 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, | 345 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, |
| 291 | enum dev_pm_qos_req_type type, s32 value) | 346 | enum dev_pm_qos_req_type type, s32 value) |
| 292 | { | 347 | { |
| 293 | int ret = 0; | 348 | int ret; |
| 294 | |||
| 295 | if (!dev || !req) /*guard against callers passing in null */ | ||
| 296 | return -EINVAL; | ||
| 297 | |||
| 298 | if (WARN(dev_pm_qos_request_active(req), | ||
| 299 | "%s() called for already added request\n", __func__)) | ||
| 300 | return -EINVAL; | ||
| 301 | 349 | ||
| 302 | mutex_lock(&dev_pm_qos_mtx); | 350 | mutex_lock(&dev_pm_qos_mtx); |
| 303 | 351 | ret = __dev_pm_qos_add_request(dev, req, type, value); | |
| 304 | if (IS_ERR(dev->power.qos)) | ||
| 305 | ret = -ENODEV; | ||
| 306 | else if (!dev->power.qos) | ||
| 307 | ret = dev_pm_qos_constraints_allocate(dev); | ||
| 308 | |||
| 309 | trace_dev_pm_qos_add_request(dev_name(dev), type, value); | ||
| 310 | if (!ret) { | ||
| 311 | req->dev = dev; | ||
| 312 | req->type = type; | ||
| 313 | ret = apply_constraint(req, PM_QOS_ADD_REQ, value); | ||
| 314 | } | ||
| 315 | |||
| 316 | mutex_unlock(&dev_pm_qos_mtx); | 352 | mutex_unlock(&dev_pm_qos_mtx); |
| 317 | |||
| 318 | return ret; | 353 | return ret; |
| 319 | } | 354 | } |
| 320 | EXPORT_SYMBOL_GPL(dev_pm_qos_add_request); | 355 | EXPORT_SYMBOL_GPL(dev_pm_qos_add_request); |
| @@ -341,7 +376,8 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req, | |||
| 341 | return -ENODEV; | 376 | return -ENODEV; |
| 342 | 377 | ||
| 343 | switch(req->type) { | 378 | switch(req->type) { |
| 344 | case DEV_PM_QOS_LATENCY: | 379 | case DEV_PM_QOS_RESUME_LATENCY: |
| 380 | case DEV_PM_QOS_LATENCY_TOLERANCE: | ||
| 345 | curr_value = req->data.pnode.prio; | 381 | curr_value = req->data.pnode.prio; |
| 346 | break; | 382 | break; |
| 347 | case DEV_PM_QOS_FLAGS: | 383 | case DEV_PM_QOS_FLAGS: |
| @@ -460,8 +496,8 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier) | |||
| 460 | ret = dev_pm_qos_constraints_allocate(dev); | 496 | ret = dev_pm_qos_constraints_allocate(dev); |
| 461 | 497 | ||
| 462 | if (!ret) | 498 | if (!ret) |
| 463 | ret = blocking_notifier_chain_register( | 499 | ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers, |
| 464 | dev->power.qos->latency.notifiers, notifier); | 500 | notifier); |
| 465 | 501 | ||
| 466 | mutex_unlock(&dev_pm_qos_mtx); | 502 | mutex_unlock(&dev_pm_qos_mtx); |
| 467 | return ret; | 503 | return ret; |
| @@ -487,9 +523,8 @@ int dev_pm_qos_remove_notifier(struct device *dev, | |||
| 487 | 523 | ||
| 488 | /* Silently return if the constraints object is not present. */ | 524 | /* Silently return if the constraints object is not present. */ |
| 489 | if (!IS_ERR_OR_NULL(dev->power.qos)) | 525 | if (!IS_ERR_OR_NULL(dev->power.qos)) |
| 490 | retval = blocking_notifier_chain_unregister( | 526 | retval = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers, |
| 491 | dev->power.qos->latency.notifiers, | 527 | notifier); |
| 492 | notifier); | ||
| 493 | 528 | ||
| 494 | mutex_unlock(&dev_pm_qos_mtx); | 529 | mutex_unlock(&dev_pm_qos_mtx); |
| 495 | return retval; | 530 | return retval; |
| @@ -530,20 +565,32 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_remove_global_notifier); | |||
| 530 | * dev_pm_qos_add_ancestor_request - Add PM QoS request for device's ancestor. | 565 | * dev_pm_qos_add_ancestor_request - Add PM QoS request for device's ancestor. |
| 531 | * @dev: Device whose ancestor to add the request for. | 566 | * @dev: Device whose ancestor to add the request for. |
| 532 | * @req: Pointer to the preallocated handle. | 567 | * @req: Pointer to the preallocated handle. |
| 568 | * @type: Type of the request. | ||
| 533 | * @value: Constraint latency value. | 569 | * @value: Constraint latency value. |
| 534 | */ | 570 | */ |
| 535 | int dev_pm_qos_add_ancestor_request(struct device *dev, | 571 | int dev_pm_qos_add_ancestor_request(struct device *dev, |
| 536 | struct dev_pm_qos_request *req, s32 value) | 572 | struct dev_pm_qos_request *req, |
| 573 | enum dev_pm_qos_req_type type, s32 value) | ||
| 537 | { | 574 | { |
| 538 | struct device *ancestor = dev->parent; | 575 | struct device *ancestor = dev->parent; |
| 539 | int ret = -ENODEV; | 576 | int ret = -ENODEV; |
| 540 | 577 | ||
| 541 | while (ancestor && !ancestor->power.ignore_children) | 578 | switch (type) { |
| 542 | ancestor = ancestor->parent; | 579 | case DEV_PM_QOS_RESUME_LATENCY: |
| 580 | while (ancestor && !ancestor->power.ignore_children) | ||
| 581 | ancestor = ancestor->parent; | ||
| 543 | 582 | ||
| 583 | break; | ||
| 584 | case DEV_PM_QOS_LATENCY_TOLERANCE: | ||
| 585 | while (ancestor && !ancestor->power.set_latency_tolerance) | ||
| 586 | ancestor = ancestor->parent; | ||
| 587 | |||
| 588 | break; | ||
| 589 | default: | ||
| 590 | ancestor = NULL; | ||
| 591 | } | ||
| 544 | if (ancestor) | 592 | if (ancestor) |
| 545 | ret = dev_pm_qos_add_request(ancestor, req, | 593 | ret = dev_pm_qos_add_request(ancestor, req, type, value); |
| 546 | DEV_PM_QOS_LATENCY, value); | ||
| 547 | 594 | ||
| 548 | if (ret < 0) | 595 | if (ret < 0) |
| 549 | req->dev = NULL; | 596 | req->dev = NULL; |
| @@ -559,9 +606,13 @@ static void __dev_pm_qos_drop_user_request(struct device *dev, | |||
| 559 | struct dev_pm_qos_request *req = NULL; | 606 | struct dev_pm_qos_request *req = NULL; |
| 560 | 607 | ||
| 561 | switch(type) { | 608 | switch(type) { |
| 562 | case DEV_PM_QOS_LATENCY: | 609 | case DEV_PM_QOS_RESUME_LATENCY: |
| 563 | req = dev->power.qos->latency_req; | 610 | req = dev->power.qos->resume_latency_req; |
| 564 | dev->power.qos->latency_req = NULL; | 611 | dev->power.qos->resume_latency_req = NULL; |
| 612 | break; | ||
| 613 | case DEV_PM_QOS_LATENCY_TOLERANCE: | ||
| 614 | req = dev->power.qos->latency_tolerance_req; | ||
| 615 | dev->power.qos->latency_tolerance_req = NULL; | ||
| 565 | break; | 616 | break; |
| 566 | case DEV_PM_QOS_FLAGS: | 617 | case DEV_PM_QOS_FLAGS: |
| 567 | req = dev->power.qos->flags_req; | 618 | req = dev->power.qos->flags_req; |
| @@ -597,7 +648,7 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | |||
| 597 | if (!req) | 648 | if (!req) |
| 598 | return -ENOMEM; | 649 | return -ENOMEM; |
| 599 | 650 | ||
| 600 | ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_LATENCY, value); | 651 | ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_RESUME_LATENCY, value); |
| 601 | if (ret < 0) { | 652 | if (ret < 0) { |
| 602 | kfree(req); | 653 | kfree(req); |
| 603 | return ret; | 654 | return ret; |
| @@ -609,7 +660,7 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | |||
| 609 | 660 | ||
| 610 | if (IS_ERR_OR_NULL(dev->power.qos)) | 661 | if (IS_ERR_OR_NULL(dev->power.qos)) |
| 611 | ret = -ENODEV; | 662 | ret = -ENODEV; |
| 612 | else if (dev->power.qos->latency_req) | 663 | else if (dev->power.qos->resume_latency_req) |
| 613 | ret = -EEXIST; | 664 | ret = -EEXIST; |
| 614 | 665 | ||
| 615 | if (ret < 0) { | 666 | if (ret < 0) { |
| @@ -618,13 +669,13 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | |||
| 618 | mutex_unlock(&dev_pm_qos_mtx); | 669 | mutex_unlock(&dev_pm_qos_mtx); |
| 619 | goto out; | 670 | goto out; |
| 620 | } | 671 | } |
| 621 | dev->power.qos->latency_req = req; | 672 | dev->power.qos->resume_latency_req = req; |
| 622 | 673 | ||
| 623 | mutex_unlock(&dev_pm_qos_mtx); | 674 | mutex_unlock(&dev_pm_qos_mtx); |
| 624 | 675 | ||
| 625 | ret = pm_qos_sysfs_add_latency(dev); | 676 | ret = pm_qos_sysfs_add_resume_latency(dev); |
| 626 | if (ret) | 677 | if (ret) |
| 627 | dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); | 678 | dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_RESUME_LATENCY); |
| 628 | 679 | ||
| 629 | out: | 680 | out: |
| 630 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | 681 | mutex_unlock(&dev_pm_qos_sysfs_mtx); |
| @@ -634,8 +685,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); | |||
| 634 | 685 | ||
| 635 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) | 686 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) |
| 636 | { | 687 | { |
| 637 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) | 688 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->resume_latency_req) |
| 638 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); | 689 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_RESUME_LATENCY); |
| 639 | } | 690 | } |
| 640 | 691 | ||
| 641 | /** | 692 | /** |
| @@ -646,7 +697,7 @@ void dev_pm_qos_hide_latency_limit(struct device *dev) | |||
| 646 | { | 697 | { |
| 647 | mutex_lock(&dev_pm_qos_sysfs_mtx); | 698 | mutex_lock(&dev_pm_qos_sysfs_mtx); |
| 648 | 699 | ||
| 649 | pm_qos_sysfs_remove_latency(dev); | 700 | pm_qos_sysfs_remove_resume_latency(dev); |
| 650 | 701 | ||
| 651 | mutex_lock(&dev_pm_qos_mtx); | 702 | mutex_lock(&dev_pm_qos_mtx); |
| 652 | __dev_pm_qos_hide_latency_limit(dev); | 703 | __dev_pm_qos_hide_latency_limit(dev); |
| @@ -768,6 +819,67 @@ int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set) | |||
| 768 | pm_runtime_put(dev); | 819 | pm_runtime_put(dev); |
| 769 | return ret; | 820 | return ret; |
| 770 | } | 821 | } |
| 822 | |||
| 823 | /** | ||
| 824 | * dev_pm_qos_get_user_latency_tolerance - Get user space latency tolerance. | ||
| 825 | * @dev: Device to obtain the user space latency tolerance for. | ||
| 826 | */ | ||
| 827 | s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev) | ||
| 828 | { | ||
| 829 | s32 ret; | ||
| 830 | |||
| 831 | mutex_lock(&dev_pm_qos_mtx); | ||
| 832 | ret = IS_ERR_OR_NULL(dev->power.qos) | ||
| 833 | || !dev->power.qos->latency_tolerance_req ? | ||
| 834 | PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT : | ||
| 835 | dev->power.qos->latency_tolerance_req->data.pnode.prio; | ||
| 836 | mutex_unlock(&dev_pm_qos_mtx); | ||
| 837 | return ret; | ||
| 838 | } | ||
| 839 | |||
| 840 | /** | ||
| 841 | * dev_pm_qos_update_user_latency_tolerance - Update user space latency tolerance. | ||
| 842 | * @dev: Device to update the user space latency tolerance for. | ||
| 843 | * @val: New user space latency tolerance for @dev (negative values disable). | ||
| 844 | */ | ||
| 845 | int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val) | ||
| 846 | { | ||
| 847 | int ret; | ||
| 848 | |||
| 849 | mutex_lock(&dev_pm_qos_mtx); | ||
| 850 | |||
| 851 | if (IS_ERR_OR_NULL(dev->power.qos) | ||
| 852 | || !dev->power.qos->latency_tolerance_req) { | ||
| 853 | struct dev_pm_qos_request *req; | ||
| 854 | |||
| 855 | if (val < 0) { | ||
| 856 | ret = -EINVAL; | ||
| 857 | goto out; | ||
| 858 | } | ||
| 859 | req = kzalloc(sizeof(*req), GFP_KERNEL); | ||
| 860 | if (!req) { | ||
| 861 | ret = -ENOMEM; | ||
| 862 | goto out; | ||
| 863 | } | ||
| 864 | ret = __dev_pm_qos_add_request(dev, req, DEV_PM_QOS_LATENCY_TOLERANCE, val); | ||
| 865 | if (ret < 0) { | ||
| 866 | kfree(req); | ||
| 867 | goto out; | ||
| 868 | } | ||
| 869 | dev->power.qos->latency_tolerance_req = req; | ||
| 870 | } else { | ||
| 871 | if (val < 0) { | ||
| 872 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY_TOLERANCE); | ||
| 873 | ret = 0; | ||
| 874 | } else { | ||
| 875 | ret = __dev_pm_qos_update_request(dev->power.qos->latency_tolerance_req, val); | ||
| 876 | } | ||
| 877 | } | ||
| 878 | |||
| 879 | out: | ||
| 880 | mutex_unlock(&dev_pm_qos_mtx); | ||
| 881 | return ret; | ||
| 882 | } | ||
| 771 | #else /* !CONFIG_PM_RUNTIME */ | 883 | #else /* !CONFIG_PM_RUNTIME */ |
| 772 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) {} | 884 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) {} |
| 773 | static void __dev_pm_qos_hide_flags(struct device *dev) {} | 885 | static void __dev_pm_qos_hide_flags(struct device *dev) {} |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 72e00e66ecc5..67c7938e430b 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
| @@ -13,6 +13,43 @@ | |||
| 13 | #include <trace/events/rpm.h> | 13 | #include <trace/events/rpm.h> |
| 14 | #include "power.h" | 14 | #include "power.h" |
| 15 | 15 | ||
| 16 | #define RPM_GET_CALLBACK(dev, cb) \ | ||
| 17 | ({ \ | ||
| 18 | int (*__rpm_cb)(struct device *__d); \ | ||
| 19 | \ | ||
| 20 | if (dev->pm_domain) \ | ||
| 21 | __rpm_cb = dev->pm_domain->ops.cb; \ | ||
| 22 | else if (dev->type && dev->type->pm) \ | ||
| 23 | __rpm_cb = dev->type->pm->cb; \ | ||
| 24 | else if (dev->class && dev->class->pm) \ | ||
| 25 | __rpm_cb = dev->class->pm->cb; \ | ||
| 26 | else if (dev->bus && dev->bus->pm) \ | ||
| 27 | __rpm_cb = dev->bus->pm->cb; \ | ||
| 28 | else \ | ||
| 29 | __rpm_cb = NULL; \ | ||
| 30 | \ | ||
| 31 | if (!__rpm_cb && dev->driver && dev->driver->pm) \ | ||
| 32 | __rpm_cb = dev->driver->pm->cb; \ | ||
| 33 | \ | ||
| 34 | __rpm_cb; \ | ||
| 35 | }) | ||
| 36 | |||
| 37 | static int (*rpm_get_suspend_cb(struct device *dev))(struct device *) | ||
| 38 | { | ||
| 39 | return RPM_GET_CALLBACK(dev, runtime_suspend); | ||
| 40 | } | ||
| 41 | |||
| 42 | static int (*rpm_get_resume_cb(struct device *dev))(struct device *) | ||
| 43 | { | ||
| 44 | return RPM_GET_CALLBACK(dev, runtime_resume); | ||
| 45 | } | ||
| 46 | |||
| 47 | #ifdef CONFIG_PM_RUNTIME | ||
| 48 | static int (*rpm_get_idle_cb(struct device *dev))(struct device *) | ||
| 49 | { | ||
| 50 | return RPM_GET_CALLBACK(dev, runtime_idle); | ||
| 51 | } | ||
| 52 | |||
| 16 | static int rpm_resume(struct device *dev, int rpmflags); | 53 | static int rpm_resume(struct device *dev, int rpmflags); |
| 17 | static int rpm_suspend(struct device *dev, int rpmflags); | 54 | static int rpm_suspend(struct device *dev, int rpmflags); |
| 18 | 55 | ||
| @@ -310,19 +347,7 @@ static int rpm_idle(struct device *dev, int rpmflags) | |||
| 310 | 347 | ||
| 311 | dev->power.idle_notification = true; | 348 | dev->power.idle_notification = true; |
| 312 | 349 | ||
| 313 | if (dev->pm_domain) | 350 | callback = rpm_get_idle_cb(dev); |
| 314 | callback = dev->pm_domain->ops.runtime_idle; | ||
| 315 | else if (dev->type && dev->type->pm) | ||
| 316 | callback = dev->type->pm->runtime_idle; | ||
| 317 | else if (dev->class && dev->class->pm) | ||
| 318 | callback = dev->class->pm->runtime_idle; | ||
| 319 | else if (dev->bus && dev->bus->pm) | ||
| 320 | callback = dev->bus->pm->runtime_idle; | ||
| 321 | else | ||
| 322 | callback = NULL; | ||
| 323 | |||
| 324 | if (!callback && dev->driver && dev->driver->pm) | ||
| 325 | callback = dev->driver->pm->runtime_idle; | ||
| 326 | 351 | ||
| 327 | if (callback) | 352 | if (callback) |
| 328 | retval = __rpm_callback(callback, dev); | 353 | retval = __rpm_callback(callback, dev); |
| @@ -492,19 +517,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
| 492 | 517 | ||
| 493 | __update_runtime_status(dev, RPM_SUSPENDING); | 518 | __update_runtime_status(dev, RPM_SUSPENDING); |
| 494 | 519 | ||
| 495 | if (dev->pm_domain) | 520 | callback = rpm_get_suspend_cb(dev); |
| 496 | callback = dev->pm_domain->ops.runtime_suspend; | ||
| 497 | else if (dev->type && dev->type->pm) | ||
| 498 | callback = dev->type->pm->runtime_suspend; | ||
| 499 | else if (dev->class && dev->class->pm) | ||
| 500 | callback = dev->class->pm->runtime_suspend; | ||
| 501 | else if (dev->bus && dev->bus->pm) | ||
| 502 | callback = dev->bus->pm->runtime_suspend; | ||
| 503 | else | ||
| 504 | callback = NULL; | ||
| 505 | |||
| 506 | if (!callback && dev->driver && dev->driver->pm) | ||
| 507 | callback = dev->driver->pm->runtime_suspend; | ||
| 508 | 521 | ||
| 509 | retval = rpm_callback(callback, dev); | 522 | retval = rpm_callback(callback, dev); |
| 510 | if (retval) | 523 | if (retval) |
| @@ -724,19 +737,7 @@ static int rpm_resume(struct device *dev, int rpmflags) | |||
| 724 | 737 | ||
| 725 | __update_runtime_status(dev, RPM_RESUMING); | 738 | __update_runtime_status(dev, RPM_RESUMING); |
| 726 | 739 | ||
| 727 | if (dev->pm_domain) | 740 | callback = rpm_get_resume_cb(dev); |
| 728 | callback = dev->pm_domain->ops.runtime_resume; | ||
| 729 | else if (dev->type && dev->type->pm) | ||
| 730 | callback = dev->type->pm->runtime_resume; | ||
| 731 | else if (dev->class && dev->class->pm) | ||
| 732 | callback = dev->class->pm->runtime_resume; | ||
| 733 | else if (dev->bus && dev->bus->pm) | ||
| 734 | callback = dev->bus->pm->runtime_resume; | ||
| 735 | else | ||
| 736 | callback = NULL; | ||
| 737 | |||
| 738 | if (!callback && dev->driver && dev->driver->pm) | ||
| 739 | callback = dev->driver->pm->runtime_resume; | ||
| 740 | 741 | ||
| 741 | retval = rpm_callback(callback, dev); | 742 | retval = rpm_callback(callback, dev); |
| 742 | if (retval) { | 743 | if (retval) { |
| @@ -1130,7 +1131,7 @@ EXPORT_SYMBOL_GPL(pm_runtime_barrier); | |||
| 1130 | * @dev: Device to handle. | 1131 | * @dev: Device to handle. |
| 1131 | * @check_resume: If set, check if there's a resume request for the device. | 1132 | * @check_resume: If set, check if there's a resume request for the device. |
| 1132 | * | 1133 | * |
| 1133 | * Increment power.disable_depth for the device and if was zero previously, | 1134 | * Increment power.disable_depth for the device and if it was zero previously, |
| 1134 | * cancel all pending runtime PM requests for the device and wait for all | 1135 | * cancel all pending runtime PM requests for the device and wait for all |
| 1135 | * operations in progress to complete. The device can be either active or | 1136 | * operations in progress to complete. The device can be either active or |
| 1136 | * suspended after its runtime PM has been disabled. | 1137 | * suspended after its runtime PM has been disabled. |
| @@ -1401,3 +1402,86 @@ void pm_runtime_remove(struct device *dev) | |||
| 1401 | if (dev->power.irq_safe && dev->parent) | 1402 | if (dev->power.irq_safe && dev->parent) |
| 1402 | pm_runtime_put(dev->parent); | 1403 | pm_runtime_put(dev->parent); |
| 1403 | } | 1404 | } |
| 1405 | #endif | ||
| 1406 | |||
| 1407 | /** | ||
| 1408 | * pm_runtime_force_suspend - Force a device into suspend state if needed. | ||
| 1409 | * @dev: Device to suspend. | ||
| 1410 | * | ||
| 1411 | * Disable runtime PM so we safely can check the device's runtime PM status and | ||
| 1412 | * if it is active, invoke it's .runtime_suspend callback to bring it into | ||
| 1413 | * suspend state. Keep runtime PM disabled to preserve the state unless we | ||
| 1414 | * encounter errors. | ||
| 1415 | * | ||
| 1416 | * Typically this function may be invoked from a system suspend callback to make | ||
| 1417 | * sure the device is put into low power state. | ||
| 1418 | */ | ||
| 1419 | int pm_runtime_force_suspend(struct device *dev) | ||
| 1420 | { | ||
| 1421 | int (*callback)(struct device *); | ||
| 1422 | int ret = 0; | ||
| 1423 | |||
| 1424 | pm_runtime_disable(dev); | ||
| 1425 | |||
| 1426 | /* | ||
| 1427 | * Note that pm_runtime_status_suspended() returns false while | ||
| 1428 | * !CONFIG_PM_RUNTIME, which means the device will be put into low | ||
| 1429 | * power state. | ||
| 1430 | */ | ||
| 1431 | if (pm_runtime_status_suspended(dev)) | ||
| 1432 | return 0; | ||
| 1433 | |||
| 1434 | callback = rpm_get_suspend_cb(dev); | ||
| 1435 | |||
| 1436 | if (!callback) { | ||
| 1437 | ret = -ENOSYS; | ||
| 1438 | goto err; | ||
| 1439 | } | ||
| 1440 | |||
| 1441 | ret = callback(dev); | ||
| 1442 | if (ret) | ||
| 1443 | goto err; | ||
| 1444 | |||
| 1445 | pm_runtime_set_suspended(dev); | ||
| 1446 | return 0; | ||
| 1447 | err: | ||
| 1448 | pm_runtime_enable(dev); | ||
| 1449 | return ret; | ||
| 1450 | } | ||
| 1451 | EXPORT_SYMBOL_GPL(pm_runtime_force_suspend); | ||
| 1452 | |||
| 1453 | /** | ||
| 1454 | * pm_runtime_force_resume - Force a device into resume state. | ||
| 1455 | * @dev: Device to resume. | ||
| 1456 | * | ||
| 1457 | * Prior invoking this function we expect the user to have brought the device | ||
| 1458 | * into low power state by a call to pm_runtime_force_suspend(). Here we reverse | ||
| 1459 | * those actions and brings the device into full power. We update the runtime PM | ||
| 1460 | * status and re-enables runtime PM. | ||
| 1461 | * | ||
| 1462 | * Typically this function may be invoked from a system resume callback to make | ||
| 1463 | * sure the device is put into full power state. | ||
| 1464 | */ | ||
| 1465 | int pm_runtime_force_resume(struct device *dev) | ||
| 1466 | { | ||
| 1467 | int (*callback)(struct device *); | ||
| 1468 | int ret = 0; | ||
| 1469 | |||
| 1470 | callback = rpm_get_resume_cb(dev); | ||
| 1471 | |||
| 1472 | if (!callback) { | ||
| 1473 | ret = -ENOSYS; | ||
| 1474 | goto out; | ||
| 1475 | } | ||
| 1476 | |||
| 1477 | ret = callback(dev); | ||
| 1478 | if (ret) | ||
| 1479 | goto out; | ||
| 1480 | |||
| 1481 | pm_runtime_set_active(dev); | ||
| 1482 | pm_runtime_mark_last_busy(dev); | ||
| 1483 | out: | ||
| 1484 | pm_runtime_enable(dev); | ||
| 1485 | return ret; | ||
| 1486 | } | ||
| 1487 | EXPORT_SYMBOL_GPL(pm_runtime_force_resume); | ||
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 03e089ade5ce..95b181d1ca6d 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c | |||
| @@ -218,15 +218,16 @@ static ssize_t autosuspend_delay_ms_store(struct device *dev, | |||
| 218 | static DEVICE_ATTR(autosuspend_delay_ms, 0644, autosuspend_delay_ms_show, | 218 | static DEVICE_ATTR(autosuspend_delay_ms, 0644, autosuspend_delay_ms_show, |
| 219 | autosuspend_delay_ms_store); | 219 | autosuspend_delay_ms_store); |
| 220 | 220 | ||
| 221 | static ssize_t pm_qos_latency_show(struct device *dev, | 221 | static ssize_t pm_qos_resume_latency_show(struct device *dev, |
| 222 | struct device_attribute *attr, char *buf) | 222 | struct device_attribute *attr, |
| 223 | char *buf) | ||
| 223 | { | 224 | { |
| 224 | return sprintf(buf, "%d\n", dev_pm_qos_requested_latency(dev)); | 225 | return sprintf(buf, "%d\n", dev_pm_qos_requested_resume_latency(dev)); |
| 225 | } | 226 | } |
| 226 | 227 | ||
| 227 | static ssize_t pm_qos_latency_store(struct device *dev, | 228 | static ssize_t pm_qos_resume_latency_store(struct device *dev, |
| 228 | struct device_attribute *attr, | 229 | struct device_attribute *attr, |
| 229 | const char *buf, size_t n) | 230 | const char *buf, size_t n) |
| 230 | { | 231 | { |
| 231 | s32 value; | 232 | s32 value; |
| 232 | int ret; | 233 | int ret; |
| @@ -237,12 +238,47 @@ static ssize_t pm_qos_latency_store(struct device *dev, | |||
| 237 | if (value < 0) | 238 | if (value < 0) |
| 238 | return -EINVAL; | 239 | return -EINVAL; |
| 239 | 240 | ||
| 240 | ret = dev_pm_qos_update_request(dev->power.qos->latency_req, value); | 241 | ret = dev_pm_qos_update_request(dev->power.qos->resume_latency_req, |
| 242 | value); | ||
| 241 | return ret < 0 ? ret : n; | 243 | return ret < 0 ? ret : n; |
| 242 | } | 244 | } |
| 243 | 245 | ||
| 244 | static DEVICE_ATTR(pm_qos_resume_latency_us, 0644, | 246 | static DEVICE_ATTR(pm_qos_resume_latency_us, 0644, |
| 245 | pm_qos_latency_show, pm_qos_latency_store); | 247 | pm_qos_resume_latency_show, pm_qos_resume_latency_store); |
| 248 | |||
| 249 | static ssize_t pm_qos_latency_tolerance_show(struct device *dev, | ||
| 250 | struct device_attribute *attr, | ||
| 251 | char *buf) | ||
| 252 | { | ||
| 253 | s32 value = dev_pm_qos_get_user_latency_tolerance(dev); | ||
| 254 | |||
| 255 | if (value < 0) | ||
| 256 | return sprintf(buf, "auto\n"); | ||
| 257 | else if (value == PM_QOS_LATENCY_ANY) | ||
| 258 | return sprintf(buf, "any\n"); | ||
| 259 | |||
| 260 | return sprintf(buf, "%d\n", value); | ||
| 261 | } | ||
| 262 | |||
| 263 | static ssize_t pm_qos_latency_tolerance_store(struct device *dev, | ||
| 264 | struct device_attribute *attr, | ||
| 265 | const char *buf, size_t n) | ||
| 266 | { | ||
| 267 | s32 value; | ||
| 268 | int ret; | ||
| 269 | |||
| 270 | if (kstrtos32(buf, 0, &value)) { | ||
| 271 | if (!strcmp(buf, "auto") || !strcmp(buf, "auto\n")) | ||
| 272 | value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; | ||
| 273 | else if (!strcmp(buf, "any") || !strcmp(buf, "any\n")) | ||
| 274 | value = PM_QOS_LATENCY_ANY; | ||
| 275 | } | ||
| 276 | ret = dev_pm_qos_update_user_latency_tolerance(dev, value); | ||
| 277 | return ret < 0 ? ret : n; | ||
| 278 | } | ||
| 279 | |||
| 280 | static DEVICE_ATTR(pm_qos_latency_tolerance_us, 0644, | ||
| 281 | pm_qos_latency_tolerance_show, pm_qos_latency_tolerance_store); | ||
| 246 | 282 | ||
| 247 | static ssize_t pm_qos_no_power_off_show(struct device *dev, | 283 | static ssize_t pm_qos_no_power_off_show(struct device *dev, |
| 248 | struct device_attribute *attr, | 284 | struct device_attribute *attr, |
| @@ -618,15 +654,26 @@ static struct attribute_group pm_runtime_attr_group = { | |||
| 618 | .attrs = runtime_attrs, | 654 | .attrs = runtime_attrs, |
| 619 | }; | 655 | }; |
| 620 | 656 | ||
| 621 | static struct attribute *pm_qos_latency_attrs[] = { | 657 | static struct attribute *pm_qos_resume_latency_attrs[] = { |
| 622 | #ifdef CONFIG_PM_RUNTIME | 658 | #ifdef CONFIG_PM_RUNTIME |
| 623 | &dev_attr_pm_qos_resume_latency_us.attr, | 659 | &dev_attr_pm_qos_resume_latency_us.attr, |
| 624 | #endif /* CONFIG_PM_RUNTIME */ | 660 | #endif /* CONFIG_PM_RUNTIME */ |
| 625 | NULL, | 661 | NULL, |
| 626 | }; | 662 | }; |
| 627 | static struct attribute_group pm_qos_latency_attr_group = { | 663 | static struct attribute_group pm_qos_resume_latency_attr_group = { |
| 664 | .name = power_group_name, | ||
| 665 | .attrs = pm_qos_resume_latency_attrs, | ||
| 666 | }; | ||
| 667 | |||
| 668 | static struct attribute *pm_qos_latency_tolerance_attrs[] = { | ||
| 669 | #ifdef CONFIG_PM_RUNTIME | ||
| 670 | &dev_attr_pm_qos_latency_tolerance_us.attr, | ||
| 671 | #endif /* CONFIG_PM_RUNTIME */ | ||
| 672 | NULL, | ||
| 673 | }; | ||
| 674 | static struct attribute_group pm_qos_latency_tolerance_attr_group = { | ||
| 628 | .name = power_group_name, | 675 | .name = power_group_name, |
| 629 | .attrs = pm_qos_latency_attrs, | 676 | .attrs = pm_qos_latency_tolerance_attrs, |
| 630 | }; | 677 | }; |
| 631 | 678 | ||
| 632 | static struct attribute *pm_qos_flags_attrs[] = { | 679 | static struct attribute *pm_qos_flags_attrs[] = { |
| @@ -654,18 +701,23 @@ int dpm_sysfs_add(struct device *dev) | |||
| 654 | if (rc) | 701 | if (rc) |
| 655 | goto err_out; | 702 | goto err_out; |
| 656 | } | 703 | } |
| 657 | |||
| 658 | if (device_can_wakeup(dev)) { | 704 | if (device_can_wakeup(dev)) { |
| 659 | rc = sysfs_merge_group(&dev->kobj, &pm_wakeup_attr_group); | 705 | rc = sysfs_merge_group(&dev->kobj, &pm_wakeup_attr_group); |
| 660 | if (rc) { | 706 | if (rc) |
| 661 | if (pm_runtime_callbacks_present(dev)) | 707 | goto err_runtime; |
| 662 | sysfs_unmerge_group(&dev->kobj, | 708 | } |
| 663 | &pm_runtime_attr_group); | 709 | if (dev->power.set_latency_tolerance) { |
| 664 | goto err_out; | 710 | rc = sysfs_merge_group(&dev->kobj, |
| 665 | } | 711 | &pm_qos_latency_tolerance_attr_group); |
| 712 | if (rc) | ||
| 713 | goto err_wakeup; | ||
| 666 | } | 714 | } |
| 667 | return 0; | 715 | return 0; |
| 668 | 716 | ||
| 717 | err_wakeup: | ||
| 718 | sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); | ||
| 719 | err_runtime: | ||
| 720 | sysfs_unmerge_group(&dev->kobj, &pm_runtime_attr_group); | ||
| 669 | err_out: | 721 | err_out: |
| 670 | sysfs_remove_group(&dev->kobj, &pm_attr_group); | 722 | sysfs_remove_group(&dev->kobj, &pm_attr_group); |
| 671 | return rc; | 723 | return rc; |
| @@ -681,14 +733,14 @@ void wakeup_sysfs_remove(struct device *dev) | |||
| 681 | sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); | 733 | sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); |
| 682 | } | 734 | } |
| 683 | 735 | ||
| 684 | int pm_qos_sysfs_add_latency(struct device *dev) | 736 | int pm_qos_sysfs_add_resume_latency(struct device *dev) |
| 685 | { | 737 | { |
| 686 | return sysfs_merge_group(&dev->kobj, &pm_qos_latency_attr_group); | 738 | return sysfs_merge_group(&dev->kobj, &pm_qos_resume_latency_attr_group); |
| 687 | } | 739 | } |
| 688 | 740 | ||
| 689 | void pm_qos_sysfs_remove_latency(struct device *dev) | 741 | void pm_qos_sysfs_remove_resume_latency(struct device *dev) |
| 690 | { | 742 | { |
| 691 | sysfs_unmerge_group(&dev->kobj, &pm_qos_latency_attr_group); | 743 | sysfs_unmerge_group(&dev->kobj, &pm_qos_resume_latency_attr_group); |
| 692 | } | 744 | } |
| 693 | 745 | ||
| 694 | int pm_qos_sysfs_add_flags(struct device *dev) | 746 | int pm_qos_sysfs_add_flags(struct device *dev) |
| @@ -708,6 +760,7 @@ void rpm_sysfs_remove(struct device *dev) | |||
| 708 | 760 | ||
| 709 | void dpm_sysfs_remove(struct device *dev) | 761 | void dpm_sysfs_remove(struct device *dev) |
| 710 | { | 762 | { |
| 763 | sysfs_unmerge_group(&dev->kobj, &pm_qos_latency_tolerance_attr_group); | ||
| 711 | dev_pm_qos_constraints_destroy(dev); | 764 | dev_pm_qos_constraints_destroy(dev); |
| 712 | rpm_sysfs_remove(dev); | 765 | rpm_sysfs_remove(dev); |
| 713 | sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); | 766 | sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); |
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 4b029c0944af..1fbe11f2a146 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
| @@ -200,7 +200,7 @@ source "drivers/cpufreq/Kconfig.x86" | |||
| 200 | endmenu | 200 | endmenu |
| 201 | 201 | ||
| 202 | menu "ARM CPU frequency scaling drivers" | 202 | menu "ARM CPU frequency scaling drivers" |
| 203 | depends on ARM | 203 | depends on ARM || ARM64 |
| 204 | source "drivers/cpufreq/Kconfig.arm" | 204 | source "drivers/cpufreq/Kconfig.arm" |
| 205 | endmenu | 205 | endmenu |
| 206 | 206 | ||
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 31297499a60a..9fb627046e17 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | # ARM CPU Frequency scaling drivers | 2 | # ARM CPU Frequency scaling drivers |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | # big LITTLE core layer and glue drivers | ||
| 5 | config ARM_BIG_LITTLE_CPUFREQ | 6 | config ARM_BIG_LITTLE_CPUFREQ |
| 6 | tristate "Generic ARM big LITTLE CPUfreq driver" | 7 | tristate "Generic ARM big LITTLE CPUfreq driver" |
| 7 | depends on ARM && BIG_LITTLE && ARM_CPU_TOPOLOGY && HAVE_CLK | 8 | depends on ARM && BIG_LITTLE && ARM_CPU_TOPOLOGY && HAVE_CLK |
| @@ -16,6 +17,14 @@ config ARM_DT_BL_CPUFREQ | |||
| 16 | This enables probing via DT for Generic CPUfreq driver for ARM | 17 | This enables probing via DT for Generic CPUfreq driver for ARM |
| 17 | big.LITTLE platform. This gets frequency tables from DT. | 18 | big.LITTLE platform. This gets frequency tables from DT. |
| 18 | 19 | ||
| 20 | config ARM_VEXPRESS_SPC_CPUFREQ | ||
| 21 | tristate "Versatile Express SPC based CPUfreq driver" | ||
| 22 | depends on ARM_BIG_LITTLE_CPUFREQ && ARCH_VEXPRESS_SPC | ||
| 23 | help | ||
| 24 | This add the CPUfreq driver support for Versatile Express | ||
| 25 | big.LITTLE platforms using SPC for power management. | ||
| 26 | |||
| 27 | |||
| 19 | config ARM_EXYNOS_CPUFREQ | 28 | config ARM_EXYNOS_CPUFREQ |
| 20 | bool | 29 | bool |
| 21 | 30 | ||
| @@ -241,11 +250,3 @@ config ARM_TEGRA_CPUFREQ | |||
| 241 | default y | 250 | default y |
| 242 | help | 251 | help |
| 243 | This adds the CPUFreq driver support for TEGRA SOCs. | 252 | This adds the CPUFreq driver support for TEGRA SOCs. |
| 244 | |||
| 245 | config ARM_VEXPRESS_SPC_CPUFREQ | ||
| 246 | tristate "Versatile Express SPC based CPUfreq driver" | ||
| 247 | select ARM_BIG_LITTLE_CPUFREQ | ||
| 248 | depends on ARCH_VEXPRESS_SPC | ||
| 249 | help | ||
| 250 | This add the CPUfreq driver support for Versatile Express | ||
| 251 | big.LITTLE platforms using SPC for power management. | ||
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 18448a7e9f86..822ca03a87f7 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
| @@ -855,7 +855,6 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) | |||
| 855 | pr_debug("acpi_cpufreq_cpu_exit\n"); | 855 | pr_debug("acpi_cpufreq_cpu_exit\n"); |
| 856 | 856 | ||
| 857 | if (data) { | 857 | if (data) { |
| 858 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 859 | per_cpu(acfreq_data, policy->cpu) = NULL; | 858 | per_cpu(acfreq_data, policy->cpu) = NULL; |
| 860 | acpi_processor_unregister_performance(data->acpi_data, | 859 | acpi_processor_unregister_performance(data->acpi_data, |
| 861 | policy->cpu); | 860 | policy->cpu); |
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c index 72f87e9317e3..bad2ed317ba2 100644 --- a/drivers/cpufreq/arm_big_little.c +++ b/drivers/cpufreq/arm_big_little.c | |||
| @@ -446,9 +446,12 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy) | |||
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | if (cur_cluster < MAX_CLUSTERS) { | 448 | if (cur_cluster < MAX_CLUSTERS) { |
| 449 | int cpu; | ||
| 450 | |||
| 449 | cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); | 451 | cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu)); |
| 450 | 452 | ||
| 451 | per_cpu(physical_cluster, policy->cpu) = cur_cluster; | 453 | for_each_cpu(cpu, policy->cpus) |
| 454 | per_cpu(physical_cluster, cpu) = cur_cluster; | ||
| 452 | } else { | 455 | } else { |
| 453 | /* Assumption: during init, we are always running on A15 */ | 456 | /* Assumption: during init, we are always running on A15 */ |
| 454 | per_cpu(physical_cluster, policy->cpu) = A15_CLUSTER; | 457 | per_cpu(physical_cluster, policy->cpu) = A15_CLUSTER; |
| @@ -478,7 +481,6 @@ static int bL_cpufreq_exit(struct cpufreq_policy *policy) | |||
| 478 | return -ENODEV; | 481 | return -ENODEV; |
| 479 | } | 482 | } |
| 480 | 483 | ||
| 481 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 482 | put_cluster_clk_and_freq_table(cpu_dev); | 484 | put_cluster_clk_and_freq_table(cpu_dev); |
| 483 | dev_dbg(cpu_dev, "%s: Exited, cpu: %d\n", __func__, policy->cpu); | 485 | dev_dbg(cpu_dev, "%s: Exited, cpu: %d\n", __func__, policy->cpu); |
| 484 | 486 | ||
diff --git a/drivers/cpufreq/blackfin-cpufreq.c b/drivers/cpufreq/blackfin-cpufreq.c index e9e63fc9c2c9..a9f8e5bd0716 100644 --- a/drivers/cpufreq/blackfin-cpufreq.c +++ b/drivers/cpufreq/blackfin-cpufreq.c | |||
| @@ -195,7 +195,6 @@ static struct cpufreq_driver bfin_driver = { | |||
| 195 | .target_index = bfin_target, | 195 | .target_index = bfin_target, |
| 196 | .get = bfin_getfreq_khz, | 196 | .get = bfin_getfreq_khz, |
| 197 | .init = __bfin_cpu_init, | 197 | .init = __bfin_cpu_init, |
| 198 | .exit = cpufreq_generic_exit, | ||
| 199 | .name = "bfin cpufreq", | 198 | .name = "bfin cpufreq", |
| 200 | .attr = cpufreq_generic_attr, | 199 | .attr = cpufreq_generic_attr, |
| 201 | }; | 200 | }; |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 0c12ffc0ebcb..1bf6bbac3e03 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
| @@ -109,7 +109,6 @@ static struct cpufreq_driver cpu0_cpufreq_driver = { | |||
| 109 | .target_index = cpu0_set_target, | 109 | .target_index = cpu0_set_target, |
| 110 | .get = cpufreq_generic_get, | 110 | .get = cpufreq_generic_get, |
| 111 | .init = cpu0_cpufreq_init, | 111 | .init = cpu0_cpufreq_init, |
| 112 | .exit = cpufreq_generic_exit, | ||
| 113 | .name = "generic_cpu0", | 112 | .name = "generic_cpu0", |
| 114 | .attr = cpufreq_generic_attr, | 113 | .attr = cpufreq_generic_attr, |
| 115 | }; | 114 | }; |
diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c index a05b876f375e..bc447b9003c3 100644 --- a/drivers/cpufreq/cpufreq-nforce2.c +++ b/drivers/cpufreq/cpufreq-nforce2.c | |||
| @@ -270,7 +270,7 @@ static int nforce2_target(struct cpufreq_policy *policy, | |||
| 270 | pr_debug("Old CPU frequency %d kHz, new %d kHz\n", | 270 | pr_debug("Old CPU frequency %d kHz, new %d kHz\n", |
| 271 | freqs.old, freqs.new); | 271 | freqs.old, freqs.new); |
| 272 | 272 | ||
| 273 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 273 | cpufreq_freq_transition_begin(policy, &freqs); |
| 274 | 274 | ||
| 275 | /* Disable IRQs */ | 275 | /* Disable IRQs */ |
| 276 | /* local_irq_save(flags); */ | 276 | /* local_irq_save(flags); */ |
| @@ -285,7 +285,7 @@ static int nforce2_target(struct cpufreq_policy *policy, | |||
| 285 | /* Enable IRQs */ | 285 | /* Enable IRQs */ |
| 286 | /* local_irq_restore(flags); */ | 286 | /* local_irq_restore(flags); */ |
| 287 | 287 | ||
| 288 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 288 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 289 | 289 | ||
| 290 | return 0; | 290 | return 0; |
| 291 | } | 291 | } |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 199b52b7c3e1..abda6609d3e7 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/syscore_ops.h> | 29 | #include <linux/suspend.h> |
| 30 | #include <linux/tick.h> | 30 | #include <linux/tick.h> |
| 31 | #include <trace/events/power.h> | 31 | #include <trace/events/power.h> |
| 32 | 32 | ||
| @@ -42,10 +42,11 @@ static DEFINE_RWLOCK(cpufreq_driver_lock); | |||
| 42 | DEFINE_MUTEX(cpufreq_governor_lock); | 42 | DEFINE_MUTEX(cpufreq_governor_lock); |
| 43 | static LIST_HEAD(cpufreq_policy_list); | 43 | static LIST_HEAD(cpufreq_policy_list); |
| 44 | 44 | ||
| 45 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 46 | /* This one keeps track of the previously set governor of a removed CPU */ | 45 | /* This one keeps track of the previously set governor of a removed CPU */ |
| 47 | static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); | 46 | static DEFINE_PER_CPU(char[CPUFREQ_NAME_LEN], cpufreq_cpu_governor); |
| 48 | #endif | 47 | |
| 48 | /* Flag to suspend/resume CPUFreq governors */ | ||
| 49 | static bool cpufreq_suspended; | ||
| 49 | 50 | ||
| 50 | static inline bool has_target(void) | 51 | static inline bool has_target(void) |
| 51 | { | 52 | { |
| @@ -181,8 +182,8 @@ unsigned int cpufreq_generic_get(unsigned int cpu) | |||
| 181 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); | 182 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); |
| 182 | 183 | ||
| 183 | if (!policy || IS_ERR(policy->clk)) { | 184 | if (!policy || IS_ERR(policy->clk)) { |
| 184 | pr_err("%s: No %s associated to cpu: %d\n", __func__, | 185 | pr_err("%s: No %s associated to cpu: %d\n", |
| 185 | policy ? "clk" : "policy", cpu); | 186 | __func__, policy ? "clk" : "policy", cpu); |
| 186 | return 0; | 187 | return 0; |
| 187 | } | 188 | } |
| 188 | 189 | ||
| @@ -190,6 +191,12 @@ unsigned int cpufreq_generic_get(unsigned int cpu) | |||
| 190 | } | 191 | } |
| 191 | EXPORT_SYMBOL_GPL(cpufreq_generic_get); | 192 | EXPORT_SYMBOL_GPL(cpufreq_generic_get); |
| 192 | 193 | ||
| 194 | /* Only for cpufreq core internal use */ | ||
| 195 | struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) | ||
| 196 | { | ||
| 197 | return per_cpu(cpufreq_cpu_data, cpu); | ||
| 198 | } | ||
| 199 | |||
| 193 | struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) | 200 | struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) |
| 194 | { | 201 | { |
| 195 | struct cpufreq_policy *policy = NULL; | 202 | struct cpufreq_policy *policy = NULL; |
| @@ -254,15 +261,14 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) | |||
| 254 | if (!l_p_j_ref_freq) { | 261 | if (!l_p_j_ref_freq) { |
| 255 | l_p_j_ref = loops_per_jiffy; | 262 | l_p_j_ref = loops_per_jiffy; |
| 256 | l_p_j_ref_freq = ci->old; | 263 | l_p_j_ref_freq = ci->old; |
| 257 | pr_debug("saving %lu as reference value for loops_per_jiffy; " | 264 | pr_debug("saving %lu as reference value for loops_per_jiffy; freq is %u kHz\n", |
| 258 | "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq); | 265 | l_p_j_ref, l_p_j_ref_freq); |
| 259 | } | 266 | } |
| 260 | if ((val == CPUFREQ_POSTCHANGE && ci->old != ci->new) || | 267 | if (val == CPUFREQ_POSTCHANGE && ci->old != ci->new) { |
| 261 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { | ||
| 262 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, | 268 | loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, |
| 263 | ci->new); | 269 | ci->new); |
| 264 | pr_debug("scaling loops_per_jiffy to %lu " | 270 | pr_debug("scaling loops_per_jiffy to %lu for frequency %u kHz\n", |
| 265 | "for frequency %u kHz\n", loops_per_jiffy, ci->new); | 271 | loops_per_jiffy, ci->new); |
| 266 | } | 272 | } |
| 267 | } | 273 | } |
| 268 | #else | 274 | #else |
| @@ -282,7 +288,7 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, | |||
| 282 | 288 | ||
| 283 | freqs->flags = cpufreq_driver->flags; | 289 | freqs->flags = cpufreq_driver->flags; |
| 284 | pr_debug("notification %u of frequency transition to %u kHz\n", | 290 | pr_debug("notification %u of frequency transition to %u kHz\n", |
| 285 | state, freqs->new); | 291 | state, freqs->new); |
| 286 | 292 | ||
| 287 | switch (state) { | 293 | switch (state) { |
| 288 | 294 | ||
| @@ -294,9 +300,8 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, | |||
| 294 | if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { | 300 | if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { |
| 295 | if ((policy) && (policy->cpu == freqs->cpu) && | 301 | if ((policy) && (policy->cpu == freqs->cpu) && |
| 296 | (policy->cur) && (policy->cur != freqs->old)) { | 302 | (policy->cur) && (policy->cur != freqs->old)) { |
| 297 | pr_debug("Warning: CPU frequency is" | 303 | pr_debug("Warning: CPU frequency is %u, cpufreq assumed %u kHz\n", |
| 298 | " %u, cpufreq assumed %u kHz.\n", | 304 | freqs->old, policy->cur); |
| 299 | freqs->old, policy->cur); | ||
| 300 | freqs->old = policy->cur; | 305 | freqs->old = policy->cur; |
| 301 | } | 306 | } |
| 302 | } | 307 | } |
| @@ -307,8 +312,8 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, | |||
| 307 | 312 | ||
| 308 | case CPUFREQ_POSTCHANGE: | 313 | case CPUFREQ_POSTCHANGE: |
| 309 | adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); | 314 | adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); |
| 310 | pr_debug("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new, | 315 | pr_debug("FREQ: %lu - CPU: %lu\n", |
| 311 | (unsigned long)freqs->cpu); | 316 | (unsigned long)freqs->new, (unsigned long)freqs->cpu); |
| 312 | trace_cpu_frequency(freqs->new, freqs->cpu); | 317 | trace_cpu_frequency(freqs->new, freqs->cpu); |
| 313 | srcu_notifier_call_chain(&cpufreq_transition_notifier_list, | 318 | srcu_notifier_call_chain(&cpufreq_transition_notifier_list, |
| 314 | CPUFREQ_POSTCHANGE, freqs); | 319 | CPUFREQ_POSTCHANGE, freqs); |
| @@ -326,16 +331,15 @@ static void __cpufreq_notify_transition(struct cpufreq_policy *policy, | |||
| 326 | * function. It is called twice on all CPU frequency changes that have | 331 | * function. It is called twice on all CPU frequency changes that have |
| 327 | * external effects. | 332 | * external effects. |
| 328 | */ | 333 | */ |
| 329 | void cpufreq_notify_transition(struct cpufreq_policy *policy, | 334 | static void cpufreq_notify_transition(struct cpufreq_policy *policy, |
| 330 | struct cpufreq_freqs *freqs, unsigned int state) | 335 | struct cpufreq_freqs *freqs, unsigned int state) |
| 331 | { | 336 | { |
| 332 | for_each_cpu(freqs->cpu, policy->cpus) | 337 | for_each_cpu(freqs->cpu, policy->cpus) |
| 333 | __cpufreq_notify_transition(policy, freqs, state); | 338 | __cpufreq_notify_transition(policy, freqs, state); |
| 334 | } | 339 | } |
| 335 | EXPORT_SYMBOL_GPL(cpufreq_notify_transition); | ||
| 336 | 340 | ||
| 337 | /* Do post notifications when there are chances that transition has failed */ | 341 | /* Do post notifications when there are chances that transition has failed */ |
| 338 | void cpufreq_notify_post_transition(struct cpufreq_policy *policy, | 342 | static void cpufreq_notify_post_transition(struct cpufreq_policy *policy, |
| 339 | struct cpufreq_freqs *freqs, int transition_failed) | 343 | struct cpufreq_freqs *freqs, int transition_failed) |
| 340 | { | 344 | { |
| 341 | cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); | 345 | cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); |
| @@ -346,13 +350,47 @@ void cpufreq_notify_post_transition(struct cpufreq_policy *policy, | |||
| 346 | cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE); | 350 | cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE); |
| 347 | cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); | 351 | cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); |
| 348 | } | 352 | } |
| 349 | EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition); | 353 | |
| 354 | void cpufreq_freq_transition_begin(struct cpufreq_policy *policy, | ||
| 355 | struct cpufreq_freqs *freqs) | ||
| 356 | { | ||
| 357 | wait: | ||
| 358 | wait_event(policy->transition_wait, !policy->transition_ongoing); | ||
| 359 | |||
| 360 | spin_lock(&policy->transition_lock); | ||
| 361 | |||
| 362 | if (unlikely(policy->transition_ongoing)) { | ||
| 363 | spin_unlock(&policy->transition_lock); | ||
| 364 | goto wait; | ||
| 365 | } | ||
| 366 | |||
| 367 | policy->transition_ongoing = true; | ||
| 368 | |||
| 369 | spin_unlock(&policy->transition_lock); | ||
| 370 | |||
| 371 | cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE); | ||
| 372 | } | ||
| 373 | EXPORT_SYMBOL_GPL(cpufreq_freq_transition_begin); | ||
| 374 | |||
| 375 | void cpufreq_freq_transition_end(struct cpufreq_policy *policy, | ||
| 376 | struct cpufreq_freqs *freqs, int transition_failed) | ||
| 377 | { | ||
| 378 | if (unlikely(WARN_ON(!policy->transition_ongoing))) | ||
| 379 | return; | ||
| 380 | |||
| 381 | cpufreq_notify_post_transition(policy, freqs, transition_failed); | ||
| 382 | |||
| 383 | policy->transition_ongoing = false; | ||
| 384 | |||
| 385 | wake_up(&policy->transition_wait); | ||
| 386 | } | ||
| 387 | EXPORT_SYMBOL_GPL(cpufreq_freq_transition_end); | ||
| 350 | 388 | ||
| 351 | 389 | ||
| 352 | /********************************************************************* | 390 | /********************************************************************* |
| 353 | * SYSFS INTERFACE * | 391 | * SYSFS INTERFACE * |
| 354 | *********************************************************************/ | 392 | *********************************************************************/ |
| 355 | ssize_t show_boost(struct kobject *kobj, | 393 | static ssize_t show_boost(struct kobject *kobj, |
| 356 | struct attribute *attr, char *buf) | 394 | struct attribute *attr, char *buf) |
| 357 | { | 395 | { |
| 358 | return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled); | 396 | return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled); |
| @@ -368,13 +406,13 @@ static ssize_t store_boost(struct kobject *kobj, struct attribute *attr, | |||
| 368 | return -EINVAL; | 406 | return -EINVAL; |
| 369 | 407 | ||
| 370 | if (cpufreq_boost_trigger_state(enable)) { | 408 | if (cpufreq_boost_trigger_state(enable)) { |
| 371 | pr_err("%s: Cannot %s BOOST!\n", __func__, | 409 | pr_err("%s: Cannot %s BOOST!\n", |
| 372 | enable ? "enable" : "disable"); | 410 | __func__, enable ? "enable" : "disable"); |
| 373 | return -EINVAL; | 411 | return -EINVAL; |
| 374 | } | 412 | } |
| 375 | 413 | ||
| 376 | pr_debug("%s: cpufreq BOOST %s\n", __func__, | 414 | pr_debug("%s: cpufreq BOOST %s\n", |
| 377 | enable ? "enabled" : "disabled"); | 415 | __func__, enable ? "enabled" : "disabled"); |
| 378 | 416 | ||
| 379 | return count; | 417 | return count; |
| 380 | } | 418 | } |
| @@ -879,18 +917,25 @@ err_out_kobj_put: | |||
| 879 | 917 | ||
| 880 | static void cpufreq_init_policy(struct cpufreq_policy *policy) | 918 | static void cpufreq_init_policy(struct cpufreq_policy *policy) |
| 881 | { | 919 | { |
| 920 | struct cpufreq_governor *gov = NULL; | ||
| 882 | struct cpufreq_policy new_policy; | 921 | struct cpufreq_policy new_policy; |
| 883 | int ret = 0; | 922 | int ret = 0; |
| 884 | 923 | ||
| 885 | memcpy(&new_policy, policy, sizeof(*policy)); | 924 | memcpy(&new_policy, policy, sizeof(*policy)); |
| 886 | 925 | ||
| 926 | /* Update governor of new_policy to the governor used before hotplug */ | ||
| 927 | gov = __find_governor(per_cpu(cpufreq_cpu_governor, policy->cpu)); | ||
| 928 | if (gov) | ||
| 929 | pr_debug("Restoring governor %s for cpu %d\n", | ||
| 930 | policy->governor->name, policy->cpu); | ||
| 931 | else | ||
| 932 | gov = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 933 | |||
| 934 | new_policy.governor = gov; | ||
| 935 | |||
| 887 | /* Use the default policy if its valid. */ | 936 | /* Use the default policy if its valid. */ |
| 888 | if (cpufreq_driver->setpolicy) | 937 | if (cpufreq_driver->setpolicy) |
| 889 | cpufreq_parse_governor(policy->governor->name, | 938 | cpufreq_parse_governor(gov->name, &new_policy.policy, NULL); |
| 890 | &new_policy.policy, NULL); | ||
| 891 | |||
| 892 | /* assure that the starting sequence is run in cpufreq_set_policy */ | ||
| 893 | policy->governor = NULL; | ||
| 894 | 939 | ||
| 895 | /* set default policy */ | 940 | /* set default policy */ |
| 896 | ret = cpufreq_set_policy(policy, &new_policy); | 941 | ret = cpufreq_set_policy(policy, &new_policy); |
| @@ -927,8 +972,11 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, | |||
| 927 | up_write(&policy->rwsem); | 972 | up_write(&policy->rwsem); |
| 928 | 973 | ||
| 929 | if (has_target()) { | 974 | if (has_target()) { |
| 930 | if ((ret = __cpufreq_governor(policy, CPUFREQ_GOV_START)) || | 975 | ret = __cpufreq_governor(policy, CPUFREQ_GOV_START); |
| 931 | (ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))) { | 976 | if (!ret) |
| 977 | ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); | ||
| 978 | |||
| 979 | if (ret) { | ||
| 932 | pr_err("%s: Failed to start governor\n", __func__); | 980 | pr_err("%s: Failed to start governor\n", __func__); |
| 933 | return ret; | 981 | return ret; |
| 934 | } | 982 | } |
| @@ -949,6 +997,8 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) | |||
| 949 | 997 | ||
| 950 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | 998 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| 951 | 999 | ||
| 1000 | policy->governor = NULL; | ||
| 1001 | |||
| 952 | return policy; | 1002 | return policy; |
| 953 | } | 1003 | } |
| 954 | 1004 | ||
| @@ -968,6 +1018,8 @@ static struct cpufreq_policy *cpufreq_policy_alloc(void) | |||
| 968 | 1018 | ||
| 969 | INIT_LIST_HEAD(&policy->policy_list); | 1019 | INIT_LIST_HEAD(&policy->policy_list); |
| 970 | init_rwsem(&policy->rwsem); | 1020 | init_rwsem(&policy->rwsem); |
| 1021 | spin_lock_init(&policy->transition_lock); | ||
| 1022 | init_waitqueue_head(&policy->transition_wait); | ||
| 971 | 1023 | ||
| 972 | return policy; | 1024 | return policy; |
| 973 | 1025 | ||
| @@ -1022,21 +1074,19 @@ static void update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu) | |||
| 1022 | 1074 | ||
| 1023 | up_write(&policy->rwsem); | 1075 | up_write(&policy->rwsem); |
| 1024 | 1076 | ||
| 1025 | cpufreq_frequency_table_update_policy_cpu(policy); | ||
| 1026 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, | 1077 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
| 1027 | CPUFREQ_UPDATE_POLICY_CPU, policy); | 1078 | CPUFREQ_UPDATE_POLICY_CPU, policy); |
| 1028 | } | 1079 | } |
| 1029 | 1080 | ||
| 1030 | static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | 1081 | static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) |
| 1031 | bool frozen) | ||
| 1032 | { | 1082 | { |
| 1033 | unsigned int j, cpu = dev->id; | 1083 | unsigned int j, cpu = dev->id; |
| 1034 | int ret = -ENOMEM; | 1084 | int ret = -ENOMEM; |
| 1035 | struct cpufreq_policy *policy; | 1085 | struct cpufreq_policy *policy; |
| 1036 | unsigned long flags; | 1086 | unsigned long flags; |
| 1087 | bool recover_policy = cpufreq_suspended; | ||
| 1037 | #ifdef CONFIG_HOTPLUG_CPU | 1088 | #ifdef CONFIG_HOTPLUG_CPU |
| 1038 | struct cpufreq_policy *tpolicy; | 1089 | struct cpufreq_policy *tpolicy; |
| 1039 | struct cpufreq_governor *gov; | ||
| 1040 | #endif | 1090 | #endif |
| 1041 | 1091 | ||
| 1042 | if (cpu_is_offline(cpu)) | 1092 | if (cpu_is_offline(cpu)) |
| @@ -1075,9 +1125,9 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
| 1075 | * Restore the saved policy when doing light-weight init and fall back | 1125 | * Restore the saved policy when doing light-weight init and fall back |
| 1076 | * to the full init if that fails. | 1126 | * to the full init if that fails. |
| 1077 | */ | 1127 | */ |
| 1078 | policy = frozen ? cpufreq_policy_restore(cpu) : NULL; | 1128 | policy = recover_policy ? cpufreq_policy_restore(cpu) : NULL; |
| 1079 | if (!policy) { | 1129 | if (!policy) { |
| 1080 | frozen = false; | 1130 | recover_policy = false; |
| 1081 | policy = cpufreq_policy_alloc(); | 1131 | policy = cpufreq_policy_alloc(); |
| 1082 | if (!policy) | 1132 | if (!policy) |
| 1083 | goto nomem_out; | 1133 | goto nomem_out; |
| @@ -1089,12 +1139,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
| 1089 | * the creation of a brand new one. So we need to perform this update | 1139 | * the creation of a brand new one. So we need to perform this update |
| 1090 | * by invoking update_policy_cpu(). | 1140 | * by invoking update_policy_cpu(). |
| 1091 | */ | 1141 | */ |
| 1092 | if (frozen && cpu != policy->cpu) | 1142 | if (recover_policy && cpu != policy->cpu) |
| 1093 | update_policy_cpu(policy, cpu); | 1143 | update_policy_cpu(policy, cpu); |
| 1094 | else | 1144 | else |
| 1095 | policy->cpu = cpu; | 1145 | policy->cpu = cpu; |
| 1096 | 1146 | ||
| 1097 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 1098 | cpumask_copy(policy->cpus, cpumask_of(cpu)); | 1147 | cpumask_copy(policy->cpus, cpumask_of(cpu)); |
| 1099 | 1148 | ||
| 1100 | init_completion(&policy->kobj_unregister); | 1149 | init_completion(&policy->kobj_unregister); |
| @@ -1118,7 +1167,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
| 1118 | */ | 1167 | */ |
| 1119 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); | 1168 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); |
| 1120 | 1169 | ||
| 1121 | if (!frozen) { | 1170 | if (!recover_policy) { |
| 1122 | policy->user_policy.min = policy->min; | 1171 | policy->user_policy.min = policy->min; |
| 1123 | policy->user_policy.max = policy->max; | 1172 | policy->user_policy.max = policy->max; |
| 1124 | } | 1173 | } |
| @@ -1180,16 +1229,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
| 1180 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, | 1229 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
| 1181 | CPUFREQ_START, policy); | 1230 | CPUFREQ_START, policy); |
| 1182 | 1231 | ||
| 1183 | #ifdef CONFIG_HOTPLUG_CPU | 1232 | if (!recover_policy) { |
| 1184 | gov = __find_governor(per_cpu(cpufreq_cpu_governor, cpu)); | ||
| 1185 | if (gov) { | ||
| 1186 | policy->governor = gov; | ||
| 1187 | pr_debug("Restoring governor %s for cpu %d\n", | ||
| 1188 | policy->governor->name, cpu); | ||
| 1189 | } | ||
| 1190 | #endif | ||
| 1191 | |||
| 1192 | if (!frozen) { | ||
| 1193 | ret = cpufreq_add_dev_interface(policy, dev); | 1233 | ret = cpufreq_add_dev_interface(policy, dev); |
| 1194 | if (ret) | 1234 | if (ret) |
| 1195 | goto err_out_unregister; | 1235 | goto err_out_unregister; |
| @@ -1203,7 +1243,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
| 1203 | 1243 | ||
| 1204 | cpufreq_init_policy(policy); | 1244 | cpufreq_init_policy(policy); |
| 1205 | 1245 | ||
| 1206 | if (!frozen) { | 1246 | if (!recover_policy) { |
| 1207 | policy->user_policy.policy = policy->policy; | 1247 | policy->user_policy.policy = policy->policy; |
| 1208 | policy->user_policy.governor = policy->governor; | 1248 | policy->user_policy.governor = policy->governor; |
| 1209 | } | 1249 | } |
| @@ -1226,7 +1266,7 @@ err_get_freq: | |||
| 1226 | if (cpufreq_driver->exit) | 1266 | if (cpufreq_driver->exit) |
| 1227 | cpufreq_driver->exit(policy); | 1267 | cpufreq_driver->exit(policy); |
| 1228 | err_set_policy_cpu: | 1268 | err_set_policy_cpu: |
| 1229 | if (frozen) { | 1269 | if (recover_policy) { |
| 1230 | /* Do not leave stale fallback data behind. */ | 1270 | /* Do not leave stale fallback data behind. */ |
| 1231 | per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL; | 1271 | per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL; |
| 1232 | cpufreq_policy_put_kobj(policy); | 1272 | cpufreq_policy_put_kobj(policy); |
| @@ -1250,7 +1290,7 @@ nomem_out: | |||
| 1250 | */ | 1290 | */ |
| 1251 | static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) | 1291 | static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) |
| 1252 | { | 1292 | { |
| 1253 | return __cpufreq_add_dev(dev, sif, false); | 1293 | return __cpufreq_add_dev(dev, sif); |
| 1254 | } | 1294 | } |
| 1255 | 1295 | ||
| 1256 | static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, | 1296 | static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, |
| @@ -1265,7 +1305,7 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, | |||
| 1265 | sysfs_remove_link(&cpu_dev->kobj, "cpufreq"); | 1305 | sysfs_remove_link(&cpu_dev->kobj, "cpufreq"); |
| 1266 | ret = kobject_move(&policy->kobj, &cpu_dev->kobj); | 1306 | ret = kobject_move(&policy->kobj, &cpu_dev->kobj); |
| 1267 | if (ret) { | 1307 | if (ret) { |
| 1268 | pr_err("%s: Failed to move kobj: %d", __func__, ret); | 1308 | pr_err("%s: Failed to move kobj: %d\n", __func__, ret); |
| 1269 | 1309 | ||
| 1270 | down_write(&policy->rwsem); | 1310 | down_write(&policy->rwsem); |
| 1271 | cpumask_set_cpu(old_cpu, policy->cpus); | 1311 | cpumask_set_cpu(old_cpu, policy->cpus); |
| @@ -1281,8 +1321,7 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, | |||
| 1281 | } | 1321 | } |
| 1282 | 1322 | ||
| 1283 | static int __cpufreq_remove_dev_prepare(struct device *dev, | 1323 | static int __cpufreq_remove_dev_prepare(struct device *dev, |
| 1284 | struct subsys_interface *sif, | 1324 | struct subsys_interface *sif) |
| 1285 | bool frozen) | ||
| 1286 | { | 1325 | { |
| 1287 | unsigned int cpu = dev->id, cpus; | 1326 | unsigned int cpu = dev->id, cpus; |
| 1288 | int new_cpu, ret; | 1327 | int new_cpu, ret; |
| @@ -1296,7 +1335,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, | |||
| 1296 | policy = per_cpu(cpufreq_cpu_data, cpu); | 1335 | policy = per_cpu(cpufreq_cpu_data, cpu); |
| 1297 | 1336 | ||
| 1298 | /* Save the policy somewhere when doing a light-weight tear-down */ | 1337 | /* Save the policy somewhere when doing a light-weight tear-down */ |
| 1299 | if (frozen) | 1338 | if (cpufreq_suspended) |
| 1300 | per_cpu(cpufreq_cpu_data_fallback, cpu) = policy; | 1339 | per_cpu(cpufreq_cpu_data_fallback, cpu) = policy; |
| 1301 | 1340 | ||
| 1302 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1341 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| @@ -1314,11 +1353,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, | |||
| 1314 | } | 1353 | } |
| 1315 | } | 1354 | } |
| 1316 | 1355 | ||
| 1317 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 1318 | if (!cpufreq_driver->setpolicy) | 1356 | if (!cpufreq_driver->setpolicy) |
| 1319 | strncpy(per_cpu(cpufreq_cpu_governor, cpu), | 1357 | strncpy(per_cpu(cpufreq_cpu_governor, cpu), |
| 1320 | policy->governor->name, CPUFREQ_NAME_LEN); | 1358 | policy->governor->name, CPUFREQ_NAME_LEN); |
| 1321 | #endif | ||
| 1322 | 1359 | ||
| 1323 | down_read(&policy->rwsem); | 1360 | down_read(&policy->rwsem); |
| 1324 | cpus = cpumask_weight(policy->cpus); | 1361 | cpus = cpumask_weight(policy->cpus); |
| @@ -1331,19 +1368,19 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, | |||
| 1331 | if (new_cpu >= 0) { | 1368 | if (new_cpu >= 0) { |
| 1332 | update_policy_cpu(policy, new_cpu); | 1369 | update_policy_cpu(policy, new_cpu); |
| 1333 | 1370 | ||
| 1334 | if (!frozen) { | 1371 | if (!cpufreq_suspended) |
| 1335 | pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n", | 1372 | pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n", |
| 1336 | __func__, new_cpu, cpu); | 1373 | __func__, new_cpu, cpu); |
| 1337 | } | ||
| 1338 | } | 1374 | } |
| 1375 | } else if (cpufreq_driver->stop_cpu && cpufreq_driver->setpolicy) { | ||
| 1376 | cpufreq_driver->stop_cpu(policy); | ||
| 1339 | } | 1377 | } |
| 1340 | 1378 | ||
| 1341 | return 0; | 1379 | return 0; |
| 1342 | } | 1380 | } |
| 1343 | 1381 | ||
| 1344 | static int __cpufreq_remove_dev_finish(struct device *dev, | 1382 | static int __cpufreq_remove_dev_finish(struct device *dev, |
| 1345 | struct subsys_interface *sif, | 1383 | struct subsys_interface *sif) |
| 1346 | bool frozen) | ||
| 1347 | { | 1384 | { |
| 1348 | unsigned int cpu = dev->id, cpus; | 1385 | unsigned int cpu = dev->id, cpus; |
| 1349 | int ret; | 1386 | int ret; |
| @@ -1373,12 +1410,12 @@ static int __cpufreq_remove_dev_finish(struct device *dev, | |||
| 1373 | CPUFREQ_GOV_POLICY_EXIT); | 1410 | CPUFREQ_GOV_POLICY_EXIT); |
| 1374 | if (ret) { | 1411 | if (ret) { |
| 1375 | pr_err("%s: Failed to exit governor\n", | 1412 | pr_err("%s: Failed to exit governor\n", |
| 1376 | __func__); | 1413 | __func__); |
| 1377 | return ret; | 1414 | return ret; |
| 1378 | } | 1415 | } |
| 1379 | } | 1416 | } |
| 1380 | 1417 | ||
| 1381 | if (!frozen) | 1418 | if (!cpufreq_suspended) |
| 1382 | cpufreq_policy_put_kobj(policy); | 1419 | cpufreq_policy_put_kobj(policy); |
| 1383 | 1420 | ||
| 1384 | /* | 1421 | /* |
| @@ -1394,16 +1431,16 @@ static int __cpufreq_remove_dev_finish(struct device *dev, | |||
| 1394 | list_del(&policy->policy_list); | 1431 | list_del(&policy->policy_list); |
| 1395 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1432 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| 1396 | 1433 | ||
| 1397 | if (!frozen) | 1434 | if (!cpufreq_suspended) |
| 1398 | cpufreq_policy_free(policy); | 1435 | cpufreq_policy_free(policy); |
| 1399 | } else { | 1436 | } else if (has_target()) { |
| 1400 | if (has_target()) { | 1437 | ret = __cpufreq_governor(policy, CPUFREQ_GOV_START); |
| 1401 | if ((ret = __cpufreq_governor(policy, CPUFREQ_GOV_START)) || | 1438 | if (!ret) |
| 1402 | (ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))) { | 1439 | ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); |
| 1403 | pr_err("%s: Failed to start governor\n", | 1440 | |
| 1404 | __func__); | 1441 | if (ret) { |
| 1405 | return ret; | 1442 | pr_err("%s: Failed to start governor\n", __func__); |
| 1406 | } | 1443 | return ret; |
| 1407 | } | 1444 | } |
| 1408 | } | 1445 | } |
| 1409 | 1446 | ||
| @@ -1424,10 +1461,10 @@ static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) | |||
| 1424 | if (cpu_is_offline(cpu)) | 1461 | if (cpu_is_offline(cpu)) |
| 1425 | return 0; | 1462 | return 0; |
| 1426 | 1463 | ||
| 1427 | ret = __cpufreq_remove_dev_prepare(dev, sif, false); | 1464 | ret = __cpufreq_remove_dev_prepare(dev, sif); |
| 1428 | 1465 | ||
| 1429 | if (!ret) | 1466 | if (!ret) |
| 1430 | ret = __cpufreq_remove_dev_finish(dev, sif, false); | 1467 | ret = __cpufreq_remove_dev_finish(dev, sif); |
| 1431 | 1468 | ||
| 1432 | return ret; | 1469 | return ret; |
| 1433 | } | 1470 | } |
| @@ -1458,8 +1495,8 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, | |||
| 1458 | struct cpufreq_freqs freqs; | 1495 | struct cpufreq_freqs freqs; |
| 1459 | unsigned long flags; | 1496 | unsigned long flags; |
| 1460 | 1497 | ||
| 1461 | pr_debug("Warning: CPU frequency out of sync: cpufreq and timing " | 1498 | pr_debug("Warning: CPU frequency out of sync: cpufreq and timing core thinks of %u, is %u kHz\n", |
| 1462 | "core thinks of %u, is %u kHz.\n", old_freq, new_freq); | 1499 | old_freq, new_freq); |
| 1463 | 1500 | ||
| 1464 | freqs.old = old_freq; | 1501 | freqs.old = old_freq; |
| 1465 | freqs.new = new_freq; | 1502 | freqs.new = new_freq; |
| @@ -1468,8 +1505,8 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, | |||
| 1468 | policy = per_cpu(cpufreq_cpu_data, cpu); | 1505 | policy = per_cpu(cpufreq_cpu_data, cpu); |
| 1469 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1506 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| 1470 | 1507 | ||
| 1471 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 1508 | cpufreq_freq_transition_begin(policy, &freqs); |
| 1472 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 1509 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 1473 | } | 1510 | } |
| 1474 | 1511 | ||
| 1475 | /** | 1512 | /** |
| @@ -1570,83 +1607,103 @@ static struct subsys_interface cpufreq_interface = { | |||
| 1570 | .remove_dev = cpufreq_remove_dev, | 1607 | .remove_dev = cpufreq_remove_dev, |
| 1571 | }; | 1608 | }; |
| 1572 | 1609 | ||
| 1610 | /* | ||
| 1611 | * In case platform wants some specific frequency to be configured | ||
| 1612 | * during suspend.. | ||
| 1613 | */ | ||
| 1614 | int cpufreq_generic_suspend(struct cpufreq_policy *policy) | ||
| 1615 | { | ||
| 1616 | int ret; | ||
| 1617 | |||
| 1618 | if (!policy->suspend_freq) { | ||
| 1619 | pr_err("%s: suspend_freq can't be zero\n", __func__); | ||
| 1620 | return -EINVAL; | ||
| 1621 | } | ||
| 1622 | |||
| 1623 | pr_debug("%s: Setting suspend-freq: %u\n", __func__, | ||
| 1624 | policy->suspend_freq); | ||
| 1625 | |||
| 1626 | ret = __cpufreq_driver_target(policy, policy->suspend_freq, | ||
| 1627 | CPUFREQ_RELATION_H); | ||
| 1628 | if (ret) | ||
| 1629 | pr_err("%s: unable to set suspend-freq: %u. err: %d\n", | ||
| 1630 | __func__, policy->suspend_freq, ret); | ||
| 1631 | |||
| 1632 | return ret; | ||
| 1633 | } | ||
| 1634 | EXPORT_SYMBOL(cpufreq_generic_suspend); | ||
| 1635 | |||
| 1573 | /** | 1636 | /** |
| 1574 | * cpufreq_bp_suspend - Prepare the boot CPU for system suspend. | 1637 | * cpufreq_suspend() - Suspend CPUFreq governors |
| 1575 | * | 1638 | * |
| 1576 | * This function is only executed for the boot processor. The other CPUs | 1639 | * Called during system wide Suspend/Hibernate cycles for suspending governors |
| 1577 | * have been put offline by means of CPU hotplug. | 1640 | * as some platforms can't change frequency after this point in suspend cycle. |
| 1641 | * Because some of the devices (like: i2c, regulators, etc) they use for | ||
| 1642 | * changing frequency are suspended quickly after this point. | ||
| 1578 | */ | 1643 | */ |
| 1579 | static int cpufreq_bp_suspend(void) | 1644 | void cpufreq_suspend(void) |
| 1580 | { | 1645 | { |
| 1581 | int ret = 0; | ||
| 1582 | |||
| 1583 | int cpu = smp_processor_id(); | ||
| 1584 | struct cpufreq_policy *policy; | 1646 | struct cpufreq_policy *policy; |
| 1585 | 1647 | ||
| 1586 | pr_debug("suspending cpu %u\n", cpu); | 1648 | if (!cpufreq_driver) |
| 1649 | return; | ||
| 1587 | 1650 | ||
| 1588 | /* If there's no policy for the boot CPU, we have nothing to do. */ | 1651 | if (!has_target()) |
| 1589 | policy = cpufreq_cpu_get(cpu); | 1652 | return; |
| 1590 | if (!policy) | ||
| 1591 | return 0; | ||
| 1592 | 1653 | ||
| 1593 | if (cpufreq_driver->suspend) { | 1654 | pr_debug("%s: Suspending Governors\n", __func__); |
| 1594 | ret = cpufreq_driver->suspend(policy); | 1655 | |
| 1595 | if (ret) | 1656 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { |
| 1596 | printk(KERN_ERR "cpufreq: suspend failed in ->suspend " | 1657 | if (__cpufreq_governor(policy, CPUFREQ_GOV_STOP)) |
| 1597 | "step on CPU %u\n", policy->cpu); | 1658 | pr_err("%s: Failed to stop governor for policy: %p\n", |
| 1659 | __func__, policy); | ||
| 1660 | else if (cpufreq_driver->suspend | ||
| 1661 | && cpufreq_driver->suspend(policy)) | ||
| 1662 | pr_err("%s: Failed to suspend driver: %p\n", __func__, | ||
| 1663 | policy); | ||
| 1598 | } | 1664 | } |
| 1599 | 1665 | ||
| 1600 | cpufreq_cpu_put(policy); | 1666 | cpufreq_suspended = true; |
| 1601 | return ret; | ||
| 1602 | } | 1667 | } |
| 1603 | 1668 | ||
| 1604 | /** | 1669 | /** |
| 1605 | * cpufreq_bp_resume - Restore proper frequency handling of the boot CPU. | 1670 | * cpufreq_resume() - Resume CPUFreq governors |
| 1606 | * | ||
| 1607 | * 1.) resume CPUfreq hardware support (cpufreq_driver->resume()) | ||
| 1608 | * 2.) schedule call cpufreq_update_policy() ASAP as interrupts are | ||
| 1609 | * restored. It will verify that the current freq is in sync with | ||
| 1610 | * what we believe it to be. This is a bit later than when it | ||
| 1611 | * should be, but nonethteless it's better than calling | ||
| 1612 | * cpufreq_driver->get() here which might re-enable interrupts... | ||
| 1613 | * | 1671 | * |
| 1614 | * This function is only executed for the boot CPU. The other CPUs have not | 1672 | * Called during system wide Suspend/Hibernate cycle for resuming governors that |
| 1615 | * been turned on yet. | 1673 | * are suspended with cpufreq_suspend(). |
| 1616 | */ | 1674 | */ |
| 1617 | static void cpufreq_bp_resume(void) | 1675 | void cpufreq_resume(void) |
| 1618 | { | 1676 | { |
| 1619 | int ret = 0; | ||
| 1620 | |||
| 1621 | int cpu = smp_processor_id(); | ||
| 1622 | struct cpufreq_policy *policy; | 1677 | struct cpufreq_policy *policy; |
| 1623 | 1678 | ||
| 1624 | pr_debug("resuming cpu %u\n", cpu); | 1679 | if (!cpufreq_driver) |
| 1680 | return; | ||
| 1625 | 1681 | ||
| 1626 | /* If there's no policy for the boot CPU, we have nothing to do. */ | 1682 | if (!has_target()) |
| 1627 | policy = cpufreq_cpu_get(cpu); | ||
| 1628 | if (!policy) | ||
| 1629 | return; | 1683 | return; |
| 1630 | 1684 | ||
| 1631 | if (cpufreq_driver->resume) { | 1685 | pr_debug("%s: Resuming Governors\n", __func__); |
| 1632 | ret = cpufreq_driver->resume(policy); | ||
| 1633 | if (ret) { | ||
| 1634 | printk(KERN_ERR "cpufreq: resume failed in ->resume " | ||
| 1635 | "step on CPU %u\n", policy->cpu); | ||
| 1636 | goto fail; | ||
| 1637 | } | ||
| 1638 | } | ||
| 1639 | 1686 | ||
| 1640 | schedule_work(&policy->update); | 1687 | cpufreq_suspended = false; |
| 1641 | 1688 | ||
| 1642 | fail: | 1689 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { |
| 1643 | cpufreq_cpu_put(policy); | 1690 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) |
| 1644 | } | 1691 | pr_err("%s: Failed to resume driver: %p\n", __func__, |
| 1692 | policy); | ||
| 1693 | else if (__cpufreq_governor(policy, CPUFREQ_GOV_START) | ||
| 1694 | || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS)) | ||
| 1695 | pr_err("%s: Failed to start governor for policy: %p\n", | ||
| 1696 | __func__, policy); | ||
| 1645 | 1697 | ||
| 1646 | static struct syscore_ops cpufreq_syscore_ops = { | 1698 | /* |
| 1647 | .suspend = cpufreq_bp_suspend, | 1699 | * schedule call cpufreq_update_policy() for boot CPU, i.e. last |
| 1648 | .resume = cpufreq_bp_resume, | 1700 | * policy in list. It will verify that the current freq is in |
| 1649 | }; | 1701 | * sync with what we believe it to be. |
| 1702 | */ | ||
| 1703 | if (list_is_last(&policy->policy_list, &cpufreq_policy_list)) | ||
| 1704 | schedule_work(&policy->update); | ||
| 1705 | } | ||
| 1706 | } | ||
| 1650 | 1707 | ||
| 1651 | /** | 1708 | /** |
| 1652 | * cpufreq_get_current_driver - return current driver's name | 1709 | * cpufreq_get_current_driver - return current driver's name |
| @@ -1762,7 +1819,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
| 1762 | target_freq = policy->min; | 1819 | target_freq = policy->min; |
| 1763 | 1820 | ||
| 1764 | pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", | 1821 | pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n", |
| 1765 | policy->cpu, target_freq, relation, old_target_freq); | 1822 | policy->cpu, target_freq, relation, old_target_freq); |
| 1766 | 1823 | ||
| 1767 | /* | 1824 | /* |
| 1768 | * This might look like a redundant call as we are checking it again | 1825 | * This might look like a redundant call as we are checking it again |
| @@ -1807,20 +1864,18 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
| 1807 | freqs.flags = 0; | 1864 | freqs.flags = 0; |
| 1808 | 1865 | ||
| 1809 | pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n", | 1866 | pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n", |
| 1810 | __func__, policy->cpu, freqs.old, | 1867 | __func__, policy->cpu, freqs.old, freqs.new); |
| 1811 | freqs.new); | ||
| 1812 | 1868 | ||
| 1813 | cpufreq_notify_transition(policy, &freqs, | 1869 | cpufreq_freq_transition_begin(policy, &freqs); |
| 1814 | CPUFREQ_PRECHANGE); | ||
| 1815 | } | 1870 | } |
| 1816 | 1871 | ||
| 1817 | retval = cpufreq_driver->target_index(policy, index); | 1872 | retval = cpufreq_driver->target_index(policy, index); |
| 1818 | if (retval) | 1873 | if (retval) |
| 1819 | pr_err("%s: Failed to change cpu frequency: %d\n", | 1874 | pr_err("%s: Failed to change cpu frequency: %d\n", |
| 1820 | __func__, retval); | 1875 | __func__, retval); |
| 1821 | 1876 | ||
| 1822 | if (notify) | 1877 | if (notify) |
| 1823 | cpufreq_notify_post_transition(policy, &freqs, retval); | 1878 | cpufreq_freq_transition_end(policy, &freqs, retval); |
| 1824 | } | 1879 | } |
| 1825 | 1880 | ||
| 1826 | out: | 1881 | out: |
| @@ -1863,17 +1918,18 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
| 1863 | struct cpufreq_governor *gov = NULL; | 1918 | struct cpufreq_governor *gov = NULL; |
| 1864 | #endif | 1919 | #endif |
| 1865 | 1920 | ||
| 1921 | /* Don't start any governor operations if we are entering suspend */ | ||
| 1922 | if (cpufreq_suspended) | ||
| 1923 | return 0; | ||
| 1924 | |||
| 1866 | if (policy->governor->max_transition_latency && | 1925 | if (policy->governor->max_transition_latency && |
| 1867 | policy->cpuinfo.transition_latency > | 1926 | policy->cpuinfo.transition_latency > |
| 1868 | policy->governor->max_transition_latency) { | 1927 | policy->governor->max_transition_latency) { |
| 1869 | if (!gov) | 1928 | if (!gov) |
| 1870 | return -EINVAL; | 1929 | return -EINVAL; |
| 1871 | else { | 1930 | else { |
| 1872 | printk(KERN_WARNING "%s governor failed, too long" | 1931 | pr_warn("%s governor failed, too long transition latency of HW, fallback to %s governor\n", |
| 1873 | " transition latency of HW, fallback" | 1932 | policy->governor->name, gov->name); |
| 1874 | " to %s governor\n", | ||
| 1875 | policy->governor->name, | ||
| 1876 | gov->name); | ||
| 1877 | policy->governor = gov; | 1933 | policy->governor = gov; |
| 1878 | } | 1934 | } |
| 1879 | } | 1935 | } |
| @@ -1883,7 +1939,7 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
| 1883 | return -EINVAL; | 1939 | return -EINVAL; |
| 1884 | 1940 | ||
| 1885 | pr_debug("__cpufreq_governor for CPU %u, event %u\n", | 1941 | pr_debug("__cpufreq_governor for CPU %u, event %u\n", |
| 1886 | policy->cpu, event); | 1942 | policy->cpu, event); |
| 1887 | 1943 | ||
| 1888 | mutex_lock(&cpufreq_governor_lock); | 1944 | mutex_lock(&cpufreq_governor_lock); |
| 1889 | if ((policy->governor_enabled && event == CPUFREQ_GOV_START) | 1945 | if ((policy->governor_enabled && event == CPUFREQ_GOV_START) |
| @@ -1950,9 +2006,7 @@ EXPORT_SYMBOL_GPL(cpufreq_register_governor); | |||
| 1950 | 2006 | ||
| 1951 | void cpufreq_unregister_governor(struct cpufreq_governor *governor) | 2007 | void cpufreq_unregister_governor(struct cpufreq_governor *governor) |
| 1952 | { | 2008 | { |
| 1953 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 1954 | int cpu; | 2009 | int cpu; |
| 1955 | #endif | ||
| 1956 | 2010 | ||
| 1957 | if (!governor) | 2011 | if (!governor) |
| 1958 | return; | 2012 | return; |
| @@ -1960,14 +2014,12 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor) | |||
| 1960 | if (cpufreq_disabled()) | 2014 | if (cpufreq_disabled()) |
| 1961 | return; | 2015 | return; |
| 1962 | 2016 | ||
| 1963 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 1964 | for_each_present_cpu(cpu) { | 2017 | for_each_present_cpu(cpu) { |
| 1965 | if (cpu_online(cpu)) | 2018 | if (cpu_online(cpu)) |
| 1966 | continue; | 2019 | continue; |
| 1967 | if (!strcmp(per_cpu(cpufreq_cpu_governor, cpu), governor->name)) | 2020 | if (!strcmp(per_cpu(cpufreq_cpu_governor, cpu), governor->name)) |
| 1968 | strcpy(per_cpu(cpufreq_cpu_governor, cpu), "\0"); | 2021 | strcpy(per_cpu(cpufreq_cpu_governor, cpu), "\0"); |
| 1969 | } | 2022 | } |
| 1970 | #endif | ||
| 1971 | 2023 | ||
| 1972 | mutex_lock(&cpufreq_governor_mutex); | 2024 | mutex_lock(&cpufreq_governor_mutex); |
| 1973 | list_del(&governor->governor_list); | 2025 | list_del(&governor->governor_list); |
| @@ -2012,22 +2064,21 @@ EXPORT_SYMBOL(cpufreq_get_policy); | |||
| 2012 | static int cpufreq_set_policy(struct cpufreq_policy *policy, | 2064 | static int cpufreq_set_policy(struct cpufreq_policy *policy, |
| 2013 | struct cpufreq_policy *new_policy) | 2065 | struct cpufreq_policy *new_policy) |
| 2014 | { | 2066 | { |
| 2015 | int ret = 0, failed = 1; | 2067 | struct cpufreq_governor *old_gov; |
| 2068 | int ret; | ||
| 2016 | 2069 | ||
| 2017 | pr_debug("setting new policy for CPU %u: %u - %u kHz\n", new_policy->cpu, | 2070 | pr_debug("setting new policy for CPU %u: %u - %u kHz\n", |
| 2018 | new_policy->min, new_policy->max); | 2071 | new_policy->cpu, new_policy->min, new_policy->max); |
| 2019 | 2072 | ||
| 2020 | memcpy(&new_policy->cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo)); | 2073 | memcpy(&new_policy->cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo)); |
| 2021 | 2074 | ||
| 2022 | if (new_policy->min > policy->max || new_policy->max < policy->min) { | 2075 | if (new_policy->min > policy->max || new_policy->max < policy->min) |
| 2023 | ret = -EINVAL; | 2076 | return -EINVAL; |
| 2024 | goto error_out; | ||
| 2025 | } | ||
| 2026 | 2077 | ||
| 2027 | /* verify the cpu speed can be set within this limit */ | 2078 | /* verify the cpu speed can be set within this limit */ |
| 2028 | ret = cpufreq_driver->verify(new_policy); | 2079 | ret = cpufreq_driver->verify(new_policy); |
| 2029 | if (ret) | 2080 | if (ret) |
| 2030 | goto error_out; | 2081 | return ret; |
| 2031 | 2082 | ||
| 2032 | /* adjust if necessary - all reasons */ | 2083 | /* adjust if necessary - all reasons */ |
| 2033 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, | 2084 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
| @@ -2043,7 +2094,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, | |||
| 2043 | */ | 2094 | */ |
| 2044 | ret = cpufreq_driver->verify(new_policy); | 2095 | ret = cpufreq_driver->verify(new_policy); |
| 2045 | if (ret) | 2096 | if (ret) |
| 2046 | goto error_out; | 2097 | return ret; |
| 2047 | 2098 | ||
| 2048 | /* notification of the new policy */ | 2099 | /* notification of the new policy */ |
| 2049 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, | 2100 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
| @@ -2053,63 +2104,53 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, | |||
| 2053 | policy->max = new_policy->max; | 2104 | policy->max = new_policy->max; |
| 2054 | 2105 | ||
| 2055 | pr_debug("new min and max freqs are %u - %u kHz\n", | 2106 | pr_debug("new min and max freqs are %u - %u kHz\n", |
| 2056 | policy->min, policy->max); | 2107 | policy->min, policy->max); |
| 2057 | 2108 | ||
| 2058 | if (cpufreq_driver->setpolicy) { | 2109 | if (cpufreq_driver->setpolicy) { |
| 2059 | policy->policy = new_policy->policy; | 2110 | policy->policy = new_policy->policy; |
| 2060 | pr_debug("setting range\n"); | 2111 | pr_debug("setting range\n"); |
| 2061 | ret = cpufreq_driver->setpolicy(new_policy); | 2112 | return cpufreq_driver->setpolicy(new_policy); |
| 2062 | } else { | 2113 | } |
| 2063 | if (new_policy->governor != policy->governor) { | ||
| 2064 | /* save old, working values */ | ||
| 2065 | struct cpufreq_governor *old_gov = policy->governor; | ||
| 2066 | |||
| 2067 | pr_debug("governor switch\n"); | ||
| 2068 | |||
| 2069 | /* end old governor */ | ||
| 2070 | if (policy->governor) { | ||
| 2071 | __cpufreq_governor(policy, CPUFREQ_GOV_STOP); | ||
| 2072 | up_write(&policy->rwsem); | ||
| 2073 | __cpufreq_governor(policy, | ||
| 2074 | CPUFREQ_GOV_POLICY_EXIT); | ||
| 2075 | down_write(&policy->rwsem); | ||
| 2076 | } | ||
| 2077 | 2114 | ||
| 2078 | /* start new governor */ | 2115 | if (new_policy->governor == policy->governor) |
| 2079 | policy->governor = new_policy->governor; | 2116 | goto out; |
| 2080 | if (!__cpufreq_governor(policy, CPUFREQ_GOV_POLICY_INIT)) { | ||
| 2081 | if (!__cpufreq_governor(policy, CPUFREQ_GOV_START)) { | ||
| 2082 | failed = 0; | ||
| 2083 | } else { | ||
| 2084 | up_write(&policy->rwsem); | ||
| 2085 | __cpufreq_governor(policy, | ||
| 2086 | CPUFREQ_GOV_POLICY_EXIT); | ||
| 2087 | down_write(&policy->rwsem); | ||
| 2088 | } | ||
| 2089 | } | ||
| 2090 | 2117 | ||
| 2091 | if (failed) { | 2118 | pr_debug("governor switch\n"); |
| 2092 | /* new governor failed, so re-start old one */ | 2119 | |
| 2093 | pr_debug("starting governor %s failed\n", | 2120 | /* save old, working values */ |
| 2094 | policy->governor->name); | 2121 | old_gov = policy->governor; |
| 2095 | if (old_gov) { | 2122 | /* end old governor */ |
| 2096 | policy->governor = old_gov; | 2123 | if (old_gov) { |
| 2097 | __cpufreq_governor(policy, | 2124 | __cpufreq_governor(policy, CPUFREQ_GOV_STOP); |
| 2098 | CPUFREQ_GOV_POLICY_INIT); | 2125 | up_write(&policy->rwsem); |
| 2099 | __cpufreq_governor(policy, | 2126 | __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); |
| 2100 | CPUFREQ_GOV_START); | 2127 | down_write(&policy->rwsem); |
| 2101 | } | ||
| 2102 | ret = -EINVAL; | ||
| 2103 | goto error_out; | ||
| 2104 | } | ||
| 2105 | /* might be a policy change, too, so fall through */ | ||
| 2106 | } | ||
| 2107 | pr_debug("governor: change or update limits\n"); | ||
| 2108 | ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); | ||
| 2109 | } | 2128 | } |
| 2110 | 2129 | ||
| 2111 | error_out: | 2130 | /* start new governor */ |
| 2112 | return ret; | 2131 | policy->governor = new_policy->governor; |
| 2132 | if (!__cpufreq_governor(policy, CPUFREQ_GOV_POLICY_INIT)) { | ||
| 2133 | if (!__cpufreq_governor(policy, CPUFREQ_GOV_START)) | ||
| 2134 | goto out; | ||
| 2135 | |||
| 2136 | up_write(&policy->rwsem); | ||
| 2137 | __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_EXIT); | ||
| 2138 | down_write(&policy->rwsem); | ||
| 2139 | } | ||
| 2140 | |||
| 2141 | /* new governor failed, so re-start old one */ | ||
| 2142 | pr_debug("starting governor %s failed\n", policy->governor->name); | ||
| 2143 | if (old_gov) { | ||
| 2144 | policy->governor = old_gov; | ||
| 2145 | __cpufreq_governor(policy, CPUFREQ_GOV_POLICY_INIT); | ||
| 2146 | __cpufreq_governor(policy, CPUFREQ_GOV_START); | ||
| 2147 | } | ||
| 2148 | |||
| 2149 | return -EINVAL; | ||
| 2150 | |||
| 2151 | out: | ||
| 2152 | pr_debug("governor: change or update limits\n"); | ||
| 2153 | return __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); | ||
| 2113 | } | 2154 | } |
| 2114 | 2155 | ||
| 2115 | /** | 2156 | /** |
| @@ -2145,8 +2186,13 @@ int cpufreq_update_policy(unsigned int cpu) | |||
| 2145 | */ | 2186 | */ |
| 2146 | if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { | 2187 | if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { |
| 2147 | new_policy.cur = cpufreq_driver->get(cpu); | 2188 | new_policy.cur = cpufreq_driver->get(cpu); |
| 2189 | if (WARN_ON(!new_policy.cur)) { | ||
| 2190 | ret = -EIO; | ||
| 2191 | goto no_policy; | ||
| 2192 | } | ||
| 2193 | |||
| 2148 | if (!policy->cur) { | 2194 | if (!policy->cur) { |
| 2149 | pr_debug("Driver did not initialize current freq"); | 2195 | pr_debug("Driver did not initialize current freq\n"); |
| 2150 | policy->cur = new_policy.cur; | 2196 | policy->cur = new_policy.cur; |
| 2151 | } else { | 2197 | } else { |
| 2152 | if (policy->cur != new_policy.cur && has_target()) | 2198 | if (policy->cur != new_policy.cur && has_target()) |
| @@ -2170,30 +2216,24 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb, | |||
| 2170 | { | 2216 | { |
| 2171 | unsigned int cpu = (unsigned long)hcpu; | 2217 | unsigned int cpu = (unsigned long)hcpu; |
| 2172 | struct device *dev; | 2218 | struct device *dev; |
| 2173 | bool frozen = false; | ||
| 2174 | 2219 | ||
| 2175 | dev = get_cpu_device(cpu); | 2220 | dev = get_cpu_device(cpu); |
| 2176 | if (dev) { | 2221 | if (dev) { |
| 2177 | |||
| 2178 | if (action & CPU_TASKS_FROZEN) | ||
| 2179 | frozen = true; | ||
| 2180 | |||
| 2181 | switch (action & ~CPU_TASKS_FROZEN) { | 2222 | switch (action & ~CPU_TASKS_FROZEN) { |
| 2182 | case CPU_ONLINE: | 2223 | case CPU_ONLINE: |
| 2183 | __cpufreq_add_dev(dev, NULL, frozen); | 2224 | __cpufreq_add_dev(dev, NULL); |
| 2184 | cpufreq_update_policy(cpu); | ||
| 2185 | break; | 2225 | break; |
| 2186 | 2226 | ||
| 2187 | case CPU_DOWN_PREPARE: | 2227 | case CPU_DOWN_PREPARE: |
| 2188 | __cpufreq_remove_dev_prepare(dev, NULL, frozen); | 2228 | __cpufreq_remove_dev_prepare(dev, NULL); |
| 2189 | break; | 2229 | break; |
| 2190 | 2230 | ||
| 2191 | case CPU_POST_DEAD: | 2231 | case CPU_POST_DEAD: |
| 2192 | __cpufreq_remove_dev_finish(dev, NULL, frozen); | 2232 | __cpufreq_remove_dev_finish(dev, NULL); |
| 2193 | break; | 2233 | break; |
| 2194 | 2234 | ||
| 2195 | case CPU_DOWN_FAILED: | 2235 | case CPU_DOWN_FAILED: |
| 2196 | __cpufreq_add_dev(dev, NULL, frozen); | 2236 | __cpufreq_add_dev(dev, NULL); |
| 2197 | break; | 2237 | break; |
| 2198 | } | 2238 | } |
| 2199 | } | 2239 | } |
| @@ -2249,8 +2289,8 @@ int cpufreq_boost_trigger_state(int state) | |||
| 2249 | cpufreq_driver->boost_enabled = !state; | 2289 | cpufreq_driver->boost_enabled = !state; |
| 2250 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 2290 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| 2251 | 2291 | ||
| 2252 | pr_err("%s: Cannot %s BOOST\n", __func__, | 2292 | pr_err("%s: Cannot %s BOOST\n", |
| 2253 | state ? "enable" : "disable"); | 2293 | __func__, state ? "enable" : "disable"); |
| 2254 | } | 2294 | } |
| 2255 | 2295 | ||
| 2256 | return ret; | 2296 | return ret; |
| @@ -2295,7 +2335,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
| 2295 | 2335 | ||
| 2296 | if (!driver_data || !driver_data->verify || !driver_data->init || | 2336 | if (!driver_data || !driver_data->verify || !driver_data->init || |
| 2297 | !(driver_data->setpolicy || driver_data->target_index || | 2337 | !(driver_data->setpolicy || driver_data->target_index || |
| 2298 | driver_data->target)) | 2338 | driver_data->target) || |
| 2339 | (driver_data->setpolicy && (driver_data->target_index || | ||
| 2340 | driver_data->target))) | ||
| 2299 | return -EINVAL; | 2341 | return -EINVAL; |
| 2300 | 2342 | ||
| 2301 | pr_debug("trying to register driver %s\n", driver_data->name); | 2343 | pr_debug("trying to register driver %s\n", driver_data->name); |
| @@ -2322,7 +2364,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
| 2322 | ret = cpufreq_sysfs_create_file(&boost.attr); | 2364 | ret = cpufreq_sysfs_create_file(&boost.attr); |
| 2323 | if (ret) { | 2365 | if (ret) { |
| 2324 | pr_err("%s: cannot register global BOOST sysfs file\n", | 2366 | pr_err("%s: cannot register global BOOST sysfs file\n", |
| 2325 | __func__); | 2367 | __func__); |
| 2326 | goto err_null_driver; | 2368 | goto err_null_driver; |
| 2327 | } | 2369 | } |
| 2328 | } | 2370 | } |
| @@ -2345,7 +2387,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
| 2345 | /* if all ->init() calls failed, unregister */ | 2387 | /* if all ->init() calls failed, unregister */ |
| 2346 | if (ret) { | 2388 | if (ret) { |
| 2347 | pr_debug("no CPU initialized for driver %s\n", | 2389 | pr_debug("no CPU initialized for driver %s\n", |
| 2348 | driver_data->name); | 2390 | driver_data->name); |
| 2349 | goto err_if_unreg; | 2391 | goto err_if_unreg; |
| 2350 | } | 2392 | } |
| 2351 | } | 2393 | } |
| @@ -2409,7 +2451,6 @@ static int __init cpufreq_core_init(void) | |||
| 2409 | 2451 | ||
| 2410 | cpufreq_global_kobject = kobject_create(); | 2452 | cpufreq_global_kobject = kobject_create(); |
| 2411 | BUG_ON(!cpufreq_global_kobject); | 2453 | BUG_ON(!cpufreq_global_kobject); |
| 2412 | register_syscore_ops(&cpufreq_syscore_ops); | ||
| 2413 | 2454 | ||
| 2414 | return 0; | 2455 | return 0; |
| 2415 | } | 2456 | } |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 5793e1447fb1..eb214d83ad6b 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
| @@ -180,27 +180,25 @@ static void cpufreq_stats_free_table(unsigned int cpu) | |||
| 180 | cpufreq_cpu_put(policy); | 180 | cpufreq_cpu_put(policy); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | static int __cpufreq_stats_create_table(struct cpufreq_policy *policy, | 183 | static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) |
| 184 | struct cpufreq_frequency_table *table) | ||
| 185 | { | 184 | { |
| 186 | unsigned int i, j, count = 0, ret = 0; | 185 | unsigned int i, j, count = 0, ret = 0; |
| 187 | struct cpufreq_stats *stat; | 186 | struct cpufreq_stats *stat; |
| 188 | struct cpufreq_policy *current_policy; | ||
| 189 | unsigned int alloc_size; | 187 | unsigned int alloc_size; |
| 190 | unsigned int cpu = policy->cpu; | 188 | unsigned int cpu = policy->cpu; |
| 189 | struct cpufreq_frequency_table *table; | ||
| 190 | |||
| 191 | table = cpufreq_frequency_get_table(cpu); | ||
| 192 | if (unlikely(!table)) | ||
| 193 | return 0; | ||
| 194 | |||
| 191 | if (per_cpu(cpufreq_stats_table, cpu)) | 195 | if (per_cpu(cpufreq_stats_table, cpu)) |
| 192 | return -EBUSY; | 196 | return -EBUSY; |
| 193 | stat = kzalloc(sizeof(*stat), GFP_KERNEL); | 197 | stat = kzalloc(sizeof(*stat), GFP_KERNEL); |
| 194 | if ((stat) == NULL) | 198 | if ((stat) == NULL) |
| 195 | return -ENOMEM; | 199 | return -ENOMEM; |
| 196 | 200 | ||
| 197 | current_policy = cpufreq_cpu_get(cpu); | 201 | ret = sysfs_create_group(&policy->kobj, &stats_attr_group); |
| 198 | if (current_policy == NULL) { | ||
| 199 | ret = -EINVAL; | ||
| 200 | goto error_get_fail; | ||
| 201 | } | ||
| 202 | |||
| 203 | ret = sysfs_create_group(¤t_policy->kobj, &stats_attr_group); | ||
| 204 | if (ret) | 202 | if (ret) |
| 205 | goto error_out; | 203 | goto error_out; |
| 206 | 204 | ||
| @@ -223,7 +221,7 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy, | |||
| 223 | stat->time_in_state = kzalloc(alloc_size, GFP_KERNEL); | 221 | stat->time_in_state = kzalloc(alloc_size, GFP_KERNEL); |
| 224 | if (!stat->time_in_state) { | 222 | if (!stat->time_in_state) { |
| 225 | ret = -ENOMEM; | 223 | ret = -ENOMEM; |
| 226 | goto error_out; | 224 | goto error_alloc; |
| 227 | } | 225 | } |
| 228 | stat->freq_table = (unsigned int *)(stat->time_in_state + count); | 226 | stat->freq_table = (unsigned int *)(stat->time_in_state + count); |
| 229 | 227 | ||
| @@ -243,11 +241,10 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy, | |||
| 243 | stat->last_time = get_jiffies_64(); | 241 | stat->last_time = get_jiffies_64(); |
| 244 | stat->last_index = freq_table_get_index(stat, policy->cur); | 242 | stat->last_index = freq_table_get_index(stat, policy->cur); |
| 245 | spin_unlock(&cpufreq_stats_lock); | 243 | spin_unlock(&cpufreq_stats_lock); |
| 246 | cpufreq_cpu_put(current_policy); | ||
| 247 | return 0; | 244 | return 0; |
| 245 | error_alloc: | ||
| 246 | sysfs_remove_group(&policy->kobj, &stats_attr_group); | ||
| 248 | error_out: | 247 | error_out: |
| 249 | cpufreq_cpu_put(current_policy); | ||
| 250 | error_get_fail: | ||
| 251 | kfree(stat); | 248 | kfree(stat); |
| 252 | per_cpu(cpufreq_stats_table, cpu) = NULL; | 249 | per_cpu(cpufreq_stats_table, cpu) = NULL; |
| 253 | return ret; | 250 | return ret; |
| @@ -256,7 +253,6 @@ error_get_fail: | |||
| 256 | static void cpufreq_stats_create_table(unsigned int cpu) | 253 | static void cpufreq_stats_create_table(unsigned int cpu) |
| 257 | { | 254 | { |
| 258 | struct cpufreq_policy *policy; | 255 | struct cpufreq_policy *policy; |
| 259 | struct cpufreq_frequency_table *table; | ||
| 260 | 256 | ||
| 261 | /* | 257 | /* |
| 262 | * "likely(!policy)" because normally cpufreq_stats will be registered | 258 | * "likely(!policy)" because normally cpufreq_stats will be registered |
| @@ -266,9 +262,7 @@ static void cpufreq_stats_create_table(unsigned int cpu) | |||
| 266 | if (likely(!policy)) | 262 | if (likely(!policy)) |
| 267 | return; | 263 | return; |
| 268 | 264 | ||
| 269 | table = cpufreq_frequency_get_table(policy->cpu); | 265 | __cpufreq_stats_create_table(policy); |
| 270 | if (likely(table)) | ||
| 271 | __cpufreq_stats_create_table(policy, table); | ||
| 272 | 266 | ||
| 273 | cpufreq_cpu_put(policy); | 267 | cpufreq_cpu_put(policy); |
| 274 | } | 268 | } |
| @@ -291,20 +285,14 @@ static int cpufreq_stat_notifier_policy(struct notifier_block *nb, | |||
| 291 | { | 285 | { |
| 292 | int ret = 0; | 286 | int ret = 0; |
| 293 | struct cpufreq_policy *policy = data; | 287 | struct cpufreq_policy *policy = data; |
| 294 | struct cpufreq_frequency_table *table; | ||
| 295 | unsigned int cpu = policy->cpu; | ||
| 296 | 288 | ||
| 297 | if (val == CPUFREQ_UPDATE_POLICY_CPU) { | 289 | if (val == CPUFREQ_UPDATE_POLICY_CPU) { |
| 298 | cpufreq_stats_update_policy_cpu(policy); | 290 | cpufreq_stats_update_policy_cpu(policy); |
| 299 | return 0; | 291 | return 0; |
| 300 | } | 292 | } |
| 301 | 293 | ||
| 302 | table = cpufreq_frequency_get_table(cpu); | ||
| 303 | if (!table) | ||
| 304 | return 0; | ||
| 305 | |||
| 306 | if (val == CPUFREQ_CREATE_POLICY) | 294 | if (val == CPUFREQ_CREATE_POLICY) |
| 307 | ret = __cpufreq_stats_create_table(policy, table); | 295 | ret = __cpufreq_stats_create_table(policy); |
| 308 | else if (val == CPUFREQ_REMOVE_POLICY) | 296 | else if (val == CPUFREQ_REMOVE_POLICY) |
| 309 | __cpufreq_stats_free_table(policy); | 297 | __cpufreq_stats_free_table(policy); |
| 310 | 298 | ||
diff --git a/drivers/cpufreq/cris-artpec3-cpufreq.c b/drivers/cpufreq/cris-artpec3-cpufreq.c index 86559040c54c..d4573032cbbc 100644 --- a/drivers/cpufreq/cris-artpec3-cpufreq.c +++ b/drivers/cpufreq/cris-artpec3-cpufreq.c | |||
| @@ -57,7 +57,6 @@ static struct cpufreq_driver cris_freq_driver = { | |||
| 57 | .verify = cpufreq_generic_frequency_table_verify, | 57 | .verify = cpufreq_generic_frequency_table_verify, |
| 58 | .target_index = cris_freq_target, | 58 | .target_index = cris_freq_target, |
| 59 | .init = cris_freq_cpu_init, | 59 | .init = cris_freq_cpu_init, |
| 60 | .exit = cpufreq_generic_exit, | ||
| 61 | .name = "cris_freq", | 60 | .name = "cris_freq", |
| 62 | .attr = cpufreq_generic_attr, | 61 | .attr = cpufreq_generic_attr, |
| 63 | }; | 62 | }; |
diff --git a/drivers/cpufreq/cris-etraxfs-cpufreq.c b/drivers/cpufreq/cris-etraxfs-cpufreq.c index 26d940d40b1d..13c3361437f7 100644 --- a/drivers/cpufreq/cris-etraxfs-cpufreq.c +++ b/drivers/cpufreq/cris-etraxfs-cpufreq.c | |||
| @@ -57,7 +57,6 @@ static struct cpufreq_driver cris_freq_driver = { | |||
| 57 | .verify = cpufreq_generic_frequency_table_verify, | 57 | .verify = cpufreq_generic_frequency_table_verify, |
| 58 | .target_index = cris_freq_target, | 58 | .target_index = cris_freq_target, |
| 59 | .init = cris_freq_cpu_init, | 59 | .init = cris_freq_cpu_init, |
| 60 | .exit = cpufreq_generic_exit, | ||
| 61 | .name = "cris_freq", | 60 | .name = "cris_freq", |
| 62 | .attr = cpufreq_generic_attr, | 61 | .attr = cpufreq_generic_attr, |
| 63 | }; | 62 | }; |
diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index 2cf33848d86e..28a16dc6e02e 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c | |||
| @@ -125,7 +125,6 @@ static struct cpufreq_driver davinci_driver = { | |||
| 125 | .target_index = davinci_target, | 125 | .target_index = davinci_target, |
| 126 | .get = cpufreq_generic_get, | 126 | .get = cpufreq_generic_get, |
| 127 | .init = davinci_cpu_init, | 127 | .init = davinci_cpu_init, |
| 128 | .exit = cpufreq_generic_exit, | ||
| 129 | .name = "davinci", | 128 | .name = "davinci", |
| 130 | .attr = cpufreq_generic_attr, | 129 | .attr = cpufreq_generic_attr, |
| 131 | }; | 130 | }; |
diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c index 9012b8bb6b64..a0d2a423cea9 100644 --- a/drivers/cpufreq/e_powersaver.c +++ b/drivers/cpufreq/e_powersaver.c | |||
| @@ -382,7 +382,6 @@ static int eps_cpu_exit(struct cpufreq_policy *policy) | |||
| 382 | unsigned int cpu = policy->cpu; | 382 | unsigned int cpu = policy->cpu; |
| 383 | 383 | ||
| 384 | /* Bye */ | 384 | /* Bye */ |
| 385 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 386 | kfree(eps_cpu[cpu]); | 385 | kfree(eps_cpu[cpu]); |
| 387 | eps_cpu[cpu] = NULL; | 386 | eps_cpu[cpu] = NULL; |
| 388 | return 0; | 387 | return 0; |
diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c index de08acff5101..c987e94708f5 100644 --- a/drivers/cpufreq/elanfreq.c +++ b/drivers/cpufreq/elanfreq.c | |||
| @@ -198,7 +198,6 @@ static struct cpufreq_driver elanfreq_driver = { | |||
| 198 | .verify = cpufreq_generic_frequency_table_verify, | 198 | .verify = cpufreq_generic_frequency_table_verify, |
| 199 | .target_index = elanfreq_target, | 199 | .target_index = elanfreq_target, |
| 200 | .init = elanfreq_cpu_init, | 200 | .init = elanfreq_cpu_init, |
| 201 | .exit = cpufreq_generic_exit, | ||
| 202 | .name = "elanfreq", | 201 | .name = "elanfreq", |
| 203 | .attr = cpufreq_generic_attr, | 202 | .attr = cpufreq_generic_attr, |
| 204 | }; | 203 | }; |
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index fcd2914d081a..f99cfe24e7bc 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | #include <linux/regulator/consumer.h> | 17 | #include <linux/regulator/consumer.h> |
| 18 | #include <linux/cpufreq.h> | 18 | #include <linux/cpufreq.h> |
| 19 | #include <linux/suspend.h> | ||
| 20 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 21 | 20 | ||
| 22 | #include <plat/cpu.h> | 21 | #include <plat/cpu.h> |
| @@ -24,12 +23,8 @@ | |||
| 24 | #include "exynos-cpufreq.h" | 23 | #include "exynos-cpufreq.h" |
| 25 | 24 | ||
| 26 | static struct exynos_dvfs_info *exynos_info; | 25 | static struct exynos_dvfs_info *exynos_info; |
| 27 | |||
| 28 | static struct regulator *arm_regulator; | 26 | static struct regulator *arm_regulator; |
| 29 | |||
| 30 | static unsigned int locking_frequency; | 27 | static unsigned int locking_frequency; |
| 31 | static bool frequency_locked; | ||
| 32 | static DEFINE_MUTEX(cpufreq_lock); | ||
| 33 | 28 | ||
| 34 | static int exynos_cpufreq_get_index(unsigned int freq) | 29 | static int exynos_cpufreq_get_index(unsigned int freq) |
| 35 | { | 30 | { |
| @@ -134,83 +129,13 @@ out: | |||
| 134 | 129 | ||
| 135 | static int exynos_target(struct cpufreq_policy *policy, unsigned int index) | 130 | static int exynos_target(struct cpufreq_policy *policy, unsigned int index) |
| 136 | { | 131 | { |
| 137 | struct cpufreq_frequency_table *freq_table = exynos_info->freq_table; | 132 | return exynos_cpufreq_scale(exynos_info->freq_table[index].frequency); |
| 138 | int ret = 0; | ||
| 139 | |||
| 140 | mutex_lock(&cpufreq_lock); | ||
| 141 | |||
| 142 | if (frequency_locked) | ||
| 143 | goto out; | ||
| 144 | |||
| 145 | ret = exynos_cpufreq_scale(freq_table[index].frequency); | ||
| 146 | |||
| 147 | out: | ||
| 148 | mutex_unlock(&cpufreq_lock); | ||
| 149 | |||
| 150 | return ret; | ||
| 151 | } | ||
| 152 | |||
| 153 | #ifdef CONFIG_PM | ||
| 154 | static int exynos_cpufreq_suspend(struct cpufreq_policy *policy) | ||
| 155 | { | ||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | |||
| 159 | static int exynos_cpufreq_resume(struct cpufreq_policy *policy) | ||
| 160 | { | ||
| 161 | return 0; | ||
| 162 | } | ||
| 163 | #endif | ||
| 164 | |||
| 165 | /** | ||
| 166 | * exynos_cpufreq_pm_notifier - block CPUFREQ's activities in suspend-resume | ||
| 167 | * context | ||
| 168 | * @notifier | ||
| 169 | * @pm_event | ||
| 170 | * @v | ||
| 171 | * | ||
| 172 | * While frequency_locked == true, target() ignores every frequency but | ||
| 173 | * locking_frequency. The locking_frequency value is the initial frequency, | ||
| 174 | * which is set by the bootloader. In order to eliminate possible | ||
| 175 | * inconsistency in clock values, we save and restore frequencies during | ||
| 176 | * suspend and resume and block CPUFREQ activities. Note that the standard | ||
| 177 | * suspend/resume cannot be used as they are too deep (syscore_ops) for | ||
| 178 | * regulator actions. | ||
| 179 | */ | ||
| 180 | static int exynos_cpufreq_pm_notifier(struct notifier_block *notifier, | ||
| 181 | unsigned long pm_event, void *v) | ||
| 182 | { | ||
| 183 | int ret; | ||
| 184 | |||
| 185 | switch (pm_event) { | ||
| 186 | case PM_SUSPEND_PREPARE: | ||
| 187 | mutex_lock(&cpufreq_lock); | ||
| 188 | frequency_locked = true; | ||
| 189 | mutex_unlock(&cpufreq_lock); | ||
| 190 | |||
| 191 | ret = exynos_cpufreq_scale(locking_frequency); | ||
| 192 | if (ret < 0) | ||
| 193 | return NOTIFY_BAD; | ||
| 194 | |||
| 195 | break; | ||
| 196 | |||
| 197 | case PM_POST_SUSPEND: | ||
| 198 | mutex_lock(&cpufreq_lock); | ||
| 199 | frequency_locked = false; | ||
| 200 | mutex_unlock(&cpufreq_lock); | ||
| 201 | break; | ||
| 202 | } | ||
| 203 | |||
| 204 | return NOTIFY_OK; | ||
| 205 | } | 133 | } |
| 206 | 134 | ||
| 207 | static struct notifier_block exynos_cpufreq_nb = { | ||
| 208 | .notifier_call = exynos_cpufreq_pm_notifier, | ||
| 209 | }; | ||
| 210 | |||
| 211 | static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) | 135 | static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) |
| 212 | { | 136 | { |
| 213 | policy->clk = exynos_info->cpu_clk; | 137 | policy->clk = exynos_info->cpu_clk; |
| 138 | policy->suspend_freq = locking_frequency; | ||
| 214 | return cpufreq_generic_init(policy, exynos_info->freq_table, 100000); | 139 | return cpufreq_generic_init(policy, exynos_info->freq_table, 100000); |
| 215 | } | 140 | } |
| 216 | 141 | ||
| @@ -220,15 +145,13 @@ static struct cpufreq_driver exynos_driver = { | |||
| 220 | .target_index = exynos_target, | 145 | .target_index = exynos_target, |
| 221 | .get = cpufreq_generic_get, | 146 | .get = cpufreq_generic_get, |
| 222 | .init = exynos_cpufreq_cpu_init, | 147 | .init = exynos_cpufreq_cpu_init, |
| 223 | .exit = cpufreq_generic_exit, | ||
| 224 | .name = "exynos_cpufreq", | 148 | .name = "exynos_cpufreq", |
| 225 | .attr = cpufreq_generic_attr, | 149 | .attr = cpufreq_generic_attr, |
| 226 | #ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW | 150 | #ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW |
| 227 | .boost_supported = true, | 151 | .boost_supported = true, |
| 228 | #endif | 152 | #endif |
| 229 | #ifdef CONFIG_PM | 153 | #ifdef CONFIG_PM |
| 230 | .suspend = exynos_cpufreq_suspend, | 154 | .suspend = cpufreq_generic_suspend, |
| 231 | .resume = exynos_cpufreq_resume, | ||
| 232 | #endif | 155 | #endif |
| 233 | }; | 156 | }; |
| 234 | 157 | ||
| @@ -263,19 +186,13 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
| 263 | goto err_vdd_arm; | 186 | goto err_vdd_arm; |
| 264 | } | 187 | } |
| 265 | 188 | ||
| 189 | /* Done here as we want to capture boot frequency */ | ||
| 266 | locking_frequency = clk_get_rate(exynos_info->cpu_clk) / 1000; | 190 | locking_frequency = clk_get_rate(exynos_info->cpu_clk) / 1000; |
| 267 | 191 | ||
| 268 | register_pm_notifier(&exynos_cpufreq_nb); | 192 | if (!cpufreq_register_driver(&exynos_driver)) |
| 269 | 193 | return 0; | |
| 270 | if (cpufreq_register_driver(&exynos_driver)) { | ||
| 271 | pr_err("%s: failed to register cpufreq driver\n", __func__); | ||
| 272 | goto err_cpufreq; | ||
| 273 | } | ||
| 274 | |||
| 275 | return 0; | ||
| 276 | err_cpufreq: | ||
| 277 | unregister_pm_notifier(&exynos_cpufreq_nb); | ||
| 278 | 194 | ||
| 195 | pr_err("%s: failed to register cpufreq driver\n", __func__); | ||
| 279 | regulator_put(arm_regulator); | 196 | regulator_put(arm_regulator); |
| 280 | err_vdd_arm: | 197 | err_vdd_arm: |
| 281 | kfree(exynos_info); | 198 | kfree(exynos_info); |
diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c index 49b756015316..a6b8214d7b77 100644 --- a/drivers/cpufreq/exynos5440-cpufreq.c +++ b/drivers/cpufreq/exynos5440-cpufreq.c | |||
| @@ -219,7 +219,7 @@ static int exynos_target(struct cpufreq_policy *policy, unsigned int index) | |||
| 219 | freqs.old = policy->cur; | 219 | freqs.old = policy->cur; |
| 220 | freqs.new = freq_table[index].frequency; | 220 | freqs.new = freq_table[index].frequency; |
| 221 | 221 | ||
| 222 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 222 | cpufreq_freq_transition_begin(policy, &freqs); |
| 223 | 223 | ||
| 224 | /* Set the target frequency in all C0_3_PSTATE register */ | 224 | /* Set the target frequency in all C0_3_PSTATE register */ |
| 225 | for_each_cpu(i, policy->cpus) { | 225 | for_each_cpu(i, policy->cpus) { |
| @@ -258,7 +258,7 @@ static void exynos_cpufreq_work(struct work_struct *work) | |||
| 258 | dev_crit(dvfs_info->dev, "New frequency out of range\n"); | 258 | dev_crit(dvfs_info->dev, "New frequency out of range\n"); |
| 259 | freqs.new = freqs.old; | 259 | freqs.new = freqs.old; |
| 260 | } | 260 | } |
| 261 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 261 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 262 | 262 | ||
| 263 | cpufreq_cpu_put(policy); | 263 | cpufreq_cpu_put(policy); |
| 264 | mutex_unlock(&cpufreq_lock); | 264 | mutex_unlock(&cpufreq_lock); |
| @@ -312,7 +312,6 @@ static struct cpufreq_driver exynos_driver = { | |||
| 312 | .target_index = exynos_target, | 312 | .target_index = exynos_target, |
| 313 | .get = cpufreq_generic_get, | 313 | .get = cpufreq_generic_get, |
| 314 | .init = exynos_cpufreq_cpu_init, | 314 | .init = exynos_cpufreq_cpu_init, |
| 315 | .exit = cpufreq_generic_exit, | ||
| 316 | .name = CPUFREQ_NAME, | 315 | .name = CPUFREQ_NAME, |
| 317 | .attr = cpufreq_generic_attr, | 316 | .attr = cpufreq_generic_attr, |
| 318 | }; | 317 | }; |
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 8e54f97899ba..65a477075b3f 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
| @@ -91,8 +91,8 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, | |||
| 91 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify); | 91 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify); |
| 92 | 92 | ||
| 93 | /* | 93 | /* |
| 94 | * Generic routine to verify policy & frequency table, requires driver to call | 94 | * Generic routine to verify policy & frequency table, requires driver to set |
| 95 | * cpufreq_frequency_table_get_attr() prior to it. | 95 | * policy->freq_table prior to it. |
| 96 | */ | 96 | */ |
| 97 | int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy) | 97 | int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy) |
| 98 | { | 98 | { |
| @@ -203,8 +203,6 @@ int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, | |||
| 203 | } | 203 | } |
| 204 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); | 204 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); |
| 205 | 205 | ||
| 206 | static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); | ||
| 207 | |||
| 208 | /** | 206 | /** |
| 209 | * show_available_freqs - show available frequencies for the specified CPU | 207 | * show_available_freqs - show available frequencies for the specified CPU |
| 210 | */ | 208 | */ |
| @@ -212,15 +210,12 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, | |||
| 212 | bool show_boost) | 210 | bool show_boost) |
| 213 | { | 211 | { |
| 214 | unsigned int i = 0; | 212 | unsigned int i = 0; |
| 215 | unsigned int cpu = policy->cpu; | ||
| 216 | ssize_t count = 0; | 213 | ssize_t count = 0; |
| 217 | struct cpufreq_frequency_table *table; | 214 | struct cpufreq_frequency_table *table = policy->freq_table; |
| 218 | 215 | ||
| 219 | if (!per_cpu(cpufreq_show_table, cpu)) | 216 | if (!table) |
| 220 | return -ENODEV; | 217 | return -ENODEV; |
| 221 | 218 | ||
| 222 | table = per_cpu(cpufreq_show_table, cpu); | ||
| 223 | |||
| 224 | for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { | 219 | for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { |
| 225 | if (table[i].frequency == CPUFREQ_ENTRY_INVALID) | 220 | if (table[i].frequency == CPUFREQ_ENTRY_INVALID) |
| 226 | continue; | 221 | continue; |
| @@ -283,49 +278,24 @@ struct freq_attr *cpufreq_generic_attr[] = { | |||
| 283 | }; | 278 | }; |
| 284 | EXPORT_SYMBOL_GPL(cpufreq_generic_attr); | 279 | EXPORT_SYMBOL_GPL(cpufreq_generic_attr); |
| 285 | 280 | ||
| 286 | /* | ||
| 287 | * if you use these, you must assure that the frequency table is valid | ||
| 288 | * all the time between get_attr and put_attr! | ||
| 289 | */ | ||
| 290 | void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, | ||
| 291 | unsigned int cpu) | ||
| 292 | { | ||
| 293 | pr_debug("setting show_table for cpu %u to %p\n", cpu, table); | ||
| 294 | per_cpu(cpufreq_show_table, cpu) = table; | ||
| 295 | } | ||
| 296 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_attr); | ||
| 297 | |||
| 298 | void cpufreq_frequency_table_put_attr(unsigned int cpu) | ||
| 299 | { | ||
| 300 | pr_debug("clearing show_table for cpu %u\n", cpu); | ||
| 301 | per_cpu(cpufreq_show_table, cpu) = NULL; | ||
| 302 | } | ||
| 303 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_put_attr); | ||
| 304 | |||
| 305 | int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, | 281 | int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, |
| 306 | struct cpufreq_frequency_table *table) | 282 | struct cpufreq_frequency_table *table) |
| 307 | { | 283 | { |
| 308 | int ret = cpufreq_frequency_table_cpuinfo(policy, table); | 284 | int ret = cpufreq_frequency_table_cpuinfo(policy, table); |
| 309 | 285 | ||
| 310 | if (!ret) | 286 | if (!ret) |
| 311 | cpufreq_frequency_table_get_attr(table, policy->cpu); | 287 | policy->freq_table = table; |
| 312 | 288 | ||
| 313 | return ret; | 289 | return ret; |
| 314 | } | 290 | } |
| 315 | EXPORT_SYMBOL_GPL(cpufreq_table_validate_and_show); | 291 | EXPORT_SYMBOL_GPL(cpufreq_table_validate_and_show); |
| 316 | 292 | ||
| 317 | void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy) | 293 | struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu); |
| 318 | { | ||
| 319 | pr_debug("Updating show_table for new_cpu %u from last_cpu %u\n", | ||
| 320 | policy->cpu, policy->last_cpu); | ||
| 321 | per_cpu(cpufreq_show_table, policy->cpu) = per_cpu(cpufreq_show_table, | ||
| 322 | policy->last_cpu); | ||
| 323 | per_cpu(cpufreq_show_table, policy->last_cpu) = NULL; | ||
| 324 | } | ||
| 325 | 294 | ||
| 326 | struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu) | 295 | struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu) |
| 327 | { | 296 | { |
| 328 | return per_cpu(cpufreq_show_table, cpu); | 297 | struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu); |
| 298 | return policy ? policy->freq_table : NULL; | ||
| 329 | } | 299 | } |
| 330 | EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table); | 300 | EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table); |
| 331 | 301 | ||
diff --git a/drivers/cpufreq/gx-suspmod.c b/drivers/cpufreq/gx-suspmod.c index d83e8266a58e..1d723dc8880c 100644 --- a/drivers/cpufreq/gx-suspmod.c +++ b/drivers/cpufreq/gx-suspmod.c | |||
| @@ -265,7 +265,7 @@ static void gx_set_cpuspeed(struct cpufreq_policy *policy, unsigned int khz) | |||
| 265 | 265 | ||
| 266 | freqs.new = new_khz; | 266 | freqs.new = new_khz; |
| 267 | 267 | ||
| 268 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 268 | cpufreq_freq_transition_begin(policy, &freqs); |
| 269 | local_irq_save(flags); | 269 | local_irq_save(flags); |
| 270 | 270 | ||
| 271 | if (new_khz != stock_freq) { | 271 | if (new_khz != stock_freq) { |
| @@ -314,7 +314,7 @@ static void gx_set_cpuspeed(struct cpufreq_policy *policy, unsigned int khz) | |||
| 314 | 314 | ||
| 315 | gx_params->pci_suscfg = suscfg; | 315 | gx_params->pci_suscfg = suscfg; |
| 316 | 316 | ||
| 317 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 317 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 318 | 318 | ||
| 319 | pr_debug("suspend modulation w/ duration of ON:%d us, OFF:%d us\n", | 319 | pr_debug("suspend modulation w/ duration of ON:%d us, OFF:%d us\n", |
| 320 | gx_params->on_duration * 32, gx_params->off_duration * 32); | 320 | gx_params->on_duration * 32, gx_params->off_duration * 32); |
diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c b/drivers/cpufreq/ia64-acpi-cpufreq.c index 53c6ac637e10..a22b5d182e0e 100644 --- a/drivers/cpufreq/ia64-acpi-cpufreq.c +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c | |||
| @@ -332,7 +332,6 @@ acpi_cpufreq_cpu_exit ( | |||
| 332 | pr_debug("acpi_cpufreq_cpu_exit\n"); | 332 | pr_debug("acpi_cpufreq_cpu_exit\n"); |
| 333 | 333 | ||
| 334 | if (data) { | 334 | if (data) { |
| 335 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 336 | acpi_io_data[policy->cpu] = NULL; | 335 | acpi_io_data[policy->cpu] = NULL; |
| 337 | acpi_processor_unregister_performance(&data->acpi_data, | 336 | acpi_processor_unregister_performance(&data->acpi_data, |
| 338 | policy->cpu); | 337 | policy->cpu); |
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index ce69059be1fc..e27fca86fe4f 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c | |||
| @@ -144,7 +144,6 @@ static struct cpufreq_driver imx6q_cpufreq_driver = { | |||
| 144 | .target_index = imx6q_set_target, | 144 | .target_index = imx6q_set_target, |
| 145 | .get = cpufreq_generic_get, | 145 | .get = cpufreq_generic_get, |
| 146 | .init = imx6q_cpufreq_init, | 146 | .init = imx6q_cpufreq_init, |
| 147 | .exit = cpufreq_generic_exit, | ||
| 148 | .name = "imx6q-cpufreq", | 147 | .name = "imx6q-cpufreq", |
| 149 | .attr = cpufreq_generic_attr, | 148 | .attr = cpufreq_generic_attr, |
| 150 | }; | 149 | }; |
diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c index 0e27844e8c2d..e5122f1bfe78 100644 --- a/drivers/cpufreq/integrator-cpufreq.c +++ b/drivers/cpufreq/integrator-cpufreq.c | |||
| @@ -122,7 +122,7 @@ static int integrator_set_target(struct cpufreq_policy *policy, | |||
| 122 | return 0; | 122 | return 0; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 125 | cpufreq_freq_transition_begin(policy, &freqs); |
| 126 | 126 | ||
| 127 | cm_osc = __raw_readl(cm_base + INTEGRATOR_HDR_OSC_OFFSET); | 127 | cm_osc = __raw_readl(cm_base + INTEGRATOR_HDR_OSC_OFFSET); |
| 128 | 128 | ||
| @@ -143,7 +143,7 @@ static int integrator_set_target(struct cpufreq_policy *policy, | |||
| 143 | */ | 143 | */ |
| 144 | set_cpus_allowed(current, cpus_allowed); | 144 | set_cpus_allowed(current, cpus_allowed); |
| 145 | 145 | ||
| 146 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 146 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 147 | 147 | ||
| 148 | return 0; | 148 | return 0; |
| 149 | } | 149 | } |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 2cd36b9297f3..099967302bf2 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
| @@ -99,8 +99,7 @@ struct cpudata { | |||
| 99 | u64 prev_aperf; | 99 | u64 prev_aperf; |
| 100 | u64 prev_mperf; | 100 | u64 prev_mperf; |
| 101 | unsigned long long prev_tsc; | 101 | unsigned long long prev_tsc; |
| 102 | int sample_ptr; | 102 | struct sample sample; |
| 103 | struct sample samples[SAMPLE_COUNT]; | ||
| 104 | }; | 103 | }; |
| 105 | 104 | ||
| 106 | static struct cpudata **all_cpu_data; | 105 | static struct cpudata **all_cpu_data; |
| @@ -154,7 +153,7 @@ static inline void pid_reset(struct _pid *pid, int setpoint, int busy, | |||
| 154 | pid->setpoint = setpoint; | 153 | pid->setpoint = setpoint; |
| 155 | pid->deadband = deadband; | 154 | pid->deadband = deadband; |
| 156 | pid->integral = int_tofp(integral); | 155 | pid->integral = int_tofp(integral); |
| 157 | pid->last_err = setpoint - busy; | 156 | pid->last_err = int_tofp(setpoint) - int_tofp(busy); |
| 158 | } | 157 | } |
| 159 | 158 | ||
| 160 | static inline void pid_p_gain_set(struct _pid *pid, int percent) | 159 | static inline void pid_p_gain_set(struct _pid *pid, int percent) |
| @@ -447,7 +446,7 @@ static void core_set_pstate(struct cpudata *cpudata, int pstate) | |||
| 447 | if (limits.no_turbo) | 446 | if (limits.no_turbo) |
| 448 | val |= (u64)1 << 32; | 447 | val |= (u64)1 << 32; |
| 449 | 448 | ||
| 450 | wrmsrl(MSR_IA32_PERF_CTL, val); | 449 | wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); |
| 451 | } | 450 | } |
| 452 | 451 | ||
| 453 | static struct cpu_defaults core_params = { | 452 | static struct cpu_defaults core_params = { |
| @@ -586,15 +585,14 @@ static inline void intel_pstate_sample(struct cpudata *cpu) | |||
| 586 | mperf = mperf >> FRAC_BITS; | 585 | mperf = mperf >> FRAC_BITS; |
| 587 | tsc = tsc >> FRAC_BITS; | 586 | tsc = tsc >> FRAC_BITS; |
| 588 | 587 | ||
| 589 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; | 588 | cpu->sample.aperf = aperf; |
| 590 | cpu->samples[cpu->sample_ptr].aperf = aperf; | 589 | cpu->sample.mperf = mperf; |
| 591 | cpu->samples[cpu->sample_ptr].mperf = mperf; | 590 | cpu->sample.tsc = tsc; |
| 592 | cpu->samples[cpu->sample_ptr].tsc = tsc; | 591 | cpu->sample.aperf -= cpu->prev_aperf; |
| 593 | cpu->samples[cpu->sample_ptr].aperf -= cpu->prev_aperf; | 592 | cpu->sample.mperf -= cpu->prev_mperf; |
| 594 | cpu->samples[cpu->sample_ptr].mperf -= cpu->prev_mperf; | 593 | cpu->sample.tsc -= cpu->prev_tsc; |
| 595 | cpu->samples[cpu->sample_ptr].tsc -= cpu->prev_tsc; | ||
| 596 | 594 | ||
| 597 | intel_pstate_calc_busy(cpu, &cpu->samples[cpu->sample_ptr]); | 595 | intel_pstate_calc_busy(cpu, &cpu->sample); |
| 598 | 596 | ||
| 599 | cpu->prev_aperf = aperf; | 597 | cpu->prev_aperf = aperf; |
| 600 | cpu->prev_mperf = mperf; | 598 | cpu->prev_mperf = mperf; |
| @@ -614,7 +612,7 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | |||
| 614 | { | 612 | { |
| 615 | int32_t core_busy, max_pstate, current_pstate; | 613 | int32_t core_busy, max_pstate, current_pstate; |
| 616 | 614 | ||
| 617 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; | 615 | core_busy = cpu->sample.core_pct_busy; |
| 618 | max_pstate = int_tofp(cpu->pstate.max_pstate); | 616 | max_pstate = int_tofp(cpu->pstate.max_pstate); |
| 619 | current_pstate = int_tofp(cpu->pstate.current_pstate); | 617 | current_pstate = int_tofp(cpu->pstate.current_pstate); |
| 620 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); | 618 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); |
| @@ -648,7 +646,7 @@ static void intel_pstate_timer_func(unsigned long __data) | |||
| 648 | 646 | ||
| 649 | intel_pstate_sample(cpu); | 647 | intel_pstate_sample(cpu); |
| 650 | 648 | ||
| 651 | sample = &cpu->samples[cpu->sample_ptr]; | 649 | sample = &cpu->sample; |
| 652 | 650 | ||
| 653 | intel_pstate_adjust_busy_pstate(cpu); | 651 | intel_pstate_adjust_busy_pstate(cpu); |
| 654 | 652 | ||
| @@ -729,7 +727,7 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) | |||
| 729 | cpu = all_cpu_data[cpu_num]; | 727 | cpu = all_cpu_data[cpu_num]; |
| 730 | if (!cpu) | 728 | if (!cpu) |
| 731 | return 0; | 729 | return 0; |
| 732 | sample = &cpu->samples[cpu->sample_ptr]; | 730 | sample = &cpu->sample; |
| 733 | return sample->freq; | 731 | return sample->freq; |
| 734 | } | 732 | } |
| 735 | 733 | ||
| @@ -773,14 +771,17 @@ static int intel_pstate_verify_policy(struct cpufreq_policy *policy) | |||
| 773 | return 0; | 771 | return 0; |
| 774 | } | 772 | } |
| 775 | 773 | ||
| 776 | static int intel_pstate_cpu_exit(struct cpufreq_policy *policy) | 774 | static void intel_pstate_stop_cpu(struct cpufreq_policy *policy) |
| 777 | { | 775 | { |
| 778 | int cpu = policy->cpu; | 776 | int cpu_num = policy->cpu; |
| 777 | struct cpudata *cpu = all_cpu_data[cpu_num]; | ||
| 779 | 778 | ||
| 780 | del_timer(&all_cpu_data[cpu]->timer); | 779 | pr_info("intel_pstate CPU %d exiting\n", cpu_num); |
| 781 | kfree(all_cpu_data[cpu]); | 780 | |
| 782 | all_cpu_data[cpu] = NULL; | 781 | del_timer_sync(&all_cpu_data[cpu_num]->timer); |
| 783 | return 0; | 782 | intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate); |
| 783 | kfree(all_cpu_data[cpu_num]); | ||
| 784 | all_cpu_data[cpu_num] = NULL; | ||
| 784 | } | 785 | } |
| 785 | 786 | ||
| 786 | static int intel_pstate_cpu_init(struct cpufreq_policy *policy) | 787 | static int intel_pstate_cpu_init(struct cpufreq_policy *policy) |
| @@ -818,7 +819,7 @@ static struct cpufreq_driver intel_pstate_driver = { | |||
| 818 | .setpolicy = intel_pstate_set_policy, | 819 | .setpolicy = intel_pstate_set_policy, |
| 819 | .get = intel_pstate_get, | 820 | .get = intel_pstate_get, |
| 820 | .init = intel_pstate_cpu_init, | 821 | .init = intel_pstate_cpu_init, |
| 821 | .exit = intel_pstate_cpu_exit, | 822 | .stop_cpu = intel_pstate_stop_cpu, |
| 822 | .name = "intel_pstate", | 823 | .name = "intel_pstate", |
| 823 | }; | 824 | }; |
| 824 | 825 | ||
diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c index eb7abe345b50..3d114bc5a97a 100644 --- a/drivers/cpufreq/kirkwood-cpufreq.c +++ b/drivers/cpufreq/kirkwood-cpufreq.c | |||
| @@ -102,7 +102,6 @@ static struct cpufreq_driver kirkwood_cpufreq_driver = { | |||
| 102 | .verify = cpufreq_generic_frequency_table_verify, | 102 | .verify = cpufreq_generic_frequency_table_verify, |
| 103 | .target_index = kirkwood_cpufreq_target, | 103 | .target_index = kirkwood_cpufreq_target, |
| 104 | .init = kirkwood_cpufreq_cpu_init, | 104 | .init = kirkwood_cpufreq_cpu_init, |
| 105 | .exit = cpufreq_generic_exit, | ||
| 106 | .name = "kirkwood-cpufreq", | 105 | .name = "kirkwood-cpufreq", |
| 107 | .attr = cpufreq_generic_attr, | 106 | .attr = cpufreq_generic_attr, |
| 108 | }; | 107 | }; |
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 45bafddfd8ea..5c440f87ba8a 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c | |||
| @@ -269,7 +269,7 @@ static void longhaul_setstate(struct cpufreq_policy *policy, | |||
| 269 | freqs.old = calc_speed(longhaul_get_cpu_mult()); | 269 | freqs.old = calc_speed(longhaul_get_cpu_mult()); |
| 270 | freqs.new = speed; | 270 | freqs.new = speed; |
| 271 | 271 | ||
| 272 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 272 | cpufreq_freq_transition_begin(policy, &freqs); |
| 273 | 273 | ||
| 274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", | 274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", |
| 275 | fsb, mult/10, mult%10, print_speed(speed/1000)); | 275 | fsb, mult/10, mult%10, print_speed(speed/1000)); |
| @@ -386,7 +386,7 @@ retry_loop: | |||
| 386 | } | 386 | } |
| 387 | } | 387 | } |
| 388 | /* Report true CPU frequency */ | 388 | /* Report true CPU frequency */ |
| 389 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 389 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 390 | 390 | ||
| 391 | if (!bm_timeout) | 391 | if (!bm_timeout) |
| 392 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " | 392 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " |
| @@ -913,7 +913,6 @@ static struct cpufreq_driver longhaul_driver = { | |||
| 913 | .target_index = longhaul_target, | 913 | .target_index = longhaul_target, |
| 914 | .get = longhaul_get, | 914 | .get = longhaul_get, |
| 915 | .init = longhaul_cpu_init, | 915 | .init = longhaul_cpu_init, |
| 916 | .exit = cpufreq_generic_exit, | ||
| 917 | .name = "longhaul", | 916 | .name = "longhaul", |
| 918 | .attr = cpufreq_generic_attr, | 917 | .attr = cpufreq_generic_attr, |
| 919 | }; | 918 | }; |
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index b6581abc9207..a3588d61d933 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
| @@ -104,7 +104,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 104 | 104 | ||
| 105 | static int loongson2_cpufreq_exit(struct cpufreq_policy *policy) | 105 | static int loongson2_cpufreq_exit(struct cpufreq_policy *policy) |
| 106 | { | 106 | { |
| 107 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 108 | clk_put(policy->clk); | 107 | clk_put(policy->clk); |
| 109 | return 0; | 108 | return 0; |
| 110 | } | 109 | } |
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 590f5b66d181..5f69c9aa703c 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c | |||
| @@ -143,7 +143,6 @@ fail: | |||
| 143 | 143 | ||
| 144 | static int omap_cpu_exit(struct cpufreq_policy *policy) | 144 | static int omap_cpu_exit(struct cpufreq_policy *policy) |
| 145 | { | 145 | { |
| 146 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 147 | freq_table_free(); | 146 | freq_table_free(); |
| 148 | clk_put(policy->clk); | 147 | clk_put(policy->clk); |
| 149 | return 0; | 148 | return 0; |
diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c index 3d1cba9fd5f9..74f593e70e19 100644 --- a/drivers/cpufreq/p4-clockmod.c +++ b/drivers/cpufreq/p4-clockmod.c | |||
| @@ -237,7 +237,6 @@ static struct cpufreq_driver p4clockmod_driver = { | |||
| 237 | .verify = cpufreq_generic_frequency_table_verify, | 237 | .verify = cpufreq_generic_frequency_table_verify, |
| 238 | .target_index = cpufreq_p4_target, | 238 | .target_index = cpufreq_p4_target, |
| 239 | .init = cpufreq_p4_cpu_init, | 239 | .init = cpufreq_p4_cpu_init, |
| 240 | .exit = cpufreq_generic_exit, | ||
| 241 | .get = cpufreq_p4_get, | 240 | .get = cpufreq_p4_get, |
| 242 | .name = "p4-clockmod", | 241 | .name = "p4-clockmod", |
| 243 | .attr = cpufreq_generic_attr, | 242 | .attr = cpufreq_generic_attr, |
diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c index 0426008380d8..6a2b7d3e85a7 100644 --- a/drivers/cpufreq/pasemi-cpufreq.c +++ b/drivers/cpufreq/pasemi-cpufreq.c | |||
| @@ -234,7 +234,6 @@ static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy) | |||
| 234 | if (sdcpwr_mapbase) | 234 | if (sdcpwr_mapbase) |
| 235 | iounmap(sdcpwr_mapbase); | 235 | iounmap(sdcpwr_mapbase); |
| 236 | 236 | ||
| 237 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 238 | return 0; | 237 | return 0; |
| 239 | } | 238 | } |
| 240 | 239 | ||
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index 1c0f1067af73..728a2d879499 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c | |||
| @@ -215,7 +215,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
| 215 | 215 | ||
| 216 | freqs.old = policy->cur; | 216 | freqs.old = policy->cur; |
| 217 | freqs.new = target_freq; | 217 | freqs.new = target_freq; |
| 218 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 218 | cpufreq_freq_transition_begin(policy, &freqs); |
| 219 | 219 | ||
| 220 | input_buffer = 0x1 | (((target_freq * 100) | 220 | input_buffer = 0x1 | (((target_freq * 100) |
| 221 | / (ioread32(&pcch_hdr->nominal) * 1000)) << 8); | 221 | / (ioread32(&pcch_hdr->nominal) * 1000)) << 8); |
| @@ -231,7 +231,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
| 231 | status = ioread16(&pcch_hdr->status); | 231 | status = ioread16(&pcch_hdr->status); |
| 232 | iowrite16(0, &pcch_hdr->status); | 232 | iowrite16(0, &pcch_hdr->status); |
| 233 | 233 | ||
| 234 | cpufreq_notify_post_transition(policy, &freqs, status != CMD_COMPLETE); | 234 | cpufreq_freq_transition_end(policy, &freqs, status != CMD_COMPLETE); |
| 235 | spin_unlock(&pcc_lock); | 235 | spin_unlock(&pcc_lock); |
| 236 | 236 | ||
| 237 | if (status != CMD_COMPLETE) { | 237 | if (status != CMD_COMPLETE) { |
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index b9a444e358b5..62c6f2e5afce 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c | |||
| @@ -148,11 +148,11 @@ static int powernow_k6_target(struct cpufreq_policy *policy, | |||
| 148 | freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); | 148 | freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); |
| 149 | freqs.new = busfreq * clock_ratio[best_i].driver_data; | 149 | freqs.new = busfreq * clock_ratio[best_i].driver_data; |
| 150 | 150 | ||
| 151 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 151 | cpufreq_freq_transition_begin(policy, &freqs); |
| 152 | 152 | ||
| 153 | powernow_k6_set_cpu_multiplier(best_i); | 153 | powernow_k6_set_cpu_multiplier(best_i); |
| 154 | 154 | ||
| 155 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 155 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 156 | 156 | ||
| 157 | return 0; | 157 | return 0; |
| 158 | } | 158 | } |
| @@ -231,7 +231,6 @@ static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) | |||
| 231 | if (i == max_multiplier) | 231 | if (i == max_multiplier) |
| 232 | powernow_k6_target(policy, i); | 232 | powernow_k6_target(policy, i); |
| 233 | } | 233 | } |
| 234 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 235 | return 0; | 234 | return 0; |
| 236 | } | 235 | } |
| 237 | 236 | ||
diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c index 946708a1d745..f911645c3f6d 100644 --- a/drivers/cpufreq/powernow-k7.c +++ b/drivers/cpufreq/powernow-k7.c | |||
| @@ -269,7 +269,7 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) | |||
| 269 | 269 | ||
| 270 | freqs.new = powernow_table[index].frequency; | 270 | freqs.new = powernow_table[index].frequency; |
| 271 | 271 | ||
| 272 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 272 | cpufreq_freq_transition_begin(policy, &freqs); |
| 273 | 273 | ||
| 274 | /* Now do the magic poking into the MSRs. */ | 274 | /* Now do the magic poking into the MSRs. */ |
| 275 | 275 | ||
| @@ -290,7 +290,7 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) | |||
| 290 | if (have_a0 == 1) | 290 | if (have_a0 == 1) |
| 291 | local_irq_enable(); | 291 | local_irq_enable(); |
| 292 | 292 | ||
| 293 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 293 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 294 | 294 | ||
| 295 | return 0; | 295 | return 0; |
| 296 | } | 296 | } |
| @@ -664,8 +664,6 @@ static int powernow_cpu_init(struct cpufreq_policy *policy) | |||
| 664 | 664 | ||
| 665 | static int powernow_cpu_exit(struct cpufreq_policy *policy) | 665 | static int powernow_cpu_exit(struct cpufreq_policy *policy) |
| 666 | { | 666 | { |
| 667 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 668 | |||
| 669 | #ifdef CONFIG_X86_POWERNOW_K7_ACPI | 667 | #ifdef CONFIG_X86_POWERNOW_K7_ACPI |
| 670 | if (acpi_processor_perf) { | 668 | if (acpi_processor_perf) { |
| 671 | acpi_processor_unregister_performance(acpi_processor_perf, 0); | 669 | acpi_processor_unregister_performance(acpi_processor_perf, 0); |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 6684e0342792..770a9e1b3468 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
| @@ -963,9 +963,9 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, | |||
| 963 | policy = cpufreq_cpu_get(smp_processor_id()); | 963 | policy = cpufreq_cpu_get(smp_processor_id()); |
| 964 | cpufreq_cpu_put(policy); | 964 | cpufreq_cpu_put(policy); |
| 965 | 965 | ||
| 966 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 966 | cpufreq_freq_transition_begin(policy, &freqs); |
| 967 | res = transition_fid_vid(data, fid, vid); | 967 | res = transition_fid_vid(data, fid, vid); |
| 968 | cpufreq_notify_post_transition(policy, &freqs, res); | 968 | cpufreq_freq_transition_end(policy, &freqs, res); |
| 969 | 969 | ||
| 970 | return res; | 970 | return res; |
| 971 | } | 971 | } |
| @@ -1164,8 +1164,6 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol) | |||
| 1164 | 1164 | ||
| 1165 | powernow_k8_cpu_exit_acpi(data); | 1165 | powernow_k8_cpu_exit_acpi(data); |
| 1166 | 1166 | ||
| 1167 | cpufreq_frequency_table_put_attr(pol->cpu); | ||
| 1168 | |||
| 1169 | kfree(data->powernow_table); | 1167 | kfree(data->powernow_table); |
| 1170 | kfree(data); | 1168 | kfree(data); |
| 1171 | for_each_cpu(cpu, pol->cpus) | 1169 | for_each_cpu(cpu, pol->cpus) |
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index 051000f44ca2..3bd9123e7026 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
| 24 | #include <sysdev/fsl_soc.h> | ||
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| 26 | * struct cpu_data - per CPU data struct | 27 | * struct cpu_data - per CPU data struct |
| @@ -205,7 +206,8 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 205 | for_each_cpu(i, per_cpu(cpu_mask, cpu)) | 206 | for_each_cpu(i, per_cpu(cpu_mask, cpu)) |
| 206 | per_cpu(cpu_data, i) = data; | 207 | per_cpu(cpu_data, i) = data; |
| 207 | 208 | ||
| 208 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 209 | policy->cpuinfo.transition_latency = |
| 210 | (12 * NSEC_PER_SEC) / fsl_get_sys_freq(); | ||
| 209 | of_node_put(np); | 211 | of_node_put(np); |
| 210 | 212 | ||
| 211 | return 0; | 213 | return 0; |
| @@ -228,7 +230,6 @@ static int __exit corenet_cpufreq_cpu_exit(struct cpufreq_policy *policy) | |||
| 228 | struct cpu_data *data = per_cpu(cpu_data, policy->cpu); | 230 | struct cpu_data *data = per_cpu(cpu_data, policy->cpu); |
| 229 | unsigned int cpu; | 231 | unsigned int cpu; |
| 230 | 232 | ||
| 231 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 232 | of_node_put(data->parent); | 233 | of_node_put(data->parent); |
| 233 | kfree(data->table); | 234 | kfree(data->table); |
| 234 | kfree(data); | 235 | kfree(data); |
diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c index e42ca9c31cea..af7b1cabd1e7 100644 --- a/drivers/cpufreq/ppc_cbe_cpufreq.c +++ b/drivers/cpufreq/ppc_cbe_cpufreq.c | |||
| @@ -141,7 +141,6 @@ static struct cpufreq_driver cbe_cpufreq_driver = { | |||
| 141 | .verify = cpufreq_generic_frequency_table_verify, | 141 | .verify = cpufreq_generic_frequency_table_verify, |
| 142 | .target_index = cbe_cpufreq_target, | 142 | .target_index = cbe_cpufreq_target, |
| 143 | .init = cbe_cpufreq_cpu_init, | 143 | .init = cbe_cpufreq_cpu_init, |
| 144 | .exit = cpufreq_generic_exit, | ||
| 145 | .name = "cbe-cpufreq", | 144 | .name = "cbe-cpufreq", |
| 146 | .flags = CPUFREQ_CONST_LOOPS, | 145 | .flags = CPUFREQ_CONST_LOOPS, |
| 147 | }; | 146 | }; |
diff --git a/drivers/cpufreq/pxa2xx-cpufreq.c b/drivers/cpufreq/pxa2xx-cpufreq.c index a9195a86b069..e24269ab4e9b 100644 --- a/drivers/cpufreq/pxa2xx-cpufreq.c +++ b/drivers/cpufreq/pxa2xx-cpufreq.c | |||
| @@ -427,7 +427,6 @@ static struct cpufreq_driver pxa_cpufreq_driver = { | |||
| 427 | .verify = cpufreq_generic_frequency_table_verify, | 427 | .verify = cpufreq_generic_frequency_table_verify, |
| 428 | .target_index = pxa_set_target, | 428 | .target_index = pxa_set_target, |
| 429 | .init = pxa_cpufreq_init, | 429 | .init = pxa_cpufreq_init, |
| 430 | .exit = cpufreq_generic_exit, | ||
| 431 | .get = pxa_cpufreq_get, | 430 | .get = pxa_cpufreq_get, |
| 432 | .name = "PXA2xx", | 431 | .name = "PXA2xx", |
| 433 | }; | 432 | }; |
diff --git a/drivers/cpufreq/pxa3xx-cpufreq.c b/drivers/cpufreq/pxa3xx-cpufreq.c index 3785687e9d70..a01275900389 100644 --- a/drivers/cpufreq/pxa3xx-cpufreq.c +++ b/drivers/cpufreq/pxa3xx-cpufreq.c | |||
| @@ -205,7 +205,6 @@ static struct cpufreq_driver pxa3xx_cpufreq_driver = { | |||
| 205 | .verify = cpufreq_generic_frequency_table_verify, | 205 | .verify = cpufreq_generic_frequency_table_verify, |
| 206 | .target_index = pxa3xx_cpufreq_set, | 206 | .target_index = pxa3xx_cpufreq_set, |
| 207 | .init = pxa3xx_cpufreq_init, | 207 | .init = pxa3xx_cpufreq_init, |
| 208 | .exit = cpufreq_generic_exit, | ||
| 209 | .get = pxa3xx_cpufreq_get, | 208 | .get = pxa3xx_cpufreq_get, |
| 210 | .name = "pxa3xx-cpufreq", | 209 | .name = "pxa3xx-cpufreq", |
| 211 | }; | 210 | }; |
diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c index 25069741b507..a3dc192d21f9 100644 --- a/drivers/cpufreq/s3c24xx-cpufreq.c +++ b/drivers/cpufreq/s3c24xx-cpufreq.c | |||
| @@ -217,7 +217,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy, | |||
| 217 | s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk); | 217 | s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk); |
| 218 | 218 | ||
| 219 | /* start the frequency change */ | 219 | /* start the frequency change */ |
| 220 | cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_PRECHANGE); | 220 | cpufreq_freq_transition_begin(policy, &freqs.freqs); |
| 221 | 221 | ||
| 222 | /* If hclk is staying the same, then we do not need to | 222 | /* If hclk is staying the same, then we do not need to |
| 223 | * re-write the IO or the refresh timings whilst we are changing | 223 | * re-write the IO or the refresh timings whilst we are changing |
| @@ -261,7 +261,7 @@ static int s3c_cpufreq_settarget(struct cpufreq_policy *policy, | |||
| 261 | local_irq_restore(flags); | 261 | local_irq_restore(flags); |
| 262 | 262 | ||
| 263 | /* notify everyone we've done this */ | 263 | /* notify everyone we've done this */ |
| 264 | cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_POSTCHANGE); | 264 | cpufreq_freq_transition_end(policy, &freqs.freqs, 0); |
| 265 | 265 | ||
| 266 | s3c_freq_dbg("%s: finished\n", __func__); | 266 | s3c_freq_dbg("%s: finished\n", __func__); |
| 267 | return 0; | 267 | return 0; |
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index 55a8e9fa9435..72421534fff5 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <linux/cpufreq.h> | 18 | #include <linux/cpufreq.h> |
| 19 | #include <linux/reboot.h> | 19 | #include <linux/reboot.h> |
| 20 | #include <linux/regulator/consumer.h> | 20 | #include <linux/regulator/consumer.h> |
| 21 | #include <linux/suspend.h> | ||
| 22 | 21 | ||
| 23 | #include <mach/map.h> | 22 | #include <mach/map.h> |
| 24 | #include <mach/regs-clock.h> | 23 | #include <mach/regs-clock.h> |
| @@ -435,18 +434,6 @@ exit: | |||
| 435 | return ret; | 434 | return ret; |
| 436 | } | 435 | } |
| 437 | 436 | ||
| 438 | #ifdef CONFIG_PM | ||
| 439 | static int s5pv210_cpufreq_suspend(struct cpufreq_policy *policy) | ||
| 440 | { | ||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | |||
| 444 | static int s5pv210_cpufreq_resume(struct cpufreq_policy *policy) | ||
| 445 | { | ||
| 446 | return 0; | ||
| 447 | } | ||
| 448 | #endif | ||
| 449 | |||
| 450 | static int check_mem_type(void __iomem *dmc_reg) | 437 | static int check_mem_type(void __iomem *dmc_reg) |
| 451 | { | 438 | { |
| 452 | unsigned long val; | 439 | unsigned long val; |
| @@ -502,6 +489,7 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) | |||
| 502 | s5pv210_dram_conf[1].refresh = (__raw_readl(S5P_VA_DMC1 + 0x30) * 1000); | 489 | s5pv210_dram_conf[1].refresh = (__raw_readl(S5P_VA_DMC1 + 0x30) * 1000); |
| 503 | s5pv210_dram_conf[1].freq = clk_get_rate(dmc1_clk); | 490 | s5pv210_dram_conf[1].freq = clk_get_rate(dmc1_clk); |
| 504 | 491 | ||
| 492 | policy->suspend_freq = SLEEP_FREQ; | ||
| 505 | return cpufreq_generic_init(policy, s5pv210_freq_table, 40000); | 493 | return cpufreq_generic_init(policy, s5pv210_freq_table, 40000); |
| 506 | 494 | ||
| 507 | out_dmc1: | 495 | out_dmc1: |
| @@ -511,32 +499,6 @@ out_dmc0: | |||
| 511 | return ret; | 499 | return ret; |
| 512 | } | 500 | } |
| 513 | 501 | ||
| 514 | static int s5pv210_cpufreq_notifier_event(struct notifier_block *this, | ||
| 515 | unsigned long event, void *ptr) | ||
| 516 | { | ||
| 517 | int ret; | ||
| 518 | |||
| 519 | switch (event) { | ||
| 520 | case PM_SUSPEND_PREPARE: | ||
| 521 | ret = cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, 0); | ||
| 522 | if (ret < 0) | ||
| 523 | return NOTIFY_BAD; | ||
| 524 | |||
| 525 | /* Disable updation of cpu frequency */ | ||
| 526 | no_cpufreq_access = true; | ||
| 527 | return NOTIFY_OK; | ||
| 528 | case PM_POST_RESTORE: | ||
| 529 | case PM_POST_SUSPEND: | ||
| 530 | /* Enable updation of cpu frequency */ | ||
| 531 | no_cpufreq_access = false; | ||
| 532 | cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, 0); | ||
| 533 | |||
| 534 | return NOTIFY_OK; | ||
| 535 | } | ||
| 536 | |||
| 537 | return NOTIFY_DONE; | ||
| 538 | } | ||
| 539 | |||
| 540 | static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this, | 502 | static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this, |
| 541 | unsigned long event, void *ptr) | 503 | unsigned long event, void *ptr) |
| 542 | { | 504 | { |
| @@ -558,15 +520,11 @@ static struct cpufreq_driver s5pv210_driver = { | |||
| 558 | .init = s5pv210_cpu_init, | 520 | .init = s5pv210_cpu_init, |
| 559 | .name = "s5pv210", | 521 | .name = "s5pv210", |
| 560 | #ifdef CONFIG_PM | 522 | #ifdef CONFIG_PM |
| 561 | .suspend = s5pv210_cpufreq_suspend, | 523 | .suspend = cpufreq_generic_suspend, |
| 562 | .resume = s5pv210_cpufreq_resume, | 524 | .resume = cpufreq_generic_suspend, /* We need to set SLEEP FREQ again */ |
| 563 | #endif | 525 | #endif |
| 564 | }; | 526 | }; |
| 565 | 527 | ||
| 566 | static struct notifier_block s5pv210_cpufreq_notifier = { | ||
| 567 | .notifier_call = s5pv210_cpufreq_notifier_event, | ||
| 568 | }; | ||
| 569 | |||
| 570 | static struct notifier_block s5pv210_cpufreq_reboot_notifier = { | 528 | static struct notifier_block s5pv210_cpufreq_reboot_notifier = { |
| 571 | .notifier_call = s5pv210_cpufreq_reboot_notifier_event, | 529 | .notifier_call = s5pv210_cpufreq_reboot_notifier_event, |
| 572 | }; | 530 | }; |
| @@ -586,7 +544,6 @@ static int __init s5pv210_cpufreq_init(void) | |||
| 586 | return PTR_ERR(int_regulator); | 544 | return PTR_ERR(int_regulator); |
| 587 | } | 545 | } |
| 588 | 546 | ||
| 589 | register_pm_notifier(&s5pv210_cpufreq_notifier); | ||
| 590 | register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier); | 547 | register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier); |
| 591 | 548 | ||
| 592 | return cpufreq_register_driver(&s5pv210_driver); | 549 | return cpufreq_register_driver(&s5pv210_driver); |
diff --git a/drivers/cpufreq/sc520_freq.c b/drivers/cpufreq/sc520_freq.c index 6adb354e359c..69371bf0886d 100644 --- a/drivers/cpufreq/sc520_freq.c +++ b/drivers/cpufreq/sc520_freq.c | |||
| @@ -93,7 +93,6 @@ static struct cpufreq_driver sc520_freq_driver = { | |||
| 93 | .verify = cpufreq_generic_frequency_table_verify, | 93 | .verify = cpufreq_generic_frequency_table_verify, |
| 94 | .target_index = sc520_freq_target, | 94 | .target_index = sc520_freq_target, |
| 95 | .init = sc520_freq_cpu_init, | 95 | .init = sc520_freq_cpu_init, |
| 96 | .exit = cpufreq_generic_exit, | ||
| 97 | .name = "sc520_freq", | 96 | .name = "sc520_freq", |
| 98 | .attr = cpufreq_generic_attr, | 97 | .attr = cpufreq_generic_attr, |
| 99 | }; | 98 | }; |
diff --git a/drivers/cpufreq/sh-cpufreq.c b/drivers/cpufreq/sh-cpufreq.c index 387af12503a6..86628e22b2a3 100644 --- a/drivers/cpufreq/sh-cpufreq.c +++ b/drivers/cpufreq/sh-cpufreq.c | |||
| @@ -68,10 +68,10 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy, | |||
| 68 | freqs.new = (freq + 500) / 1000; | 68 | freqs.new = (freq + 500) / 1000; |
| 69 | freqs.flags = 0; | 69 | freqs.flags = 0; |
| 70 | 70 | ||
| 71 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 71 | cpufreq_freq_transition_begin(policy, &freqs); |
| 72 | set_cpus_allowed_ptr(current, &cpus_allowed); | 72 | set_cpus_allowed_ptr(current, &cpus_allowed); |
| 73 | clk_set_rate(cpuclk, freq); | 73 | clk_set_rate(cpuclk, freq); |
| 74 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); | 74 | cpufreq_freq_transition_end(policy, &freqs, 0); |
| 75 | 75 | ||
| 76 | dev_dbg(dev, "set frequency %lu Hz\n", freq); | 76 | dev_dbg(dev, "set frequency %lu Hz\n", freq); |
| 77 | 77 | ||
| @@ -143,7 +143,6 @@ static int sh_cpufreq_cpu_exit(struct cpufreq_policy *policy) | |||
| 143 | unsigned int cpu = policy->cpu; | 143 | unsigned int cpu = policy->cpu; |
| 144 | struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); | 144 | struct clk *cpuclk = &per_cpu(sh_cpuclk, cpu); |
| 145 | 145 | ||
| 146 | cpufreq_frequency_table_put_attr(cpu); | ||
| 147 | clk_put(cpuclk); | 146 | clk_put(cpuclk); |
| 148 | 147 | ||
| 149 | return 0; | 148 | return 0; |
diff --git a/drivers/cpufreq/sparc-us2e-cpufreq.c b/drivers/cpufreq/sparc-us2e-cpufreq.c index 62aa23e219d4..b73feeb666f9 100644 --- a/drivers/cpufreq/sparc-us2e-cpufreq.c +++ b/drivers/cpufreq/sparc-us2e-cpufreq.c | |||
| @@ -301,10 +301,8 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) | |||
| 301 | 301 | ||
| 302 | static int us2e_freq_cpu_exit(struct cpufreq_policy *policy) | 302 | static int us2e_freq_cpu_exit(struct cpufreq_policy *policy) |
| 303 | { | 303 | { |
| 304 | if (cpufreq_us2e_driver) { | 304 | if (cpufreq_us2e_driver) |
| 305 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 306 | us2e_freq_target(policy, 0); | 305 | us2e_freq_target(policy, 0); |
| 307 | } | ||
| 308 | 306 | ||
| 309 | return 0; | 307 | return 0; |
| 310 | } | 308 | } |
diff --git a/drivers/cpufreq/sparc-us3-cpufreq.c b/drivers/cpufreq/sparc-us3-cpufreq.c index 724ffbd7105d..9bb42ba50efa 100644 --- a/drivers/cpufreq/sparc-us3-cpufreq.c +++ b/drivers/cpufreq/sparc-us3-cpufreq.c | |||
| @@ -156,10 +156,8 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) | |||
| 156 | 156 | ||
| 157 | static int us3_freq_cpu_exit(struct cpufreq_policy *policy) | 157 | static int us3_freq_cpu_exit(struct cpufreq_policy *policy) |
| 158 | { | 158 | { |
| 159 | if (cpufreq_us3_driver) { | 159 | if (cpufreq_us3_driver) |
| 160 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 161 | us3_freq_target(policy, 0); | 160 | us3_freq_target(policy, 0); |
| 162 | } | ||
| 163 | 161 | ||
| 164 | return 0; | 162 | return 0; |
| 165 | } | 163 | } |
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c index 5c86e3fa5593..4cfdcff8a310 100644 --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/of_device.h> | 21 | #include <linux/of_device.h> |
| 22 | #include <linux/platform_device.h> | ||
| 22 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 23 | #include <linux/types.h> | 24 | #include <linux/types.h> |
| 24 | 25 | ||
| @@ -163,11 +164,10 @@ static struct cpufreq_driver spear_cpufreq_driver = { | |||
| 163 | .target_index = spear_cpufreq_target, | 164 | .target_index = spear_cpufreq_target, |
| 164 | .get = cpufreq_generic_get, | 165 | .get = cpufreq_generic_get, |
| 165 | .init = spear_cpufreq_init, | 166 | .init = spear_cpufreq_init, |
| 166 | .exit = cpufreq_generic_exit, | ||
| 167 | .attr = cpufreq_generic_attr, | 167 | .attr = cpufreq_generic_attr, |
| 168 | }; | 168 | }; |
| 169 | 169 | ||
| 170 | static int spear_cpufreq_driver_init(void) | 170 | static int spear_cpufreq_probe(struct platform_device *pdev) |
| 171 | { | 171 | { |
| 172 | struct device_node *np; | 172 | struct device_node *np; |
| 173 | const struct property *prop; | 173 | const struct property *prop; |
| @@ -235,7 +235,15 @@ out_put_node: | |||
| 235 | of_node_put(np); | 235 | of_node_put(np); |
| 236 | return ret; | 236 | return ret; |
| 237 | } | 237 | } |
| 238 | late_initcall(spear_cpufreq_driver_init); | 238 | |
| 239 | static struct platform_driver spear_cpufreq_platdrv = { | ||
| 240 | .driver = { | ||
| 241 | .name = "spear-cpufreq", | ||
| 242 | .owner = THIS_MODULE, | ||
| 243 | }, | ||
| 244 | .probe = spear_cpufreq_probe, | ||
| 245 | }; | ||
| 246 | module_platform_driver(spear_cpufreq_platdrv); | ||
| 239 | 247 | ||
| 240 | MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>"); | 248 | MODULE_AUTHOR("Deepak Sikri <deepak.sikri@st.com>"); |
| 241 | MODULE_DESCRIPTION("SPEAr CPUFreq driver"); | 249 | MODULE_DESCRIPTION("SPEAr CPUFreq driver"); |
diff --git a/drivers/cpufreq/speedstep-centrino.c b/drivers/cpufreq/speedstep-centrino.c index 4e1daca5ce3b..6723f0390f20 100644 --- a/drivers/cpufreq/speedstep-centrino.c +++ b/drivers/cpufreq/speedstep-centrino.c | |||
| @@ -406,8 +406,6 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy) | |||
| 406 | if (!per_cpu(centrino_model, cpu)) | 406 | if (!per_cpu(centrino_model, cpu)) |
| 407 | return -ENODEV; | 407 | return -ENODEV; |
| 408 | 408 | ||
| 409 | cpufreq_frequency_table_put_attr(cpu); | ||
| 410 | |||
| 411 | per_cpu(centrino_model, cpu) = NULL; | 409 | per_cpu(centrino_model, cpu) = NULL; |
| 412 | 410 | ||
| 413 | return 0; | 411 | return 0; |
diff --git a/drivers/cpufreq/speedstep-ich.c b/drivers/cpufreq/speedstep-ich.c index 7639b2be2a90..394ac159312a 100644 --- a/drivers/cpufreq/speedstep-ich.c +++ b/drivers/cpufreq/speedstep-ich.c | |||
| @@ -311,7 +311,6 @@ static struct cpufreq_driver speedstep_driver = { | |||
| 311 | .verify = cpufreq_generic_frequency_table_verify, | 311 | .verify = cpufreq_generic_frequency_table_verify, |
| 312 | .target_index = speedstep_target, | 312 | .target_index = speedstep_target, |
| 313 | .init = speedstep_cpu_init, | 313 | .init = speedstep_cpu_init, |
| 314 | .exit = cpufreq_generic_exit, | ||
| 315 | .get = speedstep_get, | 314 | .get = speedstep_get, |
| 316 | .attr = cpufreq_generic_attr, | 315 | .attr = cpufreq_generic_attr, |
| 317 | }; | 316 | }; |
diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c index 998c17b42200..db5d274dc13a 100644 --- a/drivers/cpufreq/speedstep-smi.c +++ b/drivers/cpufreq/speedstep-smi.c | |||
| @@ -280,7 +280,6 @@ static struct cpufreq_driver speedstep_driver = { | |||
| 280 | .verify = cpufreq_generic_frequency_table_verify, | 280 | .verify = cpufreq_generic_frequency_table_verify, |
| 281 | .target_index = speedstep_target, | 281 | .target_index = speedstep_target, |
| 282 | .init = speedstep_cpu_init, | 282 | .init = speedstep_cpu_init, |
| 283 | .exit = cpufreq_generic_exit, | ||
| 284 | .get = speedstep_get, | 283 | .get = speedstep_get, |
| 285 | .resume = speedstep_resume, | 284 | .resume = speedstep_resume, |
| 286 | .attr = cpufreq_generic_attr, | 285 | .attr = cpufreq_generic_attr, |
diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index e652c1bd8d0f..63f00598a251 100644 --- a/drivers/cpufreq/tegra-cpufreq.c +++ b/drivers/cpufreq/tegra-cpufreq.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
| 27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
| 28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
| 29 | #include <linux/suspend.h> | ||
| 30 | 29 | ||
| 31 | static struct cpufreq_frequency_table freq_table[] = { | 30 | static struct cpufreq_frequency_table freq_table[] = { |
| 32 | { .frequency = 216000 }, | 31 | { .frequency = 216000 }, |
| @@ -47,9 +46,6 @@ static struct clk *pll_x_clk; | |||
| 47 | static struct clk *pll_p_clk; | 46 | static struct clk *pll_p_clk; |
| 48 | static struct clk *emc_clk; | 47 | static struct clk *emc_clk; |
| 49 | 48 | ||
| 50 | static DEFINE_MUTEX(tegra_cpu_lock); | ||
| 51 | static bool is_suspended; | ||
| 52 | |||
| 53 | static int tegra_cpu_clk_set_rate(unsigned long rate) | 49 | static int tegra_cpu_clk_set_rate(unsigned long rate) |
| 54 | { | 50 | { |
| 55 | int ret; | 51 | int ret; |
| @@ -112,42 +108,9 @@ static int tegra_update_cpu_speed(struct cpufreq_policy *policy, | |||
| 112 | 108 | ||
| 113 | static int tegra_target(struct cpufreq_policy *policy, unsigned int index) | 109 | static int tegra_target(struct cpufreq_policy *policy, unsigned int index) |
| 114 | { | 110 | { |
| 115 | int ret = -EBUSY; | 111 | return tegra_update_cpu_speed(policy, freq_table[index].frequency); |
| 116 | |||
| 117 | mutex_lock(&tegra_cpu_lock); | ||
| 118 | |||
| 119 | if (!is_suspended) | ||
| 120 | ret = tegra_update_cpu_speed(policy, | ||
| 121 | freq_table[index].frequency); | ||
| 122 | |||
| 123 | mutex_unlock(&tegra_cpu_lock); | ||
| 124 | return ret; | ||
| 125 | } | 112 | } |
| 126 | 113 | ||
| 127 | static int tegra_pm_notify(struct notifier_block *nb, unsigned long event, | ||
| 128 | void *dummy) | ||
| 129 | { | ||
| 130 | mutex_lock(&tegra_cpu_lock); | ||
| 131 | if (event == PM_SUSPEND_PREPARE) { | ||
| 132 | struct cpufreq_policy *policy = cpufreq_cpu_get(0); | ||
| 133 | is_suspended = true; | ||
| 134 | pr_info("Tegra cpufreq suspend: setting frequency to %d kHz\n", | ||
| 135 | freq_table[0].frequency); | ||
| 136 | if (clk_get_rate(cpu_clk) / 1000 != freq_table[0].frequency) | ||
| 137 | tegra_update_cpu_speed(policy, freq_table[0].frequency); | ||
| 138 | cpufreq_cpu_put(policy); | ||
| 139 | } else if (event == PM_POST_SUSPEND) { | ||
| 140 | is_suspended = false; | ||
| 141 | } | ||
| 142 | mutex_unlock(&tegra_cpu_lock); | ||
| 143 | |||
| 144 | return NOTIFY_OK; | ||
| 145 | } | ||
| 146 | |||
| 147 | static struct notifier_block tegra_cpu_pm_notifier = { | ||
| 148 | .notifier_call = tegra_pm_notify, | ||
| 149 | }; | ||
| 150 | |||
| 151 | static int tegra_cpu_init(struct cpufreq_policy *policy) | 114 | static int tegra_cpu_init(struct cpufreq_policy *policy) |
| 152 | { | 115 | { |
| 153 | int ret; | 116 | int ret; |
| @@ -166,16 +129,13 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) | |||
| 166 | return ret; | 129 | return ret; |
| 167 | } | 130 | } |
| 168 | 131 | ||
| 169 | if (policy->cpu == 0) | ||
| 170 | register_pm_notifier(&tegra_cpu_pm_notifier); | ||
| 171 | |||
| 172 | policy->clk = cpu_clk; | 132 | policy->clk = cpu_clk; |
| 133 | policy->suspend_freq = freq_table[0].frequency; | ||
| 173 | return 0; | 134 | return 0; |
| 174 | } | 135 | } |
| 175 | 136 | ||
| 176 | static int tegra_cpu_exit(struct cpufreq_policy *policy) | 137 | static int tegra_cpu_exit(struct cpufreq_policy *policy) |
| 177 | { | 138 | { |
| 178 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 179 | clk_disable_unprepare(cpu_clk); | 139 | clk_disable_unprepare(cpu_clk); |
| 180 | clk_disable_unprepare(emc_clk); | 140 | clk_disable_unprepare(emc_clk); |
| 181 | return 0; | 141 | return 0; |
| @@ -190,6 +150,9 @@ static struct cpufreq_driver tegra_cpufreq_driver = { | |||
| 190 | .exit = tegra_cpu_exit, | 150 | .exit = tegra_cpu_exit, |
| 191 | .name = "tegra", | 151 | .name = "tegra", |
| 192 | .attr = cpufreq_generic_attr, | 152 | .attr = cpufreq_generic_attr, |
| 153 | #ifdef CONFIG_PM | ||
| 154 | .suspend = cpufreq_generic_suspend, | ||
| 155 | #endif | ||
| 193 | }; | 156 | }; |
| 194 | 157 | ||
| 195 | static int __init tegra_cpufreq_init(void) | 158 | static int __init tegra_cpufreq_init(void) |
diff --git a/drivers/cpufreq/unicore2-cpufreq.c b/drivers/cpufreq/unicore2-cpufreq.c index 36cc330b8747..13be802b6170 100644 --- a/drivers/cpufreq/unicore2-cpufreq.c +++ b/drivers/cpufreq/unicore2-cpufreq.c | |||
| @@ -44,9 +44,9 @@ static int ucv2_target(struct cpufreq_policy *policy, | |||
| 44 | freqs.old = policy->cur; | 44 | freqs.old = policy->cur; |
| 45 | freqs.new = target_freq; | 45 | freqs.new = target_freq; |
| 46 | 46 | ||
| 47 | cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); | 47 | cpufreq_freq_transition_begin(policy, &freqs); |
| 48 | ret = clk_set_rate(policy->mclk, target_freq * 1000); | 48 | ret = clk_set_rate(policy->mclk, target_freq * 1000); |
| 49 | cpufreq_notify_post_transition(policy, &freqs, ret); | 49 | cpufreq_freq_transition_end(policy, &freqs, ret); |
| 50 | 50 | ||
| 51 | return ret; | 51 | return ret; |
| 52 | } | 52 | } |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index a55e68f2cfc8..366e6840ec46 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
| @@ -85,7 +85,8 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
| 85 | 85 | ||
| 86 | time_end = ktime_get(); | 86 | time_end = ktime_get(); |
| 87 | 87 | ||
| 88 | local_irq_enable(); | 88 | if (!cpuidle_state_is_coupled(dev, drv, entered_state)) |
| 89 | local_irq_enable(); | ||
| 89 | 90 | ||
| 90 | diff = ktime_to_us(ktime_sub(time_end, time_start)); | 91 | diff = ktime_to_us(ktime_sub(time_end, time_start)); |
| 91 | if (diff > INT_MAX) | 92 | if (diff > INT_MAX) |
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 06dbe7c86199..136d6a283e0a 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c | |||
| @@ -209,7 +209,7 @@ static void poll_idle_init(struct cpuidle_driver *drv) | |||
| 209 | state->exit_latency = 0; | 209 | state->exit_latency = 0; |
| 210 | state->target_residency = 0; | 210 | state->target_residency = 0; |
| 211 | state->power_usage = -1; | 211 | state->power_usage = -1; |
| 212 | state->flags = 0; | 212 | state->flags = CPUIDLE_FLAG_TIME_VALID; |
| 213 | state->enter = poll_idle; | 213 | state->enter = poll_idle; |
| 214 | state->disabled = false; | 214 | state->disabled = false; |
| 215 | } | 215 | } |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index cf7f2f0e4ef5..71b523293354 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
| @@ -122,9 +122,8 @@ struct menu_device { | |||
| 122 | int last_state_idx; | 122 | int last_state_idx; |
| 123 | int needs_update; | 123 | int needs_update; |
| 124 | 124 | ||
| 125 | unsigned int expected_us; | 125 | unsigned int next_timer_us; |
| 126 | unsigned int predicted_us; | 126 | unsigned int predicted_us; |
| 127 | unsigned int exit_us; | ||
| 128 | unsigned int bucket; | 127 | unsigned int bucket; |
| 129 | unsigned int correction_factor[BUCKETS]; | 128 | unsigned int correction_factor[BUCKETS]; |
| 130 | unsigned int intervals[INTERVALS]; | 129 | unsigned int intervals[INTERVALS]; |
| @@ -257,7 +256,7 @@ again: | |||
| 257 | stddev = int_sqrt(stddev); | 256 | stddev = int_sqrt(stddev); |
| 258 | if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) | 257 | if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) |
| 259 | || stddev <= 20) { | 258 | || stddev <= 20) { |
| 260 | if (data->expected_us > avg) | 259 | if (data->next_timer_us > avg) |
| 261 | data->predicted_us = avg; | 260 | data->predicted_us = avg; |
| 262 | return; | 261 | return; |
| 263 | } | 262 | } |
| @@ -289,7 +288,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 289 | struct menu_device *data = &__get_cpu_var(menu_devices); | 288 | struct menu_device *data = &__get_cpu_var(menu_devices); |
| 290 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); | 289 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); |
| 291 | int i; | 290 | int i; |
| 292 | int multiplier; | 291 | unsigned int interactivity_req; |
| 293 | struct timespec t; | 292 | struct timespec t; |
| 294 | 293 | ||
| 295 | if (data->needs_update) { | 294 | if (data->needs_update) { |
| @@ -298,7 +297,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 298 | } | 297 | } |
| 299 | 298 | ||
| 300 | data->last_state_idx = 0; | 299 | data->last_state_idx = 0; |
| 301 | data->exit_us = 0; | ||
| 302 | 300 | ||
| 303 | /* Special case when user has set very strict latency requirement */ | 301 | /* Special case when user has set very strict latency requirement */ |
| 304 | if (unlikely(latency_req == 0)) | 302 | if (unlikely(latency_req == 0)) |
| @@ -306,13 +304,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 306 | 304 | ||
| 307 | /* determine the expected residency time, round up */ | 305 | /* determine the expected residency time, round up */ |
| 308 | t = ktime_to_timespec(tick_nohz_get_sleep_length()); | 306 | t = ktime_to_timespec(tick_nohz_get_sleep_length()); |
| 309 | data->expected_us = | 307 | data->next_timer_us = |
| 310 | t.tv_sec * USEC_PER_SEC + t.tv_nsec / NSEC_PER_USEC; | 308 | t.tv_sec * USEC_PER_SEC + t.tv_nsec / NSEC_PER_USEC; |
| 311 | 309 | ||
| 312 | 310 | ||
| 313 | data->bucket = which_bucket(data->expected_us); | 311 | data->bucket = which_bucket(data->next_timer_us); |
| 314 | |||
| 315 | multiplier = performance_multiplier(); | ||
| 316 | 312 | ||
| 317 | /* | 313 | /* |
| 318 | * if the correction factor is 0 (eg first time init or cpu hotplug | 314 | * if the correction factor is 0 (eg first time init or cpu hotplug |
| @@ -326,17 +322,26 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 326 | * operands are 32 bits. | 322 | * operands are 32 bits. |
| 327 | * Make sure to round up for half microseconds. | 323 | * Make sure to round up for half microseconds. |
| 328 | */ | 324 | */ |
| 329 | data->predicted_us = div_round64((uint64_t)data->expected_us * | 325 | data->predicted_us = div_round64((uint64_t)data->next_timer_us * |
| 330 | data->correction_factor[data->bucket], | 326 | data->correction_factor[data->bucket], |
| 331 | RESOLUTION * DECAY); | 327 | RESOLUTION * DECAY); |
| 332 | 328 | ||
| 333 | get_typical_interval(data); | 329 | get_typical_interval(data); |
| 334 | 330 | ||
| 335 | /* | 331 | /* |
| 332 | * Performance multiplier defines a minimum predicted idle | ||
| 333 | * duration / latency ratio. Adjust the latency limit if | ||
| 334 | * necessary. | ||
| 335 | */ | ||
| 336 | interactivity_req = data->predicted_us / performance_multiplier(); | ||
| 337 | if (latency_req > interactivity_req) | ||
| 338 | latency_req = interactivity_req; | ||
| 339 | |||
| 340 | /* | ||
| 336 | * We want to default to C1 (hlt), not to busy polling | 341 | * We want to default to C1 (hlt), not to busy polling |
| 337 | * unless the timer is happening really really soon. | 342 | * unless the timer is happening really really soon. |
| 338 | */ | 343 | */ |
| 339 | if (data->expected_us > 5 && | 344 | if (data->next_timer_us > 5 && |
| 340 | !drv->states[CPUIDLE_DRIVER_STATE_START].disabled && | 345 | !drv->states[CPUIDLE_DRIVER_STATE_START].disabled && |
| 341 | dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0) | 346 | dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0) |
| 342 | data->last_state_idx = CPUIDLE_DRIVER_STATE_START; | 347 | data->last_state_idx = CPUIDLE_DRIVER_STATE_START; |
| @@ -355,11 +360,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 355 | continue; | 360 | continue; |
| 356 | if (s->exit_latency > latency_req) | 361 | if (s->exit_latency > latency_req) |
| 357 | continue; | 362 | continue; |
| 358 | if (s->exit_latency * multiplier > data->predicted_us) | ||
| 359 | continue; | ||
| 360 | 363 | ||
| 361 | data->last_state_idx = i; | 364 | data->last_state_idx = i; |
| 362 | data->exit_us = s->exit_latency; | ||
| 363 | } | 365 | } |
| 364 | 366 | ||
| 365 | return data->last_state_idx; | 367 | return data->last_state_idx; |
| @@ -390,36 +392,47 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 390 | { | 392 | { |
| 391 | struct menu_device *data = &__get_cpu_var(menu_devices); | 393 | struct menu_device *data = &__get_cpu_var(menu_devices); |
| 392 | int last_idx = data->last_state_idx; | 394 | int last_idx = data->last_state_idx; |
| 393 | unsigned int last_idle_us = cpuidle_get_last_residency(dev); | ||
| 394 | struct cpuidle_state *target = &drv->states[last_idx]; | 395 | struct cpuidle_state *target = &drv->states[last_idx]; |
| 395 | unsigned int measured_us; | 396 | unsigned int measured_us; |
| 396 | unsigned int new_factor; | 397 | unsigned int new_factor; |
| 397 | 398 | ||
| 398 | /* | 399 | /* |
| 399 | * Ugh, this idle state doesn't support residency measurements, so we | 400 | * Try to figure out how much time passed between entry to low |
| 400 | * are basically lost in the dark. As a compromise, assume we slept | 401 | * power state and occurrence of the wakeup event. |
| 401 | * for the whole expected time. | 402 | * |
| 403 | * If the entered idle state didn't support residency measurements, | ||
| 404 | * we are basically lost in the dark how much time passed. | ||
| 405 | * As a compromise, assume we slept for the whole expected time. | ||
| 406 | * | ||
| 407 | * Any measured amount of time will include the exit latency. | ||
| 408 | * Since we are interested in when the wakeup begun, not when it | ||
| 409 | * was completed, we must substract the exit latency. However, if | ||
| 410 | * the measured amount of time is less than the exit latency, | ||
| 411 | * assume the state was never reached and the exit latency is 0. | ||
| 402 | */ | 412 | */ |
| 403 | if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID))) | 413 | if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID))) { |
| 404 | last_idle_us = data->expected_us; | 414 | /* Use timer value as is */ |
| 415 | measured_us = data->next_timer_us; | ||
| 405 | 416 | ||
| 417 | } else { | ||
| 418 | /* Use measured value */ | ||
| 419 | measured_us = cpuidle_get_last_residency(dev); | ||
| 406 | 420 | ||
| 407 | measured_us = last_idle_us; | 421 | /* Deduct exit latency */ |
| 408 | 422 | if (measured_us > target->exit_latency) | |
| 409 | /* | 423 | measured_us -= target->exit_latency; |
| 410 | * We correct for the exit latency; we are assuming here that the | ||
| 411 | * exit latency happens after the event that we're interested in. | ||
| 412 | */ | ||
| 413 | if (measured_us > data->exit_us) | ||
| 414 | measured_us -= data->exit_us; | ||
| 415 | 424 | ||
| 425 | /* Make sure our coefficients do not exceed unity */ | ||
| 426 | if (measured_us > data->next_timer_us) | ||
| 427 | measured_us = data->next_timer_us; | ||
| 428 | } | ||
| 416 | 429 | ||
| 417 | /* Update our correction ratio */ | 430 | /* Update our correction ratio */ |
| 418 | new_factor = data->correction_factor[data->bucket]; | 431 | new_factor = data->correction_factor[data->bucket]; |
| 419 | new_factor -= new_factor / DECAY; | 432 | new_factor -= new_factor / DECAY; |
| 420 | 433 | ||
| 421 | if (data->expected_us > 0 && measured_us < MAX_INTERESTING) | 434 | if (data->next_timer_us > 0 && measured_us < MAX_INTERESTING) |
| 422 | new_factor += RESOLUTION * measured_us / data->expected_us; | 435 | new_factor += RESOLUTION * measured_us / data->next_timer_us; |
| 423 | else | 436 | else |
| 424 | /* | 437 | /* |
| 425 | * we were idle so long that we count it as a perfect | 438 | * we were idle so long that we count it as a perfect |
| @@ -439,7 +452,7 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
| 439 | data->correction_factor[data->bucket] = new_factor; | 452 | data->correction_factor[data->bucket] = new_factor; |
| 440 | 453 | ||
| 441 | /* update the repeating-pattern data */ | 454 | /* update the repeating-pattern data */ |
| 442 | data->intervals[data->interval_ptr++] = last_idle_us; | 455 | data->intervals[data->interval_ptr++] = measured_us; |
| 443 | if (data->interval_ptr >= INTERVALS) | 456 | if (data->interval_ptr >= INTERVALS) |
| 444 | data->interval_ptr = 0; | 457 | data->interval_ptr = 0; |
| 445 | } | 458 | } |
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index a0b2f7e0eedb..2042ec3656ba 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c | |||
| @@ -91,26 +91,35 @@ static int devfreq_get_freq_level(struct devfreq *devfreq, unsigned long freq) | |||
| 91 | */ | 91 | */ |
| 92 | static int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) | 92 | static int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) |
| 93 | { | 93 | { |
| 94 | int lev, prev_lev; | 94 | int lev, prev_lev, ret = 0; |
| 95 | unsigned long cur_time; | 95 | unsigned long cur_time; |
| 96 | 96 | ||
| 97 | lev = devfreq_get_freq_level(devfreq, freq); | ||
| 98 | if (lev < 0) | ||
| 99 | return lev; | ||
| 100 | |||
| 101 | cur_time = jiffies; | 97 | cur_time = jiffies; |
| 102 | devfreq->time_in_state[lev] += | 98 | |
| 99 | prev_lev = devfreq_get_freq_level(devfreq, devfreq->previous_freq); | ||
| 100 | if (prev_lev < 0) { | ||
| 101 | ret = prev_lev; | ||
| 102 | goto out; | ||
| 103 | } | ||
| 104 | |||
| 105 | devfreq->time_in_state[prev_lev] += | ||
| 103 | cur_time - devfreq->last_stat_updated; | 106 | cur_time - devfreq->last_stat_updated; |
| 104 | if (freq != devfreq->previous_freq) { | 107 | |
| 105 | prev_lev = devfreq_get_freq_level(devfreq, | 108 | lev = devfreq_get_freq_level(devfreq, freq); |
| 106 | devfreq->previous_freq); | 109 | if (lev < 0) { |
| 110 | ret = lev; | ||
| 111 | goto out; | ||
| 112 | } | ||
| 113 | |||
| 114 | if (lev != prev_lev) { | ||
| 107 | devfreq->trans_table[(prev_lev * | 115 | devfreq->trans_table[(prev_lev * |
| 108 | devfreq->profile->max_state) + lev]++; | 116 | devfreq->profile->max_state) + lev]++; |
| 109 | devfreq->total_trans++; | 117 | devfreq->total_trans++; |
| 110 | } | 118 | } |
| 111 | devfreq->last_stat_updated = cur_time; | ||
| 112 | 119 | ||
| 113 | return 0; | 120 | out: |
| 121 | devfreq->last_stat_updated = cur_time; | ||
| 122 | return ret; | ||
| 114 | } | 123 | } |
| 115 | 124 | ||
| 116 | /** | 125 | /** |
diff --git a/drivers/gpu/drm/gma500/Kconfig b/drivers/gpu/drm/gma500/Kconfig index 508cf99a292d..17f928ec84ea 100644 --- a/drivers/gpu/drm/gma500/Kconfig +++ b/drivers/gpu/drm/gma500/Kconfig | |||
| @@ -10,7 +10,6 @@ config DRM_GMA500 | |||
| 10 | # GMA500 depends on ACPI_VIDEO when ACPI is enabled, just like i915 | 10 | # GMA500 depends on ACPI_VIDEO when ACPI is enabled, just like i915 |
| 11 | select ACPI_VIDEO if ACPI | 11 | select ACPI_VIDEO if ACPI |
| 12 | select BACKLIGHT_CLASS_DEVICE if ACPI | 12 | select BACKLIGHT_CLASS_DEVICE if ACPI |
| 13 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
| 14 | select INPUT if ACPI | 13 | select INPUT if ACPI |
| 15 | help | 14 | help |
| 16 | Say yes for an experimental 2D KMS framebuffer driver for the | 15 | Say yes for an experimental 2D KMS framebuffer driver for the |
diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig index 73ed59eff139..bea2d67196fb 100644 --- a/drivers/gpu/drm/i915/Kconfig +++ b/drivers/gpu/drm/i915/Kconfig | |||
| @@ -14,7 +14,6 @@ config DRM_I915 | |||
| 14 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | 14 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick |
| 15 | select BACKLIGHT_LCD_SUPPORT if ACPI | 15 | select BACKLIGHT_LCD_SUPPORT if ACPI |
| 16 | select BACKLIGHT_CLASS_DEVICE if ACPI | 16 | select BACKLIGHT_CLASS_DEVICE if ACPI |
| 17 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
| 18 | select INPUT if ACPI | 17 | select INPUT if ACPI |
| 19 | select ACPI_VIDEO if ACPI | 18 | select ACPI_VIDEO if ACPI |
| 20 | select ACPI_BUTTON if ACPI | 19 | select ACPI_BUTTON if ACPI |
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig index 7cf787d697b1..637c29a33127 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig | |||
| @@ -11,7 +11,7 @@ config DRM_NOUVEAU | |||
| 11 | select FB | 11 | select FB |
| 12 | select FRAMEBUFFER_CONSOLE if !EXPERT | 12 | select FRAMEBUFFER_CONSOLE if !EXPERT |
| 13 | select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT | 13 | select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT |
| 14 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT | 14 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && INPUT |
| 15 | select X86_PLATFORM_DEVICES if ACPI && X86 | 15 | select X86_PLATFORM_DEVICES if ACPI && X86 |
| 16 | select ACPI_WMI if ACPI && X86 | 16 | select ACPI_WMI if ACPI && X86 |
| 17 | select MXM_WMI if ACPI && X86 | 17 | select MXM_WMI if ACPI && X86 |
| @@ -19,7 +19,6 @@ config DRM_NOUVEAU | |||
| 19 | # Similar to i915, we need to select ACPI_VIDEO and it's dependencies | 19 | # Similar to i915, we need to select ACPI_VIDEO and it's dependencies |
| 20 | select BACKLIGHT_LCD_SUPPORT if ACPI && X86 | 20 | select BACKLIGHT_LCD_SUPPORT if ACPI && X86 |
| 21 | select BACKLIGHT_CLASS_DEVICE if ACPI && X86 | 21 | select BACKLIGHT_CLASS_DEVICE if ACPI && X86 |
| 22 | select VIDEO_OUTPUT_CONTROL if ACPI && X86 | ||
| 23 | select INPUT if ACPI && X86 | 22 | select INPUT if ACPI && X86 |
| 24 | select THERMAL if ACPI && X86 | 23 | select THERMAL if ACPI && X86 |
| 25 | select ACPI_VIDEO if ACPI && X86 | 24 | select ACPI_VIDEO if ACPI && X86 |
diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index 5c342b3139e8..3c0f57efe7b1 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c | |||
| @@ -134,7 +134,8 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id) | |||
| 134 | } else if (!ts->low_latency_req.dev) { | 134 | } else if (!ts->low_latency_req.dev) { |
| 135 | /* First contact, request 100 us latency. */ | 135 | /* First contact, request 100 us latency. */ |
| 136 | dev_pm_qos_add_ancestor_request(&ts->client->dev, | 136 | dev_pm_qos_add_ancestor_request(&ts->client->dev, |
| 137 | &ts->low_latency_req, 100); | 137 | &ts->low_latency_req, |
| 138 | DEV_PM_QOS_RESUME_LATENCY, 100); | ||
| 138 | } | 139 | } |
| 139 | 140 | ||
| 140 | /* SYN_REPORT */ | 141 | /* SYN_REPORT */ |
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c index d72783dd7b96..c0670237e7a2 100644 --- a/drivers/mtd/nand/sh_flctl.c +++ b/drivers/mtd/nand/sh_flctl.c | |||
| @@ -897,7 +897,7 @@ static void flctl_select_chip(struct mtd_info *mtd, int chipnr) | |||
| 897 | if (!flctl->qos_request) { | 897 | if (!flctl->qos_request) { |
| 898 | ret = dev_pm_qos_add_request(&flctl->pdev->dev, | 898 | ret = dev_pm_qos_add_request(&flctl->pdev->dev, |
| 899 | &flctl->pm_qos, | 899 | &flctl->pm_qos, |
| 900 | DEV_PM_QOS_LATENCY, | 900 | DEV_PM_QOS_RESUME_LATENCY, |
| 901 | 100); | 901 | 100); |
| 902 | if (ret < 0) | 902 | if (ret < 0) |
| 903 | dev_err(&flctl->pdev->dev, | 903 | dev_err(&flctl->pdev->dev, |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index b6162be4df40..2b859249303b 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
| @@ -93,7 +93,6 @@ struct acpiphp_slot { | |||
| 93 | struct list_head funcs; /* one slot may have different | 93 | struct list_head funcs; /* one slot may have different |
| 94 | objects (i.e. for each function) */ | 94 | objects (i.e. for each function) */ |
| 95 | struct slot *slot; | 95 | struct slot *slot; |
| 96 | struct mutex crit_sect; | ||
| 97 | 96 | ||
| 98 | u8 device; /* pci device# */ | 97 | u8 device; /* pci device# */ |
| 99 | u32 flags; /* see below */ | 98 | u32 flags; /* see below */ |
| @@ -117,20 +116,30 @@ struct acpiphp_func { | |||
| 117 | }; | 116 | }; |
| 118 | 117 | ||
| 119 | struct acpiphp_context { | 118 | struct acpiphp_context { |
| 120 | acpi_handle handle; | 119 | struct acpi_hotplug_context hp; |
| 121 | struct acpiphp_func func; | 120 | struct acpiphp_func func; |
| 122 | struct acpiphp_bridge *bridge; | 121 | struct acpiphp_bridge *bridge; |
| 123 | unsigned int refcount; | 122 | unsigned int refcount; |
| 124 | }; | 123 | }; |
| 125 | 124 | ||
| 125 | static inline struct acpiphp_context *to_acpiphp_context(struct acpi_hotplug_context *hp) | ||
| 126 | { | ||
| 127 | return container_of(hp, struct acpiphp_context, hp); | ||
| 128 | } | ||
| 129 | |||
| 126 | static inline struct acpiphp_context *func_to_context(struct acpiphp_func *func) | 130 | static inline struct acpiphp_context *func_to_context(struct acpiphp_func *func) |
| 127 | { | 131 | { |
| 128 | return container_of(func, struct acpiphp_context, func); | 132 | return container_of(func, struct acpiphp_context, func); |
| 129 | } | 133 | } |
| 130 | 134 | ||
| 135 | static inline struct acpi_device *func_to_acpi_device(struct acpiphp_func *func) | ||
| 136 | { | ||
| 137 | return func_to_context(func)->hp.self; | ||
| 138 | } | ||
| 139 | |||
| 131 | static inline acpi_handle func_to_handle(struct acpiphp_func *func) | 140 | static inline acpi_handle func_to_handle(struct acpiphp_func *func) |
| 132 | { | 141 | { |
| 133 | return func_to_context(func)->handle; | 142 | return func_to_acpi_device(func)->handle; |
| 134 | } | 143 | } |
| 135 | 144 | ||
| 136 | /* | 145 | /* |
| @@ -158,7 +167,6 @@ struct acpiphp_attention_info | |||
| 158 | 167 | ||
| 159 | #define FUNC_HAS_STA (0x00000001) | 168 | #define FUNC_HAS_STA (0x00000001) |
| 160 | #define FUNC_HAS_EJ0 (0x00000002) | 169 | #define FUNC_HAS_EJ0 (0x00000002) |
| 161 | #define FUNC_HAS_DCK (0x00000004) | ||
| 162 | 170 | ||
| 163 | /* function prototypes */ | 171 | /* function prototypes */ |
| 164 | 172 | ||
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 7c7a388c85ab..828acf422c17 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
| @@ -58,71 +58,59 @@ | |||
| 58 | 58 | ||
| 59 | static LIST_HEAD(bridge_list); | 59 | static LIST_HEAD(bridge_list); |
| 60 | static DEFINE_MUTEX(bridge_mutex); | 60 | static DEFINE_MUTEX(bridge_mutex); |
| 61 | static DEFINE_MUTEX(acpiphp_context_lock); | ||
| 62 | 61 | ||
| 63 | static void handle_hotplug_event(acpi_handle handle, u32 type, void *data); | 62 | static int acpiphp_hotplug_notify(struct acpi_device *adev, u32 type); |
| 63 | static void acpiphp_post_dock_fixup(struct acpi_device *adev); | ||
| 64 | static void acpiphp_sanitize_bus(struct pci_bus *bus); | 64 | static void acpiphp_sanitize_bus(struct pci_bus *bus); |
| 65 | static void acpiphp_set_hpp_values(struct pci_bus *bus); | 65 | static void acpiphp_set_hpp_values(struct pci_bus *bus); |
| 66 | static void hotplug_event(acpi_handle handle, u32 type, void *data); | 66 | static void hotplug_event(u32 type, struct acpiphp_context *context); |
| 67 | static void free_bridge(struct kref *kref); | 67 | static void free_bridge(struct kref *kref); |
| 68 | 68 | ||
| 69 | static void acpiphp_context_handler(acpi_handle handle, void *context) | ||
| 70 | { | ||
| 71 | /* Intentionally empty. */ | ||
| 72 | } | ||
| 73 | |||
| 74 | /** | 69 | /** |
| 75 | * acpiphp_init_context - Create hotplug context and grab a reference to it. | 70 | * acpiphp_init_context - Create hotplug context and grab a reference to it. |
| 76 | * @handle: ACPI object handle to create the context for. | 71 | * @adev: ACPI device object to create the context for. |
| 77 | * | 72 | * |
| 78 | * Call under acpiphp_context_lock. | 73 | * Call under acpi_hp_context_lock. |
| 79 | */ | 74 | */ |
| 80 | static struct acpiphp_context *acpiphp_init_context(acpi_handle handle) | 75 | static struct acpiphp_context *acpiphp_init_context(struct acpi_device *adev) |
| 81 | { | 76 | { |
| 82 | struct acpiphp_context *context; | 77 | struct acpiphp_context *context; |
| 83 | acpi_status status; | ||
| 84 | 78 | ||
| 85 | context = kzalloc(sizeof(*context), GFP_KERNEL); | 79 | context = kzalloc(sizeof(*context), GFP_KERNEL); |
| 86 | if (!context) | 80 | if (!context) |
| 87 | return NULL; | 81 | return NULL; |
| 88 | 82 | ||
| 89 | context->handle = handle; | ||
| 90 | context->refcount = 1; | 83 | context->refcount = 1; |
| 91 | status = acpi_attach_data(handle, acpiphp_context_handler, context); | 84 | acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL, |
| 92 | if (ACPI_FAILURE(status)) { | 85 | acpiphp_post_dock_fixup); |
| 93 | kfree(context); | ||
| 94 | return NULL; | ||
| 95 | } | ||
| 96 | return context; | 86 | return context; |
| 97 | } | 87 | } |
| 98 | 88 | ||
| 99 | /** | 89 | /** |
| 100 | * acpiphp_get_context - Get hotplug context and grab a reference to it. | 90 | * acpiphp_get_context - Get hotplug context and grab a reference to it. |
| 101 | * @handle: ACPI object handle to get the context for. | 91 | * @adev: ACPI device object to get the context for. |
| 102 | * | 92 | * |
| 103 | * Call under acpiphp_context_lock. | 93 | * Call under acpi_hp_context_lock. |
| 104 | */ | 94 | */ |
| 105 | static struct acpiphp_context *acpiphp_get_context(acpi_handle handle) | 95 | static struct acpiphp_context *acpiphp_get_context(struct acpi_device *adev) |
| 106 | { | 96 | { |
| 107 | struct acpiphp_context *context = NULL; | 97 | struct acpiphp_context *context; |
| 108 | acpi_status status; | ||
| 109 | void *data; | ||
| 110 | 98 | ||
| 111 | status = acpi_get_data(handle, acpiphp_context_handler, &data); | 99 | if (!adev->hp) |
| 112 | if (ACPI_SUCCESS(status)) { | 100 | return NULL; |
| 113 | context = data; | 101 | |
| 114 | context->refcount++; | 102 | context = to_acpiphp_context(adev->hp); |
| 115 | } | 103 | context->refcount++; |
| 116 | return context; | 104 | return context; |
| 117 | } | 105 | } |
| 118 | 106 | ||
| 119 | /** | 107 | /** |
| 120 | * acpiphp_put_context - Drop a reference to ACPI hotplug context. | 108 | * acpiphp_put_context - Drop a reference to ACPI hotplug context. |
| 121 | * @handle: ACPI object handle to put the context for. | 109 | * @context: ACPI hotplug context to drop a reference to. |
| 122 | * | 110 | * |
| 123 | * The context object is removed if there are no more references to it. | 111 | * The context object is removed if there are no more references to it. |
| 124 | * | 112 | * |
| 125 | * Call under acpiphp_context_lock. | 113 | * Call under acpi_hp_context_lock. |
| 126 | */ | 114 | */ |
| 127 | static void acpiphp_put_context(struct acpiphp_context *context) | 115 | static void acpiphp_put_context(struct acpiphp_context *context) |
| 128 | { | 116 | { |
| @@ -130,7 +118,7 @@ static void acpiphp_put_context(struct acpiphp_context *context) | |||
| 130 | return; | 118 | return; |
| 131 | 119 | ||
| 132 | WARN_ON(context->bridge); | 120 | WARN_ON(context->bridge); |
| 133 | acpi_detach_data(context->handle, acpiphp_context_handler); | 121 | context->hp.self->hp = NULL; |
| 134 | kfree(context); | 122 | kfree(context); |
| 135 | } | 123 | } |
| 136 | 124 | ||
| @@ -144,6 +132,27 @@ static inline void put_bridge(struct acpiphp_bridge *bridge) | |||
| 144 | kref_put(&bridge->ref, free_bridge); | 132 | kref_put(&bridge->ref, free_bridge); |
| 145 | } | 133 | } |
| 146 | 134 | ||
| 135 | static struct acpiphp_context *acpiphp_grab_context(struct acpi_device *adev) | ||
| 136 | { | ||
| 137 | struct acpiphp_context *context; | ||
| 138 | |||
| 139 | acpi_lock_hp_context(); | ||
| 140 | context = acpiphp_get_context(adev); | ||
| 141 | if (!context || context->func.parent->is_going_away) { | ||
| 142 | acpi_unlock_hp_context(); | ||
| 143 | return NULL; | ||
| 144 | } | ||
| 145 | get_bridge(context->func.parent); | ||
| 146 | acpiphp_put_context(context); | ||
| 147 | acpi_unlock_hp_context(); | ||
| 148 | return context; | ||
| 149 | } | ||
| 150 | |||
| 151 | static void acpiphp_let_context_go(struct acpiphp_context *context) | ||
| 152 | { | ||
| 153 | put_bridge(context->func.parent); | ||
| 154 | } | ||
| 155 | |||
| 147 | static void free_bridge(struct kref *kref) | 156 | static void free_bridge(struct kref *kref) |
| 148 | { | 157 | { |
| 149 | struct acpiphp_context *context; | 158 | struct acpiphp_context *context; |
| @@ -151,7 +160,7 @@ static void free_bridge(struct kref *kref) | |||
| 151 | struct acpiphp_slot *slot, *next; | 160 | struct acpiphp_slot *slot, *next; |
| 152 | struct acpiphp_func *func, *tmp; | 161 | struct acpiphp_func *func, *tmp; |
| 153 | 162 | ||
| 154 | mutex_lock(&acpiphp_context_lock); | 163 | acpi_lock_hp_context(); |
| 155 | 164 | ||
| 156 | bridge = container_of(kref, struct acpiphp_bridge, ref); | 165 | bridge = container_of(kref, struct acpiphp_bridge, ref); |
| 157 | 166 | ||
| @@ -175,31 +184,32 @@ static void free_bridge(struct kref *kref) | |||
| 175 | pci_dev_put(bridge->pci_dev); | 184 | pci_dev_put(bridge->pci_dev); |
| 176 | kfree(bridge); | 185 | kfree(bridge); |
| 177 | 186 | ||
| 178 | mutex_unlock(&acpiphp_context_lock); | 187 | acpi_unlock_hp_context(); |
| 179 | } | 188 | } |
| 180 | 189 | ||
| 181 | /* | 190 | /** |
| 182 | * the _DCK method can do funny things... and sometimes not | 191 | * acpiphp_post_dock_fixup - Post-dock fixups for PCI devices. |
| 183 | * hah-hah funny. | 192 | * @adev: ACPI device object corresponding to a PCI device. |
| 184 | * | 193 | * |
| 185 | * TBD - figure out a way to only call fixups for | 194 | * TBD - figure out a way to only call fixups for systems that require them. |
| 186 | * systems that require them. | ||
| 187 | */ | 195 | */ |
| 188 | static void post_dock_fixups(acpi_handle not_used, u32 event, void *data) | 196 | static void acpiphp_post_dock_fixup(struct acpi_device *adev) |
| 189 | { | 197 | { |
| 190 | struct acpiphp_context *context = data; | 198 | struct acpiphp_context *context = acpiphp_grab_context(adev); |
| 191 | struct pci_bus *bus = context->func.slot->bus; | 199 | struct pci_bus *bus; |
| 192 | u32 buses; | 200 | u32 buses; |
| 193 | 201 | ||
| 194 | if (!bus->self) | 202 | if (!context) |
| 195 | return; | 203 | return; |
| 196 | 204 | ||
| 205 | bus = context->func.slot->bus; | ||
| 206 | if (!bus->self) | ||
| 207 | goto out; | ||
| 208 | |||
| 197 | /* fixup bad _DCK function that rewrites | 209 | /* fixup bad _DCK function that rewrites |
| 198 | * secondary bridge on slot | 210 | * secondary bridge on slot |
| 199 | */ | 211 | */ |
| 200 | pci_read_config_dword(bus->self, | 212 | pci_read_config_dword(bus->self, PCI_PRIMARY_BUS, &buses); |
| 201 | PCI_PRIMARY_BUS, | ||
| 202 | &buses); | ||
| 203 | 213 | ||
| 204 | if (((buses >> 8) & 0xff) != bus->busn_res.start) { | 214 | if (((buses >> 8) & 0xff) != bus->busn_res.start) { |
| 205 | buses = (buses & 0xff000000) | 215 | buses = (buses & 0xff000000) |
| @@ -208,33 +218,11 @@ static void post_dock_fixups(acpi_handle not_used, u32 event, void *data) | |||
| 208 | | ((unsigned int)(bus->busn_res.end) << 16); | 218 | | ((unsigned int)(bus->busn_res.end) << 16); |
| 209 | pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); | 219 | pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); |
| 210 | } | 220 | } |
| 211 | } | ||
| 212 | |||
| 213 | static void dock_event(acpi_handle handle, u32 type, void *data) | ||
| 214 | { | ||
| 215 | struct acpiphp_context *context; | ||
| 216 | |||
| 217 | mutex_lock(&acpiphp_context_lock); | ||
| 218 | context = acpiphp_get_context(handle); | ||
| 219 | if (!context || WARN_ON(context->handle != handle) | ||
| 220 | || context->func.parent->is_going_away) { | ||
| 221 | mutex_unlock(&acpiphp_context_lock); | ||
| 222 | return; | ||
| 223 | } | ||
| 224 | get_bridge(context->func.parent); | ||
| 225 | acpiphp_put_context(context); | ||
| 226 | mutex_unlock(&acpiphp_context_lock); | ||
| 227 | |||
| 228 | hotplug_event(handle, type, data); | ||
| 229 | 221 | ||
| 230 | put_bridge(context->func.parent); | 222 | out: |
| 223 | acpiphp_let_context_go(context); | ||
| 231 | } | 224 | } |
| 232 | 225 | ||
| 233 | static const struct acpi_dock_ops acpiphp_dock_ops = { | ||
| 234 | .fixup = post_dock_fixups, | ||
| 235 | .handler = dock_event, | ||
| 236 | }; | ||
| 237 | |||
| 238 | /* Check whether the PCI device is managed by native PCIe hotplug driver */ | 226 | /* Check whether the PCI device is managed by native PCIe hotplug driver */ |
| 239 | static bool device_is_managed_by_native_pciehp(struct pci_dev *pdev) | 227 | static bool device_is_managed_by_native_pciehp(struct pci_dev *pdev) |
| 240 | { | 228 | { |
| @@ -264,26 +252,19 @@ static bool device_is_managed_by_native_pciehp(struct pci_dev *pdev) | |||
| 264 | return true; | 252 | return true; |
| 265 | } | 253 | } |
| 266 | 254 | ||
| 267 | static void acpiphp_dock_init(void *data) | 255 | /** |
| 268 | { | 256 | * acpiphp_add_context - Add ACPIPHP context to an ACPI device object. |
| 269 | struct acpiphp_context *context = data; | 257 | * @handle: ACPI handle of the object to add a context to. |
| 270 | 258 | * @lvl: Not used. | |
| 271 | get_bridge(context->func.parent); | 259 | * @data: The object's parent ACPIPHP bridge. |
| 272 | } | 260 | * @rv: Not used. |
| 273 | 261 | */ | |
| 274 | static void acpiphp_dock_release(void *data) | 262 | static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data, |
| 275 | { | 263 | void **rv) |
| 276 | struct acpiphp_context *context = data; | ||
| 277 | |||
| 278 | put_bridge(context->func.parent); | ||
| 279 | } | ||
| 280 | |||
| 281 | /* callback routine to register each ACPI PCI slot object */ | ||
| 282 | static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | ||
| 283 | void **rv) | ||
| 284 | { | 264 | { |
| 285 | struct acpiphp_bridge *bridge = data; | 265 | struct acpiphp_bridge *bridge = data; |
| 286 | struct acpiphp_context *context; | 266 | struct acpiphp_context *context; |
| 267 | struct acpi_device *adev; | ||
| 287 | struct acpiphp_slot *slot; | 268 | struct acpiphp_slot *slot; |
| 288 | struct acpiphp_func *newfunc; | 269 | struct acpiphp_func *newfunc; |
| 289 | acpi_status status = AE_OK; | 270 | acpi_status status = AE_OK; |
| @@ -293,9 +274,6 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
| 293 | struct pci_dev *pdev = bridge->pci_dev; | 274 | struct pci_dev *pdev = bridge->pci_dev; |
| 294 | u32 val; | 275 | u32 val; |
| 295 | 276 | ||
| 296 | if (pdev && device_is_managed_by_native_pciehp(pdev)) | ||
| 297 | return AE_OK; | ||
| 298 | |||
| 299 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); | 277 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); |
| 300 | if (ACPI_FAILURE(status)) { | 278 | if (ACPI_FAILURE(status)) { |
| 301 | if (status != AE_NOT_FOUND) | 279 | if (status != AE_NOT_FOUND) |
| @@ -303,31 +281,34 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
| 303 | "can't evaluate _ADR (%#x)\n", status); | 281 | "can't evaluate _ADR (%#x)\n", status); |
| 304 | return AE_OK; | 282 | return AE_OK; |
| 305 | } | 283 | } |
| 284 | if (acpi_bus_get_device(handle, &adev)) | ||
| 285 | return AE_OK; | ||
| 306 | 286 | ||
| 307 | device = (adr >> 16) & 0xffff; | 287 | device = (adr >> 16) & 0xffff; |
| 308 | function = adr & 0xffff; | 288 | function = adr & 0xffff; |
| 309 | 289 | ||
| 310 | mutex_lock(&acpiphp_context_lock); | 290 | acpi_lock_hp_context(); |
| 311 | context = acpiphp_init_context(handle); | 291 | context = acpiphp_init_context(adev); |
| 312 | if (!context) { | 292 | if (!context) { |
| 313 | mutex_unlock(&acpiphp_context_lock); | 293 | acpi_unlock_hp_context(); |
| 314 | acpi_handle_err(handle, "No hotplug context\n"); | 294 | acpi_handle_err(handle, "No hotplug context\n"); |
| 315 | return AE_NOT_EXIST; | 295 | return AE_NOT_EXIST; |
| 316 | } | 296 | } |
| 317 | newfunc = &context->func; | 297 | newfunc = &context->func; |
| 318 | newfunc->function = function; | 298 | newfunc->function = function; |
| 319 | newfunc->parent = bridge; | 299 | newfunc->parent = bridge; |
| 320 | mutex_unlock(&acpiphp_context_lock); | 300 | acpi_unlock_hp_context(); |
| 321 | 301 | ||
| 322 | if (acpi_has_method(handle, "_EJ0")) | 302 | /* |
| 303 | * If this is a dock device, its _EJ0 should be executed by the dock | ||
| 304 | * notify handler after calling _DCK. | ||
| 305 | */ | ||
| 306 | if (!is_dock_device(adev) && acpi_has_method(handle, "_EJ0")) | ||
| 323 | newfunc->flags = FUNC_HAS_EJ0; | 307 | newfunc->flags = FUNC_HAS_EJ0; |
| 324 | 308 | ||
| 325 | if (acpi_has_method(handle, "_STA")) | 309 | if (acpi_has_method(handle, "_STA")) |
| 326 | newfunc->flags |= FUNC_HAS_STA; | 310 | newfunc->flags |= FUNC_HAS_STA; |
| 327 | 311 | ||
| 328 | if (acpi_has_method(handle, "_DCK")) | ||
| 329 | newfunc->flags |= FUNC_HAS_DCK; | ||
| 330 | |||
| 331 | /* search for objects that share the same slot */ | 312 | /* search for objects that share the same slot */ |
| 332 | list_for_each_entry(slot, &bridge->slots, node) | 313 | list_for_each_entry(slot, &bridge->slots, node) |
| 333 | if (slot->device == device) | 314 | if (slot->device == device) |
| @@ -335,19 +316,26 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
| 335 | 316 | ||
| 336 | slot = kzalloc(sizeof(struct acpiphp_slot), GFP_KERNEL); | 317 | slot = kzalloc(sizeof(struct acpiphp_slot), GFP_KERNEL); |
| 337 | if (!slot) { | 318 | if (!slot) { |
| 338 | status = AE_NO_MEMORY; | 319 | acpi_lock_hp_context(); |
| 339 | goto err; | 320 | acpiphp_put_context(context); |
| 321 | acpi_unlock_hp_context(); | ||
| 322 | return AE_NO_MEMORY; | ||
| 340 | } | 323 | } |
| 341 | 324 | ||
| 342 | slot->bus = bridge->pci_bus; | 325 | slot->bus = bridge->pci_bus; |
| 343 | slot->device = device; | 326 | slot->device = device; |
| 344 | INIT_LIST_HEAD(&slot->funcs); | 327 | INIT_LIST_HEAD(&slot->funcs); |
| 345 | mutex_init(&slot->crit_sect); | ||
| 346 | 328 | ||
| 347 | list_add_tail(&slot->node, &bridge->slots); | 329 | list_add_tail(&slot->node, &bridge->slots); |
| 348 | 330 | ||
| 349 | /* Register slots for ejectable functions only. */ | 331 | /* |
| 350 | if (acpi_pci_check_ejectable(pbus, handle) || is_dock_device(handle)) { | 332 | * Expose slots to user space for functions that have _EJ0 or _RMV or |
| 333 | * are located in dock stations. Do not expose them for devices handled | ||
| 334 | * by the native PCIe hotplug (PCIeHP), becuase that code is supposed to | ||
| 335 | * expose slots to user space in those cases. | ||
| 336 | */ | ||
| 337 | if ((acpi_pci_check_ejectable(pbus, handle) || is_dock_device(adev)) | ||
| 338 | && !(pdev && device_is_managed_by_native_pciehp(pdev))) { | ||
| 351 | unsigned long long sun; | 339 | unsigned long long sun; |
| 352 | int retval; | 340 | int retval; |
| 353 | 341 | ||
| @@ -381,44 +369,16 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
| 381 | &val, 60*1000)) | 369 | &val, 60*1000)) |
| 382 | slot->flags |= SLOT_ENABLED; | 370 | slot->flags |= SLOT_ENABLED; |
| 383 | 371 | ||
| 384 | if (is_dock_device(handle)) { | ||
| 385 | /* we don't want to call this device's _EJ0 | ||
| 386 | * because we want the dock notify handler | ||
| 387 | * to call it after it calls _DCK | ||
| 388 | */ | ||
| 389 | newfunc->flags &= ~FUNC_HAS_EJ0; | ||
| 390 | if (register_hotplug_dock_device(handle, | ||
| 391 | &acpiphp_dock_ops, context, | ||
| 392 | acpiphp_dock_init, acpiphp_dock_release)) | ||
| 393 | pr_debug("failed to register dock device\n"); | ||
| 394 | } | ||
| 395 | |||
| 396 | /* install notify handler */ | ||
| 397 | if (!(newfunc->flags & FUNC_HAS_DCK)) { | ||
| 398 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
| 399 | handle_hotplug_event, | ||
| 400 | context); | ||
| 401 | if (ACPI_FAILURE(status)) | ||
| 402 | acpi_handle_err(handle, | ||
| 403 | "failed to install notify handler\n"); | ||
| 404 | } | ||
| 405 | |||
| 406 | return AE_OK; | 372 | return AE_OK; |
| 407 | |||
| 408 | err: | ||
| 409 | mutex_lock(&acpiphp_context_lock); | ||
| 410 | acpiphp_put_context(context); | ||
| 411 | mutex_unlock(&acpiphp_context_lock); | ||
| 412 | return status; | ||
| 413 | } | 373 | } |
| 414 | 374 | ||
| 415 | static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle) | 375 | static struct acpiphp_bridge *acpiphp_dev_to_bridge(struct acpi_device *adev) |
| 416 | { | 376 | { |
| 417 | struct acpiphp_context *context; | 377 | struct acpiphp_context *context; |
| 418 | struct acpiphp_bridge *bridge = NULL; | 378 | struct acpiphp_bridge *bridge = NULL; |
| 419 | 379 | ||
| 420 | mutex_lock(&acpiphp_context_lock); | 380 | acpi_lock_hp_context(); |
| 421 | context = acpiphp_get_context(handle); | 381 | context = acpiphp_get_context(adev); |
| 422 | if (context) { | 382 | if (context) { |
| 423 | bridge = context->bridge; | 383 | bridge = context->bridge; |
| 424 | if (bridge) | 384 | if (bridge) |
| @@ -426,7 +386,7 @@ static struct acpiphp_bridge *acpiphp_handle_to_bridge(acpi_handle handle) | |||
| 426 | 386 | ||
| 427 | acpiphp_put_context(context); | 387 | acpiphp_put_context(context); |
| 428 | } | 388 | } |
| 429 | mutex_unlock(&acpiphp_context_lock); | 389 | acpi_unlock_hp_context(); |
| 430 | return bridge; | 390 | return bridge; |
| 431 | } | 391 | } |
| 432 | 392 | ||
| @@ -434,22 +394,15 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) | |||
| 434 | { | 394 | { |
| 435 | struct acpiphp_slot *slot; | 395 | struct acpiphp_slot *slot; |
| 436 | struct acpiphp_func *func; | 396 | struct acpiphp_func *func; |
| 437 | acpi_status status; | ||
| 438 | 397 | ||
| 439 | list_for_each_entry(slot, &bridge->slots, node) { | 398 | list_for_each_entry(slot, &bridge->slots, node) { |
| 440 | list_for_each_entry(func, &slot->funcs, sibling) { | 399 | list_for_each_entry(func, &slot->funcs, sibling) { |
| 441 | acpi_handle handle = func_to_handle(func); | 400 | struct acpi_device *adev = func_to_acpi_device(func); |
| 442 | |||
| 443 | if (is_dock_device(handle)) | ||
| 444 | unregister_hotplug_dock_device(handle); | ||
| 445 | 401 | ||
| 446 | if (!(func->flags & FUNC_HAS_DCK)) { | 402 | acpi_lock_hp_context(); |
| 447 | status = acpi_remove_notify_handler(handle, | 403 | adev->hp->notify = NULL; |
| 448 | ACPI_SYSTEM_NOTIFY, | 404 | adev->hp->fixup = NULL; |
| 449 | handle_hotplug_event); | 405 | acpi_unlock_hp_context(); |
| 450 | if (ACPI_FAILURE(status)) | ||
| 451 | pr_err("failed to remove notify handler\n"); | ||
| 452 | } | ||
| 453 | } | 406 | } |
| 454 | slot->flags |= SLOT_IS_GOING_AWAY; | 407 | slot->flags |= SLOT_IS_GOING_AWAY; |
| 455 | if (slot->slot) | 408 | if (slot->slot) |
| @@ -460,9 +413,9 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) | |||
| 460 | list_del(&bridge->list); | 413 | list_del(&bridge->list); |
| 461 | mutex_unlock(&bridge_mutex); | 414 | mutex_unlock(&bridge_mutex); |
| 462 | 415 | ||
| 463 | mutex_lock(&acpiphp_context_lock); | 416 | acpi_lock_hp_context(); |
| 464 | bridge->is_going_away = true; | 417 | bridge->is_going_away = true; |
| 465 | mutex_unlock(&acpiphp_context_lock); | 418 | acpi_unlock_hp_context(); |
| 466 | } | 419 | } |
| 467 | 420 | ||
| 468 | /** | 421 | /** |
| @@ -492,33 +445,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
| 492 | return max; | 445 | return max; |
| 493 | } | 446 | } |
| 494 | 447 | ||
| 495 | /** | ||
| 496 | * acpiphp_bus_trim - Trim device objects in an ACPI namespace subtree. | ||
| 497 | * @handle: ACPI device object handle to start from. | ||
| 498 | */ | ||
| 499 | static void acpiphp_bus_trim(acpi_handle handle) | ||
| 500 | { | ||
| 501 | struct acpi_device *adev = NULL; | ||
| 502 | |||
| 503 | acpi_bus_get_device(handle, &adev); | ||
| 504 | if (adev) | ||
| 505 | acpi_bus_trim(adev); | ||
| 506 | } | ||
| 507 | |||
| 508 | /** | ||
| 509 | * acpiphp_bus_add - Scan ACPI namespace subtree. | ||
| 510 | * @handle: ACPI object handle to start the scan from. | ||
| 511 | */ | ||
| 512 | static void acpiphp_bus_add(acpi_handle handle) | ||
| 513 | { | ||
| 514 | struct acpi_device *adev = NULL; | ||
| 515 | |||
| 516 | acpi_bus_scan(handle); | ||
| 517 | acpi_bus_get_device(handle, &adev); | ||
| 518 | if (acpi_device_enumerated(adev)) | ||
| 519 | acpi_device_set_power(adev, ACPI_STATE_D0); | ||
| 520 | } | ||
| 521 | |||
| 522 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) | 448 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) |
| 523 | { | 449 | { |
| 524 | struct acpiphp_func *func; | 450 | struct acpiphp_func *func; |
| @@ -558,9 +484,13 @@ static int acpiphp_rescan_slot(struct acpiphp_slot *slot) | |||
| 558 | { | 484 | { |
| 559 | struct acpiphp_func *func; | 485 | struct acpiphp_func *func; |
| 560 | 486 | ||
| 561 | list_for_each_entry(func, &slot->funcs, sibling) | 487 | list_for_each_entry(func, &slot->funcs, sibling) { |
| 562 | acpiphp_bus_add(func_to_handle(func)); | 488 | struct acpi_device *adev = func_to_acpi_device(func); |
| 563 | 489 | ||
| 490 | acpi_bus_scan(adev->handle); | ||
| 491 | if (acpi_device_enumerated(adev)) | ||
| 492 | acpi_device_set_power(adev, ACPI_STATE_D0); | ||
| 493 | } | ||
| 564 | return pci_scan_slot(slot->bus, PCI_DEVFN(slot->device, 0)); | 494 | return pci_scan_slot(slot->bus, PCI_DEVFN(slot->device, 0)); |
| 565 | } | 495 | } |
| 566 | 496 | ||
| @@ -625,32 +555,15 @@ static void __ref enable_slot(struct acpiphp_slot *slot) | |||
| 625 | } | 555 | } |
| 626 | } | 556 | } |
| 627 | 557 | ||
| 628 | /* return first device in slot, acquiring a reference on it */ | ||
| 629 | static struct pci_dev *dev_in_slot(struct acpiphp_slot *slot) | ||
| 630 | { | ||
| 631 | struct pci_bus *bus = slot->bus; | ||
| 632 | struct pci_dev *dev; | ||
| 633 | struct pci_dev *ret = NULL; | ||
| 634 | |||
| 635 | down_read(&pci_bus_sem); | ||
| 636 | list_for_each_entry(dev, &bus->devices, bus_list) | ||
| 637 | if (PCI_SLOT(dev->devfn) == slot->device) { | ||
| 638 | ret = pci_dev_get(dev); | ||
| 639 | break; | ||
| 640 | } | ||
| 641 | up_read(&pci_bus_sem); | ||
| 642 | |||
| 643 | return ret; | ||
| 644 | } | ||
| 645 | |||
| 646 | /** | 558 | /** |
| 647 | * disable_slot - disable a slot | 559 | * disable_slot - disable a slot |
| 648 | * @slot: ACPI PHP slot | 560 | * @slot: ACPI PHP slot |
| 649 | */ | 561 | */ |
| 650 | static void disable_slot(struct acpiphp_slot *slot) | 562 | static void disable_slot(struct acpiphp_slot *slot) |
| 651 | { | 563 | { |
| 564 | struct pci_bus *bus = slot->bus; | ||
| 565 | struct pci_dev *dev, *prev; | ||
| 652 | struct acpiphp_func *func; | 566 | struct acpiphp_func *func; |
| 653 | struct pci_dev *pdev; | ||
| 654 | 567 | ||
| 655 | /* | 568 | /* |
| 656 | * enable_slot() enumerates all functions in this device via | 569 | * enable_slot() enumerates all functions in this device via |
| @@ -658,22 +571,18 @@ static void disable_slot(struct acpiphp_slot *slot) | |||
| 658 | * methods (_EJ0, etc.) or not. Therefore, we remove all functions | 571 | * methods (_EJ0, etc.) or not. Therefore, we remove all functions |
| 659 | * here. | 572 | * here. |
| 660 | */ | 573 | */ |
| 661 | while ((pdev = dev_in_slot(slot))) { | 574 | list_for_each_entry_safe_reverse(dev, prev, &bus->devices, bus_list) |
| 662 | pci_stop_and_remove_bus_device(pdev); | 575 | if (PCI_SLOT(dev->devfn) == slot->device) |
| 663 | pci_dev_put(pdev); | 576 | pci_stop_and_remove_bus_device(dev); |
| 664 | } | ||
| 665 | 577 | ||
| 666 | list_for_each_entry(func, &slot->funcs, sibling) | 578 | list_for_each_entry(func, &slot->funcs, sibling) |
| 667 | acpiphp_bus_trim(func_to_handle(func)); | 579 | acpi_bus_trim(func_to_acpi_device(func)); |
| 668 | 580 | ||
| 669 | slot->flags &= (~SLOT_ENABLED); | 581 | slot->flags &= (~SLOT_ENABLED); |
| 670 | } | 582 | } |
| 671 | 583 | ||
| 672 | static bool acpiphp_no_hotplug(acpi_handle handle) | 584 | static bool acpiphp_no_hotplug(struct acpi_device *adev) |
| 673 | { | 585 | { |
| 674 | struct acpi_device *adev = NULL; | ||
| 675 | |||
| 676 | acpi_bus_get_device(handle, &adev); | ||
| 677 | return adev && adev->flags.no_hotplug; | 586 | return adev && adev->flags.no_hotplug; |
| 678 | } | 587 | } |
| 679 | 588 | ||
| @@ -682,7 +591,7 @@ static bool slot_no_hotplug(struct acpiphp_slot *slot) | |||
| 682 | struct acpiphp_func *func; | 591 | struct acpiphp_func *func; |
| 683 | 592 | ||
| 684 | list_for_each_entry(func, &slot->funcs, sibling) | 593 | list_for_each_entry(func, &slot->funcs, sibling) |
| 685 | if (acpiphp_no_hotplug(func_to_handle(func))) | 594 | if (acpiphp_no_hotplug(func_to_acpi_device(func))) |
| 686 | return true; | 595 | return true; |
| 687 | 596 | ||
| 688 | return false; | 597 | return false; |
| @@ -747,28 +656,25 @@ static inline bool device_status_valid(unsigned int sta) | |||
| 747 | */ | 656 | */ |
| 748 | static void trim_stale_devices(struct pci_dev *dev) | 657 | static void trim_stale_devices(struct pci_dev *dev) |
| 749 | { | 658 | { |
| 750 | acpi_handle handle = ACPI_HANDLE(&dev->dev); | 659 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); |
| 751 | struct pci_bus *bus = dev->subordinate; | 660 | struct pci_bus *bus = dev->subordinate; |
| 752 | bool alive = false; | 661 | bool alive = false; |
| 753 | 662 | ||
| 754 | if (handle) { | 663 | if (adev) { |
| 755 | acpi_status status; | 664 | acpi_status status; |
| 756 | unsigned long long sta; | 665 | unsigned long long sta; |
| 757 | 666 | ||
| 758 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | 667 | status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); |
| 759 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) | 668 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) |
| 760 | || acpiphp_no_hotplug(handle); | 669 | || acpiphp_no_hotplug(adev); |
| 761 | } | 670 | } |
| 762 | if (!alive) { | 671 | if (!alive) |
| 763 | u32 v; | 672 | alive = pci_device_is_present(dev); |
| 764 | 673 | ||
| 765 | /* Check if the device responds. */ | ||
| 766 | alive = pci_bus_read_dev_vendor_id(dev->bus, dev->devfn, &v, 0); | ||
| 767 | } | ||
| 768 | if (!alive) { | 674 | if (!alive) { |
| 769 | pci_stop_and_remove_bus_device(dev); | 675 | pci_stop_and_remove_bus_device(dev); |
| 770 | if (handle) | 676 | if (adev) |
| 771 | acpiphp_bus_trim(handle); | 677 | acpi_bus_trim(adev); |
| 772 | } else if (bus) { | 678 | } else if (bus) { |
| 773 | struct pci_dev *child, *tmp; | 679 | struct pci_dev *child, *tmp; |
| 774 | 680 | ||
| @@ -800,7 +706,6 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) | |||
| 800 | struct pci_bus *bus = slot->bus; | 706 | struct pci_bus *bus = slot->bus; |
| 801 | struct pci_dev *dev, *tmp; | 707 | struct pci_dev *dev, *tmp; |
| 802 | 708 | ||
| 803 | mutex_lock(&slot->crit_sect); | ||
| 804 | if (slot_no_hotplug(slot)) { | 709 | if (slot_no_hotplug(slot)) { |
| 805 | ; /* do nothing */ | 710 | ; /* do nothing */ |
| 806 | } else if (device_status_valid(get_slot_status(slot))) { | 711 | } else if (device_status_valid(get_slot_status(slot))) { |
| @@ -815,7 +720,6 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) | |||
| 815 | } else { | 720 | } else { |
| 816 | disable_slot(slot); | 721 | disable_slot(slot); |
| 817 | } | 722 | } |
| 818 | mutex_unlock(&slot->crit_sect); | ||
| 819 | } | 723 | } |
| 820 | } | 724 | } |
| 821 | 725 | ||
| @@ -855,11 +759,11 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus) | |||
| 855 | * ACPI event handlers | 759 | * ACPI event handlers |
| 856 | */ | 760 | */ |
| 857 | 761 | ||
| 858 | void acpiphp_check_host_bridge(acpi_handle handle) | 762 | void acpiphp_check_host_bridge(struct acpi_device *adev) |
| 859 | { | 763 | { |
| 860 | struct acpiphp_bridge *bridge; | 764 | struct acpiphp_bridge *bridge; |
| 861 | 765 | ||
| 862 | bridge = acpiphp_handle_to_bridge(handle); | 766 | bridge = acpiphp_dev_to_bridge(adev); |
| 863 | if (bridge) { | 767 | if (bridge) { |
| 864 | pci_lock_rescan_remove(); | 768 | pci_lock_rescan_remove(); |
| 865 | 769 | ||
| @@ -872,73 +776,52 @@ void acpiphp_check_host_bridge(acpi_handle handle) | |||
| 872 | 776 | ||
| 873 | static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot); | 777 | static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot); |
| 874 | 778 | ||
| 875 | static void hotplug_event(acpi_handle handle, u32 type, void *data) | 779 | static void hotplug_event(u32 type, struct acpiphp_context *context) |
| 876 | { | 780 | { |
| 877 | struct acpiphp_context *context = data; | 781 | acpi_handle handle = context->hp.self->handle; |
| 878 | struct acpiphp_func *func = &context->func; | 782 | struct acpiphp_func *func = &context->func; |
| 783 | struct acpiphp_slot *slot = func->slot; | ||
| 879 | struct acpiphp_bridge *bridge; | 784 | struct acpiphp_bridge *bridge; |
| 880 | char objname[64]; | ||
| 881 | struct acpi_buffer buffer = { .length = sizeof(objname), | ||
| 882 | .pointer = objname }; | ||
| 883 | 785 | ||
| 884 | mutex_lock(&acpiphp_context_lock); | 786 | acpi_lock_hp_context(); |
| 885 | bridge = context->bridge; | 787 | bridge = context->bridge; |
| 886 | if (bridge) | 788 | if (bridge) |
| 887 | get_bridge(bridge); | 789 | get_bridge(bridge); |
| 888 | 790 | ||
| 889 | mutex_unlock(&acpiphp_context_lock); | 791 | acpi_unlock_hp_context(); |
| 890 | 792 | ||
| 891 | pci_lock_rescan_remove(); | 793 | pci_lock_rescan_remove(); |
| 892 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
| 893 | 794 | ||
| 894 | switch (type) { | 795 | switch (type) { |
| 895 | case ACPI_NOTIFY_BUS_CHECK: | 796 | case ACPI_NOTIFY_BUS_CHECK: |
| 896 | /* bus re-enumerate */ | 797 | /* bus re-enumerate */ |
| 897 | pr_debug("%s: Bus check notify on %s\n", __func__, objname); | 798 | acpi_handle_debug(handle, "Bus check in %s()\n", __func__); |
| 898 | pr_debug("%s: re-enumerating slots under %s\n", | 799 | if (bridge) |
| 899 | __func__, objname); | ||
| 900 | if (bridge) { | ||
| 901 | acpiphp_check_bridge(bridge); | 800 | acpiphp_check_bridge(bridge); |
| 902 | } else { | 801 | else if (!(slot->flags & SLOT_IS_GOING_AWAY)) |
| 903 | struct acpiphp_slot *slot = func->slot; | ||
| 904 | |||
| 905 | if (slot->flags & SLOT_IS_GOING_AWAY) | ||
| 906 | break; | ||
| 907 | |||
| 908 | mutex_lock(&slot->crit_sect); | ||
| 909 | enable_slot(slot); | 802 | enable_slot(slot); |
| 910 | mutex_unlock(&slot->crit_sect); | 803 | |
| 911 | } | ||
| 912 | break; | 804 | break; |
| 913 | 805 | ||
| 914 | case ACPI_NOTIFY_DEVICE_CHECK: | 806 | case ACPI_NOTIFY_DEVICE_CHECK: |
| 915 | /* device check */ | 807 | /* device check */ |
| 916 | pr_debug("%s: Device check notify on %s\n", __func__, objname); | 808 | acpi_handle_debug(handle, "Device check in %s()\n", __func__); |
| 917 | if (bridge) { | 809 | if (bridge) { |
| 918 | acpiphp_check_bridge(bridge); | 810 | acpiphp_check_bridge(bridge); |
| 919 | } else { | 811 | } else if (!(slot->flags & SLOT_IS_GOING_AWAY)) { |
| 920 | struct acpiphp_slot *slot = func->slot; | ||
| 921 | int ret; | ||
| 922 | |||
| 923 | if (slot->flags & SLOT_IS_GOING_AWAY) | ||
| 924 | break; | ||
| 925 | |||
| 926 | /* | 812 | /* |
| 927 | * Check if anything has changed in the slot and rescan | 813 | * Check if anything has changed in the slot and rescan |
| 928 | * from the parent if that's the case. | 814 | * from the parent if that's the case. |
| 929 | */ | 815 | */ |
| 930 | mutex_lock(&slot->crit_sect); | 816 | if (acpiphp_rescan_slot(slot)) |
| 931 | ret = acpiphp_rescan_slot(slot); | ||
| 932 | mutex_unlock(&slot->crit_sect); | ||
| 933 | if (ret) | ||
| 934 | acpiphp_check_bridge(func->parent); | 817 | acpiphp_check_bridge(func->parent); |
| 935 | } | 818 | } |
| 936 | break; | 819 | break; |
| 937 | 820 | ||
| 938 | case ACPI_NOTIFY_EJECT_REQUEST: | 821 | case ACPI_NOTIFY_EJECT_REQUEST: |
| 939 | /* request device eject */ | 822 | /* request device eject */ |
| 940 | pr_debug("%s: Device eject notify on %s\n", __func__, objname); | 823 | acpi_handle_debug(handle, "Eject request in %s()\n", __func__); |
| 941 | acpiphp_disable_and_eject_slot(func->slot); | 824 | acpiphp_disable_and_eject_slot(slot); |
| 942 | break; | 825 | break; |
| 943 | } | 826 | } |
| 944 | 827 | ||
| @@ -947,106 +830,41 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) | |||
| 947 | put_bridge(bridge); | 830 | put_bridge(bridge); |
| 948 | } | 831 | } |
| 949 | 832 | ||
| 950 | static void hotplug_event_work(void *data, u32 type) | 833 | static int acpiphp_hotplug_notify(struct acpi_device *adev, u32 type) |
| 951 | { | 834 | { |
| 952 | struct acpiphp_context *context = data; | 835 | struct acpiphp_context *context; |
| 953 | acpi_handle handle = context->handle; | ||
| 954 | |||
| 955 | acpi_scan_lock_acquire(); | ||
| 956 | 836 | ||
| 957 | hotplug_event(handle, type, context); | 837 | context = acpiphp_grab_context(adev); |
| 838 | if (!context) | ||
| 839 | return -ENODATA; | ||
| 958 | 840 | ||
| 959 | acpi_scan_lock_release(); | 841 | hotplug_event(type, context); |
| 960 | acpi_evaluate_hotplug_ost(handle, type, ACPI_OST_SC_SUCCESS, NULL); | 842 | acpiphp_let_context_go(context); |
| 961 | put_bridge(context->func.parent); | 843 | return 0; |
| 962 | } | 844 | } |
| 963 | 845 | ||
| 964 | /** | 846 | /** |
| 965 | * handle_hotplug_event - handle ACPI hotplug event | 847 | * acpiphp_enumerate_slots - Enumerate PCI slots for a given bus. |
| 966 | * @handle: Notify()'ed acpi_handle | 848 | * @bus: PCI bus to enumerate the slots for. |
| 967 | * @type: Notify code | ||
| 968 | * @data: pointer to acpiphp_context structure | ||
| 969 | * | 849 | * |
| 970 | * Handles ACPI event notification on slots. | 850 | * A "slot" is an object associated with a PCI device number. All functions |
| 971 | */ | 851 | * (PCI devices) with the same bus and device number belong to the same slot. |
| 972 | static void handle_hotplug_event(acpi_handle handle, u32 type, void *data) | ||
| 973 | { | ||
| 974 | struct acpiphp_context *context; | ||
| 975 | u32 ost_code = ACPI_OST_SC_SUCCESS; | ||
| 976 | acpi_status status; | ||
| 977 | |||
| 978 | switch (type) { | ||
| 979 | case ACPI_NOTIFY_BUS_CHECK: | ||
| 980 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
| 981 | break; | ||
| 982 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
| 983 | ost_code = ACPI_OST_SC_EJECT_IN_PROGRESS; | ||
| 984 | acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); | ||
| 985 | break; | ||
| 986 | |||
| 987 | case ACPI_NOTIFY_DEVICE_WAKE: | ||
| 988 | return; | ||
| 989 | |||
| 990 | case ACPI_NOTIFY_FREQUENCY_MISMATCH: | ||
| 991 | acpi_handle_err(handle, "Device cannot be configured due " | ||
| 992 | "to a frequency mismatch\n"); | ||
| 993 | goto out; | ||
| 994 | |||
| 995 | case ACPI_NOTIFY_BUS_MODE_MISMATCH: | ||
| 996 | acpi_handle_err(handle, "Device cannot be configured due " | ||
| 997 | "to a bus mode mismatch\n"); | ||
| 998 | goto out; | ||
| 999 | |||
| 1000 | case ACPI_NOTIFY_POWER_FAULT: | ||
| 1001 | acpi_handle_err(handle, "Device has suffered a power fault\n"); | ||
| 1002 | goto out; | ||
| 1003 | |||
| 1004 | default: | ||
| 1005 | acpi_handle_warn(handle, "Unsupported event type 0x%x\n", type); | ||
| 1006 | ost_code = ACPI_OST_SC_UNRECOGNIZED_NOTIFY; | ||
| 1007 | goto out; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | mutex_lock(&acpiphp_context_lock); | ||
| 1011 | context = acpiphp_get_context(handle); | ||
| 1012 | if (!context || WARN_ON(context->handle != handle) | ||
| 1013 | || context->func.parent->is_going_away) | ||
| 1014 | goto err_out; | ||
| 1015 | |||
| 1016 | get_bridge(context->func.parent); | ||
| 1017 | acpiphp_put_context(context); | ||
| 1018 | status = acpi_hotplug_execute(hotplug_event_work, context, type); | ||
| 1019 | if (ACPI_SUCCESS(status)) { | ||
| 1020 | mutex_unlock(&acpiphp_context_lock); | ||
| 1021 | return; | ||
| 1022 | } | ||
| 1023 | put_bridge(context->func.parent); | ||
| 1024 | |||
| 1025 | err_out: | ||
| 1026 | mutex_unlock(&acpiphp_context_lock); | ||
| 1027 | ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | ||
| 1028 | |||
| 1029 | out: | ||
| 1030 | acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); | ||
| 1031 | } | ||
| 1032 | |||
| 1033 | /* | ||
| 1034 | * Create hotplug slots for the PCI bus. | ||
| 1035 | * It should always return 0 to avoid skipping following notifiers. | ||
| 1036 | */ | 852 | */ |
| 1037 | void acpiphp_enumerate_slots(struct pci_bus *bus) | 853 | void acpiphp_enumerate_slots(struct pci_bus *bus) |
| 1038 | { | 854 | { |
| 1039 | struct acpiphp_bridge *bridge; | 855 | struct acpiphp_bridge *bridge; |
| 856 | struct acpi_device *adev; | ||
| 1040 | acpi_handle handle; | 857 | acpi_handle handle; |
| 1041 | acpi_status status; | 858 | acpi_status status; |
| 1042 | 859 | ||
| 1043 | if (acpiphp_disabled) | 860 | if (acpiphp_disabled) |
| 1044 | return; | 861 | return; |
| 1045 | 862 | ||
| 1046 | handle = ACPI_HANDLE(bus->bridge); | 863 | adev = ACPI_COMPANION(bus->bridge); |
| 1047 | if (!handle) | 864 | if (!adev) |
| 1048 | return; | 865 | return; |
| 1049 | 866 | ||
| 867 | handle = adev->handle; | ||
| 1050 | bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); | 868 | bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); |
| 1051 | if (!bridge) { | 869 | if (!bridge) { |
| 1052 | acpi_handle_err(handle, "No memory for bridge object\n"); | 870 | acpi_handle_err(handle, "No memory for bridge object\n"); |
| @@ -1074,10 +892,10 @@ void acpiphp_enumerate_slots(struct pci_bus *bus) | |||
| 1074 | * parent is going to be handled by pciehp, in which case this | 892 | * parent is going to be handled by pciehp, in which case this |
| 1075 | * bridge is not interesting to us either. | 893 | * bridge is not interesting to us either. |
| 1076 | */ | 894 | */ |
| 1077 | mutex_lock(&acpiphp_context_lock); | 895 | acpi_lock_hp_context(); |
| 1078 | context = acpiphp_get_context(handle); | 896 | context = acpiphp_get_context(adev); |
| 1079 | if (!context) { | 897 | if (!context) { |
| 1080 | mutex_unlock(&acpiphp_context_lock); | 898 | acpi_unlock_hp_context(); |
| 1081 | put_device(&bus->dev); | 899 | put_device(&bus->dev); |
| 1082 | pci_dev_put(bridge->pci_dev); | 900 | pci_dev_put(bridge->pci_dev); |
| 1083 | kfree(bridge); | 901 | kfree(bridge); |
| @@ -1087,17 +905,17 @@ void acpiphp_enumerate_slots(struct pci_bus *bus) | |||
| 1087 | context->bridge = bridge; | 905 | context->bridge = bridge; |
| 1088 | /* Get a reference to the parent bridge. */ | 906 | /* Get a reference to the parent bridge. */ |
| 1089 | get_bridge(context->func.parent); | 907 | get_bridge(context->func.parent); |
| 1090 | mutex_unlock(&acpiphp_context_lock); | 908 | acpi_unlock_hp_context(); |
| 1091 | } | 909 | } |
| 1092 | 910 | ||
| 1093 | /* must be added to the list prior to calling register_slot */ | 911 | /* Must be added to the list prior to calling acpiphp_add_context(). */ |
| 1094 | mutex_lock(&bridge_mutex); | 912 | mutex_lock(&bridge_mutex); |
| 1095 | list_add(&bridge->list, &bridge_list); | 913 | list_add(&bridge->list, &bridge_list); |
| 1096 | mutex_unlock(&bridge_mutex); | 914 | mutex_unlock(&bridge_mutex); |
| 1097 | 915 | ||
| 1098 | /* register all slot objects under this bridge */ | 916 | /* register all slot objects under this bridge */ |
| 1099 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | 917 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, |
| 1100 | register_slot, NULL, bridge, NULL); | 918 | acpiphp_add_context, NULL, bridge, NULL); |
| 1101 | if (ACPI_FAILURE(status)) { | 919 | if (ACPI_FAILURE(status)) { |
| 1102 | acpi_handle_err(handle, "failed to register slots\n"); | 920 | acpi_handle_err(handle, "failed to register slots\n"); |
| 1103 | cleanup_bridge(bridge); | 921 | cleanup_bridge(bridge); |
| @@ -1105,7 +923,10 @@ void acpiphp_enumerate_slots(struct pci_bus *bus) | |||
| 1105 | } | 923 | } |
| 1106 | } | 924 | } |
| 1107 | 925 | ||
| 1108 | /* Destroy hotplug slots associated with the PCI bus */ | 926 | /** |
| 927 | * acpiphp_remove_slots - Remove slot objects associated with a given bus. | ||
| 928 | * @bus: PCI bus to remove the slot objects for. | ||
| 929 | */ | ||
| 1109 | void acpiphp_remove_slots(struct pci_bus *bus) | 930 | void acpiphp_remove_slots(struct pci_bus *bus) |
| 1110 | { | 931 | { |
| 1111 | struct acpiphp_bridge *bridge; | 932 | struct acpiphp_bridge *bridge; |
| @@ -1136,13 +957,10 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
| 1136 | if (slot->flags & SLOT_IS_GOING_AWAY) | 957 | if (slot->flags & SLOT_IS_GOING_AWAY) |
| 1137 | return -ENODEV; | 958 | return -ENODEV; |
| 1138 | 959 | ||
| 1139 | mutex_lock(&slot->crit_sect); | ||
| 1140 | /* configure all functions */ | 960 | /* configure all functions */ |
| 1141 | if (!(slot->flags & SLOT_ENABLED)) | 961 | if (!(slot->flags & SLOT_ENABLED)) |
| 1142 | enable_slot(slot); | 962 | enable_slot(slot); |
| 1143 | 963 | ||
| 1144 | mutex_unlock(&slot->crit_sect); | ||
| 1145 | |||
| 1146 | pci_unlock_rescan_remove(); | 964 | pci_unlock_rescan_remove(); |
| 1147 | return 0; | 965 | return 0; |
| 1148 | } | 966 | } |
| @@ -1158,8 +976,6 @@ static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) | |||
| 1158 | if (slot->flags & SLOT_IS_GOING_AWAY) | 976 | if (slot->flags & SLOT_IS_GOING_AWAY) |
| 1159 | return -ENODEV; | 977 | return -ENODEV; |
| 1160 | 978 | ||
| 1161 | mutex_lock(&slot->crit_sect); | ||
| 1162 | |||
| 1163 | /* unconfigure all functions */ | 979 | /* unconfigure all functions */ |
| 1164 | disable_slot(slot); | 980 | disable_slot(slot); |
| 1165 | 981 | ||
| @@ -1173,7 +989,6 @@ static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) | |||
| 1173 | break; | 989 | break; |
| 1174 | } | 990 | } |
| 1175 | 991 | ||
| 1176 | mutex_unlock(&slot->crit_sect); | ||
| 1177 | return 0; | 992 | return 0; |
| 1178 | } | 993 | } |
| 1179 | 994 | ||
| @@ -1181,9 +996,15 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) | |||
| 1181 | { | 996 | { |
| 1182 | int ret; | 997 | int ret; |
| 1183 | 998 | ||
| 999 | /* | ||
| 1000 | * Acquire acpi_scan_lock to ensure that the execution of _EJ0 in | ||
| 1001 | * acpiphp_disable_and_eject_slot() will be synchronized properly. | ||
| 1002 | */ | ||
| 1003 | acpi_scan_lock_acquire(); | ||
| 1184 | pci_lock_rescan_remove(); | 1004 | pci_lock_rescan_remove(); |
| 1185 | ret = acpiphp_disable_and_eject_slot(slot); | 1005 | ret = acpiphp_disable_and_eject_slot(slot); |
| 1186 | pci_unlock_rescan_remove(); | 1006 | pci_unlock_rescan_remove(); |
| 1007 | acpi_scan_lock_release(); | ||
| 1187 | return ret; | 1008 | return ret; |
| 1188 | } | 1009 | } |
| 1189 | 1010 | ||
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 25f0bc659164..d911e0c1f359 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
| @@ -616,15 +616,11 @@ static int pci_pm_prepare(struct device *dev) | |||
| 616 | int error = 0; | 616 | int error = 0; |
| 617 | 617 | ||
| 618 | /* | 618 | /* |
| 619 | * PCI devices suspended at run time need to be resumed at this | 619 | * Devices having power.ignore_children set may still be necessary for |
| 620 | * point, because in general it is necessary to reconfigure them for | 620 | * suspending their children in the next phase of device suspend. |
| 621 | * system suspend. Namely, if the device is supposed to wake up the | ||
| 622 | * system from the sleep state, we may need to reconfigure it for this | ||
| 623 | * purpose. In turn, if the device is not supposed to wake up the | ||
| 624 | * system from the sleep state, we'll have to prevent it from signaling | ||
| 625 | * wake-up. | ||
| 626 | */ | 621 | */ |
| 627 | pm_runtime_resume(dev); | 622 | if (dev->power.ignore_children) |
| 623 | pm_runtime_resume(dev); | ||
| 628 | 624 | ||
| 629 | if (drv && drv->pm && drv->pm->prepare) | 625 | if (drv && drv->pm && drv->pm->prepare) |
| 630 | error = drv->pm->prepare(dev); | 626 | error = drv->pm->prepare(dev); |
| @@ -654,6 +650,16 @@ static int pci_pm_suspend(struct device *dev) | |||
| 654 | goto Fixup; | 650 | goto Fixup; |
| 655 | } | 651 | } |
| 656 | 652 | ||
| 653 | /* | ||
| 654 | * PCI devices suspended at run time need to be resumed at this point, | ||
| 655 | * because in general it is necessary to reconfigure them for system | ||
| 656 | * suspend. Namely, if the device is supposed to wake up the system | ||
| 657 | * from the sleep state, we may need to reconfigure it for this purpose. | ||
| 658 | * In turn, if the device is not supposed to wake up the system from the | ||
| 659 | * sleep state, we'll have to prevent it from signaling wake-up. | ||
| 660 | */ | ||
| 661 | pm_runtime_resume(dev); | ||
| 662 | |||
| 657 | pci_dev->state_saved = false; | 663 | pci_dev->state_saved = false; |
| 658 | if (pm->suspend) { | 664 | if (pm->suspend) { |
| 659 | pci_power_t prev = pci_dev->current_state; | 665 | pci_power_t prev = pci_dev->current_state; |
| @@ -808,6 +814,14 @@ static int pci_pm_freeze(struct device *dev) | |||
| 808 | return 0; | 814 | return 0; |
| 809 | } | 815 | } |
| 810 | 816 | ||
| 817 | /* | ||
| 818 | * This used to be done in pci_pm_prepare() for all devices and some | ||
| 819 | * drivers may depend on it, so do it here. Ideally, runtime-suspended | ||
| 820 | * devices should not be touched during freeze/thaw transitions, | ||
| 821 | * however. | ||
| 822 | */ | ||
| 823 | pm_runtime_resume(dev); | ||
| 824 | |||
| 811 | pci_dev->state_saved = false; | 825 | pci_dev->state_saved = false; |
| 812 | if (pm->freeze) { | 826 | if (pm->freeze) { |
| 813 | int error; | 827 | int error; |
| @@ -915,6 +929,9 @@ static int pci_pm_poweroff(struct device *dev) | |||
| 915 | goto Fixup; | 929 | goto Fixup; |
| 916 | } | 930 | } |
| 917 | 931 | ||
| 932 | /* The reason to do that is the same as in pci_pm_suspend(). */ | ||
| 933 | pm_runtime_resume(dev); | ||
| 934 | |||
| 918 | pci_dev->state_saved = false; | 935 | pci_dev->state_saved = false; |
| 919 | if (pm->poweroff) { | 936 | if (pm->poweroff) { |
| 920 | int error; | 937 | int error; |
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index 6eecd7cddf57..54d3089d157b 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c | |||
| @@ -125,9 +125,6 @@ sa1100_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, | |||
| 125 | if (freqs->new < freqs->old) | 125 | if (freqs->new < freqs->old) |
| 126 | sa1100_pcmcia_set_mecr(skt, freqs->new); | 126 | sa1100_pcmcia_set_mecr(skt, freqs->new); |
| 127 | break; | 127 | break; |
| 128 | case CPUFREQ_RESUMECHANGE: | ||
| 129 | sa1100_pcmcia_set_mecr(skt, freqs->new); | ||
| 130 | break; | ||
| 131 | } | 128 | } |
| 132 | 129 | ||
| 133 | return 0; | 130 | return 0; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 5ae65c11d544..5f67843c7fb7 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -27,8 +27,6 @@ config ACER_WMI | |||
| 27 | depends on ACPI_WMI | 27 | depends on ACPI_WMI |
| 28 | select INPUT_SPARSEKMAP | 28 | select INPUT_SPARSEKMAP |
| 29 | # Acer WMI depends on ACPI_VIDEO when ACPI is enabled | 29 | # Acer WMI depends on ACPI_VIDEO when ACPI is enabled |
| 30 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | ||
| 31 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
| 32 | select ACPI_VIDEO if ACPI | 30 | select ACPI_VIDEO if ACPI |
| 33 | ---help--- | 31 | ---help--- |
| 34 | This is a driver for newer Acer (and Wistron) laptops. It adds | 32 | This is a driver for newer Acer (and Wistron) laptops. It adds |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index be02bcc346d3..e6f336270c21 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
| @@ -66,7 +66,6 @@ | |||
| 66 | #include <linux/backlight.h> | 66 | #include <linux/backlight.h> |
| 67 | #include <linux/input.h> | 67 | #include <linux/input.h> |
| 68 | #include <linux/kfifo.h> | 68 | #include <linux/kfifo.h> |
| 69 | #include <linux/video_output.h> | ||
| 70 | #include <linux/platform_device.h> | 69 | #include <linux/platform_device.h> |
| 71 | #include <linux/slab.h> | 70 | #include <linux/slab.h> |
| 72 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 71 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index bacddd102ae9..01712cbfd92e 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
| @@ -385,7 +385,7 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res) | |||
| 385 | * device is active because it itself may be in use */ | 385 | * device is active because it itself may be in use */ |
| 386 | if (!dev->active) { | 386 | if (!dev->active) { |
| 387 | if (request_irq(*irq, pnp_test_handler, | 387 | if (request_irq(*irq, pnp_test_handler, |
| 388 | IRQF_DISABLED | IRQF_PROBE_SHARED, "pnp", NULL)) | 388 | IRQF_PROBE_SHARED, "pnp", NULL)) |
| 389 | return 0; | 389 | return 0; |
| 390 | free_irq(*irq, NULL); | 390 | free_irq(*irq, NULL); |
| 391 | } | 391 | } |
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 3c6768378a94..61b51e17d932 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c | |||
| @@ -834,7 +834,7 @@ static int rapl_write_data_raw(struct rapl_domain *rd, | |||
| 834 | } | 834 | } |
| 835 | 835 | ||
| 836 | static const struct x86_cpu_id energy_unit_quirk_ids[] = { | 836 | static const struct x86_cpu_id energy_unit_quirk_ids[] = { |
| 837 | { X86_VENDOR_INTEL, 6, 0x37},/* VLV */ | 837 | { X86_VENDOR_INTEL, 6, 0x37},/* Valleyview */ |
| 838 | {} | 838 | {} |
| 839 | }; | 839 | }; |
| 840 | 840 | ||
| @@ -947,11 +947,11 @@ static void package_power_limit_irq_restore(int package_id) | |||
| 947 | } | 947 | } |
| 948 | 948 | ||
| 949 | static const struct x86_cpu_id rapl_ids[] = { | 949 | static const struct x86_cpu_id rapl_ids[] = { |
| 950 | { X86_VENDOR_INTEL, 6, 0x2a},/* SNB */ | 950 | { X86_VENDOR_INTEL, 6, 0x2a},/* Sandy Bridge */ |
| 951 | { X86_VENDOR_INTEL, 6, 0x2d},/* SNB EP */ | 951 | { X86_VENDOR_INTEL, 6, 0x2d},/* Sandy Bridge EP */ |
| 952 | { X86_VENDOR_INTEL, 6, 0x37},/* VLV */ | 952 | { X86_VENDOR_INTEL, 6, 0x37},/* Valleyview */ |
| 953 | { X86_VENDOR_INTEL, 6, 0x3a},/* IVB */ | 953 | { X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */ |
| 954 | { X86_VENDOR_INTEL, 6, 0x45},/* HSW */ | 954 | { X86_VENDOR_INTEL, 6, 0x45},/* Haswell */ |
| 955 | /* TODO: Add more CPU IDs after testing */ | 955 | /* TODO: Add more CPU IDs after testing */ |
| 956 | {} | 956 | {} |
| 957 | }; | 957 | }; |
| @@ -1147,6 +1147,11 @@ static int rapl_check_domain(int cpu, int domain) | |||
| 1147 | if (rdmsrl_safe_on_cpu(cpu, msr, &val1)) | 1147 | if (rdmsrl_safe_on_cpu(cpu, msr, &val1)) |
| 1148 | return -ENODEV; | 1148 | return -ENODEV; |
| 1149 | 1149 | ||
| 1150 | /* PP1/uncore/graphics domain may not be active at the time of | ||
| 1151 | * driver loading. So skip further checks. | ||
| 1152 | */ | ||
| 1153 | if (domain == RAPL_DOMAIN_PP1) | ||
| 1154 | return 0; | ||
| 1150 | /* energy counters roll slowly on some domains */ | 1155 | /* energy counters roll slowly on some domains */ |
| 1151 | while (++retry < 10) { | 1156 | while (++retry < 10) { |
| 1152 | usleep_range(10000, 15000); | 1157 | usleep_range(10000, 15000); |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index be33d2b0613b..7e0b62602632 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -1041,8 +1041,7 @@ static int sci_notifier(struct notifier_block *self, | |||
| 1041 | 1041 | ||
| 1042 | sci_port = container_of(self, struct sci_port, freq_transition); | 1042 | sci_port = container_of(self, struct sci_port, freq_transition); |
| 1043 | 1043 | ||
| 1044 | if ((phase == CPUFREQ_POSTCHANGE) || | 1044 | if (phase == CPUFREQ_POSTCHANGE) { |
| 1045 | (phase == CPUFREQ_RESUMECHANGE)) { | ||
| 1046 | struct uart_port *port = &sci_port->port; | 1045 | struct uart_port *port = &sci_port->port; |
| 1047 | 1046 | ||
| 1048 | spin_lock_irqsave(&port->lock, flags); | 1047 | spin_lock_irqsave(&port->lock, flags); |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index dade5b7699bc..97a8f3a12a7b 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
| @@ -27,12 +27,6 @@ config VGASTATE | |||
| 27 | tristate | 27 | tristate |
| 28 | default n | 28 | default n |
| 29 | 29 | ||
| 30 | config VIDEO_OUTPUT_CONTROL | ||
| 31 | tristate "Lowlevel video output switch controls" | ||
| 32 | help | ||
| 33 | This framework adds support for low-level control of the video | ||
| 34 | output switch. | ||
| 35 | |||
| 36 | config VIDEOMODE_HELPERS | 30 | config VIDEOMODE_HELPERS |
| 37 | bool | 31 | bool |
| 38 | 32 | ||
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index ae17ddf49a00..08d6a4ab3ace 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
| @@ -172,8 +172,6 @@ obj-$(CONFIG_FB_SIMPLE) += simplefb.o | |||
| 172 | # the test framebuffer is last | 172 | # the test framebuffer is last |
| 173 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o | 173 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o |
| 174 | 174 | ||
| 175 | #video output switch sysfs driver | ||
| 176 | obj-$(CONFIG_VIDEO_OUTPUT_CONTROL) += output.o | ||
| 177 | obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o | 175 | obj-$(CONFIG_VIDEOMODE_HELPERS) += display_timing.o videomode.o |
| 178 | ifeq ($(CONFIG_OF),y) | 176 | ifeq ($(CONFIG_OF),y) |
| 179 | obj-$(CONFIG_VIDEOMODE_HELPERS) += of_display_timing.o of_videomode.o | 177 | obj-$(CONFIG_VIDEOMODE_HELPERS) += of_display_timing.o of_videomode.o |
diff --git a/drivers/video/output.c b/drivers/video/output.c deleted file mode 100644 index 1446c49fe6af..000000000000 --- a/drivers/video/output.c +++ /dev/null | |||
| @@ -1,133 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * output.c - Display Output Switch driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Luming Yu <luming.yu@intel.com> | ||
| 5 | * | ||
| 6 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License as published by | ||
| 10 | * the Free Software Foundation; either version 2 of the License, or (at | ||
| 11 | * your option) any later version. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, but | ||
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License along | ||
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 20 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
| 21 | * | ||
| 22 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 23 | */ | ||
| 24 | #include <linux/module.h> | ||
| 25 | #include <linux/video_output.h> | ||
| 26 | #include <linux/slab.h> | ||
| 27 | #include <linux/err.h> | ||
| 28 | #include <linux/ctype.h> | ||
| 29 | |||
| 30 | |||
| 31 | MODULE_DESCRIPTION("Display Output Switcher Lowlevel Control Abstraction"); | ||
| 32 | MODULE_LICENSE("GPL"); | ||
| 33 | MODULE_AUTHOR("Luming Yu <luming.yu@intel.com>"); | ||
| 34 | |||
| 35 | static ssize_t state_show(struct device *dev, struct device_attribute *attr, | ||
| 36 | char *buf) | ||
| 37 | { | ||
| 38 | ssize_t ret_size = 0; | ||
| 39 | struct output_device *od = to_output_device(dev); | ||
| 40 | if (od->props) | ||
| 41 | ret_size = sprintf(buf,"%.8x\n",od->props->get_status(od)); | ||
| 42 | return ret_size; | ||
| 43 | } | ||
| 44 | |||
| 45 | static ssize_t state_store(struct device *dev, struct device_attribute *attr, | ||
| 46 | const char *buf,size_t count) | ||
| 47 | { | ||
| 48 | char *endp; | ||
| 49 | struct output_device *od = to_output_device(dev); | ||
| 50 | int request_state = simple_strtoul(buf,&endp,0); | ||
| 51 | size_t size = endp - buf; | ||
| 52 | |||
| 53 | if (isspace(*endp)) | ||
| 54 | size++; | ||
| 55 | if (size != count) | ||
| 56 | return -EINVAL; | ||
| 57 | |||
| 58 | if (od->props) { | ||
| 59 | od->request_state = request_state; | ||
| 60 | od->props->set_state(od); | ||
| 61 | } | ||
| 62 | return count; | ||
| 63 | } | ||
| 64 | static DEVICE_ATTR_RW(state); | ||
| 65 | |||
| 66 | static void video_output_release(struct device *dev) | ||
| 67 | { | ||
| 68 | struct output_device *od = to_output_device(dev); | ||
| 69 | kfree(od); | ||
| 70 | } | ||
| 71 | |||
| 72 | static struct attribute *video_output_attrs[] = { | ||
| 73 | &dev_attr_state.attr, | ||
| 74 | NULL, | ||
| 75 | }; | ||
| 76 | ATTRIBUTE_GROUPS(video_output); | ||
| 77 | |||
| 78 | static struct class video_output_class = { | ||
| 79 | .name = "video_output", | ||
| 80 | .dev_release = video_output_release, | ||
| 81 | .dev_groups = video_output_groups, | ||
| 82 | }; | ||
| 83 | |||
| 84 | struct output_device *video_output_register(const char *name, | ||
| 85 | struct device *dev, | ||
| 86 | void *devdata, | ||
| 87 | struct output_properties *op) | ||
| 88 | { | ||
| 89 | struct output_device *new_dev; | ||
| 90 | int ret_code = 0; | ||
| 91 | |||
| 92 | new_dev = kzalloc(sizeof(struct output_device),GFP_KERNEL); | ||
| 93 | if (!new_dev) { | ||
| 94 | ret_code = -ENOMEM; | ||
| 95 | goto error_return; | ||
| 96 | } | ||
| 97 | new_dev->props = op; | ||
| 98 | new_dev->dev.class = &video_output_class; | ||
| 99 | new_dev->dev.parent = dev; | ||
| 100 | dev_set_name(&new_dev->dev, "%s", name); | ||
| 101 | dev_set_drvdata(&new_dev->dev, devdata); | ||
| 102 | ret_code = device_register(&new_dev->dev); | ||
| 103 | if (ret_code) { | ||
| 104 | kfree(new_dev); | ||
| 105 | goto error_return; | ||
| 106 | } | ||
| 107 | return new_dev; | ||
| 108 | |||
| 109 | error_return: | ||
| 110 | return ERR_PTR(ret_code); | ||
| 111 | } | ||
| 112 | EXPORT_SYMBOL(video_output_register); | ||
| 113 | |||
| 114 | void video_output_unregister(struct output_device *dev) | ||
| 115 | { | ||
| 116 | if (!dev) | ||
| 117 | return; | ||
| 118 | device_unregister(&dev->dev); | ||
| 119 | } | ||
| 120 | EXPORT_SYMBOL(video_output_unregister); | ||
| 121 | |||
| 122 | static void __exit video_output_class_exit(void) | ||
| 123 | { | ||
| 124 | class_unregister(&video_output_class); | ||
| 125 | } | ||
| 126 | |||
| 127 | static int __init video_output_class_init(void) | ||
| 128 | { | ||
| 129 | return class_register(&video_output_class); | ||
| 130 | } | ||
| 131 | |||
| 132 | postcore_initcall(video_output_class_init); | ||
| 133 | module_exit(video_output_class_exit); | ||
diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c index 80875fb770ed..3e62ee4b3b66 100644 --- a/drivers/xen/xen-acpi-cpuhotplug.c +++ b/drivers/xen/xen-acpi-cpuhotplug.c | |||
| @@ -313,7 +313,7 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
| 313 | goto out; | 313 | goto out; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | 316 | (void) acpi_evaluate_ost(handle, event, ost_code, NULL); |
| 317 | 317 | ||
| 318 | out: | 318 | out: |
| 319 | acpi_scan_lock_release(); | 319 | acpi_scan_lock_release(); |
diff --git a/drivers/xen/xen-acpi-memhotplug.c b/drivers/xen/xen-acpi-memhotplug.c index f8d18626969a..34e40b733f9a 100644 --- a/drivers/xen/xen-acpi-memhotplug.c +++ b/drivers/xen/xen-acpi-memhotplug.c | |||
| @@ -285,7 +285,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 285 | return; | 285 | return; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | 288 | (void) acpi_evaluate_ost(handle, event, ost_code, NULL); |
| 289 | return; | 289 | return; |
| 290 | } | 290 | } |
| 291 | 291 | ||
diff --git a/drivers/xen/xen-acpi-pad.c b/drivers/xen/xen-acpi-pad.c index 40c4bc06b5fa..f83b754505f8 100644 --- a/drivers/xen/xen-acpi-pad.c +++ b/drivers/xen/xen-acpi-pad.c | |||
| @@ -77,27 +77,14 @@ static int acpi_pad_pur(acpi_handle handle) | |||
| 77 | return num; | 77 | return num; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | /* Notify firmware how many CPUs are idle */ | ||
| 81 | static void acpi_pad_ost(acpi_handle handle, int stat, | ||
| 82 | uint32_t idle_nums) | ||
| 83 | { | ||
| 84 | union acpi_object params[3] = { | ||
| 85 | {.type = ACPI_TYPE_INTEGER,}, | ||
| 86 | {.type = ACPI_TYPE_INTEGER,}, | ||
| 87 | {.type = ACPI_TYPE_BUFFER,}, | ||
| 88 | }; | ||
| 89 | struct acpi_object_list arg_list = {3, params}; | ||
| 90 | |||
| 91 | params[0].integer.value = ACPI_PROCESSOR_AGGREGATOR_NOTIFY; | ||
| 92 | params[1].integer.value = stat; | ||
| 93 | params[2].buffer.length = 4; | ||
| 94 | params[2].buffer.pointer = (void *)&idle_nums; | ||
| 95 | acpi_evaluate_object(handle, "_OST", &arg_list, NULL); | ||
| 96 | } | ||
| 97 | |||
| 98 | static void acpi_pad_handle_notify(acpi_handle handle) | 80 | static void acpi_pad_handle_notify(acpi_handle handle) |
| 99 | { | 81 | { |
| 100 | int idle_nums; | 82 | int idle_nums; |
| 83 | struct acpi_buffer param = { | ||
| 84 | .length = 4, | ||
| 85 | .pointer = (void *)&idle_nums, | ||
| 86 | }; | ||
| 87 | |||
| 101 | 88 | ||
| 102 | mutex_lock(&xen_cpu_lock); | 89 | mutex_lock(&xen_cpu_lock); |
| 103 | idle_nums = acpi_pad_pur(handle); | 90 | idle_nums = acpi_pad_pur(handle); |
| @@ -109,7 +96,8 @@ static void acpi_pad_handle_notify(acpi_handle handle) | |||
| 109 | idle_nums = xen_acpi_pad_idle_cpus(idle_nums) | 96 | idle_nums = xen_acpi_pad_idle_cpus(idle_nums) |
| 110 | ?: xen_acpi_pad_idle_cpus_num(); | 97 | ?: xen_acpi_pad_idle_cpus_num(); |
| 111 | if (idle_nums >= 0) | 98 | if (idle_nums >= 0) |
| 112 | acpi_pad_ost(handle, 0, idle_nums); | 99 | acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, |
| 100 | 0, ¶m); | ||
| 113 | mutex_unlock(&xen_cpu_lock); | 101 | mutex_unlock(&xen_cpu_lock); |
| 114 | } | 102 | } |
| 115 | 103 | ||
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h index c927a0b1de78..88cb477524a6 100644 --- a/include/acpi/acbuffer.h +++ b/include/acpi/acbuffer.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index 3ea214cff349..932a60d6ed82 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 4e280bd226dd..8b06e4c1dd5d 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 1f36777e26fe..3dd6e838dc30 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 4607b027a657..1baae6edda89 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h index 618787715d56..ca0cb603b171 100644 --- a/include/acpi/acpi.h +++ b/include/acpi/acpi.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -62,5 +62,8 @@ | |||
| 62 | #include <acpi/acrestyp.h> /* Resource Descriptor structs */ | 62 | #include <acpi/acrestyp.h> /* Resource Descriptor structs */ |
| 63 | #include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */ | 63 | #include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */ |
| 64 | #include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */ | 64 | #include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */ |
| 65 | #ifdef ACPI_NATIVE_INTERFACE_HEADER | ||
| 66 | #include ACPI_NATIVE_INTERFACE_HEADER | ||
| 67 | #endif | ||
| 65 | 68 | ||
| 66 | #endif /* __ACPI_H__ */ | 69 | #endif /* __ACPI_H__ */ |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 8256eb4ad057..84a2e29a2314 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -49,8 +49,8 @@ acpi_evaluate_reference(acpi_handle handle, | |||
| 49 | struct acpi_object_list *arguments, | 49 | struct acpi_object_list *arguments, |
| 50 | struct acpi_handle_list *list); | 50 | struct acpi_handle_list *list); |
| 51 | acpi_status | 51 | acpi_status |
| 52 | acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, | 52 | acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, |
| 53 | u32 status_code, struct acpi_buffer *status_buf); | 53 | struct acpi_buffer *status_buf); |
| 54 | 54 | ||
| 55 | acpi_status | 55 | acpi_status |
| 56 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); | 56 | acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); |
| @@ -133,10 +133,24 @@ struct acpi_scan_handler { | |||
| 133 | struct list_head list_node; | 133 | struct list_head list_node; |
| 134 | int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); | 134 | int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); |
| 135 | void (*detach)(struct acpi_device *dev); | 135 | void (*detach)(struct acpi_device *dev); |
| 136 | void (*bind)(struct device *phys_dev); | ||
| 137 | void (*unbind)(struct device *phys_dev); | ||
| 136 | struct acpi_hotplug_profile hotplug; | 138 | struct acpi_hotplug_profile hotplug; |
| 137 | }; | 139 | }; |
| 138 | 140 | ||
| 139 | /* | 141 | /* |
| 142 | * ACPI Hotplug Context | ||
| 143 | * -------------------- | ||
| 144 | */ | ||
| 145 | |||
| 146 | struct acpi_hotplug_context { | ||
| 147 | struct acpi_device *self; | ||
| 148 | int (*notify)(struct acpi_device *, u32); | ||
| 149 | void (*uevent)(struct acpi_device *, u32); | ||
| 150 | void (*fixup)(struct acpi_device *); | ||
| 151 | }; | ||
| 152 | |||
| 153 | /* | ||
| 140 | * ACPI Driver | 154 | * ACPI Driver |
| 141 | * ----------- | 155 | * ----------- |
| 142 | */ | 156 | */ |
| @@ -190,7 +204,9 @@ struct acpi_device_flags { | |||
| 190 | u32 initialized:1; | 204 | u32 initialized:1; |
| 191 | u32 visited:1; | 205 | u32 visited:1; |
| 192 | u32 no_hotplug:1; | 206 | u32 no_hotplug:1; |
| 193 | u32 reserved:24; | 207 | u32 hotplug_notify:1; |
| 208 | u32 is_dock_station:1; | ||
| 209 | u32 reserved:22; | ||
| 194 | }; | 210 | }; |
| 195 | 211 | ||
| 196 | /* File System */ | 212 | /* File System */ |
| @@ -329,6 +345,7 @@ struct acpi_device { | |||
| 329 | struct acpi_device_perf performance; | 345 | struct acpi_device_perf performance; |
| 330 | struct acpi_device_dir dir; | 346 | struct acpi_device_dir dir; |
| 331 | struct acpi_scan_handler *handler; | 347 | struct acpi_scan_handler *handler; |
| 348 | struct acpi_hotplug_context *hp; | ||
| 332 | struct acpi_driver *driver; | 349 | struct acpi_driver *driver; |
| 333 | void *driver_data; | 350 | void *driver_data; |
| 334 | struct device dev; | 351 | struct device dev; |
| @@ -351,6 +368,24 @@ static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta) | |||
| 351 | *((u32 *)&adev->status) = sta; | 368 | *((u32 *)&adev->status) = sta; |
| 352 | } | 369 | } |
| 353 | 370 | ||
| 371 | static inline void acpi_set_hp_context(struct acpi_device *adev, | ||
| 372 | struct acpi_hotplug_context *hp, | ||
| 373 | int (*notify)(struct acpi_device *, u32), | ||
| 374 | void (*uevent)(struct acpi_device *, u32), | ||
| 375 | void (*fixup)(struct acpi_device *)) | ||
| 376 | { | ||
| 377 | hp->self = adev; | ||
| 378 | hp->notify = notify; | ||
| 379 | hp->uevent = uevent; | ||
| 380 | hp->fixup = fixup; | ||
| 381 | adev->hp = hp; | ||
| 382 | } | ||
| 383 | |||
| 384 | void acpi_initialize_hp_context(struct acpi_device *adev, | ||
| 385 | struct acpi_hotplug_context *hp, | ||
| 386 | int (*notify)(struct acpi_device *, u32), | ||
| 387 | void (*uevent)(struct acpi_device *, u32)); | ||
| 388 | |||
| 354 | /* acpi_device.dev.bus == &acpi_bus_type */ | 389 | /* acpi_device.dev.bus == &acpi_bus_type */ |
| 355 | extern struct bus_type acpi_bus_type; | 390 | extern struct bus_type acpi_bus_type; |
| 356 | 391 | ||
| @@ -381,6 +416,8 @@ extern int unregister_acpi_notifier(struct notifier_block *); | |||
| 381 | */ | 416 | */ |
| 382 | 417 | ||
| 383 | int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); | 418 | int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); |
| 419 | struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle); | ||
| 420 | void acpi_bus_put_acpi_device(struct acpi_device *adev); | ||
| 384 | acpi_status acpi_bus_get_status_handle(acpi_handle handle, | 421 | acpi_status acpi_bus_get_status_handle(acpi_handle handle, |
| 385 | unsigned long long *sta); | 422 | unsigned long long *sta); |
| 386 | int acpi_bus_get_status(struct acpi_device *device); | 423 | int acpi_bus_get_status(struct acpi_device *device); |
| @@ -402,6 +439,8 @@ static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; } | |||
| 402 | 439 | ||
| 403 | void acpi_scan_lock_acquire(void); | 440 | void acpi_scan_lock_acquire(void); |
| 404 | void acpi_scan_lock_release(void); | 441 | void acpi_scan_lock_release(void); |
| 442 | void acpi_lock_hp_context(void); | ||
| 443 | void acpi_unlock_hp_context(void); | ||
| 405 | int acpi_scan_add_handler(struct acpi_scan_handler *handler); | 444 | int acpi_scan_add_handler(struct acpi_scan_handler *handler); |
| 406 | int acpi_bus_register_driver(struct acpi_driver *driver); | 445 | int acpi_bus_register_driver(struct acpi_driver *driver); |
| 407 | void acpi_bus_unregister_driver(struct acpi_driver *driver); | 446 | void acpi_bus_unregister_driver(struct acpi_driver *driver); |
| @@ -418,10 +457,6 @@ static inline bool acpi_device_enumerated(struct acpi_device *adev) | |||
| 418 | return adev && adev->flags.initialized && adev->flags.visited; | 457 | return adev && adev->flags.initialized && adev->flags.visited; |
| 419 | } | 458 | } |
| 420 | 459 | ||
| 421 | typedef void (*acpi_hp_callback)(void *data, u32 src); | ||
| 422 | |||
| 423 | acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src); | ||
| 424 | |||
| 425 | /** | 460 | /** |
| 426 | * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver | 461 | * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver |
| 427 | * @__acpi_driver: acpi_driver struct | 462 | * @__acpi_driver: acpi_driver struct |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index b124fdb26046..d504613bbf80 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
| @@ -109,36 +109,14 @@ void pci_acpi_crs_quirks(void); | |||
| 109 | /*-------------------------------------------------------------------------- | 109 | /*-------------------------------------------------------------------------- |
| 110 | Dock Station | 110 | Dock Station |
| 111 | -------------------------------------------------------------------------- */ | 111 | -------------------------------------------------------------------------- */ |
| 112 | struct acpi_dock_ops { | ||
| 113 | acpi_notify_handler fixup; | ||
| 114 | acpi_notify_handler handler; | ||
| 115 | acpi_notify_handler uevent; | ||
| 116 | }; | ||
| 117 | 112 | ||
| 118 | #ifdef CONFIG_ACPI_DOCK | 113 | #ifdef CONFIG_ACPI_DOCK |
| 119 | extern int is_dock_device(acpi_handle handle); | 114 | extern int is_dock_device(struct acpi_device *adev); |
| 120 | extern int register_hotplug_dock_device(acpi_handle handle, | ||
| 121 | const struct acpi_dock_ops *ops, | ||
| 122 | void *context, | ||
| 123 | void (*init)(void *), | ||
| 124 | void (*release)(void *)); | ||
| 125 | extern void unregister_hotplug_dock_device(acpi_handle handle); | ||
| 126 | #else | 115 | #else |
| 127 | static inline int is_dock_device(acpi_handle handle) | 116 | static inline int is_dock_device(struct acpi_device *adev) |
| 128 | { | 117 | { |
| 129 | return 0; | 118 | return 0; |
| 130 | } | 119 | } |
| 131 | static inline int register_hotplug_dock_device(acpi_handle handle, | ||
| 132 | const struct acpi_dock_ops *ops, | ||
| 133 | void *context, | ||
| 134 | void (*init)(void *), | ||
| 135 | void (*release)(void *)) | ||
| 136 | { | ||
| 137 | return -ENODEV; | ||
| 138 | } | ||
| 139 | static inline void unregister_hotplug_dock_device(acpi_handle handle) | ||
| 140 | { | ||
| 141 | } | ||
| 142 | #endif /* CONFIG_ACPI_DOCK */ | 120 | #endif /* CONFIG_ACPI_DOCK */ |
| 143 | 121 | ||
| 144 | #endif /*__ACPI_DRIVERS_H__*/ | 122 | #endif /*__ACPI_DRIVERS_H__*/ |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 01e6c6d8b7e1..f6f5f8af2112 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | * Copyright (C) 2000 - 2013, Intel Corp. | 10 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 11 | * All rights reserved. | 11 | * All rights reserved. |
| 12 | * | 12 | * |
| 13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index fea6773f87fc..44f5e9749601 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -46,7 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 47 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
| 48 | 48 | ||
| 49 | #define ACPI_CA_VERSION 0x20131218 | 49 | #define ACPI_CA_VERSION 0x20140214 |
| 50 | 50 | ||
| 51 | #include <acpi/acconfig.h> | 51 | #include <acpi/acconfig.h> |
| 52 | #include <acpi/actypes.h> | 52 | #include <acpi/actypes.h> |
| @@ -71,7 +71,7 @@ extern u32 acpi_dbg_layer; | |||
| 71 | 71 | ||
| 72 | /* ACPICA runtime options */ | 72 | /* ACPICA runtime options */ |
| 73 | 73 | ||
| 74 | extern u8 acpi_gbl_all_methods_serialized; | 74 | extern u8 acpi_gbl_auto_serialize_methods; |
| 75 | extern u8 acpi_gbl_copy_dsdt_locally; | 75 | extern u8 acpi_gbl_copy_dsdt_locally; |
| 76 | extern u8 acpi_gbl_create_osi_method; | 76 | extern u8 acpi_gbl_create_osi_method; |
| 77 | extern u8 acpi_gbl_disable_auto_repair; | 77 | extern u8 acpi_gbl_disable_auto_repair; |
| @@ -230,6 +230,10 @@ acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data); | |||
| 230 | acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); | 230 | acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); |
| 231 | 231 | ||
| 232 | acpi_status | 232 | acpi_status |
| 233 | acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, | ||
| 234 | void (*callback)(void *)); | ||
| 235 | |||
| 236 | acpi_status | ||
| 233 | acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); | 237 | acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); |
| 234 | 238 | ||
| 235 | acpi_status | 239 | acpi_status |
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h index cbf4bf977f75..eb760ca0b2e0 100644 --- a/include/acpi/acrestyp.h +++ b/include/acpi/acrestyp.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index 325aeae1fa99..3b30e36b53b5 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 4ec8c194bfe5..212c65de75df 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 094a906a0e98..f3372441e3a5 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index 01c2a9013e40..c2295cc4a5c0 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 68a3ada689c9..e76356574374 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -55,18 +55,16 @@ | |||
| 55 | #error ACPI_MACHINE_WIDTH not defined | 55 | #error ACPI_MACHINE_WIDTH not defined |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | /*! [Begin] no source code translation */ | ||
| 59 | |||
| 60 | /* | 58 | /* |
| 61 | * Data type ranges | 59 | * Data type ranges |
| 62 | * Note: These macros are designed to be compiler independent as well as | 60 | * Note: These macros are designed to be compiler independent as well as |
| 63 | * working around problems that some 32-bit compilers have with 64-bit | 61 | * working around problems that some 32-bit compilers have with 64-bit |
| 64 | * constants. | 62 | * constants. |
| 65 | */ | 63 | */ |
| 66 | #define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ | 64 | #define ACPI_UINT8_MAX (u8) (~((u8) 0)) /* 0xFF */ |
| 67 | #define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ | 65 | #define ACPI_UINT16_MAX (u16)(~((u16) 0)) /* 0xFFFF */ |
| 68 | #define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ | 66 | #define ACPI_UINT32_MAX (u32)(~((u32) 0)) /* 0xFFFFFFFF */ |
| 69 | #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ | 67 | #define ACPI_UINT64_MAX (u64)(~((u64) 0)) /* 0xFFFFFFFFFFFFFFFF */ |
| 70 | #define ACPI_ASCII_MAX 0x7F | 68 | #define ACPI_ASCII_MAX 0x7F |
| 71 | 69 | ||
| 72 | /* | 70 | /* |
| @@ -77,18 +75,18 @@ | |||
| 77 | * | 75 | * |
| 78 | * 1) The following types are of fixed size for all targets (16/32/64): | 76 | * 1) The following types are of fixed size for all targets (16/32/64): |
| 79 | * | 77 | * |
| 80 | * BOOLEAN Logical boolean | 78 | * u8 Logical boolean |
| 81 | * | 79 | * |
| 82 | * UINT8 8-bit (1 byte) unsigned value | 80 | * u8 8-bit (1 byte) unsigned value |
| 83 | * UINT16 16-bit (2 byte) unsigned value | 81 | * u16 16-bit (2 byte) unsigned value |
| 84 | * UINT32 32-bit (4 byte) unsigned value | 82 | * u32 32-bit (4 byte) unsigned value |
| 85 | * UINT64 64-bit (8 byte) unsigned value | 83 | * u64 64-bit (8 byte) unsigned value |
| 86 | * | 84 | * |
| 87 | * INT16 16-bit (2 byte) signed value | 85 | * s16 16-bit (2 byte) signed value |
| 88 | * INT32 32-bit (4 byte) signed value | 86 | * s32 32-bit (4 byte) signed value |
| 89 | * INT64 64-bit (8 byte) signed value | 87 | * s64 64-bit (8 byte) signed value |
| 90 | * | 88 | * |
| 91 | * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the | 89 | * COMPILER_DEPENDENT_UINT64/s64 - These types are defined in the |
| 92 | * compiler-dependent header(s) and were introduced because there is no common | 90 | * compiler-dependent header(s) and were introduced because there is no common |
| 93 | * 64-bit integer type across the various compilation models, as shown in | 91 | * 64-bit integer type across the various compilation models, as shown in |
| 94 | * the table below. | 92 | * the table below. |
| @@ -110,11 +108,11 @@ | |||
| 110 | * usually used for memory allocation, efficient loop counters, and array | 108 | * usually used for memory allocation, efficient loop counters, and array |
| 111 | * indexes. The types are similar to the size_t type in the C library and are | 109 | * indexes. The types are similar to the size_t type in the C library and are |
| 112 | * required because there is no C type that consistently represents the native | 110 | * required because there is no C type that consistently represents the native |
| 113 | * data width. ACPI_SIZE is needed because there is no guarantee that a | 111 | * data width. acpi_size is needed because there is no guarantee that a |
| 114 | * kernel-level C library is present. | 112 | * kernel-level C library is present. |
| 115 | * | 113 | * |
| 116 | * ACPI_SIZE 16/32/64-bit unsigned value | 114 | * acpi_size 16/32/64-bit unsigned value |
| 117 | * ACPI_NATIVE_INT 16/32/64-bit signed value | 115 | * acpi_native_int 16/32/64-bit signed value |
| 118 | */ | 116 | */ |
| 119 | 117 | ||
| 120 | /******************************************************************************* | 118 | /******************************************************************************* |
| @@ -123,13 +121,15 @@ | |||
| 123 | * | 121 | * |
| 124 | ******************************************************************************/ | 122 | ******************************************************************************/ |
| 125 | 123 | ||
| 126 | typedef unsigned char BOOLEAN; | 124 | #ifndef ACPI_USE_SYSTEM_INTTYPES |
| 127 | typedef unsigned char UINT8; | 125 | |
| 128 | typedef unsigned short UINT16; | 126 | typedef unsigned char u8; |
| 129 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | 127 | typedef unsigned char u8; |
| 130 | typedef COMPILER_DEPENDENT_INT64 INT64; | 128 | typedef unsigned short u16; |
| 129 | typedef COMPILER_DEPENDENT_UINT64 u64; | ||
| 130 | typedef COMPILER_DEPENDENT_INT64 s64; | ||
| 131 | 131 | ||
| 132 | /*! [End] no source code translation !*/ | 132 | #endif /* ACPI_USE_SYSTEM_INTTYPES */ |
| 133 | 133 | ||
| 134 | /* | 134 | /* |
| 135 | * Value returned by acpi_os_get_thread_id. There is no standard "thread_id" | 135 | * Value returned by acpi_os_get_thread_id. There is no standard "thread_id" |
| @@ -149,12 +149,12 @@ typedef COMPILER_DEPENDENT_INT64 INT64; | |||
| 149 | 149 | ||
| 150 | #if ACPI_MACHINE_WIDTH == 64 | 150 | #if ACPI_MACHINE_WIDTH == 64 |
| 151 | 151 | ||
| 152 | /*! [Begin] no source code translation (keep the typedefs as-is) */ | 152 | #ifndef ACPI_USE_SYSTEM_INTTYPES |
| 153 | 153 | ||
| 154 | typedef unsigned int UINT32; | 154 | typedef unsigned int u32; |
| 155 | typedef int INT32; | 155 | typedef int s32; |
| 156 | 156 | ||
| 157 | /*! [End] no source code translation !*/ | 157 | #endif /* ACPI_USE_SYSTEM_INTTYPES */ |
| 158 | 158 | ||
| 159 | typedef s64 acpi_native_int; | 159 | typedef s64 acpi_native_int; |
| 160 | 160 | ||
| @@ -188,12 +188,12 @@ typedef u64 acpi_physical_address; | |||
| 188 | 188 | ||
| 189 | #elif ACPI_MACHINE_WIDTH == 32 | 189 | #elif ACPI_MACHINE_WIDTH == 32 |
| 190 | 190 | ||
| 191 | /*! [Begin] no source code translation (keep the typedefs as-is) */ | 191 | #ifndef ACPI_USE_SYSTEM_INTTYPES |
| 192 | 192 | ||
| 193 | typedef unsigned int UINT32; | 193 | typedef unsigned int u32; |
| 194 | typedef int INT32; | 194 | typedef int s32; |
| 195 | 195 | ||
| 196 | /*! [End] no source code translation !*/ | 196 | #endif /* ACPI_USE_SYSTEM_INTTYPES */ |
| 197 | 197 | ||
| 198 | typedef s32 acpi_native_int; | 198 | typedef s32 acpi_native_int; |
| 199 | 199 | ||
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index b402eb67af83..e863dd5c4e04 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h index e077ce6c38ca..a476b9118b49 100644 --- a/include/acpi/platform/acgcc.h +++ b/include/acpi/platform/acgcc.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 008aa287c7a9..93c55ed7c53d 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (C) 2000 - 2013, Intel Corp. | 8 | * Copyright (C) 2000 - 2014, Intel Corp. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * | 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
| @@ -52,6 +52,14 @@ | |||
| 52 | 52 | ||
| 53 | #ifdef __KERNEL__ | 53 | #ifdef __KERNEL__ |
| 54 | 54 | ||
| 55 | #define ACPI_USE_SYSTEM_INTTYPES | ||
| 56 | |||
| 57 | /* Compile for reduced hardware mode only with this kernel config */ | ||
| 58 | |||
| 59 | #ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY | ||
| 60 | #define ACPI_REDUCED_HARDWARE 1 | ||
| 61 | #endif | ||
| 62 | |||
| 55 | #include <linux/string.h> | 63 | #include <linux/string.h> |
| 56 | #include <linux/kernel.h> | 64 | #include <linux/kernel.h> |
| 57 | #include <linux/ctype.h> | 65 | #include <linux/ctype.h> |
| @@ -83,6 +91,16 @@ | |||
| 83 | #include <ctype.h> | 91 | #include <ctype.h> |
| 84 | #include <unistd.h> | 92 | #include <unistd.h> |
| 85 | 93 | ||
| 94 | /* Disable kernel specific declarators */ | ||
| 95 | |||
| 96 | #ifndef __init | ||
| 97 | #define __init | ||
| 98 | #endif | ||
| 99 | |||
| 100 | #ifndef __iomem | ||
| 101 | #define __iomem | ||
| 102 | #endif | ||
| 103 | |||
| 86 | /* Host-dependent types and defines for user-space ACPICA */ | 104 | /* Host-dependent types and defines for user-space ACPICA */ |
| 87 | 105 | ||
| 88 | #define ACPI_FLUSH_CPU_CACHE() | 106 | #define ACPI_FLUSH_CPU_CACHE() |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 1151a1dcfe41..6a15dddbaa09 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -108,6 +108,10 @@ static inline void acpi_initrd_override(void *data, size_t size) | |||
| 108 | } | 108 | } |
| 109 | #endif | 109 | #endif |
| 110 | 110 | ||
| 111 | #define BAD_MADT_ENTRY(entry, end) ( \ | ||
| 112 | (!entry) || (unsigned long)entry + sizeof(*entry) > end || \ | ||
| 113 | ((struct acpi_subtable_header *)entry)->length < sizeof(*entry)) | ||
| 114 | |||
| 111 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | 115 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); |
| 112 | void __acpi_unmap_table(char *map, unsigned long size); | 116 | void __acpi_unmap_table(char *map, unsigned long size); |
| 113 | int early_acpi_boot_init(void); | 117 | int early_acpi_boot_init(void); |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 4d89e0e6f9cc..c48e595f623e 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/completion.h> | 16 | #include <linux/completion.h> |
| 17 | #include <linux/kobject.h> | 17 | #include <linux/kobject.h> |
| 18 | #include <linux/notifier.h> | 18 | #include <linux/notifier.h> |
| 19 | #include <linux/spinlock.h> | ||
| 19 | #include <linux/sysfs.h> | 20 | #include <linux/sysfs.h> |
| 20 | 21 | ||
| 21 | /********************************************************************* | 22 | /********************************************************************* |
| @@ -74,6 +75,8 @@ struct cpufreq_policy { | |||
| 74 | unsigned int max; /* in kHz */ | 75 | unsigned int max; /* in kHz */ |
| 75 | unsigned int cur; /* in kHz, only needed if cpufreq | 76 | unsigned int cur; /* in kHz, only needed if cpufreq |
| 76 | * governors are used */ | 77 | * governors are used */ |
| 78 | unsigned int suspend_freq; /* freq to set during suspend */ | ||
| 79 | |||
| 77 | unsigned int policy; /* see above */ | 80 | unsigned int policy; /* see above */ |
| 78 | struct cpufreq_governor *governor; /* see below */ | 81 | struct cpufreq_governor *governor; /* see below */ |
| 79 | void *governor_data; | 82 | void *governor_data; |
| @@ -83,6 +86,7 @@ struct cpufreq_policy { | |||
| 83 | * called, but you're in IRQ context */ | 86 | * called, but you're in IRQ context */ |
| 84 | 87 | ||
| 85 | struct cpufreq_real_policy user_policy; | 88 | struct cpufreq_real_policy user_policy; |
| 89 | struct cpufreq_frequency_table *freq_table; | ||
| 86 | 90 | ||
| 87 | struct list_head policy_list; | 91 | struct list_head policy_list; |
| 88 | struct kobject kobj; | 92 | struct kobject kobj; |
| @@ -101,6 +105,11 @@ struct cpufreq_policy { | |||
| 101 | * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); | 105 | * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); |
| 102 | */ | 106 | */ |
| 103 | struct rw_semaphore rwsem; | 107 | struct rw_semaphore rwsem; |
| 108 | |||
| 109 | /* Synchronization for frequency transitions */ | ||
| 110 | bool transition_ongoing; /* Tracks transition status */ | ||
| 111 | spinlock_t transition_lock; | ||
| 112 | wait_queue_head_t transition_wait; | ||
| 104 | }; | 113 | }; |
| 105 | 114 | ||
| 106 | /* Only for ACPI */ | 115 | /* Only for ACPI */ |
| @@ -224,6 +233,7 @@ struct cpufreq_driver { | |||
| 224 | int (*bios_limit) (int cpu, unsigned int *limit); | 233 | int (*bios_limit) (int cpu, unsigned int *limit); |
| 225 | 234 | ||
| 226 | int (*exit) (struct cpufreq_policy *policy); | 235 | int (*exit) (struct cpufreq_policy *policy); |
| 236 | void (*stop_cpu) (struct cpufreq_policy *policy); | ||
| 227 | int (*suspend) (struct cpufreq_policy *policy); | 237 | int (*suspend) (struct cpufreq_policy *policy); |
| 228 | int (*resume) (struct cpufreq_policy *policy); | 238 | int (*resume) (struct cpufreq_policy *policy); |
| 229 | struct freq_attr **attr; | 239 | struct freq_attr **attr; |
| @@ -296,6 +306,15 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy) | |||
| 296 | policy->cpuinfo.max_freq); | 306 | policy->cpuinfo.max_freq); |
| 297 | } | 307 | } |
| 298 | 308 | ||
| 309 | #ifdef CONFIG_CPU_FREQ | ||
| 310 | void cpufreq_suspend(void); | ||
| 311 | void cpufreq_resume(void); | ||
| 312 | int cpufreq_generic_suspend(struct cpufreq_policy *policy); | ||
| 313 | #else | ||
| 314 | static inline void cpufreq_suspend(void) {} | ||
| 315 | static inline void cpufreq_resume(void) {} | ||
| 316 | #endif | ||
| 317 | |||
| 299 | /********************************************************************* | 318 | /********************************************************************* |
| 300 | * CPUFREQ NOTIFIER INTERFACE * | 319 | * CPUFREQ NOTIFIER INTERFACE * |
| 301 | *********************************************************************/ | 320 | *********************************************************************/ |
| @@ -306,8 +325,6 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy) | |||
| 306 | /* Transition notifiers */ | 325 | /* Transition notifiers */ |
| 307 | #define CPUFREQ_PRECHANGE (0) | 326 | #define CPUFREQ_PRECHANGE (0) |
| 308 | #define CPUFREQ_POSTCHANGE (1) | 327 | #define CPUFREQ_POSTCHANGE (1) |
| 309 | #define CPUFREQ_RESUMECHANGE (8) | ||
| 310 | #define CPUFREQ_SUSPENDCHANGE (9) | ||
| 311 | 328 | ||
| 312 | /* Policy Notifiers */ | 329 | /* Policy Notifiers */ |
| 313 | #define CPUFREQ_ADJUST (0) | 330 | #define CPUFREQ_ADJUST (0) |
| @@ -322,9 +339,9 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy) | |||
| 322 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); | 339 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); |
| 323 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); | 340 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); |
| 324 | 341 | ||
| 325 | void cpufreq_notify_transition(struct cpufreq_policy *policy, | 342 | void cpufreq_freq_transition_begin(struct cpufreq_policy *policy, |
| 326 | struct cpufreq_freqs *freqs, unsigned int state); | 343 | struct cpufreq_freqs *freqs); |
| 327 | void cpufreq_notify_post_transition(struct cpufreq_policy *policy, | 344 | void cpufreq_freq_transition_end(struct cpufreq_policy *policy, |
| 328 | struct cpufreq_freqs *freqs, int transition_failed); | 345 | struct cpufreq_freqs *freqs, int transition_failed); |
| 329 | 346 | ||
| 330 | #else /* CONFIG_CPU_FREQ */ | 347 | #else /* CONFIG_CPU_FREQ */ |
| @@ -463,7 +480,6 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, | |||
| 463 | int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, | 480 | int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, |
| 464 | unsigned int freq); | 481 | unsigned int freq); |
| 465 | 482 | ||
| 466 | void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy); | ||
| 467 | ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); | 483 | ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); |
| 468 | 484 | ||
| 469 | #ifdef CONFIG_CPU_FREQ | 485 | #ifdef CONFIG_CPU_FREQ |
| @@ -490,9 +506,6 @@ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); | |||
| 490 | /* the following are really really optional */ | 506 | /* the following are really really optional */ |
| 491 | extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; | 507 | extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; |
| 492 | extern struct freq_attr *cpufreq_generic_attr[]; | 508 | extern struct freq_attr *cpufreq_generic_attr[]; |
| 493 | void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, | ||
| 494 | unsigned int cpu); | ||
| 495 | void cpufreq_frequency_table_put_attr(unsigned int cpu); | ||
| 496 | int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, | 509 | int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, |
| 497 | struct cpufreq_frequency_table *table); | 510 | struct cpufreq_frequency_table *table); |
| 498 | 511 | ||
| @@ -500,10 +513,4 @@ unsigned int cpufreq_generic_get(unsigned int cpu); | |||
| 500 | int cpufreq_generic_init(struct cpufreq_policy *policy, | 513 | int cpufreq_generic_init(struct cpufreq_policy *policy, |
| 501 | struct cpufreq_frequency_table *table, | 514 | struct cpufreq_frequency_table *table, |
| 502 | unsigned int transition_latency); | 515 | unsigned int transition_latency); |
| 503 | static inline int cpufreq_generic_exit(struct cpufreq_policy *policy) | ||
| 504 | { | ||
| 505 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 506 | return 0; | ||
| 507 | } | ||
| 508 | |||
| 509 | #endif /* _LINUX_CPUFREQ_H */ | 516 | #endif /* _LINUX_CPUFREQ_H */ |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 5a462c4e5009..637a608ded0b 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
| @@ -59,12 +59,12 @@ static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } | |||
| 59 | void acpiphp_init(void); | 59 | void acpiphp_init(void); |
| 60 | void acpiphp_enumerate_slots(struct pci_bus *bus); | 60 | void acpiphp_enumerate_slots(struct pci_bus *bus); |
| 61 | void acpiphp_remove_slots(struct pci_bus *bus); | 61 | void acpiphp_remove_slots(struct pci_bus *bus); |
| 62 | void acpiphp_check_host_bridge(acpi_handle handle); | 62 | void acpiphp_check_host_bridge(struct acpi_device *adev); |
| 63 | #else | 63 | #else |
| 64 | static inline void acpiphp_init(void) { } | 64 | static inline void acpiphp_init(void) { } |
| 65 | static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { } | 65 | static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { } |
| 66 | static inline void acpiphp_remove_slots(struct pci_bus *bus) { } | 66 | static inline void acpiphp_remove_slots(struct pci_bus *bus) { } |
| 67 | static inline void acpiphp_check_host_bridge(acpi_handle handle) { } | 67 | static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { } |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | #else /* CONFIG_ACPI */ | 70 | #else /* CONFIG_ACPI */ |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 0298b5e5de01..d915d0345fa1 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -352,7 +352,7 @@ const struct dev_pm_ops name = { \ | |||
| 352 | 352 | ||
| 353 | /* | 353 | /* |
| 354 | * Use this for defining a set of PM operations to be used in all situations | 354 | * Use this for defining a set of PM operations to be used in all situations |
| 355 | * (sustem suspend, hibernation or runtime PM). | 355 | * (system suspend, hibernation or runtime PM). |
| 356 | * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should | 356 | * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should |
| 357 | * be different from the corresponding runtime PM callbacks, .runtime_suspend(), | 357 | * be different from the corresponding runtime PM callbacks, .runtime_suspend(), |
| 358 | * and .runtime_resume(), because .runtime_suspend() always works on an already | 358 | * and .runtime_resume(), because .runtime_suspend() always works on an already |
| @@ -379,7 +379,7 @@ const struct dev_pm_ops name = { \ | |||
| 379 | * | 379 | * |
| 380 | * ON No transition. | 380 | * ON No transition. |
| 381 | * | 381 | * |
| 382 | * FREEZE System is going to hibernate, call ->prepare() and ->freeze() | 382 | * FREEZE System is going to hibernate, call ->prepare() and ->freeze() |
| 383 | * for all devices. | 383 | * for all devices. |
| 384 | * | 384 | * |
| 385 | * SUSPEND System is going to suspend, call ->prepare() and ->suspend() | 385 | * SUSPEND System is going to suspend, call ->prepare() and ->suspend() |
| @@ -423,7 +423,7 @@ const struct dev_pm_ops name = { \ | |||
| 423 | 423 | ||
| 424 | #define PM_EVENT_INVALID (-1) | 424 | #define PM_EVENT_INVALID (-1) |
| 425 | #define PM_EVENT_ON 0x0000 | 425 | #define PM_EVENT_ON 0x0000 |
| 426 | #define PM_EVENT_FREEZE 0x0001 | 426 | #define PM_EVENT_FREEZE 0x0001 |
| 427 | #define PM_EVENT_SUSPEND 0x0002 | 427 | #define PM_EVENT_SUSPEND 0x0002 |
| 428 | #define PM_EVENT_HIBERNATE 0x0004 | 428 | #define PM_EVENT_HIBERNATE 0x0004 |
| 429 | #define PM_EVENT_QUIESCE 0x0008 | 429 | #define PM_EVENT_QUIESCE 0x0008 |
| @@ -542,6 +542,8 @@ struct dev_pm_info { | |||
| 542 | unsigned int async_suspend:1; | 542 | unsigned int async_suspend:1; |
| 543 | bool is_prepared:1; /* Owned by the PM core */ | 543 | bool is_prepared:1; /* Owned by the PM core */ |
| 544 | bool is_suspended:1; /* Ditto */ | 544 | bool is_suspended:1; /* Ditto */ |
| 545 | bool is_noirq_suspended:1; | ||
| 546 | bool is_late_suspended:1; | ||
| 545 | bool ignore_children:1; | 547 | bool ignore_children:1; |
| 546 | bool early_init:1; /* Owned by the PM core */ | 548 | bool early_init:1; /* Owned by the PM core */ |
| 547 | spinlock_t lock; | 549 | spinlock_t lock; |
| @@ -582,6 +584,7 @@ struct dev_pm_info { | |||
| 582 | unsigned long accounting_timestamp; | 584 | unsigned long accounting_timestamp; |
| 583 | #endif | 585 | #endif |
| 584 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ | 586 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ |
| 587 | void (*set_latency_tolerance)(struct device *, s32); | ||
| 585 | struct dev_pm_qos *qos; | 588 | struct dev_pm_qos *qos; |
| 586 | }; | 589 | }; |
| 587 | 590 | ||
| @@ -612,11 +615,11 @@ struct dev_pm_domain { | |||
| 612 | * message is implicit: | 615 | * message is implicit: |
| 613 | * | 616 | * |
| 614 | * ON Driver starts working again, responding to hardware events | 617 | * ON Driver starts working again, responding to hardware events |
| 615 | * and software requests. The hardware may have gone through | 618 | * and software requests. The hardware may have gone through |
| 616 | * a power-off reset, or it may have maintained state from the | 619 | * a power-off reset, or it may have maintained state from the |
| 617 | * previous suspend() which the driver will rely on while | 620 | * previous suspend() which the driver will rely on while |
| 618 | * resuming. On most platforms, there are no restrictions on | 621 | * resuming. On most platforms, there are no restrictions on |
| 619 | * availability of resources like clocks during resume(). | 622 | * availability of resources like clocks during resume(). |
| 620 | * | 623 | * |
| 621 | * Other transitions are triggered by messages sent using suspend(). All | 624 | * Other transitions are triggered by messages sent using suspend(). All |
| 622 | * these transitions quiesce the driver, so that I/O queues are inactive. | 625 | * these transitions quiesce the driver, so that I/O queues are inactive. |
| @@ -626,21 +629,21 @@ struct dev_pm_domain { | |||
| 626 | * differ according to the message: | 629 | * differ according to the message: |
| 627 | * | 630 | * |
| 628 | * SUSPEND Quiesce, enter a low power device state appropriate for | 631 | * SUSPEND Quiesce, enter a low power device state appropriate for |
| 629 | * the upcoming system state (such as PCI_D3hot), and enable | 632 | * the upcoming system state (such as PCI_D3hot), and enable |
| 630 | * wakeup events as appropriate. | 633 | * wakeup events as appropriate. |
| 631 | * | 634 | * |
| 632 | * HIBERNATE Enter a low power device state appropriate for the hibernation | 635 | * HIBERNATE Enter a low power device state appropriate for the hibernation |
| 633 | * state (eg. ACPI S4) and enable wakeup events as appropriate. | 636 | * state (eg. ACPI S4) and enable wakeup events as appropriate. |
| 634 | * | 637 | * |
| 635 | * FREEZE Quiesce operations so that a consistent image can be saved; | 638 | * FREEZE Quiesce operations so that a consistent image can be saved; |
| 636 | * but do NOT otherwise enter a low power device state, and do | 639 | * but do NOT otherwise enter a low power device state, and do |
| 637 | * NOT emit system wakeup events. | 640 | * NOT emit system wakeup events. |
| 638 | * | 641 | * |
| 639 | * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring | 642 | * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring |
| 640 | * the system from a snapshot taken after an earlier FREEZE. | 643 | * the system from a snapshot taken after an earlier FREEZE. |
| 641 | * Some drivers will need to reset their hardware state instead | 644 | * Some drivers will need to reset their hardware state instead |
| 642 | * of preserving it, to ensure that it's never mistaken for the | 645 | * of preserving it, to ensure that it's never mistaken for the |
| 643 | * state which that earlier snapshot had set up. | 646 | * state which that earlier snapshot had set up. |
| 644 | * | 647 | * |
| 645 | * A minimally power-aware driver treats all messages as SUSPEND, fully | 648 | * A minimally power-aware driver treats all messages as SUSPEND, fully |
| 646 | * reinitializes its device during resume() -- whether or not it was reset | 649 | * reinitializes its device during resume() -- whether or not it was reset |
| @@ -717,14 +720,26 @@ static inline void dpm_for_each_dev(void *data, void (*fn)(struct device *, void | |||
| 717 | { | 720 | { |
| 718 | } | 721 | } |
| 719 | 722 | ||
| 720 | #define pm_generic_prepare NULL | 723 | #define pm_generic_prepare NULL |
| 721 | #define pm_generic_suspend NULL | 724 | #define pm_generic_suspend_late NULL |
| 722 | #define pm_generic_resume NULL | 725 | #define pm_generic_suspend_noirq NULL |
| 723 | #define pm_generic_freeze NULL | 726 | #define pm_generic_suspend NULL |
| 724 | #define pm_generic_thaw NULL | 727 | #define pm_generic_resume_early NULL |
| 725 | #define pm_generic_restore NULL | 728 | #define pm_generic_resume_noirq NULL |
| 726 | #define pm_generic_poweroff NULL | 729 | #define pm_generic_resume NULL |
| 727 | #define pm_generic_complete NULL | 730 | #define pm_generic_freeze_noirq NULL |
| 731 | #define pm_generic_freeze_late NULL | ||
| 732 | #define pm_generic_freeze NULL | ||
| 733 | #define pm_generic_thaw_noirq NULL | ||
| 734 | #define pm_generic_thaw_early NULL | ||
| 735 | #define pm_generic_thaw NULL | ||
| 736 | #define pm_generic_restore_noirq NULL | ||
| 737 | #define pm_generic_restore_early NULL | ||
| 738 | #define pm_generic_restore NULL | ||
| 739 | #define pm_generic_poweroff_noirq NULL | ||
| 740 | #define pm_generic_poweroff_late NULL | ||
| 741 | #define pm_generic_poweroff NULL | ||
| 742 | #define pm_generic_complete NULL | ||
| 728 | #endif /* !CONFIG_PM_SLEEP */ | 743 | #endif /* !CONFIG_PM_SLEEP */ |
| 729 | 744 | ||
| 730 | /* How to reorder dpm_list after device_move() */ | 745 | /* How to reorder dpm_list after device_move() */ |
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 5a95013905c8..9ab4bf7c4646 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
| @@ -32,7 +32,10 @@ enum pm_qos_flags_status { | |||
| 32 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 32 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
| 33 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 33 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
| 34 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 | 34 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 |
| 35 | #define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 | 35 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 |
| 36 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 | ||
| 37 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) | ||
| 38 | #define PM_QOS_LATENCY_ANY ((s32)(~(__u32)0 >> 1)) | ||
| 36 | 39 | ||
| 37 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) | 40 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) |
| 38 | #define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) | 41 | #define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) |
| @@ -49,7 +52,8 @@ struct pm_qos_flags_request { | |||
| 49 | }; | 52 | }; |
| 50 | 53 | ||
| 51 | enum dev_pm_qos_req_type { | 54 | enum dev_pm_qos_req_type { |
| 52 | DEV_PM_QOS_LATENCY = 1, | 55 | DEV_PM_QOS_RESUME_LATENCY = 1, |
| 56 | DEV_PM_QOS_LATENCY_TOLERANCE, | ||
| 53 | DEV_PM_QOS_FLAGS, | 57 | DEV_PM_QOS_FLAGS, |
| 54 | }; | 58 | }; |
| 55 | 59 | ||
| @@ -77,6 +81,7 @@ struct pm_qos_constraints { | |||
| 77 | struct plist_head list; | 81 | struct plist_head list; |
| 78 | s32 target_value; /* Do not change to 64 bit */ | 82 | s32 target_value; /* Do not change to 64 bit */ |
| 79 | s32 default_value; | 83 | s32 default_value; |
| 84 | s32 no_constraint_value; | ||
| 80 | enum pm_qos_type type; | 85 | enum pm_qos_type type; |
| 81 | struct blocking_notifier_head *notifiers; | 86 | struct blocking_notifier_head *notifiers; |
| 82 | }; | 87 | }; |
| @@ -87,9 +92,11 @@ struct pm_qos_flags { | |||
| 87 | }; | 92 | }; |
| 88 | 93 | ||
| 89 | struct dev_pm_qos { | 94 | struct dev_pm_qos { |
| 90 | struct pm_qos_constraints latency; | 95 | struct pm_qos_constraints resume_latency; |
| 96 | struct pm_qos_constraints latency_tolerance; | ||
| 91 | struct pm_qos_flags flags; | 97 | struct pm_qos_flags flags; |
| 92 | struct dev_pm_qos_request *latency_req; | 98 | struct dev_pm_qos_request *resume_latency_req; |
| 99 | struct dev_pm_qos_request *latency_tolerance_req; | ||
| 93 | struct dev_pm_qos_request *flags_req; | 100 | struct dev_pm_qos_request *flags_req; |
| 94 | }; | 101 | }; |
| 95 | 102 | ||
| @@ -142,7 +149,8 @@ int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier); | |||
| 142 | void dev_pm_qos_constraints_init(struct device *dev); | 149 | void dev_pm_qos_constraints_init(struct device *dev); |
| 143 | void dev_pm_qos_constraints_destroy(struct device *dev); | 150 | void dev_pm_qos_constraints_destroy(struct device *dev); |
| 144 | int dev_pm_qos_add_ancestor_request(struct device *dev, | 151 | int dev_pm_qos_add_ancestor_request(struct device *dev, |
| 145 | struct dev_pm_qos_request *req, s32 value); | 152 | struct dev_pm_qos_request *req, |
| 153 | enum dev_pm_qos_req_type type, s32 value); | ||
| 146 | #else | 154 | #else |
| 147 | static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, | 155 | static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, |
| 148 | s32 mask) | 156 | s32 mask) |
| @@ -185,7 +193,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev) | |||
| 185 | dev->power.power_state = PMSG_INVALID; | 193 | dev->power.power_state = PMSG_INVALID; |
| 186 | } | 194 | } |
| 187 | static inline int dev_pm_qos_add_ancestor_request(struct device *dev, | 195 | static inline int dev_pm_qos_add_ancestor_request(struct device *dev, |
| 188 | struct dev_pm_qos_request *req, s32 value) | 196 | struct dev_pm_qos_request *req, |
| 197 | enum dev_pm_qos_req_type type, | ||
| 198 | s32 value) | ||
| 189 | { return 0; } | 199 | { return 0; } |
| 190 | #endif | 200 | #endif |
| 191 | 201 | ||
| @@ -195,10 +205,12 @@ void dev_pm_qos_hide_latency_limit(struct device *dev); | |||
| 195 | int dev_pm_qos_expose_flags(struct device *dev, s32 value); | 205 | int dev_pm_qos_expose_flags(struct device *dev, s32 value); |
| 196 | void dev_pm_qos_hide_flags(struct device *dev); | 206 | void dev_pm_qos_hide_flags(struct device *dev); |
| 197 | int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); | 207 | int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); |
| 208 | s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev); | ||
| 209 | int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val); | ||
| 198 | 210 | ||
| 199 | static inline s32 dev_pm_qos_requested_latency(struct device *dev) | 211 | static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) |
| 200 | { | 212 | { |
| 201 | return dev->power.qos->latency_req->data.pnode.prio; | 213 | return dev->power.qos->resume_latency_req->data.pnode.prio; |
| 202 | } | 214 | } |
| 203 | 215 | ||
| 204 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) | 216 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) |
| @@ -214,8 +226,12 @@ static inline int dev_pm_qos_expose_flags(struct device *dev, s32 value) | |||
| 214 | static inline void dev_pm_qos_hide_flags(struct device *dev) {} | 226 | static inline void dev_pm_qos_hide_flags(struct device *dev) {} |
| 215 | static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set) | 227 | static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set) |
| 216 | { return 0; } | 228 | { return 0; } |
| 229 | static inline s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev) | ||
| 230 | { return PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; } | ||
| 231 | static inline int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val) | ||
| 232 | { return 0; } | ||
| 217 | 233 | ||
| 218 | static inline s32 dev_pm_qos_requested_latency(struct device *dev) { return 0; } | 234 | static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; } |
| 219 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } | 235 | static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } |
| 220 | #endif | 236 | #endif |
| 221 | 237 | ||
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 16c9a62fa1c0..2a5897a4afbc 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
| @@ -26,9 +26,13 @@ | |||
| 26 | #ifdef CONFIG_PM | 26 | #ifdef CONFIG_PM |
| 27 | extern int pm_generic_runtime_suspend(struct device *dev); | 27 | extern int pm_generic_runtime_suspend(struct device *dev); |
| 28 | extern int pm_generic_runtime_resume(struct device *dev); | 28 | extern int pm_generic_runtime_resume(struct device *dev); |
| 29 | extern int pm_runtime_force_suspend(struct device *dev); | ||
| 30 | extern int pm_runtime_force_resume(struct device *dev); | ||
| 29 | #else | 31 | #else |
| 30 | static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } | 32 | static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } |
| 31 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } | 33 | static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } |
| 34 | static inline int pm_runtime_force_suspend(struct device *dev) { return 0; } | ||
| 35 | static inline int pm_runtime_force_resume(struct device *dev) { return 0; } | ||
| 32 | #endif | 36 | #endif |
| 33 | 37 | ||
| 34 | #ifdef CONFIG_PM_RUNTIME | 38 | #ifdef CONFIG_PM_RUNTIME |
diff --git a/include/linux/video_output.h b/include/linux/video_output.h deleted file mode 100644 index ed5cdeb3604d..000000000000 --- a/include/linux/video_output.h +++ /dev/null | |||
| @@ -1,57 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * Copyright (C) 2006 Luming Yu <luming.yu@intel.com> | ||
| 4 | * | ||
| 5 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or (at | ||
| 10 | * your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
| 20 | * | ||
| 21 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 22 | */ | ||
| 23 | #ifndef _LINUX_VIDEO_OUTPUT_H | ||
| 24 | #define _LINUX_VIDEO_OUTPUT_H | ||
| 25 | #include <linux/device.h> | ||
| 26 | #include <linux/err.h> | ||
| 27 | struct output_device; | ||
| 28 | struct output_properties { | ||
| 29 | int (*set_state)(struct output_device *); | ||
| 30 | int (*get_status)(struct output_device *); | ||
| 31 | }; | ||
| 32 | struct output_device { | ||
| 33 | int request_state; | ||
| 34 | struct output_properties *props; | ||
| 35 | struct device dev; | ||
| 36 | }; | ||
| 37 | #define to_output_device(obj) container_of(obj, struct output_device, dev) | ||
| 38 | #if defined(CONFIG_VIDEO_OUTPUT_CONTROL) || defined(CONFIG_VIDEO_OUTPUT_CONTROL_MODULE) | ||
| 39 | struct output_device *video_output_register(const char *name, | ||
| 40 | struct device *dev, | ||
| 41 | void *devdata, | ||
| 42 | struct output_properties *op); | ||
| 43 | void video_output_unregister(struct output_device *dev); | ||
| 44 | #else | ||
| 45 | static struct output_device *video_output_register(const char *name, | ||
| 46 | struct device *dev, | ||
| 47 | void *devdata, | ||
| 48 | struct output_properties *op) | ||
| 49 | { | ||
| 50 | return ERR_PTR(-ENODEV); | ||
| 51 | } | ||
| 52 | static void video_output_unregister(struct output_device *dev) | ||
| 53 | { | ||
| 54 | return; | ||
| 55 | } | ||
| 56 | #endif | ||
| 57 | #endif | ||
diff --git a/include/trace/events/power.h b/include/trace/events/power.h index e5bf9a76f169..9a7e08d61258 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h | |||
| @@ -407,8 +407,8 @@ DECLARE_EVENT_CLASS(dev_pm_qos_request, | |||
| 407 | TP_printk("device=%s type=%s new_value=%d", | 407 | TP_printk("device=%s type=%s new_value=%d", |
| 408 | __get_str(name), | 408 | __get_str(name), |
| 409 | __print_symbolic(__entry->type, | 409 | __print_symbolic(__entry->type, |
| 410 | { DEV_PM_QOS_LATENCY, "DEV_PM_QOS_LATENCY" }, | 410 | { DEV_PM_QOS_RESUME_LATENCY, "DEV_PM_QOS_RESUME_LATENCY" }, |
| 411 | { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }), | 411 | { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }), |
| 412 | __entry->new_value) | 412 | __entry->new_value) |
| 413 | ); | 413 | ); |
| 414 | 414 | ||
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 37170d4dd9a6..f4f2073711d3 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
| @@ -973,16 +973,20 @@ static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr, | |||
| 973 | static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, | 973 | static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, |
| 974 | const char *buf, size_t n) | 974 | const char *buf, size_t n) |
| 975 | { | 975 | { |
| 976 | unsigned int maj, min; | ||
| 977 | dev_t res; | 976 | dev_t res; |
| 978 | int ret = -EINVAL; | 977 | int len = n; |
| 978 | char *name; | ||
| 979 | 979 | ||
| 980 | if (sscanf(buf, "%u:%u", &maj, &min) != 2) | 980 | if (len && buf[len-1] == '\n') |
| 981 | goto out; | 981 | len--; |
| 982 | name = kstrndup(buf, len, GFP_KERNEL); | ||
| 983 | if (!name) | ||
| 984 | return -ENOMEM; | ||
| 982 | 985 | ||
| 983 | res = MKDEV(maj,min); | 986 | res = name_to_dev_t(name); |
| 984 | if (maj != MAJOR(res) || min != MINOR(res)) | 987 | kfree(name); |
| 985 | goto out; | 988 | if (!res) |
| 989 | return -EINVAL; | ||
| 986 | 990 | ||
| 987 | lock_system_sleep(); | 991 | lock_system_sleep(); |
| 988 | swsusp_resume_device = res; | 992 | swsusp_resume_device = res; |
| @@ -990,9 +994,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
| 990 | printk(KERN_INFO "PM: Starting manual resume from disk\n"); | 994 | printk(KERN_INFO "PM: Starting manual resume from disk\n"); |
| 991 | noresume = 0; | 995 | noresume = 0; |
| 992 | software_resume(); | 996 | software_resume(); |
| 993 | ret = n; | 997 | return n; |
| 994 | out: | ||
| 995 | return ret; | ||
| 996 | } | 998 | } |
| 997 | 999 | ||
| 998 | power_attr(resume); | 1000 | power_attr(resume); |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 1d1bf630e6e9..6271bc4073ef 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -282,8 +282,8 @@ struct kobject *power_kobj; | |||
| 282 | * state - control system power state. | 282 | * state - control system power state. |
| 283 | * | 283 | * |
| 284 | * show() returns what states are supported, which is hard-coded to | 284 | * show() returns what states are supported, which is hard-coded to |
| 285 | * 'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and | 285 | * 'freeze' (Low-Power Idle), 'standby' (Power-On Suspend), |
| 286 | * 'disk' (Suspend-to-Disk). | 286 | * 'mem' (Suspend-to-RAM), and 'disk' (Suspend-to-Disk). |
| 287 | * | 287 | * |
| 288 | * store() accepts one of those strings, translates it into the | 288 | * store() accepts one of those strings, translates it into the |
| 289 | * proper enumerated value, and initiates a suspend transition. | 289 | * proper enumerated value, and initiates a suspend transition. |
diff --git a/kernel/power/power.h b/kernel/power/power.h index 7d4b7ffb3c1d..1ca753106557 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
| @@ -49,6 +49,8 @@ static inline char *check_image_kernel(struct swsusp_info *info) | |||
| 49 | */ | 49 | */ |
| 50 | #define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT) | 50 | #define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT) |
| 51 | 51 | ||
| 52 | asmlinkage int swsusp_save(void); | ||
| 53 | |||
| 52 | /* kernel/power/hibernate.c */ | 54 | /* kernel/power/hibernate.c */ |
| 53 | extern bool freezer_test_done; | 55 | extern bool freezer_test_done; |
| 54 | 56 | ||
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 8dff9b48075a..884b77058864 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
| @@ -66,6 +66,7 @@ static struct pm_qos_constraints cpu_dma_constraints = { | |||
| 66 | .list = PLIST_HEAD_INIT(cpu_dma_constraints.list), | 66 | .list = PLIST_HEAD_INIT(cpu_dma_constraints.list), |
| 67 | .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, | 67 | .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, |
| 68 | .default_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, | 68 | .default_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, |
| 69 | .no_constraint_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, | ||
| 69 | .type = PM_QOS_MIN, | 70 | .type = PM_QOS_MIN, |
| 70 | .notifiers = &cpu_dma_lat_notifier, | 71 | .notifiers = &cpu_dma_lat_notifier, |
| 71 | }; | 72 | }; |
| @@ -79,6 +80,7 @@ static struct pm_qos_constraints network_lat_constraints = { | |||
| 79 | .list = PLIST_HEAD_INIT(network_lat_constraints.list), | 80 | .list = PLIST_HEAD_INIT(network_lat_constraints.list), |
| 80 | .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, | 81 | .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, |
| 81 | .default_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, | 82 | .default_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, |
| 83 | .no_constraint_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, | ||
| 82 | .type = PM_QOS_MIN, | 84 | .type = PM_QOS_MIN, |
| 83 | .notifiers = &network_lat_notifier, | 85 | .notifiers = &network_lat_notifier, |
| 84 | }; | 86 | }; |
| @@ -93,6 +95,7 @@ static struct pm_qos_constraints network_tput_constraints = { | |||
| 93 | .list = PLIST_HEAD_INIT(network_tput_constraints.list), | 95 | .list = PLIST_HEAD_INIT(network_tput_constraints.list), |
| 94 | .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, | 96 | .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, |
| 95 | .default_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, | 97 | .default_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, |
| 98 | .no_constraint_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, | ||
| 96 | .type = PM_QOS_MAX, | 99 | .type = PM_QOS_MAX, |
| 97 | .notifiers = &network_throughput_notifier, | 100 | .notifiers = &network_throughput_notifier, |
| 98 | }; | 101 | }; |
| @@ -128,7 +131,7 @@ static const struct file_operations pm_qos_power_fops = { | |||
| 128 | static inline int pm_qos_get_value(struct pm_qos_constraints *c) | 131 | static inline int pm_qos_get_value(struct pm_qos_constraints *c) |
| 129 | { | 132 | { |
| 130 | if (plist_head_empty(&c->list)) | 133 | if (plist_head_empty(&c->list)) |
| 131 | return c->default_value; | 134 | return c->no_constraint_value; |
| 132 | 135 | ||
| 133 | switch (c->type) { | 136 | switch (c->type) { |
| 134 | case PM_QOS_MIN: | 137 | case PM_QOS_MIN: |
| @@ -170,6 +173,7 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, | |||
| 170 | { | 173 | { |
| 171 | unsigned long flags; | 174 | unsigned long flags; |
| 172 | int prev_value, curr_value, new_value; | 175 | int prev_value, curr_value, new_value; |
| 176 | int ret; | ||
| 173 | 177 | ||
| 174 | spin_lock_irqsave(&pm_qos_lock, flags); | 178 | spin_lock_irqsave(&pm_qos_lock, flags); |
| 175 | prev_value = pm_qos_get_value(c); | 179 | prev_value = pm_qos_get_value(c); |
| @@ -205,13 +209,15 @@ int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, | |||
| 205 | 209 | ||
| 206 | trace_pm_qos_update_target(action, prev_value, curr_value); | 210 | trace_pm_qos_update_target(action, prev_value, curr_value); |
| 207 | if (prev_value != curr_value) { | 211 | if (prev_value != curr_value) { |
| 208 | blocking_notifier_call_chain(c->notifiers, | 212 | ret = 1; |
| 209 | (unsigned long)curr_value, | 213 | if (c->notifiers) |
| 210 | NULL); | 214 | blocking_notifier_call_chain(c->notifiers, |
| 211 | return 1; | 215 | (unsigned long)curr_value, |
| 216 | NULL); | ||
| 212 | } else { | 217 | } else { |
| 213 | return 0; | 218 | ret = 0; |
| 214 | } | 219 | } |
| 220 | return ret; | ||
| 215 | } | 221 | } |
| 216 | 222 | ||
| 217 | /** | 223 | /** |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index d9f61a145802..149e745eaa52 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
| @@ -1268,7 +1268,7 @@ static void free_unnecessary_pages(void) | |||
| 1268 | * [number of saveable pages] - [number of pages that can be freed in theory] | 1268 | * [number of saveable pages] - [number of pages that can be freed in theory] |
| 1269 | * | 1269 | * |
| 1270 | * where the second term is the sum of (1) reclaimable slab pages, (2) active | 1270 | * where the second term is the sum of (1) reclaimable slab pages, (2) active |
| 1271 | * and (3) inactive anonymouns pages, (4) active and (5) inactive file pages, | 1271 | * and (3) inactive anonymous pages, (4) active and (5) inactive file pages, |
| 1272 | * minus mapped file pages. | 1272 | * minus mapped file pages. |
| 1273 | */ | 1273 | */ |
| 1274 | static unsigned long minimum_image_size(unsigned long saveable) | 1274 | static unsigned long minimum_image_size(unsigned long saveable) |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 62ee437b5c7e..90b3d9366d1a 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
| @@ -39,7 +39,7 @@ static const struct platform_suspend_ops *suspend_ops; | |||
| 39 | 39 | ||
| 40 | static bool need_suspend_ops(suspend_state_t state) | 40 | static bool need_suspend_ops(suspend_state_t state) |
| 41 | { | 41 | { |
| 42 | return !!(state > PM_SUSPEND_FREEZE); | 42 | return state > PM_SUSPEND_FREEZE; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | static DECLARE_WAIT_QUEUE_HEAD(suspend_freeze_wait_head); | 45 | static DECLARE_WAIT_QUEUE_HEAD(suspend_freeze_wait_head); |
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index 8f50de394d22..019069c84ff6 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | #include <linux/rbtree.h> | 18 | #include <linux/rbtree.h> |
| 19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | 20 | ||
| 21 | #include "power.h" | ||
| 22 | |||
| 21 | static DEFINE_MUTEX(wakelocks_lock); | 23 | static DEFINE_MUTEX(wakelocks_lock); |
| 22 | 24 | ||
| 23 | struct wakelock { | 25 | struct wakelock { |
