aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/thermal/spear-thermal.txt14
-rw-r--r--Documentation/thermal/sysfs-api.txt30
-rw-r--r--MAINTAINERS7
-rw-r--r--drivers/acpi/ac.c4
-rw-r--r--drivers/acpi/acpi_memhotplug.c43
-rw-r--r--drivers/acpi/acpi_pad.c4
-rw-r--r--drivers/acpi/acpica/Makefile2
-rw-r--r--drivers/acpi/acpica/acevents.h2
-rw-r--r--drivers/acpi/acpica/acglobal.h19
-rw-r--r--drivers/acpi/acpica/aclocal.h43
-rw-r--r--drivers/acpi/acpica/acmacros.h6
-rw-r--r--drivers/acpi/acpica/acobject.h15
-rw-r--r--drivers/acpi/acpica/acpredef.h8
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/acutils.h2
-rw-r--r--drivers/acpi/acpica/amlcode.h4
-rw-r--r--drivers/acpi/acpica/amlresrc.h4
-rw-r--r--drivers/acpi/acpica/dsargs.c2
-rw-r--r--drivers/acpi/acpica/dscontrol.c4
-rw-r--r--drivers/acpi/acpica/dsfield.c103
-rw-r--r--drivers/acpi/acpica/dsinit.c4
-rw-r--r--drivers/acpi/acpica/dsmethod.c6
-rw-r--r--drivers/acpi/acpica/dsmthdat.c32
-rw-r--r--drivers/acpi/acpica/dsobject.c14
-rw-r--r--drivers/acpi/acpica/dsopcode.c12
-rw-r--r--drivers/acpi/acpica/dsutils.c6
-rw-r--r--drivers/acpi/acpica/dswscope.c4
-rw-r--r--drivers/acpi/acpica/dswstate.c20
-rw-r--r--drivers/acpi/acpica/evevent.c2
-rw-r--r--drivers/acpi/acpica/evglock.c4
-rw-r--r--drivers/acpi/acpica/evgpe.c22
-rw-r--r--drivers/acpi/acpica/evgpeblk.c2
-rw-r--r--drivers/acpi/acpica/evgpeutil.c22
-rw-r--r--drivers/acpi/acpica/evmisc.c191
-rw-r--r--drivers/acpi/acpica/evregion.c24
-rw-r--r--drivers/acpi/acpica/evrgnini.c28
-rw-r--r--drivers/acpi/acpica/evsci.c4
-rw-r--r--drivers/acpi/acpica/evxface.c474
-rw-r--r--drivers/acpi/acpica/evxfevnt.c8
-rw-r--r--drivers/acpi/acpica/evxfgpe.c112
-rw-r--r--drivers/acpi/acpica/evxfregn.c18
-rw-r--r--drivers/acpi/acpica/exconfig.c8
-rw-r--r--drivers/acpi/acpica/exconvrt.c10
-rw-r--r--drivers/acpi/acpica/excreate.c2
-rw-r--r--drivers/acpi/acpica/exdebug.c4
-rw-r--r--drivers/acpi/acpica/exdump.c51
-rw-r--r--drivers/acpi/acpica/exfldio.c14
-rw-r--r--drivers/acpi/acpica/exmisc.c26
-rw-r--r--drivers/acpi/acpica/exmutex.c6
-rw-r--r--drivers/acpi/acpica/exprep.c6
-rw-r--r--drivers/acpi/acpica/exregion.c38
-rw-r--r--drivers/acpi/acpica/exresolv.c4
-rw-r--r--drivers/acpi/acpica/exresop.c10
-rw-r--r--drivers/acpi/acpica/exstore.c6
-rw-r--r--drivers/acpi/acpica/exstorob.c2
-rw-r--r--drivers/acpi/acpica/exsystem.c8
-rw-r--r--drivers/acpi/acpica/exutils.c10
-rw-r--r--drivers/acpi/acpica/hwacpi.c2
-rw-r--r--drivers/acpi/acpica/hwesleep.c15
-rw-r--r--drivers/acpi/acpica/hwregs.c22
-rw-r--r--drivers/acpi/acpica/hwsleep.c6
-rw-r--r--drivers/acpi/acpica/hwtimer.c4
-rw-r--r--drivers/acpi/acpica/hwvalid.c4
-rw-r--r--drivers/acpi/acpica/hwxface.c12
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c6
-rw-r--r--drivers/acpi/acpica/nsaccess.c8
-rw-r--r--drivers/acpi/acpica/nsalloc.c10
-rw-r--r--drivers/acpi/acpica/nsdump.c18
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c6
-rw-r--r--drivers/acpi/acpica/nseval.c10
-rw-r--r--drivers/acpi/acpica/nsinit.c6
-rw-r--r--drivers/acpi/acpica/nsload.c4
-rw-r--r--drivers/acpi/acpica/nsnames.c10
-rw-r--r--drivers/acpi/acpica/nsobject.c28
-rw-r--r--drivers/acpi/acpica/nspredef.c38
-rw-r--r--drivers/acpi/acpica/nsrepair.c14
-rw-r--r--drivers/acpi/acpica/nsrepair2.c26
-rw-r--r--drivers/acpi/acpica/nssearch.c12
-rw-r--r--drivers/acpi/acpica/nsutils.c26
-rw-r--r--drivers/acpi/acpica/nswalk.c8
-rw-r--r--drivers/acpi/acpica/nsxfeval.c26
-rw-r--r--drivers/acpi/acpica/nsxfname.c16
-rw-r--r--drivers/acpi/acpica/nsxfobj.c8
-rw-r--r--drivers/acpi/acpica/psargs.c6
-rw-r--r--drivers/acpi/acpica/psloop.c16
-rw-r--r--drivers/acpi/acpica/psopcode.c4
-rw-r--r--drivers/acpi/acpica/psparse.c6
-rw-r--r--drivers/acpi/acpica/psscope.c6
-rw-r--r--drivers/acpi/acpica/pstree.c14
-rw-r--r--drivers/acpi/acpica/psutils.c8
-rw-r--r--drivers/acpi/acpica/psxface.c16
-rw-r--r--drivers/acpi/acpica/rsaddr.c14
-rw-r--r--drivers/acpi/acpica/rscalc.c2
-rw-r--r--drivers/acpi/acpica/rscreate.c6
-rw-r--r--drivers/acpi/acpica/rsdump.c10
-rw-r--r--drivers/acpi/acpica/rslist.c2
-rw-r--r--drivers/acpi/acpica/rsmisc.c22
-rw-r--r--drivers/acpi/acpica/rsutils.c44
-rw-r--r--drivers/acpi/acpica/rsxface.c14
-rw-r--r--drivers/acpi/acpica/tbfadt.c144
-rw-r--r--drivers/acpi/acpica/tbfind.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c23
-rw-r--r--drivers/acpi/acpica/tbutils.c58
-rw-r--r--drivers/acpi/acpica/tbxface.c225
-rw-r--r--drivers/acpi/acpica/tbxfload.c389
-rw-r--r--drivers/acpi/acpica/tbxfroot.c12
-rw-r--r--drivers/acpi/acpica/utaddress.c10
-rw-r--r--drivers/acpi/acpica/utalloc.c20
-rw-r--r--drivers/acpi/acpica/utcopy.c2
-rw-r--r--drivers/acpi/acpica/utdebug.c32
-rw-r--r--drivers/acpi/acpica/utdecode.c70
-rw-r--r--drivers/acpi/acpica/utdelete.c38
-rw-r--r--drivers/acpi/acpica/uteval.c6
-rw-r--r--drivers/acpi/acpica/utexcep.c153
-rw-r--r--drivers/acpi/acpica/utglobal.c11
-rw-r--r--drivers/acpi/acpica/utids.c2
-rw-r--r--drivers/acpi/acpica/utlock.c6
-rw-r--r--drivers/acpi/acpica/utmath.c4
-rw-r--r--drivers/acpi/acpica/utmisc.c104
-rw-r--r--drivers/acpi/acpica/utmutex.c8
-rw-r--r--drivers/acpi/acpica/utobject.c14
-rw-r--r--drivers/acpi/acpica/utosi.c2
-rw-r--r--drivers/acpi/acpica/utresrc.c34
-rw-r--r--drivers/acpi/acpica/utstate.c16
-rw-r--r--drivers/acpi/acpica/utxface.c18
-rw-r--r--drivers/acpi/acpica/utxferror.c90
-rw-r--r--drivers/acpi/acpica/utxfmutex.c14
-rw-r--r--drivers/acpi/apei/apei-base.c5
-rw-r--r--drivers/acpi/battery.c9
-rw-r--r--drivers/acpi/bus.c4
-rw-r--r--drivers/acpi/container.c43
-rw-r--r--drivers/acpi/osl.c4
-rw-r--r--drivers/acpi/processor_driver.c28
-rw-r--r--drivers/acpi/processor_idle.c12
-rw-r--r--drivers/acpi/scan.c58
-rw-r--r--drivers/acpi/sleep.c2
-rw-r--r--drivers/acpi/thermal.c10
-rw-r--r--drivers/acpi/utils.c42
-rw-r--r--drivers/cpuidle/Kconfig3
-rw-r--r--drivers/cpuidle/Makefile1
-rw-r--r--drivers/cpuidle/coupled.c715
-rw-r--r--drivers/cpuidle/cpuidle.c85
-rw-r--r--drivers/cpuidle/cpuidle.h32
-rw-r--r--drivers/idle/intel_idle.c37
-rw-r--r--drivers/platform/x86/acerhdf.c2
-rw-r--r--drivers/platform/x86/intel_mid_thermal.c2
-rw-r--r--drivers/thermal/Kconfig1
-rw-r--r--drivers/thermal/spear_thermal.c28
-rw-r--r--drivers/thermal/thermal_sys.c223
-rw-r--r--include/acpi/acexcep.h7
-rw-r--r--include/acpi/acnames.h2
-rw-r--r--include/acpi/acoutput.h6
-rw-r--r--include/acpi/acpi.h2
-rw-r--r--include/acpi/acpi_bus.h12
-rw-r--r--include/acpi/acpiosxf.h4
-rw-r--r--include/acpi/acpixf.h25
-rw-r--r--include/acpi/acrestyp.h6
-rw-r--r--include/acpi/actbl.h10
-rw-r--r--include/acpi/actbl1.h10
-rw-r--r--include/acpi/actbl2.h10
-rw-r--r--include/acpi/actbl3.h2
-rw-r--r--include/acpi/actypes.h13
-rw-r--r--include/acpi/platform/acenv.h2
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h2
-rw-r--r--include/linux/acpi.h40
-rw-r--r--include/linux/cpuidle.h11
-rw-r--r--include/linux/platform_data/spear_thermal.h26
-rw-r--r--include/linux/thermal.h20
-rw-r--r--tools/power/x86/turbostat/Makefile1
-rw-r--r--tools/power/x86/turbostat/turbostat.877
-rw-r--r--tools/power/x86/turbostat/turbostat.c1333
172 files changed, 4203 insertions, 2340 deletions
diff --git a/Documentation/devicetree/bindings/thermal/spear-thermal.txt b/Documentation/devicetree/bindings/thermal/spear-thermal.txt
new file mode 100644
index 000000000000..93e3b67c102d
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/spear-thermal.txt
@@ -0,0 +1,14 @@
1* SPEAr Thermal
2
3Required properties:
4- compatible : "st,thermal-spear1340"
5- reg : Address range of the thermal registers
6- st,thermal-flags: flags used to enable thermal sensor
7
8Example:
9
10 thermal@fc000000 {
11 compatible = "st,thermal-spear1340";
12 reg = <0xfc000000 0x1000>;
13 st,thermal-flags = <0x7000>;
14 };
diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt
index 1733ab947a95..c087dbcf3535 100644
--- a/Documentation/thermal/sysfs-api.txt
+++ b/Documentation/thermal/sysfs-api.txt
@@ -32,7 +32,8 @@ temperature) and throttle appropriate devices.
32 32
331.1 thermal zone device interface 331.1 thermal zone device interface
341.1.1 struct thermal_zone_device *thermal_zone_device_register(char *name, 341.1.1 struct thermal_zone_device *thermal_zone_device_register(char *name,
35 int trips, void *devdata, struct thermal_zone_device_ops *ops) 35 int trips, int mask, void *devdata,
36 struct thermal_zone_device_ops *ops)
36 37
37 This interface function adds a new thermal zone device (sensor) to 38 This interface function adds a new thermal zone device (sensor) to
38 /sys/class/thermal folder as thermal_zone[0-*]. It tries to bind all the 39 /sys/class/thermal folder as thermal_zone[0-*]. It tries to bind all the
@@ -40,16 +41,17 @@ temperature) and throttle appropriate devices.
40 41
41 name: the thermal zone name. 42 name: the thermal zone name.
42 trips: the total number of trip points this thermal zone supports. 43 trips: the total number of trip points this thermal zone supports.
44 mask: Bit string: If 'n'th bit is set, then trip point 'n' is writeable.
43 devdata: device private data 45 devdata: device private data
44 ops: thermal zone device call-backs. 46 ops: thermal zone device call-backs.
45 .bind: bind the thermal zone device with a thermal cooling device. 47 .bind: bind the thermal zone device with a thermal cooling device.
46 .unbind: unbind the thermal zone device with a thermal cooling device. 48 .unbind: unbind the thermal zone device with a thermal cooling device.
47 .get_temp: get the current temperature of the thermal zone. 49 .get_temp: get the current temperature of the thermal zone.
48 .get_mode: get the current mode (user/kernel) of the thermal zone. 50 .get_mode: get the current mode (enabled/disabled) of the thermal zone.
49 - "kernel" means thermal management is done in kernel. 51 - "enabled" means the kernel thermal management is enabled.
50 - "user" will prevent kernel thermal driver actions upon trip points 52 - "disabled" will prevent kernel thermal driver action upon trip points
51 so that user applications can take charge of thermal management. 53 so that user applications can take charge of thermal management.
52 .set_mode: set the mode (user/kernel) of the thermal zone. 54 .set_mode: set the mode (enabled/disabled) of the thermal zone.
53 .get_trip_type: get the type of certain trip point. 55 .get_trip_type: get the type of certain trip point.
54 .get_trip_temp: get the temperature above which the certain trip point 56 .get_trip_temp: get the temperature above which the certain trip point
55 will be fired. 57 will be fired.
@@ -119,6 +121,7 @@ Thermal zone device sys I/F, created once it's registered:
119 |---mode: Working mode of the thermal zone 121 |---mode: Working mode of the thermal zone
120 |---trip_point_[0-*]_temp: Trip point temperature 122 |---trip_point_[0-*]_temp: Trip point temperature
121 |---trip_point_[0-*]_type: Trip point type 123 |---trip_point_[0-*]_type: Trip point type
124 |---trip_point_[0-*]_hyst: Hysteresis value for this trip point
122 125
123Thermal cooling device sys I/F, created once it's registered: 126Thermal cooling device sys I/F, created once it's registered:
124/sys/class/thermal/cooling_device[0-*]: 127/sys/class/thermal/cooling_device[0-*]:
@@ -167,14 +170,14 @@ temp
167 RO, Required 170 RO, Required
168 171
169mode 172mode
170 One of the predefined values in [kernel, user]. 173 One of the predefined values in [enabled, disabled].
171 This file gives information about the algorithm that is currently 174 This file gives information about the algorithm that is currently
172 managing the thermal zone. It can be either default kernel based 175 managing the thermal zone. It can be either default kernel based
173 algorithm or user space application. 176 algorithm or user space application.
174 kernel = Thermal management in kernel thermal zone driver. 177 enabled = enable Kernel Thermal management.
175 user = Preventing kernel thermal zone driver actions upon 178 disabled = Preventing kernel thermal zone driver actions upon
176 trip points so that user application can take full 179 trip points so that user application can take full
177 charge of the thermal management. 180 charge of the thermal management.
178 RW, Optional 181 RW, Optional
179 182
180trip_point_[0-*]_temp 183trip_point_[0-*]_temp
@@ -188,6 +191,11 @@ trip_point_[0-*]_type
188 thermal zone. 191 thermal zone.
189 RO, Optional 192 RO, Optional
190 193
194trip_point_[0-*]_hyst
195 The hysteresis value for a trip point, represented as an integer
196 Unit: Celsius
197 RW, Optional
198
191cdev[0-*] 199cdev[0-*]
192 Sysfs link to the thermal cooling device node where the sys I/F 200 Sysfs link to the thermal cooling device node where the sys I/F
193 for cooling device throttling control represents. 201 for cooling device throttling control represents.
@@ -248,7 +256,7 @@ method, the sys I/F structure will be built like this:
248|thermal_zone1: 256|thermal_zone1:
249 |---type: acpitz 257 |---type: acpitz
250 |---temp: 37000 258 |---temp: 37000
251 |---mode: kernel 259 |---mode: enabled
252 |---trip_point_0_temp: 100000 260 |---trip_point_0_temp: 100000
253 |---trip_point_0_type: critical 261 |---trip_point_0_type: critical
254 |---trip_point_1_temp: 80000 262 |---trip_point_1_temp: 80000
diff --git a/MAINTAINERS b/MAINTAINERS
index 5b41de49a324..48778c985dc8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -242,13 +242,6 @@ W: http://www.lesswatts.org/projects/acpi/
242S: Supported 242S: Supported
243F: drivers/acpi/fan.c 243F: drivers/acpi/fan.c
244 244
245ACPI PROCESSOR AGGREGATOR DRIVER
246M: Shaohua Li <shaohua.li@intel.com>
247L: linux-acpi@vger.kernel.org
248W: http://www.lesswatts.org/projects/acpi/
249S: Supported
250F: drivers/acpi/acpi_pad.c
251
252ACPI THERMAL DRIVER 245ACPI THERMAL DRIVER
253M: Zhang Rui <rui.zhang@intel.com> 246M: Zhang Rui <rui.zhang@intel.com>
254L: linux-acpi@vger.kernel.org 247L: linux-acpi@vger.kernel.org
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index ff9f6bd48301..ac7034129f3f 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -294,7 +294,9 @@ static int acpi_ac_add(struct acpi_device *device)
294 ac->charger.properties = ac_props; 294 ac->charger.properties = ac_props;
295 ac->charger.num_properties = ARRAY_SIZE(ac_props); 295 ac->charger.num_properties = ARRAY_SIZE(ac_props);
296 ac->charger.get_property = get_ac_property; 296 ac->charger.get_property = get_ac_property;
297 power_supply_register(&ac->device->dev, &ac->charger); 297 result = power_supply_register(&ac->device->dev, &ac->charger);
298 if (result)
299 goto end;
298 300
299 printk(KERN_INFO PREFIX "%s [%s] (%s)\n", 301 printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
300 acpi_device_name(device), acpi_device_bid(device), 302 acpi_device_name(device), acpi_device_bid(device),
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index d98571385656..24c807f96636 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -341,7 +341,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
341{ 341{
342 struct acpi_memory_device *mem_device; 342 struct acpi_memory_device *mem_device;
343 struct acpi_device *device; 343 struct acpi_device *device;
344 344 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
345 345
346 switch (event) { 346 switch (event) {
347 case ACPI_NOTIFY_BUS_CHECK: 347 case ACPI_NOTIFY_BUS_CHECK:
@@ -354,15 +354,20 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
354 "\nReceived DEVICE CHECK notification for device\n")); 354 "\nReceived DEVICE CHECK notification for device\n"));
355 if (acpi_memory_get_device(handle, &mem_device)) { 355 if (acpi_memory_get_device(handle, &mem_device)) {
356 printk(KERN_ERR PREFIX "Cannot find driver data\n"); 356 printk(KERN_ERR PREFIX "Cannot find driver data\n");
357 return; 357 break;
358 } 358 }
359 359
360 if (!acpi_memory_check_device(mem_device)) { 360 if (acpi_memory_check_device(mem_device))
361 if (acpi_memory_enable_device(mem_device)) 361 break;
362 printk(KERN_ERR PREFIX 362
363 "Cannot enable memory device\n"); 363 if (acpi_memory_enable_device(mem_device)) {
364 printk(KERN_ERR PREFIX "Cannot enable memory device\n");
365 break;
364 } 366 }
367
368 ost_code = ACPI_OST_SC_SUCCESS;
365 break; 369 break;
370
366 case ACPI_NOTIFY_EJECT_REQUEST: 371 case ACPI_NOTIFY_EJECT_REQUEST:
367 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 372 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
368 "\nReceived EJECT REQUEST notification for device\n")); 373 "\nReceived EJECT REQUEST notification for device\n"));
@@ -383,19 +388,35 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
383 * TBD: Can also be disabled by Callback registration 388 * TBD: Can also be disabled by Callback registration
384 * with generic sysfs driver 389 * with generic sysfs driver
385 */ 390 */
386 if (acpi_memory_disable_device(mem_device)) 391 if (acpi_memory_disable_device(mem_device)) {
387 printk(KERN_ERR PREFIX 392 printk(KERN_ERR PREFIX "Disable memory device\n");
388 "Disable memory device\n"); 393 /*
394 * If _EJ0 was called but failed, _OST is not
395 * necessary.
396 */
397 if (mem_device->state == MEMORY_INVALID_STATE)
398 return;
399
400 break;
401 }
402
389 /* 403 /*
390 * TBD: Invoke acpi_bus_remove to cleanup data structures 404 * TBD: Invoke acpi_bus_remove to cleanup data structures
391 */ 405 */
392 break; 406
407 /* _EJ0 succeeded; _OST is not necessary */
408 return;
409
393 default: 410 default:
394 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 411 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
395 "Unsupported event [0x%x]\n", event)); 412 "Unsupported event [0x%x]\n", event));
396 break; 413
414 /* non-hotplug event; possibly handled by other handler */
415 return;
397 } 416 }
398 417
418 /* Inform firmware that the hotplug operation has completed */
419 (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
399 return; 420 return;
400} 421}
401 422
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 1502c50273b5..af4aad6ee2eb 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -145,7 +145,7 @@ static void exit_round_robin(unsigned int tsk_index)
145} 145}
146 146
147static unsigned int idle_pct = 5; /* percentage */ 147static unsigned int idle_pct = 5; /* percentage */
148static unsigned int round_robin_time = 10; /* second */ 148static unsigned int round_robin_time = 1; /* second */
149static int power_saving_thread(void *data) 149static int power_saving_thread(void *data)
150{ 150{
151 struct sched_param param = {.sched_priority = 1}; 151 struct sched_param param = {.sched_priority = 1};
@@ -235,7 +235,7 @@ static int create_power_saving_task(void)
235 235
236 ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, 236 ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread,
237 (void *)(unsigned long)ps_tsk_num, 237 (void *)(unsigned long)ps_tsk_num,
238 "power_saving/%d", ps_tsk_num); 238 "acpi_pad/%d", ps_tsk_num);
239 rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; 239 rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0;
240 if (!rc) 240 if (!rc)
241 ps_tsk_num++; 241 ps_tsk_num++;
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 793b8cc8e256..0a1b3435f920 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -134,12 +134,14 @@ acpi-y += \
134 tbinstal.o \ 134 tbinstal.o \
135 tbutils.o \ 135 tbutils.o \
136 tbxface.o \ 136 tbxface.o \
137 tbxfload.o \
137 tbxfroot.o 138 tbxfroot.o
138 139
139acpi-y += \ 140acpi-y += \
140 utaddress.o \ 141 utaddress.o \
141 utalloc.o \ 142 utalloc.o \
142 utcopy.o \ 143 utcopy.o \
144 utexcep.o \
143 utdebug.o \ 145 utdebug.o \
144 utdecode.o \ 146 utdecode.o \
145 utdelete.o \ 147 utdelete.o \
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index d700f63e4701..c0a43b38c6a3 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -237,7 +237,7 @@ u32 acpi_ev_install_sci_handler(void);
237 237
238acpi_status acpi_ev_remove_sci_handler(void); 238acpi_status acpi_ev_remove_sci_handler(void);
239 239
240u32 acpi_ev_initialize_sCI(u32 program_sCI); 240u32 acpi_ev_initialize_SCI(u32 program_SCI);
241 241
242ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_ev_terminate(void)) 242ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_ev_terminate(void))
243#endif /* __ACEVENTS_H__ */ 243#endif /* __ACEVENTS_H__ */
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 4f7d3f57d05c..ce79100fb5eb 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -278,8 +278,7 @@ ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
278 278
279/* Global handlers */ 279/* Global handlers */
280 280
281ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; 281ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2];
282ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
283ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; 282ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
284ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; 283ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
285ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; 284ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler;
@@ -327,14 +326,6 @@ extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
327 326
328#endif 327#endif
329 328
330/* Exception codes */
331
332extern char const *acpi_gbl_exception_names_env[];
333extern char const *acpi_gbl_exception_names_pgm[];
334extern char const *acpi_gbl_exception_names_tbl[];
335extern char const *acpi_gbl_exception_names_aml[];
336extern char const *acpi_gbl_exception_names_ctrl[];
337
338/***************************************************************************** 329/*****************************************************************************
339 * 330 *
340 * Namespace globals 331 * Namespace globals
@@ -463,4 +454,12 @@ ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
463 454
464#endif /* ACPI_DEBUGGER */ 455#endif /* ACPI_DEBUGGER */
465 456
457/*****************************************************************************
458 *
459 * Info/help support
460 *
461 ****************************************************************************/
462
463extern const struct ah_predefined_name asl_predefined_info[];
464
466#endif /* __ACGLOBAL_H__ */ 465#endif /* __ACGLOBAL_H__ */
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index e3922ca20e7f..cc80fe10e8ea 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -299,7 +299,7 @@ acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
299 * Information structure for ACPI predefined names. 299 * Information structure for ACPI predefined names.
300 * Each entry in the table contains the following items: 300 * Each entry in the table contains the following items:
301 * 301 *
302 * Name - The ACPI reserved name 302 * name - The ACPI reserved name
303 * param_count - Number of arguments to the method 303 * param_count - Number of arguments to the method
304 * expected_return_btypes - Allowed type(s) for the return value 304 * expected_return_btypes - Allowed type(s) for the return value
305 */ 305 */
@@ -404,6 +404,13 @@ struct acpi_gpe_handler_info {
404 u8 originally_enabled; /* True if GPE was originally enabled */ 404 u8 originally_enabled; /* True if GPE was originally enabled */
405}; 405};
406 406
407/* Notify info for implicit notify, multiple device objects */
408
409struct acpi_gpe_notify_info {
410 struct acpi_namespace_node *device_node; /* Device to be notified */
411 struct acpi_gpe_notify_info *next;
412};
413
407struct acpi_gpe_notify_object { 414struct acpi_gpe_notify_object {
408 struct acpi_namespace_node *node; 415 struct acpi_namespace_node *node;
409 struct acpi_gpe_notify_object *next; 416 struct acpi_gpe_notify_object *next;
@@ -412,7 +419,7 @@ struct acpi_gpe_notify_object {
412union acpi_gpe_dispatch_info { 419union acpi_gpe_dispatch_info {
413 struct acpi_namespace_node *method_node; /* Method node for this GPE level */ 420 struct acpi_namespace_node *method_node; /* Method node for this GPE level */
414 struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ 421 struct acpi_gpe_handler_info *handler; /* Installed GPE handler */
415 struct acpi_gpe_notify_object device; /* List of _PRW devices for implicit notify */ 422 struct acpi_gpe_notify_info *notify_list; /* List of _PRW devices for implicit notifies */
416}; 423};
417 424
418/* 425/*
@@ -420,7 +427,7 @@ union acpi_gpe_dispatch_info {
420 * NOTE: Important to keep this struct as small as possible. 427 * NOTE: Important to keep this struct as small as possible.
421 */ 428 */
422struct acpi_gpe_event_info { 429struct acpi_gpe_event_info {
423 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ 430 union acpi_gpe_dispatch_info dispatch; /* Either Method, Handler, or notify_list */
424 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ 431 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
425 u8 flags; /* Misc info about this GPE */ 432 u8 flags; /* Misc info about this GPE */
426 u8 gpe_number; /* This GPE */ 433 u8 gpe_number; /* This GPE */
@@ -600,13 +607,22 @@ acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
600 607
601typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); 608typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
602 609
610/* Global handlers for AML Notifies */
611
612struct acpi_global_notify_handler {
613 acpi_notify_handler handler;
614 void *context;
615};
616
603/* 617/*
604 * Notify info - used to pass info to the deferred notify 618 * Notify info - used to pass info to the deferred notify
605 * handler/dispatcher. 619 * handler/dispatcher.
606 */ 620 */
607struct acpi_notify_info { 621struct acpi_notify_info {
608 ACPI_STATE_COMMON struct acpi_namespace_node *node; 622 ACPI_STATE_COMMON u8 handler_list_id;
609 union acpi_operand_object *handler_obj; 623 struct acpi_namespace_node *node;
624 union acpi_operand_object *handler_list_head;
625 struct acpi_global_notify_handler *global;
610}; 626};
611 627
612/* Generic state is union of structs above */ 628/* Generic state is union of structs above */
@@ -718,7 +734,7 @@ struct acpi_parse_obj_named {
718 u32 name; /* 4-byte name or zero if no name */ 734 u32 name; /* 4-byte name or zero if no name */
719}; 735};
720 736
721/* This version is used by the i_aSL compiler only */ 737/* This version is used by the iASL compiler only */
722 738
723#define ACPI_MAX_PARSEOP_NAME 20 739#define ACPI_MAX_PARSEOP_NAME 20
724 740
@@ -787,6 +803,7 @@ struct acpi_parse_state {
787#define ACPI_PARSEOP_IGNORE 0x01 803#define ACPI_PARSEOP_IGNORE 0x01
788#define ACPI_PARSEOP_PARAMLIST 0x02 804#define ACPI_PARSEOP_PARAMLIST 0x02
789#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 805#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
806#define ACPI_PARSEOP_PREDEF_CHECKED 0x08
790#define ACPI_PARSEOP_SPECIAL 0x10 807#define ACPI_PARSEOP_SPECIAL 0x10
791 808
792/***************************************************************************** 809/*****************************************************************************
@@ -1075,4 +1092,18 @@ struct acpi_debug_mem_block {
1075#define ACPI_MEM_LIST_MAX 1 1092#define ACPI_MEM_LIST_MAX 1
1076#define ACPI_NUM_MEM_LISTS 2 1093#define ACPI_NUM_MEM_LISTS 2
1077 1094
1095/*****************************************************************************
1096 *
1097 * Info/help support
1098 *
1099 ****************************************************************************/
1100
1101struct ah_predefined_name {
1102 char *name;
1103 char *description;
1104#ifndef ACPI_ASL_COMPILER
1105 char *action;
1106#endif
1107};
1108
1078#endif /* __ACLOCAL_H__ */ 1109#endif /* __ACLOCAL_H__ */
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index f119f473f71a..832b6198652e 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -62,7 +62,7 @@
62 * printf() format helpers 62 * printf() format helpers
63 */ 63 */
64 64
65/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ 65/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */
66 66
67#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) 67#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i)
68 68
@@ -283,8 +283,8 @@
283#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) 283#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask))
284 284
285/* 285/*
286 * A struct acpi_namespace_node can appear in some contexts 286 * An object of type struct acpi_namespace_node can appear in some contexts
287 * where a pointer to a union acpi_operand_object can also 287 * where a pointer to an object of type union acpi_operand_object can also
288 * appear. This macro is used to distinguish them. 288 * appear. This macro is used to distinguish them.
289 * 289 *
290 * The "Descriptor" field is the first field in both structures. 290 * The "Descriptor" field is the first field in both structures.
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index c065078ca83b..364a1303fb8f 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -113,8 +113,8 @@ struct acpi_object_integer {
113}; 113};
114 114
115/* 115/*
116 * Note: The String and Buffer object must be identical through the Pointer 116 * Note: The String and Buffer object must be identical through the
117 * and length elements. There is code that depends on this. 117 * pointer and length elements. There is code that depends on this.
118 * 118 *
119 * Fields common to both Strings and Buffers 119 * Fields common to both Strings and Buffers
120 */ 120 */
@@ -206,8 +206,7 @@ struct acpi_object_method {
206 * Common fields for objects that support ASL notifications 206 * Common fields for objects that support ASL notifications
207 */ 207 */
208#define ACPI_COMMON_NOTIFY_INFO \ 208#define ACPI_COMMON_NOTIFY_INFO \
209 union acpi_operand_object *system_notify; /* Handler for system notifies */\ 209 union acpi_operand_object *notify_list[2]; /* Handlers for system/device notifies */\
210 union acpi_operand_object *device_notify; /* Handler for driver notifies */\
211 union acpi_operand_object *handler; /* Handler for Address space */ 210 union acpi_operand_object *handler; /* Handler for Address space */
212 211
213struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ 212struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
@@ -296,10 +295,10 @@ struct acpi_object_buffer_field {
296 295
297struct acpi_object_notify_handler { 296struct acpi_object_notify_handler {
298 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ 297 ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */
299 u32 handler_type; 298 u32 handler_type; /* Type: Device/System/Both */
300 acpi_notify_handler handler; 299 acpi_notify_handler handler; /* Handler address */
301 void *context; 300 void *context;
302 struct acpi_object_notify_handler *next; 301 union acpi_operand_object *next[2]; /* Device and System handler lists */
303}; 302};
304 303
305struct acpi_object_addr_handler { 304struct acpi_object_addr_handler {
@@ -382,7 +381,7 @@ struct acpi_object_cache_list {
382 381
383/****************************************************************************** 382/******************************************************************************
384 * 383 *
385 * union acpi_operand_object Descriptor - a giant union of all of the above 384 * union acpi_operand_object descriptor - a giant union of all of the above
386 * 385 *
387 *****************************************************************************/ 386 *****************************************************************************/
388 387
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index bbb34c9be4e8..3080c017f5ba 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -140,7 +140,7 @@ enum acpi_return_package_types {
140 * 140 *
141 * The main entries in the table each contain the following items: 141 * The main entries in the table each contain the following items:
142 * 142 *
143 * Name - The ACPI reserved name 143 * name - The ACPI reserved name
144 * param_count - Number of arguments to the method 144 * param_count - Number of arguments to the method
145 * expected_btypes - Allowed type(s) for the return value. 145 * expected_btypes - Allowed type(s) for the return value.
146 * 0 means that no return value is expected. 146 * 0 means that no return value is expected.
@@ -511,14 +511,14 @@ static const union acpi_predefined_info predefined_names[] =
511 {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, 511 {{"_TMP", 0, ACPI_RTYPE_INTEGER}},
512 {{"_TPC", 0, ACPI_RTYPE_INTEGER}}, 512 {{"_TPC", 0, ACPI_RTYPE_INTEGER}},
513 {{"_TPT", 1, 0}}, 513 {{"_TPT", 1, 0}},
514 {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2_ref/6_int */ 514 {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */
515 {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}}, 515 {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}},
516 516
517 {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int with count */ 517 {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int with count */
518 {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, 518 {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
519 519
520 {{"_TSP", 0, ACPI_RTYPE_INTEGER}}, 520 {{"_TSP", 0, ACPI_RTYPE_INTEGER}},
521 {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int */ 521 {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int */
522 {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, 522 {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
523 523
524 {{"_TST", 0, ACPI_RTYPE_INTEGER}}, 524 {{"_TST", 0, ACPI_RTYPE_INTEGER}},
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index 0404df605bc1..f196e2c9a71f 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -68,7 +68,7 @@
68#define ACPI_WALK_METHOD 0x01 68#define ACPI_WALK_METHOD 0x01
69#define ACPI_WALK_METHOD_RESTART 0x02 69#define ACPI_WALK_METHOD_RESTART 0x02
70 70
71/* Flags for i_aSL compiler only */ 71/* Flags for iASL compiler only */
72 72
73#define ACPI_WALK_CONST_REQUIRED 0x10 73#define ACPI_WALK_CONST_REQUIRED 0x10
74#define ACPI_WALK_CONST_OPTIONAL 0x20 74#define ACPI_WALK_CONST_OPTIONAL 0x20
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 925ccf22101b..5035327ebccc 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -460,6 +460,8 @@ acpi_ut_short_divide(u64 in_dividend,
460/* 460/*
461 * utmisc 461 * utmisc
462 */ 462 */
463void ut_convert_backslashes(char *pathname);
464
463const char *acpi_ut_validate_exception(acpi_status status); 465const char *acpi_ut_validate_exception(acpi_status status);
464 466
465u8 acpi_ut_is_pci_root_bridge(char *id); 467u8 acpi_ut_is_pci_root_bridge(char *id);
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index 905280fec0fa..c26f8ff6c3b9 100644
--- a/drivers/acpi/acpica/amlcode.h
+++ b/drivers/acpi/acpica/amlcode.h
@@ -182,7 +182,7 @@
182 182
183/* 183/*
184 * Combination opcodes (actually two one-byte opcodes) 184 * Combination opcodes (actually two one-byte opcodes)
185 * Used by the disassembler and i_aSL compiler 185 * Used by the disassembler and iASL compiler
186 */ 186 */
187#define AML_LGREATEREQUAL_OP (u16) 0x9295 187#define AML_LGREATEREQUAL_OP (u16) 0x9295
188#define AML_LLESSEQUAL_OP (u16) 0x9294 188#define AML_LLESSEQUAL_OP (u16) 0x9294
@@ -280,7 +280,7 @@
280 280
281/* Multiple/complex types */ 281/* Multiple/complex types */
282 282
283#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */ 283#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a node - Used only by size_of operator */
284#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ 284#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
285#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ 285#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
286#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */ 286#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 7b2128f274e7..af4947956ec2 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -98,7 +98,7 @@
98#define ACPI_RESTAG_TRANSLATION "_TRA" 98#define ACPI_RESTAG_TRANSLATION "_TRA"
99#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ 99#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
100#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ 100#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
101#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ 101#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
102#define ACPI_RESTAG_VENDORDATA "_VEN" 102#define ACPI_RESTAG_VENDORDATA "_VEN"
103 103
104/* Default sizes for "small" resource descriptors */ 104/* Default sizes for "small" resource descriptors */
@@ -235,7 +235,7 @@ AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
235 235
236struct aml_resource_extended_address64 { 236struct aml_resource_extended_address64 {
237 AML_RESOURCE_LARGE_HEADER_COMMON 237 AML_RESOURCE_LARGE_HEADER_COMMON
238 AML_RESOURCE_ADDRESS_COMMON u8 revision_iD; 238 AML_RESOURCE_ADDRESS_COMMON u8 revision_ID;
239 u8 reserved; 239 u8 reserved;
240 u64 granularity; 240 u64 granularity;
241 u64 minimum; 241 u64 minimum;
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c
index 80eb1900297f..c8b5e2565b98 100644
--- a/drivers/acpi/acpica/dsargs.c
+++ b/drivers/acpi/acpica/dsargs.c
@@ -62,7 +62,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,
62 * 62 *
63 * FUNCTION: acpi_ds_execute_arguments 63 * FUNCTION: acpi_ds_execute_arguments
64 * 64 *
65 * PARAMETERS: Node - Object NS node 65 * PARAMETERS: node - Object NS node
66 * scope_node - Parent NS node 66 * scope_node - Parent NS node
67 * aml_length - Length of executable AML 67 * aml_length - Length of executable AML
68 * aml_start - Pointer to the AML 68 * aml_start - Pointer to the AML
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index effe4ca1133f..465f02134b89 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -56,7 +56,7 @@ ACPI_MODULE_NAME("dscontrol")
56 * FUNCTION: acpi_ds_exec_begin_control_op 56 * FUNCTION: acpi_ds_exec_begin_control_op
57 * 57 *
58 * PARAMETERS: walk_list - The list that owns the walk stack 58 * PARAMETERS: walk_list - The list that owns the walk stack
59 * Op - The control Op 59 * op - The control Op
60 * 60 *
61 * RETURN: Status 61 * RETURN: Status
62 * 62 *
@@ -153,7 +153,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
153 * FUNCTION: acpi_ds_exec_end_control_op 153 * FUNCTION: acpi_ds_exec_end_control_op
154 * 154 *
155 * PARAMETERS: walk_list - The list that owns the walk stack 155 * PARAMETERS: walk_list - The list that owns the walk stack
156 * Op - The control Op 156 * op - The control Op
157 * 157 *
158 * RETURN: Status 158 * RETURN: Status
159 * 159 *
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index cd243cf2cab2..3da6fd8530c5 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -53,16 +53,84 @@
53ACPI_MODULE_NAME("dsfield") 53ACPI_MODULE_NAME("dsfield")
54 54
55/* Local prototypes */ 55/* Local prototypes */
56#ifdef ACPI_ASL_COMPILER
57#include "acdisasm.h"
58static acpi_status
59acpi_ds_create_external_region(acpi_status lookup_status,
60 union acpi_parse_object *op,
61 char *path,
62 struct acpi_walk_state *walk_state,
63 struct acpi_namespace_node **node);
64#endif
65
56static acpi_status 66static acpi_status
57acpi_ds_get_field_names(struct acpi_create_field_info *info, 67acpi_ds_get_field_names(struct acpi_create_field_info *info,
58 struct acpi_walk_state *walk_state, 68 struct acpi_walk_state *walk_state,
59 union acpi_parse_object *arg); 69 union acpi_parse_object *arg);
60 70
71#ifdef ACPI_ASL_COMPILER
72/*******************************************************************************
73 *
74 * FUNCTION: acpi_ds_create_external_region (iASL Disassembler only)
75 *
76 * PARAMETERS: lookup_status - Status from ns_lookup operation
77 * op - Op containing the Field definition and args
78 * path - Pathname of the region
79 * ` walk_state - Current method state
80 * node - Where the new region node is returned
81 *
82 * RETURN: Status
83 *
84 * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new
85 * region node/object.
86 *
87 ******************************************************************************/
88
89static acpi_status
90acpi_ds_create_external_region(acpi_status lookup_status,
91 union acpi_parse_object *op,
92 char *path,
93 struct acpi_walk_state *walk_state,
94 struct acpi_namespace_node **node)
95{
96 acpi_status status;
97 union acpi_operand_object *obj_desc;
98
99 if (lookup_status != AE_NOT_FOUND) {
100 return (lookup_status);
101 }
102
103 /*
104 * Table disassembly:
105 * operation_region not found. Generate an External for it, and
106 * insert the name into the namespace.
107 */
108 acpi_dm_add_to_external_list(op, path, ACPI_TYPE_REGION, 0);
109 status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION,
110 ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
111 walk_state, node);
112 if (ACPI_FAILURE(status)) {
113 return (status);
114 }
115
116 /* Must create and install a region object for the new node */
117
118 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
119 if (!obj_desc) {
120 return (AE_NO_MEMORY);
121 }
122
123 obj_desc->region.node = *node;
124 status = acpi_ns_attach_object(*node, obj_desc, ACPI_TYPE_REGION);
125 return (status);
126}
127#endif
128
61/******************************************************************************* 129/*******************************************************************************
62 * 130 *
63 * FUNCTION: acpi_ds_create_buffer_field 131 * FUNCTION: acpi_ds_create_buffer_field
64 * 132 *
65 * PARAMETERS: Op - Current parse op (create_xXField) 133 * PARAMETERS: op - Current parse op (create_XXField)
66 * walk_state - Current state 134 * walk_state - Current state
67 * 135 *
68 * RETURN: Status 136 * RETURN: Status
@@ -99,7 +167,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
99 167
100 arg = acpi_ps_get_arg(op, 3); 168 arg = acpi_ps_get_arg(op, 3);
101 } else { 169 } else {
102 /* For all other create_xXXField operators, name is the 3rd argument */ 170 /* For all other create_XXXField operators, name is the 3rd argument */
103 171
104 arg = acpi_ps_get_arg(op, 2); 172 arg = acpi_ps_get_arg(op, 2);
105 } 173 }
@@ -203,9 +271,9 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
203 * 271 *
204 * FUNCTION: acpi_ds_get_field_names 272 * FUNCTION: acpi_ds_get_field_names
205 * 273 *
206 * PARAMETERS: Info - create_field info structure 274 * PARAMETERS: info - create_field info structure
207 * ` walk_state - Current method state 275 * ` walk_state - Current method state
208 * Arg - First parser arg for the field name list 276 * arg - First parser arg for the field name list
209 * 277 *
210 * RETURN: Status 278 * RETURN: Status
211 * 279 *
@@ -234,10 +302,10 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
234 while (arg) { 302 while (arg) {
235 /* 303 /*
236 * Four types of field elements are handled: 304 * Four types of field elements are handled:
237 * 1) Name - Enters a new named field into the namespace 305 * 1) name - Enters a new named field into the namespace
238 * 2) Offset - specifies a bit offset 306 * 2) offset - specifies a bit offset
239 * 3) access_as - changes the access mode/attributes 307 * 3) access_as - changes the access mode/attributes
240 * 4) Connection - Associate a resource template with the field 308 * 4) connection - Associate a resource template with the field
241 */ 309 */
242 switch (arg->common.aml_opcode) { 310 switch (arg->common.aml_opcode) {
243 case AML_INT_RESERVEDFIELD_OP: 311 case AML_INT_RESERVEDFIELD_OP:
@@ -389,7 +457,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
389 * 457 *
390 * FUNCTION: acpi_ds_create_field 458 * FUNCTION: acpi_ds_create_field
391 * 459 *
392 * PARAMETERS: Op - Op containing the Field definition and args 460 * PARAMETERS: op - Op containing the Field definition and args
393 * region_node - Object for the containing Operation Region 461 * region_node - Object for the containing Operation Region
394 * ` walk_state - Current method state 462 * ` walk_state - Current method state
395 * 463 *
@@ -413,12 +481,19 @@ acpi_ds_create_field(union acpi_parse_object *op,
413 /* First arg is the name of the parent op_region (must already exist) */ 481 /* First arg is the name of the parent op_region (must already exist) */
414 482
415 arg = op->common.value.arg; 483 arg = op->common.value.arg;
484
416 if (!region_node) { 485 if (!region_node) {
417 status = 486 status =
418 acpi_ns_lookup(walk_state->scope_info, 487 acpi_ns_lookup(walk_state->scope_info,
419 arg->common.value.name, ACPI_TYPE_REGION, 488 arg->common.value.name, ACPI_TYPE_REGION,
420 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, 489 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
421 walk_state, &region_node); 490 walk_state, &region_node);
491#ifdef ACPI_ASL_COMPILER
492 status = acpi_ds_create_external_region(status, arg,
493 arg->common.value.name,
494 walk_state,
495 &region_node);
496#endif
422 if (ACPI_FAILURE(status)) { 497 if (ACPI_FAILURE(status)) {
423 ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 498 ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
424 return_ACPI_STATUS(status); 499 return_ACPI_STATUS(status);
@@ -446,7 +521,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
446 * 521 *
447 * FUNCTION: acpi_ds_init_field_objects 522 * FUNCTION: acpi_ds_init_field_objects
448 * 523 *
449 * PARAMETERS: Op - Op containing the Field definition and args 524 * PARAMETERS: op - Op containing the Field definition and args
450 * ` walk_state - Current method state 525 * ` walk_state - Current method state
451 * 526 *
452 * RETURN: Status 527 * RETURN: Status
@@ -561,7 +636,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
561 * 636 *
562 * FUNCTION: acpi_ds_create_bank_field 637 * FUNCTION: acpi_ds_create_bank_field
563 * 638 *
564 * PARAMETERS: Op - Op containing the Field definition and args 639 * PARAMETERS: op - Op containing the Field definition and args
565 * region_node - Object for the containing Operation Region 640 * region_node - Object for the containing Operation Region
566 * walk_state - Current method state 641 * walk_state - Current method state
567 * 642 *
@@ -591,6 +666,12 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
591 arg->common.value.name, ACPI_TYPE_REGION, 666 arg->common.value.name, ACPI_TYPE_REGION,
592 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, 667 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
593 walk_state, &region_node); 668 walk_state, &region_node);
669#ifdef ACPI_ASL_COMPILER
670 status = acpi_ds_create_external_region(status, arg,
671 arg->common.value.name,
672 walk_state,
673 &region_node);
674#endif
594 if (ACPI_FAILURE(status)) { 675 if (ACPI_FAILURE(status)) {
595 ACPI_ERROR_NAMESPACE(arg->common.value.name, status); 676 ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
596 return_ACPI_STATUS(status); 677 return_ACPI_STATUS(status);
@@ -645,7 +726,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
645 * 726 *
646 * FUNCTION: acpi_ds_create_index_field 727 * FUNCTION: acpi_ds_create_index_field
647 * 728 *
648 * PARAMETERS: Op - Op containing the Field definition and args 729 * PARAMETERS: op - Op containing the Field definition and args
649 * region_node - Object for the containing Operation Region 730 * region_node - Object for the containing Operation Region
650 * ` walk_state - Current method state 731 * ` walk_state - Current method state
651 * 732 *
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index 9e5ac7f780a7..87eff701ecfa 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -60,8 +60,8 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
60 * FUNCTION: acpi_ds_init_one_object 60 * FUNCTION: acpi_ds_init_one_object
61 * 61 *
62 * PARAMETERS: obj_handle - Node for the object 62 * PARAMETERS: obj_handle - Node for the object
63 * Level - Current nesting level 63 * level - Current nesting level
64 * Context - Points to a init info struct 64 * context - Points to a init info struct
65 * return_value - Not used 65 * return_value - Not used
66 * 66 *
67 * RETURN: Status 67 * RETURN: Status
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 00f5dab5bcc0..aa9a5d4e4052 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -61,7 +61,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc);
61 * 61 *
62 * FUNCTION: acpi_ds_method_error 62 * FUNCTION: acpi_ds_method_error
63 * 63 *
64 * PARAMETERS: Status - Execution status 64 * PARAMETERS: status - Execution status
65 * walk_state - Current state 65 * walk_state - Current state
66 * 66 *
67 * RETURN: Status 67 * RETURN: Status
@@ -306,9 +306,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
306 * 306 *
307 * FUNCTION: acpi_ds_call_control_method 307 * FUNCTION: acpi_ds_call_control_method
308 * 308 *
309 * PARAMETERS: Thread - Info for this thread 309 * PARAMETERS: thread - Info for this thread
310 * this_walk_state - Current walk state 310 * this_walk_state - Current walk state
311 * Op - Current Op to be walked 311 * op - Current Op to be walked
312 * 312 *
313 * RETURN: Status 313 * RETURN: Status
314 * 314 *
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index b40bd507be5d..8d55cebaa656 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -177,7 +177,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
177 * 177 *
178 * FUNCTION: acpi_ds_method_data_init_args 178 * FUNCTION: acpi_ds_method_data_init_args
179 * 179 *
180 * PARAMETERS: *Params - Pointer to a parameter list for the method 180 * PARAMETERS: *params - Pointer to a parameter list for the method
181 * max_param_count - The arg count for this method 181 * max_param_count - The arg count for this method
182 * walk_state - Current walk state object 182 * walk_state - Current walk state object
183 * 183 *
@@ -232,11 +232,11 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
232 * 232 *
233 * FUNCTION: acpi_ds_method_data_get_node 233 * FUNCTION: acpi_ds_method_data_get_node
234 * 234 *
235 * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or 235 * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or
236 * ACPI_REFCLASS_ARG 236 * ACPI_REFCLASS_ARG
237 * Index - Which Local or Arg whose type to get 237 * index - Which Local or Arg whose type to get
238 * walk_state - Current walk state object 238 * walk_state - Current walk state object
239 * Node - Where the node is returned. 239 * node - Where the node is returned.
240 * 240 *
241 * RETURN: Status and node 241 * RETURN: Status and node
242 * 242 *
@@ -296,10 +296,10 @@ acpi_ds_method_data_get_node(u8 type,
296 * 296 *
297 * FUNCTION: acpi_ds_method_data_set_value 297 * FUNCTION: acpi_ds_method_data_set_value
298 * 298 *
299 * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or 299 * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or
300 * ACPI_REFCLASS_ARG 300 * ACPI_REFCLASS_ARG
301 * Index - Which Local or Arg to get 301 * index - Which Local or Arg to get
302 * Object - Object to be inserted into the stack entry 302 * object - Object to be inserted into the stack entry
303 * walk_state - Current walk state object 303 * walk_state - Current walk state object
304 * 304 *
305 * RETURN: Status 305 * RETURN: Status
@@ -336,7 +336,7 @@ acpi_ds_method_data_set_value(u8 type,
336 * Increment ref count so object can't be deleted while installed. 336 * Increment ref count so object can't be deleted while installed.
337 * NOTE: We do not copy the object in order to preserve the call by 337 * NOTE: We do not copy the object in order to preserve the call by
338 * reference semantics of ACPI Control Method invocation. 338 * reference semantics of ACPI Control Method invocation.
339 * (See ACPI Specification 2.0_c) 339 * (See ACPI Specification 2.0C)
340 */ 340 */
341 acpi_ut_add_reference(object); 341 acpi_ut_add_reference(object);
342 342
@@ -350,9 +350,9 @@ acpi_ds_method_data_set_value(u8 type,
350 * 350 *
351 * FUNCTION: acpi_ds_method_data_get_value 351 * FUNCTION: acpi_ds_method_data_get_value
352 * 352 *
353 * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or 353 * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or
354 * ACPI_REFCLASS_ARG 354 * ACPI_REFCLASS_ARG
355 * Index - Which local_var or argument to get 355 * index - Which localVar or argument to get
356 * walk_state - Current walk state object 356 * walk_state - Current walk state object
357 * dest_desc - Where Arg or Local value is returned 357 * dest_desc - Where Arg or Local value is returned
358 * 358 *
@@ -458,9 +458,9 @@ acpi_ds_method_data_get_value(u8 type,
458 * 458 *
459 * FUNCTION: acpi_ds_method_data_delete_value 459 * FUNCTION: acpi_ds_method_data_delete_value
460 * 460 *
461 * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or 461 * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or
462 * ACPI_REFCLASS_ARG 462 * ACPI_REFCLASS_ARG
463 * Index - Which local_var or argument to delete 463 * index - Which localVar or argument to delete
464 * walk_state - Current walk state object 464 * walk_state - Current walk state object
465 * 465 *
466 * RETURN: None 466 * RETURN: None
@@ -515,9 +515,9 @@ acpi_ds_method_data_delete_value(u8 type,
515 * 515 *
516 * FUNCTION: acpi_ds_store_object_to_local 516 * FUNCTION: acpi_ds_store_object_to_local
517 * 517 *
518 * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or 518 * PARAMETERS: type - Either ACPI_REFCLASS_LOCAL or
519 * ACPI_REFCLASS_ARG 519 * ACPI_REFCLASS_ARG
520 * Index - Which Local or Arg to set 520 * index - Which Local or Arg to set
521 * obj_desc - Value to be stored 521 * obj_desc - Value to be stored
522 * walk_state - Current walk state 522 * walk_state - Current walk state
523 * 523 *
@@ -670,8 +670,8 @@ acpi_ds_store_object_to_local(u8 type,
670 * 670 *
671 * FUNCTION: acpi_ds_method_data_get_type 671 * FUNCTION: acpi_ds_method_data_get_type
672 * 672 *
673 * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP 673 * PARAMETERS: opcode - Either AML_LOCAL_OP or AML_ARG_OP
674 * Index - Which Local or Arg whose type to get 674 * index - Which Local or Arg whose type to get
675 * walk_state - Current walk state object 675 * walk_state - Current walk state object
676 * 676 *
677 * RETURN: Data type of current value of the selected Arg or Local 677 * RETURN: Data type of current value of the selected Arg or Local
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index d7045ca3e32a..68592dd34960 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -64,7 +64,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
64 * FUNCTION: acpi_ds_build_internal_object 64 * FUNCTION: acpi_ds_build_internal_object
65 * 65 *
66 * PARAMETERS: walk_state - Current walk state 66 * PARAMETERS: walk_state - Current walk state
67 * Op - Parser object to be translated 67 * op - Parser object to be translated
68 * obj_desc_ptr - Where the ACPI internal object is returned 68 * obj_desc_ptr - Where the ACPI internal object is returned
69 * 69 *
70 * RETURN: Status 70 * RETURN: Status
@@ -250,7 +250,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
250 * FUNCTION: acpi_ds_build_internal_buffer_obj 250 * FUNCTION: acpi_ds_build_internal_buffer_obj
251 * 251 *
252 * PARAMETERS: walk_state - Current walk state 252 * PARAMETERS: walk_state - Current walk state
253 * Op - Parser object to be translated 253 * op - Parser object to be translated
254 * buffer_length - Length of the buffer 254 * buffer_length - Length of the buffer
255 * obj_desc_ptr - Where the ACPI internal object is returned 255 * obj_desc_ptr - Where the ACPI internal object is returned
256 * 256 *
@@ -354,7 +354,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
354 * FUNCTION: acpi_ds_build_internal_package_obj 354 * FUNCTION: acpi_ds_build_internal_package_obj
355 * 355 *
356 * PARAMETERS: walk_state - Current walk state 356 * PARAMETERS: walk_state - Current walk state
357 * Op - Parser object to be translated 357 * op - Parser object to be translated
358 * element_count - Number of elements in the package - this is 358 * element_count - Number of elements in the package - this is
359 * the num_elements argument to Package() 359 * the num_elements argument to Package()
360 * obj_desc_ptr - Where the ACPI internal object is returned 360 * obj_desc_ptr - Where the ACPI internal object is returned
@@ -547,8 +547,8 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
547 * FUNCTION: acpi_ds_create_node 547 * FUNCTION: acpi_ds_create_node
548 * 548 *
549 * PARAMETERS: walk_state - Current walk state 549 * PARAMETERS: walk_state - Current walk state
550 * Node - NS Node to be initialized 550 * node - NS Node to be initialized
551 * Op - Parser object to be translated 551 * op - Parser object to be translated
552 * 552 *
553 * RETURN: Status 553 * RETURN: Status
554 * 554 *
@@ -611,8 +611,8 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
611 * FUNCTION: acpi_ds_init_object_from_op 611 * FUNCTION: acpi_ds_init_object_from_op
612 * 612 *
613 * PARAMETERS: walk_state - Current walk state 613 * PARAMETERS: walk_state - Current walk state
614 * Op - Parser op used to init the internal object 614 * op - Parser op used to init the internal object
615 * Opcode - AML opcode associated with the object 615 * opcode - AML opcode associated with the object
616 * ret_obj_desc - Namespace object to be initialized 616 * ret_obj_desc - Namespace object to be initialized
617 * 617 *
618 * RETURN: Status 618 * RETURN: Status
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index e5eff7585102..aa34d8984d34 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -286,7 +286,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
286 * FUNCTION: acpi_ds_eval_buffer_field_operands 286 * FUNCTION: acpi_ds_eval_buffer_field_operands
287 * 287 *
288 * PARAMETERS: walk_state - Current walk 288 * PARAMETERS: walk_state - Current walk
289 * Op - A valid buffer_field Op object 289 * op - A valid buffer_field Op object
290 * 290 *
291 * RETURN: Status 291 * RETURN: Status
292 * 292 *
@@ -370,7 +370,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
370 * FUNCTION: acpi_ds_eval_region_operands 370 * FUNCTION: acpi_ds_eval_region_operands
371 * 371 *
372 * PARAMETERS: walk_state - Current walk 372 * PARAMETERS: walk_state - Current walk
373 * Op - A valid region Op object 373 * op - A valid region Op object
374 * 374 *
375 * RETURN: Status 375 * RETURN: Status
376 * 376 *
@@ -397,7 +397,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
397 */ 397 */
398 node = op->common.node; 398 node = op->common.node;
399 399
400 /* next_op points to the op that holds the space_iD */ 400 /* next_op points to the op that holds the space_ID */
401 401
402 next_op = op->common.value.arg; 402 next_op = op->common.value.arg;
403 403
@@ -461,7 +461,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
461 * FUNCTION: acpi_ds_eval_table_region_operands 461 * FUNCTION: acpi_ds_eval_table_region_operands
462 * 462 *
463 * PARAMETERS: walk_state - Current walk 463 * PARAMETERS: walk_state - Current walk
464 * Op - A valid region Op object 464 * op - A valid region Op object
465 * 465 *
466 * RETURN: Status 466 * RETURN: Status
467 * 467 *
@@ -560,7 +560,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
560 * FUNCTION: acpi_ds_eval_data_object_operands 560 * FUNCTION: acpi_ds_eval_data_object_operands
561 * 561 *
562 * PARAMETERS: walk_state - Current walk 562 * PARAMETERS: walk_state - Current walk
563 * Op - A valid data_object Op object 563 * op - A valid data_object Op object
564 * obj_desc - data_object 564 * obj_desc - data_object
565 * 565 *
566 * RETURN: Status 566 * RETURN: Status
@@ -662,7 +662,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
662 * FUNCTION: acpi_ds_eval_bank_field_operands 662 * FUNCTION: acpi_ds_eval_bank_field_operands
663 * 663 *
664 * PARAMETERS: walk_state - Current walk 664 * PARAMETERS: walk_state - Current walk
665 * Op - A valid bank_field Op object 665 * op - A valid bank_field Op object
666 * 666 *
667 * RETURN: Status 667 * RETURN: Status
668 * 668 *
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 1abcda31037f..73a5447475f5 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -157,7 +157,7 @@ acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
157 * 157 *
158 * FUNCTION: acpi_ds_is_result_used 158 * FUNCTION: acpi_ds_is_result_used
159 * 159 *
160 * PARAMETERS: Op - Current Op 160 * PARAMETERS: op - Current Op
161 * walk_state - Current State 161 * walk_state - Current State
162 * 162 *
163 * RETURN: TRUE if result is used, FALSE otherwise 163 * RETURN: TRUE if result is used, FALSE otherwise
@@ -323,7 +323,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
323 * 323 *
324 * FUNCTION: acpi_ds_delete_result_if_not_used 324 * FUNCTION: acpi_ds_delete_result_if_not_used
325 * 325 *
326 * PARAMETERS: Op - Current parse Op 326 * PARAMETERS: op - Current parse Op
327 * result_obj - Result of the operation 327 * result_obj - Result of the operation
328 * walk_state - Current state 328 * walk_state - Current state
329 * 329 *
@@ -445,7 +445,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
445 * FUNCTION: acpi_ds_create_operand 445 * FUNCTION: acpi_ds_create_operand
446 * 446 *
447 * PARAMETERS: walk_state - Current walk state 447 * PARAMETERS: walk_state - Current walk state
448 * Arg - Parse object for the argument 448 * arg - Parse object for the argument
449 * arg_index - Which argument (zero based) 449 * arg_index - Which argument (zero based)
450 * 450 *
451 * RETURN: Status 451 * RETURN: Status
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c
index 9e9490a9cbf0..f6c4295470ae 100644
--- a/drivers/acpi/acpica/dswscope.c
+++ b/drivers/acpi/acpica/dswscope.c
@@ -85,8 +85,8 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state)
85 * 85 *
86 * FUNCTION: acpi_ds_scope_stack_push 86 * FUNCTION: acpi_ds_scope_stack_push
87 * 87 *
88 * PARAMETERS: Node - Name to be made current 88 * PARAMETERS: node - Name to be made current
89 * Type - Type of frame being pushed 89 * type - Type of frame being pushed
90 * walk_state - Current state 90 * walk_state - Current state
91 * 91 *
92 * RETURN: Status 92 * RETURN: Status
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c
index c9c2ac13e7cc..d0e6555061e4 100644
--- a/drivers/acpi/acpica/dswstate.c
+++ b/drivers/acpi/acpica/dswstate.c
@@ -58,7 +58,7 @@ static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *ws);
58 * 58 *
59 * FUNCTION: acpi_ds_result_pop 59 * FUNCTION: acpi_ds_result_pop
60 * 60 *
61 * PARAMETERS: Object - Where to return the popped object 61 * PARAMETERS: object - Where to return the popped object
62 * walk_state - Current Walk state 62 * walk_state - Current Walk state
63 * 63 *
64 * RETURN: Status 64 * RETURN: Status
@@ -132,7 +132,7 @@ acpi_ds_result_pop(union acpi_operand_object **object,
132 * 132 *
133 * FUNCTION: acpi_ds_result_push 133 * FUNCTION: acpi_ds_result_push
134 * 134 *
135 * PARAMETERS: Object - Where to return the popped object 135 * PARAMETERS: object - Where to return the popped object
136 * walk_state - Current Walk state 136 * walk_state - Current Walk state
137 * 137 *
138 * RETURN: Status 138 * RETURN: Status
@@ -296,7 +296,7 @@ static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state)
296 * 296 *
297 * FUNCTION: acpi_ds_obj_stack_push 297 * FUNCTION: acpi_ds_obj_stack_push
298 * 298 *
299 * PARAMETERS: Object - Object to push 299 * PARAMETERS: object - Object to push
300 * walk_state - Current Walk state 300 * walk_state - Current Walk state
301 * 301 *
302 * RETURN: Status 302 * RETURN: Status
@@ -433,7 +433,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
433 * 433 *
434 * FUNCTION: acpi_ds_get_current_walk_state 434 * FUNCTION: acpi_ds_get_current_walk_state
435 * 435 *
436 * PARAMETERS: Thread - Get current active state for this Thread 436 * PARAMETERS: thread - Get current active state for this Thread
437 * 437 *
438 * RETURN: Pointer to the current walk state 438 * RETURN: Pointer to the current walk state
439 * 439 *
@@ -462,7 +462,7 @@ struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
462 * FUNCTION: acpi_ds_push_walk_state 462 * FUNCTION: acpi_ds_push_walk_state
463 * 463 *
464 * PARAMETERS: walk_state - State to push 464 * PARAMETERS: walk_state - State to push
465 * Thread - Thread state object 465 * thread - Thread state object
466 * 466 *
467 * RETURN: None 467 * RETURN: None
468 * 468 *
@@ -486,7 +486,7 @@ acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
486 * 486 *
487 * FUNCTION: acpi_ds_pop_walk_state 487 * FUNCTION: acpi_ds_pop_walk_state
488 * 488 *
489 * PARAMETERS: Thread - Current thread state 489 * PARAMETERS: thread - Current thread state
490 * 490 *
491 * RETURN: A walk_state object popped from the thread's stack 491 * RETURN: A walk_state object popped from the thread's stack
492 * 492 *
@@ -525,9 +525,9 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
525 * FUNCTION: acpi_ds_create_walk_state 525 * FUNCTION: acpi_ds_create_walk_state
526 * 526 *
527 * PARAMETERS: owner_id - ID for object creation 527 * PARAMETERS: owner_id - ID for object creation
528 * Origin - Starting point for this walk 528 * origin - Starting point for this walk
529 * method_desc - Method object 529 * method_desc - Method object
530 * Thread - Current thread state 530 * thread - Current thread state
531 * 531 *
532 * RETURN: Pointer to the new walk state. 532 * RETURN: Pointer to the new walk state.
533 * 533 *
@@ -578,11 +578,11 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union
578 * FUNCTION: acpi_ds_init_aml_walk 578 * FUNCTION: acpi_ds_init_aml_walk
579 * 579 *
580 * PARAMETERS: walk_state - New state to be initialized 580 * PARAMETERS: walk_state - New state to be initialized
581 * Op - Current parse op 581 * op - Current parse op
582 * method_node - Control method NS node, if any 582 * method_node - Control method NS node, if any
583 * aml_start - Start of AML 583 * aml_start - Start of AML
584 * aml_length - Length of AML 584 * aml_length - Length of AML
585 * Info - Method info block (params, etc.) 585 * info - Method info block (params, etc.)
586 * pass_number - 1, 2, or 3 586 * pass_number - 1, 2, or 3
587 * 587 *
588 * RETURN: Status 588 * RETURN: Status
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c
index 07e4dc44f81c..d4acfbbe5b29 100644
--- a/drivers/acpi/acpica/evevent.c
+++ b/drivers/acpi/acpica/evevent.c
@@ -251,7 +251,7 @@ u32 acpi_ev_fixed_event_detect(void)
251 * 251 *
252 * FUNCTION: acpi_ev_fixed_event_dispatch 252 * FUNCTION: acpi_ev_fixed_event_dispatch
253 * 253 *
254 * PARAMETERS: Event - Event type 254 * PARAMETERS: event - Event type
255 * 255 *
256 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED 256 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
257 * 257 *
diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c
index cfeab38795d8..af14a7137632 100644
--- a/drivers/acpi/acpica/evglock.c
+++ b/drivers/acpi/acpica/evglock.c
@@ -135,7 +135,7 @@ acpi_status acpi_ev_remove_global_lock_handler(void)
135 * 135 *
136 * FUNCTION: acpi_ev_global_lock_handler 136 * FUNCTION: acpi_ev_global_lock_handler
137 * 137 *
138 * PARAMETERS: Context - From thread interface, not used 138 * PARAMETERS: context - From thread interface, not used
139 * 139 *
140 * RETURN: ACPI_INTERRUPT_HANDLED 140 * RETURN: ACPI_INTERRUPT_HANDLED
141 * 141 *
@@ -182,7 +182,7 @@ static u32 acpi_ev_global_lock_handler(void *context)
182 * 182 *
183 * FUNCTION: acpi_ev_acquire_global_lock 183 * FUNCTION: acpi_ev_acquire_global_lock
184 * 184 *
185 * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. 185 * PARAMETERS: timeout - Max time to wait for the lock, in millisec.
186 * 186 *
187 * RETURN: Status 187 * RETURN: Status
188 * 188 *
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index 8ba0e5f17091..afbd5cb391f6 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -466,7 +466,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
466 acpi_status status; 466 acpi_status status;
467 struct acpi_gpe_event_info *local_gpe_event_info; 467 struct acpi_gpe_event_info *local_gpe_event_info;
468 struct acpi_evaluate_info *info; 468 struct acpi_evaluate_info *info;
469 struct acpi_gpe_notify_object *notify_object; 469 struct acpi_gpe_notify_info *notify;
470 470
471 ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); 471 ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method);
472 472
@@ -517,17 +517,17 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
517 * completes. The notify handlers are NOT invoked synchronously 517 * completes. The notify handlers are NOT invoked synchronously
518 * from this thread -- because handlers may in turn run other 518 * from this thread -- because handlers may in turn run other
519 * control methods. 519 * control methods.
520 *
521 * June 2012: Expand implicit notify mechanism to support
522 * notifies on multiple device objects.
520 */ 523 */
521 status = acpi_ev_queue_notify_request( 524 notify = local_gpe_event_info->dispatch.notify_list;
522 local_gpe_event_info->dispatch.device.node, 525 while (ACPI_SUCCESS(status) && notify) {
523 ACPI_NOTIFY_DEVICE_WAKE); 526 status =
524 527 acpi_ev_queue_notify_request(notify->device_node,
525 notify_object = local_gpe_event_info->dispatch.device.next; 528 ACPI_NOTIFY_DEVICE_WAKE);
526 while (ACPI_SUCCESS(status) && notify_object) { 529
527 status = acpi_ev_queue_notify_request( 530 notify = notify->next;
528 notify_object->node,
529 ACPI_NOTIFY_DEVICE_WAKE);
530 notify_object = notify_object->next;
531 } 531 }
532 532
533 break; 533 break;
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 23a3ca86b2eb..8cf4c104c7b7 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -318,7 +318,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
318 * FUNCTION: acpi_ev_create_gpe_block 318 * FUNCTION: acpi_ev_create_gpe_block
319 * 319 *
320 * PARAMETERS: gpe_device - Handle to the parent GPE block 320 * PARAMETERS: gpe_device - Handle to the parent GPE block
321 * gpe_block_address - Address and space_iD 321 * gpe_block_address - Address and space_ID
322 * register_count - Number of GPE register pairs in the block 322 * register_count - Number of GPE register pairs in the block
323 * gpe_block_base_number - Starting GPE number for the block 323 * gpe_block_base_number - Starting GPE number for the block
324 * interrupt_number - H/W interrupt for the block 324 * interrupt_number - H/W interrupt for the block
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 3c43796b8361..cb50dd91bc18 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("evgpeutil")
54 * FUNCTION: acpi_ev_walk_gpe_list 54 * FUNCTION: acpi_ev_walk_gpe_list
55 * 55 *
56 * PARAMETERS: gpe_walk_callback - Routine called for each GPE block 56 * PARAMETERS: gpe_walk_callback - Routine called for each GPE block
57 * Context - Value passed to callback 57 * context - Value passed to callback
58 * 58 *
59 * RETURN: Status 59 * RETURN: Status
60 * 60 *
@@ -347,6 +347,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
347 void *context) 347 void *context)
348{ 348{
349 struct acpi_gpe_event_info *gpe_event_info; 349 struct acpi_gpe_event_info *gpe_event_info;
350 struct acpi_gpe_notify_info *notify;
351 struct acpi_gpe_notify_info *next;
350 u32 i; 352 u32 i;
351 u32 j; 353 u32 j;
352 354
@@ -365,10 +367,28 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
365 367
366 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 368 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
367 ACPI_GPE_DISPATCH_HANDLER) { 369 ACPI_GPE_DISPATCH_HANDLER) {
370
371 /* Delete an installed handler block */
372
368 ACPI_FREE(gpe_event_info->dispatch.handler); 373 ACPI_FREE(gpe_event_info->dispatch.handler);
369 gpe_event_info->dispatch.handler = NULL; 374 gpe_event_info->dispatch.handler = NULL;
370 gpe_event_info->flags &= 375 gpe_event_info->flags &=
371 ~ACPI_GPE_DISPATCH_MASK; 376 ~ACPI_GPE_DISPATCH_MASK;
377 } else if ((gpe_event_info->
378 flags & ACPI_GPE_DISPATCH_MASK) ==
379 ACPI_GPE_DISPATCH_NOTIFY) {
380
381 /* Delete the implicit notification device list */
382
383 notify = gpe_event_info->dispatch.notify_list;
384 while (notify) {
385 next = notify->next;
386 ACPI_FREE(notify);
387 notify = next;
388 }
389 gpe_event_info->dispatch.notify_list = NULL;
390 gpe_event_info->flags &=
391 ~ACPI_GPE_DISPATCH_MASK;
372 } 392 }
373 } 393 }
374 } 394 }
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index 51ef9f5e002d..51f537937c1f 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -56,7 +56,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
56 * 56 *
57 * FUNCTION: acpi_ev_is_notify_object 57 * FUNCTION: acpi_ev_is_notify_object
58 * 58 *
59 * PARAMETERS: Node - Node to check 59 * PARAMETERS: node - Node to check
60 * 60 *
61 * RETURN: TRUE if notifies allowed on this object 61 * RETURN: TRUE if notifies allowed on this object
62 * 62 *
@@ -86,7 +86,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
86 * 86 *
87 * FUNCTION: acpi_ev_queue_notify_request 87 * FUNCTION: acpi_ev_queue_notify_request
88 * 88 *
89 * PARAMETERS: Node - NS node for the notified object 89 * PARAMETERS: node - NS node for the notified object
90 * notify_value - Value from the Notify() request 90 * notify_value - Value from the Notify() request
91 * 91 *
92 * RETURN: Status 92 * RETURN: Status
@@ -101,102 +101,77 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
101 u32 notify_value) 101 u32 notify_value)
102{ 102{
103 union acpi_operand_object *obj_desc; 103 union acpi_operand_object *obj_desc;
104 union acpi_operand_object *handler_obj = NULL; 104 union acpi_operand_object *handler_list_head = NULL;
105 union acpi_generic_state *notify_info; 105 union acpi_generic_state *info;
106 u8 handler_list_id = 0;
106 acpi_status status = AE_OK; 107 acpi_status status = AE_OK;
107 108
108 ACPI_FUNCTION_NAME(ev_queue_notify_request); 109 ACPI_FUNCTION_NAME(ev_queue_notify_request);
109 110
110 /* 111 /* Are Notifies allowed on this object? */
111 * For value 0x03 (Ejection Request), may need to run a device method.
112 * For value 0x02 (Device Wake), if _PRW exists, may need to run
113 * the _PS0 method.
114 * For value 0x80 (Status Change) on the power button or sleep button,
115 * initiate soft-off or sleep operation.
116 *
117 * For all cases, simply dispatch the notify to the handler.
118 */
119 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
120 "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
121 acpi_ut_get_node_name(node),
122 acpi_ut_get_type_name(node->type), notify_value,
123 acpi_ut_get_notify_name(notify_value), node));
124 112
125 /* Get the notify object attached to the NS Node */ 113 if (!acpi_ev_is_notify_object(node)) {
126 114 return (AE_TYPE);
127 obj_desc = acpi_ns_get_attached_object(node); 115 }
128 if (obj_desc) {
129
130 /* We have the notify object, Get the correct handler */
131
132 switch (node->type) {
133 116
134 /* Notify is allowed only on these types */ 117 /* Get the correct notify list type (System or Device) */
135 118
136 case ACPI_TYPE_DEVICE: 119 if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
137 case ACPI_TYPE_THERMAL: 120 handler_list_id = ACPI_SYSTEM_HANDLER_LIST;
138 case ACPI_TYPE_PROCESSOR: 121 } else {
122 handler_list_id = ACPI_DEVICE_HANDLER_LIST;
123 }
139 124
140 if (notify_value <= ACPI_MAX_SYS_NOTIFY) { 125 /* Get the notify object attached to the namespace Node */
141 handler_obj =
142 obj_desc->common_notify.system_notify;
143 } else {
144 handler_obj =
145 obj_desc->common_notify.device_notify;
146 }
147 break;
148 126
149 default: 127 obj_desc = acpi_ns_get_attached_object(node);
128 if (obj_desc) {
150 129
151 /* All other types are not supported */ 130 /* We have an attached object, Get the correct handler list */
152 131
153 return (AE_TYPE); 132 handler_list_head =
154 } 133 obj_desc->common_notify.notify_list[handler_list_id];
155 } 134 }
156 135
157 /* 136 /*
158 * If there is a handler to run, schedule the dispatcher. 137 * If there is no notify handler (Global or Local)
159 * Check for: 138 * for this object, just ignore the notify
160 * 1) Global system notify handler
161 * 2) Global device notify handler
162 * 3) Per-device notify handler
163 */ 139 */
164 if ((acpi_gbl_system_notify.handler && 140 if (!acpi_gbl_global_notify[handler_list_id].handler
165 (notify_value <= ACPI_MAX_SYS_NOTIFY)) || 141 && !handler_list_head) {
166 (acpi_gbl_device_notify.handler && 142 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
167 (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) { 143 "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n",
168 notify_info = acpi_ut_create_generic_state(); 144 acpi_ut_get_node_name(node), notify_value,
169 if (!notify_info) { 145 node));
170 return (AE_NO_MEMORY);
171 }
172 146
173 if (!handler_obj) { 147 return (AE_OK);
174 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 148 }
175 "Executing system notify handler for Notify (%4.4s, %X) "
176 "node %p\n",
177 acpi_ut_get_node_name(node),
178 notify_value, node));
179 }
180 149
181 notify_info->common.descriptor_type = 150 /* Setup notify info and schedule the notify dispatcher */
182 ACPI_DESC_TYPE_STATE_NOTIFY;
183 notify_info->notify.node = node;
184 notify_info->notify.value = (u16) notify_value;
185 notify_info->notify.handler_obj = handler_obj;
186 151
187 status = 152 info = acpi_ut_create_generic_state();
188 acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, 153 if (!info) {
189 notify_info); 154 return (AE_NO_MEMORY);
190 if (ACPI_FAILURE(status)) { 155 }
191 acpi_ut_delete_generic_state(notify_info);
192 }
193 } else {
194 /* There is no notify handler (per-device or system) for this device */
195 156
196 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 157 info->common.descriptor_type = ACPI_DESC_TYPE_STATE_NOTIFY;
197 "No notify handler for Notify (%4.4s, %X) node %p\n", 158
198 acpi_ut_get_node_name(node), notify_value, 159 info->notify.node = node;
199 node)); 160 info->notify.value = (u16)notify_value;
161 info->notify.handler_list_id = handler_list_id;
162 info->notify.handler_list_head = handler_list_head;
163 info->notify.global = &acpi_gbl_global_notify[handler_list_id];
164
165 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
166 "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
167 acpi_ut_get_node_name(node),
168 acpi_ut_get_type_name(node->type), notify_value,
169 acpi_ut_get_notify_name(notify_value), node));
170
171 status = acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch,
172 info);
173 if (ACPI_FAILURE(status)) {
174 acpi_ut_delete_generic_state(info);
200 } 175 }
201 176
202 return (status); 177 return (status);
@@ -206,7 +181,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
206 * 181 *
207 * FUNCTION: acpi_ev_notify_dispatch 182 * FUNCTION: acpi_ev_notify_dispatch
208 * 183 *
209 * PARAMETERS: Context - To be passed to the notify handler 184 * PARAMETERS: context - To be passed to the notify handler
210 * 185 *
211 * RETURN: None. 186 * RETURN: None.
212 * 187 *
@@ -217,60 +192,34 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
217 192
218static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) 193static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
219{ 194{
220 union acpi_generic_state *notify_info = 195 union acpi_generic_state *info = (union acpi_generic_state *)context;
221 (union acpi_generic_state *)context;
222 acpi_notify_handler global_handler = NULL;
223 void *global_context = NULL;
224 union acpi_operand_object *handler_obj; 196 union acpi_operand_object *handler_obj;
225 197
226 ACPI_FUNCTION_ENTRY(); 198 ACPI_FUNCTION_ENTRY();
227 199
228 /* 200 /* Invoke a global notify handler if installed */
229 * We will invoke a global notify handler if installed. This is done
230 * _before_ we invoke the per-device handler attached to the device.
231 */
232 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
233
234 /* Global system notification handler */
235
236 if (acpi_gbl_system_notify.handler) {
237 global_handler = acpi_gbl_system_notify.handler;
238 global_context = acpi_gbl_system_notify.context;
239 }
240 } else {
241 /* Global driver notification handler */
242
243 if (acpi_gbl_device_notify.handler) {
244 global_handler = acpi_gbl_device_notify.handler;
245 global_context = acpi_gbl_device_notify.context;
246 }
247 }
248
249 /* Invoke the system handler first, if present */
250 201
251 if (global_handler) { 202 if (info->notify.global->handler) {
252 global_handler(notify_info->notify.node, 203 info->notify.global->handler(info->notify.node,
253 notify_info->notify.value, global_context); 204 info->notify.value,
205 info->notify.global->context);
254 } 206 }
255 207
256 /* Now invoke the per-device handler, if present */ 208 /* Now invoke the local notify handler(s) if any are installed */
257 209
258 handler_obj = notify_info->notify.handler_obj; 210 handler_obj = info->notify.handler_list_head;
259 if (handler_obj) { 211 while (handler_obj) {
260 struct acpi_object_notify_handler *notifier; 212 handler_obj->notify.handler(info->notify.node,
213 info->notify.value,
214 handler_obj->notify.context);
261 215
262 notifier = &handler_obj->notify; 216 handler_obj =
263 while (notifier) { 217 handler_obj->notify.next[info->notify.handler_list_id];
264 notifier->handler(notify_info->notify.node,
265 notify_info->notify.value,
266 notifier->context);
267 notifier = notifier->next;
268 }
269 } 218 }
270 219
271 /* All done with the info object */ 220 /* All done with the info object */
272 221
273 acpi_ut_delete_generic_state(notify_info); 222 acpi_ut_delete_generic_state(info);
274} 223}
275 224
276#if (!ACPI_REDUCED_HARDWARE) 225#if (!ACPI_REDUCED_HARDWARE)
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 1b0180a1b798..0cc6a16fedc7 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -150,7 +150,7 @@ acpi_status acpi_ev_install_region_handlers(void)
150 * 150 *
151 * FUNCTION: acpi_ev_has_default_handler 151 * FUNCTION: acpi_ev_has_default_handler
152 * 152 *
153 * PARAMETERS: Node - Namespace node for the device 153 * PARAMETERS: node - Namespace node for the device
154 * space_id - The address space ID 154 * space_id - The address space ID
155 * 155 *
156 * RETURN: TRUE if default handler is installed, FALSE otherwise 156 * RETURN: TRUE if default handler is installed, FALSE otherwise
@@ -244,7 +244,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
244 * FUNCTION: acpi_ev_execute_reg_method 244 * FUNCTION: acpi_ev_execute_reg_method
245 * 245 *
246 * PARAMETERS: region_obj - Region object 246 * PARAMETERS: region_obj - Region object
247 * Function - Passed to _REG: On (1) or Off (0) 247 * function - Passed to _REG: On (1) or Off (0)
248 * 248 *
249 * RETURN: Status 249 * RETURN: Status
250 * 250 *
@@ -286,10 +286,10 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
286 /* 286 /*
287 * The _REG method has two arguments: 287 * The _REG method has two arguments:
288 * 288 *
289 * Arg0 - Integer: 289 * arg0 - Integer:
290 * Operation region space ID Same value as region_obj->Region.space_id 290 * Operation region space ID Same value as region_obj->Region.space_id
291 * 291 *
292 * Arg1 - Integer: 292 * arg1 - Integer:
293 * connection status 1 for connecting the handler, 0 for disconnecting 293 * connection status 1 for connecting the handler, 0 for disconnecting
294 * the handler (Passed as a parameter) 294 * the handler (Passed as a parameter)
295 */ 295 */
@@ -330,10 +330,10 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
330 * 330 *
331 * PARAMETERS: region_obj - Internal region object 331 * PARAMETERS: region_obj - Internal region object
332 * field_obj - Corresponding field. Can be NULL. 332 * field_obj - Corresponding field. Can be NULL.
333 * Function - Read or Write operation 333 * function - Read or Write operation
334 * region_offset - Where in the region to read or write 334 * region_offset - Where in the region to read or write
335 * bit_width - Field width in bits (8, 16, 32, or 64) 335 * bit_width - Field width in bits (8, 16, 32, or 64)
336 * Value - Pointer to in or out value, must be 336 * value - Pointer to in or out value, must be
337 * a full 64-bit integer 337 * a full 64-bit integer
338 * 338 *
339 * RETURN: Status 339 * RETURN: Status
@@ -840,11 +840,11 @@ acpi_ev_install_handler(acpi_handle obj_handle,
840 * 840 *
841 * FUNCTION: acpi_ev_install_space_handler 841 * FUNCTION: acpi_ev_install_space_handler
842 * 842 *
843 * PARAMETERS: Node - Namespace node for the device 843 * PARAMETERS: node - Namespace node for the device
844 * space_id - The address space ID 844 * space_id - The address space ID
845 * Handler - Address of the handler 845 * handler - Address of the handler
846 * Setup - Address of the setup function 846 * setup - Address of the setup function
847 * Context - Value passed to the handler on each access 847 * context - Value passed to the handler on each access
848 * 848 *
849 * RETURN: Status 849 * RETURN: Status
850 * 850 *
@@ -1061,7 +1061,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
1061 * 1061 *
1062 * FUNCTION: acpi_ev_execute_reg_methods 1062 * FUNCTION: acpi_ev_execute_reg_methods
1063 * 1063 *
1064 * PARAMETERS: Node - Namespace node for the device 1064 * PARAMETERS: node - Namespace node for the device
1065 * space_id - The address space ID 1065 * space_id - The address space ID
1066 * 1066 *
1067 * RETURN: Status 1067 * RETURN: Status
@@ -1104,7 +1104,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
1104 * 1104 *
1105 * PARAMETERS: walk_namespace callback 1105 * PARAMETERS: walk_namespace callback
1106 * 1106 *
1107 * DESCRIPTION: Run _REG method for region objects of the requested space_iD 1107 * DESCRIPTION: Run _REG method for region objects of the requested spaceID
1108 * 1108 *
1109 ******************************************************************************/ 1109 ******************************************************************************/
1110 1110
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 819c17f5897a..4c1c8261166f 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -56,8 +56,8 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
56 * 56 *
57 * FUNCTION: acpi_ev_system_memory_region_setup 57 * FUNCTION: acpi_ev_system_memory_region_setup
58 * 58 *
59 * PARAMETERS: Handle - Region we are interested in 59 * PARAMETERS: handle - Region we are interested in
60 * Function - Start or stop 60 * function - Start or stop
61 * handler_context - Address space handler context 61 * handler_context - Address space handler context
62 * region_context - Region specific context 62 * region_context - Region specific context
63 * 63 *
@@ -118,8 +118,8 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
118 * 118 *
119 * FUNCTION: acpi_ev_io_space_region_setup 119 * FUNCTION: acpi_ev_io_space_region_setup
120 * 120 *
121 * PARAMETERS: Handle - Region we are interested in 121 * PARAMETERS: handle - Region we are interested in
122 * Function - Start or stop 122 * function - Start or stop
123 * handler_context - Address space handler context 123 * handler_context - Address space handler context
124 * region_context - Region specific context 124 * region_context - Region specific context
125 * 125 *
@@ -149,8 +149,8 @@ acpi_ev_io_space_region_setup(acpi_handle handle,
149 * 149 *
150 * FUNCTION: acpi_ev_pci_config_region_setup 150 * FUNCTION: acpi_ev_pci_config_region_setup
151 * 151 *
152 * PARAMETERS: Handle - Region we are interested in 152 * PARAMETERS: handle - Region we are interested in
153 * Function - Start or stop 153 * function - Start or stop
154 * handler_context - Address space handler context 154 * handler_context - Address space handler context
155 * region_context - Region specific context 155 * region_context - Region specific context
156 * 156 *
@@ -338,7 +338,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
338 * 338 *
339 * FUNCTION: acpi_ev_is_pci_root_bridge 339 * FUNCTION: acpi_ev_is_pci_root_bridge
340 * 340 *
341 * PARAMETERS: Node - Device node being examined 341 * PARAMETERS: node - Device node being examined
342 * 342 *
343 * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge 343 * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
344 * 344 *
@@ -393,14 +393,14 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
393 * 393 *
394 * FUNCTION: acpi_ev_pci_bar_region_setup 394 * FUNCTION: acpi_ev_pci_bar_region_setup
395 * 395 *
396 * PARAMETERS: Handle - Region we are interested in 396 * PARAMETERS: handle - Region we are interested in
397 * Function - Start or stop 397 * function - Start or stop
398 * handler_context - Address space handler context 398 * handler_context - Address space handler context
399 * region_context - Region specific context 399 * region_context - Region specific context
400 * 400 *
401 * RETURN: Status 401 * RETURN: Status
402 * 402 *
403 * DESCRIPTION: Setup a pci_bAR operation region 403 * DESCRIPTION: Setup a pci_BAR operation region
404 * 404 *
405 * MUTEX: Assumes namespace is not locked 405 * MUTEX: Assumes namespace is not locked
406 * 406 *
@@ -420,8 +420,8 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle,
420 * 420 *
421 * FUNCTION: acpi_ev_cmos_region_setup 421 * FUNCTION: acpi_ev_cmos_region_setup
422 * 422 *
423 * PARAMETERS: Handle - Region we are interested in 423 * PARAMETERS: handle - Region we are interested in
424 * Function - Start or stop 424 * function - Start or stop
425 * handler_context - Address space handler context 425 * handler_context - Address space handler context
426 * region_context - Region specific context 426 * region_context - Region specific context
427 * 427 *
@@ -447,8 +447,8 @@ acpi_ev_cmos_region_setup(acpi_handle handle,
447 * 447 *
448 * FUNCTION: acpi_ev_default_region_setup 448 * FUNCTION: acpi_ev_default_region_setup
449 * 449 *
450 * PARAMETERS: Handle - Region we are interested in 450 * PARAMETERS: handle - Region we are interested in
451 * Function - Start or stop 451 * function - Start or stop
452 * handler_context - Address space handler context 452 * handler_context - Address space handler context
453 * region_context - Region specific context 453 * region_context - Region specific context
454 * 454 *
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c
index 6a57aa2d70d1..f9661e2b46a9 100644
--- a/drivers/acpi/acpica/evsci.c
+++ b/drivers/acpi/acpica/evsci.c
@@ -56,7 +56,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
56 * 56 *
57 * FUNCTION: acpi_ev_sci_xrupt_handler 57 * FUNCTION: acpi_ev_sci_xrupt_handler
58 * 58 *
59 * PARAMETERS: Context - Calling Context 59 * PARAMETERS: context - Calling Context
60 * 60 *
61 * RETURN: Status code indicates whether interrupt was handled. 61 * RETURN: Status code indicates whether interrupt was handled.
62 * 62 *
@@ -96,7 +96,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
96 * 96 *
97 * FUNCTION: acpi_ev_gpe_xrupt_handler 97 * FUNCTION: acpi_ev_gpe_xrupt_handler
98 * 98 *
99 * PARAMETERS: Context - Calling Context 99 * PARAMETERS: context - Calling Context
100 * 100 *
101 * RETURN: Status code indicates whether interrupt was handled. 101 * RETURN: Status code indicates whether interrupt was handled.
102 * 102 *
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 44bef5744ebb..7587eb6c9584 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -54,86 +54,25 @@ ACPI_MODULE_NAME("evxface")
54 54
55/******************************************************************************* 55/*******************************************************************************
56 * 56 *
57 * FUNCTION: acpi_populate_handler_object
58 *
59 * PARAMETERS: handler_obj - Handler object to populate
60 * handler_type - The type of handler:
61 * ACPI_SYSTEM_NOTIFY: system_handler (00-7f)
62 * ACPI_DEVICE_NOTIFY: driver_handler (80-ff)
63 * ACPI_ALL_NOTIFY: both system and device
64 * handler - Address of the handler
65 * context - Value passed to the handler on each GPE
66 * next - Address of a handler object to link to
67 *
68 * RETURN: None
69 *
70 * DESCRIPTION: Populate a handler object.
71 *
72 ******************************************************************************/
73static void
74acpi_populate_handler_object(struct acpi_object_notify_handler *handler_obj,
75 u32 handler_type,
76 acpi_notify_handler handler, void *context,
77 struct acpi_object_notify_handler *next)
78{
79 handler_obj->handler_type = handler_type;
80 handler_obj->handler = handler;
81 handler_obj->context = context;
82 handler_obj->next = next;
83}
84
85/*******************************************************************************
86 *
87 * FUNCTION: acpi_add_handler_object
88 *
89 * PARAMETERS: parent_obj - Parent of the new object
90 * handler - Address of the handler
91 * context - Value passed to the handler on each GPE
92 *
93 * RETURN: Status
94 *
95 * DESCRIPTION: Create a new handler object and populate it.
96 *
97 ******************************************************************************/
98static acpi_status
99acpi_add_handler_object(struct acpi_object_notify_handler *parent_obj,
100 acpi_notify_handler handler, void *context)
101{
102 struct acpi_object_notify_handler *handler_obj;
103
104 /* The parent must not be a defice notify handler object. */
105 if (parent_obj->handler_type & ACPI_DEVICE_NOTIFY)
106 return AE_BAD_PARAMETER;
107
108 handler_obj = ACPI_ALLOCATE_ZEROED(sizeof(*handler_obj));
109 if (!handler_obj)
110 return AE_NO_MEMORY;
111
112 acpi_populate_handler_object(handler_obj,
113 ACPI_SYSTEM_NOTIFY,
114 handler, context,
115 parent_obj->next);
116 parent_obj->next = handler_obj;
117
118 return AE_OK;
119}
120
121
122/*******************************************************************************
123 *
124 * FUNCTION: acpi_install_notify_handler 57 * FUNCTION: acpi_install_notify_handler
125 * 58 *
126 * PARAMETERS: Device - The device for which notifies will be handled 59 * PARAMETERS: Device - The device for which notifies will be handled
127 * handler_type - The type of handler: 60 * handler_type - The type of handler:
128 * ACPI_SYSTEM_NOTIFY: system_handler (00-7f) 61 * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
129 * ACPI_DEVICE_NOTIFY: driver_handler (80-ff) 62 * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
130 * ACPI_ALL_NOTIFY: both system and device 63 * ACPI_ALL_NOTIFY: Both System and Device
131 * Handler - Address of the handler 64 * Handler - Address of the handler
132 * Context - Value passed to the handler on each GPE 65 * Context - Value passed to the handler on each GPE
133 * 66 *
134 * RETURN: Status 67 * RETURN: Status
135 * 68 *
136 * DESCRIPTION: Install a handler for notifies on an ACPI device 69 * DESCRIPTION: Install a handler for notifications on an ACPI Device,
70 * thermal_zone, or Processor object.
71 *
72 * NOTES: The Root namespace object may have only one handler for each
73 * type of notify (System/Device). Device/Thermal/Processor objects
74 * may have one device notify handler, and multiple system notify
75 * handlers.
137 * 76 *
138 ******************************************************************************/ 77 ******************************************************************************/
139acpi_status 78acpi_status
@@ -141,17 +80,19 @@ acpi_install_notify_handler(acpi_handle device,
141 u32 handler_type, 80 u32 handler_type,
142 acpi_notify_handler handler, void *context) 81 acpi_notify_handler handler, void *context)
143{ 82{
83 struct acpi_namespace_node *node =
84 ACPI_CAST_PTR(struct acpi_namespace_node, device);
144 union acpi_operand_object *obj_desc; 85 union acpi_operand_object *obj_desc;
145 union acpi_operand_object *notify_obj; 86 union acpi_operand_object *handler_obj;
146 struct acpi_namespace_node *node;
147 acpi_status status; 87 acpi_status status;
88 u32 i;
148 89
149 ACPI_FUNCTION_TRACE(acpi_install_notify_handler); 90 ACPI_FUNCTION_TRACE(acpi_install_notify_handler);
150 91
151 /* Parameter validation */ 92 /* Parameter validation */
152 93
153 if ((!device) || 94 if ((!device) || (!handler) || (!handler_type) ||
154 (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { 95 (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
155 return_ACPI_STATUS(AE_BAD_PARAMETER); 96 return_ACPI_STATUS(AE_BAD_PARAMETER);
156 } 97 }
157 98
@@ -160,144 +101,112 @@ acpi_install_notify_handler(acpi_handle device,
160 return_ACPI_STATUS(status); 101 return_ACPI_STATUS(status);
161 } 102 }
162 103
163 /* Convert and validate the device handle */
164
165 node = acpi_ns_validate_handle(device);
166 if (!node) {
167 status = AE_BAD_PARAMETER;
168 goto unlock_and_exit;
169 }
170
171 /* 104 /*
172 * Root Object: 105 * Root Object:
173 * Registering a notify handler on the root object indicates that the 106 * Registering a notify handler on the root object indicates that the
174 * caller wishes to receive notifications for all objects. Note that 107 * caller wishes to receive notifications for all objects. Note that
175 * only one <external> global handler can be regsitered (per notify type). 108 * only one global handler can be registered per notify type.
109 * Ensure that a handler is not already installed.
176 */ 110 */
177 if (device == ACPI_ROOT_OBJECT) { 111 if (device == ACPI_ROOT_OBJECT) {
112 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
113 if (handler_type & (i + 1)) {
114 if (acpi_gbl_global_notify[i].handler) {
115 status = AE_ALREADY_EXISTS;
116 goto unlock_and_exit;
117 }
178 118
179 /* Make sure the handler is not already installed */ 119 acpi_gbl_global_notify[i].handler = handler;
180 120 acpi_gbl_global_notify[i].context = context;
181 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 121 }
182 acpi_gbl_system_notify.handler) ||
183 ((handler_type & ACPI_DEVICE_NOTIFY) &&
184 acpi_gbl_device_notify.handler)) {
185 status = AE_ALREADY_EXISTS;
186 goto unlock_and_exit;
187 }
188
189 if (handler_type & ACPI_SYSTEM_NOTIFY) {
190 acpi_gbl_system_notify.node = node;
191 acpi_gbl_system_notify.handler = handler;
192 acpi_gbl_system_notify.context = context;
193 }
194
195 if (handler_type & ACPI_DEVICE_NOTIFY) {
196 acpi_gbl_device_notify.node = node;
197 acpi_gbl_device_notify.handler = handler;
198 acpi_gbl_device_notify.context = context;
199 } 122 }
200 123
201 /* Global notify handler installed */ 124 goto unlock_and_exit; /* Global notify handler installed, all done */
202 } 125 }
203 126
204 /* 127 /*
205 * All Other Objects: 128 * All Other Objects:
206 * Caller will only receive notifications specific to the target object. 129 * Caller will only receive notifications specific to the target
207 * Note that only certain object types can receive notifications. 130 * object. Note that only certain object types are allowed to
131 * receive notifications.
208 */ 132 */
209 else {
210 /* Notifies allowed on this object? */
211 133
212 if (!acpi_ev_is_notify_object(node)) { 134 /* Are Notifies allowed on this object? */
213 status = AE_TYPE;
214 goto unlock_and_exit;
215 }
216 135
217 /* Check for an existing internal object */ 136 if (!acpi_ev_is_notify_object(node)) {
137 status = AE_TYPE;
138 goto unlock_and_exit;
139 }
218 140
219 obj_desc = acpi_ns_get_attached_object(node); 141 /* Check for an existing internal object, might not exist */
220 if (obj_desc) {
221 142
222 /* Object exists. */ 143 obj_desc = acpi_ns_get_attached_object(node);
144 if (!obj_desc) {
223 145
224 /* For a device notify, make sure there's no handler. */ 146 /* Create a new object */
225 if ((handler_type & ACPI_DEVICE_NOTIFY) &&
226 obj_desc->common_notify.device_notify) {
227 status = AE_ALREADY_EXISTS;
228 goto unlock_and_exit;
229 }
230 147
231 /* System notifies may have more handlers installed. */ 148 obj_desc = acpi_ut_create_internal_object(node->type);
232 notify_obj = obj_desc->common_notify.system_notify; 149 if (!obj_desc) {
150 status = AE_NO_MEMORY;
151 goto unlock_and_exit;
152 }
233 153
234 if ((handler_type & ACPI_SYSTEM_NOTIFY) && notify_obj) { 154 /* Attach new object to the Node, remove local reference */
235 struct acpi_object_notify_handler *parent_obj; 155
156 status = acpi_ns_attach_object(device, obj_desc, node->type);
157 acpi_ut_remove_reference(obj_desc);
158 if (ACPI_FAILURE(status)) {
159 goto unlock_and_exit;
160 }
161 }
236 162
237 if (handler_type & ACPI_DEVICE_NOTIFY) { 163 /* Ensure that the handler is not already installed in the lists */
164
165 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
166 if (handler_type & (i + 1)) {
167 handler_obj = obj_desc->common_notify.notify_list[i];
168 while (handler_obj) {
169 if (handler_obj->notify.handler == handler) {
238 status = AE_ALREADY_EXISTS; 170 status = AE_ALREADY_EXISTS;
239 goto unlock_and_exit; 171 goto unlock_and_exit;
240 } 172 }
241 173
242 parent_obj = &notify_obj->notify; 174 handler_obj = handler_obj->notify.next[i];
243 status = acpi_add_handler_object(parent_obj,
244 handler,
245 context);
246 goto unlock_and_exit;
247 }
248 } else {
249 /* Create a new object */
250
251 obj_desc = acpi_ut_create_internal_object(node->type);
252 if (!obj_desc) {
253 status = AE_NO_MEMORY;
254 goto unlock_and_exit;
255 }
256
257 /* Attach new object to the Node */
258
259 status =
260 acpi_ns_attach_object(device, obj_desc, node->type);
261
262 /* Remove local reference to the object */
263
264 acpi_ut_remove_reference(obj_desc);
265 if (ACPI_FAILURE(status)) {
266 goto unlock_and_exit;
267 } 175 }
268 } 176 }
177 }
269 178
270 /* Install the handler */ 179 /* Create and populate a new notify handler object */
271 180
272 notify_obj = 181 handler_obj = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY);
273 acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY); 182 if (!handler_obj) {
274 if (!notify_obj) { 183 status = AE_NO_MEMORY;
275 status = AE_NO_MEMORY; 184 goto unlock_and_exit;
276 goto unlock_and_exit; 185 }
277 }
278 186
279 acpi_populate_handler_object(&notify_obj->notify, 187 handler_obj->notify.node = node;
280 handler_type, 188 handler_obj->notify.handler_type = handler_type;
281 handler, context, 189 handler_obj->notify.handler = handler;
282 NULL); 190 handler_obj->notify.context = context;
283 191
284 if (handler_type & ACPI_SYSTEM_NOTIFY) { 192 /* Install the handler at the list head(s) */
285 obj_desc->common_notify.system_notify = notify_obj;
286 }
287 193
288 if (handler_type & ACPI_DEVICE_NOTIFY) { 194 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
289 obj_desc->common_notify.device_notify = notify_obj; 195 if (handler_type & (i + 1)) {
290 } 196 handler_obj->notify.next[i] =
197 obj_desc->common_notify.notify_list[i];
291 198
292 if (handler_type == ACPI_ALL_NOTIFY) { 199 obj_desc->common_notify.notify_list[i] = handler_obj;
200 }
201 }
293 202
294 /* Extra ref if installed in both */ 203 /* Add an extra reference if handler was installed in both lists */
295 204
296 acpi_ut_add_reference(notify_obj); 205 if (handler_type == ACPI_ALL_NOTIFY) {
297 } 206 acpi_ut_add_reference(handler_obj);
298 } 207 }
299 208
300 unlock_and_exit: 209unlock_and_exit:
301 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 210 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
302 return_ACPI_STATUS(status); 211 return_ACPI_STATUS(status);
303} 212}
@@ -308,11 +217,11 @@ ACPI_EXPORT_SYMBOL(acpi_install_notify_handler)
308 * 217 *
309 * FUNCTION: acpi_remove_notify_handler 218 * FUNCTION: acpi_remove_notify_handler
310 * 219 *
311 * PARAMETERS: Device - The device for which notifies will be handled 220 * PARAMETERS: Device - The device for which the handler is installed
312 * handler_type - The type of handler: 221 * handler_type - The type of handler:
313 * ACPI_SYSTEM_NOTIFY: system_handler (00-7f) 222 * ACPI_SYSTEM_NOTIFY: System Handler (00-7F)
314 * ACPI_DEVICE_NOTIFY: driver_handler (80-ff) 223 * ACPI_DEVICE_NOTIFY: Device Handler (80-FF)
315 * ACPI_ALL_NOTIFY: both system and device 224 * ACPI_ALL_NOTIFY: Both System and Device
316 * Handler - Address of the handler 225 * Handler - Address of the handler
317 * 226 *
318 * RETURN: Status 227 * RETURN: Status
@@ -324,165 +233,106 @@ acpi_status
324acpi_remove_notify_handler(acpi_handle device, 233acpi_remove_notify_handler(acpi_handle device,
325 u32 handler_type, acpi_notify_handler handler) 234 u32 handler_type, acpi_notify_handler handler)
326{ 235{
327 union acpi_operand_object *notify_obj; 236 struct acpi_namespace_node *node =
237 ACPI_CAST_PTR(struct acpi_namespace_node, device);
328 union acpi_operand_object *obj_desc; 238 union acpi_operand_object *obj_desc;
329 struct acpi_namespace_node *node; 239 union acpi_operand_object *handler_obj;
240 union acpi_operand_object *previous_handler_obj;
330 acpi_status status; 241 acpi_status status;
242 u32 i;
331 243
332 ACPI_FUNCTION_TRACE(acpi_remove_notify_handler); 244 ACPI_FUNCTION_TRACE(acpi_remove_notify_handler);
333 245
334 /* Parameter validation */ 246 /* Parameter validation */
335 247
336 if ((!device) || 248 if ((!device) || (!handler) || (!handler_type) ||
337 (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { 249 (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
338 status = AE_BAD_PARAMETER; 250 return_ACPI_STATUS(AE_BAD_PARAMETER);
339 goto exit;
340 } 251 }
341
342
343 /* Make sure all deferred tasks are completed */ 252 /* Make sure all deferred tasks are completed */
344 acpi_os_wait_events_complete(NULL); 253
254 acpi_os_wait_events_complete();
345 255
346 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 256 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
347 if (ACPI_FAILURE(status)) { 257 if (ACPI_FAILURE(status)) {
348 goto exit; 258 return_ACPI_STATUS(status);
349 }
350
351 /* Convert and validate the device handle */
352
353 node = acpi_ns_validate_handle(device);
354 if (!node) {
355 status = AE_BAD_PARAMETER;
356 goto unlock_and_exit;
357 } 259 }
358 260
359 /* Root Object */ 261 /* Root Object. Global handlers are removed here */
360 262
361 if (device == ACPI_ROOT_OBJECT) { 263 if (device == ACPI_ROOT_OBJECT) {
362 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 264 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
363 "Removing notify handler for namespace root object\n")); 265 if (handler_type & (i + 1)) {
266 if (!acpi_gbl_global_notify[i].handler ||
267 (acpi_gbl_global_notify[i].handler !=
268 handler)) {
269 status = AE_NOT_EXIST;
270 goto unlock_and_exit;
271 }
364 272
365 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 273 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
366 !acpi_gbl_system_notify.handler) || 274 "Removing global notify handler\n"));
367 ((handler_type & ACPI_DEVICE_NOTIFY) &&
368 !acpi_gbl_device_notify.handler)) {
369 status = AE_NOT_EXIST;
370 goto unlock_and_exit;
371 }
372 275
373 if (handler_type & ACPI_SYSTEM_NOTIFY) { 276 acpi_gbl_global_notify[i].handler = NULL;
374 acpi_gbl_system_notify.node = NULL; 277 acpi_gbl_global_notify[i].context = NULL;
375 acpi_gbl_system_notify.handler = NULL; 278 }
376 acpi_gbl_system_notify.context = NULL;
377 } 279 }
378 280
379 if (handler_type & ACPI_DEVICE_NOTIFY) { 281 goto unlock_and_exit;
380 acpi_gbl_device_notify.node = NULL;
381 acpi_gbl_device_notify.handler = NULL;
382 acpi_gbl_device_notify.context = NULL;
383 }
384 } 282 }
385 283
386 /* All Other Objects */ 284 /* All other objects: Are Notifies allowed on this object? */
387 285
388 else { 286 if (!acpi_ev_is_notify_object(node)) {
389 /* Notifies allowed on this object? */ 287 status = AE_TYPE;
288 goto unlock_and_exit;
289 }
390 290
391 if (!acpi_ev_is_notify_object(node)) { 291 /* Must have an existing internal object */
392 status = AE_TYPE;
393 goto unlock_and_exit;
394 }
395 292
396 /* Check for an existing internal object */ 293 obj_desc = acpi_ns_get_attached_object(node);
294 if (!obj_desc) {
295 status = AE_NOT_EXIST;
296 goto unlock_and_exit;
297 }
397 298
398 obj_desc = acpi_ns_get_attached_object(node); 299 /* Internal object exists. Find the handler and remove it */
399 if (!obj_desc) {
400 status = AE_NOT_EXIST;
401 goto unlock_and_exit;
402 }
403 300
404 /* Object exists - make sure there's an existing handler */ 301 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
302 if (handler_type & (i + 1)) {
303 handler_obj = obj_desc->common_notify.notify_list[i];
304 previous_handler_obj = NULL;
405 305
406 if (handler_type & ACPI_SYSTEM_NOTIFY) { 306 /* Attempt to find the handler in the handler list */
407 struct acpi_object_notify_handler *handler_obj;
408 struct acpi_object_notify_handler *parent_obj;
409 307
410 notify_obj = obj_desc->common_notify.system_notify; 308 while (handler_obj &&
411 if (!notify_obj) { 309 (handler_obj->notify.handler != handler)) {
412 status = AE_NOT_EXIST; 310 previous_handler_obj = handler_obj;
413 goto unlock_and_exit; 311 handler_obj = handler_obj->notify.next[i];
414 }
415
416 handler_obj = &notify_obj->notify;
417 parent_obj = NULL;
418 while (handler_obj->handler != handler) {
419 if (handler_obj->next) {
420 parent_obj = handler_obj;
421 handler_obj = handler_obj->next;
422 } else {
423 break;
424 }
425 } 312 }
426 313
427 if (handler_obj->handler != handler) { 314 if (!handler_obj) {
428 status = AE_BAD_PARAMETER; 315 status = AE_NOT_EXIST;
429 goto unlock_and_exit; 316 goto unlock_and_exit;
430 } 317 }
431 318
432 /* 319 /* Remove the handler object from the list */
433 * Remove the handler. There are three possible cases.
434 * First, we may need to remove a non-embedded object.
435 * Second, we may need to remove the embedded object's
436 * handler data, while non-embedded objects exist.
437 * Finally, we may need to remove the embedded object
438 * entirely along with its container.
439 */
440 if (parent_obj) {
441 /* Non-embedded object is being removed. */
442 parent_obj->next = handler_obj->next;
443 ACPI_FREE(handler_obj);
444 } else if (notify_obj->notify.next) {
445 /*
446 * The handler matches the embedded object, but
447 * there are more handler objects in the list.
448 * Replace the embedded object's data with the
449 * first next object's data and remove that
450 * object.
451 */
452 parent_obj = &notify_obj->notify;
453 handler_obj = notify_obj->notify.next;
454 *parent_obj = *handler_obj;
455 ACPI_FREE(handler_obj);
456 } else {
457 /* No more handler objects in the list. */
458 obj_desc->common_notify.system_notify = NULL;
459 acpi_ut_remove_reference(notify_obj);
460 }
461 }
462 320
463 if (handler_type & ACPI_DEVICE_NOTIFY) { 321 if (previous_handler_obj) { /* Handler is not at the list head */
464 notify_obj = obj_desc->common_notify.device_notify; 322 previous_handler_obj->notify.next[i] =
465 if (!notify_obj) { 323 handler_obj->notify.next[i];
466 status = AE_NOT_EXIST; 324 } else { /* Handler is at the list head */
467 goto unlock_and_exit;
468 }
469 325
470 if (notify_obj->notify.handler != handler) { 326 obj_desc->common_notify.notify_list[i] =
471 status = AE_BAD_PARAMETER; 327 handler_obj->notify.next[i];
472 goto unlock_and_exit;
473 } 328 }
474 329
475 /* Remove the handler */ 330 acpi_ut_remove_reference(handler_obj);
476 obj_desc->common_notify.device_notify = NULL;
477 acpi_ut_remove_reference(notify_obj);
478 } 331 }
479 } 332 }
480 333
481 unlock_and_exit: 334unlock_and_exit:
482 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 335 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
483 exit:
484 if (ACPI_FAILURE(status))
485 ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler"));
486 return_ACPI_STATUS(status); 336 return_ACPI_STATUS(status);
487} 337}
488 338
@@ -492,7 +342,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler)
492 * 342 *
493 * FUNCTION: acpi_install_exception_handler 343 * FUNCTION: acpi_install_exception_handler
494 * 344 *
495 * PARAMETERS: Handler - Pointer to the handler function for the 345 * PARAMETERS: handler - Pointer to the handler function for the
496 * event 346 * event
497 * 347 *
498 * RETURN: Status 348 * RETURN: Status
@@ -536,8 +386,8 @@ ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
536 * 386 *
537 * FUNCTION: acpi_install_global_event_handler 387 * FUNCTION: acpi_install_global_event_handler
538 * 388 *
539 * PARAMETERS: Handler - Pointer to the global event handler function 389 * PARAMETERS: handler - Pointer to the global event handler function
540 * Context - Value passed to the handler on each event 390 * context - Value passed to the handler on each event
541 * 391 *
542 * RETURN: Status 392 * RETURN: Status
543 * 393 *
@@ -586,10 +436,10 @@ ACPI_EXPORT_SYMBOL(acpi_install_global_event_handler)
586 * 436 *
587 * FUNCTION: acpi_install_fixed_event_handler 437 * FUNCTION: acpi_install_fixed_event_handler
588 * 438 *
589 * PARAMETERS: Event - Event type to enable. 439 * PARAMETERS: event - Event type to enable.
590 * Handler - Pointer to the handler function for the 440 * handler - Pointer to the handler function for the
591 * event 441 * event
592 * Context - Value passed to the handler on each GPE 442 * context - Value passed to the handler on each GPE
593 * 443 *
594 * RETURN: Status 444 * RETURN: Status
595 * 445 *
@@ -656,8 +506,8 @@ ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler)
656 * 506 *
657 * FUNCTION: acpi_remove_fixed_event_handler 507 * FUNCTION: acpi_remove_fixed_event_handler
658 * 508 *
659 * PARAMETERS: Event - Event type to disable. 509 * PARAMETERS: event - Event type to disable.
660 * Handler - Address of the handler 510 * handler - Address of the handler
661 * 511 *
662 * RETURN: Status 512 * RETURN: Status
663 * 513 *
@@ -713,10 +563,10 @@ ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
713 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT 563 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
714 * defined GPEs) 564 * defined GPEs)
715 * gpe_number - The GPE number within the GPE block 565 * gpe_number - The GPE number within the GPE block
716 * Type - Whether this GPE should be treated as an 566 * type - Whether this GPE should be treated as an
717 * edge- or level-triggered interrupt. 567 * edge- or level-triggered interrupt.
718 * Address - Address of the handler 568 * address - Address of the handler
719 * Context - Value passed to the handler on each GPE 569 * context - Value passed to the handler on each GPE
720 * 570 *
721 * RETURN: Status 571 * RETURN: Status
722 * 572 *
@@ -823,7 +673,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
823 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT 673 * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
824 * defined GPEs) 674 * defined GPEs)
825 * gpe_number - The event to remove a handler 675 * gpe_number - The event to remove a handler
826 * Address - Address of the handler 676 * address - Address of the handler
827 * 677 *
828 * RETURN: Status 678 * RETURN: Status
829 * 679 *
@@ -849,7 +699,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
849 699
850 /* Make sure all deferred tasks are completed */ 700 /* Make sure all deferred tasks are completed */
851 701
852 acpi_os_wait_events_complete(NULL); 702 acpi_os_wait_events_complete();
853 703
854 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 704 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
855 if (ACPI_FAILURE(status)) { 705 if (ACPI_FAILURE(status)) {
@@ -919,8 +769,8 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler)
919 * 769 *
920 * FUNCTION: acpi_acquire_global_lock 770 * FUNCTION: acpi_acquire_global_lock
921 * 771 *
922 * PARAMETERS: Timeout - How long the caller is willing to wait 772 * PARAMETERS: timeout - How long the caller is willing to wait
923 * Handle - Where the handle to the lock is returned 773 * handle - Where the handle to the lock is returned
924 * (if acquired) 774 * (if acquired)
925 * 775 *
926 * RETURN: Status 776 * RETURN: Status
@@ -967,7 +817,7 @@ ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock)
967 * 817 *
968 * FUNCTION: acpi_release_global_lock 818 * FUNCTION: acpi_release_global_lock
969 * 819 *
970 * PARAMETERS: Handle - Returned from acpi_acquire_global_lock 820 * PARAMETERS: handle - Returned from acpi_acquire_global_lock
971 * 821 *
972 * RETURN: Status 822 * RETURN: Status
973 * 823 *
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 77cee5a5e891..35520c6eeefb 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -153,8 +153,8 @@ ACPI_EXPORT_SYMBOL(acpi_disable)
153 * 153 *
154 * FUNCTION: acpi_enable_event 154 * FUNCTION: acpi_enable_event
155 * 155 *
156 * PARAMETERS: Event - The fixed eventto be enabled 156 * PARAMETERS: event - The fixed eventto be enabled
157 * Flags - Reserved 157 * flags - Reserved
158 * 158 *
159 * RETURN: Status 159 * RETURN: Status
160 * 160 *
@@ -265,7 +265,7 @@ ACPI_EXPORT_SYMBOL(acpi_disable_event)
265 * 265 *
266 * FUNCTION: acpi_clear_event 266 * FUNCTION: acpi_clear_event
267 * 267 *
268 * PARAMETERS: Event - The fixed event to be cleared 268 * PARAMETERS: event - The fixed event to be cleared
269 * 269 *
270 * RETURN: Status 270 * RETURN: Status
271 * 271 *
@@ -301,7 +301,7 @@ ACPI_EXPORT_SYMBOL(acpi_clear_event)
301 * 301 *
302 * FUNCTION: acpi_get_event_status 302 * FUNCTION: acpi_get_event_status
303 * 303 *
304 * PARAMETERS: Event - The fixed event 304 * PARAMETERS: event - The fixed event
305 * event_status - Where the current status of the event will 305 * event_status - Where the current status of the event will
306 * be returned 306 * be returned
307 * 307 *
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 86f9b343ebd4..6affbdb4b88c 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -197,12 +197,12 @@ acpi_status
197acpi_setup_gpe_for_wake(acpi_handle wake_device, 197acpi_setup_gpe_for_wake(acpi_handle wake_device,
198 acpi_handle gpe_device, u32 gpe_number) 198 acpi_handle gpe_device, u32 gpe_number)
199{ 199{
200 acpi_status status = AE_BAD_PARAMETER; 200 acpi_status status;
201 struct acpi_gpe_event_info *gpe_event_info; 201 struct acpi_gpe_event_info *gpe_event_info;
202 struct acpi_namespace_node *device_node; 202 struct acpi_namespace_node *device_node;
203 struct acpi_gpe_notify_object *notify_object; 203 struct acpi_gpe_notify_info *notify;
204 struct acpi_gpe_notify_info *new_notify;
204 acpi_cpu_flags flags; 205 acpi_cpu_flags flags;
205 u8 gpe_dispatch_mask;
206 206
207 ACPI_FUNCTION_TRACE(acpi_setup_gpe_for_wake); 207 ACPI_FUNCTION_TRACE(acpi_setup_gpe_for_wake);
208 208
@@ -216,63 +216,95 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
216 return_ACPI_STATUS(AE_BAD_PARAMETER); 216 return_ACPI_STATUS(AE_BAD_PARAMETER);
217 } 217 }
218 218
219 /* Handle root object case */
220
221 if (wake_device == ACPI_ROOT_OBJECT) {
222 device_node = acpi_gbl_root_node;
223 } else {
224 device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
225 }
226
227 /* Validate WakeDevice is of type Device */
228
229 if (device_node->type != ACPI_TYPE_DEVICE) {
230 return_ACPI_STATUS (AE_BAD_PARAMETER);
231 }
232
233 /*
234 * Allocate a new notify object up front, in case it is needed.
235 * Memory allocation while holding a spinlock is a big no-no
236 * on some hosts.
237 */
238 new_notify = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_notify_info));
239 if (!new_notify) {
240 return_ACPI_STATUS(AE_NO_MEMORY);
241 }
242
219 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 243 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
220 244
221 /* Ensure that we have a valid GPE number */ 245 /* Ensure that we have a valid GPE number */
222 246
223 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 247 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
224 if (!gpe_event_info) { 248 if (!gpe_event_info) {
249 status = AE_BAD_PARAMETER;
225 goto unlock_and_exit; 250 goto unlock_and_exit;
226 } 251 }
227 252
228 if (wake_device == ACPI_ROOT_OBJECT) {
229 goto out;
230 }
231
232 /* 253 /*
233 * If there is no method or handler for this GPE, then the 254 * If there is no method or handler for this GPE, then the
234 * wake_device will be notified whenever this GPE fires (aka 255 * wake_device will be notified whenever this GPE fires. This is
235 * "implicit notify") Note: The GPE is assumed to be 256 * known as an "implicit notify". Note: The GPE is assumed to be
236 * level-triggered (for windows compatibility). 257 * level-triggered (for windows compatibility).
237 */ 258 */
238 gpe_dispatch_mask = gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK; 259 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
239 if (gpe_dispatch_mask != ACPI_GPE_DISPATCH_NONE 260 ACPI_GPE_DISPATCH_NONE) {
240 && gpe_dispatch_mask != ACPI_GPE_DISPATCH_NOTIFY) { 261 /*
241 goto out; 262 * This is the first device for implicit notify on this GPE.
242 } 263 * Just set the flags here, and enter the NOTIFY block below.
243 264 */
244 /* Validate wake_device is of type Device */ 265 gpe_event_info->flags =
245 266 (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
246 device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
247 if (device_node->type != ACPI_TYPE_DEVICE) {
248 goto unlock_and_exit;
249 } 267 }
250 268
251 if (gpe_dispatch_mask == ACPI_GPE_DISPATCH_NONE) { 269 /*
252 gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY | 270 * If we already have an implicit notify on this GPE, add
253 ACPI_GPE_LEVEL_TRIGGERED); 271 * this device to the notify list.
254 gpe_event_info->dispatch.device.node = device_node; 272 */
255 gpe_event_info->dispatch.device.next = NULL; 273 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
256 } else { 274 ACPI_GPE_DISPATCH_NOTIFY) {
257 /* There are multiple devices to notify implicitly. */ 275
258 276 /* Ensure that the device is not already in the list */
259 notify_object = ACPI_ALLOCATE_ZEROED(sizeof(*notify_object)); 277
260 if (!notify_object) { 278 notify = gpe_event_info->dispatch.notify_list;
261 status = AE_NO_MEMORY; 279 while (notify) {
262 goto unlock_and_exit; 280 if (notify->device_node == device_node) {
281 status = AE_ALREADY_EXISTS;
282 goto unlock_and_exit;
283 }
284 notify = notify->next;
263 } 285 }
264 286
265 notify_object->node = device_node; 287 /* Add this device to the notify list for this GPE */
266 notify_object->next = gpe_event_info->dispatch.device.next; 288
267 gpe_event_info->dispatch.device.next = notify_object; 289 new_notify->device_node = device_node;
290 new_notify->next = gpe_event_info->dispatch.notify_list;
291 gpe_event_info->dispatch.notify_list = new_notify;
292 new_notify = NULL;
268 } 293 }
269 294
270 out: 295 /* Mark the GPE as a possible wake event */
296
271 gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; 297 gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
272 status = AE_OK; 298 status = AE_OK;
273 299
274 unlock_and_exit: 300unlock_and_exit:
275 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 301 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
302
303 /* Delete the notify object if it was not used above */
304
305 if (new_notify) {
306 ACPI_FREE(new_notify);
307 }
276 return_ACPI_STATUS(status); 308 return_ACPI_STATUS(status);
277} 309}
278ACPI_EXPORT_SYMBOL(acpi_setup_gpe_for_wake) 310ACPI_EXPORT_SYMBOL(acpi_setup_gpe_for_wake)
@@ -283,7 +315,7 @@ ACPI_EXPORT_SYMBOL(acpi_setup_gpe_for_wake)
283 * 315 *
284 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 316 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
285 * gpe_number - GPE level within the GPE block 317 * gpe_number - GPE level within the GPE block
286 * Action - Enable or Disable 318 * action - Enable or Disable
287 * 319 *
288 * RETURN: Status 320 * RETURN: Status
289 * 321 *
@@ -508,7 +540,7 @@ ACPI_EXPORT_SYMBOL(acpi_enable_all_runtime_gpes)
508 * FUNCTION: acpi_install_gpe_block 540 * FUNCTION: acpi_install_gpe_block
509 * 541 *
510 * PARAMETERS: gpe_device - Handle to the parent GPE Block Device 542 * PARAMETERS: gpe_device - Handle to the parent GPE Block Device
511 * gpe_block_address - Address and space_iD 543 * gpe_block_address - Address and space_ID
512 * register_count - Number of GPE register pairs in the block 544 * register_count - Number of GPE register pairs in the block
513 * interrupt_number - H/W interrupt for the block 545 * interrupt_number - H/W interrupt for the block
514 * 546 *
@@ -653,7 +685,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
653 * 685 *
654 * FUNCTION: acpi_get_gpe_device 686 * FUNCTION: acpi_get_gpe_device
655 * 687 *
656 * PARAMETERS: Index - System GPE index (0-current_gpe_count) 688 * PARAMETERS: index - System GPE index (0-current_gpe_count)
657 * gpe_device - Where the parent GPE Device is returned 689 * gpe_device - Where the parent GPE Device is returned
658 * 690 *
659 * RETURN: Status 691 * RETURN: Status
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index 6019208cd4b6..96b412d03950 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -55,11 +55,11 @@ ACPI_MODULE_NAME("evxfregn")
55 * 55 *
56 * FUNCTION: acpi_install_address_space_handler 56 * FUNCTION: acpi_install_address_space_handler
57 * 57 *
58 * PARAMETERS: Device - Handle for the device 58 * PARAMETERS: device - Handle for the device
59 * space_id - The address space ID 59 * space_id - The address space ID
60 * Handler - Address of the handler 60 * handler - Address of the handler
61 * Setup - Address of the setup function 61 * setup - Address of the setup function
62 * Context - Value passed to the handler on each access 62 * context - Value passed to the handler on each access
63 * 63 *
64 * RETURN: Status 64 * RETURN: Status
65 * 65 *
@@ -112,16 +112,16 @@ acpi_install_address_space_handler(acpi_handle device,
112 } 112 }
113 113
114 /* 114 /*
115 * For the default space_iDs, (the IDs for which there are default region handlers 115 * For the default space_IDs, (the IDs for which there are default region handlers
116 * installed) Only execute the _REG methods if the global initialization _REG 116 * installed) Only execute the _REG methods if the global initialization _REG
117 * methods have already been run (via acpi_initialize_objects). In other words, 117 * methods have already been run (via acpi_initialize_objects). In other words,
118 * we will defer the execution of the _REG methods for these space_iDs until 118 * we will defer the execution of the _REG methods for these space_IDs until
119 * execution of acpi_initialize_objects. This is done because we need the handlers 119 * execution of acpi_initialize_objects. This is done because we need the handlers
120 * for the default spaces (mem/io/pci/table) to be installed before we can run 120 * for the default spaces (mem/io/pci/table) to be installed before we can run
121 * any control methods (or _REG methods). There is known BIOS code that depends 121 * any control methods (or _REG methods). There is known BIOS code that depends
122 * on this. 122 * on this.
123 * 123 *
124 * For all other space_iDs, we can safely execute the _REG methods immediately. 124 * For all other space_IDs, we can safely execute the _REG methods immediately.
125 * This means that for IDs like embedded_controller, this function should be called 125 * This means that for IDs like embedded_controller, this function should be called
126 * only after acpi_enable_subsystem has been called. 126 * only after acpi_enable_subsystem has been called.
127 */ 127 */
@@ -157,9 +157,9 @@ ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler)
157 * 157 *
158 * FUNCTION: acpi_remove_address_space_handler 158 * FUNCTION: acpi_remove_address_space_handler
159 * 159 *
160 * PARAMETERS: Device - Handle for the device 160 * PARAMETERS: device - Handle for the device
161 * space_id - The address space ID 161 * space_id - The address space ID
162 * Handler - Address of the handler 162 * handler - Address of the handler
163 * 163 *
164 * RETURN: Status 164 * RETURN: Status
165 * 165 *
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index c86d44e41bc8..16219bde48da 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -66,7 +66,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc,
66 * 66 *
67 * FUNCTION: acpi_ex_add_table 67 * FUNCTION: acpi_ex_add_table
68 * 68 *
69 * PARAMETERS: Table - Pointer to raw table 69 * PARAMETERS: table - Pointer to raw table
70 * parent_node - Where to load the table (scope) 70 * parent_node - Where to load the table (scope)
71 * ddb_handle - Where to return the table handle. 71 * ddb_handle - Where to return the table handle.
72 * 72 *
@@ -276,8 +276,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
276 * FUNCTION: acpi_ex_region_read 276 * FUNCTION: acpi_ex_region_read
277 * 277 *
278 * PARAMETERS: obj_desc - Region descriptor 278 * PARAMETERS: obj_desc - Region descriptor
279 * Length - Number of bytes to read 279 * length - Number of bytes to read
280 * Buffer - Pointer to where to put the data 280 * buffer - Pointer to where to put the data
281 * 281 *
282 * RETURN: Status 282 * RETURN: Status
283 * 283 *
@@ -318,7 +318,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
318 * 318 *
319 * PARAMETERS: obj_desc - Region or Buffer/Field where the table will be 319 * PARAMETERS: obj_desc - Region or Buffer/Field where the table will be
320 * obtained 320 * obtained
321 * Target - Where a handle to the table will be stored 321 * target - Where a handle to the table will be stored
322 * walk_state - Current state 322 * walk_state - Current state
323 * 323 *
324 * RETURN: Status 324 * RETURN: Status
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index e385436bd424..bfb062e4c4b4 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -60,7 +60,7 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length);
60 * PARAMETERS: obj_desc - Object to be converted. Must be an 60 * PARAMETERS: obj_desc - Object to be converted. Must be an
61 * Integer, Buffer, or String 61 * Integer, Buffer, or String
62 * result_desc - Where the new Integer object is returned 62 * result_desc - Where the new Integer object is returned
63 * Flags - Used for string conversion 63 * flags - Used for string conversion
64 * 64 *
65 * RETURN: Status 65 * RETURN: Status
66 * 66 *
@@ -272,9 +272,9 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
272 * 272 *
273 * FUNCTION: acpi_ex_convert_to_ascii 273 * FUNCTION: acpi_ex_convert_to_ascii
274 * 274 *
275 * PARAMETERS: Integer - Value to be converted 275 * PARAMETERS: integer - Value to be converted
276 * Base - ACPI_STRING_DECIMAL or ACPI_STRING_HEX 276 * base - ACPI_STRING_DECIMAL or ACPI_STRING_HEX
277 * String - Where the string is returned 277 * string - Where the string is returned
278 * data_width - Size of data item to be converted, in bytes 278 * data_width - Size of data item to be converted, in bytes
279 * 279 *
280 * RETURN: Actual string length 280 * RETURN: Actual string length
@@ -385,7 +385,7 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
385 * PARAMETERS: obj_desc - Object to be converted. Must be an 385 * PARAMETERS: obj_desc - Object to be converted. Must be an
386 * Integer, Buffer, or String 386 * Integer, Buffer, or String
387 * result_desc - Where the string object is returned 387 * result_desc - Where the string object is returned
388 * Type - String flags (base and conversion type) 388 * type - String flags (base and conversion type)
389 * 389 *
390 * RETURN: Status 390 * RETURN: Status
391 * 391 *
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 3f5bc998c1cb..691d4763102c 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -369,7 +369,7 @@ acpi_ex_create_region(u8 * aml_start,
369 * 369 *
370 * DESCRIPTION: Create a new processor object and populate the fields 370 * DESCRIPTION: Create a new processor object and populate the fields
371 * 371 *
372 * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) 372 * Processor (Name[0], cpu_ID[1], pblock_addr[2], pblock_length[3])
373 * 373 *
374 ******************************************************************************/ 374 ******************************************************************************/
375 375
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index e211e9c19215..bc5b9a6a1316 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -54,8 +54,8 @@ ACPI_MODULE_NAME("exdebug")
54 * FUNCTION: acpi_ex_do_debug_object 54 * FUNCTION: acpi_ex_do_debug_object
55 * 55 *
56 * PARAMETERS: source_desc - Object to be output to "Debug Object" 56 * PARAMETERS: source_desc - Object to be output to "Debug Object"
57 * Level - Indentation level (used for packages) 57 * level - Indentation level (used for packages)
58 * Index - Current package element, zero if not pkg 58 * index - Current package element, zero if not pkg
59 * 59 *
60 * RETURN: None 60 * RETURN: None
61 * 61 *
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index 2a6ac0a3bc1e..213c081776fc 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -109,9 +109,9 @@ static struct acpi_exdump_info acpi_ex_dump_package[5] = {
109static struct acpi_exdump_info acpi_ex_dump_device[4] = { 109static struct acpi_exdump_info acpi_ex_dump_device[4] = {
110 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL}, 110 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL},
111 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"}, 111 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"},
112 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.system_notify), 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.device_notify), 114 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.notify_list[1]),
115 "Device Notify"} 115 "Device Notify"}
116}; 116};
117 117
@@ -158,9 +158,9 @@ static struct acpi_exdump_info acpi_ex_dump_power[5] = {
158 "System Level"}, 158 "System Level"},
159 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order), 159 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order),
160 "Resource Order"}, 160 "Resource Order"},
161 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.system_notify), 161 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[0]),
162 "System Notify"}, 162 "System Notify"},
163 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.device_notify), 163 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.notify_list[1]),
164 "Device Notify"} 164 "Device Notify"}
165}; 165};
166 166
@@ -169,18 +169,18 @@ static struct acpi_exdump_info acpi_ex_dump_processor[7] = {
169 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"}, 169 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"},
170 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.length), "Length"}, 170 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(processor.length), "Length"},
171 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"}, 171 {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"},
172 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify), 172 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.notify_list[0]),
173 "System Notify"}, 173 "System Notify"},
174 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.device_notify), 174 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.notify_list[1]),
175 "Device Notify"}, 175 "Device Notify"},
176 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"} 176 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"}
177}; 177};
178 178
179static struct acpi_exdump_info acpi_ex_dump_thermal[4] = { 179static struct acpi_exdump_info acpi_ex_dump_thermal[4] = {
180 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL}, 180 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL},
181 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.system_notify), 181 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.notify_list[0]),
182 "System Notify"}, 182 "System Notify"},
183 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.device_notify), 183 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.notify_list[1]),
184 "Device Notify"}, 184 "Device Notify"},
185 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"} 185 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"}
186}; 186};
@@ -241,10 +241,15 @@ static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = {
241 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"} 241 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"}
242}; 242};
243 243
244static struct acpi_exdump_info acpi_ex_dump_notify[3] = { 244static struct acpi_exdump_info acpi_ex_dump_notify[7] = {
245 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL}, 245 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL},
246 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"}, 246 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"},
247 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"} 247 {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(notify.handler_type), "Handler Type"},
248 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.handler), "Handler"},
249 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"},
250 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[0]),
251 "Next System Notify"},
252 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.next[1]), "Next Device Notify"}
248}; 253};
249 254
250/* Miscellaneous tables */ 255/* Miscellaneous tables */
@@ -318,7 +323,7 @@ static struct acpi_exdump_info *acpi_ex_dump_info[] = {
318 * FUNCTION: acpi_ex_dump_object 323 * FUNCTION: acpi_ex_dump_object
319 * 324 *
320 * PARAMETERS: obj_desc - Descriptor to dump 325 * PARAMETERS: obj_desc - Descriptor to dump
321 * Info - Info table corresponding to this object 326 * info - Info table corresponding to this object
322 * type 327 * type
323 * 328 *
324 * RETURN: None 329 * RETURN: None
@@ -444,7 +449,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
444 * FUNCTION: acpi_ex_dump_operand 449 * FUNCTION: acpi_ex_dump_operand
445 * 450 *
446 * PARAMETERS: *obj_desc - Pointer to entry to be dumped 451 * PARAMETERS: *obj_desc - Pointer to entry to be dumped
447 * Depth - Current nesting depth 452 * depth - Current nesting depth
448 * 453 *
449 * RETURN: None 454 * RETURN: None
450 * 455 *
@@ -726,7 +731,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
726 * 731 *
727 * FUNCTION: acpi_ex_dump_operands 732 * FUNCTION: acpi_ex_dump_operands
728 * 733 *
729 * PARAMETERS: Operands - A list of Operand objects 734 * PARAMETERS: operands - A list of Operand objects
730 * opcode_name - AML opcode name 735 * opcode_name - AML opcode name
731 * num_operands - Operand count for this opcode 736 * num_operands - Operand count for this opcode
732 * 737 *
@@ -769,8 +774,8 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
769 * 774 *
770 * FUNCTION: acpi_ex_out* functions 775 * FUNCTION: acpi_ex_out* functions
771 * 776 *
772 * PARAMETERS: Title - Descriptive text 777 * PARAMETERS: title - Descriptive text
773 * Value - Value to be displayed 778 * value - Value to be displayed
774 * 779 *
775 * DESCRIPTION: Object dump output formatting functions. These functions 780 * DESCRIPTION: Object dump output formatting functions. These functions
776 * reduce the number of format strings required and keeps them 781 * reduce the number of format strings required and keeps them
@@ -792,8 +797,8 @@ static void acpi_ex_out_pointer(char *title, void *value)
792 * 797 *
793 * FUNCTION: acpi_ex_dump_namespace_node 798 * FUNCTION: acpi_ex_dump_namespace_node
794 * 799 *
795 * PARAMETERS: Node - Descriptor to dump 800 * PARAMETERS: node - Descriptor to dump
796 * Flags - Force display if TRUE 801 * flags - Force display if TRUE
797 * 802 *
798 * DESCRIPTION: Dumps the members of the given.Node 803 * DESCRIPTION: Dumps the members of the given.Node
799 * 804 *
@@ -825,7 +830,7 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
825 * 830 *
826 * FUNCTION: acpi_ex_dump_reference_obj 831 * FUNCTION: acpi_ex_dump_reference_obj
827 * 832 *
828 * PARAMETERS: Object - Descriptor to dump 833 * PARAMETERS: object - Descriptor to dump
829 * 834 *
830 * DESCRIPTION: Dumps a reference object 835 * DESCRIPTION: Dumps a reference object
831 * 836 *
@@ -882,8 +887,8 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
882 * FUNCTION: acpi_ex_dump_package_obj 887 * FUNCTION: acpi_ex_dump_package_obj
883 * 888 *
884 * PARAMETERS: obj_desc - Descriptor to dump 889 * PARAMETERS: obj_desc - Descriptor to dump
885 * Level - Indentation Level 890 * level - Indentation Level
886 * Index - Package index for this object 891 * index - Package index for this object
887 * 892 *
888 * DESCRIPTION: Dumps the elements of the package 893 * DESCRIPTION: Dumps the elements of the package
889 * 894 *
@@ -926,9 +931,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
926 case ACPI_TYPE_STRING: 931 case ACPI_TYPE_STRING:
927 932
928 acpi_os_printf("[String] Value: "); 933 acpi_os_printf("[String] Value: ");
929 for (i = 0; i < obj_desc->string.length; i++) { 934 acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
930 acpi_os_printf("%c", obj_desc->string.pointer[i]);
931 }
932 acpi_os_printf("\n"); 935 acpi_os_printf("\n");
933 break; 936 break;
934 937
@@ -977,7 +980,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
977 * FUNCTION: acpi_ex_dump_object_descriptor 980 * FUNCTION: acpi_ex_dump_object_descriptor
978 * 981 *
979 * PARAMETERS: obj_desc - Descriptor to dump 982 * PARAMETERS: obj_desc - Descriptor to dump
980 * Flags - Force display if TRUE 983 * flags - Force display if TRUE
981 * 984 *
982 * DESCRIPTION: Dumps the members of the object descriptor given. 985 * DESCRIPTION: Dumps the members of the object descriptor given.
983 * 986 *
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index 149de45fdadd..a7784152ed30 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -222,9 +222,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
222 * PARAMETERS: obj_desc - Field to be read 222 * PARAMETERS: obj_desc - Field to be read
223 * field_datum_byte_offset - Byte offset of this datum within the 223 * field_datum_byte_offset - Byte offset of this datum within the
224 * parent field 224 * parent field
225 * Value - Where to store value (must at least 225 * value - Where to store value (must at least
226 * 64 bits) 226 * 64 bits)
227 * Function - Read or Write flag plus other region- 227 * function - Read or Write flag plus other region-
228 * dependent flags 228 * dependent flags
229 * 229 *
230 * RETURN: Status 230 * RETURN: Status
@@ -315,7 +315,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
315 * FUNCTION: acpi_ex_register_overflow 315 * FUNCTION: acpi_ex_register_overflow
316 * 316 *
317 * PARAMETERS: obj_desc - Register(Field) to be written 317 * PARAMETERS: obj_desc - Register(Field) to be written
318 * Value - Value to be stored 318 * value - Value to be stored
319 * 319 *
320 * RETURN: TRUE if value overflows the field, FALSE otherwise 320 * RETURN: TRUE if value overflows the field, FALSE otherwise
321 * 321 *
@@ -365,7 +365,7 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value)
365 * PARAMETERS: obj_desc - Field to be read 365 * PARAMETERS: obj_desc - Field to be read
366 * field_datum_byte_offset - Byte offset of this datum within the 366 * field_datum_byte_offset - Byte offset of this datum within the
367 * parent field 367 * parent field
368 * Value - Where to store value (must be 64 bits) 368 * value - Where to store value (must be 64 bits)
369 * read_write - Read or Write flag 369 * read_write - Read or Write flag
370 * 370 *
371 * RETURN: Status 371 * RETURN: Status
@@ -574,7 +574,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
574 * FUNCTION: acpi_ex_write_with_update_rule 574 * FUNCTION: acpi_ex_write_with_update_rule
575 * 575 *
576 * PARAMETERS: obj_desc - Field to be written 576 * PARAMETERS: obj_desc - Field to be written
577 * Mask - bitmask within field datum 577 * mask - bitmask within field datum
578 * field_value - Value to write 578 * field_value - Value to write
579 * field_datum_byte_offset - Offset of datum within field 579 * field_datum_byte_offset - Offset of datum within field
580 * 580 *
@@ -678,7 +678,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
678 * FUNCTION: acpi_ex_extract_from_field 678 * FUNCTION: acpi_ex_extract_from_field
679 * 679 *
680 * PARAMETERS: obj_desc - Field to be read 680 * PARAMETERS: obj_desc - Field to be read
681 * Buffer - Where to store the field data 681 * buffer - Where to store the field data
682 * buffer_length - Length of Buffer 682 * buffer_length - Length of Buffer
683 * 683 *
684 * RETURN: Status 684 * RETURN: Status
@@ -823,7 +823,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
823 * FUNCTION: acpi_ex_insert_into_field 823 * FUNCTION: acpi_ex_insert_into_field
824 * 824 *
825 * PARAMETERS: obj_desc - Field to be written 825 * PARAMETERS: obj_desc - Field to be written
826 * Buffer - Data to be written 826 * buffer - Data to be written
827 * buffer_length - Length of Buffer 827 * buffer_length - Length of Buffer
828 * 828 *
829 * RETURN: Status 829 * RETURN: Status
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 0a0893310348..271c0c57ea10 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -144,8 +144,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
144 * 144 *
145 * FUNCTION: acpi_ex_concat_template 145 * FUNCTION: acpi_ex_concat_template
146 * 146 *
147 * PARAMETERS: Operand0 - First source object 147 * PARAMETERS: operand0 - First source object
148 * Operand1 - Second source object 148 * operand1 - Second source object
149 * actual_return_desc - Where to place the return object 149 * actual_return_desc - Where to place the return object
150 * walk_state - Current walk state 150 * walk_state - Current walk state
151 * 151 *
@@ -229,8 +229,8 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
229 * 229 *
230 * FUNCTION: acpi_ex_do_concatenate 230 * FUNCTION: acpi_ex_do_concatenate
231 * 231 *
232 * PARAMETERS: Operand0 - First source object 232 * PARAMETERS: operand0 - First source object
233 * Operand1 - Second source object 233 * operand1 - Second source object
234 * actual_return_desc - Where to place the return object 234 * actual_return_desc - Where to place the return object
235 * walk_state - Current walk state 235 * walk_state - Current walk state
236 * 236 *
@@ -397,9 +397,9 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
397 * 397 *
398 * FUNCTION: acpi_ex_do_math_op 398 * FUNCTION: acpi_ex_do_math_op
399 * 399 *
400 * PARAMETERS: Opcode - AML opcode 400 * PARAMETERS: opcode - AML opcode
401 * Integer0 - Integer operand #0 401 * integer0 - Integer operand #0
402 * Integer1 - Integer operand #1 402 * integer1 - Integer operand #1
403 * 403 *
404 * RETURN: Integer result of the operation 404 * RETURN: Integer result of the operation
405 * 405 *
@@ -479,9 +479,9 @@ u64 acpi_ex_do_math_op(u16 opcode, u64 integer0, u64 integer1)
479 * 479 *
480 * FUNCTION: acpi_ex_do_logical_numeric_op 480 * FUNCTION: acpi_ex_do_logical_numeric_op
481 * 481 *
482 * PARAMETERS: Opcode - AML opcode 482 * PARAMETERS: opcode - AML opcode
483 * Integer0 - Integer operand #0 483 * integer0 - Integer operand #0
484 * Integer1 - Integer operand #1 484 * integer1 - Integer operand #1
485 * logical_result - TRUE/FALSE result of the operation 485 * logical_result - TRUE/FALSE result of the operation
486 * 486 *
487 * RETURN: Status 487 * RETURN: Status
@@ -534,9 +534,9 @@ acpi_ex_do_logical_numeric_op(u16 opcode,
534 * 534 *
535 * FUNCTION: acpi_ex_do_logical_op 535 * FUNCTION: acpi_ex_do_logical_op
536 * 536 *
537 * PARAMETERS: Opcode - AML opcode 537 * PARAMETERS: opcode - AML opcode
538 * Operand0 - operand #0 538 * operand0 - operand #0
539 * Operand1 - operand #1 539 * operand1 - operand #1
540 * logical_result - TRUE/FALSE result of the operation 540 * logical_result - TRUE/FALSE result of the operation
541 * 541 *
542 * RETURN: Status 542 * RETURN: Status
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c
index 60933e9dc3c0..bcceda5be9e3 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -102,7 +102,7 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc)
102 * FUNCTION: acpi_ex_link_mutex 102 * FUNCTION: acpi_ex_link_mutex
103 * 103 *
104 * PARAMETERS: obj_desc - The mutex to be linked 104 * PARAMETERS: obj_desc - The mutex to be linked
105 * Thread - Current executing thread object 105 * thread - Current executing thread object
106 * 106 *
107 * RETURN: None 107 * RETURN: None
108 * 108 *
@@ -138,7 +138,7 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
138 * 138 *
139 * FUNCTION: acpi_ex_acquire_mutex_object 139 * FUNCTION: acpi_ex_acquire_mutex_object
140 * 140 *
141 * PARAMETERS: Timeout - Timeout in milliseconds 141 * PARAMETERS: timeout - Timeout in milliseconds
142 * obj_desc - Mutex object 142 * obj_desc - Mutex object
143 * thread_id - Current thread state 143 * thread_id - Current thread state
144 * 144 *
@@ -443,7 +443,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
443 * 443 *
444 * FUNCTION: acpi_ex_release_all_mutexes 444 * FUNCTION: acpi_ex_release_all_mutexes
445 * 445 *
446 * PARAMETERS: Thread - Current executing thread object 446 * PARAMETERS: thread - Current executing thread object
447 * 447 *
448 * RETURN: Status 448 * RETURN: Status
449 * 449 *
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 30157f5a12d7..81eca60d2748 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -391,12 +391,12 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
391 * 391 *
392 * FUNCTION: acpi_ex_prep_field_value 392 * FUNCTION: acpi_ex_prep_field_value
393 * 393 *
394 * PARAMETERS: Info - Contains all field creation info 394 * PARAMETERS: info - Contains all field creation info
395 * 395 *
396 * RETURN: Status 396 * RETURN: Status
397 * 397 *
398 * DESCRIPTION: Construct a union acpi_operand_object of type def_field and 398 * DESCRIPTION: Construct an object of type union acpi_operand_object with a
399 * connect it to the parent Node. 399 * subtype of def_field and connect it to the parent Node.
400 * 400 *
401 ******************************************************************************/ 401 ******************************************************************************/
402 402
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index 12d51df6d3bf..1f1ce0c3d2f8 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -53,10 +53,10 @@ ACPI_MODULE_NAME("exregion")
53 * 53 *
54 * FUNCTION: acpi_ex_system_memory_space_handler 54 * FUNCTION: acpi_ex_system_memory_space_handler
55 * 55 *
56 * PARAMETERS: Function - Read or Write operation 56 * PARAMETERS: function - Read or Write operation
57 * Address - Where in the space to read or write 57 * address - Where in the space to read or write
58 * bit_width - Field width in bits (8, 16, or 32) 58 * bit_width - Field width in bits (8, 16, or 32)
59 * Value - Pointer to in or out value 59 * value - Pointer to in or out value
60 * handler_context - Pointer to Handler's context 60 * handler_context - Pointer to Handler's context
61 * region_context - Pointer to context specific to the 61 * region_context - Pointer to context specific to the
62 * accessed region 62 * accessed region
@@ -270,10 +270,10 @@ acpi_ex_system_memory_space_handler(u32 function,
270 * 270 *
271 * FUNCTION: acpi_ex_system_io_space_handler 271 * FUNCTION: acpi_ex_system_io_space_handler
272 * 272 *
273 * PARAMETERS: Function - Read or Write operation 273 * PARAMETERS: function - Read or Write operation
274 * Address - Where in the space to read or write 274 * address - Where in the space to read or write
275 * bit_width - Field width in bits (8, 16, or 32) 275 * bit_width - Field width in bits (8, 16, or 32)
276 * Value - Pointer to in or out value 276 * value - Pointer to in or out value
277 * handler_context - Pointer to Handler's context 277 * handler_context - Pointer to Handler's context
278 * region_context - Pointer to context specific to the 278 * region_context - Pointer to context specific to the
279 * accessed region 279 * accessed region
@@ -329,10 +329,10 @@ acpi_ex_system_io_space_handler(u32 function,
329 * 329 *
330 * FUNCTION: acpi_ex_pci_config_space_handler 330 * FUNCTION: acpi_ex_pci_config_space_handler
331 * 331 *
332 * PARAMETERS: Function - Read or Write operation 332 * PARAMETERS: function - Read or Write operation
333 * Address - Where in the space to read or write 333 * address - Where in the space to read or write
334 * bit_width - Field width in bits (8, 16, or 32) 334 * bit_width - Field width in bits (8, 16, or 32)
335 * Value - Pointer to in or out value 335 * value - Pointer to in or out value
336 * handler_context - Pointer to Handler's context 336 * handler_context - Pointer to Handler's context
337 * region_context - Pointer to context specific to the 337 * region_context - Pointer to context specific to the
338 * accessed region 338 * accessed region
@@ -365,7 +365,7 @@ acpi_ex_pci_config_space_handler(u32 function,
365 * pci_function is the PCI device function number 365 * pci_function is the PCI device function number
366 * pci_register is the Config space register range 0-255 bytes 366 * pci_register is the Config space register range 0-255 bytes
367 * 367 *
368 * Value - input value for write, output address for read 368 * value - input value for write, output address for read
369 * 369 *
370 */ 370 */
371 pci_id = (struct acpi_pci_id *)region_context; 371 pci_id = (struct acpi_pci_id *)region_context;
@@ -402,10 +402,10 @@ acpi_ex_pci_config_space_handler(u32 function,
402 * 402 *
403 * FUNCTION: acpi_ex_cmos_space_handler 403 * FUNCTION: acpi_ex_cmos_space_handler
404 * 404 *
405 * PARAMETERS: Function - Read or Write operation 405 * PARAMETERS: function - Read or Write operation
406 * Address - Where in the space to read or write 406 * address - Where in the space to read or write
407 * bit_width - Field width in bits (8, 16, or 32) 407 * bit_width - Field width in bits (8, 16, or 32)
408 * Value - Pointer to in or out value 408 * value - Pointer to in or out value
409 * handler_context - Pointer to Handler's context 409 * handler_context - Pointer to Handler's context
410 * region_context - Pointer to context specific to the 410 * region_context - Pointer to context specific to the
411 * accessed region 411 * accessed region
@@ -434,10 +434,10 @@ acpi_ex_cmos_space_handler(u32 function,
434 * 434 *
435 * FUNCTION: acpi_ex_pci_bar_space_handler 435 * FUNCTION: acpi_ex_pci_bar_space_handler
436 * 436 *
437 * PARAMETERS: Function - Read or Write operation 437 * PARAMETERS: function - Read or Write operation
438 * Address - Where in the space to read or write 438 * address - Where in the space to read or write
439 * bit_width - Field width in bits (8, 16, or 32) 439 * bit_width - Field width in bits (8, 16, or 32)
440 * Value - Pointer to in or out value 440 * value - Pointer to in or out value
441 * handler_context - Pointer to Handler's context 441 * handler_context - Pointer to Handler's context
442 * region_context - Pointer to context specific to the 442 * region_context - Pointer to context specific to the
443 * accessed region 443 * accessed region
@@ -466,10 +466,10 @@ acpi_ex_pci_bar_space_handler(u32 function,
466 * 466 *
467 * FUNCTION: acpi_ex_data_table_space_handler 467 * FUNCTION: acpi_ex_data_table_space_handler
468 * 468 *
469 * PARAMETERS: Function - Read or Write operation 469 * PARAMETERS: function - Read or Write operation
470 * Address - Where in the space to read or write 470 * address - Where in the space to read or write
471 * bit_width - Field width in bits (8, 16, or 32) 471 * bit_width - Field width in bits (8, 16, or 32)
472 * Value - Pointer to in or out value 472 * value - Pointer to in or out value
473 * handler_context - Pointer to Handler's context 473 * handler_context - Pointer to Handler's context
474 * region_context - Pointer to context specific to the 474 * region_context - Pointer to context specific to the
475 * accessed region 475 * accessed region
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index 6e335dc34528..bbf40ac27585 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -147,7 +147,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
147 147
148 stack_desc = *stack_ptr; 148 stack_desc = *stack_ptr;
149 149
150 /* This is a union acpi_operand_object */ 150 /* This is an object of type union acpi_operand_object */
151 151
152 switch (stack_desc->common.type) { 152 switch (stack_desc->common.type) {
153 case ACPI_TYPE_LOCAL_REFERENCE: 153 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -321,7 +321,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
321 * FUNCTION: acpi_ex_resolve_multiple 321 * FUNCTION: acpi_ex_resolve_multiple
322 * 322 *
323 * PARAMETERS: walk_state - Current state (contains AML opcode) 323 * PARAMETERS: walk_state - Current state (contains AML opcode)
324 * Operand - Starting point for resolution 324 * operand - Starting point for resolution
325 * return_type - Where the object type is returned 325 * return_type - Where the object type is returned
326 * return_desc - Where the resolved object is returned 326 * return_desc - Where the resolved object is returned
327 * 327 *
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index a67b1d925ddd..f232fbabdea8 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -113,7 +113,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
113 * 113 *
114 * FUNCTION: acpi_ex_resolve_operands 114 * FUNCTION: acpi_ex_resolve_operands
115 * 115 *
116 * PARAMETERS: Opcode - Opcode being interpreted 116 * PARAMETERS: opcode - Opcode being interpreted
117 * stack_ptr - Pointer to the operand stack to be 117 * stack_ptr - Pointer to the operand stack to be
118 * resolved 118 * resolved
119 * walk_state - Current state 119 * walk_state - Current state
@@ -307,7 +307,7 @@ acpi_ex_resolve_operands(u16 opcode,
307 case ARGI_DEVICE_REF: 307 case ARGI_DEVICE_REF:
308 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ 308 case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
309 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ 309 case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
310 case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ 310 case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */
311 311
312 /* 312 /*
313 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE 313 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
@@ -410,7 +410,7 @@ acpi_ex_resolve_operands(u16 opcode,
410 /* 410 /*
411 * Need an operand of type ACPI_TYPE_INTEGER, 411 * Need an operand of type ACPI_TYPE_INTEGER,
412 * But we can implicitly convert from a STRING or BUFFER 412 * But we can implicitly convert from a STRING or BUFFER
413 * Aka - "Implicit Source Operand Conversion" 413 * aka - "Implicit Source Operand Conversion"
414 */ 414 */
415 status = 415 status =
416 acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); 416 acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
@@ -437,7 +437,7 @@ acpi_ex_resolve_operands(u16 opcode,
437 /* 437 /*
438 * Need an operand of type ACPI_TYPE_BUFFER, 438 * Need an operand of type ACPI_TYPE_BUFFER,
439 * But we can implicitly convert from a STRING or INTEGER 439 * But we can implicitly convert from a STRING or INTEGER
440 * Aka - "Implicit Source Operand Conversion" 440 * aka - "Implicit Source Operand Conversion"
441 */ 441 */
442 status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); 442 status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
443 if (ACPI_FAILURE(status)) { 443 if (ACPI_FAILURE(status)) {
@@ -463,7 +463,7 @@ acpi_ex_resolve_operands(u16 opcode,
463 /* 463 /*
464 * Need an operand of type ACPI_TYPE_STRING, 464 * Need an operand of type ACPI_TYPE_STRING,
465 * But we can implicitly convert from a BUFFER or INTEGER 465 * But we can implicitly convert from a BUFFER or INTEGER
466 * Aka - "Implicit Source Operand Conversion" 466 * aka - "Implicit Source Operand Conversion"
467 */ 467 */
468 status = acpi_ex_convert_to_string(obj_desc, stack_ptr, 468 status = acpi_ex_convert_to_string(obj_desc, stack_ptr,
469 ACPI_IMPLICIT_CONVERT_HEX); 469 ACPI_IMPLICIT_CONVERT_HEX);
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index c6cf843cc4c9..5fffe7ab5ece 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -62,8 +62,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
62 * FUNCTION: acpi_ex_store 62 * FUNCTION: acpi_ex_store
63 * 63 *
64 * PARAMETERS: *source_desc - Value to be stored 64 * PARAMETERS: *source_desc - Value to be stored
65 * *dest_desc - Where to store it. Must be an NS node 65 * *dest_desc - Where to store it. Must be an NS node
66 * or a union acpi_operand_object of type 66 * or union acpi_operand_object of type
67 * Reference; 67 * Reference;
68 * walk_state - Current walk state 68 * walk_state - Current walk state
69 * 69 *
@@ -361,7 +361,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
361 * FUNCTION: acpi_ex_store_object_to_node 361 * FUNCTION: acpi_ex_store_object_to_node
362 * 362 *
363 * PARAMETERS: source_desc - Value to be stored 363 * PARAMETERS: source_desc - Value to be stored
364 * Node - Named object to receive the value 364 * node - Named object to receive the value
365 * walk_state - Current walk state 365 * walk_state - Current walk state
366 * implicit_conversion - Perform implicit conversion (yes/no) 366 * implicit_conversion - Perform implicit conversion (yes/no)
367 * 367 *
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c
index 65a45d8335c8..53c248473547 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -110,7 +110,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
110 * NOTE: ACPI versions up to 3.0 specified that the buffer must be 110 * NOTE: ACPI versions up to 3.0 specified that the buffer must be
111 * truncated if the string is smaller than the buffer. However, "other" 111 * truncated if the string is smaller than the buffer. However, "other"
112 * implementations of ACPI never did this and thus became the defacto 112 * implementations of ACPI never did this and thus became the defacto
113 * standard. ACPI 3.0_a changes this behavior such that the buffer 113 * standard. ACPI 3.0A changes this behavior such that the buffer
114 * is no longer truncated. 114 * is no longer truncated.
115 */ 115 */
116 116
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index 191a12945226..b760641e2fc6 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -53,8 +53,8 @@ ACPI_MODULE_NAME("exsystem")
53 * 53 *
54 * FUNCTION: acpi_ex_system_wait_semaphore 54 * FUNCTION: acpi_ex_system_wait_semaphore
55 * 55 *
56 * PARAMETERS: Semaphore - Semaphore to wait on 56 * PARAMETERS: semaphore - Semaphore to wait on
57 * Timeout - Max time to wait 57 * timeout - Max time to wait
58 * 58 *
59 * RETURN: Status 59 * RETURN: Status
60 * 60 *
@@ -98,8 +98,8 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
98 * 98 *
99 * FUNCTION: acpi_ex_system_wait_mutex 99 * FUNCTION: acpi_ex_system_wait_mutex
100 * 100 *
101 * PARAMETERS: Mutex - Mutex to wait on 101 * PARAMETERS: mutex - Mutex to wait on
102 * Timeout - Max time to wait 102 * timeout - Max time to wait
103 * 103 *
104 * RETURN: Status 104 * RETURN: Status
105 * 105 *
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index eb6798ba8b59..d1ab7917eed7 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -109,7 +109,7 @@ void acpi_ex_enter_interpreter(void)
109 * 109 *
110 * DESCRIPTION: Reacquire the interpreter execution region from within the 110 * DESCRIPTION: Reacquire the interpreter execution region from within the
111 * interpreter code. Failure to enter the interpreter region is a 111 * interpreter code. Failure to enter the interpreter region is a
112 * fatal system error. Used in conjunction with 112 * fatal system error. Used in conjunction with
113 * relinquish_interpreter 113 * relinquish_interpreter
114 * 114 *
115 ******************************************************************************/ 115 ******************************************************************************/
@@ -317,8 +317,8 @@ void acpi_ex_release_global_lock(u32 field_flags)
317 * 317 *
318 * FUNCTION: acpi_ex_digits_needed 318 * FUNCTION: acpi_ex_digits_needed
319 * 319 *
320 * PARAMETERS: Value - Value to be represented 320 * PARAMETERS: value - Value to be represented
321 * Base - Base of representation 321 * base - Base of representation
322 * 322 *
323 * RETURN: The number of digits. 323 * RETURN: The number of digits.
324 * 324 *
@@ -408,7 +408,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id)
408 * PARAMETERS: out_string - Where to put the converted string. At least 408 * PARAMETERS: out_string - Where to put the converted string. At least
409 * 21 bytes are needed to hold the largest 409 * 21 bytes are needed to hold the largest
410 * possible 64-bit integer. 410 * possible 64-bit integer.
411 * Value - Value to be converted 411 * value - Value to be converted
412 * 412 *
413 * RETURN: None, string 413 * RETURN: None, string
414 * 414 *
@@ -443,7 +443,7 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
443 * 443 *
444 * RETURN: TRUE if valid/supported ID. 444 * RETURN: TRUE if valid/supported ID.
445 * 445 *
446 * DESCRIPTION: Validate an operation region space_iD. 446 * DESCRIPTION: Validate an operation region space_ID.
447 * 447 *
448 ******************************************************************************/ 448 ******************************************************************************/
449 449
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index d0b9ed5df97e..a1e71d0ef57b 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("hwacpi")
53 * 53 *
54 * FUNCTION: acpi_hw_set_mode 54 * FUNCTION: acpi_hw_set_mode
55 * 55 *
56 * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY 56 * PARAMETERS: mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
57 * 57 *
58 * RETURN: Status 58 * RETURN: Status
59 * 59 *
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 29e859293edd..48518dac5342 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -90,7 +90,7 @@ void acpi_hw_execute_sleep_method(char *method_pathname, u32 integer_argument)
90 * FUNCTION: acpi_hw_extended_sleep 90 * FUNCTION: acpi_hw_extended_sleep
91 * 91 *
92 * PARAMETERS: sleep_state - Which sleep state to enter 92 * PARAMETERS: sleep_state - Which sleep state to enter
93 * Flags - ACPI_EXECUTE_GTS to run optional method 93 * flags - ACPI_EXECUTE_GTS to run optional method
94 * 94 *
95 * RETURN: Status 95 * RETURN: Status
96 * 96 *
@@ -117,7 +117,8 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
117 117
118 /* Clear wake status (WAK_STS) */ 118 /* Clear wake status (WAK_STS) */
119 119
120 status = acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); 120 status =
121 acpi_write((u64)ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status);
121 if (ACPI_FAILURE(status)) { 122 if (ACPI_FAILURE(status)) {
122 return_ACPI_STATUS(status); 123 return_ACPI_STATUS(status);
123 } 124 }
@@ -147,7 +148,7 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
147 ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & 148 ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) &
148 ACPI_X_SLEEP_TYPE_MASK); 149 ACPI_X_SLEEP_TYPE_MASK);
149 150
150 status = acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE), 151 status = acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
151 &acpi_gbl_FADT.sleep_control); 152 &acpi_gbl_FADT.sleep_control);
152 if (ACPI_FAILURE(status)) { 153 if (ACPI_FAILURE(status)) {
153 return_ACPI_STATUS(status); 154 return_ACPI_STATUS(status);
@@ -171,7 +172,7 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state, u8 flags)
171 * FUNCTION: acpi_hw_extended_wake_prep 172 * FUNCTION: acpi_hw_extended_wake_prep
172 * 173 *
173 * PARAMETERS: sleep_state - Which sleep state we just exited 174 * PARAMETERS: sleep_state - Which sleep state we just exited
174 * Flags - ACPI_EXECUTE_BFS to run optional method 175 * flags - ACPI_EXECUTE_BFS to run optional method
175 * 176 *
176 * RETURN: Status 177 * RETURN: Status
177 * 178 *
@@ -195,7 +196,7 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state, u8 flags)
195 ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) & 196 ((acpi_gbl_sleep_type_a << ACPI_X_SLEEP_TYPE_POSITION) &
196 ACPI_X_SLEEP_TYPE_MASK); 197 ACPI_X_SLEEP_TYPE_MASK);
197 198
198 (void)acpi_write((sleep_type_value | ACPI_X_SLEEP_ENABLE), 199 (void)acpi_write((u64)(sleep_type_value | ACPI_X_SLEEP_ENABLE),
199 &acpi_gbl_FADT.sleep_control); 200 &acpi_gbl_FADT.sleep_control);
200 } 201 }
201 202
@@ -212,7 +213,7 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state, u8 flags)
212 * FUNCTION: acpi_hw_extended_wake 213 * FUNCTION: acpi_hw_extended_wake
213 * 214 *
214 * PARAMETERS: sleep_state - Which sleep state we just exited 215 * PARAMETERS: sleep_state - Which sleep state we just exited
215 * Flags - Reserved, set to zero 216 * flags - Reserved, set to zero
216 * 217 *
217 * RETURN: Status 218 * RETURN: Status
218 * 219 *
@@ -239,7 +240,7 @@ acpi_status acpi_hw_extended_wake(u8 sleep_state, u8 flags)
239 * and use it to determine whether the system is rebooting or 240 * and use it to determine whether the system is rebooting or
240 * resuming. Clear WAK_STS for compatibility. 241 * resuming. Clear WAK_STS for compatibility.
241 */ 242 */
242 (void)acpi_write(ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); 243 (void)acpi_write((u64)ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status);
243 acpi_gbl_system_awake_and_running = TRUE; 244 acpi_gbl_system_awake_and_running = TRUE;
244 245
245 acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING); 246 acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 6b6c83b87b52..4af6d20ef077 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -69,9 +69,9 @@ acpi_hw_write_multiple(u32 value,
69 * 69 *
70 * FUNCTION: acpi_hw_validate_register 70 * FUNCTION: acpi_hw_validate_register
71 * 71 *
72 * PARAMETERS: Reg - GAS register structure 72 * PARAMETERS: reg - GAS register structure
73 * max_bit_width - Max bit_width supported (32 or 64) 73 * max_bit_width - Max bit_width supported (32 or 64)
74 * Address - Pointer to where the gas->address 74 * address - Pointer to where the gas->address
75 * is returned 75 * is returned
76 * 76 *
77 * RETURN: Status 77 * RETURN: Status
@@ -102,7 +102,7 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
102 return (AE_BAD_ADDRESS); 102 return (AE_BAD_ADDRESS);
103 } 103 }
104 104
105 /* Validate the space_iD */ 105 /* Validate the space_ID */
106 106
107 if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && 107 if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
108 (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { 108 (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
@@ -137,8 +137,8 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
137 * 137 *
138 * FUNCTION: acpi_hw_read 138 * FUNCTION: acpi_hw_read
139 * 139 *
140 * PARAMETERS: Value - Where the value is returned 140 * PARAMETERS: value - Where the value is returned
141 * Reg - GAS register structure 141 * reg - GAS register structure
142 * 142 *
143 * RETURN: Status 143 * RETURN: Status
144 * 144 *
@@ -148,7 +148,7 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
148 * 148 *
149 * LIMITATIONS: <These limitations also apply to acpi_hw_write> 149 * LIMITATIONS: <These limitations also apply to acpi_hw_write>
150 * bit_width must be exactly 8, 16, or 32. 150 * bit_width must be exactly 8, 16, or 32.
151 * space_iD must be system_memory or system_iO. 151 * space_ID must be system_memory or system_IO.
152 * bit_offset and access_width are currently ignored, as there has 152 * bit_offset and access_width are currently ignored, as there has
153 * not been a need to implement these. 153 * not been a need to implement these.
154 * 154 *
@@ -200,8 +200,8 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
200 * 200 *
201 * FUNCTION: acpi_hw_write 201 * FUNCTION: acpi_hw_write
202 * 202 *
203 * PARAMETERS: Value - Value to be written 203 * PARAMETERS: value - Value to be written
204 * Reg - GAS register structure 204 * reg - GAS register structure
205 * 205 *
206 * RETURN: Status 206 * RETURN: Status
207 * 207 *
@@ -439,7 +439,7 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)
439 * FUNCTION: acpi_hw_register_write 439 * FUNCTION: acpi_hw_register_write
440 * 440 *
441 * PARAMETERS: register_id - ACPI Register ID 441 * PARAMETERS: register_id - ACPI Register ID
442 * Value - The value to write 442 * value - The value to write
443 * 443 *
444 * RETURN: Status 444 * RETURN: Status
445 * 445 *
@@ -571,7 +571,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
571 * 571 *
572 * FUNCTION: acpi_hw_read_multiple 572 * FUNCTION: acpi_hw_read_multiple
573 * 573 *
574 * PARAMETERS: Value - Where the register value is returned 574 * PARAMETERS: value - Where the register value is returned
575 * register_a - First ACPI register (required) 575 * register_a - First ACPI register (required)
576 * register_b - Second ACPI register (optional) 576 * register_b - Second ACPI register (optional)
577 * 577 *
@@ -624,7 +624,7 @@ acpi_hw_read_multiple(u32 *value,
624 * 624 *
625 * FUNCTION: acpi_hw_write_multiple 625 * FUNCTION: acpi_hw_write_multiple
626 * 626 *
627 * PARAMETERS: Value - The value to write 627 * PARAMETERS: value - The value to write
628 * register_a - First ACPI register (required) 628 * register_a - First ACPI register (required)
629 * register_b - Second ACPI register (optional) 629 * register_b - Second ACPI register (optional)
630 * 630 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 615996a36bed..9960fe9ef533 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -56,7 +56,7 @@ ACPI_MODULE_NAME("hwsleep")
56 * FUNCTION: acpi_hw_legacy_sleep 56 * FUNCTION: acpi_hw_legacy_sleep
57 * 57 *
58 * PARAMETERS: sleep_state - Which sleep state to enter 58 * PARAMETERS: sleep_state - Which sleep state to enter
59 * Flags - ACPI_EXECUTE_GTS to run optional method 59 * flags - ACPI_EXECUTE_GTS to run optional method
60 * 60 *
61 * RETURN: Status 61 * RETURN: Status
62 * 62 *
@@ -214,7 +214,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags)
214 * FUNCTION: acpi_hw_legacy_wake_prep 214 * FUNCTION: acpi_hw_legacy_wake_prep
215 * 215 *
216 * PARAMETERS: sleep_state - Which sleep state we just exited 216 * PARAMETERS: sleep_state - Which sleep state we just exited
217 * Flags - ACPI_EXECUTE_BFS to run optional method 217 * flags - ACPI_EXECUTE_BFS to run optional method
218 * 218 *
219 * RETURN: Status 219 * RETURN: Status
220 * 220 *
@@ -288,7 +288,7 @@ acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state, u8 flags)
288 * FUNCTION: acpi_hw_legacy_wake 288 * FUNCTION: acpi_hw_legacy_wake
289 * 289 *
290 * PARAMETERS: sleep_state - Which sleep state we just exited 290 * PARAMETERS: sleep_state - Which sleep state we just exited
291 * Flags - Reserved, set to zero 291 * flags - Reserved, set to zero
292 * 292 *
293 * RETURN: Status 293 * RETURN: Status
294 * 294 *
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index f1b2c3b94cac..b6411f16832f 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("hwtimer")
54 * 54 *
55 * FUNCTION: acpi_get_timer_resolution 55 * FUNCTION: acpi_get_timer_resolution
56 * 56 *
57 * PARAMETERS: Resolution - Where the resolution is returned 57 * PARAMETERS: resolution - Where the resolution is returned
58 * 58 *
59 * RETURN: Status and timer resolution 59 * RETURN: Status and timer resolution
60 * 60 *
@@ -84,7 +84,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution)
84 * 84 *
85 * FUNCTION: acpi_get_timer 85 * FUNCTION: acpi_get_timer
86 * 86 *
87 * PARAMETERS: Ticks - Where the timer value is returned 87 * PARAMETERS: ticks - Where the timer value is returned
88 * 88 *
89 * RETURN: Status and current timer value (ticks) 89 * RETURN: Status and current timer value (ticks)
90 * 90 *
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index 6e5c43a60bb7..c99d546b217f 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -58,7 +58,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width);
58 * 58 *
59 * The table is used to implement the Microsoft port access rules that 59 * The table is used to implement the Microsoft port access rules that
60 * first appeared in Windows XP. Some ports are always illegal, and some 60 * first appeared in Windows XP. Some ports are always illegal, and some
61 * ports are only illegal if the BIOS calls _OSI with a win_xP string or 61 * ports are only illegal if the BIOS calls _OSI with a win_XP string or
62 * later (meaning that the BIOS itelf is post-XP.) 62 * later (meaning that the BIOS itelf is post-XP.)
63 * 63 *
64 * This provides ACPICA with the desired port protections and 64 * This provides ACPICA with the desired port protections and
@@ -66,7 +66,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width);
66 * 66 *
67 * Description of port entries: 67 * Description of port entries:
68 * DMA: DMA controller 68 * DMA: DMA controller
69 * PIC0: Programmable Interrupt Controller (8259_a) 69 * PIC0: Programmable Interrupt Controller (8259A)
70 * PIT1: System Timer 1 70 * PIT1: System Timer 1
71 * PIT2: System Timer 2 failsafe 71 * PIT2: System Timer 2 failsafe
72 * RTC: Real-time clock 72 * RTC: Real-time clock
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index a716fede4f25..7bfd649d1996 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -104,8 +104,8 @@ ACPI_EXPORT_SYMBOL(acpi_reset)
104 * 104 *
105 * FUNCTION: acpi_read 105 * FUNCTION: acpi_read
106 * 106 *
107 * PARAMETERS: Value - Where the value is returned 107 * PARAMETERS: value - Where the value is returned
108 * Reg - GAS register structure 108 * reg - GAS register structure
109 * 109 *
110 * RETURN: Status 110 * RETURN: Status
111 * 111 *
@@ -113,7 +113,7 @@ ACPI_EXPORT_SYMBOL(acpi_reset)
113 * 113 *
114 * LIMITATIONS: <These limitations also apply to acpi_write> 114 * LIMITATIONS: <These limitations also apply to acpi_write>
115 * bit_width must be exactly 8, 16, 32, or 64. 115 * bit_width must be exactly 8, 16, 32, or 64.
116 * space_iD must be system_memory or system_iO. 116 * space_ID must be system_memory or system_IO.
117 * bit_offset and access_width are currently ignored, as there has 117 * bit_offset and access_width are currently ignored, as there has
118 * not been a need to implement these. 118 * not been a need to implement these.
119 * 119 *
@@ -196,8 +196,8 @@ ACPI_EXPORT_SYMBOL(acpi_read)
196 * 196 *
197 * FUNCTION: acpi_write 197 * FUNCTION: acpi_write
198 * 198 *
199 * PARAMETERS: Value - Value to be written 199 * PARAMETERS: value - Value to be written
200 * Reg - GAS register structure 200 * reg - GAS register structure
201 * 201 *
202 * RETURN: Status 202 * RETURN: Status
203 * 203 *
@@ -441,7 +441,7 @@ ACPI_EXPORT_SYMBOL(acpi_write_bit_register)
441 * *sleep_type_a - Where SLP_TYPa is returned 441 * *sleep_type_a - Where SLP_TYPa is returned
442 * *sleep_type_b - Where SLP_TYPb is returned 442 * *sleep_type_b - Where SLP_TYPb is returned
443 * 443 *
444 * RETURN: Status - ACPI status 444 * RETURN: status - ACPI status
445 * 445 *
446 * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep 446 * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
447 * state. 447 * state.
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 762d059bb508..f8684bfe7907 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -205,7 +205,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
205 ACPI_FLUSH_CPU_CACHE(); 205 ACPI_FLUSH_CPU_CACHE();
206 206
207 status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, 207 status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
208 (u32)acpi_gbl_FADT.S4bios_request, 8); 208 (u32)acpi_gbl_FADT.s4_bios_request, 8);
209 209
210 do { 210 do {
211 acpi_os_stall(1000); 211 acpi_os_stall(1000);
@@ -349,7 +349,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
349 * FUNCTION: acpi_enter_sleep_state 349 * FUNCTION: acpi_enter_sleep_state
350 * 350 *
351 * PARAMETERS: sleep_state - Which sleep state to enter 351 * PARAMETERS: sleep_state - Which sleep state to enter
352 * Flags - ACPI_EXECUTE_GTS to run optional method 352 * flags - ACPI_EXECUTE_GTS to run optional method
353 * 353 *
354 * RETURN: Status 354 * RETURN: Status
355 * 355 *
@@ -382,7 +382,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
382 * FUNCTION: acpi_leave_sleep_state_prep 382 * FUNCTION: acpi_leave_sleep_state_prep
383 * 383 *
384 * PARAMETERS: sleep_state - Which sleep state we are exiting 384 * PARAMETERS: sleep_state - Which sleep state we are exiting
385 * Flags - ACPI_EXECUTE_BFS to run optional method 385 * flags - ACPI_EXECUTE_BFS to run optional method
386 * 386 *
387 * RETURN: Status 387 * RETURN: Status
388 * 388 *
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 61623f3f6826..23db53ce2293 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -157,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void)
157 157
158#if defined (ACPI_ASL_COMPILER) 158#if defined (ACPI_ASL_COMPILER)
159 159
160 /* Save the parameter count for the i_aSL compiler */ 160 /* Save the parameter count for the iASL compiler */
161 161
162 new_node->value = obj_desc->method.param_count; 162 new_node->value = obj_desc->method.param_count;
163#else 163#else
@@ -258,11 +258,11 @@ acpi_status acpi_ns_root_initialize(void)
258 * FUNCTION: acpi_ns_lookup 258 * FUNCTION: acpi_ns_lookup
259 * 259 *
260 * PARAMETERS: scope_info - Current scope info block 260 * PARAMETERS: scope_info - Current scope info block
261 * Pathname - Search pathname, in internal format 261 * pathname - Search pathname, in internal format
262 * (as represented in the AML stream) 262 * (as represented in the AML stream)
263 * Type - Type associated with name 263 * type - Type associated with name
264 * interpreter_mode - IMODE_LOAD_PASS2 => add name if not found 264 * interpreter_mode - IMODE_LOAD_PASS2 => add name if not found
265 * Flags - Flags describing the search restrictions 265 * flags - Flags describing the search restrictions
266 * walk_state - Current state of the walk 266 * walk_state - Current state of the walk
267 * return_node - Where the Node is placed (if found 267 * return_node - Where the Node is placed (if found
268 * or created successfully) 268 * or created successfully)
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 7c3d3ceb98b3..ac389e5bb594 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -52,7 +52,7 @@ ACPI_MODULE_NAME("nsalloc")
52 * 52 *
53 * FUNCTION: acpi_ns_create_node 53 * FUNCTION: acpi_ns_create_node
54 * 54 *
55 * PARAMETERS: Name - Name of the new node (4 char ACPI name) 55 * PARAMETERS: name - Name of the new node (4 char ACPI name)
56 * 56 *
57 * RETURN: New namespace node (Null on failure) 57 * RETURN: New namespace node (Null on failure)
58 * 58 *
@@ -92,7 +92,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
92 * 92 *
93 * FUNCTION: acpi_ns_delete_node 93 * FUNCTION: acpi_ns_delete_node
94 * 94 *
95 * PARAMETERS: Node - Node to be deleted 95 * PARAMETERS: node - Node to be deleted
96 * 96 *
97 * RETURN: None 97 * RETURN: None
98 * 98 *
@@ -143,7 +143,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
143 * 143 *
144 * FUNCTION: acpi_ns_remove_node 144 * FUNCTION: acpi_ns_remove_node
145 * 145 *
146 * PARAMETERS: Node - Node to be removed/deleted 146 * PARAMETERS: node - Node to be removed/deleted
147 * 147 *
148 * RETURN: None 148 * RETURN: None
149 * 149 *
@@ -196,8 +196,8 @@ void acpi_ns_remove_node(struct acpi_namespace_node *node)
196 * 196 *
197 * PARAMETERS: walk_state - Current state of the walk 197 * PARAMETERS: walk_state - Current state of the walk
198 * parent_node - The parent of the new Node 198 * parent_node - The parent of the new Node
199 * Node - The new Node to install 199 * node - The new Node to install
200 * Type - ACPI object type of the new Node 200 * type - ACPI object type of the new Node
201 * 201 *
202 * RETURN: None 202 * RETURN: None
203 * 203 *
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 3f7f3f6e7dd5..7ee4e6aeb0a2 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -63,7 +63,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle,
63 * FUNCTION: acpi_ns_print_pathname 63 * FUNCTION: acpi_ns_print_pathname
64 * 64 *
65 * PARAMETERS: num_segments - Number of ACPI name segments 65 * PARAMETERS: num_segments - Number of ACPI name segments
66 * Pathname - The compressed (internal) path 66 * pathname - The compressed (internal) path
67 * 67 *
68 * RETURN: None 68 * RETURN: None
69 * 69 *
@@ -107,10 +107,10 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
107 * 107 *
108 * FUNCTION: acpi_ns_dump_pathname 108 * FUNCTION: acpi_ns_dump_pathname
109 * 109 *
110 * PARAMETERS: Handle - Object 110 * PARAMETERS: handle - Object
111 * Msg - Prefix message 111 * msg - Prefix message
112 * Level - Desired debug level 112 * level - Desired debug level
113 * Component - Caller's component ID 113 * component - Caller's component ID
114 * 114 *
115 * RETURN: None 115 * RETURN: None
116 * 116 *
@@ -143,8 +143,8 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
143 * FUNCTION: acpi_ns_dump_one_object 143 * FUNCTION: acpi_ns_dump_one_object
144 * 144 *
145 * PARAMETERS: obj_handle - Node to be dumped 145 * PARAMETERS: obj_handle - Node to be dumped
146 * Level - Nesting level of the handle 146 * level - Nesting level of the handle
147 * Context - Passed into walk_namespace 147 * context - Passed into walk_namespace
148 * return_value - Not used 148 * return_value - Not used
149 * 149 *
150 * RETURN: Status 150 * RETURN: Status
@@ -615,7 +615,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
615 * 615 *
616 * FUNCTION: acpi_ns_dump_objects 616 * FUNCTION: acpi_ns_dump_objects
617 * 617 *
618 * PARAMETERS: Type - Object type to be dumped 618 * PARAMETERS: type - Object type to be dumped
619 * display_type - 0 or ACPI_DISPLAY_SUMMARY 619 * display_type - 0 or ACPI_DISPLAY_SUMMARY
620 * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX 620 * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX
621 * for an effectively unlimited depth. 621 * for an effectively unlimited depth.
@@ -671,7 +671,7 @@ acpi_ns_dump_objects(acpi_object_type type,
671 * 671 *
672 * FUNCTION: acpi_ns_dump_entry 672 * FUNCTION: acpi_ns_dump_entry
673 * 673 *
674 * PARAMETERS: Handle - Node to be dumped 674 * PARAMETERS: handle - Node to be dumped
675 * debug_level - Output level 675 * debug_level - Output level
676 * 676 *
677 * RETURN: None 677 * RETURN: None
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c
index 3b5acb0eb406..944d4c8d9438 100644
--- a/drivers/acpi/acpica/nsdumpdv.c
+++ b/drivers/acpi/acpica/nsdumpdv.c
@@ -55,9 +55,9 @@ ACPI_MODULE_NAME("nsdumpdv")
55 * 55 *
56 * FUNCTION: acpi_ns_dump_one_device 56 * FUNCTION: acpi_ns_dump_one_device
57 * 57 *
58 * PARAMETERS: Handle - Node to be dumped 58 * PARAMETERS: handle - Node to be dumped
59 * Level - Nesting level of the handle 59 * level - Nesting level of the handle
60 * Context - Passed into walk_namespace 60 * context - Passed into walk_namespace
61 * return_value - Not used 61 * return_value - Not used
62 * 62 *
63 * RETURN: Status 63 * RETURN: Status
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index f375cb82e321..69074be498e8 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -59,11 +59,11 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
59 * 59 *
60 * FUNCTION: acpi_ns_evaluate 60 * FUNCTION: acpi_ns_evaluate
61 * 61 *
62 * PARAMETERS: Info - Evaluation info block, contains: 62 * PARAMETERS: info - Evaluation info block, contains:
63 * prefix_node - Prefix or Method/Object Node to execute 63 * prefix_node - Prefix or Method/Object Node to execute
64 * Pathname - Name of method to execute, If NULL, the 64 * pathname - Name of method to execute, If NULL, the
65 * Node is the object to execute 65 * Node is the object to execute
66 * Parameters - List of parameters to pass to the method, 66 * parameters - List of parameters to pass to the method,
67 * terminated by NULL. Params itself may be 67 * terminated by NULL. Params itself may be
68 * NULL if no parameters are being passed. 68 * NULL if no parameters are being passed.
69 * return_object - Where to put method's return value (if 69 * return_object - Where to put method's return value (if
@@ -71,7 +71,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
71 * parameter_type - Type of Parameter list 71 * parameter_type - Type of Parameter list
72 * return_object - Where to put method's return value (if 72 * return_object - Where to put method's return value (if
73 * any). If NULL, no value is returned. 73 * any). If NULL, no value is returned.
74 * Flags - ACPI_IGNORE_RETURN_VALUE to delete return 74 * flags - ACPI_IGNORE_RETURN_VALUE to delete return
75 * 75 *
76 * RETURN: Status 76 * RETURN: Status
77 * 77 *
@@ -351,7 +351,7 @@ void acpi_ns_exec_module_code_list(void)
351 * FUNCTION: acpi_ns_exec_module_code 351 * FUNCTION: acpi_ns_exec_module_code
352 * 352 *
353 * PARAMETERS: method_obj - Object container for the module-level code 353 * PARAMETERS: method_obj - Object container for the module-level code
354 * Info - Info block for method evaluation 354 * info - Info block for method evaluation
355 * 355 *
356 * RETURN: None. Exceptions during method execution are ignored, since 356 * RETURN: None. Exceptions during method execution are ignored, since
357 * we cannot abort a table load. 357 * we cannot abort a table load.
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 9d84ec2f0211..95ffe8dfa1f1 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -224,8 +224,8 @@ acpi_status acpi_ns_initialize_devices(void)
224 * FUNCTION: acpi_ns_init_one_object 224 * FUNCTION: acpi_ns_init_one_object
225 * 225 *
226 * PARAMETERS: obj_handle - Node 226 * PARAMETERS: obj_handle - Node
227 * Level - Current nesting level 227 * level - Current nesting level
228 * Context - Points to a init info struct 228 * context - Points to a init info struct
229 * return_value - Not used 229 * return_value - Not used
230 * 230 *
231 * RETURN: Status 231 * RETURN: Status
@@ -530,7 +530,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
530 * we will not run _INI, but we continue to examine the children 530 * we will not run _INI, but we continue to examine the children
531 * of this device. 531 * of this device.
532 * 532 *
533 * From the ACPI spec, description of _STA: (Note - no mention 533 * From the ACPI spec, description of _STA: (note - no mention
534 * of whether to run _INI or not on the device in question) 534 * of whether to run _INI or not on the device in question)
535 * 535 *
536 * "_STA may return bit 0 clear (not present) with bit 3 set 536 * "_STA may return bit 0 clear (not present) with bit 3 set
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index 5cbf15ffe7d8..76935ff29289 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -63,7 +63,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
63 * FUNCTION: acpi_ns_load_table 63 * FUNCTION: acpi_ns_load_table
64 * 64 *
65 * PARAMETERS: table_index - Index for table to be loaded 65 * PARAMETERS: table_index - Index for table to be loaded
66 * Node - Owning NS node 66 * node - Owning NS node
67 * 67 *
68 * RETURN: Status 68 * RETURN: Status
69 * 69 *
@@ -278,7 +278,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
278 * 278 *
279 * FUNCTION: acpi_ns_unload_name_space 279 * FUNCTION: acpi_ns_unload_name_space
280 * 280 *
281 * PARAMETERS: Handle - Root of namespace subtree to be deleted 281 * PARAMETERS: handle - Root of namespace subtree to be deleted
282 * 282 *
283 * RETURN: Status 283 * RETURN: Status
284 * 284 *
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index b20e7c8c3ffb..96e0eb609bb4 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -53,8 +53,8 @@ ACPI_MODULE_NAME("nsnames")
53 * 53 *
54 * FUNCTION: acpi_ns_build_external_path 54 * FUNCTION: acpi_ns_build_external_path
55 * 55 *
56 * PARAMETERS: Node - NS node whose pathname is needed 56 * PARAMETERS: node - NS node whose pathname is needed
57 * Size - Size of the pathname 57 * size - Size of the pathname
58 * *name_buffer - Where to return the pathname 58 * *name_buffer - Where to return the pathname
59 * 59 *
60 * RETURN: Status 60 * RETURN: Status
@@ -120,7 +120,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
120 * 120 *
121 * FUNCTION: acpi_ns_get_external_pathname 121 * FUNCTION: acpi_ns_get_external_pathname
122 * 122 *
123 * PARAMETERS: Node - Namespace node whose pathname is needed 123 * PARAMETERS: node - Namespace node whose pathname is needed
124 * 124 *
125 * RETURN: Pointer to storage containing the fully qualified name of 125 * RETURN: Pointer to storage containing the fully qualified name of
126 * the node, In external format (name segments separated by path 126 * the node, In external format (name segments separated by path
@@ -168,7 +168,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
168 * 168 *
169 * FUNCTION: acpi_ns_get_pathname_length 169 * FUNCTION: acpi_ns_get_pathname_length
170 * 170 *
171 * PARAMETERS: Node - Namespace node 171 * PARAMETERS: node - Namespace node
172 * 172 *
173 * RETURN: Length of path, including prefix 173 * RETURN: Length of path, including prefix
174 * 174 *
@@ -214,7 +214,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
214 * 214 *
215 * PARAMETERS: target_handle - Handle of named object whose name is 215 * PARAMETERS: target_handle - Handle of named object whose name is
216 * to be found 216 * to be found
217 * Buffer - Where the pathname is returned 217 * buffer - Where the pathname is returned
218 * 218 *
219 * RETURN: Status, Buffer is filled with pathname if status is AE_OK 219 * RETURN: Status, Buffer is filled with pathname if status is AE_OK
220 * 220 *
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index dd77a3ce6e50..d6c9a3cc6716 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -53,9 +53,9 @@ ACPI_MODULE_NAME("nsobject")
53 * 53 *
54 * FUNCTION: acpi_ns_attach_object 54 * FUNCTION: acpi_ns_attach_object
55 * 55 *
56 * PARAMETERS: Node - Parent Node 56 * PARAMETERS: node - Parent Node
57 * Object - Object to be attached 57 * object - Object to be attached
58 * Type - Type of object, or ACPI_TYPE_ANY if not 58 * type - Type of object, or ACPI_TYPE_ANY if not
59 * known 59 * known
60 * 60 *
61 * RETURN: Status 61 * RETURN: Status
@@ -191,7 +191,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
191 * 191 *
192 * FUNCTION: acpi_ns_detach_object 192 * FUNCTION: acpi_ns_detach_object
193 * 193 *
194 * PARAMETERS: Node - A Namespace node whose object will be detached 194 * PARAMETERS: node - A Namespace node whose object will be detached
195 * 195 *
196 * RETURN: None. 196 * RETURN: None.
197 * 197 *
@@ -250,7 +250,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node)
250 * 250 *
251 * FUNCTION: acpi_ns_get_attached_object 251 * FUNCTION: acpi_ns_get_attached_object
252 * 252 *
253 * PARAMETERS: Node - Namespace node 253 * PARAMETERS: node - Namespace node
254 * 254 *
255 * RETURN: Current value of the object field from the Node whose 255 * RETURN: Current value of the object field from the Node whose
256 * handle is passed 256 * handle is passed
@@ -285,7 +285,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct
285 * 285 *
286 * FUNCTION: acpi_ns_get_secondary_object 286 * FUNCTION: acpi_ns_get_secondary_object
287 * 287 *
288 * PARAMETERS: Node - Namespace node 288 * PARAMETERS: node - Namespace node
289 * 289 *
290 * RETURN: Current value of the object field from the Node whose 290 * RETURN: Current value of the object field from the Node whose
291 * handle is passed. 291 * handle is passed.
@@ -315,9 +315,9 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union
315 * 315 *
316 * FUNCTION: acpi_ns_attach_data 316 * FUNCTION: acpi_ns_attach_data
317 * 317 *
318 * PARAMETERS: Node - Namespace node 318 * PARAMETERS: node - Namespace node
319 * Handler - Handler to be associated with the data 319 * handler - Handler to be associated with the data
320 * Data - Data to be attached 320 * data - Data to be attached
321 * 321 *
322 * RETURN: Status 322 * RETURN: Status
323 * 323 *
@@ -372,8 +372,8 @@ acpi_ns_attach_data(struct acpi_namespace_node *node,
372 * 372 *
373 * FUNCTION: acpi_ns_detach_data 373 * FUNCTION: acpi_ns_detach_data
374 * 374 *
375 * PARAMETERS: Node - Namespace node 375 * PARAMETERS: node - Namespace node
376 * Handler - Handler associated with the data 376 * handler - Handler associated with the data
377 * 377 *
378 * RETURN: Status 378 * RETURN: Status
379 * 379 *
@@ -416,9 +416,9 @@ acpi_ns_detach_data(struct acpi_namespace_node * node,
416 * 416 *
417 * FUNCTION: acpi_ns_get_attached_data 417 * FUNCTION: acpi_ns_get_attached_data
418 * 418 *
419 * PARAMETERS: Node - Namespace node 419 * PARAMETERS: node - Namespace node
420 * Handler - Handler associated with the data 420 * handler - Handler associated with the data
421 * Data - Where the data is returned 421 * data - Where the data is returned
422 * 422 *
423 * RETURN: Status 423 * RETURN: Status
424 * 424 *
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index fe6626035495..2419f417ea33 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -116,7 +116,7 @@ static const char *acpi_rtype_names[] = {
116 * 116 *
117 * FUNCTION: acpi_ns_check_predefined_names 117 * FUNCTION: acpi_ns_check_predefined_names
118 * 118 *
119 * PARAMETERS: Node - Namespace node for the method/object 119 * PARAMETERS: node - Namespace node for the method/object
120 * user_param_count - Number of parameters actually passed 120 * user_param_count - Number of parameters actually passed
121 * return_status - Status from the object evaluation 121 * return_status - Status from the object evaluation
122 * return_object_ptr - Pointer to the object returned from the 122 * return_object_ptr - Pointer to the object returned from the
@@ -275,10 +275,10 @@ cleanup:
275 * 275 *
276 * FUNCTION: acpi_ns_check_parameter_count 276 * FUNCTION: acpi_ns_check_parameter_count
277 * 277 *
278 * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 278 * PARAMETERS: pathname - Full pathname to the node (for error msgs)
279 * Node - Namespace node for the method/object 279 * node - Namespace node for the method/object
280 * user_param_count - Number of args passed in by the caller 280 * user_param_count - Number of args passed in by the caller
281 * Predefined - Pointer to entry in predefined name table 281 * predefined - Pointer to entry in predefined name table
282 * 282 *
283 * RETURN: None 283 * RETURN: None
284 * 284 *
@@ -364,7 +364,7 @@ acpi_ns_check_parameter_count(char *pathname,
364 * 364 *
365 * FUNCTION: acpi_ns_check_for_predefined_name 365 * FUNCTION: acpi_ns_check_for_predefined_name
366 * 366 *
367 * PARAMETERS: Node - Namespace node for the method/object 367 * PARAMETERS: node - Namespace node for the method/object
368 * 368 *
369 * RETURN: Pointer to entry in predefined table. NULL indicates not found. 369 * RETURN: Pointer to entry in predefined table. NULL indicates not found.
370 * 370 *
@@ -410,7 +410,7 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
410 * 410 *
411 * FUNCTION: acpi_ns_check_package 411 * FUNCTION: acpi_ns_check_package
412 * 412 *
413 * PARAMETERS: Data - Pointer to validation data structure 413 * PARAMETERS: data - Pointer to validation data structure
414 * return_object_ptr - Pointer to the object returned from the 414 * return_object_ptr - Pointer to the object returned from the
415 * evaluation of a method or object 415 * evaluation of a method or object
416 * 416 *
@@ -685,11 +685,11 @@ package_too_small:
685 * 685 *
686 * FUNCTION: acpi_ns_check_package_list 686 * FUNCTION: acpi_ns_check_package_list
687 * 687 *
688 * PARAMETERS: Data - Pointer to validation data structure 688 * PARAMETERS: data - Pointer to validation data structure
689 * Package - Pointer to package-specific info for method 689 * package - Pointer to package-specific info for method
690 * Elements - Element list of parent package. All elements 690 * elements - Element list of parent package. All elements
691 * of this list should be of type Package. 691 * of this list should be of type Package.
692 * Count - Count of subpackages 692 * count - Count of subpackages
693 * 693 *
694 * RETURN: Status 694 * RETURN: Status
695 * 695 *
@@ -911,12 +911,12 @@ package_too_small:
911 * 911 *
912 * FUNCTION: acpi_ns_check_package_elements 912 * FUNCTION: acpi_ns_check_package_elements
913 * 913 *
914 * PARAMETERS: Data - Pointer to validation data structure 914 * PARAMETERS: data - Pointer to validation data structure
915 * Elements - Pointer to the package elements array 915 * elements - Pointer to the package elements array
916 * Type1 - Object type for first group 916 * type1 - Object type for first group
917 * Count1 - Count for first group 917 * count1 - Count for first group
918 * Type2 - Object type for second group 918 * type2 - Object type for second group
919 * Count2 - Count for second group 919 * count2 - Count for second group
920 * start_index - Start of the first group of elements 920 * start_index - Start of the first group of elements
921 * 921 *
922 * RETURN: Status 922 * RETURN: Status
@@ -968,7 +968,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
968 * 968 *
969 * FUNCTION: acpi_ns_check_object_type 969 * FUNCTION: acpi_ns_check_object_type
970 * 970 *
971 * PARAMETERS: Data - Pointer to validation data structure 971 * PARAMETERS: data - Pointer to validation data structure
972 * return_object_ptr - Pointer to the object returned from the 972 * return_object_ptr - Pointer to the object returned from the
973 * evaluation of a method or object 973 * evaluation of a method or object
974 * expected_btypes - Bitmap of expected return type(s) 974 * expected_btypes - Bitmap of expected return type(s)
@@ -1102,7 +1102,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
1102 * 1102 *
1103 * FUNCTION: acpi_ns_check_reference 1103 * FUNCTION: acpi_ns_check_reference
1104 * 1104 *
1105 * PARAMETERS: Data - Pointer to validation data structure 1105 * PARAMETERS: data - Pointer to validation data structure
1106 * return_object - Object returned from the evaluation of a 1106 * return_object - Object returned from the evaluation of a
1107 * method or object 1107 * method or object
1108 * 1108 *
@@ -1140,7 +1140,7 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,
1140 * 1140 *
1141 * FUNCTION: acpi_ns_get_expected_types 1141 * FUNCTION: acpi_ns_get_expected_types
1142 * 1142 *
1143 * PARAMETERS: Buffer - Pointer to where the string is returned 1143 * PARAMETERS: buffer - Pointer to where the string is returned
1144 * expected_btypes - Bitmap of expected return type(s) 1144 * expected_btypes - Bitmap of expected return type(s)
1145 * 1145 *
1146 * RETURN: Buffer is populated with type names. 1146 * RETURN: Buffer is populated with type names.
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index 5519a64a353f..8c5f292860fc 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -94,7 +94,7 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
94 * 94 *
95 * FUNCTION: acpi_ns_repair_object 95 * FUNCTION: acpi_ns_repair_object
96 * 96 *
97 * PARAMETERS: Data - Pointer to validation data structure 97 * PARAMETERS: data - Pointer to validation data structure
98 * expected_btypes - Object types expected 98 * expected_btypes - Object types expected
99 * package_index - Index of object within parent package (if 99 * package_index - Index of object within parent package (if
100 * applicable - ACPI_NOT_PACKAGE_ELEMENT 100 * applicable - ACPI_NOT_PACKAGE_ELEMENT
@@ -470,7 +470,7 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
470 * 470 *
471 * FUNCTION: acpi_ns_repair_null_element 471 * FUNCTION: acpi_ns_repair_null_element
472 * 472 *
473 * PARAMETERS: Data - Pointer to validation data structure 473 * PARAMETERS: data - Pointer to validation data structure
474 * expected_btypes - Object types expected 474 * expected_btypes - Object types expected
475 * package_index - Index of object within parent package (if 475 * package_index - Index of object within parent package (if
476 * applicable - ACPI_NOT_PACKAGE_ELEMENT 476 * applicable - ACPI_NOT_PACKAGE_ELEMENT
@@ -509,17 +509,17 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
509 */ 509 */
510 if (expected_btypes & ACPI_RTYPE_INTEGER) { 510 if (expected_btypes & ACPI_RTYPE_INTEGER) {
511 511
512 /* Need an Integer - create a zero-value integer */ 512 /* Need an integer - create a zero-value integer */
513 513
514 new_object = acpi_ut_create_integer_object((u64)0); 514 new_object = acpi_ut_create_integer_object((u64)0);
515 } else if (expected_btypes & ACPI_RTYPE_STRING) { 515 } else if (expected_btypes & ACPI_RTYPE_STRING) {
516 516
517 /* Need a String - create a NULL string */ 517 /* Need a string - create a NULL string */
518 518
519 new_object = acpi_ut_create_string_object(0); 519 new_object = acpi_ut_create_string_object(0);
520 } else if (expected_btypes & ACPI_RTYPE_BUFFER) { 520 } else if (expected_btypes & ACPI_RTYPE_BUFFER) {
521 521
522 /* Need a Buffer - create a zero-length buffer */ 522 /* Need a buffer - create a zero-length buffer */
523 523
524 new_object = acpi_ut_create_buffer_object(0); 524 new_object = acpi_ut_create_buffer_object(0);
525 } else { 525 } else {
@@ -552,7 +552,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
552 * 552 *
553 * FUNCTION: acpi_ns_remove_null_elements 553 * FUNCTION: acpi_ns_remove_null_elements
554 * 554 *
555 * PARAMETERS: Data - Pointer to validation data structure 555 * PARAMETERS: data - Pointer to validation data structure
556 * package_type - An acpi_return_package_types value 556 * package_type - An acpi_return_package_types value
557 * obj_desc - A Package object 557 * obj_desc - A Package object
558 * 558 *
@@ -635,7 +635,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
635 * 635 *
636 * FUNCTION: acpi_ns_wrap_with_package 636 * FUNCTION: acpi_ns_wrap_with_package
637 * 637 *
638 * PARAMETERS: Data - Pointer to validation data structure 638 * PARAMETERS: data - Pointer to validation data structure
639 * original_object - Pointer to the object to repair. 639 * original_object - Pointer to the object to repair.
640 * obj_desc_ptr - The new package object is returned here 640 * obj_desc_ptr - The new package object is returned here
641 * 641 *
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 726bc8e687f7..90189251cdf0 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -149,8 +149,8 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
149 * 149 *
150 * FUNCTION: acpi_ns_complex_repairs 150 * FUNCTION: acpi_ns_complex_repairs
151 * 151 *
152 * PARAMETERS: Data - Pointer to validation data structure 152 * PARAMETERS: data - Pointer to validation data structure
153 * Node - Namespace node for the method/object 153 * node - Namespace node for the method/object
154 * validate_status - Original status of earlier validation 154 * validate_status - Original status of earlier validation
155 * return_object_ptr - Pointer to the object returned from the 155 * return_object_ptr - Pointer to the object returned from the
156 * evaluation of a method or object 156 * evaluation of a method or object
@@ -187,7 +187,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
187 * 187 *
188 * FUNCTION: acpi_ns_match_repairable_name 188 * FUNCTION: acpi_ns_match_repairable_name
189 * 189 *
190 * PARAMETERS: Node - Namespace node for the method/object 190 * PARAMETERS: node - Namespace node for the method/object
191 * 191 *
192 * RETURN: Pointer to entry in repair table. NULL indicates not found. 192 * RETURN: Pointer to entry in repair table. NULL indicates not found.
193 * 193 *
@@ -218,7 +218,7 @@ static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct
218 * 218 *
219 * FUNCTION: acpi_ns_repair_ALR 219 * FUNCTION: acpi_ns_repair_ALR
220 * 220 *
221 * PARAMETERS: Data - Pointer to validation data structure 221 * PARAMETERS: data - Pointer to validation data structure
222 * return_object_ptr - Pointer to the object returned from the 222 * return_object_ptr - Pointer to the object returned from the
223 * evaluation of a method or object 223 * evaluation of a method or object
224 * 224 *
@@ -247,7 +247,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
247 * 247 *
248 * FUNCTION: acpi_ns_repair_FDE 248 * FUNCTION: acpi_ns_repair_FDE
249 * 249 *
250 * PARAMETERS: Data - Pointer to validation data structure 250 * PARAMETERS: data - Pointer to validation data structure
251 * return_object_ptr - Pointer to the object returned from the 251 * return_object_ptr - Pointer to the object returned from the
252 * evaluation of a method or object 252 * evaluation of a method or object
253 * 253 *
@@ -335,7 +335,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
335 * 335 *
336 * FUNCTION: acpi_ns_repair_CID 336 * FUNCTION: acpi_ns_repair_CID
337 * 337 *
338 * PARAMETERS: Data - Pointer to validation data structure 338 * PARAMETERS: data - Pointer to validation data structure
339 * return_object_ptr - Pointer to the object returned from the 339 * return_object_ptr - Pointer to the object returned from the
340 * evaluation of a method or object 340 * evaluation of a method or object
341 * 341 *
@@ -405,7 +405,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
405 * 405 *
406 * FUNCTION: acpi_ns_repair_HID 406 * FUNCTION: acpi_ns_repair_HID
407 * 407 *
408 * PARAMETERS: Data - Pointer to validation data structure 408 * PARAMETERS: data - Pointer to validation data structure
409 * return_object_ptr - Pointer to the object returned from the 409 * return_object_ptr - Pointer to the object returned from the
410 * evaluation of a method or object 410 * evaluation of a method or object
411 * 411 *
@@ -487,7 +487,7 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
487 * 487 *
488 * FUNCTION: acpi_ns_repair_TSS 488 * FUNCTION: acpi_ns_repair_TSS
489 * 489 *
490 * PARAMETERS: Data - Pointer to validation data structure 490 * PARAMETERS: data - Pointer to validation data structure
491 * return_object_ptr - Pointer to the object returned from the 491 * return_object_ptr - Pointer to the object returned from the
492 * evaluation of a method or object 492 * evaluation of a method or object
493 * 493 *
@@ -531,7 +531,7 @@ acpi_ns_repair_TSS(struct acpi_predefined_data *data,
531 * 531 *
532 * FUNCTION: acpi_ns_repair_PSS 532 * FUNCTION: acpi_ns_repair_PSS
533 * 533 *
534 * PARAMETERS: Data - Pointer to validation data structure 534 * PARAMETERS: data - Pointer to validation data structure
535 * return_object_ptr - Pointer to the object returned from the 535 * return_object_ptr - Pointer to the object returned from the
536 * evaluation of a method or object 536 * evaluation of a method or object
537 * 537 *
@@ -600,7 +600,7 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
600 * 600 *
601 * FUNCTION: acpi_ns_check_sorted_list 601 * FUNCTION: acpi_ns_check_sorted_list
602 * 602 *
603 * PARAMETERS: Data - Pointer to validation data structure 603 * PARAMETERS: data - Pointer to validation data structure
604 * return_object - Pointer to the top-level returned object 604 * return_object - Pointer to the top-level returned object
605 * expected_count - Minimum length of each sub-package 605 * expected_count - Minimum length of each sub-package
606 * sort_index - Sub-package entry to sort on 606 * sort_index - Sub-package entry to sort on
@@ -707,9 +707,9 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
707 * 707 *
708 * FUNCTION: acpi_ns_sort_list 708 * FUNCTION: acpi_ns_sort_list
709 * 709 *
710 * PARAMETERS: Elements - Package object element list 710 * PARAMETERS: elements - Package object element list
711 * Count - Element count for above 711 * count - Element count for above
712 * Index - Sort by which package element 712 * index - Sort by which package element
713 * sort_direction - Ascending or Descending sort 713 * sort_direction - Ascending or Descending sort
714 * 714 *
715 * RETURN: None 715 * RETURN: None
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 507043d66114..456cc859f869 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -65,7 +65,7 @@ acpi_ns_search_parent_tree(u32 target_name,
65 * 65 *
66 * PARAMETERS: target_name - Ascii ACPI name to search for 66 * PARAMETERS: target_name - Ascii ACPI name to search for
67 * parent_node - Starting node where search will begin 67 * parent_node - Starting node where search will begin
68 * Type - Object type to match 68 * type - Object type to match
69 * return_node - Where the matched Named obj is returned 69 * return_node - Where the matched Named obj is returned
70 * 70 *
71 * RETURN: Status 71 * RETURN: Status
@@ -175,8 +175,8 @@ acpi_ns_search_one_scope(u32 target_name,
175 * FUNCTION: acpi_ns_search_parent_tree 175 * FUNCTION: acpi_ns_search_parent_tree
176 * 176 *
177 * PARAMETERS: target_name - Ascii ACPI name to search for 177 * PARAMETERS: target_name - Ascii ACPI name to search for
178 * Node - Starting node where search will begin 178 * node - Starting node where search will begin
179 * Type - Object type to match 179 * type - Object type to match
180 * return_node - Where the matched Node is returned 180 * return_node - Where the matched Node is returned
181 * 181 *
182 * RETURN: Status 182 * RETURN: Status
@@ -264,11 +264,11 @@ acpi_ns_search_parent_tree(u32 target_name,
264 * 264 *
265 * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars) 265 * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars)
266 * walk_state - Current state of the walk 266 * walk_state - Current state of the walk
267 * Node - Starting node where search will begin 267 * node - Starting node where search will begin
268 * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x. 268 * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x.
269 * Otherwise,search only. 269 * Otherwise,search only.
270 * Type - Object type to match 270 * type - Object type to match
271 * Flags - Flags describing the search restrictions 271 * flags - Flags describing the search restrictions
272 * return_node - Where the Node is returned 272 * return_node - Where the Node is returned
273 * 273 *
274 * RETURN: Status 274 * RETURN: Status
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 75113759f69d..ef753a41e087 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -62,8 +62,8 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
62 * 62 *
63 * FUNCTION: acpi_ns_print_node_pathname 63 * FUNCTION: acpi_ns_print_node_pathname
64 * 64 *
65 * PARAMETERS: Node - Object 65 * PARAMETERS: node - Object
66 * Message - Prefix message 66 * message - Prefix message
67 * 67 *
68 * DESCRIPTION: Print an object's full namespace pathname 68 * DESCRIPTION: Print an object's full namespace pathname
69 * Manages allocation/freeing of a pathname buffer 69 * Manages allocation/freeing of a pathname buffer
@@ -101,7 +101,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node,
101 * 101 *
102 * FUNCTION: acpi_ns_valid_root_prefix 102 * FUNCTION: acpi_ns_valid_root_prefix
103 * 103 *
104 * PARAMETERS: Prefix - Character to be checked 104 * PARAMETERS: prefix - Character to be checked
105 * 105 *
106 * RETURN: TRUE if a valid prefix 106 * RETURN: TRUE if a valid prefix
107 * 107 *
@@ -119,7 +119,7 @@ u8 acpi_ns_valid_root_prefix(char prefix)
119 * 119 *
120 * FUNCTION: acpi_ns_valid_path_separator 120 * FUNCTION: acpi_ns_valid_path_separator
121 * 121 *
122 * PARAMETERS: Sep - Character to be checked 122 * PARAMETERS: sep - Character to be checked
123 * 123 *
124 * RETURN: TRUE if a valid path separator 124 * RETURN: TRUE if a valid path separator
125 * 125 *
@@ -137,7 +137,7 @@ static u8 acpi_ns_valid_path_separator(char sep)
137 * 137 *
138 * FUNCTION: acpi_ns_get_type 138 * FUNCTION: acpi_ns_get_type
139 * 139 *
140 * PARAMETERS: Node - Parent Node to be examined 140 * PARAMETERS: node - Parent Node to be examined
141 * 141 *
142 * RETURN: Type field from Node whose handle is passed 142 * RETURN: Type field from Node whose handle is passed
143 * 143 *
@@ -161,7 +161,7 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
161 * 161 *
162 * FUNCTION: acpi_ns_local 162 * FUNCTION: acpi_ns_local
163 * 163 *
164 * PARAMETERS: Type - A namespace object type 164 * PARAMETERS: type - A namespace object type
165 * 165 *
166 * RETURN: LOCAL if names must be found locally in objects of the 166 * RETURN: LOCAL if names must be found locally in objects of the
167 * passed type, 0 if enclosing scopes should be searched 167 * passed type, 0 if enclosing scopes should be searched
@@ -189,7 +189,7 @@ u32 acpi_ns_local(acpi_object_type type)
189 * 189 *
190 * FUNCTION: acpi_ns_get_internal_name_length 190 * FUNCTION: acpi_ns_get_internal_name_length
191 * 191 *
192 * PARAMETERS: Info - Info struct initialized with the 192 * PARAMETERS: info - Info struct initialized with the
193 * external name pointer. 193 * external name pointer.
194 * 194 *
195 * RETURN: None 195 * RETURN: None
@@ -260,7 +260,7 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
260 * 260 *
261 * FUNCTION: acpi_ns_build_internal_name 261 * FUNCTION: acpi_ns_build_internal_name
262 * 262 *
263 * PARAMETERS: Info - Info struct fully initialized 263 * PARAMETERS: info - Info struct fully initialized
264 * 264 *
265 * RETURN: Status 265 * RETURN: Status
266 * 266 *
@@ -371,7 +371,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
371 * FUNCTION: acpi_ns_internalize_name 371 * FUNCTION: acpi_ns_internalize_name
372 * 372 *
373 * PARAMETERS: *external_name - External representation of name 373 * PARAMETERS: *external_name - External representation of name
374 * **Converted Name - Where to return the resulting 374 * **Converted name - Where to return the resulting
375 * internal represention of the name 375 * internal represention of the name
376 * 376 *
377 * RETURN: Status 377 * RETURN: Status
@@ -575,7 +575,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
575 * 575 *
576 * FUNCTION: acpi_ns_validate_handle 576 * FUNCTION: acpi_ns_validate_handle
577 * 577 *
578 * PARAMETERS: Handle - Handle to be validated and typecast to a 578 * PARAMETERS: handle - Handle to be validated and typecast to a
579 * namespace node. 579 * namespace node.
580 * 580 *
581 * RETURN: A pointer to a namespace node 581 * RETURN: A pointer to a namespace node
@@ -651,7 +651,7 @@ void acpi_ns_terminate(void)
651 * 651 *
652 * FUNCTION: acpi_ns_opens_scope 652 * FUNCTION: acpi_ns_opens_scope
653 * 653 *
654 * PARAMETERS: Type - A valid namespace type 654 * PARAMETERS: type - A valid namespace type
655 * 655 *
656 * RETURN: NEWSCOPE if the passed type "opens a name scope" according 656 * RETURN: NEWSCOPE if the passed type "opens a name scope" according
657 * to the ACPI specification, else 0 657 * to the ACPI specification, else 0
@@ -677,14 +677,14 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
677 * 677 *
678 * FUNCTION: acpi_ns_get_node 678 * FUNCTION: acpi_ns_get_node
679 * 679 *
680 * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The 680 * PARAMETERS: *pathname - Name to be found, in external (ASL) format. The
681 * \ (backslash) and ^ (carat) prefixes, and the 681 * \ (backslash) and ^ (carat) prefixes, and the
682 * . (period) to separate segments are supported. 682 * . (period) to separate segments are supported.
683 * prefix_node - Root of subtree to be searched, or NS_ALL for the 683 * prefix_node - Root of subtree to be searched, or NS_ALL for the
684 * root of the name space. If Name is fully 684 * root of the name space. If Name is fully
685 * qualified (first s8 is '\'), the passed value 685 * qualified (first s8 is '\'), the passed value
686 * of Scope will not be accessed. 686 * of Scope will not be accessed.
687 * Flags - Used to indicate whether to perform upsearch or 687 * flags - Used to indicate whether to perform upsearch or
688 * not. 688 * not.
689 * return_node - Where the Node is returned 689 * return_node - Where the Node is returned
690 * 690 *
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index f69895a54895..730bccc5e7f7 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -88,7 +88,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
88 * 88 *
89 * FUNCTION: acpi_ns_get_next_node_typed 89 * FUNCTION: acpi_ns_get_next_node_typed
90 * 90 *
91 * PARAMETERS: Type - Type of node to be searched for 91 * PARAMETERS: type - Type of node to be searched for
92 * parent_node - Parent node whose children we are 92 * parent_node - Parent node whose children we are
93 * getting 93 * getting
94 * child_node - Previous child that was found. 94 * child_node - Previous child that was found.
@@ -151,16 +151,16 @@ struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
151 * 151 *
152 * FUNCTION: acpi_ns_walk_namespace 152 * FUNCTION: acpi_ns_walk_namespace
153 * 153 *
154 * PARAMETERS: Type - acpi_object_type to search for 154 * PARAMETERS: type - acpi_object_type to search for
155 * start_node - Handle in namespace where search begins 155 * start_node - Handle in namespace where search begins
156 * max_depth - Depth to which search is to reach 156 * max_depth - Depth to which search is to reach
157 * Flags - Whether to unlock the NS before invoking 157 * flags - Whether to unlock the NS before invoking
158 * the callback routine 158 * the callback routine
159 * pre_order_visit - Called during tree pre-order visit 159 * pre_order_visit - Called during tree pre-order visit
160 * when an object of "Type" is found 160 * when an object of "Type" is found
161 * post_order_visit - Called during tree post-order visit 161 * post_order_visit - Called during tree post-order visit
162 * when an object of "Type" is found 162 * when an object of "Type" is found
163 * Context - Passed to user function(s) above 163 * context - Passed to user function(s) above
164 * return_value - from the user_function if terminated 164 * return_value - from the user_function if terminated
165 * early. Otherwise, returns NULL. 165 * early. Otherwise, returns NULL.
166 * RETURNS: Status 166 * RETURNS: Status
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 71d15f61807b..9692e6702333 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -58,8 +58,8 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
58 * 58 *
59 * FUNCTION: acpi_evaluate_object_typed 59 * FUNCTION: acpi_evaluate_object_typed
60 * 60 *
61 * PARAMETERS: Handle - Object handle (optional) 61 * PARAMETERS: handle - Object handle (optional)
62 * Pathname - Object pathname (optional) 62 * pathname - Object pathname (optional)
63 * external_params - List of parameters to pass to method, 63 * external_params - List of parameters to pass to method,
64 * terminated by NULL. May be NULL 64 * terminated by NULL. May be NULL
65 * if no parameters are being passed. 65 * if no parameters are being passed.
@@ -152,8 +152,8 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed)
152 * 152 *
153 * FUNCTION: acpi_evaluate_object 153 * FUNCTION: acpi_evaluate_object
154 * 154 *
155 * PARAMETERS: Handle - Object handle (optional) 155 * PARAMETERS: handle - Object handle (optional)
156 * Pathname - Object pathname (optional) 156 * pathname - Object pathname (optional)
157 * external_params - List of parameters to pass to method, 157 * external_params - List of parameters to pass to method,
158 * terminated by NULL. May be NULL 158 * terminated by NULL. May be NULL
159 * if no parameters are being passed. 159 * if no parameters are being passed.
@@ -364,7 +364,7 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
364 * 364 *
365 * FUNCTION: acpi_ns_resolve_references 365 * FUNCTION: acpi_ns_resolve_references
366 * 366 *
367 * PARAMETERS: Info - Evaluation info block 367 * PARAMETERS: info - Evaluation info block
368 * 368 *
369 * RETURN: Info->return_object is replaced with the dereferenced object 369 * RETURN: Info->return_object is replaced with the dereferenced object
370 * 370 *
@@ -431,14 +431,14 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
431 * 431 *
432 * FUNCTION: acpi_walk_namespace 432 * FUNCTION: acpi_walk_namespace
433 * 433 *
434 * PARAMETERS: Type - acpi_object_type to search for 434 * PARAMETERS: type - acpi_object_type to search for
435 * start_object - Handle in namespace where search begins 435 * start_object - Handle in namespace where search begins
436 * max_depth - Depth to which search is to reach 436 * max_depth - Depth to which search is to reach
437 * pre_order_visit - Called during tree pre-order visit 437 * pre_order_visit - Called during tree pre-order visit
438 * when an object of "Type" is found 438 * when an object of "Type" is found
439 * post_order_visit - Called during tree post-order visit 439 * post_order_visit - Called during tree post-order visit
440 * when an object of "Type" is found 440 * when an object of "Type" is found
441 * Context - Passed to user function(s) above 441 * context - Passed to user function(s) above
442 * return_value - Location where return value of 442 * return_value - Location where return value of
443 * user_function is put if terminated early 443 * user_function is put if terminated early
444 * 444 *
@@ -646,7 +646,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
646 * 646 *
647 * PARAMETERS: HID - HID to search for. Can be NULL. 647 * PARAMETERS: HID - HID to search for. Can be NULL.
648 * user_function - Called when a matching object is found 648 * user_function - Called when a matching object is found
649 * Context - Passed to user function 649 * context - Passed to user function
650 * return_value - Location where return value of 650 * return_value - Location where return value of
651 * user_function is put if terminated early 651 * user_function is put if terminated early
652 * 652 *
@@ -716,8 +716,8 @@ ACPI_EXPORT_SYMBOL(acpi_get_devices)
716 * FUNCTION: acpi_attach_data 716 * FUNCTION: acpi_attach_data
717 * 717 *
718 * PARAMETERS: obj_handle - Namespace node 718 * PARAMETERS: obj_handle - Namespace node
719 * Handler - Handler for this attachment 719 * handler - Handler for this attachment
720 * Data - Pointer to data to be attached 720 * data - Pointer to data to be attached
721 * 721 *
722 * RETURN: Status 722 * RETURN: Status
723 * 723 *
@@ -764,7 +764,7 @@ ACPI_EXPORT_SYMBOL(acpi_attach_data)
764 * FUNCTION: acpi_detach_data 764 * FUNCTION: acpi_detach_data
765 * 765 *
766 * PARAMETERS: obj_handle - Namespace node handle 766 * PARAMETERS: obj_handle - Namespace node handle
767 * Handler - Handler used in call to acpi_attach_data 767 * handler - Handler used in call to acpi_attach_data
768 * 768 *
769 * RETURN: Status 769 * RETURN: Status
770 * 770 *
@@ -810,8 +810,8 @@ ACPI_EXPORT_SYMBOL(acpi_detach_data)
810 * FUNCTION: acpi_get_data 810 * FUNCTION: acpi_get_data
811 * 811 *
812 * PARAMETERS: obj_handle - Namespace node 812 * PARAMETERS: obj_handle - Namespace node
813 * Handler - Handler used in call to attach_data 813 * handler - Handler used in call to attach_data
814 * Data - Where the data is returned 814 * data - Where the data is returned
815 * 815 *
816 * RETURN: Status 816 * RETURN: Status
817 * 817 *
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index af401c9c4dfc..08e9610b34ca 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -61,8 +61,8 @@ static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
61 * 61 *
62 * FUNCTION: acpi_get_handle 62 * FUNCTION: acpi_get_handle
63 * 63 *
64 * PARAMETERS: Parent - Object to search under (search scope). 64 * PARAMETERS: parent - Object to search under (search scope).
65 * Pathname - Pointer to an asciiz string containing the 65 * pathname - Pointer to an asciiz string containing the
66 * name 66 * name
67 * ret_handle - Where the return handle is returned 67 * ret_handle - Where the return handle is returned
68 * 68 *
@@ -142,9 +142,9 @@ ACPI_EXPORT_SYMBOL(acpi_get_handle)
142 * 142 *
143 * FUNCTION: acpi_get_name 143 * FUNCTION: acpi_get_name
144 * 144 *
145 * PARAMETERS: Handle - Handle to be converted to a pathname 145 * PARAMETERS: handle - Handle to be converted to a pathname
146 * name_type - Full pathname or single segment 146 * name_type - Full pathname or single segment
147 * Buffer - Buffer for returned path 147 * buffer - Buffer for returned path
148 * 148 *
149 * RETURN: Pointer to a string containing the fully qualified Name. 149 * RETURN: Pointer to a string containing the fully qualified Name.
150 * 150 *
@@ -219,8 +219,8 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)
219 * 219 *
220 * FUNCTION: acpi_ns_copy_device_id 220 * FUNCTION: acpi_ns_copy_device_id
221 * 221 *
222 * PARAMETERS: Dest - Pointer to the destination DEVICE_ID 222 * PARAMETERS: dest - Pointer to the destination DEVICE_ID
223 * Source - Pointer to the source DEVICE_ID 223 * source - Pointer to the source DEVICE_ID
224 * string_area - Pointer to where to copy the dest string 224 * string_area - Pointer to where to copy the dest string
225 * 225 *
226 * RETURN: Pointer to the next string area 226 * RETURN: Pointer to the next string area
@@ -247,7 +247,7 @@ static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
247 * 247 *
248 * FUNCTION: acpi_get_object_info 248 * FUNCTION: acpi_get_object_info
249 * 249 *
250 * PARAMETERS: Handle - Object Handle 250 * PARAMETERS: handle - Object Handle
251 * return_buffer - Where the info is returned 251 * return_buffer - Where the info is returned
252 * 252 *
253 * RETURN: Status 253 * RETURN: Status
@@ -493,7 +493,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_object_info)
493 * 493 *
494 * FUNCTION: acpi_install_method 494 * FUNCTION: acpi_install_method
495 * 495 *
496 * PARAMETERS: Buffer - An ACPI table containing one control method 496 * PARAMETERS: buffer - An ACPI table containing one control method
497 * 497 *
498 * RETURN: Status 498 * RETURN: Status
499 * 499 *
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index 880a605cee20..6766fc4f088f 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -98,7 +98,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_id)
98 * 98 *
99 * FUNCTION: acpi_get_type 99 * FUNCTION: acpi_get_type
100 * 100 *
101 * PARAMETERS: Handle - Handle of object whose type is desired 101 * PARAMETERS: handle - Handle of object whose type is desired
102 * ret_type - Where the type will be placed 102 * ret_type - Where the type will be placed
103 * 103 *
104 * RETURN: Status 104 * RETURN: Status
@@ -151,7 +151,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_type)
151 * 151 *
152 * FUNCTION: acpi_get_parent 152 * FUNCTION: acpi_get_parent
153 * 153 *
154 * PARAMETERS: Handle - Handle of object whose parent is desired 154 * PARAMETERS: handle - Handle of object whose parent is desired
155 * ret_handle - Where the parent handle will be placed 155 * ret_handle - Where the parent handle will be placed
156 * 156 *
157 * RETURN: Status 157 * RETURN: Status
@@ -212,8 +212,8 @@ ACPI_EXPORT_SYMBOL(acpi_get_parent)
212 * 212 *
213 * FUNCTION: acpi_get_next_object 213 * FUNCTION: acpi_get_next_object
214 * 214 *
215 * PARAMETERS: Type - Type of object to be searched for 215 * PARAMETERS: type - Type of object to be searched for
216 * Parent - Parent object whose children we are getting 216 * parent - Parent object whose children we are getting
217 * last_child - Previous child that was found. 217 * last_child - Previous child that was found.
218 * The NEXT child will be returned 218 * The NEXT child will be returned
219 * ret_handle - Where handle to the next object is placed 219 * ret_handle - Where handle to the next object is placed
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 5ac36aba507c..844464c4f901 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -210,7 +210,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
210 * FUNCTION: acpi_ps_get_next_namepath 210 * FUNCTION: acpi_ps_get_next_namepath
211 * 211 *
212 * PARAMETERS: parser_state - Current parser state object 212 * PARAMETERS: parser_state - Current parser state object
213 * Arg - Where the namepath will be stored 213 * arg - Where the namepath will be stored
214 * arg_count - If the namepath points to a control method 214 * arg_count - If the namepath points to a control method
215 * the method's argument is returned here. 215 * the method's argument is returned here.
216 * possible_method_call - Whether the namepath can possibly be the 216 * possible_method_call - Whether the namepath can possibly be the
@@ -379,7 +379,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
379 * 379 *
380 * PARAMETERS: parser_state - Current parser state object 380 * PARAMETERS: parser_state - Current parser state object
381 * arg_type - The argument type (AML_*_ARG) 381 * arg_type - The argument type (AML_*_ARG)
382 * Arg - Where the argument is returned 382 * arg - Where the argument is returned
383 * 383 *
384 * RETURN: None 384 * RETURN: None
385 * 385 *
@@ -618,6 +618,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
618 618
619 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); 619 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
620 if (!arg) { 620 if (!arg) {
621 acpi_ps_free_op(field);
621 return_PTR(NULL); 622 return_PTR(NULL);
622 } 623 }
623 624
@@ -662,6 +663,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
662 } else { 663 } else {
663 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); 664 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
664 if (!arg) { 665 if (!arg) {
666 acpi_ps_free_op(field);
665 return_PTR(NULL); 667 return_PTR(NULL);
666 } 668 }
667 669
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index 9547ad8a620b..799162c1b6df 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -167,7 +167,7 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
167 * PARAMETERS: walk_state - Current state 167 * PARAMETERS: walk_state - Current state
168 * aml_op_start - Begin of named Op in AML 168 * aml_op_start - Begin of named Op in AML
169 * unnamed_op - Early Op (not a named Op) 169 * unnamed_op - Early Op (not a named Op)
170 * Op - Returned Op 170 * op - Returned Op
171 * 171 *
172 * RETURN: Status 172 * RETURN: Status
173 * 173 *
@@ -323,7 +323,7 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,
323 323
324 if (walk_state->op_info->flags & AML_CREATE) { 324 if (walk_state->op_info->flags & AML_CREATE) {
325 /* 325 /*
326 * Backup to beginning of create_xXXfield declaration 326 * Backup to beginning of create_XXXfield declaration
327 * body_length is unknown until we parse the body 327 * body_length is unknown until we parse the body
328 */ 328 */
329 op->named.data = aml_op_start; 329 op->named.data = aml_op_start;
@@ -380,7 +380,7 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,
380 * 380 *
381 * PARAMETERS: walk_state - Current state 381 * PARAMETERS: walk_state - Current state
382 * aml_op_start - Op start in AML 382 * aml_op_start - Op start in AML
383 * Op - Current Op 383 * op - Current Op
384 * 384 *
385 * RETURN: Status 385 * RETURN: Status
386 * 386 *
@@ -679,8 +679,8 @@ acpi_ps_link_module_code(union acpi_parse_object *parent_op,
679 * FUNCTION: acpi_ps_complete_op 679 * FUNCTION: acpi_ps_complete_op
680 * 680 *
681 * PARAMETERS: walk_state - Current state 681 * PARAMETERS: walk_state - Current state
682 * Op - Returned Op 682 * op - Returned Op
683 * Status - Parse status before complete Op 683 * status - Parse status before complete Op
684 * 684 *
685 * RETURN: Status 685 * RETURN: Status
686 * 686 *
@@ -853,8 +853,8 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
853 * FUNCTION: acpi_ps_complete_final_op 853 * FUNCTION: acpi_ps_complete_final_op
854 * 854 *
855 * PARAMETERS: walk_state - Current state 855 * PARAMETERS: walk_state - Current state
856 * Op - Current Op 856 * op - Current Op
857 * Status - Current parse status before complete last 857 * status - Current parse status before complete last
858 * Op 858 * Op
859 * 859 *
860 * RETURN: Status 860 * RETURN: Status
@@ -1165,7 +1165,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
1165 1165
1166 if (walk_state->op_info->flags & AML_CREATE) { 1166 if (walk_state->op_info->flags & AML_CREATE) {
1167 /* 1167 /*
1168 * Backup to beginning of create_xXXfield declaration (1 for 1168 * Backup to beginning of create_XXXfield declaration (1 for
1169 * Opcode) 1169 * Opcode)
1170 * 1170 *
1171 * body_length is unknown until we parse the body 1171 * body_length is unknown until we parse the body
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c
index a0226fdcf75c..ed1d457bd5ca 100644
--- a/drivers/acpi/acpica/psopcode.c
+++ b/drivers/acpi/acpica/psopcode.c
@@ -724,7 +724,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
724 * 724 *
725 * FUNCTION: acpi_ps_get_opcode_info 725 * FUNCTION: acpi_ps_get_opcode_info
726 * 726 *
727 * PARAMETERS: Opcode - The AML opcode 727 * PARAMETERS: opcode - The AML opcode
728 * 728 *
729 * RETURN: A pointer to the info about the opcode. 729 * RETURN: A pointer to the info about the opcode.
730 * 730 *
@@ -769,7 +769,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
769 * 769 *
770 * FUNCTION: acpi_ps_get_opcode_name 770 * FUNCTION: acpi_ps_get_opcode_name
771 * 771 *
772 * PARAMETERS: Opcode - The AML opcode 772 * PARAMETERS: opcode - The AML opcode
773 * 773 *
774 * RETURN: A pointer to the name of the opcode (ASCII String) 774 * RETURN: A pointer to the name of the opcode (ASCII String)
775 * Note: Never returns NULL. 775 * Note: Never returns NULL.
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 2ff9c35a1968..01985703bb98 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -64,7 +64,7 @@ ACPI_MODULE_NAME("psparse")
64 * 64 *
65 * FUNCTION: acpi_ps_get_opcode_size 65 * FUNCTION: acpi_ps_get_opcode_size
66 * 66 *
67 * PARAMETERS: Opcode - An AML opcode 67 * PARAMETERS: opcode - An AML opcode
68 * 68 *
69 * RETURN: Size of the opcode, in bytes (1 or 2) 69 * RETURN: Size of the opcode, in bytes (1 or 2)
70 * 70 *
@@ -121,7 +121,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
121 * FUNCTION: acpi_ps_complete_this_op 121 * FUNCTION: acpi_ps_complete_this_op
122 * 122 *
123 * PARAMETERS: walk_state - Current State 123 * PARAMETERS: walk_state - Current State
124 * Op - Op to complete 124 * op - Op to complete
125 * 125 *
126 * RETURN: Status 126 * RETURN: Status
127 * 127 *
@@ -311,7 +311,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
311 * FUNCTION: acpi_ps_next_parse_state 311 * FUNCTION: acpi_ps_next_parse_state
312 * 312 *
313 * PARAMETERS: walk_state - Current state 313 * PARAMETERS: walk_state - Current state
314 * Op - Current parse op 314 * op - Current parse op
315 * callback_status - Status from previous operation 315 * callback_status - Status from previous operation
316 * 316 *
317 * RETURN: Status 317 * RETURN: Status
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c
index c872aa4b926e..608dc20dc173 100644
--- a/drivers/acpi/acpica/psscope.c
+++ b/drivers/acpi/acpica/psscope.c
@@ -93,7 +93,7 @@ u8 acpi_ps_has_completed_scope(struct acpi_parse_state * parser_state)
93 * FUNCTION: acpi_ps_init_scope 93 * FUNCTION: acpi_ps_init_scope
94 * 94 *
95 * PARAMETERS: parser_state - Current parser state object 95 * PARAMETERS: parser_state - Current parser state object
96 * Root - the Root Node of this new scope 96 * root - the Root Node of this new scope
97 * 97 *
98 * RETURN: Status 98 * RETURN: Status
99 * 99 *
@@ -131,7 +131,7 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state,
131 * FUNCTION: acpi_ps_push_scope 131 * FUNCTION: acpi_ps_push_scope
132 * 132 *
133 * PARAMETERS: parser_state - Current parser state object 133 * PARAMETERS: parser_state - Current parser state object
134 * Op - Current op to be pushed 134 * op - Current op to be pushed
135 * remaining_args - List of args remaining 135 * remaining_args - List of args remaining
136 * arg_count - Fixed or variable number of args 136 * arg_count - Fixed or variable number of args
137 * 137 *
@@ -184,7 +184,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
184 * FUNCTION: acpi_ps_pop_scope 184 * FUNCTION: acpi_ps_pop_scope
185 * 185 *
186 * PARAMETERS: parser_state - Current parser state object 186 * PARAMETERS: parser_state - Current parser state object
187 * Op - Where the popped op is returned 187 * op - Where the popped op is returned
188 * arg_list - Where the popped "next argument" is 188 * arg_list - Where the popped "next argument" is
189 * returned 189 * returned
190 * arg_count - Count of objects in arg_list 190 * arg_count - Count of objects in arg_list
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c
index 2b03cdbbe1c0..fdb2e71f3046 100644
--- a/drivers/acpi/acpica/pstree.c
+++ b/drivers/acpi/acpica/pstree.c
@@ -58,8 +58,8 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op);
58 * 58 *
59 * FUNCTION: acpi_ps_get_arg 59 * FUNCTION: acpi_ps_get_arg
60 * 60 *
61 * PARAMETERS: Op - Get an argument for this op 61 * PARAMETERS: op - Get an argument for this op
62 * Argn - Nth argument to get 62 * argn - Nth argument to get
63 * 63 *
64 * RETURN: The argument (as an Op object). NULL if argument does not exist 64 * RETURN: The argument (as an Op object). NULL if argument does not exist
65 * 65 *
@@ -114,8 +114,8 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
114 * 114 *
115 * FUNCTION: acpi_ps_append_arg 115 * FUNCTION: acpi_ps_append_arg
116 * 116 *
117 * PARAMETERS: Op - Append an argument to this Op. 117 * PARAMETERS: op - Append an argument to this Op.
118 * Arg - Argument Op to append 118 * arg - Argument Op to append
119 * 119 *
120 * RETURN: None. 120 * RETURN: None.
121 * 121 *
@@ -188,8 +188,8 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
188 * 188 *
189 * FUNCTION: acpi_ps_get_depth_next 189 * FUNCTION: acpi_ps_get_depth_next
190 * 190 *
191 * PARAMETERS: Origin - Root of subtree to search 191 * PARAMETERS: origin - Root of subtree to search
192 * Op - Last (previous) Op that was found 192 * op - Last (previous) Op that was found
193 * 193 *
194 * RETURN: Next Op found in the search. 194 * RETURN: Next Op found in the search.
195 * 195 *
@@ -261,7 +261,7 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
261 * 261 *
262 * FUNCTION: acpi_ps_get_child 262 * FUNCTION: acpi_ps_get_child
263 * 263 *
264 * PARAMETERS: Op - Get the child of this Op 264 * PARAMETERS: op - Get the child of this Op
265 * 265 *
266 * RETURN: Child Op, Null if none is found. 266 * RETURN: Child Op, Null if none is found.
267 * 267 *
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index 13bb131ae125..8736ad5f04d3 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -77,8 +77,8 @@ union acpi_parse_object *acpi_ps_create_scope_op(void)
77 * 77 *
78 * FUNCTION: acpi_ps_init_op 78 * FUNCTION: acpi_ps_init_op
79 * 79 *
80 * PARAMETERS: Op - A newly allocated Op object 80 * PARAMETERS: op - A newly allocated Op object
81 * Opcode - Opcode to store in the Op 81 * opcode - Opcode to store in the Op
82 * 82 *
83 * RETURN: None 83 * RETURN: None
84 * 84 *
@@ -103,7 +103,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
103 * 103 *
104 * FUNCTION: acpi_ps_alloc_op 104 * FUNCTION: acpi_ps_alloc_op
105 * 105 *
106 * PARAMETERS: Opcode - Opcode that will be stored in the new Op 106 * PARAMETERS: opcode - Opcode that will be stored in the new Op
107 * 107 *
108 * RETURN: Pointer to the new Op, null on failure 108 * RETURN: Pointer to the new Op, null on failure
109 * 109 *
@@ -160,7 +160,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
160 * 160 *
161 * FUNCTION: acpi_ps_free_op 161 * FUNCTION: acpi_ps_free_op
162 * 162 *
163 * PARAMETERS: Op - Op to be freed 163 * PARAMETERS: op - Op to be freed
164 * 164 *
165 * RETURN: None. 165 * RETURN: None.
166 * 166 *
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index 9d98c5ff66a5..963e16225797 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -66,7 +66,7 @@ acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
66 * PARAMETERS: method_name - Valid ACPI name string 66 * PARAMETERS: method_name - Valid ACPI name string
67 * debug_level - Optional level mask. 0 to use default 67 * debug_level - Optional level mask. 0 to use default
68 * debug_layer - Optional layer mask. 0 to use default 68 * debug_layer - Optional layer mask. 0 to use default
69 * Flags - bit 1: one shot(1) or persistent(0) 69 * flags - bit 1: one shot(1) or persistent(0)
70 * 70 *
71 * RETURN: Status 71 * RETURN: Status
72 * 72 *
@@ -105,7 +105,7 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags)
105 * 105 *
106 * FUNCTION: acpi_ps_start_trace 106 * FUNCTION: acpi_ps_start_trace
107 * 107 *
108 * PARAMETERS: Info - Method info struct 108 * PARAMETERS: info - Method info struct
109 * 109 *
110 * RETURN: None 110 * RETURN: None
111 * 111 *
@@ -150,7 +150,7 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info)
150 * 150 *
151 * FUNCTION: acpi_ps_stop_trace 151 * FUNCTION: acpi_ps_stop_trace
152 * 152 *
153 * PARAMETERS: Info - Method info struct 153 * PARAMETERS: info - Method info struct
154 * 154 *
155 * RETURN: None 155 * RETURN: None
156 * 156 *
@@ -193,10 +193,10 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
193 * 193 *
194 * FUNCTION: acpi_ps_execute_method 194 * FUNCTION: acpi_ps_execute_method
195 * 195 *
196 * PARAMETERS: Info - Method info block, contains: 196 * PARAMETERS: info - Method info block, contains:
197 * Node - Method Node to execute 197 * node - Method Node to execute
198 * obj_desc - Method object 198 * obj_desc - Method object
199 * Parameters - List of parameters to pass to the method, 199 * parameters - List of parameters to pass to the method,
200 * terminated by NULL. Params itself may be 200 * terminated by NULL. Params itself may be
201 * NULL if no parameters are being passed. 201 * NULL if no parameters are being passed.
202 * return_object - Where to put method's return value (if 202 * return_object - Where to put method's return value (if
@@ -361,9 +361,9 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
361 * 361 *
362 * FUNCTION: acpi_ps_update_parameter_list 362 * FUNCTION: acpi_ps_update_parameter_list
363 * 363 *
364 * PARAMETERS: Info - See struct acpi_evaluate_info 364 * PARAMETERS: info - See struct acpi_evaluate_info
365 * (Used: parameter_type and Parameters) 365 * (Used: parameter_type and Parameters)
366 * Action - Add or Remove reference 366 * action - Add or Remove reference
367 * 367 *
368 * RETURN: Status 368 * RETURN: Status
369 * 369 *
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c
index a0305652394f..856ff075b6ab 100644
--- a/drivers/acpi/acpica/rsaddr.c
+++ b/drivers/acpi/acpica/rsaddr.c
@@ -182,8 +182,8 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_address64[5] = {
182 182
183 /* Revision ID */ 183 /* Revision ID */
184 184
185 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_iD), 185 {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.ext_address64.revision_ID),
186 AML_OFFSET(ext_address64.revision_iD), 186 AML_OFFSET(ext_address64.revision_ID),
187 1}, 187 1},
188 /* 188 /*
189 * These fields are contiguous in both the source and destination: 189 * These fields are contiguous in both the source and destination:
@@ -215,7 +215,7 @@ static struct acpi_rsconvert_info acpi_rs_convert_general_flags[6] = {
215 AML_OFFSET(address.resource_type), 215 AML_OFFSET(address.resource_type),
216 1}, 216 1},
217 217
218 /* General Flags - Consume, Decode, min_fixed, max_fixed */ 218 /* General flags - Consume, Decode, min_fixed, max_fixed */
219 219
220 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer), 220 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.address.producer_consumer),
221 AML_OFFSET(address.flags), 221 AML_OFFSET(address.flags),
@@ -293,8 +293,8 @@ static struct acpi_rsconvert_info acpi_rs_convert_io_flags[4] = {
293 * 293 *
294 * FUNCTION: acpi_rs_get_address_common 294 * FUNCTION: acpi_rs_get_address_common
295 * 295 *
296 * PARAMETERS: Resource - Pointer to the internal resource struct 296 * PARAMETERS: resource - Pointer to the internal resource struct
297 * Aml - Pointer to the AML resource descriptor 297 * aml - Pointer to the AML resource descriptor
298 * 298 *
299 * RETURN: TRUE if the resource_type field is OK, FALSE otherwise 299 * RETURN: TRUE if the resource_type field is OK, FALSE otherwise
300 * 300 *
@@ -343,8 +343,8 @@ acpi_rs_get_address_common(struct acpi_resource *resource,
343 * 343 *
344 * FUNCTION: acpi_rs_set_address_common 344 * FUNCTION: acpi_rs_set_address_common
345 * 345 *
346 * PARAMETERS: Aml - Pointer to the AML resource descriptor 346 * PARAMETERS: aml - Pointer to the AML resource descriptor
347 * Resource - Pointer to the internal resource struct 347 * resource - Pointer to the internal resource struct
348 * 348 *
349 * RETURN: None 349 * RETURN: None
350 * 350 *
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index 3c6df4b7eb2d..de12469d1c9c 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -173,7 +173,7 @@ acpi_rs_stream_option_length(u32 resource_length,
173 * 173 *
174 * FUNCTION: acpi_rs_get_aml_length 174 * FUNCTION: acpi_rs_get_aml_length
175 * 175 *
176 * PARAMETERS: Resource - Pointer to the resource linked list 176 * PARAMETERS: resource - Pointer to the resource linked list
177 * size_needed - Where the required size is returned 177 * size_needed - Where the required size is returned
178 * 178 *
179 * RETURN: Status 179 * RETURN: Status
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index 46d6eb38ae66..311cbc4f05fa 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -190,8 +190,8 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
190 * 190 *
191 * FUNCTION: acpi_rs_create_pci_routing_table 191 * FUNCTION: acpi_rs_create_pci_routing_table
192 * 192 *
193 * PARAMETERS: package_object - Pointer to a union acpi_operand_object 193 * PARAMETERS: package_object - Pointer to a package containing one
194 * package 194 * of more ACPI_OPERAND_OBJECTs
195 * output_buffer - Pointer to the user's buffer 195 * output_buffer - Pointer to the user's buffer
196 * 196 *
197 * RETURN: Status AE_OK if okay, else a valid acpi_status code. 197 * RETURN: Status AE_OK if okay, else a valid acpi_status code.
@@ -199,7 +199,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
199 * AE_BUFFER_OVERFLOW and output_buffer->Length will point 199 * AE_BUFFER_OVERFLOW and output_buffer->Length will point
200 * to the size buffer needed. 200 * to the size buffer needed.
201 * 201 *
202 * DESCRIPTION: Takes the union acpi_operand_object package and creates a 202 * DESCRIPTION: Takes the union acpi_operand_object package and creates a
203 * linked list of PCI interrupt descriptions 203 * linked list of PCI interrupt descriptions
204 * 204 *
205 * NOTE: It is the caller's responsibility to ensure that the start of the 205 * NOTE: It is the caller's responsibility to ensure that the start of the
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index b4c581132393..4d11b072388c 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -703,7 +703,7 @@ acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
703 * 703 *
704 * FUNCTION: acpi_rs_dump_address_common 704 * FUNCTION: acpi_rs_dump_address_common
705 * 705 *
706 * PARAMETERS: Resource - Pointer to an internal resource descriptor 706 * PARAMETERS: resource - Pointer to an internal resource descriptor
707 * 707 *
708 * RETURN: None 708 * RETURN: None
709 * 709 *
@@ -850,8 +850,8 @@ void acpi_rs_dump_irq_list(u8 * route_table)
850 * 850 *
851 * FUNCTION: acpi_rs_out* 851 * FUNCTION: acpi_rs_out*
852 * 852 *
853 * PARAMETERS: Title - Name of the resource field 853 * PARAMETERS: title - Name of the resource field
854 * Value - Value of the resource field 854 * value - Value of the resource field
855 * 855 *
856 * RETURN: None 856 * RETURN: None
857 * 857 *
@@ -898,8 +898,8 @@ static void acpi_rs_out_title(char *title)
898 * 898 *
899 * FUNCTION: acpi_rs_dump*List 899 * FUNCTION: acpi_rs_dump*List
900 * 900 *
901 * PARAMETERS: Length - Number of elements in the list 901 * PARAMETERS: length - Number of elements in the list
902 * Data - Start of the list 902 * data - Start of the list
903 * 903 *
904 * RETURN: None 904 * RETURN: None
905 * 905 *
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 9be129f5d6f4..46b5324b22d6 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -139,7 +139,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
139 * 139 *
140 * FUNCTION: acpi_rs_convert_resources_to_aml 140 * FUNCTION: acpi_rs_convert_resources_to_aml
141 * 141 *
142 * PARAMETERS: Resource - Pointer to the resource linked list 142 * PARAMETERS: resource - Pointer to the resource linked list
143 * aml_size_needed - Calculated size of the byte stream 143 * aml_size_needed - Calculated size of the byte stream
144 * needed from calling acpi_rs_get_aml_length() 144 * needed from calling acpi_rs_get_aml_length()
145 * The size of the output_buffer is 145 * The size of the output_buffer is
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c
index 8073b371cc7c..c6f291c2bc83 100644
--- a/drivers/acpi/acpica/rsmisc.c
+++ b/drivers/acpi/acpica/rsmisc.c
@@ -57,9 +57,9 @@ ACPI_MODULE_NAME("rsmisc")
57 * 57 *
58 * FUNCTION: acpi_rs_convert_aml_to_resource 58 * FUNCTION: acpi_rs_convert_aml_to_resource
59 * 59 *
60 * PARAMETERS: Resource - Pointer to the resource descriptor 60 * PARAMETERS: resource - Pointer to the resource descriptor
61 * Aml - Where the AML descriptor is returned 61 * aml - Where the AML descriptor is returned
62 * Info - Pointer to appropriate conversion table 62 * info - Pointer to appropriate conversion table
63 * 63 *
64 * RETURN: Status 64 * RETURN: Status
65 * 65 *
@@ -406,7 +406,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
406 406
407 case ACPI_RSC_EXIT_NE: 407 case ACPI_RSC_EXIT_NE:
408 /* 408 /*
409 * Control - Exit conversion if not equal 409 * control - Exit conversion if not equal
410 */ 410 */
411 switch (info->resource_offset) { 411 switch (info->resource_offset) {
412 case ACPI_RSC_COMPARE_AML_LENGTH: 412 case ACPI_RSC_COMPARE_AML_LENGTH:
@@ -454,9 +454,9 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
454 * 454 *
455 * FUNCTION: acpi_rs_convert_resource_to_aml 455 * FUNCTION: acpi_rs_convert_resource_to_aml
456 * 456 *
457 * PARAMETERS: Resource - Pointer to the resource descriptor 457 * PARAMETERS: resource - Pointer to the resource descriptor
458 * Aml - Where the AML descriptor is returned 458 * aml - Where the AML descriptor is returned
459 * Info - Pointer to appropriate conversion table 459 * info - Pointer to appropriate conversion table
460 * 460 *
461 * RETURN: Status 461 * RETURN: Status
462 * 462 *
@@ -726,7 +726,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
726 726
727 case ACPI_RSC_EXIT_LE: 727 case ACPI_RSC_EXIT_LE:
728 /* 728 /*
729 * Control - Exit conversion if less than or equal 729 * control - Exit conversion if less than or equal
730 */ 730 */
731 if (item_count <= info->value) { 731 if (item_count <= info->value) {
732 goto exit; 732 goto exit;
@@ -735,7 +735,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
735 735
736 case ACPI_RSC_EXIT_NE: 736 case ACPI_RSC_EXIT_NE:
737 /* 737 /*
738 * Control - Exit conversion if not equal 738 * control - Exit conversion if not equal
739 */ 739 */
740 switch (COMPARE_OPCODE(info)) { 740 switch (COMPARE_OPCODE(info)) {
741 case ACPI_RSC_COMPARE_VALUE: 741 case ACPI_RSC_COMPARE_VALUE:
@@ -757,7 +757,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
757 757
758 case ACPI_RSC_EXIT_EQ: 758 case ACPI_RSC_EXIT_EQ:
759 /* 759 /*
760 * Control - Exit conversion if equal 760 * control - Exit conversion if equal
761 */ 761 */
762 if (*ACPI_ADD_PTR(u8, resource, 762 if (*ACPI_ADD_PTR(u8, resource,
763 COMPARE_TARGET(info)) == 763 COMPARE_TARGET(info)) ==
@@ -783,7 +783,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
783#if 0 783#if 0
784/* Previous resource validations */ 784/* Previous resource validations */
785 785
786if (aml->ext_address64.revision_iD != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { 786if (aml->ext_address64.revision_ID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
787 return_ACPI_STATUS(AE_SUPPORT); 787 return_ACPI_STATUS(AE_SUPPORT);
788} 788}
789 789
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index 433a375deb93..37d5241c0acf 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -53,8 +53,8 @@ ACPI_MODULE_NAME("rsutils")
53 * 53 *
54 * FUNCTION: acpi_rs_decode_bitmask 54 * FUNCTION: acpi_rs_decode_bitmask
55 * 55 *
56 * PARAMETERS: Mask - Bitmask to decode 56 * PARAMETERS: mask - Bitmask to decode
57 * List - Where the converted list is returned 57 * list - Where the converted list is returned
58 * 58 *
59 * RETURN: Count of bits set (length of list) 59 * RETURN: Count of bits set (length of list)
60 * 60 *
@@ -86,8 +86,8 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list)
86 * 86 *
87 * FUNCTION: acpi_rs_encode_bitmask 87 * FUNCTION: acpi_rs_encode_bitmask
88 * 88 *
89 * PARAMETERS: List - List of values to encode 89 * PARAMETERS: list - List of values to encode
90 * Count - Length of list 90 * count - Length of list
91 * 91 *
92 * RETURN: Encoded bitmask 92 * RETURN: Encoded bitmask
93 * 93 *
@@ -115,8 +115,8 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
115 * 115 *
116 * FUNCTION: acpi_rs_move_data 116 * FUNCTION: acpi_rs_move_data
117 * 117 *
118 * PARAMETERS: Destination - Pointer to the destination descriptor 118 * PARAMETERS: destination - Pointer to the destination descriptor
119 * Source - Pointer to the source descriptor 119 * source - Pointer to the source descriptor
120 * item_count - How many items to move 120 * item_count - How many items to move
121 * move_type - Byte width 121 * move_type - Byte width
122 * 122 *
@@ -183,7 +183,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
183 * 183 *
184 * PARAMETERS: total_length - Length of the AML descriptor, including 184 * PARAMETERS: total_length - Length of the AML descriptor, including
185 * the header and length fields. 185 * the header and length fields.
186 * Aml - Pointer to the raw AML descriptor 186 * aml - Pointer to the raw AML descriptor
187 * 187 *
188 * RETURN: None 188 * RETURN: None
189 * 189 *
@@ -235,7 +235,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
235 * PARAMETERS: descriptor_type - Byte to be inserted as the type 235 * PARAMETERS: descriptor_type - Byte to be inserted as the type
236 * total_length - Length of the AML descriptor, including 236 * total_length - Length of the AML descriptor, including
237 * the header and length fields. 237 * the header and length fields.
238 * Aml - Pointer to the raw AML descriptor 238 * aml - Pointer to the raw AML descriptor
239 * 239 *
240 * RETURN: None 240 * RETURN: None
241 * 241 *
@@ -265,8 +265,8 @@ acpi_rs_set_resource_header(u8 descriptor_type,
265 * 265 *
266 * FUNCTION: acpi_rs_strcpy 266 * FUNCTION: acpi_rs_strcpy
267 * 267 *
268 * PARAMETERS: Destination - Pointer to the destination string 268 * PARAMETERS: destination - Pointer to the destination string
269 * Source - Pointer to the source string 269 * source - Pointer to the source string
270 * 270 *
271 * RETURN: String length, including NULL terminator 271 * RETURN: String length, including NULL terminator
272 * 272 *
@@ -300,7 +300,7 @@ static u16 acpi_rs_strcpy(char *destination, char *source)
300 * minimum_length - Minimum length of the descriptor (minus 300 * minimum_length - Minimum length of the descriptor (minus
301 * any optional fields) 301 * any optional fields)
302 * resource_source - Where the resource_source is returned 302 * resource_source - Where the resource_source is returned
303 * Aml - Pointer to the raw AML descriptor 303 * aml - Pointer to the raw AML descriptor
304 * string_ptr - (optional) where to store the actual 304 * string_ptr - (optional) where to store the actual
305 * resource_source string 305 * resource_source string
306 * 306 *
@@ -386,7 +386,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
386 * 386 *
387 * FUNCTION: acpi_rs_set_resource_source 387 * FUNCTION: acpi_rs_set_resource_source
388 * 388 *
389 * PARAMETERS: Aml - Pointer to the raw AML descriptor 389 * PARAMETERS: aml - Pointer to the raw AML descriptor
390 * minimum_length - Minimum length of the descriptor (minus 390 * minimum_length - Minimum length of the descriptor (minus
391 * any optional fields) 391 * any optional fields)
392 * resource_source - Internal resource_source 392 * resource_source - Internal resource_source
@@ -445,7 +445,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
445 * 445 *
446 * FUNCTION: acpi_rs_get_prt_method_data 446 * FUNCTION: acpi_rs_get_prt_method_data
447 * 447 *
448 * PARAMETERS: Node - Device node 448 * PARAMETERS: node - Device node
449 * ret_buffer - Pointer to a buffer structure for the 449 * ret_buffer - Pointer to a buffer structure for the
450 * results 450 * results
451 * 451 *
@@ -494,7 +494,7 @@ acpi_rs_get_prt_method_data(struct acpi_namespace_node * node,
494 * 494 *
495 * FUNCTION: acpi_rs_get_crs_method_data 495 * FUNCTION: acpi_rs_get_crs_method_data
496 * 496 *
497 * PARAMETERS: Node - Device node 497 * PARAMETERS: node - Device node
498 * ret_buffer - Pointer to a buffer structure for the 498 * ret_buffer - Pointer to a buffer structure for the
499 * results 499 * results
500 * 500 *
@@ -534,7 +534,7 @@ acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
534 */ 534 */
535 status = acpi_rs_create_resource_list(obj_desc, ret_buffer); 535 status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
536 536
537 /* On exit, we must delete the object returned by evaluate_object */ 537 /* On exit, we must delete the object returned by evaluateObject */
538 538
539 acpi_ut_remove_reference(obj_desc); 539 acpi_ut_remove_reference(obj_desc);
540 return_ACPI_STATUS(status); 540 return_ACPI_STATUS(status);
@@ -544,7 +544,7 @@ acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
544 * 544 *
545 * FUNCTION: acpi_rs_get_prs_method_data 545 * FUNCTION: acpi_rs_get_prs_method_data
546 * 546 *
547 * PARAMETERS: Node - Device node 547 * PARAMETERS: node - Device node
548 * ret_buffer - Pointer to a buffer structure for the 548 * ret_buffer - Pointer to a buffer structure for the
549 * results 549 * results
550 * 550 *
@@ -585,7 +585,7 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
585 */ 585 */
586 status = acpi_rs_create_resource_list(obj_desc, ret_buffer); 586 status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
587 587
588 /* On exit, we must delete the object returned by evaluate_object */ 588 /* On exit, we must delete the object returned by evaluateObject */
589 589
590 acpi_ut_remove_reference(obj_desc); 590 acpi_ut_remove_reference(obj_desc);
591 return_ACPI_STATUS(status); 591 return_ACPI_STATUS(status);
@@ -596,7 +596,7 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
596 * 596 *
597 * FUNCTION: acpi_rs_get_aei_method_data 597 * FUNCTION: acpi_rs_get_aei_method_data
598 * 598 *
599 * PARAMETERS: Node - Device node 599 * PARAMETERS: node - Device node
600 * ret_buffer - Pointer to a buffer structure for the 600 * ret_buffer - Pointer to a buffer structure for the
601 * results 601 * results
602 * 602 *
@@ -636,7 +636,7 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
636 */ 636 */
637 status = acpi_rs_create_resource_list(obj_desc, ret_buffer); 637 status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
638 638
639 /* On exit, we must delete the object returned by evaluate_object */ 639 /* On exit, we must delete the object returned by evaluateObject */
640 640
641 acpi_ut_remove_reference(obj_desc); 641 acpi_ut_remove_reference(obj_desc);
642 return_ACPI_STATUS(status); 642 return_ACPI_STATUS(status);
@@ -646,8 +646,8 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
646 * 646 *
647 * FUNCTION: acpi_rs_get_method_data 647 * FUNCTION: acpi_rs_get_method_data
648 * 648 *
649 * PARAMETERS: Handle - Handle to the containing object 649 * PARAMETERS: handle - Handle to the containing object
650 * Path - Path to method, relative to Handle 650 * path - Path to method, relative to Handle
651 * ret_buffer - Pointer to a buffer structure for the 651 * ret_buffer - Pointer to a buffer structure for the
652 * results 652 * results
653 * 653 *
@@ -697,7 +697,7 @@ acpi_rs_get_method_data(acpi_handle handle,
697 * 697 *
698 * FUNCTION: acpi_rs_set_srs_method_data 698 * FUNCTION: acpi_rs_set_srs_method_data
699 * 699 *
700 * PARAMETERS: Node - Device node 700 * PARAMETERS: node - Device node
701 * in_buffer - Pointer to a buffer structure of the 701 * in_buffer - Pointer to a buffer structure of the
702 * parameter 702 * parameter
703 * 703 *
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index f58c098c7aeb..5aad744b5b83 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -79,7 +79,7 @@ acpi_rs_validate_parameters(acpi_handle device_handle,
79 * FUNCTION: acpi_rs_validate_parameters 79 * FUNCTION: acpi_rs_validate_parameters
80 * 80 *
81 * PARAMETERS: device_handle - Handle to a device 81 * PARAMETERS: device_handle - Handle to a device
82 * Buffer - Pointer to a data buffer 82 * buffer - Pointer to a data buffer
83 * return_node - Pointer to where the device node is returned 83 * return_node - Pointer to where the device node is returned
84 * 84 *
85 * RETURN: Status 85 * RETURN: Status
@@ -351,8 +351,8 @@ ACPI_EXPORT_SYMBOL(acpi_get_event_resources)
351 * 351 *
352 * FUNCTION: acpi_resource_to_address64 352 * FUNCTION: acpi_resource_to_address64
353 * 353 *
354 * PARAMETERS: Resource - Pointer to a resource 354 * PARAMETERS: resource - Pointer to a resource
355 * Out - Pointer to the users's return buffer 355 * out - Pointer to the users's return buffer
356 * (a struct acpi_resource_address64) 356 * (a struct acpi_resource_address64)
357 * 357 *
358 * RETURN: Status 358 * RETURN: Status
@@ -415,9 +415,9 @@ ACPI_EXPORT_SYMBOL(acpi_resource_to_address64)
415 * FUNCTION: acpi_get_vendor_resource 415 * FUNCTION: acpi_get_vendor_resource
416 * 416 *
417 * PARAMETERS: device_handle - Handle for the parent device object 417 * PARAMETERS: device_handle - Handle for the parent device object
418 * Name - Method name for the parent resource 418 * name - Method name for the parent resource
419 * (METHOD_NAME__CRS or METHOD_NAME__PRS) 419 * (METHOD_NAME__CRS or METHOD_NAME__PRS)
420 * Uuid - Pointer to the UUID to be matched. 420 * uuid - Pointer to the UUID to be matched.
421 * includes both subtype and 16-byte UUID 421 * includes both subtype and 16-byte UUID
422 * ret_buffer - Where the vendor resource is returned 422 * ret_buffer - Where the vendor resource is returned
423 * 423 *
@@ -526,11 +526,11 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
526 * 526 *
527 * PARAMETERS: device_handle - Handle to the device object for the 527 * PARAMETERS: device_handle - Handle to the device object for the
528 * device we are querying 528 * device we are querying
529 * Name - Method name of the resources we want. 529 * name - Method name of the resources we want.
530 * (METHOD_NAME__CRS, METHOD_NAME__PRS, or 530 * (METHOD_NAME__CRS, METHOD_NAME__PRS, or
531 * METHOD_NAME__AEI) 531 * METHOD_NAME__AEI)
532 * user_function - Called for each resource 532 * user_function - Called for each resource
533 * Context - Passed to user_function 533 * context - Passed to user_function
534 * 534 *
535 * RETURN: Status 535 * RETURN: Status
536 * 536 *
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 4c9c760db4a4..390651860bf0 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -49,9 +49,10 @@
49ACPI_MODULE_NAME("tbfadt") 49ACPI_MODULE_NAME("tbfadt")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static ACPI_INLINE void 52static void
53acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, 53acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
54 u8 space_id, u8 byte_width, u64 address); 54 u8 space_id,
55 u8 byte_width, u64 address, char *register_name);
55 56
56static void acpi_tb_convert_fadt(void); 57static void acpi_tb_convert_fadt(void);
57 58
@@ -172,7 +173,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
172 * 173 *
173 * PARAMETERS: generic_address - GAS struct to be initialized 174 * PARAMETERS: generic_address - GAS struct to be initialized
174 * byte_width - Width of this register 175 * byte_width - Width of this register
175 * Address - Address of the register 176 * address - Address of the register
176 * 177 *
177 * RETURN: None 178 * RETURN: None
178 * 179 *
@@ -182,10 +183,25 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
182 * 183 *
183 ******************************************************************************/ 184 ******************************************************************************/
184 185
185static ACPI_INLINE void 186static void
186acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, 187acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
187 u8 space_id, u8 byte_width, u64 address) 188 u8 space_id,
189 u8 byte_width, u64 address, char *register_name)
188{ 190{
191 u8 bit_width;
192
193 /* Bit width field in the GAS is only one byte long, 255 max */
194
195 bit_width = (u8)(byte_width * 8);
196
197 if (byte_width > 31) { /* (31*8)=248 */
198 ACPI_ERROR((AE_INFO,
199 "%s - 32-bit FADT register is too long (%u bytes, %u bits) "
200 "to convert to GAS struct - 255 bits max, truncating",
201 register_name, byte_width, (byte_width * 8)));
202
203 bit_width = 255;
204 }
189 205
190 /* 206 /*
191 * The 64-bit Address field is non-aligned in the byte packed 207 * The 64-bit Address field is non-aligned in the byte packed
@@ -196,7 +212,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
196 /* All other fields are byte-wide */ 212 /* All other fields are byte-wide */
197 213
198 generic_address->space_id = space_id; 214 generic_address->space_id = space_id;
199 generic_address->bit_width = (u8)ACPI_MUL_8(byte_width); 215 generic_address->bit_width = bit_width;
200 generic_address->bit_offset = 0; 216 generic_address->bit_offset = 0;
201 generic_address->access_width = 0; /* Access width ANY */ 217 generic_address->access_width = 0; /* Access width ANY */
202} 218}
@@ -267,8 +283,8 @@ void acpi_tb_parse_fadt(u32 table_index)
267 * 283 *
268 * FUNCTION: acpi_tb_create_local_fadt 284 * FUNCTION: acpi_tb_create_local_fadt
269 * 285 *
270 * PARAMETERS: Table - Pointer to BIOS FADT 286 * PARAMETERS: table - Pointer to BIOS FADT
271 * Length - Length of the table 287 * length - Length of the table
272 * 288 *
273 * RETURN: None 289 * RETURN: None
274 * 290 *
@@ -287,11 +303,11 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
287 * a warning. 303 * a warning.
288 */ 304 */
289 if (length > sizeof(struct acpi_table_fadt)) { 305 if (length > sizeof(struct acpi_table_fadt)) {
290 ACPI_WARNING((AE_INFO, 306 ACPI_BIOS_WARNING((AE_INFO,
291 "FADT (revision %u) is longer than ACPI 5.0 version, " 307 "FADT (revision %u) is longer than ACPI 5.0 version, "
292 "truncating length %u to %u", 308 "truncating length %u to %u",
293 table->revision, length, 309 table->revision, length,
294 (u32)sizeof(struct acpi_table_fadt))); 310 (u32)sizeof(struct acpi_table_fadt)));
295 } 311 }
296 312
297 /* Clear the entire local FADT */ 313 /* Clear the entire local FADT */
@@ -436,11 +452,13 @@ static void acpi_tb_convert_fadt(void)
436 * they must match. 452 * they must match.
437 */ 453 */
438 if (address64->address && address32 && 454 if (address64->address && address32 &&
439 (address64->address != (u64) address32)) { 455 (address64->address != (u64)address32)) {
440 ACPI_ERROR((AE_INFO, 456 ACPI_BIOS_ERROR((AE_INFO,
441 "32/64X address mismatch in %s: 0x%8.8X/0x%8.8X%8.8X, using 32", 457 "32/64X address mismatch in FADT/%s: "
442 fadt_info_table[i].name, address32, 458 "0x%8.8X/0x%8.8X%8.8X, using 32",
443 ACPI_FORMAT_UINT64(address64->address))); 459 fadt_info_table[i].name, address32,
460 ACPI_FORMAT_UINT64(address64->
461 address)));
444 } 462 }
445 463
446 /* Always use 32-bit address if it is valid (non-null) */ 464 /* Always use 32-bit address if it is valid (non-null) */
@@ -456,7 +474,8 @@ static void acpi_tb_convert_fadt(void)
456 &acpi_gbl_FADT, 474 &acpi_gbl_FADT,
457 fadt_info_table 475 fadt_info_table
458 [i].length), 476 [i].length),
459 (u64) address32); 477 (u64) address32,
478 fadt_info_table[i].name);
460 } 479 }
461 } 480 }
462} 481}
@@ -465,7 +484,7 @@ static void acpi_tb_convert_fadt(void)
465 * 484 *
466 * FUNCTION: acpi_tb_validate_fadt 485 * FUNCTION: acpi_tb_validate_fadt
467 * 486 *
468 * PARAMETERS: Table - Pointer to the FADT to be validated 487 * PARAMETERS: table - Pointer to the FADT to be validated
469 * 488 *
470 * RETURN: None 489 * RETURN: None
471 * 490 *
@@ -494,25 +513,25 @@ static void acpi_tb_validate_fadt(void)
494 * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. 513 * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables.
495 */ 514 */
496 if (acpi_gbl_FADT.facs && 515 if (acpi_gbl_FADT.facs &&
497 (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { 516 (acpi_gbl_FADT.Xfacs != (u64)acpi_gbl_FADT.facs)) {
498 ACPI_WARNING((AE_INFO, 517 ACPI_BIOS_WARNING((AE_INFO,
499 "32/64X FACS address mismatch in FADT - " 518 "32/64X FACS address mismatch in FADT - "
500 "0x%8.8X/0x%8.8X%8.8X, using 32", 519 "0x%8.8X/0x%8.8X%8.8X, using 32",
501 acpi_gbl_FADT.facs, 520 acpi_gbl_FADT.facs,
502 ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs))); 521 ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs)));
503 522
504 acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; 523 acpi_gbl_FADT.Xfacs = (u64)acpi_gbl_FADT.facs;
505 } 524 }
506 525
507 if (acpi_gbl_FADT.dsdt && 526 if (acpi_gbl_FADT.dsdt &&
508 (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { 527 (acpi_gbl_FADT.Xdsdt != (u64)acpi_gbl_FADT.dsdt)) {
509 ACPI_WARNING((AE_INFO, 528 ACPI_BIOS_WARNING((AE_INFO,
510 "32/64X DSDT address mismatch in FADT - " 529 "32/64X DSDT address mismatch in FADT - "
511 "0x%8.8X/0x%8.8X%8.8X, using 32", 530 "0x%8.8X/0x%8.8X%8.8X, using 32",
512 acpi_gbl_FADT.dsdt, 531 acpi_gbl_FADT.dsdt,
513 ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt))); 532 ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt)));
514 533
515 acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; 534 acpi_gbl_FADT.Xdsdt = (u64)acpi_gbl_FADT.dsdt;
516 } 535 }
517 536
518 /* If Hardware Reduced flag is set, we are all done */ 537 /* If Hardware Reduced flag is set, we are all done */
@@ -542,10 +561,10 @@ static void acpi_tb_validate_fadt(void)
542 */ 561 */
543 if (address64->address && 562 if (address64->address &&
544 (address64->bit_width != ACPI_MUL_8(length))) { 563 (address64->bit_width != ACPI_MUL_8(length))) {
545 ACPI_WARNING((AE_INFO, 564 ACPI_BIOS_WARNING((AE_INFO,
546 "32/64X length mismatch in %s: %u/%u", 565 "32/64X length mismatch in FADT/%s: %u/%u",
547 name, ACPI_MUL_8(length), 566 name, ACPI_MUL_8(length),
548 address64->bit_width)); 567 address64->bit_width));
549 } 568 }
550 569
551 if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) { 570 if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) {
@@ -554,29 +573,29 @@ static void acpi_tb_validate_fadt(void)
554 * Both the address and length must be non-zero. 573 * Both the address and length must be non-zero.
555 */ 574 */
556 if (!address64->address || !length) { 575 if (!address64->address || !length) {
557 ACPI_ERROR((AE_INFO, 576 ACPI_BIOS_ERROR((AE_INFO,
558 "Required field %s has zero address and/or length:" 577 "Required FADT field %s has zero address and/or length: "
559 " 0x%8.8X%8.8X/0x%X", 578 "0x%8.8X%8.8X/0x%X",
560 name, 579 name,
561 ACPI_FORMAT_UINT64(address64-> 580 ACPI_FORMAT_UINT64(address64->
562 address), 581 address),
563 length)); 582 length));
564 } 583 }
565 } else if (fadt_info_table[i].type & ACPI_FADT_SEPARATE_LENGTH) { 584 } else if (fadt_info_table[i].type & ACPI_FADT_SEPARATE_LENGTH) {
566 /* 585 /*
567 * Field is optional (PM2Control, GPE0, GPE1) AND has its own 586 * Field is optional (Pm2_control, GPE0, GPE1) AND has its own
568 * length field. If present, both the address and length must 587 * length field. If present, both the address and length must
569 * be valid. 588 * be valid.
570 */ 589 */
571 if ((address64->address && !length) || 590 if ((address64->address && !length) ||
572 (!address64->address && length)) { 591 (!address64->address && length)) {
573 ACPI_WARNING((AE_INFO, 592 ACPI_BIOS_WARNING((AE_INFO,
574 "Optional field %s has zero address or length: " 593 "Optional FADT field %s has zero address or length: "
575 "0x%8.8X%8.8X/0x%X", 594 "0x%8.8X%8.8X/0x%X",
576 name, 595 name,
577 ACPI_FORMAT_UINT64(address64-> 596 ACPI_FORMAT_UINT64
578 address), 597 (address64->address),
579 length)); 598 length));
580 } 599 }
581 } 600 }
582 } 601 }
@@ -621,12 +640,12 @@ static void acpi_tb_setup_fadt_registers(void)
621 (fadt_info_table[i].default_length > 0) && 640 (fadt_info_table[i].default_length > 0) &&
622 (fadt_info_table[i].default_length != 641 (fadt_info_table[i].default_length !=
623 target64->bit_width)) { 642 target64->bit_width)) {
624 ACPI_WARNING((AE_INFO, 643 ACPI_BIOS_WARNING((AE_INFO,
625 "Invalid length for %s: %u, using default %u", 644 "Invalid length for FADT/%s: %u, using default %u",
626 fadt_info_table[i].name, 645 fadt_info_table[i].name,
627 target64->bit_width, 646 target64->bit_width,
628 fadt_info_table[i]. 647 fadt_info_table[i].
629 default_length)); 648 default_length));
630 649
631 /* Incorrect size, set width to the default */ 650 /* Incorrect size, set width to the default */
632 651
@@ -670,7 +689,8 @@ static void acpi_tb_setup_fadt_registers(void)
670 source64->address + 689 source64->address +
671 (fadt_pm_info_table[i]. 690 (fadt_pm_info_table[i].
672 register_num * 691 register_num *
673 pm1_register_byte_width)); 692 pm1_register_byte_width),
693 "PmRegisters");
674 } 694 }
675 } 695 }
676} 696}
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index 4903e36ea75a..57deae166577 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -52,7 +52,7 @@ ACPI_MODULE_NAME("tbfind")
52 * 52 *
53 * FUNCTION: acpi_tb_find_table 53 * FUNCTION: acpi_tb_find_table
54 * 54 *
55 * PARAMETERS: Signature - String with ACPI table signature 55 * PARAMETERS: signature - String with ACPI table signature
56 * oem_id - String with the table OEM ID 56 * oem_id - String with the table OEM ID
57 * oem_table_id - String with the OEM Table ID 57 * oem_table_id - String with the OEM Table ID
58 * table_index - Where the table index is returned 58 * table_index - Where the table index is returned
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index c03500b4cc7a..74f97d74db1c 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -138,13 +138,14 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
138 if ((table_desc->pointer->signature[0] != 0x00) && 138 if ((table_desc->pointer->signature[0] != 0x00) &&
139 (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)) 139 (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT))
140 && (ACPI_STRNCMP(table_desc->pointer->signature, "OEM", 3))) { 140 && (ACPI_STRNCMP(table_desc->pointer->signature, "OEM", 3))) {
141 ACPI_ERROR((AE_INFO, 141 ACPI_BIOS_ERROR((AE_INFO,
142 "Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx", 142 "Table has invalid signature [%4.4s] (0x%8.8X), "
143 acpi_ut_valid_acpi_name(*(u32 *)table_desc-> 143 "must be SSDT or OEMx",
144 pointer-> 144 acpi_ut_valid_acpi_name(*(u32 *)table_desc->
145 signature) ? table_desc-> 145 pointer->
146 pointer->signature : "????", 146 signature) ?
147 *(u32 *)table_desc->pointer->signature)); 147 table_desc->pointer->signature : "????",
148 *(u32 *)table_desc->pointer->signature));
148 149
149 return_ACPI_STATUS(AE_BAD_SIGNATURE); 150 return_ACPI_STATUS(AE_BAD_SIGNATURE);
150 } 151 }
@@ -396,10 +397,10 @@ acpi_status acpi_tb_resize_root_table_list(void)
396 * 397 *
397 * FUNCTION: acpi_tb_store_table 398 * FUNCTION: acpi_tb_store_table
398 * 399 *
399 * PARAMETERS: Address - Table address 400 * PARAMETERS: address - Table address
400 * Table - Table header 401 * table - Table header
401 * Length - Table length 402 * length - Table length
402 * Flags - flags 403 * flags - flags
403 * 404 *
404 * RETURN: Status and table index. 405 * RETURN: Status and table index.
405 * 406 *
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 0a706cac37de..b6cea30da638 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -178,8 +178,8 @@ u8 acpi_tb_tables_loaded(void)
178 * 178 *
179 * FUNCTION: acpi_tb_fix_string 179 * FUNCTION: acpi_tb_fix_string
180 * 180 *
181 * PARAMETERS: String - String to be repaired 181 * PARAMETERS: string - String to be repaired
182 * Length - Maximum length 182 * length - Maximum length
183 * 183 *
184 * RETURN: None 184 * RETURN: None
185 * 185 *
@@ -205,7 +205,7 @@ static void acpi_tb_fix_string(char *string, acpi_size length)
205 * FUNCTION: acpi_tb_cleanup_table_header 205 * FUNCTION: acpi_tb_cleanup_table_header
206 * 206 *
207 * PARAMETERS: out_header - Where the cleaned header is returned 207 * PARAMETERS: out_header - Where the cleaned header is returned
208 * Header - Input ACPI table header 208 * header - Input ACPI table header
209 * 209 *
210 * RETURN: Returns the cleaned header in out_header 210 * RETURN: Returns the cleaned header in out_header
211 * 211 *
@@ -231,8 +231,8 @@ acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
231 * 231 *
232 * FUNCTION: acpi_tb_print_table_header 232 * FUNCTION: acpi_tb_print_table_header
233 * 233 *
234 * PARAMETERS: Address - Table physical address 234 * PARAMETERS: address - Table physical address
235 * Header - Table header 235 * header - Table header
236 * 236 *
237 * RETURN: None 237 * RETURN: None
238 * 238 *
@@ -296,8 +296,8 @@ acpi_tb_print_table_header(acpi_physical_address address,
296 * 296 *
297 * FUNCTION: acpi_tb_validate_checksum 297 * FUNCTION: acpi_tb_validate_checksum
298 * 298 *
299 * PARAMETERS: Table - ACPI table to verify 299 * PARAMETERS: table - ACPI table to verify
300 * Length - Length of entire table 300 * length - Length of entire table
301 * 301 *
302 * RETURN: Status 302 * RETURN: Status
303 * 303 *
@@ -317,10 +317,11 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
317 /* Checksum ok? (should be zero) */ 317 /* Checksum ok? (should be zero) */
318 318
319 if (checksum) { 319 if (checksum) {
320 ACPI_WARNING((AE_INFO, 320 ACPI_BIOS_WARNING((AE_INFO,
321 "Incorrect checksum in table [%4.4s] - 0x%2.2X, should be 0x%2.2X", 321 "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
322 table->signature, table->checksum, 322 "should be 0x%2.2X",
323 (u8) (table->checksum - checksum))); 323 table->signature, table->checksum,
324 (u8)(table->checksum - checksum)));
324 325
325#if (ACPI_CHECKSUM_ABORT) 326#if (ACPI_CHECKSUM_ABORT)
326 327
@@ -335,8 +336,8 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
335 * 336 *
336 * FUNCTION: acpi_tb_checksum 337 * FUNCTION: acpi_tb_checksum
337 * 338 *
338 * PARAMETERS: Buffer - Pointer to memory region to be checked 339 * PARAMETERS: buffer - Pointer to memory region to be checked
339 * Length - Length of this memory region 340 * length - Length of this memory region
340 * 341 *
341 * RETURN: Checksum (u8) 342 * RETURN: Checksum (u8)
342 * 343 *
@@ -377,8 +378,9 @@ void acpi_tb_check_dsdt_header(void)
377 378
378 if (acpi_gbl_original_dsdt_header.length != acpi_gbl_DSDT->length || 379 if (acpi_gbl_original_dsdt_header.length != acpi_gbl_DSDT->length ||
379 acpi_gbl_original_dsdt_header.checksum != acpi_gbl_DSDT->checksum) { 380 acpi_gbl_original_dsdt_header.checksum != acpi_gbl_DSDT->checksum) {
380 ACPI_ERROR((AE_INFO, 381 ACPI_BIOS_ERROR((AE_INFO,
381 "The DSDT has been corrupted or replaced - old, new headers below")); 382 "The DSDT has been corrupted or replaced - "
383 "old, new headers below"));
382 acpi_tb_print_table_header(0, &acpi_gbl_original_dsdt_header); 384 acpi_tb_print_table_header(0, &acpi_gbl_original_dsdt_header);
383 acpi_tb_print_table_header(0, acpi_gbl_DSDT); 385 acpi_tb_print_table_header(0, acpi_gbl_DSDT);
384 386
@@ -438,8 +440,8 @@ struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index)
438 * 440 *
439 * FUNCTION: acpi_tb_install_table 441 * FUNCTION: acpi_tb_install_table
440 * 442 *
441 * PARAMETERS: Address - Physical address of DSDT or FACS 443 * PARAMETERS: address - Physical address of DSDT or FACS
442 * Signature - Table signature, NULL if no need to 444 * signature - Table signature, NULL if no need to
443 * match 445 * match
444 * table_index - Index into root table array 446 * table_index - Index into root table array
445 * 447 *
@@ -480,9 +482,10 @@ acpi_tb_install_table(acpi_physical_address address,
480 /* If a particular signature is expected (DSDT/FACS), it must match */ 482 /* If a particular signature is expected (DSDT/FACS), it must match */
481 483
482 if (signature && !ACPI_COMPARE_NAME(table->signature, signature)) { 484 if (signature && !ACPI_COMPARE_NAME(table->signature, signature)) {
483 ACPI_ERROR((AE_INFO, 485 ACPI_BIOS_ERROR((AE_INFO,
484 "Invalid signature 0x%X for ACPI table, expected [%s]", 486 "Invalid signature 0x%X for ACPI table, expected [%s]",
485 *ACPI_CAST_PTR(u32, table->signature), signature)); 487 *ACPI_CAST_PTR(u32, table->signature),
488 signature));
486 goto unmap_and_exit; 489 goto unmap_and_exit;
487 } 490 }
488 491
@@ -589,10 +592,10 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)
589 592
590 /* Will truncate 64-bit address to 32 bits, issue warning */ 593 /* Will truncate 64-bit address to 32 bits, issue warning */
591 594
592 ACPI_WARNING((AE_INFO, 595 ACPI_BIOS_WARNING((AE_INFO,
593 "64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X)," 596 "64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X),"
594 " truncating", 597 " truncating",
595 ACPI_FORMAT_UINT64(address64))); 598 ACPI_FORMAT_UINT64(address64)));
596 } 599 }
597#endif 600#endif
598 return ((acpi_physical_address) (address64)); 601 return ((acpi_physical_address) (address64));
@@ -603,7 +606,7 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)
603 * 606 *
604 * FUNCTION: acpi_tb_parse_root_table 607 * FUNCTION: acpi_tb_parse_root_table
605 * 608 *
606 * PARAMETERS: Rsdp - Pointer to the RSDP 609 * PARAMETERS: rsdp - Pointer to the RSDP
607 * 610 *
608 * RETURN: Status 611 * RETURN: Status
609 * 612 *
@@ -694,8 +697,9 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
694 acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); 697 acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
695 698
696 if (length < sizeof(struct acpi_table_header)) { 699 if (length < sizeof(struct acpi_table_header)) {
697 ACPI_ERROR((AE_INFO, "Invalid length 0x%X in RSDT/XSDT", 700 ACPI_BIOS_ERROR((AE_INFO,
698 length)); 701 "Invalid table length 0x%X in RSDT/XSDT",
702 length));
699 return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); 703 return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
700 } 704 }
701 705
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index abcc6412c244..ea4c6d52605a 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -1,7 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Module Name: tbxface - Public interfaces to the ACPI subsystem 3 * Module Name: tbxface - ACPI table oriented external interfaces
4 * ACPI table oriented interfaces
5 * 4 *
6 *****************************************************************************/ 5 *****************************************************************************/
7 6
@@ -51,11 +50,6 @@
51#define _COMPONENT ACPI_TABLES 50#define _COMPONENT ACPI_TABLES
52ACPI_MODULE_NAME("tbxface") 51ACPI_MODULE_NAME("tbxface")
53 52
54/* Local prototypes */
55static acpi_status acpi_tb_load_namespace(void);
56
57static int no_auto_ssdt;
58
59/******************************************************************************* 53/*******************************************************************************
60 * 54 *
61 * FUNCTION: acpi_allocate_root_table 55 * FUNCTION: acpi_allocate_root_table
@@ -65,11 +59,10 @@ static int no_auto_ssdt;
65 * 59 *
66 * RETURN: Status 60 * RETURN: Status
67 * 61 *
68 * DESCRIPTION: Allocate a root table array. Used by i_aSL compiler and 62 * DESCRIPTION: Allocate a root table array. Used by iASL compiler and
69 * acpi_initialize_tables. 63 * acpi_initialize_tables.
70 * 64 *
71 ******************************************************************************/ 65 ******************************************************************************/
72
73acpi_status acpi_allocate_root_table(u32 initial_table_count) 66acpi_status acpi_allocate_root_table(u32 initial_table_count)
74{ 67{
75 68
@@ -222,52 +215,10 @@ acpi_status acpi_reallocate_root_table(void)
222 215
223/******************************************************************************* 216/*******************************************************************************
224 * 217 *
225 * FUNCTION: acpi_load_table
226 *
227 * PARAMETERS: table_ptr - pointer to a buffer containing the entire
228 * table to be loaded
229 *
230 * RETURN: Status
231 *
232 * DESCRIPTION: This function is called to load a table from the caller's
233 * buffer. The buffer must contain an entire ACPI Table including
234 * a valid header. The header fields will be verified, and if it
235 * is determined that the table is invalid, the call will fail.
236 *
237 ******************************************************************************/
238acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
239{
240 acpi_status status;
241 u32 table_index;
242 struct acpi_table_desc table_desc;
243
244 if (!table_ptr)
245 return AE_BAD_PARAMETER;
246
247 ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc));
248 table_desc.pointer = table_ptr;
249 table_desc.length = table_ptr->length;
250 table_desc.flags = ACPI_TABLE_ORIGIN_UNKNOWN;
251
252 /*
253 * Install the new table into the local data structures
254 */
255 status = acpi_tb_add_table(&table_desc, &table_index);
256 if (ACPI_FAILURE(status)) {
257 return status;
258 }
259 status = acpi_ns_load_table(table_index, acpi_gbl_root_node);
260 return status;
261}
262
263ACPI_EXPORT_SYMBOL(acpi_load_table)
264
265/*******************************************************************************
266 *
267 * FUNCTION: acpi_get_table_header 218 * FUNCTION: acpi_get_table_header
268 * 219 *
269 * PARAMETERS: Signature - ACPI signature of needed table 220 * PARAMETERS: signature - ACPI signature of needed table
270 * Instance - Which instance (for SSDTs) 221 * instance - Which instance (for SSDTs)
271 * out_table_header - The pointer to the table header to fill 222 * out_table_header - The pointer to the table header to fill
272 * 223 *
273 * RETURN: Status and pointer to mapped table header 224 * RETURN: Status and pointer to mapped table header
@@ -382,8 +333,8 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id)
382 * 333 *
383 * FUNCTION: acpi_get_table_with_size 334 * FUNCTION: acpi_get_table_with_size
384 * 335 *
385 * PARAMETERS: Signature - ACPI signature of needed table 336 * PARAMETERS: signature - ACPI signature of needed table
386 * Instance - Which instance (for SSDTs) 337 * instance - Which instance (for SSDTs)
387 * out_table - Where the pointer to the table is returned 338 * out_table - Where the pointer to the table is returned
388 * 339 *
389 * RETURN: Status and pointer to table 340 * RETURN: Status and pointer to table
@@ -453,7 +404,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table)
453 * FUNCTION: acpi_get_table_by_index 404 * FUNCTION: acpi_get_table_by_index
454 * 405 *
455 * PARAMETERS: table_index - Table index 406 * PARAMETERS: table_index - Table index
456 * Table - Where the pointer to the table is returned 407 * table - Where the pointer to the table is returned
457 * 408 *
458 * RETURN: Status and pointer to the table 409 * RETURN: Status and pointer to the table
459 * 410 *
@@ -502,157 +453,13 @@ acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table)
502 453
503ACPI_EXPORT_SYMBOL(acpi_get_table_by_index) 454ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)
504 455
505/*******************************************************************************
506 *
507 * FUNCTION: acpi_tb_load_namespace
508 *
509 * PARAMETERS: None
510 *
511 * RETURN: Status
512 *
513 * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
514 * the RSDT/XSDT.
515 *
516 ******************************************************************************/
517static acpi_status acpi_tb_load_namespace(void)
518{
519 acpi_status status;
520 u32 i;
521 struct acpi_table_header *new_dsdt;
522
523 ACPI_FUNCTION_TRACE(tb_load_namespace);
524
525 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
526
527 /*
528 * Load the namespace. The DSDT is required, but any SSDT and
529 * PSDT tables are optional. Verify the DSDT.
530 */
531 if (!acpi_gbl_root_table_list.current_table_count ||
532 !ACPI_COMPARE_NAME(&
533 (acpi_gbl_root_table_list.
534 tables[ACPI_TABLE_INDEX_DSDT].signature),
535 ACPI_SIG_DSDT)
536 ||
537 ACPI_FAILURE(acpi_tb_verify_table
538 (&acpi_gbl_root_table_list.
539 tables[ACPI_TABLE_INDEX_DSDT]))) {
540 status = AE_NO_ACPI_TABLES;
541 goto unlock_and_exit;
542 }
543
544 /*
545 * Save the DSDT pointer for simple access. This is the mapped memory
546 * address. We must take care here because the address of the .Tables
547 * array can change dynamically as tables are loaded at run-time. Note:
548 * .Pointer field is not validated until after call to acpi_tb_verify_table.
549 */
550 acpi_gbl_DSDT =
551 acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer;
552
553 /*
554 * Optionally copy the entire DSDT to local memory (instead of simply
555 * mapping it.) There are some BIOSs that corrupt or replace the original
556 * DSDT, creating the need for this option. Default is FALSE, do not copy
557 * the DSDT.
558 */
559 if (acpi_gbl_copy_dsdt_locally) {
560 new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT);
561 if (new_dsdt) {
562 acpi_gbl_DSDT = new_dsdt;
563 }
564 }
565
566 /*
567 * Save the original DSDT header for detection of table corruption
568 * and/or replacement of the DSDT from outside the OS.
569 */
570 ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
571 sizeof(struct acpi_table_header));
572
573 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
574
575 /* Load and parse tables */
576
577 status = acpi_ns_load_table(ACPI_TABLE_INDEX_DSDT, acpi_gbl_root_node);
578 if (ACPI_FAILURE(status)) {
579 return_ACPI_STATUS(status);
580 }
581
582 /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
583
584 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
585 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
586 if ((!ACPI_COMPARE_NAME
587 (&(acpi_gbl_root_table_list.tables[i].signature),
588 ACPI_SIG_SSDT)
589 &&
590 !ACPI_COMPARE_NAME(&
591 (acpi_gbl_root_table_list.tables[i].
592 signature), ACPI_SIG_PSDT))
593 ||
594 ACPI_FAILURE(acpi_tb_verify_table
595 (&acpi_gbl_root_table_list.tables[i]))) {
596 continue;
597 }
598
599 if (no_auto_ssdt) {
600 printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n");
601 continue;
602 }
603
604 /* Ignore errors while loading tables, get as many as possible */
605
606 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
607 (void)acpi_ns_load_table(i, acpi_gbl_root_node);
608 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
609 }
610
611 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
612
613 unlock_and_exit:
614 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
615 return_ACPI_STATUS(status);
616}
617
618/*******************************************************************************
619 *
620 * FUNCTION: acpi_load_tables
621 *
622 * PARAMETERS: None
623 *
624 * RETURN: Status
625 *
626 * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
627 *
628 ******************************************************************************/
629
630acpi_status acpi_load_tables(void)
631{
632 acpi_status status;
633
634 ACPI_FUNCTION_TRACE(acpi_load_tables);
635
636 /* Load the namespace from the tables */
637
638 status = acpi_tb_load_namespace();
639 if (ACPI_FAILURE(status)) {
640 ACPI_EXCEPTION((AE_INFO, status,
641 "While loading namespace from ACPI tables"));
642 }
643
644 return_ACPI_STATUS(status);
645}
646
647ACPI_EXPORT_SYMBOL(acpi_load_tables)
648
649 456
650/******************************************************************************* 457/*******************************************************************************
651 * 458 *
652 * FUNCTION: acpi_install_table_handler 459 * FUNCTION: acpi_install_table_handler
653 * 460 *
654 * PARAMETERS: Handler - Table event handler 461 * PARAMETERS: handler - Table event handler
655 * Context - Value passed to the handler on each event 462 * context - Value passed to the handler on each event
656 * 463 *
657 * RETURN: Status 464 * RETURN: Status
658 * 465 *
@@ -698,7 +505,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_table_handler)
698 * 505 *
699 * FUNCTION: acpi_remove_table_handler 506 * FUNCTION: acpi_remove_table_handler
700 * 507 *
701 * PARAMETERS: Handler - Table event handler that was installed 508 * PARAMETERS: handler - Table event handler that was installed
702 * previously. 509 * previously.
703 * 510 *
704 * RETURN: Status 511 * RETURN: Status
@@ -734,15 +541,3 @@ acpi_status acpi_remove_table_handler(acpi_tbl_handler handler)
734} 541}
735 542
736ACPI_EXPORT_SYMBOL(acpi_remove_table_handler) 543ACPI_EXPORT_SYMBOL(acpi_remove_table_handler)
737
738
739static int __init acpi_no_auto_ssdt_setup(char *s) {
740
741 printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
742
743 no_auto_ssdt = 1;
744
745 return 1;
746}
747
748__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
new file mode 100644
index 000000000000..f87cc63e69a1
--- /dev/null
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -0,0 +1,389 @@
1/******************************************************************************
2 *
3 * Module Name: tbxfload - Table load/unload external interfaces
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <linux/export.h>
45#include <acpi/acpi.h>
46#include "accommon.h"
47#include "acnamesp.h"
48#include "actables.h"
49
50#define _COMPONENT ACPI_TABLES
51ACPI_MODULE_NAME("tbxfload")
52
53/* Local prototypes */
54static acpi_status acpi_tb_load_namespace(void);
55
56static int no_auto_ssdt;
57
58/*******************************************************************************
59 *
60 * FUNCTION: acpi_load_tables
61 *
62 * PARAMETERS: None
63 *
64 * RETURN: Status
65 *
66 * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
67 *
68 ******************************************************************************/
69
70acpi_status acpi_load_tables(void)
71{
72 acpi_status status;
73
74 ACPI_FUNCTION_TRACE(acpi_load_tables);
75
76 /* Load the namespace from the tables */
77
78 status = acpi_tb_load_namespace();
79 if (ACPI_FAILURE(status)) {
80 ACPI_EXCEPTION((AE_INFO, status,
81 "While loading namespace from ACPI tables"));
82 }
83
84 return_ACPI_STATUS(status);
85}
86
87ACPI_EXPORT_SYMBOL(acpi_load_tables)
88
89/*******************************************************************************
90 *
91 * FUNCTION: acpi_tb_load_namespace
92 *
93 * PARAMETERS: None
94 *
95 * RETURN: Status
96 *
97 * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
98 * the RSDT/XSDT.
99 *
100 ******************************************************************************/
101static acpi_status acpi_tb_load_namespace(void)
102{
103 acpi_status status;
104 u32 i;
105 struct acpi_table_header *new_dsdt;
106
107 ACPI_FUNCTION_TRACE(tb_load_namespace);
108
109 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
110
111 /*
112 * Load the namespace. The DSDT is required, but any SSDT and
113 * PSDT tables are optional. Verify the DSDT.
114 */
115 if (!acpi_gbl_root_table_list.current_table_count ||
116 !ACPI_COMPARE_NAME(&
117 (acpi_gbl_root_table_list.
118 tables[ACPI_TABLE_INDEX_DSDT].signature),
119 ACPI_SIG_DSDT)
120 ||
121 ACPI_FAILURE(acpi_tb_verify_table
122 (&acpi_gbl_root_table_list.
123 tables[ACPI_TABLE_INDEX_DSDT]))) {
124 status = AE_NO_ACPI_TABLES;
125 goto unlock_and_exit;
126 }
127
128 /*
129 * Save the DSDT pointer for simple access. This is the mapped memory
130 * address. We must take care here because the address of the .Tables
131 * array can change dynamically as tables are loaded at run-time. Note:
132 * .Pointer field is not validated until after call to acpi_tb_verify_table.
133 */
134 acpi_gbl_DSDT =
135 acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer;
136
137 /*
138 * Optionally copy the entire DSDT to local memory (instead of simply
139 * mapping it.) There are some BIOSs that corrupt or replace the original
140 * DSDT, creating the need for this option. Default is FALSE, do not copy
141 * the DSDT.
142 */
143 if (acpi_gbl_copy_dsdt_locally) {
144 new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT);
145 if (new_dsdt) {
146 acpi_gbl_DSDT = new_dsdt;
147 }
148 }
149
150 /*
151 * Save the original DSDT header for detection of table corruption
152 * and/or replacement of the DSDT from outside the OS.
153 */
154 ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
155 sizeof(struct acpi_table_header));
156
157 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
158
159 /* Load and parse tables */
160
161 status = acpi_ns_load_table(ACPI_TABLE_INDEX_DSDT, acpi_gbl_root_node);
162 if (ACPI_FAILURE(status)) {
163 return_ACPI_STATUS(status);
164 }
165
166 /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
167
168 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
169 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
170 if ((!ACPI_COMPARE_NAME
171 (&(acpi_gbl_root_table_list.tables[i].signature),
172 ACPI_SIG_SSDT)
173 &&
174 !ACPI_COMPARE_NAME(&
175 (acpi_gbl_root_table_list.tables[i].
176 signature), ACPI_SIG_PSDT))
177 ||
178 ACPI_FAILURE(acpi_tb_verify_table
179 (&acpi_gbl_root_table_list.tables[i]))) {
180 continue;
181 }
182
183 if (no_auto_ssdt) {
184 printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n");
185 continue;
186 }
187
188 /* Ignore errors while loading tables, get as many as possible */
189
190 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
191 (void)acpi_ns_load_table(i, acpi_gbl_root_node);
192 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
193 }
194
195 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
196
197 unlock_and_exit:
198 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
199 return_ACPI_STATUS(status);
200}
201
202/*******************************************************************************
203 *
204 * FUNCTION: acpi_load_table
205 *
206 * PARAMETERS: table - Pointer to a buffer containing the ACPI
207 * table to be loaded.
208 *
209 * RETURN: Status
210 *
211 * DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
212 * be a valid ACPI table with a valid ACPI table header.
213 * Note1: Mainly intended to support hotplug addition of SSDTs.
214 * Note2: Does not copy the incoming table. User is reponsible
215 * to ensure that the table is not deleted or unmapped.
216 *
217 ******************************************************************************/
218
219acpi_status acpi_load_table(struct acpi_table_header *table)
220{
221 acpi_status status;
222 struct acpi_table_desc table_desc;
223 u32 table_index;
224
225 ACPI_FUNCTION_TRACE(acpi_load_table);
226
227 /* Parameter validation */
228
229 if (!table) {
230 return_ACPI_STATUS(AE_BAD_PARAMETER);
231 }
232
233 /* Init local table descriptor */
234
235 ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc));
236 table_desc.address = ACPI_PTR_TO_PHYSADDR(table);
237 table_desc.pointer = table;
238 table_desc.length = table->length;
239 table_desc.flags = ACPI_TABLE_ORIGIN_UNKNOWN;
240
241 /* Must acquire the interpreter lock during this operation */
242
243 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
244 if (ACPI_FAILURE(status)) {
245 return_ACPI_STATUS(status);
246 }
247
248 /* Install the table and load it into the namespace */
249
250 ACPI_INFO((AE_INFO, "Host-directed Dynamic ACPI Table Load:"));
251 status = acpi_tb_add_table(&table_desc, &table_index);
252 if (ACPI_FAILURE(status)) {
253 goto unlock_and_exit;
254 }
255
256 status = acpi_ns_load_table(table_index, acpi_gbl_root_node);
257
258 /* Invoke table handler if present */
259
260 if (acpi_gbl_table_handler) {
261 (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table,
262 acpi_gbl_table_handler_context);
263 }
264
265 unlock_and_exit:
266 (void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
267 return_ACPI_STATUS(status);
268}
269
270ACPI_EXPORT_SYMBOL(acpi_load_table)
271
272/*******************************************************************************
273 *
274 * FUNCTION: acpi_unload_parent_table
275 *
276 * PARAMETERS: object - Handle to any namespace object owned by
277 * the table to be unloaded
278 *
279 * RETURN: Status
280 *
281 * DESCRIPTION: Via any namespace object within an SSDT or OEMx table, unloads
282 * the table and deletes all namespace objects associated with
283 * that table. Unloading of the DSDT is not allowed.
284 * Note: Mainly intended to support hotplug removal of SSDTs.
285 *
286 ******************************************************************************/
287acpi_status acpi_unload_parent_table(acpi_handle object)
288{
289 struct acpi_namespace_node *node =
290 ACPI_CAST_PTR(struct acpi_namespace_node, object);
291 acpi_status status = AE_NOT_EXIST;
292 acpi_owner_id owner_id;
293 u32 i;
294
295 ACPI_FUNCTION_TRACE(acpi_unload_parent_table);
296
297 /* Parameter validation */
298
299 if (!object) {
300 return_ACPI_STATUS(AE_BAD_PARAMETER);
301 }
302
303 /*
304 * The node owner_id is currently the same as the parent table ID.
305 * However, this could change in the future.
306 */
307 owner_id = node->owner_id;
308 if (!owner_id) {
309
310 /* owner_id==0 means DSDT is the owner. DSDT cannot be unloaded */
311
312 return_ACPI_STATUS(AE_TYPE);
313 }
314
315 /* Must acquire the interpreter lock during this operation */
316
317 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
318 if (ACPI_FAILURE(status)) {
319 return_ACPI_STATUS(status);
320 }
321
322 /* Find the table in the global table list */
323
324 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) {
325 if (owner_id != acpi_gbl_root_table_list.tables[i].owner_id) {
326 continue;
327 }
328
329 /*
330 * Allow unload of SSDT and OEMx tables only. Do not allow unload
331 * of the DSDT. No other types of tables should get here, since
332 * only these types can contain AML and thus are the only types
333 * that can create namespace objects.
334 */
335 if (ACPI_COMPARE_NAME
336 (acpi_gbl_root_table_list.tables[i].signature.ascii,
337 ACPI_SIG_DSDT)) {
338 status = AE_TYPE;
339 break;
340 }
341
342 /* Ensure the table is actually loaded */
343
344 if (!acpi_tb_is_table_loaded(i)) {
345 status = AE_NOT_EXIST;
346 break;
347 }
348
349 /* Invoke table handler if present */
350
351 if (acpi_gbl_table_handler) {
352 (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD,
353 acpi_gbl_root_table_list.
354 tables[i].pointer,
355 acpi_gbl_table_handler_context);
356 }
357
358 /*
359 * Delete all namespace objects owned by this table. Note that
360 * these objects can appear anywhere in the namespace by virtue
361 * of the AML "Scope" operator. Thus, we need to track ownership
362 * by an ID, not simply a position within the hierarchy.
363 */
364 status = acpi_tb_delete_namespace_by_owner(i);
365 if (ACPI_FAILURE(status)) {
366 break;
367 }
368
369 status = acpi_tb_release_owner_id(i);
370 acpi_tb_set_table_loaded_flag(i, FALSE);
371 break;
372 }
373
374 (void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
375 return_ACPI_STATUS(status);
376}
377
378ACPI_EXPORT_SYMBOL(acpi_unload_parent_table)
379
380static int __init acpi_no_auto_ssdt_setup(char *s) {
381
382 printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
383
384 no_auto_ssdt = 1;
385
386 return 1;
387}
388
389__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index 4258f647ca3d..74e720800037 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -57,7 +57,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp);
57 * 57 *
58 * FUNCTION: acpi_tb_validate_rsdp 58 * FUNCTION: acpi_tb_validate_rsdp
59 * 59 *
60 * PARAMETERS: Rsdp - Pointer to unvalidated RSDP 60 * PARAMETERS: rsdp - Pointer to unvalidated RSDP
61 * 61 *
62 * RETURN: Status 62 * RETURN: Status
63 * 63 *
@@ -107,10 +107,10 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
107 * 107 *
108 * RETURN: Status, RSDP physical address 108 * RETURN: Status, RSDP physical address
109 * 109 *
110 * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor 110 * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
111 * pointer structure. If it is found, set *RSDP to point to it. 111 * pointer structure. If it is found, set *RSDP to point to it.
112 * 112 *
113 * NOTE1: The RSDP must be either in the first 1_k of the Extended 113 * NOTE1: The RSDP must be either in the first 1K of the Extended
114 * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) 114 * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
115 * Only a 32-bit physical address is necessary. 115 * Only a 32-bit physical address is necessary.
116 * 116 *
@@ -152,7 +152,7 @@ acpi_status acpi_find_root_pointer(acpi_size *table_address)
152 if (physical_address > 0x400) { 152 if (physical_address > 0x400) {
153 /* 153 /*
154 * 1b) Search EBDA paragraphs (EBDA is required to be a 154 * 1b) Search EBDA paragraphs (EBDA is required to be a
155 * minimum of 1_k length) 155 * minimum of 1K length)
156 */ 156 */
157 table_ptr = acpi_os_map_memory((acpi_physical_address) 157 table_ptr = acpi_os_map_memory((acpi_physical_address)
158 physical_address, 158 physical_address,
@@ -216,7 +216,7 @@ acpi_status acpi_find_root_pointer(acpi_size *table_address)
216 216
217 /* A valid RSDP was not found */ 217 /* A valid RSDP was not found */
218 218
219 ACPI_ERROR((AE_INFO, "A valid RSDP was not found")); 219 ACPI_BIOS_ERROR((AE_INFO, "A valid RSDP was not found"));
220 return_ACPI_STATUS(AE_NOT_FOUND); 220 return_ACPI_STATUS(AE_NOT_FOUND);
221} 221}
222 222
@@ -225,7 +225,7 @@ acpi_status acpi_find_root_pointer(acpi_size *table_address)
225 * FUNCTION: acpi_tb_scan_memory_for_rsdp 225 * FUNCTION: acpi_tb_scan_memory_for_rsdp
226 * 226 *
227 * PARAMETERS: start_address - Starting pointer for search 227 * PARAMETERS: start_address - Starting pointer for search
228 * Length - Maximum length to search 228 * length - Maximum length to search
229 * 229 *
230 * RETURN: Pointer to the RSDP if found, otherwise NULL. 230 * RETURN: Pointer to the RSDP if found, otherwise NULL.
231 * 231 *
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c
index 67932aebe6dd..64880306133d 100644
--- a/drivers/acpi/acpica/utaddress.c
+++ b/drivers/acpi/acpica/utaddress.c
@@ -53,8 +53,8 @@ ACPI_MODULE_NAME("utaddress")
53 * FUNCTION: acpi_ut_add_address_range 53 * FUNCTION: acpi_ut_add_address_range
54 * 54 *
55 * PARAMETERS: space_id - Address space ID 55 * PARAMETERS: space_id - Address space ID
56 * Address - op_region start address 56 * address - op_region start address
57 * Length - op_region length 57 * length - op_region length
58 * region_node - op_region namespace node 58 * region_node - op_region namespace node
59 * 59 *
60 * RETURN: Status 60 * RETURN: Status
@@ -186,9 +186,9 @@ acpi_ut_remove_address_range(acpi_adr_space_type space_id,
186 * FUNCTION: acpi_ut_check_address_range 186 * FUNCTION: acpi_ut_check_address_range
187 * 187 *
188 * PARAMETERS: space_id - Address space ID 188 * PARAMETERS: space_id - Address space ID
189 * Address - Start address 189 * address - Start address
190 * Length - Length of address range 190 * length - Length of address range
191 * Warn - TRUE if warning on overlap desired 191 * warn - TRUE if warning on overlap desired
192 * 192 *
193 * RETURN: Count of the number of conflicts detected. Zero is always 193 * RETURN: Count of the number of conflicts detected. Zero is always
194 * returned for Space IDs other than Memory or I/O. 194 * returned for Space IDs other than Memory or I/O.
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index 9982d2ea66fb..ed29d474095e 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -189,7 +189,7 @@ acpi_status acpi_ut_delete_caches(void)
189 * 189 *
190 * FUNCTION: acpi_ut_validate_buffer 190 * FUNCTION: acpi_ut_validate_buffer
191 * 191 *
192 * PARAMETERS: Buffer - Buffer descriptor to be validated 192 * PARAMETERS: buffer - Buffer descriptor to be validated
193 * 193 *
194 * RETURN: Status 194 * RETURN: Status
195 * 195 *
@@ -227,7 +227,7 @@ acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
227 * 227 *
228 * FUNCTION: acpi_ut_initialize_buffer 228 * FUNCTION: acpi_ut_initialize_buffer
229 * 229 *
230 * PARAMETERS: Buffer - Buffer to be validated 230 * PARAMETERS: buffer - Buffer to be validated
231 * required_length - Length needed 231 * required_length - Length needed
232 * 232 *
233 * RETURN: Status 233 * RETURN: Status
@@ -308,10 +308,10 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
308 * 308 *
309 * FUNCTION: acpi_ut_allocate 309 * FUNCTION: acpi_ut_allocate
310 * 310 *
311 * PARAMETERS: Size - Size of the allocation 311 * PARAMETERS: size - Size of the allocation
312 * Component - Component type of caller 312 * component - Component type of caller
313 * Module - Source file name of caller 313 * module - Source file name of caller
314 * Line - Line number of caller 314 * line - Line number of caller
315 * 315 *
316 * RETURN: Address of the allocated memory on success, NULL on failure. 316 * RETURN: Address of the allocated memory on success, NULL on failure.
317 * 317 *
@@ -352,10 +352,10 @@ void *acpi_ut_allocate(acpi_size size,
352 * 352 *
353 * FUNCTION: acpi_ut_allocate_zeroed 353 * FUNCTION: acpi_ut_allocate_zeroed
354 * 354 *
355 * PARAMETERS: Size - Size of the allocation 355 * PARAMETERS: size - Size of the allocation
356 * Component - Component type of caller 356 * component - Component type of caller
357 * Module - Source file name of caller 357 * module - Source file name of caller
358 * Line - Line number of caller 358 * line - Line number of caller
359 * 359 *
360 * RETURN: Address of the allocated memory on success, NULL on failure. 360 * RETURN: Address of the allocated memory on success, NULL on failure.
361 * 361 *
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index 3317c0a406ee..294692ae76e9 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -317,7 +317,7 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
317 * FUNCTION: acpi_ut_copy_ipackage_to_epackage 317 * FUNCTION: acpi_ut_copy_ipackage_to_epackage
318 * 318 *
319 * PARAMETERS: internal_object - Pointer to the object we are returning 319 * PARAMETERS: internal_object - Pointer to the object we are returning
320 * Buffer - Where the object is returned 320 * buffer - Where the object is returned
321 * space_used - Where the object length is returned 321 * space_used - Where the object length is returned
322 * 322 *
323 * RETURN: Status 323 * RETURN: Status
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index a0998a886318..e810894149ae 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -145,7 +145,7 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
145 * function_name - Caller's procedure name 145 * function_name - Caller's procedure name
146 * module_name - Caller's module name 146 * module_name - Caller's module name
147 * component_id - Caller's component ID 147 * component_id - Caller's component ID
148 * Format - Printf format field 148 * format - Printf format field
149 * ... - Optional printf arguments 149 * ... - Optional printf arguments
150 * 150 *
151 * RETURN: None 151 * RETURN: None
@@ -217,7 +217,7 @@ ACPI_EXPORT_SYMBOL(acpi_debug_print)
217 * function_name - Caller's procedure name 217 * function_name - Caller's procedure name
218 * module_name - Caller's module name 218 * module_name - Caller's module name
219 * component_id - Caller's component ID 219 * component_id - Caller's component ID
220 * Format - Printf format field 220 * format - Printf format field
221 * ... - Optional printf arguments 221 * ... - Optional printf arguments
222 * 222 *
223 * RETURN: None 223 * RETURN: None
@@ -286,7 +286,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace)
286 * function_name - Caller's procedure name 286 * function_name - Caller's procedure name
287 * module_name - Caller's module name 287 * module_name - Caller's module name
288 * component_id - Caller's component ID 288 * component_id - Caller's component ID
289 * Pointer - Pointer to display 289 * pointer - Pointer to display
290 * 290 *
291 * RETURN: None 291 * RETURN: None
292 * 292 *
@@ -315,7 +315,7 @@ acpi_ut_trace_ptr(u32 line_number,
315 * function_name - Caller's procedure name 315 * function_name - Caller's procedure name
316 * module_name - Caller's module name 316 * module_name - Caller's module name
317 * component_id - Caller's component ID 317 * component_id - Caller's component ID
318 * String - Additional string to display 318 * string - Additional string to display
319 * 319 *
320 * RETURN: None 320 * RETURN: None
321 * 321 *
@@ -346,7 +346,7 @@ acpi_ut_trace_str(u32 line_number,
346 * function_name - Caller's procedure name 346 * function_name - Caller's procedure name
347 * module_name - Caller's module name 347 * module_name - Caller's module name
348 * component_id - Caller's component ID 348 * component_id - Caller's component ID
349 * Integer - Integer to display 349 * integer - Integer to display
350 * 350 *
351 * RETURN: None 351 * RETURN: None
352 * 352 *
@@ -408,7 +408,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_exit)
408 * function_name - Caller's procedure name 408 * function_name - Caller's procedure name
409 * module_name - Caller's module name 409 * module_name - Caller's module name
410 * component_id - Caller's component ID 410 * component_id - Caller's component ID
411 * Status - Exit status code 411 * status - Exit status code
412 * 412 *
413 * RETURN: None 413 * RETURN: None
414 * 414 *
@@ -449,7 +449,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
449 * function_name - Caller's procedure name 449 * function_name - Caller's procedure name
450 * module_name - Caller's module name 450 * module_name - Caller's module name
451 * component_id - Caller's component ID 451 * component_id - Caller's component ID
452 * Value - Value to be printed with exit msg 452 * value - Value to be printed with exit msg
453 * 453 *
454 * RETURN: None 454 * RETURN: None
455 * 455 *
@@ -481,7 +481,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
481 * function_name - Caller's procedure name 481 * function_name - Caller's procedure name
482 * module_name - Caller's module name 482 * module_name - Caller's module name
483 * component_id - Caller's component ID 483 * component_id - Caller's component ID
484 * Ptr - Pointer to display 484 * ptr - Pointer to display
485 * 485 *
486 * RETURN: None 486 * RETURN: None
487 * 487 *
@@ -508,10 +508,10 @@ acpi_ut_ptr_exit(u32 line_number,
508 * 508 *
509 * FUNCTION: acpi_ut_dump_buffer 509 * FUNCTION: acpi_ut_dump_buffer
510 * 510 *
511 * PARAMETERS: Buffer - Buffer to dump 511 * PARAMETERS: buffer - Buffer to dump
512 * Count - Amount to dump, in bytes 512 * count - Amount to dump, in bytes
513 * Display - BYTE, WORD, DWORD, or QWORD display 513 * display - BYTE, WORD, DWORD, or QWORD display
514 * component_iD - Caller's component ID 514 * component_ID - Caller's component ID
515 * 515 *
516 * RETURN: None 516 * RETURN: None
517 * 517 *
@@ -625,10 +625,10 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
625 * 625 *
626 * FUNCTION: acpi_ut_dump_buffer 626 * FUNCTION: acpi_ut_dump_buffer
627 * 627 *
628 * PARAMETERS: Buffer - Buffer to dump 628 * PARAMETERS: buffer - Buffer to dump
629 * Count - Amount to dump, in bytes 629 * count - Amount to dump, in bytes
630 * Display - BYTE, WORD, DWORD, or QWORD display 630 * display - BYTE, WORD, DWORD, or QWORD display
631 * component_iD - Caller's component ID 631 * component_ID - Caller's component ID
632 * 632 *
633 * RETURN: None 633 * RETURN: None
634 * 634 *
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 684849949bf3..60a158472d82 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -49,41 +49,6 @@
49#define _COMPONENT ACPI_UTILITIES 49#define _COMPONENT ACPI_UTILITIES
50ACPI_MODULE_NAME("utdecode") 50ACPI_MODULE_NAME("utdecode")
51 51
52/*******************************************************************************
53 *
54 * FUNCTION: acpi_format_exception
55 *
56 * PARAMETERS: Status - The acpi_status code to be formatted
57 *
58 * RETURN: A string containing the exception text. A valid pointer is
59 * always returned.
60 *
61 * DESCRIPTION: This function translates an ACPI exception into an ASCII string
62 * It is here instead of utxface.c so it is always present.
63 *
64 ******************************************************************************/
65const char *acpi_format_exception(acpi_status status)
66{
67 const char *exception = NULL;
68
69 ACPI_FUNCTION_ENTRY();
70
71 exception = acpi_ut_validate_exception(status);
72 if (!exception) {
73
74 /* Exception code was not recognized */
75
76 ACPI_ERROR((AE_INFO,
77 "Unknown exception code: 0x%8.8X", status));
78
79 exception = "UNKNOWN_STATUS_CODE";
80 }
81
82 return (ACPI_CAST_PTR(const char, exception));
83}
84
85ACPI_EXPORT_SYMBOL(acpi_format_exception)
86
87/* 52/*
88 * Properties of the ACPI Object Types, both internal and external. 53 * Properties of the ACPI Object Types, both internal and external.
89 * The table is indexed by values of acpi_object_type 54 * The table is indexed by values of acpi_object_type
@@ -126,8 +91,8 @@ const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES] = {
126 * 91 *
127 * FUNCTION: acpi_ut_hex_to_ascii_char 92 * FUNCTION: acpi_ut_hex_to_ascii_char
128 * 93 *
129 * PARAMETERS: Integer - Contains the hex digit 94 * PARAMETERS: integer - Contains the hex digit
130 * Position - bit position of the digit within the 95 * position - bit position of the digit within the
131 * integer (multiple of 4) 96 * integer (multiple of 4)
132 * 97 *
133 * RETURN: The converted Ascii character 98 * RETURN: The converted Ascii character
@@ -164,16 +129,17 @@ char acpi_ut_hex_to_ascii_char(u64 integer, u32 position)
164/* Region type decoding */ 129/* Region type decoding */
165 130
166const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { 131const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
167 "SystemMemory", 132 "SystemMemory", /* 0x00 */
168 "SystemIO", 133 "SystemIO", /* 0x01 */
169 "PCI_Config", 134 "PCI_Config", /* 0x02 */
170 "EmbeddedControl", 135 "EmbeddedControl", /* 0x03 */
171 "SMBus", 136 "SMBus", /* 0x04 */
172 "SystemCMOS", 137 "SystemCMOS", /* 0x05 */
173 "PCIBARTarget", 138 "PCIBARTarget", /* 0x06 */
174 "IPMI", 139 "IPMI", /* 0x07 */
175 "GeneralPurposeIo", 140 "GeneralPurposeIo", /* 0x08 */
176 "GenericSerialBus" 141 "GenericSerialBus", /* 0x09 */
142 "PCC" /* 0x0A */
177}; 143};
178 144
179char *acpi_ut_get_region_name(u8 space_id) 145char *acpi_ut_get_region_name(u8 space_id)
@@ -228,7 +194,7 @@ char *acpi_ut_get_event_name(u32 event_id)
228 * 194 *
229 * FUNCTION: acpi_ut_get_type_name 195 * FUNCTION: acpi_ut_get_type_name
230 * 196 *
231 * PARAMETERS: Type - An ACPI object type 197 * PARAMETERS: type - An ACPI object type
232 * 198 *
233 * RETURN: Decoded ACPI object type name 199 * RETURN: Decoded ACPI object type name
234 * 200 *
@@ -306,7 +272,7 @@ char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
306 * 272 *
307 * FUNCTION: acpi_ut_get_node_name 273 * FUNCTION: acpi_ut_get_node_name
308 * 274 *
309 * PARAMETERS: Object - A namespace node 275 * PARAMETERS: object - A namespace node
310 * 276 *
311 * RETURN: ASCII name of the node 277 * RETURN: ASCII name of the node
312 * 278 *
@@ -351,7 +317,7 @@ char *acpi_ut_get_node_name(void *object)
351 * 317 *
352 * FUNCTION: acpi_ut_get_descriptor_name 318 * FUNCTION: acpi_ut_get_descriptor_name
353 * 319 *
354 * PARAMETERS: Object - An ACPI object 320 * PARAMETERS: object - An ACPI object
355 * 321 *
356 * RETURN: Decoded name of the descriptor type 322 * RETURN: Decoded name of the descriptor type
357 * 323 *
@@ -401,7 +367,7 @@ char *acpi_ut_get_descriptor_name(void *object)
401 * 367 *
402 * FUNCTION: acpi_ut_get_reference_name 368 * FUNCTION: acpi_ut_get_reference_name
403 * 369 *
404 * PARAMETERS: Object - An ACPI reference object 370 * PARAMETERS: object - An ACPI reference object
405 * 371 *
406 * RETURN: Decoded name of the type of reference 372 * RETURN: Decoded name of the type of reference
407 * 373 *
@@ -532,7 +498,7 @@ const char *acpi_ut_get_notify_name(u32 notify_value)
532 * 498 *
533 * FUNCTION: acpi_ut_valid_object_type 499 * FUNCTION: acpi_ut_valid_object_type
534 * 500 *
535 * PARAMETERS: Type - Object type to be validated 501 * PARAMETERS: type - Object type to be validated
536 * 502 *
537 * RETURN: TRUE if valid object type, FALSE otherwise 503 * RETURN: TRUE if valid object type, FALSE otherwise
538 * 504 *
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index 2a6c3e183697..798105443d0f 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -60,7 +60,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action);
60 * 60 *
61 * FUNCTION: acpi_ut_delete_internal_obj 61 * FUNCTION: acpi_ut_delete_internal_obj
62 * 62 *
63 * PARAMETERS: Object - Object to be deleted 63 * PARAMETERS: object - Object to be deleted
64 * 64 *
65 * RETURN: None 65 * RETURN: None
66 * 66 *
@@ -152,7 +152,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
152 case ACPI_TYPE_PROCESSOR: 152 case ACPI_TYPE_PROCESSOR:
153 case ACPI_TYPE_THERMAL: 153 case ACPI_TYPE_THERMAL:
154 154
155 /* Walk the notify handler list for this object */ 155 /* Walk the address handler list for this object */
156 156
157 handler_desc = object->common_notify.handler; 157 handler_desc = object->common_notify.handler;
158 while (handler_desc) { 158 while (handler_desc) {
@@ -358,8 +358,8 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
358 * 358 *
359 * FUNCTION: acpi_ut_update_ref_count 359 * FUNCTION: acpi_ut_update_ref_count
360 * 360 *
361 * PARAMETERS: Object - Object whose ref count is to be updated 361 * PARAMETERS: object - Object whose ref count is to be updated
362 * Action - What to do 362 * action - What to do
363 * 363 *
364 * RETURN: New ref count 364 * RETURN: New ref count
365 * 365 *
@@ -456,9 +456,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
456 * 456 *
457 * FUNCTION: acpi_ut_update_object_reference 457 * FUNCTION: acpi_ut_update_object_reference
458 * 458 *
459 * PARAMETERS: Object - Increment ref count for this object 459 * PARAMETERS: object - Increment ref count for this object
460 * and all sub-objects 460 * and all sub-objects
461 * Action - Either REF_INCREMENT or REF_DECREMENT or 461 * action - Either REF_INCREMENT or REF_DECREMENT or
462 * REF_FORCE_DELETE 462 * REF_FORCE_DELETE
463 * 463 *
464 * RETURN: Status 464 * RETURN: Status
@@ -480,6 +480,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
480 acpi_status status = AE_OK; 480 acpi_status status = AE_OK;
481 union acpi_generic_state *state_list = NULL; 481 union acpi_generic_state *state_list = NULL;
482 union acpi_operand_object *next_object = NULL; 482 union acpi_operand_object *next_object = NULL;
483 union acpi_operand_object *prev_object;
483 union acpi_generic_state *state; 484 union acpi_generic_state *state;
484 u32 i; 485 u32 i;
485 486
@@ -505,12 +506,21 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
505 case ACPI_TYPE_POWER: 506 case ACPI_TYPE_POWER:
506 case ACPI_TYPE_THERMAL: 507 case ACPI_TYPE_THERMAL:
507 508
508 /* Update the notify objects for these types (if present) */ 509 /*
509 510 * Update the notify objects for these types (if present)
510 acpi_ut_update_ref_count(object->common_notify. 511 * Two lists, system and device notify handlers.
511 system_notify, action); 512 */
512 acpi_ut_update_ref_count(object->common_notify. 513 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) {
513 device_notify, action); 514 prev_object =
515 object->common_notify.notify_list[i];
516 while (prev_object) {
517 next_object =
518 prev_object->notify.next[i];
519 acpi_ut_update_ref_count(prev_object,
520 action);
521 prev_object = next_object;
522 }
523 }
514 break; 524 break;
515 525
516 case ACPI_TYPE_PACKAGE: 526 case ACPI_TYPE_PACKAGE:
@@ -630,7 +640,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
630 * 640 *
631 * FUNCTION: acpi_ut_add_reference 641 * FUNCTION: acpi_ut_add_reference
632 * 642 *
633 * PARAMETERS: Object - Object whose reference count is to be 643 * PARAMETERS: object - Object whose reference count is to be
634 * incremented 644 * incremented
635 * 645 *
636 * RETURN: None 646 * RETURN: None
@@ -664,7 +674,7 @@ void acpi_ut_add_reference(union acpi_operand_object *object)
664 * 674 *
665 * FUNCTION: acpi_ut_remove_reference 675 * FUNCTION: acpi_ut_remove_reference
666 * 676 *
667 * PARAMETERS: Object - Object whose ref count will be decremented 677 * PARAMETERS: object - Object whose ref count will be decremented
668 * 678 *
669 * RETURN: None 679 * RETURN: None
670 * 680 *
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 479f32b33415..a9c65fbea5f4 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("uteval")
53 * FUNCTION: acpi_ut_evaluate_object 53 * FUNCTION: acpi_ut_evaluate_object
54 * 54 *
55 * PARAMETERS: prefix_node - Starting node 55 * PARAMETERS: prefix_node - Starting node
56 * Path - Path to object from starting node 56 * path - Path to object from starting node
57 * expected_return_types - Bitmap of allowed return types 57 * expected_return_types - Bitmap of allowed return types
58 * return_desc - Where a return value is stored 58 * return_desc - Where a return value is stored
59 * 59 *
@@ -187,7 +187,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
187 * 187 *
188 * PARAMETERS: object_name - Object name to be evaluated 188 * PARAMETERS: object_name - Object name to be evaluated
189 * device_node - Node for the device 189 * device_node - Node for the device
190 * Value - Where the value is returned 190 * value - Where the value is returned
191 * 191 *
192 * RETURN: Status 192 * RETURN: Status
193 * 193 *
@@ -229,7 +229,7 @@ acpi_ut_evaluate_numeric_object(char *object_name,
229 * FUNCTION: acpi_ut_execute_STA 229 * FUNCTION: acpi_ut_execute_STA
230 * 230 *
231 * PARAMETERS: device_node - Node for the device 231 * PARAMETERS: device_node - Node for the device
232 * Flags - Where the status flags are returned 232 * flags - Where the status flags are returned
233 * 233 *
234 * RETURN: Status 234 * RETURN: Status
235 * 235 *
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c
new file mode 100644
index 000000000000..23b98945f6b7
--- /dev/null
+++ b/drivers/acpi/acpica/utexcep.c
@@ -0,0 +1,153 @@
1/*******************************************************************************
2 *
3 * Module Name: utexcep - Exception code support
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#define ACPI_DEFINE_EXCEPTION_TABLE
45#include <linux/export.h>
46#include <acpi/acpi.h>
47#include "accommon.h"
48
49#define _COMPONENT ACPI_UTILITIES
50ACPI_MODULE_NAME("utexcep")
51
52/*******************************************************************************
53 *
54 * FUNCTION: acpi_format_exception
55 *
56 * PARAMETERS: status - The acpi_status code to be formatted
57 *
58 * RETURN: A string containing the exception text. A valid pointer is
59 * always returned.
60 *
61 * DESCRIPTION: This function translates an ACPI exception into an ASCII
62 * string. Returns "unknown status" string for invalid codes.
63 *
64 ******************************************************************************/
65const char *acpi_format_exception(acpi_status status)
66{
67 const char *exception = NULL;
68
69 ACPI_FUNCTION_ENTRY();
70
71 exception = acpi_ut_validate_exception(status);
72 if (!exception) {
73
74 /* Exception code was not recognized */
75
76 ACPI_ERROR((AE_INFO,
77 "Unknown exception code: 0x%8.8X", status));
78
79 exception = "UNKNOWN_STATUS_CODE";
80 }
81
82 return (ACPI_CAST_PTR(const char, exception));
83}
84
85ACPI_EXPORT_SYMBOL(acpi_format_exception)
86
87/*******************************************************************************
88 *
89 * FUNCTION: acpi_ut_validate_exception
90 *
91 * PARAMETERS: status - The acpi_status code to be formatted
92 *
93 * RETURN: A string containing the exception text. NULL if exception is
94 * not valid.
95 *
96 * DESCRIPTION: This function validates and translates an ACPI exception into
97 * an ASCII string.
98 *
99 ******************************************************************************/
100const char *acpi_ut_validate_exception(acpi_status status)
101{
102 u32 sub_status;
103 const char *exception = NULL;
104
105 ACPI_FUNCTION_ENTRY();
106
107 /*
108 * Status is composed of two parts, a "type" and an actual code
109 */
110 sub_status = (status & ~AE_CODE_MASK);
111
112 switch (status & AE_CODE_MASK) {
113 case AE_CODE_ENVIRONMENTAL:
114
115 if (sub_status <= AE_CODE_ENV_MAX) {
116 exception = acpi_gbl_exception_names_env[sub_status];
117 }
118 break;
119
120 case AE_CODE_PROGRAMMER:
121
122 if (sub_status <= AE_CODE_PGM_MAX) {
123 exception = acpi_gbl_exception_names_pgm[sub_status];
124 }
125 break;
126
127 case AE_CODE_ACPI_TABLES:
128
129 if (sub_status <= AE_CODE_TBL_MAX) {
130 exception = acpi_gbl_exception_names_tbl[sub_status];
131 }
132 break;
133
134 case AE_CODE_AML:
135
136 if (sub_status <= AE_CODE_AML_MAX) {
137 exception = acpi_gbl_exception_names_aml[sub_status];
138 }
139 break;
140
141 case AE_CODE_CONTROL:
142
143 if (sub_status <= AE_CODE_CTRL_MAX) {
144 exception = acpi_gbl_exception_names_ctrl[sub_status];
145 }
146 break;
147
148 default:
149 break;
150 }
151
152 return (ACPI_CAST_PTR(const char, exception));
153}
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 90f53b42eca9..ed1893155f8b 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -247,8 +247,9 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
247 * 247 *
248 * RETURN: Status 248 * RETURN: Status
249 * 249 *
250 * DESCRIPTION: Init library globals. All globals that require specific 250 * DESCRIPTION: Initialize ACPICA globals. All globals that require specific
251 * initialization should be initialized here! 251 * initialization should be initialized here. This allows for
252 * a warm restart.
252 * 253 *
253 ******************************************************************************/ 254 ******************************************************************************/
254 255
@@ -284,7 +285,7 @@ acpi_status acpi_ut_init_globals(void)
284 acpi_gbl_owner_id_mask[i] = 0; 285 acpi_gbl_owner_id_mask[i] = 0;
285 } 286 }
286 287
287 /* Last owner_iD is never valid */ 288 /* Last owner_ID is never valid */
288 289
289 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; 290 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
290 291
@@ -304,8 +305,8 @@ acpi_status acpi_ut_init_globals(void)
304 305
305 /* Global handlers */ 306 /* Global handlers */
306 307
307 acpi_gbl_system_notify.handler = NULL; 308 acpi_gbl_global_notify[0].handler = NULL;
308 acpi_gbl_device_notify.handler = NULL; 309 acpi_gbl_global_notify[1].handler = NULL;
309 acpi_gbl_exception_handler = NULL; 310 acpi_gbl_exception_handler = NULL;
310 acpi_gbl_init_handler = NULL; 311 acpi_gbl_init_handler = NULL;
311 acpi_gbl_table_handler = NULL; 312 acpi_gbl_table_handler = NULL;
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index c92eb1d93785..5d84e1954575 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Module Name: utids - support for device IDs - HID, UID, CID 3 * Module Name: utids - support for device Ids - HID, UID, CID
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c
index 155fd786d0f2..b1eb7f17e110 100644
--- a/drivers/acpi/acpica/utlock.c
+++ b/drivers/acpi/acpica/utlock.c
@@ -52,7 +52,7 @@ ACPI_MODULE_NAME("utlock")
52 * FUNCTION: acpi_ut_create_rw_lock 52 * FUNCTION: acpi_ut_create_rw_lock
53 * acpi_ut_delete_rw_lock 53 * acpi_ut_delete_rw_lock
54 * 54 *
55 * PARAMETERS: Lock - Pointer to a valid RW lock 55 * PARAMETERS: lock - Pointer to a valid RW lock
56 * 56 *
57 * RETURN: Status 57 * RETURN: Status
58 * 58 *
@@ -89,7 +89,7 @@ void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock)
89 * FUNCTION: acpi_ut_acquire_read_lock 89 * FUNCTION: acpi_ut_acquire_read_lock
90 * acpi_ut_release_read_lock 90 * acpi_ut_release_read_lock
91 * 91 *
92 * PARAMETERS: Lock - Pointer to a valid RW lock 92 * PARAMETERS: lock - Pointer to a valid RW lock
93 * 93 *
94 * RETURN: Status 94 * RETURN: Status
95 * 95 *
@@ -149,7 +149,7 @@ acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)
149 * FUNCTION: acpi_ut_acquire_write_lock 149 * FUNCTION: acpi_ut_acquire_write_lock
150 * acpi_ut_release_write_lock 150 * acpi_ut_release_write_lock
151 * 151 *
152 * PARAMETERS: Lock - Pointer to a valid RW lock 152 * PARAMETERS: lock - Pointer to a valid RW lock
153 * 153 *
154 * RETURN: Status 154 * RETURN: Status
155 * 155 *
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index 2491a552b0e6..d88a8aaab2a6 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -73,8 +73,8 @@ typedef union uint64_overlay {
73 * 73 *
74 * FUNCTION: acpi_ut_short_divide 74 * FUNCTION: acpi_ut_short_divide
75 * 75 *
76 * PARAMETERS: Dividend - 64-bit dividend 76 * PARAMETERS: dividend - 64-bit dividend
77 * Divisor - 32-bit divisor 77 * divisor - 32-bit divisor
78 * out_quotient - Pointer to where the quotient is returned 78 * out_quotient - Pointer to where the quotient is returned
79 * out_remainder - Pointer to where the remainder is returned 79 * out_remainder - Pointer to where the remainder is returned
80 * 80 *
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index 86f19db74e05..33c6cf7ff467 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -50,79 +50,41 @@
50#define _COMPONENT ACPI_UTILITIES 50#define _COMPONENT ACPI_UTILITIES
51ACPI_MODULE_NAME("utmisc") 51ACPI_MODULE_NAME("utmisc")
52 52
53#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
53/******************************************************************************* 54/*******************************************************************************
54 * 55 *
55 * FUNCTION: acpi_ut_validate_exception 56 * FUNCTION: ut_convert_backslashes
56 * 57 *
57 * PARAMETERS: Status - The acpi_status code to be formatted 58 * PARAMETERS: pathname - File pathname string to be converted
58 * 59 *
59 * RETURN: A string containing the exception text. NULL if exception is 60 * RETURN: Modifies the input Pathname
60 * not valid.
61 * 61 *
62 * DESCRIPTION: This function validates and translates an ACPI exception into 62 * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within
63 * an ASCII string. 63 * the entire input file pathname string.
64 * 64 *
65 ******************************************************************************/ 65 ******************************************************************************/
66const char *acpi_ut_validate_exception(acpi_status status) 66void ut_convert_backslashes(char *pathname)
67{ 67{
68 u32 sub_status;
69 const char *exception = NULL;
70 68
71 ACPI_FUNCTION_ENTRY(); 69 if (!pathname) {
72 70 return;
73 /* 71 }
74 * Status is composed of two parts, a "type" and an actual code
75 */
76 sub_status = (status & ~AE_CODE_MASK);
77
78 switch (status & AE_CODE_MASK) {
79 case AE_CODE_ENVIRONMENTAL:
80
81 if (sub_status <= AE_CODE_ENV_MAX) {
82 exception = acpi_gbl_exception_names_env[sub_status];
83 }
84 break;
85
86 case AE_CODE_PROGRAMMER:
87
88 if (sub_status <= AE_CODE_PGM_MAX) {
89 exception = acpi_gbl_exception_names_pgm[sub_status];
90 }
91 break;
92
93 case AE_CODE_ACPI_TABLES:
94
95 if (sub_status <= AE_CODE_TBL_MAX) {
96 exception = acpi_gbl_exception_names_tbl[sub_status];
97 }
98 break;
99
100 case AE_CODE_AML:
101
102 if (sub_status <= AE_CODE_AML_MAX) {
103 exception = acpi_gbl_exception_names_aml[sub_status];
104 }
105 break;
106
107 case AE_CODE_CONTROL:
108 72
109 if (sub_status <= AE_CODE_CTRL_MAX) { 73 while (*pathname) {
110 exception = acpi_gbl_exception_names_ctrl[sub_status]; 74 if (*pathname == '\\') {
75 *pathname = '/';
111 } 76 }
112 break;
113 77
114 default: 78 pathname++;
115 break;
116 } 79 }
117
118 return (ACPI_CAST_PTR(const char, exception));
119} 80}
81#endif
120 82
121/******************************************************************************* 83/*******************************************************************************
122 * 84 *
123 * FUNCTION: acpi_ut_is_pci_root_bridge 85 * FUNCTION: acpi_ut_is_pci_root_bridge
124 * 86 *
125 * PARAMETERS: Id - The HID/CID in string format 87 * PARAMETERS: id - The HID/CID in string format
126 * 88 *
127 * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge 89 * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
128 * 90 *
@@ -150,7 +112,7 @@ u8 acpi_ut_is_pci_root_bridge(char *id)
150 * 112 *
151 * FUNCTION: acpi_ut_is_aml_table 113 * FUNCTION: acpi_ut_is_aml_table
152 * 114 *
153 * PARAMETERS: Table - An ACPI table 115 * PARAMETERS: table - An ACPI table
154 * 116 *
155 * RETURN: TRUE if table contains executable AML; FALSE otherwise 117 * RETURN: TRUE if table contains executable AML; FALSE otherwise
156 * 118 *
@@ -284,7 +246,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
284 * 246 *
285 * FUNCTION: acpi_ut_release_owner_id 247 * FUNCTION: acpi_ut_release_owner_id
286 * 248 *
287 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_iD 249 * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_ID
288 * 250 *
289 * RETURN: None. No error is returned because we are either exiting a 251 * RETURN: None. No error is returned because we are either exiting a
290 * control method or unloading a table. Either way, we would 252 * control method or unloading a table. Either way, we would
@@ -307,7 +269,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
307 269
308 *owner_id_ptr = 0; 270 *owner_id_ptr = 0;
309 271
310 /* Zero is not a valid owner_iD */ 272 /* Zero is not a valid owner_ID */
311 273
312 if (owner_id == 0) { 274 if (owner_id == 0) {
313 ACPI_ERROR((AE_INFO, "Invalid OwnerId: 0x%2.2X", owner_id)); 275 ACPI_ERROR((AE_INFO, "Invalid OwnerId: 0x%2.2X", owner_id));
@@ -381,7 +343,7 @@ void acpi_ut_strupr(char *src_string)
381 * 343 *
382 * FUNCTION: acpi_ut_print_string 344 * FUNCTION: acpi_ut_print_string
383 * 345 *
384 * PARAMETERS: String - Null terminated ASCII string 346 * PARAMETERS: string - Null terminated ASCII string
385 * max_length - Maximum output length 347 * max_length - Maximum output length
386 * 348 *
387 * RETURN: None 349 * RETURN: None
@@ -467,7 +429,7 @@ void acpi_ut_print_string(char *string, u8 max_length)
467 * 429 *
468 * FUNCTION: acpi_ut_dword_byte_swap 430 * FUNCTION: acpi_ut_dword_byte_swap
469 * 431 *
470 * PARAMETERS: Value - Value to be converted 432 * PARAMETERS: value - Value to be converted
471 * 433 *
472 * RETURN: u32 integer with bytes swapped 434 * RETURN: u32 integer with bytes swapped
473 * 435 *
@@ -537,9 +499,9 @@ void acpi_ut_set_integer_width(u8 revision)
537 * 499 *
538 * FUNCTION: acpi_ut_display_init_pathname 500 * FUNCTION: acpi_ut_display_init_pathname
539 * 501 *
540 * PARAMETERS: Type - Object type of the node 502 * PARAMETERS: type - Object type of the node
541 * obj_handle - Handle whose pathname will be displayed 503 * obj_handle - Handle whose pathname will be displayed
542 * Path - Additional path string to be appended. 504 * path - Additional path string to be appended.
543 * (NULL if no extra path) 505 * (NULL if no extra path)
544 * 506 *
545 * RETURN: acpi_status 507 * RETURN: acpi_status
@@ -604,8 +566,8 @@ acpi_ut_display_init_pathname(u8 type,
604 * 566 *
605 * FUNCTION: acpi_ut_valid_acpi_char 567 * FUNCTION: acpi_ut_valid_acpi_char
606 * 568 *
607 * PARAMETERS: Char - The character to be examined 569 * PARAMETERS: char - The character to be examined
608 * Position - Byte position (0-3) 570 * position - Byte position (0-3)
609 * 571 *
610 * RETURN: TRUE if the character is valid, FALSE otherwise 572 * RETURN: TRUE if the character is valid, FALSE otherwise
611 * 573 *
@@ -640,7 +602,7 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
640 * 602 *
641 * FUNCTION: acpi_ut_valid_acpi_name 603 * FUNCTION: acpi_ut_valid_acpi_name
642 * 604 *
643 * PARAMETERS: Name - The name to be examined 605 * PARAMETERS: name - The name to be examined
644 * 606 *
645 * RETURN: TRUE if the name is valid, FALSE otherwise 607 * RETURN: TRUE if the name is valid, FALSE otherwise
646 * 608 *
@@ -671,7 +633,7 @@ u8 acpi_ut_valid_acpi_name(u32 name)
671 * 633 *
672 * FUNCTION: acpi_ut_repair_name 634 * FUNCTION: acpi_ut_repair_name
673 * 635 *
674 * PARAMETERS: Name - The ACPI name to be repaired 636 * PARAMETERS: name - The ACPI name to be repaired
675 * 637 *
676 * RETURN: Repaired version of the name 638 * RETURN: Repaired version of the name
677 * 639 *
@@ -705,8 +667,8 @@ acpi_name acpi_ut_repair_name(char *name)
705 * 667 *
706 * FUNCTION: acpi_ut_strtoul64 668 * FUNCTION: acpi_ut_strtoul64
707 * 669 *
708 * PARAMETERS: String - Null terminated string 670 * PARAMETERS: string - Null terminated string
709 * Base - Radix of the string: 16 or ACPI_ANY_BASE; 671 * base - Radix of the string: 16 or ACPI_ANY_BASE;
710 * ACPI_ANY_BASE means 'in behalf of to_integer' 672 * ACPI_ANY_BASE means 'in behalf of to_integer'
711 * ret_integer - Where the converted integer is returned 673 * ret_integer - Where the converted integer is returned
712 * 674 *
@@ -755,7 +717,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
755 717
756 if (to_integer_op) { 718 if (to_integer_op) {
757 /* 719 /*
758 * Base equal to ACPI_ANY_BASE means 'to_integer operation case'. 720 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
759 * We need to determine if it is decimal or hexadecimal. 721 * We need to determine if it is decimal or hexadecimal.
760 */ 722 */
761 if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { 723 if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
@@ -878,8 +840,8 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
878 * 840 *
879 * FUNCTION: acpi_ut_create_update_state_and_push 841 * FUNCTION: acpi_ut_create_update_state_and_push
880 * 842 *
881 * PARAMETERS: Object - Object to be added to the new state 843 * PARAMETERS: object - Object to be added to the new state
882 * Action - Increment/Decrement 844 * action - Increment/Decrement
883 * state_list - List the state will be added to 845 * state_list - List the state will be added to
884 * 846 *
885 * RETURN: Status 847 * RETURN: Status
@@ -919,7 +881,7 @@ acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
919 * PARAMETERS: source_object - The package to walk 881 * PARAMETERS: source_object - The package to walk
920 * target_object - Target object (if package is being copied) 882 * target_object - Target object (if package is being copied)
921 * walk_callback - Called once for each package element 883 * walk_callback - Called once for each package element
922 * Context - Passed to the callback function 884 * context - Passed to the callback function
923 * 885 *
924 * RETURN: Status 886 * RETURN: Status
925 * 887 *
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 43174df33121..296baa676bc5 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -147,7 +147,7 @@ void acpi_ut_mutex_terminate(void)
147 * 147 *
148 * FUNCTION: acpi_ut_create_mutex 148 * FUNCTION: acpi_ut_create_mutex
149 * 149 *
150 * PARAMETERS: mutex_iD - ID of the mutex to be created 150 * PARAMETERS: mutex_ID - ID of the mutex to be created
151 * 151 *
152 * RETURN: Status 152 * RETURN: Status
153 * 153 *
@@ -176,7 +176,7 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
176 * 176 *
177 * FUNCTION: acpi_ut_delete_mutex 177 * FUNCTION: acpi_ut_delete_mutex
178 * 178 *
179 * PARAMETERS: mutex_iD - ID of the mutex to be deleted 179 * PARAMETERS: mutex_ID - ID of the mutex to be deleted
180 * 180 *
181 * RETURN: Status 181 * RETURN: Status
182 * 182 *
@@ -199,7 +199,7 @@ static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
199 * 199 *
200 * FUNCTION: acpi_ut_acquire_mutex 200 * FUNCTION: acpi_ut_acquire_mutex
201 * 201 *
202 * PARAMETERS: mutex_iD - ID of the mutex to be acquired 202 * PARAMETERS: mutex_ID - ID of the mutex to be acquired
203 * 203 *
204 * RETURN: Status 204 * RETURN: Status
205 * 205 *
@@ -283,7 +283,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
283 * 283 *
284 * FUNCTION: acpi_ut_release_mutex 284 * FUNCTION: acpi_ut_release_mutex
285 * 285 *
286 * PARAMETERS: mutex_iD - ID of the mutex to be released 286 * PARAMETERS: mutex_ID - ID of the mutex to be released
287 * 287 *
288 * RETURN: Status 288 * RETURN: Status
289 * 289 *
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index b112744fc9ae..655f0799a391 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -69,7 +69,7 @@ acpi_ut_get_element_length(u8 object_type,
69 * PARAMETERS: module_name - Source file name of caller 69 * PARAMETERS: module_name - Source file name of caller
70 * line_number - Line number of caller 70 * line_number - Line number of caller
71 * component_id - Component type of caller 71 * component_id - Component type of caller
72 * Type - ACPI Type of the new object 72 * type - ACPI Type of the new object
73 * 73 *
74 * RETURN: A new internal object, null on failure 74 * RETURN: A new internal object, null on failure
75 * 75 *
@@ -150,7 +150,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
150 * 150 *
151 * FUNCTION: acpi_ut_create_package_object 151 * FUNCTION: acpi_ut_create_package_object
152 * 152 *
153 * PARAMETERS: Count - Number of package elements 153 * PARAMETERS: count - Number of package elements
154 * 154 *
155 * RETURN: Pointer to a new Package object, null on failure 155 * RETURN: Pointer to a new Package object, null on failure
156 * 156 *
@@ -323,11 +323,11 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
323 * 323 *
324 * FUNCTION: acpi_ut_valid_internal_object 324 * FUNCTION: acpi_ut_valid_internal_object
325 * 325 *
326 * PARAMETERS: Object - Object to be validated 326 * PARAMETERS: object - Object to be validated
327 * 327 *
328 * RETURN: TRUE if object is valid, FALSE otherwise 328 * RETURN: TRUE if object is valid, FALSE otherwise
329 * 329 *
330 * DESCRIPTION: Validate a pointer to be a union acpi_operand_object 330 * DESCRIPTION: Validate a pointer to be of type union acpi_operand_object
331 * 331 *
332 ******************************************************************************/ 332 ******************************************************************************/
333 333
@@ -348,7 +348,7 @@ u8 acpi_ut_valid_internal_object(void *object)
348 switch (ACPI_GET_DESCRIPTOR_TYPE(object)) { 348 switch (ACPI_GET_DESCRIPTOR_TYPE(object)) {
349 case ACPI_DESC_TYPE_OPERAND: 349 case ACPI_DESC_TYPE_OPERAND:
350 350
351 /* The object appears to be a valid union acpi_operand_object */ 351 /* The object appears to be a valid union acpi_operand_object */
352 352
353 return (TRUE); 353 return (TRUE);
354 354
@@ -407,7 +407,7 @@ void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
407 * 407 *
408 * FUNCTION: acpi_ut_delete_object_desc 408 * FUNCTION: acpi_ut_delete_object_desc
409 * 409 *
410 * PARAMETERS: Object - An Acpi internal object to be deleted 410 * PARAMETERS: object - An Acpi internal object to be deleted
411 * 411 *
412 * RETURN: None. 412 * RETURN: None.
413 * 413 *
@@ -419,7 +419,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
419{ 419{
420 ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); 420 ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
421 421
422 /* Object must be a union acpi_operand_object */ 422 /* Object must be a union acpi_operand_object */
423 423
424 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { 424 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
425 ACPI_ERROR((AE_INFO, 425 ACPI_ERROR((AE_INFO,
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index 2360cf70c18c..34ef0bd7e4b4 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -68,7 +68,7 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = {
68 {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ 68 {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */
69 {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ 69 {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */
70 {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ 70 {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */
71 {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ 71 {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows vista - Added 03/2006 */
72 {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ 72 {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */
73 {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ 73 {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */
74 {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ 74 {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 9d441ea70305..e38bef4980bc 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -356,13 +356,13 @@ static const u8 acpi_gbl_resource_types[] = {
356 ACPI_SMALL_VARIABLE_LENGTH, /* 06 start_dependent_functions */ 356 ACPI_SMALL_VARIABLE_LENGTH, /* 06 start_dependent_functions */
357 ACPI_FIXED_LENGTH, /* 07 end_dependent_functions */ 357 ACPI_FIXED_LENGTH, /* 07 end_dependent_functions */
358 ACPI_FIXED_LENGTH, /* 08 IO */ 358 ACPI_FIXED_LENGTH, /* 08 IO */
359 ACPI_FIXED_LENGTH, /* 09 fixed_iO */ 359 ACPI_FIXED_LENGTH, /* 09 fixed_IO */
360 ACPI_FIXED_LENGTH, /* 0_a fixed_dMA */ 360 ACPI_FIXED_LENGTH, /* 0A fixed_DMA */
361 0, 361 0,
362 0, 362 0,
363 0, 363 0,
364 ACPI_VARIABLE_LENGTH, /* 0_e vendor_short */ 364 ACPI_VARIABLE_LENGTH, /* 0E vendor_short */
365 ACPI_FIXED_LENGTH, /* 0_f end_tag */ 365 ACPI_FIXED_LENGTH, /* 0F end_tag */
366 366
367 /* Large descriptors */ 367 /* Large descriptors */
368 368
@@ -375,16 +375,16 @@ static const u8 acpi_gbl_resource_types[] = {
375 ACPI_FIXED_LENGTH, /* 06 memory32_fixed */ 375 ACPI_FIXED_LENGTH, /* 06 memory32_fixed */
376 ACPI_VARIABLE_LENGTH, /* 07 Dword* address */ 376 ACPI_VARIABLE_LENGTH, /* 07 Dword* address */
377 ACPI_VARIABLE_LENGTH, /* 08 Word* address */ 377 ACPI_VARIABLE_LENGTH, /* 08 Word* address */
378 ACPI_VARIABLE_LENGTH, /* 09 extended_iRQ */ 378 ACPI_VARIABLE_LENGTH, /* 09 extended_IRQ */
379 ACPI_VARIABLE_LENGTH, /* 0_a Qword* address */ 379 ACPI_VARIABLE_LENGTH, /* 0A Qword* address */
380 ACPI_FIXED_LENGTH, /* 0_b Extended* address */ 380 ACPI_FIXED_LENGTH, /* 0B Extended* address */
381 ACPI_VARIABLE_LENGTH, /* 0_c Gpio* */ 381 ACPI_VARIABLE_LENGTH, /* 0C Gpio* */
382 0, 382 0,
383 ACPI_VARIABLE_LENGTH /* 0_e *serial_bus */ 383 ACPI_VARIABLE_LENGTH /* 0E *serial_bus */
384}; 384};
385 385
386/* 386/*
387 * For the i_aSL compiler/disassembler, we don't want any error messages 387 * For the iASL compiler/disassembler, we don't want any error messages
388 * because the disassembler uses the resource validation code to determine 388 * because the disassembler uses the resource validation code to determine
389 * if Buffer objects are actually Resource Templates. 389 * if Buffer objects are actually Resource Templates.
390 */ 390 */
@@ -398,11 +398,11 @@ static const u8 acpi_gbl_resource_types[] = {
398 * 398 *
399 * FUNCTION: acpi_ut_walk_aml_resources 399 * FUNCTION: acpi_ut_walk_aml_resources
400 * 400 *
401 * PARAMETERS: Aml - Pointer to the raw AML resource template 401 * PARAMETERS: aml - Pointer to the raw AML resource template
402 * aml_length - Length of the entire template 402 * aml_length - Length of the entire template
403 * user_function - Called once for each descriptor found. If 403 * user_function - Called once for each descriptor found. If
404 * NULL, a pointer to the end_tag is returned 404 * NULL, a pointer to the end_tag is returned
405 * Context - Passed to user_function 405 * context - Passed to user_function
406 * 406 *
407 * RETURN: Status 407 * RETURN: Status
408 * 408 *
@@ -513,7 +513,7 @@ acpi_ut_walk_aml_resources(u8 * aml,
513 * 513 *
514 * FUNCTION: acpi_ut_validate_resource 514 * FUNCTION: acpi_ut_validate_resource
515 * 515 *
516 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 516 * PARAMETERS: aml - Pointer to the raw AML resource descriptor
517 * return_index - Where the resource index is returned. NULL 517 * return_index - Where the resource index is returned. NULL
518 * if the index is not required. 518 * if the index is not required.
519 * 519 *
@@ -664,7 +664,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
664 * 664 *
665 * FUNCTION: acpi_ut_get_resource_type 665 * FUNCTION: acpi_ut_get_resource_type
666 * 666 *
667 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 667 * PARAMETERS: aml - Pointer to the raw AML resource descriptor
668 * 668 *
669 * RETURN: The Resource Type with no extraneous bits (except the 669 * RETURN: The Resource Type with no extraneous bits (except the
670 * Large/Small descriptor bit -- this is left alone) 670 * Large/Small descriptor bit -- this is left alone)
@@ -698,7 +698,7 @@ u8 acpi_ut_get_resource_type(void *aml)
698 * 698 *
699 * FUNCTION: acpi_ut_get_resource_length 699 * FUNCTION: acpi_ut_get_resource_length
700 * 700 *
701 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 701 * PARAMETERS: aml - Pointer to the raw AML resource descriptor
702 * 702 *
703 * RETURN: Byte Length 703 * RETURN: Byte Length
704 * 704 *
@@ -738,7 +738,7 @@ u16 acpi_ut_get_resource_length(void *aml)
738 * 738 *
739 * FUNCTION: acpi_ut_get_resource_header_length 739 * FUNCTION: acpi_ut_get_resource_header_length
740 * 740 *
741 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 741 * PARAMETERS: aml - Pointer to the raw AML resource descriptor
742 * 742 *
743 * RETURN: Length of the AML header (depends on large/small descriptor) 743 * RETURN: Length of the AML header (depends on large/small descriptor)
744 * 744 *
@@ -763,7 +763,7 @@ u8 acpi_ut_get_resource_header_length(void *aml)
763 * 763 *
764 * FUNCTION: acpi_ut_get_descriptor_length 764 * FUNCTION: acpi_ut_get_descriptor_length
765 * 765 *
766 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 766 * PARAMETERS: aml - Pointer to the raw AML resource descriptor
767 * 767 *
768 * RETURN: Byte length 768 * RETURN: Byte length
769 * 769 *
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index 4267477c2797..a1c988260073 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -51,8 +51,8 @@ ACPI_MODULE_NAME("utstate")
51 * 51 *
52 * FUNCTION: acpi_ut_create_pkg_state_and_push 52 * FUNCTION: acpi_ut_create_pkg_state_and_push
53 * 53 *
54 * PARAMETERS: Object - Object to be added to the new state 54 * PARAMETERS: object - Object to be added to the new state
55 * Action - Increment/Decrement 55 * action - Increment/Decrement
56 * state_list - List the state will be added to 56 * state_list - List the state will be added to
57 * 57 *
58 * RETURN: Status 58 * RETURN: Status
@@ -85,7 +85,7 @@ acpi_ut_create_pkg_state_and_push(void *internal_object,
85 * FUNCTION: acpi_ut_push_generic_state 85 * FUNCTION: acpi_ut_push_generic_state
86 * 86 *
87 * PARAMETERS: list_head - Head of the state stack 87 * PARAMETERS: list_head - Head of the state stack
88 * State - State object to push 88 * state - State object to push
89 * 89 *
90 * RETURN: None 90 * RETURN: None
91 * 91 *
@@ -214,8 +214,8 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
214 * 214 *
215 * FUNCTION: acpi_ut_create_update_state 215 * FUNCTION: acpi_ut_create_update_state
216 * 216 *
217 * PARAMETERS: Object - Initial Object to be installed in the state 217 * PARAMETERS: object - Initial Object to be installed in the state
218 * Action - Update action to be performed 218 * action - Update action to be performed
219 * 219 *
220 * RETURN: New state object, null on failure 220 * RETURN: New state object, null on failure
221 * 221 *
@@ -252,8 +252,8 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
252 * 252 *
253 * FUNCTION: acpi_ut_create_pkg_state 253 * FUNCTION: acpi_ut_create_pkg_state
254 * 254 *
255 * PARAMETERS: Object - Initial Object to be installed in the state 255 * PARAMETERS: object - Initial Object to be installed in the state
256 * Action - Update action to be performed 256 * action - Update action to be performed
257 * 257 *
258 * RETURN: New state object, null on failure 258 * RETURN: New state object, null on failure
259 * 259 *
@@ -325,7 +325,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
325 * 325 *
326 * FUNCTION: acpi_ut_delete_generic_state 326 * FUNCTION: acpi_ut_delete_generic_state
327 * 327 *
328 * PARAMETERS: State - The state object to be deleted 328 * PARAMETERS: state - The state object to be deleted
329 * 329 *
330 * RETURN: None 330 * RETURN: None
331 * 331 *
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index afa94f51ff0b..534179f1177b 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -131,7 +131,7 @@ acpi_status __init acpi_initialize_subsystem(void)
131 * 131 *
132 * FUNCTION: acpi_enable_subsystem 132 * FUNCTION: acpi_enable_subsystem
133 * 133 *
134 * PARAMETERS: Flags - Init/enable Options 134 * PARAMETERS: flags - Init/enable Options
135 * 135 *
136 * RETURN: Status 136 * RETURN: Status
137 * 137 *
@@ -234,7 +234,7 @@ ACPI_EXPORT_SYMBOL(acpi_enable_subsystem)
234 * 234 *
235 * FUNCTION: acpi_initialize_objects 235 * FUNCTION: acpi_initialize_objects
236 * 236 *
237 * PARAMETERS: Flags - Init/enable Options 237 * PARAMETERS: flags - Init/enable Options
238 * 238 *
239 * RETURN: Status 239 * RETURN: Status
240 * 240 *
@@ -409,7 +409,7 @@ ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
409 * PARAMETERS: out_buffer - A buffer to receive the resources for the 409 * PARAMETERS: out_buffer - A buffer to receive the resources for the
410 * device 410 * device
411 * 411 *
412 * RETURN: Status - the status of the call 412 * RETURN: status - the status of the call
413 * 413 *
414 * DESCRIPTION: This function is called to get information about the current 414 * DESCRIPTION: This function is called to get information about the current
415 * state of the ACPI subsystem. It will return system information 415 * state of the ACPI subsystem. It will return system information
@@ -480,8 +480,8 @@ ACPI_EXPORT_SYMBOL(acpi_get_system_info)
480 * 480 *
481 * FUNCTION: acpi_install_initialization_handler 481 * FUNCTION: acpi_install_initialization_handler
482 * 482 *
483 * PARAMETERS: Handler - Callback procedure 483 * PARAMETERS: handler - Callback procedure
484 * Function - Not (currently) used, see below 484 * function - Not (currently) used, see below
485 * 485 *
486 * RETURN: Status 486 * RETURN: Status
487 * 487 *
@@ -618,7 +618,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_interface)
618 * 618 *
619 * FUNCTION: acpi_install_interface_handler 619 * FUNCTION: acpi_install_interface_handler
620 * 620 *
621 * PARAMETERS: Handler - The _OSI interface handler to install 621 * PARAMETERS: handler - The _OSI interface handler to install
622 * NULL means "remove existing handler" 622 * NULL means "remove existing handler"
623 * 623 *
624 * RETURN: Status 624 * RETURN: Status
@@ -651,9 +651,9 @@ ACPI_EXPORT_SYMBOL(acpi_install_interface_handler)
651 * FUNCTION: acpi_check_address_range 651 * FUNCTION: acpi_check_address_range
652 * 652 *
653 * PARAMETERS: space_id - Address space ID 653 * PARAMETERS: space_id - Address space ID
654 * Address - Start address 654 * address - Start address
655 * Length - Length 655 * length - Length
656 * Warn - TRUE if warning on overlap desired 656 * warn - TRUE if warning on overlap desired
657 * 657 *
658 * RETURN: Count of the number of conflicts detected. 658 * RETURN: Count of the number of conflicts detected.
659 * 659 *
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 52b568af1819..6d63cc39b9ae 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("utxferror")
53 * This module is used for the in-kernel ACPICA as well as the ACPICA 53 * This module is used for the in-kernel ACPICA as well as the ACPICA
54 * tools/applications. 54 * tools/applications.
55 * 55 *
56 * For the i_aSL compiler case, the output is redirected to stderr so that 56 * For the iASL compiler case, the output is redirected to stderr so that
57 * any of the various ACPI errors and warnings do not appear in the output 57 * any of the various ACPI errors and warnings do not appear in the output
58 * files, for either the compiler or disassembler portions of the tool. 58 * files, for either the compiler or disassembler portions of the tool.
59 */ 59 */
@@ -70,7 +70,7 @@ extern FILE *acpi_gbl_output_file;
70 70
71#else 71#else
72/* 72/*
73 * non-i_aSL case - no redirection, nothing to do 73 * non-iASL case - no redirection, nothing to do
74 */ 74 */
75#define ACPI_MSG_REDIRECT_BEGIN 75#define ACPI_MSG_REDIRECT_BEGIN
76#define ACPI_MSG_REDIRECT_END 76#define ACPI_MSG_REDIRECT_END
@@ -82,6 +82,8 @@ extern FILE *acpi_gbl_output_file;
82#define ACPI_MSG_EXCEPTION "ACPI Exception: " 82#define ACPI_MSG_EXCEPTION "ACPI Exception: "
83#define ACPI_MSG_WARNING "ACPI Warning: " 83#define ACPI_MSG_WARNING "ACPI Warning: "
84#define ACPI_MSG_INFO "ACPI: " 84#define ACPI_MSG_INFO "ACPI: "
85#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Bug: Error: "
86#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Bug: Warning: "
85/* 87/*
86 * Common message suffix 88 * Common message suffix
87 */ 89 */
@@ -93,7 +95,7 @@ extern FILE *acpi_gbl_output_file;
93 * 95 *
94 * PARAMETERS: module_name - Caller's module name (for error output) 96 * PARAMETERS: module_name - Caller's module name (for error output)
95 * line_number - Caller's line number (for error output) 97 * line_number - Caller's line number (for error output)
96 * Format - Printf format string + additional args 98 * format - Printf format string + additional args
97 * 99 *
98 * RETURN: None 100 * RETURN: None
99 * 101 *
@@ -124,8 +126,8 @@ ACPI_EXPORT_SYMBOL(acpi_error)
124 * 126 *
125 * PARAMETERS: module_name - Caller's module name (for error output) 127 * PARAMETERS: module_name - Caller's module name (for error output)
126 * line_number - Caller's line number (for error output) 128 * line_number - Caller's line number (for error output)
127 * Status - Status to be formatted 129 * status - Status to be formatted
128 * Format - Printf format string + additional args 130 * format - Printf format string + additional args
129 * 131 *
130 * RETURN: None 132 * RETURN: None
131 * 133 *
@@ -159,7 +161,7 @@ ACPI_EXPORT_SYMBOL(acpi_exception)
159 * 161 *
160 * PARAMETERS: module_name - Caller's module name (for error output) 162 * PARAMETERS: module_name - Caller's module name (for error output)
161 * line_number - Caller's line number (for error output) 163 * line_number - Caller's line number (for error output)
162 * Format - Printf format string + additional args 164 * format - Printf format string + additional args
163 * 165 *
164 * RETURN: None 166 * RETURN: None
165 * 167 *
@@ -190,7 +192,7 @@ ACPI_EXPORT_SYMBOL(acpi_warning)
190 * 192 *
191 * PARAMETERS: module_name - Caller's module name (for error output) 193 * PARAMETERS: module_name - Caller's module name (for error output)
192 * line_number - Caller's line number (for error output) 194 * line_number - Caller's line number (for error output)
193 * Format - Printf format string + additional args 195 * format - Printf format string + additional args
194 * 196 *
195 * RETURN: None 197 * RETURN: None
196 * 198 *
@@ -218,6 +220,72 @@ acpi_info(const char *module_name, u32 line_number, const char *format, ...)
218 220
219ACPI_EXPORT_SYMBOL(acpi_info) 221ACPI_EXPORT_SYMBOL(acpi_info)
220 222
223/*******************************************************************************
224 *
225 * FUNCTION: acpi_bios_error
226 *
227 * PARAMETERS: module_name - Caller's module name (for error output)
228 * line_number - Caller's line number (for error output)
229 * format - Printf format string + additional args
230 *
231 * RETURN: None
232 *
233 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
234 * info
235 *
236 ******************************************************************************/
237void ACPI_INTERNAL_VAR_XFACE
238acpi_bios_error(const char *module_name,
239 u32 line_number, const char *format, ...)
240{
241 va_list arg_list;
242
243 ACPI_MSG_REDIRECT_BEGIN;
244 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
245
246 va_start(arg_list, format);
247 acpi_os_vprintf(format, arg_list);
248 ACPI_MSG_SUFFIX;
249 va_end(arg_list);
250
251 ACPI_MSG_REDIRECT_END;
252}
253
254ACPI_EXPORT_SYMBOL(acpi_bios_error)
255
256/*******************************************************************************
257 *
258 * FUNCTION: acpi_bios_warning
259 *
260 * PARAMETERS: module_name - Caller's module name (for error output)
261 * line_number - Caller's line number (for error output)
262 * format - Printf format string + additional args
263 *
264 * RETURN: None
265 *
266 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
267 * info
268 *
269 ******************************************************************************/
270void ACPI_INTERNAL_VAR_XFACE
271acpi_bios_warning(const char *module_name,
272 u32 line_number, const char *format, ...)
273{
274 va_list arg_list;
275
276 ACPI_MSG_REDIRECT_BEGIN;
277 acpi_os_printf(ACPI_MSG_BIOS_WARNING);
278
279 va_start(arg_list, format);
280 acpi_os_vprintf(format, arg_list);
281 ACPI_MSG_SUFFIX;
282 va_end(arg_list);
283
284 ACPI_MSG_REDIRECT_END;
285}
286
287ACPI_EXPORT_SYMBOL(acpi_bios_warning)
288
221/* 289/*
222 * The remainder of this module contains internal error functions that may 290 * The remainder of this module contains internal error functions that may
223 * be configured out. 291 * be configured out.
@@ -271,9 +339,9 @@ acpi_ut_predefined_warning(const char *module_name,
271 * 339 *
272 * PARAMETERS: module_name - Caller's module name (for error output) 340 * PARAMETERS: module_name - Caller's module name (for error output)
273 * line_number - Caller's line number (for error output) 341 * line_number - Caller's line number (for error output)
274 * Pathname - Full pathname to the node 342 * pathname - Full pathname to the node
275 * node_flags - From Namespace node for the method/object 343 * node_flags - From Namespace node for the method/object
276 * Format - Printf format string + additional args 344 * format - Printf format string + additional args
277 * 345 *
278 * RETURN: None 346 * RETURN: None
279 * 347 *
@@ -373,9 +441,9 @@ acpi_ut_namespace_error(const char *module_name,
373 * 441 *
374 * PARAMETERS: module_name - Caller's module name (for error output) 442 * PARAMETERS: module_name - Caller's module name (for error output)
375 * line_number - Caller's line number (for error output) 443 * line_number - Caller's line number (for error output)
376 * Message - Error message to use on failure 444 * message - Error message to use on failure
377 * prefix_node - Prefix relative to the path 445 * prefix_node - Prefix relative to the path
378 * Path - Path to the node (optional) 446 * path - Path to the node (optional)
379 * method_status - Execution status 447 * method_status - Execution status
380 * 448 *
381 * RETURN: None 449 * RETURN: None
diff --git a/drivers/acpi/acpica/utxfmutex.c b/drivers/acpi/acpica/utxfmutex.c
index 1427d191d15a..0a40a851b354 100644
--- a/drivers/acpi/acpica/utxfmutex.c
+++ b/drivers/acpi/acpica/utxfmutex.c
@@ -58,8 +58,8 @@ acpi_ut_get_mutex_object(acpi_handle handle,
58 * 58 *
59 * FUNCTION: acpi_ut_get_mutex_object 59 * FUNCTION: acpi_ut_get_mutex_object
60 * 60 *
61 * PARAMETERS: Handle - Mutex or prefix handle (optional) 61 * PARAMETERS: handle - Mutex or prefix handle (optional)
62 * Pathname - Mutex pathname (optional) 62 * pathname - Mutex pathname (optional)
63 * ret_obj - Where the mutex object is returned 63 * ret_obj - Where the mutex object is returned
64 * 64 *
65 * RETURN: Status 65 * RETURN: Status
@@ -118,9 +118,9 @@ acpi_ut_get_mutex_object(acpi_handle handle,
118 * 118 *
119 * FUNCTION: acpi_acquire_mutex 119 * FUNCTION: acpi_acquire_mutex
120 * 120 *
121 * PARAMETERS: Handle - Mutex or prefix handle (optional) 121 * PARAMETERS: handle - Mutex or prefix handle (optional)
122 * Pathname - Mutex pathname (optional) 122 * pathname - Mutex pathname (optional)
123 * Timeout - Max time to wait for the lock (millisec) 123 * timeout - Max time to wait for the lock (millisec)
124 * 124 *
125 * RETURN: Status 125 * RETURN: Status
126 * 126 *
@@ -155,8 +155,8 @@ acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout)
155 * 155 *
156 * FUNCTION: acpi_release_mutex 156 * FUNCTION: acpi_release_mutex
157 * 157 *
158 * PARAMETERS: Handle - Mutex or prefix handle (optional) 158 * PARAMETERS: handle - Mutex or prefix handle (optional)
159 * Pathname - Mutex pathname (optional) 159 * pathname - Mutex pathname (optional)
160 * 160 *
161 * RETURN: Status 161 * RETURN: Status
162 * 162 *
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 6686b1eaf13e..00a783661d0b 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -586,6 +586,11 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
586 } 586 }
587 *access_bit_width = 1UL << (access_size_code + 2); 587 *access_bit_width = 1UL << (access_size_code + 2);
588 588
589 /* Fixup common BIOS bug */
590 if (bit_width == 32 && bit_offset == 0 && (*paddr & 0x03) == 0 &&
591 *access_bit_width < 32)
592 *access_bit_width = 32;
593
589 if ((bit_width + bit_offset) > *access_bit_width) { 594 if ((bit_width + bit_offset) > *access_bit_width) {
590 pr_warning(FW_BUG APEI_PFX 595 pr_warning(FW_BUG APEI_PFX
591 "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n", 596 "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n",
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 023f9c8534d0..ff2c876ec412 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -250,6 +250,13 @@ static int acpi_battery_get_property(struct power_supply *psy,
250 else 250 else
251 val->intval = battery->capacity_now * 1000; 251 val->intval = battery->capacity_now * 1000;
252 break; 252 break;
253 case POWER_SUPPLY_PROP_CAPACITY:
254 if (battery->capacity_now && battery->full_charge_capacity)
255 val->intval = battery->capacity_now * 100/
256 battery->full_charge_capacity;
257 else
258 val->intval = 0;
259 break;
253 case POWER_SUPPLY_PROP_MODEL_NAME: 260 case POWER_SUPPLY_PROP_MODEL_NAME:
254 val->strval = battery->model_number; 261 val->strval = battery->model_number;
255 break; 262 break;
@@ -276,6 +283,7 @@ static enum power_supply_property charge_battery_props[] = {
276 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 283 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
277 POWER_SUPPLY_PROP_CHARGE_FULL, 284 POWER_SUPPLY_PROP_CHARGE_FULL,
278 POWER_SUPPLY_PROP_CHARGE_NOW, 285 POWER_SUPPLY_PROP_CHARGE_NOW,
286 POWER_SUPPLY_PROP_CAPACITY,
279 POWER_SUPPLY_PROP_MODEL_NAME, 287 POWER_SUPPLY_PROP_MODEL_NAME,
280 POWER_SUPPLY_PROP_MANUFACTURER, 288 POWER_SUPPLY_PROP_MANUFACTURER,
281 POWER_SUPPLY_PROP_SERIAL_NUMBER, 289 POWER_SUPPLY_PROP_SERIAL_NUMBER,
@@ -292,6 +300,7 @@ static enum power_supply_property energy_battery_props[] = {
292 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 300 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
293 POWER_SUPPLY_PROP_ENERGY_FULL, 301 POWER_SUPPLY_PROP_ENERGY_FULL,
294 POWER_SUPPLY_PROP_ENERGY_NOW, 302 POWER_SUPPLY_PROP_ENERGY_NOW,
303 POWER_SUPPLY_PROP_CAPACITY,
295 POWER_SUPPLY_PROP_MODEL_NAME, 304 POWER_SUPPLY_PROP_MODEL_NAME,
296 POWER_SUPPLY_PROP_MANUFACTURER, 305 POWER_SUPPLY_PROP_MANUFACTURER,
297 POWER_SUPPLY_PROP_SERIAL_NUMBER, 306 POWER_SUPPLY_PROP_SERIAL_NUMBER,
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index adceafda9c17..9628652e080c 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -574,6 +574,10 @@ static void acpi_bus_osc_support(void)
574 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; 574 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT;
575#endif 575#endif
576 576
577#ifdef ACPI_HOTPLUG_OST
578 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_HOTPLUG_OST_SUPPORT;
579#endif
580
577 if (!ghes_disable) 581 if (!ghes_disable)
578 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_APEI_SUPPORT; 582 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_APEI_SUPPORT;
579 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) 583 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 45cd03b4630e..1f9f7d7d7bc5 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -158,9 +158,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
158 int result; 158 int result;
159 int present; 159 int present;
160 acpi_status status; 160 acpi_status status;
161 161 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
162
163 present = is_device_present(handle);
164 162
165 switch (type) { 163 switch (type) {
166 case ACPI_NOTIFY_BUS_CHECK: 164 case ACPI_NOTIFY_BUS_CHECK:
@@ -169,32 +167,47 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
169 printk(KERN_WARNING "Container driver received %s event\n", 167 printk(KERN_WARNING "Container driver received %s event\n",
170 (type == ACPI_NOTIFY_BUS_CHECK) ? 168 (type == ACPI_NOTIFY_BUS_CHECK) ?
171 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); 169 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
170
171 present = is_device_present(handle);
172 status = acpi_bus_get_device(handle, &device); 172 status = acpi_bus_get_device(handle, &device);
173 if (present) { 173 if (!present) {
174 if (ACPI_FAILURE(status) || !device) {
175 result = container_device_add(&device, handle);
176 if (!result)
177 kobject_uevent(&device->dev.kobj,
178 KOBJ_ONLINE);
179 else
180 printk(KERN_WARNING
181 "Failed to add container\n");
182 }
183 } else {
184 if (ACPI_SUCCESS(status)) { 174 if (ACPI_SUCCESS(status)) {
185 /* device exist and this is a remove request */ 175 /* device exist and this is a remove request */
176 device->flags.eject_pending = 1;
186 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 177 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
178 return;
187 } 179 }
180 break;
181 }
182
183 if (!ACPI_FAILURE(status) || device)
184 break;
185
186 result = container_device_add(&device, handle);
187 if (result) {
188 printk(KERN_WARNING "Failed to add container\n");
189 break;
188 } 190 }
191
192 kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
193 ost_code = ACPI_OST_SC_SUCCESS;
189 break; 194 break;
195
190 case ACPI_NOTIFY_EJECT_REQUEST: 196 case ACPI_NOTIFY_EJECT_REQUEST:
191 if (!acpi_bus_get_device(handle, &device) && device) { 197 if (!acpi_bus_get_device(handle, &device) && device) {
198 device->flags.eject_pending = 1;
192 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 199 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
200 return;
193 } 201 }
194 break; 202 break;
203
195 default: 204 default:
196 break; 205 /* non-hotplug event; possibly handled by other handler */
206 return;
197 } 207 }
208
209 /* Inform firmware that the hotplug operation has completed */
210 (void) acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL);
198 return; 211 return;
199} 212}
200 213
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index c3881b2eb8b2..9eaf708f5885 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -891,7 +891,7 @@ static void acpi_os_execute_deferred(struct work_struct *work)
891 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); 891 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
892 892
893 if (dpc->wait) 893 if (dpc->wait)
894 acpi_os_wait_events_complete(NULL); 894 acpi_os_wait_events_complete();
895 895
896 dpc->function(dpc->context); 896 dpc->function(dpc->context);
897 kfree(dpc); 897 kfree(dpc);
@@ -987,7 +987,7 @@ acpi_status acpi_os_hotplug_execute(acpi_osd_exec_callback function,
987 return __acpi_os_execute(0, function, context, 1); 987 return __acpi_os_execute(0, function, context, 1);
988} 988}
989 989
990void acpi_os_wait_events_complete(void *context) 990void acpi_os_wait_events_complete(void)
991{ 991{
992 flush_workqueue(kacpid_wq); 992 flush_workqueue(kacpid_wq);
993 flush_workqueue(kacpi_notify_wq); 993 flush_workqueue(kacpi_notify_wq);
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 7048b97853e0..ff8e04f2fab4 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -696,9 +696,9 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
696{ 696{
697 struct acpi_processor *pr; 697 struct acpi_processor *pr;
698 struct acpi_device *device = NULL; 698 struct acpi_device *device = NULL;
699 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
699 int result; 700 int result;
700 701
701
702 switch (event) { 702 switch (event) {
703 case ACPI_NOTIFY_BUS_CHECK: 703 case ACPI_NOTIFY_BUS_CHECK:
704 case ACPI_NOTIFY_DEVICE_CHECK: 704 case ACPI_NOTIFY_DEVICE_CHECK:
@@ -710,14 +710,18 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
710 if (!is_processor_present(handle)) 710 if (!is_processor_present(handle))
711 break; 711 break;
712 712
713 if (acpi_bus_get_device(handle, &device)) { 713 if (!acpi_bus_get_device(handle, &device))
714 result = acpi_processor_device_add(handle, &device); 714 break;
715 if (result) 715
716 printk(KERN_ERR PREFIX 716 result = acpi_processor_device_add(handle, &device);
717 "Unable to add the device\n"); 717 if (result) {
718 printk(KERN_ERR PREFIX "Unable to add the device\n");
718 break; 719 break;
719 } 720 }
721
722 ost_code = ACPI_OST_SC_SUCCESS;
720 break; 723 break;
724
721 case ACPI_NOTIFY_EJECT_REQUEST: 725 case ACPI_NOTIFY_EJECT_REQUEST:
722 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 726 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
723 "received ACPI_NOTIFY_EJECT_REQUEST\n")); 727 "received ACPI_NOTIFY_EJECT_REQUEST\n"));
@@ -731,15 +735,23 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
731 if (!pr) { 735 if (!pr) {
732 printk(KERN_ERR PREFIX 736 printk(KERN_ERR PREFIX
733 "Driver data is NULL, dropping EJECT\n"); 737 "Driver data is NULL, dropping EJECT\n");
734 return; 738 break;
735 } 739 }
740
741 /* REVISIT: update when eject is supported */
742 ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
736 break; 743 break;
744
737 default: 745 default:
738 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 746 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
739 "Unsupported event [0x%x]\n", event)); 747 "Unsupported event [0x%x]\n", event));
740 break; 748
749 /* non-hotplug event; possibly handled by other handler */
750 return;
741 } 751 }
742 752
753 /* Inform firmware that the hotplug operation has completed */
754 (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
743 return; 755 return;
744} 756}
745 757
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index e589c1985248..ad3730b4038b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -301,16 +301,16 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
301 pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5; 301 pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5;
302 302
303 /* determine latencies from FADT */ 303 /* determine latencies from FADT */
304 pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; 304 pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.c2_latency;
305 pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; 305 pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.c3_latency;
306 306
307 /* 307 /*
308 * FADT specified C2 latency must be less than or equal to 308 * FADT specified C2 latency must be less than or equal to
309 * 100 microseconds. 309 * 100 microseconds.
310 */ 310 */
311 if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { 311 if (acpi_gbl_FADT.c2_latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
312 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 312 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
313 "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency)); 313 "C2 latency too large [%d]\n", acpi_gbl_FADT.c2_latency));
314 /* invalidate C2 */ 314 /* invalidate C2 */
315 pr->power.states[ACPI_STATE_C2].address = 0; 315 pr->power.states[ACPI_STATE_C2].address = 0;
316 } 316 }
@@ -319,9 +319,9 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
319 * FADT supplied C3 latency must be less than or equal to 319 * FADT supplied C3 latency must be less than or equal to
320 * 1000 microseconds. 320 * 1000 microseconds.
321 */ 321 */
322 if (acpi_gbl_FADT.C3latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { 322 if (acpi_gbl_FADT.c3_latency > ACPI_PROCESSOR_MAX_C3_LATENCY) {
323 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 323 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
324 "C3 latency too large [%d]\n", acpi_gbl_FADT.C3latency)); 324 "C3 latency too large [%d]\n", acpi_gbl_FADT.c3_latency));
325 /* invalidate C3 */ 325 /* invalidate C3 */
326 pr->power.states[ACPI_STATE_C3].address = 0; 326 pr->power.states[ACPI_STATE_C3].address = 0;
327 } 327 }
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index fdda49336560..d1ecca2b641a 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -83,19 +83,29 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha
83} 83}
84static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); 84static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
85 85
86static void acpi_bus_hot_remove_device(void *context) 86/**
87 * acpi_bus_hot_remove_device: hot-remove a device and its children
88 * @context: struct acpi_eject_event pointer (freed in this func)
89 *
90 * Hot-remove a device and its children. This function frees up the
91 * memory space passed by arg context, so that the caller may call
92 * this function asynchronously through acpi_os_hotplug_execute().
93 */
94void acpi_bus_hot_remove_device(void *context)
87{ 95{
96 struct acpi_eject_event *ej_event = (struct acpi_eject_event *) context;
88 struct acpi_device *device; 97 struct acpi_device *device;
89 acpi_handle handle = context; 98 acpi_handle handle = ej_event->handle;
90 struct acpi_object_list arg_list; 99 struct acpi_object_list arg_list;
91 union acpi_object arg; 100 union acpi_object arg;
92 acpi_status status = AE_OK; 101 acpi_status status = AE_OK;
102 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
93 103
94 if (acpi_bus_get_device(handle, &device)) 104 if (acpi_bus_get_device(handle, &device))
95 return; 105 goto err_out;
96 106
97 if (!device) 107 if (!device)
98 return; 108 goto err_out;
99 109
100 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 110 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
101 "Hot-removing device %s...\n", dev_name(&device->dev))); 111 "Hot-removing device %s...\n", dev_name(&device->dev)));
@@ -103,7 +113,7 @@ static void acpi_bus_hot_remove_device(void *context)
103 if (acpi_bus_trim(device, 1)) { 113 if (acpi_bus_trim(device, 1)) {
104 printk(KERN_ERR PREFIX 114 printk(KERN_ERR PREFIX
105 "Removing device failed\n"); 115 "Removing device failed\n");
106 return; 116 goto err_out;
107 } 117 }
108 118
109 /* power off device */ 119 /* power off device */
@@ -129,10 +139,21 @@ static void acpi_bus_hot_remove_device(void *context)
129 * TBD: _EJD support. 139 * TBD: _EJD support.
130 */ 140 */
131 status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); 141 status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
132 if (ACPI_FAILURE(status)) 142 if (ACPI_FAILURE(status)) {
133 printk(KERN_WARNING PREFIX 143 if (status != AE_NOT_FOUND)
134 "Eject device failed\n"); 144 printk(KERN_WARNING PREFIX
145 "Eject device failed\n");
146 goto err_out;
147 }
148
149 kfree(context);
150 return;
135 151
152err_out:
153 /* Inform firmware the hot-remove operation has completed w/ error */
154 (void) acpi_evaluate_hotplug_ost(handle,
155 ej_event->event, ost_code, NULL);
156 kfree(context);
136 return; 157 return;
137} 158}
138 159
@@ -144,6 +165,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
144 acpi_status status; 165 acpi_status status;
145 acpi_object_type type = 0; 166 acpi_object_type type = 0;
146 struct acpi_device *acpi_device = to_acpi_device(d); 167 struct acpi_device *acpi_device = to_acpi_device(d);
168 struct acpi_eject_event *ej_event;
147 169
148 if ((!count) || (buf[0] != '1')) { 170 if ((!count) || (buf[0] != '1')) {
149 return -EINVAL; 171 return -EINVAL;
@@ -160,7 +182,25 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
160 goto err; 182 goto err;
161 } 183 }
162 184
163 acpi_os_hotplug_execute(acpi_bus_hot_remove_device, acpi_device->handle); 185 ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
186 if (!ej_event) {
187 ret = -ENOMEM;
188 goto err;
189 }
190
191 ej_event->handle = acpi_device->handle;
192 if (acpi_device->flags.eject_pending) {
193 /* event originated from ACPI eject notification */
194 ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
195 acpi_device->flags.eject_pending = 0;
196 } else {
197 /* event originated from user */
198 ej_event->event = ACPI_OST_EC_OSPM_EJECT;
199 (void) acpi_evaluate_hotplug_ost(ej_event->handle,
200 ej_event->event, ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
201 }
202
203 acpi_os_hotplug_execute(acpi_bus_hot_remove_device, (void *)ej_event);
164err: 204err:
165 return ret; 205 return ret;
166} 206}
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 028dd425702c..7a7a9c929247 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -143,7 +143,7 @@ void __init acpi_old_suspend_ordering(void)
143static int acpi_pm_freeze(void) 143static int acpi_pm_freeze(void)
144{ 144{
145 acpi_disable_all_gpes(); 145 acpi_disable_all_gpes();
146 acpi_os_wait_events_complete(NULL); 146 acpi_os_wait_events_complete();
147 acpi_ec_block_transactions(); 147 acpi_ec_block_transactions();
148 return 0; 148 return 0;
149} 149}
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 21dd4c268aef..9fe90e9fecb5 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -552,8 +552,6 @@ static int thermal_get_temp(struct thermal_zone_device *thermal,
552 return 0; 552 return 0;
553} 553}
554 554
555static const char enabled[] = "kernel";
556static const char disabled[] = "user";
557static int thermal_get_mode(struct thermal_zone_device *thermal, 555static int thermal_get_mode(struct thermal_zone_device *thermal,
558 enum thermal_device_mode *mode) 556 enum thermal_device_mode *mode)
559{ 557{
@@ -590,8 +588,8 @@ static int thermal_set_mode(struct thermal_zone_device *thermal,
590 if (enable != tz->tz_enabled) { 588 if (enable != tz->tz_enabled) {
591 tz->tz_enabled = enable; 589 tz->tz_enabled = enable;
592 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 590 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
593 "%s ACPI thermal control\n", 591 "%s kernel ACPI thermal control\n",
594 tz->tz_enabled ? enabled : disabled)); 592 tz->tz_enabled ? "Enable" : "Disable"));
595 acpi_thermal_check(tz); 593 acpi_thermal_check(tz);
596 } 594 }
597 return 0; 595 return 0;
@@ -847,7 +845,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
847 845
848 if (tz->trips.passive.flags.valid) 846 if (tz->trips.passive.flags.valid)
849 tz->thermal_zone = 847 tz->thermal_zone =
850 thermal_zone_device_register("acpitz", trips, tz, 848 thermal_zone_device_register("acpitz", trips, 0, tz,
851 &acpi_thermal_zone_ops, 849 &acpi_thermal_zone_ops,
852 tz->trips.passive.tc1, 850 tz->trips.passive.tc1,
853 tz->trips.passive.tc2, 851 tz->trips.passive.tc2,
@@ -855,7 +853,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
855 tz->polling_frequency*100); 853 tz->polling_frequency*100);
856 else 854 else
857 tz->thermal_zone = 855 tz->thermal_zone =
858 thermal_zone_device_register("acpitz", trips, tz, 856 thermal_zone_device_register("acpitz", trips, 0, tz,
859 &acpi_thermal_zone_ops, 857 &acpi_thermal_zone_ops,
860 0, 0, 0, 858 0, 0, 0,
861 tz->polling_frequency*100); 859 tz->polling_frequency*100);
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index adbbc1c80a26..3e87c9c538aa 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -412,3 +412,45 @@ out:
412 return status; 412 return status;
413} 413}
414EXPORT_SYMBOL(acpi_get_physical_device_location); 414EXPORT_SYMBOL(acpi_get_physical_device_location);
415
416/**
417 * acpi_evaluate_hotplug_ost: Evaluate _OST for hotplug operations
418 * @handle: ACPI device handle
419 * @source_event: source event code
420 * @status_code: status code
421 * @status_buf: optional detailed information (NULL if none)
422 *
423 * Evaluate _OST for hotplug operations. All ACPI hotplug handlers
424 * must call this function when evaluating _OST for hotplug operations.
425 * When the platform does not support _OST, this function has no effect.
426 */
427acpi_status
428acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
429 u32 status_code, struct acpi_buffer *status_buf)
430{
431#ifdef ACPI_HOTPLUG_OST
432 union acpi_object params[3] = {
433 {.type = ACPI_TYPE_INTEGER,},
434 {.type = ACPI_TYPE_INTEGER,},
435 {.type = ACPI_TYPE_BUFFER,}
436 };
437 struct acpi_object_list arg_list = {3, params};
438 acpi_status status;
439
440 params[0].integer.value = source_event;
441 params[1].integer.value = status_code;
442 if (status_buf != NULL) {
443 params[2].buffer.pointer = status_buf->pointer;
444 params[2].buffer.length = status_buf->length;
445 } else {
446 params[2].buffer.pointer = NULL;
447 params[2].buffer.length = 0;
448 }
449
450 status = acpi_evaluate_object(handle, "_OST", &arg_list, NULL);
451 return status;
452#else
453 return AE_OK;
454#endif
455}
456EXPORT_SYMBOL(acpi_evaluate_hotplug_ost);
diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index 78a666d1e5f5..a76b689e553b 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -18,3 +18,6 @@ config CPU_IDLE_GOV_MENU
18 bool 18 bool
19 depends on CPU_IDLE && NO_HZ 19 depends on CPU_IDLE && NO_HZ
20 default y 20 default y
21
22config ARCH_NEEDS_CPU_IDLE_COUPLED
23 def_bool n
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 5634f88379df..38c8f69f30cf 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -3,3 +3,4 @@
3# 3#
4 4
5obj-y += cpuidle.o driver.o governor.o sysfs.o governors/ 5obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
6obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
new file mode 100644
index 000000000000..2c9bf2692232
--- /dev/null
+++ b/drivers/cpuidle/coupled.c
@@ -0,0 +1,715 @@
1/*
2 * coupled.c - helper functions to enter the same idle state on multiple cpus
3 *
4 * Copyright (c) 2011 Google, Inc.
5 *
6 * Author: Colin Cross <ccross@android.com>
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
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 */
18
19#include <linux/kernel.h>
20#include <linux/cpu.h>
21#include <linux/cpuidle.h>
22#include <linux/mutex.h>
23#include <linux/sched.h>
24#include <linux/slab.h>
25#include <linux/spinlock.h>
26
27#include "cpuidle.h"
28
29/**
30 * DOC: Coupled cpuidle states
31 *
32 * On some ARM SMP SoCs (OMAP4460, Tegra 2, and probably more), the
33 * cpus cannot be independently powered down, either due to
34 * sequencing restrictions (on Tegra 2, cpu 0 must be the last to
35 * power down), or due to HW bugs (on OMAP4460, a cpu powering up
36 * will corrupt the gic state unless the other cpu runs a work
37 * around). Each cpu has a power state that it can enter without
38 * coordinating with the other cpu (usually Wait For Interrupt, or
39 * WFI), and one or more "coupled" power states that affect blocks
40 * shared between the cpus (L2 cache, interrupt controller, and
41 * sometimes the whole SoC). Entering a coupled power state must
42 * be tightly controlled on both cpus.
43 *
44 * This file implements a solution, where each cpu will wait in the
45 * WFI state until all cpus are ready to enter a coupled state, at
46 * which point the coupled state function will be called on all
47 * cpus at approximately the same time.
48 *
49 * Once all cpus are ready to enter idle, they are woken by an smp
50 * cross call. At this point, there is a chance that one of the
51 * cpus will find work to do, and choose not to enter idle. A
52 * final pass is needed to guarantee that all cpus will call the
53 * power state enter function at the same time. During this pass,
54 * each cpu will increment the ready counter, and continue once the
55 * ready counter matches the number of online coupled cpus. If any
56 * cpu exits idle, the other cpus will decrement their counter and
57 * retry.
58 *
59 * requested_state stores the deepest coupled idle state each cpu
60 * is ready for. It is assumed that the states are indexed from
61 * shallowest (highest power, lowest exit latency) to deepest
62 * (lowest power, highest exit latency). The requested_state
63 * variable is not locked. It is only written from the cpu that
64 * it stores (or by the on/offlining cpu if that cpu is offline),
65 * and only read after all the cpus are ready for the coupled idle
66 * state are are no longer updating it.
67 *
68 * Three atomic counters are used. alive_count tracks the number
69 * of cpus in the coupled set that are currently or soon will be
70 * online. waiting_count tracks the number of cpus that are in
71 * the waiting loop, in the ready loop, or in the coupled idle state.
72 * ready_count tracks the number of cpus that are in the ready loop
73 * or in the coupled idle state.
74 *
75 * To use coupled cpuidle states, a cpuidle driver must:
76 *
77 * Set struct cpuidle_device.coupled_cpus to the mask of all
78 * coupled cpus, usually the same as cpu_possible_mask if all cpus
79 * are part of the same cluster. The coupled_cpus mask must be
80 * set in the struct cpuidle_device for each cpu.
81 *
82 * Set struct cpuidle_device.safe_state to a state that is not a
83 * coupled state. This is usually WFI.
84 *
85 * Set CPUIDLE_FLAG_COUPLED in struct cpuidle_state.flags for each
86 * state that affects multiple cpus.
87 *
88 * Provide a struct cpuidle_state.enter function for each state
89 * that affects multiple cpus. This function is guaranteed to be
90 * called on all cpus at approximately the same time. The driver
91 * should ensure that the cpus all abort together if any cpu tries
92 * to abort once the function is called. The function should return
93 * with interrupts still disabled.
94 */
95
96/**
97 * struct cpuidle_coupled - data for set of cpus that share a coupled idle state
98 * @coupled_cpus: mask of cpus that are part of the coupled set
99 * @requested_state: array of requested states for cpus in the coupled set
100 * @ready_waiting_counts: combined count of cpus in ready or waiting loops
101 * @online_count: count of cpus that are online
102 * @refcnt: reference count of cpuidle devices that are using this struct
103 * @prevent: flag to prevent coupled idle while a cpu is hotplugging
104 */
105struct cpuidle_coupled {
106 cpumask_t coupled_cpus;
107 int requested_state[NR_CPUS];
108 atomic_t ready_waiting_counts;
109 int online_count;
110 int refcnt;
111 int prevent;
112};
113
114#define WAITING_BITS 16
115#define MAX_WAITING_CPUS (1 << WAITING_BITS)
116#define WAITING_MASK (MAX_WAITING_CPUS - 1)
117#define READY_MASK (~WAITING_MASK)
118
119#define CPUIDLE_COUPLED_NOT_IDLE (-1)
120
121static DEFINE_MUTEX(cpuidle_coupled_lock);
122static DEFINE_PER_CPU(struct call_single_data, cpuidle_coupled_poke_cb);
123
124/*
125 * The cpuidle_coupled_poked_mask mask is used to avoid calling
126 * __smp_call_function_single with the per cpu call_single_data struct already
127 * in use. This prevents a deadlock where two cpus are waiting for each others
128 * call_single_data struct to be available
129 */
130static cpumask_t cpuidle_coupled_poked_mask;
131
132/**
133 * cpuidle_coupled_parallel_barrier - synchronize all online coupled cpus
134 * @dev: cpuidle_device of the calling cpu
135 * @a: atomic variable to hold the barrier
136 *
137 * No caller to this function will return from this function until all online
138 * cpus in the same coupled group have called this function. Once any caller
139 * has returned from this function, the barrier is immediately available for
140 * reuse.
141 *
142 * The atomic variable a must be initialized to 0 before any cpu calls
143 * this function, will be reset to 0 before any cpu returns from this function.
144 *
145 * Must only be called from within a coupled idle state handler
146 * (state.enter when state.flags has CPUIDLE_FLAG_COUPLED set).
147 *
148 * Provides full smp barrier semantics before and after calling.
149 */
150void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a)
151{
152 int n = dev->coupled->online_count;
153
154 smp_mb__before_atomic_inc();
155 atomic_inc(a);
156
157 while (atomic_read(a) < n)
158 cpu_relax();
159
160 if (atomic_inc_return(a) == n * 2) {
161 atomic_set(a, 0);
162 return;
163 }
164
165 while (atomic_read(a) > n)
166 cpu_relax();
167}
168
169/**
170 * cpuidle_state_is_coupled - check if a state is part of a coupled set
171 * @dev: struct cpuidle_device for the current cpu
172 * @drv: struct cpuidle_driver for the platform
173 * @state: index of the target state in drv->states
174 *
175 * Returns true if the target state is coupled with cpus besides this one
176 */
177bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
178 struct cpuidle_driver *drv, int state)
179{
180 return drv->states[state].flags & CPUIDLE_FLAG_COUPLED;
181}
182
183/**
184 * cpuidle_coupled_set_ready - mark a cpu as ready
185 * @coupled: the struct coupled that contains the current cpu
186 */
187static inline void cpuidle_coupled_set_ready(struct cpuidle_coupled *coupled)
188{
189 atomic_add(MAX_WAITING_CPUS, &coupled->ready_waiting_counts);
190}
191
192/**
193 * cpuidle_coupled_set_not_ready - mark a cpu as not ready
194 * @coupled: the struct coupled that contains the current cpu
195 *
196 * Decrements the ready counter, unless the ready (and thus the waiting) counter
197 * is equal to the number of online cpus. Prevents a race where one cpu
198 * decrements the waiting counter and then re-increments it just before another
199 * cpu has decremented its ready counter, leading to the ready counter going
200 * down from the number of online cpus without going through the coupled idle
201 * state.
202 *
203 * Returns 0 if the counter was decremented successfully, -EINVAL if the ready
204 * counter was equal to the number of online cpus.
205 */
206static
207inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled)
208{
209 int all;
210 int ret;
211
212 all = coupled->online_count || (coupled->online_count << WAITING_BITS);
213 ret = atomic_add_unless(&coupled->ready_waiting_counts,
214 -MAX_WAITING_CPUS, all);
215
216 return ret ? 0 : -EINVAL;
217}
218
219/**
220 * cpuidle_coupled_no_cpus_ready - check if no cpus in a coupled set are ready
221 * @coupled: the struct coupled that contains the current cpu
222 *
223 * Returns true if all of the cpus in a coupled set are out of the ready loop.
224 */
225static inline int cpuidle_coupled_no_cpus_ready(struct cpuidle_coupled *coupled)
226{
227 int r = atomic_read(&coupled->ready_waiting_counts) >> WAITING_BITS;
228 return r == 0;
229}
230
231/**
232 * cpuidle_coupled_cpus_ready - check if all cpus in a coupled set are ready
233 * @coupled: the struct coupled that contains the current cpu
234 *
235 * Returns true if all cpus coupled to this target state are in the ready loop
236 */
237static inline bool cpuidle_coupled_cpus_ready(struct cpuidle_coupled *coupled)
238{
239 int r = atomic_read(&coupled->ready_waiting_counts) >> WAITING_BITS;
240 return r == coupled->online_count;
241}
242
243/**
244 * cpuidle_coupled_cpus_waiting - check if all cpus in a coupled set are waiting
245 * @coupled: the struct coupled that contains the current cpu
246 *
247 * Returns true if all cpus coupled to this target state are in the wait loop
248 */
249static inline bool cpuidle_coupled_cpus_waiting(struct cpuidle_coupled *coupled)
250{
251 int w = atomic_read(&coupled->ready_waiting_counts) & WAITING_MASK;
252 return w == coupled->online_count;
253}
254
255/**
256 * cpuidle_coupled_no_cpus_waiting - check if no cpus in coupled set are waiting
257 * @coupled: the struct coupled that contains the current cpu
258 *
259 * Returns true if all of the cpus in a coupled set are out of the waiting loop.
260 */
261static inline int cpuidle_coupled_no_cpus_waiting(struct cpuidle_coupled *coupled)
262{
263 int w = atomic_read(&coupled->ready_waiting_counts) & WAITING_MASK;
264 return w == 0;
265}
266
267/**
268 * cpuidle_coupled_get_state - determine the deepest idle state
269 * @dev: struct cpuidle_device for this cpu
270 * @coupled: the struct coupled that contains the current cpu
271 *
272 * Returns the deepest idle state that all coupled cpus can enter
273 */
274static inline int cpuidle_coupled_get_state(struct cpuidle_device *dev,
275 struct cpuidle_coupled *coupled)
276{
277 int i;
278 int state = INT_MAX;
279
280 /*
281 * Read barrier ensures that read of requested_state is ordered after
282 * reads of ready_count. Matches the write barriers
283 * cpuidle_set_state_waiting.
284 */
285 smp_rmb();
286
287 for_each_cpu_mask(i, coupled->coupled_cpus)
288 if (cpu_online(i) && coupled->requested_state[i] < state)
289 state = coupled->requested_state[i];
290
291 return state;
292}
293
294static void cpuidle_coupled_poked(void *info)
295{
296 int cpu = (unsigned long)info;
297 cpumask_clear_cpu(cpu, &cpuidle_coupled_poked_mask);
298}
299
300/**
301 * cpuidle_coupled_poke - wake up a cpu that may be waiting
302 * @cpu: target cpu
303 *
304 * Ensures that the target cpu exits it's waiting idle state (if it is in it)
305 * and will see updates to waiting_count before it re-enters it's waiting idle
306 * state.
307 *
308 * If cpuidle_coupled_poked_mask is already set for the target cpu, that cpu
309 * either has or will soon have a pending IPI that will wake it out of idle,
310 * or it is currently processing the IPI and is not in idle.
311 */
312static void cpuidle_coupled_poke(int cpu)
313{
314 struct call_single_data *csd = &per_cpu(cpuidle_coupled_poke_cb, cpu);
315
316 if (!cpumask_test_and_set_cpu(cpu, &cpuidle_coupled_poked_mask))
317 __smp_call_function_single(cpu, csd, 0);
318}
319
320/**
321 * cpuidle_coupled_poke_others - wake up all other cpus that may be waiting
322 * @dev: struct cpuidle_device for this cpu
323 * @coupled: the struct coupled that contains the current cpu
324 *
325 * Calls cpuidle_coupled_poke on all other online cpus.
326 */
327static void cpuidle_coupled_poke_others(int this_cpu,
328 struct cpuidle_coupled *coupled)
329{
330 int cpu;
331
332 for_each_cpu_mask(cpu, coupled->coupled_cpus)
333 if (cpu != this_cpu && cpu_online(cpu))
334 cpuidle_coupled_poke(cpu);
335}
336
337/**
338 * cpuidle_coupled_set_waiting - mark this cpu as in the wait loop
339 * @dev: struct cpuidle_device for this cpu
340 * @coupled: the struct coupled that contains the current cpu
341 * @next_state: the index in drv->states of the requested state for this cpu
342 *
343 * Updates the requested idle state for the specified cpuidle device,
344 * poking all coupled cpus out of idle if necessary to let them see the new
345 * state.
346 */
347static void cpuidle_coupled_set_waiting(int cpu,
348 struct cpuidle_coupled *coupled, int next_state)
349{
350 int w;
351
352 coupled->requested_state[cpu] = next_state;
353
354 /*
355 * If this is the last cpu to enter the waiting state, poke
356 * all the other cpus out of their waiting state so they can
357 * enter a deeper state. This can race with one of the cpus
358 * exiting the waiting state due to an interrupt and
359 * decrementing waiting_count, see comment below.
360 *
361 * The atomic_inc_return provides a write barrier to order the write
362 * to requested_state with the later write that increments ready_count.
363 */
364 w = atomic_inc_return(&coupled->ready_waiting_counts) & WAITING_MASK;
365 if (w == coupled->online_count)
366 cpuidle_coupled_poke_others(cpu, coupled);
367}
368
369/**
370 * cpuidle_coupled_set_not_waiting - mark this cpu as leaving the wait loop
371 * @dev: struct cpuidle_device for this cpu
372 * @coupled: the struct coupled that contains the current cpu
373 *
374 * Removes the requested idle state for the specified cpuidle device.
375 */
376static void cpuidle_coupled_set_not_waiting(int cpu,
377 struct cpuidle_coupled *coupled)
378{
379 /*
380 * Decrementing waiting count can race with incrementing it in
381 * cpuidle_coupled_set_waiting, but that's OK. Worst case, some
382 * cpus will increment ready_count and then spin until they
383 * notice that this cpu has cleared it's requested_state.
384 */
385 atomic_dec(&coupled->ready_waiting_counts);
386
387 coupled->requested_state[cpu] = CPUIDLE_COUPLED_NOT_IDLE;
388}
389
390/**
391 * cpuidle_coupled_set_done - mark this cpu as leaving the ready loop
392 * @cpu: the current cpu
393 * @coupled: the struct coupled that contains the current cpu
394 *
395 * Marks this cpu as no longer in the ready and waiting loops. Decrements
396 * the waiting count first to prevent another cpu looping back in and seeing
397 * this cpu as waiting just before it exits idle.
398 */
399static void cpuidle_coupled_set_done(int cpu, struct cpuidle_coupled *coupled)
400{
401 cpuidle_coupled_set_not_waiting(cpu, coupled);
402 atomic_sub(MAX_WAITING_CPUS, &coupled->ready_waiting_counts);
403}
404
405/**
406 * cpuidle_coupled_clear_pokes - spin until the poke interrupt is processed
407 * @cpu - this cpu
408 *
409 * Turns on interrupts and spins until any outstanding poke interrupts have
410 * been processed and the poke bit has been cleared.
411 *
412 * Other interrupts may also be processed while interrupts are enabled, so
413 * need_resched() must be tested after turning interrupts off again to make sure
414 * the interrupt didn't schedule work that should take the cpu out of idle.
415 *
416 * Returns 0 if need_resched was false, -EINTR if need_resched was true.
417 */
418static int cpuidle_coupled_clear_pokes(int cpu)
419{
420 local_irq_enable();
421 while (cpumask_test_cpu(cpu, &cpuidle_coupled_poked_mask))
422 cpu_relax();
423 local_irq_disable();
424
425 return need_resched() ? -EINTR : 0;
426}
427
428/**
429 * cpuidle_enter_state_coupled - attempt to enter a state with coupled cpus
430 * @dev: struct cpuidle_device for the current cpu
431 * @drv: struct cpuidle_driver for the platform
432 * @next_state: index of the requested state in drv->states
433 *
434 * Coordinate with coupled cpus to enter the target state. This is a two
435 * stage process. In the first stage, the cpus are operating independently,
436 * and may call into cpuidle_enter_state_coupled at completely different times.
437 * To save as much power as possible, the first cpus to call this function will
438 * go to an intermediate state (the cpuidle_device's safe state), and wait for
439 * all the other cpus to call this function. Once all coupled cpus are idle,
440 * the second stage will start. Each coupled cpu will spin until all cpus have
441 * guaranteed that they will call the target_state.
442 *
443 * This function must be called with interrupts disabled. It may enable
444 * interrupts while preparing for idle, and it will always return with
445 * interrupts enabled.
446 */
447int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
448 struct cpuidle_driver *drv, int next_state)
449{
450 int entered_state = -1;
451 struct cpuidle_coupled *coupled = dev->coupled;
452
453 if (!coupled)
454 return -EINVAL;
455
456 while (coupled->prevent) {
457 if (cpuidle_coupled_clear_pokes(dev->cpu)) {
458 local_irq_enable();
459 return entered_state;
460 }
461 entered_state = cpuidle_enter_state(dev, drv,
462 dev->safe_state_index);
463 }
464
465 /* Read barrier ensures online_count is read after prevent is cleared */
466 smp_rmb();
467
468 cpuidle_coupled_set_waiting(dev->cpu, coupled, next_state);
469
470retry:
471 /*
472 * Wait for all coupled cpus to be idle, using the deepest state
473 * allowed for a single cpu.
474 */
475 while (!cpuidle_coupled_cpus_waiting(coupled)) {
476 if (cpuidle_coupled_clear_pokes(dev->cpu)) {
477 cpuidle_coupled_set_not_waiting(dev->cpu, coupled);
478 goto out;
479 }
480
481 if (coupled->prevent) {
482 cpuidle_coupled_set_not_waiting(dev->cpu, coupled);
483 goto out;
484 }
485
486 entered_state = cpuidle_enter_state(dev, drv,
487 dev->safe_state_index);
488 }
489
490 if (cpuidle_coupled_clear_pokes(dev->cpu)) {
491 cpuidle_coupled_set_not_waiting(dev->cpu, coupled);
492 goto out;
493 }
494
495 /*
496 * All coupled cpus are probably idle. There is a small chance that
497 * one of the other cpus just became active. Increment the ready count,
498 * and spin until all coupled cpus have incremented the counter. Once a
499 * cpu has incremented the ready counter, it cannot abort idle and must
500 * spin until either all cpus have incremented the ready counter, or
501 * another cpu leaves idle and decrements the waiting counter.
502 */
503
504 cpuidle_coupled_set_ready(coupled);
505 while (!cpuidle_coupled_cpus_ready(coupled)) {
506 /* Check if any other cpus bailed out of idle. */
507 if (!cpuidle_coupled_cpus_waiting(coupled))
508 if (!cpuidle_coupled_set_not_ready(coupled))
509 goto retry;
510
511 cpu_relax();
512 }
513
514 /* all cpus have acked the coupled state */
515 next_state = cpuidle_coupled_get_state(dev, coupled);
516
517 entered_state = cpuidle_enter_state(dev, drv, next_state);
518
519 cpuidle_coupled_set_done(dev->cpu, coupled);
520
521out:
522 /*
523 * Normal cpuidle states are expected to return with irqs enabled.
524 * That leads to an inefficiency where a cpu receiving an interrupt
525 * that brings it out of idle will process that interrupt before
526 * exiting the idle enter function and decrementing ready_count. All
527 * other cpus will need to spin waiting for the cpu that is processing
528 * the interrupt. If the driver returns with interrupts disabled,
529 * all other cpus will loop back into the safe idle state instead of
530 * spinning, saving power.
531 *
532 * Calling local_irq_enable here allows coupled states to return with
533 * interrupts disabled, but won't cause problems for drivers that
534 * exit with interrupts enabled.
535 */
536 local_irq_enable();
537
538 /*
539 * Wait until all coupled cpus have exited idle. There is no risk that
540 * a cpu exits and re-enters the ready state because this cpu has
541 * already decremented its waiting_count.
542 */
543 while (!cpuidle_coupled_no_cpus_ready(coupled))
544 cpu_relax();
545
546 return entered_state;
547}
548
549static void cpuidle_coupled_update_online_cpus(struct cpuidle_coupled *coupled)
550{
551 cpumask_t cpus;
552 cpumask_and(&cpus, cpu_online_mask, &coupled->coupled_cpus);
553 coupled->online_count = cpumask_weight(&cpus);
554}
555
556/**
557 * cpuidle_coupled_register_device - register a coupled cpuidle device
558 * @dev: struct cpuidle_device for the current cpu
559 *
560 * Called from cpuidle_register_device to handle coupled idle init. Finds the
561 * cpuidle_coupled struct for this set of coupled cpus, or creates one if none
562 * exists yet.
563 */
564int cpuidle_coupled_register_device(struct cpuidle_device *dev)
565{
566 int cpu;
567 struct cpuidle_device *other_dev;
568 struct call_single_data *csd;
569 struct cpuidle_coupled *coupled;
570
571 if (cpumask_empty(&dev->coupled_cpus))
572 return 0;
573
574 for_each_cpu_mask(cpu, dev->coupled_cpus) {
575 other_dev = per_cpu(cpuidle_devices, cpu);
576 if (other_dev && other_dev->coupled) {
577 coupled = other_dev->coupled;
578 goto have_coupled;
579 }
580 }
581
582 /* No existing coupled info found, create a new one */
583 coupled = kzalloc(sizeof(struct cpuidle_coupled), GFP_KERNEL);
584 if (!coupled)
585 return -ENOMEM;
586
587 coupled->coupled_cpus = dev->coupled_cpus;
588
589have_coupled:
590 dev->coupled = coupled;
591 if (WARN_ON(!cpumask_equal(&dev->coupled_cpus, &coupled->coupled_cpus)))
592 coupled->prevent++;
593
594 cpuidle_coupled_update_online_cpus(coupled);
595
596 coupled->refcnt++;
597
598 csd = &per_cpu(cpuidle_coupled_poke_cb, dev->cpu);
599 csd->func = cpuidle_coupled_poked;
600 csd->info = (void *)(unsigned long)dev->cpu;
601
602 return 0;
603}
604
605/**
606 * cpuidle_coupled_unregister_device - unregister a coupled cpuidle device
607 * @dev: struct cpuidle_device for the current cpu
608 *
609 * Called from cpuidle_unregister_device to tear down coupled idle. Removes the
610 * cpu from the coupled idle set, and frees the cpuidle_coupled_info struct if
611 * this was the last cpu in the set.
612 */
613void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
614{
615 struct cpuidle_coupled *coupled = dev->coupled;
616
617 if (cpumask_empty(&dev->coupled_cpus))
618 return;
619
620 if (--coupled->refcnt)
621 kfree(coupled);
622 dev->coupled = NULL;
623}
624
625/**
626 * cpuidle_coupled_prevent_idle - prevent cpus from entering a coupled state
627 * @coupled: the struct coupled that contains the cpu that is changing state
628 *
629 * Disables coupled cpuidle on a coupled set of cpus. Used to ensure that
630 * cpu_online_mask doesn't change while cpus are coordinating coupled idle.
631 */
632static void cpuidle_coupled_prevent_idle(struct cpuidle_coupled *coupled)
633{
634 int cpu = get_cpu();
635
636 /* Force all cpus out of the waiting loop. */
637 coupled->prevent++;
638 cpuidle_coupled_poke_others(cpu, coupled);
639 put_cpu();
640 while (!cpuidle_coupled_no_cpus_waiting(coupled))
641 cpu_relax();
642}
643
644/**
645 * cpuidle_coupled_allow_idle - allows cpus to enter a coupled state
646 * @coupled: the struct coupled that contains the cpu that is changing state
647 *
648 * Enables coupled cpuidle on a coupled set of cpus. Used to ensure that
649 * cpu_online_mask doesn't change while cpus are coordinating coupled idle.
650 */
651static void cpuidle_coupled_allow_idle(struct cpuidle_coupled *coupled)
652{
653 int cpu = get_cpu();
654
655 /*
656 * Write barrier ensures readers see the new online_count when they
657 * see prevent == 0.
658 */
659 smp_wmb();
660 coupled->prevent--;
661 /* Force cpus out of the prevent loop. */
662 cpuidle_coupled_poke_others(cpu, coupled);
663 put_cpu();
664}
665
666/**
667 * cpuidle_coupled_cpu_notify - notifier called during hotplug transitions
668 * @nb: notifier block
669 * @action: hotplug transition
670 * @hcpu: target cpu number
671 *
672 * Called when a cpu is brought on or offline using hotplug. Updates the
673 * coupled cpu set appropriately
674 */
675static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
676 unsigned long action, void *hcpu)
677{
678 int cpu = (unsigned long)hcpu;
679 struct cpuidle_device *dev;
680
681 mutex_lock(&cpuidle_lock);
682
683 dev = per_cpu(cpuidle_devices, cpu);
684 if (!dev->coupled)
685 goto out;
686
687 switch (action & ~CPU_TASKS_FROZEN) {
688 case CPU_UP_PREPARE:
689 case CPU_DOWN_PREPARE:
690 cpuidle_coupled_prevent_idle(dev->coupled);
691 break;
692 case CPU_ONLINE:
693 case CPU_DEAD:
694 cpuidle_coupled_update_online_cpus(dev->coupled);
695 /* Fall through */
696 case CPU_UP_CANCELED:
697 case CPU_DOWN_FAILED:
698 cpuidle_coupled_allow_idle(dev->coupled);
699 break;
700 }
701
702out:
703 mutex_unlock(&cpuidle_lock);
704 return NOTIFY_OK;
705}
706
707static struct notifier_block cpuidle_coupled_cpu_notifier = {
708 .notifier_call = cpuidle_coupled_cpu_notify,
709};
710
711static int __init cpuidle_coupled_init(void)
712{
713 return register_cpu_notifier(&cpuidle_coupled_cpu_notifier);
714}
715core_initcall(cpuidle_coupled_init);
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d6a533e68e0f..e28f6ea46f1a 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -92,6 +92,34 @@ int cpuidle_play_dead(void)
92} 92}
93 93
94/** 94/**
95 * cpuidle_enter_state - enter the state and update stats
96 * @dev: cpuidle device for this cpu
97 * @drv: cpuidle driver for this cpu
98 * @next_state: index into drv->states of the state to enter
99 */
100int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
101 int next_state)
102{
103 int entered_state;
104
105 entered_state = cpuidle_enter_ops(dev, drv, next_state);
106
107 if (entered_state >= 0) {
108 /* Update cpuidle counters */
109 /* This can be moved to within driver enter routine
110 * but that results in multiple copies of same code.
111 */
112 dev->states_usage[entered_state].time +=
113 (unsigned long long)dev->last_residency;
114 dev->states_usage[entered_state].usage++;
115 } else {
116 dev->last_residency = 0;
117 }
118
119 return entered_state;
120}
121
122/**
95 * cpuidle_idle_call - the main idle loop 123 * cpuidle_idle_call - the main idle loop
96 * 124 *
97 * NOTE: no locks or semaphores should be used here 125 * NOTE: no locks or semaphores should be used here
@@ -113,15 +141,6 @@ int cpuidle_idle_call(void)
113 if (!dev || !dev->enabled) 141 if (!dev || !dev->enabled)
114 return -EBUSY; 142 return -EBUSY;
115 143
116#if 0
117 /* shows regressions, re-enable for 2.6.29 */
118 /*
119 * run any timers that can be run now, at this point
120 * before calculating the idle duration etc.
121 */
122 hrtimer_peek_ahead_timers();
123#endif
124
125 /* ask the governor for the next state */ 144 /* ask the governor for the next state */
126 next_state = cpuidle_curr_governor->select(drv, dev); 145 next_state = cpuidle_curr_governor->select(drv, dev);
127 if (need_resched()) { 146 if (need_resched()) {
@@ -132,23 +151,15 @@ int cpuidle_idle_call(void)
132 trace_power_start_rcuidle(POWER_CSTATE, next_state, dev->cpu); 151 trace_power_start_rcuidle(POWER_CSTATE, next_state, dev->cpu);
133 trace_cpu_idle_rcuidle(next_state, dev->cpu); 152 trace_cpu_idle_rcuidle(next_state, dev->cpu);
134 153
135 entered_state = cpuidle_enter_ops(dev, drv, next_state); 154 if (cpuidle_state_is_coupled(dev, drv, next_state))
155 entered_state = cpuidle_enter_state_coupled(dev, drv,
156 next_state);
157 else
158 entered_state = cpuidle_enter_state(dev, drv, next_state);
136 159
137 trace_power_end_rcuidle(dev->cpu); 160 trace_power_end_rcuidle(dev->cpu);
138 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); 161 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
139 162
140 if (entered_state >= 0) {
141 /* Update cpuidle counters */
142 /* This can be moved to within driver enter routine
143 * but that results in multiple copies of same code.
144 */
145 dev->states_usage[entered_state].time +=
146 (unsigned long long)dev->last_residency;
147 dev->states_usage[entered_state].usage++;
148 } else {
149 dev->last_residency = 0;
150 }
151
152 /* give the governor an opportunity to reflect on the outcome */ 163 /* give the governor an opportunity to reflect on the outcome */
153 if (cpuidle_curr_governor->reflect) 164 if (cpuidle_curr_governor->reflect)
154 cpuidle_curr_governor->reflect(dev, entered_state); 165 cpuidle_curr_governor->reflect(dev, entered_state);
@@ -299,6 +310,9 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
299 int ret, i; 310 int ret, i;
300 struct cpuidle_driver *drv = cpuidle_get_driver(); 311 struct cpuidle_driver *drv = cpuidle_get_driver();
301 312
313 if (!dev)
314 return -EINVAL;
315
302 if (dev->enabled) 316 if (dev->enabled)
303 return 0; 317 return 0;
304 if (!drv || !cpuidle_curr_governor) 318 if (!drv || !cpuidle_curr_governor)
@@ -383,8 +397,6 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
383 struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); 397 struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
384 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); 398 struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
385 399
386 if (!dev)
387 return -EINVAL;
388 if (!try_module_get(cpuidle_driver->owner)) 400 if (!try_module_get(cpuidle_driver->owner))
389 return -EINVAL; 401 return -EINVAL;
390 402
@@ -392,13 +404,25 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
392 404
393 per_cpu(cpuidle_devices, dev->cpu) = dev; 405 per_cpu(cpuidle_devices, dev->cpu) = dev;
394 list_add(&dev->device_list, &cpuidle_detected_devices); 406 list_add(&dev->device_list, &cpuidle_detected_devices);
395 if ((ret = cpuidle_add_sysfs(cpu_dev))) { 407 ret = cpuidle_add_sysfs(cpu_dev);
396 module_put(cpuidle_driver->owner); 408 if (ret)
397 return ret; 409 goto err_sysfs;
398 } 410
411 ret = cpuidle_coupled_register_device(dev);
412 if (ret)
413 goto err_coupled;
399 414
400 dev->registered = 1; 415 dev->registered = 1;
401 return 0; 416 return 0;
417
418err_coupled:
419 cpuidle_remove_sysfs(cpu_dev);
420 wait_for_completion(&dev->kobj_unregister);
421err_sysfs:
422 list_del(&dev->device_list);
423 per_cpu(cpuidle_devices, dev->cpu) = NULL;
424 module_put(cpuidle_driver->owner);
425 return ret;
402} 426}
403 427
404/** 428/**
@@ -409,6 +433,9 @@ int cpuidle_register_device(struct cpuidle_device *dev)
409{ 433{
410 int ret; 434 int ret;
411 435
436 if (!dev)
437 return -EINVAL;
438
412 mutex_lock(&cpuidle_lock); 439 mutex_lock(&cpuidle_lock);
413 440
414 if ((ret = __cpuidle_register_device(dev))) { 441 if ((ret = __cpuidle_register_device(dev))) {
@@ -448,6 +475,8 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
448 wait_for_completion(&dev->kobj_unregister); 475 wait_for_completion(&dev->kobj_unregister);
449 per_cpu(cpuidle_devices, dev->cpu) = NULL; 476 per_cpu(cpuidle_devices, dev->cpu) = NULL;
450 477
478 cpuidle_coupled_unregister_device(dev);
479
451 cpuidle_resume_and_unlock(); 480 cpuidle_resume_and_unlock();
452 481
453 module_put(cpuidle_driver->owner); 482 module_put(cpuidle_driver->owner);
diff --git a/drivers/cpuidle/cpuidle.h b/drivers/cpuidle/cpuidle.h
index 7db186685c27..76e7f696ad8c 100644
--- a/drivers/cpuidle/cpuidle.h
+++ b/drivers/cpuidle/cpuidle.h
@@ -14,6 +14,8 @@ extern struct list_head cpuidle_detected_devices;
14extern struct mutex cpuidle_lock; 14extern struct mutex cpuidle_lock;
15extern spinlock_t cpuidle_driver_lock; 15extern spinlock_t cpuidle_driver_lock;
16extern int cpuidle_disabled(void); 16extern int cpuidle_disabled(void);
17extern int cpuidle_enter_state(struct cpuidle_device *dev,
18 struct cpuidle_driver *drv, int next_state);
17 19
18/* idle loop */ 20/* idle loop */
19extern void cpuidle_install_idle_handler(void); 21extern void cpuidle_install_idle_handler(void);
@@ -30,4 +32,34 @@ extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device);
30extern int cpuidle_add_sysfs(struct device *dev); 32extern int cpuidle_add_sysfs(struct device *dev);
31extern void cpuidle_remove_sysfs(struct device *dev); 33extern void cpuidle_remove_sysfs(struct device *dev);
32 34
35#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
36bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
37 struct cpuidle_driver *drv, int state);
38int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
39 struct cpuidle_driver *drv, int next_state);
40int cpuidle_coupled_register_device(struct cpuidle_device *dev);
41void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
42#else
43static inline bool cpuidle_state_is_coupled(struct cpuidle_device *dev,
44 struct cpuidle_driver *drv, int state)
45{
46 return false;
47}
48
49static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
50 struct cpuidle_driver *drv, int next_state)
51{
52 return -1;
53}
54
55static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
56{
57 return 0;
58}
59
60static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
61{
62}
63#endif
64
33#endif /* __DRIVER_CPUIDLE_H */ 65#endif /* __DRIVER_CPUIDLE_H */
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index fe95d5464a02..f559088869f6 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -170,6 +170,38 @@ static struct cpuidle_state snb_cstates[MWAIT_MAX_NUM_CSTATES] = {
170 .enter = &intel_idle }, 170 .enter = &intel_idle },
171}; 171};
172 172
173static struct cpuidle_state ivb_cstates[MWAIT_MAX_NUM_CSTATES] = {
174 { /* MWAIT C0 */ },
175 { /* MWAIT C1 */
176 .name = "C1-IVB",
177 .desc = "MWAIT 0x00",
178 .flags = CPUIDLE_FLAG_TIME_VALID,
179 .exit_latency = 1,
180 .target_residency = 1,
181 .enter = &intel_idle },
182 { /* MWAIT C2 */
183 .name = "C3-IVB",
184 .desc = "MWAIT 0x10",
185 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
186 .exit_latency = 59,
187 .target_residency = 156,
188 .enter = &intel_idle },
189 { /* MWAIT C3 */
190 .name = "C6-IVB",
191 .desc = "MWAIT 0x20",
192 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
193 .exit_latency = 80,
194 .target_residency = 300,
195 .enter = &intel_idle },
196 { /* MWAIT C4 */
197 .name = "C7-IVB",
198 .desc = "MWAIT 0x30",
199 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
200 .exit_latency = 87,
201 .target_residency = 300,
202 .enter = &intel_idle },
203};
204
173static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { 205static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = {
174 { /* MWAIT C0 */ }, 206 { /* MWAIT C0 */ },
175 { /* MWAIT C1 */ 207 { /* MWAIT C1 */
@@ -361,6 +393,10 @@ static const struct idle_cpu idle_cpu_snb = {
361 .state_table = snb_cstates, 393 .state_table = snb_cstates,
362}; 394};
363 395
396static const struct idle_cpu idle_cpu_ivb = {
397 .state_table = ivb_cstates,
398};
399
364#define ICPU(model, cpu) \ 400#define ICPU(model, cpu) \
365 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu } 401 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu }
366 402
@@ -376,6 +412,7 @@ static const struct x86_cpu_id intel_idle_ids[] = {
376 ICPU(0x2f, idle_cpu_nehalem), 412 ICPU(0x2f, idle_cpu_nehalem),
377 ICPU(0x2a, idle_cpu_snb), 413 ICPU(0x2a, idle_cpu_snb),
378 ICPU(0x2d, idle_cpu_snb), 414 ICPU(0x2d, idle_cpu_snb),
415 ICPU(0x3a, idle_cpu_ivb),
379 {} 416 {}
380}; 417};
381MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); 418MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 2fd9d36acd15..39abb150bdd4 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -660,7 +660,7 @@ static int acerhdf_register_thermal(void)
660 if (IS_ERR(cl_dev)) 660 if (IS_ERR(cl_dev))
661 return -EINVAL; 661 return -EINVAL;
662 662
663 thz_dev = thermal_zone_device_register("acerhdf", 1, NULL, 663 thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
664 &acerhdf_dev_ops, 0, 0, 0, 664 &acerhdf_dev_ops, 0, 0, 0,
665 (kernelmode) ? interval*1000 : 0); 665 (kernelmode) ? interval*1000 : 0);
666 if (IS_ERR(thz_dev)) 666 if (IS_ERR(thz_dev))
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index ea7422f6fa03..3a27113deda9 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -502,7 +502,7 @@ static int mid_thermal_probe(struct platform_device *pdev)
502 goto err; 502 goto err;
503 } 503 }
504 pinfo->tzd[i] = thermal_zone_device_register(name[i], 504 pinfo->tzd[i] = thermal_zone_device_register(name[i],
505 0, td_info, &tzd_ops, 0, 0, 0, 0); 505 0, 0, td_info, &tzd_ops, 0, 0, 0, 0);
506 if (IS_ERR(pinfo->tzd[i])) { 506 if (IS_ERR(pinfo->tzd[i])) {
507 kfree(td_info); 507 kfree(td_info);
508 ret = PTR_ERR(pinfo->tzd[i]); 508 ret = PTR_ERR(pinfo->tzd[i]);
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 514a691abea0..3ab2bd540b54 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -23,6 +23,7 @@ config SPEAR_THERMAL
23 bool "SPEAr thermal sensor driver" 23 bool "SPEAr thermal sensor driver"
24 depends on THERMAL 24 depends on THERMAL
25 depends on PLAT_SPEAR 25 depends on PLAT_SPEAR
26 depends on OF
26 help 27 help
27 Enable this to plug the SPEAr thermal sensor driver into the Linux 28 Enable this to plug the SPEAr thermal sensor driver into the Linux
28 thermal framework 29 thermal framework
diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
index c2e32df3b164..5f8ee39f2000 100644
--- a/drivers/thermal/spear_thermal.c
+++ b/drivers/thermal/spear_thermal.c
@@ -20,9 +20,9 @@
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/of.h>
23#include <linux/module.h> 24#include <linux/module.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/platform_data/spear_thermal.h>
26#include <linux/thermal.h> 26#include <linux/thermal.h>
27 27
28#define MD_FACTOR 1000 28#define MD_FACTOR 1000
@@ -103,21 +103,20 @@ static int spear_thermal_probe(struct platform_device *pdev)
103{ 103{
104 struct thermal_zone_device *spear_thermal = NULL; 104 struct thermal_zone_device *spear_thermal = NULL;
105 struct spear_thermal_dev *stdev; 105 struct spear_thermal_dev *stdev;
106 struct spear_thermal_pdata *pdata; 106 struct device_node *np = pdev->dev.of_node;
107 int ret = 0;
108 struct resource *stres = platform_get_resource(pdev, IORESOURCE_MEM, 0); 107 struct resource *stres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
108 int ret = 0, val;
109
110 if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) {
111 dev_err(&pdev->dev, "Failed: DT Pdata not passed\n");
112 return -EINVAL;
113 }
109 114
110 if (!stres) { 115 if (!stres) {
111 dev_err(&pdev->dev, "memory resource missing\n"); 116 dev_err(&pdev->dev, "memory resource missing\n");
112 return -ENODEV; 117 return -ENODEV;
113 } 118 }
114 119
115 pdata = dev_get_platdata(&pdev->dev);
116 if (!pdata) {
117 dev_err(&pdev->dev, "platform data is NULL\n");
118 return -EINVAL;
119 }
120
121 stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL); 120 stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL);
122 if (!stdev) { 121 if (!stdev) {
123 dev_err(&pdev->dev, "kzalloc fail\n"); 122 dev_err(&pdev->dev, "kzalloc fail\n");
@@ -144,10 +143,10 @@ static int spear_thermal_probe(struct platform_device *pdev)
144 goto put_clk; 143 goto put_clk;
145 } 144 }
146 145
147 stdev->flags = pdata->thermal_flags; 146 stdev->flags = val;
148 writel_relaxed(stdev->flags, stdev->thermal_base); 147 writel_relaxed(stdev->flags, stdev->thermal_base);
149 148
150 spear_thermal = thermal_zone_device_register("spear_thermal", 0, 149 spear_thermal = thermal_zone_device_register("spear_thermal", 0, 0,
151 stdev, &ops, 0, 0, 0, 0); 150 stdev, &ops, 0, 0, 0, 0);
152 if (IS_ERR(spear_thermal)) { 151 if (IS_ERR(spear_thermal)) {
153 dev_err(&pdev->dev, "thermal zone device is NULL\n"); 152 dev_err(&pdev->dev, "thermal zone device is NULL\n");
@@ -189,6 +188,12 @@ static int spear_thermal_exit(struct platform_device *pdev)
189 return 0; 188 return 0;
190} 189}
191 190
191static const struct of_device_id spear_thermal_id_table[] = {
192 { .compatible = "st,thermal-spear1340" },
193 {}
194};
195MODULE_DEVICE_TABLE(of, spear_thermal_id_table);
196
192static struct platform_driver spear_thermal_driver = { 197static struct platform_driver spear_thermal_driver = {
193 .probe = spear_thermal_probe, 198 .probe = spear_thermal_probe,
194 .remove = spear_thermal_exit, 199 .remove = spear_thermal_exit,
@@ -196,6 +201,7 @@ static struct platform_driver spear_thermal_driver = {
196 .name = "spear_thermal", 201 .name = "spear_thermal",
197 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
198 .pm = &spear_thermal_pm_ops, 203 .pm = &spear_thermal_pm_ops,
204 .of_match_table = of_match_ptr(spear_thermal_id_table),
199 }, 205 },
200}; 206};
201 207
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 022bacb71a7e..2d7a9fe8f365 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -196,6 +196,28 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr,
196} 196}
197 197
198static ssize_t 198static ssize_t
199trip_point_temp_store(struct device *dev, struct device_attribute *attr,
200 const char *buf, size_t count)
201{
202 struct thermal_zone_device *tz = to_thermal_zone(dev);
203 int trip, ret;
204 unsigned long temperature;
205
206 if (!tz->ops->set_trip_temp)
207 return -EPERM;
208
209 if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))
210 return -EINVAL;
211
212 if (kstrtoul(buf, 10, &temperature))
213 return -EINVAL;
214
215 ret = tz->ops->set_trip_temp(tz, trip, temperature);
216
217 return ret ? ret : count;
218}
219
220static ssize_t
199trip_point_temp_show(struct device *dev, struct device_attribute *attr, 221trip_point_temp_show(struct device *dev, struct device_attribute *attr,
200 char *buf) 222 char *buf)
201{ 223{
@@ -218,6 +240,52 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
218} 240}
219 241
220static ssize_t 242static ssize_t
243trip_point_hyst_store(struct device *dev, struct device_attribute *attr,
244 const char *buf, size_t count)
245{
246 struct thermal_zone_device *tz = to_thermal_zone(dev);
247 int trip, ret;
248 unsigned long temperature;
249
250 if (!tz->ops->set_trip_hyst)
251 return -EPERM;
252
253 if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
254 return -EINVAL;
255
256 if (kstrtoul(buf, 10, &temperature))
257 return -EINVAL;
258
259 /*
260 * We are not doing any check on the 'temperature' value
261 * here. The driver implementing 'set_trip_hyst' has to
262 * take care of this.
263 */
264 ret = tz->ops->set_trip_hyst(tz, trip, temperature);
265
266 return ret ? ret : count;
267}
268
269static ssize_t
270trip_point_hyst_show(struct device *dev, struct device_attribute *attr,
271 char *buf)
272{
273 struct thermal_zone_device *tz = to_thermal_zone(dev);
274 int trip, ret;
275 unsigned long temperature;
276
277 if (!tz->ops->get_trip_hyst)
278 return -EPERM;
279
280 if (!sscanf(attr->attr.name, "trip_point_%d_hyst", &trip))
281 return -EINVAL;
282
283 ret = tz->ops->get_trip_hyst(tz, trip, &temperature);
284
285 return ret ? ret : sprintf(buf, "%ld\n", temperature);
286}
287
288static ssize_t
221passive_store(struct device *dev, struct device_attribute *attr, 289passive_store(struct device *dev, struct device_attribute *attr,
222 const char *buf, size_t count) 290 const char *buf, size_t count)
223{ 291{
@@ -283,33 +351,6 @@ static DEVICE_ATTR(temp, 0444, temp_show, NULL);
283static DEVICE_ATTR(mode, 0644, mode_show, mode_store); 351static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
284static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store); 352static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store);
285 353
286static struct device_attribute trip_point_attrs[] = {
287 __ATTR(trip_point_0_type, 0444, trip_point_type_show, NULL),
288 __ATTR(trip_point_0_temp, 0444, trip_point_temp_show, NULL),
289 __ATTR(trip_point_1_type, 0444, trip_point_type_show, NULL),
290 __ATTR(trip_point_1_temp, 0444, trip_point_temp_show, NULL),
291 __ATTR(trip_point_2_type, 0444, trip_point_type_show, NULL),
292 __ATTR(trip_point_2_temp, 0444, trip_point_temp_show, NULL),
293 __ATTR(trip_point_3_type, 0444, trip_point_type_show, NULL),
294 __ATTR(trip_point_3_temp, 0444, trip_point_temp_show, NULL),
295 __ATTR(trip_point_4_type, 0444, trip_point_type_show, NULL),
296 __ATTR(trip_point_4_temp, 0444, trip_point_temp_show, NULL),
297 __ATTR(trip_point_5_type, 0444, trip_point_type_show, NULL),
298 __ATTR(trip_point_5_temp, 0444, trip_point_temp_show, NULL),
299 __ATTR(trip_point_6_type, 0444, trip_point_type_show, NULL),
300 __ATTR(trip_point_6_temp, 0444, trip_point_temp_show, NULL),
301 __ATTR(trip_point_7_type, 0444, trip_point_type_show, NULL),
302 __ATTR(trip_point_7_temp, 0444, trip_point_temp_show, NULL),
303 __ATTR(trip_point_8_type, 0444, trip_point_type_show, NULL),
304 __ATTR(trip_point_8_temp, 0444, trip_point_temp_show, NULL),
305 __ATTR(trip_point_9_type, 0444, trip_point_type_show, NULL),
306 __ATTR(trip_point_9_temp, 0444, trip_point_temp_show, NULL),
307 __ATTR(trip_point_10_type, 0444, trip_point_type_show, NULL),
308 __ATTR(trip_point_10_temp, 0444, trip_point_temp_show, NULL),
309 __ATTR(trip_point_11_type, 0444, trip_point_type_show, NULL),
310 __ATTR(trip_point_11_temp, 0444, trip_point_temp_show, NULL),
311};
312
313/* sys I/F for cooling device */ 354/* sys I/F for cooling device */
314#define to_cooling_device(_dev) \ 355#define to_cooling_device(_dev) \
315 container_of(_dev, struct thermal_cooling_device, device) 356 container_of(_dev, struct thermal_cooling_device, device)
@@ -1089,9 +1130,113 @@ leave:
1089EXPORT_SYMBOL(thermal_zone_device_update); 1130EXPORT_SYMBOL(thermal_zone_device_update);
1090 1131
1091/** 1132/**
1133 * create_trip_attrs - create attributes for trip points
1134 * @tz: the thermal zone device
1135 * @mask: Writeable trip point bitmap.
1136 */
1137static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
1138{
1139 int indx;
1140 int size = sizeof(struct thermal_attr) * tz->trips;
1141
1142 tz->trip_type_attrs = kzalloc(size, GFP_KERNEL);
1143 if (!tz->trip_type_attrs)
1144 return -ENOMEM;
1145
1146 tz->trip_temp_attrs = kzalloc(size, GFP_KERNEL);
1147 if (!tz->trip_temp_attrs) {
1148 kfree(tz->trip_type_attrs);
1149 return -ENOMEM;
1150 }
1151
1152 if (tz->ops->get_trip_hyst) {
1153 tz->trip_hyst_attrs = kzalloc(size, GFP_KERNEL);
1154 if (!tz->trip_hyst_attrs) {
1155 kfree(tz->trip_type_attrs);
1156 kfree(tz->trip_temp_attrs);
1157 return -ENOMEM;
1158 }
1159 }
1160
1161
1162 for (indx = 0; indx < tz->trips; indx++) {
1163 /* create trip type attribute */
1164 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH,
1165 "trip_point_%d_type", indx);
1166
1167 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr);
1168 tz->trip_type_attrs[indx].attr.attr.name =
1169 tz->trip_type_attrs[indx].name;
1170 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO;
1171 tz->trip_type_attrs[indx].attr.show = trip_point_type_show;
1172
1173 device_create_file(&tz->device,
1174 &tz->trip_type_attrs[indx].attr);
1175
1176 /* create trip temp attribute */
1177 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH,
1178 "trip_point_%d_temp", indx);
1179
1180 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr);
1181 tz->trip_temp_attrs[indx].attr.attr.name =
1182 tz->trip_temp_attrs[indx].name;
1183 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO;
1184 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show;
1185 if (mask & (1 << indx)) {
1186 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR;
1187 tz->trip_temp_attrs[indx].attr.store =
1188 trip_point_temp_store;
1189 }
1190
1191 device_create_file(&tz->device,
1192 &tz->trip_temp_attrs[indx].attr);
1193
1194 /* create Optional trip hyst attribute */
1195 if (!tz->ops->get_trip_hyst)
1196 continue;
1197 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH,
1198 "trip_point_%d_hyst", indx);
1199
1200 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr);
1201 tz->trip_hyst_attrs[indx].attr.attr.name =
1202 tz->trip_hyst_attrs[indx].name;
1203 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO;
1204 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show;
1205 if (tz->ops->set_trip_hyst) {
1206 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR;
1207 tz->trip_hyst_attrs[indx].attr.store =
1208 trip_point_hyst_store;
1209 }
1210
1211 device_create_file(&tz->device,
1212 &tz->trip_hyst_attrs[indx].attr);
1213 }
1214 return 0;
1215}
1216
1217static void remove_trip_attrs(struct thermal_zone_device *tz)
1218{
1219 int indx;
1220
1221 for (indx = 0; indx < tz->trips; indx++) {
1222 device_remove_file(&tz->device,
1223 &tz->trip_type_attrs[indx].attr);
1224 device_remove_file(&tz->device,
1225 &tz->trip_temp_attrs[indx].attr);
1226 if (tz->ops->get_trip_hyst)
1227 device_remove_file(&tz->device,
1228 &tz->trip_hyst_attrs[indx].attr);
1229 }
1230 kfree(tz->trip_type_attrs);
1231 kfree(tz->trip_temp_attrs);
1232 kfree(tz->trip_hyst_attrs);
1233}
1234
1235/**
1092 * thermal_zone_device_register - register a new thermal zone device 1236 * thermal_zone_device_register - register a new thermal zone device
1093 * @type: the thermal zone device type 1237 * @type: the thermal zone device type
1094 * @trips: the number of trip points the thermal zone support 1238 * @trips: the number of trip points the thermal zone support
1239 * @mask: a bit string indicating the writeablility of trip points
1095 * @devdata: private device data 1240 * @devdata: private device data
1096 * @ops: standard thermal zone device callbacks 1241 * @ops: standard thermal zone device callbacks
1097 * @tc1: thermal coefficient 1 for passive calculations 1242 * @tc1: thermal coefficient 1 for passive calculations
@@ -1107,7 +1252,7 @@ EXPORT_SYMBOL(thermal_zone_device_update);
1107 * section 11.1.5.1 of the ACPI specification 3.0. 1252 * section 11.1.5.1 of the ACPI specification 3.0.
1108 */ 1253 */
1109struct thermal_zone_device *thermal_zone_device_register(char *type, 1254struct thermal_zone_device *thermal_zone_device_register(char *type,
1110 int trips, void *devdata, 1255 int trips, int mask, void *devdata,
1111 const struct thermal_zone_device_ops *ops, 1256 const struct thermal_zone_device_ops *ops,
1112 int tc1, int tc2, int passive_delay, int polling_delay) 1257 int tc1, int tc2, int passive_delay, int polling_delay)
1113{ 1258{
@@ -1121,7 +1266,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
1121 if (strlen(type) >= THERMAL_NAME_LENGTH) 1266 if (strlen(type) >= THERMAL_NAME_LENGTH)
1122 return ERR_PTR(-EINVAL); 1267 return ERR_PTR(-EINVAL);
1123 1268
1124 if (trips > THERMAL_MAX_TRIPS || trips < 0) 1269 if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips)
1125 return ERR_PTR(-EINVAL); 1270 return ERR_PTR(-EINVAL);
1126 1271
1127 if (!ops || !ops->get_temp) 1272 if (!ops || !ops->get_temp)
@@ -1175,15 +1320,11 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
1175 goto unregister; 1320 goto unregister;
1176 } 1321 }
1177 1322
1323 result = create_trip_attrs(tz, mask);
1324 if (result)
1325 goto unregister;
1326
1178 for (count = 0; count < trips; count++) { 1327 for (count = 0; count < trips; count++) {
1179 result = device_create_file(&tz->device,
1180 &trip_point_attrs[count * 2]);
1181 if (result)
1182 break;
1183 result = device_create_file(&tz->device,
1184 &trip_point_attrs[count * 2 + 1]);
1185 if (result)
1186 goto unregister;
1187 tz->ops->get_trip_type(tz, count, &trip_type); 1328 tz->ops->get_trip_type(tz, count, &trip_type);
1188 if (trip_type == THERMAL_TRIP_PASSIVE) 1329 if (trip_type == THERMAL_TRIP_PASSIVE)
1189 passive = 1; 1330 passive = 1;
@@ -1232,7 +1373,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
1232{ 1373{
1233 struct thermal_cooling_device *cdev; 1374 struct thermal_cooling_device *cdev;
1234 struct thermal_zone_device *pos = NULL; 1375 struct thermal_zone_device *pos = NULL;
1235 int count;
1236 1376
1237 if (!tz) 1377 if (!tz)
1238 return; 1378 return;
@@ -1259,13 +1399,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
1259 device_remove_file(&tz->device, &dev_attr_temp); 1399 device_remove_file(&tz->device, &dev_attr_temp);
1260 if (tz->ops->get_mode) 1400 if (tz->ops->get_mode)
1261 device_remove_file(&tz->device, &dev_attr_mode); 1401 device_remove_file(&tz->device, &dev_attr_mode);
1402 remove_trip_attrs(tz);
1262 1403
1263 for (count = 0; count < tz->trips; count++) {
1264 device_remove_file(&tz->device,
1265 &trip_point_attrs[count * 2]);
1266 device_remove_file(&tz->device,
1267 &trip_point_attrs[count * 2 + 1]);
1268 }
1269 thermal_remove_hwmon_sysfs(tz); 1404 thermal_remove_hwmon_sysfs(tz);
1270 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); 1405 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
1271 idr_destroy(&tz->idr); 1406 idr_destroy(&tz->idr);
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 92d6e1d701ff..19503449814f 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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,7 @@
52#define AE_CODE_ACPI_TABLES 0x2000 52#define AE_CODE_ACPI_TABLES 0x2000
53#define AE_CODE_AML 0x3000 53#define AE_CODE_AML 0x3000
54#define AE_CODE_CONTROL 0x4000 54#define AE_CODE_CONTROL 0x4000
55#define AE_CODE_MAX 0x4000
55#define AE_CODE_MASK 0xF000 56#define AE_CODE_MASK 0xF000
56 57
57#define ACPI_SUCCESS(a) (!(a)) 58#define ACPI_SUCCESS(a) (!(a))
@@ -181,7 +182,7 @@
181 182
182/* Exception strings for acpi_format_exception */ 183/* Exception strings for acpi_format_exception */
183 184
184#ifdef DEFINE_ACPI_GLOBALS 185#ifdef ACPI_DEFINE_EXCEPTION_TABLE
185 186
186/* 187/*
187 * String versions of the exception codes above 188 * String versions of the exception codes above
@@ -295,6 +296,6 @@ char const *acpi_gbl_exception_names_ctrl[] = {
295 "AE_CTRL_PARSE_PENDING" 296 "AE_CTRL_PARSE_PENDING"
296}; 297};
297 298
298#endif /* ACPI GLOBALS */ 299#endif /* EXCEPTION_TABLE */
299 300
300#endif /* __ACEXCEP_H__ */ 301#endif /* __ACEXCEP_H__ */
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index b177f97f53b6..d988ac54f41e 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 d7bd661bfae7..2457ac849655 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -213,6 +213,8 @@
213#define ACPI_WARNING(plist) acpi_warning plist 213#define ACPI_WARNING(plist) acpi_warning plist
214#define ACPI_EXCEPTION(plist) acpi_exception plist 214#define ACPI_EXCEPTION(plist) acpi_exception plist
215#define ACPI_ERROR(plist) acpi_error plist 215#define ACPI_ERROR(plist) acpi_error plist
216#define ACPI_BIOS_WARNING(plist) acpi_bios_warning plist
217#define ACPI_BIOS_ERROR(plist) acpi_bios_error plist
216#define ACPI_DEBUG_OBJECT(obj,l,i) acpi_ex_do_debug_object(obj,l,i) 218#define ACPI_DEBUG_OBJECT(obj,l,i) acpi_ex_do_debug_object(obj,l,i)
217 219
218#else 220#else
@@ -223,6 +225,8 @@
223#define ACPI_WARNING(plist) 225#define ACPI_WARNING(plist)
224#define ACPI_EXCEPTION(plist) 226#define ACPI_EXCEPTION(plist)
225#define ACPI_ERROR(plist) 227#define ACPI_ERROR(plist)
228#define ACPI_BIOS_WARNING(plist)
229#define ACPI_BIOS_ERROR(plist)
226#define ACPI_DEBUG_OBJECT(obj,l,i) 230#define ACPI_DEBUG_OBJECT(obj,l,i)
227 231
228#endif /* ACPI_NO_ERROR_MESSAGES */ 232#endif /* ACPI_NO_ERROR_MESSAGES */
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index de39915f6b7f..c433d5e27679 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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_bus.h b/include/acpi/acpi_bus.h
index 01e2925523ea..bde976ee068d 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -50,6 +50,9 @@ acpi_evaluate_reference(acpi_handle handle,
50 acpi_string pathname, 50 acpi_string pathname,
51 struct acpi_object_list *arguments, 51 struct acpi_object_list *arguments,
52 struct acpi_handle_list *list); 52 struct acpi_handle_list *list);
53acpi_status
54acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
55 u32 status_code, struct acpi_buffer *status_buf);
53 56
54struct acpi_pld { 57struct acpi_pld {
55 unsigned int revision:7; /* 0 */ 58 unsigned int revision:7; /* 0 */
@@ -174,7 +177,8 @@ struct acpi_device_flags {
174 u32 suprise_removal_ok:1; 177 u32 suprise_removal_ok:1;
175 u32 power_manageable:1; 178 u32 power_manageable:1;
176 u32 performance_manageable:1; 179 u32 performance_manageable:1;
177 u32 reserved:24; 180 u32 eject_pending:1;
181 u32 reserved:23;
178}; 182};
179 183
180/* File System */ 184/* File System */
@@ -326,6 +330,11 @@ struct acpi_bus_event {
326 u32 data; 330 u32 data;
327}; 331};
328 332
333struct acpi_eject_event {
334 acpi_handle handle;
335 u32 event;
336};
337
329extern struct kobject *acpi_kobj; 338extern struct kobject *acpi_kobj;
330extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 339extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
331void acpi_bus_private_data_handler(acpi_handle, void *); 340void acpi_bus_private_data_handler(acpi_handle, void *);
@@ -363,6 +372,7 @@ int acpi_bus_register_driver(struct acpi_driver *driver);
363void acpi_bus_unregister_driver(struct acpi_driver *driver); 372void acpi_bus_unregister_driver(struct acpi_driver *driver);
364int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, 373int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
365 acpi_handle handle, int type); 374 acpi_handle handle, int type);
375void acpi_bus_hot_remove_device(void *context);
366int acpi_bus_trim(struct acpi_device *start, int rmdevice); 376int acpi_bus_trim(struct acpi_device *start, int rmdevice);
367int acpi_bus_start(struct acpi_device *device); 377int acpi_bus_start(struct acpi_device *device);
368acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); 378acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd);
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 21a5548c6686..0650f5fa7ce9 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -8,7 +8,7 @@
8 *****************************************************************************/ 8 *****************************************************************************/
9 9
10/* 10/*
11 * Copyright (C) 2000 - 2011, Intel Corp. 11 * Copyright (C) 2000 - 2012, Intel Corp.
12 * All rights reserved. 12 * All rights reserved.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -205,7 +205,7 @@ acpi_os_execute(acpi_execute_type type,
205acpi_status 205acpi_status
206acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context); 206acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context);
207 207
208void acpi_os_wait_events_complete(void *context); 208void acpi_os_wait_events_complete(void);
209 209
210void acpi_os_sleep(u64 milliseconds); 210void acpi_os_sleep(u64 milliseconds);
211 211
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 982110134672..2c744c7a5b3d 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2011, Intel Corp. 9 * Copyright (C) 2000 - 2012, 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
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20120320 50#define ACPI_CA_VERSION 0x20120711
51 51
52#include "acconfig.h" 52#include "acconfig.h"
53#include "actypes.h" 53#include "actypes.h"
@@ -154,15 +154,20 @@ void *acpi_callocate(u32 size);
154void acpi_free(void *address); 154void acpi_free(void *address);
155 155
156/* 156/*
157 * ACPI table manipulation interfaces 157 * ACPI table load/unload interfaces
158 */ 158 */
159acpi_status acpi_reallocate_root_table(void); 159acpi_status acpi_load_table(struct acpi_table_header *table);
160 160
161acpi_status acpi_find_root_pointer(acpi_size *rsdp_address); 161acpi_status acpi_unload_parent_table(acpi_handle object);
162 162
163acpi_status acpi_load_tables(void); 163acpi_status acpi_load_tables(void);
164 164
165acpi_status acpi_load_table(struct acpi_table_header *table_ptr); 165/*
166 * ACPI table manipulation interfaces
167 */
168acpi_status acpi_reallocate_root_table(void);
169
170acpi_status acpi_find_root_pointer(acpi_size *rsdp_address);
166 171
167acpi_status acpi_unload_table_id(acpi_owner_id id); 172acpi_status acpi_unload_table_id(acpi_owner_id id);
168 173
@@ -529,6 +534,14 @@ void ACPI_INTERNAL_VAR_XFACE
529acpi_info(const char *module_name, 534acpi_info(const char *module_name,
530 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); 535 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
531 536
537void ACPI_INTERNAL_VAR_XFACE
538acpi_bios_error(const char *module_name,
539 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
540
541void ACPI_INTERNAL_VAR_XFACE
542acpi_bios_warning(const char *module_name,
543 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
544
532/* 545/*
533 * Debug output 546 * Debug output
534 */ 547 */
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 3506e39a66b1..40349ae65464 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 * Definitions for Resource Attributes 48 * Definitions for Resource Attributes
49 */ 49 */
50typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ 50typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
51typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */ 51typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
52 52
53/* 53/*
54 * Memory Attributes 54 * Memory Attributes
@@ -332,7 +332,7 @@ struct acpi_resource_address64 {
332}; 332};
333 333
334struct acpi_resource_extended_address64 { 334struct acpi_resource_extended_address64 {
335 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD; 335 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_ID;
336 u64 granularity; 336 u64 granularity;
337 u64 minimum; 337 u64 minimum;
338 u64 maximum; 338 u64 maximum;
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 8dea54665dcf..59a73e1b2845 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -212,7 +212,7 @@ struct acpi_table_fadt {
212 u32 smi_command; /* 32-bit Port address of SMI command port */ 212 u32 smi_command; /* 32-bit Port address of SMI command port */
213 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ 213 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
214 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ 214 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
215 u8 S4bios_request; /* Value to write to SMI CMD to enter S4BIOS state */ 215 u8 s4_bios_request; /* Value to write to SMI CMD to enter S4BIOS state */
216 u8 pstate_control; /* Processor performance state control */ 216 u8 pstate_control; /* Processor performance state control */
217 u32 pm1a_event_block; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */ 217 u32 pm1a_event_block; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */
218 u32 pm1b_event_block; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */ 218 u32 pm1b_event_block; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */
@@ -230,8 +230,8 @@ struct acpi_table_fadt {
230 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */ 230 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */
231 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */ 231 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */
232 u8 cst_control; /* Support for the _CST object and C States change notification */ 232 u8 cst_control; /* Support for the _CST object and C States change notification */
233 u16 C2latency; /* Worst case HW latency to enter/exit C2 state */ 233 u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */
234 u16 C3latency; /* Worst case HW latency to enter/exit C3 state */ 234 u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */
235 u16 flush_size; /* Processor's memory cache line width, in bytes */ 235 u16 flush_size; /* Processor's memory cache line width, in bytes */
236 u16 flush_stride; /* Number of flush strides that need to be read */ 236 u16 flush_stride; /* Number of flush strides that need to be read */
237 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ 237 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */
@@ -291,7 +291,7 @@ struct acpi_table_fadt {
291#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ 291#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
292#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ 292#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
293#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ 293#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
294#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */ 294#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */
295#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */ 295#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */
296#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */ 296#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */
297 297
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 71e747beac8f..300d14e7c5d5 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -676,7 +676,7 @@ struct acpi_madt_local_apic {
676struct acpi_madt_io_apic { 676struct acpi_madt_io_apic {
677 struct acpi_subtable_header header; 677 struct acpi_subtable_header header;
678 u8 id; /* I/O APIC ID */ 678 u8 id; /* I/O APIC ID */
679 u8 reserved; /* Reserved - must be zero */ 679 u8 reserved; /* reserved - must be zero */
680 u32 address; /* APIC physical address */ 680 u32 address; /* APIC physical address */
681 u32 global_irq_base; /* Global system interrupt where INTI lines start */ 681 u32 global_irq_base; /* Global system interrupt where INTI lines start */
682}; 682};
@@ -794,11 +794,11 @@ struct acpi_madt_generic_interrupt {
794 794
795struct acpi_madt_generic_distributor { 795struct acpi_madt_generic_distributor {
796 struct acpi_subtable_header header; 796 struct acpi_subtable_header header;
797 u16 reserved; /* Reserved - must be zero */ 797 u16 reserved; /* reserved - must be zero */
798 u32 gic_id; 798 u32 gic_id;
799 u64 base_address; 799 u64 base_address;
800 u32 global_irq_base; 800 u32 global_irq_base;
801 u32 reserved2; /* Reserved - must be zero */ 801 u32 reserved2; /* reserved - must be zero */
802}; 802};
803 803
804/* 804/*
@@ -841,7 +841,7 @@ struct acpi_table_msct {
841 u64 max_address; /* Max physical address in system */ 841 u64 max_address; /* Max physical address in system */
842}; 842};
843 843
844/* Subtable - Maximum Proximity Domain Information. Version 1 */ 844/* subtable - Maximum Proximity Domain Information. Version 1 */
845 845
846struct acpi_msct_proximity { 846struct acpi_msct_proximity {
847 u8 revision; 847 u8 revision;
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 58bdd0545c5a..d9ceb3d31629 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -66,7 +66,7 @@
66#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ 66#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
67#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ 67#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
68#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ 68#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
69#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */ 69#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */
70#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ 70#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
71#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 71#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
72#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ 72#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
@@ -334,8 +334,8 @@ struct acpi_dmar_reserved_memory {
334 struct acpi_dmar_header header; 334 struct acpi_dmar_header header;
335 u16 reserved; 335 u16 reserved;
336 u16 segment; 336 u16 segment;
337 u64 base_address; /* 4_k aligned base address */ 337 u64 base_address; /* 4K aligned base address */
338 u64 end_address; /* 4_k aligned limit address */ 338 u64 end_address; /* 4K aligned limit address */
339}; 339};
340 340
341/* Masks for Flags field above */ 341/* Masks for Flags field above */
@@ -565,7 +565,7 @@ struct acpi_ivrs_hardware {
565/* Masks for Info field above */ 565/* Masks for Info field above */
566 566
567#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */ 567#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */
568#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_iD */ 568#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_ID */
569 569
570/* 570/*
571 * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure. 571 * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index c22ce80e9535..f65a0ed869eb 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 e8bcc4742e0e..3af87de6a68c 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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
@@ -173,7 +173,7 @@ typedef u64 acpi_physical_address;
173 * to indicate that special precautions must be taken to avoid alignment faults. 173 * to indicate that special precautions must be taken to avoid alignment faults.
174 * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) 174 * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
175 * 175 *
176 * Note: Em64_t and other X86-64 processors support misaligned transfers, 176 * Note: EM64T and other X86-64 processors support misaligned transfers,
177 * so there is no need to define this flag. 177 * so there is no need to define this flag.
178 */ 178 */
179#if defined (__IA64__) || defined (__ia64__) 179#if defined (__IA64__) || defined (__ia64__)
@@ -636,7 +636,7 @@ typedef u32 acpi_event_type;
636#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 636#define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
637 637
638/* 638/*
639 * Event Status - Per event 639 * Event status - Per event
640 * ------------- 640 * -------------
641 * The encoding of acpi_event_status is illustrated below. 641 * The encoding of acpi_event_status is illustrated below.
642 * Note that a set bit (1) indicates the property is TRUE 642 * Note that a set bit (1) indicates the property is TRUE
@@ -706,10 +706,14 @@ typedef u32 acpi_event_status;
706#define ACPI_DEVICE_NOTIFY 0x2 706#define ACPI_DEVICE_NOTIFY 0x2
707#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) 707#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
708#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 708#define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
709#define ACPI_NUM_NOTIFY_TYPES 2
709 710
710#define ACPI_MAX_SYS_NOTIFY 0x7F 711#define ACPI_MAX_SYS_NOTIFY 0x7F
711#define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF 712#define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF
712 713
714#define ACPI_SYSTEM_HANDLER_LIST 0 /* Used as index, must be SYSTEM_NOTIFY -1 */
715#define ACPI_DEVICE_HANDLER_LIST 1 /* Used as index, must be DEVICE_NOTIFY -1 */
716
713/* Address Space (Operation Region) Types */ 717/* Address Space (Operation Region) Types */
714 718
715typedef u8 acpi_adr_space_type; 719typedef u8 acpi_adr_space_type;
@@ -724,8 +728,9 @@ typedef u8 acpi_adr_space_type;
724#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7 728#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7
725#define ACPI_ADR_SPACE_GPIO (acpi_adr_space_type) 8 729#define ACPI_ADR_SPACE_GPIO (acpi_adr_space_type) 8
726#define ACPI_ADR_SPACE_GSBUS (acpi_adr_space_type) 9 730#define ACPI_ADR_SPACE_GSBUS (acpi_adr_space_type) 9
731#define ACPI_ADR_SPACE_PLATFORM_COMM (acpi_adr_space_type) 10
727 732
728#define ACPI_NUM_PREDEFINED_REGIONS 10 733#define ACPI_NUM_PREDEFINED_REGIONS 11
729 734
730/* 735/*
731 * Special Address Spaces 736 * Special Address Spaces
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 5af3ed52ef98..560a9f272f34 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 e228893591a9..72553b0c9f33 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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 6fbc4cab5834..7509be30ca01 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 - 2011, Intel Corp. 8 * Copyright (C) 2000 - 2012, 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/linux/acpi.h b/include/linux/acpi.h
index f421dd84f29d..b2b4d2ad7103 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -277,7 +277,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
277#define OSC_SB_PAD_SUPPORT 1 277#define OSC_SB_PAD_SUPPORT 1
278#define OSC_SB_PPC_OST_SUPPORT 2 278#define OSC_SB_PPC_OST_SUPPORT 2
279#define OSC_SB_PR3_SUPPORT 4 279#define OSC_SB_PR3_SUPPORT 4
280#define OSC_SB_CPUHP_OST_SUPPORT 8 280#define OSC_SB_HOTPLUG_OST_SUPPORT 8
281#define OSC_SB_APEI_SUPPORT 16 281#define OSC_SB_APEI_SUPPORT 16
282 282
283extern bool osc_sb_apei_support_acked; 283extern bool osc_sb_apei_support_acked;
@@ -309,6 +309,44 @@ extern bool osc_sb_apei_support_acked;
309 309
310extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 310extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
311 u32 *mask, u32 req); 311 u32 *mask, u32 req);
312
313/* Enable _OST when all relevant hotplug operations are enabled */
314#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \
315 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \
316 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \
317 (defined(CONFIG_ACPI_CONTAINER) || \
318 defined(CONFIG_ACPI_CONTAINER_MODULE))
319#define ACPI_HOTPLUG_OST
320#endif
321
322/* _OST Source Event Code (OSPM Action) */
323#define ACPI_OST_EC_OSPM_SHUTDOWN 0x100
324#define ACPI_OST_EC_OSPM_EJECT 0x103
325#define ACPI_OST_EC_OSPM_INSERTION 0x200
326
327/* _OST General Processing Status Code */
328#define ACPI_OST_SC_SUCCESS 0x0
329#define ACPI_OST_SC_NON_SPECIFIC_FAILURE 0x1
330#define ACPI_OST_SC_UNRECOGNIZED_NOTIFY 0x2
331
332/* _OST OS Shutdown Processing (0x100) Status Code */
333#define ACPI_OST_SC_OS_SHUTDOWN_DENIED 0x80
334#define ACPI_OST_SC_OS_SHUTDOWN_IN_PROGRESS 0x81
335#define ACPI_OST_SC_OS_SHUTDOWN_COMPLETED 0x82
336#define ACPI_OST_SC_OS_SHUTDOWN_NOT_SUPPORTED 0x83
337
338/* _OST Ejection Request (0x3, 0x103) Status Code */
339#define ACPI_OST_SC_EJECT_NOT_SUPPORTED 0x80
340#define ACPI_OST_SC_DEVICE_IN_USE 0x81
341#define ACPI_OST_SC_DEVICE_BUSY 0x82
342#define ACPI_OST_SC_EJECT_DEPENDENCY_BUSY 0x83
343#define ACPI_OST_SC_EJECT_IN_PROGRESS 0x84
344
345/* _OST Insertion Request (0x200) Status Code */
346#define ACPI_OST_SC_INSERT_IN_PROGRESS 0x80
347#define ACPI_OST_SC_DRIVER_LOAD_FAILURE 0x81
348#define ACPI_OST_SC_INSERT_NOT_SUPPORTED 0x82
349
312extern void acpi_early_init(void); 350extern void acpi_early_init(void);
313 351
314extern int acpi_nvs_register(__u64 start, __u64 size); 352extern int acpi_nvs_register(__u64 start, __u64 size);
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 89dcd30ac8ea..040b13b5c14a 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -58,6 +58,7 @@ struct cpuidle_state {
58 58
59/* Idle State Flags */ 59/* Idle State Flags */
60#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */ 60#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */
61#define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */
61 62
62#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 63#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
63 64
@@ -101,6 +102,12 @@ struct cpuidle_device {
101 struct list_head device_list; 102 struct list_head device_list;
102 struct kobject kobj; 103 struct kobject kobj;
103 struct completion kobj_unregister; 104 struct completion kobj_unregister;
105
106#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
107 int safe_state_index;
108 cpumask_t coupled_cpus;
109 struct cpuidle_coupled *coupled;
110#endif
104}; 111};
105 112
106DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 113DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
@@ -185,6 +192,10 @@ static inline int cpuidle_play_dead(void) {return -ENODEV; }
185 192
186#endif 193#endif
187 194
195#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
196void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a);
197#endif
198
188/****************************** 199/******************************
189 * CPUIDLE GOVERNOR INTERFACE * 200 * CPUIDLE GOVERNOR INTERFACE *
190 ******************************/ 201 ******************************/
diff --git a/include/linux/platform_data/spear_thermal.h b/include/linux/platform_data/spear_thermal.h
deleted file mode 100644
index 724f2e1cbbcb..000000000000
--- a/include/linux/platform_data/spear_thermal.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * SPEAr thermal driver platform data.
3 *
4 * Copyright (C) 2011-2012 ST Microelectronics
5 * Author: Vincenzo Frascino <vincenzo.frascino@st.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17#ifndef SPEAR_THERMAL_H
18#define SPEAR_THERMAL_H
19
20/* SPEAr Thermal Sensor Platform Data */
21struct spear_thermal_pdata {
22 /* flags used to enable thermal sensor */
23 unsigned int thermal_flags;
24};
25
26#endif /* SPEAR_THERMAL_H */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 796f1ff0388c..cfc8d908892e 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -58,6 +58,12 @@ struct thermal_zone_device_ops {
58 enum thermal_trip_type *); 58 enum thermal_trip_type *);
59 int (*get_trip_temp) (struct thermal_zone_device *, int, 59 int (*get_trip_temp) (struct thermal_zone_device *, int,
60 unsigned long *); 60 unsigned long *);
61 int (*set_trip_temp) (struct thermal_zone_device *, int,
62 unsigned long);
63 int (*get_trip_hyst) (struct thermal_zone_device *, int,
64 unsigned long *);
65 int (*set_trip_hyst) (struct thermal_zone_device *, int,
66 unsigned long);
61 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); 67 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
62 int (*notify) (struct thermal_zone_device *, int, 68 int (*notify) (struct thermal_zone_device *, int,
63 enum thermal_trip_type); 69 enum thermal_trip_type);
@@ -85,10 +91,18 @@ struct thermal_cooling_device {
85 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 91 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
86#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 92#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
87 93
94struct thermal_attr {
95 struct device_attribute attr;
96 char name[THERMAL_NAME_LENGTH];
97};
98
88struct thermal_zone_device { 99struct thermal_zone_device {
89 int id; 100 int id;
90 char type[THERMAL_NAME_LENGTH]; 101 char type[THERMAL_NAME_LENGTH];
91 struct device device; 102 struct device device;
103 struct thermal_attr *trip_temp_attrs;
104 struct thermal_attr *trip_type_attrs;
105 struct thermal_attr *trip_hyst_attrs;
92 void *devdata; 106 void *devdata;
93 int trips; 107 int trips;
94 int tc1; 108 int tc1;
@@ -137,9 +151,9 @@ enum {
137}; 151};
138#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) 152#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
139 153
140struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, 154struct thermal_zone_device *thermal_zone_device_register(char *, int, int,
141 const struct thermal_zone_device_ops *, int tc1, int tc2, 155 void *, const struct thermal_zone_device_ops *, int tc1,
142 int passive_freq, int polling_freq); 156 int tc2, int passive_freq, int polling_freq);
143void thermal_zone_device_unregister(struct thermal_zone_device *); 157void thermal_zone_device_unregister(struct thermal_zone_device *);
144 158
145int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 159int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
index fd8e1f1297aa..f85649554191 100644
--- a/tools/power/x86/turbostat/Makefile
+++ b/tools/power/x86/turbostat/Makefile
@@ -1,4 +1,5 @@
1turbostat : turbostat.c 1turbostat : turbostat.c
2CFLAGS += -Wall
2 3
3clean : 4clean :
4 rm -f turbostat 5 rm -f turbostat
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index adf175f61496..74e44507dfe9 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -27,7 +27,11 @@ supports an "invariant" TSC, plus the APERF and MPERF MSRs.
27on processors that additionally support C-state residency counters. 27on processors that additionally support C-state residency counters.
28 28
29.SS Options 29.SS Options
30The \fB-s\fP option prints only a 1-line summary for each sample interval. 30The \fB-s\fP option limits output to a 1-line system summary for each interval.
31.PP
32The \fB-c\fP option limits output to the 1st thread in each core.
33.PP
34The \fB-p\fP option limits output to the 1st thread in each package.
31.PP 35.PP
32The \fB-v\fP option increases verbosity. 36The \fB-v\fP option increases verbosity.
33.PP 37.PP
@@ -65,19 +69,19 @@ Subsequent rows show per-CPU statistics.
65.nf 69.nf
66[root@x980]# ./turbostat 70[root@x980]# ./turbostat
67cor CPU %c0 GHz TSC %c1 %c3 %c6 %pc3 %pc6 71cor CPU %c0 GHz TSC %c1 %c3 %c6 %pc3 %pc6
68 0.60 1.63 3.38 2.91 0.00 96.49 0.00 76.64 72 0.09 1.62 3.38 1.83 0.32 97.76 1.26 83.61
69 0 0 0.59 1.62 3.38 4.51 0.00 94.90 0.00 76.64 73 0 0 0.15 1.62 3.38 10.23 0.05 89.56 1.26 83.61
70 0 6 1.13 1.64 3.38 3.97 0.00 94.90 0.00 76.64 74 0 6 0.05 1.62 3.38 10.34
71 1 2 0.08 1.62 3.38 0.07 0.00 99.85 0.00 76.64 75 1 2 0.03 1.62 3.38 0.07 0.05 99.86
72 1 8 0.03 1.62 3.38 0.12 0.00 99.85 0.00 76.64 76 1 8 0.03 1.62 3.38 0.06
73 2 4 0.01 1.62 3.38 0.06 0.00 99.93 0.00 76.64 77 2 4 0.21 1.62 3.38 0.10 1.49 98.21
74 2 10 0.04 1.62 3.38 0.02 0.00 99.93 0.00 76.64 78 2 10 0.02 1.62 3.38 0.29
75 8 1 2.85 1.62 3.38 11.71 0.00 85.44 0.00 76.64 79 8 1 0.04 1.62 3.38 0.04 0.08 99.84
76 8 7 1.98 1.62 3.38 12.58 0.00 85.44 0.00 76.64 80 8 7 0.01 1.62 3.38 0.06
77 9 3 0.36 1.62 3.38 0.71 0.00 98.93 0.00 76.64 81 9 3 0.53 1.62 3.38 0.10 0.20 99.17
78 9 9 0.09 1.62 3.38 0.98 0.00 98.93 0.00 76.64 82 9 9 0.02 1.62 3.38 0.60
79 10 5 0.03 1.62 3.38 0.09 0.00 99.87 0.00 76.64 83 10 5 0.01 1.62 3.38 0.02 0.04 99.92
80 10 11 0.07 1.62 3.38 0.06 0.00 99.87 0.00 76.64 84 10 11 0.02 1.62 3.38 0.02
81.fi 85.fi
82.SH SUMMARY EXAMPLE 86.SH SUMMARY EXAMPLE
83The "-s" option prints the column headers just once, 87The "-s" option prints the column headers just once,
@@ -86,9 +90,10 @@ and then the one line system summary for each sample interval.
86.nf 90.nf
87[root@x980]# ./turbostat -s 91[root@x980]# ./turbostat -s
88 %c0 GHz TSC %c1 %c3 %c6 %pc3 %pc6 92 %c0 GHz TSC %c1 %c3 %c6 %pc3 %pc6
89 0.61 1.89 3.38 5.95 0.00 93.44 0.00 66.33 93 0.23 1.67 3.38 2.00 0.30 97.47 1.07 82.12
90 0.52 1.62 3.38 6.83 0.00 92.65 0.00 61.11 94 0.10 1.62 3.38 1.87 2.25 95.77 12.02 72.60
91 0.62 1.92 3.38 5.47 0.00 93.91 0.00 67.31 95 0.20 1.64 3.38 1.98 0.11 97.72 0.30 83.36
96 0.11 1.70 3.38 1.86 1.81 96.22 9.71 74.90
92.fi 97.fi
93.SH VERBOSE EXAMPLE 98.SH VERBOSE EXAMPLE
94The "-v" option adds verbosity to the output: 99The "-v" option adds verbosity to the output:
@@ -120,30 +125,28 @@ until ^C while the other CPUs are mostly idle:
120[root@x980 lenb]# ./turbostat cat /dev/zero > /dev/null 125[root@x980 lenb]# ./turbostat cat /dev/zero > /dev/null
121^C 126^C
122cor CPU %c0 GHz TSC %c1 %c3 %c6 %pc3 %pc6 127cor CPU %c0 GHz TSC %c1 %c3 %c6 %pc3 %pc6
123 8.63 3.64 3.38 14.46 0.49 76.42 0.00 0.00 128 8.86 3.61 3.38 15.06 31.19 44.89 0.00 0.00
124 0 0 0.34 3.36 3.38 99.66 0.00 0.00 0.00 0.00 129 0 0 1.46 3.22 3.38 16.84 29.48 52.22 0.00 0.00
125 0 6 99.96 3.64 3.38 0.04 0.00 0.00 0.00 0.00 130 0 6 0.21 3.06 3.38 18.09
126 1 2 0.14 3.50 3.38 1.75 2.04 96.07 0.00 0.00 131 1 2 0.53 3.33 3.38 2.80 46.40 50.27
127 1 8 0.38 3.57 3.38 1.51 2.04 96.07 0.00 0.00 132 1 8 0.89 3.47 3.38 2.44
128 2 4 0.01 2.65 3.38 0.06 0.00 99.93 0.00 0.00 133 2 4 1.36 3.43 3.38 9.04 23.71 65.89
129 2 10 0.03 2.12 3.38 0.04 0.00 99.93 0.00 0.00 134 2 10 0.18 2.86 3.38 10.22
130 8 1 0.91 3.59 3.38 35.27 0.92 62.90 0.00 0.00 135 8 1 0.04 2.87 3.38 99.96 0.01 0.00
131 8 7 1.61 3.63 3.38 34.57 0.92 62.90 0.00 0.00 136 8 7 99.72 3.63 3.38 0.27
132 9 3 0.04 3.38 3.38 0.20 0.00 99.76 0.00 0.00 137 9 3 0.31 3.21 3.38 7.64 56.55 35.50
133 9 9 0.04 3.29 3.38 0.20 0.00 99.76 0.00 0.00 138 9 9 0.08 2.95 3.38 7.88
134 10 5 0.03 3.08 3.38 0.12 0.00 99.85 0.00 0.00 139 10 5 1.42 3.43 3.38 2.14 30.99 65.44
135 10 11 0.05 3.07 3.38 0.10 0.00 99.85 0.00 0.00 140 10 11 0.16 2.88 3.38 3.40
1364.907015 sec
137
138.fi 141.fi
139Above the cycle soaker drives cpu6 up 3.6 Ghz turbo limit 142Above the cycle soaker drives cpu7 up its 3.6 Ghz turbo limit
140while the other processors are generally in various states of idle. 143while the other processors are generally in various states of idle.
141 144
142Note that cpu0 is an HT sibling sharing core0 145Note that cpu1 and cpu7 are HT siblings within core8.
143with cpu6, and thus it is unable to get to an idle state 146As cpu7 is very busy, it prevents its sibling, cpu1,
144deeper than c1 while cpu6 is busy. 147from entering a c-state deeper than c1.
145 148
146Note that turbostat reports average GHz of 3.64, while 149Note that turbostat reports average GHz of 3.63, while
147the arithmetic average of the GHz column above is lower. 150the arithmetic average of the GHz column above is lower.
148This is a weighted average, where the weight is %c0. ie. it is the total number of 151This is a weighted average, where the weight is %c0. ie. it is the total number of
149un-halted cycles elapsed per time divided by the number of CPUs. 152un-halted cycles elapsed per time divided by the number of CPUs.
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 16de7ad4850f..861d77190206 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -67,92 +67,119 @@ double bclk;
67unsigned int show_pkg; 67unsigned int show_pkg;
68unsigned int show_core; 68unsigned int show_core;
69unsigned int show_cpu; 69unsigned int show_cpu;
70unsigned int show_pkg_only;
71unsigned int show_core_only;
72char *output_buffer, *outp;
70 73
71int aperf_mperf_unstable; 74int aperf_mperf_unstable;
72int backwards_count; 75int backwards_count;
73char *progname; 76char *progname;
74 77
75int num_cpus; 78cpu_set_t *cpu_present_set, *cpu_affinity_set;
76cpu_set_t *cpu_present_set, *cpu_mask; 79size_t cpu_present_setsize, cpu_affinity_setsize;
77size_t cpu_present_setsize, cpu_mask_size; 80
78 81struct thread_data {
79struct counters { 82 unsigned long long tsc;
80 unsigned long long tsc; /* per thread */ 83 unsigned long long aperf;
81 unsigned long long aperf; /* per thread */ 84 unsigned long long mperf;
82 unsigned long long mperf; /* per thread */ 85 unsigned long long c1; /* derived */
83 unsigned long long c1; /* per thread (calculated) */ 86 unsigned long long extra_msr;
84 unsigned long long c3; /* per core */ 87 unsigned int cpu_id;
85 unsigned long long c6; /* per core */ 88 unsigned int flags;
86 unsigned long long c7; /* per core */ 89#define CPU_IS_FIRST_THREAD_IN_CORE 0x2
87 unsigned long long pc2; /* per package */ 90#define CPU_IS_FIRST_CORE_IN_PACKAGE 0x4
88 unsigned long long pc3; /* per package */ 91} *thread_even, *thread_odd;
89 unsigned long long pc6; /* per package */ 92
90 unsigned long long pc7; /* per package */ 93struct core_data {
91 unsigned long long extra_msr; /* per thread */ 94 unsigned long long c3;
92 int pkg; 95 unsigned long long c6;
93 int core; 96 unsigned long long c7;
94 int cpu; 97 unsigned int core_id;
95 struct counters *next; 98} *core_even, *core_odd;
96}; 99
97 100struct pkg_data {
98struct counters *cnt_even; 101 unsigned long long pc2;
99struct counters *cnt_odd; 102 unsigned long long pc3;
100struct counters *cnt_delta; 103 unsigned long long pc6;
101struct counters *cnt_average; 104 unsigned long long pc7;
102struct timeval tv_even; 105 unsigned int package_id;
103struct timeval tv_odd; 106} *package_even, *package_odd;
104struct timeval tv_delta; 107
105 108#define ODD_COUNTERS thread_odd, core_odd, package_odd
106int mark_cpu_present(int pkg, int core, int cpu) 109#define EVEN_COUNTERS thread_even, core_even, package_even
110
111#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
112 (thread_base + (pkg_no) * topo.num_cores_per_pkg * \
113 topo.num_threads_per_core + \
114 (core_no) * topo.num_threads_per_core + (thread_no))
115#define GET_CORE(core_base, core_no, pkg_no) \
116 (core_base + (pkg_no) * topo.num_cores_per_pkg + (core_no))
117#define GET_PKG(pkg_base, pkg_no) (pkg_base + pkg_no)
118
119struct system_summary {
120 struct thread_data threads;
121 struct core_data cores;
122 struct pkg_data packages;
123} sum, average;
124
125
126struct topo_params {
127 int num_packages;
128 int num_cpus;
129 int num_cores;
130 int max_cpu_num;
131 int num_cores_per_pkg;
132 int num_threads_per_core;
133} topo;
134
135struct timeval tv_even, tv_odd, tv_delta;
136
137void setup_all_buffers(void);
138
139int cpu_is_not_present(int cpu)
107{ 140{
108 CPU_SET_S(cpu, cpu_present_setsize, cpu_present_set); 141 return !CPU_ISSET_S(cpu, cpu_present_setsize, cpu_present_set);
109 return 0;
110} 142}
111
112/* 143/*
113 * cpu_mask_init(ncpus) 144 * run func(thread, core, package) in topology order
114 * 145 * skip non-present cpus
115 * allocate and clear cpu_mask
116 * set cpu_mask_size
117 */ 146 */
118void cpu_mask_init(int ncpus) 147
148int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg_data *),
149 struct thread_data *thread_base, struct core_data *core_base, struct pkg_data *pkg_base)
119{ 150{
120 cpu_mask = CPU_ALLOC(ncpus); 151 int retval, pkg_no, core_no, thread_no;
121 if (cpu_mask == NULL) {
122 perror("CPU_ALLOC");
123 exit(3);
124 }
125 cpu_mask_size = CPU_ALLOC_SIZE(ncpus);
126 CPU_ZERO_S(cpu_mask_size, cpu_mask);
127 152
128 /* 153 for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) {
129 * Allocate and initialize cpu_present_set 154 for (core_no = 0; core_no < topo.num_cores_per_pkg; ++core_no) {
130 */ 155 for (thread_no = 0; thread_no <
131 cpu_present_set = CPU_ALLOC(ncpus); 156 topo.num_threads_per_core; ++thread_no) {
132 if (cpu_present_set == NULL) { 157 struct thread_data *t;
133 perror("CPU_ALLOC"); 158 struct core_data *c;
134 exit(3); 159 struct pkg_data *p;
135 }
136 cpu_present_setsize = CPU_ALLOC_SIZE(ncpus);
137 CPU_ZERO_S(cpu_present_setsize, cpu_present_set);
138 for_all_cpus(mark_cpu_present);
139}
140 160
141void cpu_mask_uninit() 161 t = GET_THREAD(thread_base, thread_no, core_no, pkg_no);
142{ 162
143 CPU_FREE(cpu_mask); 163 if (cpu_is_not_present(t->cpu_id))
144 cpu_mask = NULL; 164 continue;
145 cpu_mask_size = 0; 165
146 CPU_FREE(cpu_present_set); 166 c = GET_CORE(core_base, core_no, pkg_no);
147 cpu_present_set = NULL; 167 p = GET_PKG(pkg_base, pkg_no);
148 cpu_present_setsize = 0; 168
169 retval = func(t, c, p);
170 if (retval)
171 return retval;
172 }
173 }
174 }
175 return 0;
149} 176}
150 177
151int cpu_migrate(int cpu) 178int cpu_migrate(int cpu)
152{ 179{
153 CPU_ZERO_S(cpu_mask_size, cpu_mask); 180 CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set);
154 CPU_SET_S(cpu, cpu_mask_size, cpu_mask); 181 CPU_SET_S(cpu, cpu_affinity_setsize, cpu_affinity_set);
155 if (sched_setaffinity(0, cpu_mask_size, cpu_mask) == -1) 182 if (sched_setaffinity(0, cpu_affinity_setsize, cpu_affinity_set) == -1)
156 return -1; 183 return -1;
157 else 184 else
158 return 0; 185 return 0;
@@ -181,67 +208,72 @@ int get_msr(int cpu, off_t offset, unsigned long long *msr)
181void print_header(void) 208void print_header(void)
182{ 209{
183 if (show_pkg) 210 if (show_pkg)
184 fprintf(stderr, "pk"); 211 outp += sprintf(outp, "pk");
185 if (show_pkg) 212 if (show_pkg)
186 fprintf(stderr, " "); 213 outp += sprintf(outp, " ");
187 if (show_core) 214 if (show_core)
188 fprintf(stderr, "cor"); 215 outp += sprintf(outp, "cor");
189 if (show_cpu) 216 if (show_cpu)
190 fprintf(stderr, " CPU"); 217 outp += sprintf(outp, " CPU");
191 if (show_pkg || show_core || show_cpu) 218 if (show_pkg || show_core || show_cpu)
192 fprintf(stderr, " "); 219 outp += sprintf(outp, " ");
193 if (do_nhm_cstates) 220 if (do_nhm_cstates)
194 fprintf(stderr, " %%c0"); 221 outp += sprintf(outp, " %%c0");
195 if (has_aperf) 222 if (has_aperf)
196 fprintf(stderr, " GHz"); 223 outp += sprintf(outp, " GHz");
197 fprintf(stderr, " TSC"); 224 outp += sprintf(outp, " TSC");
198 if (do_nhm_cstates) 225 if (do_nhm_cstates)
199 fprintf(stderr, " %%c1"); 226 outp += sprintf(outp, " %%c1");
200 if (do_nhm_cstates) 227 if (do_nhm_cstates)
201 fprintf(stderr, " %%c3"); 228 outp += sprintf(outp, " %%c3");
202 if (do_nhm_cstates) 229 if (do_nhm_cstates)
203 fprintf(stderr, " %%c6"); 230 outp += sprintf(outp, " %%c6");
204 if (do_snb_cstates) 231 if (do_snb_cstates)
205 fprintf(stderr, " %%c7"); 232 outp += sprintf(outp, " %%c7");
206 if (do_snb_cstates) 233 if (do_snb_cstates)
207 fprintf(stderr, " %%pc2"); 234 outp += sprintf(outp, " %%pc2");
208 if (do_nhm_cstates) 235 if (do_nhm_cstates)
209 fprintf(stderr, " %%pc3"); 236 outp += sprintf(outp, " %%pc3");
210 if (do_nhm_cstates) 237 if (do_nhm_cstates)
211 fprintf(stderr, " %%pc6"); 238 outp += sprintf(outp, " %%pc6");
212 if (do_snb_cstates) 239 if (do_snb_cstates)
213 fprintf(stderr, " %%pc7"); 240 outp += sprintf(outp, " %%pc7");
214 if (extra_msr_offset) 241 if (extra_msr_offset)
215 fprintf(stderr, " MSR 0x%x ", extra_msr_offset); 242 outp += sprintf(outp, " MSR 0x%x ", extra_msr_offset);
216 243
217 putc('\n', stderr); 244 outp += sprintf(outp, "\n");
218} 245}
219 246
220void dump_cnt(struct counters *cnt) 247int dump_counters(struct thread_data *t, struct core_data *c,
248 struct pkg_data *p)
221{ 249{
222 if (!cnt) 250 fprintf(stderr, "t %p, c %p, p %p\n", t, c, p);
223 return; 251
224 if (cnt->pkg) fprintf(stderr, "package: %d ", cnt->pkg); 252 if (t) {
225 if (cnt->core) fprintf(stderr, "core:: %d ", cnt->core); 253 fprintf(stderr, "CPU: %d flags 0x%x\n", t->cpu_id, t->flags);
226 if (cnt->cpu) fprintf(stderr, "CPU: %d ", cnt->cpu); 254 fprintf(stderr, "TSC: %016llX\n", t->tsc);
227 if (cnt->tsc) fprintf(stderr, "TSC: %016llX\n", cnt->tsc); 255 fprintf(stderr, "aperf: %016llX\n", t->aperf);
228 if (cnt->c3) fprintf(stderr, "c3: %016llX\n", cnt->c3); 256 fprintf(stderr, "mperf: %016llX\n", t->mperf);
229 if (cnt->c6) fprintf(stderr, "c6: %016llX\n", cnt->c6); 257 fprintf(stderr, "c1: %016llX\n", t->c1);
230 if (cnt->c7) fprintf(stderr, "c7: %016llX\n", cnt->c7); 258 fprintf(stderr, "msr0x%x: %016llX\n",
231 if (cnt->aperf) fprintf(stderr, "aperf: %016llX\n", cnt->aperf); 259 extra_msr_offset, t->extra_msr);
232 if (cnt->pc2) fprintf(stderr, "pc2: %016llX\n", cnt->pc2); 260 }
233 if (cnt->pc3) fprintf(stderr, "pc3: %016llX\n", cnt->pc3);
234 if (cnt->pc6) fprintf(stderr, "pc6: %016llX\n", cnt->pc6);
235 if (cnt->pc7) fprintf(stderr, "pc7: %016llX\n", cnt->pc7);
236 if (cnt->extra_msr) fprintf(stderr, "msr0x%x: %016llX\n", extra_msr_offset, cnt->extra_msr);
237}
238 261
239void dump_list(struct counters *cnt) 262 if (c) {
240{ 263 fprintf(stderr, "core: %d\n", c->core_id);
241 printf("dump_list 0x%p\n", cnt); 264 fprintf(stderr, "c3: %016llX\n", c->c3);
265 fprintf(stderr, "c6: %016llX\n", c->c6);
266 fprintf(stderr, "c7: %016llX\n", c->c7);
267 }
242 268
243 for (; cnt; cnt = cnt->next) 269 if (p) {
244 dump_cnt(cnt); 270 fprintf(stderr, "package: %d\n", p->package_id);
271 fprintf(stderr, "pc2: %016llX\n", p->pc2);
272 fprintf(stderr, "pc3: %016llX\n", p->pc3);
273 fprintf(stderr, "pc6: %016llX\n", p->pc6);
274 fprintf(stderr, "pc7: %016llX\n", p->pc7);
275 }
276 return 0;
245} 277}
246 278
247/* 279/*
@@ -253,321 +285,389 @@ void dump_list(struct counters *cnt)
253 * TSC: "TSC" 3 columns %3.2 285 * TSC: "TSC" 3 columns %3.2
254 * percentage " %pc3" %6.2 286 * percentage " %pc3" %6.2
255 */ 287 */
256void print_cnt(struct counters *p) 288int format_counters(struct thread_data *t, struct core_data *c,
289 struct pkg_data *p)
257{ 290{
258 double interval_float; 291 double interval_float;
259 292
293 /* if showing only 1st thread in core and this isn't one, bail out */
294 if (show_core_only && !(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
295 return 0;
296
297 /* if showing only 1st thread in pkg and this isn't one, bail out */
298 if (show_pkg_only && !(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
299 return 0;
300
260 interval_float = tv_delta.tv_sec + tv_delta.tv_usec/1000000.0; 301 interval_float = tv_delta.tv_sec + tv_delta.tv_usec/1000000.0;
261 302
262 /* topology columns, print blanks on 1st (average) line */ 303 /* topo columns, print blanks on 1st (average) line */
263 if (p == cnt_average) { 304 if (t == &average.threads) {
264 if (show_pkg) 305 if (show_pkg)
265 fprintf(stderr, " "); 306 outp += sprintf(outp, " ");
266 if (show_pkg && show_core) 307 if (show_pkg && show_core)
267 fprintf(stderr, " "); 308 outp += sprintf(outp, " ");
268 if (show_core) 309 if (show_core)
269 fprintf(stderr, " "); 310 outp += sprintf(outp, " ");
270 if (show_cpu) 311 if (show_cpu)
271 fprintf(stderr, " " " "); 312 outp += sprintf(outp, " " " ");
272 } else { 313 } else {
273 if (show_pkg) 314 if (show_pkg) {
274 fprintf(stderr, "%2d", p->pkg); 315 if (p)
316 outp += sprintf(outp, "%2d", p->package_id);
317 else
318 outp += sprintf(outp, " ");
319 }
275 if (show_pkg && show_core) 320 if (show_pkg && show_core)
276 fprintf(stderr, " "); 321 outp += sprintf(outp, " ");
277 if (show_core) 322 if (show_core) {
278 fprintf(stderr, "%3d", p->core); 323 if (c)
324 outp += sprintf(outp, "%3d", c->core_id);
325 else
326 outp += sprintf(outp, " ");
327 }
279 if (show_cpu) 328 if (show_cpu)
280 fprintf(stderr, " %3d", p->cpu); 329 outp += sprintf(outp, " %3d", t->cpu_id);
281 } 330 }
282 331
283 /* %c0 */ 332 /* %c0 */
284 if (do_nhm_cstates) { 333 if (do_nhm_cstates) {
285 if (show_pkg || show_core || show_cpu) 334 if (show_pkg || show_core || show_cpu)
286 fprintf(stderr, " "); 335 outp += sprintf(outp, " ");
287 if (!skip_c0) 336 if (!skip_c0)
288 fprintf(stderr, "%6.2f", 100.0 * p->mperf/p->tsc); 337 outp += sprintf(outp, "%6.2f", 100.0 * t->mperf/t->tsc);
289 else 338 else
290 fprintf(stderr, " ****"); 339 outp += sprintf(outp, " ****");
291 } 340 }
292 341
293 /* GHz */ 342 /* GHz */
294 if (has_aperf) { 343 if (has_aperf) {
295 if (!aperf_mperf_unstable) { 344 if (!aperf_mperf_unstable) {
296 fprintf(stderr, " %3.2f", 345 outp += sprintf(outp, " %3.2f",
297 1.0 * p->tsc / units * p->aperf / 346 1.0 * t->tsc / units * t->aperf /
298 p->mperf / interval_float); 347 t->mperf / interval_float);
299 } else { 348 } else {
300 if (p->aperf > p->tsc || p->mperf > p->tsc) { 349 if (t->aperf > t->tsc || t->mperf > t->tsc) {
301 fprintf(stderr, " ***"); 350 outp += sprintf(outp, " ***");
302 } else { 351 } else {
303 fprintf(stderr, "%3.1f*", 352 outp += sprintf(outp, "%3.1f*",
304 1.0 * p->tsc / 353 1.0 * t->tsc /
305 units * p->aperf / 354 units * t->aperf /
306 p->mperf / interval_float); 355 t->mperf / interval_float);
307 } 356 }
308 } 357 }
309 } 358 }
310 359
311 /* TSC */ 360 /* TSC */
312 fprintf(stderr, "%5.2f", 1.0 * p->tsc/units/interval_float); 361 outp += sprintf(outp, "%5.2f", 1.0 * t->tsc/units/interval_float);
313 362
314 if (do_nhm_cstates) { 363 if (do_nhm_cstates) {
315 if (!skip_c1) 364 if (!skip_c1)
316 fprintf(stderr, " %6.2f", 100.0 * p->c1/p->tsc); 365 outp += sprintf(outp, " %6.2f", 100.0 * t->c1/t->tsc);
317 else 366 else
318 fprintf(stderr, " ****"); 367 outp += sprintf(outp, " ****");
319 } 368 }
369
370 /* print per-core data only for 1st thread in core */
371 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
372 goto done;
373
320 if (do_nhm_cstates) 374 if (do_nhm_cstates)
321 fprintf(stderr, " %6.2f", 100.0 * p->c3/p->tsc); 375 outp += sprintf(outp, " %6.2f", 100.0 * c->c3/t->tsc);
322 if (do_nhm_cstates) 376 if (do_nhm_cstates)
323 fprintf(stderr, " %6.2f", 100.0 * p->c6/p->tsc); 377 outp += sprintf(outp, " %6.2f", 100.0 * c->c6/t->tsc);
324 if (do_snb_cstates) 378 if (do_snb_cstates)
325 fprintf(stderr, " %6.2f", 100.0 * p->c7/p->tsc); 379 outp += sprintf(outp, " %6.2f", 100.0 * c->c7/t->tsc);
380
381 /* print per-package data only for 1st core in package */
382 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
383 goto done;
384
326 if (do_snb_cstates) 385 if (do_snb_cstates)
327 fprintf(stderr, " %6.2f", 100.0 * p->pc2/p->tsc); 386 outp += sprintf(outp, " %6.2f", 100.0 * p->pc2/t->tsc);
328 if (do_nhm_cstates) 387 if (do_nhm_cstates)
329 fprintf(stderr, " %6.2f", 100.0 * p->pc3/p->tsc); 388 outp += sprintf(outp, " %6.2f", 100.0 * p->pc3/t->tsc);
330 if (do_nhm_cstates) 389 if (do_nhm_cstates)
331 fprintf(stderr, " %6.2f", 100.0 * p->pc6/p->tsc); 390 outp += sprintf(outp, " %6.2f", 100.0 * p->pc6/t->tsc);
332 if (do_snb_cstates) 391 if (do_snb_cstates)
333 fprintf(stderr, " %6.2f", 100.0 * p->pc7/p->tsc); 392 outp += sprintf(outp, " %6.2f", 100.0 * p->pc7/t->tsc);
393done:
334 if (extra_msr_offset) 394 if (extra_msr_offset)
335 fprintf(stderr, " 0x%016llx", p->extra_msr); 395 outp += sprintf(outp, " 0x%016llx", t->extra_msr);
336 putc('\n', stderr); 396 outp += sprintf(outp, "\n");
397
398 return 0;
337} 399}
338 400
339void print_counters(struct counters *counters) 401void flush_stdout()
402{
403 fputs(output_buffer, stdout);
404 outp = output_buffer;
405}
406void flush_stderr()
407{
408 fputs(output_buffer, stderr);
409 outp = output_buffer;
410}
411void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
340{ 412{
341 struct counters *cnt;
342 static int printed; 413 static int printed;
343 414
344
345 if (!printed || !summary_only) 415 if (!printed || !summary_only)
346 print_header(); 416 print_header();
347 417
348 if (num_cpus > 1) 418 if (topo.num_cpus > 1)
349 print_cnt(cnt_average); 419 format_counters(&average.threads, &average.cores,
420 &average.packages);
350 421
351 printed = 1; 422 printed = 1;
352 423
353 if (summary_only) 424 if (summary_only)
354 return; 425 return;
355 426
356 for (cnt = counters; cnt != NULL; cnt = cnt->next) 427 for_all_cpus(format_counters, t, c, p);
357 print_cnt(cnt);
358
359} 428}
360 429
361#define SUBTRACT_COUNTER(after, before, delta) (delta = (after - before), (before > after)) 430void
431delta_package(struct pkg_data *new, struct pkg_data *old)
432{
433 old->pc2 = new->pc2 - old->pc2;
434 old->pc3 = new->pc3 - old->pc3;
435 old->pc6 = new->pc6 - old->pc6;
436 old->pc7 = new->pc7 - old->pc7;
437}
362 438
363int compute_delta(struct counters *after, 439void
364 struct counters *before, struct counters *delta) 440delta_core(struct core_data *new, struct core_data *old)
365{ 441{
366 int errors = 0; 442 old->c3 = new->c3 - old->c3;
367 int perf_err = 0; 443 old->c6 = new->c6 - old->c6;
444 old->c7 = new->c7 - old->c7;
445}
368 446
369 skip_c0 = skip_c1 = 0; 447/*
448 * old = new - old
449 */
450void
451delta_thread(struct thread_data *new, struct thread_data *old,
452 struct core_data *core_delta)
453{
454 old->tsc = new->tsc - old->tsc;
455
456 /* check for TSC < 1 Mcycles over interval */
457 if (old->tsc < (1000 * 1000)) {
458 fprintf(stderr, "Insanely slow TSC rate, TSC stops in idle?\n");
459 fprintf(stderr, "You can disable all c-states by booting with \"idle=poll\"\n");
460 fprintf(stderr, "or just the deep ones with \"processor.max_cstate=1\"\n");
461 exit(-3);
462 }
370 463
371 for ( ; after && before && delta; 464 old->c1 = new->c1 - old->c1;
372 after = after->next, before = before->next, delta = delta->next) {
373 if (before->cpu != after->cpu) {
374 printf("cpu configuration changed: %d != %d\n",
375 before->cpu, after->cpu);
376 return -1;
377 }
378 465
379 if (SUBTRACT_COUNTER(after->tsc, before->tsc, delta->tsc)) { 466 if ((new->aperf > old->aperf) && (new->mperf > old->mperf)) {
380 fprintf(stderr, "cpu%d TSC went backwards %llX to %llX\n", 467 old->aperf = new->aperf - old->aperf;
381 before->cpu, before->tsc, after->tsc); 468 old->mperf = new->mperf - old->mperf;
382 errors++; 469 } else {
383 }
384 /* check for TSC < 1 Mcycles over interval */
385 if (delta->tsc < (1000 * 1000)) {
386 fprintf(stderr, "Insanely slow TSC rate,"
387 " TSC stops in idle?\n");
388 fprintf(stderr, "You can disable all c-states"
389 " by booting with \"idle=poll\"\n");
390 fprintf(stderr, "or just the deep ones with"
391 " \"processor.max_cstate=1\"\n");
392 exit(-3);
393 }
394 if (SUBTRACT_COUNTER(after->c3, before->c3, delta->c3)) {
395 fprintf(stderr, "cpu%d c3 counter went backwards %llX to %llX\n",
396 before->cpu, before->c3, after->c3);
397 errors++;
398 }
399 if (SUBTRACT_COUNTER(after->c6, before->c6, delta->c6)) {
400 fprintf(stderr, "cpu%d c6 counter went backwards %llX to %llX\n",
401 before->cpu, before->c6, after->c6);
402 errors++;
403 }
404 if (SUBTRACT_COUNTER(after->c7, before->c7, delta->c7)) {
405 fprintf(stderr, "cpu%d c7 counter went backwards %llX to %llX\n",
406 before->cpu, before->c7, after->c7);
407 errors++;
408 }
409 if (SUBTRACT_COUNTER(after->pc2, before->pc2, delta->pc2)) {
410 fprintf(stderr, "cpu%d pc2 counter went backwards %llX to %llX\n",
411 before->cpu, before->pc2, after->pc2);
412 errors++;
413 }
414 if (SUBTRACT_COUNTER(after->pc3, before->pc3, delta->pc3)) {
415 fprintf(stderr, "cpu%d pc3 counter went backwards %llX to %llX\n",
416 before->cpu, before->pc3, after->pc3);
417 errors++;
418 }
419 if (SUBTRACT_COUNTER(after->pc6, before->pc6, delta->pc6)) {
420 fprintf(stderr, "cpu%d pc6 counter went backwards %llX to %llX\n",
421 before->cpu, before->pc6, after->pc6);
422 errors++;
423 }
424 if (SUBTRACT_COUNTER(after->pc7, before->pc7, delta->pc7)) {
425 fprintf(stderr, "cpu%d pc7 counter went backwards %llX to %llX\n",
426 before->cpu, before->pc7, after->pc7);
427 errors++;
428 }
429 470
430 perf_err = SUBTRACT_COUNTER(after->aperf, before->aperf, delta->aperf); 471 if (!aperf_mperf_unstable) {
431 if (perf_err) { 472 fprintf(stderr, "%s: APERF or MPERF went backwards *\n", progname);
432 fprintf(stderr, "cpu%d aperf counter went backwards %llX to %llX\n", 473 fprintf(stderr, "* Frequency results do not cover entire interval *\n");
433 before->cpu, before->aperf, after->aperf); 474 fprintf(stderr, "* fix this by running Linux-2.6.30 or later *\n");
434 }
435 perf_err |= SUBTRACT_COUNTER(after->mperf, before->mperf, delta->mperf);
436 if (perf_err) {
437 fprintf(stderr, "cpu%d mperf counter went backwards %llX to %llX\n",
438 before->cpu, before->mperf, after->mperf);
439 }
440 if (perf_err) {
441 if (!aperf_mperf_unstable) {
442 fprintf(stderr, "%s: APERF or MPERF went backwards *\n", progname);
443 fprintf(stderr, "* Frequency results do not cover entire interval *\n");
444 fprintf(stderr, "* fix this by running Linux-2.6.30 or later *\n");
445 475
446 aperf_mperf_unstable = 1; 476 aperf_mperf_unstable = 1;
447 }
448 /*
449 * mperf delta is likely a huge "positive" number
450 * can not use it for calculating c0 time
451 */
452 skip_c0 = 1;
453 skip_c1 = 1;
454 } 477 }
455
456 /* 478 /*
457 * As mperf and tsc collection are not atomic, 479 * mperf delta is likely a huge "positive" number
458 * it is possible for mperf's non-halted cycles 480 * can not use it for calculating c0 time
459 * to exceed TSC's all cycles: show c1 = 0% in that case.
460 */ 481 */
461 if (delta->mperf > delta->tsc) 482 skip_c0 = 1;
462 delta->c1 = 0; 483 skip_c1 = 1;
463 else /* normal case, derive c1 */ 484 }
464 delta->c1 = delta->tsc - delta->mperf
465 - delta->c3 - delta->c6 - delta->c7;
466 485
467 if (delta->mperf == 0)
468 delta->mperf = 1; /* divide by 0 protection */
469 486
470 /* 487 /*
471 * for "extra msr", just copy the latest w/o subtracting 488 * As counter collection is not atomic,
472 */ 489 * it is possible for mperf's non-halted cycles + idle states
473 delta->extra_msr = after->extra_msr; 490 * to exceed TSC's all cycles: show c1 = 0% in that case.
474 if (errors) { 491 */
475 fprintf(stderr, "ERROR cpu%d before:\n", before->cpu); 492 if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > old->tsc)
476 dump_cnt(before); 493 old->c1 = 0;
477 fprintf(stderr, "ERROR cpu%d after:\n", before->cpu); 494 else {
478 dump_cnt(after); 495 /* normal case, derive c1 */
479 errors = 0; 496 old->c1 = old->tsc - old->mperf - core_delta->c3
480 } 497 - core_delta->c6 - core_delta->c7;
481 } 498 }
499
500 if (old->mperf == 0) {
501 if (verbose > 1) fprintf(stderr, "cpu%d MPERF 0!\n", old->cpu_id);
502 old->mperf = 1; /* divide by 0 protection */
503 }
504
505 /*
506 * for "extra msr", just copy the latest w/o subtracting
507 */
508 old->extra_msr = new->extra_msr;
509}
510
511int delta_cpu(struct thread_data *t, struct core_data *c,
512 struct pkg_data *p, struct thread_data *t2,
513 struct core_data *c2, struct pkg_data *p2)
514{
515 /* calculate core delta only for 1st thread in core */
516 if (t->flags & CPU_IS_FIRST_THREAD_IN_CORE)
517 delta_core(c, c2);
518
519 /* always calculate thread delta */
520 delta_thread(t, t2, c2); /* c2 is core delta */
521
522 /* calculate package delta only for 1st core in package */
523 if (t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE)
524 delta_package(p, p2);
525
482 return 0; 526 return 0;
483} 527}
484 528
485void compute_average(struct counters *delta, struct counters *avg) 529void clear_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
530{
531 t->tsc = 0;
532 t->aperf = 0;
533 t->mperf = 0;
534 t->c1 = 0;
535
536 /* tells format_counters to dump all fields from this set */
537 t->flags = CPU_IS_FIRST_THREAD_IN_CORE | CPU_IS_FIRST_CORE_IN_PACKAGE;
538
539 c->c3 = 0;
540 c->c6 = 0;
541 c->c7 = 0;
542
543 p->pc2 = 0;
544 p->pc3 = 0;
545 p->pc6 = 0;
546 p->pc7 = 0;
547}
548int sum_counters(struct thread_data *t, struct core_data *c,
549 struct pkg_data *p)
486{ 550{
487 struct counters *sum; 551 average.threads.tsc += t->tsc;
552 average.threads.aperf += t->aperf;
553 average.threads.mperf += t->mperf;
554 average.threads.c1 += t->c1;
488 555
489 sum = calloc(1, sizeof(struct counters)); 556 /* sum per-core values only for 1st thread in core */
490 if (sum == NULL) { 557 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
491 perror("calloc sum"); 558 return 0;
492 exit(1);
493 }
494 559
495 for (; delta; delta = delta->next) { 560 average.cores.c3 += c->c3;
496 sum->tsc += delta->tsc; 561 average.cores.c6 += c->c6;
497 sum->c1 += delta->c1; 562 average.cores.c7 += c->c7;
498 sum->c3 += delta->c3; 563
499 sum->c6 += delta->c6; 564 /* sum per-pkg values only for 1st core in pkg */
500 sum->c7 += delta->c7; 565 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
501 sum->aperf += delta->aperf; 566 return 0;
502 sum->mperf += delta->mperf; 567
503 sum->pc2 += delta->pc2; 568 average.packages.pc2 += p->pc2;
504 sum->pc3 += delta->pc3; 569 average.packages.pc3 += p->pc3;
505 sum->pc6 += delta->pc6; 570 average.packages.pc6 += p->pc6;
506 sum->pc7 += delta->pc7; 571 average.packages.pc7 += p->pc7;
507 } 572
508 avg->tsc = sum->tsc/num_cpus; 573 return 0;
509 avg->c1 = sum->c1/num_cpus; 574}
510 avg->c3 = sum->c3/num_cpus; 575/*
511 avg->c6 = sum->c6/num_cpus; 576 * sum the counters for all cpus in the system
512 avg->c7 = sum->c7/num_cpus; 577 * compute the weighted average
513 avg->aperf = sum->aperf/num_cpus; 578 */
514 avg->mperf = sum->mperf/num_cpus; 579void compute_average(struct thread_data *t, struct core_data *c,
515 avg->pc2 = sum->pc2/num_cpus; 580 struct pkg_data *p)
516 avg->pc3 = sum->pc3/num_cpus; 581{
517 avg->pc6 = sum->pc6/num_cpus; 582 clear_counters(&average.threads, &average.cores, &average.packages);
518 avg->pc7 = sum->pc7/num_cpus; 583
519 584 for_all_cpus(sum_counters, t, c, p);
520 free(sum); 585
586 average.threads.tsc /= topo.num_cpus;
587 average.threads.aperf /= topo.num_cpus;
588 average.threads.mperf /= topo.num_cpus;
589 average.threads.c1 /= topo.num_cpus;
590
591 average.cores.c3 /= topo.num_cores;
592 average.cores.c6 /= topo.num_cores;
593 average.cores.c7 /= topo.num_cores;
594
595 average.packages.pc2 /= topo.num_packages;
596 average.packages.pc3 /= topo.num_packages;
597 average.packages.pc6 /= topo.num_packages;
598 average.packages.pc7 /= topo.num_packages;
521} 599}
522 600
523int get_counters(struct counters *cnt) 601static unsigned long long rdtsc(void)
524{ 602{
525 for ( ; cnt; cnt = cnt->next) { 603 unsigned int low, high;
526 604
527 if (cpu_migrate(cnt->cpu)) 605 asm volatile("rdtsc" : "=a" (low), "=d" (high));
528 return -1;
529 606
530 if (get_msr(cnt->cpu, MSR_TSC, &cnt->tsc)) 607 return low | ((unsigned long long)high) << 32;
531 return -1; 608}
532 609
533 if (has_aperf) {
534 if (get_msr(cnt->cpu, MSR_APERF, &cnt->aperf))
535 return -1;
536 if (get_msr(cnt->cpu, MSR_MPERF, &cnt->mperf))
537 return -1;
538 }
539 610
540 if (do_nhm_cstates) { 611/*
541 if (get_msr(cnt->cpu, MSR_CORE_C3_RESIDENCY, &cnt->c3)) 612 * get_counters(...)
542 return -1; 613 * migrate to cpu
543 if (get_msr(cnt->cpu, MSR_CORE_C6_RESIDENCY, &cnt->c6)) 614 * acquire and record local counters for that cpu
544 return -1; 615 */
545 } 616int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
617{
618 int cpu = t->cpu_id;
546 619
547 if (do_snb_cstates) 620 if (cpu_migrate(cpu))
548 if (get_msr(cnt->cpu, MSR_CORE_C7_RESIDENCY, &cnt->c7)) 621 return -1;
549 return -1;
550 622
551 if (do_nhm_cstates) { 623 t->tsc = rdtsc(); /* we are running on local CPU of interest */
552 if (get_msr(cnt->cpu, MSR_PKG_C3_RESIDENCY, &cnt->pc3)) 624
553 return -1; 625 if (has_aperf) {
554 if (get_msr(cnt->cpu, MSR_PKG_C6_RESIDENCY, &cnt->pc6)) 626 if (get_msr(cpu, MSR_APERF, &t->aperf))
555 return -1; 627 return -3;
556 } 628 if (get_msr(cpu, MSR_MPERF, &t->mperf))
557 if (do_snb_cstates) { 629 return -4;
558 if (get_msr(cnt->cpu, MSR_PKG_C2_RESIDENCY, &cnt->pc2)) 630 }
559 return -1; 631
560 if (get_msr(cnt->cpu, MSR_PKG_C7_RESIDENCY, &cnt->pc7)) 632 if (extra_msr_offset)
561 return -1; 633 if (get_msr(cpu, extra_msr_offset, &t->extra_msr))
562 } 634 return -5;
563 if (extra_msr_offset) 635
564 if (get_msr(cnt->cpu, extra_msr_offset, &cnt->extra_msr)) 636 /* collect core counters only for 1st thread in core */
565 return -1; 637 if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE))
638 return 0;
639
640 if (do_nhm_cstates) {
641 if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3))
642 return -6;
643 if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6))
644 return -7;
645 }
646
647 if (do_snb_cstates)
648 if (get_msr(cpu, MSR_CORE_C7_RESIDENCY, &c->c7))
649 return -8;
650
651 /* collect package counters only for 1st core in package */
652 if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
653 return 0;
654
655 if (do_nhm_cstates) {
656 if (get_msr(cpu, MSR_PKG_C3_RESIDENCY, &p->pc3))
657 return -9;
658 if (get_msr(cpu, MSR_PKG_C6_RESIDENCY, &p->pc6))
659 return -10;
660 }
661 if (do_snb_cstates) {
662 if (get_msr(cpu, MSR_PKG_C2_RESIDENCY, &p->pc2))
663 return -11;
664 if (get_msr(cpu, MSR_PKG_C7_RESIDENCY, &p->pc7))
665 return -12;
566 } 666 }
567 return 0; 667 return 0;
568} 668}
569 669
570void print_nehalem_info(void) 670void print_verbose_header(void)
571{ 671{
572 unsigned long long msr; 672 unsigned long long msr;
573 unsigned int ratio; 673 unsigned int ratio;
@@ -615,143 +715,82 @@ void print_nehalem_info(void)
615 715
616} 716}
617 717
618void free_counter_list(struct counters *list) 718void free_all_buffers(void)
619{ 719{
620 struct counters *p; 720 CPU_FREE(cpu_present_set);
721 cpu_present_set = NULL;
722 cpu_present_set = 0;
621 723
622 for (p = list; p; ) { 724 CPU_FREE(cpu_affinity_set);
623 struct counters *free_me; 725 cpu_affinity_set = NULL;
726 cpu_affinity_setsize = 0;
624 727
625 free_me = p; 728 free(thread_even);
626 p = p->next; 729 free(core_even);
627 free(free_me); 730 free(package_even);
628 }
629}
630 731
631void free_all_counters(void) 732 thread_even = NULL;
632{ 733 core_even = NULL;
633 free_counter_list(cnt_even); 734 package_even = NULL;
634 cnt_even = NULL;
635 735
636 free_counter_list(cnt_odd); 736 free(thread_odd);
637 cnt_odd = NULL; 737 free(core_odd);
738 free(package_odd);
638 739
639 free_counter_list(cnt_delta); 740 thread_odd = NULL;
640 cnt_delta = NULL; 741 core_odd = NULL;
742 package_odd = NULL;
641 743
642 free_counter_list(cnt_average); 744 free(output_buffer);
643 cnt_average = NULL; 745 output_buffer = NULL;
746 outp = NULL;
644} 747}
645 748
646void insert_counters(struct counters **list, 749/*
647 struct counters *new) 750 * cpu_is_first_sibling_in_core(cpu)
751 * return 1 if given CPU is 1st HT sibling in the core
752 */
753int cpu_is_first_sibling_in_core(int cpu)
648{ 754{
649 struct counters *prev; 755 char path[64];
650 756 FILE *filep;
651 /* 757 int first_cpu;
652 * list was empty
653 */
654 if (*list == NULL) {
655 new->next = *list;
656 *list = new;
657 return;
658 }
659
660 if (!summary_only)
661 show_cpu = 1; /* there is more than one CPU */
662
663 /*
664 * insert on front of list.
665 * It is sorted by ascending package#, core#, cpu#
666 */
667 if (((*list)->pkg > new->pkg) ||
668 (((*list)->pkg == new->pkg) && ((*list)->core > new->core)) ||
669 (((*list)->pkg == new->pkg) && ((*list)->core == new->core) && ((*list)->cpu > new->cpu))) {
670 new->next = *list;
671 *list = new;
672 return;
673 }
674
675 prev = *list;
676
677 while (prev->next && (prev->next->pkg < new->pkg)) {
678 prev = prev->next;
679 if (!summary_only)
680 show_pkg = 1; /* there is more than 1 package */
681 }
682
683 while (prev->next && (prev->next->pkg == new->pkg)
684 && (prev->next->core < new->core)) {
685 prev = prev->next;
686 if (!summary_only)
687 show_core = 1; /* there is more than 1 core */
688 }
689 758
690 while (prev->next && (prev->next->pkg == new->pkg) 759 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
691 && (prev->next->core == new->core) 760 filep = fopen(path, "r");
692 && (prev->next->cpu < new->cpu)) { 761 if (filep == NULL) {
693 prev = prev->next; 762 perror(path);
763 exit(1);
694 } 764 }
695 765 fscanf(filep, "%d", &first_cpu);
696 /* 766 fclose(filep);
697 * insert after "prev" 767 return (cpu == first_cpu);
698 */
699 new->next = prev->next;
700 prev->next = new;
701} 768}
702 769
703void alloc_new_counters(int pkg, int core, int cpu) 770/*
771 * cpu_is_first_core_in_package(cpu)
772 * return 1 if given CPU is 1st core in package
773 */
774int cpu_is_first_core_in_package(int cpu)
704{ 775{
705 struct counters *new; 776 char path[64];
706 777 FILE *filep;
707 if (verbose > 1) 778 int first_cpu;
708 printf("pkg%d core%d, cpu%d\n", pkg, core, cpu);
709
710 new = (struct counters *)calloc(1, sizeof(struct counters));
711 if (new == NULL) {
712 perror("calloc");
713 exit(1);
714 }
715 new->pkg = pkg;
716 new->core = core;
717 new->cpu = cpu;
718 insert_counters(&cnt_odd, new);
719
720 new = (struct counters *)calloc(1,
721 sizeof(struct counters));
722 if (new == NULL) {
723 perror("calloc");
724 exit(1);
725 }
726 new->pkg = pkg;
727 new->core = core;
728 new->cpu = cpu;
729 insert_counters(&cnt_even, new);
730
731 new = (struct counters *)calloc(1, sizeof(struct counters));
732 if (new == NULL) {
733 perror("calloc");
734 exit(1);
735 }
736 new->pkg = pkg;
737 new->core = core;
738 new->cpu = cpu;
739 insert_counters(&cnt_delta, new);
740 779
741 new = (struct counters *)calloc(1, sizeof(struct counters)); 780 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/core_siblings_list", cpu);
742 if (new == NULL) { 781 filep = fopen(path, "r");
743 perror("calloc"); 782 if (filep == NULL) {
783 perror(path);
744 exit(1); 784 exit(1);
745 } 785 }
746 new->pkg = pkg; 786 fscanf(filep, "%d", &first_cpu);
747 new->core = core; 787 fclose(filep);
748 new->cpu = cpu; 788 return (cpu == first_cpu);
749 cnt_average = new;
750} 789}
751 790
752int get_physical_package_id(int cpu) 791int get_physical_package_id(int cpu)
753{ 792{
754 char path[64]; 793 char path[80];
755 FILE *filep; 794 FILE *filep;
756 int pkg; 795 int pkg;
757 796
@@ -768,7 +807,7 @@ int get_physical_package_id(int cpu)
768 807
769int get_core_id(int cpu) 808int get_core_id(int cpu)
770{ 809{
771 char path[64]; 810 char path[80];
772 FILE *filep; 811 FILE *filep;
773 int core; 812 int core;
774 813
@@ -783,14 +822,87 @@ int get_core_id(int cpu)
783 return core; 822 return core;
784} 823}
785 824
825int get_num_ht_siblings(int cpu)
826{
827 char path[80];
828 FILE *filep;
829 int sib1, sib2;
830 int matches;
831 char character;
832
833 sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
834 filep = fopen(path, "r");
835 if (filep == NULL) {
836 perror(path);
837 exit(1);
838 }
839 /*
840 * file format:
841 * if a pair of number with a character between: 2 siblings (eg. 1-2, or 1,4)
842 * otherwinse 1 sibling (self).
843 */
844 matches = fscanf(filep, "%d%c%d\n", &sib1, &character, &sib2);
845
846 fclose(filep);
847
848 if (matches == 3)
849 return 2;
850 else
851 return 1;
852}
853
786/* 854/*
787 * run func(pkg, core, cpu) on every cpu in /proc/stat 855 * run func(thread, core, package) in topology order
856 * skip non-present cpus
788 */ 857 */
789 858
790int for_all_cpus(void (func)(int, int, int)) 859int for_all_cpus_2(int (func)(struct thread_data *, struct core_data *,
860 struct pkg_data *, struct thread_data *, struct core_data *,
861 struct pkg_data *), struct thread_data *thread_base,
862 struct core_data *core_base, struct pkg_data *pkg_base,
863 struct thread_data *thread_base2, struct core_data *core_base2,
864 struct pkg_data *pkg_base2)
865{
866 int retval, pkg_no, core_no, thread_no;
867
868 for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) {
869 for (core_no = 0; core_no < topo.num_cores_per_pkg; ++core_no) {
870 for (thread_no = 0; thread_no <
871 topo.num_threads_per_core; ++thread_no) {
872 struct thread_data *t, *t2;
873 struct core_data *c, *c2;
874 struct pkg_data *p, *p2;
875
876 t = GET_THREAD(thread_base, thread_no, core_no, pkg_no);
877
878 if (cpu_is_not_present(t->cpu_id))
879 continue;
880
881 t2 = GET_THREAD(thread_base2, thread_no, core_no, pkg_no);
882
883 c = GET_CORE(core_base, core_no, pkg_no);
884 c2 = GET_CORE(core_base2, core_no, pkg_no);
885
886 p = GET_PKG(pkg_base, pkg_no);
887 p2 = GET_PKG(pkg_base2, pkg_no);
888
889 retval = func(t, c, p, t2, c2, p2);
890 if (retval)
891 return retval;
892 }
893 }
894 }
895 return 0;
896}
897
898/*
899 * run func(cpu) on every cpu in /proc/stat
900 * return max_cpu number
901 */
902int for_all_proc_cpus(int (func)(int))
791{ 903{
792 FILE *fp; 904 FILE *fp;
793 int cpu_count; 905 int cpu_num;
794 int retval; 906 int retval;
795 907
796 fp = fopen(proc_stat, "r"); 908 fp = fopen(proc_stat, "r");
@@ -805,78 +917,88 @@ int for_all_cpus(void (func)(int, int, int))
805 exit(1); 917 exit(1);
806 } 918 }
807 919
808 for (cpu_count = 0; ; cpu_count++) { 920 while (1) {
809 int cpu; 921 retval = fscanf(fp, "cpu%u %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d\n", &cpu_num);
810
811 retval = fscanf(fp, "cpu%u %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d\n", &cpu);
812 if (retval != 1) 922 if (retval != 1)
813 break; 923 break;
814 924
815 func(get_physical_package_id(cpu), get_core_id(cpu), cpu); 925 retval = func(cpu_num);
926 if (retval) {
927 fclose(fp);
928 return(retval);
929 }
816 } 930 }
817 fclose(fp); 931 fclose(fp);
818 return cpu_count; 932 return 0;
819} 933}
820 934
821void re_initialize(void) 935void re_initialize(void)
822{ 936{
823 free_all_counters(); 937 free_all_buffers();
824 num_cpus = for_all_cpus(alloc_new_counters); 938 setup_all_buffers();
825 cpu_mask_uninit(); 939 printf("turbostat: re-initialized with num_cpus %d\n", topo.num_cpus);
826 cpu_mask_init(num_cpus);
827 printf("turbostat: re-initialized with num_cpus %d\n", num_cpus);
828} 940}
829 941
830void dummy(int pkg, int core, int cpu) { return; } 942
831/* 943/*
832 * check to see if a cpu came on-line 944 * count_cpus()
945 * remember the last one seen, it will be the max
833 */ 946 */
834int verify_num_cpus(void) 947int count_cpus(int cpu)
835{ 948{
836 int new_num_cpus; 949 if (topo.max_cpu_num < cpu)
837 950 topo.max_cpu_num = cpu;
838 new_num_cpus = for_all_cpus(dummy);
839 951
840 if (new_num_cpus != num_cpus) { 952 topo.num_cpus += 1;
841 if (verbose) 953 return 0;
842 printf("num_cpus was %d, is now %d\n", 954}
843 num_cpus, new_num_cpus); 955int mark_cpu_present(int cpu)
844 return -1; 956{
845 } 957 CPU_SET_S(cpu, cpu_present_setsize, cpu_present_set);
846 return 0; 958 return 0;
847} 959}
848 960
849void turbostat_loop() 961void turbostat_loop()
850{ 962{
963 int retval;
964
851restart: 965restart:
852 get_counters(cnt_even); 966 retval = for_all_cpus(get_counters, EVEN_COUNTERS);
967 if (retval) {
968 re_initialize();
969 goto restart;
970 }
853 gettimeofday(&tv_even, (struct timezone *)NULL); 971 gettimeofday(&tv_even, (struct timezone *)NULL);
854 972
855 while (1) { 973 while (1) {
856 if (verify_num_cpus()) { 974 if (for_all_proc_cpus(cpu_is_not_present)) {
857 re_initialize(); 975 re_initialize();
858 goto restart; 976 goto restart;
859 } 977 }
860 sleep(interval_sec); 978 sleep(interval_sec);
861 if (get_counters(cnt_odd)) { 979 retval = for_all_cpus(get_counters, ODD_COUNTERS);
980 if (retval) {
862 re_initialize(); 981 re_initialize();
863 goto restart; 982 goto restart;
864 } 983 }
865 gettimeofday(&tv_odd, (struct timezone *)NULL); 984 gettimeofday(&tv_odd, (struct timezone *)NULL);
866 compute_delta(cnt_odd, cnt_even, cnt_delta);
867 timersub(&tv_odd, &tv_even, &tv_delta); 985 timersub(&tv_odd, &tv_even, &tv_delta);
868 compute_average(cnt_delta, cnt_average); 986 for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS);
869 print_counters(cnt_delta); 987 compute_average(EVEN_COUNTERS);
988 format_all_counters(EVEN_COUNTERS);
989 flush_stdout();
870 sleep(interval_sec); 990 sleep(interval_sec);
871 if (get_counters(cnt_even)) { 991 retval = for_all_cpus(get_counters, EVEN_COUNTERS);
992 if (retval) {
872 re_initialize(); 993 re_initialize();
873 goto restart; 994 goto restart;
874 } 995 }
875 gettimeofday(&tv_even, (struct timezone *)NULL); 996 gettimeofday(&tv_even, (struct timezone *)NULL);
876 compute_delta(cnt_even, cnt_odd, cnt_delta);
877 timersub(&tv_even, &tv_odd, &tv_delta); 997 timersub(&tv_even, &tv_odd, &tv_delta);
878 compute_average(cnt_delta, cnt_average); 998 for_all_cpus_2(delta_cpu, EVEN_COUNTERS, ODD_COUNTERS);
879 print_counters(cnt_delta); 999 compute_average(ODD_COUNTERS);
1000 format_all_counters(ODD_COUNTERS);
1001 flush_stdout();
880 } 1002 }
881} 1003}
882 1004
@@ -1051,6 +1173,208 @@ int open_dev_cpu_msr(int dummy1)
1051 return 0; 1173 return 0;
1052} 1174}
1053 1175
1176void topology_probe()
1177{
1178 int i;
1179 int max_core_id = 0;
1180 int max_package_id = 0;
1181 int max_siblings = 0;
1182 struct cpu_topology {
1183 int core_id;
1184 int physical_package_id;
1185 } *cpus;
1186
1187 /* Initialize num_cpus, max_cpu_num */
1188 topo.num_cpus = 0;
1189 topo.max_cpu_num = 0;
1190 for_all_proc_cpus(count_cpus);
1191 if (!summary_only && topo.num_cpus > 1)
1192 show_cpu = 1;
1193
1194 if (verbose > 1)
1195 fprintf(stderr, "num_cpus %d max_cpu_num %d\n", topo.num_cpus, topo.max_cpu_num);
1196
1197 cpus = calloc(1, (topo.max_cpu_num + 1) * sizeof(struct cpu_topology));
1198 if (cpus == NULL) {
1199 perror("calloc cpus");
1200 exit(1);
1201 }
1202
1203 /*
1204 * Allocate and initialize cpu_present_set
1205 */
1206 cpu_present_set = CPU_ALLOC((topo.max_cpu_num + 1));
1207 if (cpu_present_set == NULL) {
1208 perror("CPU_ALLOC");
1209 exit(3);
1210 }
1211 cpu_present_setsize = CPU_ALLOC_SIZE((topo.max_cpu_num + 1));
1212 CPU_ZERO_S(cpu_present_setsize, cpu_present_set);
1213 for_all_proc_cpus(mark_cpu_present);
1214
1215 /*
1216 * Allocate and initialize cpu_affinity_set
1217 */
1218 cpu_affinity_set = CPU_ALLOC((topo.max_cpu_num + 1));
1219 if (cpu_affinity_set == NULL) {
1220 perror("CPU_ALLOC");
1221 exit(3);
1222 }
1223 cpu_affinity_setsize = CPU_ALLOC_SIZE((topo.max_cpu_num + 1));
1224 CPU_ZERO_S(cpu_affinity_setsize, cpu_affinity_set);
1225
1226
1227 /*
1228 * For online cpus
1229 * find max_core_id, max_package_id
1230 */
1231 for (i = 0; i <= topo.max_cpu_num; ++i) {
1232 int siblings;
1233
1234 if (cpu_is_not_present(i)) {
1235 if (verbose > 1)
1236 fprintf(stderr, "cpu%d NOT PRESENT\n", i);
1237 continue;
1238 }
1239 cpus[i].core_id = get_core_id(i);
1240 if (cpus[i].core_id > max_core_id)
1241 max_core_id = cpus[i].core_id;
1242
1243 cpus[i].physical_package_id = get_physical_package_id(i);
1244 if (cpus[i].physical_package_id > max_package_id)
1245 max_package_id = cpus[i].physical_package_id;
1246
1247 siblings = get_num_ht_siblings(i);
1248 if (siblings > max_siblings)
1249 max_siblings = siblings;
1250 if (verbose > 1)
1251 fprintf(stderr, "cpu %d pkg %d core %d\n",
1252 i, cpus[i].physical_package_id, cpus[i].core_id);
1253 }
1254 topo.num_cores_per_pkg = max_core_id + 1;
1255 if (verbose > 1)
1256 fprintf(stderr, "max_core_id %d, sizing for %d cores per package\n",
1257 max_core_id, topo.num_cores_per_pkg);
1258 if (!summary_only && topo.num_cores_per_pkg > 1)
1259 show_core = 1;
1260
1261 topo.num_packages = max_package_id + 1;
1262 if (verbose > 1)
1263 fprintf(stderr, "max_package_id %d, sizing for %d packages\n",
1264 max_package_id, topo.num_packages);
1265 if (!summary_only && topo.num_packages > 1)
1266 show_pkg = 1;
1267
1268 topo.num_threads_per_core = max_siblings;
1269 if (verbose > 1)
1270 fprintf(stderr, "max_siblings %d\n", max_siblings);
1271
1272 free(cpus);
1273}
1274
1275void
1276allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data **p)
1277{
1278 int i;
1279
1280 *t = calloc(topo.num_threads_per_core * topo.num_cores_per_pkg *
1281 topo.num_packages, sizeof(struct thread_data));
1282 if (*t == NULL)
1283 goto error;
1284
1285 for (i = 0; i < topo.num_threads_per_core *
1286 topo.num_cores_per_pkg * topo.num_packages; i++)
1287 (*t)[i].cpu_id = -1;
1288
1289 *c = calloc(topo.num_cores_per_pkg * topo.num_packages,
1290 sizeof(struct core_data));
1291 if (*c == NULL)
1292 goto error;
1293
1294 for (i = 0; i < topo.num_cores_per_pkg * topo.num_packages; i++)
1295 (*c)[i].core_id = -1;
1296
1297 *p = calloc(topo.num_packages, sizeof(struct pkg_data));
1298 if (*p == NULL)
1299 goto error;
1300
1301 for (i = 0; i < topo.num_packages; i++)
1302 (*p)[i].package_id = i;
1303
1304 return;
1305error:
1306 perror("calloc counters");
1307 exit(1);
1308}
1309/*
1310 * init_counter()
1311 *
1312 * set cpu_id, core_num, pkg_num
1313 * set FIRST_THREAD_IN_CORE and FIRST_CORE_IN_PACKAGE
1314 *
1315 * increment topo.num_cores when 1st core in pkg seen
1316 */
1317void init_counter(struct thread_data *thread_base, struct core_data *core_base,
1318 struct pkg_data *pkg_base, int thread_num, int core_num,
1319 int pkg_num, int cpu_id)
1320{
1321 struct thread_data *t;
1322 struct core_data *c;
1323 struct pkg_data *p;
1324
1325 t = GET_THREAD(thread_base, thread_num, core_num, pkg_num);
1326 c = GET_CORE(core_base, core_num, pkg_num);
1327 p = GET_PKG(pkg_base, pkg_num);
1328
1329 t->cpu_id = cpu_id;
1330 if (thread_num == 0) {
1331 t->flags |= CPU_IS_FIRST_THREAD_IN_CORE;
1332 if (cpu_is_first_core_in_package(cpu_id))
1333 t->flags |= CPU_IS_FIRST_CORE_IN_PACKAGE;
1334 }
1335
1336 c->core_id = core_num;
1337 p->package_id = pkg_num;
1338}
1339
1340
1341int initialize_counters(int cpu_id)
1342{
1343 int my_thread_id, my_core_id, my_package_id;
1344
1345 my_package_id = get_physical_package_id(cpu_id);
1346 my_core_id = get_core_id(cpu_id);
1347
1348 if (cpu_is_first_sibling_in_core(cpu_id)) {
1349 my_thread_id = 0;
1350 topo.num_cores++;
1351 } else {
1352 my_thread_id = 1;
1353 }
1354
1355 init_counter(EVEN_COUNTERS, my_thread_id, my_core_id, my_package_id, cpu_id);
1356 init_counter(ODD_COUNTERS, my_thread_id, my_core_id, my_package_id, cpu_id);
1357 return 0;
1358}
1359
1360void allocate_output_buffer()
1361{
1362 output_buffer = calloc(1, (1 + topo.num_cpus) * 128);
1363 outp = output_buffer;
1364 if (outp == NULL) {
1365 perror("calloc");
1366 exit(-1);
1367 }
1368}
1369
1370void setup_all_buffers(void)
1371{
1372 topology_probe();
1373 allocate_counters(&thread_even, &core_even, &package_even);
1374 allocate_counters(&thread_odd, &core_odd, &package_odd);
1375 allocate_output_buffer();
1376 for_all_proc_cpus(initialize_counters);
1377}
1054void turbostat_init() 1378void turbostat_init()
1055{ 1379{
1056 check_cpuid(); 1380 check_cpuid();
@@ -1058,21 +1382,19 @@ void turbostat_init()
1058 check_dev_msr(); 1382 check_dev_msr();
1059 check_super_user(); 1383 check_super_user();
1060 1384
1061 num_cpus = for_all_cpus(alloc_new_counters); 1385 setup_all_buffers();
1062 cpu_mask_init(num_cpus);
1063 1386
1064 if (verbose) 1387 if (verbose)
1065 print_nehalem_info(); 1388 print_verbose_header();
1066} 1389}
1067 1390
1068int fork_it(char **argv) 1391int fork_it(char **argv)
1069{ 1392{
1070 int retval;
1071 pid_t child_pid; 1393 pid_t child_pid;
1072 get_counters(cnt_even);
1073 1394
1074 /* clear affinity side-effect of get_counters() */ 1395 for_all_cpus(get_counters, EVEN_COUNTERS);
1075 sched_setaffinity(0, cpu_present_setsize, cpu_present_set); 1396 /* clear affinity side-effect of get_counters() */
1397 sched_setaffinity(0, cpu_present_setsize, cpu_present_set);
1076 gettimeofday(&tv_even, (struct timezone *)NULL); 1398 gettimeofday(&tv_even, (struct timezone *)NULL);
1077 1399
1078 child_pid = fork(); 1400 child_pid = fork();
@@ -1095,14 +1417,17 @@ int fork_it(char **argv)
1095 exit(1); 1417 exit(1);
1096 } 1418 }
1097 } 1419 }
1098 get_counters(cnt_odd); 1420 /*
1421 * n.b. fork_it() does not check for errors from for_all_cpus()
1422 * because re-starting is problematic when forking
1423 */
1424 for_all_cpus(get_counters, ODD_COUNTERS);
1099 gettimeofday(&tv_odd, (struct timezone *)NULL); 1425 gettimeofday(&tv_odd, (struct timezone *)NULL);
1100 retval = compute_delta(cnt_odd, cnt_even, cnt_delta);
1101
1102 timersub(&tv_odd, &tv_even, &tv_delta); 1426 timersub(&tv_odd, &tv_even, &tv_delta);
1103 compute_average(cnt_delta, cnt_average); 1427 for_all_cpus_2(delta_cpu, ODD_COUNTERS, EVEN_COUNTERS);
1104 if (!retval) 1428 compute_average(EVEN_COUNTERS);
1105 print_counters(cnt_delta); 1429 format_all_counters(EVEN_COUNTERS);
1430 flush_stderr();
1106 1431
1107 fprintf(stderr, "%.6f sec\n", tv_delta.tv_sec + tv_delta.tv_usec/1000000.0); 1432 fprintf(stderr, "%.6f sec\n", tv_delta.tv_sec + tv_delta.tv_usec/1000000.0);
1108 1433
@@ -1115,8 +1440,14 @@ void cmdline(int argc, char **argv)
1115 1440
1116 progname = argv[0]; 1441 progname = argv[0];
1117 1442
1118 while ((opt = getopt(argc, argv, "+svi:M:")) != -1) { 1443 while ((opt = getopt(argc, argv, "+cpsvi:M:")) != -1) {
1119 switch (opt) { 1444 switch (opt) {
1445 case 'c':
1446 show_core_only++;
1447 break;
1448 case 'p':
1449 show_pkg_only++;
1450 break;
1120 case 's': 1451 case 's':
1121 summary_only++; 1452 summary_only++;
1122 break; 1453 break;
@@ -1142,10 +1473,8 @@ int main(int argc, char **argv)
1142 cmdline(argc, argv); 1473 cmdline(argc, argv);
1143 1474
1144 if (verbose > 1) 1475 if (verbose > 1)
1145 fprintf(stderr, "turbostat Dec 6, 2010" 1476 fprintf(stderr, "turbostat v2.0 May 16, 2012"
1146 " - Len Brown <lenb@kernel.org>\n"); 1477 " - Len Brown <lenb@kernel.org>\n");
1147 if (verbose > 1)
1148 fprintf(stderr, "http://userweb.kernel.org/~lenb/acpi/utils/pmtools/turbostat/\n");
1149 1478
1150 turbostat_init(); 1479 turbostat_init();
1151 1480