diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 16:40:27 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 16:40:27 -0400 |
commit | c1b054d03f5b31c33eaa0b267c629b118eaf3790 (patch) | |
tree | 9333907ca767be24fcb3667877242976c3e3c8dd /drivers/acpi | |
parent | 559fb51ba7e66fe298b8355fabde1275b7def35f (diff) | |
parent | bf4e70e54cf31dcca48d279c7f7e71328eebe749 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/acpi')
125 files changed, 7387 insertions, 4053 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 670fdb5142d1..ba13896cae40 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menu "ACPI (Advanced Configuration and Power Interface) Support" | 5 | menu "ACPI (Advanced Configuration and Power Interface) Support" |
6 | depends on PM | ||
6 | depends on !X86_VISWS | 7 | depends on !X86_VISWS |
7 | depends on !IA64_HP_SIM | 8 | depends on !IA64_HP_SIM |
8 | depends on IA64 || X86 | 9 | depends on IA64 || X86 |
@@ -48,14 +49,13 @@ config ACPI_BOOT | |||
48 | 49 | ||
49 | config ACPI_INTERPRETER | 50 | config ACPI_INTERPRETER |
50 | bool | 51 | bool |
51 | depends on !IA64_SGI_SN | ||
52 | default y | 52 | default y |
53 | 53 | ||
54 | if ACPI_INTERPRETER | 54 | if ACPI_INTERPRETER |
55 | 55 | ||
56 | config ACPI_SLEEP | 56 | config ACPI_SLEEP |
57 | bool "Sleep States (EXPERIMENTAL)" | 57 | bool "Sleep States (EXPERIMENTAL)" |
58 | depends on X86 | 58 | depends on X86 && (!SMP || SUSPEND_SMP) |
59 | depends on EXPERIMENTAL && PM | 59 | depends on EXPERIMENTAL && PM |
60 | default y | 60 | default y |
61 | ---help--- | 61 | ---help--- |
@@ -79,6 +79,14 @@ config ACPI_SLEEP_PROC_FS | |||
79 | depends on ACPI_SLEEP && PROC_FS | 79 | depends on ACPI_SLEEP && PROC_FS |
80 | default y | 80 | default y |
81 | 81 | ||
82 | config ACPI_SLEEP_PROC_SLEEP | ||
83 | bool "/proc/acpi/sleep (deprecated)" | ||
84 | depends on ACPI_SLEEP_PROC_FS | ||
85 | default n | ||
86 | ---help--- | ||
87 | Create /proc/acpi/sleep | ||
88 | Deprecated by /sys/power/state | ||
89 | |||
82 | config ACPI_AC | 90 | config ACPI_AC |
83 | tristate "AC Adapter" | 91 | tristate "AC Adapter" |
84 | depends on X86 | 92 | depends on X86 |
@@ -99,7 +107,6 @@ config ACPI_BATTERY | |||
99 | 107 | ||
100 | config ACPI_BUTTON | 108 | config ACPI_BUTTON |
101 | tristate "Button" | 109 | tristate "Button" |
102 | depends on !IA64_SGI_SN | ||
103 | default m | 110 | default m |
104 | help | 111 | help |
105 | This driver registers for events based on buttons, such as the | 112 | This driver registers for events based on buttons, such as the |
@@ -111,7 +118,6 @@ config ACPI_BUTTON | |||
111 | config ACPI_VIDEO | 118 | config ACPI_VIDEO |
112 | tristate "Video" | 119 | tristate "Video" |
113 | depends on EXPERIMENTAL | 120 | depends on EXPERIMENTAL |
114 | depends on !IA64_SGI_SN | ||
115 | default m | 121 | default m |
116 | help | 122 | help |
117 | This driver implement the ACPI Extensions For Display Adapters | 123 | This driver implement the ACPI Extensions For Display Adapters |
@@ -122,9 +128,18 @@ config ACPI_VIDEO | |||
122 | Note that this is an ref. implementation only. It may or may not work | 128 | Note that this is an ref. implementation only. It may or may not work |
123 | for your integrated video device. | 129 | for your integrated video device. |
124 | 130 | ||
131 | config ACPI_HOTKEY | ||
132 | tristate "Generic Hotkey" | ||
133 | depends on ACPI_INTERPRETER | ||
134 | depends on EXPERIMENTAL | ||
135 | depends on !IA64_SGI_SN | ||
136 | default n | ||
137 | help | ||
138 | Experimental consolidated hotkey driver. | ||
139 | If you are unsure, say N. | ||
140 | |||
125 | config ACPI_FAN | 141 | config ACPI_FAN |
126 | tristate "Fan" | 142 | tristate "Fan" |
127 | depends on !IA64_SGI_SN | ||
128 | default m | 143 | default m |
129 | help | 144 | help |
130 | This driver adds support for ACPI fan devices, allowing user-mode | 145 | This driver adds support for ACPI fan devices, allowing user-mode |
@@ -132,7 +147,6 @@ config ACPI_FAN | |||
132 | 147 | ||
133 | config ACPI_PROCESSOR | 148 | config ACPI_PROCESSOR |
134 | tristate "Processor" | 149 | tristate "Processor" |
135 | depends on !IA64_SGI_SN | ||
136 | default m | 150 | default m |
137 | help | 151 | help |
138 | This driver installs ACPI as the idle handler for Linux, and uses | 152 | This driver installs ACPI as the idle handler for Linux, and uses |
@@ -142,7 +156,6 @@ config ACPI_PROCESSOR | |||
142 | config ACPI_HOTPLUG_CPU | 156 | config ACPI_HOTPLUG_CPU |
143 | bool "Processor Hotplug (EXPERIMENTAL)" | 157 | bool "Processor Hotplug (EXPERIMENTAL)" |
144 | depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL | 158 | depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL |
145 | depends on !IA64_SGI_SN | ||
146 | select ACPI_CONTAINER | 159 | select ACPI_CONTAINER |
147 | default n | 160 | default n |
148 | ---help--- | 161 | ---help--- |
@@ -262,7 +275,6 @@ config ACPI_BLACKLIST_YEAR | |||
262 | 275 | ||
263 | config ACPI_DEBUG | 276 | config ACPI_DEBUG |
264 | bool "Debug Statements" | 277 | bool "Debug Statements" |
265 | depends on !IA64_SGI_SN | ||
266 | default n | 278 | default n |
267 | help | 279 | help |
268 | The ACPI driver can optionally report errors with a great deal | 280 | The ACPI driver can optionally report errors with a great deal |
@@ -271,7 +283,6 @@ config ACPI_DEBUG | |||
271 | 283 | ||
272 | config ACPI_BUS | 284 | config ACPI_BUS |
273 | bool | 285 | bool |
274 | depends on !IA64_SGI_SN | ||
275 | default y | 286 | default y |
276 | 287 | ||
277 | config ACPI_EC | 288 | config ACPI_EC |
@@ -285,17 +296,14 @@ config ACPI_EC | |||
285 | 296 | ||
286 | config ACPI_POWER | 297 | config ACPI_POWER |
287 | bool | 298 | bool |
288 | depends on !IA64_SGI_SN | ||
289 | default y | 299 | default y |
290 | 300 | ||
291 | config ACPI_PCI | 301 | config ACPI_PCI |
292 | bool | 302 | bool |
293 | depends on !IA64_SGI_SN | ||
294 | default PCI | 303 | default PCI |
295 | 304 | ||
296 | config ACPI_SYSTEM | 305 | config ACPI_SYSTEM |
297 | bool | 306 | bool |
298 | depends on !IA64_SGI_SN | ||
299 | default y | 307 | default y |
300 | help | 308 | help |
301 | This driver will enable your system to shut down using ACPI, and | 309 | This driver will enable your system to shut down using ACPI, and |
@@ -327,8 +335,13 @@ config ACPI_CONTAINER | |||
327 | depends on EXPERIMENTAL | 335 | depends on EXPERIMENTAL |
328 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) | 336 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) |
329 | ---help--- | 337 | ---help--- |
330 | This is the ACPI generic container driver which supports | 338 | This allows _physical_ insertion and removal of CPUs and memory. |
331 | ACPI0004, PNP0A05 and PNP0A06 devices | 339 | This can be useful, for example, on NUMA machines that support |
340 | ACPI based physical hotplug of nodes, or non-NUMA machines that | ||
341 | support physical cpu/memory hot-plug. | ||
342 | |||
343 | If one selects "m", this driver can be loaded with | ||
344 | "modprobe acpi_container". | ||
332 | 345 | ||
333 | config ACPI_HOTPLUG_MEMORY | 346 | config ACPI_HOTPLUG_MEMORY |
334 | tristate "Memory Hotplug" | 347 | tristate "Memory Hotplug" |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 65c92e20566d..ad67e8f61e6c 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -36,13 +36,14 @@ processor-objs += processor_perflib.o | |||
36 | endif | 36 | endif |
37 | 37 | ||
38 | obj-$(CONFIG_ACPI_BUS) += sleep/ | 38 | obj-$(CONFIG_ACPI_BUS) += sleep/ |
39 | obj-$(CONFIG_ACPI_BUS) += bus.o | 39 | obj-$(CONFIG_ACPI_BUS) += bus.o glue.o |
40 | obj-$(CONFIG_ACPI_AC) += ac.o | 40 | obj-$(CONFIG_ACPI_AC) += ac.o |
41 | obj-$(CONFIG_ACPI_BATTERY) += battery.o | 41 | obj-$(CONFIG_ACPI_BATTERY) += battery.o |
42 | obj-$(CONFIG_ACPI_BUTTON) += button.o | 42 | obj-$(CONFIG_ACPI_BUTTON) += button.o |
43 | obj-$(CONFIG_ACPI_EC) += ec.o | 43 | obj-$(CONFIG_ACPI_EC) += ec.o |
44 | obj-$(CONFIG_ACPI_FAN) += fan.o | 44 | obj-$(CONFIG_ACPI_FAN) += fan.o |
45 | obj-$(CONFIG_ACPI_VIDEO) += video.o | 45 | obj-$(CONFIG_ACPI_VIDEO) += video.o |
46 | obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o | ||
46 | obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o | 47 | obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o |
47 | obj-$(CONFIG_ACPI_POWER) += power.o | 48 | obj-$(CONFIG_ACPI_POWER) += power.o |
48 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | 49 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index a75cb565caeb..a560b1e2da77 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -1204,6 +1204,10 @@ static int __init asus_acpi_init(void) | |||
1204 | if (acpi_disabled) | 1204 | if (acpi_disabled) |
1205 | return -ENODEV; | 1205 | return -ENODEV; |
1206 | 1206 | ||
1207 | if (!acpi_specific_hotkey_enabled){ | ||
1208 | printk(KERN_ERR "Using generic hotkey driver\n"); | ||
1209 | return -ENODEV; | ||
1210 | } | ||
1207 | asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); | 1211 | asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir); |
1208 | if (!asus_proc_dir) { | 1212 | if (!asus_proc_dir) { |
1209 | printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); | 1213 | printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 4edff1738579..d77c2307883c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -212,6 +212,12 @@ acpi_bus_set_power ( | |||
212 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n")); | 212 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n")); |
213 | return_VALUE(-ENODEV); | 213 | return_VALUE(-ENODEV); |
214 | } | 214 | } |
215 | /* | ||
216 | * Get device's current power state if it's unknown | ||
217 | * This means device power state isn't initialized or previous setting failed | ||
218 | */ | ||
219 | if (device->power.state == ACPI_STATE_UNKNOWN) | ||
220 | acpi_bus_get_power(device->handle, &device->power.state); | ||
215 | if (state == device->power.state) { | 221 | if (state == device->power.state) { |
216 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); | 222 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); |
217 | return_VALUE(0); | 223 | return_VALUE(0); |
@@ -231,7 +237,7 @@ acpi_bus_set_power ( | |||
231 | * On transitions to a high-powered state we first apply power (via | 237 | * On transitions to a high-powered state we first apply power (via |
232 | * power resources) then evalute _PSx. Conversly for transitions to | 238 | * power resources) then evalute _PSx. Conversly for transitions to |
233 | * a lower-powered state. | 239 | * a lower-powered state. |
234 | */ | 240 | */ |
235 | if (state < device->power.state) { | 241 | if (state < device->power.state) { |
236 | if (device->power.flags.power_resources) { | 242 | if (device->power.flags.power_resources) { |
237 | result = acpi_power_transition(device, state); | 243 | result = acpi_power_transition(device, state); |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index ec4430e3053f..8162fd0c21a7 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -156,6 +156,10 @@ static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | |||
156 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); | 156 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); |
157 | } | 157 | } |
158 | 158 | ||
159 | static struct proc_dir_entry *acpi_power_dir; | ||
160 | static struct proc_dir_entry *acpi_sleep_dir; | ||
161 | static struct proc_dir_entry *acpi_lid_dir; | ||
162 | |||
159 | static int | 163 | static int |
160 | acpi_button_add_fs ( | 164 | acpi_button_add_fs ( |
161 | struct acpi_device *device) | 165 | struct acpi_device *device) |
@@ -173,17 +177,23 @@ acpi_button_add_fs ( | |||
173 | switch (button->type) { | 177 | switch (button->type) { |
174 | case ACPI_BUTTON_TYPE_POWER: | 178 | case ACPI_BUTTON_TYPE_POWER: |
175 | case ACPI_BUTTON_TYPE_POWERF: | 179 | case ACPI_BUTTON_TYPE_POWERF: |
176 | entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, | 180 | if (!acpi_power_dir) |
181 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, | ||
177 | acpi_button_dir); | 182 | acpi_button_dir); |
183 | entry = acpi_power_dir; | ||
178 | break; | 184 | break; |
179 | case ACPI_BUTTON_TYPE_SLEEP: | 185 | case ACPI_BUTTON_TYPE_SLEEP: |
180 | case ACPI_BUTTON_TYPE_SLEEPF: | 186 | case ACPI_BUTTON_TYPE_SLEEPF: |
181 | entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, | 187 | if (!acpi_sleep_dir) |
188 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, | ||
182 | acpi_button_dir); | 189 | acpi_button_dir); |
190 | entry = acpi_sleep_dir; | ||
183 | break; | 191 | break; |
184 | case ACPI_BUTTON_TYPE_LID: | 192 | case ACPI_BUTTON_TYPE_LID: |
185 | entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, | 193 | if (!acpi_lid_dir) |
194 | acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, | ||
186 | acpi_button_dir); | 195 | acpi_button_dir); |
196 | entry = acpi_lid_dir; | ||
187 | break; | 197 | break; |
188 | } | 198 | } |
189 | 199 | ||
@@ -246,24 +256,6 @@ acpi_button_remove_fs ( | |||
246 | 256 | ||
247 | remove_proc_entry(acpi_device_bid(device), | 257 | remove_proc_entry(acpi_device_bid(device), |
248 | acpi_device_dir(device)->parent); | 258 | acpi_device_dir(device)->parent); |
249 | |||
250 | |||
251 | switch (button->type) { | ||
252 | case ACPI_BUTTON_TYPE_POWER: | ||
253 | case ACPI_BUTTON_TYPE_POWERF: | ||
254 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, | ||
255 | acpi_button_dir); | ||
256 | break; | ||
257 | case ACPI_BUTTON_TYPE_SLEEP: | ||
258 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
259 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, | ||
260 | acpi_button_dir); | ||
261 | break; | ||
262 | case ACPI_BUTTON_TYPE_LID: | ||
263 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, | ||
264 | acpi_button_dir); | ||
265 | break; | ||
266 | } | ||
267 | acpi_device_dir(device) = NULL; | 259 | acpi_device_dir(device) = NULL; |
268 | } | 260 | } |
269 | 261 | ||
@@ -327,10 +319,6 @@ acpi_button_add ( | |||
327 | acpi_status status = AE_OK; | 319 | acpi_status status = AE_OK; |
328 | struct acpi_button *button = NULL; | 320 | struct acpi_button *button = NULL; |
329 | 321 | ||
330 | static struct acpi_device *power_button; | ||
331 | static struct acpi_device *sleep_button; | ||
332 | static struct acpi_device *lid_button; | ||
333 | |||
334 | ACPI_FUNCTION_TRACE("acpi_button_add"); | 322 | ACPI_FUNCTION_TRACE("acpi_button_add"); |
335 | 323 | ||
336 | if (!device) | 324 | if (!device) |
@@ -391,38 +379,6 @@ acpi_button_add ( | |||
391 | goto end; | 379 | goto end; |
392 | } | 380 | } |
393 | 381 | ||
394 | /* | ||
395 | * Ensure only one button of each type is used. | ||
396 | */ | ||
397 | switch (button->type) { | ||
398 | case ACPI_BUTTON_TYPE_POWER: | ||
399 | case ACPI_BUTTON_TYPE_POWERF: | ||
400 | if (!power_button) | ||
401 | power_button = device; | ||
402 | else { | ||
403 | kfree(button); | ||
404 | return_VALUE(-ENODEV); | ||
405 | } | ||
406 | break; | ||
407 | case ACPI_BUTTON_TYPE_SLEEP: | ||
408 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
409 | if (!sleep_button) | ||
410 | sleep_button = device; | ||
411 | else { | ||
412 | kfree(button); | ||
413 | return_VALUE(-ENODEV); | ||
414 | } | ||
415 | break; | ||
416 | case ACPI_BUTTON_TYPE_LID: | ||
417 | if (!lid_button) | ||
418 | lid_button = device; | ||
419 | else { | ||
420 | kfree(button); | ||
421 | return_VALUE(-ENODEV); | ||
422 | } | ||
423 | break; | ||
424 | } | ||
425 | |||
426 | result = acpi_button_add_fs(device); | 382 | result = acpi_button_add_fs(device); |
427 | if (result) | 383 | if (result) |
428 | goto end; | 384 | goto end; |
@@ -530,7 +486,6 @@ acpi_button_init (void) | |||
530 | if (!acpi_button_dir) | 486 | if (!acpi_button_dir) |
531 | return_VALUE(-ENODEV); | 487 | return_VALUE(-ENODEV); |
532 | acpi_button_dir->owner = THIS_MODULE; | 488 | acpi_button_dir->owner = THIS_MODULE; |
533 | |||
534 | result = acpi_bus_register_driver(&acpi_button_driver); | 489 | result = acpi_bus_register_driver(&acpi_button_driver); |
535 | if (result < 0) { | 490 | if (result < 0) { |
536 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | 491 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
@@ -548,6 +503,12 @@ acpi_button_exit (void) | |||
548 | 503 | ||
549 | acpi_bus_unregister_driver(&acpi_button_driver); | 504 | acpi_bus_unregister_driver(&acpi_button_driver); |
550 | 505 | ||
506 | if (acpi_power_dir) | ||
507 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir); | ||
508 | if (acpi_sleep_dir) | ||
509 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir); | ||
510 | if (acpi_lid_dir) | ||
511 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); | ||
551 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | 512 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
552 | 513 | ||
553 | return_VOID; | 514 | return_VOID; |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 5a0adbf8bc04..97013ddfa202 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -153,7 +153,7 @@ container_device_add(struct acpi_device **device, acpi_handle handle) | |||
153 | return_VALUE(-ENODEV); | 153 | return_VALUE(-ENODEV); |
154 | } | 154 | } |
155 | 155 | ||
156 | result = acpi_bus_scan(*device); | 156 | result = acpi_bus_start(*device); |
157 | 157 | ||
158 | return_VALUE(result); | 158 | return_VALUE(result); |
159 | } | 159 | } |
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 2779211be756..84193983d6ba 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
@@ -53,13 +53,20 @@ | |||
53 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME ("dsfield") | 54 | ACPI_MODULE_NAME ("dsfield") |
55 | 55 | ||
56 | /* Local prototypes */ | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ds_get_field_names ( | ||
60 | struct acpi_create_field_info *info, | ||
61 | struct acpi_walk_state *walk_state, | ||
62 | union acpi_parse_object *arg); | ||
63 | |||
56 | 64 | ||
57 | /******************************************************************************* | 65 | /******************************************************************************* |
58 | * | 66 | * |
59 | * FUNCTION: acpi_ds_create_buffer_field | 67 | * FUNCTION: acpi_ds_create_buffer_field |
60 | * | 68 | * |
61 | * PARAMETERS: Opcode - The opcode to be executed | 69 | * PARAMETERS: Op - Current parse op (create_xXField) |
62 | * Operands - List of operands for the opcode | ||
63 | * walk_state - Current state | 70 | * walk_state - Current state |
64 | * | 71 | * |
65 | * RETURN: Status | 72 | * RETURN: Status |
@@ -70,7 +77,7 @@ | |||
70 | * create_word_field_op, | 77 | * create_word_field_op, |
71 | * create_dword_field_op, | 78 | * create_dword_field_op, |
72 | * create_qword_field_op, | 79 | * create_qword_field_op, |
73 | * create_field_op (all of which define fields in buffers) | 80 | * create_field_op (all of which define a field in a buffer) |
74 | * | 81 | * |
75 | ******************************************************************************/ | 82 | ******************************************************************************/ |
76 | 83 | ||
@@ -119,7 +126,8 @@ acpi_ds_create_buffer_field ( | |||
119 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; | 126 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; |
120 | } | 127 | } |
121 | else { | 128 | else { |
122 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; | 129 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
130 | ACPI_NS_ERROR_IF_FOUND; | ||
123 | } | 131 | } |
124 | 132 | ||
125 | /* | 133 | /* |
@@ -134,16 +142,16 @@ acpi_ds_create_buffer_field ( | |||
134 | } | 142 | } |
135 | } | 143 | } |
136 | 144 | ||
137 | /* We could put the returned object (Node) on the object stack for later, but | 145 | /* We could put the returned object (Node) on the object stack for later, |
138 | * for now, we will put it in the "op" object that the parser uses, so we | 146 | * but for now, we will put it in the "op" object that the parser uses, |
139 | * can get it again at the end of this scope | 147 | * so we can get it again at the end of this scope |
140 | */ | 148 | */ |
141 | op->common.node = node; | 149 | op->common.node = node; |
142 | 150 | ||
143 | /* | 151 | /* |
144 | * If there is no object attached to the node, this node was just created and | 152 | * If there is no object attached to the node, this node was just created |
145 | * we need to create the field object. Otherwise, this was a lookup of an | 153 | * and we need to create the field object. Otherwise, this was a lookup |
146 | * existing node and we don't want to create the field object again. | 154 | * of an existing node and we don't want to create the field object again. |
147 | */ | 155 | */ |
148 | obj_desc = acpi_ns_get_attached_object (node); | 156 | obj_desc = acpi_ns_get_attached_object (node); |
149 | if (obj_desc) { | 157 | if (obj_desc) { |
@@ -205,7 +213,7 @@ cleanup: | |||
205 | * | 213 | * |
206 | ******************************************************************************/ | 214 | ******************************************************************************/ |
207 | 215 | ||
208 | acpi_status | 216 | static acpi_status |
209 | acpi_ds_get_field_names ( | 217 | acpi_ds_get_field_names ( |
210 | struct acpi_create_field_info *info, | 218 | struct acpi_create_field_info *info, |
211 | struct acpi_walk_state *walk_state, | 219 | struct acpi_walk_state *walk_state, |
@@ -238,7 +246,8 @@ acpi_ds_get_field_names ( | |||
238 | + (acpi_integer) arg->common.value.size; | 246 | + (acpi_integer) arg->common.value.size; |
239 | 247 | ||
240 | if (position > ACPI_UINT32_MAX) { | 248 | if (position > ACPI_UINT32_MAX) { |
241 | ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n")); | 249 | ACPI_REPORT_ERROR (( |
250 | "Bit offset within field too large (> 0xFFFFFFFF)\n")); | ||
242 | return_ACPI_STATUS (AE_SUPPORT); | 251 | return_ACPI_STATUS (AE_SUPPORT); |
243 | } | 252 | } |
244 | 253 | ||
@@ -250,12 +259,15 @@ acpi_ds_get_field_names ( | |||
250 | 259 | ||
251 | /* | 260 | /* |
252 | * Get a new access_type and access_attribute -- to be used for all | 261 | * Get a new access_type and access_attribute -- to be used for all |
253 | * field units that follow, until field end or another access_as keyword. | 262 | * field units that follow, until field end or another access_as |
263 | * keyword. | ||
254 | * | 264 | * |
255 | * In field_flags, preserve the flag bits other than the ACCESS_TYPE bits | 265 | * In field_flags, preserve the flag bits other than the |
266 | * ACCESS_TYPE bits | ||
256 | */ | 267 | */ |
257 | info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | | 268 | info->field_flags = (u8) |
258 | ((u8) ((u32) arg->common.value.integer >> 8))); | 269 | ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | |
270 | ((u8) ((u32) arg->common.value.integer >> 8))); | ||
259 | 271 | ||
260 | info->attribute = (u8) (arg->common.value.integer); | 272 | info->attribute = (u8) (arg->common.value.integer); |
261 | break; | 273 | break; |
@@ -267,7 +279,8 @@ acpi_ds_get_field_names ( | |||
267 | 279 | ||
268 | status = acpi_ns_lookup (walk_state->scope_info, | 280 | status = acpi_ns_lookup (walk_state->scope_info, |
269 | (char *) &arg->named.name, | 281 | (char *) &arg->named.name, |
270 | info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, | 282 | info->field_type, ACPI_IMODE_EXECUTE, |
283 | ACPI_NS_DONT_OPEN_SCOPE, | ||
271 | walk_state, &info->field_node); | 284 | walk_state, &info->field_node); |
272 | if (ACPI_FAILURE (status)) { | 285 | if (ACPI_FAILURE (status)) { |
273 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 286 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); |
@@ -295,8 +308,9 @@ acpi_ds_get_field_names ( | |||
295 | + (acpi_integer) arg->common.value.size; | 308 | + (acpi_integer) arg->common.value.size; |
296 | 309 | ||
297 | if (position > ACPI_UINT32_MAX) { | 310 | if (position > ACPI_UINT32_MAX) { |
298 | ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", | 311 | ACPI_REPORT_ERROR (( |
299 | (char *) &info->field_node->name)); | 312 | "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", |
313 | (char *) &info->field_node->name)); | ||
300 | return_ACPI_STATUS (AE_SUPPORT); | 314 | return_ACPI_STATUS (AE_SUPPORT); |
301 | } | 315 | } |
302 | 316 | ||
@@ -306,7 +320,8 @@ acpi_ds_get_field_names ( | |||
306 | 320 | ||
307 | default: | 321 | default: |
308 | 322 | ||
309 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n", | 323 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
324 | "Invalid opcode in field list: %X\n", | ||
310 | arg->common.aml_opcode)); | 325 | arg->common.aml_opcode)); |
311 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 326 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); |
312 | } | 327 | } |
@@ -435,7 +450,8 @@ acpi_ds_init_field_objects ( | |||
435 | status = acpi_ns_lookup (walk_state->scope_info, | 450 | status = acpi_ns_lookup (walk_state->scope_info, |
436 | (char *) &arg->named.name, | 451 | (char *) &arg->named.name, |
437 | type, ACPI_IMODE_LOAD_PASS1, | 452 | type, ACPI_IMODE_LOAD_PASS1, |
438 | ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, | 453 | ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
454 | ACPI_NS_ERROR_IF_FOUND, | ||
439 | walk_state, &node); | 455 | walk_state, &node); |
440 | if (ACPI_FAILURE (status)) { | 456 | if (ACPI_FAILURE (status)) { |
441 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 457 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); |
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index b4d264dbbf67..d7790db50178 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -49,12 +49,21 @@ | |||
49 | #define _COMPONENT ACPI_DISPATCHER | 49 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME ("dsinit") | 50 | ACPI_MODULE_NAME ("dsinit") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ds_init_one_object ( | ||
56 | acpi_handle obj_handle, | ||
57 | u32 level, | ||
58 | void *context, | ||
59 | void **return_value); | ||
60 | |||
52 | 61 | ||
53 | /******************************************************************************* | 62 | /******************************************************************************* |
54 | * | 63 | * |
55 | * FUNCTION: acpi_ds_init_one_object | 64 | * FUNCTION: acpi_ds_init_one_object |
56 | * | 65 | * |
57 | * PARAMETERS: obj_handle - Node | 66 | * PARAMETERS: obj_handle - Node for the object |
58 | * Level - Current nesting level | 67 | * Level - Current nesting level |
59 | * Context - Points to a init info struct | 68 | * Context - Points to a init info struct |
60 | * return_value - Not used | 69 | * return_value - Not used |
@@ -70,7 +79,7 @@ | |||
70 | * | 79 | * |
71 | ******************************************************************************/ | 80 | ******************************************************************************/ |
72 | 81 | ||
73 | acpi_status | 82 | static acpi_status |
74 | acpi_ds_init_one_object ( | 83 | acpi_ds_init_one_object ( |
75 | acpi_handle obj_handle, | 84 | acpi_handle obj_handle, |
76 | u32 level, | 85 | u32 level, |
@@ -105,7 +114,8 @@ acpi_ds_init_one_object ( | |||
105 | 114 | ||
106 | status = acpi_ds_initialize_region (obj_handle); | 115 | status = acpi_ds_initialize_region (obj_handle); |
107 | if (ACPI_FAILURE (status)) { | 116 | if (ACPI_FAILURE (status)) { |
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n", | 117 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
118 | "Region %p [%4.4s] - Init failure, %s\n", | ||
109 | obj_handle, acpi_ut_get_node_name (obj_handle), | 119 | obj_handle, acpi_ut_get_node_name (obj_handle), |
110 | acpi_format_exception (status))); | 120 | acpi_format_exception (status))); |
111 | } | 121 | } |
@@ -118,8 +128,10 @@ acpi_ds_init_one_object ( | |||
118 | 128 | ||
119 | info->method_count++; | 129 | info->method_count++; |
120 | 130 | ||
121 | /* Print a dot for each method unless we are going to print the entire pathname */ | 131 | /* |
122 | 132 | * Print a dot for each method unless we are going to print | |
133 | * the entire pathname | ||
134 | */ | ||
123 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | 135 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { |
124 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); | 136 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); |
125 | } | 137 | } |
@@ -140,7 +152,8 @@ acpi_ds_init_one_object ( | |||
140 | */ | 152 | */ |
141 | status = acpi_ds_parse_method (obj_handle); | 153 | status = acpi_ds_parse_method (obj_handle); |
142 | if (ACPI_FAILURE (status)) { | 154 | if (ACPI_FAILURE (status)) { |
143 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", | 155 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
156 | "Method %p [%4.4s] - parse failure, %s\n", | ||
144 | obj_handle, acpi_ut_get_node_name (obj_handle), | 157 | obj_handle, acpi_ut_get_node_name (obj_handle), |
145 | acpi_format_exception (status))); | 158 | acpi_format_exception (status))); |
146 | 159 | ||
@@ -154,7 +167,8 @@ acpi_ds_init_one_object ( | |||
154 | * for every execution since there isn't much overhead | 167 | * for every execution since there isn't much overhead |
155 | */ | 168 | */ |
156 | acpi_ns_delete_namespace_subtree (obj_handle); | 169 | acpi_ns_delete_namespace_subtree (obj_handle); |
157 | acpi_ns_delete_namespace_by_owner (((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); | 170 | acpi_ns_delete_namespace_by_owner ( |
171 | ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); | ||
158 | break; | 172 | break; |
159 | 173 | ||
160 | 174 | ||
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 9f0456cb9bb5..9fc3f4c033eb 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -153,12 +153,11 @@ acpi_ds_parse_method ( | |||
153 | /* | 153 | /* |
154 | * Parse the method, first pass | 154 | * Parse the method, first pass |
155 | * | 155 | * |
156 | * The first pass load is where newly declared named objects are | 156 | * The first pass load is where newly declared named objects are added into |
157 | * added into the namespace. Actual evaluation of | 157 | * the namespace. Actual evaluation of the named objects (what would be |
158 | * the named objects (what would be called a "second | 158 | * called a "second pass") happens during the actual execution of the |
159 | * pass") happens during the actual execution of the | 159 | * method so that operands to the named objects can take on dynamic |
160 | * method so that operands to the named objects can | 160 | * run-time values. |
161 | * take on dynamic run-time values. | ||
162 | */ | 161 | */ |
163 | status = acpi_ps_parse_aml (walk_state); | 162 | status = acpi_ps_parse_aml (walk_state); |
164 | if (ACPI_FAILURE (status)) { | 163 | if (ACPI_FAILURE (status)) { |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index f31d095f9833..f7998306f756 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -52,6 +52,29 @@ | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsmthdat") | 53 | ACPI_MODULE_NAME ("dsmthdat") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static void | ||
58 | acpi_ds_method_data_delete_value ( | ||
59 | u16 opcode, | ||
60 | u32 index, | ||
61 | struct acpi_walk_state *walk_state); | ||
62 | |||
63 | static acpi_status | ||
64 | acpi_ds_method_data_set_value ( | ||
65 | u16 opcode, | ||
66 | u32 index, | ||
67 | union acpi_operand_object *object, | ||
68 | struct acpi_walk_state *walk_state); | ||
69 | |||
70 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
71 | acpi_object_type | ||
72 | acpi_ds_method_data_get_type ( | ||
73 | u16 opcode, | ||
74 | u32 index, | ||
75 | struct acpi_walk_state *walk_state); | ||
76 | #endif | ||
77 | |||
55 | 78 | ||
56 | /******************************************************************************* | 79 | /******************************************************************************* |
57 | * | 80 | * |
@@ -62,8 +85,8 @@ | |||
62 | * RETURN: Status | 85 | * RETURN: Status |
63 | * | 86 | * |
64 | * DESCRIPTION: Initialize the data structures that hold the method's arguments | 87 | * DESCRIPTION: Initialize the data structures that hold the method's arguments |
65 | * and locals. The data struct is an array of NTEs for each. | 88 | * and locals. The data struct is an array of namespace nodes for |
66 | * This allows ref_of and de_ref_of to work properly for these | 89 | * each - this allows ref_of and de_ref_of to work properly for these |
67 | * special data types. | 90 | * special data types. |
68 | * | 91 | * |
69 | * NOTES: walk_state fields are initialized to zero by the | 92 | * NOTES: walk_state fields are initialized to zero by the |
@@ -92,7 +115,8 @@ acpi_ds_method_data_init ( | |||
92 | walk_state->arguments[i].name.integer |= (i << 24); | 115 | walk_state->arguments[i].name.integer |= (i << 24); |
93 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 116 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; |
94 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 117 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
95 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; | 118 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | |
119 | ANOBJ_METHOD_ARG; | ||
96 | } | 120 | } |
97 | 121 | ||
98 | /* Init the method locals */ | 122 | /* Init the method locals */ |
@@ -104,7 +128,8 @@ acpi_ds_method_data_init ( | |||
104 | walk_state->local_variables[i].name.integer |= (i << 24); | 128 | walk_state->local_variables[i].name.integer |= (i << 24); |
105 | walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; | 129 | walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; |
106 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 130 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
107 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; | 131 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | |
132 | ANOBJ_METHOD_LOCAL; | ||
108 | } | 133 | } |
109 | 134 | ||
110 | return_VOID; | 135 | return_VOID; |
@@ -198,15 +223,18 @@ acpi_ds_method_data_init_args ( | |||
198 | return_ACPI_STATUS (AE_OK); | 223 | return_ACPI_STATUS (AE_OK); |
199 | } | 224 | } |
200 | 225 | ||
201 | /* Copy passed parameters into the new method stack frame */ | 226 | /* Copy passed parameters into the new method stack frame */ |
202 | 227 | ||
203 | while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) { | 228 | while ((index < ACPI_METHOD_NUM_ARGS) && |
229 | (index < max_param_count) && | ||
230 | params[index]) { | ||
204 | /* | 231 | /* |
205 | * A valid parameter. | 232 | * A valid parameter. |
206 | * Store the argument in the method/walk descriptor. | 233 | * Store the argument in the method/walk descriptor. |
207 | * Do not copy the arg in order to implement call by reference | 234 | * Do not copy the arg in order to implement call by reference |
208 | */ | 235 | */ |
209 | status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state); | 236 | status = acpi_ds_method_data_set_value (AML_ARG_OP, index, |
237 | params[index], walk_state); | ||
210 | if (ACPI_FAILURE (status)) { | 238 | if (ACPI_FAILURE (status)) { |
211 | return_ACPI_STATUS (status); | 239 | return_ACPI_STATUS (status); |
212 | } | 240 | } |
@@ -224,11 +252,13 @@ acpi_ds_method_data_init_args ( | |||
224 | * FUNCTION: acpi_ds_method_data_get_node | 252 | * FUNCTION: acpi_ds_method_data_get_node |
225 | * | 253 | * |
226 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 254 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
227 | * Index - which local_var or argument whose type | 255 | * Index - Which Local or Arg whose type to get |
228 | * to get | ||
229 | * walk_state - Current walk state object | 256 | * walk_state - Current walk state object |
257 | * Node - Where the node is returned. | ||
230 | * | 258 | * |
231 | * RETURN: Get the Node associated with a local or arg. | 259 | * RETURN: Status and node |
260 | * | ||
261 | * DESCRIPTION: Get the Node associated with a local or arg. | ||
232 | * | 262 | * |
233 | ******************************************************************************/ | 263 | ******************************************************************************/ |
234 | 264 | ||
@@ -249,7 +279,8 @@ acpi_ds_method_data_get_node ( | |||
249 | case AML_LOCAL_OP: | 279 | case AML_LOCAL_OP: |
250 | 280 | ||
251 | if (index > ACPI_METHOD_MAX_LOCAL) { | 281 | if (index > ACPI_METHOD_MAX_LOCAL) { |
252 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", | 282 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
283 | "Local index %d is invalid (max %d)\n", | ||
253 | index, ACPI_METHOD_MAX_LOCAL)); | 284 | index, ACPI_METHOD_MAX_LOCAL)); |
254 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 285 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); |
255 | } | 286 | } |
@@ -262,7 +293,8 @@ acpi_ds_method_data_get_node ( | |||
262 | case AML_ARG_OP: | 293 | case AML_ARG_OP: |
263 | 294 | ||
264 | if (index > ACPI_METHOD_MAX_ARG) { | 295 | if (index > ACPI_METHOD_MAX_ARG) { |
265 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", | 296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
297 | "Arg index %d is invalid (max %d)\n", | ||
266 | index, ACPI_METHOD_MAX_ARG)); | 298 | index, ACPI_METHOD_MAX_ARG)); |
267 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 299 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); |
268 | } | 300 | } |
@@ -286,7 +318,7 @@ acpi_ds_method_data_get_node ( | |||
286 | * FUNCTION: acpi_ds_method_data_set_value | 318 | * FUNCTION: acpi_ds_method_data_set_value |
287 | * | 319 | * |
288 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 320 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
289 | * Index - which local_var or argument to get | 321 | * Index - Which Local or Arg to get |
290 | * Object - Object to be inserted into the stack entry | 322 | * Object - Object to be inserted into the stack entry |
291 | * walk_state - Current walk state object | 323 | * walk_state - Current walk state object |
292 | * | 324 | * |
@@ -297,7 +329,7 @@ acpi_ds_method_data_get_node ( | |||
297 | * | 329 | * |
298 | ******************************************************************************/ | 330 | ******************************************************************************/ |
299 | 331 | ||
300 | acpi_status | 332 | static acpi_status |
301 | acpi_ds_method_data_set_value ( | 333 | acpi_ds_method_data_set_value ( |
302 | u16 opcode, | 334 | u16 opcode, |
303 | u32 index, | 335 | u32 index, |
@@ -340,68 +372,16 @@ acpi_ds_method_data_set_value ( | |||
340 | 372 | ||
341 | /******************************************************************************* | 373 | /******************************************************************************* |
342 | * | 374 | * |
343 | * FUNCTION: acpi_ds_method_data_get_type | ||
344 | * | ||
345 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | ||
346 | * Index - which local_var or argument whose type | ||
347 | * to get | ||
348 | * walk_state - Current walk state object | ||
349 | * | ||
350 | * RETURN: Data type of current value of the selected Arg or Local | ||
351 | * | ||
352 | ******************************************************************************/ | ||
353 | #ifdef ACPI_FUTURE_USAGE | ||
354 | acpi_object_type | ||
355 | acpi_ds_method_data_get_type ( | ||
356 | u16 opcode, | ||
357 | u32 index, | ||
358 | struct acpi_walk_state *walk_state) | ||
359 | { | ||
360 | acpi_status status; | ||
361 | struct acpi_namespace_node *node; | ||
362 | union acpi_operand_object *object; | ||
363 | |||
364 | |||
365 | ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); | ||
366 | |||
367 | |||
368 | /* Get the namespace node for the arg/local */ | ||
369 | |||
370 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | ||
371 | if (ACPI_FAILURE (status)) { | ||
372 | return_VALUE ((ACPI_TYPE_NOT_FOUND)); | ||
373 | } | ||
374 | |||
375 | /* Get the object */ | ||
376 | |||
377 | object = acpi_ns_get_attached_object (node); | ||
378 | if (!object) { | ||
379 | /* Uninitialized local/arg, return TYPE_ANY */ | ||
380 | |||
381 | return_VALUE (ACPI_TYPE_ANY); | ||
382 | } | ||
383 | |||
384 | /* Get the object type */ | ||
385 | |||
386 | return_VALUE (ACPI_GET_OBJECT_TYPE (object)); | ||
387 | } | ||
388 | #endif /* ACPI_FUTURE_USAGE */ | ||
389 | |||
390 | |||
391 | /******************************************************************************* | ||
392 | * | ||
393 | * FUNCTION: acpi_ds_method_data_get_value | 375 | * FUNCTION: acpi_ds_method_data_get_value |
394 | * | 376 | * |
395 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 377 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
396 | * Index - which local_var or argument to get | 378 | * Index - which local_var or argument to get |
397 | * walk_state - Current walk state object | 379 | * walk_state - Current walk state object |
398 | * *dest_desc - Ptr to Descriptor into which selected Arg | 380 | * dest_desc - Where Arg or Local value is returned |
399 | * or Local value should be copied | ||
400 | * | 381 | * |
401 | * RETURN: Status | 382 | * RETURN: Status |
402 | * | 383 | * |
403 | * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame | 384 | * DESCRIPTION: Retrieve value of selected Arg or Local for this method |
404 | * at the current top of the method stack. | ||
405 | * Used only in acpi_ex_resolve_to_value(). | 385 | * Used only in acpi_ex_resolve_to_value(). |
406 | * | 386 | * |
407 | ******************************************************************************/ | 387 | ******************************************************************************/ |
@@ -467,14 +447,16 @@ acpi_ds_method_data_get_value ( | |||
467 | else switch (opcode) { | 447 | else switch (opcode) { |
468 | case AML_ARG_OP: | 448 | case AML_ARG_OP: |
469 | 449 | ||
470 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n", | 450 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
451 | "Uninitialized Arg[%d] at node %p\n", | ||
471 | index, node)); | 452 | index, node)); |
472 | 453 | ||
473 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); | 454 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); |
474 | 455 | ||
475 | case AML_LOCAL_OP: | 456 | case AML_LOCAL_OP: |
476 | 457 | ||
477 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n", | 458 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
459 | "Uninitialized Local[%d] at node %p\n", | ||
478 | index, node)); | 460 | index, node)); |
479 | 461 | ||
480 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); | 462 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); |
@@ -506,12 +488,12 @@ acpi_ds_method_data_get_value ( | |||
506 | * | 488 | * |
507 | * RETURN: None | 489 | * RETURN: None |
508 | * | 490 | * |
509 | * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts | 491 | * DESCRIPTION: Delete the entry at Opcode:Index. Inserts |
510 | * a null into the stack slot after the object is deleted. | 492 | * a null into the stack slot after the object is deleted. |
511 | * | 493 | * |
512 | ******************************************************************************/ | 494 | ******************************************************************************/ |
513 | 495 | ||
514 | void | 496 | static void |
515 | acpi_ds_method_data_delete_value ( | 497 | acpi_ds_method_data_delete_value ( |
516 | u16 opcode, | 498 | u16 opcode, |
517 | u32 index, | 499 | u32 index, |
@@ -562,7 +544,7 @@ acpi_ds_method_data_delete_value ( | |||
562 | * FUNCTION: acpi_ds_store_object_to_local | 544 | * FUNCTION: acpi_ds_store_object_to_local |
563 | * | 545 | * |
564 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 546 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
565 | * Index - which local_var or argument to set | 547 | * Index - Which Local or Arg to set |
566 | * obj_desc - Value to be stored | 548 | * obj_desc - Value to be stored |
567 | * walk_state - Current walk state | 549 | * walk_state - Current walk state |
568 | * | 550 | * |
@@ -651,19 +633,20 @@ acpi_ds_store_object_to_local ( | |||
651 | */ | 633 | */ |
652 | if (opcode == AML_ARG_OP) { | 634 | if (opcode == AML_ARG_OP) { |
653 | /* | 635 | /* |
654 | * Make sure that the object is the correct type. This may be overkill, but | 636 | * Make sure that the object is the correct type. This may be |
655 | * it is here because references were NS nodes in the past. Now they are | 637 | * overkill, butit is here because references were NS nodes in |
656 | * operand objects of type Reference. | 638 | * the past. Now they are operand objects of type Reference. |
657 | */ | 639 | */ |
658 | if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 640 | if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
659 | ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n", | 641 | ACPI_REPORT_ERROR (( |
660 | acpi_ut_get_descriptor_name (current_obj_desc))); | 642 | "Invalid descriptor type while storing to method arg: [%s]\n", |
643 | acpi_ut_get_descriptor_name (current_obj_desc))); | ||
661 | return_ACPI_STATUS (AE_AML_INTERNAL); | 644 | return_ACPI_STATUS (AE_AML_INTERNAL); |
662 | } | 645 | } |
663 | 646 | ||
664 | /* | 647 | /* |
665 | * If we have a valid reference object that came from ref_of(), do the | 648 | * If we have a valid reference object that came from ref_of(), |
666 | * indirect store | 649 | * do the indirect store |
667 | */ | 650 | */ |
668 | if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && | 651 | if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && |
669 | (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { | 652 | (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { |
@@ -713,3 +696,55 @@ acpi_ds_store_object_to_local ( | |||
713 | } | 696 | } |
714 | 697 | ||
715 | 698 | ||
699 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
700 | /******************************************************************************* | ||
701 | * | ||
702 | * FUNCTION: acpi_ds_method_data_get_type | ||
703 | * | ||
704 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | ||
705 | * Index - Which Local or Arg whose type to get | ||
706 | * walk_state - Current walk state object | ||
707 | * | ||
708 | * RETURN: Data type of current value of the selected Arg or Local | ||
709 | * | ||
710 | * DESCRIPTION: Get the type of the object stored in the Local or Arg | ||
711 | * | ||
712 | ******************************************************************************/ | ||
713 | |||
714 | acpi_object_type | ||
715 | acpi_ds_method_data_get_type ( | ||
716 | u16 opcode, | ||
717 | u32 index, | ||
718 | struct acpi_walk_state *walk_state) | ||
719 | { | ||
720 | acpi_status status; | ||
721 | struct acpi_namespace_node *node; | ||
722 | union acpi_operand_object *object; | ||
723 | |||
724 | |||
725 | ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); | ||
726 | |||
727 | |||
728 | /* Get the namespace node for the arg/local */ | ||
729 | |||
730 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | ||
731 | if (ACPI_FAILURE (status)) { | ||
732 | return_VALUE ((ACPI_TYPE_NOT_FOUND)); | ||
733 | } | ||
734 | |||
735 | /* Get the object */ | ||
736 | |||
737 | object = acpi_ns_get_attached_object (node); | ||
738 | if (!object) { | ||
739 | /* Uninitialized local/arg, return TYPE_ANY */ | ||
740 | |||
741 | return_VALUE (ACPI_TYPE_ANY); | ||
742 | } | ||
743 | |||
744 | /* Get the object type */ | ||
745 | |||
746 | return_VALUE (ACPI_GET_OBJECT_TYPE (object)); | ||
747 | } | ||
748 | #endif | ||
749 | |||
750 | |||
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index eb8af4785bcb..bfbae4e4c667 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -52,9 +52,15 @@ | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsobject") | 53 | ACPI_MODULE_NAME ("dsobject") |
54 | 54 | ||
55 | static acpi_status | ||
56 | acpi_ds_build_internal_object ( | ||
57 | struct acpi_walk_state *walk_state, | ||
58 | union acpi_parse_object *op, | ||
59 | union acpi_operand_object **obj_desc_ptr); | ||
60 | |||
55 | 61 | ||
56 | #ifndef ACPI_NO_METHOD_EXECUTION | 62 | #ifndef ACPI_NO_METHOD_EXECUTION |
57 | /***************************************************************************** | 63 | /******************************************************************************* |
58 | * | 64 | * |
59 | * FUNCTION: acpi_ds_build_internal_object | 65 | * FUNCTION: acpi_ds_build_internal_object |
60 | * | 66 | * |
@@ -67,9 +73,9 @@ | |||
67 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object | 73 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object |
68 | * Simple objects are any objects other than a package object! | 74 | * Simple objects are any objects other than a package object! |
69 | * | 75 | * |
70 | ****************************************************************************/ | 76 | ******************************************************************************/ |
71 | 77 | ||
72 | acpi_status | 78 | static acpi_status |
73 | acpi_ds_build_internal_object ( | 79 | acpi_ds_build_internal_object ( |
74 | struct acpi_walk_state *walk_state, | 80 | struct acpi_walk_state *walk_state, |
75 | union acpi_parse_object *op, | 81 | union acpi_parse_object *op, |
@@ -90,9 +96,11 @@ acpi_ds_build_internal_object ( | |||
90 | * Otherwise, go ahead and look it up now | 96 | * Otherwise, go ahead and look it up now |
91 | */ | 97 | */ |
92 | if (!op->common.node) { | 98 | if (!op->common.node) { |
93 | status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, | 99 | status = acpi_ns_lookup (walk_state->scope_info, |
100 | op->common.value.string, | ||
94 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 101 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
95 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, | 102 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
103 | NULL, | ||
96 | (struct acpi_namespace_node **) &(op->common.node)); | 104 | (struct acpi_namespace_node **) &(op->common.node)); |
97 | 105 | ||
98 | if (ACPI_FAILURE (status)) { | 106 | if (ACPI_FAILURE (status)) { |
@@ -104,12 +112,14 @@ acpi_ds_build_internal_object ( | |||
104 | 112 | ||
105 | /* Create and init the internal ACPI object */ | 113 | /* Create and init the internal ACPI object */ |
106 | 114 | ||
107 | obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | 115 | obj_desc = acpi_ut_create_internal_object ( |
116 | (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | ||
108 | if (!obj_desc) { | 117 | if (!obj_desc) { |
109 | return_ACPI_STATUS (AE_NO_MEMORY); | 118 | return_ACPI_STATUS (AE_NO_MEMORY); |
110 | } | 119 | } |
111 | 120 | ||
112 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc); | 121 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, |
122 | &obj_desc); | ||
113 | if (ACPI_FAILURE (status)) { | 123 | if (ACPI_FAILURE (status)) { |
114 | acpi_ut_remove_reference (obj_desc); | 124 | acpi_ut_remove_reference (obj_desc); |
115 | return_ACPI_STATUS (status); | 125 | return_ACPI_STATUS (status); |
@@ -120,7 +130,7 @@ acpi_ds_build_internal_object ( | |||
120 | } | 130 | } |
121 | 131 | ||
122 | 132 | ||
123 | /***************************************************************************** | 133 | /******************************************************************************* |
124 | * | 134 | * |
125 | * FUNCTION: acpi_ds_build_internal_buffer_obj | 135 | * FUNCTION: acpi_ds_build_internal_buffer_obj |
126 | * | 136 | * |
@@ -134,7 +144,7 @@ acpi_ds_build_internal_object ( | |||
134 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 144 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
135 | * namespace object | 145 | * namespace object |
136 | * | 146 | * |
137 | ****************************************************************************/ | 147 | ******************************************************************************/ |
138 | 148 | ||
139 | acpi_status | 149 | acpi_status |
140 | acpi_ds_build_internal_buffer_obj ( | 150 | acpi_ds_build_internal_buffer_obj ( |
@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
229 | } | 239 | } |
230 | 240 | ||
231 | 241 | ||
232 | /***************************************************************************** | 242 | /******************************************************************************* |
233 | * | 243 | * |
234 | * FUNCTION: acpi_ds_build_internal_package_obj | 244 | * FUNCTION: acpi_ds_build_internal_package_obj |
235 | * | 245 | * |
@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
243 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 253 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
244 | * namespace object | 254 | * namespace object |
245 | * | 255 | * |
246 | ****************************************************************************/ | 256 | ******************************************************************************/ |
247 | 257 | ||
248 | acpi_status | 258 | acpi_status |
249 | acpi_ds_build_internal_package_obj ( | 259 | acpi_ds_build_internal_package_obj ( |
@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj ( | |||
331 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 341 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
332 | /* Object (package or buffer) is already built */ | 342 | /* Object (package or buffer) is already built */ |
333 | 343 | ||
334 | obj_desc->package.elements[i] = ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | 344 | obj_desc->package.elements[i] = |
345 | ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | ||
335 | } | 346 | } |
336 | else { | 347 | else { |
337 | status = acpi_ds_build_internal_object (walk_state, arg, | 348 | status = acpi_ds_build_internal_object (walk_state, arg, |
338 | &obj_desc->package.elements[i]); | 349 | &obj_desc->package.elements[i]); |
339 | } | 350 | } |
340 | 351 | ||
341 | i++; | 352 | i++; |
@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj ( | |||
348 | } | 359 | } |
349 | 360 | ||
350 | 361 | ||
351 | /***************************************************************************** | 362 | /******************************************************************************* |
352 | * | 363 | * |
353 | * FUNCTION: acpi_ds_create_node | 364 | * FUNCTION: acpi_ds_create_node |
354 | * | 365 | * |
@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj ( | |||
360 | * | 371 | * |
361 | * DESCRIPTION: Create the object to be associated with a namespace node | 372 | * DESCRIPTION: Create the object to be associated with a namespace node |
362 | * | 373 | * |
363 | ****************************************************************************/ | 374 | ******************************************************************************/ |
364 | 375 | ||
365 | acpi_status | 376 | acpi_status |
366 | acpi_ds_create_node ( | 377 | acpi_ds_create_node ( |
@@ -392,7 +403,8 @@ acpi_ds_create_node ( | |||
392 | 403 | ||
393 | /* Build an internal object for the argument(s) */ | 404 | /* Build an internal object for the argument(s) */ |
394 | 405 | ||
395 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc); | 406 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, |
407 | &obj_desc); | ||
396 | if (ACPI_FAILURE (status)) { | 408 | if (ACPI_FAILURE (status)) { |
397 | return_ACPI_STATUS (status); | 409 | return_ACPI_STATUS (status); |
398 | } | 410 | } |
@@ -414,7 +426,7 @@ acpi_ds_create_node ( | |||
414 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 426 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
415 | 427 | ||
416 | 428 | ||
417 | /***************************************************************************** | 429 | /******************************************************************************* |
418 | * | 430 | * |
419 | * FUNCTION: acpi_ds_init_object_from_op | 431 | * FUNCTION: acpi_ds_init_object_from_op |
420 | * | 432 | * |
@@ -429,7 +441,7 @@ acpi_ds_create_node ( | |||
429 | * associated arguments. The namespace object is a more compact | 441 | * associated arguments. The namespace object is a more compact |
430 | * representation of the Op and its arguments. | 442 | * representation of the Op and its arguments. |
431 | * | 443 | * |
432 | ****************************************************************************/ | 444 | ******************************************************************************/ |
433 | 445 | ||
434 | acpi_status | 446 | acpi_status |
435 | acpi_ds_init_object_from_op ( | 447 | acpi_ds_init_object_from_op ( |
@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op ( | |||
462 | /* | 474 | /* |
463 | * Defer evaluation of Buffer term_arg operand | 475 | * Defer evaluation of Buffer term_arg operand |
464 | */ | 476 | */ |
465 | obj_desc->buffer.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 477 | obj_desc->buffer.node = (struct acpi_namespace_node *) |
478 | walk_state->operands[0]; | ||
466 | obj_desc->buffer.aml_start = op->named.data; | 479 | obj_desc->buffer.aml_start = op->named.data; |
467 | obj_desc->buffer.aml_length = op->named.length; | 480 | obj_desc->buffer.aml_length = op->named.length; |
468 | break; | 481 | break; |
@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op ( | |||
473 | /* | 486 | /* |
474 | * Defer evaluation of Package term_arg operand | 487 | * Defer evaluation of Package term_arg operand |
475 | */ | 488 | */ |
476 | obj_desc->package.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 489 | obj_desc->package.node = (struct acpi_namespace_node *) |
490 | walk_state->operands[0]; | ||
477 | obj_desc->package.aml_start = op->named.data; | 491 | obj_desc->package.aml_start = op->named.data; |
478 | obj_desc->package.aml_length = op->named.length; | 492 | obj_desc->package.aml_length = op->named.length; |
479 | break; | 493 | break; |
@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op ( | |||
486 | /* | 500 | /* |
487 | * Resolve AML Constants here - AND ONLY HERE! | 501 | * Resolve AML Constants here - AND ONLY HERE! |
488 | * All constants are integers. | 502 | * All constants are integers. |
489 | * We mark the integer with a flag that indicates that it started life | 503 | * We mark the integer with a flag that indicates that it started |
490 | * as a constant -- so that stores to constants will perform as expected (noop). | 504 | * life as a constant -- so that stores to constants will perform |
491 | * (zero_op is used as a placeholder for optional target operands.) | 505 | * as expected (noop). zero_op is used as a placeholder for optional |
506 | * target operands. | ||
492 | */ | 507 | */ |
493 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; | 508 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; |
494 | 509 | ||
@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op ( | |||
521 | 536 | ||
522 | default: | 537 | default: |
523 | 538 | ||
524 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode)); | 539 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
540 | "Unknown constant opcode %X\n", opcode)); | ||
525 | status = AE_AML_OPERAND_TYPE; | 541 | status = AE_AML_OPERAND_TYPE; |
526 | break; | 542 | break; |
527 | } | 543 | } |
@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op ( | |||
535 | 551 | ||
536 | 552 | ||
537 | default: | 553 | default: |
538 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type)); | 554 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", |
555 | op_info->type)); | ||
539 | status = AE_AML_OPERAND_TYPE; | 556 | status = AE_AML_OPERAND_TYPE; |
540 | break; | 557 | break; |
541 | } | 558 | } |
@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op ( | |||
570 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; | 587 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; |
571 | 588 | ||
572 | #ifndef ACPI_NO_METHOD_EXECUTION | 589 | #ifndef ACPI_NO_METHOD_EXECUTION |
573 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset, | 590 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, |
574 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 591 | obj_desc->reference.offset, |
592 | walk_state, | ||
593 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
575 | #endif | 594 | #endif |
576 | break; | 595 | break; |
577 | 596 | ||
@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op ( | |||
584 | obj_desc->reference.offset = opcode - AML_ARG_OP; | 603 | obj_desc->reference.offset = opcode - AML_ARG_OP; |
585 | 604 | ||
586 | #ifndef ACPI_NO_METHOD_EXECUTION | 605 | #ifndef ACPI_NO_METHOD_EXECUTION |
587 | status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, | 606 | status = acpi_ds_method_data_get_node (AML_ARG_OP, |
588 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 607 | obj_desc->reference.offset, |
608 | walk_state, | ||
609 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
589 | #endif | 610 | #endif |
590 | break; | 611 | break; |
591 | 612 | ||
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 5c987a0e7b75..ba13bca28bee 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -54,12 +54,31 @@ | |||
54 | #define _COMPONENT ACPI_DISPATCHER | 54 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME ("dsopcode") | 55 | ACPI_MODULE_NAME ("dsopcode") |
56 | 56 | ||
57 | /* Local prototypes */ | ||
57 | 58 | ||
58 | /***************************************************************************** | 59 | static acpi_status |
60 | acpi_ds_execute_arguments ( | ||
61 | struct acpi_namespace_node *node, | ||
62 | struct acpi_namespace_node *scope_node, | ||
63 | u32 aml_length, | ||
64 | u8 *aml_start); | ||
65 | |||
66 | static acpi_status | ||
67 | acpi_ds_init_buffer_field ( | ||
68 | u16 aml_opcode, | ||
69 | union acpi_operand_object *obj_desc, | ||
70 | union acpi_operand_object *buffer_desc, | ||
71 | union acpi_operand_object *offset_desc, | ||
72 | union acpi_operand_object *length_desc, | ||
73 | union acpi_operand_object *result_desc); | ||
74 | |||
75 | |||
76 | /******************************************************************************* | ||
59 | * | 77 | * |
60 | * FUNCTION: acpi_ds_execute_arguments | 78 | * FUNCTION: acpi_ds_execute_arguments |
61 | * | 79 | * |
62 | * PARAMETERS: Node - Parent NS node | 80 | * PARAMETERS: Node - Object NS node |
81 | * scope_node - Parent NS node | ||
63 | * aml_length - Length of executable AML | 82 | * aml_length - Length of executable AML |
64 | * aml_start - Pointer to the AML | 83 | * aml_start - Pointer to the AML |
65 | * | 84 | * |
@@ -67,9 +86,9 @@ | |||
67 | * | 86 | * |
68 | * DESCRIPTION: Late (deferred) execution of region or field arguments | 87 | * DESCRIPTION: Late (deferred) execution of region or field arguments |
69 | * | 88 | * |
70 | ****************************************************************************/ | 89 | ******************************************************************************/ |
71 | 90 | ||
72 | acpi_status | 91 | static acpi_status |
73 | acpi_ds_execute_arguments ( | 92 | acpi_ds_execute_arguments ( |
74 | struct acpi_namespace_node *node, | 93 | struct acpi_namespace_node *node, |
75 | struct acpi_namespace_node *scope_node, | 94 | struct acpi_namespace_node *scope_node, |
@@ -162,7 +181,7 @@ acpi_ds_execute_arguments ( | |||
162 | } | 181 | } |
163 | 182 | ||
164 | 183 | ||
165 | /***************************************************************************** | 184 | /******************************************************************************* |
166 | * | 185 | * |
167 | * FUNCTION: acpi_ds_get_buffer_field_arguments | 186 | * FUNCTION: acpi_ds_get_buffer_field_arguments |
168 | * | 187 | * |
@@ -173,7 +192,7 @@ acpi_ds_execute_arguments ( | |||
173 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late | 192 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late |
174 | * evaluation of these field attributes. | 193 | * evaluation of these field attributes. |
175 | * | 194 | * |
176 | ****************************************************************************/ | 195 | ******************************************************************************/ |
177 | 196 | ||
178 | acpi_status | 197 | acpi_status |
179 | acpi_ds_get_buffer_field_arguments ( | 198 | acpi_ds_get_buffer_field_arguments ( |
@@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments ( | |||
208 | } | 227 | } |
209 | 228 | ||
210 | 229 | ||
211 | /***************************************************************************** | 230 | /******************************************************************************* |
212 | * | 231 | * |
213 | * FUNCTION: acpi_ds_get_buffer_arguments | 232 | * FUNCTION: acpi_ds_get_buffer_arguments |
214 | * | 233 | * |
@@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments ( | |||
219 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements | 238 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements |
220 | * the late evaluation of these attributes. | 239 | * the late evaluation of these attributes. |
221 | * | 240 | * |
222 | ****************************************************************************/ | 241 | ******************************************************************************/ |
223 | 242 | ||
224 | acpi_status | 243 | acpi_status |
225 | acpi_ds_get_buffer_arguments ( | 244 | acpi_ds_get_buffer_arguments ( |
@@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments ( | |||
255 | } | 274 | } |
256 | 275 | ||
257 | 276 | ||
258 | /***************************************************************************** | 277 | /******************************************************************************* |
259 | * | 278 | * |
260 | * FUNCTION: acpi_ds_get_package_arguments | 279 | * FUNCTION: acpi_ds_get_package_arguments |
261 | * | 280 | * |
@@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments ( | |||
266 | * DESCRIPTION: Get Package length and initializer byte list. This implements | 285 | * DESCRIPTION: Get Package length and initializer byte list. This implements |
267 | * the late evaluation of these attributes. | 286 | * the late evaluation of these attributes. |
268 | * | 287 | * |
269 | ****************************************************************************/ | 288 | ******************************************************************************/ |
270 | 289 | ||
271 | acpi_status | 290 | acpi_status |
272 | acpi_ds_get_package_arguments ( | 291 | acpi_ds_get_package_arguments ( |
@@ -353,17 +372,17 @@ acpi_ds_get_region_arguments ( | |||
353 | } | 372 | } |
354 | 373 | ||
355 | 374 | ||
356 | /***************************************************************************** | 375 | /******************************************************************************* |
357 | * | 376 | * |
358 | * FUNCTION: acpi_ds_initialize_region | 377 | * FUNCTION: acpi_ds_initialize_region |
359 | * | 378 | * |
360 | * PARAMETERS: Op - A valid region Op object | 379 | * PARAMETERS: obj_handle - Region namespace node |
361 | * | 380 | * |
362 | * RETURN: Status | 381 | * RETURN: Status |
363 | * | 382 | * |
364 | * DESCRIPTION: Front end to ev_initialize_region | 383 | * DESCRIPTION: Front end to ev_initialize_region |
365 | * | 384 | * |
366 | ****************************************************************************/ | 385 | ******************************************************************************/ |
367 | 386 | ||
368 | acpi_status | 387 | acpi_status |
369 | acpi_ds_initialize_region ( | 388 | acpi_ds_initialize_region ( |
@@ -382,7 +401,7 @@ acpi_ds_initialize_region ( | |||
382 | } | 401 | } |
383 | 402 | ||
384 | 403 | ||
385 | /***************************************************************************** | 404 | /******************************************************************************* |
386 | * | 405 | * |
387 | * FUNCTION: acpi_ds_init_buffer_field | 406 | * FUNCTION: acpi_ds_init_buffer_field |
388 | * | 407 | * |
@@ -390,16 +409,16 @@ acpi_ds_initialize_region ( | |||
390 | * obj_desc - buffer_field object | 409 | * obj_desc - buffer_field object |
391 | * buffer_desc - Host Buffer | 410 | * buffer_desc - Host Buffer |
392 | * offset_desc - Offset into buffer | 411 | * offset_desc - Offset into buffer |
393 | * Length - Length of field (CREATE_FIELD_OP only) | 412 | * length_desc - Length of field (CREATE_FIELD_OP only) |
394 | * Result - Where to store the result | 413 | * result_desc - Where to store the result |
395 | * | 414 | * |
396 | * RETURN: Status | 415 | * RETURN: Status |
397 | * | 416 | * |
398 | * DESCRIPTION: Perform actual initialization of a buffer field | 417 | * DESCRIPTION: Perform actual initialization of a buffer field |
399 | * | 418 | * |
400 | ****************************************************************************/ | 419 | ******************************************************************************/ |
401 | 420 | ||
402 | acpi_status | 421 | static acpi_status |
403 | acpi_ds_init_buffer_field ( | 422 | acpi_ds_init_buffer_field ( |
404 | u16 aml_opcode, | 423 | u16 aml_opcode, |
405 | union acpi_operand_object *obj_desc, | 424 | union acpi_operand_object *obj_desc, |
@@ -435,8 +454,10 @@ acpi_ds_init_buffer_field ( | |||
435 | * after resolution in acpi_ex_resolve_operands(). | 454 | * after resolution in acpi_ex_resolve_operands(). |
436 | */ | 455 | */ |
437 | if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { | 456 | if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { |
438 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", | 457 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
439 | acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc))); | 458 | "(%s) destination not a NS Node [%s]\n", |
459 | acpi_ps_get_opcode_name (aml_opcode), | ||
460 | acpi_ut_get_descriptor_name (result_desc))); | ||
440 | 461 | ||
441 | status = AE_AML_OPERAND_TYPE; | 462 | status = AE_AML_OPERAND_TYPE; |
442 | goto cleanup; | 463 | goto cleanup; |
@@ -452,9 +473,18 @@ acpi_ds_init_buffer_field ( | |||
452 | 473 | ||
453 | /* Offset is in bits, count is in bits */ | 474 | /* Offset is in bits, count is in bits */ |
454 | 475 | ||
476 | field_flags = AML_FIELD_ACCESS_BYTE; | ||
455 | bit_offset = offset; | 477 | bit_offset = offset; |
456 | bit_count = (u32) length_desc->integer.value; | 478 | bit_count = (u32) length_desc->integer.value; |
457 | field_flags = AML_FIELD_ACCESS_BYTE; | 479 | |
480 | /* Must have a valid (>0) bit count */ | ||
481 | |||
482 | if (bit_count == 0) { | ||
483 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
484 | "Attempt to create_field of length 0\n")); | ||
485 | status = AE_AML_OPERAND_VALUE; | ||
486 | goto cleanup; | ||
487 | } | ||
458 | break; | 488 | break; |
459 | 489 | ||
460 | case AML_CREATE_BIT_FIELD_OP: | 490 | case AML_CREATE_BIT_FIELD_OP: |
@@ -527,7 +557,8 @@ acpi_ds_init_buffer_field ( | |||
527 | 557 | ||
528 | /* | 558 | /* |
529 | * Initialize areas of the field object that are common to all fields | 559 | * Initialize areas of the field object that are common to all fields |
530 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) | 560 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), |
561 | * UPDATE_RULE = 0 (UPDATE_PRESERVE) | ||
531 | */ | 562 | */ |
532 | status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, | 563 | status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, |
533 | bit_offset, bit_count); | 564 | bit_offset, bit_count); |
@@ -539,8 +570,8 @@ acpi_ds_init_buffer_field ( | |||
539 | 570 | ||
540 | /* Reference count for buffer_desc inherits obj_desc count */ | 571 | /* Reference count for buffer_desc inherits obj_desc count */ |
541 | 572 | ||
542 | buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count + | 573 | buffer_desc->common.reference_count = (u16) |
543 | obj_desc->common.reference_count); | 574 | (buffer_desc->common.reference_count + obj_desc->common.reference_count); |
544 | 575 | ||
545 | 576 | ||
546 | cleanup: | 577 | cleanup: |
@@ -569,7 +600,7 @@ cleanup: | |||
569 | } | 600 | } |
570 | 601 | ||
571 | 602 | ||
572 | /***************************************************************************** | 603 | /******************************************************************************* |
573 | * | 604 | * |
574 | * FUNCTION: acpi_ds_eval_buffer_field_operands | 605 | * FUNCTION: acpi_ds_eval_buffer_field_operands |
575 | * | 606 | * |
@@ -581,7 +612,7 @@ cleanup: | |||
581 | * DESCRIPTION: Get buffer_field Buffer and Index | 612 | * DESCRIPTION: Get buffer_field Buffer and Index |
582 | * Called from acpi_ds_exec_end_op during buffer_field parse tree walk | 613 | * Called from acpi_ds_exec_end_op during buffer_field parse tree walk |
583 | * | 614 | * |
584 | ****************************************************************************/ | 615 | ******************************************************************************/ |
585 | 616 | ||
586 | acpi_status | 617 | acpi_status |
587 | acpi_ds_eval_buffer_field_operands ( | 618 | acpi_ds_eval_buffer_field_operands ( |
@@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands ( | |||
656 | } | 687 | } |
657 | 688 | ||
658 | 689 | ||
659 | /***************************************************************************** | 690 | /******************************************************************************* |
660 | * | 691 | * |
661 | * FUNCTION: acpi_ds_eval_region_operands | 692 | * FUNCTION: acpi_ds_eval_region_operands |
662 | * | 693 | * |
@@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands ( | |||
668 | * DESCRIPTION: Get region address and length | 699 | * DESCRIPTION: Get region address and length |
669 | * Called from acpi_ds_exec_end_op during op_region parse tree walk | 700 | * Called from acpi_ds_exec_end_op during op_region parse tree walk |
670 | * | 701 | * |
671 | ****************************************************************************/ | 702 | ******************************************************************************/ |
672 | 703 | ||
673 | acpi_status | 704 | acpi_status |
674 | acpi_ds_eval_region_operands ( | 705 | acpi_ds_eval_region_operands ( |
@@ -686,7 +717,8 @@ acpi_ds_eval_region_operands ( | |||
686 | 717 | ||
687 | 718 | ||
688 | /* | 719 | /* |
689 | * This is where we evaluate the address and length fields of the op_region declaration | 720 | * This is where we evaluate the address and length fields of the |
721 | * op_region declaration | ||
690 | */ | 722 | */ |
691 | node = op->common.node; | 723 | node = op->common.node; |
692 | 724 | ||
@@ -707,7 +739,8 @@ acpi_ds_eval_region_operands ( | |||
707 | 739 | ||
708 | /* Resolve the length and address operands to numbers */ | 740 | /* Resolve the length and address operands to numbers */ |
709 | 741 | ||
710 | status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state); | 742 | status = acpi_ex_resolve_operands (op->common.aml_opcode, |
743 | ACPI_WALK_OPERANDS, walk_state); | ||
711 | if (ACPI_FAILURE (status)) { | 744 | if (ACPI_FAILURE (status)) { |
712 | return_ACPI_STATUS (status); | 745 | return_ACPI_STATUS (status); |
713 | } | 746 | } |
@@ -736,7 +769,8 @@ acpi_ds_eval_region_operands ( | |||
736 | */ | 769 | */ |
737 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; | 770 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; |
738 | 771 | ||
739 | obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value; | 772 | obj_desc->region.address = (acpi_physical_address) |
773 | operand_desc->integer.value; | ||
740 | acpi_ut_remove_reference (operand_desc); | 774 | acpi_ut_remove_reference (operand_desc); |
741 | 775 | ||
742 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 776 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", |
@@ -752,7 +786,7 @@ acpi_ds_eval_region_operands ( | |||
752 | } | 786 | } |
753 | 787 | ||
754 | 788 | ||
755 | /***************************************************************************** | 789 | /******************************************************************************* |
756 | * | 790 | * |
757 | * FUNCTION: acpi_ds_eval_data_object_operands | 791 | * FUNCTION: acpi_ds_eval_data_object_operands |
758 | * | 792 | * |
@@ -765,7 +799,7 @@ acpi_ds_eval_region_operands ( | |||
765 | * DESCRIPTION: Get the operands and complete the following data object types: | 799 | * DESCRIPTION: Get the operands and complete the following data object types: |
766 | * Buffer, Package. | 800 | * Buffer, Package. |
767 | * | 801 | * |
768 | ****************************************************************************/ | 802 | ******************************************************************************/ |
769 | 803 | ||
770 | acpi_status | 804 | acpi_status |
771 | acpi_ds_eval_data_object_operands ( | 805 | acpi_ds_eval_data_object_operands ( |
@@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands ( | |||
830 | 864 | ||
831 | if (ACPI_SUCCESS (status)) { | 865 | if (ACPI_SUCCESS (status)) { |
832 | /* | 866 | /* |
833 | * Return the object in the walk_state, unless the parent is a package -- | 867 | * Return the object in the walk_state, unless the parent is a package - |
834 | * in this case, the return object will be stored in the parse tree | 868 | * in this case, the return object will be stored in the parse tree |
835 | * for the package. | 869 | * for the package. |
836 | */ | 870 | */ |
@@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op ( | |||
988 | status = AE_CTRL_PENDING; | 1022 | status = AE_CTRL_PENDING; |
989 | } | 1023 | } |
990 | 1024 | ||
991 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); | 1025 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
1026 | "[WHILE_OP] termination! Op=%p\n",op)); | ||
992 | 1027 | ||
993 | /* Pop this control state and free it */ | 1028 | /* Pop this control state and free it */ |
994 | 1029 | ||
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 462c5d83e747..9613349ac31d 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return ( | |||
100 | 100 | ||
101 | 101 | ||
102 | #ifndef ACPI_NO_METHOD_EXECUTION | 102 | #ifndef ACPI_NO_METHOD_EXECUTION |
103 | |||
104 | /******************************************************************************* | 103 | /******************************************************************************* |
105 | * | 104 | * |
106 | * FUNCTION: acpi_ds_do_implicit_return | 105 | * FUNCTION: acpi_ds_do_implicit_return |
@@ -205,7 +204,7 @@ acpi_ds_is_result_used ( | |||
205 | * NOTE: this is optional because the ASL language does not actually | 204 | * NOTE: this is optional because the ASL language does not actually |
206 | * support this behavior. | 205 | * support this behavior. |
207 | */ | 206 | */ |
208 | acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); | 207 | (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); |
209 | 208 | ||
210 | /* | 209 | /* |
211 | * Now determine if the parent will use the result | 210 | * Now determine if the parent will use the result |
@@ -219,8 +218,9 @@ acpi_ds_is_result_used ( | |||
219 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 218 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
220 | /* No parent, the return value cannot possibly be used */ | 219 | /* No parent, the return value cannot possibly be used */ |
221 | 220 | ||
222 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n", | 221 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
223 | acpi_ps_get_opcode_name (op->common.aml_opcode))); | 222 | "At Method level, result of [%s] not used\n", |
223 | acpi_ps_get_opcode_name (op->common.aml_opcode))); | ||
224 | return_VALUE (FALSE); | 224 | return_VALUE (FALSE); |
225 | } | 225 | } |
226 | 226 | ||
@@ -228,7 +228,8 @@ acpi_ds_is_result_used ( | |||
228 | 228 | ||
229 | parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); | 229 | parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); |
230 | if (parent_info->class == AML_CLASS_UNKNOWN) { | 230 | if (parent_info->class == AML_CLASS_UNKNOWN) { |
231 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); | 231 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
232 | "Unknown parent opcode. Op=%p\n", op)); | ||
232 | return_VALUE (FALSE); | 233 | return_VALUE (FALSE); |
233 | } | 234 | } |
234 | 235 | ||
@@ -309,17 +310,19 @@ acpi_ds_is_result_used ( | |||
309 | 310 | ||
310 | 311 | ||
311 | result_used: | 312 | result_used: |
312 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", | 313 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
313 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 314 | "Result of [%s] used by Parent [%s] Op=%p\n", |
314 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | 315 | acpi_ps_get_opcode_name (op->common.aml_opcode), |
316 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | ||
315 | 317 | ||
316 | return_VALUE (TRUE); | 318 | return_VALUE (TRUE); |
317 | 319 | ||
318 | 320 | ||
319 | result_not_used: | 321 | result_not_used: |
320 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", | 322 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
321 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 323 | "Result of [%s] not used by Parent [%s] Op=%p\n", |
322 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | 324 | acpi_ps_get_opcode_name (op->common.aml_opcode), |
325 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | ||
323 | 326 | ||
324 | return_VALUE (FALSE); | 327 | return_VALUE (FALSE); |
325 | } | 328 | } |
@@ -522,7 +525,8 @@ acpi_ds_create_operand ( | |||
522 | if ((walk_state->deferred_node) && | 525 | if ((walk_state->deferred_node) && |
523 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && | 526 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && |
524 | (arg_index != 0)) { | 527 | (arg_index != 0)) { |
525 | obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node); | 528 | obj_desc = ACPI_CAST_PTR ( |
529 | union acpi_operand_object, walk_state->deferred_node); | ||
526 | status = AE_OK; | 530 | status = AE_OK; |
527 | } | 531 | } |
528 | else /* All other opcodes */ { | 532 | else /* All other opcodes */ { |
@@ -565,7 +569,8 @@ acpi_ds_create_operand ( | |||
565 | * indicate this to the interpreter, set the | 569 | * indicate this to the interpreter, set the |
566 | * object to the root | 570 | * object to the root |
567 | */ | 571 | */ |
568 | obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node); | 572 | obj_desc = ACPI_CAST_PTR ( |
573 | union acpi_operand_object, acpi_gbl_root_node); | ||
569 | status = AE_OK; | 574 | status = AE_OK; |
570 | } | 575 | } |
571 | else { | 576 | else { |
@@ -612,7 +617,8 @@ acpi_ds_create_operand ( | |||
612 | */ | 617 | */ |
613 | opcode = AML_ZERO_OP; /* Has no arguments! */ | 618 | opcode = AML_ZERO_OP; /* Has no arguments! */ |
614 | 619 | ||
615 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg)); | 620 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
621 | "Null namepath: Arg=%p\n", arg)); | ||
616 | } | 622 | } |
617 | else { | 623 | else { |
618 | opcode = arg->common.aml_opcode; | 624 | opcode = arg->common.aml_opcode; |
@@ -642,7 +648,8 @@ acpi_ds_create_operand ( | |||
642 | * Only error is underflow, and this indicates | 648 | * Only error is underflow, and this indicates |
643 | * a missing or null operand! | 649 | * a missing or null operand! |
644 | */ | 650 | */ |
645 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n", | 651 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
652 | "Missing or null operand, %s\n", | ||
646 | acpi_format_exception (status))); | 653 | acpi_format_exception (status))); |
647 | return_ACPI_STATUS (status); | 654 | return_ACPI_STATUS (status); |
648 | } | 655 | } |
@@ -657,8 +664,8 @@ acpi_ds_create_operand ( | |||
657 | 664 | ||
658 | /* Initialize the new object */ | 665 | /* Initialize the new object */ |
659 | 666 | ||
660 | status = acpi_ds_init_object_from_op (walk_state, arg, | 667 | status = acpi_ds_init_object_from_op ( |
661 | opcode, &obj_desc); | 668 | walk_state, arg, opcode, &obj_desc); |
662 | if (ACPI_FAILURE (status)) { | 669 | if (ACPI_FAILURE (status)) { |
663 | acpi_ut_delete_object_desc (obj_desc); | 670 | acpi_ut_delete_object_desc (obj_desc); |
664 | return_ACPI_STATUS (status); | 671 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 2071a0d2bbbb..10f71318e23b 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { | |||
73 | acpi_ex_opcode_3A_1T_1R, | 73 | acpi_ex_opcode_3A_1T_1R, |
74 | acpi_ex_opcode_6A_0T_1R}; | 74 | acpi_ex_opcode_6A_0T_1R}; |
75 | 75 | ||
76 | |||
76 | /***************************************************************************** | 77 | /***************************************************************************** |
77 | * | 78 | * |
78 | * FUNCTION: acpi_ds_get_predicate_value | 79 | * FUNCTION: acpi_ds_get_predicate_value |
79 | * | 80 | * |
80 | * PARAMETERS: walk_state - Current state of the parse tree walk | 81 | * PARAMETERS: walk_state - Current state of the parse tree walk |
82 | * result_obj - if non-zero, pop result from result stack | ||
81 | * | 83 | * |
82 | * RETURN: Status | 84 | * RETURN: Status |
83 | * | 85 | * |
@@ -124,7 +126,8 @@ acpi_ds_get_predicate_value ( | |||
124 | } | 126 | } |
125 | 127 | ||
126 | if (!obj_desc) { | 128 | if (!obj_desc) { |
127 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate obj_desc=%p State=%p\n", | 129 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
130 | "No predicate obj_desc=%p State=%p\n", | ||
128 | obj_desc, walk_state)); | 131 | obj_desc, walk_state)); |
129 | 132 | ||
130 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 133 | return_ACPI_STATUS (AE_AML_NO_OPERAND); |
@@ -197,7 +200,7 @@ cleanup: | |||
197 | * FUNCTION: acpi_ds_exec_begin_op | 200 | * FUNCTION: acpi_ds_exec_begin_op |
198 | * | 201 | * |
199 | * PARAMETERS: walk_state - Current state of the parse tree walk | 202 | * PARAMETERS: walk_state - Current state of the parse tree walk |
200 | * out_op - Return op if a new one is created | 203 | * out_op - Where to return op if a new one is created |
201 | * | 204 | * |
202 | * RETURN: Status | 205 | * RETURN: Status |
203 | * | 206 | * |
@@ -233,7 +236,8 @@ acpi_ds_exec_begin_op ( | |||
233 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); | 236 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); |
234 | 237 | ||
235 | if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { | 238 | if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { |
236 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 239 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
240 | "(%s) Popping scope for Op %p\n", | ||
237 | acpi_ut_get_type_name (walk_state->op_info->object_type), op)); | 241 | acpi_ut_get_type_name (walk_state->op_info->object_type), op)); |
238 | 242 | ||
239 | status = acpi_ds_scope_stack_pop (walk_state); | 243 | status = acpi_ds_scope_stack_pop (walk_state); |
@@ -297,11 +301,10 @@ acpi_ds_exec_begin_op ( | |||
297 | 301 | ||
298 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 302 | if (walk_state->walk_type == ACPI_WALK_METHOD) { |
299 | /* | 303 | /* |
300 | * Found a named object declaration during method | 304 | * Found a named object declaration during method execution; |
301 | * execution; we must enter this object into the | 305 | * we must enter this object into the namespace. The created |
302 | * namespace. The created object is temporary and | 306 | * object is temporary and will be deleted upon completion of |
303 | * will be deleted upon completion of the execution | 307 | * the execution of this method. |
304 | * of this method. | ||
305 | */ | 308 | */ |
306 | status = acpi_ds_load2_begin_op (walk_state, NULL); | 309 | status = acpi_ds_load2_begin_op (walk_state, NULL); |
307 | } | 310 | } |
@@ -338,8 +341,6 @@ acpi_ds_exec_begin_op ( | |||
338 | * FUNCTION: acpi_ds_exec_end_op | 341 | * FUNCTION: acpi_ds_exec_end_op |
339 | * | 342 | * |
340 | * PARAMETERS: walk_state - Current state of the parse tree walk | 343 | * PARAMETERS: walk_state - Current state of the parse tree walk |
341 | * Op - Op that has been just been completed in the | ||
342 | * walk; Arguments have now been evaluated. | ||
343 | * | 344 | * |
344 | * RETURN: Status | 345 | * RETURN: Status |
345 | * | 346 | * |
@@ -389,7 +390,7 @@ acpi_ds_exec_end_op ( | |||
389 | /* Decode the Opcode Class */ | 390 | /* Decode the Opcode Class */ |
390 | 391 | ||
391 | switch (op_class) { | 392 | switch (op_class) { |
392 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ | 393 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ |
393 | break; | 394 | break; |
394 | 395 | ||
395 | 396 | ||
@@ -417,12 +418,12 @@ acpi_ds_exec_end_op ( | |||
417 | /* Resolve all operands */ | 418 | /* Resolve all operands */ |
418 | 419 | ||
419 | status = acpi_ex_resolve_operands (walk_state->opcode, | 420 | status = acpi_ex_resolve_operands (walk_state->opcode, |
420 | &(walk_state->operands [walk_state->num_operands -1]), | 421 | &(walk_state->operands [walk_state->num_operands -1]), |
421 | walk_state); | 422 | walk_state); |
422 | if (ACPI_SUCCESS (status)) { | 423 | if (ACPI_SUCCESS (status)) { |
423 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 424 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
424 | acpi_ps_get_opcode_name (walk_state->opcode), | 425 | acpi_ps_get_opcode_name (walk_state->opcode), |
425 | walk_state->num_operands, "after ex_resolve_operands"); | 426 | walk_state->num_operands, "after ex_resolve_operands"); |
426 | } | 427 | } |
427 | } | 428 | } |
428 | 429 | ||
@@ -506,7 +507,8 @@ acpi_ds_exec_end_op ( | |||
506 | if ((op->asl.parent) && | 507 | if ((op->asl.parent) && |
507 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || | 508 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || |
508 | (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { | 509 | (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { |
509 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op)); | 510 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
511 | "Method Reference in a Package, Op=%p\n", op)); | ||
510 | op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; | 512 | op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; |
511 | acpi_ut_add_reference (op->asl.value.arg->asl.node->object); | 513 | acpi_ut_add_reference (op->asl.value.arg->asl.node->object); |
512 | return_ACPI_STATUS (AE_OK); | 514 | return_ACPI_STATUS (AE_OK); |
@@ -583,13 +585,15 @@ acpi_ds_exec_end_op ( | |||
583 | case AML_NAME_OP: | 585 | case AML_NAME_OP: |
584 | 586 | ||
585 | /* | 587 | /* |
586 | * Put the Node on the object stack (Contains the ACPI Name of | 588 | * Put the Node on the object stack (Contains the ACPI Name |
587 | * this object) | 589 | * of this object) |
588 | */ | 590 | */ |
589 | walk_state->operands[0] = (void *) op->common.parent->common.node; | 591 | walk_state->operands[0] = (void *) op->common.parent->common.node; |
590 | walk_state->num_operands = 1; | 592 | walk_state->num_operands = 1; |
591 | 593 | ||
592 | status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent); | 594 | status = acpi_ds_create_node (walk_state, |
595 | op->common.parent->common.node, | ||
596 | op->common.parent); | ||
593 | if (ACPI_FAILURE (status)) { | 597 | if (ACPI_FAILURE (status)) { |
594 | break; | 598 | break; |
595 | } | 599 | } |
@@ -600,7 +604,7 @@ acpi_ds_exec_end_op ( | |||
600 | case AML_INT_EVAL_SUBTREE_OP: | 604 | case AML_INT_EVAL_SUBTREE_OP: |
601 | 605 | ||
602 | status = acpi_ds_eval_data_object_operands (walk_state, op, | 606 | status = acpi_ds_eval_data_object_operands (walk_state, op, |
603 | acpi_ns_get_attached_object (op->common.parent->common.node)); | 607 | acpi_ns_get_attached_object (op->common.parent->common.node)); |
604 | break; | 608 | break; |
605 | 609 | ||
606 | default: | 610 | default: |
@@ -609,7 +613,7 @@ acpi_ds_exec_end_op ( | |||
609 | break; | 613 | break; |
610 | } | 614 | } |
611 | 615 | ||
612 | /* Done with this result state (Now that operand stack is built) */ | 616 | /* Done with result state (Now that operand stack is built) */ |
613 | 617 | ||
614 | status = acpi_ds_result_stack_pop (walk_state); | 618 | status = acpi_ds_result_stack_pop (walk_state); |
615 | if (ACPI_FAILURE (status)) { | 619 | if (ACPI_FAILURE (status)) { |
@@ -620,8 +624,7 @@ acpi_ds_exec_end_op ( | |||
620 | * If a result object was returned from above, push it on the | 624 | * If a result object was returned from above, push it on the |
621 | * current result stack | 625 | * current result stack |
622 | */ | 626 | */ |
623 | if (ACPI_SUCCESS (status) && | 627 | if (walk_state->result_obj) { |
624 | walk_state->result_obj) { | ||
625 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); | 628 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); |
626 | } | 629 | } |
627 | break; | 630 | break; |
@@ -654,7 +657,8 @@ acpi_ds_exec_end_op ( | |||
654 | 657 | ||
655 | case AML_TYPE_UNDEFINED: | 658 | case AML_TYPE_UNDEFINED: |
656 | 659 | ||
657 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op)); | 660 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
661 | "Undefined opcode type Op=%p\n", op)); | ||
658 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); | 662 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); |
659 | 663 | ||
660 | 664 | ||
@@ -709,13 +713,14 @@ cleanup: | |||
709 | status = acpi_gbl_exception_handler (status, | 713 | status = acpi_gbl_exception_handler (status, |
710 | walk_state->method_node->name.integer, walk_state->opcode, | 714 | walk_state->method_node->name.integer, walk_state->opcode, |
711 | walk_state->aml_offset, NULL); | 715 | walk_state->aml_offset, NULL); |
712 | acpi_ex_enter_interpreter (); | 716 | (void) acpi_ex_enter_interpreter (); |
713 | } | 717 | } |
714 | 718 | ||
715 | if (walk_state->result_obj) { | 719 | if (walk_state->result_obj) { |
716 | /* Break to debugger to display result */ | 720 | /* Break to debugger to display result */ |
717 | 721 | ||
718 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state)); | 722 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, |
723 | walk_state)); | ||
719 | 724 | ||
720 | /* | 725 | /* |
721 | * Delete the result op if and only if: | 726 | * Delete the result op if and only if: |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 06d758679588..d11620018421 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -79,20 +79,23 @@ acpi_ds_init_callbacks ( | |||
79 | 79 | ||
80 | switch (pass_number) { | 80 | switch (pass_number) { |
81 | case 1: | 81 | case 1: |
82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
83 | ACPI_PARSE_DELETE_TREE; | ||
83 | walk_state->descending_callback = acpi_ds_load1_begin_op; | 84 | walk_state->descending_callback = acpi_ds_load1_begin_op; |
84 | walk_state->ascending_callback = acpi_ds_load1_end_op; | 85 | walk_state->ascending_callback = acpi_ds_load1_end_op; |
85 | break; | 86 | break; |
86 | 87 | ||
87 | case 2: | 88 | case 2: |
88 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 89 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
90 | ACPI_PARSE_DELETE_TREE; | ||
89 | walk_state->descending_callback = acpi_ds_load2_begin_op; | 91 | walk_state->descending_callback = acpi_ds_load2_begin_op; |
90 | walk_state->ascending_callback = acpi_ds_load2_end_op; | 92 | walk_state->ascending_callback = acpi_ds_load2_end_op; |
91 | break; | 93 | break; |
92 | 94 | ||
93 | case 3: | 95 | case 3: |
94 | #ifndef ACPI_NO_METHOD_EXECUTION | 96 | #ifndef ACPI_NO_METHOD_EXECUTION |
95 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; | 97 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | |
98 | ACPI_PARSE_DELETE_TREE; | ||
96 | walk_state->descending_callback = acpi_ds_exec_begin_op; | 99 | walk_state->descending_callback = acpi_ds_exec_begin_op; |
97 | walk_state->ascending_callback = acpi_ds_exec_end_op; | 100 | walk_state->ascending_callback = acpi_ds_exec_end_op; |
98 | #endif | 101 | #endif |
@@ -111,8 +114,7 @@ acpi_ds_init_callbacks ( | |||
111 | * FUNCTION: acpi_ds_load1_begin_op | 114 | * FUNCTION: acpi_ds_load1_begin_op |
112 | * | 115 | * |
113 | * PARAMETERS: walk_state - Current state of the parse tree walk | 116 | * PARAMETERS: walk_state - Current state of the parse tree walk |
114 | * Op - Op that has been just been reached in the | 117 | * out_op - Where to return op if a new one is created |
115 | * walk; Arguments have not been evaluated yet. | ||
116 | * | 118 | * |
117 | * RETURN: Status | 119 | * RETURN: Status |
118 | * | 120 | * |
@@ -146,7 +148,8 @@ acpi_ds_load1_begin_op ( | |||
146 | #if 0 | 148 | #if 0 |
147 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 149 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
148 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | 150 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { |
149 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name); | 151 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", |
152 | walk_state->op_info->name); | ||
150 | *out_op = op; | 153 | *out_op = op; |
151 | return (AE_CTRL_SKIP); | 154 | return (AE_CTRL_SKIP); |
152 | } | 155 | } |
@@ -191,7 +194,8 @@ acpi_ds_load1_begin_op ( | |||
191 | */ | 194 | */ |
192 | acpi_dm_add_to_external_list (path); | 195 | acpi_dm_add_to_external_list (path); |
193 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 196 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
194 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 197 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
198 | walk_state, &(node)); | ||
195 | } | 199 | } |
196 | #endif | 200 | #endif |
197 | if (ACPI_FAILURE (status)) { | 201 | if (ACPI_FAILURE (status)) { |
@@ -224,10 +228,12 @@ acpi_ds_load1_begin_op ( | |||
224 | * Name (DEB, 0) | 228 | * Name (DEB, 0) |
225 | * Scope (DEB) { ... } | 229 | * Scope (DEB) { ... } |
226 | * | 230 | * |
227 | * Note: silently change the type here. On the second pass, we will report a warning | 231 | * Note: silently change the type here. On the second pass, we will report |
232 | * a warning | ||
228 | */ | 233 | */ |
229 | 234 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 235 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
236 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
231 | path, acpi_ut_get_type_name (node->type))); | 237 | path, acpi_ut_get_type_name (node->type))); |
232 | 238 | ||
233 | node->type = ACPI_TYPE_ANY; | 239 | node->type = ACPI_TYPE_ANY; |
@@ -238,7 +244,8 @@ acpi_ds_load1_begin_op ( | |||
238 | 244 | ||
239 | /* All other types are an error */ | 245 | /* All other types are an error */ |
240 | 246 | ||
241 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | 247 | ACPI_REPORT_ERROR (( |
248 | "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | ||
242 | acpi_ut_get_type_name (node->type), path)); | 249 | acpi_ut_get_type_name (node->type), path)); |
243 | 250 | ||
244 | return (AE_AML_OPERAND_TYPE); | 251 | return (AE_AML_OPERAND_TYPE); |
@@ -249,7 +256,8 @@ acpi_ds_load1_begin_op ( | |||
249 | default: | 256 | default: |
250 | 257 | ||
251 | /* | 258 | /* |
252 | * For all other named opcodes, we will enter the name into the namespace. | 259 | * For all other named opcodes, we will enter the name into |
260 | * the namespace. | ||
253 | * | 261 | * |
254 | * Setup the search flags. | 262 | * Setup the search flags. |
255 | * Since we are entering a name into the namespace, we do not want to | 263 | * Since we are entering a name into the namespace, we do not want to |
@@ -279,14 +287,16 @@ acpi_ds_load1_begin_op ( | |||
279 | acpi_ut_get_type_name (object_type))); | 287 | acpi_ut_get_type_name (object_type))); |
280 | } | 288 | } |
281 | else { | 289 | else { |
282 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", | 290 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
291 | "[%s] Both Find or Create allowed\n", | ||
283 | acpi_ut_get_type_name (object_type))); | 292 | acpi_ut_get_type_name (object_type))); |
284 | } | 293 | } |
285 | 294 | ||
286 | /* | 295 | /* |
287 | * Enter the named type into the internal namespace. We enter the name | 296 | * Enter the named type into the internal namespace. We enter the name |
288 | * as we go downward in the parse tree. Any necessary subobjects that involve | 297 | * as we go downward in the parse tree. Any necessary subobjects that |
289 | * arguments to the opcode must be created as we go back up the parse tree later. | 298 | * involve arguments to the opcode must be created as we go back up the |
299 | * parse tree later. | ||
290 | */ | 300 | */ |
291 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 301 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
292 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); | 302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); |
@@ -335,8 +345,6 @@ acpi_ds_load1_begin_op ( | |||
335 | * FUNCTION: acpi_ds_load1_end_op | 345 | * FUNCTION: acpi_ds_load1_end_op |
336 | * | 346 | * |
337 | * PARAMETERS: walk_state - Current state of the parse tree walk | 347 | * PARAMETERS: walk_state - Current state of the parse tree walk |
338 | * Op - Op that has been just been completed in the | ||
339 | * walk; Arguments have now been evaluated. | ||
340 | * | 348 | * |
341 | * RETURN: Status | 349 | * RETURN: Status |
342 | * | 350 | * |
@@ -383,7 +391,9 @@ acpi_ds_load1_end_op ( | |||
383 | 391 | ||
384 | if (op->common.aml_opcode == AML_REGION_OP) { | 392 | if (op->common.aml_opcode == AML_REGION_OP) { |
385 | status = acpi_ex_create_region (op->named.data, op->named.length, | 393 | status = acpi_ex_create_region (op->named.data, op->named.length, |
386 | (acpi_adr_space_type) ((op->common.value.arg)->common.value.integer), walk_state); | 394 | (acpi_adr_space_type) |
395 | ((op->common.value.arg)->common.value.integer), | ||
396 | walk_state); | ||
387 | if (ACPI_FAILURE (status)) { | 397 | if (ACPI_FAILURE (status)) { |
388 | return (status); | 398 | return (status); |
389 | } | 399 | } |
@@ -394,7 +404,8 @@ acpi_ds_load1_end_op ( | |||
394 | /* For Name opcode, get the object type from the argument */ | 404 | /* For Name opcode, get the object type from the argument */ |
395 | 405 | ||
396 | if (op->common.value.arg) { | 406 | if (op->common.value.arg) { |
397 | object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type; | 407 | object_type = (acpi_ps_get_opcode_info ( |
408 | (op->common.value.arg)->common.aml_opcode))->object_type; | ||
398 | op->common.node->type = (u8) object_type; | 409 | op->common.node->type = (u8) object_type; |
399 | } | 410 | } |
400 | } | 411 | } |
@@ -448,8 +459,7 @@ acpi_ds_load1_end_op ( | |||
448 | * FUNCTION: acpi_ds_load2_begin_op | 459 | * FUNCTION: acpi_ds_load2_begin_op |
449 | * | 460 | * |
450 | * PARAMETERS: walk_state - Current state of the parse tree walk | 461 | * PARAMETERS: walk_state - Current state of the parse tree walk |
451 | * Op - Op that has been just been reached in the | 462 | * out_op - Wher to return op if a new one is created |
452 | * walk; Arguments have not been evaluated yet. | ||
453 | * | 463 | * |
454 | * RETURN: Status | 464 | * RETURN: Status |
455 | * | 465 | * |
@@ -478,14 +488,14 @@ acpi_ds_load2_begin_op ( | |||
478 | if (op) { | 488 | if (op) { |
479 | /* We only care about Namespace opcodes here */ | 489 | /* We only care about Namespace opcodes here */ |
480 | 490 | ||
481 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | 491 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && |
492 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | ||
482 | (!(walk_state->op_info->flags & AML_NAMED))) { | 493 | (!(walk_state->op_info->flags & AML_NAMED))) { |
483 | return_ACPI_STATUS (AE_OK); | 494 | return_ACPI_STATUS (AE_OK); |
484 | } | 495 | } |
485 | 496 | ||
486 | /* | 497 | /* Get the name we are going to enter or lookup in the namespace */ |
487 | * Get the name we are going to enter or lookup in the namespace | 498 | |
488 | */ | ||
489 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 499 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
490 | /* For Namepath op, get the path string */ | 500 | /* For Namepath op, get the path string */ |
491 | 501 | ||
@@ -528,21 +538,25 @@ acpi_ds_load2_begin_op ( | |||
528 | case AML_INT_NAMEPATH_OP: | 538 | case AML_INT_NAMEPATH_OP: |
529 | 539 | ||
530 | /* | 540 | /* |
531 | * The name_path is an object reference to an existing object. Don't enter the | 541 | * The name_path is an object reference to an existing object. |
532 | * name into the namespace, but look it up for use later | 542 | * Don't enter the name into the namespace, but look it up |
543 | * for use later. | ||
533 | */ | 544 | */ |
534 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 545 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
535 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 546 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
547 | walk_state, &(node)); | ||
536 | break; | 548 | break; |
537 | 549 | ||
538 | case AML_SCOPE_OP: | 550 | case AML_SCOPE_OP: |
539 | 551 | ||
540 | /* | 552 | /* |
541 | * The Path is an object reference to an existing object. Don't enter the | 553 | * The Path is an object reference to an existing object. |
542 | * name into the namespace, but look it up for use later | 554 | * Don't enter the name into the namespace, but look it up |
555 | * for use later. | ||
543 | */ | 556 | */ |
544 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 557 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
545 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 558 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
559 | walk_state, &(node)); | ||
546 | if (ACPI_FAILURE (status)) { | 560 | if (ACPI_FAILURE (status)) { |
547 | #ifdef _ACPI_ASL_COMPILER | 561 | #ifdef _ACPI_ASL_COMPILER |
548 | if (status == AE_NOT_FOUND) { | 562 | if (status == AE_NOT_FOUND) { |
@@ -582,7 +596,8 @@ acpi_ds_load2_begin_op ( | |||
582 | * Scope (DEB) { ... } | 596 | * Scope (DEB) { ... } |
583 | */ | 597 | */ |
584 | 598 | ||
585 | ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 599 | ACPI_REPORT_WARNING (( |
600 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
586 | buffer_ptr, acpi_ut_get_type_name (node->type))); | 601 | buffer_ptr, acpi_ut_get_type_name (node->type))); |
587 | 602 | ||
588 | node->type = ACPI_TYPE_ANY; | 603 | node->type = ACPI_TYPE_ANY; |
@@ -593,7 +608,8 @@ acpi_ds_load2_begin_op ( | |||
593 | 608 | ||
594 | /* All other types are an error */ | 609 | /* All other types are an error */ |
595 | 610 | ||
596 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", | 611 | ACPI_REPORT_ERROR (( |
612 | "Invalid type (%s) for target of Scope operator [%4.4s]\n", | ||
597 | acpi_ut_get_type_name (node->type), buffer_ptr)); | 613 | acpi_ut_get_type_name (node->type), buffer_ptr)); |
598 | 614 | ||
599 | return (AE_AML_OPERAND_TYPE); | 615 | return (AE_AML_OPERAND_TYPE); |
@@ -621,8 +637,9 @@ acpi_ds_load2_begin_op ( | |||
621 | 637 | ||
622 | /* | 638 | /* |
623 | * Enter the named type into the internal namespace. We enter the name | 639 | * Enter the named type into the internal namespace. We enter the name |
624 | * as we go downward in the parse tree. Any necessary subobjects that involve | 640 | * as we go downward in the parse tree. Any necessary subobjects that |
625 | * arguments to the opcode must be created as we go back up the parse tree later. | 641 | * involve arguments to the opcode must be created as we go back up the |
642 | * parse tree later. | ||
626 | * | 643 | * |
627 | * Note: Name may already exist if we are executing a deferred opcode. | 644 | * Note: Name may already exist if we are executing a deferred opcode. |
628 | */ | 645 | */ |
@@ -635,7 +652,8 @@ acpi_ds_load2_begin_op ( | |||
635 | } | 652 | } |
636 | 653 | ||
637 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 654 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
638 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); | 655 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, |
656 | walk_state, &(node)); | ||
639 | break; | 657 | break; |
640 | } | 658 | } |
641 | 659 | ||
@@ -678,8 +696,6 @@ acpi_ds_load2_begin_op ( | |||
678 | * FUNCTION: acpi_ds_load2_end_op | 696 | * FUNCTION: acpi_ds_load2_end_op |
679 | * | 697 | * |
680 | * PARAMETERS: walk_state - Current state of the parse tree walk | 698 | * PARAMETERS: walk_state - Current state of the parse tree walk |
681 | * Op - Op that has been just been completed in the | ||
682 | * walk; Arguments have now been evaluated. | ||
683 | * | 699 | * |
684 | * RETURN: Status | 700 | * RETURN: Status |
685 | * | 701 | * |
@@ -738,7 +754,8 @@ acpi_ds_load2_end_op ( | |||
738 | 754 | ||
739 | /* Pop the scope stack */ | 755 | /* Pop the scope stack */ |
740 | 756 | ||
741 | if (acpi_ns_opens_scope (object_type) && (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | 757 | if (acpi_ns_opens_scope (object_type) && |
758 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | ||
742 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 759 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", |
743 | acpi_ut_get_type_name (object_type), op)); | 760 | acpi_ut_get_type_name (object_type), op)); |
744 | 761 | ||
@@ -803,7 +820,7 @@ acpi_ds_load2_end_op ( | |||
803 | case AML_INDEX_FIELD_OP: | 820 | case AML_INDEX_FIELD_OP: |
804 | 821 | ||
805 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, | 822 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, |
806 | walk_state); | 823 | walk_state); |
807 | break; | 824 | break; |
808 | 825 | ||
809 | case AML_BANK_FIELD_OP: | 826 | case AML_BANK_FIELD_OP: |
@@ -884,14 +901,16 @@ acpi_ds_load2_end_op ( | |||
884 | #ifndef ACPI_NO_METHOD_EXECUTION | 901 | #ifndef ACPI_NO_METHOD_EXECUTION |
885 | case AML_REGION_OP: | 902 | case AML_REGION_OP: |
886 | /* | 903 | /* |
887 | * The op_region is not fully parsed at this time. Only valid argument is the space_id. | 904 | * The op_region is not fully parsed at this time. Only valid |
888 | * (We must save the address of the AML of the address and length operands) | 905 | * argument is the space_id. (We must save the address of the |
906 | * AML of the address and length operands) | ||
889 | */ | 907 | */ |
890 | /* | 908 | /* |
891 | * If we have a valid region, initialize it | 909 | * If we have a valid region, initialize it |
892 | * Namespace is NOT locked at this point. | 910 | * Namespace is NOT locked at this point. |
893 | */ | 911 | */ |
894 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); | 912 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), |
913 | FALSE); | ||
895 | if (ACPI_FAILURE (status)) { | 914 | if (ACPI_FAILURE (status)) { |
896 | /* | 915 | /* |
897 | * If AE_NOT_EXIST is returned, it is not fatal | 916 | * If AE_NOT_EXIST is returned, it is not fatal |
@@ -942,15 +961,16 @@ acpi_ds_load2_end_op ( | |||
942 | if (ACPI_SUCCESS (status)) { | 961 | if (ACPI_SUCCESS (status)) { |
943 | /* | 962 | /* |
944 | * Make sure that what we found is indeed a method | 963 | * Make sure that what we found is indeed a method |
945 | * We didn't search for a method on purpose, to see if the name would resolve | 964 | * We didn't search for a method on purpose, to see if the name |
965 | * would resolve | ||
946 | */ | 966 | */ |
947 | if (new_node->type != ACPI_TYPE_METHOD) { | 967 | if (new_node->type != ACPI_TYPE_METHOD) { |
948 | status = AE_AML_OPERAND_TYPE; | 968 | status = AE_AML_OPERAND_TYPE; |
949 | } | 969 | } |
950 | 970 | ||
951 | /* We could put the returned object (Node) on the object stack for later, but | 971 | /* We could put the returned object (Node) on the object stack for |
952 | * for now, we will put it in the "op" object that the parser uses, so we | 972 | * later, but for now, we will put it in the "op" object that the |
953 | * can get it again at the end of this scope | 973 | * parser uses, so we can get it again at the end of this scope |
954 | */ | 974 | */ |
955 | op->common.node = new_node; | 975 | op->common.node = new_node; |
956 | } | 976 | } |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index 65f456151e25..21f4548ff323 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -50,14 +50,13 @@ | |||
50 | ACPI_MODULE_NAME ("dswscope") | 50 | ACPI_MODULE_NAME ("dswscope") |
51 | 51 | ||
52 | 52 | ||
53 | #define STACK_POP(head) head | ||
54 | |||
55 | |||
56 | /**************************************************************************** | 53 | /**************************************************************************** |
57 | * | 54 | * |
58 | * FUNCTION: acpi_ds_scope_stack_clear | 55 | * FUNCTION: acpi_ds_scope_stack_clear |
59 | * | 56 | * |
60 | * PARAMETERS: None | 57 | * PARAMETERS: walk_state - Current state |
58 | * | ||
59 | * RETURN: None | ||
61 | * | 60 | * |
62 | * DESCRIPTION: Pop (and free) everything on the scope stack except the | 61 | * DESCRIPTION: Pop (and free) everything on the scope stack except the |
63 | * root scope object (which remains at the stack top.) | 62 | * root scope object (which remains at the stack top.) |
@@ -80,7 +79,8 @@ acpi_ds_scope_stack_clear ( | |||
80 | walk_state->scope_info = scope_info->scope.next; | 79 | walk_state->scope_info = scope_info->scope.next; |
81 | 80 | ||
82 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 81 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
83 | "Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value))); | 82 | "Popped object type (%s)\n", |
83 | acpi_ut_get_type_name (scope_info->common.value))); | ||
84 | acpi_ut_delete_generic_state (scope_info); | 84 | acpi_ut_delete_generic_state (scope_info); |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear ( | |||
90 | * | 90 | * |
91 | * FUNCTION: acpi_ds_scope_stack_push | 91 | * FUNCTION: acpi_ds_scope_stack_push |
92 | * | 92 | * |
93 | * PARAMETERS: *Node, - Name to be made current | 93 | * PARAMETERS: Node - Name to be made current |
94 | * Type, - Type of frame being pushed | 94 | * Type - Type of frame being pushed |
95 | * walk_state - Current state | ||
96 | * | ||
97 | * RETURN: Status | ||
95 | * | 98 | * |
96 | * DESCRIPTION: Push the current scope on the scope stack, and make the | 99 | * DESCRIPTION: Push the current scope on the scope stack, and make the |
97 | * passed Node current. | 100 | * passed Node current. |
@@ -121,7 +124,8 @@ acpi_ds_scope_stack_push ( | |||
121 | /* Make sure object type is valid */ | 124 | /* Make sure object type is valid */ |
122 | 125 | ||
123 | if (!acpi_ut_valid_object_type (type)) { | 126 | if (!acpi_ut_valid_object_type (type)) { |
124 | ACPI_REPORT_WARNING (("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); | 127 | ACPI_REPORT_WARNING (( |
128 | "ds_scope_stack_push: Invalid object type: 0x%X\n", type)); | ||
125 | } | 129 | } |
126 | 130 | ||
127 | /* Allocate a new scope object */ | 131 | /* Allocate a new scope object */ |
@@ -170,16 +174,11 @@ acpi_ds_scope_stack_push ( | |||
170 | * | 174 | * |
171 | * FUNCTION: acpi_ds_scope_stack_pop | 175 | * FUNCTION: acpi_ds_scope_stack_pop |
172 | * | 176 | * |
173 | * PARAMETERS: Type - The type of frame to be found | 177 | * PARAMETERS: walk_state - Current state |
174 | * | 178 | * |
175 | * DESCRIPTION: Pop the scope stack until a frame of the requested type | 179 | * RETURN: Status |
176 | * is found. | ||
177 | * | 180 | * |
178 | * RETURN: Count of frames popped. If no frame of the requested type | 181 | * DESCRIPTION: Pop the scope stack once. |
179 | * was found, the count is returned as a negative number and | ||
180 | * the scope stack is emptied (which sets the current scope | ||
181 | * to the root). If the scope stack was empty at entry, the | ||
182 | * function is a no-op and returns 0. | ||
183 | * | 182 | * |
184 | ***************************************************************************/ | 183 | ***************************************************************************/ |
185 | 184 | ||
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index e555b3fbd5e5..9cd3db652b31 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -50,67 +50,31 @@ | |||
50 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
51 | ACPI_MODULE_NAME ("dswstate") | 51 | ACPI_MODULE_NAME ("dswstate") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #ifdef ACPI_FUTURE_USAGE | 55 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
55 | |||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * FUNCTION: acpi_ds_result_insert | ||
59 | * | ||
60 | * PARAMETERS: Object - Object to push | ||
61 | * Index - Where to insert the object | ||
62 | * walk_state - Current Walk state | ||
63 | * | ||
64 | * RETURN: Status | ||
65 | * | ||
66 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | |||
70 | acpi_status | 56 | acpi_status |
71 | acpi_ds_result_insert ( | 57 | acpi_ds_result_insert ( |
72 | void *object, | 58 | void *object, |
73 | u32 index, | 59 | u32 index, |
74 | struct acpi_walk_state *walk_state) | 60 | struct acpi_walk_state *walk_state); |
75 | { | ||
76 | union acpi_generic_state *state; | ||
77 | |||
78 | 61 | ||
79 | ACPI_FUNCTION_NAME ("ds_result_insert"); | 62 | acpi_status |
80 | 63 | acpi_ds_obj_stack_delete_all ( | |
81 | 64 | struct acpi_walk_state *walk_state); | |
82 | state = walk_state->results; | ||
83 | if (!state) { | ||
84 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
85 | walk_state)); | ||
86 | return (AE_NOT_EXIST); | ||
87 | } | ||
88 | |||
89 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
91 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
92 | index, object, walk_state, state->results.num_results)); | ||
93 | return (AE_BAD_PARAMETER); | ||
94 | } | ||
95 | |||
96 | if (!object) { | ||
97 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
98 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
99 | index, object, walk_state, state->results.num_results)); | ||
100 | return (AE_BAD_PARAMETER); | ||
101 | } | ||
102 | |||
103 | state->results.obj_desc [index] = object; | ||
104 | state->results.num_results++; | ||
105 | 65 | ||
106 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 66 | acpi_status |
107 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | 67 | acpi_ds_obj_stack_pop_object ( |
108 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | 68 | union acpi_operand_object **object, |
109 | walk_state, state->results.num_results, walk_state->current_result)); | 69 | struct acpi_walk_state *walk_state); |
110 | 70 | ||
111 | return (AE_OK); | 71 | void * |
112 | } | 72 | acpi_ds_obj_stack_get_value ( |
73 | u32 index, | ||
74 | struct acpi_walk_state *walk_state); | ||
75 | #endif | ||
113 | 76 | ||
77 | #ifdef ACPI_FUTURE_USAGE | ||
114 | 78 | ||
115 | /******************************************************************************* | 79 | /******************************************************************************* |
116 | * | 80 | * |
@@ -178,7 +142,6 @@ acpi_ds_result_remove ( | |||
178 | 142 | ||
179 | #endif /* ACPI_FUTURE_USAGE */ | 143 | #endif /* ACPI_FUTURE_USAGE */ |
180 | 144 | ||
181 | |||
182 | /******************************************************************************* | 145 | /******************************************************************************* |
183 | * | 146 | * |
184 | * FUNCTION: acpi_ds_result_pop | 147 | * FUNCTION: acpi_ds_result_pop |
@@ -227,15 +190,18 @@ acpi_ds_result_pop ( | |||
227 | *object = state->results.obj_desc [index -1]; | 190 | *object = state->results.obj_desc [index -1]; |
228 | state->results.obj_desc [index -1] = NULL; | 191 | state->results.obj_desc [index -1] = NULL; |
229 | 192 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", | 193 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
231 | *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | 194 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", |
195 | *object, | ||
196 | (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | ||
232 | (u32) index -1, walk_state, state->results.num_results)); | 197 | (u32) index -1, walk_state, state->results.num_results)); |
233 | 198 | ||
234 | return (AE_OK); | 199 | return (AE_OK); |
235 | } | 200 | } |
236 | } | 201 | } |
237 | 202 | ||
238 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 203 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
204 | "No result objects! State=%p\n", walk_state)); | ||
239 | return (AE_AML_NO_RETURN_VALUE); | 205 | return (AE_AML_NO_RETURN_VALUE); |
240 | } | 206 | } |
241 | 207 | ||
@@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom ( | |||
274 | } | 240 | } |
275 | 241 | ||
276 | if (!state->results.num_results) { | 242 | if (!state->results.num_results) { |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 243 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", |
244 | walk_state)); | ||
278 | return (AE_AML_NO_RETURN_VALUE); | 245 | return (AE_AML_NO_RETURN_VALUE); |
279 | } | 246 | } |
280 | 247 | ||
@@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom ( | |||
293 | /* Check for a valid result object */ | 260 | /* Check for a valid result object */ |
294 | 261 | ||
295 | if (!*object) { | 262 | if (!*object) { |
296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", | 263 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
264 | "Null operand! State=%p #Ops=%X, Index=%X\n", | ||
297 | walk_state, state->results.num_results, (u32) index)); | 265 | walk_state, state->results.num_results, (u32) index)); |
298 | return (AE_AML_NO_RETURN_VALUE); | 266 | return (AE_AML_NO_RETURN_VALUE); |
299 | } | 267 | } |
@@ -344,7 +312,8 @@ acpi_ds_result_push ( | |||
344 | } | 312 | } |
345 | 313 | ||
346 | if (!object) { | 314 | if (!object) { |
347 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n", | 315 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
316 | "Null Object! Obj=%p State=%p Num=%X\n", | ||
348 | object, walk_state, state->results.num_results)); | 317 | object, walk_state, state->results.num_results)); |
349 | return (AE_BAD_PARAMETER); | 318 | return (AE_BAD_PARAMETER); |
350 | } | 319 | } |
@@ -439,43 +408,6 @@ acpi_ds_result_stack_pop ( | |||
439 | 408 | ||
440 | /******************************************************************************* | 409 | /******************************************************************************* |
441 | * | 410 | * |
442 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
443 | * | ||
444 | * PARAMETERS: walk_state - Current Walk state | ||
445 | * | ||
446 | * RETURN: Status | ||
447 | * | ||
448 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
449 | * Should be used with great care, if at all! | ||
450 | * | ||
451 | ******************************************************************************/ | ||
452 | #ifdef ACPI_FUTURE_USAGE | ||
453 | acpi_status | ||
454 | acpi_ds_obj_stack_delete_all ( | ||
455 | struct acpi_walk_state *walk_state) | ||
456 | { | ||
457 | u32 i; | ||
458 | |||
459 | |||
460 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
461 | |||
462 | |||
463 | /* The stack size is configurable, but fixed */ | ||
464 | |||
465 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
466 | if (walk_state->operands[i]) { | ||
467 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
468 | walk_state->operands[i] = NULL; | ||
469 | } | ||
470 | } | ||
471 | |||
472 | return_ACPI_STATUS (AE_OK); | ||
473 | } | ||
474 | #endif /* ACPI_FUTURE_USAGE */ | ||
475 | |||
476 | |||
477 | /******************************************************************************* | ||
478 | * | ||
479 | * FUNCTION: acpi_ds_obj_stack_push | 411 | * FUNCTION: acpi_ds_obj_stack_push |
480 | * | 412 | * |
481 | * PARAMETERS: Object - Object to push | 413 | * PARAMETERS: Object - Object to push |
@@ -517,67 +449,6 @@ acpi_ds_obj_stack_push ( | |||
517 | } | 449 | } |
518 | 450 | ||
519 | 451 | ||
520 | #if 0 | ||
521 | /******************************************************************************* | ||
522 | * | ||
523 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
524 | * | ||
525 | * PARAMETERS: pop_count - Number of objects/entries to pop | ||
526 | * walk_state - Current Walk state | ||
527 | * | ||
528 | * RETURN: Status | ||
529 | * | ||
530 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
531 | * deleted by this routine. | ||
532 | * | ||
533 | ******************************************************************************/ | ||
534 | |||
535 | acpi_status | ||
536 | acpi_ds_obj_stack_pop_object ( | ||
537 | union acpi_operand_object **object, | ||
538 | struct acpi_walk_state *walk_state) | ||
539 | { | ||
540 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
541 | |||
542 | |||
543 | /* Check for stack underflow */ | ||
544 | |||
545 | if (walk_state->num_operands == 0) { | ||
546 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
547 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
548 | walk_state, walk_state->num_operands)); | ||
549 | *object = NULL; | ||
550 | return (AE_AML_NO_OPERAND); | ||
551 | } | ||
552 | |||
553 | /* Pop the stack */ | ||
554 | |||
555 | walk_state->num_operands--; | ||
556 | |||
557 | /* Check for a valid operand */ | ||
558 | |||
559 | if (!walk_state->operands [walk_state->num_operands]) { | ||
560 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
561 | "Null operand! State=%p #Ops=%X\n", | ||
562 | walk_state, walk_state->num_operands)); | ||
563 | *object = NULL; | ||
564 | return (AE_AML_NO_OPERAND); | ||
565 | } | ||
566 | |||
567 | /* Get operand and set stack entry to null */ | ||
568 | |||
569 | *object = walk_state->operands [walk_state->num_operands]; | ||
570 | walk_state->operands [walk_state->num_operands] = NULL; | ||
571 | |||
572 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
573 | *object, acpi_ut_get_object_type_name (*object), | ||
574 | walk_state, walk_state->num_operands)); | ||
575 | |||
576 | return (AE_OK); | ||
577 | } | ||
578 | #endif | ||
579 | |||
580 | |||
581 | /******************************************************************************* | 452 | /******************************************************************************* |
582 | * | 453 | * |
583 | * FUNCTION: acpi_ds_obj_stack_pop | 454 | * FUNCTION: acpi_ds_obj_stack_pop |
@@ -680,48 +551,6 @@ acpi_ds_obj_stack_pop_and_delete ( | |||
680 | 551 | ||
681 | /******************************************************************************* | 552 | /******************************************************************************* |
682 | * | 553 | * |
683 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
684 | * | ||
685 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
686 | * on the top of the stack (index=0 == top) | ||
687 | * walk_state - Current Walk state | ||
688 | * | ||
689 | * RETURN: Status | ||
690 | * | ||
691 | * DESCRIPTION: Retrieve an object from this walk's object stack. Index must | ||
692 | * be within the range of the current stack pointer. | ||
693 | * | ||
694 | ******************************************************************************/ | ||
695 | #ifdef ACPI_FUTURE_USAGE | ||
696 | void * | ||
697 | acpi_ds_obj_stack_get_value ( | ||
698 | u32 index, | ||
699 | struct acpi_walk_state *walk_state) | ||
700 | { | ||
701 | |||
702 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
703 | |||
704 | |||
705 | /* Can't do it if the stack is empty */ | ||
706 | |||
707 | if (walk_state->num_operands == 0) { | ||
708 | return_PTR (NULL); | ||
709 | } | ||
710 | |||
711 | /* or if the index is past the top of the stack */ | ||
712 | |||
713 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
714 | return_PTR (NULL); | ||
715 | } | ||
716 | |||
717 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
718 | index]); | ||
719 | } | ||
720 | #endif /* ACPI_FUTURE_USAGE */ | ||
721 | |||
722 | |||
723 | /******************************************************************************* | ||
724 | * | ||
725 | * FUNCTION: acpi_ds_get_current_walk_state | 554 | * FUNCTION: acpi_ds_get_current_walk_state |
726 | * | 555 | * |
727 | * PARAMETERS: Thread - Get current active state for this Thread | 556 | * PARAMETERS: Thread - Get current active state for this Thread |
@@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state ( | |||
757 | * FUNCTION: acpi_ds_push_walk_state | 586 | * FUNCTION: acpi_ds_push_walk_state |
758 | * | 587 | * |
759 | * PARAMETERS: walk_state - State to push | 588 | * PARAMETERS: walk_state - State to push |
760 | * walk_list - The list that owns the walk stack | 589 | * Thread - Thread state object |
761 | * | 590 | * |
762 | * RETURN: None | 591 | * RETURN: None |
763 | * | 592 | * |
764 | * DESCRIPTION: Place the walk_state at the head of the state list. | 593 | * DESCRIPTION: Place the Thread state at the head of the state list. |
765 | * | 594 | * |
766 | ******************************************************************************/ | 595 | ******************************************************************************/ |
767 | 596 | ||
@@ -784,9 +613,9 @@ acpi_ds_push_walk_state ( | |||
784 | * | 613 | * |
785 | * FUNCTION: acpi_ds_pop_walk_state | 614 | * FUNCTION: acpi_ds_pop_walk_state |
786 | * | 615 | * |
787 | * PARAMETERS: walk_list - The list that owns the walk stack | 616 | * PARAMETERS: Thread - Current thread state |
788 | * | 617 | * |
789 | * RETURN: A walk_state object popped from the stack | 618 | * RETURN: A walk_state object popped from the thread's stack |
790 | * | 619 | * |
791 | * DESCRIPTION: Remove and return the walkstate object that is at the head of | 620 | * DESCRIPTION: Remove and return the walkstate object that is at the head of |
792 | * the walk stack for the given walk list. NULL indicates that | 621 | * the walk stack for the given walk list. NULL indicates that |
@@ -814,7 +643,7 @@ acpi_ds_pop_walk_state ( | |||
814 | /* | 643 | /* |
815 | * Don't clear the NEXT field, this serves as an indicator | 644 | * Don't clear the NEXT field, this serves as an indicator |
816 | * that there is a parent WALK STATE | 645 | * that there is a parent WALK STATE |
817 | * NO: walk_state->Next = NULL; | 646 | * Do Not: walk_state->Next = NULL; |
818 | */ | 647 | */ |
819 | } | 648 | } |
820 | 649 | ||
@@ -826,7 +655,9 @@ acpi_ds_pop_walk_state ( | |||
826 | * | 655 | * |
827 | * FUNCTION: acpi_ds_create_walk_state | 656 | * FUNCTION: acpi_ds_create_walk_state |
828 | * | 657 | * |
829 | * PARAMETERS: Origin - Starting point for this walk | 658 | * PARAMETERS: owner_id - ID for object creation |
659 | * Origin - Starting point for this walk | ||
660 | * mth_desc - Method object | ||
830 | * Thread - Current thread state | 661 | * Thread - Current thread state |
831 | * | 662 | * |
832 | * RETURN: Pointer to the new walk state. | 663 | * RETURN: Pointer to the new walk state. |
@@ -896,8 +727,7 @@ acpi_ds_create_walk_state ( | |||
896 | * method_node - Control method NS node, if any | 727 | * method_node - Control method NS node, if any |
897 | * aml_start - Start of AML | 728 | * aml_start - Start of AML |
898 | * aml_length - Length of AML | 729 | * aml_length - Length of AML |
899 | * Params - Method args, if any | 730 | * Info - Method info block (params, etc.) |
900 | * return_obj_desc - Where to store a return object, if any | ||
901 | * pass_number - 1, 2, or 3 | 731 | * pass_number - 1, 2, or 3 |
902 | * | 732 | * |
903 | * RETURN: Status | 733 | * RETURN: Status |
@@ -931,7 +761,7 @@ acpi_ds_init_aml_walk ( | |||
931 | 761 | ||
932 | /* The next_op of the next_walk will be the beginning of the method */ | 762 | /* The next_op of the next_walk will be the beginning of the method */ |
933 | 763 | ||
934 | walk_state->next_op = NULL; | 764 | walk_state->next_op = NULL; |
935 | 765 | ||
936 | if (info) { | 766 | if (info) { |
937 | if (info->parameter_type == ACPI_PARAM_GPE) { | 767 | if (info->parameter_type == ACPI_PARAM_GPE) { |
@@ -939,8 +769,8 @@ acpi_ds_init_aml_walk ( | |||
939 | info->parameters); | 769 | info->parameters); |
940 | } | 770 | } |
941 | else { | 771 | else { |
942 | walk_state->params = info->parameters; | 772 | walk_state->params = info->parameters; |
943 | walk_state->caller_return_desc = &info->return_object; | 773 | walk_state->caller_return_desc = &info->return_object; |
944 | } | 774 | } |
945 | } | 775 | } |
946 | 776 | ||
@@ -964,7 +794,8 @@ acpi_ds_init_aml_walk ( | |||
964 | 794 | ||
965 | /* Init the method arguments */ | 795 | /* Init the method arguments */ |
966 | 796 | ||
967 | status = acpi_ds_method_data_init_args (walk_state->params, ACPI_METHOD_NUM_ARGS, walk_state); | 797 | status = acpi_ds_method_data_init_args (walk_state->params, |
798 | ACPI_METHOD_NUM_ARGS, walk_state); | ||
968 | if (ACPI_FAILURE (status)) { | 799 | if (ACPI_FAILURE (status)) { |
969 | return_ACPI_STATUS (status); | 800 | return_ACPI_STATUS (status); |
970 | } | 801 | } |
@@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state ( | |||
1031 | } | 862 | } |
1032 | 863 | ||
1033 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 864 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { |
1034 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state)); | 865 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", |
866 | walk_state)); | ||
1035 | return; | 867 | return; |
1036 | } | 868 | } |
1037 | 869 | ||
1038 | if (walk_state->parser_state.scope) { | 870 | if (walk_state->parser_state.scope) { |
1039 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); | 871 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", |
872 | walk_state)); | ||
1040 | } | 873 | } |
1041 | 874 | ||
1042 | /* Always must free any linked control states */ | 875 | /* Always must free any linked control states */ |
@@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state ( | |||
1078 | * | 911 | * |
1079 | * PARAMETERS: None | 912 | * PARAMETERS: None |
1080 | * | 913 | * |
1081 | * RETURN: Status | 914 | * RETURN: None |
1082 | * | 915 | * |
1083 | * DESCRIPTION: Purge the global state object cache. Used during subsystem | 916 | * DESCRIPTION: Purge the global state object cache. Used during subsystem |
1084 | * termination. | 917 | * termination. |
@@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache ( | |||
1098 | #endif | 931 | #endif |
1099 | 932 | ||
1100 | 933 | ||
934 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
935 | /******************************************************************************* | ||
936 | * | ||
937 | * FUNCTION: acpi_ds_result_insert | ||
938 | * | ||
939 | * PARAMETERS: Object - Object to push | ||
940 | * Index - Where to insert the object | ||
941 | * walk_state - Current Walk state | ||
942 | * | ||
943 | * RETURN: Status | ||
944 | * | ||
945 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
946 | * | ||
947 | ******************************************************************************/ | ||
948 | |||
949 | acpi_status | ||
950 | acpi_ds_result_insert ( | ||
951 | void *object, | ||
952 | u32 index, | ||
953 | struct acpi_walk_state *walk_state) | ||
954 | { | ||
955 | union acpi_generic_state *state; | ||
956 | |||
957 | |||
958 | ACPI_FUNCTION_NAME ("ds_result_insert"); | ||
959 | |||
960 | |||
961 | state = walk_state->results; | ||
962 | if (!state) { | ||
963 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
964 | walk_state)); | ||
965 | return (AE_NOT_EXIST); | ||
966 | } | ||
967 | |||
968 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
969 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
970 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
971 | index, object, walk_state, state->results.num_results)); | ||
972 | return (AE_BAD_PARAMETER); | ||
973 | } | ||
974 | |||
975 | if (!object) { | ||
976 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
977 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
978 | index, object, walk_state, state->results.num_results)); | ||
979 | return (AE_BAD_PARAMETER); | ||
980 | } | ||
981 | |||
982 | state->results.obj_desc [index] = object; | ||
983 | state->results.num_results++; | ||
984 | |||
985 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
986 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | ||
987 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | ||
988 | walk_state, state->results.num_results, walk_state->current_result)); | ||
989 | |||
990 | return (AE_OK); | ||
991 | } | ||
992 | |||
993 | |||
994 | /******************************************************************************* | ||
995 | * | ||
996 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
997 | * | ||
998 | * PARAMETERS: walk_state - Current Walk state | ||
999 | * | ||
1000 | * RETURN: Status | ||
1001 | * | ||
1002 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
1003 | * Should be used with great care, if at all! | ||
1004 | * | ||
1005 | ******************************************************************************/ | ||
1006 | |||
1007 | acpi_status | ||
1008 | acpi_ds_obj_stack_delete_all ( | ||
1009 | struct acpi_walk_state *walk_state) | ||
1010 | { | ||
1011 | u32 i; | ||
1012 | |||
1013 | |||
1014 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
1015 | |||
1016 | |||
1017 | /* The stack size is configurable, but fixed */ | ||
1018 | |||
1019 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
1020 | if (walk_state->operands[i]) { | ||
1021 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
1022 | walk_state->operands[i] = NULL; | ||
1023 | } | ||
1024 | } | ||
1025 | |||
1026 | return_ACPI_STATUS (AE_OK); | ||
1027 | } | ||
1028 | |||
1029 | |||
1030 | /******************************************************************************* | ||
1031 | * | ||
1032 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
1033 | * | ||
1034 | * PARAMETERS: Object - Where to return the popped object | ||
1035 | * walk_state - Current Walk state | ||
1036 | * | ||
1037 | * RETURN: Status | ||
1038 | * | ||
1039 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
1040 | * deleted by this routine. | ||
1041 | * | ||
1042 | ******************************************************************************/ | ||
1043 | |||
1044 | acpi_status | ||
1045 | acpi_ds_obj_stack_pop_object ( | ||
1046 | union acpi_operand_object **object, | ||
1047 | struct acpi_walk_state *walk_state) | ||
1048 | { | ||
1049 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
1050 | |||
1051 | |||
1052 | /* Check for stack underflow */ | ||
1053 | |||
1054 | if (walk_state->num_operands == 0) { | ||
1055 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1056 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
1057 | walk_state, walk_state->num_operands)); | ||
1058 | *object = NULL; | ||
1059 | return (AE_AML_NO_OPERAND); | ||
1060 | } | ||
1061 | |||
1062 | /* Pop the stack */ | ||
1063 | |||
1064 | walk_state->num_operands--; | ||
1065 | |||
1066 | /* Check for a valid operand */ | ||
1067 | |||
1068 | if (!walk_state->operands [walk_state->num_operands]) { | ||
1069 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1070 | "Null operand! State=%p #Ops=%X\n", | ||
1071 | walk_state, walk_state->num_operands)); | ||
1072 | *object = NULL; | ||
1073 | return (AE_AML_NO_OPERAND); | ||
1074 | } | ||
1075 | |||
1076 | /* Get operand and set stack entry to null */ | ||
1077 | |||
1078 | *object = walk_state->operands [walk_state->num_operands]; | ||
1079 | walk_state->operands [walk_state->num_operands] = NULL; | ||
1080 | |||
1081 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
1082 | *object, acpi_ut_get_object_type_name (*object), | ||
1083 | walk_state, walk_state->num_operands)); | ||
1084 | |||
1085 | return (AE_OK); | ||
1086 | } | ||
1087 | |||
1088 | |||
1089 | /******************************************************************************* | ||
1090 | * | ||
1091 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
1092 | * | ||
1093 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
1094 | * on the top of the stack (index=0 == top) | ||
1095 | * walk_state - Current Walk state | ||
1096 | * | ||
1097 | * RETURN: Pointer to the requested operand | ||
1098 | * | ||
1099 | * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must | ||
1100 | * be within the range of the current stack pointer. | ||
1101 | * | ||
1102 | ******************************************************************************/ | ||
1103 | |||
1104 | void * | ||
1105 | acpi_ds_obj_stack_get_value ( | ||
1106 | u32 index, | ||
1107 | struct acpi_walk_state *walk_state) | ||
1108 | { | ||
1109 | |||
1110 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
1111 | |||
1112 | |||
1113 | /* Can't do it if the stack is empty */ | ||
1114 | |||
1115 | if (walk_state->num_operands == 0) { | ||
1116 | return_PTR (NULL); | ||
1117 | } | ||
1118 | |||
1119 | /* or if the index is past the top of the stack */ | ||
1120 | |||
1121 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
1122 | return_PTR (NULL); | ||
1123 | } | ||
1124 | |||
1125 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
1126 | index]); | ||
1127 | } | ||
1128 | #endif | ||
1129 | |||
1130 | |||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index fdf143b405be..1ac5731d45e5 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/interrupt.h> | ||
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
35 | #include <acpi/acpi_bus.h> | 36 | #include <acpi/acpi_bus.h> |
36 | #include <acpi/acpi_drivers.h> | 37 | #include <acpi/acpi_drivers.h> |
@@ -49,60 +50,149 @@ ACPI_MODULE_NAME ("acpi_ec") | |||
49 | 50 | ||
50 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 51 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
51 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 52 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
53 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ | ||
52 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ | 54 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ |
53 | 55 | ||
54 | #define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ | 56 | #define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ |
55 | #define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ | 57 | #define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ |
56 | 58 | ||
57 | #define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ | 59 | #define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ |
58 | #define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ | ||
59 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 60 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
60 | 61 | ||
62 | #define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ | ||
63 | #define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ | ||
64 | |||
61 | #define ACPI_EC_COMMAND_READ 0x80 | 65 | #define ACPI_EC_COMMAND_READ 0x80 |
62 | #define ACPI_EC_COMMAND_WRITE 0x81 | 66 | #define ACPI_EC_COMMAND_WRITE 0x81 |
67 | #define ACPI_EC_BURST_ENABLE 0x82 | ||
68 | #define ACPI_EC_BURST_DISABLE 0x83 | ||
63 | #define ACPI_EC_COMMAND_QUERY 0x84 | 69 | #define ACPI_EC_COMMAND_QUERY 0x84 |
64 | 70 | ||
65 | static int acpi_ec_add (struct acpi_device *device); | 71 | #define EC_POLLING 0xFF |
72 | #define EC_BURST 0x00 | ||
73 | |||
74 | |||
66 | static int acpi_ec_remove (struct acpi_device *device, int type); | 75 | static int acpi_ec_remove (struct acpi_device *device, int type); |
67 | static int acpi_ec_start (struct acpi_device *device); | 76 | static int acpi_ec_start (struct acpi_device *device); |
68 | static int acpi_ec_stop (struct acpi_device *device, int type); | 77 | static int acpi_ec_stop (struct acpi_device *device, int type); |
78 | static int acpi_ec_burst_add ( struct acpi_device *device); | ||
79 | static int acpi_ec_polling_add ( struct acpi_device *device); | ||
69 | 80 | ||
70 | static struct acpi_driver acpi_ec_driver = { | 81 | static struct acpi_driver acpi_ec_driver = { |
71 | .name = ACPI_EC_DRIVER_NAME, | 82 | .name = ACPI_EC_DRIVER_NAME, |
72 | .class = ACPI_EC_CLASS, | 83 | .class = ACPI_EC_CLASS, |
73 | .ids = ACPI_EC_HID, | 84 | .ids = ACPI_EC_HID, |
74 | .ops = { | 85 | .ops = { |
75 | .add = acpi_ec_add, | 86 | .add = acpi_ec_polling_add, |
76 | .remove = acpi_ec_remove, | 87 | .remove = acpi_ec_remove, |
77 | .start = acpi_ec_start, | 88 | .start = acpi_ec_start, |
78 | .stop = acpi_ec_stop, | 89 | .stop = acpi_ec_stop, |
79 | }, | 90 | }, |
80 | }; | 91 | }; |
81 | 92 | union acpi_ec { | |
82 | struct acpi_ec { | 93 | struct { |
83 | acpi_handle handle; | 94 | u32 mode; |
84 | unsigned long uid; | 95 | acpi_handle handle; |
85 | unsigned long gpe_bit; | 96 | unsigned long uid; |
86 | struct acpi_generic_address status_addr; | 97 | unsigned long gpe_bit; |
87 | struct acpi_generic_address command_addr; | 98 | struct acpi_generic_address status_addr; |
88 | struct acpi_generic_address data_addr; | 99 | struct acpi_generic_address command_addr; |
89 | unsigned long global_lock; | 100 | struct acpi_generic_address data_addr; |
90 | spinlock_t lock; | 101 | unsigned long global_lock; |
102 | } common; | ||
103 | |||
104 | struct { | ||
105 | u32 mode; | ||
106 | acpi_handle handle; | ||
107 | unsigned long uid; | ||
108 | unsigned long gpe_bit; | ||
109 | struct acpi_generic_address status_addr; | ||
110 | struct acpi_generic_address command_addr; | ||
111 | struct acpi_generic_address data_addr; | ||
112 | unsigned long global_lock; | ||
113 | unsigned int expect_event; | ||
114 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ | ||
115 | atomic_t pending_gpe; | ||
116 | struct semaphore sem; | ||
117 | wait_queue_head_t wait; | ||
118 | }burst; | ||
119 | |||
120 | struct { | ||
121 | u32 mode; | ||
122 | acpi_handle handle; | ||
123 | unsigned long uid; | ||
124 | unsigned long gpe_bit; | ||
125 | struct acpi_generic_address status_addr; | ||
126 | struct acpi_generic_address command_addr; | ||
127 | struct acpi_generic_address data_addr; | ||
128 | unsigned long global_lock; | ||
129 | spinlock_t lock; | ||
130 | }polling; | ||
91 | }; | 131 | }; |
92 | 132 | ||
133 | static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event); | ||
134 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); | ||
135 | static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data); | ||
136 | static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data); | ||
137 | static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data); | ||
138 | static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data); | ||
139 | static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data); | ||
140 | static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data); | ||
141 | static void acpi_ec_gpe_polling_query ( void *ec_cxt); | ||
142 | static void acpi_ec_gpe_burst_query ( void *ec_cxt); | ||
143 | static u32 acpi_ec_gpe_polling_handler ( void *data); | ||
144 | static u32 acpi_ec_gpe_burst_handler ( void *data); | ||
145 | static acpi_status __init | ||
146 | acpi_fake_ecdt_polling_callback ( | ||
147 | acpi_handle handle, | ||
148 | u32 Level, | ||
149 | void *context, | ||
150 | void **retval); | ||
151 | |||
152 | static acpi_status __init | ||
153 | acpi_fake_ecdt_burst_callback ( | ||
154 | acpi_handle handle, | ||
155 | u32 Level, | ||
156 | void *context, | ||
157 | void **retval); | ||
158 | |||
159 | static int __init | ||
160 | acpi_ec_polling_get_real_ecdt(void); | ||
161 | static int __init | ||
162 | acpi_ec_burst_get_real_ecdt(void); | ||
93 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 163 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
94 | static struct acpi_ec *ec_ecdt; | 164 | static union acpi_ec *ec_ecdt; |
95 | 165 | ||
96 | /* External interfaces use first EC only, so remember */ | 166 | /* External interfaces use first EC only, so remember */ |
97 | static struct acpi_device *first_ec; | 167 | static struct acpi_device *first_ec; |
168 | static int acpi_ec_polling_mode = EC_POLLING; | ||
98 | 169 | ||
99 | /* -------------------------------------------------------------------------- | 170 | /* -------------------------------------------------------------------------- |
100 | Transaction Management | 171 | Transaction Management |
101 | -------------------------------------------------------------------------- */ | 172 | -------------------------------------------------------------------------- */ |
102 | 173 | ||
174 | static inline u32 acpi_ec_read_status(union acpi_ec *ec) | ||
175 | { | ||
176 | u32 status = 0; | ||
177 | |||
178 | acpi_hw_low_level_read(8, &status, &ec->common.status_addr); | ||
179 | return status; | ||
180 | } | ||
181 | |||
103 | static int | 182 | static int |
104 | acpi_ec_wait ( | 183 | acpi_ec_wait ( |
105 | struct acpi_ec *ec, | 184 | union acpi_ec *ec, |
185 | u8 event) | ||
186 | { | ||
187 | if (acpi_ec_polling_mode) | ||
188 | return acpi_ec_polling_wait (ec, event); | ||
189 | else | ||
190 | return acpi_ec_burst_wait (ec, event); | ||
191 | } | ||
192 | |||
193 | static int | ||
194 | acpi_ec_polling_wait ( | ||
195 | union acpi_ec *ec, | ||
106 | u8 event) | 196 | u8 event) |
107 | { | 197 | { |
108 | u32 acpi_ec_status = 0; | 198 | u32 acpi_ec_status = 0; |
@@ -115,7 +205,7 @@ acpi_ec_wait ( | |||
115 | switch (event) { | 205 | switch (event) { |
116 | case ACPI_EC_EVENT_OBF: | 206 | case ACPI_EC_EVENT_OBF: |
117 | do { | 207 | do { |
118 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr); | 208 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); |
119 | if (acpi_ec_status & ACPI_EC_FLAG_OBF) | 209 | if (acpi_ec_status & ACPI_EC_FLAG_OBF) |
120 | return 0; | 210 | return 0; |
121 | udelay(ACPI_EC_UDELAY); | 211 | udelay(ACPI_EC_UDELAY); |
@@ -123,7 +213,7 @@ acpi_ec_wait ( | |||
123 | break; | 213 | break; |
124 | case ACPI_EC_EVENT_IBE: | 214 | case ACPI_EC_EVENT_IBE: |
125 | do { | 215 | do { |
126 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr); | 216 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); |
127 | if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) | 217 | if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) |
128 | return 0; | 218 | return 0; |
129 | udelay(ACPI_EC_UDELAY); | 219 | udelay(ACPI_EC_UDELAY); |
@@ -135,11 +225,129 @@ acpi_ec_wait ( | |||
135 | 225 | ||
136 | return -ETIME; | 226 | return -ETIME; |
137 | } | 227 | } |
228 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) | ||
229 | { | ||
230 | int result = 0; | ||
231 | |||
232 | ACPI_FUNCTION_TRACE("acpi_ec_wait"); | ||
233 | |||
234 | ec->burst.expect_event = event; | ||
235 | smp_mb(); | ||
236 | |||
237 | result = wait_event_interruptible_timeout(ec->burst.wait, | ||
238 | !ec->burst.expect_event, | ||
239 | msecs_to_jiffies(ACPI_EC_DELAY)); | ||
240 | |||
241 | ec->burst.expect_event = 0; | ||
242 | smp_mb(); | ||
243 | |||
244 | if (result < 0){ | ||
245 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR," result = %d ", result)); | ||
246 | return_VALUE(result); | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * Verify that the event in question has actually happened by | ||
251 | * querying EC status. Do the check even if operation timed-out | ||
252 | * to make sure that we did not miss interrupt. | ||
253 | */ | ||
254 | switch (event) { | ||
255 | case ACPI_EC_EVENT_OBF: | ||
256 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) | ||
257 | return_VALUE(0); | ||
258 | break; | ||
259 | |||
260 | case ACPI_EC_EVENT_IBE: | ||
261 | if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) | ||
262 | return_VALUE(0); | ||
263 | break; | ||
264 | } | ||
265 | |||
266 | return_VALUE(-ETIME); | ||
267 | } | ||
268 | |||
269 | |||
270 | |||
271 | static int | ||
272 | acpi_ec_enter_burst_mode ( | ||
273 | union acpi_ec *ec) | ||
274 | { | ||
275 | u32 tmp = 0; | ||
276 | int status = 0; | ||
277 | |||
278 | ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode"); | ||
279 | |||
280 | status = acpi_ec_read_status(ec); | ||
281 | if (status != -EINVAL && | ||
282 | !(status & ACPI_EC_FLAG_BURST)){ | ||
283 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); | ||
284 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
285 | if (status){ | ||
286 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
287 | return_VALUE(-EINVAL); | ||
288 | } | ||
289 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); | ||
290 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
291 | if(tmp != 0x90 ) {/* Burst ACK byte*/ | ||
292 | return_VALUE(-EINVAL); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | atomic_set(&ec->burst.leaving_burst , 0); | ||
297 | return_VALUE(0); | ||
298 | } | ||
138 | 299 | ||
300 | static int | ||
301 | acpi_ec_leave_burst_mode ( | ||
302 | union acpi_ec *ec) | ||
303 | { | ||
304 | int status =0; | ||
305 | |||
306 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); | ||
307 | |||
308 | atomic_set(&ec->burst.leaving_burst , 1); | ||
309 | status = acpi_ec_read_status(ec); | ||
310 | if (status != -EINVAL && | ||
311 | (status & ACPI_EC_FLAG_BURST)){ | ||
312 | acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); | ||
313 | status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | ||
314 | if (status){ | ||
315 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
316 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); | ||
317 | return_VALUE(-EINVAL); | ||
318 | } | ||
319 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
320 | status = acpi_ec_read_status(ec); | ||
321 | } | ||
322 | |||
323 | return_VALUE(0); | ||
324 | } | ||
139 | 325 | ||
140 | static int | 326 | static int |
141 | acpi_ec_read ( | 327 | acpi_ec_read ( |
142 | struct acpi_ec *ec, | 328 | union acpi_ec *ec, |
329 | u8 address, | ||
330 | u32 *data) | ||
331 | { | ||
332 | if (acpi_ec_polling_mode) | ||
333 | return acpi_ec_polling_read(ec, address, data); | ||
334 | else | ||
335 | return acpi_ec_burst_read(ec, address, data); | ||
336 | } | ||
337 | static int | ||
338 | acpi_ec_write ( | ||
339 | union acpi_ec *ec, | ||
340 | u8 address, | ||
341 | u8 data) | ||
342 | { | ||
343 | if (acpi_ec_polling_mode) | ||
344 | return acpi_ec_polling_write(ec, address, data); | ||
345 | else | ||
346 | return acpi_ec_burst_write(ec, address, data); | ||
347 | } | ||
348 | static int | ||
349 | acpi_ec_polling_read ( | ||
350 | union acpi_ec *ec, | ||
143 | u8 address, | 351 | u8 address, |
144 | u32 *data) | 352 | u32 *data) |
145 | { | 353 | { |
@@ -155,34 +363,33 @@ acpi_ec_read ( | |||
155 | 363 | ||
156 | *data = 0; | 364 | *data = 0; |
157 | 365 | ||
158 | if (ec->global_lock) { | 366 | if (ec->common.global_lock) { |
159 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 367 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
160 | if (ACPI_FAILURE(status)) | 368 | if (ACPI_FAILURE(status)) |
161 | return_VALUE(-ENODEV); | 369 | return_VALUE(-ENODEV); |
162 | } | 370 | } |
163 | |||
164 | spin_lock_irqsave(&ec->lock, flags); | ||
165 | 371 | ||
166 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr); | 372 | spin_lock_irqsave(&ec->polling.lock, flags); |
373 | |||
374 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); | ||
167 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 375 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
168 | if (result) | 376 | if (result) |
169 | goto end; | 377 | goto end; |
170 | 378 | ||
171 | acpi_hw_low_level_write(8, address, &ec->data_addr); | 379 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
172 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 380 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
173 | if (result) | 381 | if (result) |
174 | goto end; | 382 | goto end; |
175 | 383 | ||
176 | 384 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); | |
177 | acpi_hw_low_level_read(8, data, &ec->data_addr); | ||
178 | 385 | ||
179 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", | 386 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", |
180 | *data, address)); | 387 | *data, address)); |
181 | 388 | ||
182 | end: | 389 | end: |
183 | spin_unlock_irqrestore(&ec->lock, flags); | 390 | spin_unlock_irqrestore(&ec->polling.lock, flags); |
184 | 391 | ||
185 | if (ec->global_lock) | 392 | if (ec->common.global_lock) |
186 | acpi_release_global_lock(glk); | 393 | acpi_release_global_lock(glk); |
187 | 394 | ||
188 | return_VALUE(result); | 395 | return_VALUE(result); |
@@ -190,8 +397,8 @@ end: | |||
190 | 397 | ||
191 | 398 | ||
192 | static int | 399 | static int |
193 | acpi_ec_write ( | 400 | acpi_ec_polling_write ( |
194 | struct acpi_ec *ec, | 401 | union acpi_ec *ec, |
195 | u8 address, | 402 | u8 address, |
196 | u8 data) | 403 | u8 data) |
197 | { | 404 | { |
@@ -205,25 +412,25 @@ acpi_ec_write ( | |||
205 | if (!ec) | 412 | if (!ec) |
206 | return_VALUE(-EINVAL); | 413 | return_VALUE(-EINVAL); |
207 | 414 | ||
208 | if (ec->global_lock) { | 415 | if (ec->common.global_lock) { |
209 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 416 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
210 | if (ACPI_FAILURE(status)) | 417 | if (ACPI_FAILURE(status)) |
211 | return_VALUE(-ENODEV); | 418 | return_VALUE(-ENODEV); |
212 | } | 419 | } |
213 | 420 | ||
214 | spin_lock_irqsave(&ec->lock, flags); | 421 | spin_lock_irqsave(&ec->polling.lock, flags); |
215 | 422 | ||
216 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr); | 423 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); |
217 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 424 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
218 | if (result) | 425 | if (result) |
219 | goto end; | 426 | goto end; |
220 | 427 | ||
221 | acpi_hw_low_level_write(8, address, &ec->data_addr); | 428 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
222 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 429 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
223 | if (result) | 430 | if (result) |
224 | goto end; | 431 | goto end; |
225 | 432 | ||
226 | acpi_hw_low_level_write(8, data, &ec->data_addr); | 433 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); |
227 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 434 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
228 | if (result) | 435 | if (result) |
229 | goto end; | 436 | goto end; |
@@ -232,21 +439,172 @@ acpi_ec_write ( | |||
232 | data, address)); | 439 | data, address)); |
233 | 440 | ||
234 | end: | 441 | end: |
235 | spin_unlock_irqrestore(&ec->lock, flags); | 442 | spin_unlock_irqrestore(&ec->polling.lock, flags); |
236 | 443 | ||
237 | if (ec->global_lock) | 444 | if (ec->common.global_lock) |
238 | acpi_release_global_lock(glk); | 445 | acpi_release_global_lock(glk); |
239 | 446 | ||
240 | return_VALUE(result); | 447 | return_VALUE(result); |
241 | } | 448 | } |
242 | 449 | ||
450 | static int | ||
451 | acpi_ec_burst_read ( | ||
452 | union acpi_ec *ec, | ||
453 | u8 address, | ||
454 | u32 *data) | ||
455 | { | ||
456 | int status = 0; | ||
457 | u32 glk; | ||
458 | |||
459 | ACPI_FUNCTION_TRACE("acpi_ec_read"); | ||
460 | |||
461 | if (!ec || !data) | ||
462 | return_VALUE(-EINVAL); | ||
463 | |||
464 | retry: | ||
465 | *data = 0; | ||
466 | |||
467 | if (ec->common.global_lock) { | ||
468 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | ||
469 | if (ACPI_FAILURE(status)) | ||
470 | return_VALUE(-ENODEV); | ||
471 | } | ||
472 | |||
473 | WARN_ON(in_interrupt()); | ||
474 | down(&ec->burst.sem); | ||
475 | |||
476 | if(acpi_ec_enter_burst_mode(ec)) | ||
477 | goto end; | ||
478 | |||
479 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); | ||
480 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
481 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
482 | if (status) { | ||
483 | goto end; | ||
484 | } | ||
485 | |||
486 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | ||
487 | status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
488 | if (status){ | ||
489 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
490 | goto end; | ||
491 | } | ||
492 | |||
493 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); | ||
494 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
495 | |||
496 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", | ||
497 | *data, address)); | ||
498 | |||
499 | end: | ||
500 | acpi_ec_leave_burst_mode(ec); | ||
501 | up(&ec->burst.sem); | ||
502 | |||
503 | if (ec->common.global_lock) | ||
504 | acpi_release_global_lock(glk); | ||
505 | |||
506 | if(atomic_read(&ec->burst.leaving_burst) == 2){ | ||
507 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | ||
508 | while(atomic_read(&ec->burst.pending_gpe)){ | ||
509 | msleep(1); | ||
510 | } | ||
511 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
512 | goto retry; | ||
513 | } | ||
514 | |||
515 | return_VALUE(status); | ||
516 | } | ||
517 | |||
518 | |||
519 | static int | ||
520 | acpi_ec_burst_write ( | ||
521 | union acpi_ec *ec, | ||
522 | u8 address, | ||
523 | u8 data) | ||
524 | { | ||
525 | int status = 0; | ||
526 | u32 glk; | ||
527 | u32 tmp; | ||
528 | |||
529 | ACPI_FUNCTION_TRACE("acpi_ec_write"); | ||
530 | |||
531 | if (!ec) | ||
532 | return_VALUE(-EINVAL); | ||
533 | retry: | ||
534 | if (ec->common.global_lock) { | ||
535 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | ||
536 | if (ACPI_FAILURE(status)) | ||
537 | return_VALUE(-ENODEV); | ||
538 | } | ||
539 | |||
540 | WARN_ON(in_interrupt()); | ||
541 | down(&ec->burst.sem); | ||
542 | |||
543 | if(acpi_ec_enter_burst_mode(ec)) | ||
544 | goto end; | ||
545 | |||
546 | status = acpi_ec_read_status(ec); | ||
547 | if (status != -EINVAL && | ||
548 | !(status & ACPI_EC_FLAG_BURST)){ | ||
549 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); | ||
550 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
551 | if (status) | ||
552 | goto end; | ||
553 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); | ||
554 | if(tmp != 0x90 ) /* Burst ACK byte*/ | ||
555 | goto end; | ||
556 | } | ||
557 | /*Now we are in burst mode*/ | ||
558 | |||
559 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); | ||
560 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
561 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
562 | if (status){ | ||
563 | goto end; | ||
564 | } | ||
565 | |||
566 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | ||
567 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
568 | if (status){ | ||
569 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
570 | goto end; | ||
571 | } | ||
572 | |||
573 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); | ||
574 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
575 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
576 | if (status) | ||
577 | goto end; | ||
578 | |||
579 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", | ||
580 | data, address)); | ||
581 | |||
582 | end: | ||
583 | acpi_ec_leave_burst_mode(ec); | ||
584 | up(&ec->burst.sem); | ||
585 | |||
586 | if (ec->common.global_lock) | ||
587 | acpi_release_global_lock(glk); | ||
588 | |||
589 | if(atomic_read(&ec->burst.leaving_burst) == 2){ | ||
590 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | ||
591 | while(atomic_read(&ec->burst.pending_gpe)){ | ||
592 | msleep(1); | ||
593 | } | ||
594 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
595 | goto retry; | ||
596 | } | ||
597 | |||
598 | return_VALUE(status); | ||
599 | } | ||
600 | |||
243 | /* | 601 | /* |
244 | * Externally callable EC access functions. For now, assume 1 EC only | 602 | * Externally callable EC access functions. For now, assume 1 EC only |
245 | */ | 603 | */ |
246 | int | 604 | int |
247 | ec_read(u8 addr, u8 *val) | 605 | ec_read(u8 addr, u8 *val) |
248 | { | 606 | { |
249 | struct acpi_ec *ec; | 607 | union acpi_ec *ec; |
250 | int err; | 608 | int err; |
251 | u32 temp_data; | 609 | u32 temp_data; |
252 | 610 | ||
@@ -269,7 +627,7 @@ EXPORT_SYMBOL(ec_read); | |||
269 | int | 627 | int |
270 | ec_write(u8 addr, u8 val) | 628 | ec_write(u8 addr, u8 val) |
271 | { | 629 | { |
272 | struct acpi_ec *ec; | 630 | union acpi_ec *ec; |
273 | int err; | 631 | int err; |
274 | 632 | ||
275 | if (!first_ec) | 633 | if (!first_ec) |
@@ -283,10 +641,19 @@ ec_write(u8 addr, u8 val) | |||
283 | } | 641 | } |
284 | EXPORT_SYMBOL(ec_write); | 642 | EXPORT_SYMBOL(ec_write); |
285 | 643 | ||
286 | |||
287 | static int | 644 | static int |
288 | acpi_ec_query ( | 645 | acpi_ec_query ( |
289 | struct acpi_ec *ec, | 646 | union acpi_ec *ec, |
647 | u32 *data) | ||
648 | { | ||
649 | if (acpi_ec_polling_mode) | ||
650 | return acpi_ec_polling_query(ec, data); | ||
651 | else | ||
652 | return acpi_ec_burst_query(ec, data); | ||
653 | } | ||
654 | static int | ||
655 | acpi_ec_polling_query ( | ||
656 | union acpi_ec *ec, | ||
290 | u32 *data) | 657 | u32 *data) |
291 | { | 658 | { |
292 | int result = 0; | 659 | int result = 0; |
@@ -301,7 +668,7 @@ acpi_ec_query ( | |||
301 | 668 | ||
302 | *data = 0; | 669 | *data = 0; |
303 | 670 | ||
304 | if (ec->global_lock) { | 671 | if (ec->common.global_lock) { |
305 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 672 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
306 | if (ACPI_FAILURE(status)) | 673 | if (ACPI_FAILURE(status)) |
307 | return_VALUE(-ENODEV); | 674 | return_VALUE(-ENODEV); |
@@ -312,32 +679,86 @@ acpi_ec_query ( | |||
312 | * Note that successful completion of the query causes the ACPI_EC_SCI | 679 | * Note that successful completion of the query causes the ACPI_EC_SCI |
313 | * bit to be cleared (and thus clearing the interrupt source). | 680 | * bit to be cleared (and thus clearing the interrupt source). |
314 | */ | 681 | */ |
315 | spin_lock_irqsave(&ec->lock, flags); | 682 | spin_lock_irqsave(&ec->polling.lock, flags); |
316 | 683 | ||
317 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr); | 684 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); |
318 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 685 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
319 | if (result) | 686 | if (result) |
320 | goto end; | 687 | goto end; |
321 | 688 | ||
322 | acpi_hw_low_level_read(8, data, &ec->data_addr); | 689 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); |
323 | if (!*data) | 690 | if (!*data) |
324 | result = -ENODATA; | 691 | result = -ENODATA; |
325 | 692 | ||
326 | end: | 693 | end: |
327 | spin_unlock_irqrestore(&ec->lock, flags); | 694 | spin_unlock_irqrestore(&ec->polling.lock, flags); |
328 | 695 | ||
329 | if (ec->global_lock) | 696 | if (ec->common.global_lock) |
330 | acpi_release_global_lock(glk); | 697 | acpi_release_global_lock(glk); |
331 | 698 | ||
332 | return_VALUE(result); | 699 | return_VALUE(result); |
333 | } | 700 | } |
701 | static int | ||
702 | acpi_ec_burst_query ( | ||
703 | union acpi_ec *ec, | ||
704 | u32 *data) | ||
705 | { | ||
706 | int status = 0; | ||
707 | u32 glk; | ||
708 | |||
709 | ACPI_FUNCTION_TRACE("acpi_ec_query"); | ||
710 | |||
711 | if (!ec || !data) | ||
712 | return_VALUE(-EINVAL); | ||
713 | *data = 0; | ||
714 | |||
715 | if (ec->common.global_lock) { | ||
716 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | ||
717 | if (ACPI_FAILURE(status)) | ||
718 | return_VALUE(-ENODEV); | ||
719 | } | ||
720 | |||
721 | down(&ec->burst.sem); | ||
722 | if(acpi_ec_enter_burst_mode(ec)) | ||
723 | goto end; | ||
724 | /* | ||
725 | * Query the EC to find out which _Qxx method we need to evaluate. | ||
726 | * Note that successful completion of the query causes the ACPI_EC_SCI | ||
727 | * bit to be cleared (and thus clearing the interrupt source). | ||
728 | */ | ||
729 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); | ||
730 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
731 | if (status){ | ||
732 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
733 | goto end; | ||
734 | } | ||
735 | |||
736 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); | ||
737 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
738 | if (!*data) | ||
739 | status = -ENODATA; | ||
740 | |||
741 | end: | ||
742 | acpi_ec_leave_burst_mode(ec); | ||
743 | up(&ec->burst.sem); | ||
744 | |||
745 | if (ec->common.global_lock) | ||
746 | acpi_release_global_lock(glk); | ||
747 | |||
748 | if(atomic_read(&ec->burst.leaving_burst) == 2){ | ||
749 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | ||
750 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
751 | status = -ENODATA; | ||
752 | } | ||
753 | return_VALUE(status); | ||
754 | } | ||
334 | 755 | ||
335 | 756 | ||
336 | /* -------------------------------------------------------------------------- | 757 | /* -------------------------------------------------------------------------- |
337 | Event Management | 758 | Event Management |
338 | -------------------------------------------------------------------------- */ | 759 | -------------------------------------------------------------------------- */ |
339 | 760 | ||
340 | struct acpi_ec_query_data { | 761 | union acpi_ec_query_data { |
341 | acpi_handle handle; | 762 | acpi_handle handle; |
342 | u8 data; | 763 | u8 data; |
343 | }; | 764 | }; |
@@ -346,7 +767,17 @@ static void | |||
346 | acpi_ec_gpe_query ( | 767 | acpi_ec_gpe_query ( |
347 | void *ec_cxt) | 768 | void *ec_cxt) |
348 | { | 769 | { |
349 | struct acpi_ec *ec = (struct acpi_ec *) ec_cxt; | 770 | if (acpi_ec_polling_mode) |
771 | acpi_ec_gpe_polling_query(ec_cxt); | ||
772 | else | ||
773 | acpi_ec_gpe_burst_query(ec_cxt); | ||
774 | } | ||
775 | |||
776 | static void | ||
777 | acpi_ec_gpe_polling_query ( | ||
778 | void *ec_cxt) | ||
779 | { | ||
780 | union acpi_ec *ec = (union acpi_ec *) ec_cxt; | ||
350 | u32 value = 0; | 781 | u32 value = 0; |
351 | unsigned long flags = 0; | 782 | unsigned long flags = 0; |
352 | static char object_name[5] = {'_','Q','0','0','\0'}; | 783 | static char object_name[5] = {'_','Q','0','0','\0'}; |
@@ -356,11 +787,11 @@ acpi_ec_gpe_query ( | |||
356 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); | 787 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); |
357 | 788 | ||
358 | if (!ec_cxt) | 789 | if (!ec_cxt) |
359 | goto end; | 790 | goto end; |
360 | 791 | ||
361 | spin_lock_irqsave(&ec->lock, flags); | 792 | spin_lock_irqsave(&ec->polling.lock, flags); |
362 | acpi_hw_low_level_read(8, &value, &ec->command_addr); | 793 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); |
363 | spin_unlock_irqrestore(&ec->lock, flags); | 794 | spin_unlock_irqrestore(&ec->polling.lock, flags); |
364 | 795 | ||
365 | /* TBD: Implement asynch events! | 796 | /* TBD: Implement asynch events! |
366 | * NOTE: All we care about are EC-SCI's. Other EC events are | 797 | * NOTE: All we care about are EC-SCI's. Other EC events are |
@@ -373,29 +804,67 @@ acpi_ec_gpe_query ( | |||
373 | 804 | ||
374 | if (acpi_ec_query(ec, &value)) | 805 | if (acpi_ec_query(ec, &value)) |
375 | goto end; | 806 | goto end; |
376 | 807 | ||
377 | object_name[2] = hex[((value >> 4) & 0x0F)]; | 808 | object_name[2] = hex[((value >> 4) & 0x0F)]; |
378 | object_name[3] = hex[(value & 0x0F)]; | 809 | object_name[3] = hex[(value & 0x0F)]; |
379 | 810 | ||
380 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); | 811 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); |
381 | 812 | ||
382 | acpi_evaluate_object(ec->handle, object_name, NULL, NULL); | 813 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); |
383 | 814 | ||
384 | end: | 815 | end: |
385 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 816 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
817 | } | ||
818 | static void | ||
819 | acpi_ec_gpe_burst_query ( | ||
820 | void *ec_cxt) | ||
821 | { | ||
822 | union acpi_ec *ec = (union acpi_ec *) ec_cxt; | ||
823 | u32 value; | ||
824 | int result = -ENODATA; | ||
825 | static char object_name[5] = {'_','Q','0','0','\0'}; | ||
826 | const char hex[] = {'0','1','2','3','4','5','6','7', | ||
827 | '8','9','A','B','C','D','E','F'}; | ||
828 | |||
829 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); | ||
830 | |||
831 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) | ||
832 | result = acpi_ec_query(ec, &value); | ||
833 | |||
834 | if (result) | ||
835 | goto end; | ||
836 | |||
837 | object_name[2] = hex[((value >> 4) & 0x0F)]; | ||
838 | object_name[3] = hex[(value & 0x0F)]; | ||
839 | |||
840 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); | ||
841 | |||
842 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); | ||
843 | end: | ||
844 | atomic_dec(&ec->burst.pending_gpe); | ||
845 | return; | ||
386 | } | 846 | } |
387 | 847 | ||
388 | static u32 | 848 | static u32 |
389 | acpi_ec_gpe_handler ( | 849 | acpi_ec_gpe_handler ( |
390 | void *data) | 850 | void *data) |
391 | { | 851 | { |
852 | if (acpi_ec_polling_mode) | ||
853 | return acpi_ec_gpe_polling_handler(data); | ||
854 | else | ||
855 | return acpi_ec_gpe_burst_handler(data); | ||
856 | } | ||
857 | static u32 | ||
858 | acpi_ec_gpe_polling_handler ( | ||
859 | void *data) | ||
860 | { | ||
392 | acpi_status status = AE_OK; | 861 | acpi_status status = AE_OK; |
393 | struct acpi_ec *ec = (struct acpi_ec *) data; | 862 | union acpi_ec *ec = (union acpi_ec *) data; |
394 | 863 | ||
395 | if (!ec) | 864 | if (!ec) |
396 | return ACPI_INTERRUPT_NOT_HANDLED; | 865 | return ACPI_INTERRUPT_NOT_HANDLED; |
397 | 866 | ||
398 | acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); | 867 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
399 | 868 | ||
400 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 869 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, |
401 | acpi_ec_gpe_query, ec); | 870 | acpi_ec_gpe_query, ec); |
@@ -405,6 +874,55 @@ acpi_ec_gpe_handler ( | |||
405 | else | 874 | else |
406 | return ACPI_INTERRUPT_NOT_HANDLED; | 875 | return ACPI_INTERRUPT_NOT_HANDLED; |
407 | } | 876 | } |
877 | static u32 | ||
878 | acpi_ec_gpe_burst_handler ( | ||
879 | void *data) | ||
880 | { | ||
881 | acpi_status status = AE_OK; | ||
882 | u32 value; | ||
883 | union acpi_ec *ec = (union acpi_ec *) data; | ||
884 | |||
885 | if (!ec) | ||
886 | return ACPI_INTERRUPT_NOT_HANDLED; | ||
887 | |||
888 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | ||
889 | |||
890 | value = acpi_ec_read_status(ec); | ||
891 | |||
892 | if((value & ACPI_EC_FLAG_IBF) && | ||
893 | !(value & ACPI_EC_FLAG_BURST) && | ||
894 | (atomic_read(&ec->burst.leaving_burst) == 0)) { | ||
895 | /* | ||
896 | * the embedded controller disables | ||
897 | * burst mode for any reason other | ||
898 | * than the burst disable command | ||
899 | * to process critical event. | ||
900 | */ | ||
901 | atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction | ||
902 | and retry */ | ||
903 | wake_up(&ec->burst.wait); | ||
904 | }else { | ||
905 | if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF && | ||
906 | (value & ACPI_EC_FLAG_OBF)) || | ||
907 | (ec->burst.expect_event == ACPI_EC_EVENT_IBE && | ||
908 | !(value & ACPI_EC_FLAG_IBF))) { | ||
909 | ec->burst.expect_event = 0; | ||
910 | wake_up(&ec->burst.wait); | ||
911 | return ACPI_INTERRUPT_HANDLED; | ||
912 | } | ||
913 | } | ||
914 | |||
915 | if (value & ACPI_EC_FLAG_SCI){ | ||
916 | atomic_add(1, &ec->burst.pending_gpe) ; | ||
917 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | ||
918 | acpi_ec_gpe_query, ec); | ||
919 | return status == AE_OK ? | ||
920 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | ||
921 | } | ||
922 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | ||
923 | return status == AE_OK ? | ||
924 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | ||
925 | } | ||
408 | 926 | ||
409 | /* -------------------------------------------------------------------------- | 927 | /* -------------------------------------------------------------------------- |
410 | Address Space Management | 928 | Address Space Management |
@@ -421,10 +939,8 @@ acpi_ec_space_setup ( | |||
421 | * The EC object is in the handler context and is needed | 939 | * The EC object is in the handler context and is needed |
422 | * when calling the acpi_ec_space_handler. | 940 | * when calling the acpi_ec_space_handler. |
423 | */ | 941 | */ |
424 | if(function == ACPI_REGION_DEACTIVATE) | 942 | *return_context = (function != ACPI_REGION_DEACTIVATE) ? |
425 | *return_context = NULL; | 943 | handler_context : NULL; |
426 | else | ||
427 | *return_context = handler_context; | ||
428 | 944 | ||
429 | return AE_OK; | 945 | return AE_OK; |
430 | } | 946 | } |
@@ -440,8 +956,8 @@ acpi_ec_space_handler ( | |||
440 | void *region_context) | 956 | void *region_context) |
441 | { | 957 | { |
442 | int result = 0; | 958 | int result = 0; |
443 | struct acpi_ec *ec = NULL; | 959 | union acpi_ec *ec = NULL; |
444 | u32 temp = 0; | 960 | u64 temp = *value; |
445 | acpi_integer f_v = 0; | 961 | acpi_integer f_v = 0; |
446 | int i = 0; | 962 | int i = 0; |
447 | 963 | ||
@@ -450,22 +966,21 @@ acpi_ec_space_handler ( | |||
450 | if ((address > 0xFF) || !value || !handler_context) | 966 | if ((address > 0xFF) || !value || !handler_context) |
451 | return_VALUE(AE_BAD_PARAMETER); | 967 | return_VALUE(AE_BAD_PARAMETER); |
452 | 968 | ||
453 | if(bit_width != 8) { | 969 | if (bit_width != 8 && acpi_strict) { |
454 | printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); | 970 | printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); |
455 | if (acpi_strict) | 971 | return_VALUE(AE_BAD_PARAMETER); |
456 | return_VALUE(AE_BAD_PARAMETER); | ||
457 | } | 972 | } |
458 | 973 | ||
459 | ec = (struct acpi_ec *) handler_context; | 974 | ec = (union acpi_ec *) handler_context; |
460 | 975 | ||
461 | next_byte: | 976 | next_byte: |
462 | switch (function) { | 977 | switch (function) { |
463 | case ACPI_READ: | 978 | case ACPI_READ: |
464 | result = acpi_ec_read(ec, (u8) address, &temp); | 979 | temp = 0; |
465 | *value = (acpi_integer) temp; | 980 | result = acpi_ec_read(ec, (u8) address, (u32 *)&temp); |
466 | break; | 981 | break; |
467 | case ACPI_WRITE: | 982 | case ACPI_WRITE: |
468 | result = acpi_ec_write(ec, (u8) address, (u8) *value); | 983 | result = acpi_ec_write(ec, (u8) address, (u8) temp); |
469 | break; | 984 | break; |
470 | default: | 985 | default: |
471 | result = -EINVAL; | 986 | result = -EINVAL; |
@@ -474,19 +989,18 @@ next_byte: | |||
474 | } | 989 | } |
475 | 990 | ||
476 | bit_width -= 8; | 991 | bit_width -= 8; |
477 | if(bit_width){ | 992 | if (bit_width) { |
478 | 993 | if (function == ACPI_READ) | |
479 | if(function == ACPI_READ) | 994 | f_v |= temp << 8 * i; |
480 | f_v |= (acpi_integer) (*value) << 8*i; | 995 | if (function == ACPI_WRITE) |
481 | if(function == ACPI_WRITE) | 996 | temp >>= 8; |
482 | (*value) >>=8; | ||
483 | i++; | 997 | i++; |
998 | address++; | ||
484 | goto next_byte; | 999 | goto next_byte; |
485 | } | 1000 | } |
486 | 1001 | ||
487 | 1002 | if (function == ACPI_READ) { | |
488 | if(function == ACPI_READ){ | 1003 | f_v |= temp << 8 * i; |
489 | f_v |= (acpi_integer) (*value) << 8*i; | ||
490 | *value = f_v; | 1004 | *value = f_v; |
491 | } | 1005 | } |
492 | 1006 | ||
@@ -505,8 +1019,6 @@ out: | |||
505 | default: | 1019 | default: |
506 | return_VALUE(AE_OK); | 1020 | return_VALUE(AE_OK); |
507 | } | 1021 | } |
508 | |||
509 | |||
510 | } | 1022 | } |
511 | 1023 | ||
512 | 1024 | ||
@@ -520,7 +1032,7 @@ static struct proc_dir_entry *acpi_ec_dir; | |||
520 | static int | 1032 | static int |
521 | acpi_ec_read_info (struct seq_file *seq, void *offset) | 1033 | acpi_ec_read_info (struct seq_file *seq, void *offset) |
522 | { | 1034 | { |
523 | struct acpi_ec *ec = (struct acpi_ec *) seq->private; | 1035 | union acpi_ec *ec = (union acpi_ec *) seq->private; |
524 | 1036 | ||
525 | ACPI_FUNCTION_TRACE("acpi_ec_read_info"); | 1037 | ACPI_FUNCTION_TRACE("acpi_ec_read_info"); |
526 | 1038 | ||
@@ -528,11 +1040,12 @@ acpi_ec_read_info (struct seq_file *seq, void *offset) | |||
528 | goto end; | 1040 | goto end; |
529 | 1041 | ||
530 | seq_printf(seq, "gpe bit: 0x%02x\n", | 1042 | seq_printf(seq, "gpe bit: 0x%02x\n", |
531 | (u32) ec->gpe_bit); | 1043 | (u32) ec->common.gpe_bit); |
532 | seq_printf(seq, "ports: 0x%02x, 0x%02x\n", | 1044 | seq_printf(seq, "ports: 0x%02x, 0x%02x\n", |
533 | (u32) ec->status_addr.address, (u32) ec->data_addr.address); | 1045 | (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address); |
534 | seq_printf(seq, "use global lock: %s\n", | 1046 | seq_printf(seq, "use global lock: %s\n", |
535 | ec->global_lock?"yes":"no"); | 1047 | ec->common.global_lock?"yes":"no"); |
1048 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
536 | 1049 | ||
537 | end: | 1050 | end: |
538 | return_VALUE(0); | 1051 | return_VALUE(0); |
@@ -602,13 +1115,14 @@ acpi_ec_remove_fs ( | |||
602 | Driver Interface | 1115 | Driver Interface |
603 | -------------------------------------------------------------------------- */ | 1116 | -------------------------------------------------------------------------- */ |
604 | 1117 | ||
1118 | |||
605 | static int | 1119 | static int |
606 | acpi_ec_add ( | 1120 | acpi_ec_polling_add ( |
607 | struct acpi_device *device) | 1121 | struct acpi_device *device) |
608 | { | 1122 | { |
609 | int result = 0; | 1123 | int result = 0; |
610 | acpi_status status = AE_OK; | 1124 | acpi_status status = AE_OK; |
611 | struct acpi_ec *ec = NULL; | 1125 | union acpi_ec *ec = NULL; |
612 | unsigned long uid; | 1126 | unsigned long uid; |
613 | 1127 | ||
614 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1128 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
@@ -616,36 +1130,107 @@ acpi_ec_add ( | |||
616 | if (!device) | 1130 | if (!device) |
617 | return_VALUE(-EINVAL); | 1131 | return_VALUE(-EINVAL); |
618 | 1132 | ||
619 | ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 1133 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
620 | if (!ec) | 1134 | if (!ec) |
621 | return_VALUE(-ENOMEM); | 1135 | return_VALUE(-ENOMEM); |
622 | memset(ec, 0, sizeof(struct acpi_ec)); | 1136 | memset(ec, 0, sizeof(union acpi_ec)); |
623 | 1137 | ||
624 | ec->handle = device->handle; | 1138 | ec->common.handle = device->handle; |
625 | ec->uid = -1; | 1139 | ec->common.uid = -1; |
626 | spin_lock_init(&ec->lock); | 1140 | spin_lock_init(&ec->polling.lock); |
627 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1141 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
628 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1142 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
629 | acpi_driver_data(device) = ec; | 1143 | acpi_driver_data(device) = ec; |
630 | 1144 | ||
631 | /* Use the global lock for all EC transactions? */ | 1145 | /* Use the global lock for all EC transactions? */ |
632 | acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock); | 1146 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); |
633 | 1147 | ||
634 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1148 | /* If our UID matches the UID for the ECDT-enumerated EC, |
635 | we now have the *real* EC info, so kill the makeshift one.*/ | 1149 | we now have the *real* EC info, so kill the makeshift one.*/ |
636 | acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid); | 1150 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); |
637 | if (ec_ecdt && ec_ecdt->uid == uid) { | 1151 | if (ec_ecdt && ec_ecdt->common.uid == uid) { |
638 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1152 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
639 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); | 1153 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); |
640 | 1154 | ||
641 | acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); | 1155 | acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); |
1156 | |||
1157 | kfree(ec_ecdt); | ||
1158 | } | ||
1159 | |||
1160 | /* Get GPE bit assignment (EC events). */ | ||
1161 | /* TODO: Add support for _GPE returning a package */ | ||
1162 | status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); | ||
1163 | if (ACPI_FAILURE(status)) { | ||
1164 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1165 | "Error obtaining GPE bit assignment\n")); | ||
1166 | result = -ENODEV; | ||
1167 | goto end; | ||
1168 | } | ||
1169 | |||
1170 | result = acpi_ec_add_fs(device); | ||
1171 | if (result) | ||
1172 | goto end; | ||
1173 | |||
1174 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | ||
1175 | acpi_device_name(device), acpi_device_bid(device), | ||
1176 | (u32) ec->common.gpe_bit); | ||
1177 | |||
1178 | if (!first_ec) | ||
1179 | first_ec = device; | ||
1180 | |||
1181 | end: | ||
1182 | if (result) | ||
1183 | kfree(ec); | ||
1184 | |||
1185 | return_VALUE(result); | ||
1186 | } | ||
1187 | static int | ||
1188 | acpi_ec_burst_add ( | ||
1189 | struct acpi_device *device) | ||
1190 | { | ||
1191 | int result = 0; | ||
1192 | acpi_status status = AE_OK; | ||
1193 | union acpi_ec *ec = NULL; | ||
1194 | unsigned long uid; | ||
1195 | |||
1196 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | ||
1197 | |||
1198 | if (!device) | ||
1199 | return_VALUE(-EINVAL); | ||
1200 | |||
1201 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); | ||
1202 | if (!ec) | ||
1203 | return_VALUE(-ENOMEM); | ||
1204 | memset(ec, 0, sizeof(union acpi_ec)); | ||
1205 | |||
1206 | ec->common.handle = device->handle; | ||
1207 | ec->common.uid = -1; | ||
1208 | atomic_set(&ec->burst.pending_gpe, 0); | ||
1209 | atomic_set(&ec->burst.leaving_burst , 1); | ||
1210 | init_MUTEX(&ec->burst.sem); | ||
1211 | init_waitqueue_head(&ec->burst.wait); | ||
1212 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | ||
1213 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | ||
1214 | acpi_driver_data(device) = ec; | ||
1215 | |||
1216 | /* Use the global lock for all EC transactions? */ | ||
1217 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); | ||
1218 | |||
1219 | /* If our UID matches the UID for the ECDT-enumerated EC, | ||
1220 | we now have the *real* EC info, so kill the makeshift one.*/ | ||
1221 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | ||
1222 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1223 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | ||
1224 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); | ||
1225 | |||
1226 | acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); | ||
642 | 1227 | ||
643 | kfree(ec_ecdt); | 1228 | kfree(ec_ecdt); |
644 | } | 1229 | } |
645 | 1230 | ||
646 | /* Get GPE bit assignment (EC events). */ | 1231 | /* Get GPE bit assignment (EC events). */ |
647 | /* TODO: Add support for _GPE returning a package */ | 1232 | /* TODO: Add support for _GPE returning a package */ |
648 | status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe_bit); | 1233 | status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); |
649 | if (ACPI_FAILURE(status)) { | 1234 | if (ACPI_FAILURE(status)) { |
650 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1235 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
651 | "Error obtaining GPE bit assignment\n")); | 1236 | "Error obtaining GPE bit assignment\n")); |
@@ -659,7 +1244,7 @@ acpi_ec_add ( | |||
659 | 1244 | ||
660 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | 1245 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", |
661 | acpi_device_name(device), acpi_device_bid(device), | 1246 | acpi_device_name(device), acpi_device_bid(device), |
662 | (u32) ec->gpe_bit); | 1247 | (u32) ec->common.gpe_bit); |
663 | 1248 | ||
664 | if (!first_ec) | 1249 | if (!first_ec) |
665 | first_ec = device; | 1250 | first_ec = device; |
@@ -677,7 +1262,7 @@ acpi_ec_remove ( | |||
677 | struct acpi_device *device, | 1262 | struct acpi_device *device, |
678 | int type) | 1263 | int type) |
679 | { | 1264 | { |
680 | struct acpi_ec *ec = NULL; | 1265 | union acpi_ec *ec = NULL; |
681 | 1266 | ||
682 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); | 1267 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); |
683 | 1268 | ||
@@ -699,7 +1284,7 @@ acpi_ec_io_ports ( | |||
699 | struct acpi_resource *resource, | 1284 | struct acpi_resource *resource, |
700 | void *context) | 1285 | void *context) |
701 | { | 1286 | { |
702 | struct acpi_ec *ec = (struct acpi_ec *) context; | 1287 | union acpi_ec *ec = (union acpi_ec *) context; |
703 | struct acpi_generic_address *addr; | 1288 | struct acpi_generic_address *addr; |
704 | 1289 | ||
705 | if (resource->id != ACPI_RSTYPE_IO) { | 1290 | if (resource->id != ACPI_RSTYPE_IO) { |
@@ -711,10 +1296,10 @@ acpi_ec_io_ports ( | |||
711 | * the second address region returned is the status/command | 1296 | * the second address region returned is the status/command |
712 | * port. | 1297 | * port. |
713 | */ | 1298 | */ |
714 | if (ec->data_addr.register_bit_width == 0) { | 1299 | if (ec->common.data_addr.register_bit_width == 0) { |
715 | addr = &ec->data_addr; | 1300 | addr = &ec->common.data_addr; |
716 | } else if (ec->command_addr.register_bit_width == 0) { | 1301 | } else if (ec->common.command_addr.register_bit_width == 0) { |
717 | addr = &ec->command_addr; | 1302 | addr = &ec->common.command_addr; |
718 | } else { | 1303 | } else { |
719 | return AE_CTRL_TERMINATE; | 1304 | return AE_CTRL_TERMINATE; |
720 | } | 1305 | } |
@@ -733,7 +1318,7 @@ acpi_ec_start ( | |||
733 | struct acpi_device *device) | 1318 | struct acpi_device *device) |
734 | { | 1319 | { |
735 | acpi_status status = AE_OK; | 1320 | acpi_status status = AE_OK; |
736 | struct acpi_ec *ec = NULL; | 1321 | union acpi_ec *ec = NULL; |
737 | 1322 | ||
738 | ACPI_FUNCTION_TRACE("acpi_ec_start"); | 1323 | ACPI_FUNCTION_TRACE("acpi_ec_start"); |
739 | 1324 | ||
@@ -748,35 +1333,36 @@ acpi_ec_start ( | |||
748 | /* | 1333 | /* |
749 | * Get I/O port addresses. Convert to GAS format. | 1334 | * Get I/O port addresses. Convert to GAS format. |
750 | */ | 1335 | */ |
751 | status = acpi_walk_resources(ec->handle, METHOD_NAME__CRS, | 1336 | status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS, |
752 | acpi_ec_io_ports, ec); | 1337 | acpi_ec_io_ports, ec); |
753 | if (ACPI_FAILURE(status) || ec->command_addr.register_bit_width == 0) { | 1338 | if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { |
754 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); | 1339 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); |
755 | return_VALUE(-ENODEV); | 1340 | return_VALUE(-ENODEV); |
756 | } | 1341 | } |
757 | 1342 | ||
758 | ec->status_addr = ec->command_addr; | 1343 | ec->common.status_addr = ec->common.command_addr; |
759 | 1344 | ||
760 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", | 1345 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", |
761 | (u32) ec->gpe_bit, (u32) ec->command_addr.address, | 1346 | (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address, |
762 | (u32) ec->data_addr.address)); | 1347 | (u32) ec->common.data_addr.address)); |
1348 | |||
763 | 1349 | ||
764 | /* | 1350 | /* |
765 | * Install GPE handler | 1351 | * Install GPE handler |
766 | */ | 1352 | */ |
767 | status = acpi_install_gpe_handler(NULL, ec->gpe_bit, | 1353 | status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit, |
768 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); | 1354 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); |
769 | if (ACPI_FAILURE(status)) { | 1355 | if (ACPI_FAILURE(status)) { |
770 | return_VALUE(-ENODEV); | 1356 | return_VALUE(-ENODEV); |
771 | } | 1357 | } |
772 | acpi_set_gpe_type (NULL, ec->gpe_bit, ACPI_GPE_TYPE_RUNTIME); | 1358 | acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); |
773 | acpi_enable_gpe (NULL, ec->gpe_bit, ACPI_NOT_ISR); | 1359 | acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
774 | 1360 | ||
775 | status = acpi_install_address_space_handler (ec->handle, | 1361 | status = acpi_install_address_space_handler (ec->common.handle, |
776 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, | 1362 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, |
777 | &acpi_ec_space_setup, ec); | 1363 | &acpi_ec_space_setup, ec); |
778 | if (ACPI_FAILURE(status)) { | 1364 | if (ACPI_FAILURE(status)) { |
779 | acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); | 1365 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); |
780 | return_VALUE(-ENODEV); | 1366 | return_VALUE(-ENODEV); |
781 | } | 1367 | } |
782 | 1368 | ||
@@ -790,7 +1376,7 @@ acpi_ec_stop ( | |||
790 | int type) | 1376 | int type) |
791 | { | 1377 | { |
792 | acpi_status status = AE_OK; | 1378 | acpi_status status = AE_OK; |
793 | struct acpi_ec *ec = NULL; | 1379 | union acpi_ec *ec = NULL; |
794 | 1380 | ||
795 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); | 1381 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); |
796 | 1382 | ||
@@ -799,12 +1385,12 @@ acpi_ec_stop ( | |||
799 | 1385 | ||
800 | ec = acpi_driver_data(device); | 1386 | ec = acpi_driver_data(device); |
801 | 1387 | ||
802 | status = acpi_remove_address_space_handler(ec->handle, | 1388 | status = acpi_remove_address_space_handler(ec->common.handle, |
803 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); | 1389 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); |
804 | if (ACPI_FAILURE(status)) | 1390 | if (ACPI_FAILURE(status)) |
805 | return_VALUE(-ENODEV); | 1391 | return_VALUE(-ENODEV); |
806 | 1392 | ||
807 | status = acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); | 1393 | status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); |
808 | if (ACPI_FAILURE(status)) | 1394 | if (ACPI_FAILURE(status)) |
809 | return_VALUE(-ENODEV); | 1395 | return_VALUE(-ENODEV); |
810 | 1396 | ||
@@ -818,27 +1404,76 @@ acpi_fake_ecdt_callback ( | |||
818 | void *context, | 1404 | void *context, |
819 | void **retval) | 1405 | void **retval) |
820 | { | 1406 | { |
1407 | |||
1408 | if (acpi_ec_polling_mode) | ||
1409 | return acpi_fake_ecdt_polling_callback(handle, | ||
1410 | Level, context, retval); | ||
1411 | else | ||
1412 | return acpi_fake_ecdt_burst_callback(handle, | ||
1413 | Level, context, retval); | ||
1414 | } | ||
1415 | |||
1416 | static acpi_status __init | ||
1417 | acpi_fake_ecdt_polling_callback ( | ||
1418 | acpi_handle handle, | ||
1419 | u32 Level, | ||
1420 | void *context, | ||
1421 | void **retval) | ||
1422 | { | ||
1423 | acpi_status status; | ||
1424 | |||
1425 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
1426 | acpi_ec_io_ports, ec_ecdt); | ||
1427 | if (ACPI_FAILURE(status)) | ||
1428 | return status; | ||
1429 | ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; | ||
1430 | |||
1431 | ec_ecdt->common.uid = -1; | ||
1432 | acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); | ||
1433 | |||
1434 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); | ||
1435 | if (ACPI_FAILURE(status)) | ||
1436 | return status; | ||
1437 | spin_lock_init(&ec_ecdt->polling.lock); | ||
1438 | ec_ecdt->common.global_lock = TRUE; | ||
1439 | ec_ecdt->common.handle = handle; | ||
1440 | |||
1441 | printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", | ||
1442 | (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, | ||
1443 | (u32) ec_ecdt->common.data_addr.address); | ||
1444 | |||
1445 | return AE_CTRL_TERMINATE; | ||
1446 | } | ||
1447 | |||
1448 | static acpi_status __init | ||
1449 | acpi_fake_ecdt_burst_callback ( | ||
1450 | acpi_handle handle, | ||
1451 | u32 Level, | ||
1452 | void *context, | ||
1453 | void **retval) | ||
1454 | { | ||
821 | acpi_status status; | 1455 | acpi_status status; |
822 | 1456 | ||
1457 | init_MUTEX(&ec_ecdt->burst.sem); | ||
1458 | init_waitqueue_head(&ec_ecdt->burst.wait); | ||
823 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 1459 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
824 | acpi_ec_io_ports, ec_ecdt); | 1460 | acpi_ec_io_ports, ec_ecdt); |
825 | if (ACPI_FAILURE(status)) | 1461 | if (ACPI_FAILURE(status)) |
826 | return status; | 1462 | return status; |
827 | ec_ecdt->status_addr = ec_ecdt->command_addr; | 1463 | ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; |
828 | 1464 | ||
829 | ec_ecdt->uid = -1; | 1465 | ec_ecdt->common.uid = -1; |
830 | acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); | 1466 | acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); |
831 | 1467 | ||
832 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); | 1468 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); |
833 | if (ACPI_FAILURE(status)) | 1469 | if (ACPI_FAILURE(status)) |
834 | return status; | 1470 | return status; |
835 | spin_lock_init(&ec_ecdt->lock); | 1471 | ec_ecdt->common.global_lock = TRUE; |
836 | ec_ecdt->global_lock = TRUE; | 1472 | ec_ecdt->common.handle = handle; |
837 | ec_ecdt->handle = handle; | ||
838 | 1473 | ||
839 | printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", | 1474 | printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", |
840 | (u32) ec_ecdt->gpe_bit, (u32) ec_ecdt->command_addr.address, | 1475 | (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, |
841 | (u32) ec_ecdt->data_addr.address); | 1476 | (u32) ec_ecdt->common.data_addr.address); |
842 | 1477 | ||
843 | return AE_CTRL_TERMINATE; | 1478 | return AE_CTRL_TERMINATE; |
844 | } | 1479 | } |
@@ -861,12 +1496,12 @@ acpi_ec_fake_ecdt(void) | |||
861 | 1496 | ||
862 | printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); | 1497 | printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); |
863 | 1498 | ||
864 | ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 1499 | ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
865 | if (!ec_ecdt) { | 1500 | if (!ec_ecdt) { |
866 | ret = -ENOMEM; | 1501 | ret = -ENOMEM; |
867 | goto error; | 1502 | goto error; |
868 | } | 1503 | } |
869 | memset(ec_ecdt, 0, sizeof(struct acpi_ec)); | 1504 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); |
870 | 1505 | ||
871 | status = acpi_get_devices (ACPI_EC_HID, | 1506 | status = acpi_get_devices (ACPI_EC_HID, |
872 | acpi_fake_ecdt_callback, | 1507 | acpi_fake_ecdt_callback, |
@@ -887,6 +1522,15 @@ error: | |||
887 | static int __init | 1522 | static int __init |
888 | acpi_ec_get_real_ecdt(void) | 1523 | acpi_ec_get_real_ecdt(void) |
889 | { | 1524 | { |
1525 | if (acpi_ec_polling_mode) | ||
1526 | return acpi_ec_polling_get_real_ecdt(); | ||
1527 | else | ||
1528 | return acpi_ec_burst_get_real_ecdt(); | ||
1529 | } | ||
1530 | |||
1531 | static int __init | ||
1532 | acpi_ec_polling_get_real_ecdt(void) | ||
1533 | { | ||
890 | acpi_status status; | 1534 | acpi_status status; |
891 | struct acpi_table_ecdt *ecdt_ptr; | 1535 | struct acpi_table_ecdt *ecdt_ptr; |
892 | 1536 | ||
@@ -900,21 +1544,67 @@ acpi_ec_get_real_ecdt(void) | |||
900 | /* | 1544 | /* |
901 | * Generate a temporary ec context to use until the namespace is scanned | 1545 | * Generate a temporary ec context to use until the namespace is scanned |
902 | */ | 1546 | */ |
903 | ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 1547 | ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
904 | if (!ec_ecdt) | 1548 | if (!ec_ecdt) |
905 | return -ENOMEM; | 1549 | return -ENOMEM; |
906 | memset(ec_ecdt, 0, sizeof(struct acpi_ec)); | 1550 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); |
1551 | |||
1552 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; | ||
1553 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | ||
1554 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | ||
1555 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; | ||
1556 | spin_lock_init(&ec_ecdt->polling.lock); | ||
1557 | /* use the GL just to be safe */ | ||
1558 | ec_ecdt->common.global_lock = TRUE; | ||
1559 | ec_ecdt->common.uid = ecdt_ptr->uid; | ||
1560 | |||
1561 | status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); | ||
1562 | if (ACPI_FAILURE(status)) { | ||
1563 | goto error; | ||
1564 | } | ||
1565 | |||
1566 | return 0; | ||
1567 | error: | ||
1568 | printk(KERN_ERR PREFIX "Could not use ECDT\n"); | ||
1569 | kfree(ec_ecdt); | ||
1570 | ec_ecdt = NULL; | ||
1571 | |||
1572 | return -ENODEV; | ||
1573 | } | ||
1574 | |||
1575 | |||
1576 | static int __init | ||
1577 | acpi_ec_burst_get_real_ecdt(void) | ||
1578 | { | ||
1579 | acpi_status status; | ||
1580 | struct acpi_table_ecdt *ecdt_ptr; | ||
1581 | |||
1582 | status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, | ||
1583 | (struct acpi_table_header **) &ecdt_ptr); | ||
1584 | if (ACPI_FAILURE(status)) | ||
1585 | return -ENODEV; | ||
1586 | |||
1587 | printk(KERN_INFO PREFIX "Found ECDT\n"); | ||
907 | 1588 | ||
908 | ec_ecdt->command_addr = ecdt_ptr->ec_control; | 1589 | /* |
909 | ec_ecdt->status_addr = ecdt_ptr->ec_control; | 1590 | * Generate a temporary ec context to use until the namespace is scanned |
910 | ec_ecdt->data_addr = ecdt_ptr->ec_data; | 1591 | */ |
911 | ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; | 1592 | ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
912 | spin_lock_init(&ec_ecdt->lock); | 1593 | if (!ec_ecdt) |
1594 | return -ENOMEM; | ||
1595 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); | ||
1596 | |||
1597 | init_MUTEX(&ec_ecdt->burst.sem); | ||
1598 | init_waitqueue_head(&ec_ecdt->burst.wait); | ||
1599 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; | ||
1600 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | ||
1601 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | ||
1602 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; | ||
913 | /* use the GL just to be safe */ | 1603 | /* use the GL just to be safe */ |
914 | ec_ecdt->global_lock = TRUE; | 1604 | ec_ecdt->common.global_lock = TRUE; |
915 | ec_ecdt->uid = ecdt_ptr->uid; | 1605 | ec_ecdt->common.uid = ecdt_ptr->uid; |
916 | 1606 | ||
917 | status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle); | 1607 | status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); |
918 | if (ACPI_FAILURE(status)) { | 1608 | if (ACPI_FAILURE(status)) { |
919 | goto error; | 1609 | goto error; |
920 | } | 1610 | } |
@@ -947,20 +1637,20 @@ acpi_ec_ecdt_probe (void) | |||
947 | /* | 1637 | /* |
948 | * Install GPE handler | 1638 | * Install GPE handler |
949 | */ | 1639 | */ |
950 | status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe_bit, | 1640 | status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit, |
951 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, | 1641 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, |
952 | ec_ecdt); | 1642 | ec_ecdt); |
953 | if (ACPI_FAILURE(status)) { | 1643 | if (ACPI_FAILURE(status)) { |
954 | goto error; | 1644 | goto error; |
955 | } | 1645 | } |
956 | acpi_set_gpe_type (NULL, ec_ecdt->gpe_bit, ACPI_GPE_TYPE_RUNTIME); | 1646 | acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); |
957 | acpi_enable_gpe (NULL, ec_ecdt->gpe_bit, ACPI_NOT_ISR); | 1647 | acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR); |
958 | 1648 | ||
959 | status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, | 1649 | status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, |
960 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, | 1650 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, |
961 | &acpi_ec_space_setup, ec_ecdt); | 1651 | &acpi_ec_space_setup, ec_ecdt); |
962 | if (ACPI_FAILURE(status)) { | 1652 | if (ACPI_FAILURE(status)) { |
963 | acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, | 1653 | acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, |
964 | &acpi_ec_gpe_handler); | 1654 | &acpi_ec_gpe_handler); |
965 | goto error; | 1655 | goto error; |
966 | } | 1656 | } |
@@ -1021,4 +1711,24 @@ static int __init acpi_fake_ecdt_setup(char *str) | |||
1021 | acpi_fake_ecdt_enabled = 1; | 1711 | acpi_fake_ecdt_enabled = 1; |
1022 | return 0; | 1712 | return 0; |
1023 | } | 1713 | } |
1714 | |||
1024 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); | 1715 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); |
1716 | static int __init acpi_ec_set_polling_mode(char *str) | ||
1717 | { | ||
1718 | int burst; | ||
1719 | |||
1720 | if (!get_option(&str, &burst)) | ||
1721 | return 0; | ||
1722 | |||
1723 | if (burst) { | ||
1724 | acpi_ec_polling_mode = EC_BURST; | ||
1725 | acpi_ec_driver.ops.add = acpi_ec_burst_add; | ||
1726 | } else { | ||
1727 | acpi_ec_polling_mode = EC_POLLING; | ||
1728 | acpi_ec_driver.ops.add = acpi_ec_polling_add; | ||
1729 | } | ||
1730 | printk(KERN_INFO PREFIX "EC %s mode.\n", | ||
1731 | burst ? "burst": "polling"); | ||
1732 | return 0; | ||
1733 | } | ||
1734 | __setup("ec_burst=", acpi_ec_set_polling_mode); | ||
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 2a213604ae51..dd3a72a869f4 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -47,6 +47,16 @@ | |||
47 | #define _COMPONENT ACPI_EVENTS | 47 | #define _COMPONENT ACPI_EVENTS |
48 | ACPI_MODULE_NAME ("evevent") | 48 | ACPI_MODULE_NAME ("evevent") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | |||
52 | static acpi_status | ||
53 | acpi_ev_fixed_event_initialize ( | ||
54 | void); | ||
55 | |||
56 | static u32 | ||
57 | acpi_ev_fixed_event_dispatch ( | ||
58 | u32 event); | ||
59 | |||
50 | 60 | ||
51 | /******************************************************************************* | 61 | /******************************************************************************* |
52 | * | 62 | * |
@@ -56,7 +66,7 @@ | |||
56 | * | 66 | * |
57 | * RETURN: Status | 67 | * RETURN: Status |
58 | * | 68 | * |
59 | * DESCRIPTION: Initialize global data structures for events. | 69 | * DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE) |
60 | * | 70 | * |
61 | ******************************************************************************/ | 71 | ******************************************************************************/ |
62 | 72 | ||
@@ -78,9 +88,9 @@ acpi_ev_initialize_events ( | |||
78 | } | 88 | } |
79 | 89 | ||
80 | /* | 90 | /* |
81 | * Initialize the Fixed and General Purpose Events. This is | 91 | * Initialize the Fixed and General Purpose Events. This is done prior to |
82 | * done prior to enabling SCIs to prevent interrupts from | 92 | * enabling SCIs to prevent interrupts from occurring before the handlers are |
83 | * occurring before handers are installed. | 93 | * installed. |
84 | */ | 94 | */ |
85 | status = acpi_ev_fixed_event_initialize (); | 95 | status = acpi_ev_fixed_event_initialize (); |
86 | if (ACPI_FAILURE (status)) { | 96 | if (ACPI_FAILURE (status)) { |
@@ -161,7 +171,7 @@ acpi_ev_install_xrupt_handlers ( | |||
161 | * | 171 | * |
162 | ******************************************************************************/ | 172 | ******************************************************************************/ |
163 | 173 | ||
164 | acpi_status | 174 | static acpi_status |
165 | acpi_ev_fixed_event_initialize ( | 175 | acpi_ev_fixed_event_initialize ( |
166 | void) | 176 | void) |
167 | { | 177 | { |
@@ -180,7 +190,8 @@ acpi_ev_fixed_event_initialize ( | |||
180 | /* Enable the fixed event */ | 190 | /* Enable the fixed event */ |
181 | 191 | ||
182 | if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { | 192 | if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { |
183 | status = acpi_set_register (acpi_gbl_fixed_event_info[i].enable_register_id, | 193 | status = acpi_set_register ( |
194 | acpi_gbl_fixed_event_info[i].enable_register_id, | ||
184 | 0, ACPI_MTX_LOCK); | 195 | 0, ACPI_MTX_LOCK); |
185 | if (ACPI_FAILURE (status)) { | 196 | if (ACPI_FAILURE (status)) { |
186 | return (status); | 197 | return (status); |
@@ -200,7 +211,7 @@ acpi_ev_fixed_event_initialize ( | |||
200 | * | 211 | * |
201 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED | 212 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED |
202 | * | 213 | * |
203 | * DESCRIPTION: Checks the PM status register for fixed events | 214 | * DESCRIPTION: Checks the PM status register for active fixed events |
204 | * | 215 | * |
205 | ******************************************************************************/ | 216 | ******************************************************************************/ |
206 | 217 | ||
@@ -221,8 +232,10 @@ acpi_ev_fixed_event_detect ( | |||
221 | * Read the fixed feature status and enable registers, as all the cases | 232 | * Read the fixed feature status and enable registers, as all the cases |
222 | * depend on their values. Ignore errors here. | 233 | * depend on their values. Ignore errors here. |
223 | */ | 234 | */ |
224 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &fixed_status); | 235 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, |
225 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable); | 236 | &fixed_status); |
237 | (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, | ||
238 | &fixed_enable); | ||
226 | 239 | ||
227 | ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, | 240 | ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, |
228 | "Fixed Event Block: Enable %08X Status %08X\n", | 241 | "Fixed Event Block: Enable %08X Status %08X\n", |
@@ -259,7 +272,7 @@ acpi_ev_fixed_event_detect ( | |||
259 | * | 272 | * |
260 | ******************************************************************************/ | 273 | ******************************************************************************/ |
261 | 274 | ||
262 | u32 | 275 | static u32 |
263 | acpi_ev_fixed_event_dispatch ( | 276 | acpi_ev_fixed_event_dispatch ( |
264 | u32 event) | 277 | u32 event) |
265 | { | 278 | { |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 118d72ac7c76..081120b109ba 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -48,6 +48,12 @@ | |||
48 | #define _COMPONENT ACPI_EVENTS | 48 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME ("evgpe") | 49 | ACPI_MODULE_NAME ("evgpe") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | |||
53 | static void ACPI_SYSTEM_XFACE | ||
54 | acpi_ev_asynch_execute_gpe_method ( | ||
55 | void *context); | ||
56 | |||
51 | 57 | ||
52 | /******************************************************************************* | 58 | /******************************************************************************* |
53 | * | 59 | * |
@@ -335,8 +341,10 @@ acpi_ev_get_gpe_event_info ( | |||
335 | gpe_block = acpi_gbl_gpe_fadt_blocks[i]; | 341 | gpe_block = acpi_gbl_gpe_fadt_blocks[i]; |
336 | if (gpe_block) { | 342 | if (gpe_block) { |
337 | if ((gpe_number >= gpe_block->block_base_number) && | 343 | if ((gpe_number >= gpe_block->block_base_number) && |
338 | (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { | 344 | (gpe_number < gpe_block->block_base_number + |
339 | return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); | 345 | (gpe_block->register_count * 8))) { |
346 | return (&gpe_block->event_info[gpe_number - | ||
347 | gpe_block->block_base_number]); | ||
340 | } | 348 | } |
341 | } | 349 | } |
342 | } | 350 | } |
@@ -437,7 +445,7 @@ acpi_ev_gpe_detect ( | |||
437 | "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", | 445 | "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", |
438 | gpe_register_info->base_gpe_number, status_reg, enable_reg)); | 446 | gpe_register_info->base_gpe_number, status_reg, enable_reg)); |
439 | 447 | ||
440 | /* First check if there is anything active at all in this register */ | 448 | /* Check if there is anything active at all in this register */ |
441 | 449 | ||
442 | enabled_status_byte = (u8) (status_reg & enable_reg); | 450 | enabled_status_byte = (u8) (status_reg & enable_reg); |
443 | if (!enabled_status_byte) { | 451 | if (!enabled_status_byte) { |
@@ -457,8 +465,8 @@ acpi_ev_gpe_detect ( | |||
457 | * or method. | 465 | * or method. |
458 | */ | 466 | */ |
459 | int_status |= acpi_ev_gpe_dispatch ( | 467 | int_status |= acpi_ev_gpe_dispatch ( |
460 | &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], | 468 | &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], |
461 | (u32) j + gpe_register_info->base_gpe_number); | 469 | (u32) j + gpe_register_info->base_gpe_number); |
462 | } | 470 | } |
463 | } | 471 | } |
464 | } | 472 | } |
@@ -523,7 +531,8 @@ acpi_ev_asynch_execute_gpe_method ( | |||
523 | * Take a snapshot of the GPE info for this level - we copy the | 531 | * Take a snapshot of the GPE info for this level - we copy the |
524 | * info to prevent a race condition with remove_handler/remove_block. | 532 | * info to prevent a race condition with remove_handler/remove_block. |
525 | */ | 533 | */ |
526 | ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, sizeof (struct acpi_gpe_event_info)); | 534 | ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, |
535 | sizeof (struct acpi_gpe_event_info)); | ||
527 | 536 | ||
528 | status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); | 537 | status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); |
529 | if (ACPI_FAILURE (status)) { | 538 | if (ACPI_FAILURE (status)) { |
@@ -534,7 +543,8 @@ acpi_ev_asynch_execute_gpe_method ( | |||
534 | * Must check for control method type dispatch one more | 543 | * Must check for control method type dispatch one more |
535 | * time to avoid race with ev_gpe_install_handler | 544 | * time to avoid race with ev_gpe_install_handler |
536 | */ | 545 | */ |
537 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { | 546 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == |
547 | ACPI_GPE_DISPATCH_METHOD) { | ||
538 | /* | 548 | /* |
539 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | 549 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx |
540 | * control method that corresponds to this GPE | 550 | * control method that corresponds to this GPE |
@@ -553,7 +563,8 @@ acpi_ev_asynch_execute_gpe_method ( | |||
553 | } | 563 | } |
554 | } | 564 | } |
555 | 565 | ||
556 | if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { | 566 | if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
567 | ACPI_GPE_LEVEL_TRIGGERED) { | ||
557 | /* | 568 | /* |
558 | * GPE is level-triggered, we clear the GPE status bit after | 569 | * GPE is level-triggered, we clear the GPE status bit after |
559 | * handling the event. | 570 | * handling the event. |
@@ -575,7 +586,7 @@ acpi_ev_asynch_execute_gpe_method ( | |||
575 | * | 586 | * |
576 | * FUNCTION: acpi_ev_gpe_dispatch | 587 | * FUNCTION: acpi_ev_gpe_dispatch |
577 | * | 588 | * |
578 | * PARAMETERS: gpe_event_info - info for this GPE | 589 | * PARAMETERS: gpe_event_info - Info for this GPE |
579 | * gpe_number - Number relative to the parent GPE block | 590 | * gpe_number - Number relative to the parent GPE block |
580 | * | 591 | * |
581 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED | 592 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED |
@@ -602,10 +613,12 @@ acpi_ev_gpe_dispatch ( | |||
602 | * If edge-triggered, clear the GPE status bit now. Note that | 613 | * If edge-triggered, clear the GPE status bit now. Note that |
603 | * level-triggered events are cleared after the GPE is serviced. | 614 | * level-triggered events are cleared after the GPE is serviced. |
604 | */ | 615 | */ |
605 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) { | 616 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
617 | ACPI_GPE_EDGE_TRIGGERED) { | ||
606 | status = acpi_hw_clear_gpe (gpe_event_info); | 618 | status = acpi_hw_clear_gpe (gpe_event_info); |
607 | if (ACPI_FAILURE (status)) { | 619 | if (ACPI_FAILURE (status)) { |
608 | ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", | 620 | ACPI_REPORT_ERROR (( |
621 | "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", | ||
609 | acpi_format_exception (status), gpe_number)); | 622 | acpi_format_exception (status), gpe_number)); |
610 | return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); | 623 | return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); |
611 | } | 624 | } |
@@ -639,7 +652,8 @@ acpi_ev_gpe_dispatch ( | |||
639 | 652 | ||
640 | /* It is now safe to clear level-triggered events. */ | 653 | /* It is now safe to clear level-triggered events. */ |
641 | 654 | ||
642 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { | 655 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
656 | ACPI_GPE_LEVEL_TRIGGERED) { | ||
643 | status = acpi_hw_clear_gpe (gpe_event_info); | 657 | status = acpi_hw_clear_gpe (gpe_event_info); |
644 | if (ACPI_FAILURE (status)) { | 658 | if (ACPI_FAILURE (status)) { |
645 | ACPI_REPORT_ERROR (( | 659 | ACPI_REPORT_ERROR (( |
@@ -704,7 +718,6 @@ acpi_ev_gpe_dispatch ( | |||
704 | 718 | ||
705 | 719 | ||
706 | #ifdef ACPI_GPE_NOTIFY_CHECK | 720 | #ifdef ACPI_GPE_NOTIFY_CHECK |
707 | |||
708 | /******************************************************************************* | 721 | /******************************************************************************* |
709 | * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED | 722 | * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED |
710 | * | 723 | * |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 00d981f53c6a..84186a7d17b2 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -48,6 +48,39 @@ | |||
48 | #define _COMPONENT ACPI_EVENTS | 48 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME ("evgpeblk") | 49 | ACPI_MODULE_NAME ("evgpeblk") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | |||
53 | static acpi_status | ||
54 | acpi_ev_save_method_info ( | ||
55 | acpi_handle obj_handle, | ||
56 | u32 level, | ||
57 | void *obj_desc, | ||
58 | void **return_value); | ||
59 | |||
60 | static acpi_status | ||
61 | acpi_ev_match_prw_and_gpe ( | ||
62 | acpi_handle obj_handle, | ||
63 | u32 level, | ||
64 | void *info, | ||
65 | void **return_value); | ||
66 | |||
67 | static struct acpi_gpe_xrupt_info * | ||
68 | acpi_ev_get_gpe_xrupt_block ( | ||
69 | u32 interrupt_level); | ||
70 | |||
71 | static acpi_status | ||
72 | acpi_ev_delete_gpe_xrupt ( | ||
73 | struct acpi_gpe_xrupt_info *gpe_xrupt); | ||
74 | |||
75 | static acpi_status | ||
76 | acpi_ev_install_gpe_block ( | ||
77 | struct acpi_gpe_block_info *gpe_block, | ||
78 | u32 interrupt_level); | ||
79 | |||
80 | static acpi_status | ||
81 | acpi_ev_create_gpe_info_blocks ( | ||
82 | struct acpi_gpe_block_info *gpe_block); | ||
83 | |||
51 | 84 | ||
52 | /******************************************************************************* | 85 | /******************************************************************************* |
53 | * | 86 | * |
@@ -155,7 +188,7 @@ unlock_and_exit: | |||
155 | } | 188 | } |
156 | 189 | ||
157 | 190 | ||
158 | /****************************************************************************** | 191 | /******************************************************************************* |
159 | * | 192 | * |
160 | * FUNCTION: acpi_ev_delete_gpe_handlers | 193 | * FUNCTION: acpi_ev_delete_gpe_handlers |
161 | * | 194 | * |
@@ -190,7 +223,8 @@ acpi_ev_delete_gpe_handlers ( | |||
190 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 223 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
191 | gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; | 224 | gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j]; |
192 | 225 | ||
193 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { | 226 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
227 | ACPI_GPE_DISPATCH_HANDLER) { | ||
194 | ACPI_MEM_FREE (gpe_event_info->dispatch.handler); | 228 | ACPI_MEM_FREE (gpe_event_info->dispatch.handler); |
195 | gpe_event_info->dispatch.handler = NULL; | 229 | gpe_event_info->dispatch.handler = NULL; |
196 | gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; | 230 | gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; |
@@ -471,7 +505,7 @@ acpi_ev_get_gpe_xrupt_block ( | |||
471 | ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); | 505 | ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block"); |
472 | 506 | ||
473 | 507 | ||
474 | /* No need for spin lock since we are not changing any list elements here */ | 508 | /* No need for lock since we are not changing any list elements here */ |
475 | 509 | ||
476 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; | 510 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; |
477 | while (next_gpe_xrupt) { | 511 | while (next_gpe_xrupt) { |
@@ -619,7 +653,7 @@ acpi_ev_install_gpe_block ( | |||
619 | goto unlock_and_exit; | 653 | goto unlock_and_exit; |
620 | } | 654 | } |
621 | 655 | ||
622 | /* Install the new block at the end of the list for this interrupt with lock */ | 656 | /* Install the new block at the end of the list with lock */ |
623 | 657 | ||
624 | acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); | 658 | acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR); |
625 | if (gpe_xrupt_block->gpe_block_list_head) { | 659 | if (gpe_xrupt_block->gpe_block_list_head) { |
@@ -756,10 +790,12 @@ acpi_ev_create_gpe_info_blocks ( | |||
756 | * per register. Initialization to zeros is sufficient. | 790 | * per register. Initialization to zeros is sufficient. |
757 | */ | 791 | */ |
758 | gpe_event_info = ACPI_MEM_CALLOCATE ( | 792 | gpe_event_info = ACPI_MEM_CALLOCATE ( |
759 | ((acpi_size) gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) * | 793 | ((acpi_size) gpe_block->register_count * |
794 | ACPI_GPE_REGISTER_WIDTH) * | ||
760 | sizeof (struct acpi_gpe_event_info)); | 795 | sizeof (struct acpi_gpe_event_info)); |
761 | if (!gpe_event_info) { | 796 | if (!gpe_event_info) { |
762 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the gpe_event_info table\n")); | 797 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
798 | "Could not allocate the gpe_event_info table\n")); | ||
763 | status = AE_NO_MEMORY; | 799 | status = AE_NO_MEMORY; |
764 | goto error_exit; | 800 | goto error_exit; |
765 | } | 801 | } |
@@ -899,7 +935,8 @@ acpi_ev_create_gpe_block ( | |||
899 | gpe_block->block_base_number = gpe_block_base_number; | 935 | gpe_block->block_base_number = gpe_block_base_number; |
900 | gpe_block->node = gpe_device; | 936 | gpe_block->node = gpe_device; |
901 | 937 | ||
902 | ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, sizeof (struct acpi_generic_address)); | 938 | ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, |
939 | sizeof (struct acpi_generic_address)); | ||
903 | 940 | ||
904 | /* Create the register_info and event_info sub-structures */ | 941 | /* Create the register_info and event_info sub-structures */ |
905 | 942 | ||
@@ -1061,8 +1098,9 @@ acpi_ev_gpe_initialize ( | |||
1061 | 1098 | ||
1062 | /* Install GPE Block 0 */ | 1099 | /* Install GPE Block 0 */ |
1063 | 1100 | ||
1064 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe0_blk, | 1101 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, |
1065 | register_count0, 0, acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); | 1102 | &acpi_gbl_FADT->xgpe0_blk, register_count0, 0, |
1103 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); | ||
1066 | 1104 | ||
1067 | if (ACPI_FAILURE (status)) { | 1105 | if (ACPI_FAILURE (status)) { |
1068 | ACPI_REPORT_ERROR (( | 1106 | ACPI_REPORT_ERROR (( |
@@ -1094,8 +1132,9 @@ acpi_ev_gpe_initialize ( | |||
1094 | else { | 1132 | else { |
1095 | /* Install GPE Block 1 */ | 1133 | /* Install GPE Block 1 */ |
1096 | 1134 | ||
1097 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe1_blk, | 1135 | status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, |
1098 | register_count1, acpi_gbl_FADT->gpe1_base, | 1136 | &acpi_gbl_FADT->xgpe1_blk, register_count1, |
1137 | acpi_gbl_FADT->gpe1_base, | ||
1099 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); | 1138 | acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); |
1100 | 1139 | ||
1101 | if (ACPI_FAILURE (status)) { | 1140 | if (ACPI_FAILURE (status)) { |
@@ -1109,7 +1148,7 @@ acpi_ev_gpe_initialize ( | |||
1109 | * space. However, GPE0 always starts at GPE number zero. | 1148 | * space. However, GPE0 always starts at GPE number zero. |
1110 | */ | 1149 | */ |
1111 | gpe_number_max = acpi_gbl_FADT->gpe1_base + | 1150 | gpe_number_max = acpi_gbl_FADT->gpe1_base + |
1112 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); | 1151 | ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1); |
1113 | } | 1152 | } |
1114 | } | 1153 | } |
1115 | 1154 | ||
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 2548efa7a45f..659e90956112 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -50,6 +50,35 @@ | |||
50 | ACPI_MODULE_NAME ("evmisc") | 50 | ACPI_MODULE_NAME ("evmisc") |
51 | 51 | ||
52 | 52 | ||
53 | #ifdef ACPI_DEBUG_OUTPUT | ||
54 | static const char *acpi_notify_value_names[] = | ||
55 | { | ||
56 | "Bus Check", | ||
57 | "Device Check", | ||
58 | "Device Wake", | ||
59 | "Eject request", | ||
60 | "Device Check Light", | ||
61 | "Frequency Mismatch", | ||
62 | "Bus Mode Mismatch", | ||
63 | "Power Fault" | ||
64 | }; | ||
65 | #endif | ||
66 | |||
67 | /* Local prototypes */ | ||
68 | |||
69 | static void ACPI_SYSTEM_XFACE | ||
70 | acpi_ev_notify_dispatch ( | ||
71 | void *context); | ||
72 | |||
73 | static void ACPI_SYSTEM_XFACE | ||
74 | acpi_ev_global_lock_thread ( | ||
75 | void *context); | ||
76 | |||
77 | static u32 | ||
78 | acpi_ev_global_lock_handler ( | ||
79 | void *context); | ||
80 | |||
81 | |||
53 | /******************************************************************************* | 82 | /******************************************************************************* |
54 | * | 83 | * |
55 | * FUNCTION: acpi_ev_is_notify_object | 84 | * FUNCTION: acpi_ev_is_notify_object |
@@ -98,20 +127,6 @@ acpi_ev_is_notify_object ( | |||
98 | * | 127 | * |
99 | ******************************************************************************/ | 128 | ******************************************************************************/ |
100 | 129 | ||
101 | #ifdef ACPI_DEBUG_OUTPUT | ||
102 | static const char *acpi_notify_value_names[] = | ||
103 | { | ||
104 | "Bus Check", | ||
105 | "Device Check", | ||
106 | "Device Wake", | ||
107 | "Eject request", | ||
108 | "Device Check Light", | ||
109 | "Frequency Mismatch", | ||
110 | "Bus Mode Mismatch", | ||
111 | "Power Fault" | ||
112 | }; | ||
113 | #endif | ||
114 | |||
115 | acpi_status | 130 | acpi_status |
116 | acpi_ev_queue_notify_request ( | 131 | acpi_ev_queue_notify_request ( |
117 | struct acpi_namespace_node *node, | 132 | struct acpi_namespace_node *node, |
@@ -128,9 +143,10 @@ acpi_ev_queue_notify_request ( | |||
128 | 143 | ||
129 | /* | 144 | /* |
130 | * For value 3 (Ejection Request), some device method may need to be run. | 145 | * For value 3 (Ejection Request), some device method may need to be run. |
131 | * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run. | 146 | * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need |
147 | * to be run. | ||
132 | * For value 0x80 (Status Change) on the power button or sleep button, | 148 | * For value 0x80 (Status Change) on the power button or sleep button, |
133 | * initiate soft-off or sleep operation? | 149 | * initiate soft-off or sleep operation? |
134 | */ | 150 | */ |
135 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 151 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
136 | "Dispatching Notify(%X) on node %p\n", notify_value, node)); | 152 | "Dispatching Notify(%X) on node %p\n", notify_value, node)); |
@@ -140,8 +156,9 @@ acpi_ev_queue_notify_request ( | |||
140 | acpi_notify_value_names[notify_value])); | 156 | acpi_notify_value_names[notify_value])); |
141 | } | 157 | } |
142 | else { | 158 | else { |
143 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", | 159 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
144 | notify_value)); | 160 | "Notify value: 0x%2.2X **Device Specific**\n", |
161 | notify_value)); | ||
145 | } | 162 | } |
146 | 163 | ||
147 | /* Get the notify object attached to the NS Node */ | 164 | /* Get the notify object attached to the NS Node */ |
@@ -210,7 +227,7 @@ acpi_ev_queue_notify_request ( | |||
210 | * | 227 | * |
211 | * FUNCTION: acpi_ev_notify_dispatch | 228 | * FUNCTION: acpi_ev_notify_dispatch |
212 | * | 229 | * |
213 | * PARAMETERS: Context - To be passsed to the notify handler | 230 | * PARAMETERS: Context - To be passed to the notify handler |
214 | * | 231 | * |
215 | * RETURN: None. | 232 | * RETURN: None. |
216 | * | 233 | * |
@@ -219,7 +236,7 @@ acpi_ev_queue_notify_request ( | |||
219 | * | 236 | * |
220 | ******************************************************************************/ | 237 | ******************************************************************************/ |
221 | 238 | ||
222 | void ACPI_SYSTEM_XFACE | 239 | static void ACPI_SYSTEM_XFACE |
223 | acpi_ev_notify_dispatch ( | 240 | acpi_ev_notify_dispatch ( |
224 | void *context) | 241 | void *context) |
225 | { | 242 | { |
@@ -234,7 +251,8 @@ acpi_ev_notify_dispatch ( | |||
234 | 251 | ||
235 | /* | 252 | /* |
236 | * We will invoke a global notify handler if installed. | 253 | * We will invoke a global notify handler if installed. |
237 | * This is done _before_ we invoke the per-device handler attached to the device. | 254 | * This is done _before_ we invoke the per-device handler attached |
255 | * to the device. | ||
238 | */ | 256 | */ |
239 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { | 257 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { |
240 | /* Global system notification handler */ | 258 | /* Global system notification handler */ |
@@ -256,15 +274,17 @@ acpi_ev_notify_dispatch ( | |||
256 | /* Invoke the system handler first, if present */ | 274 | /* Invoke the system handler first, if present */ |
257 | 275 | ||
258 | if (global_handler) { | 276 | if (global_handler) { |
259 | global_handler (notify_info->notify.node, notify_info->notify.value, global_context); | 277 | global_handler (notify_info->notify.node, notify_info->notify.value, |
278 | global_context); | ||
260 | } | 279 | } |
261 | 280 | ||
262 | /* Now invoke the per-device handler, if present */ | 281 | /* Now invoke the per-device handler, if present */ |
263 | 282 | ||
264 | handler_obj = notify_info->notify.handler_obj; | 283 | handler_obj = notify_info->notify.handler_obj; |
265 | if (handler_obj) { | 284 | if (handler_obj) { |
266 | handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value, | 285 | handler_obj->notify.handler (notify_info->notify.node, |
267 | handler_obj->notify.context); | 286 | notify_info->notify.value, |
287 | handler_obj->notify.context); | ||
268 | } | 288 | } |
269 | 289 | ||
270 | /* All done with the info object */ | 290 | /* All done with the info object */ |
@@ -370,7 +390,8 @@ acpi_ev_global_lock_handler ( | |||
370 | ******************************************************************************/ | 390 | ******************************************************************************/ |
371 | 391 | ||
372 | acpi_status | 392 | acpi_status |
373 | acpi_ev_init_global_lock_handler (void) | 393 | acpi_ev_init_global_lock_handler ( |
394 | void) | ||
374 | { | 395 | { |
375 | acpi_status status; | 396 | acpi_status status; |
376 | 397 | ||
@@ -380,7 +401,7 @@ acpi_ev_init_global_lock_handler (void) | |||
380 | 401 | ||
381 | acpi_gbl_global_lock_present = TRUE; | 402 | acpi_gbl_global_lock_present = TRUE; |
382 | status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, | 403 | status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, |
383 | acpi_ev_global_lock_handler, NULL); | 404 | acpi_ev_global_lock_handler, NULL); |
384 | 405 | ||
385 | /* | 406 | /* |
386 | * If the global lock does not exist on this platform, the attempt | 407 | * If the global lock does not exist on this platform, the attempt |
@@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock ( | |||
433 | 454 | ||
434 | acpi_gbl_global_lock_thread_count++; | 455 | acpi_gbl_global_lock_thread_count++; |
435 | 456 | ||
436 | /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */ | 457 | /* |
437 | 458 | * If we (OS side vs. BIOS side) have the hardware lock already, | |
459 | * we are done | ||
460 | */ | ||
438 | if (acpi_gbl_global_lock_acquired) { | 461 | if (acpi_gbl_global_lock_acquired) { |
439 | return_ACPI_STATUS (AE_OK); | 462 | return_ACPI_STATUS (AE_OK); |
440 | } | 463 | } |
@@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock ( | |||
480 | ******************************************************************************/ | 503 | ******************************************************************************/ |
481 | 504 | ||
482 | acpi_status | 505 | acpi_status |
483 | acpi_ev_release_global_lock (void) | 506 | acpi_ev_release_global_lock ( |
507 | void) | ||
484 | { | 508 | { |
485 | u8 pending = FALSE; | 509 | u8 pending = FALSE; |
486 | acpi_status status = AE_OK; | 510 | acpi_status status = AE_OK; |
@@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void) | |||
490 | 514 | ||
491 | 515 | ||
492 | if (!acpi_gbl_global_lock_thread_count) { | 516 | if (!acpi_gbl_global_lock_thread_count) { |
493 | ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); | 517 | ACPI_REPORT_WARNING(( |
518 | "Cannot release HW Global Lock, it has not been acquired\n")); | ||
494 | return_ACPI_STATUS (AE_NOT_ACQUIRED); | 519 | return_ACPI_STATUS (AE_NOT_ACQUIRED); |
495 | } | 520 | } |
496 | 521 | ||
@@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void) | |||
515 | * register | 540 | * register |
516 | */ | 541 | */ |
517 | if (pending) { | 542 | if (pending) { |
518 | status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); | 543 | status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, |
544 | 1, ACPI_MTX_LOCK); | ||
519 | } | 545 | } |
520 | 546 | ||
521 | return_ACPI_STATUS (status); | 547 | return_ACPI_STATUS (status); |
@@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void) | |||
535 | ******************************************************************************/ | 561 | ******************************************************************************/ |
536 | 562 | ||
537 | void | 563 | void |
538 | acpi_ev_terminate (void) | 564 | acpi_ev_terminate ( |
565 | void) | ||
539 | { | 566 | { |
540 | acpi_native_uint i; | 567 | acpi_native_uint i; |
541 | acpi_status status; | 568 | acpi_status status; |
@@ -555,7 +582,8 @@ acpi_ev_terminate (void) | |||
555 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 582 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
556 | status = acpi_disable_event ((u32) i, 0); | 583 | status = acpi_disable_event ((u32) i, 0); |
557 | if (ACPI_FAILURE (status)) { | 584 | if (ACPI_FAILURE (status)) { |
558 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (u32) i)); | 585 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
586 | "Could not disable fixed event %d\n", (u32) i)); | ||
559 | } | 587 | } |
560 | } | 588 | } |
561 | 589 | ||
@@ -567,7 +595,8 @@ acpi_ev_terminate (void) | |||
567 | 595 | ||
568 | status = acpi_ev_remove_sci_handler (); | 596 | status = acpi_ev_remove_sci_handler (); |
569 | if (ACPI_FAILURE(status)) { | 597 | if (ACPI_FAILURE(status)) { |
570 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n")); | 598 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
599 | "Could not remove SCI handler\n")); | ||
571 | } | 600 | } |
572 | } | 601 | } |
573 | 602 | ||
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 772342708a7a..a1d7276c5742 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -58,6 +58,22 @@ static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPA | |||
58 | ACPI_ADR_SPACE_PCI_CONFIG, | 58 | ACPI_ADR_SPACE_PCI_CONFIG, |
59 | ACPI_ADR_SPACE_DATA_TABLE}; | 59 | ACPI_ADR_SPACE_DATA_TABLE}; |
60 | 60 | ||
61 | /* Local prototypes */ | ||
62 | |||
63 | static acpi_status | ||
64 | acpi_ev_reg_run ( | ||
65 | acpi_handle obj_handle, | ||
66 | u32 level, | ||
67 | void *context, | ||
68 | void **return_value); | ||
69 | |||
70 | static acpi_status | ||
71 | acpi_ev_install_handler ( | ||
72 | acpi_handle obj_handle, | ||
73 | u32 level, | ||
74 | void *context, | ||
75 | void **return_value); | ||
76 | |||
61 | 77 | ||
62 | /******************************************************************************* | 78 | /******************************************************************************* |
63 | * | 79 | * |
@@ -179,8 +195,8 @@ acpi_ev_initialize_op_regions ( | |||
179 | * | 195 | * |
180 | * FUNCTION: acpi_ev_execute_reg_method | 196 | * FUNCTION: acpi_ev_execute_reg_method |
181 | * | 197 | * |
182 | * PARAMETERS: region_obj - Object structure | 198 | * PARAMETERS: region_obj - Region object |
183 | * Function - Passed to _REG: On (1) or Off (0) | 199 | * Function - Passed to _REG: On (1) or Off (0) |
184 | * | 200 | * |
185 | * RETURN: Status | 201 | * RETURN: Status |
186 | * | 202 | * |
@@ -323,14 +339,16 @@ acpi_ev_address_space_dispatch ( | |||
323 | if (!region_setup) { | 339 | if (!region_setup) { |
324 | /* No initialization routine, exit with error */ | 340 | /* No initialization routine, exit with error */ |
325 | 341 | ||
326 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n", | 342 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
343 | "No init routine for region(%p) [%s]\n", | ||
327 | region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); | 344 | region_obj, acpi_ut_get_region_name (region_obj->region.space_id))); |
328 | return_ACPI_STATUS (AE_NOT_EXIST); | 345 | return_ACPI_STATUS (AE_NOT_EXIST); |
329 | } | 346 | } |
330 | 347 | ||
331 | /* | 348 | /* |
332 | * We must exit the interpreter because the region setup will potentially | 349 | * We must exit the interpreter because the region |
333 | * execute control methods (e.g., _REG method for this region) | 350 | * setup will potentially execute control methods |
351 | * (e.g., _REG method for this region) | ||
334 | */ | 352 | */ |
335 | acpi_ex_exit_interpreter (); | 353 | acpi_ex_exit_interpreter (); |
336 | 354 | ||
@@ -621,7 +639,7 @@ acpi_ev_attach_region ( | |||
621 | * | 639 | * |
622 | ******************************************************************************/ | 640 | ******************************************************************************/ |
623 | 641 | ||
624 | acpi_status | 642 | static acpi_status |
625 | acpi_ev_install_handler ( | 643 | acpi_ev_install_handler ( |
626 | acpi_handle obj_handle, | 644 | acpi_handle obj_handle, |
627 | u32 level, | 645 | u32 level, |
@@ -848,7 +866,8 @@ acpi_ev_install_space_handler ( | |||
848 | if (handler_obj->address_space.handler == handler) { | 866 | if (handler_obj->address_space.handler == handler) { |
849 | /* | 867 | /* |
850 | * It is (relatively) OK to attempt to install the SAME | 868 | * It is (relatively) OK to attempt to install the SAME |
851 | * handler twice. This can easily happen with PCI_Config space. | 869 | * handler twice. This can easily happen |
870 | * with PCI_Config space. | ||
852 | */ | 871 | */ |
853 | status = AE_SAME_HANDLER; | 872 | status = AE_SAME_HANDLER; |
854 | goto unlock_and_exit; | 873 | goto unlock_and_exit; |
@@ -1011,7 +1030,7 @@ acpi_ev_execute_reg_methods ( | |||
1011 | * | 1030 | * |
1012 | ******************************************************************************/ | 1031 | ******************************************************************************/ |
1013 | 1032 | ||
1014 | acpi_status | 1033 | static acpi_status |
1015 | acpi_ev_reg_run ( | 1034 | acpi_ev_reg_run ( |
1016 | acpi_handle obj_handle, | 1035 | acpi_handle obj_handle, |
1017 | u32 level, | 1036 | u32 level, |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index 4983a3378be5..95bc09c73a6a 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -61,7 +61,7 @@ | |||
61 | * | 61 | * |
62 | * RETURN: Status | 62 | * RETURN: Status |
63 | * | 63 | * |
64 | * DESCRIPTION: Do any prep work for region handling, a nop for now | 64 | * DESCRIPTION: Setup a system_memory operation region |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | 67 | ||
@@ -115,7 +115,7 @@ acpi_ev_system_memory_region_setup ( | |||
115 | * | 115 | * |
116 | * RETURN: Status | 116 | * RETURN: Status |
117 | * | 117 | * |
118 | * DESCRIPTION: Do any prep work for region handling | 118 | * DESCRIPTION: Setup a IO operation region |
119 | * | 119 | * |
120 | ******************************************************************************/ | 120 | ******************************************************************************/ |
121 | 121 | ||
@@ -144,14 +144,14 @@ acpi_ev_io_space_region_setup ( | |||
144 | * | 144 | * |
145 | * FUNCTION: acpi_ev_pci_config_region_setup | 145 | * FUNCTION: acpi_ev_pci_config_region_setup |
146 | * | 146 | * |
147 | * PARAMETERS: Handle - Region we are interested in | 147 | * PARAMETERS: Handle - Region we are interested in |
148 | * Function - Start or stop | 148 | * Function - Start or stop |
149 | * handler_context - Address space handler context | 149 | * handler_context - Address space handler context |
150 | * region_context - Region specific context | 150 | * region_context - Region specific context |
151 | * | 151 | * |
152 | * RETURN: Status | 152 | * RETURN: Status |
153 | * | 153 | * |
154 | * DESCRIPTION: Do any prep work for region handling | 154 | * DESCRIPTION: Setup a PCI_Config operation region |
155 | * | 155 | * |
156 | * MUTEX: Assumes namespace is not locked | 156 | * MUTEX: Assumes namespace is not locked |
157 | * | 157 | * |
@@ -324,7 +324,7 @@ acpi_ev_pci_config_region_setup ( | |||
324 | * | 324 | * |
325 | * RETURN: Status | 325 | * RETURN: Status |
326 | * | 326 | * |
327 | * DESCRIPTION: Do any prep work for region handling | 327 | * DESCRIPTION: Setup a pci_bAR operation region |
328 | * | 328 | * |
329 | * MUTEX: Assumes namespace is not locked | 329 | * MUTEX: Assumes namespace is not locked |
330 | * | 330 | * |
@@ -355,7 +355,7 @@ acpi_ev_pci_bar_region_setup ( | |||
355 | * | 355 | * |
356 | * RETURN: Status | 356 | * RETURN: Status |
357 | * | 357 | * |
358 | * DESCRIPTION: Do any prep work for region handling | 358 | * DESCRIPTION: Setup a CMOS operation region |
359 | * | 359 | * |
360 | * MUTEX: Assumes namespace is not locked | 360 | * MUTEX: Assumes namespace is not locked |
361 | * | 361 | * |
@@ -386,7 +386,7 @@ acpi_ev_cmos_region_setup ( | |||
386 | * | 386 | * |
387 | * RETURN: Status | 387 | * RETURN: Status |
388 | * | 388 | * |
389 | * DESCRIPTION: Do any prep work for region handling | 389 | * DESCRIPTION: Default region initialization |
390 | * | 390 | * |
391 | ******************************************************************************/ | 391 | ******************************************************************************/ |
392 | 392 | ||
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 46b31995c827..f3123c26ae98 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -49,6 +49,12 @@ | |||
49 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME ("evsci") | 50 | ACPI_MODULE_NAME ("evsci") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static u32 ACPI_SYSTEM_XFACE | ||
55 | acpi_ev_sci_xrupt_handler ( | ||
56 | void *context); | ||
57 | |||
52 | 58 | ||
53 | /******************************************************************************* | 59 | /******************************************************************************* |
54 | * | 60 | * |
@@ -146,7 +152,8 @@ acpi_ev_gpe_xrupt_handler ( | |||
146 | ******************************************************************************/ | 152 | ******************************************************************************/ |
147 | 153 | ||
148 | u32 | 154 | u32 |
149 | acpi_ev_install_sci_handler (void) | 155 | acpi_ev_install_sci_handler ( |
156 | void) | ||
150 | { | 157 | { |
151 | u32 status = AE_OK; | 158 | u32 status = AE_OK; |
152 | 159 | ||
@@ -180,7 +187,8 @@ acpi_ev_install_sci_handler (void) | |||
180 | ******************************************************************************/ | 187 | ******************************************************************************/ |
181 | 188 | ||
182 | acpi_status | 189 | acpi_status |
183 | acpi_ev_remove_sci_handler (void) | 190 | acpi_ev_remove_sci_handler ( |
191 | void) | ||
184 | { | 192 | { |
185 | acpi_status status; | 193 | acpi_status status; |
186 | 194 | ||
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 0bfec10a5f1e..4092d47f6758 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -64,6 +64,7 @@ | |||
64 | * DESCRIPTION: Saves the pointer to the handler function | 64 | * DESCRIPTION: Saves the pointer to the handler function |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | |||
67 | #ifdef ACPI_FUTURE_USAGE | 68 | #ifdef ACPI_FUTURE_USAGE |
68 | acpi_status | 69 | acpi_status |
69 | acpi_install_exception_handler ( | 70 | acpi_install_exception_handler ( |
@@ -457,7 +458,8 @@ acpi_remove_notify_handler ( | |||
457 | /* Root Object */ | 458 | /* Root Object */ |
458 | 459 | ||
459 | if (device == ACPI_ROOT_OBJECT) { | 460 | if (device == ACPI_ROOT_OBJECT) { |
460 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n")); | 461 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
462 | "Removing notify handler for ROOT object.\n")); | ||
461 | 463 | ||
462 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 464 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
463 | !acpi_gbl_system_notify.handler) || | 465 | !acpi_gbl_system_notify.handler) || |
@@ -564,8 +566,9 @@ EXPORT_SYMBOL(acpi_remove_notify_handler); | |||
564 | * | 566 | * |
565 | * FUNCTION: acpi_install_gpe_handler | 567 | * FUNCTION: acpi_install_gpe_handler |
566 | * | 568 | * |
567 | * PARAMETERS: gpe_number - The GPE number within the GPE block | 569 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
568 | * gpe_block - GPE block (NULL == FADT GPEs) | 570 | * defined GPEs) |
571 | * gpe_number - The GPE number within the GPE block | ||
569 | * Type - Whether this GPE should be treated as an | 572 | * Type - Whether this GPE should be treated as an |
570 | * edge- or level-triggered interrupt. | 573 | * edge- or level-triggered interrupt. |
571 | * Address - Address of the handler | 574 | * Address - Address of the handler |
@@ -662,8 +665,9 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); | |||
662 | * | 665 | * |
663 | * FUNCTION: acpi_remove_gpe_handler | 666 | * FUNCTION: acpi_remove_gpe_handler |
664 | * | 667 | * |
665 | * PARAMETERS: gpe_number - The event to remove a handler | 668 | * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT |
666 | * gpe_block - GPE block (NULL == FADT GPEs) | 669 | * defined GPEs) |
670 | * gpe_number - The event to remove a handler | ||
667 | * Address - Address of the handler | 671 | * Address - Address of the handler |
668 | * | 672 | * |
669 | * RETURN: Status | 673 | * RETURN: Status |
@@ -766,7 +770,8 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); | |||
766 | * FUNCTION: acpi_acquire_global_lock | 770 | * FUNCTION: acpi_acquire_global_lock |
767 | * | 771 | * |
768 | * PARAMETERS: Timeout - How long the caller is willing to wait | 772 | * PARAMETERS: Timeout - How long the caller is willing to wait |
769 | * out_handle - A handle to the lock if acquired | 773 | * Handle - Where the handle to the lock is returned |
774 | * (if acquired) | ||
770 | * | 775 | * |
771 | * RETURN: Status | 776 | * RETURN: Status |
772 | * | 777 | * |
@@ -812,7 +817,7 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); | |||
812 | * | 817 | * |
813 | * RETURN: Status | 818 | * RETURN: Status |
814 | * | 819 | * |
815 | * DESCRIPTION: Release the ACPI Global Lock | 820 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. |
816 | * | 821 | * |
817 | ******************************************************************************/ | 822 | ******************************************************************************/ |
818 | 823 | ||
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index fa8d5f25be62..f337dc2cc569 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -64,7 +64,8 @@ | |||
64 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | 65 | ||
66 | acpi_status | 66 | acpi_status |
67 | acpi_enable (void) | 67 | acpi_enable ( |
68 | void) | ||
68 | { | 69 | { |
69 | acpi_status status = AE_OK; | 70 | acpi_status status = AE_OK; |
70 | 71 | ||
@@ -91,7 +92,8 @@ acpi_enable (void) | |||
91 | return_ACPI_STATUS (status); | 92 | return_ACPI_STATUS (status); |
92 | } | 93 | } |
93 | 94 | ||
94 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n")); | 95 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, |
96 | "Transition to ACPI mode successful\n")); | ||
95 | } | 97 | } |
96 | 98 | ||
97 | return_ACPI_STATUS (status); | 99 | return_ACPI_STATUS (status); |
@@ -106,12 +108,13 @@ acpi_enable (void) | |||
106 | * | 108 | * |
107 | * RETURN: Status | 109 | * RETURN: Status |
108 | * | 110 | * |
109 | * DESCRIPTION: Transfers the system into LEGACY mode. | 111 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. |
110 | * | 112 | * |
111 | ******************************************************************************/ | 113 | ******************************************************************************/ |
112 | 114 | ||
113 | acpi_status | 115 | acpi_status |
114 | acpi_disable (void) | 116 | acpi_disable ( |
117 | void) | ||
115 | { | 118 | { |
116 | acpi_status status = AE_OK; | 119 | acpi_status status = AE_OK; |
117 | 120 | ||
@@ -125,7 +128,8 @@ acpi_disable (void) | |||
125 | } | 128 | } |
126 | 129 | ||
127 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { | 130 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { |
128 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n")); | 131 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, |
132 | "System is already in legacy (non-ACPI) mode\n")); | ||
129 | } | 133 | } |
130 | else { | 134 | else { |
131 | /* Transition to LEGACY mode */ | 135 | /* Transition to LEGACY mode */ |
@@ -133,7 +137,8 @@ acpi_disable (void) | |||
133 | status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); | 137 | status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); |
134 | 138 | ||
135 | if (ACPI_FAILURE (status)) { | 139 | if (ACPI_FAILURE (status)) { |
136 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode")); | 140 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
141 | "Could not exit ACPI mode to legacy mode")); | ||
137 | return_ACPI_STATUS (status); | 142 | return_ACPI_STATUS (status); |
138 | } | 143 | } |
139 | 144 | ||
@@ -214,7 +219,7 @@ EXPORT_SYMBOL(acpi_enable_event); | |||
214 | * | 219 | * |
215 | * RETURN: Status | 220 | * RETURN: Status |
216 | * | 221 | * |
217 | * DESCRIPTION: Enable an ACPI event (general purpose) | 222 | * DESCRIPTION: Set the type of an individual GPE |
218 | * | 223 | * |
219 | ******************************************************************************/ | 224 | ******************************************************************************/ |
220 | 225 | ||
@@ -519,13 +524,12 @@ unlock_and_exit: | |||
519 | 524 | ||
520 | 525 | ||
521 | #ifdef ACPI_FUTURE_USAGE | 526 | #ifdef ACPI_FUTURE_USAGE |
522 | |||
523 | /******************************************************************************* | 527 | /******************************************************************************* |
524 | * | 528 | * |
525 | * FUNCTION: acpi_get_event_status | 529 | * FUNCTION: acpi_get_event_status |
526 | * | 530 | * |
527 | * PARAMETERS: Event - The fixed event | 531 | * PARAMETERS: Event - The fixed event |
528 | * Event Status - Where the current status of the event will | 532 | * event_status - Where the current status of the event will |
529 | * be returned | 533 | * be returned |
530 | * | 534 | * |
531 | * RETURN: Status | 535 | * RETURN: Status |
@@ -571,7 +575,7 @@ acpi_get_event_status ( | |||
571 | * PARAMETERS: gpe_device - Parent GPE Device | 575 | * PARAMETERS: gpe_device - Parent GPE Device |
572 | * gpe_number - GPE level within the GPE block | 576 | * gpe_number - GPE level within the GPE block |
573 | * Flags - Called from an ISR or not | 577 | * Flags - Called from an ISR or not |
574 | * Event Status - Where the current status of the event will | 578 | * event_status - Where the current status of the event will |
575 | * be returned | 579 | * be returned |
576 | * | 580 | * |
577 | * RETURN: Status | 581 | * RETURN: Status |
@@ -775,4 +779,5 @@ unlock_and_exit: | |||
775 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 779 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
776 | return_ACPI_STATUS (status); | 780 | return_ACPI_STATUS (status); |
777 | } | 781 | } |
782 | |||
778 | EXPORT_SYMBOL(acpi_remove_gpe_block); | 783 | EXPORT_SYMBOL(acpi_remove_gpe_block); |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index ac3c061967f2..734b2f24af48 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -54,6 +54,14 @@ | |||
54 | #define _COMPONENT ACPI_EXECUTER | 54 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exconfig") | 55 | ACPI_MODULE_NAME ("exconfig") |
56 | 56 | ||
57 | /* Local prototypes */ | ||
58 | |||
59 | static acpi_status | ||
60 | acpi_ex_add_table ( | ||
61 | struct acpi_table_header *table, | ||
62 | struct acpi_namespace_node *parent_node, | ||
63 | union acpi_operand_object **ddb_handle); | ||
64 | |||
57 | 65 | ||
58 | /******************************************************************************* | 66 | /******************************************************************************* |
59 | * | 67 | * |
@@ -70,7 +78,7 @@ | |||
70 | * | 78 | * |
71 | ******************************************************************************/ | 79 | ******************************************************************************/ |
72 | 80 | ||
73 | acpi_status | 81 | static acpi_status |
74 | acpi_ex_add_table ( | 82 | acpi_ex_add_table ( |
75 | struct acpi_table_header *table, | 83 | struct acpi_table_header *table, |
76 | struct acpi_namespace_node *parent_node, | 84 | struct acpi_namespace_node *parent_node, |
@@ -95,10 +103,10 @@ acpi_ex_add_table ( | |||
95 | 103 | ||
96 | ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); | 104 | ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc)); |
97 | 105 | ||
98 | table_info.type = ACPI_TABLE_SSDT; | 106 | table_info.type = ACPI_TABLE_SSDT; |
99 | table_info.pointer = table; | 107 | table_info.pointer = table; |
100 | table_info.length = (acpi_size) table->length; | 108 | table_info.length = (acpi_size) table->length; |
101 | table_info.allocation = ACPI_MEM_ALLOCATED; | 109 | table_info.allocation = ACPI_MEM_ALLOCATED; |
102 | 110 | ||
103 | status = acpi_tb_install_table (&table_info); | 111 | status = acpi_tb_install_table (&table_info); |
104 | if (ACPI_FAILURE (status)) { | 112 | if (ACPI_FAILURE (status)) { |
@@ -226,11 +234,10 @@ acpi_ex_load_table_op ( | |||
226 | start_node = parent_node; | 234 | start_node = parent_node; |
227 | } | 235 | } |
228 | 236 | ||
229 | /* | 237 | /* Find the node referenced by the parameter_path_string */ |
230 | * Find the node referenced by the parameter_path_string | 238 | |
231 | */ | ||
232 | status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, | 239 | status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node, |
233 | ACPI_NS_SEARCH_PARENT, ¶meter_node); | 240 | ACPI_NS_SEARCH_PARENT, ¶meter_node); |
234 | if (ACPI_FAILURE (status)) { | 241 | if (ACPI_FAILURE (status)) { |
235 | return_ACPI_STATUS (status); | 242 | return_ACPI_STATUS (status); |
236 | } | 243 | } |
@@ -248,7 +255,8 @@ acpi_ex_load_table_op ( | |||
248 | if (parameter_node) { | 255 | if (parameter_node) { |
249 | /* Store the parameter data into the optional parameter object */ | 256 | /* Store the parameter data into the optional parameter object */ |
250 | 257 | ||
251 | status = acpi_ex_store (operand[5], ACPI_CAST_PTR (union acpi_operand_object, parameter_node), | 258 | status = acpi_ex_store (operand[5], |
259 | ACPI_CAST_PTR (union acpi_operand_object, parameter_node), | ||
252 | walk_state); | 260 | walk_state); |
253 | if (ACPI_FAILURE (status)) { | 261 | if (ACPI_FAILURE (status)) { |
254 | (void) acpi_ex_unload_table (ddb_handle); | 262 | (void) acpi_ex_unload_table (ddb_handle); |
@@ -371,7 +379,8 @@ acpi_ex_load_op ( | |||
371 | goto cleanup; | 379 | goto cleanup; |
372 | } | 380 | } |
373 | 381 | ||
374 | table_ptr = ACPI_CAST_PTR (struct acpi_table_header, buffer_desc->buffer.pointer); | 382 | table_ptr = ACPI_CAST_PTR (struct acpi_table_header, |
383 | buffer_desc->buffer.pointer); | ||
375 | 384 | ||
376 | /* Sanity check the table length */ | 385 | /* Sanity check the table length */ |
377 | 386 | ||
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index df7ba1219bf6..97856c48bd74 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -50,6 +50,15 @@ | |||
50 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exconvrt") | 51 | ACPI_MODULE_NAME ("exconvrt") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static u32 | ||
56 | acpi_ex_convert_to_ascii ( | ||
57 | acpi_integer integer, | ||
58 | u16 base, | ||
59 | u8 *string, | ||
60 | u8 max_length); | ||
61 | |||
53 | 62 | ||
54 | /******************************************************************************* | 63 | /******************************************************************************* |
55 | * | 64 | * |
@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer ( | |||
115 | */ | 124 | */ |
116 | result = 0; | 125 | result = 0; |
117 | 126 | ||
118 | /* | 127 | /* String conversion is different than Buffer conversion */ |
119 | * String conversion is different than Buffer conversion | 128 | |
120 | */ | ||
121 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 129 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
122 | case ACPI_TYPE_STRING: | 130 | case ACPI_TYPE_STRING: |
123 | 131 | ||
@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer ( | |||
168 | break; | 176 | break; |
169 | } | 177 | } |
170 | 178 | ||
171 | /* | 179 | /* Create a new integer */ |
172 | * Create a new integer | 180 | |
173 | */ | ||
174 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 181 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); |
175 | if (!return_desc) { | 182 | if (!return_desc) { |
176 | return_ACPI_STATUS (AE_NO_MEMORY); | 183 | return_ACPI_STATUS (AE_NO_MEMORY); |
@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer ( | |||
251 | * ASL/AML code that depends on the null being transferred to the new | 258 | * ASL/AML code that depends on the null being transferred to the new |
252 | * buffer. | 259 | * buffer. |
253 | */ | 260 | */ |
254 | return_desc = acpi_ut_create_buffer_object ((acpi_size) obj_desc->string.length + 1); | 261 | return_desc = acpi_ut_create_buffer_object ( |
262 | (acpi_size) obj_desc->string.length + 1); | ||
255 | if (!return_desc) { | 263 | if (!return_desc) { |
256 | return_ACPI_STATUS (AE_NO_MEMORY); | 264 | return_ACPI_STATUS (AE_NO_MEMORY); |
257 | } | 265 | } |
@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer ( | |||
291 | * | 299 | * |
292 | ******************************************************************************/ | 300 | ******************************************************************************/ |
293 | 301 | ||
294 | u32 | 302 | static u32 |
295 | acpi_ex_convert_to_ascii ( | 303 | acpi_ex_convert_to_ascii ( |
296 | acpi_integer integer, | 304 | acpi_integer integer, |
297 | u16 base, | 305 | u16 base, |
@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii ( | |||
357 | 365 | ||
358 | case 16: | 366 | case 16: |
359 | 367 | ||
360 | hex_length = ACPI_MUL_2 (data_width); /* 2 ascii hex chars per data byte */ | 368 | /* hex_length: 2 ascii hex chars per data byte */ |
361 | 369 | ||
370 | hex_length = ACPI_MUL_2 (data_width); | ||
362 | for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { | 371 | for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) { |
363 | /* Get one hex digit, most significant digits first */ | 372 | /* Get one hex digit, most significant digits first */ |
364 | 373 | ||
@@ -475,7 +484,7 @@ acpi_ex_convert_to_string ( | |||
475 | /* Setup string length, base, and separator */ | 484 | /* Setup string length, base, and separator */ |
476 | 485 | ||
477 | switch (type) { | 486 | switch (type) { |
478 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */ | 487 | case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */ |
479 | /* | 488 | /* |
480 | * From ACPI: "If Data is a buffer, it is converted to a string of | 489 | * From ACPI: "If Data is a buffer, it is converted to a string of |
481 | * decimal values separated by commas." | 490 | * decimal values separated by commas." |
@@ -509,7 +518,7 @@ acpi_ex_convert_to_string ( | |||
509 | string_length = (obj_desc->buffer.length * 3); | 518 | string_length = (obj_desc->buffer.length * 3); |
510 | break; | 519 | break; |
511 | 520 | ||
512 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */ | 521 | case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */ |
513 | /* | 522 | /* |
514 | * From ACPI: "If Data is a buffer, it is converted to a string of | 523 | * From ACPI: "If Data is a buffer, it is converted to a string of |
515 | * hexadecimal values separated by commas." | 524 | * hexadecimal values separated by commas." |
@@ -530,9 +539,8 @@ acpi_ex_convert_to_string ( | |||
530 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); | 539 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); |
531 | } | 540 | } |
532 | 541 | ||
533 | /* | 542 | /* Create a new string object and string buffer */ |
534 | * Create a new string object and string buffer | 543 | |
535 | */ | ||
536 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); | 544 | return_desc = acpi_ut_create_string_object ((acpi_size) string_length); |
537 | if (!return_desc) { | 545 | if (!return_desc) { |
538 | return_ACPI_STATUS (AE_NO_MEMORY); | 546 | return_ACPI_STATUS (AE_NO_MEMORY); |
@@ -551,8 +559,10 @@ acpi_ex_convert_to_string ( | |||
551 | *new_buf++ = separator; /* each separated by a comma or space */ | 559 | *new_buf++ = separator; /* each separated by a comma or space */ |
552 | } | 560 | } |
553 | 561 | ||
554 | /* Null terminate the string (overwrites final comma/space from above) */ | 562 | /* |
555 | 563 | * Null terminate the string | |
564 | * (overwrites final comma/space from above) | ||
565 | */ | ||
556 | new_buf--; | 566 | new_buf--; |
557 | *new_buf = 0; | 567 | *new_buf = 0; |
558 | break; | 568 | break; |
@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type ( | |||
645 | 655 | ||
646 | 656 | ||
647 | case ACPI_TYPE_STRING: | 657 | case ACPI_TYPE_STRING: |
648 | |||
649 | /* | 658 | /* |
650 | * The operand must be a String. We can convert an | 659 | * The operand must be a String. We can convert an |
651 | * Integer or Buffer if necessary | 660 | * Integer or Buffer if necessary |
@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type ( | |||
656 | 665 | ||
657 | 666 | ||
658 | case ACPI_TYPE_BUFFER: | 667 | case ACPI_TYPE_BUFFER: |
659 | |||
660 | /* | 668 | /* |
661 | * The operand must be a Buffer. We can convert an | 669 | * The operand must be a Buffer. We can convert an |
662 | * Integer or String if necessary | 670 | * Integer or String if necessary |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index d94c260dac6d..812cdcb2e370 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -55,7 +55,7 @@ | |||
55 | 55 | ||
56 | 56 | ||
57 | #ifndef ACPI_NO_METHOD_EXECUTION | 57 | #ifndef ACPI_NO_METHOD_EXECUTION |
58 | /***************************************************************************** | 58 | /******************************************************************************* |
59 | * | 59 | * |
60 | * FUNCTION: acpi_ex_create_alias | 60 | * FUNCTION: acpi_ex_create_alias |
61 | * | 61 | * |
@@ -65,7 +65,7 @@ | |||
65 | * | 65 | * |
66 | * DESCRIPTION: Create a new named alias | 66 | * DESCRIPTION: Create a new named alias |
67 | * | 67 | * |
68 | ****************************************************************************/ | 68 | ******************************************************************************/ |
69 | 69 | ||
70 | acpi_status | 70 | acpi_status |
71 | acpi_ex_create_alias ( | 71 | acpi_ex_create_alias ( |
@@ -140,8 +140,7 @@ acpi_ex_create_alias ( | |||
140 | * target node or the alias Node | 140 | * target node or the alias Node |
141 | */ | 141 | */ |
142 | status = acpi_ns_attach_object (alias_node, | 142 | status = acpi_ns_attach_object (alias_node, |
143 | acpi_ns_get_attached_object (target_node), | 143 | acpi_ns_get_attached_object (target_node), target_node->type); |
144 | target_node->type); | ||
145 | break; | 144 | break; |
146 | } | 145 | } |
147 | 146 | ||
@@ -151,7 +150,7 @@ acpi_ex_create_alias ( | |||
151 | } | 150 | } |
152 | 151 | ||
153 | 152 | ||
154 | /***************************************************************************** | 153 | /******************************************************************************* |
155 | * | 154 | * |
156 | * FUNCTION: acpi_ex_create_event | 155 | * FUNCTION: acpi_ex_create_event |
157 | * | 156 | * |
@@ -161,7 +160,7 @@ acpi_ex_create_alias ( | |||
161 | * | 160 | * |
162 | * DESCRIPTION: Create a new event object | 161 | * DESCRIPTION: Create a new event object |
163 | * | 162 | * |
164 | ****************************************************************************/ | 163 | ******************************************************************************/ |
165 | 164 | ||
166 | acpi_status | 165 | acpi_status |
167 | acpi_ex_create_event ( | 166 | acpi_ex_create_event ( |
@@ -185,7 +184,7 @@ acpi_ex_create_event ( | |||
185 | * that the event is created in an unsignalled state | 184 | * that the event is created in an unsignalled state |
186 | */ | 185 | */ |
187 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, | 186 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, |
188 | &obj_desc->event.semaphore); | 187 | &obj_desc->event.semaphore); |
189 | if (ACPI_FAILURE (status)) { | 188 | if (ACPI_FAILURE (status)) { |
190 | goto cleanup; | 189 | goto cleanup; |
191 | } | 190 | } |
@@ -193,7 +192,7 @@ acpi_ex_create_event ( | |||
193 | /* Attach object to the Node */ | 192 | /* Attach object to the Node */ |
194 | 193 | ||
195 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], | 194 | status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0], |
196 | obj_desc, ACPI_TYPE_EVENT); | 195 | obj_desc, ACPI_TYPE_EVENT); |
197 | 196 | ||
198 | cleanup: | 197 | cleanup: |
199 | /* | 198 | /* |
@@ -205,7 +204,7 @@ cleanup: | |||
205 | } | 204 | } |
206 | 205 | ||
207 | 206 | ||
208 | /***************************************************************************** | 207 | /******************************************************************************* |
209 | * | 208 | * |
210 | * FUNCTION: acpi_ex_create_mutex | 209 | * FUNCTION: acpi_ex_create_mutex |
211 | * | 210 | * |
@@ -217,7 +216,7 @@ cleanup: | |||
217 | * | 216 | * |
218 | * Mutex (Name[0], sync_level[1]) | 217 | * Mutex (Name[0], sync_level[1]) |
219 | * | 218 | * |
220 | ****************************************************************************/ | 219 | ******************************************************************************/ |
221 | 220 | ||
222 | acpi_status | 221 | acpi_status |
223 | acpi_ex_create_mutex ( | 222 | acpi_ex_create_mutex ( |
@@ -267,20 +266,20 @@ cleanup: | |||
267 | } | 266 | } |
268 | 267 | ||
269 | 268 | ||
270 | /***************************************************************************** | 269 | /******************************************************************************* |
271 | * | 270 | * |
272 | * FUNCTION: acpi_ex_create_region | 271 | * FUNCTION: acpi_ex_create_region |
273 | * | 272 | * |
274 | * PARAMETERS: aml_start - Pointer to the region declaration AML | 273 | * PARAMETERS: aml_start - Pointer to the region declaration AML |
275 | * aml_length - Max length of the declaration AML | 274 | * aml_length - Max length of the declaration AML |
276 | * Operands - List of operands for the opcode | 275 | * region_space - space_iD for the region |
277 | * walk_state - Current state | 276 | * walk_state - Current state |
278 | * | 277 | * |
279 | * RETURN: Status | 278 | * RETURN: Status |
280 | * | 279 | * |
281 | * DESCRIPTION: Create a new operation region object | 280 | * DESCRIPTION: Create a new operation region object |
282 | * | 281 | * |
283 | ****************************************************************************/ | 282 | ******************************************************************************/ |
284 | 283 | ||
285 | acpi_status | 284 | acpi_status |
286 | acpi_ex_create_region ( | 285 | acpi_ex_create_region ( |
@@ -321,7 +320,7 @@ acpi_ex_create_region ( | |||
321 | } | 320 | } |
322 | 321 | ||
323 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", | 322 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n", |
324 | acpi_ut_get_region_name (region_space), region_space)); | 323 | acpi_ut_get_region_name (region_space), region_space)); |
325 | 324 | ||
326 | /* Create the region descriptor */ | 325 | /* Create the region descriptor */ |
327 | 326 | ||
@@ -360,7 +359,7 @@ cleanup: | |||
360 | } | 359 | } |
361 | 360 | ||
362 | 361 | ||
363 | /***************************************************************************** | 362 | /******************************************************************************* |
364 | * | 363 | * |
365 | * FUNCTION: acpi_ex_create_table_region | 364 | * FUNCTION: acpi_ex_create_table_region |
366 | * | 365 | * |
@@ -370,7 +369,7 @@ cleanup: | |||
370 | * | 369 | * |
371 | * DESCRIPTION: Create a new data_table_region object | 370 | * DESCRIPTION: Create a new data_table_region object |
372 | * | 371 | * |
373 | ****************************************************************************/ | 372 | ******************************************************************************/ |
374 | 373 | ||
375 | acpi_status | 374 | acpi_status |
376 | acpi_ex_create_table_region ( | 375 | acpi_ex_create_table_region ( |
@@ -455,7 +454,7 @@ cleanup: | |||
455 | } | 454 | } |
456 | 455 | ||
457 | 456 | ||
458 | /***************************************************************************** | 457 | /******************************************************************************* |
459 | * | 458 | * |
460 | * FUNCTION: acpi_ex_create_processor | 459 | * FUNCTION: acpi_ex_create_processor |
461 | * | 460 | * |
@@ -467,7 +466,7 @@ cleanup: | |||
467 | * | 466 | * |
468 | * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) | 467 | * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) |
469 | * | 468 | * |
470 | ****************************************************************************/ | 469 | ******************************************************************************/ |
471 | 470 | ||
472 | acpi_status | 471 | acpi_status |
473 | acpi_ex_create_processor ( | 472 | acpi_ex_create_processor ( |
@@ -488,9 +487,8 @@ acpi_ex_create_processor ( | |||
488 | return_ACPI_STATUS (AE_NO_MEMORY); | 487 | return_ACPI_STATUS (AE_NO_MEMORY); |
489 | } | 488 | } |
490 | 489 | ||
491 | /* | 490 | /* Initialize the processor object from the operands */ |
492 | * Initialize the processor object from the operands | 491 | |
493 | */ | ||
494 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; | 492 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; |
495 | obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; | 493 | obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; |
496 | obj_desc->processor.length = (u8) operand[3]->integer.value; | 494 | obj_desc->processor.length = (u8) operand[3]->integer.value; |
@@ -507,7 +505,7 @@ acpi_ex_create_processor ( | |||
507 | } | 505 | } |
508 | 506 | ||
509 | 507 | ||
510 | /***************************************************************************** | 508 | /******************************************************************************* |
511 | * | 509 | * |
512 | * FUNCTION: acpi_ex_create_power_resource | 510 | * FUNCTION: acpi_ex_create_power_resource |
513 | * | 511 | * |
@@ -519,7 +517,7 @@ acpi_ex_create_processor ( | |||
519 | * | 517 | * |
520 | * power_resource (Name[0], system_level[1], resource_order[2]) | 518 | * power_resource (Name[0], system_level[1], resource_order[2]) |
521 | * | 519 | * |
522 | ****************************************************************************/ | 520 | ******************************************************************************/ |
523 | 521 | ||
524 | acpi_status | 522 | acpi_status |
525 | acpi_ex_create_power_resource ( | 523 | acpi_ex_create_power_resource ( |
@@ -555,10 +553,10 @@ acpi_ex_create_power_resource ( | |||
555 | acpi_ut_remove_reference (obj_desc); | 553 | acpi_ut_remove_reference (obj_desc); |
556 | return_ACPI_STATUS (status); | 554 | return_ACPI_STATUS (status); |
557 | } | 555 | } |
558 | |||
559 | #endif | 556 | #endif |
560 | 557 | ||
561 | /***************************************************************************** | 558 | |
559 | /******************************************************************************* | ||
562 | * | 560 | * |
563 | * FUNCTION: acpi_ex_create_method | 561 | * FUNCTION: acpi_ex_create_method |
564 | * | 562 | * |
@@ -570,7 +568,7 @@ acpi_ex_create_power_resource ( | |||
570 | * | 568 | * |
571 | * DESCRIPTION: Create a new method object | 569 | * DESCRIPTION: Create a new method object |
572 | * | 570 | * |
573 | ****************************************************************************/ | 571 | ******************************************************************************/ |
574 | 572 | ||
575 | acpi_status | 573 | acpi_status |
576 | acpi_ex_create_method ( | 574 | acpi_ex_create_method ( |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index e2f7c32f28de..408500648114 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -51,23 +51,48 @@ | |||
51 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME ("exdump") | 52 | ACPI_MODULE_NAME ("exdump") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
55 | |||
56 | #ifdef ACPI_FUTURE_USAGE | ||
57 | static void | ||
58 | acpi_ex_out_string ( | ||
59 | char *title, | ||
60 | char *value); | ||
61 | |||
62 | static void | ||
63 | acpi_ex_out_pointer ( | ||
64 | char *title, | ||
65 | void *value); | ||
66 | |||
67 | static void | ||
68 | acpi_ex_out_integer ( | ||
69 | char *title, | ||
70 | u32 value); | ||
71 | |||
72 | static void | ||
73 | acpi_ex_out_address ( | ||
74 | char *title, | ||
75 | acpi_physical_address value); | ||
76 | #endif /* ACPI_FUTURE_USAGE */ | ||
77 | |||
54 | 78 | ||
55 | /* | 79 | /* |
56 | * The following routines are used for debug output only | 80 | * The following routines are used for debug output only |
57 | */ | 81 | */ |
58 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 82 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
59 | 83 | ||
60 | /***************************************************************************** | 84 | /******************************************************************************* |
61 | * | 85 | * |
62 | * FUNCTION: acpi_ex_dump_operand | 86 | * FUNCTION: acpi_ex_dump_operand |
63 | * | 87 | * |
64 | * PARAMETERS: *obj_desc - Pointer to entry to be dumped | 88 | * PARAMETERS: *obj_desc - Pointer to entry to be dumped |
89 | * Depth - Current nesting depth | ||
65 | * | 90 | * |
66 | * RETURN: None | 91 | * RETURN: None |
67 | * | 92 | * |
68 | * DESCRIPTION: Dump an operand object | 93 | * DESCRIPTION: Dump an operand object |
69 | * | 94 | * |
70 | ****************************************************************************/ | 95 | ******************************************************************************/ |
71 | 96 | ||
72 | void | 97 | void |
73 | acpi_ex_dump_operand ( | 98 | acpi_ex_dump_operand ( |
@@ -86,9 +111,8 @@ acpi_ex_dump_operand ( | |||
86 | } | 111 | } |
87 | 112 | ||
88 | if (!obj_desc) { | 113 | if (!obj_desc) { |
89 | /* | 114 | /* This could be a null element of a package */ |
90 | * This could be a null element of a package | 115 | |
91 | */ | ||
92 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); | 116 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); |
93 | return; | 117 | return; |
94 | } | 118 | } |
@@ -117,6 +141,8 @@ acpi_ex_dump_operand ( | |||
117 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); | 141 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); |
118 | } | 142 | } |
119 | 143 | ||
144 | /* Decode object type */ | ||
145 | |||
120 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 146 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
121 | case ACPI_TYPE_LOCAL_REFERENCE: | 147 | case ACPI_TYPE_LOCAL_REFERENCE: |
122 | 148 | ||
@@ -274,7 +300,9 @@ acpi_ex_dump_operand ( | |||
274 | case ACPI_TYPE_STRING: | 300 | case ACPI_TYPE_STRING: |
275 | 301 | ||
276 | acpi_os_printf ("String length %X @ %p ", | 302 | acpi_os_printf ("String length %X @ %p ", |
277 | obj_desc->string.length, obj_desc->string.pointer); | 303 | obj_desc->string.length, |
304 | obj_desc->string.pointer); | ||
305 | |||
278 | acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); | 306 | acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); |
279 | acpi_os_printf ("\n"); | 307 | acpi_os_printf ("\n"); |
280 | break; | 308 | break; |
@@ -290,10 +318,13 @@ acpi_ex_dump_operand ( | |||
290 | 318 | ||
291 | acpi_os_printf ( | 319 | acpi_os_printf ( |
292 | "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", | 320 | "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", |
293 | obj_desc->field.bit_length, obj_desc->field.access_byte_width, | 321 | obj_desc->field.bit_length, |
322 | obj_desc->field.access_byte_width, | ||
294 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, | 323 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, |
295 | obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, | 324 | obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, |
296 | obj_desc->field.base_byte_offset, obj_desc->field.start_field_bit_offset); | 325 | obj_desc->field.base_byte_offset, |
326 | obj_desc->field.start_field_bit_offset); | ||
327 | |||
297 | acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); | 328 | acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); |
298 | break; | 329 | break; |
299 | 330 | ||
@@ -308,13 +339,15 @@ acpi_ex_dump_operand ( | |||
308 | 339 | ||
309 | acpi_os_printf ( | 340 | acpi_os_printf ( |
310 | "buffer_field: %X bits at byte %X bit %X of \n", | 341 | "buffer_field: %X bits at byte %X bit %X of \n", |
311 | obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, | 342 | obj_desc->buffer_field.bit_length, |
343 | obj_desc->buffer_field.base_byte_offset, | ||
312 | obj_desc->buffer_field.start_field_bit_offset); | 344 | obj_desc->buffer_field.start_field_bit_offset); |
313 | 345 | ||
314 | if (!obj_desc->buffer_field.buffer_obj) { | 346 | if (!obj_desc->buffer_field.buffer_obj) { |
315 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); | 347 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); |
316 | } | 348 | } |
317 | else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { | 349 | else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != |
350 | ACPI_TYPE_BUFFER) { | ||
318 | acpi_os_printf ("*not a Buffer* \n"); | 351 | acpi_os_printf ("*not a Buffer* \n"); |
319 | } | 352 | } |
320 | else { | 353 | else { |
@@ -331,10 +364,10 @@ acpi_ex_dump_operand ( | |||
331 | 364 | ||
332 | case ACPI_TYPE_METHOD: | 365 | case ACPI_TYPE_METHOD: |
333 | 366 | ||
334 | acpi_os_printf ( | 367 | acpi_os_printf ("Method(%X) @ %p:%X\n", |
335 | "Method(%X) @ %p:%X\n", | ||
336 | obj_desc->method.param_count, | 368 | obj_desc->method.param_count, |
337 | obj_desc->method.aml_start, obj_desc->method.aml_length); | 369 | obj_desc->method.aml_start, |
370 | obj_desc->method.aml_length); | ||
338 | break; | 371 | break; |
339 | 372 | ||
340 | 373 | ||
@@ -379,7 +412,7 @@ acpi_ex_dump_operand ( | |||
379 | } | 412 | } |
380 | 413 | ||
381 | 414 | ||
382 | /***************************************************************************** | 415 | /******************************************************************************* |
383 | * | 416 | * |
384 | * FUNCTION: acpi_ex_dump_operands | 417 | * FUNCTION: acpi_ex_dump_operands |
385 | * | 418 | * |
@@ -393,7 +426,7 @@ acpi_ex_dump_operand ( | |||
393 | * | 426 | * |
394 | * DESCRIPTION: Dump the object stack | 427 | * DESCRIPTION: Dump the object stack |
395 | * | 428 | * |
396 | ****************************************************************************/ | 429 | ******************************************************************************/ |
397 | 430 | ||
398 | void | 431 | void |
399 | acpi_ex_dump_operands ( | 432 | acpi_ex_dump_operands ( |
@@ -441,10 +474,9 @@ acpi_ex_dump_operands ( | |||
441 | 474 | ||
442 | 475 | ||
443 | #ifdef ACPI_FUTURE_USAGE | 476 | #ifdef ACPI_FUTURE_USAGE |
444 | 477 | /******************************************************************************* | |
445 | /***************************************************************************** | ||
446 | * | 478 | * |
447 | * FUNCTION: acpi_ex_out* | 479 | * FUNCTION: acpi_ex_out* functions |
448 | * | 480 | * |
449 | * PARAMETERS: Title - Descriptive text | 481 | * PARAMETERS: Title - Descriptive text |
450 | * Value - Value to be displayed | 482 | * Value - Value to be displayed |
@@ -453,9 +485,9 @@ acpi_ex_dump_operands ( | |||
453 | * reduce the number of format strings required and keeps them | 485 | * reduce the number of format strings required and keeps them |
454 | * all in one place for easy modification. | 486 | * all in one place for easy modification. |
455 | * | 487 | * |
456 | ****************************************************************************/ | 488 | ******************************************************************************/ |
457 | 489 | ||
458 | void | 490 | static void |
459 | acpi_ex_out_string ( | 491 | acpi_ex_out_string ( |
460 | char *title, | 492 | char *title, |
461 | char *value) | 493 | char *value) |
@@ -463,7 +495,7 @@ acpi_ex_out_string ( | |||
463 | acpi_os_printf ("%20s : %s\n", title, value); | 495 | acpi_os_printf ("%20s : %s\n", title, value); |
464 | } | 496 | } |
465 | 497 | ||
466 | void | 498 | static void |
467 | acpi_ex_out_pointer ( | 499 | acpi_ex_out_pointer ( |
468 | char *title, | 500 | char *title, |
469 | void *value) | 501 | void *value) |
@@ -471,7 +503,7 @@ acpi_ex_out_pointer ( | |||
471 | acpi_os_printf ("%20s : %p\n", title, value); | 503 | acpi_os_printf ("%20s : %p\n", title, value); |
472 | } | 504 | } |
473 | 505 | ||
474 | void | 506 | static void |
475 | acpi_ex_out_integer ( | 507 | acpi_ex_out_integer ( |
476 | char *title, | 508 | char *title, |
477 | u32 value) | 509 | u32 value) |
@@ -479,7 +511,7 @@ acpi_ex_out_integer ( | |||
479 | acpi_os_printf ("%20s : %X\n", title, value); | 511 | acpi_os_printf ("%20s : %X\n", title, value); |
480 | } | 512 | } |
481 | 513 | ||
482 | void | 514 | static void |
483 | acpi_ex_out_address ( | 515 | acpi_ex_out_address ( |
484 | char *title, | 516 | char *title, |
485 | acpi_physical_address value) | 517 | acpi_physical_address value) |
@@ -493,16 +525,16 @@ acpi_ex_out_address ( | |||
493 | } | 525 | } |
494 | 526 | ||
495 | 527 | ||
496 | /***************************************************************************** | 528 | /******************************************************************************* |
497 | * | 529 | * |
498 | * FUNCTION: acpi_ex_dump_node | 530 | * FUNCTION: acpi_ex_dump_node |
499 | * | 531 | * |
500 | * PARAMETERS: *Node - Descriptor to dump | 532 | * PARAMETERS: *Node - Descriptor to dump |
501 | * Flags - Force display | 533 | * Flags - Force display if TRUE |
502 | * | 534 | * |
503 | * DESCRIPTION: Dumps the members of the given.Node | 535 | * DESCRIPTION: Dumps the members of the given.Node |
504 | * | 536 | * |
505 | ****************************************************************************/ | 537 | ******************************************************************************/ |
506 | 538 | ||
507 | void | 539 | void |
508 | acpi_ex_dump_node ( | 540 | acpi_ex_dump_node ( |
@@ -531,16 +563,16 @@ acpi_ex_dump_node ( | |||
531 | } | 563 | } |
532 | 564 | ||
533 | 565 | ||
534 | /***************************************************************************** | 566 | /******************************************************************************* |
535 | * | 567 | * |
536 | * FUNCTION: acpi_ex_dump_object_descriptor | 568 | * FUNCTION: acpi_ex_dump_object_descriptor |
537 | * | 569 | * |
538 | * PARAMETERS: *Object - Descriptor to dump | 570 | * PARAMETERS: *Object - Descriptor to dump |
539 | * Flags - Force display | 571 | * Flags - Force display if TRUE |
540 | * | 572 | * |
541 | * DESCRIPTION: Dumps the members of the object descriptor given. | 573 | * DESCRIPTION: Dumps the members of the object descriptor given. |
542 | * | 574 | * |
543 | ****************************************************************************/ | 575 | ******************************************************************************/ |
544 | 576 | ||
545 | void | 577 | void |
546 | acpi_ex_dump_object_descriptor ( | 578 | acpi_ex_dump_object_descriptor ( |
@@ -553,6 +585,10 @@ acpi_ex_dump_object_descriptor ( | |||
553 | ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); | 585 | ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); |
554 | 586 | ||
555 | 587 | ||
588 | if (!obj_desc) { | ||
589 | return_VOID; | ||
590 | } | ||
591 | |||
556 | if (!flags) { | 592 | if (!flags) { |
557 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { | 593 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { |
558 | return_VOID; | 594 | return_VOID; |
@@ -747,11 +783,17 @@ acpi_ex_dump_object_descriptor ( | |||
747 | case ACPI_TYPE_LOCAL_REFERENCE: | 783 | case ACPI_TYPE_LOCAL_REFERENCE: |
748 | 784 | ||
749 | acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); | 785 | acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); |
750 | acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name); | 786 | acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info ( |
787 | obj_desc->reference.opcode))->name); | ||
751 | acpi_ex_out_integer ("Offset", obj_desc->reference.offset); | 788 | acpi_ex_out_integer ("Offset", obj_desc->reference.offset); |
752 | acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); | 789 | acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); |
753 | acpi_ex_out_pointer ("Node", obj_desc->reference.node); | 790 | acpi_ex_out_pointer ("Node", obj_desc->reference.node); |
754 | acpi_ex_out_pointer ("Where", obj_desc->reference.where); | 791 | acpi_ex_out_pointer ("Where", obj_desc->reference.where); |
792 | |||
793 | if (obj_desc->reference.object) { | ||
794 | acpi_os_printf ("\nReferenced Object:\n"); | ||
795 | acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags); | ||
796 | } | ||
755 | break; | 797 | break; |
756 | 798 | ||
757 | 799 | ||
@@ -788,6 +830,5 @@ acpi_ex_dump_object_descriptor ( | |||
788 | } | 830 | } |
789 | 831 | ||
790 | #endif /* ACPI_FUTURE_USAGE */ | 832 | #endif /* ACPI_FUTURE_USAGE */ |
791 | |||
792 | #endif | 833 | #endif |
793 | 834 | ||
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index be7f2124fa02..22c8fa480f60 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field ( | |||
120 | * Note: Smbus protocol value is passed in upper 16-bits of Function | 120 | * Note: Smbus protocol value is passed in upper 16-bits of Function |
121 | */ | 121 | */ |
122 | status = acpi_ex_access_region (obj_desc, 0, | 122 | status = acpi_ex_access_region (obj_desc, 0, |
123 | ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), | 123 | ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), |
124 | ACPI_READ | (obj_desc->field.attribute << 16)); | 124 | ACPI_READ | (obj_desc->field.attribute << 16)); |
125 | acpi_ex_release_global_lock (locked); | 125 | acpi_ex_release_global_lock (locked); |
126 | goto exit; | 126 | goto exit; |
127 | } | 127 | } |
@@ -196,6 +196,7 @@ exit: | |||
196 | * | 196 | * |
197 | * PARAMETERS: source_desc - Contains data to write | 197 | * PARAMETERS: source_desc - Contains data to write |
198 | * obj_desc - The named field | 198 | * obj_desc - The named field |
199 | * result_desc - Where the return value is returned, if any | ||
199 | * | 200 | * |
200 | * RETURN: Status | 201 | * RETURN: Status |
201 | * | 202 | * |
@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field ( | |||
250 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { | 251 | if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { |
251 | ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", | 252 | ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", |
252 | acpi_ut_get_object_type_name (source_desc))); | 253 | acpi_ut_get_object_type_name (source_desc))); |
254 | |||
253 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 255 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
254 | } | 256 | } |
255 | 257 | ||
256 | if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { | 258 | if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { |
257 | ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n", | 259 | ACPI_REPORT_ERROR (( |
260 | "SMBus write requires Buffer of length %X, found length %X\n", | ||
258 | ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); | 261 | ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); |
262 | |||
259 | return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); | 263 | return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); |
260 | } | 264 | } |
261 | 265 | ||
@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field ( | |||
265 | } | 269 | } |
266 | 270 | ||
267 | buffer = buffer_desc->buffer.pointer; | 271 | buffer = buffer_desc->buffer.pointer; |
268 | ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE); | 272 | ACPI_MEMCPY (buffer, source_desc->buffer.pointer, |
273 | ACPI_SMBUS_BUFFER_SIZE); | ||
269 | 274 | ||
270 | /* Lock entire transaction if requested */ | 275 | /* Lock entire transaction if requested */ |
271 | 276 | ||
272 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); | 277 | locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); |
273 | 278 | ||
274 | /* | 279 | /* |
275 | * Perform the write (returns status and perhaps data in the same buffer) | 280 | * Perform the write (returns status and perhaps data in the |
281 | * same buffer) | ||
276 | * Note: SMBus protocol type is passed in upper 16-bits of Function. | 282 | * Note: SMBus protocol type is passed in upper 16-bits of Function. |
277 | */ | 283 | */ |
278 | status = acpi_ex_access_region (obj_desc, 0, | 284 | status = acpi_ex_access_region (obj_desc, 0, |
@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field ( | |||
284 | return_ACPI_STATUS (status); | 290 | return_ACPI_STATUS (status); |
285 | } | 291 | } |
286 | 292 | ||
287 | /* | 293 | /* Get a pointer to the data to be written */ |
288 | * Get a pointer to the data to be written | 294 | |
289 | */ | ||
290 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | 295 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { |
291 | case ACPI_TYPE_INTEGER: | 296 | case ACPI_TYPE_INTEGER: |
292 | buffer = &source_desc->integer.value; | 297 | buffer = &source_desc->integer.value; |
@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field ( | |||
314 | * the ACPI specification. | 319 | * the ACPI specification. |
315 | */ | 320 | */ |
316 | new_buffer = NULL; | 321 | new_buffer = NULL; |
317 | required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length); | 322 | required_length = ACPI_ROUND_BITS_UP_TO_BYTES ( |
323 | obj_desc->common_field.bit_length); | ||
318 | 324 | ||
319 | if (length < required_length) { | 325 | if (length < required_length) { |
320 | /* We need to create a new buffer */ | 326 | /* We need to create a new buffer */ |
@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field ( | |||
338 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", | 344 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", |
339 | source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), | 345 | source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), |
340 | ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); | 346 | ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); |
347 | |||
341 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 348 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
342 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", | 349 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", |
343 | obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), | 350 | obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 9d0f9d2e9061..3c2f89e00f78 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -52,12 +52,31 @@ | |||
52 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exfldio") | 53 | ACPI_MODULE_NAME ("exfldio") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static acpi_status | ||
58 | acpi_ex_field_datum_io ( | ||
59 | union acpi_operand_object *obj_desc, | ||
60 | u32 field_datum_byte_offset, | ||
61 | acpi_integer *value, | ||
62 | u32 read_write); | ||
63 | |||
64 | static u8 | ||
65 | acpi_ex_register_overflow ( | ||
66 | union acpi_operand_object *obj_desc, | ||
67 | acpi_integer value); | ||
68 | |||
69 | static acpi_status | ||
70 | acpi_ex_setup_region ( | ||
71 | union acpi_operand_object *obj_desc, | ||
72 | u32 field_datum_byte_offset); | ||
73 | |||
55 | 74 | ||
56 | /******************************************************************************* | 75 | /******************************************************************************* |
57 | * | 76 | * |
58 | * FUNCTION: acpi_ex_setup_region | 77 | * FUNCTION: acpi_ex_setup_region |
59 | * | 78 | * |
60 | * PARAMETERS: *obj_desc - Field to be read or written | 79 | * PARAMETERS: obj_desc - Field to be read or written |
61 | * field_datum_byte_offset - Byte offset of this datum within the | 80 | * field_datum_byte_offset - Byte offset of this datum within the |
62 | * parent field | 81 | * parent field |
63 | * | 82 | * |
@@ -69,7 +88,7 @@ | |||
69 | * | 88 | * |
70 | ******************************************************************************/ | 89 | ******************************************************************************/ |
71 | 90 | ||
72 | acpi_status | 91 | static acpi_status |
73 | acpi_ex_setup_region ( | 92 | acpi_ex_setup_region ( |
74 | union acpi_operand_object *obj_desc, | 93 | union acpi_operand_object *obj_desc, |
75 | u32 field_datum_byte_offset) | 94 | u32 field_datum_byte_offset) |
@@ -127,9 +146,9 @@ acpi_ex_setup_region ( | |||
127 | * length of one field datum (access width) must fit within the region. | 146 | * length of one field datum (access width) must fit within the region. |
128 | * (Region length is specified in bytes) | 147 | * (Region length is specified in bytes) |
129 | */ | 148 | */ |
130 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset | 149 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + |
131 | + field_datum_byte_offset | 150 | field_datum_byte_offset + |
132 | + obj_desc->common_field.access_byte_width)) { | 151 | obj_desc->common_field.access_byte_width)) { |
133 | if (acpi_gbl_enable_interpreter_slack) { | 152 | if (acpi_gbl_enable_interpreter_slack) { |
134 | /* | 153 | /* |
135 | * Slack mode only: We will go ahead and allow access to this | 154 | * Slack mode only: We will go ahead and allow access to this |
@@ -155,7 +174,8 @@ acpi_ex_setup_region ( | |||
155 | "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", | 174 | "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", |
156 | acpi_ut_get_node_name (obj_desc->common_field.node), | 175 | acpi_ut_get_node_name (obj_desc->common_field.node), |
157 | obj_desc->common_field.access_byte_width, | 176 | obj_desc->common_field.access_byte_width, |
158 | acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); | 177 | acpi_ut_get_node_name (rgn_desc->region.node), |
178 | rgn_desc->region.length)); | ||
159 | } | 179 | } |
160 | 180 | ||
161 | /* | 181 | /* |
@@ -167,7 +187,8 @@ acpi_ex_setup_region ( | |||
167 | acpi_ut_get_node_name (obj_desc->common_field.node), | 187 | acpi_ut_get_node_name (obj_desc->common_field.node), |
168 | obj_desc->common_field.base_byte_offset, | 188 | obj_desc->common_field.base_byte_offset, |
169 | field_datum_byte_offset, obj_desc->common_field.access_byte_width, | 189 | field_datum_byte_offset, obj_desc->common_field.access_byte_width, |
170 | acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); | 190 | acpi_ut_get_node_name (rgn_desc->region.node), |
191 | rgn_desc->region.length)); | ||
171 | 192 | ||
172 | return_ACPI_STATUS (AE_AML_REGION_LIMIT); | 193 | return_ACPI_STATUS (AE_AML_REGION_LIMIT); |
173 | } | 194 | } |
@@ -180,10 +201,10 @@ acpi_ex_setup_region ( | |||
180 | * | 201 | * |
181 | * FUNCTION: acpi_ex_access_region | 202 | * FUNCTION: acpi_ex_access_region |
182 | * | 203 | * |
183 | * PARAMETERS: *obj_desc - Field to be read | 204 | * PARAMETERS: obj_desc - Field to be read |
184 | * field_datum_byte_offset - Byte offset of this datum within the | 205 | * field_datum_byte_offset - Byte offset of this datum within the |
185 | * parent field | 206 | * parent field |
186 | * *Value - Where to store value (must at least | 207 | * Value - Where to store value (must at least |
187 | * the size of acpi_integer) | 208 | * the size of acpi_integer) |
188 | * Function - Read or Write flag plus other region- | 209 | * Function - Read or Write flag plus other region- |
189 | * dependent flags | 210 | * dependent flags |
@@ -226,9 +247,9 @@ acpi_ex_access_region ( | |||
226 | * 3) The current offset into the field | 247 | * 3) The current offset into the field |
227 | */ | 248 | */ |
228 | rgn_desc = obj_desc->common_field.region_obj; | 249 | rgn_desc = obj_desc->common_field.region_obj; |
229 | address = rgn_desc->region.address | 250 | address = rgn_desc->region.address + |
230 | + obj_desc->common_field.base_byte_offset | 251 | obj_desc->common_field.base_byte_offset + |
231 | + field_datum_byte_offset; | 252 | field_datum_byte_offset; |
232 | 253 | ||
233 | if ((function & ACPI_IO_MASK) == ACPI_READ) { | 254 | if ((function & ACPI_IO_MASK) == ACPI_READ) { |
234 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); | 255 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); |
@@ -249,7 +270,8 @@ acpi_ex_access_region ( | |||
249 | /* Invoke the appropriate address_space/op_region handler */ | 270 | /* Invoke the appropriate address_space/op_region handler */ |
250 | 271 | ||
251 | status = acpi_ev_address_space_dispatch (rgn_desc, function, | 272 | status = acpi_ev_address_space_dispatch (rgn_desc, function, |
252 | address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); | 273 | address, |
274 | ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); | ||
253 | 275 | ||
254 | if (ACPI_FAILURE (status)) { | 276 | if (ACPI_FAILURE (status)) { |
255 | if (status == AE_NOT_IMPLEMENTED) { | 277 | if (status == AE_NOT_IMPLEMENTED) { |
@@ -274,7 +296,7 @@ acpi_ex_access_region ( | |||
274 | * | 296 | * |
275 | * FUNCTION: acpi_ex_register_overflow | 297 | * FUNCTION: acpi_ex_register_overflow |
276 | * | 298 | * |
277 | * PARAMETERS: *obj_desc - Register(Field) to be written | 299 | * PARAMETERS: obj_desc - Register(Field) to be written |
278 | * Value - Value to be stored | 300 | * Value - Value to be stored |
279 | * | 301 | * |
280 | * RETURN: TRUE if value overflows the field, FALSE otherwise | 302 | * RETURN: TRUE if value overflows the field, FALSE otherwise |
@@ -287,7 +309,7 @@ acpi_ex_access_region ( | |||
287 | * | 309 | * |
288 | ******************************************************************************/ | 310 | ******************************************************************************/ |
289 | 311 | ||
290 | u8 | 312 | static u8 |
291 | acpi_ex_register_overflow ( | 313 | acpi_ex_register_overflow ( |
292 | union acpi_operand_object *obj_desc, | 314 | union acpi_operand_object *obj_desc, |
293 | acpi_integer value) | 315 | acpi_integer value) |
@@ -319,10 +341,10 @@ acpi_ex_register_overflow ( | |||
319 | * | 341 | * |
320 | * FUNCTION: acpi_ex_field_datum_io | 342 | * FUNCTION: acpi_ex_field_datum_io |
321 | * | 343 | * |
322 | * PARAMETERS: *obj_desc - Field to be read | 344 | * PARAMETERS: obj_desc - Field to be read |
323 | * field_datum_byte_offset - Byte offset of this datum within the | 345 | * field_datum_byte_offset - Byte offset of this datum within the |
324 | * parent field | 346 | * parent field |
325 | * *Value - Where to store value (must be 64 bits) | 347 | * Value - Where to store value (must be 64 bits) |
326 | * read_write - Read or Write flag | 348 | * read_write - Read or Write flag |
327 | * | 349 | * |
328 | * RETURN: Status | 350 | * RETURN: Status |
@@ -333,7 +355,7 @@ acpi_ex_register_overflow ( | |||
333 | * | 355 | * |
334 | ******************************************************************************/ | 356 | ******************************************************************************/ |
335 | 357 | ||
336 | acpi_status | 358 | static acpi_status |
337 | acpi_ex_field_datum_io ( | 359 | acpi_ex_field_datum_io ( |
338 | union acpi_operand_object *obj_desc, | 360 | union acpi_operand_object *obj_desc, |
339 | u32 field_datum_byte_offset, | 361 | u32 field_datum_byte_offset, |
@@ -350,7 +372,9 @@ acpi_ex_field_datum_io ( | |||
350 | if (read_write == ACPI_READ) { | 372 | if (read_write == ACPI_READ) { |
351 | if (!value) { | 373 | if (!value) { |
352 | local_value = 0; | 374 | local_value = 0; |
353 | value = &local_value; /* To support reads without saving return value */ | 375 | |
376 | /* To support reads without saving return value */ | ||
377 | value = &local_value; | ||
354 | } | 378 | } |
355 | 379 | ||
356 | /* Clear the entire return buffer first, [Very Important!] */ | 380 | /* Clear the entire return buffer first, [Very Important!] */ |
@@ -363,8 +387,10 @@ acpi_ex_field_datum_io ( | |||
363 | * | 387 | * |
364 | * buffer_field - Read/write from/to a Buffer | 388 | * buffer_field - Read/write from/to a Buffer |
365 | * region_field - Read/write from/to a Operation Region. | 389 | * region_field - Read/write from/to a Operation Region. |
366 | * bank_field - Write to a Bank Register, then read/write from/to an op_region | 390 | * bank_field - Write to a Bank Register, then read/write from/to an |
367 | * index_field - Write to an Index Register, then read/write from/to a Data Register | 391 | * operation_region |
392 | * index_field - Write to an Index Register, then read/write from/to a | ||
393 | * Data Register | ||
368 | */ | 394 | */ |
369 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 395 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
370 | case ACPI_TYPE_BUFFER_FIELD: | 396 | case ACPI_TYPE_BUFFER_FIELD: |
@@ -384,19 +410,20 @@ acpi_ex_field_datum_io ( | |||
384 | * Copy the data from the source buffer. | 410 | * Copy the data from the source buffer. |
385 | * Length is the field width in bytes. | 411 | * Length is the field width in bytes. |
386 | */ | 412 | */ |
387 | ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer | 413 | ACPI_MEMCPY (value, |
388 | + obj_desc->buffer_field.base_byte_offset | 414 | (obj_desc->buffer_field.buffer_obj)->buffer.pointer + |
389 | + field_datum_byte_offset, | 415 | obj_desc->buffer_field.base_byte_offset + |
390 | obj_desc->common_field.access_byte_width); | 416 | field_datum_byte_offset, |
417 | obj_desc->common_field.access_byte_width); | ||
391 | } | 418 | } |
392 | else { | 419 | else { |
393 | /* | 420 | /* |
394 | * Copy the data to the target buffer. | 421 | * Copy the data to the target buffer. |
395 | * Length is the field width in bytes. | 422 | * Length is the field width in bytes. |
396 | */ | 423 | */ |
397 | ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer | 424 | ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer + |
398 | + obj_desc->buffer_field.base_byte_offset | 425 | obj_desc->buffer_field.base_byte_offset + |
399 | + field_datum_byte_offset, | 426 | field_datum_byte_offset, |
400 | value, obj_desc->common_field.access_byte_width); | 427 | value, obj_desc->common_field.access_byte_width); |
401 | } | 428 | } |
402 | 429 | ||
@@ -406,8 +433,10 @@ acpi_ex_field_datum_io ( | |||
406 | 433 | ||
407 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 434 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
408 | 435 | ||
409 | /* Ensure that the bank_value is not beyond the capacity of the register */ | 436 | /* |
410 | 437 | * Ensure that the bank_value is not beyond the capacity of | |
438 | * the register | ||
439 | */ | ||
411 | if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, | 440 | if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, |
412 | (acpi_integer) obj_desc->bank_field.value)) { | 441 | (acpi_integer) obj_desc->bank_field.value)) { |
413 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); | 442 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); |
@@ -445,8 +474,10 @@ acpi_ex_field_datum_io ( | |||
445 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 474 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
446 | 475 | ||
447 | 476 | ||
448 | /* Ensure that the index_value is not beyond the capacity of the register */ | 477 | /* |
449 | 478 | * Ensure that the index_value is not beyond the capacity of | |
479 | * the register | ||
480 | */ | ||
450 | if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, | 481 | if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, |
451 | (acpi_integer) obj_desc->index_field.value)) { | 482 | (acpi_integer) obj_desc->index_field.value)) { |
452 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); | 483 | return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); |
@@ -496,14 +527,16 @@ acpi_ex_field_datum_io ( | |||
496 | 527 | ||
497 | if (ACPI_SUCCESS (status)) { | 528 | if (ACPI_SUCCESS (status)) { |
498 | if (read_write == ACPI_READ) { | 529 | if (read_write == ACPI_READ) { |
499 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", | 530 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
500 | ACPI_FORMAT_UINT64 (*value), | 531 | "Value Read %8.8X%8.8X, Width %d\n", |
501 | obj_desc->common_field.access_byte_width)); | 532 | ACPI_FORMAT_UINT64 (*value), |
533 | obj_desc->common_field.access_byte_width)); | ||
502 | } | 534 | } |
503 | else { | 535 | else { |
504 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", | 536 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
505 | ACPI_FORMAT_UINT64 (*value), | 537 | "Value Written %8.8X%8.8X, Width %d\n", |
506 | obj_desc->common_field.access_byte_width)); | 538 | ACPI_FORMAT_UINT64 (*value), |
539 | obj_desc->common_field.access_byte_width)); | ||
507 | } | 540 | } |
508 | } | 541 | } |
509 | 542 | ||
@@ -515,8 +548,10 @@ acpi_ex_field_datum_io ( | |||
515 | * | 548 | * |
516 | * FUNCTION: acpi_ex_write_with_update_rule | 549 | * FUNCTION: acpi_ex_write_with_update_rule |
517 | * | 550 | * |
518 | * PARAMETERS: *obj_desc - Field to be set | 551 | * PARAMETERS: obj_desc - Field to be written |
519 | * Value - Value to store | 552 | * Mask - bitmask within field datum |
553 | * field_value - Value to write | ||
554 | * field_datum_byte_offset - Offset of datum within field | ||
520 | * | 555 | * |
521 | * RETURN: Status | 556 | * RETURN: Status |
522 | * | 557 | * |
@@ -689,7 +724,8 @@ acpi_ex_extract_from_field ( | |||
689 | /* Merge with previous datum if necessary */ | 724 | /* Merge with previous datum if necessary */ |
690 | 725 | ||
691 | merged_datum |= raw_datum << | 726 | merged_datum |= raw_datum << |
692 | (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); | 727 | (obj_desc->common_field.access_bit_width - |
728 | obj_desc->common_field.start_field_bit_offset); | ||
693 | 729 | ||
694 | if (i == datum_count) { | 730 | if (i == datum_count) { |
695 | break; | 731 | break; |
@@ -707,7 +743,8 @@ acpi_ex_extract_from_field ( | |||
707 | 743 | ||
708 | /* Mask off any extra bits in the last datum */ | 744 | /* Mask off any extra bits in the last datum */ |
709 | 745 | ||
710 | buffer_tail_bits = obj_desc->common_field.bit_length % obj_desc->common_field.access_bit_width; | 746 | buffer_tail_bits = obj_desc->common_field.bit_length % |
747 | obj_desc->common_field.access_bit_width; | ||
711 | if (buffer_tail_bits) { | 748 | if (buffer_tail_bits) { |
712 | merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); | 749 | merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); |
713 | } | 750 | } |
@@ -791,7 +828,8 @@ acpi_ex_insert_into_field ( | |||
791 | /* Write merged datum to the target field */ | 828 | /* Write merged datum to the target field */ |
792 | 829 | ||
793 | merged_datum &= mask; | 830 | merged_datum &= mask; |
794 | status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); | 831 | status = acpi_ex_write_with_update_rule (obj_desc, mask, |
832 | merged_datum, field_offset); | ||
795 | if (ACPI_FAILURE (status)) { | 833 | if (ACPI_FAILURE (status)) { |
796 | return_ACPI_STATUS (status); | 834 | return_ACPI_STATUS (status); |
797 | } | 835 | } |
@@ -800,7 +838,8 @@ acpi_ex_insert_into_field ( | |||
800 | 838 | ||
801 | field_offset += obj_desc->common_field.access_byte_width; | 839 | field_offset += obj_desc->common_field.access_byte_width; |
802 | merged_datum = raw_datum >> | 840 | merged_datum = raw_datum >> |
803 | (obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); | 841 | (obj_desc->common_field.access_bit_width - |
842 | obj_desc->common_field.start_field_bit_offset); | ||
804 | mask = ACPI_INTEGER_MAX; | 843 | mask = ACPI_INTEGER_MAX; |
805 | 844 | ||
806 | if (i == datum_count) { | 845 | if (i == datum_count) { |
@@ -819,7 +858,8 @@ acpi_ex_insert_into_field ( | |||
819 | /* Mask off any extra bits in the last datum */ | 858 | /* Mask off any extra bits in the last datum */ |
820 | 859 | ||
821 | buffer_tail_bits = (obj_desc->common_field.bit_length + | 860 | buffer_tail_bits = (obj_desc->common_field.bit_length + |
822 | obj_desc->common_field.start_field_bit_offset) % obj_desc->common_field.access_bit_width; | 861 | obj_desc->common_field.start_field_bit_offset) % |
862 | obj_desc->common_field.access_bit_width; | ||
823 | if (buffer_tail_bits) { | 863 | if (buffer_tail_bits) { |
824 | mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); | 864 | mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); |
825 | } | 865 | } |
@@ -827,7 +867,8 @@ acpi_ex_insert_into_field ( | |||
827 | /* Write the last datum to the field */ | 867 | /* Write the last datum to the field */ |
828 | 868 | ||
829 | merged_datum &= mask; | 869 | merged_datum &= mask; |
830 | status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); | 870 | status = acpi_ex_write_with_update_rule (obj_desc, |
871 | mask, merged_datum, field_offset); | ||
831 | 872 | ||
832 | return_ACPI_STATUS (status); | 873 | return_ACPI_STATUS (status); |
833 | } | 874 | } |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index b542dcd58c07..022f281345b8 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -139,8 +139,9 @@ acpi_ex_get_object_reference ( | |||
139 | reference_obj->reference.object = referenced_obj; | 139 | reference_obj->reference.object = referenced_obj; |
140 | *return_desc = reference_obj; | 140 | *return_desc = reference_obj; |
141 | 141 | ||
142 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n", | 142 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
143 | obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); | 143 | "Object %p Type [%s], returning Reference %p\n", |
144 | obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc)); | ||
144 | 145 | ||
145 | return_ACPI_STATUS (AE_OK); | 146 | return_ACPI_STATUS (AE_OK); |
146 | } | 147 | } |
@@ -456,7 +457,7 @@ acpi_ex_do_math_op ( | |||
456 | return (integer0 * integer1); | 457 | return (integer0 * integer1); |
457 | 458 | ||
458 | 459 | ||
459 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ | 460 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/ |
460 | 461 | ||
461 | return (integer0 << integer1); | 462 | return (integer0 << integer1); |
462 | 463 | ||
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 68c4bb1970a5..c3cb714d2cba 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -49,6 +49,13 @@ | |||
49 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME ("exmutex") | 50 | ACPI_MODULE_NAME ("exmutex") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ex_link_mutex ( | ||
56 | union acpi_operand_object *obj_desc, | ||
57 | struct acpi_thread_state *thread); | ||
58 | |||
52 | 59 | ||
53 | /******************************************************************************* | 60 | /******************************************************************************* |
54 | * | 61 | * |
@@ -56,7 +63,7 @@ | |||
56 | * | 63 | * |
57 | * PARAMETERS: obj_desc - The mutex to be unlinked | 64 | * PARAMETERS: obj_desc - The mutex to be unlinked |
58 | * | 65 | * |
59 | * RETURN: Status | 66 | * RETURN: None |
60 | * | 67 | * |
61 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list | 68 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list |
62 | * | 69 | * |
@@ -92,16 +99,16 @@ acpi_ex_unlink_mutex ( | |||
92 | * | 99 | * |
93 | * FUNCTION: acpi_ex_link_mutex | 100 | * FUNCTION: acpi_ex_link_mutex |
94 | * | 101 | * |
95 | * PARAMETERS: obj_desc - The mutex to be linked | 102 | * PARAMETERS: obj_desc - The mutex to be linked |
96 | * list_head - head of the "acquired_mutex" list | 103 | * Thread - Current executing thread object |
97 | * | 104 | * |
98 | * RETURN: Status | 105 | * RETURN: None |
99 | * | 106 | * |
100 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk | 107 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk |
101 | * | 108 | * |
102 | ******************************************************************************/ | 109 | ******************************************************************************/ |
103 | 110 | ||
104 | void | 111 | static void |
105 | acpi_ex_link_mutex ( | 112 | acpi_ex_link_mutex ( |
106 | union acpi_operand_object *obj_desc, | 113 | union acpi_operand_object *obj_desc, |
107 | struct acpi_thread_state *thread) | 114 | struct acpi_thread_state *thread) |
@@ -132,8 +139,9 @@ acpi_ex_link_mutex ( | |||
132 | * | 139 | * |
133 | * FUNCTION: acpi_ex_acquire_mutex | 140 | * FUNCTION: acpi_ex_acquire_mutex |
134 | * | 141 | * |
135 | * PARAMETERS: time_desc - The 'time to delay' object descriptor | 142 | * PARAMETERS: time_desc - Timeout integer |
136 | * obj_desc - The object descriptor for this op | 143 | * obj_desc - Mutex object |
144 | * walk_state - Current method execution state | ||
137 | * | 145 | * |
138 | * RETURN: Status | 146 | * RETURN: Status |
139 | * | 147 | * |
@@ -161,7 +169,7 @@ acpi_ex_acquire_mutex ( | |||
161 | 169 | ||
162 | if (!walk_state->thread) { | 170 | if (!walk_state->thread) { |
163 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", | 171 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n", |
164 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 172 | acpi_ut_get_node_name (obj_desc->mutex.node))); |
165 | return_ACPI_STATUS (AE_AML_INTERNAL); | 173 | return_ACPI_STATUS (AE_AML_INTERNAL); |
166 | } | 174 | } |
167 | 175 | ||
@@ -170,8 +178,9 @@ acpi_ex_acquire_mutex ( | |||
170 | * mutex. This mechanism provides some deadlock prevention | 178 | * mutex. This mechanism provides some deadlock prevention |
171 | */ | 179 | */ |
172 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 180 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
173 | ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", | 181 | ACPI_REPORT_ERROR (( |
174 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 182 | "Cannot acquire Mutex [%4.4s], incorrect sync_level\n", |
183 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
175 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | 184 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); |
176 | } | 185 | } |
177 | 186 | ||
@@ -180,8 +189,10 @@ acpi_ex_acquire_mutex ( | |||
180 | if (obj_desc->mutex.owner_thread) { | 189 | if (obj_desc->mutex.owner_thread) { |
181 | /* Special case for Global Lock, allow all threads */ | 190 | /* Special case for Global Lock, allow all threads */ |
182 | 191 | ||
183 | if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || | 192 | if ((obj_desc->mutex.owner_thread->thread_id == |
184 | (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore)) { | 193 | walk_state->thread->thread_id) || |
194 | (obj_desc->mutex.semaphore == | ||
195 | acpi_gbl_global_lock_semaphore)) { | ||
185 | /* | 196 | /* |
186 | * The mutex is already owned by this thread, | 197 | * The mutex is already owned by this thread, |
187 | * just increment the acquisition depth | 198 | * just increment the acquisition depth |
@@ -221,6 +232,7 @@ acpi_ex_acquire_mutex ( | |||
221 | * FUNCTION: acpi_ex_release_mutex | 232 | * FUNCTION: acpi_ex_release_mutex |
222 | * | 233 | * |
223 | * PARAMETERS: obj_desc - The object descriptor for this op | 234 | * PARAMETERS: obj_desc - The object descriptor for this op |
235 | * walk_state - Current method execution state | ||
224 | * | 236 | * |
225 | * RETURN: Status | 237 | * RETURN: Status |
226 | * | 238 | * |
@@ -278,8 +290,9 @@ acpi_ex_release_mutex ( | |||
278 | * equal to the current sync level | 290 | * equal to the current sync level |
279 | */ | 291 | */ |
280 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 292 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
281 | ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect sync_level\n", | 293 | ACPI_REPORT_ERROR (( |
282 | acpi_ut_get_node_name (obj_desc->mutex.node))); | 294 | "Cannot release Mutex [%4.4s], incorrect sync_level\n", |
295 | acpi_ut_get_node_name (obj_desc->mutex.node))); | ||
283 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); | 296 | return_ACPI_STATUS (AE_AML_MUTEX_ORDER); |
284 | } | 297 | } |
285 | 298 | ||
@@ -313,11 +326,11 @@ acpi_ex_release_mutex ( | |||
313 | * | 326 | * |
314 | * FUNCTION: acpi_ex_release_all_mutexes | 327 | * FUNCTION: acpi_ex_release_all_mutexes |
315 | * | 328 | * |
316 | * PARAMETERS: mutex_list - Head of the mutex list | 329 | * PARAMETERS: Thread - Current executing thread object |
317 | * | 330 | * |
318 | * RETURN: Status | 331 | * RETURN: Status |
319 | * | 332 | * |
320 | * DESCRIPTION: Release all mutexes in the list | 333 | * DESCRIPTION: Release all mutexes held by this thread |
321 | * | 334 | * |
322 | ******************************************************************************/ | 335 | ******************************************************************************/ |
323 | 336 | ||
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 7911c533c265..639f0bd3f6d8 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -50,13 +50,17 @@ | |||
50 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME ("exnames") | 51 | ACPI_MODULE_NAME ("exnames") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | /* AML Package Length encodings */ | 55 | static char * |
56 | acpi_ex_allocate_name_string ( | ||
57 | u32 prefix_count, | ||
58 | u32 num_name_segs); | ||
55 | 59 | ||
56 | #define ACPI_AML_PACKAGE_TYPE1 0x40 | 60 | static acpi_status |
57 | #define ACPI_AML_PACKAGE_TYPE2 0x4000 | 61 | acpi_ex_name_segment ( |
58 | #define ACPI_AML_PACKAGE_TYPE3 0x400000 | 62 | u8 **in_aml_address, |
59 | #define ACPI_AML_PACKAGE_TYPE4 0x40000000 | 63 | char *name_string); |
60 | 64 | ||
61 | 65 | ||
62 | /******************************************************************************* | 66 | /******************************************************************************* |
@@ -64,7 +68,7 @@ | |||
64 | * FUNCTION: acpi_ex_allocate_name_string | 68 | * FUNCTION: acpi_ex_allocate_name_string |
65 | * | 69 | * |
66 | * PARAMETERS: prefix_count - Count of parent levels. Special cases: | 70 | * PARAMETERS: prefix_count - Count of parent levels. Special cases: |
67 | * (-1) = root, 0 = none | 71 | * (-1)==root, 0==none |
68 | * num_name_segs - count of 4-character name segments | 72 | * num_name_segs - count of 4-character name segments |
69 | * | 73 | * |
70 | * RETURN: A pointer to the allocated string segment. This segment must | 74 | * RETURN: A pointer to the allocated string segment. This segment must |
@@ -75,7 +79,7 @@ | |||
75 | * | 79 | * |
76 | ******************************************************************************/ | 80 | ******************************************************************************/ |
77 | 81 | ||
78 | char * | 82 | static char * |
79 | acpi_ex_allocate_name_string ( | 83 | acpi_ex_allocate_name_string ( |
80 | u32 prefix_count, | 84 | u32 prefix_count, |
81 | u32 num_name_segs) | 85 | u32 num_name_segs) |
@@ -88,7 +92,7 @@ acpi_ex_allocate_name_string ( | |||
88 | 92 | ||
89 | 93 | ||
90 | /* | 94 | /* |
91 | * Allow room for all \ and ^ prefixes, all segments, and a multi_name_prefix. | 95 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. |
92 | * Also, one byte for the null terminator. | 96 | * Also, one byte for the null terminator. |
93 | * This may actually be somewhat longer than needed. | 97 | * This may actually be somewhat longer than needed. |
94 | */ | 98 | */ |
@@ -107,7 +111,8 @@ acpi_ex_allocate_name_string ( | |||
107 | */ | 111 | */ |
108 | name_string = ACPI_MEM_ALLOCATE (size_needed); | 112 | name_string = ACPI_MEM_ALLOCATE (size_needed); |
109 | if (!name_string) { | 113 | if (!name_string) { |
110 | ACPI_REPORT_ERROR (("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); | 114 | ACPI_REPORT_ERROR (( |
115 | "ex_allocate_name_string: Could not allocate size %d\n", size_needed)); | ||
111 | return_PTR (NULL); | 116 | return_PTR (NULL); |
112 | } | 117 | } |
113 | 118 | ||
@@ -152,15 +157,17 @@ acpi_ex_allocate_name_string ( | |||
152 | * | 157 | * |
153 | * FUNCTION: acpi_ex_name_segment | 158 | * FUNCTION: acpi_ex_name_segment |
154 | * | 159 | * |
155 | * PARAMETERS: interpreter_mode - Current running mode (load1/Load2/Exec) | 160 | * PARAMETERS: in_aml_address - Pointer to the name in the AML code |
161 | * name_string - Where to return the name. The name is appended | ||
162 | * to any existing string to form a namepath | ||
156 | * | 163 | * |
157 | * RETURN: Status | 164 | * RETURN: Status |
158 | * | 165 | * |
159 | * DESCRIPTION: Execute a name segment (4 bytes) | 166 | * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream |
160 | * | 167 | * |
161 | ******************************************************************************/ | 168 | ******************************************************************************/ |
162 | 169 | ||
163 | acpi_status | 170 | static acpi_status |
164 | acpi_ex_name_segment ( | 171 | acpi_ex_name_segment ( |
165 | u8 **in_aml_address, | 172 | u8 **in_aml_address, |
166 | char *name_string) | 173 | char *name_string) |
@@ -223,10 +230,13 @@ acpi_ex_name_segment ( | |||
223 | status = AE_CTRL_PENDING; | 230 | status = AE_CTRL_PENDING; |
224 | } | 231 | } |
225 | else { | 232 | else { |
226 | /* Segment started with one or more valid characters, but fewer than 4 */ | 233 | /* |
227 | 234 | * Segment started with one or more valid characters, but fewer than | |
235 | * the required 4 | ||
236 | */ | ||
228 | status = AE_AML_BAD_NAME; | 237 | status = AE_AML_BAD_NAME; |
229 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n", | 238 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
239 | "Bad character %02x in name, at %p\n", | ||
230 | *aml_address, aml_address)); | 240 | *aml_address, aml_address)); |
231 | } | 241 | } |
232 | 242 | ||
@@ -239,11 +249,16 @@ acpi_ex_name_segment ( | |||
239 | * | 249 | * |
240 | * FUNCTION: acpi_ex_get_name_string | 250 | * FUNCTION: acpi_ex_get_name_string |
241 | * | 251 | * |
242 | * PARAMETERS: data_type - Data type to be associated with this name | 252 | * PARAMETERS: data_type - Object type to be associated with this |
253 | * name | ||
254 | * in_aml_address - Pointer to the namestring in the AML code | ||
255 | * out_name_string - Where the namestring is returned | ||
256 | * out_name_length - Length of the returned string | ||
243 | * | 257 | * |
244 | * RETURN: Status | 258 | * RETURN: Status, namestring and length |
245 | * | 259 | * |
246 | * DESCRIPTION: Get a name, including any prefixes. | 260 | * DESCRIPTION: Extract a full namepath from the AML byte stream, |
261 | * including any prefixes. | ||
247 | * | 262 | * |
248 | ******************************************************************************/ | 263 | ******************************************************************************/ |
249 | 264 | ||
@@ -286,7 +301,8 @@ acpi_ex_get_name_string ( | |||
286 | switch (*aml_address) { | 301 | switch (*aml_address) { |
287 | case AML_ROOT_PREFIX: | 302 | case AML_ROOT_PREFIX: |
288 | 303 | ||
289 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", aml_address)); | 304 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", |
305 | aml_address)); | ||
290 | 306 | ||
291 | /* | 307 | /* |
292 | * Remember that we have a root_prefix -- | 308 | * Remember that we have a root_prefix -- |
@@ -303,7 +319,8 @@ acpi_ex_get_name_string ( | |||
303 | /* Increment past possibly multiple parent prefixes */ | 319 | /* Increment past possibly multiple parent prefixes */ |
304 | 320 | ||
305 | do { | 321 | do { |
306 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", aml_address)); | 322 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", |
323 | aml_address)); | ||
307 | 324 | ||
308 | aml_address++; | 325 | aml_address++; |
309 | prefix_count++; | 326 | prefix_count++; |
@@ -321,13 +338,13 @@ acpi_ex_get_name_string ( | |||
321 | break; | 338 | break; |
322 | } | 339 | } |
323 | 340 | ||
324 | |||
325 | /* Examine first character of name for name segment prefix operator */ | 341 | /* Examine first character of name for name segment prefix operator */ |
326 | 342 | ||
327 | switch (*aml_address) { | 343 | switch (*aml_address) { |
328 | case AML_DUAL_NAME_PREFIX: | 344 | case AML_DUAL_NAME_PREFIX: |
329 | 345 | ||
330 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", aml_address)); | 346 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", |
347 | aml_address)); | ||
331 | 348 | ||
332 | aml_address++; | 349 | aml_address++; |
333 | name_string = acpi_ex_allocate_name_string (prefix_count, 2); | 350 | name_string = acpi_ex_allocate_name_string (prefix_count, 2); |
@@ -349,7 +366,8 @@ acpi_ex_get_name_string ( | |||
349 | 366 | ||
350 | case AML_MULTI_NAME_PREFIX_OP: | 367 | case AML_MULTI_NAME_PREFIX_OP: |
351 | 368 | ||
352 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", aml_address)); | 369 | ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", |
370 | aml_address)); | ||
353 | 371 | ||
354 | /* Fetch count of segments remaining in name path */ | 372 | /* Fetch count of segments remaining in name path */ |
355 | 373 | ||
@@ -368,7 +386,8 @@ acpi_ex_get_name_string ( | |||
368 | has_prefix = TRUE; | 386 | has_prefix = TRUE; |
369 | 387 | ||
370 | while (num_segments && | 388 | while (num_segments && |
371 | (status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) { | 389 | (status = acpi_ex_name_segment (&aml_address, name_string)) == |
390 | AE_OK) { | ||
372 | num_segments--; | 391 | num_segments--; |
373 | } | 392 | } |
374 | 393 | ||
@@ -380,7 +399,8 @@ acpi_ex_get_name_string ( | |||
380 | /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ | 399 | /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ |
381 | 400 | ||
382 | if (prefix_count == ACPI_UINT32_MAX) { | 401 | if (prefix_count == ACPI_UINT32_MAX) { |
383 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "name_seg is \"\\\" followed by NULL\n")); | 402 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
403 | "name_seg is \"\\\" followed by NULL\n")); | ||
384 | } | 404 | } |
385 | 405 | ||
386 | /* Consume the NULL byte */ | 406 | /* Consume the NULL byte */ |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 8482aefaf38b..dbdf8262ba00 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -97,7 +97,8 @@ acpi_ex_opcode_0A_0T_1R ( | |||
97 | union acpi_operand_object *return_desc = NULL; | 97 | union acpi_operand_object *return_desc = NULL; |
98 | 98 | ||
99 | 99 | ||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", |
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
101 | 102 | ||
102 | 103 | ||
103 | /* Examine the AML opcode */ | 104 | /* Examine the AML opcode */ |
@@ -161,7 +162,8 @@ acpi_ex_opcode_1A_0T_0R ( | |||
161 | acpi_status status = AE_OK; | 162 | acpi_status status = AE_OK; |
162 | 163 | ||
163 | 164 | ||
164 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); | 165 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", |
166 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
165 | 167 | ||
166 | 168 | ||
167 | /* Examine the AML opcode */ | 169 | /* Examine the AML opcode */ |
@@ -236,7 +238,8 @@ acpi_ex_opcode_1A_1T_0R ( | |||
236 | union acpi_operand_object **operand = &walk_state->operands[0]; | 238 | union acpi_operand_object **operand = &walk_state->operands[0]; |
237 | 239 | ||
238 | 240 | ||
239 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); | 241 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", |
242 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
240 | 243 | ||
241 | 244 | ||
242 | /* Examine the AML opcode */ | 245 | /* Examine the AML opcode */ |
@@ -289,7 +292,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
289 | acpi_integer digit; | 292 | acpi_integer digit; |
290 | 293 | ||
291 | 294 | ||
292 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 295 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", |
296 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
293 | 297 | ||
294 | 298 | ||
295 | /* Examine the AML opcode */ | 299 | /* Examine the AML opcode */ |
@@ -409,8 +413,10 @@ acpi_ex_opcode_1A_1T_1R ( | |||
409 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { | 413 | for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { |
410 | (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); | 414 | (void) acpi_ut_short_divide (digit, 10, &digit, &temp32); |
411 | 415 | ||
412 | /* Insert the BCD digit that resides in the remainder from above */ | 416 | /* |
413 | 417 | * Insert the BCD digit that resides in the | |
418 | * remainder from above | ||
419 | */ | ||
414 | return_desc->integer.value |= (((acpi_integer) temp32) << | 420 | return_desc->integer.value |= (((acpi_integer) temp32) << |
415 | ACPI_MUL_4 (i)); | 421 | ACPI_MUL_4 (i)); |
416 | } | 422 | } |
@@ -445,7 +451,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
445 | 451 | ||
446 | /* Get the object reference, store it, and remove our reference */ | 452 | /* Get the object reference, store it, and remove our reference */ |
447 | 453 | ||
448 | status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state); | 454 | status = acpi_ex_get_object_reference (operand[0], |
455 | &return_desc2, walk_state); | ||
449 | if (ACPI_FAILURE (status)) { | 456 | if (ACPI_FAILURE (status)) { |
450 | goto cleanup; | 457 | goto cleanup; |
451 | } | 458 | } |
@@ -482,10 +489,10 @@ acpi_ex_opcode_1A_1T_1R ( | |||
482 | 489 | ||
483 | if (!walk_state->result_obj) { | 490 | if (!walk_state->result_obj) { |
484 | /* | 491 | /* |
485 | * Normally, we would remove a reference on the Operand[0] parameter; | 492 | * Normally, we would remove a reference on the Operand[0] |
486 | * But since it is being used as the internal return object | 493 | * parameter; But since it is being used as the internal return |
487 | * (meaning we would normally increment it), the two cancel out, | 494 | * object (meaning we would normally increment it), the two |
488 | * and we simply don't do anything. | 495 | * cancel out, and we simply don't do anything. |
489 | */ | 496 | */ |
490 | walk_state->result_obj = operand[0]; | 497 | walk_state->result_obj = operand[0]; |
491 | walk_state->operands[0] = NULL; /* Prevent deletion */ | 498 | walk_state->operands[0] = NULL; /* Prevent deletion */ |
@@ -549,9 +556,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
549 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ | 556 | case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ |
550 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ | 557 | case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ |
551 | 558 | ||
552 | /* | 559 | /* These are two obsolete opcodes */ |
553 | * These are two obsolete opcodes | 560 | |
554 | */ | ||
555 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 561 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
556 | "%s is obsolete and not implemented\n", | 562 | "%s is obsolete and not implemented\n", |
557 | acpi_ps_get_opcode_name (walk_state->opcode))); | 563 | acpi_ps_get_opcode_name (walk_state->opcode))); |
@@ -568,9 +574,8 @@ acpi_ex_opcode_1A_1T_1R ( | |||
568 | } | 574 | } |
569 | 575 | ||
570 | if (ACPI_SUCCESS (status)) { | 576 | if (ACPI_SUCCESS (status)) { |
571 | /* | 577 | /* Store the return value computed above into the target object */ |
572 | * Store the return value computed above into the target object | 578 | |
573 | */ | ||
574 | status = acpi_ex_store (return_desc, operand[1], walk_state); | 579 | status = acpi_ex_store (return_desc, operand[1], walk_state); |
575 | } | 580 | } |
576 | 581 | ||
@@ -615,7 +620,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
615 | acpi_integer value; | 620 | acpi_integer value; |
616 | 621 | ||
617 | 622 | ||
618 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 623 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", |
624 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
619 | 625 | ||
620 | 626 | ||
621 | /* Examine the AML opcode */ | 627 | /* Examine the AML opcode */ |
@@ -706,9 +712,9 @@ acpi_ex_opcode_1A_0T_1R ( | |||
706 | 712 | ||
707 | /* | 713 | /* |
708 | * Note: The operand is not resolved at this point because we want to | 714 | * Note: The operand is not resolved at this point because we want to |
709 | * get the associated object, not its value. For example, we don't want | 715 | * get the associated object, not its value. For example, we don't |
710 | * to resolve a field_unit to its value, we want the actual field_unit | 716 | * want to resolve a field_unit to its value, we want the actual |
711 | * object. | 717 | * field_unit object. |
712 | */ | 718 | */ |
713 | 719 | ||
714 | /* Get the type of the base object */ | 720 | /* Get the type of the base object */ |
@@ -738,7 +744,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
738 | 744 | ||
739 | /* Get the base object */ | 745 | /* Get the base object */ |
740 | 746 | ||
741 | status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, &temp_desc); | 747 | status = acpi_ex_resolve_multiple (walk_state, |
748 | operand[0], &type, &temp_desc); | ||
742 | if (ACPI_FAILURE (status)) { | 749 | if (ACPI_FAILURE (status)) { |
743 | goto cleanup; | 750 | goto cleanup; |
744 | } | 751 | } |
@@ -818,8 +825,10 @@ acpi_ex_opcode_1A_0T_1R ( | |||
818 | 825 | ||
819 | /* Set Operand[0] to the value of the local/arg */ | 826 | /* Set Operand[0] to the value of the local/arg */ |
820 | 827 | ||
821 | status = acpi_ds_method_data_get_value (operand[0]->reference.opcode, | 828 | status = acpi_ds_method_data_get_value ( |
822 | operand[0]->reference.offset, walk_state, &temp_desc); | 829 | operand[0]->reference.opcode, |
830 | operand[0]->reference.offset, | ||
831 | walk_state, &temp_desc); | ||
823 | if (ACPI_FAILURE (status)) { | 832 | if (ACPI_FAILURE (status)) { |
824 | goto cleanup; | 833 | goto cleanup; |
825 | } | 834 | } |
@@ -852,21 +861,26 @@ acpi_ex_opcode_1A_0T_1R ( | |||
852 | case ACPI_TYPE_STRING: | 861 | case ACPI_TYPE_STRING: |
853 | 862 | ||
854 | /* | 863 | /* |
855 | * This is a deref_of (String). The string is a reference to a named ACPI object. | 864 | * This is a deref_of (String). The string is a reference |
865 | * to a named ACPI object. | ||
856 | * | 866 | * |
857 | * 1) Find the owning Node | 867 | * 1) Find the owning Node |
858 | * 2) Dereference the node to an actual object. Could be a Field, so we nee | 868 | * 2) Dereference the node to an actual object. Could be a |
859 | * to resolve the node to a value. | 869 | * Field, so we need to resolve the node to a value. |
860 | */ | 870 | */ |
861 | status = acpi_ns_get_node_by_path (operand[0]->string.pointer, | 871 | status = acpi_ns_get_node_by_path (operand[0]->string.pointer, |
862 | walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT, | 872 | walk_state->scope_info->scope.node, |
863 | ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc)); | 873 | ACPI_NS_SEARCH_PARENT, |
874 | ACPI_CAST_INDIRECT_PTR ( | ||
875 | struct acpi_namespace_node, &return_desc)); | ||
864 | if (ACPI_FAILURE (status)) { | 876 | if (ACPI_FAILURE (status)) { |
865 | goto cleanup; | 877 | goto cleanup; |
866 | } | 878 | } |
867 | 879 | ||
868 | status = acpi_ex_resolve_node_to_value ( | 880 | status = acpi_ex_resolve_node_to_value ( |
869 | ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc), walk_state); | 881 | ACPI_CAST_INDIRECT_PTR ( |
882 | struct acpi_namespace_node, &return_desc), | ||
883 | walk_state); | ||
870 | goto cleanup; | 884 | goto cleanup; |
871 | 885 | ||
872 | 886 | ||
@@ -883,14 +897,16 @@ acpi_ex_opcode_1A_0T_1R ( | |||
883 | /* | 897 | /* |
884 | * This is a deref_of (object_reference) | 898 | * This is a deref_of (object_reference) |
885 | * Get the actual object from the Node (This is the dereference). | 899 | * Get the actual object from the Node (This is the dereference). |
886 | * -- This case may only happen when a local_x or arg_x is dereferenced above. | 900 | * This case may only happen when a local_x or arg_x is |
901 | * dereferenced above. | ||
887 | */ | 902 | */ |
888 | return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) operand[0]); | 903 | return_desc = acpi_ns_get_attached_object ( |
904 | (struct acpi_namespace_node *) operand[0]); | ||
889 | } | 905 | } |
890 | else { | 906 | else { |
891 | /* | 907 | /* |
892 | * This must be a reference object produced by either the Index() or | 908 | * This must be a reference object produced by either the |
893 | * ref_of() operator | 909 | * Index() or ref_of() operator |
894 | */ | 910 | */ |
895 | switch (operand[0]->reference.opcode) { | 911 | switch (operand[0]->reference.opcode) { |
896 | case AML_INDEX_OP: | 912 | case AML_INDEX_OP: |
@@ -931,8 +947,8 @@ acpi_ex_opcode_1A_0T_1R ( | |||
931 | case ACPI_TYPE_PACKAGE: | 947 | case ACPI_TYPE_PACKAGE: |
932 | 948 | ||
933 | /* | 949 | /* |
934 | * Return the referenced element of the package. We must add | 950 | * Return the referenced element of the package. We must |
935 | * another reference to the referenced object, however. | 951 | * add another reference to the referenced object, however. |
936 | */ | 952 | */ |
937 | return_desc = *(operand[0]->reference.where); | 953 | return_desc = *(operand[0]->reference.where); |
938 | if (!return_desc) { | 954 | if (!return_desc) { |
@@ -967,9 +983,11 @@ acpi_ex_opcode_1A_0T_1R ( | |||
967 | 983 | ||
968 | return_desc = operand[0]->reference.object; | 984 | return_desc = operand[0]->reference.object; |
969 | 985 | ||
970 | if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) { | 986 | if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == |
987 | ACPI_DESC_TYPE_NAMED) { | ||
971 | 988 | ||
972 | return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) return_desc); | 989 | return_desc = acpi_ns_get_attached_object ( |
990 | (struct acpi_namespace_node *) return_desc); | ||
973 | } | 991 | } |
974 | 992 | ||
975 | /* Add another reference to the object! */ | 993 | /* Add another reference to the object! */ |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 8be4d80ceed5..7429032c2b6c 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R ( | |||
118 | 118 | ||
119 | value = (u32) operand[1]->integer.value; | 119 | value = (u32) operand[1]->integer.value; |
120 | 120 | ||
121 | /* Notifies allowed on this object? */ | 121 | /* Are notifies allowed on this object? */ |
122 | 122 | ||
123 | if (!acpi_ev_is_notify_object (node)) { | 123 | if (!acpi_ev_is_notify_object (node)) { |
124 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 124 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
@@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R ( | |||
203 | acpi_ps_get_opcode_name (walk_state->opcode)); | 203 | acpi_ps_get_opcode_name (walk_state->opcode)); |
204 | 204 | ||
205 | 205 | ||
206 | /* | 206 | /* Execute the opcode */ |
207 | * Execute the opcode | 207 | |
208 | */ | ||
209 | switch (walk_state->opcode) { | 208 | switch (walk_state->opcode) { |
210 | case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, remainder_result quotient_result) */ | 209 | case AML_DIVIDE_OP: |
210 | |||
211 | /* Divide (Dividend, Divisor, remainder_result quotient_result) */ | ||
211 | 212 | ||
212 | return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 213 | return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); |
213 | if (!return_desc1) { | 214 | if (!return_desc1) { |
@@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R ( | |||
241 | goto cleanup; | 242 | goto cleanup; |
242 | } | 243 | } |
243 | 244 | ||
244 | |||
245 | /* Store the results to the target reference operands */ | 245 | /* Store the results to the target reference operands */ |
246 | 246 | ||
247 | status = acpi_ex_store (return_desc2, operand[2], walk_state); | 247 | status = acpi_ex_store (return_desc2, operand[2], walk_state); |
@@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R ( | |||
295 | { | 295 | { |
296 | union acpi_operand_object **operand = &walk_state->operands[0]; | 296 | union acpi_operand_object **operand = &walk_state->operands[0]; |
297 | union acpi_operand_object *return_desc = NULL; | 297 | union acpi_operand_object *return_desc = NULL; |
298 | u32 index; | 298 | acpi_integer index; |
299 | acpi_status status = AE_OK; | 299 | acpi_status status = AE_OK; |
300 | acpi_size length; | 300 | acpi_size length; |
301 | 301 | ||
@@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R ( | |||
304 | acpi_ps_get_opcode_name (walk_state->opcode)); | 304 | acpi_ps_get_opcode_name (walk_state->opcode)); |
305 | 305 | ||
306 | 306 | ||
307 | /* | 307 | /* Execute the opcode */ |
308 | * Execute the opcode | 308 | |
309 | */ | ||
310 | if (walk_state->op_info->flags & AML_MATH) { | 309 | if (walk_state->op_info->flags & AML_MATH) { |
311 | /* All simple math opcodes (add, etc.) */ | 310 | /* All simple math opcodes (add, etc.) */ |
312 | 311 | ||
@@ -322,9 +321,8 @@ acpi_ex_opcode_2A_1T_1R ( | |||
322 | goto store_result_to_target; | 321 | goto store_result_to_target; |
323 | } | 322 | } |
324 | 323 | ||
325 | |||
326 | switch (walk_state->opcode) { | 324 | switch (walk_state->opcode) { |
327 | case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ | 325 | case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ |
328 | 326 | ||
329 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 327 | return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); |
330 | if (!return_desc) { | 328 | if (!return_desc) { |
@@ -341,18 +339,19 @@ acpi_ex_opcode_2A_1T_1R ( | |||
341 | break; | 339 | break; |
342 | 340 | ||
343 | 341 | ||
344 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ | 342 | case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ |
345 | 343 | ||
346 | status = acpi_ex_do_concatenate (operand[0], operand[1], | 344 | status = acpi_ex_do_concatenate (operand[0], operand[1], |
347 | &return_desc, walk_state); | 345 | &return_desc, walk_state); |
348 | break; | 346 | break; |
349 | 347 | ||
350 | 348 | ||
351 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ | 349 | case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ |
352 | 350 | ||
353 | /* | 351 | /* |
354 | * Input object is guaranteed to be a buffer at this point (it may have | 352 | * Input object is guaranteed to be a buffer at this point (it may have |
355 | * been converted.) Copy the raw buffer data to a new object of type String. | 353 | * been converted.) Copy the raw buffer data to a new object of |
354 | * type String. | ||
356 | */ | 355 | */ |
357 | 356 | ||
358 | /* | 357 | /* |
@@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R ( | |||
383 | goto cleanup; | 382 | goto cleanup; |
384 | } | 383 | } |
385 | 384 | ||
386 | /* Copy the raw buffer data with no transform. NULL terminated already. */ | 385 | /* Copy the raw buffer data with no transform. NULL terminated already*/ |
387 | 386 | ||
388 | ACPI_MEMCPY (return_desc->string.pointer, | 387 | ACPI_MEMCPY (return_desc->string.pointer, |
389 | operand[0]->buffer.pointer, length); | 388 | operand[0]->buffer.pointer, length); |
390 | break; | 389 | break; |
391 | 390 | ||
392 | 391 | ||
393 | case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ | 392 | case AML_CONCAT_RES_OP: |
393 | |||
394 | /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ | ||
394 | 395 | ||
395 | status = acpi_ex_concat_template (operand[0], operand[1], | 396 | status = acpi_ex_concat_template (operand[0], operand[1], |
396 | &return_desc, walk_state); | 397 | &return_desc, walk_state); |
@@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R ( | |||
407 | goto cleanup; | 408 | goto cleanup; |
408 | } | 409 | } |
409 | 410 | ||
410 | index = (u32) operand[1]->integer.value; | 411 | index = operand[1]->integer.value; |
412 | |||
413 | /* At this point, the Source operand is a Package, Buffer, or String */ | ||
411 | 414 | ||
412 | /* | ||
413 | * At this point, the Source operand is a Package, Buffer, or String | ||
414 | */ | ||
415 | if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { | 415 | if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { |
416 | /* Object to be indexed is a Package */ | 416 | /* Object to be indexed is a Package */ |
417 | 417 | ||
418 | if (index >= operand[0]->package.count) { | 418 | if (index >= operand[0]->package.count) { |
419 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 419 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
420 | "Index value (%X) beyond package end (%X)\n", | 420 | "Index value (%X%8.8X) beyond package end (%X)\n", |
421 | index, operand[0]->package.count)); | 421 | ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); |
422 | status = AE_AML_PACKAGE_LIMIT; | 422 | status = AE_AML_PACKAGE_LIMIT; |
423 | goto cleanup; | 423 | goto cleanup; |
424 | } | 424 | } |
425 | 425 | ||
426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; | 426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; |
427 | return_desc->reference.object = operand[0]; | 427 | return_desc->reference.object = operand[0]; |
428 | return_desc->reference.where = &operand[0]->package.elements [index]; | 428 | return_desc->reference.where = &operand[0]->package.elements [ |
429 | index]; | ||
429 | } | 430 | } |
430 | else { | 431 | else { |
431 | /* Object to be indexed is a Buffer/String */ | 432 | /* Object to be indexed is a Buffer/String */ |
432 | 433 | ||
433 | if (index >= operand[0]->buffer.length) { | 434 | if (index >= operand[0]->buffer.length) { |
434 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 435 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
435 | "Index value (%X) beyond end of buffer (%X)\n", | 436 | "Index value (%X%8.8X) beyond end of buffer (%X)\n", |
436 | index, operand[0]->buffer.length)); | 437 | ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length)); |
437 | status = AE_AML_BUFFER_LIMIT; | 438 | status = AE_AML_BUFFER_LIMIT; |
438 | goto cleanup; | 439 | goto cleanup; |
439 | } | 440 | } |
@@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R ( | |||
451 | /* Complete the Index reference object */ | 452 | /* Complete the Index reference object */ |
452 | 453 | ||
453 | return_desc->reference.opcode = AML_INDEX_OP; | 454 | return_desc->reference.opcode = AML_INDEX_OP; |
454 | return_desc->reference.offset = index; | 455 | return_desc->reference.offset = (u32) index; |
455 | 456 | ||
456 | /* Store the reference to the Target */ | 457 | /* Store the reference to the Target */ |
457 | 458 | ||
@@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R ( | |||
536 | goto cleanup; | 537 | goto cleanup; |
537 | } | 538 | } |
538 | 539 | ||
539 | /* | 540 | /* Execute the Opcode */ |
540 | * Execute the Opcode | 541 | |
541 | */ | 542 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { |
542 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ { | 543 | /* logical_op (Operand0, Operand1) */ |
544 | |||
543 | status = acpi_ex_do_logical_numeric_op (walk_state->opcode, | 545 | status = acpi_ex_do_logical_numeric_op (walk_state->opcode, |
544 | operand[0]->integer.value, operand[1]->integer.value, | 546 | operand[0]->integer.value, operand[1]->integer.value, |
545 | &logical_result); | 547 | &logical_result); |
546 | goto store_logical_result; | 548 | goto store_logical_result; |
547 | } | 549 | } |
548 | else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { | 550 | else if (walk_state->op_info->flags & AML_LOGICAL) { |
551 | /* logical_op (Operand0, Operand1) */ | ||
552 | |||
549 | status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], | 553 | status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], |
550 | operand[1], &logical_result); | 554 | operand[1], &logical_result); |
551 | goto store_logical_result; | 555 | goto store_logical_result; |
552 | } | 556 | } |
553 | 557 | ||
554 | |||
555 | switch (walk_state->opcode) { | 558 | switch (walk_state->opcode) { |
556 | case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ | 559 | case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ |
557 | 560 | ||
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 29d0b167745d..23b068adbf58 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -97,11 +97,12 @@ acpi_ex_opcode_3A_0T_0R ( | |||
97 | acpi_status status = AE_OK; | 97 | acpi_status status = AE_OK; |
98 | 98 | ||
99 | 99 | ||
100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); | 100 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", |
101 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
101 | 102 | ||
102 | 103 | ||
103 | switch (walk_state->opcode) { | 104 | switch (walk_state->opcode) { |
104 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 105 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
105 | 106 | ||
106 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 107 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
107 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 108 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
@@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R ( | |||
116 | fatal->argument = (u32) operand[2]->integer.value; | 117 | fatal->argument = (u32) operand[2]->integer.value; |
117 | } | 118 | } |
118 | 119 | ||
119 | /* | 120 | /* Always signal the OS! */ |
120 | * Always signal the OS! | 121 | |
121 | */ | ||
122 | status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); | 122 | status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); |
123 | 123 | ||
124 | /* Might return while OS is shutting down, just continue */ | 124 | /* Might return while OS is shutting down, just continue */ |
@@ -162,21 +162,23 @@ acpi_ex_opcode_3A_1T_1R ( | |||
162 | union acpi_operand_object *return_desc = NULL; | 162 | union acpi_operand_object *return_desc = NULL; |
163 | char *buffer; | 163 | char *buffer; |
164 | acpi_status status = AE_OK; | 164 | acpi_status status = AE_OK; |
165 | acpi_native_uint index; | 165 | acpi_integer index; |
166 | acpi_size length; | 166 | acpi_size length; |
167 | 167 | ||
168 | 168 | ||
169 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 169 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", |
170 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
170 | 171 | ||
171 | 172 | ||
172 | switch (walk_state->opcode) { | 173 | switch (walk_state->opcode) { |
173 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ | 174 | case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ |
174 | 175 | ||
175 | /* | 176 | /* |
176 | * Create the return object. The Source operand is guaranteed to be | 177 | * Create the return object. The Source operand is guaranteed to be |
177 | * either a String or a Buffer, so just use its type. | 178 | * either a String or a Buffer, so just use its type. |
178 | */ | 179 | */ |
179 | return_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (operand[0])); | 180 | return_desc = acpi_ut_create_internal_object ( |
181 | ACPI_GET_OBJECT_TYPE (operand[0])); | ||
180 | if (!return_desc) { | 182 | if (!return_desc) { |
181 | status = AE_NO_MEMORY; | 183 | status = AE_NO_MEMORY; |
182 | goto cleanup; | 184 | goto cleanup; |
@@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R ( | |||
184 | 186 | ||
185 | /* Get the Integer values from the objects */ | 187 | /* Get the Integer values from the objects */ |
186 | 188 | ||
187 | index = (acpi_native_uint) operand[1]->integer.value; | 189 | index = operand[1]->integer.value; |
188 | length = (acpi_size) operand[2]->integer.value; | 190 | length = (acpi_size) operand[2]->integer.value; |
189 | 191 | ||
190 | /* | 192 | /* |
@@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R ( | |||
197 | 199 | ||
198 | if ((index + length) > | 200 | if ((index + length) > |
199 | operand[0]->string.length) { | 201 | operand[0]->string.length) { |
200 | length = (acpi_size) operand[0]->string.length - index; | 202 | length = (acpi_size) operand[0]->string.length - |
203 | (acpi_size) index; | ||
201 | } | 204 | } |
202 | 205 | ||
203 | /* Allocate a new buffer for the String/Buffer */ | 206 | /* Allocate a new buffer for the String/Buffer */ |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index d32624331626..17f81d42ee41 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -75,6 +75,14 @@ | |||
75 | * fully resolved operands. | 75 | * fully resolved operands. |
76 | !*/ | 76 | !*/ |
77 | 77 | ||
78 | /* Local prototypes */ | ||
79 | |||
80 | static u8 | ||
81 | acpi_ex_do_match ( | ||
82 | u32 match_op, | ||
83 | union acpi_operand_object *package_obj, | ||
84 | union acpi_operand_object *match_obj); | ||
85 | |||
78 | 86 | ||
79 | /******************************************************************************* | 87 | /******************************************************************************* |
80 | * | 88 | * |
@@ -92,7 +100,7 @@ | |||
92 | * | 100 | * |
93 | ******************************************************************************/ | 101 | ******************************************************************************/ |
94 | 102 | ||
95 | u8 | 103 | static u8 |
96 | acpi_ex_do_match ( | 104 | acpi_ex_do_match ( |
97 | u32 match_op, | 105 | u32 match_op, |
98 | union acpi_operand_object *package_obj, | 106 | union acpi_operand_object *package_obj, |
@@ -216,11 +224,12 @@ acpi_ex_opcode_6A_0T_1R ( | |||
216 | union acpi_operand_object **operand = &walk_state->operands[0]; | 224 | union acpi_operand_object **operand = &walk_state->operands[0]; |
217 | union acpi_operand_object *return_desc = NULL; | 225 | union acpi_operand_object *return_desc = NULL; |
218 | acpi_status status = AE_OK; | 226 | acpi_status status = AE_OK; |
219 | u32 index; | 227 | acpi_integer index; |
220 | union acpi_operand_object *this_element; | 228 | union acpi_operand_object *this_element; |
221 | 229 | ||
222 | 230 | ||
223 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); | 231 | ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", |
232 | acpi_ps_get_opcode_name (walk_state->opcode)); | ||
224 | 233 | ||
225 | 234 | ||
226 | switch (walk_state->opcode) { | 235 | switch (walk_state->opcode) { |
@@ -241,9 +250,11 @@ acpi_ex_opcode_6A_0T_1R ( | |||
241 | 250 | ||
242 | /* Get the package start_index, validate against the package length */ | 251 | /* Get the package start_index, validate against the package length */ |
243 | 252 | ||
244 | index = (u32) operand[5]->integer.value; | 253 | index = operand[5]->integer.value; |
245 | if (index >= (u32) operand[0]->package.count) { | 254 | if (index >= operand[0]->package.count) { |
246 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n")); | 255 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
256 | "Index (%X%8.8X) beyond package end (%X)\n", | ||
257 | ACPI_FORMAT_UINT64 (index), operand[0]->package.count)); | ||
247 | status = AE_AML_PACKAGE_LIMIT; | 258 | status = AE_AML_PACKAGE_LIMIT; |
248 | goto cleanup; | 259 | goto cleanup; |
249 | } | 260 | } |
@@ -314,13 +325,12 @@ acpi_ex_opcode_6A_0T_1R ( | |||
314 | 325 | ||
315 | default: | 326 | default: |
316 | 327 | ||
317 | ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", | 328 | ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", |
318 | walk_state->opcode)); | 329 | walk_state->opcode)); |
319 | status = AE_AML_BAD_OPCODE; | 330 | status = AE_AML_BAD_OPCODE; |
320 | goto cleanup; | 331 | goto cleanup; |
321 | } | 332 | } |
322 | 333 | ||
323 | |||
324 | walk_state->result_obj = return_desc; | 334 | walk_state->result_obj = return_desc; |
325 | 335 | ||
326 | 336 | ||
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 264ef3bba31b..c9e3c68b5549 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -52,8 +52,23 @@ | |||
52 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exprep") | 53 | ACPI_MODULE_NAME ("exprep") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static u32 | ||
58 | acpi_ex_decode_field_access ( | ||
59 | union acpi_operand_object *obj_desc, | ||
60 | u8 field_flags, | ||
61 | u32 *return_byte_alignment); | ||
62 | |||
55 | 63 | ||
56 | #ifdef ACPI_UNDER_DEVELOPMENT | 64 | #ifdef ACPI_UNDER_DEVELOPMENT |
65 | |||
66 | static u32 | ||
67 | acpi_ex_generate_access ( | ||
68 | u32 field_bit_offset, | ||
69 | u32 field_bit_length, | ||
70 | u32 region_length); | ||
71 | |||
57 | /******************************************************************************* | 72 | /******************************************************************************* |
58 | * | 73 | * |
59 | * FUNCTION: acpi_ex_generate_access | 74 | * FUNCTION: acpi_ex_generate_access |
@@ -99,12 +114,14 @@ acpi_ex_generate_access ( | |||
99 | /* Round Field start offset and length to "minimal" byte boundaries */ | 114 | /* Round Field start offset and length to "minimal" byte boundaries */ |
100 | 115 | ||
101 | field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); | 116 | field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); |
102 | field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + field_bit_offset, 8)); | 117 | field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + |
118 | field_bit_offset, 8)); | ||
103 | field_byte_length = field_byte_end_offset - field_byte_offset; | 119 | field_byte_length = field_byte_end_offset - field_byte_offset; |
104 | 120 | ||
105 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 121 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
106 | "Bit length %d, Bit offset %d\n", | 122 | "Bit length %d, Bit offset %d\n", |
107 | field_bit_length, field_bit_offset)); | 123 | field_bit_length, field_bit_offset)); |
124 | |||
108 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 125 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
109 | "Byte Length %d, Byte Offset %d, End Offset %d\n", | 126 | "Byte Length %d, Byte Offset %d, End Offset %d\n", |
110 | field_byte_length, field_byte_offset, field_byte_end_offset)); | 127 | field_byte_length, field_byte_offset, field_byte_end_offset)); |
@@ -117,20 +134,26 @@ acpi_ex_generate_access ( | |||
117 | */ | 134 | */ |
118 | for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { | 135 | for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { |
119 | /* | 136 | /* |
120 | * 1) Round end offset up to next access boundary and make sure that this | 137 | * 1) Round end offset up to next access boundary and make sure that |
121 | * does not go beyond the end of the parent region. | 138 | * this does not go beyond the end of the parent region. |
122 | * 2) When the Access width is greater than the field_byte_length, we are done. | 139 | * 2) When the Access width is greater than the field_byte_length, we |
123 | * (This does not optimize for the perfectly aligned case yet). | 140 | * are done. (This does not optimize for the perfectly aligned |
141 | * case yet). | ||
124 | */ | 142 | */ |
125 | if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { | 143 | if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { |
126 | field_start_offset = ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / | 144 | field_start_offset = |
127 | access_byte_width; | 145 | ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / |
128 | field_end_offset = ACPI_ROUND_UP ((field_byte_length + field_byte_offset), | 146 | access_byte_width; |
129 | access_byte_width) / access_byte_width; | 147 | |
130 | accesses = field_end_offset - field_start_offset; | 148 | field_end_offset = |
149 | ACPI_ROUND_UP ((field_byte_length + field_byte_offset), | ||
150 | access_byte_width) / access_byte_width; | ||
151 | |||
152 | accesses = field_end_offset - field_start_offset; | ||
131 | 153 | ||
132 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 154 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
133 | "access_width %d end is within region\n", access_byte_width)); | 155 | "access_width %d end is within region\n", access_byte_width)); |
156 | |||
134 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 157 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
135 | "Field Start %d, Field End %d -- requires %d accesses\n", | 158 | "Field Start %d, Field End %d -- requires %d accesses\n", |
136 | field_start_offset, field_end_offset, accesses)); | 159 | field_start_offset, field_end_offset, accesses)); |
@@ -139,8 +162,8 @@ acpi_ex_generate_access ( | |||
139 | 162 | ||
140 | if (accesses <= 1) { | 163 | if (accesses <= 1) { |
141 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 164 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
142 | "Entire field can be accessed with one operation of size %d\n", | 165 | "Entire field can be accessed with one operation of size %d\n", |
143 | access_byte_width)); | 166 | access_byte_width)); |
144 | return_VALUE (access_byte_width); | 167 | return_VALUE (access_byte_width); |
145 | } | 168 | } |
146 | 169 | ||
@@ -155,15 +178,20 @@ acpi_ex_generate_access ( | |||
155 | } | 178 | } |
156 | else { | 179 | else { |
157 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 180 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
158 | "access_width %d end is NOT within region\n", access_byte_width)); | 181 | "access_width %d end is NOT within region\n", access_byte_width)); |
159 | if (access_byte_width == 1) { | 182 | if (access_byte_width == 1) { |
160 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 183 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
161 | "Field goes beyond end-of-region!\n")); | 184 | "Field goes beyond end-of-region!\n")); |
162 | return_VALUE (0); /* Field does not fit in the region at all */ | ||
163 | } | ||
164 | 185 | ||
165 | /* This width goes beyond the end-of-region, back off to previous access */ | 186 | /* Field does not fit in the region at all */ |
166 | 187 | ||
188 | return_VALUE (0); | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | * This width goes beyond the end-of-region, back off to | ||
193 | * previous access | ||
194 | */ | ||
167 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 195 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
168 | "Backing off to previous optimal access width of %d\n", | 196 | "Backing off to previous optimal access width of %d\n", |
169 | minimum_access_width)); | 197 | minimum_access_width)); |
@@ -171,8 +199,10 @@ acpi_ex_generate_access ( | |||
171 | } | 199 | } |
172 | } | 200 | } |
173 | 201 | ||
174 | /* Could not read/write field with one operation, just use max access width */ | 202 | /* |
175 | 203 | * Could not read/write field with one operation, | |
204 | * just use max access width | ||
205 | */ | ||
176 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, | 206 | ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, |
177 | "Cannot access field in one operation, using width 8\n")); | 207 | "Cannot access field in one operation, using width 8\n")); |
178 | return_VALUE (8); | 208 | return_VALUE (8); |
@@ -184,8 +214,9 @@ acpi_ex_generate_access ( | |||
184 | * | 214 | * |
185 | * FUNCTION: acpi_ex_decode_field_access | 215 | * FUNCTION: acpi_ex_decode_field_access |
186 | * | 216 | * |
187 | * PARAMETERS: Access - Encoded field access bits | 217 | * PARAMETERS: obj_desc - Field object |
188 | * Length - Field length. | 218 | * field_flags - Encoded fieldflags (contains access bits) |
219 | * return_byte_alignment - Where the byte alignment is returned | ||
189 | * | 220 | * |
190 | * RETURN: Field granularity (8, 16, 32 or 64) and | 221 | * RETURN: Field granularity (8, 16, 32 or 64) and |
191 | * byte_alignment (1, 2, 3, or 4) | 222 | * byte_alignment (1, 2, 3, or 4) |
@@ -214,9 +245,10 @@ acpi_ex_decode_field_access ( | |||
214 | case AML_FIELD_ACCESS_ANY: | 245 | case AML_FIELD_ACCESS_ANY: |
215 | 246 | ||
216 | #ifdef ACPI_UNDER_DEVELOPMENT | 247 | #ifdef ACPI_UNDER_DEVELOPMENT |
217 | byte_alignment = acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, | 248 | byte_alignment = |
218 | obj_desc->common_field.bit_length, | 249 | acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, |
219 | 0xFFFFFFFF /* Temp until we pass region_length as param */); | 250 | obj_desc->common_field.bit_length, |
251 | 0xFFFFFFFF /* Temp until we pass region_length as parameter */); | ||
220 | bit_length = byte_alignment * 8; | 252 | bit_length = byte_alignment * 8; |
221 | #endif | 253 | #endif |
222 | 254 | ||
@@ -276,6 +308,7 @@ acpi_ex_decode_field_access ( | |||
276 | * field_flags - Access, lock_rule, and update_rule. | 308 | * field_flags - Access, lock_rule, and update_rule. |
277 | * The format of a field_flag is described | 309 | * The format of a field_flag is described |
278 | * in the ACPI specification | 310 | * in the ACPI specification |
311 | * field_attribute - Special attributes (not used) | ||
279 | * field_bit_position - Field start position | 312 | * field_bit_position - Field start position |
280 | * field_bit_length - Field length in number of bits | 313 | * field_bit_length - Field length in number of bits |
281 | * | 314 | * |
@@ -337,7 +370,7 @@ acpi_ex_prep_common_field_object ( | |||
337 | /* Setup width (access granularity) fields */ | 370 | /* Setup width (access granularity) fields */ |
338 | 371 | ||
339 | obj_desc->common_field.access_byte_width = (u8) | 372 | obj_desc->common_field.access_byte_width = (u8) |
340 | ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ | 373 | ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ |
341 | 374 | ||
342 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; | 375 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; |
343 | 376 | ||
@@ -380,11 +413,7 @@ acpi_ex_prep_common_field_object ( | |||
380 | * | 413 | * |
381 | * FUNCTION: acpi_ex_prep_field_value | 414 | * FUNCTION: acpi_ex_prep_field_value |
382 | * | 415 | * |
383 | * PARAMETERS: Node - Owning Node | 416 | * PARAMETERS: Info - Contains all field creation info |
384 | * region_node - Region in which field is being defined | ||
385 | * field_flags - Access, lock_rule, and update_rule. | ||
386 | * field_bit_position - Field start position | ||
387 | * field_bit_length - Field length in number of bits | ||
388 | * | 417 | * |
389 | * RETURN: Status | 418 | * RETURN: Status |
390 | * | 419 | * |
@@ -445,7 +474,7 @@ acpi_ex_prep_field_value ( | |||
445 | switch (info->field_type) { | 474 | switch (info->field_type) { |
446 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 475 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
447 | 476 | ||
448 | obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); | 477 | obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); |
449 | 478 | ||
450 | /* An additional reference for the container */ | 479 | /* An additional reference for the container */ |
451 | 480 | ||
@@ -461,8 +490,10 @@ acpi_ex_prep_field_value ( | |||
461 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 490 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
462 | 491 | ||
463 | obj_desc->bank_field.value = info->bank_value; | 492 | obj_desc->bank_field.value = info->bank_value; |
464 | obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node); | 493 | obj_desc->bank_field.region_obj = acpi_ns_get_attached_object ( |
465 | obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (info->register_node); | 494 | info->region_node); |
495 | obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object ( | ||
496 | info->register_node); | ||
466 | 497 | ||
467 | /* An additional reference for the attached objects */ | 498 | /* An additional reference for the attached objects */ |
468 | 499 | ||
@@ -481,10 +512,13 @@ acpi_ex_prep_field_value ( | |||
481 | 512 | ||
482 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 513 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
483 | 514 | ||
484 | obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node); | 515 | obj_desc->index_field.index_obj = acpi_ns_get_attached_object ( |
485 | obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node); | 516 | info->register_node); |
517 | obj_desc->index_field.data_obj = acpi_ns_get_attached_object ( | ||
518 | info->data_register_node); | ||
486 | obj_desc->index_field.value = (u32) | 519 | obj_desc->index_field.value = (u32) |
487 | (info->field_bit_position / ACPI_MUL_8 (obj_desc->field.access_byte_width)); | 520 | (info->field_bit_position / ACPI_MUL_8 ( |
521 | obj_desc->field.access_byte_width)); | ||
488 | 522 | ||
489 | if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { | 523 | if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { |
490 | ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); | 524 | ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 7cfd0684c70b..723aaef4bb4a 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -115,7 +115,6 @@ acpi_ex_system_memory_space_handler ( | |||
115 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); | 115 | return_ACPI_STATUS (AE_AML_OPERAND_VALUE); |
116 | } | 116 | } |
117 | 117 | ||
118 | |||
119 | #ifndef ACPI_MISALIGNED_TRANSFERS | 118 | #ifndef ACPI_MISALIGNED_TRANSFERS |
120 | /* | 119 | /* |
121 | * Hardware does not support non-aligned data transfers, we must verify | 120 | * Hardware does not support non-aligned data transfers, we must verify |
@@ -134,7 +133,8 @@ acpi_ex_system_memory_space_handler ( | |||
134 | */ | 133 | */ |
135 | if ((address < mem_info->mapped_physical_address) || | 134 | if ((address < mem_info->mapped_physical_address) || |
136 | (((acpi_integer) address + length) > | 135 | (((acpi_integer) address + length) > |
137 | ((acpi_integer) mem_info->mapped_physical_address + mem_info->mapped_length))) { | 136 | ((acpi_integer) |
137 | mem_info->mapped_physical_address + mem_info->mapped_length))) { | ||
138 | /* | 138 | /* |
139 | * The request cannot be resolved by the current memory mapping; | 139 | * The request cannot be resolved by the current memory mapping; |
140 | * Delete the existing mapping and create a new one. | 140 | * Delete the existing mapping and create a new one. |
@@ -150,7 +150,9 @@ acpi_ex_system_memory_space_handler ( | |||
150 | * Don't attempt to map memory beyond the end of the region, and | 150 | * Don't attempt to map memory beyond the end of the region, and |
151 | * constrain the maximum mapping size to something reasonable. | 151 | * constrain the maximum mapping size to something reasonable. |
152 | */ | 152 | */ |
153 | window_size = (acpi_size) ((mem_info->address + mem_info->length) - address); | 153 | window_size = (acpi_size) |
154 | ((mem_info->address + mem_info->length) - address); | ||
155 | |||
154 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { | 156 | if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { |
155 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; | 157 | window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; |
156 | } | 158 | } |
@@ -160,8 +162,9 @@ acpi_ex_system_memory_space_handler ( | |||
160 | status = acpi_os_map_memory (address, window_size, | 162 | status = acpi_os_map_memory (address, window_size, |
161 | (void **) &mem_info->mapped_logical_address); | 163 | (void **) &mem_info->mapped_logical_address); |
162 | if (ACPI_FAILURE (status)) { | 164 | if (ACPI_FAILURE (status)) { |
163 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n", | 165 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
164 | ACPI_FORMAT_UINT64 (address), (u32) window_size)); | 166 | "Could not map memory at %8.8X%8.8X, size %X\n", |
167 | ACPI_FORMAT_UINT64 (address), (u32) window_size)); | ||
165 | mem_info->mapped_length = 0; | 168 | mem_info->mapped_length = 0; |
166 | return_ACPI_STATUS (status); | 169 | return_ACPI_STATUS (status); |
167 | } | 170 | } |
@@ -177,10 +180,12 @@ acpi_ex_system_memory_space_handler ( | |||
177 | * access | 180 | * access |
178 | */ | 181 | */ |
179 | logical_addr_ptr = mem_info->mapped_logical_address + | 182 | logical_addr_ptr = mem_info->mapped_logical_address + |
180 | ((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address); | 183 | ((acpi_integer) address - |
184 | (acpi_integer) mem_info->mapped_physical_address); | ||
181 | 185 | ||
182 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 186 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
183 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width, | 187 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", |
188 | function, bit_width, | ||
184 | ACPI_FORMAT_UINT64 (address))); | 189 | ACPI_FORMAT_UINT64 (address))); |
185 | 190 | ||
186 | /* | 191 | /* |
@@ -298,13 +303,15 @@ acpi_ex_system_io_space_handler ( | |||
298 | switch (function) { | 303 | switch (function) { |
299 | case ACPI_READ: | 304 | case ACPI_READ: |
300 | 305 | ||
301 | status = acpi_os_read_port ((acpi_io_address) address, &value32, bit_width); | 306 | status = acpi_os_read_port ((acpi_io_address) address, |
307 | &value32, bit_width); | ||
302 | *value = value32; | 308 | *value = value32; |
303 | break; | 309 | break; |
304 | 310 | ||
305 | case ACPI_WRITE: | 311 | case ACPI_WRITE: |
306 | 312 | ||
307 | status = acpi_os_write_port ((acpi_io_address) address, (u32) *value, bit_width); | 313 | status = acpi_os_write_port ((acpi_io_address) address, |
314 | (u32) *value, bit_width); | ||
308 | break; | 315 | break; |
309 | 316 | ||
310 | default: | 317 | default: |
@@ -375,12 +382,14 @@ acpi_ex_pci_config_space_handler ( | |||
375 | case ACPI_READ: | 382 | case ACPI_READ: |
376 | 383 | ||
377 | *value = 0; | 384 | *value = 0; |
378 | status = acpi_os_read_pci_configuration (pci_id, pci_register, value, bit_width); | 385 | status = acpi_os_read_pci_configuration (pci_id, pci_register, |
386 | value, bit_width); | ||
379 | break; | 387 | break; |
380 | 388 | ||
381 | case ACPI_WRITE: | 389 | case ACPI_WRITE: |
382 | 390 | ||
383 | status = acpi_os_write_pci_configuration (pci_id, pci_register, *value, bit_width); | 391 | status = acpi_os_write_pci_configuration (pci_id, pci_register, |
392 | *value, bit_width); | ||
384 | break; | 393 | break; |
385 | 394 | ||
386 | default: | 395 | default: |
@@ -505,8 +514,7 @@ acpi_ex_data_table_space_handler ( | |||
505 | 514 | ||
506 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); | 515 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); |
507 | 516 | ||
508 | 517 | /* Perform the memory read or write */ | |
509 | /* Perform the memory read or write */ | ||
510 | 518 | ||
511 | switch (function) { | 519 | switch (function) { |
512 | case ACPI_READ: | 520 | case ACPI_READ: |
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 7936329a0e35..21d5c74fa309 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -210,15 +210,15 @@ acpi_ex_resolve_node_to_value ( | |||
210 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 210 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
211 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 211 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
212 | 212 | ||
213 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read Node=%p source_desc=%p Type=%X\n", | 213 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
214 | "field_read Node=%p source_desc=%p Type=%X\n", | ||
214 | node, source_desc, entry_type)); | 215 | node, source_desc, entry_type)); |
215 | 216 | ||
216 | status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); | 217 | status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); |
217 | break; | 218 | break; |
218 | 219 | ||
219 | /* | 220 | /* For these objects, just return the object attached to the Node */ |
220 | * For these objects, just return the object attached to the Node | 221 | |
221 | */ | ||
222 | case ACPI_TYPE_MUTEX: | 222 | case ACPI_TYPE_MUTEX: |
223 | case ACPI_TYPE_METHOD: | 223 | case ACPI_TYPE_METHOD: |
224 | case ACPI_TYPE_POWER: | 224 | case ACPI_TYPE_POWER: |
@@ -233,12 +233,12 @@ acpi_ex_resolve_node_to_value ( | |||
233 | acpi_ut_add_reference (obj_desc); | 233 | acpi_ut_add_reference (obj_desc); |
234 | break; | 234 | break; |
235 | 235 | ||
236 | |||
237 | /* TYPE_ANY is untyped, and thus there is no object associated with it */ | 236 | /* TYPE_ANY is untyped, and thus there is no object associated with it */ |
238 | 237 | ||
239 | case ACPI_TYPE_ANY: | 238 | case ACPI_TYPE_ANY: |
240 | 239 | ||
241 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n", | 240 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
241 | "Untyped entry %p, no attached object!\n", | ||
242 | node)); | 242 | node)); |
243 | 243 | ||
244 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ | 244 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ |
@@ -259,7 +259,8 @@ acpi_ex_resolve_node_to_value ( | |||
259 | default: | 259 | default: |
260 | /* No named references are allowed here */ | 260 | /* No named references are allowed here */ |
261 | 261 | ||
262 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n", | 262 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
263 | "Unsupported Reference opcode %X (%s)\n", | ||
263 | source_desc->reference.opcode, | 264 | source_desc->reference.opcode, |
264 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); | 265 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); |
265 | 266 | ||
@@ -268,11 +269,12 @@ acpi_ex_resolve_node_to_value ( | |||
268 | break; | 269 | break; |
269 | 270 | ||
270 | 271 | ||
271 | /* Default case is for unknown types */ | ||
272 | |||
273 | default: | 272 | default: |
274 | 273 | ||
275 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n", | 274 | /* Default case is for unknown types */ |
275 | |||
276 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
277 | "Node %p - Unknown object type %X\n", | ||
276 | node, entry_type)); | 278 | node, entry_type)); |
277 | 279 | ||
278 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 280 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
@@ -280,7 +282,7 @@ acpi_ex_resolve_node_to_value ( | |||
280 | } /* switch (entry_type) */ | 282 | } /* switch (entry_type) */ |
281 | 283 | ||
282 | 284 | ||
283 | /* Put the object descriptor on the stack */ | 285 | /* Return the object descriptor */ |
284 | 286 | ||
285 | *object_ptr = (void *) obj_desc; | 287 | *object_ptr = (void *) obj_desc; |
286 | return_ACPI_STATUS (status); | 288 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 7be604911156..3de45672379a 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -54,6 +54,13 @@ | |||
54 | #define _COMPONENT ACPI_EXECUTER | 54 | #define _COMPONENT ACPI_EXECUTER |
55 | ACPI_MODULE_NAME ("exresolv") | 55 | ACPI_MODULE_NAME ("exresolv") |
56 | 56 | ||
57 | /* Local prototypes */ | ||
58 | |||
59 | static acpi_status | ||
60 | acpi_ex_resolve_object_to_value ( | ||
61 | union acpi_operand_object **stack_ptr, | ||
62 | struct acpi_walk_state *walk_state); | ||
63 | |||
57 | 64 | ||
58 | /******************************************************************************* | 65 | /******************************************************************************* |
59 | * | 66 | * |
@@ -96,6 +103,11 @@ acpi_ex_resolve_to_value ( | |||
96 | if (ACPI_FAILURE (status)) { | 103 | if (ACPI_FAILURE (status)) { |
97 | return_ACPI_STATUS (status); | 104 | return_ACPI_STATUS (status); |
98 | } | 105 | } |
106 | |||
107 | if (!*stack_ptr) { | ||
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); | ||
109 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | ||
110 | } | ||
99 | } | 111 | } |
100 | 112 | ||
101 | /* | 113 | /* |
@@ -120,18 +132,17 @@ acpi_ex_resolve_to_value ( | |||
120 | * | 132 | * |
121 | * FUNCTION: acpi_ex_resolve_object_to_value | 133 | * FUNCTION: acpi_ex_resolve_object_to_value |
122 | * | 134 | * |
123 | * PARAMETERS: stack_ptr - Pointer to a stack location that contains a | 135 | * PARAMETERS: stack_ptr - Pointer to an internal object |
124 | * ptr to an internal object. | ||
125 | * walk_state - Current method state | 136 | * walk_state - Current method state |
126 | * | 137 | * |
127 | * RETURN: Status | 138 | * RETURN: Status |
128 | * | 139 | * |
129 | * DESCRIPTION: Retrieve the value from an internal object. The Reference type | 140 | * DESCRIPTION: Retrieve the value from an internal object. The Reference type |
130 | * uses the associated AML opcode to determine the value. | 141 | * uses the associated AML opcode to determine the value. |
131 | * | 142 | * |
132 | ******************************************************************************/ | 143 | ******************************************************************************/ |
133 | 144 | ||
134 | acpi_status | 145 | static acpi_status |
135 | acpi_ex_resolve_object_to_value ( | 146 | acpi_ex_resolve_object_to_value ( |
136 | union acpi_operand_object **stack_ptr, | 147 | union acpi_operand_object **stack_ptr, |
137 | struct acpi_walk_state *walk_state) | 148 | struct acpi_walk_state *walk_state) |
@@ -159,7 +170,7 @@ acpi_ex_resolve_object_to_value ( | |||
159 | case AML_NAME_OP: | 170 | case AML_NAME_OP: |
160 | 171 | ||
161 | /* | 172 | /* |
162 | * Convert indirect name ptr to a direct name ptr. | 173 | * Convert name reference to a namespace node |
163 | * Then, acpi_ex_resolve_node_to_value can be used to get the value | 174 | * Then, acpi_ex_resolve_node_to_value can be used to get the value |
164 | */ | 175 | */ |
165 | temp_node = stack_desc->reference.object; | 176 | temp_node = stack_desc->reference.object; |
@@ -168,7 +179,7 @@ acpi_ex_resolve_object_to_value ( | |||
168 | 179 | ||
169 | acpi_ut_remove_reference (stack_desc); | 180 | acpi_ut_remove_reference (stack_desc); |
170 | 181 | ||
171 | /* Put direct name pointer onto stack and exit */ | 182 | /* Return the namespace node */ |
172 | 183 | ||
173 | (*stack_ptr) = temp_node; | 184 | (*stack_ptr) = temp_node; |
174 | break; | 185 | break; |
@@ -255,10 +266,19 @@ acpi_ex_resolve_object_to_value ( | |||
255 | 266 | ||
256 | break; | 267 | break; |
257 | 268 | ||
269 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | ||
270 | |||
271 | /* Get the object pointed to by the namespace node */ | ||
272 | |||
273 | *stack_ptr = (stack_desc->reference.node)->object; | ||
274 | acpi_ut_add_reference (*stack_ptr); | ||
275 | acpi_ut_remove_reference (stack_desc); | ||
276 | break; | ||
258 | 277 | ||
259 | default: | 278 | default: |
260 | 279 | ||
261 | ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n", | 280 | ACPI_REPORT_ERROR (( |
281 | "During resolve, Unknown Reference opcode %X (%s) in %p\n", | ||
262 | opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); | 282 | opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); |
263 | status = AE_AML_INTERNAL; | 283 | status = AE_AML_INTERNAL; |
264 | break; | 284 | break; |
@@ -278,9 +298,8 @@ acpi_ex_resolve_object_to_value ( | |||
278 | break; | 298 | break; |
279 | 299 | ||
280 | 300 | ||
281 | /* | 301 | /* These cases may never happen here, but just in case.. */ |
282 | * These cases may never happen here, but just in case.. | 302 | |
283 | */ | ||
284 | case ACPI_TYPE_BUFFER_FIELD: | 303 | case ACPI_TYPE_BUFFER_FIELD: |
285 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 304 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
286 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 305 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
@@ -333,9 +352,8 @@ acpi_ex_resolve_multiple ( | |||
333 | ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); | 352 | ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); |
334 | 353 | ||
335 | 354 | ||
336 | /* | 355 | /* Operand can be either a namespace node or an operand descriptor */ |
337 | * Operand can be either a namespace node or an operand descriptor | 356 | |
338 | */ | ||
339 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 357 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { |
340 | case ACPI_DESC_TYPE_OPERAND: | 358 | case ACPI_DESC_TYPE_OPERAND: |
341 | type = obj_desc->common.type; | 359 | type = obj_desc->common.type; |
@@ -357,10 +375,8 @@ acpi_ex_resolve_multiple ( | |||
357 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 375 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
358 | } | 376 | } |
359 | 377 | ||
378 | /* If type is anything other than a reference, we are done */ | ||
360 | 379 | ||
361 | /* | ||
362 | * If type is anything other than a reference, we are done | ||
363 | */ | ||
364 | if (type != ACPI_TYPE_LOCAL_REFERENCE) { | 380 | if (type != ACPI_TYPE_LOCAL_REFERENCE) { |
365 | goto exit; | 381 | goto exit; |
366 | } | 382 | } |
@@ -382,8 +398,9 @@ acpi_ex_resolve_multiple ( | |||
382 | /* All "References" point to a NS node */ | 398 | /* All "References" point to a NS node */ |
383 | 399 | ||
384 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { | 400 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { |
385 | ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", | 401 | ACPI_REPORT_ERROR (( |
386 | node, acpi_ut_get_descriptor_name (node))); | 402 | "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", |
403 | node, acpi_ut_get_descriptor_name (node))); | ||
387 | return_ACPI_STATUS (AE_AML_INTERNAL); | 404 | return_ACPI_STATUS (AE_AML_INTERNAL); |
388 | } | 405 | } |
389 | 406 | ||
@@ -440,8 +457,9 @@ acpi_ex_resolve_multiple ( | |||
440 | /* All "References" point to a NS node */ | 457 | /* All "References" point to a NS node */ |
441 | 458 | ||
442 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { | 459 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { |
443 | ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", | 460 | ACPI_REPORT_ERROR (( |
444 | node, acpi_ut_get_descriptor_name (node))); | 461 | "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", |
462 | node, acpi_ut_get_descriptor_name (node))); | ||
445 | return_ACPI_STATUS (AE_AML_INTERNAL); | 463 | return_ACPI_STATUS (AE_AML_INTERNAL); |
446 | } | 464 | } |
447 | 465 | ||
@@ -468,7 +486,7 @@ acpi_ex_resolve_multiple ( | |||
468 | 486 | ||
469 | if (return_desc) { | 487 | if (return_desc) { |
470 | status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, | 488 | status = acpi_ds_method_data_get_value (obj_desc->reference.opcode, |
471 | obj_desc->reference.offset, walk_state, &obj_desc); | 489 | obj_desc->reference.offset, walk_state, &obj_desc); |
472 | if (ACPI_FAILURE (status)) { | 490 | if (ACPI_FAILURE (status)) { |
473 | return_ACPI_STATUS (status); | 491 | return_ACPI_STATUS (status); |
474 | } | 492 | } |
@@ -500,7 +518,8 @@ acpi_ex_resolve_multiple ( | |||
500 | 518 | ||
501 | default: | 519 | default: |
502 | 520 | ||
503 | ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", | 521 | ACPI_REPORT_ERROR (( |
522 | "acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", | ||
504 | obj_desc->reference.opcode)); | 523 | obj_desc->reference.opcode)); |
505 | return_ACPI_STATUS (AE_AML_INTERNAL); | 524 | return_ACPI_STATUS (AE_AML_INTERNAL); |
506 | } | 525 | } |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index c92890220c32..d8b470eefe7a 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -52,6 +52,14 @@ | |||
52 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME ("exresop") | 53 | ACPI_MODULE_NAME ("exresop") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static acpi_status | ||
58 | acpi_ex_check_object_type ( | ||
59 | acpi_object_type type_needed, | ||
60 | acpi_object_type this_type, | ||
61 | void *object); | ||
62 | |||
55 | 63 | ||
56 | /******************************************************************************* | 64 | /******************************************************************************* |
57 | * | 65 | * |
@@ -67,7 +75,7 @@ | |||
67 | * | 75 | * |
68 | ******************************************************************************/ | 76 | ******************************************************************************/ |
69 | 77 | ||
70 | acpi_status | 78 | static acpi_status |
71 | acpi_ex_check_object_type ( | 79 | acpi_ex_check_object_type ( |
72 | acpi_object_type type_needed, | 80 | acpi_object_type type_needed, |
73 | acpi_object_type this_type, | 81 | acpi_object_type this_type, |
@@ -142,6 +150,7 @@ acpi_ex_resolve_operands ( | |||
142 | const struct acpi_opcode_info *op_info; | 150 | const struct acpi_opcode_info *op_info; |
143 | u32 this_arg_type; | 151 | u32 this_arg_type; |
144 | acpi_object_type type_needed; | 152 | acpi_object_type type_needed; |
153 | u16 target_op = 0; | ||
145 | 154 | ||
146 | 155 | ||
147 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); | 156 | ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); |
@@ -160,7 +169,8 @@ acpi_ex_resolve_operands ( | |||
160 | return_ACPI_STATUS (AE_AML_INTERNAL); | 169 | return_ACPI_STATUS (AE_AML_INTERNAL); |
161 | } | 170 | } |
162 | 171 | ||
163 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n", | 172 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
173 | "Opcode %X [%s] required_operand_types=%8.8X \n", | ||
164 | opcode, op_info->name, arg_types)); | 174 | opcode, op_info->name, arg_types)); |
165 | 175 | ||
166 | /* | 176 | /* |
@@ -187,7 +197,7 @@ acpi_ex_resolve_operands ( | |||
187 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 197 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { |
188 | case ACPI_DESC_TYPE_NAMED: | 198 | case ACPI_DESC_TYPE_NAMED: |
189 | 199 | ||
190 | /* Node */ | 200 | /* Namespace Node */ |
191 | 201 | ||
192 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; | 202 | object_type = ((struct acpi_namespace_node *) obj_desc)->type; |
193 | break; | 203 | break; |
@@ -202,16 +212,16 @@ acpi_ex_resolve_operands ( | |||
202 | /* Check for bad acpi_object_type */ | 212 | /* Check for bad acpi_object_type */ |
203 | 213 | ||
204 | if (!acpi_ut_valid_object_type (object_type)) { | 214 | if (!acpi_ut_valid_object_type (object_type)) { |
205 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n", | 215 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
216 | "Bad operand object type [%X]\n", | ||
206 | object_type)); | 217 | object_type)); |
207 | 218 | ||
208 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 219 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
209 | } | 220 | } |
210 | 221 | ||
211 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 222 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
212 | /* | 223 | /* Decode the Reference */ |
213 | * Decode the Reference | 224 | |
214 | */ | ||
215 | op_info = acpi_ps_get_opcode_info (opcode); | 225 | op_info = acpi_ps_get_opcode_info (opcode); |
216 | if (op_info->class == AML_CLASS_UNKNOWN) { | 226 | if (op_info->class == AML_CLASS_UNKNOWN) { |
217 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 227 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); |
@@ -219,12 +229,17 @@ acpi_ex_resolve_operands ( | |||
219 | 229 | ||
220 | switch (obj_desc->reference.opcode) { | 230 | switch (obj_desc->reference.opcode) { |
221 | case AML_DEBUG_OP: | 231 | case AML_DEBUG_OP: |
232 | target_op = AML_DEBUG_OP; | ||
233 | |||
234 | /*lint -fallthrough */ | ||
235 | |||
222 | case AML_NAME_OP: | 236 | case AML_NAME_OP: |
223 | case AML_INDEX_OP: | 237 | case AML_INDEX_OP: |
224 | case AML_REF_OF_OP: | 238 | case AML_REF_OF_OP: |
225 | case AML_ARG_OP: | 239 | case AML_ARG_OP: |
226 | case AML_LOCAL_OP: | 240 | case AML_LOCAL_OP: |
227 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ | 241 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ |
242 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | ||
228 | 243 | ||
229 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 244 | ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
230 | "Operand is a Reference, ref_opcode [%s]\n", | 245 | "Operand is a Reference, ref_opcode [%s]\n", |
@@ -254,10 +269,8 @@ acpi_ex_resolve_operands ( | |||
254 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 269 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
255 | } | 270 | } |
256 | 271 | ||
272 | /* Get one argument type, point to the next */ | ||
257 | 273 | ||
258 | /* | ||
259 | * Get one argument type, point to the next | ||
260 | */ | ||
261 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); | 274 | this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); |
262 | INCREMENT_ARG_LIST (arg_types); | 275 | INCREMENT_ARG_LIST (arg_types); |
263 | 276 | ||
@@ -271,26 +284,31 @@ acpi_ex_resolve_operands ( | |||
271 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && | 284 | if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && |
272 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { | 285 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { |
273 | /* | 286 | /* |
274 | * String found - the string references a named object and must be | 287 | * String found - the string references a named object and |
275 | * resolved to a node | 288 | * must be resolved to a node |
276 | */ | 289 | */ |
277 | goto next_operand; | 290 | goto next_operand; |
278 | } | 291 | } |
279 | 292 | ||
280 | /* Else not a string - fall through to the normal Reference case below */ | 293 | /* |
294 | * Else not a string - fall through to the normal Reference | ||
295 | * case below | ||
296 | */ | ||
281 | /*lint -fallthrough */ | 297 | /*lint -fallthrough */ |
282 | 298 | ||
283 | case ARGI_REFERENCE: /* References: */ | 299 | case ARGI_REFERENCE: /* References: */ |
284 | case ARGI_INTEGER_REF: | 300 | case ARGI_INTEGER_REF: |
285 | case ARGI_OBJECT_REF: | 301 | case ARGI_OBJECT_REF: |
286 | case ARGI_DEVICE_REF: | 302 | case ARGI_DEVICE_REF: |
287 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ | 303 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ |
288 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ | 304 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ |
289 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ | 305 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ |
290 | |||
291 | /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */ | ||
292 | 306 | ||
293 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ { | 307 | /* |
308 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE | ||
309 | * A Namespace Node is OK as-is | ||
310 | */ | ||
311 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) { | ||
294 | goto next_operand; | 312 | goto next_operand; |
295 | } | 313 | } |
296 | 314 | ||
@@ -300,11 +318,9 @@ acpi_ex_resolve_operands ( | |||
300 | return_ACPI_STATUS (status); | 318 | return_ACPI_STATUS (status); |
301 | } | 319 | } |
302 | 320 | ||
303 | if (AML_NAME_OP == obj_desc->reference.opcode) { | 321 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
304 | /* | 322 | /* Convert a named reference to the actual named object */ |
305 | * Convert an indirect name ptr to direct name ptr and put | 323 | |
306 | * it on the stack | ||
307 | */ | ||
308 | temp_node = obj_desc->reference.object; | 324 | temp_node = obj_desc->reference.object; |
309 | acpi_ut_remove_reference (obj_desc); | 325 | acpi_ut_remove_reference (obj_desc); |
310 | (*stack_ptr) = temp_node; | 326 | (*stack_ptr) = temp_node; |
@@ -332,7 +348,6 @@ acpi_ex_resolve_operands ( | |||
332 | break; | 348 | break; |
333 | } | 349 | } |
334 | 350 | ||
335 | |||
336 | /* | 351 | /* |
337 | * Resolve this object to a value | 352 | * Resolve this object to a value |
338 | */ | 353 | */ |
@@ -392,7 +407,7 @@ acpi_ex_resolve_operands ( | |||
392 | /* | 407 | /* |
393 | * The more complex cases allow multiple resolved object types | 408 | * The more complex cases allow multiple resolved object types |
394 | */ | 409 | */ |
395 | case ARGI_INTEGER: /* Number */ | 410 | case ARGI_INTEGER: |
396 | 411 | ||
397 | /* | 412 | /* |
398 | * Need an operand of type ACPI_TYPE_INTEGER, | 413 | * Need an operand of type ACPI_TYPE_INTEGER, |
@@ -563,7 +578,7 @@ acpi_ex_resolve_operands ( | |||
563 | 578 | ||
564 | case ARGI_REGION_OR_FIELD: | 579 | case ARGI_REGION_OR_FIELD: |
565 | 580 | ||
566 | /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */ | 581 | /* Need an operand of type REGION or a FIELD in a region */ |
567 | 582 | ||
568 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 583 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
569 | case ACPI_TYPE_REGION: | 584 | case ACPI_TYPE_REGION: |
@@ -614,6 +629,12 @@ acpi_ex_resolve_operands ( | |||
614 | break; | 629 | break; |
615 | } | 630 | } |
616 | 631 | ||
632 | if (target_op == AML_DEBUG_OP) { | ||
633 | /* Allow store of any object to the Debug object */ | ||
634 | |||
635 | break; | ||
636 | } | ||
637 | |||
617 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 638 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
618 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", | 639 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", |
619 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); | 640 | acpi_ut_get_object_type_name (obj_desc), obj_desc)); |
@@ -652,8 +673,7 @@ next_operand: | |||
652 | if (GET_CURRENT_ARG_TYPE (arg_types)) { | 673 | if (GET_CURRENT_ARG_TYPE (arg_types)) { |
653 | stack_ptr--; | 674 | stack_ptr--; |
654 | } | 675 | } |
655 | 676 | } | |
656 | } /* while (*Types) */ | ||
657 | 677 | ||
658 | return_ACPI_STATUS (status); | 678 | return_ACPI_STATUS (status); |
659 | } | 679 | } |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index e0fc6aba1253..2725db0901b8 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -48,11 +48,171 @@ | |||
48 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
49 | #include <acpi/amlcode.h> | 49 | #include <acpi/amlcode.h> |
50 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acparser.h> | ||
51 | 52 | ||
52 | 53 | ||
53 | #define _COMPONENT ACPI_EXECUTER | 54 | #define _COMPONENT ACPI_EXECUTER |
54 | ACPI_MODULE_NAME ("exstore") | 55 | ACPI_MODULE_NAME ("exstore") |
55 | 56 | ||
57 | /* Local prototypes */ | ||
58 | |||
59 | static void | ||
60 | acpi_ex_do_debug_object ( | ||
61 | union acpi_operand_object *source_desc, | ||
62 | u32 level, | ||
63 | u32 index); | ||
64 | |||
65 | static acpi_status | ||
66 | acpi_ex_store_object_to_index ( | ||
67 | union acpi_operand_object *val_desc, | ||
68 | union acpi_operand_object *dest_desc, | ||
69 | struct acpi_walk_state *walk_state); | ||
70 | |||
71 | |||
72 | /******************************************************************************* | ||
73 | * | ||
74 | * FUNCTION: acpi_ex_do_debug_object | ||
75 | * | ||
76 | * PARAMETERS: source_desc - Value to be stored | ||
77 | * Level - Indentation level (used for packages) | ||
78 | * Index - Current package element, zero if not pkg | ||
79 | * | ||
80 | * RETURN: None | ||
81 | * | ||
82 | * DESCRIPTION: Handles stores to the Debug Object. | ||
83 | * | ||
84 | ******************************************************************************/ | ||
85 | |||
86 | static void | ||
87 | acpi_ex_do_debug_object ( | ||
88 | union acpi_operand_object *source_desc, | ||
89 | u32 level, | ||
90 | u32 index) | ||
91 | { | ||
92 | u32 i; | ||
93 | |||
94 | |||
95 | ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc); | ||
96 | |||
97 | |||
98 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | ||
99 | level, " ")); | ||
100 | |||
101 | /* Display index for package output only */ | ||
102 | |||
103 | if (index > 0) { | ||
104 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | ||
105 | "(%.2u) ", index -1)); | ||
106 | } | ||
107 | |||
108 | if (!source_desc) { | ||
109 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); | ||
110 | return_VOID; | ||
111 | } | ||
112 | |||
113 | if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) { | ||
114 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", | ||
115 | acpi_ut_get_object_type_name (source_desc))); | ||
116 | |||
117 | if (!acpi_ut_valid_internal_object (source_desc)) { | ||
118 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | ||
119 | "%p, Invalid Internal Object!\n", source_desc)); | ||
120 | return_VOID; | ||
121 | } | ||
122 | } | ||
123 | else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) { | ||
124 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", | ||
125 | acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type), | ||
126 | source_desc)); | ||
127 | return_VOID; | ||
128 | } | ||
129 | else { | ||
130 | return_VOID; | ||
131 | } | ||
132 | |||
133 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | ||
134 | case ACPI_TYPE_INTEGER: | ||
135 | |||
136 | /* Output correct integer width */ | ||
137 | |||
138 | if (acpi_gbl_integer_byte_width == 4) { | ||
139 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", | ||
140 | (u32) source_desc->integer.value)); | ||
141 | } | ||
142 | else { | ||
143 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", | ||
144 | ACPI_FORMAT_UINT64 (source_desc->integer.value))); | ||
145 | } | ||
146 | break; | ||
147 | |||
148 | case ACPI_TYPE_BUFFER: | ||
149 | |||
150 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]", | ||
151 | (u32) source_desc->buffer.length)); | ||
152 | ACPI_DUMP_BUFFER (source_desc->buffer.pointer, | ||
153 | (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); | ||
154 | break; | ||
155 | |||
156 | case ACPI_TYPE_STRING: | ||
157 | |||
158 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", | ||
159 | source_desc->string.length, source_desc->string.pointer)); | ||
160 | break; | ||
161 | |||
162 | case ACPI_TYPE_PACKAGE: | ||
163 | |||
164 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", | ||
165 | source_desc->package.count)); | ||
166 | |||
167 | /* Output the entire contents of the package */ | ||
168 | |||
169 | for (i = 0; i < source_desc->package.count; i++) { | ||
170 | acpi_ex_do_debug_object (source_desc->package.elements[i], | ||
171 | level+4, i+1); | ||
172 | } | ||
173 | break; | ||
174 | |||
175 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
176 | |||
177 | if (source_desc->reference.opcode == AML_INDEX_OP) { | ||
178 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n", | ||
179 | acpi_ps_get_opcode_name (source_desc->reference.opcode), | ||
180 | source_desc->reference.offset)); | ||
181 | } | ||
182 | else { | ||
183 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n", | ||
184 | acpi_ps_get_opcode_name (source_desc->reference.opcode))); | ||
185 | } | ||
186 | |||
187 | |||
188 | if (source_desc->reference.object) { | ||
189 | if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == | ||
190 | ACPI_DESC_TYPE_NAMED) { | ||
191 | acpi_ex_do_debug_object (((struct acpi_namespace_node *) | ||
192 | source_desc->reference.object)->object, | ||
193 | level+4, 0); | ||
194 | } | ||
195 | else { | ||
196 | acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0); | ||
197 | } | ||
198 | } | ||
199 | else if (source_desc->reference.node) { | ||
200 | acpi_ex_do_debug_object ((source_desc->reference.node)->object, | ||
201 | level+4, 0); | ||
202 | } | ||
203 | break; | ||
204 | |||
205 | default: | ||
206 | |||
207 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", | ||
208 | source_desc, acpi_ut_get_object_type_name (source_desc))); | ||
209 | break; | ||
210 | } | ||
211 | |||
212 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); | ||
213 | return_VOID; | ||
214 | } | ||
215 | |||
56 | 216 | ||
57 | /******************************************************************************* | 217 | /******************************************************************************* |
58 | * | 218 | * |
@@ -154,8 +314,9 @@ acpi_ex_store ( | |||
154 | 314 | ||
155 | /* Storing an object into a Name "container" */ | 315 | /* Storing an object into a Name "container" */ |
156 | 316 | ||
157 | status = acpi_ex_store_object_to_node (source_desc, ref_desc->reference.object, | 317 | status = acpi_ex_store_object_to_node (source_desc, |
158 | walk_state, ACPI_IMPLICIT_CONVERSION); | 318 | ref_desc->reference.object, |
319 | walk_state, ACPI_IMPLICIT_CONVERSION); | ||
159 | break; | 320 | break; |
160 | 321 | ||
161 | 322 | ||
@@ -173,7 +334,7 @@ acpi_ex_store ( | |||
173 | /* Store to a method local/arg */ | 334 | /* Store to a method local/arg */ |
174 | 335 | ||
175 | status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, | 336 | status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, |
176 | ref_desc->reference.offset, source_desc, walk_state); | 337 | ref_desc->reference.offset, source_desc, walk_state); |
177 | break; | 338 | break; |
178 | 339 | ||
179 | 340 | ||
@@ -187,60 +348,7 @@ acpi_ex_store ( | |||
187 | "**** Write to Debug Object: Object %p %s ****:\n\n", | 348 | "**** Write to Debug Object: Object %p %s ****:\n\n", |
188 | source_desc, acpi_ut_get_object_type_name (source_desc))); | 349 | source_desc, acpi_ut_get_object_type_name (source_desc))); |
189 | 350 | ||
190 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", | 351 | acpi_ex_do_debug_object (source_desc, 0, 0); |
191 | acpi_ut_get_object_type_name (source_desc))); | ||
192 | |||
193 | if (!acpi_ut_valid_internal_object (source_desc)) { | ||
194 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, | ||
195 | "%p, Invalid Internal Object!\n", source_desc)); | ||
196 | break; | ||
197 | } | ||
198 | |||
199 | switch (ACPI_GET_OBJECT_TYPE (source_desc)) { | ||
200 | case ACPI_TYPE_INTEGER: | ||
201 | |||
202 | if (acpi_gbl_integer_byte_width == 4) { | ||
203 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", | ||
204 | (u32) source_desc->integer.value)); | ||
205 | } | ||
206 | else { | ||
207 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", | ||
208 | ACPI_FORMAT_UINT64 (source_desc->integer.value))); | ||
209 | } | ||
210 | break; | ||
211 | |||
212 | |||
213 | case ACPI_TYPE_BUFFER: | ||
214 | |||
215 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]", | ||
216 | (u32) source_desc->buffer.length)); | ||
217 | ACPI_DUMP_BUFFER (source_desc->buffer.pointer, | ||
218 | (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); | ||
219 | break; | ||
220 | |||
221 | |||
222 | case ACPI_TYPE_STRING: | ||
223 | |||
224 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", | ||
225 | source_desc->string.length, source_desc->string.pointer)); | ||
226 | break; | ||
227 | |||
228 | |||
229 | case ACPI_TYPE_PACKAGE: | ||
230 | |||
231 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n", | ||
232 | source_desc->package.count, source_desc->package.elements)); | ||
233 | break; | ||
234 | |||
235 | |||
236 | default: | ||
237 | |||
238 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", | ||
239 | source_desc)); | ||
240 | break; | ||
241 | } | ||
242 | |||
243 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); | ||
244 | break; | 352 | break; |
245 | 353 | ||
246 | 354 | ||
@@ -272,7 +380,7 @@ acpi_ex_store ( | |||
272 | * | 380 | * |
273 | ******************************************************************************/ | 381 | ******************************************************************************/ |
274 | 382 | ||
275 | acpi_status | 383 | static acpi_status |
276 | acpi_ex_store_object_to_index ( | 384 | acpi_ex_store_object_to_index ( |
277 | union acpi_operand_object *source_desc, | 385 | union acpi_operand_object *source_desc, |
278 | union acpi_operand_object *index_desc, | 386 | union acpi_operand_object *index_desc, |
@@ -313,16 +421,22 @@ acpi_ex_store_object_to_index ( | |||
313 | if (obj_desc) { | 421 | if (obj_desc) { |
314 | /* Decrement reference count by the ref count of the parent package */ | 422 | /* Decrement reference count by the ref count of the parent package */ |
315 | 423 | ||
316 | for (i = 0; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { | 424 | for (i = 0; |
425 | i < ((union acpi_operand_object *) | ||
426 | index_desc->reference.object)->common.reference_count; | ||
427 | i++) { | ||
317 | acpi_ut_remove_reference (obj_desc); | 428 | acpi_ut_remove_reference (obj_desc); |
318 | } | 429 | } |
319 | } | 430 | } |
320 | 431 | ||
321 | *(index_desc->reference.where) = new_desc; | 432 | *(index_desc->reference.where) = new_desc; |
322 | 433 | ||
323 | /* Increment reference count by the ref count of the parent package -1 */ | 434 | /* Increment ref count by the ref count of the parent package-1 */ |
324 | 435 | ||
325 | for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { | 436 | for (i = 1; |
437 | i < ((union acpi_operand_object *) | ||
438 | index_desc->reference.object)->common.reference_count; | ||
439 | i++) { | ||
326 | acpi_ut_add_reference (new_desc); | 440 | acpi_ut_add_reference (new_desc); |
327 | } | 441 | } |
328 | 442 | ||
@@ -440,9 +554,8 @@ acpi_ex_store_object_to_node ( | |||
440 | ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); | 554 | ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); |
441 | 555 | ||
442 | 556 | ||
443 | /* | 557 | /* Get current type of the node, and object attached to Node */ |
444 | * Get current type of the node, and object attached to Node | 558 | |
445 | */ | ||
446 | target_type = acpi_ns_get_type (node); | 559 | target_type = acpi_ns_get_type (node); |
447 | target_desc = acpi_ns_get_attached_object (node); | 560 | target_desc = acpi_ns_get_attached_object (node); |
448 | 561 | ||
@@ -467,19 +580,18 @@ acpi_ex_store_object_to_node ( | |||
467 | target_type = ACPI_TYPE_ANY; | 580 | target_type = ACPI_TYPE_ANY; |
468 | } | 581 | } |
469 | 582 | ||
470 | /* | 583 | /* Do the actual store operation */ |
471 | * Do the actual store operation | 584 | |
472 | */ | ||
473 | switch (target_type) { | 585 | switch (target_type) { |
474 | case ACPI_TYPE_BUFFER_FIELD: | 586 | case ACPI_TYPE_BUFFER_FIELD: |
475 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 587 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
476 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 588 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
477 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 589 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
478 | 590 | ||
479 | /* | 591 | /* For fields, copy the source data to the target field. */ |
480 | * For fields, copy the source data to the target field. | 592 | |
481 | */ | 593 | status = acpi_ex_write_data_to_field (source_desc, target_desc, |
482 | status = acpi_ex_write_data_to_field (source_desc, target_desc, &walk_state->result_obj); | 594 | &walk_state->result_obj); |
483 | break; | 595 | break; |
484 | 596 | ||
485 | 597 | ||
@@ -493,7 +605,8 @@ acpi_ex_store_object_to_node ( | |||
493 | * | 605 | * |
494 | * Copy and/or convert the source object to a new target object | 606 | * Copy and/or convert the source object to a new target object |
495 | */ | 607 | */ |
496 | status = acpi_ex_store_object_to_object (source_desc, target_desc, &new_desc, walk_state); | 608 | status = acpi_ex_store_object_to_object (source_desc, target_desc, |
609 | &new_desc, walk_state); | ||
497 | if (ACPI_FAILURE (status)) { | 610 | if (ACPI_FAILURE (status)) { |
498 | return_ACPI_STATUS (status); | 611 | return_ACPI_STATUS (status); |
499 | } | 612 | } |
@@ -526,7 +639,8 @@ acpi_ex_store_object_to_node ( | |||
526 | 639 | ||
527 | /* No conversions for all other types. Just attach the source object */ | 640 | /* No conversions for all other types. Just attach the source object */ |
528 | 641 | ||
529 | status = acpi_ns_attach_object (node, source_desc, ACPI_GET_OBJECT_TYPE (source_desc)); | 642 | status = acpi_ns_attach_object (node, source_desc, |
643 | ACPI_GET_OBJECT_TYPE (source_desc)); | ||
530 | break; | 644 | break; |
531 | } | 645 | } |
532 | 646 | ||
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index d3677feb07fd..120f30ed0bd4 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -81,9 +81,8 @@ acpi_ex_resolve_object ( | |||
81 | ACPI_FUNCTION_TRACE ("ex_resolve_object"); | 81 | ACPI_FUNCTION_TRACE ("ex_resolve_object"); |
82 | 82 | ||
83 | 83 | ||
84 | /* | 84 | /* Ensure we have a Target that can be stored to */ |
85 | * Ensure we have a Target that can be stored to | 85 | |
86 | */ | ||
87 | switch (target_type) { | 86 | switch (target_type) { |
88 | case ACPI_TYPE_BUFFER_FIELD: | 87 | case ACPI_TYPE_BUFFER_FIELD: |
89 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 88 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
@@ -118,16 +117,14 @@ acpi_ex_resolve_object ( | |||
118 | break; | 117 | break; |
119 | } | 118 | } |
120 | 119 | ||
121 | /* | 120 | /* Must have a Integer, Buffer, or String */ |
122 | * Must have a Integer, Buffer, or String | 121 | |
123 | */ | ||
124 | if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && | 122 | if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && |
125 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && | 123 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && |
126 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && | 124 | (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && |
127 | !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { | 125 | !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { |
128 | /* | 126 | /* Conversion successful but still not a valid type */ |
129 | * Conversion successful but still not a valid type | 127 | |
130 | */ | ||
131 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 128 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
132 | "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", | 129 | "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", |
133 | acpi_ut_get_object_type_name (source_desc), | 130 | acpi_ut_get_object_type_name (source_desc), |
@@ -140,9 +137,8 @@ acpi_ex_resolve_object ( | |||
140 | case ACPI_TYPE_LOCAL_ALIAS: | 137 | case ACPI_TYPE_LOCAL_ALIAS: |
141 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | 138 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: |
142 | 139 | ||
143 | /* | 140 | /* Aliases are resolved by acpi_ex_prep_operands */ |
144 | * Aliases are resolved by acpi_ex_prep_operands | 141 | |
145 | */ | ||
146 | ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); | 142 | ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); |
147 | status = AE_AML_INTERNAL; | 143 | status = AE_AML_INTERNAL; |
148 | break; | 144 | break; |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 05e1ecae8d92..12d1527669c8 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -128,7 +128,8 @@ acpi_ex_store_buffer_to_buffer ( | |||
128 | else { | 128 | else { |
129 | /* Truncate the source, copy only what will fit */ | 129 | /* Truncate the source, copy only what will fit */ |
130 | 130 | ||
131 | ACPI_MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length); | 131 | ACPI_MEMCPY (target_desc->buffer.pointer, buffer, |
132 | target_desc->buffer.length); | ||
132 | 133 | ||
133 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 134 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
134 | "Truncating source buffer from %X to %X\n", | 135 | "Truncating source buffer from %X to %X\n", |
@@ -183,7 +184,8 @@ acpi_ex_store_string_to_string ( | |||
183 | * String will fit in existing non-static buffer. | 184 | * String will fit in existing non-static buffer. |
184 | * Clear old string and copy in the new one | 185 | * Clear old string and copy in the new one |
185 | */ | 186 | */ |
186 | ACPI_MEMSET (target_desc->string.pointer, 0, (acpi_size) target_desc->string.length + 1); | 187 | ACPI_MEMSET (target_desc->string.pointer, 0, |
188 | (acpi_size) target_desc->string.length + 1); | ||
187 | ACPI_MEMCPY (target_desc->string.pointer, buffer, length); | 189 | ACPI_MEMCPY (target_desc->string.pointer, buffer, length); |
188 | } | 190 | } |
189 | else { | 191 | else { |
@@ -198,7 +200,8 @@ acpi_ex_store_string_to_string ( | |||
198 | ACPI_MEM_FREE (target_desc->string.pointer); | 200 | ACPI_MEM_FREE (target_desc->string.pointer); |
199 | } | 201 | } |
200 | 202 | ||
201 | target_desc->string.pointer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); | 203 | target_desc->string.pointer = ACPI_MEM_CALLOCATE ( |
204 | (acpi_size) length + 1); | ||
202 | if (!target_desc->string.pointer) { | 205 | if (!target_desc->string.pointer) { |
203 | return_ACPI_STATUS (AE_NO_MEMORY); | 206 | return_ACPI_STATUS (AE_NO_MEMORY); |
204 | } | 207 | } |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index f92efc512890..cafa702108dc 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -55,8 +55,8 @@ | |||
55 | * | 55 | * |
56 | * FUNCTION: acpi_ex_system_wait_semaphore | 56 | * FUNCTION: acpi_ex_system_wait_semaphore |
57 | * | 57 | * |
58 | * PARAMETERS: Semaphore - OSD semaphore to wait on | 58 | * PARAMETERS: Semaphore - Semaphore to wait on |
59 | * Timeout - Max time to wait | 59 | * Timeout - Max time to wait |
60 | * | 60 | * |
61 | * RETURN: Status | 61 | * RETURN: Status |
62 | * | 62 | * |
@@ -90,7 +90,8 @@ acpi_ex_system_wait_semaphore ( | |||
90 | 90 | ||
91 | status = acpi_os_wait_semaphore (semaphore, 1, timeout); | 91 | status = acpi_os_wait_semaphore (semaphore, 1, timeout); |
92 | 92 | ||
93 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n", | 93 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
94 | "*** Thread awake after blocking, %s\n", | ||
94 | acpi_format_exception (status))); | 95 | acpi_format_exception (status))); |
95 | 96 | ||
96 | /* Reacquire the interpreter */ | 97 | /* Reacquire the interpreter */ |
@@ -111,8 +112,8 @@ acpi_ex_system_wait_semaphore ( | |||
111 | * | 112 | * |
112 | * FUNCTION: acpi_ex_system_do_stall | 113 | * FUNCTION: acpi_ex_system_do_stall |
113 | * | 114 | * |
114 | * PARAMETERS: how_long - The amount of time to stall, | 115 | * PARAMETERS: how_long - The amount of time to stall, |
115 | * in microseconds | 116 | * in microseconds |
116 | * | 117 | * |
117 | * RETURN: Status | 118 | * RETURN: Status |
118 | * | 119 | * |
@@ -141,7 +142,8 @@ acpi_ex_system_do_stall ( | |||
141 | * (ACPI specifies 100 usec as max, but this gives some slack in | 142 | * (ACPI specifies 100 usec as max, but this gives some slack in |
142 | * order to support existing BIOSs) | 143 | * order to support existing BIOSs) |
143 | */ | 144 | */ |
144 | ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", how_long)); | 145 | ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", |
146 | how_long)); | ||
145 | status = AE_AML_OPERAND_VALUE; | 147 | status = AE_AML_OPERAND_VALUE; |
146 | } | 148 | } |
147 | else { | 149 | else { |
@@ -156,8 +158,8 @@ acpi_ex_system_do_stall ( | |||
156 | * | 158 | * |
157 | * FUNCTION: acpi_ex_system_do_suspend | 159 | * FUNCTION: acpi_ex_system_do_suspend |
158 | * | 160 | * |
159 | * PARAMETERS: how_long - The amount of time to suspend, | 161 | * PARAMETERS: how_long - The amount of time to suspend, |
160 | * in milliseconds | 162 | * in milliseconds |
161 | * | 163 | * |
162 | * RETURN: None | 164 | * RETURN: None |
163 | * | 165 | * |
@@ -192,8 +194,8 @@ acpi_ex_system_do_suspend ( | |||
192 | * | 194 | * |
193 | * FUNCTION: acpi_ex_system_acquire_mutex | 195 | * FUNCTION: acpi_ex_system_acquire_mutex |
194 | * | 196 | * |
195 | * PARAMETERS: *time_desc - The 'time to delay' object descriptor | 197 | * PARAMETERS: time_desc - The 'time to delay' object descriptor |
196 | * *obj_desc - The object descriptor for this op | 198 | * obj_desc - The object descriptor for this op |
197 | * | 199 | * |
198 | * RETURN: Status | 200 | * RETURN: Status |
199 | * | 201 | * |
@@ -218,16 +220,15 @@ acpi_ex_system_acquire_mutex ( | |||
218 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 220 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
219 | } | 221 | } |
220 | 222 | ||
221 | /* | 223 | /* Support for the _GL_ Mutex object -- go get the global lock */ |
222 | * Support for the _GL_ Mutex object -- go get the global lock | 224 | |
223 | */ | ||
224 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 225 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { |
225 | status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); | 226 | status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); |
226 | return_ACPI_STATUS (status); | 227 | return_ACPI_STATUS (status); |
227 | } | 228 | } |
228 | 229 | ||
229 | status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, | 230 | status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore, |
230 | (u16) time_desc->integer.value); | 231 | (u16) time_desc->integer.value); |
231 | return_ACPI_STATUS (status); | 232 | return_ACPI_STATUS (status); |
232 | } | 233 | } |
233 | 234 | ||
@@ -236,7 +237,7 @@ acpi_ex_system_acquire_mutex ( | |||
236 | * | 237 | * |
237 | * FUNCTION: acpi_ex_system_release_mutex | 238 | * FUNCTION: acpi_ex_system_release_mutex |
238 | * | 239 | * |
239 | * PARAMETERS: *obj_desc - The object descriptor for this op | 240 | * PARAMETERS: obj_desc - The object descriptor for this op |
240 | * | 241 | * |
241 | * RETURN: Status | 242 | * RETURN: Status |
242 | * | 243 | * |
@@ -261,9 +262,8 @@ acpi_ex_system_release_mutex ( | |||
261 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 262 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
262 | } | 263 | } |
263 | 264 | ||
264 | /* | 265 | /* Support for the _GL_ Mutex object -- release the global lock */ |
265 | * Support for the _GL_ Mutex object -- release the global lock | 266 | |
266 | */ | ||
267 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 267 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { |
268 | status = acpi_ev_release_global_lock (); | 268 | status = acpi_ev_release_global_lock (); |
269 | return_ACPI_STATUS (status); | 269 | return_ACPI_STATUS (status); |
@@ -278,9 +278,9 @@ acpi_ex_system_release_mutex ( | |||
278 | * | 278 | * |
279 | * FUNCTION: acpi_ex_system_signal_event | 279 | * FUNCTION: acpi_ex_system_signal_event |
280 | * | 280 | * |
281 | * PARAMETERS: *obj_desc - The object descriptor for this op | 281 | * PARAMETERS: obj_desc - The object descriptor for this op |
282 | * | 282 | * |
283 | * RETURN: AE_OK | 283 | * RETURN: Status |
284 | * | 284 | * |
285 | * DESCRIPTION: Provides an access point to perform synchronization operations | 285 | * DESCRIPTION: Provides an access point to perform synchronization operations |
286 | * within the AML. | 286 | * within the AML. |
@@ -309,8 +309,8 @@ acpi_ex_system_signal_event ( | |||
309 | * | 309 | * |
310 | * FUNCTION: acpi_ex_system_wait_event | 310 | * FUNCTION: acpi_ex_system_wait_event |
311 | * | 311 | * |
312 | * PARAMETERS: *time_desc - The 'time to delay' object descriptor | 312 | * PARAMETERS: time_desc - The 'time to delay' object descriptor |
313 | * *obj_desc - The object descriptor for this op | 313 | * obj_desc - The object descriptor for this op |
314 | * | 314 | * |
315 | * RETURN: Status | 315 | * RETURN: Status |
316 | * | 316 | * |
@@ -333,7 +333,7 @@ acpi_ex_system_wait_event ( | |||
333 | 333 | ||
334 | if (obj_desc) { | 334 | if (obj_desc) { |
335 | status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, | 335 | status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore, |
336 | (u16) time_desc->integer.value); | 336 | (u16) time_desc->integer.value); |
337 | } | 337 | } |
338 | 338 | ||
339 | return_ACPI_STATUS (status); | 339 | return_ACPI_STATUS (status); |
@@ -344,7 +344,7 @@ acpi_ex_system_wait_event ( | |||
344 | * | 344 | * |
345 | * FUNCTION: acpi_ex_system_reset_event | 345 | * FUNCTION: acpi_ex_system_reset_event |
346 | * | 346 | * |
347 | * PARAMETERS: *obj_desc - The object descriptor for this op | 347 | * PARAMETERS: obj_desc - The object descriptor for this op |
348 | * | 348 | * |
349 | * RETURN: Status | 349 | * RETURN: Status |
350 | * | 350 | * |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 40c6abb8b49a..5c7ec0c04177 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -67,22 +67,31 @@ | |||
67 | #define _COMPONENT ACPI_EXECUTER | 67 | #define _COMPONENT ACPI_EXECUTER |
68 | ACPI_MODULE_NAME ("exutils") | 68 | ACPI_MODULE_NAME ("exutils") |
69 | 69 | ||
70 | /* Local prototypes */ | ||
70 | 71 | ||
71 | #ifndef ACPI_NO_METHOD_EXECUTION | 72 | static u32 |
73 | acpi_ex_digits_needed ( | ||
74 | acpi_integer value, | ||
75 | u32 base); | ||
72 | 76 | ||
77 | |||
78 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
73 | /******************************************************************************* | 79 | /******************************************************************************* |
74 | * | 80 | * |
75 | * FUNCTION: acpi_ex_enter_interpreter | 81 | * FUNCTION: acpi_ex_enter_interpreter |
76 | * | 82 | * |
77 | * PARAMETERS: None | 83 | * PARAMETERS: None |
78 | * | 84 | * |
85 | * RETURN: Status | ||
86 | * | ||
79 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter | 87 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter |
80 | * the interpreter region is a fatal system error | 88 | * the interpreter region is a fatal system error |
81 | * | 89 | * |
82 | ******************************************************************************/ | 90 | ******************************************************************************/ |
83 | 91 | ||
84 | acpi_status | 92 | acpi_status |
85 | acpi_ex_enter_interpreter (void) | 93 | acpi_ex_enter_interpreter ( |
94 | void) | ||
86 | { | 95 | { |
87 | acpi_status status; | 96 | acpi_status status; |
88 | 97 | ||
@@ -104,6 +113,8 @@ acpi_ex_enter_interpreter (void) | |||
104 | * | 113 | * |
105 | * PARAMETERS: None | 114 | * PARAMETERS: None |
106 | * | 115 | * |
116 | * RETURN: None | ||
117 | * | ||
107 | * DESCRIPTION: Exit the interpreter execution region | 118 | * DESCRIPTION: Exit the interpreter execution region |
108 | * | 119 | * |
109 | * Cases where the interpreter is unlocked: | 120 | * Cases where the interpreter is unlocked: |
@@ -119,7 +130,8 @@ acpi_ex_enter_interpreter (void) | |||
119 | ******************************************************************************/ | 130 | ******************************************************************************/ |
120 | 131 | ||
121 | void | 132 | void |
122 | acpi_ex_exit_interpreter (void) | 133 | acpi_ex_exit_interpreter ( |
134 | void) | ||
123 | { | 135 | { |
124 | acpi_status status; | 136 | acpi_status status; |
125 | 137 | ||
@@ -212,7 +224,8 @@ acpi_ex_acquire_global_lock ( | |||
212 | locked = TRUE; | 224 | locked = TRUE; |
213 | } | 225 | } |
214 | else { | 226 | else { |
215 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n", | 227 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
228 | "Could not acquire Global Lock, %s\n", | ||
216 | acpi_format_exception (status))); | 229 | acpi_format_exception (status))); |
217 | } | 230 | } |
218 | } | 231 | } |
@@ -228,7 +241,7 @@ acpi_ex_acquire_global_lock ( | |||
228 | * PARAMETERS: locked_by_me - Return value from corresponding call to | 241 | * PARAMETERS: locked_by_me - Return value from corresponding call to |
229 | * acquire_global_lock. | 242 | * acquire_global_lock. |
230 | * | 243 | * |
231 | * RETURN: Status | 244 | * RETURN: None |
232 | * | 245 | * |
233 | * DESCRIPTION: Release the global lock if it is locked. | 246 | * DESCRIPTION: Release the global lock if it is locked. |
234 | * | 247 | * |
@@ -269,11 +282,14 @@ acpi_ex_release_global_lock ( | |||
269 | * PARAMETERS: Value - Value to be represented | 282 | * PARAMETERS: Value - Value to be represented |
270 | * Base - Base of representation | 283 | * Base - Base of representation |
271 | * | 284 | * |
272 | * RETURN: the number of digits needed to represent Value in Base | 285 | * RETURN: The number of digits. |
286 | * | ||
287 | * DESCRIPTION: Calculate the number of digits needed to represent the Value | ||
288 | * in the given Base (Radix) | ||
273 | * | 289 | * |
274 | ******************************************************************************/ | 290 | ******************************************************************************/ |
275 | 291 | ||
276 | u32 | 292 | static u32 |
277 | acpi_ex_digits_needed ( | 293 | acpi_ex_digits_needed ( |
278 | acpi_integer value, | 294 | acpi_integer value, |
279 | u32 base) | 295 | u32 base) |
@@ -312,6 +328,8 @@ acpi_ex_digits_needed ( | |||
312 | * PARAMETERS: numeric_id - EISA ID to be converted | 328 | * PARAMETERS: numeric_id - EISA ID to be converted |
313 | * out_string - Where to put the converted string (8 bytes) | 329 | * out_string - Where to put the converted string (8 bytes) |
314 | * | 330 | * |
331 | * RETURN: None | ||
332 | * | ||
315 | * DESCRIPTION: Convert a numeric EISA ID to string representation | 333 | * DESCRIPTION: Convert a numeric EISA ID to string representation |
316 | * | 334 | * |
317 | ******************************************************************************/ | 335 | ******************************************************************************/ |
@@ -349,7 +367,10 @@ acpi_ex_eisa_id_to_string ( | |||
349 | * PARAMETERS: Value - Value to be converted | 367 | * PARAMETERS: Value - Value to be converted |
350 | * out_string - Where to put the converted string (8 bytes) | 368 | * out_string - Where to put the converted string (8 bytes) |
351 | * | 369 | * |
352 | * RETURN: Convert a number to string representation | 370 | * RETURN: None, string |
371 | * | ||
372 | * DESCRIPTOIN: Convert a number to string representation. Assumes string | ||
373 | * buffer is large enough to hold the string. | ||
353 | * | 374 | * |
354 | ******************************************************************************/ | 375 | ******************************************************************************/ |
355 | 376 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c new file mode 100644 index 000000000000..770cfc8b17e0 --- /dev/null +++ b/drivers/acpi/glue.c | |||
@@ -0,0 +1,360 @@ | |||
1 | /* | ||
2 | * Link physical devices with ACPI devices support | ||
3 | * | ||
4 | * Copyright (c) 2005 David Shaohua Li <shaohua.li@intel.com> | ||
5 | * Copyright (c) 2005 Intel Corp. | ||
6 | * | ||
7 | * This file is released under the GPLv2. | ||
8 | */ | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/list.h> | ||
11 | #include <linux/device.h> | ||
12 | #include <linux/rwsem.h> | ||
13 | #include <linux/acpi.h> | ||
14 | |||
15 | #define ACPI_GLUE_DEBUG 0 | ||
16 | #if ACPI_GLUE_DEBUG | ||
17 | #define DBG(x...) printk(PREFIX x) | ||
18 | #else | ||
19 | #define DBG(x...) | ||
20 | #endif | ||
21 | static LIST_HEAD(bus_type_list); | ||
22 | static DECLARE_RWSEM(bus_type_sem); | ||
23 | |||
24 | int register_acpi_bus_type(struct acpi_bus_type *type) | ||
25 | { | ||
26 | if (acpi_disabled) | ||
27 | return -ENODEV; | ||
28 | if (type && type->bus && type->find_device) { | ||
29 | down_write(&bus_type_sem); | ||
30 | list_add_tail(&type->list, &bus_type_list); | ||
31 | up_write(&bus_type_sem); | ||
32 | printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name); | ||
33 | return 0; | ||
34 | } | ||
35 | return -ENODEV; | ||
36 | } | ||
37 | |||
38 | EXPORT_SYMBOL(register_acpi_bus_type); | ||
39 | |||
40 | int unregister_acpi_bus_type(struct acpi_bus_type *type) | ||
41 | { | ||
42 | if (acpi_disabled) | ||
43 | return 0; | ||
44 | if (type) { | ||
45 | down_write(&bus_type_sem); | ||
46 | list_del_init(&type->list); | ||
47 | up_write(&bus_type_sem); | ||
48 | printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name); | ||
49 | return 0; | ||
50 | } | ||
51 | return -ENODEV; | ||
52 | } | ||
53 | |||
54 | EXPORT_SYMBOL(unregister_acpi_bus_type); | ||
55 | |||
56 | static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type) | ||
57 | { | ||
58 | struct acpi_bus_type *tmp, *ret = NULL; | ||
59 | |||
60 | down_read(&bus_type_sem); | ||
61 | list_for_each_entry(tmp, &bus_type_list, list) { | ||
62 | if (tmp->bus == type) { | ||
63 | ret = tmp; | ||
64 | break; | ||
65 | } | ||
66 | } | ||
67 | up_read(&bus_type_sem); | ||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) | ||
72 | { | ||
73 | struct acpi_bus_type *tmp; | ||
74 | int ret = -ENODEV; | ||
75 | |||
76 | down_read(&bus_type_sem); | ||
77 | list_for_each_entry(tmp, &bus_type_list, list) { | ||
78 | if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) { | ||
79 | ret = 0; | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | up_read(&bus_type_sem); | ||
84 | return ret; | ||
85 | } | ||
86 | |||
87 | /* Get PCI root bridge's handle from its segment and bus number */ | ||
88 | struct acpi_find_pci_root { | ||
89 | unsigned int seg; | ||
90 | unsigned int bus; | ||
91 | acpi_handle handle; | ||
92 | }; | ||
93 | |||
94 | static acpi_status | ||
95 | do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) | ||
96 | { | ||
97 | int *busnr = (int *)data; | ||
98 | struct acpi_resource_address64 address; | ||
99 | |||
100 | if (resource->id != ACPI_RSTYPE_ADDRESS16 && | ||
101 | resource->id != ACPI_RSTYPE_ADDRESS32 && | ||
102 | resource->id != ACPI_RSTYPE_ADDRESS64) | ||
103 | return AE_OK; | ||
104 | |||
105 | acpi_resource_to_address64(resource, &address); | ||
106 | if ((address.address_length > 0) && | ||
107 | (address.resource_type == ACPI_BUS_NUMBER_RANGE)) | ||
108 | *busnr = address.min_address_range; | ||
109 | |||
110 | return AE_OK; | ||
111 | } | ||
112 | |||
113 | static int get_root_bridge_busnr(acpi_handle handle) | ||
114 | { | ||
115 | acpi_status status; | ||
116 | int bus, bbn; | ||
117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
118 | |||
119 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
120 | |||
121 | status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, | ||
122 | (unsigned long *)&bbn); | ||
123 | if (status == AE_NOT_FOUND) { | ||
124 | /* Assume bus = 0 */ | ||
125 | printk(KERN_INFO PREFIX | ||
126 | "Assume root bridge [%s] bus is 0\n", | ||
127 | (char *)buffer.pointer); | ||
128 | status = AE_OK; | ||
129 | bbn = 0; | ||
130 | } | ||
131 | if (ACPI_FAILURE(status)) { | ||
132 | bbn = -ENODEV; | ||
133 | goto exit; | ||
134 | } | ||
135 | if (bbn > 0) | ||
136 | goto exit; | ||
137 | |||
138 | /* _BBN in some systems return 0 for all root bridges */ | ||
139 | bus = -1; | ||
140 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
141 | do_root_bridge_busnr_callback, &bus); | ||
142 | /* If _CRS failed, we just use _BBN */ | ||
143 | if (ACPI_FAILURE(status) || (bus == -1)) | ||
144 | goto exit; | ||
145 | /* We select _CRS */ | ||
146 | if (bbn != bus) { | ||
147 | printk(KERN_INFO PREFIX | ||
148 | "_BBN and _CRS returns different value for %s. Select _CRS\n", | ||
149 | (char *)buffer.pointer); | ||
150 | bbn = bus; | ||
151 | } | ||
152 | exit: | ||
153 | acpi_os_free(buffer.pointer); | ||
154 | return bbn; | ||
155 | } | ||
156 | |||
157 | static acpi_status | ||
158 | find_pci_rootbridge(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
159 | { | ||
160 | struct acpi_find_pci_root *find = (struct acpi_find_pci_root *)context; | ||
161 | unsigned long seg, bus; | ||
162 | acpi_status status; | ||
163 | int tmp; | ||
164 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
165 | |||
166 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
167 | |||
168 | status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, &seg); | ||
169 | if (status == AE_NOT_FOUND) { | ||
170 | /* Assume seg = 0 */ | ||
171 | printk(KERN_INFO PREFIX | ||
172 | "Assume root bridge [%s] segment is 0\n", | ||
173 | (char *)buffer.pointer); | ||
174 | status = AE_OK; | ||
175 | seg = 0; | ||
176 | } | ||
177 | if (ACPI_FAILURE(status)) { | ||
178 | status = AE_CTRL_DEPTH; | ||
179 | goto exit; | ||
180 | } | ||
181 | |||
182 | tmp = get_root_bridge_busnr(handle); | ||
183 | if (tmp < 0) { | ||
184 | printk(KERN_ERR PREFIX | ||
185 | "Find root bridge failed for %s\n", | ||
186 | (char *)buffer.pointer); | ||
187 | status = AE_CTRL_DEPTH; | ||
188 | goto exit; | ||
189 | } | ||
190 | bus = tmp; | ||
191 | |||
192 | if (seg == find->seg && bus == find->bus) | ||
193 | find->handle = handle; | ||
194 | status = AE_OK; | ||
195 | exit: | ||
196 | acpi_os_free(buffer.pointer); | ||
197 | return status; | ||
198 | } | ||
199 | |||
200 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus) | ||
201 | { | ||
202 | struct acpi_find_pci_root find = { seg, bus, NULL }; | ||
203 | |||
204 | acpi_get_devices(PCI_ROOT_HID_STRING, find_pci_rootbridge, &find, NULL); | ||
205 | return find.handle; | ||
206 | } | ||
207 | |||
208 | /* Get device's handler per its address under its parent */ | ||
209 | struct acpi_find_child { | ||
210 | acpi_handle handle; | ||
211 | acpi_integer address; | ||
212 | }; | ||
213 | |||
214 | static acpi_status | ||
215 | do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
216 | { | ||
217 | acpi_status status; | ||
218 | struct acpi_device_info *info; | ||
219 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
220 | struct acpi_find_child *find = (struct acpi_find_child *)context; | ||
221 | |||
222 | status = acpi_get_object_info(handle, &buffer); | ||
223 | if (ACPI_SUCCESS(status)) { | ||
224 | info = buffer.pointer; | ||
225 | if (info->address == find->address) | ||
226 | find->handle = handle; | ||
227 | acpi_os_free(buffer.pointer); | ||
228 | } | ||
229 | return AE_OK; | ||
230 | } | ||
231 | |||
232 | acpi_handle acpi_get_child(acpi_handle parent, acpi_integer address) | ||
233 | { | ||
234 | struct acpi_find_child find = { NULL, address }; | ||
235 | |||
236 | if (!parent) | ||
237 | return NULL; | ||
238 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, | ||
239 | 1, do_acpi_find_child, &find, NULL); | ||
240 | return find.handle; | ||
241 | } | ||
242 | |||
243 | EXPORT_SYMBOL(acpi_get_child); | ||
244 | |||
245 | /* Link ACPI devices with physical devices */ | ||
246 | static void acpi_glue_data_handler(acpi_handle handle, | ||
247 | u32 function, void *context) | ||
248 | { | ||
249 | /* we provide an empty handler */ | ||
250 | } | ||
251 | |||
252 | /* Note: a success call will increase reference count by one */ | ||
253 | struct device *acpi_get_physical_device(acpi_handle handle) | ||
254 | { | ||
255 | acpi_status status; | ||
256 | struct device *dev; | ||
257 | |||
258 | status = acpi_get_data(handle, acpi_glue_data_handler, (void **)&dev); | ||
259 | if (ACPI_SUCCESS(status)) | ||
260 | return get_device(dev); | ||
261 | return NULL; | ||
262 | } | ||
263 | |||
264 | EXPORT_SYMBOL(acpi_get_physical_device); | ||
265 | |||
266 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | ||
267 | { | ||
268 | acpi_status status; | ||
269 | |||
270 | if (dev->firmware_data) { | ||
271 | printk(KERN_WARNING PREFIX | ||
272 | "Drivers changed 'firmware_data' for %s\n", dev->bus_id); | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | get_device(dev); | ||
276 | status = acpi_attach_data(handle, acpi_glue_data_handler, dev); | ||
277 | if (ACPI_FAILURE(status)) { | ||
278 | put_device(dev); | ||
279 | return -EINVAL; | ||
280 | } | ||
281 | dev->firmware_data = handle; | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static int acpi_unbind_one(struct device *dev) | ||
287 | { | ||
288 | if (!dev->firmware_data) | ||
289 | return 0; | ||
290 | if (dev == acpi_get_physical_device(dev->firmware_data)) { | ||
291 | /* acpi_get_physical_device increase refcnt by one */ | ||
292 | put_device(dev); | ||
293 | acpi_detach_data(dev->firmware_data, acpi_glue_data_handler); | ||
294 | dev->firmware_data = NULL; | ||
295 | /* acpi_bind_one increase refcnt by one */ | ||
296 | put_device(dev); | ||
297 | } else { | ||
298 | printk(KERN_ERR PREFIX | ||
299 | "Oops, 'firmware_data' corrupt for %s\n", dev->bus_id); | ||
300 | } | ||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | static int acpi_platform_notify(struct device *dev) | ||
305 | { | ||
306 | struct acpi_bus_type *type; | ||
307 | acpi_handle handle; | ||
308 | int ret = -EINVAL; | ||
309 | |||
310 | if (!dev->bus || !dev->parent) { | ||
311 | /* bridge devices genernally haven't bus or parent */ | ||
312 | ret = acpi_find_bridge_device(dev, &handle); | ||
313 | goto end; | ||
314 | } | ||
315 | type = acpi_get_bus_type(dev->bus); | ||
316 | if (!type) { | ||
317 | DBG("No ACPI bus support for %s\n", dev->bus_id); | ||
318 | ret = -EINVAL; | ||
319 | goto end; | ||
320 | } | ||
321 | if ((ret = type->find_device(dev, &handle)) != 0) | ||
322 | DBG("Can't get handler for %s\n", dev->bus_id); | ||
323 | end: | ||
324 | if (!ret) | ||
325 | acpi_bind_one(dev, handle); | ||
326 | |||
327 | #if ACPI_GLUE_DEBUG | ||
328 | if (!ret) { | ||
329 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
330 | |||
331 | acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer); | ||
332 | DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); | ||
333 | acpi_os_free(buffer.pointer); | ||
334 | } else | ||
335 | DBG("Device %s -> No ACPI support\n", dev->bus_id); | ||
336 | #endif | ||
337 | |||
338 | return ret; | ||
339 | } | ||
340 | |||
341 | static int acpi_platform_notify_remove(struct device *dev) | ||
342 | { | ||
343 | acpi_unbind_one(dev); | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | static int __init init_acpi_device_notify(void) | ||
348 | { | ||
349 | if (acpi_disabled) | ||
350 | return 0; | ||
351 | if (platform_notify || platform_notify_remove) { | ||
352 | printk(KERN_ERR PREFIX "Can't use platform_notify\n"); | ||
353 | return 0; | ||
354 | } | ||
355 | platform_notify = acpi_platform_notify; | ||
356 | platform_notify_remove = acpi_platform_notify_remove; | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | arch_initcall(init_acpi_device_notify); | ||
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 529e922bdc85..b51001e74eea 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -58,7 +58,8 @@ | |||
58 | * | 58 | * |
59 | * RETURN: Status | 59 | * RETURN: Status |
60 | * | 60 | * |
61 | * DESCRIPTION: Initialize and validate various ACPI registers | 61 | * DESCRIPTION: Initialize and validate the various ACPI registers defined in |
62 | * the FADT. | ||
62 | * | 63 | * |
63 | ******************************************************************************/ | 64 | ******************************************************************************/ |
64 | 65 | ||
@@ -75,7 +76,7 @@ acpi_hw_initialize ( | |||
75 | /* We must have the ACPI tables by the time we get here */ | 76 | /* We must have the ACPI tables by the time we get here */ |
76 | 77 | ||
77 | if (!acpi_gbl_FADT) { | 78 | if (!acpi_gbl_FADT) { |
78 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n")); | 79 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n")); |
79 | 80 | ||
80 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 81 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); |
81 | } | 82 | } |
@@ -131,7 +132,8 @@ acpi_hw_set_mode ( | |||
131 | * transitions are not supported. | 132 | * transitions are not supported. |
132 | */ | 133 | */ |
133 | if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { | 134 | if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { |
134 | ACPI_REPORT_ERROR (("No ACPI mode transition supported in this system (enable/disable both zero)\n")); | 135 | ACPI_REPORT_ERROR (( |
136 | "No ACPI mode transition supported in this system (enable/disable both zero)\n")); | ||
135 | return_ACPI_STATUS (AE_OK); | 137 | return_ACPI_STATUS (AE_OK); |
136 | } | 138 | } |
137 | 139 | ||
@@ -162,7 +164,8 @@ acpi_hw_set_mode ( | |||
162 | } | 164 | } |
163 | 165 | ||
164 | if (ACPI_FAILURE (status)) { | 166 | if (ACPI_FAILURE (status)) { |
165 | ACPI_REPORT_ERROR (("Could not write mode change, %s\n", acpi_format_exception (status))); | 167 | ACPI_REPORT_ERROR (("Could not write mode change, %s\n", |
168 | acpi_format_exception (status))); | ||
166 | return_ACPI_STATUS (status); | 169 | return_ACPI_STATUS (status); |
167 | } | 170 | } |
168 | 171 | ||
@@ -173,7 +176,8 @@ acpi_hw_set_mode ( | |||
173 | retry = 3000; | 176 | retry = 3000; |
174 | while (retry) { | 177 | while (retry) { |
175 | if (acpi_hw_get_mode() == mode) { | 178 | if (acpi_hw_get_mode() == mode) { |
176 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode)); | 179 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", |
180 | mode)); | ||
177 | return_ACPI_STATUS (AE_OK); | 181 | return_ACPI_STATUS (AE_OK); |
178 | } | 182 | } |
179 | acpi_os_stall(1000); | 183 | acpi_os_stall(1000); |
@@ -185,7 +189,7 @@ acpi_hw_set_mode ( | |||
185 | } | 189 | } |
186 | 190 | ||
187 | 191 | ||
188 | /****************************************************************************** | 192 | /******************************************************************************* |
189 | * | 193 | * |
190 | * FUNCTION: acpi_hw_get_mode | 194 | * FUNCTION: acpi_hw_get_mode |
191 | * | 195 | * |
@@ -199,7 +203,8 @@ acpi_hw_set_mode ( | |||
199 | ******************************************************************************/ | 203 | ******************************************************************************/ |
200 | 204 | ||
201 | u32 | 205 | u32 |
202 | acpi_hw_get_mode (void) | 206 | acpi_hw_get_mode ( |
207 | void) | ||
203 | { | 208 | { |
204 | acpi_status status; | 209 | acpi_status status; |
205 | u32 value; | 210 | u32 value; |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 9ac1d639bf51..8daeabb2fc7a 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -48,6 +48,13 @@ | |||
48 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
49 | ACPI_MODULE_NAME ("hwgpe") | 49 | ACPI_MODULE_NAME ("hwgpe") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | |||
53 | static acpi_status | ||
54 | acpi_hw_enable_wakeup_gpe_block ( | ||
55 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
56 | struct acpi_gpe_block_info *gpe_block); | ||
57 | |||
51 | 58 | ||
52 | /****************************************************************************** | 59 | /****************************************************************************** |
53 | * | 60 | * |
@@ -135,6 +142,7 @@ acpi_hw_clear_gpe ( | |||
135 | * DESCRIPTION: Return the status of a single GPE. | 142 | * DESCRIPTION: Return the status of a single GPE. |
136 | * | 143 | * |
137 | ******************************************************************************/ | 144 | ******************************************************************************/ |
145 | |||
138 | #ifdef ACPI_FUTURE_USAGE | 146 | #ifdef ACPI_FUTURE_USAGE |
139 | acpi_status | 147 | acpi_status |
140 | acpi_hw_get_gpe_status ( | 148 | acpi_hw_get_gpe_status ( |
@@ -206,7 +214,7 @@ unlock_and_exit: | |||
206 | * | 214 | * |
207 | * RETURN: Status | 215 | * RETURN: Status |
208 | * | 216 | * |
209 | * DESCRIPTION: Disable all GPEs within a GPE block | 217 | * DESCRIPTION: Disable all GPEs within a single GPE block |
210 | * | 218 | * |
211 | ******************************************************************************/ | 219 | ******************************************************************************/ |
212 | 220 | ||
@@ -244,7 +252,7 @@ acpi_hw_disable_gpe_block ( | |||
244 | * | 252 | * |
245 | * RETURN: Status | 253 | * RETURN: Status |
246 | * | 254 | * |
247 | * DESCRIPTION: Clear status bits for all GPEs within a GPE block | 255 | * DESCRIPTION: Clear status bits for all GPEs within a single GPE block |
248 | * | 256 | * |
249 | ******************************************************************************/ | 257 | ******************************************************************************/ |
250 | 258 | ||
@@ -282,8 +290,8 @@ acpi_hw_clear_gpe_block ( | |||
282 | * | 290 | * |
283 | * RETURN: Status | 291 | * RETURN: Status |
284 | * | 292 | * |
285 | * DESCRIPTION: Enable all "runtime" GPEs within a GPE block. (Includes | 293 | * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes |
286 | * combination wake/run GPEs.) | 294 | * combination wake/run GPEs. |
287 | * | 295 | * |
288 | ******************************************************************************/ | 296 | ******************************************************************************/ |
289 | 297 | ||
@@ -327,12 +335,12 @@ acpi_hw_enable_runtime_gpe_block ( | |||
327 | * | 335 | * |
328 | * RETURN: Status | 336 | * RETURN: Status |
329 | * | 337 | * |
330 | * DESCRIPTION: Enable all "wake" GPEs within a GPE block. (Includes | 338 | * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes |
331 | * combination wake/run GPEs.) | 339 | * combination wake/run GPEs. |
332 | * | 340 | * |
333 | ******************************************************************************/ | 341 | ******************************************************************************/ |
334 | 342 | ||
335 | acpi_status | 343 | static acpi_status |
336 | acpi_hw_enable_wakeup_gpe_block ( | 344 | acpi_hw_enable_wakeup_gpe_block ( |
337 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 345 | struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
338 | struct acpi_gpe_block_info *gpe_block) | 346 | struct acpi_gpe_block_info *gpe_block) |
@@ -350,7 +358,8 @@ acpi_hw_enable_wakeup_gpe_block ( | |||
350 | 358 | ||
351 | /* Enable all "wake" GPEs in this register */ | 359 | /* Enable all "wake" GPEs in this register */ |
352 | 360 | ||
353 | status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_wake, | 361 | status = acpi_hw_low_level_write (8, |
362 | gpe_block->register_info[i].enable_for_wake, | ||
354 | &gpe_block->register_info[i].enable_address); | 363 | &gpe_block->register_info[i].enable_address); |
355 | if (ACPI_FAILURE (status)) { | 364 | if (ACPI_FAILURE (status)) { |
356 | return (status); | 365 | return (status); |
@@ -369,7 +378,7 @@ acpi_hw_enable_wakeup_gpe_block ( | |||
369 | * | 378 | * |
370 | * RETURN: Status | 379 | * RETURN: Status |
371 | * | 380 | * |
372 | * DESCRIPTION: Disable and clear all GPEs | 381 | * DESCRIPTION: Disable and clear all GPEs in all GPE blocks |
373 | * | 382 | * |
374 | ******************************************************************************/ | 383 | ******************************************************************************/ |
375 | 384 | ||
@@ -397,7 +406,7 @@ acpi_hw_disable_all_gpes ( | |||
397 | * | 406 | * |
398 | * RETURN: Status | 407 | * RETURN: Status |
399 | * | 408 | * |
400 | * DESCRIPTION: Enable all GPEs of the given type | 409 | * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks |
401 | * | 410 | * |
402 | ******************************************************************************/ | 411 | ******************************************************************************/ |
403 | 412 | ||
@@ -424,7 +433,7 @@ acpi_hw_enable_all_runtime_gpes ( | |||
424 | * | 433 | * |
425 | * RETURN: Status | 434 | * RETURN: Status |
426 | * | 435 | * |
427 | * DESCRIPTION: Enable all GPEs of the given type | 436 | * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks |
428 | * | 437 | * |
429 | ******************************************************************************/ | 438 | ******************************************************************************/ |
430 | 439 | ||
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 91af0c2ddcf7..6d9e4eb84836 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -87,8 +87,9 @@ acpi_hw_clear_acpi_status ( | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, | 90 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
91 | ACPI_BITMASK_ALL_FIXED_STATUS); | 91 | ACPI_REGISTER_PM1_STATUS, |
92 | ACPI_BITMASK_ALL_FIXED_STATUS); | ||
92 | if (ACPI_FAILURE (status)) { | 93 | if (ACPI_FAILURE (status)) { |
93 | goto unlock_and_exit; | 94 | goto unlock_and_exit; |
94 | } | 95 | } |
@@ -138,28 +139,30 @@ acpi_get_sleep_type_data ( | |||
138 | { | 139 | { |
139 | acpi_status status = AE_OK; | 140 | acpi_status status = AE_OK; |
140 | struct acpi_parameter_info info; | 141 | struct acpi_parameter_info info; |
142 | char *sleep_state_name; | ||
141 | 143 | ||
142 | 144 | ||
143 | ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); | 145 | ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); |
144 | 146 | ||
145 | 147 | ||
146 | /* | 148 | /* Validate parameters */ |
147 | * Validate parameters | 149 | |
148 | */ | ||
149 | if ((sleep_state > ACPI_S_STATES_MAX) || | 150 | if ((sleep_state > ACPI_S_STATES_MAX) || |
150 | !sleep_type_a || !sleep_type_b) { | 151 | !sleep_type_a || !sleep_type_b) { |
151 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 152 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
152 | } | 153 | } |
153 | 154 | ||
154 | /* | 155 | /* Evaluate the namespace object containing the values for this state */ |
155 | * Evaluate the namespace object containing the values for this state | 156 | |
156 | */ | ||
157 | info.parameters = NULL; | 157 | info.parameters = NULL; |
158 | status = acpi_ns_evaluate_by_name ((char *) acpi_gbl_sleep_state_names[sleep_state], | 158 | info.return_object = NULL; |
159 | &info); | 159 | sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state]; |
160 | |||
161 | status = acpi_ns_evaluate_by_name (sleep_state_name, &info); | ||
160 | if (ACPI_FAILURE (status)) { | 162 | if (ACPI_FAILURE (status)) { |
161 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating sleep_state [%s]\n", | 163 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
162 | acpi_format_exception (status), acpi_gbl_sleep_state_names[sleep_state])); | 164 | "%s while evaluating sleep_state [%s]\n", |
165 | acpi_format_exception (status), sleep_state_name)); | ||
163 | 166 | ||
164 | return_ACPI_STATUS (status); | 167 | return_ACPI_STATUS (status); |
165 | } | 168 | } |
@@ -167,45 +170,57 @@ acpi_get_sleep_type_data ( | |||
167 | /* Must have a return object */ | 170 | /* Must have a return object */ |
168 | 171 | ||
169 | if (!info.return_object) { | 172 | if (!info.return_object) { |
170 | ACPI_REPORT_ERROR (("Missing Sleep State object\n")); | 173 | ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n", |
174 | sleep_state_name)); | ||
171 | status = AE_NOT_EXIST; | 175 | status = AE_NOT_EXIST; |
172 | } | 176 | } |
173 | 177 | ||
174 | /* It must be of type Package */ | 178 | /* It must be of type Package */ |
175 | 179 | ||
176 | else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { | 180 | else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { |
177 | ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); | 181 | ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n")); |
178 | status = AE_AML_OPERAND_TYPE; | 182 | status = AE_AML_OPERAND_TYPE; |
179 | } | 183 | } |
180 | 184 | ||
181 | /* The package must have at least two elements */ | 185 | /* |
182 | 186 | * The package must have at least two elements. NOTE (March 2005): This | |
187 | * goes against the current ACPI spec which defines this object as a | ||
188 | * package with one encoded DWORD element. However, existing practice | ||
189 | * by BIOS vendors seems to be to have 2 or more elements, at least | ||
190 | * one per sleep type (A/B). | ||
191 | */ | ||
183 | else if (info.return_object->package.count < 2) { | 192 | else if (info.return_object->package.count < 2) { |
184 | ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); | 193 | ACPI_REPORT_ERROR (( |
194 | "Sleep State return package does not have at least two elements\n")); | ||
185 | status = AE_AML_NO_OPERAND; | 195 | status = AE_AML_NO_OPERAND; |
186 | } | 196 | } |
187 | 197 | ||
188 | /* The first two elements must both be of type Integer */ | 198 | /* The first two elements must both be of type Integer */ |
189 | 199 | ||
190 | else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) != ACPI_TYPE_INTEGER) || | 200 | else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) |
191 | (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { | 201 | != ACPI_TYPE_INTEGER) || |
192 | ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", | 202 | (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) |
203 | != ACPI_TYPE_INTEGER)) { | ||
204 | ACPI_REPORT_ERROR (( | ||
205 | "Sleep State return package elements are not both Integers (%s, %s)\n", | ||
193 | acpi_ut_get_object_type_name (info.return_object->package.elements[0]), | 206 | acpi_ut_get_object_type_name (info.return_object->package.elements[0]), |
194 | acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); | 207 | acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); |
195 | status = AE_AML_OPERAND_TYPE; | 208 | status = AE_AML_OPERAND_TYPE; |
196 | } | 209 | } |
197 | else { | 210 | else { |
198 | /* | 211 | /* Valid _Sx_ package size, type, and value */ |
199 | * Valid _Sx_ package size, type, and value | 212 | |
200 | */ | 213 | *sleep_type_a = (u8) |
201 | *sleep_type_a = (u8) (info.return_object->package.elements[0])->integer.value; | 214 | (info.return_object->package.elements[0])->integer.value; |
202 | *sleep_type_b = (u8) (info.return_object->package.elements[1])->integer.value; | 215 | *sleep_type_b = (u8) |
216 | (info.return_object->package.elements[1])->integer.value; | ||
203 | } | 217 | } |
204 | 218 | ||
205 | if (ACPI_FAILURE (status)) { | 219 | if (ACPI_FAILURE (status)) { |
206 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 220 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
207 | "While evaluating sleep_state [%s], bad Sleep object %p type %s\n", | 221 | "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", |
208 | acpi_gbl_sleep_state_names[sleep_state], info.return_object, | 222 | acpi_format_exception (status), |
223 | sleep_state_name, info.return_object, | ||
209 | acpi_ut_get_object_type_name (info.return_object))); | 224 | acpi_ut_get_object_type_name (info.return_object))); |
210 | } | 225 | } |
211 | 226 | ||
@@ -221,9 +236,9 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); | |||
221 | * | 236 | * |
222 | * PARAMETERS: register_id - Index of ACPI Register to access | 237 | * PARAMETERS: register_id - Index of ACPI Register to access |
223 | * | 238 | * |
224 | * RETURN: The bit mask to be used when accessing the register | 239 | * RETURN: The bitmask to be used when accessing the register |
225 | * | 240 | * |
226 | * DESCRIPTION: Map register_id into a register bit mask. | 241 | * DESCRIPTION: Map register_id into a register bitmask. |
227 | * | 242 | * |
228 | ******************************************************************************/ | 243 | ******************************************************************************/ |
229 | 244 | ||
@@ -359,7 +374,7 @@ acpi_set_register ( | |||
359 | /* Always do a register read first so we can insert the new bits */ | 374 | /* Always do a register read first so we can insert the new bits */ |
360 | 375 | ||
361 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, | 376 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, |
362 | bit_reg_info->parent_register, ®ister_value); | 377 | bit_reg_info->parent_register, ®ister_value); |
363 | if (ACPI_FAILURE (status)) { | 378 | if (ACPI_FAILURE (status)) { |
364 | goto unlock_and_exit; | 379 | goto unlock_and_exit; |
365 | } | 380 | } |
@@ -396,7 +411,7 @@ acpi_set_register ( | |||
396 | bit_reg_info->access_bit_mask, value); | 411 | bit_reg_info->access_bit_mask, value); |
397 | 412 | ||
398 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 413 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
399 | ACPI_REGISTER_PM1_ENABLE, (u16) register_value); | 414 | ACPI_REGISTER_PM1_ENABLE, (u16) register_value); |
400 | break; | 415 | break; |
401 | 416 | ||
402 | 417 | ||
@@ -413,7 +428,7 @@ acpi_set_register ( | |||
413 | bit_reg_info->access_bit_mask, value); | 428 | bit_reg_info->access_bit_mask, value); |
414 | 429 | ||
415 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 430 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
416 | ACPI_REGISTER_PM1_CONTROL, (u16) register_value); | 431 | ACPI_REGISTER_PM1_CONTROL, (u16) register_value); |
417 | break; | 432 | break; |
418 | 433 | ||
419 | 434 | ||
@@ -427,17 +442,19 @@ acpi_set_register ( | |||
427 | 442 | ||
428 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", | 443 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", |
429 | register_value, | 444 | register_value, |
430 | ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); | 445 | ACPI_FORMAT_UINT64 ( |
446 | acpi_gbl_FADT->xpm2_cnt_blk.address))); | ||
431 | 447 | ||
432 | ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, | 448 | ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, |
433 | bit_reg_info->access_bit_mask, value); | 449 | bit_reg_info->access_bit_mask, value); |
434 | 450 | ||
435 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", | 451 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", |
436 | register_value, | 452 | register_value, |
437 | ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); | 453 | ACPI_FORMAT_UINT64 ( |
454 | acpi_gbl_FADT->xpm2_cnt_blk.address))); | ||
438 | 455 | ||
439 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, | 456 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
440 | ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); | 457 | ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); |
441 | break; | 458 | break; |
442 | 459 | ||
443 | 460 | ||
@@ -454,7 +471,9 @@ unlock_and_exit: | |||
454 | 471 | ||
455 | /* Normalize the value that was read */ | 472 | /* Normalize the value that was read */ |
456 | 473 | ||
457 | ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position)); | 474 | ACPI_DEBUG_EXEC (register_value = |
475 | ((register_value & bit_reg_info->access_bit_mask) >> | ||
476 | bit_reg_info->bit_position)); | ||
458 | 477 | ||
459 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", | 478 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", |
460 | value, register_value, bit_reg_info->parent_register)); | 479 | value, register_value, bit_reg_info->parent_register)); |
@@ -469,7 +488,7 @@ EXPORT_SYMBOL(acpi_set_register); | |||
469 | * | 488 | * |
470 | * PARAMETERS: use_lock - Mutex hw access | 489 | * PARAMETERS: use_lock - Mutex hw access |
471 | * register_id - register_iD + Offset | 490 | * register_id - register_iD + Offset |
472 | * return_value - Value that was read from the register | 491 | * return_value - Where the register value is returned |
473 | * | 492 | * |
474 | * RETURN: Status and the value read. | 493 | * RETURN: Status and the value read. |
475 | * | 494 | * |
@@ -557,7 +576,8 @@ acpi_hw_register_read ( | |||
557 | break; | 576 | break; |
558 | 577 | ||
559 | default: | 578 | default: |
560 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", register_id)); | 579 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", |
580 | register_id)); | ||
561 | status = AE_BAD_PARAMETER; | 581 | status = AE_BAD_PARAMETER; |
562 | break; | 582 | break; |
563 | } | 583 | } |
@@ -763,10 +783,11 @@ acpi_hw_low_level_read ( | |||
763 | return (AE_BAD_PARAMETER); | 783 | return (AE_BAD_PARAMETER); |
764 | } | 784 | } |
765 | 785 | ||
766 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", | 786 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, |
767 | *value, width, | 787 | "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", |
768 | ACPI_FORMAT_UINT64 (address), | 788 | *value, width, |
769 | acpi_ut_get_region_name (reg->address_space_id))); | 789 | ACPI_FORMAT_UINT64 (address), |
790 | acpi_ut_get_region_name (reg->address_space_id))); | ||
770 | 791 | ||
771 | return (status); | 792 | return (status); |
772 | } | 793 | } |
@@ -841,10 +862,11 @@ acpi_hw_low_level_write ( | |||
841 | return (AE_BAD_PARAMETER); | 862 | return (AE_BAD_PARAMETER); |
842 | } | 863 | } |
843 | 864 | ||
844 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", | 865 | ACPI_DEBUG_PRINT ((ACPI_DB_IO, |
845 | value, width, | 866 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", |
846 | ACPI_FORMAT_UINT64 (address), | 867 | value, width, |
847 | acpi_ut_get_region_name (reg->address_space_id))); | 868 | ACPI_FORMAT_UINT64 (address), |
869 | acpi_ut_get_region_name (reg->address_space_id))); | ||
848 | 870 | ||
849 | return (status); | 871 | return (status); |
850 | } | 872 | } |
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 77b3e9a8550b..415d342aeab5 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -43,27 +43,13 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | |||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
50 | ACPI_MODULE_NAME ("hwsleep") | 49 | ACPI_MODULE_NAME ("hwsleep") |
51 | 50 | ||
52 | 51 | ||
53 | #define METHOD_NAME__BFS "\\_BFS" | 52 | /******************************************************************************* |
54 | #define METHOD_NAME__GTS "\\_GTS" | ||
55 | #define METHOD_NAME__PTS "\\_PTS" | ||
56 | #define METHOD_NAME__SST "\\_SI._SST" | ||
57 | #define METHOD_NAME__WAK "\\_WAK" | ||
58 | |||
59 | #define ACPI_SST_INDICATOR_OFF 0 | ||
60 | #define ACPI_SST_WORKING 1 | ||
61 | #define ACPI_SST_WAKING 2 | ||
62 | #define ACPI_SST_SLEEPING 3 | ||
63 | #define ACPI_SST_SLEEP_CONTEXT 4 | ||
64 | |||
65 | |||
66 | /****************************************************************************** | ||
67 | * | 53 | * |
68 | * FUNCTION: acpi_set_firmware_waking_vector | 54 | * FUNCTION: acpi_set_firmware_waking_vector |
69 | * | 55 | * |
@@ -72,7 +58,7 @@ | |||
72 | * | 58 | * |
73 | * RETURN: Status | 59 | * RETURN: Status |
74 | * | 60 | * |
75 | * DESCRIPTION: access function for d_firmware_waking_vector field in FACS | 61 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS |
76 | * | 62 | * |
77 | ******************************************************************************/ | 63 | ******************************************************************************/ |
78 | 64 | ||
@@ -99,19 +85,20 @@ acpi_set_firmware_waking_vector ( | |||
99 | } | 85 | } |
100 | 86 | ||
101 | 87 | ||
102 | /****************************************************************************** | 88 | /******************************************************************************* |
103 | * | 89 | * |
104 | * FUNCTION: acpi_get_firmware_waking_vector | 90 | * FUNCTION: acpi_get_firmware_waking_vector |
105 | * | 91 | * |
106 | * PARAMETERS: *physical_address - Output buffer where contents of | 92 | * PARAMETERS: *physical_address - Where the contents of |
107 | * the firmware_waking_vector field of | 93 | * the firmware_waking_vector field of |
108 | * the FACS will be stored. | 94 | * the FACS will be returned. |
109 | * | 95 | * |
110 | * RETURN: Status | 96 | * RETURN: Status, vector |
111 | * | 97 | * |
112 | * DESCRIPTION: Access function for firmware_waking_vector field in FACS | 98 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS |
113 | * | 99 | * |
114 | ******************************************************************************/ | 100 | ******************************************************************************/ |
101 | |||
115 | #ifdef ACPI_FUTURE_USAGE | 102 | #ifdef ACPI_FUTURE_USAGE |
116 | acpi_status | 103 | acpi_status |
117 | acpi_get_firmware_waking_vector ( | 104 | acpi_get_firmware_waking_vector ( |
@@ -141,7 +128,7 @@ acpi_get_firmware_waking_vector ( | |||
141 | #endif | 128 | #endif |
142 | 129 | ||
143 | 130 | ||
144 | /****************************************************************************** | 131 | /******************************************************************************* |
145 | * | 132 | * |
146 | * FUNCTION: acpi_enter_sleep_state_prep | 133 | * FUNCTION: acpi_enter_sleep_state_prep |
147 | * | 134 | * |
@@ -215,7 +202,7 @@ acpi_enter_sleep_state_prep ( | |||
215 | break; | 202 | break; |
216 | 203 | ||
217 | default: | 204 | default: |
218 | arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */ | 205 | arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */ |
219 | break; | 206 | break; |
220 | } | 207 | } |
221 | 208 | ||
@@ -223,14 +210,15 @@ acpi_enter_sleep_state_prep ( | |||
223 | 210 | ||
224 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); | 211 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); |
225 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 212 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
226 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); | 213 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", |
214 | acpi_format_exception (status))); | ||
227 | } | 215 | } |
228 | 216 | ||
229 | return_ACPI_STATUS (AE_OK); | 217 | return_ACPI_STATUS (AE_OK); |
230 | } | 218 | } |
231 | 219 | ||
232 | 220 | ||
233 | /****************************************************************************** | 221 | /******************************************************************************* |
234 | * | 222 | * |
235 | * FUNCTION: acpi_enter_sleep_state | 223 | * FUNCTION: acpi_enter_sleep_state |
236 | * | 224 | * |
@@ -299,15 +287,18 @@ acpi_enter_sleep_state ( | |||
299 | 287 | ||
300 | /* Get current value of PM1A control */ | 288 | /* Get current value of PM1A control */ |
301 | 289 | ||
302 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); | 290 | status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, |
291 | ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); | ||
303 | if (ACPI_FAILURE (status)) { | 292 | if (ACPI_FAILURE (status)) { |
304 | return_ACPI_STATUS (status); | 293 | return_ACPI_STATUS (status); |
305 | } | 294 | } |
306 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", sleep_state)); | 295 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, |
296 | "Entering sleep state [S%d]\n", sleep_state)); | ||
307 | 297 | ||
308 | /* Clear SLP_EN and SLP_TYP fields */ | 298 | /* Clear SLP_EN and SLP_TYP fields */ |
309 | 299 | ||
310 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | sleep_enable_reg_info->access_bit_mask); | 300 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | |
301 | sleep_enable_reg_info->access_bit_mask); | ||
311 | PM1Bcontrol = PM1Acontrol; | 302 | PM1Bcontrol = PM1Acontrol; |
312 | 303 | ||
313 | /* Insert SLP_TYP bits */ | 304 | /* Insert SLP_TYP bits */ |
@@ -322,12 +313,14 @@ acpi_enter_sleep_state ( | |||
322 | 313 | ||
323 | /* Write #1: fill in SLP_TYP data */ | 314 | /* Write #1: fill in SLP_TYP data */ |
324 | 315 | ||
325 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | 316 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
317 | ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | ||
326 | if (ACPI_FAILURE (status)) { | 318 | if (ACPI_FAILURE (status)) { |
327 | return_ACPI_STATUS (status); | 319 | return_ACPI_STATUS (status); |
328 | } | 320 | } |
329 | 321 | ||
330 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | 322 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
323 | ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | ||
331 | if (ACPI_FAILURE (status)) { | 324 | if (ACPI_FAILURE (status)) { |
332 | return_ACPI_STATUS (status); | 325 | return_ACPI_STATUS (status); |
333 | } | 326 | } |
@@ -341,22 +334,25 @@ acpi_enter_sleep_state ( | |||
341 | 334 | ||
342 | ACPI_FLUSH_CPU_CACHE (); | 335 | ACPI_FLUSH_CPU_CACHE (); |
343 | 336 | ||
344 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | 337 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
338 | ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); | ||
345 | if (ACPI_FAILURE (status)) { | 339 | if (ACPI_FAILURE (status)) { |
346 | return_ACPI_STATUS (status); | 340 | return_ACPI_STATUS (status); |
347 | } | 341 | } |
348 | 342 | ||
349 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | 343 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
344 | ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); | ||
350 | if (ACPI_FAILURE (status)) { | 345 | if (ACPI_FAILURE (status)) { |
351 | return_ACPI_STATUS (status); | 346 | return_ACPI_STATUS (status); |
352 | } | 347 | } |
353 | 348 | ||
354 | if (sleep_state > ACPI_STATE_S3) { | 349 | if (sleep_state > ACPI_STATE_S3) { |
355 | /* | 350 | /* |
356 | * We wanted to sleep > S3, but it didn't happen (by virtue of the fact that | 351 | * We wanted to sleep > S3, but it didn't happen (by virtue of the |
357 | * we are still executing!) | 352 | * fact that we are still executing!) |
358 | * | 353 | * |
359 | * Wait ten seconds, then try again. This is to get S4/S5 to work on all machines. | 354 | * Wait ten seconds, then try again. This is to get S4/S5 to work on |
355 | * all machines. | ||
360 | * | 356 | * |
361 | * We wait so long to allow chipsets that poll this reg very slowly to | 357 | * We wait so long to allow chipsets that poll this reg very slowly to |
362 | * still read the right value. Ideally, this block would go | 358 | * still read the right value. Ideally, this block would go |
@@ -364,7 +360,8 @@ acpi_enter_sleep_state ( | |||
364 | */ | 360 | */ |
365 | acpi_os_stall (10000000); | 361 | acpi_os_stall (10000000); |
366 | 362 | ||
367 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, | 363 | status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, |
364 | ACPI_REGISTER_PM1_CONTROL, | ||
368 | sleep_enable_reg_info->access_bit_mask); | 365 | sleep_enable_reg_info->access_bit_mask); |
369 | if (ACPI_FAILURE (status)) { | 366 | if (ACPI_FAILURE (status)) { |
370 | return_ACPI_STATUS (status); | 367 | return_ACPI_STATUS (status); |
@@ -374,7 +371,8 @@ acpi_enter_sleep_state ( | |||
374 | /* Wait until we enter sleep state */ | 371 | /* Wait until we enter sleep state */ |
375 | 372 | ||
376 | do { | 373 | do { |
377 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); | 374 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, |
375 | ACPI_MTX_DO_NOT_LOCK); | ||
378 | if (ACPI_FAILURE (status)) { | 376 | if (ACPI_FAILURE (status)) { |
379 | return_ACPI_STATUS (status); | 377 | return_ACPI_STATUS (status); |
380 | } | 378 | } |
@@ -388,7 +386,7 @@ acpi_enter_sleep_state ( | |||
388 | EXPORT_SYMBOL(acpi_enter_sleep_state); | 386 | EXPORT_SYMBOL(acpi_enter_sleep_state); |
389 | 387 | ||
390 | 388 | ||
391 | /****************************************************************************** | 389 | /******************************************************************************* |
392 | * | 390 | * |
393 | * FUNCTION: acpi_enter_sleep_state_s4bios | 391 | * FUNCTION: acpi_enter_sleep_state_s4bios |
394 | * | 392 | * |
@@ -439,11 +437,13 @@ acpi_enter_sleep_state_s4bios ( | |||
439 | 437 | ||
440 | ACPI_FLUSH_CPU_CACHE (); | 438 | ACPI_FLUSH_CPU_CACHE (); |
441 | 439 | ||
442 | status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (u32) acpi_gbl_FADT->S4bios_req, 8); | 440 | status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, |
441 | (u32) acpi_gbl_FADT->S4bios_req, 8); | ||
443 | 442 | ||
444 | do { | 443 | do { |
445 | acpi_os_stall(1000); | 444 | acpi_os_stall(1000); |
446 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); | 445 | status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, |
446 | ACPI_MTX_DO_NOT_LOCK); | ||
447 | if (ACPI_FAILURE (status)) { | 447 | if (ACPI_FAILURE (status)) { |
448 | return_ACPI_STATUS (status); | 448 | return_ACPI_STATUS (status); |
449 | } | 449 | } |
@@ -454,7 +454,7 @@ acpi_enter_sleep_state_s4bios ( | |||
454 | EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | 454 | EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); |
455 | 455 | ||
456 | 456 | ||
457 | /****************************************************************************** | 457 | /******************************************************************************* |
458 | * | 458 | * |
459 | * FUNCTION: acpi_leave_sleep_state | 459 | * FUNCTION: acpi_leave_sleep_state |
460 | * | 460 | * |
@@ -534,18 +534,21 @@ acpi_leave_sleep_state ( | |||
534 | arg.integer.value = ACPI_SST_WAKING; | 534 | arg.integer.value = ACPI_SST_WAKING; |
535 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); | 535 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); |
536 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 536 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
537 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); | 537 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", |
538 | acpi_format_exception (status))); | ||
538 | } | 539 | } |
539 | 540 | ||
540 | arg.integer.value = sleep_state; | 541 | arg.integer.value = sleep_state; |
541 | status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); | 542 | status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); |
542 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 543 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
543 | ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", acpi_format_exception (status))); | 544 | ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", |
545 | acpi_format_exception (status))); | ||
544 | } | 546 | } |
545 | 547 | ||
546 | status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); | 548 | status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); |
547 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 549 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
548 | ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", acpi_format_exception (status))); | 550 | ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", |
551 | acpi_format_exception (status))); | ||
549 | } | 552 | } |
550 | /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ | 553 | /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ |
551 | 554 | ||
@@ -567,15 +570,19 @@ acpi_leave_sleep_state ( | |||
567 | 570 | ||
568 | /* Enable power button */ | 571 | /* Enable power button */ |
569 | 572 | ||
570 | (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, | 573 | (void) acpi_set_register( |
574 | acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, | ||
571 | 1, ACPI_MTX_DO_NOT_LOCK); | 575 | 1, ACPI_MTX_DO_NOT_LOCK); |
572 | (void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, | 576 | |
577 | (void) acpi_set_register( | ||
578 | acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id, | ||
573 | 1, ACPI_MTX_DO_NOT_LOCK); | 579 | 1, ACPI_MTX_DO_NOT_LOCK); |
574 | 580 | ||
575 | arg.integer.value = ACPI_SST_WORKING; | 581 | arg.integer.value = ACPI_SST_WORKING; |
576 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); | 582 | status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); |
577 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { | 583 | if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { |
578 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); | 584 | ACPI_REPORT_ERROR (("Method _SST failed, %s\n", |
585 | acpi_format_exception (status))); | ||
579 | } | 586 | } |
580 | 587 | ||
581 | return_ACPI_STATUS (status); | 588 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index 1906167d7294..49d7b395322e 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c | |||
@@ -43,7 +43,6 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | |||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
@@ -90,7 +89,7 @@ acpi_get_timer_resolution ( | |||
90 | * | 89 | * |
91 | * PARAMETERS: Ticks - Where the timer value is returned | 90 | * PARAMETERS: Ticks - Where the timer value is returned |
92 | * | 91 | * |
93 | * RETURN: Status and current ticks | 92 | * RETURN: Status and current timer value (ticks) |
94 | * | 93 | * |
95 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). | 94 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). |
96 | * | 95 | * |
@@ -199,5 +198,6 @@ acpi_get_timer_duration ( | |||
199 | *time_elapsed = (u32) quotient; | 198 | *time_elapsed = (u32) quotient; |
200 | return_ACPI_STATUS (status); | 199 | return_ACPI_STATUS (status); |
201 | } | 200 | } |
201 | |||
202 | EXPORT_SYMBOL(acpi_get_timer_duration); | 202 | EXPORT_SYMBOL(acpi_get_timer_duration); |
203 | 203 | ||
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c new file mode 100644 index 000000000000..1f76a40badec --- /dev/null +++ b/drivers/acpi/hotkey.c | |||
@@ -0,0 +1,1115 @@ | |||
1 | /* | ||
2 | * hotkey.c - ACPI Hotkey Driver ($Revision: 0.2 $) | ||
3 | * | ||
4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> | ||
5 | * | ||
6 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or (at | ||
11 | * your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along | ||
19 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
21 | * | ||
22 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
23 | */ | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/proc_fs.h> | ||
29 | #include <linux/sched.h> | ||
30 | #include <linux/kmod.h> | ||
31 | #include <linux/seq_file.h> | ||
32 | #include <acpi/acpi_drivers.h> | ||
33 | #include <acpi/acpi_bus.h> | ||
34 | #include <asm/uaccess.h> | ||
35 | |||
36 | #define HOTKEY_ACPI_VERSION "0.1" | ||
37 | |||
38 | #define HOTKEY_PROC "hotkey" | ||
39 | #define HOTKEY_EV_CONFIG "event_config" | ||
40 | #define HOTKEY_PL_CONFIG "poll_config" | ||
41 | #define HOTKEY_ACTION "action" | ||
42 | #define HOTKEY_INFO "info" | ||
43 | |||
44 | #define ACPI_HOTK_NAME "Generic Hotkey Driver" | ||
45 | #define ACPI_HOTK_CLASS "Hotkey" | ||
46 | #define ACPI_HOTK_DEVICE_NAME "Hotkey" | ||
47 | #define ACPI_HOTK_HID "Unknown?" | ||
48 | #define ACPI_HOTKEY_COMPONENT 0x20000000 | ||
49 | |||
50 | #define ACPI_HOTKEY_EVENT 0x1 | ||
51 | #define ACPI_HOTKEY_POLLING 0x2 | ||
52 | #define ACPI_UNDEFINED_EVENT 0xf | ||
53 | |||
54 | #define RESULT_STR_LEN 80 | ||
55 | |||
56 | #define ACTION_METHOD 0 | ||
57 | #define POLL_METHOD 1 | ||
58 | |||
59 | #define IS_EVENT(e) ((e) <= 10000 && (e) >0) | ||
60 | #define IS_POLL(e) ((e) > 10000) | ||
61 | #define IS_OTHERS(e) ((e)<=0 || (e)>=20000) | ||
62 | #define _COMPONENT ACPI_HOTKEY_COMPONENT | ||
63 | ACPI_MODULE_NAME("acpi_hotkey") | ||
64 | |||
65 | MODULE_AUTHOR("luming.yu@intel.com"); | ||
66 | MODULE_DESCRIPTION(ACPI_HOTK_NAME); | ||
67 | MODULE_LICENSE("GPL"); | ||
68 | |||
69 | /* standardized internal hotkey number/event */ | ||
70 | enum { | ||
71 | /* Video Extension event */ | ||
72 | HK_EVENT_CYCLE_OUTPUT_DEVICE = 0x80, | ||
73 | HK_EVENT_OUTPUT_DEVICE_STATUS_CHANGE, | ||
74 | HK_EVENT_CYCLE_DISPLAY_OUTPUT, | ||
75 | HK_EVENT_NEXT_DISPLAY_OUTPUT, | ||
76 | HK_EVENT_PREVIOUS_DISPLAY_OUTPUT, | ||
77 | HK_EVENT_CYCLE_BRIGHTNESS, | ||
78 | HK_EVENT_INCREASE_BRIGHTNESS, | ||
79 | HK_EVENT_DECREASE_BRIGHTNESS, | ||
80 | HK_EVENT_ZERO_BRIGHTNESS, | ||
81 | HK_EVENT_DISPLAY_DEVICE_OFF, | ||
82 | |||
83 | /* Snd Card event */ | ||
84 | HK_EVENT_VOLUME_MUTE, | ||
85 | HK_EVENT_VOLUME_INCLREASE, | ||
86 | HK_EVENT_VOLUME_DECREASE, | ||
87 | |||
88 | /* running state control */ | ||
89 | HK_EVENT_ENTERRING_S3, | ||
90 | HK_EVENT_ENTERRING_S4, | ||
91 | HK_EVENT_ENTERRING_S5, | ||
92 | }; | ||
93 | |||
94 | /* procdir we use */ | ||
95 | static struct proc_dir_entry *hotkey_proc_dir; | ||
96 | static struct proc_dir_entry *hotkey_config; | ||
97 | static struct proc_dir_entry *hotkey_poll_config; | ||
98 | static struct proc_dir_entry *hotkey_action; | ||
99 | static struct proc_dir_entry *hotkey_info; | ||
100 | |||
101 | /* linkage for all type of hotkey */ | ||
102 | struct acpi_hotkey_link { | ||
103 | struct list_head entries; | ||
104 | int hotkey_type; /* event or polling based hotkey */ | ||
105 | int hotkey_standard_num; /* standardized hotkey(event) number */ | ||
106 | }; | ||
107 | |||
108 | /* event based hotkey */ | ||
109 | struct acpi_event_hotkey { | ||
110 | struct acpi_hotkey_link hotkey_link; | ||
111 | int flag; | ||
112 | acpi_handle bus_handle; /* bus to install notify handler */ | ||
113 | int external_hotkey_num; /* external hotkey/event number */ | ||
114 | acpi_handle action_handle; /* acpi handle attached aml action method */ | ||
115 | char *action_method; /* action method */ | ||
116 | }; | ||
117 | |||
118 | /* | ||
119 | * There are two ways to poll status | ||
120 | * 1. directy call read_xxx method, without any arguments passed in | ||
121 | * 2. call write_xxx method, with arguments passed in, you need | ||
122 | * the result is saved in acpi_polling_hotkey.poll_result. | ||
123 | * anthoer read command through polling interface. | ||
124 | * | ||
125 | */ | ||
126 | |||
127 | /* polling based hotkey */ | ||
128 | struct acpi_polling_hotkey { | ||
129 | struct acpi_hotkey_link hotkey_link; | ||
130 | int flag; | ||
131 | acpi_handle poll_handle; /* acpi handle attached polling method */ | ||
132 | char *poll_method; /* poll method */ | ||
133 | acpi_handle action_handle; /* acpi handle attached action method */ | ||
134 | char *action_method; /* action method */ | ||
135 | union acpi_object *poll_result; /* polling_result */ | ||
136 | struct proc_dir_entry *proc; | ||
137 | }; | ||
138 | |||
139 | /* hotkey object union */ | ||
140 | union acpi_hotkey { | ||
141 | struct list_head entries; | ||
142 | struct acpi_hotkey_link link; | ||
143 | struct acpi_event_hotkey event_hotkey; | ||
144 | struct acpi_polling_hotkey poll_hotkey; | ||
145 | }; | ||
146 | |||
147 | /* hotkey object list */ | ||
148 | struct acpi_hotkey_list { | ||
149 | struct list_head *entries; | ||
150 | int count; | ||
151 | }; | ||
152 | |||
153 | static int auto_hotkey_add(struct acpi_device *device); | ||
154 | static int auto_hotkey_remove(struct acpi_device *device, int type); | ||
155 | |||
156 | static struct acpi_driver hotkey_driver = { | ||
157 | .name = ACPI_HOTK_NAME, | ||
158 | .class = ACPI_HOTK_CLASS, | ||
159 | .ids = ACPI_HOTK_HID, | ||
160 | .ops = { | ||
161 | .add = auto_hotkey_add, | ||
162 | .remove = auto_hotkey_remove, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | static void free_hotkey_device(union acpi_hotkey *key); | ||
167 | static void free_hotkey_buffer(union acpi_hotkey *key); | ||
168 | static void free_poll_hotkey_buffer(union acpi_hotkey *key); | ||
169 | static int hotkey_open_config(struct inode *inode, struct file *file); | ||
170 | static int hotkey_poll_open_config(struct inode *inode, struct file *file); | ||
171 | static ssize_t hotkey_write_config(struct file *file, | ||
172 | const char __user * buffer, | ||
173 | size_t count, loff_t * data); | ||
174 | static int hotkey_info_open_fs(struct inode *inode, struct file *file); | ||
175 | static int hotkey_action_open_fs(struct inode *inode, struct file *file); | ||
176 | static ssize_t hotkey_execute_aml_method(struct file *file, | ||
177 | const char __user * buffer, | ||
178 | size_t count, loff_t * data); | ||
179 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset); | ||
180 | static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset); | ||
181 | static int hotkey_polling_open_fs(struct inode *inode, struct file *file); | ||
182 | static union acpi_hotkey *get_hotkey_by_event(struct | ||
183 | acpi_hotkey_list | ||
184 | *hotkey_list, int event); | ||
185 | |||
186 | /* event based config */ | ||
187 | static struct file_operations hotkey_config_fops = { | ||
188 | .open = hotkey_open_config, | ||
189 | .read = seq_read, | ||
190 | .write = hotkey_write_config, | ||
191 | .llseek = seq_lseek, | ||
192 | .release = single_release, | ||
193 | }; | ||
194 | |||
195 | /* polling based config */ | ||
196 | static struct file_operations hotkey_poll_config_fops = { | ||
197 | .open = hotkey_poll_open_config, | ||
198 | .read = seq_read, | ||
199 | .write = hotkey_write_config, | ||
200 | .llseek = seq_lseek, | ||
201 | .release = single_release, | ||
202 | }; | ||
203 | |||
204 | /* hotkey driver info */ | ||
205 | static struct file_operations hotkey_info_fops = { | ||
206 | .open = hotkey_info_open_fs, | ||
207 | .read = seq_read, | ||
208 | .llseek = seq_lseek, | ||
209 | .release = single_release, | ||
210 | }; | ||
211 | |||
212 | /* action */ | ||
213 | static struct file_operations hotkey_action_fops = { | ||
214 | .open = hotkey_action_open_fs, | ||
215 | .read = seq_read, | ||
216 | .write = hotkey_execute_aml_method, | ||
217 | .llseek = seq_lseek, | ||
218 | .release = single_release, | ||
219 | }; | ||
220 | |||
221 | /* polling results */ | ||
222 | static struct file_operations hotkey_polling_fops = { | ||
223 | .open = hotkey_polling_open_fs, | ||
224 | .read = seq_read, | ||
225 | .llseek = seq_lseek, | ||
226 | .release = single_release, | ||
227 | }; | ||
228 | |||
229 | struct acpi_hotkey_list global_hotkey_list; /* link all ev or pl hotkey */ | ||
230 | struct list_head hotkey_entries; /* head of the list of hotkey_list */ | ||
231 | |||
232 | static int hotkey_info_seq_show(struct seq_file *seq, void *offset) | ||
233 | { | ||
234 | ACPI_FUNCTION_TRACE("hotkey_info_seq_show"); | ||
235 | |||
236 | seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION); | ||
237 | |||
238 | return_VALUE(0); | ||
239 | } | ||
240 | |||
241 | static int hotkey_info_open_fs(struct inode *inode, struct file *file) | ||
242 | { | ||
243 | return single_open(file, hotkey_info_seq_show, PDE(inode)->data); | ||
244 | } | ||
245 | |||
246 | static char *format_result(union acpi_object *object) | ||
247 | { | ||
248 | char *buf = NULL; | ||
249 | |||
250 | buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL); | ||
251 | if (buf) | ||
252 | memset(buf, 0, RESULT_STR_LEN); | ||
253 | else | ||
254 | goto do_fail; | ||
255 | |||
256 | /* Now, just support integer type */ | ||
257 | if (object->type == ACPI_TYPE_INTEGER) | ||
258 | sprintf(buf, "%d\n", (u32) object->integer.value); | ||
259 | do_fail: | ||
260 | return (buf); | ||
261 | } | ||
262 | |||
263 | static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) | ||
264 | { | ||
265 | struct acpi_polling_hotkey *poll_hotkey = | ||
266 | (struct acpi_polling_hotkey *)seq->private; | ||
267 | char *buf; | ||
268 | |||
269 | ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); | ||
270 | |||
271 | if (poll_hotkey->poll_result){ | ||
272 | buf = format_result(poll_hotkey->poll_result); | ||
273 | if(buf) | ||
274 | seq_printf(seq, "%s", buf); | ||
275 | kfree(buf); | ||
276 | } | ||
277 | return_VALUE(0); | ||
278 | } | ||
279 | |||
280 | static int hotkey_polling_open_fs(struct inode *inode, struct file *file) | ||
281 | { | ||
282 | return single_open(file, hotkey_polling_seq_show, PDE(inode)->data); | ||
283 | } | ||
284 | |||
285 | static int hotkey_action_open_fs(struct inode *inode, struct file *file) | ||
286 | { | ||
287 | return single_open(file, hotkey_info_seq_show, PDE(inode)->data); | ||
288 | } | ||
289 | |||
290 | /* Mapping external hotkey number to standardized hotkey event num */ | ||
291 | static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) | ||
292 | { | ||
293 | struct list_head *entries; | ||
294 | int val = -1; | ||
295 | |||
296 | ACPI_FUNCTION_TRACE("hotkey_get_internal_event"); | ||
297 | |||
298 | list_for_each(entries, list->entries) { | ||
299 | union acpi_hotkey *key = | ||
300 | container_of(entries, union acpi_hotkey, entries); | ||
301 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT | ||
302 | && key->event_hotkey.external_hotkey_num == event){ | ||
303 | val = key->link.hotkey_standard_num; | ||
304 | break; | ||
305 | } | ||
306 | } | ||
307 | |||
308 | return_VALUE(val); | ||
309 | } | ||
310 | |||
311 | static void | ||
312 | acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data) | ||
313 | { | ||
314 | struct acpi_device *device = NULL; | ||
315 | u32 internal_event; | ||
316 | |||
317 | ACPI_FUNCTION_TRACE("acpi_hotkey_notify_handler"); | ||
318 | |||
319 | if (acpi_bus_get_device(handle, &device)) | ||
320 | return_VOID; | ||
321 | |||
322 | internal_event = hotkey_get_internal_event(event, &global_hotkey_list); | ||
323 | acpi_bus_generate_event(device, internal_event, 0); | ||
324 | |||
325 | return_VOID; | ||
326 | } | ||
327 | |||
328 | /* Need to invent automatically hotkey add method */ | ||
329 | static int auto_hotkey_add(struct acpi_device *device) | ||
330 | { | ||
331 | /* Implement me */ | ||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | /* Need to invent automatically hotkey remove method */ | ||
336 | static int auto_hotkey_remove(struct acpi_device *device, int type) | ||
337 | { | ||
338 | /* Implement me */ | ||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | /* Create a proc file for each polling method */ | ||
343 | static int create_polling_proc(union acpi_hotkey *device) | ||
344 | { | ||
345 | struct proc_dir_entry *proc; | ||
346 | char proc_name[80]; | ||
347 | mode_t mode; | ||
348 | |||
349 | ACPI_FUNCTION_TRACE("create_polling_proc"); | ||
350 | mode = S_IFREG | S_IRUGO | S_IWUGO; | ||
351 | |||
352 | sprintf(proc_name, "%d", device->link.hotkey_standard_num); | ||
353 | /* | ||
354 | strcat(proc_name, device->poll_hotkey.poll_method); | ||
355 | */ | ||
356 | proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); | ||
357 | |||
358 | if (!proc) { | ||
359 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
360 | "Hotkey: Unable to create %s entry\n", | ||
361 | device->poll_hotkey.poll_method)); | ||
362 | return_VALUE(-ENODEV); | ||
363 | } else { | ||
364 | proc->proc_fops = &hotkey_polling_fops; | ||
365 | proc->owner = THIS_MODULE; | ||
366 | proc->data = device; | ||
367 | proc->uid = 0; | ||
368 | proc->gid = 0; | ||
369 | device->poll_hotkey.proc = proc; | ||
370 | } | ||
371 | return_VALUE(0); | ||
372 | } | ||
373 | |||
374 | static int hotkey_add(union acpi_hotkey *device) | ||
375 | { | ||
376 | int status = 0; | ||
377 | struct acpi_device *dev = NULL; | ||
378 | |||
379 | ACPI_FUNCTION_TRACE("hotkey_add"); | ||
380 | |||
381 | if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { | ||
382 | acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); | ||
383 | status = acpi_install_notify_handler(dev->handle, | ||
384 | ACPI_DEVICE_NOTIFY, | ||
385 | acpi_hotkey_notify_handler, | ||
386 | dev); | ||
387 | } else /* Add polling hotkey */ | ||
388 | create_polling_proc(device); | ||
389 | |||
390 | global_hotkey_list.count++; | ||
391 | |||
392 | list_add_tail(&device->link.entries, global_hotkey_list.entries); | ||
393 | |||
394 | return_VALUE(status); | ||
395 | } | ||
396 | |||
397 | static int hotkey_remove(union acpi_hotkey *device) | ||
398 | { | ||
399 | struct list_head *entries, *next; | ||
400 | |||
401 | ACPI_FUNCTION_TRACE("hotkey_remove"); | ||
402 | |||
403 | list_for_each_safe(entries, next, global_hotkey_list.entries) { | ||
404 | union acpi_hotkey *key = | ||
405 | container_of(entries, union acpi_hotkey, entries); | ||
406 | if (key->link.hotkey_standard_num == | ||
407 | device->link.hotkey_standard_num) { | ||
408 | list_del(&key->link.entries); | ||
409 | free_hotkey_device(key); | ||
410 | global_hotkey_list.count--; | ||
411 | break; | ||
412 | } | ||
413 | } | ||
414 | kfree(device); | ||
415 | return_VALUE(0); | ||
416 | } | ||
417 | |||
418 | static int hotkey_update(union acpi_hotkey *key) | ||
419 | { | ||
420 | struct list_head *entries; | ||
421 | |||
422 | ACPI_FUNCTION_TRACE("hotkey_update"); | ||
423 | |||
424 | list_for_each(entries, global_hotkey_list.entries) { | ||
425 | union acpi_hotkey *tmp= | ||
426 | container_of(entries, union acpi_hotkey, entries); | ||
427 | if (tmp->link.hotkey_standard_num == | ||
428 | key->link.hotkey_standard_num) { | ||
429 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { | ||
430 | free_hotkey_buffer(tmp); | ||
431 | tmp->event_hotkey.bus_handle = | ||
432 | key->event_hotkey.bus_handle; | ||
433 | tmp->event_hotkey.external_hotkey_num = | ||
434 | key->event_hotkey.external_hotkey_num; | ||
435 | tmp->event_hotkey.action_handle = | ||
436 | key->event_hotkey.action_handle; | ||
437 | tmp->event_hotkey.action_method = | ||
438 | key->event_hotkey.action_method; | ||
439 | kfree(key); | ||
440 | } else { | ||
441 | /* | ||
442 | char proc_name[80]; | ||
443 | |||
444 | sprintf(proc_name, "%d", tmp->link.hotkey_standard_num); | ||
445 | strcat(proc_name, tmp->poll_hotkey.poll_method); | ||
446 | remove_proc_entry(proc_name,hotkey_proc_dir); | ||
447 | */ | ||
448 | free_poll_hotkey_buffer(tmp); | ||
449 | tmp->poll_hotkey.poll_handle = | ||
450 | key->poll_hotkey.poll_handle; | ||
451 | tmp->poll_hotkey.poll_method = | ||
452 | key->poll_hotkey.poll_method; | ||
453 | tmp->poll_hotkey.action_handle = | ||
454 | key->poll_hotkey.action_handle; | ||
455 | tmp->poll_hotkey.action_method = | ||
456 | key->poll_hotkey.action_method; | ||
457 | tmp->poll_hotkey.poll_result = | ||
458 | key->poll_hotkey.poll_result; | ||
459 | /* | ||
460 | create_polling_proc(tmp); | ||
461 | */ | ||
462 | kfree(key); | ||
463 | } | ||
464 | return_VALUE(0); | ||
465 | break; | ||
466 | } | ||
467 | } | ||
468 | |||
469 | return_VALUE(-ENODEV); | ||
470 | } | ||
471 | |||
472 | static void free_hotkey_device(union acpi_hotkey *key) | ||
473 | { | ||
474 | struct acpi_device *dev; | ||
475 | |||
476 | ACPI_FUNCTION_TRACE("free_hotkey_device"); | ||
477 | |||
478 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { | ||
479 | acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); | ||
480 | if (dev->handle) | ||
481 | acpi_remove_notify_handler(dev->handle, | ||
482 | ACPI_DEVICE_NOTIFY, | ||
483 | acpi_hotkey_notify_handler); | ||
484 | free_hotkey_buffer(key); | ||
485 | } else { | ||
486 | char proc_name[80]; | ||
487 | |||
488 | sprintf(proc_name, "%d", key->link.hotkey_standard_num); | ||
489 | /* | ||
490 | strcat(proc_name, key->poll_hotkey.poll_method); | ||
491 | */ | ||
492 | remove_proc_entry(proc_name,hotkey_proc_dir); | ||
493 | free_poll_hotkey_buffer(key); | ||
494 | } | ||
495 | kfree(key); | ||
496 | return_VOID; | ||
497 | } | ||
498 | |||
499 | static void | ||
500 | free_hotkey_buffer(union acpi_hotkey *key) | ||
501 | { | ||
502 | kfree(key->event_hotkey.action_method); | ||
503 | } | ||
504 | |||
505 | static void | ||
506 | free_poll_hotkey_buffer(union acpi_hotkey *key) | ||
507 | { | ||
508 | kfree(key->poll_hotkey.action_method); | ||
509 | kfree(key->poll_hotkey.poll_method); | ||
510 | kfree(key->poll_hotkey.poll_result); | ||
511 | } | ||
512 | static int | ||
513 | init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, | ||
514 | char *method, int std_num, int external_num) | ||
515 | { | ||
516 | acpi_handle tmp_handle; | ||
517 | acpi_status status = AE_OK; | ||
518 | |||
519 | ACPI_FUNCTION_TRACE("init_hotkey_device"); | ||
520 | |||
521 | if(std_num < 0 || IS_POLL(std_num) || !key ) | ||
522 | goto do_fail; | ||
523 | |||
524 | if(!bus_str || !action_str || !method) | ||
525 | goto do_fail; | ||
526 | |||
527 | key->link.hotkey_type = ACPI_HOTKEY_EVENT; | ||
528 | key->link.hotkey_standard_num = std_num; | ||
529 | key->event_hotkey.flag = 0; | ||
530 | key->event_hotkey.action_method = method; | ||
531 | |||
532 | status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle)); | ||
533 | if(ACPI_FAILURE(status)) | ||
534 | goto do_fail; | ||
535 | key->event_hotkey.external_hotkey_num = external_num; | ||
536 | status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle)); | ||
537 | if(ACPI_FAILURE(status)) | ||
538 | goto do_fail; | ||
539 | status = acpi_get_handle(key->event_hotkey.action_handle, | ||
540 | method, &tmp_handle); | ||
541 | if (ACPI_FAILURE(status)) | ||
542 | goto do_fail; | ||
543 | return_VALUE(AE_OK); | ||
544 | do_fail: | ||
545 | return_VALUE(-ENODEV); | ||
546 | } | ||
547 | |||
548 | static int | ||
549 | init_poll_hotkey_device(union acpi_hotkey *key, | ||
550 | char *poll_str, | ||
551 | char *poll_method, | ||
552 | char *action_str, char *action_method, int std_num) | ||
553 | { | ||
554 | acpi_status status = AE_OK; | ||
555 | acpi_handle tmp_handle; | ||
556 | |||
557 | ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); | ||
558 | |||
559 | if(std_num < 0 || IS_EVENT(std_num) || !key) | ||
560 | goto do_fail; | ||
561 | |||
562 | if(!poll_str || !poll_method || !action_str || !action_method) | ||
563 | goto do_fail; | ||
564 | |||
565 | key->link.hotkey_type = ACPI_HOTKEY_POLLING; | ||
566 | key->link.hotkey_standard_num = std_num; | ||
567 | key->poll_hotkey.flag = 0; | ||
568 | key->poll_hotkey.poll_method = poll_method; | ||
569 | key->poll_hotkey.action_method = action_method; | ||
570 | |||
571 | status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle)); | ||
572 | if(ACPI_FAILURE(status)) | ||
573 | goto do_fail; | ||
574 | status = acpi_get_handle(key->poll_hotkey.poll_handle, | ||
575 | poll_method, &tmp_handle); | ||
576 | if (ACPI_FAILURE(status)) | ||
577 | goto do_fail; | ||
578 | status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle)); | ||
579 | if (ACPI_FAILURE(status)) | ||
580 | goto do_fail; | ||
581 | status = acpi_get_handle(key->poll_hotkey.action_handle, | ||
582 | action_method, &tmp_handle); | ||
583 | if (ACPI_FAILURE(status)) | ||
584 | goto do_fail; | ||
585 | key->poll_hotkey.poll_result = | ||
586 | (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
587 | if(!key->poll_hotkey.poll_result) | ||
588 | goto do_fail; | ||
589 | return_VALUE(AE_OK); | ||
590 | do_fail: | ||
591 | return_VALUE(-ENODEV); | ||
592 | } | ||
593 | |||
594 | |||
595 | static int hotkey_open_config(struct inode *inode, struct file *file) | ||
596 | { | ||
597 | ACPI_FUNCTION_TRACE("hotkey_open_config"); | ||
598 | return_VALUE(single_open | ||
599 | (file, hotkey_config_seq_show, PDE(inode)->data)); | ||
600 | } | ||
601 | |||
602 | static int hotkey_poll_open_config(struct inode *inode, struct file *file) | ||
603 | { | ||
604 | ACPI_FUNCTION_TRACE("hotkey_poll_open_config"); | ||
605 | return_VALUE(single_open | ||
606 | (file, hotkey_poll_config_seq_show, PDE(inode)->data)); | ||
607 | } | ||
608 | |||
609 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset) | ||
610 | { | ||
611 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | ||
612 | struct list_head *entries; | ||
613 | char bus_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
614 | char action_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
615 | struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; | ||
616 | struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; | ||
617 | |||
618 | ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); | ||
619 | |||
620 | list_for_each(entries, hotkey_list->entries) { | ||
621 | union acpi_hotkey *key = | ||
622 | container_of(entries, union acpi_hotkey, entries); | ||
623 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { | ||
624 | acpi_get_name(key->event_hotkey.bus_handle, | ||
625 | ACPI_NAME_TYPE_MAX, &bus); | ||
626 | acpi_get_name(key->event_hotkey.action_handle, | ||
627 | ACPI_NAME_TYPE_MAX, &act); | ||
628 | seq_printf(seq, "%s:%s:%s:%d:%d\n", bus_name, | ||
629 | action_name, | ||
630 | key->event_hotkey.action_method, | ||
631 | key->link.hotkey_standard_num, | ||
632 | key->event_hotkey.external_hotkey_num); | ||
633 | } | ||
634 | } | ||
635 | seq_puts(seq, "\n"); | ||
636 | return_VALUE(0); | ||
637 | } | ||
638 | |||
639 | static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) | ||
640 | { | ||
641 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | ||
642 | struct list_head *entries; | ||
643 | char bus_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
644 | char action_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
645 | struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; | ||
646 | struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; | ||
647 | |||
648 | ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); | ||
649 | |||
650 | list_for_each(entries, hotkey_list->entries) { | ||
651 | union acpi_hotkey *key = | ||
652 | container_of(entries, union acpi_hotkey, entries); | ||
653 | if (key->link.hotkey_type == ACPI_HOTKEY_POLLING) { | ||
654 | acpi_get_name(key->poll_hotkey.poll_handle, | ||
655 | ACPI_NAME_TYPE_MAX, &bus); | ||
656 | acpi_get_name(key->poll_hotkey.action_handle, | ||
657 | ACPI_NAME_TYPE_MAX, &act); | ||
658 | seq_printf(seq, "%s:%s:%s:%s:%d\n", bus_name, | ||
659 | key->poll_hotkey.poll_method, | ||
660 | action_name, | ||
661 | key->poll_hotkey.action_method, | ||
662 | key->link.hotkey_standard_num); | ||
663 | } | ||
664 | } | ||
665 | seq_puts(seq, "\n"); | ||
666 | return_VALUE(0); | ||
667 | } | ||
668 | |||
669 | static int | ||
670 | get_parms(char *config_record, | ||
671 | int *cmd, | ||
672 | char **bus_handle, | ||
673 | char **bus_method, | ||
674 | char **action_handle, | ||
675 | char **method, int *internal_event_num, int *external_event_num) | ||
676 | { | ||
677 | char *tmp, *tmp1, count; | ||
678 | ACPI_FUNCTION_TRACE(("get_parms")); | ||
679 | |||
680 | sscanf(config_record, "%d", cmd); | ||
681 | |||
682 | if(*cmd == 1){ | ||
683 | if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2) | ||
684 | goto do_fail; | ||
685 | else | ||
686 | return (6); | ||
687 | } | ||
688 | tmp = strchr(config_record, ':'); | ||
689 | if (!tmp) | ||
690 | goto do_fail; | ||
691 | tmp++; | ||
692 | tmp1 = strchr(tmp, ':'); | ||
693 | if (!tmp1) | ||
694 | goto do_fail; | ||
695 | |||
696 | count = tmp1 - tmp; | ||
697 | *bus_handle = (char *) kmalloc(count+1, GFP_KERNEL); | ||
698 | if(!*bus_handle) | ||
699 | goto do_fail; | ||
700 | strncpy(*bus_handle, tmp, count); | ||
701 | *(*bus_handle + count) = 0; | ||
702 | |||
703 | tmp = tmp1; | ||
704 | tmp++; | ||
705 | tmp1 = strchr(tmp, ':'); | ||
706 | if (!tmp1) | ||
707 | goto do_fail; | ||
708 | count = tmp1 - tmp; | ||
709 | *bus_method = (char *) kmalloc(count+1, GFP_KERNEL); | ||
710 | if(!*bus_method) | ||
711 | goto do_fail; | ||
712 | strncpy(*bus_method, tmp, count); | ||
713 | *(*bus_method + count) = 0; | ||
714 | |||
715 | tmp = tmp1; | ||
716 | tmp++; | ||
717 | tmp1 = strchr(tmp, ':'); | ||
718 | if (!tmp1) | ||
719 | goto do_fail; | ||
720 | count = tmp1 - tmp; | ||
721 | *action_handle = (char *) kmalloc(count+1, GFP_KERNEL); | ||
722 | strncpy(*action_handle, tmp, count); | ||
723 | *(*action_handle + count) = 0; | ||
724 | |||
725 | tmp = tmp1; | ||
726 | tmp++; | ||
727 | tmp1 = strchr(tmp, ':'); | ||
728 | if (!tmp1) | ||
729 | goto do_fail; | ||
730 | count = tmp1 - tmp; | ||
731 | *method = (char *) kmalloc(count+1, GFP_KERNEL); | ||
732 | if(!*method) | ||
733 | goto do_fail; | ||
734 | strncpy(*method, tmp, count); | ||
735 | *(*method + count) = 0; | ||
736 | |||
737 | if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0) | ||
738 | goto do_fail; | ||
739 | |||
740 | return_VALUE(6); | ||
741 | do_fail: | ||
742 | return_VALUE(-1); | ||
743 | } | ||
744 | |||
745 | /* count is length for one input record */ | ||
746 | static ssize_t hotkey_write_config(struct file *file, | ||
747 | const char __user * buffer, | ||
748 | size_t count, loff_t * data) | ||
749 | { | ||
750 | char *config_record = NULL; | ||
751 | char *bus_handle = NULL; | ||
752 | char *bus_method = NULL; | ||
753 | char *action_handle = NULL; | ||
754 | char *method = NULL; | ||
755 | int cmd, internal_event_num, external_event_num; | ||
756 | int ret = 0; | ||
757 | union acpi_hotkey *key = NULL; | ||
758 | |||
759 | ACPI_FUNCTION_TRACE(("hotkey_write_config")); | ||
760 | |||
761 | config_record = (char *) kmalloc(count+1, GFP_KERNEL); | ||
762 | if(!config_record) | ||
763 | return_VALUE(-ENOMEM); | ||
764 | |||
765 | if (copy_from_user(config_record, buffer, count)) { | ||
766 | kfree(config_record); | ||
767 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); | ||
768 | return_VALUE(-EINVAL); | ||
769 | } | ||
770 | config_record[count] = 0; | ||
771 | |||
772 | ret = get_parms(config_record, | ||
773 | &cmd, | ||
774 | &bus_handle, | ||
775 | &bus_method, | ||
776 | &action_handle, | ||
777 | &method, &internal_event_num, &external_event_num); | ||
778 | |||
779 | kfree(config_record); | ||
780 | if(IS_OTHERS(internal_event_num)) | ||
781 | goto do_fail; | ||
782 | if (ret != 6) { | ||
783 | do_fail: | ||
784 | kfree(bus_handle); | ||
785 | kfree(bus_method); | ||
786 | kfree(action_handle); | ||
787 | kfree(method); | ||
788 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
789 | "Invalid data format ret=%d\n", ret)); | ||
790 | return_VALUE(-EINVAL); | ||
791 | } | ||
792 | |||
793 | key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); | ||
794 | if(!key) | ||
795 | goto do_fail; | ||
796 | memset(key, 0, sizeof(union acpi_hotkey)); | ||
797 | if(cmd == 1) { | ||
798 | union acpi_hotkey *tmp = NULL; | ||
799 | tmp = get_hotkey_by_event(&global_hotkey_list, | ||
800 | internal_event_num); | ||
801 | if(!tmp) | ||
802 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key")); | ||
803 | else | ||
804 | memcpy(key, tmp, sizeof(union acpi_hotkey)); | ||
805 | goto cont_cmd; | ||
806 | } | ||
807 | if (IS_EVENT(internal_event_num)) { | ||
808 | kfree(bus_method); | ||
809 | ret = init_hotkey_device(key, bus_handle, action_handle, method, | ||
810 | internal_event_num, external_event_num); | ||
811 | } else | ||
812 | ret = init_poll_hotkey_device(key, bus_handle, bus_method, | ||
813 | action_handle, method, | ||
814 | internal_event_num); | ||
815 | if (ret) { | ||
816 | kfree(bus_handle); | ||
817 | kfree(action_handle); | ||
818 | if(IS_EVENT(internal_event_num)) | ||
819 | free_hotkey_buffer(key); | ||
820 | else | ||
821 | free_poll_hotkey_buffer(key); | ||
822 | kfree(key); | ||
823 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); | ||
824 | return_VALUE(-EINVAL); | ||
825 | } | ||
826 | |||
827 | cont_cmd: | ||
828 | kfree(bus_handle); | ||
829 | kfree(action_handle); | ||
830 | |||
831 | switch (cmd) { | ||
832 | case 0: | ||
833 | if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num)) | ||
834 | goto fail_out; | ||
835 | else | ||
836 | hotkey_add(key); | ||
837 | break; | ||
838 | case 1: | ||
839 | hotkey_remove(key); | ||
840 | break; | ||
841 | case 2: | ||
842 | if(hotkey_update(key)) | ||
843 | goto fail_out; | ||
844 | break; | ||
845 | default: | ||
846 | goto fail_out; | ||
847 | break; | ||
848 | } | ||
849 | return_VALUE(count); | ||
850 | fail_out: | ||
851 | if(IS_EVENT(internal_event_num)) | ||
852 | free_hotkey_buffer(key); | ||
853 | else | ||
854 | free_poll_hotkey_buffer(key); | ||
855 | kfree(key); | ||
856 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "invalid key\n")); | ||
857 | return_VALUE(-EINVAL); | ||
858 | } | ||
859 | |||
860 | /* | ||
861 | * This function evaluates an ACPI method, given an int as parameter, the | ||
862 | * method is searched within the scope of the handle, can be NULL. The output | ||
863 | * of the method is written is output, which can also be NULL | ||
864 | * | ||
865 | * returns 1 if write is successful, 0 else. | ||
866 | */ | ||
867 | static int write_acpi_int(acpi_handle handle, const char *method, int val, | ||
868 | struct acpi_buffer *output) | ||
869 | { | ||
870 | struct acpi_object_list params; /* list of input parameters (an int here) */ | ||
871 | union acpi_object in_obj; /* the only param we use */ | ||
872 | acpi_status status; | ||
873 | |||
874 | ACPI_FUNCTION_TRACE("write_acpi_int"); | ||
875 | params.count = 1; | ||
876 | params.pointer = &in_obj; | ||
877 | in_obj.type = ACPI_TYPE_INTEGER; | ||
878 | in_obj.integer.value = val; | ||
879 | |||
880 | status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); | ||
881 | |||
882 | return_VALUE(status == AE_OK); | ||
883 | } | ||
884 | |||
885 | static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val) | ||
886 | { | ||
887 | struct acpi_buffer output; | ||
888 | union acpi_object out_obj; | ||
889 | acpi_status status; | ||
890 | |||
891 | ACPI_FUNCTION_TRACE("read_acpi_int"); | ||
892 | output.length = sizeof(out_obj); | ||
893 | output.pointer = &out_obj; | ||
894 | |||
895 | status = acpi_evaluate_object(handle, (char *)method, NULL, &output); | ||
896 | if(val){ | ||
897 | val->integer.value = out_obj.integer.value; | ||
898 | val->type = out_obj.type; | ||
899 | } else | ||
900 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "null val pointer")); | ||
901 | return_VALUE((status == AE_OK) | ||
902 | && (out_obj.type == ACPI_TYPE_INTEGER)); | ||
903 | } | ||
904 | |||
905 | static union acpi_hotkey *get_hotkey_by_event(struct | ||
906 | acpi_hotkey_list | ||
907 | *hotkey_list, int event) | ||
908 | { | ||
909 | struct list_head *entries; | ||
910 | |||
911 | list_for_each(entries, hotkey_list->entries) { | ||
912 | union acpi_hotkey *key = | ||
913 | container_of(entries, union acpi_hotkey, entries); | ||
914 | if (key->link.hotkey_standard_num == event) { | ||
915 | return(key); | ||
916 | } | ||
917 | } | ||
918 | return(NULL); | ||
919 | } | ||
920 | |||
921 | /* | ||
922 | * user call AML method interface: | ||
923 | * Call convention: | ||
924 | * echo "event_num: arg type : value" | ||
925 | * example: echo "1:1:30" > /proc/acpi/action | ||
926 | * Just support 1 integer arg passing to AML method | ||
927 | */ | ||
928 | |||
929 | static ssize_t hotkey_execute_aml_method(struct file *file, | ||
930 | const char __user * buffer, | ||
931 | size_t count, loff_t * data) | ||
932 | { | ||
933 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | ||
934 | char *arg; | ||
935 | int event,method_type,type, value; | ||
936 | union acpi_hotkey *key; | ||
937 | |||
938 | ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); | ||
939 | |||
940 | arg = (char *) kmalloc(count+1, GFP_KERNEL); | ||
941 | if(!arg) | ||
942 | return_VALUE(-ENOMEM); | ||
943 | arg[count]=0; | ||
944 | |||
945 | if (copy_from_user(arg, buffer, count)) { | ||
946 | kfree(arg); | ||
947 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); | ||
948 | return_VALUE(-EINVAL); | ||
949 | } | ||
950 | |||
951 | if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { | ||
952 | kfree(arg); | ||
953 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); | ||
954 | return_VALUE(-EINVAL); | ||
955 | } | ||
956 | kfree(arg); | ||
957 | if (type == ACPI_TYPE_INTEGER) { | ||
958 | key = get_hotkey_by_event(hotkey_list, event); | ||
959 | if(!key) | ||
960 | goto do_fail; | ||
961 | if (IS_EVENT(event)) | ||
962 | write_acpi_int(key->event_hotkey.action_handle, | ||
963 | key->event_hotkey.action_method, value, NULL); | ||
964 | else if (IS_POLL(event)) { | ||
965 | if ( method_type == POLL_METHOD ) | ||
966 | read_acpi_int(key->poll_hotkey.poll_handle, | ||
967 | key->poll_hotkey.poll_method, | ||
968 | key->poll_hotkey.poll_result); | ||
969 | else if ( method_type == ACTION_METHOD ) | ||
970 | write_acpi_int(key->poll_hotkey.action_handle, | ||
971 | key->poll_hotkey.action_method, value, NULL); | ||
972 | else | ||
973 | goto do_fail; | ||
974 | |||
975 | } | ||
976 | } else { | ||
977 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); | ||
978 | return_VALUE(-EINVAL); | ||
979 | } | ||
980 | return_VALUE(count); | ||
981 | do_fail: | ||
982 | return_VALUE(-EINVAL); | ||
983 | |||
984 | } | ||
985 | |||
986 | static int __init hotkey_init(void) | ||
987 | { | ||
988 | int result; | ||
989 | mode_t mode = S_IFREG | S_IRUGO | S_IWUGO; | ||
990 | |||
991 | ACPI_FUNCTION_TRACE("hotkey_init"); | ||
992 | |||
993 | if (acpi_disabled) | ||
994 | return -ENODEV; | ||
995 | |||
996 | if (acpi_specific_hotkey_enabled) { | ||
997 | printk("Using specific hotkey driver\n"); | ||
998 | return -ENODEV; | ||
999 | } | ||
1000 | |||
1001 | hotkey_proc_dir = proc_mkdir(HOTKEY_PROC, acpi_root_dir); | ||
1002 | if (!hotkey_proc_dir) { | ||
1003 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1004 | "Hotkey: Unable to create %s entry\n", | ||
1005 | HOTKEY_PROC)); | ||
1006 | return (-ENODEV); | ||
1007 | } | ||
1008 | hotkey_proc_dir->owner = THIS_MODULE; | ||
1009 | |||
1010 | hotkey_config = | ||
1011 | create_proc_entry(HOTKEY_EV_CONFIG, mode, hotkey_proc_dir); | ||
1012 | if (!hotkey_config) { | ||
1013 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1014 | "Hotkey: Unable to create %s entry\n", | ||
1015 | HOTKEY_EV_CONFIG)); | ||
1016 | goto do_fail1; | ||
1017 | } else { | ||
1018 | hotkey_config->proc_fops = &hotkey_config_fops; | ||
1019 | hotkey_config->data = &global_hotkey_list; | ||
1020 | hotkey_config->owner = THIS_MODULE; | ||
1021 | hotkey_config->uid = 0; | ||
1022 | hotkey_config->gid = 0; | ||
1023 | } | ||
1024 | |||
1025 | hotkey_poll_config = | ||
1026 | create_proc_entry(HOTKEY_PL_CONFIG, mode, hotkey_proc_dir); | ||
1027 | if (!hotkey_poll_config) { | ||
1028 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1029 | "Hotkey: Unable to create %s entry\n", | ||
1030 | HOTKEY_EV_CONFIG)); | ||
1031 | |||
1032 | goto do_fail2; | ||
1033 | } else { | ||
1034 | hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; | ||
1035 | hotkey_poll_config->data = &global_hotkey_list; | ||
1036 | hotkey_poll_config->owner = THIS_MODULE; | ||
1037 | hotkey_poll_config->uid = 0; | ||
1038 | hotkey_poll_config->gid = 0; | ||
1039 | } | ||
1040 | |||
1041 | hotkey_action = create_proc_entry(HOTKEY_ACTION, mode, hotkey_proc_dir); | ||
1042 | if (!hotkey_action) { | ||
1043 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1044 | "Hotkey: Unable to create %s entry\n", | ||
1045 | HOTKEY_ACTION)); | ||
1046 | goto do_fail3; | ||
1047 | } else { | ||
1048 | hotkey_action->proc_fops = &hotkey_action_fops; | ||
1049 | hotkey_action->owner = THIS_MODULE; | ||
1050 | hotkey_action->uid = 0; | ||
1051 | hotkey_action->gid = 0; | ||
1052 | } | ||
1053 | |||
1054 | hotkey_info = create_proc_entry(HOTKEY_INFO, mode, hotkey_proc_dir); | ||
1055 | if (!hotkey_info) { | ||
1056 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1057 | "Hotkey: Unable to create %s entry\n", | ||
1058 | HOTKEY_INFO)); | ||
1059 | goto do_fail4; | ||
1060 | } else { | ||
1061 | hotkey_info->proc_fops = &hotkey_info_fops; | ||
1062 | hotkey_info->owner = THIS_MODULE; | ||
1063 | hotkey_info->uid = 0; | ||
1064 | hotkey_info->gid = 0; | ||
1065 | } | ||
1066 | |||
1067 | result = acpi_bus_register_driver(&hotkey_driver); | ||
1068 | if (result < 0) | ||
1069 | goto do_fail5; | ||
1070 | global_hotkey_list.count = 0; | ||
1071 | global_hotkey_list.entries = &hotkey_entries; | ||
1072 | |||
1073 | INIT_LIST_HEAD(&hotkey_entries); | ||
1074 | |||
1075 | return (0); | ||
1076 | |||
1077 | do_fail5: | ||
1078 | remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir); | ||
1079 | do_fail4: | ||
1080 | remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir); | ||
1081 | do_fail3: | ||
1082 | remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir); | ||
1083 | do_fail2: | ||
1084 | remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir); | ||
1085 | do_fail1: | ||
1086 | remove_proc_entry(HOTKEY_PROC, acpi_root_dir); | ||
1087 | return (-ENODEV); | ||
1088 | } | ||
1089 | |||
1090 | static void __exit hotkey_exit(void) | ||
1091 | { | ||
1092 | struct list_head *entries, *next; | ||
1093 | |||
1094 | ACPI_FUNCTION_TRACE("hotkey_exit"); | ||
1095 | |||
1096 | list_for_each_safe(entries, next, global_hotkey_list.entries) { | ||
1097 | union acpi_hotkey *key = | ||
1098 | container_of(entries, union acpi_hotkey, entries); | ||
1099 | |||
1100 | acpi_os_wait_events_complete(NULL); | ||
1101 | list_del(&key->link.entries); | ||
1102 | global_hotkey_list.count--; | ||
1103 | free_hotkey_device(key); | ||
1104 | } | ||
1105 | acpi_bus_unregister_driver(&hotkey_driver); | ||
1106 | remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir); | ||
1107 | remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir); | ||
1108 | remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir); | ||
1109 | remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir); | ||
1110 | remove_proc_entry(HOTKEY_PROC, acpi_root_dir); | ||
1111 | return; | ||
1112 | } | ||
1113 | |||
1114 | module_init(hotkey_init); | ||
1115 | module_exit(hotkey_exit); | ||
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 0fb731a470dc..ad85e10001f4 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -1025,7 +1025,7 @@ static int setup_notify(struct ibm_struct *ibm) | |||
1025 | return 0; | 1025 | return 0; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | static int device_add(struct acpi_device *device) | 1028 | static int ibmacpi_device_add(struct acpi_device *device) |
1029 | { | 1029 | { |
1030 | return 0; | 1030 | return 0; |
1031 | } | 1031 | } |
@@ -1043,7 +1043,7 @@ static int register_driver(struct ibm_struct *ibm) | |||
1043 | memset(ibm->driver, 0, sizeof(struct acpi_driver)); | 1043 | memset(ibm->driver, 0, sizeof(struct acpi_driver)); |
1044 | sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name); | 1044 | sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name); |
1045 | ibm->driver->ids = ibm->hid; | 1045 | ibm->driver->ids = ibm->hid; |
1046 | ibm->driver->ops.add = &device_add; | 1046 | ibm->driver->ops.add = &ibmacpi_device_add; |
1047 | 1047 | ||
1048 | ret = acpi_bus_register_driver(ibm->driver); | 1048 | ret = acpi_bus_register_driver(ibm->driver); |
1049 | if (ret < 0) { | 1049 | if (ret < 0) { |
@@ -1185,6 +1185,10 @@ static int __init acpi_ibm_init(void) | |||
1185 | if (acpi_disabled) | 1185 | if (acpi_disabled) |
1186 | return -ENODEV; | 1186 | return -ENODEV; |
1187 | 1187 | ||
1188 | if (!acpi_specific_hotkey_enabled){ | ||
1189 | printk(IBM_ERR "Using generic hotkey driver\n"); | ||
1190 | return -ENODEV; | ||
1191 | } | ||
1188 | /* these handles are required */ | 1192 | /* these handles are required */ |
1189 | if (IBM_HANDLE_INIT(ec, 1) < 0 || | 1193 | if (IBM_HANDLE_INIT(ec, 1) < 0 || |
1190 | IBM_HANDLE_INIT(hkey, 1) < 0 || | 1194 | IBM_HANDLE_INIT(hkey, 1) < 0 || |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 1c0c12336c57..ece7a9dedd5c 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -67,7 +67,8 @@ | |||
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | 68 | ||
69 | acpi_status | 69 | acpi_status |
70 | acpi_ns_root_initialize (void) | 70 | acpi_ns_root_initialize ( |
71 | void) | ||
71 | { | 72 | { |
72 | acpi_status status; | 73 | acpi_status status; |
73 | const struct acpi_predefined_names *init_val = NULL; | 74 | const struct acpi_predefined_names *init_val = NULL; |
@@ -265,7 +266,7 @@ unlock_and_exit: | |||
265 | * | 266 | * |
266 | * FUNCTION: acpi_ns_lookup | 267 | * FUNCTION: acpi_ns_lookup |
267 | * | 268 | * |
268 | * PARAMETERS: prefix_node - Search scope if name is not fully qualified | 269 | * PARAMETERS: scope_info - Current scope info block |
269 | * Pathname - Search pathname, in internal format | 270 | * Pathname - Search pathname, in internal format |
270 | * (as represented in the AML stream) | 271 | * (as represented in the AML stream) |
271 | * Type - Type associated with name | 272 | * Type - Type associated with name |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index bfd922c5c7d1..5653a19d7172 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -49,14 +49,20 @@ | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nsalloc") | 50 | ACPI_MODULE_NAME ("nsalloc") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ns_remove_reference ( | ||
56 | struct acpi_namespace_node *node); | ||
57 | |||
52 | 58 | ||
53 | /******************************************************************************* | 59 | /******************************************************************************* |
54 | * | 60 | * |
55 | * FUNCTION: acpi_ns_create_node | 61 | * FUNCTION: acpi_ns_create_node |
56 | * | 62 | * |
57 | * PARAMETERS: acpi_name - Name of the new node | 63 | * PARAMETERS: Name - Name of the new node (4 char ACPI name) |
58 | * | 64 | * |
59 | * RETURN: None | 65 | * RETURN: New namespace node (Null on failure) |
60 | * | 66 | * |
61 | * DESCRIPTION: Create a namespace node | 67 | * DESCRIPTION: Create a namespace node |
62 | * | 68 | * |
@@ -145,7 +151,6 @@ acpi_ns_delete_node ( | |||
145 | } | 151 | } |
146 | } | 152 | } |
147 | 153 | ||
148 | |||
149 | ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); | 154 | ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); |
150 | 155 | ||
151 | /* | 156 | /* |
@@ -157,57 +162,6 @@ acpi_ns_delete_node ( | |||
157 | } | 162 | } |
158 | 163 | ||
159 | 164 | ||
160 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
161 | /******************************************************************************* | ||
162 | * | ||
163 | * FUNCTION: acpi_ns_compare_names | ||
164 | * | ||
165 | * PARAMETERS: Name1 - First name to compare | ||
166 | * Name2 - Second name to compare | ||
167 | * | ||
168 | * RETURN: value from strncmp | ||
169 | * | ||
170 | * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an | ||
171 | * underscore are forced to be alphabetically first. | ||
172 | * | ||
173 | ******************************************************************************/ | ||
174 | |||
175 | int | ||
176 | acpi_ns_compare_names ( | ||
177 | char *name1, | ||
178 | char *name2) | ||
179 | { | ||
180 | char reversed_name1[ACPI_NAME_SIZE]; | ||
181 | char reversed_name2[ACPI_NAME_SIZE]; | ||
182 | u32 i; | ||
183 | u32 j; | ||
184 | |||
185 | |||
186 | /* | ||
187 | * Replace all instances of "underscore" with a value that is smaller so | ||
188 | * that all names that are prefixed with underscore(s) are alphabetically | ||
189 | * first. | ||
190 | * | ||
191 | * Reverse the name bytewise so we can just do a 32-bit compare instead | ||
192 | * of a strncmp. | ||
193 | */ | ||
194 | for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { | ||
195 | reversed_name1[j] = name1[i]; | ||
196 | if (name1[i] == '_') { | ||
197 | reversed_name1[j] = '*'; | ||
198 | } | ||
199 | |||
200 | reversed_name2[j] = name2[i]; | ||
201 | if (name2[i] == '_') { | ||
202 | reversed_name2[j] = '*'; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | return (*(int *) reversed_name1 - *(int *) reversed_name2); | ||
207 | } | ||
208 | #endif | ||
209 | |||
210 | |||
211 | /******************************************************************************* | 165 | /******************************************************************************* |
212 | * | 166 | * |
213 | * FUNCTION: acpi_ns_install_node | 167 | * FUNCTION: acpi_ns_install_node |
@@ -271,7 +225,8 @@ acpi_ns_install_node ( | |||
271 | * alphabetic placement. | 225 | * alphabetic placement. |
272 | */ | 226 | */ |
273 | previous_child_node = NULL; | 227 | previous_child_node = NULL; |
274 | while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), acpi_ut_get_node_name (node)) < 0) { | 228 | while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), |
229 | acpi_ut_get_node_name (node)) < 0) { | ||
275 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { | 230 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { |
276 | /* Last peer; Clear end-of-list flag */ | 231 | /* Last peer; Clear end-of-list flag */ |
277 | 232 | ||
@@ -429,7 +384,8 @@ acpi_ns_delete_children ( | |||
429 | /* There should be only one reference remaining on this node */ | 384 | /* There should be only one reference remaining on this node */ |
430 | 385 | ||
431 | if (child_node->reference_count != 1) { | 386 | if (child_node->reference_count != 1) { |
432 | ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n", | 387 | ACPI_REPORT_WARNING (( |
388 | "Existing references (%d) on node being deleted (%p)\n", | ||
433 | child_node->reference_count, child_node)); | 389 | child_node->reference_count, child_node)); |
434 | } | 390 | } |
435 | 391 | ||
@@ -548,7 +504,7 @@ acpi_ns_delete_namespace_subtree ( | |||
548 | * | 504 | * |
549 | ******************************************************************************/ | 505 | ******************************************************************************/ |
550 | 506 | ||
551 | void | 507 | static void |
552 | acpi_ns_remove_reference ( | 508 | acpi_ns_remove_reference ( |
553 | struct acpi_namespace_node *node) | 509 | struct acpi_namespace_node *node) |
554 | { | 510 | { |
@@ -683,3 +639,54 @@ acpi_ns_delete_namespace_by_owner ( | |||
683 | } | 639 | } |
684 | 640 | ||
685 | 641 | ||
642 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
643 | /******************************************************************************* | ||
644 | * | ||
645 | * FUNCTION: acpi_ns_compare_names | ||
646 | * | ||
647 | * PARAMETERS: Name1 - First name to compare | ||
648 | * Name2 - Second name to compare | ||
649 | * | ||
650 | * RETURN: value from strncmp | ||
651 | * | ||
652 | * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an | ||
653 | * underscore are forced to be alphabetically first. | ||
654 | * | ||
655 | ******************************************************************************/ | ||
656 | |||
657 | int | ||
658 | acpi_ns_compare_names ( | ||
659 | char *name1, | ||
660 | char *name2) | ||
661 | { | ||
662 | char reversed_name1[ACPI_NAME_SIZE]; | ||
663 | char reversed_name2[ACPI_NAME_SIZE]; | ||
664 | u32 i; | ||
665 | u32 j; | ||
666 | |||
667 | |||
668 | /* | ||
669 | * Replace all instances of "underscore" with a value that is smaller so | ||
670 | * that all names that are prefixed with underscore(s) are alphabetically | ||
671 | * first. | ||
672 | * | ||
673 | * Reverse the name bytewise so we can just do a 32-bit compare instead | ||
674 | * of a strncmp. | ||
675 | */ | ||
676 | for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { | ||
677 | reversed_name1[j] = name1[i]; | ||
678 | if (name1[i] == '_') { | ||
679 | reversed_name1[j] = '*'; | ||
680 | } | ||
681 | |||
682 | reversed_name2[j] = name2[i]; | ||
683 | if (name2[i] == '_') { | ||
684 | reversed_name2[j] = '*'; | ||
685 | } | ||
686 | } | ||
687 | |||
688 | return (*(int *) reversed_name1 - *(int *) reversed_name2); | ||
689 | } | ||
690 | #endif | ||
691 | |||
692 | |||
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 1f6af3eb6c91..6c2aef0e0dd4 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -50,16 +50,32 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsdump") | 51 | ACPI_MODULE_NAME ("nsdump") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 55 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
56 | void | ||
57 | acpi_ns_dump_root_devices ( | ||
58 | void); | ||
55 | 59 | ||
60 | static acpi_status | ||
61 | acpi_ns_dump_one_device ( | ||
62 | acpi_handle obj_handle, | ||
63 | u32 level, | ||
64 | void *context, | ||
65 | void **return_value); | ||
66 | #endif | ||
67 | |||
68 | |||
69 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
56 | /******************************************************************************* | 70 | /******************************************************************************* |
57 | * | 71 | * |
58 | * FUNCTION: acpi_ns_print_pathname | 72 | * FUNCTION: acpi_ns_print_pathname |
59 | * | 73 | * |
60 | * PARAMETERS: num_segment - Number of ACPI name segments | 74 | * PARAMETERS: num_segments - Number of ACPI name segments |
61 | * Pathname - The compressed (internal) path | 75 | * Pathname - The compressed (internal) path |
62 | * | 76 | * |
77 | * RETURN: None | ||
78 | * | ||
63 | * DESCRIPTION: Print an object's full namespace pathname | 79 | * DESCRIPTION: Print an object's full namespace pathname |
64 | * | 80 | * |
65 | ******************************************************************************/ | 81 | ******************************************************************************/ |
@@ -103,6 +119,8 @@ acpi_ns_print_pathname ( | |||
103 | * Level - Desired debug level | 119 | * Level - Desired debug level |
104 | * Component - Caller's component ID | 120 | * Component - Caller's component ID |
105 | * | 121 | * |
122 | * RETURN: None | ||
123 | * | ||
106 | * DESCRIPTION: Print an object's full namespace pathname | 124 | * DESCRIPTION: Print an object's full namespace pathname |
107 | * Manages allocation/freeing of a pathname buffer | 125 | * Manages allocation/freeing of a pathname buffer |
108 | * | 126 | * |
@@ -137,9 +155,12 @@ acpi_ns_dump_pathname ( | |||
137 | * | 155 | * |
138 | * FUNCTION: acpi_ns_dump_one_object | 156 | * FUNCTION: acpi_ns_dump_one_object |
139 | * | 157 | * |
140 | * PARAMETERS: Handle - Node to be dumped | 158 | * PARAMETERS: obj_handle - Node to be dumped |
141 | * Level - Nesting level of the handle | 159 | * Level - Nesting level of the handle |
142 | * Context - Passed into walk_namespace | 160 | * Context - Passed into walk_namespace |
161 | * return_value - Not used | ||
162 | * | ||
163 | * RETURN: Status | ||
143 | * | 164 | * |
144 | * DESCRIPTION: Dump a single Node | 165 | * DESCRIPTION: Dump a single Node |
145 | * This procedure is a user_function called by acpi_ns_walk_namespace. | 166 | * This procedure is a user_function called by acpi_ns_walk_namespace. |
@@ -394,8 +415,7 @@ acpi_ns_dump_one_object ( | |||
394 | return (AE_OK); | 415 | return (AE_OK); |
395 | } | 416 | } |
396 | 417 | ||
397 | acpi_os_printf ("(R%d)", | 418 | acpi_os_printf ("(R%d)", obj_desc->common.reference_count); |
398 | obj_desc->common.reference_count); | ||
399 | 419 | ||
400 | switch (type) { | 420 | switch (type) { |
401 | case ACPI_TYPE_METHOD: | 421 | case ACPI_TYPE_METHOD: |
@@ -551,18 +571,20 @@ cleanup: | |||
551 | 571 | ||
552 | 572 | ||
553 | #ifdef ACPI_FUTURE_USAGE | 573 | #ifdef ACPI_FUTURE_USAGE |
554 | |||
555 | /******************************************************************************* | 574 | /******************************************************************************* |
556 | * | 575 | * |
557 | * FUNCTION: acpi_ns_dump_objects | 576 | * FUNCTION: acpi_ns_dump_objects |
558 | * | 577 | * |
559 | * PARAMETERS: Type - Object type to be dumped | 578 | * PARAMETERS: Type - Object type to be dumped |
579 | * display_type - 0 or ACPI_DISPLAY_SUMMARY | ||
560 | * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX | 580 | * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX |
561 | * for an effectively unlimited depth. | 581 | * for an effectively unlimited depth. |
562 | * owner_id - Dump only objects owned by this ID. Use | 582 | * owner_id - Dump only objects owned by this ID. Use |
563 | * ACPI_UINT32_MAX to match all owners. | 583 | * ACPI_UINT32_MAX to match all owners. |
564 | * start_handle - Where in namespace to start/end search | 584 | * start_handle - Where in namespace to start/end search |
565 | * | 585 | * |
586 | * RETURN: None | ||
587 | * | ||
566 | * DESCRIPTION: Dump typed objects within the loaded namespace. | 588 | * DESCRIPTION: Dump typed objects within the loaded namespace. |
567 | * Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. | 589 | * Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. |
568 | * | 590 | * |
@@ -590,10 +612,44 @@ acpi_ns_dump_objects ( | |||
590 | ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object, | 612 | ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object, |
591 | (void *) &info, NULL); | 613 | (void *) &info, NULL); |
592 | } | 614 | } |
615 | #endif /* ACPI_FUTURE_USAGE */ | ||
593 | 616 | ||
594 | 617 | ||
595 | /******************************************************************************* | 618 | /******************************************************************************* |
596 | * | 619 | * |
620 | * FUNCTION: acpi_ns_dump_entry | ||
621 | * | ||
622 | * PARAMETERS: Handle - Node to be dumped | ||
623 | * debug_level - Output level | ||
624 | * | ||
625 | * RETURN: None | ||
626 | * | ||
627 | * DESCRIPTION: Dump a single Node | ||
628 | * | ||
629 | ******************************************************************************/ | ||
630 | |||
631 | void | ||
632 | acpi_ns_dump_entry ( | ||
633 | acpi_handle handle, | ||
634 | u32 debug_level) | ||
635 | { | ||
636 | struct acpi_walk_info info; | ||
637 | |||
638 | |||
639 | ACPI_FUNCTION_ENTRY (); | ||
640 | |||
641 | |||
642 | info.debug_level = debug_level; | ||
643 | info.owner_id = ACPI_UINT32_MAX; | ||
644 | info.display_type = ACPI_DISPLAY_SUMMARY; | ||
645 | |||
646 | (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); | ||
647 | } | ||
648 | |||
649 | |||
650 | #ifdef _ACPI_ASL_COMPILER | ||
651 | /******************************************************************************* | ||
652 | * | ||
597 | * FUNCTION: acpi_ns_dump_tables | 653 | * FUNCTION: acpi_ns_dump_tables |
598 | * | 654 | * |
599 | * PARAMETERS: search_base - Root of subtree to be dumped, or | 655 | * PARAMETERS: search_base - Root of subtree to be dumped, or |
@@ -601,6 +657,8 @@ acpi_ns_dump_objects ( | |||
601 | * max_depth - Maximum depth of dump. Use INT_MAX | 657 | * max_depth - Maximum depth of dump. Use INT_MAX |
602 | * for an effectively unlimited depth. | 658 | * for an effectively unlimited depth. |
603 | * | 659 | * |
660 | * RETURN: None | ||
661 | * | ||
604 | * DESCRIPTION: Dump the name space, or a portion of it. | 662 | * DESCRIPTION: Dump the name space, or a portion of it. |
605 | * | 663 | * |
606 | ******************************************************************************/ | 664 | ******************************************************************************/ |
@@ -626,7 +684,7 @@ acpi_ns_dump_tables ( | |||
626 | } | 684 | } |
627 | 685 | ||
628 | if (ACPI_NS_ALL == search_base) { | 686 | if (ACPI_NS_ALL == search_base) { |
629 | /* entire namespace */ | 687 | /* Entire namespace */ |
630 | 688 | ||
631 | search_handle = acpi_gbl_root_node; | 689 | search_handle = acpi_gbl_root_node; |
632 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); | 690 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); |
@@ -636,38 +694,5 @@ acpi_ns_dump_tables ( | |||
636 | ACPI_UINT32_MAX, search_handle); | 694 | ACPI_UINT32_MAX, search_handle); |
637 | return_VOID; | 695 | return_VOID; |
638 | } | 696 | } |
639 | 697 | #endif /* _ACPI_ASL_COMPILER */ | |
640 | #endif /* ACPI_FUTURE_USAGE */ | 698 | #endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ |
641 | |||
642 | |||
643 | /******************************************************************************* | ||
644 | * | ||
645 | * FUNCTION: acpi_ns_dump_entry | ||
646 | * | ||
647 | * PARAMETERS: Handle - Node to be dumped | ||
648 | * debug_level - Output level | ||
649 | * | ||
650 | * DESCRIPTION: Dump a single Node | ||
651 | * | ||
652 | ******************************************************************************/ | ||
653 | |||
654 | void | ||
655 | acpi_ns_dump_entry ( | ||
656 | acpi_handle handle, | ||
657 | u32 debug_level) | ||
658 | { | ||
659 | struct acpi_walk_info info; | ||
660 | |||
661 | |||
662 | ACPI_FUNCTION_ENTRY (); | ||
663 | |||
664 | |||
665 | info.debug_level = debug_level; | ||
666 | info.owner_id = ACPI_UINT32_MAX; | ||
667 | info.display_type = ACPI_DISPLAY_SUMMARY; | ||
668 | |||
669 | (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); | ||
670 | } | ||
671 | |||
672 | #endif | ||
673 | |||
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index d30a59e6b07d..27c4f7cd2a43 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -43,15 +43,18 @@ | |||
43 | 43 | ||
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | ||
47 | 46 | ||
48 | 47 | ||
48 | /* TBD: This entire module is apparently obsolete and should be removed */ | ||
49 | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nsdumpdv") | 51 | ACPI_MODULE_NAME ("nsdumpdv") |
51 | 52 | ||
52 | 53 | #ifdef ACPI_OBSOLETE_FUNCTIONS | |
53 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 54 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
54 | 55 | ||
56 | #include <acpi/acnamesp.h> | ||
57 | |||
55 | /******************************************************************************* | 58 | /******************************************************************************* |
56 | * | 59 | * |
57 | * FUNCTION: acpi_ns_dump_one_device | 60 | * FUNCTION: acpi_ns_dump_one_device |
@@ -59,13 +62,16 @@ | |||
59 | * PARAMETERS: Handle - Node to be dumped | 62 | * PARAMETERS: Handle - Node to be dumped |
60 | * Level - Nesting level of the handle | 63 | * Level - Nesting level of the handle |
61 | * Context - Passed into walk_namespace | 64 | * Context - Passed into walk_namespace |
65 | * return_value - Not used | ||
66 | * | ||
67 | * RETURN: Status | ||
62 | * | 68 | * |
63 | * DESCRIPTION: Dump a single Node that represents a device | 69 | * DESCRIPTION: Dump a single Node that represents a device |
64 | * This procedure is a user_function called by acpi_ns_walk_namespace. | 70 | * This procedure is a user_function called by acpi_ns_walk_namespace. |
65 | * | 71 | * |
66 | ******************************************************************************/ | 72 | ******************************************************************************/ |
67 | 73 | ||
68 | acpi_status | 74 | static acpi_status |
69 | acpi_ns_dump_one_device ( | 75 | acpi_ns_dump_one_device ( |
70 | acpi_handle obj_handle, | 76 | acpi_handle obj_handle, |
71 | u32 level, | 77 | u32 level, |
@@ -108,12 +114,15 @@ acpi_ns_dump_one_device ( | |||
108 | * | 114 | * |
109 | * PARAMETERS: None | 115 | * PARAMETERS: None |
110 | * | 116 | * |
117 | * RETURN: None | ||
118 | * | ||
111 | * DESCRIPTION: Dump all objects of type "device" | 119 | * DESCRIPTION: Dump all objects of type "device" |
112 | * | 120 | * |
113 | ******************************************************************************/ | 121 | ******************************************************************************/ |
114 | 122 | ||
115 | void | 123 | void |
116 | acpi_ns_dump_root_devices (void) | 124 | acpi_ns_dump_root_devices ( |
125 | void) | ||
117 | { | 126 | { |
118 | acpi_handle sys_bus_handle; | 127 | acpi_handle sys_bus_handle; |
119 | acpi_status status; | 128 | acpi_status status; |
@@ -142,5 +151,6 @@ acpi_ns_dump_root_devices (void) | |||
142 | } | 151 | } |
143 | 152 | ||
144 | #endif | 153 | #endif |
154 | #endif | ||
145 | 155 | ||
146 | 156 | ||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 0d008d53657e..1ae89a1c8826 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -52,19 +52,33 @@ | |||
52 | #define _COMPONENT ACPI_NAMESPACE | 52 | #define _COMPONENT ACPI_NAMESPACE |
53 | ACPI_MODULE_NAME ("nseval") | 53 | ACPI_MODULE_NAME ("nseval") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static acpi_status | ||
58 | acpi_ns_execute_control_method ( | ||
59 | struct acpi_parameter_info *info); | ||
60 | |||
61 | static acpi_status | ||
62 | acpi_ns_get_object_value ( | ||
63 | struct acpi_parameter_info *info); | ||
64 | |||
55 | 65 | ||
56 | /******************************************************************************* | 66 | /******************************************************************************* |
57 | * | 67 | * |
58 | * FUNCTION: acpi_ns_evaluate_relative | 68 | * FUNCTION: acpi_ns_evaluate_relative |
59 | * | 69 | * |
60 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the | 70 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the |
61 | * handle is the object to execute | 71 | * handle is the object to execute |
62 | * Info - Method info block | 72 | * Info - Method info block, contains: |
73 | * return_object - Where to put method's return value (if | ||
74 | * any). If NULL, no value is returned. | ||
75 | * Params - List of parameters to pass to the method, | ||
76 | * terminated by NULL. Params itself may be | ||
77 | * NULL if no parameters are being passed. | ||
63 | * | 78 | * |
64 | * RETURN: Status | 79 | * RETURN: Status |
65 | * | 80 | * |
66 | * DESCRIPTION: Find and execute the requested method using the handle as a | 81 | * DESCRIPTION: Evaluate the object or find and execute the requested method |
67 | * scope | ||
68 | * | 82 | * |
69 | * MUTEX: Locks Namespace | 83 | * MUTEX: Locks Namespace |
70 | * | 84 | * |
@@ -157,8 +171,8 @@ cleanup1: | |||
157 | * | 171 | * |
158 | * FUNCTION: acpi_ns_evaluate_by_name | 172 | * FUNCTION: acpi_ns_evaluate_by_name |
159 | * | 173 | * |
160 | * PARAMETERS: Pathname - Fully qualified pathname to the object | 174 | * PARAMETERS: Pathname - Fully qualified pathname to the object |
161 | * Info - Contains: | 175 | * Info - Method info block, contains: |
162 | * return_object - Where to put method's return value (if | 176 | * return_object - Where to put method's return value (if |
163 | * any). If NULL, no value is returned. | 177 | * any). If NULL, no value is returned. |
164 | * Params - List of parameters to pass to the method, | 178 | * Params - List of parameters to pass to the method, |
@@ -167,8 +181,8 @@ cleanup1: | |||
167 | * | 181 | * |
168 | * RETURN: Status | 182 | * RETURN: Status |
169 | * | 183 | * |
170 | * DESCRIPTION: Find and execute the requested method passing the given | 184 | * DESCRIPTION: Evaluate the object or rind and execute the requested method |
171 | * parameters | 185 | * passing the given parameters |
172 | * | 186 | * |
173 | * MUTEX: Locks Namespace | 187 | * MUTEX: Locks Namespace |
174 | * | 188 | * |
@@ -241,17 +255,21 @@ cleanup: | |||
241 | * | 255 | * |
242 | * FUNCTION: acpi_ns_evaluate_by_handle | 256 | * FUNCTION: acpi_ns_evaluate_by_handle |
243 | * | 257 | * |
244 | * PARAMETERS: Handle - Method Node to execute | 258 | * PARAMETERS: Info - Method info block, contains: |
245 | * Params - List of parameters to pass to the method, | 259 | * Node - Method/Object Node to execute |
246 | * terminated by NULL. Params itself may be | 260 | * Parameters - List of parameters to pass to the method, |
261 | * terminated by NULL. Params itself may be | ||
247 | * NULL if no parameters are being passed. | 262 | * NULL if no parameters are being passed. |
248 | * param_type - Type of Parameter list | 263 | * return_object - Where to put method's return value (if |
249 | * return_object - Where to put method's return value (if | 264 | * any). If NULL, no value is returned. |
250 | * any). If NULL, no value is returned. | 265 | * parameter_type - Type of Parameter list |
266 | * return_object - Where to put method's return value (if | ||
267 | * any). If NULL, no value is returned. | ||
251 | * | 268 | * |
252 | * RETURN: Status | 269 | * RETURN: Status |
253 | * | 270 | * |
254 | * DESCRIPTION: Execute the requested method passing the given parameters | 271 | * DESCRIPTION: Evaluate object or execute the requested method passing the |
272 | * given parameters | ||
255 | * | 273 | * |
256 | * MUTEX: Locks Namespace | 274 | * MUTEX: Locks Namespace |
257 | * | 275 | * |
@@ -345,7 +363,16 @@ acpi_ns_evaluate_by_handle ( | |||
345 | * | 363 | * |
346 | * FUNCTION: acpi_ns_execute_control_method | 364 | * FUNCTION: acpi_ns_execute_control_method |
347 | * | 365 | * |
348 | * PARAMETERS: Info - Method info block (w/params) | 366 | * PARAMETERS: Info - Method info block, contains: |
367 | * Node - Method Node to execute | ||
368 | * Parameters - List of parameters to pass to the method, | ||
369 | * terminated by NULL. Params itself may be | ||
370 | * NULL if no parameters are being passed. | ||
371 | * return_object - Where to put method's return value (if | ||
372 | * any). If NULL, no value is returned. | ||
373 | * parameter_type - Type of Parameter list | ||
374 | * return_object - Where to put method's return value (if | ||
375 | * any). If NULL, no value is returned. | ||
349 | * | 376 | * |
350 | * RETURN: Status | 377 | * RETURN: Status |
351 | * | 378 | * |
@@ -355,7 +382,7 @@ acpi_ns_evaluate_by_handle ( | |||
355 | * | 382 | * |
356 | ******************************************************************************/ | 383 | ******************************************************************************/ |
357 | 384 | ||
358 | acpi_status | 385 | static acpi_status |
359 | acpi_ns_execute_control_method ( | 386 | acpi_ns_execute_control_method ( |
360 | struct acpi_parameter_info *info) | 387 | struct acpi_parameter_info *info) |
361 | { | 388 | { |
@@ -414,7 +441,10 @@ acpi_ns_execute_control_method ( | |||
414 | * | 441 | * |
415 | * FUNCTION: acpi_ns_get_object_value | 442 | * FUNCTION: acpi_ns_get_object_value |
416 | * | 443 | * |
417 | * PARAMETERS: Info - Method info block (w/params) | 444 | * PARAMETERS: Info - Method info block, contains: |
445 | * Node - Object's NS node | ||
446 | * return_object - Where to put object value (if | ||
447 | * any). If NULL, no value is returned. | ||
418 | * | 448 | * |
419 | * RETURN: Status | 449 | * RETURN: Status |
420 | * | 450 | * |
@@ -424,7 +454,7 @@ acpi_ns_execute_control_method ( | |||
424 | * | 454 | * |
425 | ******************************************************************************/ | 455 | ******************************************************************************/ |
426 | 456 | ||
427 | acpi_status | 457 | static acpi_status |
428 | acpi_ns_get_object_value ( | 458 | acpi_ns_get_object_value ( |
429 | struct acpi_parameter_info *info) | 459 | struct acpi_parameter_info *info) |
430 | { | 460 | { |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 4a46b380605b..362802ae29a2 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -50,6 +50,22 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsinit") | 51 | ACPI_MODULE_NAME ("nsinit") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static acpi_status | ||
56 | acpi_ns_init_one_object ( | ||
57 | acpi_handle obj_handle, | ||
58 | u32 level, | ||
59 | void *context, | ||
60 | void **return_value); | ||
61 | |||
62 | static acpi_status | ||
63 | acpi_ns_init_one_device ( | ||
64 | acpi_handle obj_handle, | ||
65 | u32 nesting_level, | ||
66 | void *context, | ||
67 | void **return_value); | ||
68 | |||
53 | 69 | ||
54 | /******************************************************************************* | 70 | /******************************************************************************* |
55 | * | 71 | * |
@@ -191,7 +207,7 @@ acpi_ns_initialize_devices ( | |||
191 | * | 207 | * |
192 | ******************************************************************************/ | 208 | ******************************************************************************/ |
193 | 209 | ||
194 | acpi_status | 210 | static acpi_status |
195 | acpi_ns_init_one_object ( | 211 | acpi_ns_init_one_object ( |
196 | acpi_handle obj_handle, | 212 | acpi_handle obj_handle, |
197 | u32 level, | 213 | u32 level, |
@@ -331,7 +347,7 @@ acpi_ns_init_one_object ( | |||
331 | * | 347 | * |
332 | ******************************************************************************/ | 348 | ******************************************************************************/ |
333 | 349 | ||
334 | acpi_status | 350 | static acpi_status |
335 | acpi_ns_init_one_device ( | 351 | acpi_ns_init_one_device ( |
336 | acpi_handle obj_handle, | 352 | acpi_handle obj_handle, |
337 | u32 nesting_level, | 353 | u32 nesting_level, |
@@ -374,7 +390,8 @@ acpi_ns_init_one_device ( | |||
374 | /* | 390 | /* |
375 | * Run _STA to determine if we can run _INI on the device. | 391 | * Run _STA to determine if we can run _INI on the device. |
376 | */ | 392 | */ |
377 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_STA")); | 393 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, |
394 | pinfo.node, METHOD_NAME__STA)); | ||
378 | status = acpi_ut_execute_STA (pinfo.node, &flags); | 395 | status = acpi_ut_execute_STA (pinfo.node, &flags); |
379 | 396 | ||
380 | if (ACPI_FAILURE (status)) { | 397 | if (ACPI_FAILURE (status)) { |
@@ -399,8 +416,9 @@ acpi_ns_init_one_device ( | |||
399 | /* | 416 | /* |
400 | * The device is present. Run _INI. | 417 | * The device is present. Run _INI. |
401 | */ | 418 | */ |
402 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_INI")); | 419 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, |
403 | status = acpi_ns_evaluate_relative ("_INI", &pinfo); | 420 | pinfo.node, METHOD_NAME__INI)); |
421 | status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo); | ||
404 | if (ACPI_FAILURE (status)) { | 422 | if (ACPI_FAILURE (status)) { |
405 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ | 423 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ |
406 | 424 | ||
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 1d7aedf68a77..34e497016601 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -50,9 +50,24 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsload") | 51 | ACPI_MODULE_NAME ("nsload") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #ifndef ACPI_NO_METHOD_EXECUTION | 55 | static acpi_status |
56 | acpi_ns_load_table_by_type ( | ||
57 | acpi_table_type table_type); | ||
58 | |||
59 | #ifdef ACPI_FUTURE_IMPLEMENTATION | ||
60 | acpi_status | ||
61 | acpi_ns_unload_namespace ( | ||
62 | acpi_handle handle); | ||
63 | |||
64 | static acpi_status | ||
65 | acpi_ns_delete_subtree ( | ||
66 | acpi_handle start_handle); | ||
67 | #endif | ||
55 | 68 | ||
69 | |||
70 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
56 | /******************************************************************************* | 71 | /******************************************************************************* |
57 | * | 72 | * |
58 | * FUNCTION: acpi_ns_load_table | 73 | * FUNCTION: acpi_ns_load_table |
@@ -159,7 +174,7 @@ acpi_ns_load_table ( | |||
159 | * | 174 | * |
160 | ******************************************************************************/ | 175 | ******************************************************************************/ |
161 | 176 | ||
162 | acpi_status | 177 | static acpi_status |
163 | acpi_ns_load_table_by_type ( | 178 | acpi_ns_load_table_by_type ( |
164 | acpi_table_type table_type) | 179 | acpi_table_type table_type) |
165 | { | 180 | { |
@@ -321,8 +336,7 @@ acpi_ns_load_namespace ( | |||
321 | } | 336 | } |
322 | 337 | ||
323 | 338 | ||
324 | #ifdef ACPI_FUTURE_USAGE | 339 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
325 | |||
326 | /******************************************************************************* | 340 | /******************************************************************************* |
327 | * | 341 | * |
328 | * FUNCTION: acpi_ns_delete_subtree | 342 | * FUNCTION: acpi_ns_delete_subtree |
@@ -339,7 +353,7 @@ acpi_ns_load_namespace ( | |||
339 | * | 353 | * |
340 | ******************************************************************************/ | 354 | ******************************************************************************/ |
341 | 355 | ||
342 | acpi_status | 356 | static acpi_status |
343 | acpi_ns_delete_subtree ( | 357 | acpi_ns_delete_subtree ( |
344 | acpi_handle start_handle) | 358 | acpi_handle start_handle) |
345 | { | 359 | { |
@@ -453,8 +467,6 @@ acpi_ns_unload_namespace ( | |||
453 | 467 | ||
454 | return_ACPI_STATUS (status); | 468 | return_ACPI_STATUS (status); |
455 | } | 469 | } |
456 | 470 | #endif | |
457 | #endif /* ACPI_FUTURE_USAGE */ | ||
458 | |||
459 | #endif | 471 | #endif |
460 | 472 | ||
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index b6f8f910eff0..d8ce7e39795f 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -50,6 +50,14 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsnames") | 51 | ACPI_MODULE_NAME ("nsnames") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static void | ||
56 | acpi_ns_build_external_path ( | ||
57 | struct acpi_namespace_node *node, | ||
58 | acpi_size size, | ||
59 | char *name_buffer); | ||
60 | |||
53 | 61 | ||
54 | /******************************************************************************* | 62 | /******************************************************************************* |
55 | * | 63 | * |
@@ -66,7 +74,7 @@ | |||
66 | * | 74 | * |
67 | ******************************************************************************/ | 75 | ******************************************************************************/ |
68 | 76 | ||
69 | void | 77 | static void |
70 | acpi_ns_build_external_path ( | 78 | acpi_ns_build_external_path ( |
71 | struct acpi_namespace_node *node, | 79 | struct acpi_namespace_node *node, |
72 | acpi_size size, | 80 | acpi_size size, |
@@ -126,7 +134,7 @@ acpi_ns_build_external_path ( | |||
126 | * | 134 | * |
127 | * FUNCTION: acpi_ns_get_external_pathname | 135 | * FUNCTION: acpi_ns_get_external_pathname |
128 | * | 136 | * |
129 | * PARAMETERS: Node - NS node whose pathname is needed | 137 | * PARAMETERS: Node - Namespace node whose pathname is needed |
130 | * | 138 | * |
131 | * RETURN: Pointer to storage containing the fully qualified name of | 139 | * RETURN: Pointer to storage containing the fully qualified name of |
132 | * the node, In external format (name segments separated by path | 140 | * the node, In external format (name segments separated by path |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 4e41e66db61f..27258c1ca4f1 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -60,6 +60,8 @@ | |||
60 | * Type - Type of object, or ACPI_TYPE_ANY if not | 60 | * Type - Type of object, or ACPI_TYPE_ANY if not |
61 | * known | 61 | * known |
62 | * | 62 | * |
63 | * RETURN: Status | ||
64 | * | ||
63 | * DESCRIPTION: Record the given object as the value associated with the | 65 | * DESCRIPTION: Record the given object as the value associated with the |
64 | * name whose acpi_handle is passed. If Object is NULL | 66 | * name whose acpi_handle is passed. If Object is NULL |
65 | * and Type is ACPI_TYPE_ANY, set the name as having no value. | 67 | * and Type is ACPI_TYPE_ANY, set the name as having no value. |
@@ -97,7 +99,8 @@ acpi_ns_attach_object ( | |||
97 | if (!object && (ACPI_TYPE_ANY != type)) { | 99 | if (!object && (ACPI_TYPE_ANY != type)) { |
98 | /* Null object */ | 100 | /* Null object */ |
99 | 101 | ||
100 | ACPI_REPORT_ERROR (("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); | 102 | ACPI_REPORT_ERROR (( |
103 | "ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); | ||
101 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 104 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
102 | } | 105 | } |
103 | 106 | ||
@@ -112,7 +115,8 @@ acpi_ns_attach_object ( | |||
112 | /* Check if this object is already attached */ | 115 | /* Check if this object is already attached */ |
113 | 116 | ||
114 | if (node->object == object) { | 117 | if (node->object == object) { |
115 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj %p already installed in name_obj %p\n", | 118 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
119 | "Obj %p already installed in name_obj %p\n", | ||
116 | object, node)); | 120 | object, node)); |
117 | 121 | ||
118 | return_ACPI_STATUS (AE_OK); | 122 | return_ACPI_STATUS (AE_OK); |
@@ -192,7 +196,7 @@ acpi_ns_attach_object ( | |||
192 | * | 196 | * |
193 | * FUNCTION: acpi_ns_detach_object | 197 | * FUNCTION: acpi_ns_detach_object |
194 | * | 198 | * |
195 | * PARAMETERS: Node - An node whose object will be detached | 199 | * PARAMETERS: Node - A Namespace node whose object will be detached |
196 | * | 200 | * |
197 | * RETURN: None. | 201 | * RETURN: None. |
198 | * | 202 | * |
@@ -248,7 +252,7 @@ acpi_ns_detach_object ( | |||
248 | * | 252 | * |
249 | * FUNCTION: acpi_ns_get_attached_object | 253 | * FUNCTION: acpi_ns_get_attached_object |
250 | * | 254 | * |
251 | * PARAMETERS: Node - Parent Node to be examined | 255 | * PARAMETERS: Node - Namespace node |
252 | * | 256 | * |
253 | * RETURN: Current value of the object field from the Node whose | 257 | * RETURN: Current value of the object field from the Node whose |
254 | * handle is passed | 258 | * handle is passed |
@@ -284,7 +288,7 @@ acpi_ns_get_attached_object ( | |||
284 | * | 288 | * |
285 | * FUNCTION: acpi_ns_get_secondary_object | 289 | * FUNCTION: acpi_ns_get_secondary_object |
286 | * | 290 | * |
287 | * PARAMETERS: Node - Parent Node to be examined | 291 | * PARAMETERS: Node - Namespace node |
288 | * | 292 | * |
289 | * RETURN: Current value of the object field from the Node whose | 293 | * RETURN: Current value of the object field from the Node whose |
290 | * handle is passed. | 294 | * handle is passed. |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 0e6dea23603b..af8aaa9cc4f3 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -49,15 +49,24 @@ | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nssearch") | 50 | ACPI_MODULE_NAME ("nssearch") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ns_search_parent_tree ( | ||
56 | u32 target_name, | ||
57 | struct acpi_namespace_node *node, | ||
58 | acpi_object_type type, | ||
59 | struct acpi_namespace_node **return_node); | ||
60 | |||
52 | 61 | ||
53 | /******************************************************************************* | 62 | /******************************************************************************* |
54 | * | 63 | * |
55 | * FUNCTION: acpi_ns_search_node | 64 | * FUNCTION: acpi_ns_search_node |
56 | * | 65 | * |
57 | * PARAMETERS: *target_name - Ascii ACPI name to search for | 66 | * PARAMETERS: target_name - Ascii ACPI name to search for |
58 | * *Node - Starting node where search will begin | 67 | * Node - Starting node where search will begin |
59 | * Type - Object type to match | 68 | * Type - Object type to match |
60 | * **return_node - Where the matched Named obj is returned | 69 | * return_node - Where the matched Named obj is returned |
61 | * | 70 | * |
62 | * RETURN: Status | 71 | * RETURN: Status |
63 | * | 72 | * |
@@ -163,10 +172,10 @@ acpi_ns_search_node ( | |||
163 | * | 172 | * |
164 | * FUNCTION: acpi_ns_search_parent_tree | 173 | * FUNCTION: acpi_ns_search_parent_tree |
165 | * | 174 | * |
166 | * PARAMETERS: *target_name - Ascii ACPI name to search for | 175 | * PARAMETERS: target_name - Ascii ACPI name to search for |
167 | * *Node - Starting node where search will begin | 176 | * Node - Starting node where search will begin |
168 | * Type - Object type to match | 177 | * Type - Object type to match |
169 | * **return_node - Where the matched Node is returned | 178 | * return_node - Where the matched Node is returned |
170 | * | 179 | * |
171 | * RETURN: Status | 180 | * RETURN: Status |
172 | * | 181 | * |
@@ -257,12 +266,12 @@ acpi_ns_search_parent_tree ( | |||
257 | * | 266 | * |
258 | * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars) | 267 | * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars) |
259 | * walk_state - Current state of the walk | 268 | * walk_state - Current state of the walk |
260 | * *Node - Starting node where search will begin | 269 | * Node - Starting node where search will begin |
261 | * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x. | 270 | * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x. |
262 | * Otherwise,search only. | 271 | * Otherwise,search only. |
263 | * Type - Object type to match | 272 | * Type - Object type to match |
264 | * Flags - Flags describing the search restrictions | 273 | * Flags - Flags describing the search restrictions |
265 | * **return_node - Where the Node is returned | 274 | * return_node - Where the Node is returned |
266 | * | 275 | * |
267 | * RETURN: Status | 276 | * RETURN: Status |
268 | * | 277 | * |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 75da76cc0b19..c53b82e94ce3 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -51,6 +51,18 @@ | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME ("nsutils") | 52 | ACPI_MODULE_NAME ("nsutils") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
55 | |||
56 | static u8 | ||
57 | acpi_ns_valid_path_separator ( | ||
58 | char sep); | ||
59 | |||
60 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
61 | acpi_name | ||
62 | acpi_ns_find_parent_name ( | ||
63 | struct acpi_namespace_node *node_to_search); | ||
64 | #endif | ||
65 | |||
54 | 66 | ||
55 | /******************************************************************************* | 67 | /******************************************************************************* |
56 | * | 68 | * |
@@ -59,7 +71,8 @@ | |||
59 | * PARAMETERS: module_name - Caller's module name (for error output) | 71 | * PARAMETERS: module_name - Caller's module name (for error output) |
60 | * line_number - Caller's line number (for error output) | 72 | * line_number - Caller's line number (for error output) |
61 | * component_id - Caller's component ID (for error output) | 73 | * component_id - Caller's component ID (for error output) |
62 | * Message - Error message to use on failure | 74 | * internal_name - Name or path of the namespace node |
75 | * lookup_status - Exception code from NS lookup | ||
63 | * | 76 | * |
64 | * RETURN: None | 77 | * RETURN: None |
65 | * | 78 | * |
@@ -121,6 +134,9 @@ acpi_ns_report_error ( | |||
121 | * line_number - Caller's line number (for error output) | 134 | * line_number - Caller's line number (for error output) |
122 | * component_id - Caller's component ID (for error output) | 135 | * component_id - Caller's component ID (for error output) |
123 | * Message - Error message to use on failure | 136 | * Message - Error message to use on failure |
137 | * prefix_node - Prefix relative to the path | ||
138 | * Path - Path to the node | ||
139 | * method_status - Execution status | ||
124 | * | 140 | * |
125 | * RETURN: None | 141 | * RETURN: None |
126 | * | 142 | * |
@@ -161,8 +177,8 @@ acpi_ns_report_method_error ( | |||
161 | * | 177 | * |
162 | * FUNCTION: acpi_ns_print_node_pathname | 178 | * FUNCTION: acpi_ns_print_node_pathname |
163 | * | 179 | * |
164 | * PARAMETERS: Node - Object | 180 | * PARAMETERS: Node - Object |
165 | * Msg - Prefix message | 181 | * Message - Prefix message |
166 | * | 182 | * |
167 | * DESCRIPTION: Print an object's full namespace pathname | 183 | * DESCRIPTION: Print an object's full namespace pathname |
168 | * Manages allocation/freeing of a pathname buffer | 184 | * Manages allocation/freeing of a pathname buffer |
@@ -172,7 +188,7 @@ acpi_ns_report_method_error ( | |||
172 | void | 188 | void |
173 | acpi_ns_print_node_pathname ( | 189 | acpi_ns_print_node_pathname ( |
174 | struct acpi_namespace_node *node, | 190 | struct acpi_namespace_node *node, |
175 | char *msg) | 191 | char *message) |
176 | { | 192 | { |
177 | struct acpi_buffer buffer; | 193 | struct acpi_buffer buffer; |
178 | acpi_status status; | 194 | acpi_status status; |
@@ -189,8 +205,8 @@ acpi_ns_print_node_pathname ( | |||
189 | 205 | ||
190 | status = acpi_ns_handle_to_pathname (node, &buffer); | 206 | status = acpi_ns_handle_to_pathname (node, &buffer); |
191 | if (ACPI_SUCCESS (status)) { | 207 | if (ACPI_SUCCESS (status)) { |
192 | if (msg) { | 208 | if (message) { |
193 | acpi_os_printf ("%s ", msg); | 209 | acpi_os_printf ("%s ", message); |
194 | } | 210 | } |
195 | 211 | ||
196 | acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); | 212 | acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); |
@@ -224,7 +240,7 @@ acpi_ns_valid_root_prefix ( | |||
224 | * | 240 | * |
225 | * FUNCTION: acpi_ns_valid_path_separator | 241 | * FUNCTION: acpi_ns_valid_path_separator |
226 | * | 242 | * |
227 | * PARAMETERS: Sep - Character to be checked | 243 | * PARAMETERS: Sep - Character to be checked |
228 | * | 244 | * |
229 | * RETURN: TRUE if a valid path separator | 245 | * RETURN: TRUE if a valid path separator |
230 | * | 246 | * |
@@ -232,7 +248,7 @@ acpi_ns_valid_root_prefix ( | |||
232 | * | 248 | * |
233 | ******************************************************************************/ | 249 | ******************************************************************************/ |
234 | 250 | ||
235 | u8 | 251 | static u8 |
236 | acpi_ns_valid_path_separator ( | 252 | acpi_ns_valid_path_separator ( |
237 | char sep) | 253 | char sep) |
238 | { | 254 | { |
@@ -245,10 +261,12 @@ acpi_ns_valid_path_separator ( | |||
245 | * | 261 | * |
246 | * FUNCTION: acpi_ns_get_type | 262 | * FUNCTION: acpi_ns_get_type |
247 | * | 263 | * |
248 | * PARAMETERS: Handle - Parent Node to be examined | 264 | * PARAMETERS: Node - Parent Node to be examined |
249 | * | 265 | * |
250 | * RETURN: Type field from Node whose handle is passed | 266 | * RETURN: Type field from Node whose handle is passed |
251 | * | 267 | * |
268 | * DESCRIPTION: Return the type of a Namespace node | ||
269 | * | ||
252 | ******************************************************************************/ | 270 | ******************************************************************************/ |
253 | 271 | ||
254 | acpi_object_type | 272 | acpi_object_type |
@@ -271,11 +289,13 @@ acpi_ns_get_type ( | |||
271 | * | 289 | * |
272 | * FUNCTION: acpi_ns_local | 290 | * FUNCTION: acpi_ns_local |
273 | * | 291 | * |
274 | * PARAMETERS: Type - A namespace object type | 292 | * PARAMETERS: Type - A namespace object type |
275 | * | 293 | * |
276 | * RETURN: LOCAL if names must be found locally in objects of the | 294 | * RETURN: LOCAL if names must be found locally in objects of the |
277 | * passed type, 0 if enclosing scopes should be searched | 295 | * passed type, 0 if enclosing scopes should be searched |
278 | * | 296 | * |
297 | * DESCRIPTION: Returns scope rule for the given object type. | ||
298 | * | ||
279 | ******************************************************************************/ | 299 | ******************************************************************************/ |
280 | 300 | ||
281 | u32 | 301 | u32 |
@@ -303,7 +323,7 @@ acpi_ns_local ( | |||
303 | * PARAMETERS: Info - Info struct initialized with the | 323 | * PARAMETERS: Info - Info struct initialized with the |
304 | * external name pointer. | 324 | * external name pointer. |
305 | * | 325 | * |
306 | * RETURN: Status | 326 | * RETURN: None |
307 | * | 327 | * |
308 | * DESCRIPTION: Calculate the length of the internal (AML) namestring | 328 | * DESCRIPTION: Calculate the length of the internal (AML) namestring |
309 | * corresponding to the external (ASL) namestring. | 329 | * corresponding to the external (ASL) namestring. |
@@ -551,14 +571,16 @@ acpi_ns_internalize_name ( | |||
551 | * | 571 | * |
552 | * FUNCTION: acpi_ns_externalize_name | 572 | * FUNCTION: acpi_ns_externalize_name |
553 | * | 573 | * |
554 | * PARAMETERS: *internal_name - Internal representation of name | 574 | * PARAMETERS: internal_name_length - Lenth of the internal name below |
555 | * **converted_name - Where to return the resulting | 575 | * internal_name - Internal representation of name |
556 | * external representation of name | 576 | * converted_name_length - Where the length is returned |
577 | * converted_name - Where the resulting external name | ||
578 | * is returned | ||
557 | * | 579 | * |
558 | * RETURN: Status | 580 | * RETURN: Status |
559 | * | 581 | * |
560 | * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) | 582 | * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) |
561 | * to its external form (e.g. "\_PR_.CPU0") | 583 | * to its external (printable) form (e.g. "\_PR_.CPU0") |
562 | * | 584 | * |
563 | ******************************************************************************/ | 585 | ******************************************************************************/ |
564 | 586 | ||
@@ -717,8 +739,9 @@ acpi_ns_externalize_name ( | |||
717 | * | 739 | * |
718 | * DESCRIPTION: Convert a namespace handle to a real Node | 740 | * DESCRIPTION: Convert a namespace handle to a real Node |
719 | * | 741 | * |
720 | * Note: Real integer handles allow for more verification | 742 | * Note: Real integer handles would allow for more verification |
721 | * and keep all pointers within this subsystem. | 743 | * and keep all pointers within this subsystem - however this introduces |
744 | * more (and perhaps unnecessary) overhead. | ||
722 | * | 745 | * |
723 | ******************************************************************************/ | 746 | ******************************************************************************/ |
724 | 747 | ||
@@ -775,7 +798,7 @@ acpi_ns_convert_entry_to_handle ( | |||
775 | return ((acpi_handle) node); | 798 | return ((acpi_handle) node); |
776 | 799 | ||
777 | 800 | ||
778 | /* --------------------------------------------------- | 801 | /* Example future implementation --------------------- |
779 | 802 | ||
780 | if (!Node) | 803 | if (!Node) |
781 | { | 804 | { |
@@ -801,12 +824,13 @@ acpi_ns_convert_entry_to_handle ( | |||
801 | * | 824 | * |
802 | * RETURN: none | 825 | * RETURN: none |
803 | * | 826 | * |
804 | * DESCRIPTION: free memory allocated for table storage. | 827 | * DESCRIPTION: free memory allocated for namespace and ACPI table storage. |
805 | * | 828 | * |
806 | ******************************************************************************/ | 829 | ******************************************************************************/ |
807 | 830 | ||
808 | void | 831 | void |
809 | acpi_ns_terminate (void) | 832 | acpi_ns_terminate ( |
833 | void) | ||
810 | { | 834 | { |
811 | union acpi_operand_object *obj_desc; | 835 | union acpi_operand_object *obj_desc; |
812 | 836 | ||
@@ -940,7 +964,6 @@ acpi_ns_get_node_by_path ( | |||
940 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 964 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
941 | 965 | ||
942 | cleanup: | 966 | cleanup: |
943 | /* Cleanup */ | ||
944 | if (internal_path) { | 967 | if (internal_path) { |
945 | ACPI_MEM_FREE (internal_path); | 968 | ACPI_MEM_FREE (internal_path); |
946 | } | 969 | } |
@@ -950,55 +973,6 @@ cleanup: | |||
950 | 973 | ||
951 | /******************************************************************************* | 974 | /******************************************************************************* |
952 | * | 975 | * |
953 | * FUNCTION: acpi_ns_find_parent_name | ||
954 | * | ||
955 | * PARAMETERS: *child_node - Named Obj whose name is to be found | ||
956 | * | ||
957 | * RETURN: The ACPI name | ||
958 | * | ||
959 | * DESCRIPTION: Search for the given obj in its parent scope and return the | ||
960 | * name segment, or "????" if the parent name can't be found | ||
961 | * (which "should not happen"). | ||
962 | * | ||
963 | ******************************************************************************/ | ||
964 | #ifdef ACPI_FUTURE_USAGE | ||
965 | acpi_name | ||
966 | acpi_ns_find_parent_name ( | ||
967 | struct acpi_namespace_node *child_node) | ||
968 | { | ||
969 | struct acpi_namespace_node *parent_node; | ||
970 | |||
971 | |||
972 | ACPI_FUNCTION_TRACE ("ns_find_parent_name"); | ||
973 | |||
974 | |||
975 | if (child_node) { | ||
976 | /* Valid entry. Get the parent Node */ | ||
977 | |||
978 | parent_node = acpi_ns_get_parent_node (child_node); | ||
979 | if (parent_node) { | ||
980 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
981 | "Parent of %p [%4.4s] is %p [%4.4s]\n", | ||
982 | child_node, acpi_ut_get_node_name (child_node), | ||
983 | parent_node, acpi_ut_get_node_name (parent_node))); | ||
984 | |||
985 | if (parent_node->name.integer) { | ||
986 | return_VALUE ((acpi_name) parent_node->name.integer); | ||
987 | } | ||
988 | } | ||
989 | |||
990 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
991 | "Unable to find parent of %p (%4.4s)\n", | ||
992 | child_node, acpi_ut_get_node_name (child_node))); | ||
993 | } | ||
994 | |||
995 | return_VALUE (ACPI_UNKNOWN_NAME); | ||
996 | } | ||
997 | #endif | ||
998 | |||
999 | |||
1000 | /******************************************************************************* | ||
1001 | * | ||
1002 | * FUNCTION: acpi_ns_get_parent_node | 976 | * FUNCTION: acpi_ns_get_parent_node |
1003 | * | 977 | * |
1004 | * PARAMETERS: Node - Current table entry | 978 | * PARAMETERS: Node - Current table entry |
@@ -1009,7 +983,6 @@ acpi_ns_find_parent_name ( | |||
1009 | * | 983 | * |
1010 | ******************************************************************************/ | 984 | ******************************************************************************/ |
1011 | 985 | ||
1012 | |||
1013 | struct acpi_namespace_node * | 986 | struct acpi_namespace_node * |
1014 | acpi_ns_get_parent_node ( | 987 | acpi_ns_get_parent_node ( |
1015 | struct acpi_namespace_node *node) | 988 | struct acpi_namespace_node *node) |
@@ -1030,7 +1003,6 @@ acpi_ns_get_parent_node ( | |||
1030 | node = node->peer; | 1003 | node = node->peer; |
1031 | } | 1004 | } |
1032 | 1005 | ||
1033 | |||
1034 | return (node->peer); | 1006 | return (node->peer); |
1035 | } | 1007 | } |
1036 | 1008 | ||
@@ -1049,7 +1021,6 @@ acpi_ns_get_parent_node ( | |||
1049 | * | 1021 | * |
1050 | ******************************************************************************/ | 1022 | ******************************************************************************/ |
1051 | 1023 | ||
1052 | |||
1053 | struct acpi_namespace_node * | 1024 | struct acpi_namespace_node * |
1054 | acpi_ns_get_next_valid_node ( | 1025 | acpi_ns_get_next_valid_node ( |
1055 | struct acpi_namespace_node *node) | 1026 | struct acpi_namespace_node *node) |
@@ -1067,3 +1038,53 @@ acpi_ns_get_next_valid_node ( | |||
1067 | } | 1038 | } |
1068 | 1039 | ||
1069 | 1040 | ||
1041 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
1042 | /******************************************************************************* | ||
1043 | * | ||
1044 | * FUNCTION: acpi_ns_find_parent_name | ||
1045 | * | ||
1046 | * PARAMETERS: *child_node - Named Obj whose name is to be found | ||
1047 | * | ||
1048 | * RETURN: The ACPI name | ||
1049 | * | ||
1050 | * DESCRIPTION: Search for the given obj in its parent scope and return the | ||
1051 | * name segment, or "????" if the parent name can't be found | ||
1052 | * (which "should not happen"). | ||
1053 | * | ||
1054 | ******************************************************************************/ | ||
1055 | |||
1056 | acpi_name | ||
1057 | acpi_ns_find_parent_name ( | ||
1058 | struct acpi_namespace_node *child_node) | ||
1059 | { | ||
1060 | struct acpi_namespace_node *parent_node; | ||
1061 | |||
1062 | |||
1063 | ACPI_FUNCTION_TRACE ("ns_find_parent_name"); | ||
1064 | |||
1065 | |||
1066 | if (child_node) { | ||
1067 | /* Valid entry. Get the parent Node */ | ||
1068 | |||
1069 | parent_node = acpi_ns_get_parent_node (child_node); | ||
1070 | if (parent_node) { | ||
1071 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
1072 | "Parent of %p [%4.4s] is %p [%4.4s]\n", | ||
1073 | child_node, acpi_ut_get_node_name (child_node), | ||
1074 | parent_node, acpi_ut_get_node_name (parent_node))); | ||
1075 | |||
1076 | if (parent_node->name.integer) { | ||
1077 | return_VALUE ((acpi_name) parent_node->name.integer); | ||
1078 | } | ||
1079 | } | ||
1080 | |||
1081 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
1082 | "Unable to find parent of %p (%4.4s)\n", | ||
1083 | child_node, acpi_ut_get_node_name (child_node))); | ||
1084 | } | ||
1085 | |||
1086 | return_VALUE (ACPI_UNKNOWN_NAME); | ||
1087 | } | ||
1088 | #endif | ||
1089 | |||
1090 | |||
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index 4de2444df300..f9a7277dca6e 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * | 56 | * |
57 | * PARAMETERS: Type - Type of node to be searched for | 57 | * PARAMETERS: Type - Type of node to be searched for |
58 | * parent_node - Parent node whose children we are | 58 | * parent_node - Parent node whose children we are |
59 | * getting | 59 | * getting |
60 | * child_node - Previous child that was found. | 60 | * child_node - Previous child that was found. |
61 | * The NEXT child will be returned | 61 | * The NEXT child will be returned |
62 | * | 62 | * |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 1dc995586cbe..12ea202257fa 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -58,11 +58,11 @@ | |||
58 | * FUNCTION: acpi_evaluate_object_typed | 58 | * FUNCTION: acpi_evaluate_object_typed |
59 | * | 59 | * |
60 | * PARAMETERS: Handle - Object handle (optional) | 60 | * PARAMETERS: Handle - Object handle (optional) |
61 | * *Pathname - Object pathname (optional) | 61 | * Pathname - Object pathname (optional) |
62 | * **external_params - List of parameters to pass to method, | 62 | * external_params - List of parameters to pass to method, |
63 | * terminated by NULL. May be NULL | 63 | * terminated by NULL. May be NULL |
64 | * if no parameters are being passed. | 64 | * if no parameters are being passed. |
65 | * *return_buffer - Where to put method's return value (if | 65 | * return_buffer - Where to put method's return value (if |
66 | * any). If NULL, no value is returned. | 66 | * any). If NULL, no value is returned. |
67 | * return_type - Expected type of return object | 67 | * return_type - Expected type of return object |
68 | * | 68 | * |
@@ -73,6 +73,7 @@ | |||
73 | * be valid (non-null) | 73 | * be valid (non-null) |
74 | * | 74 | * |
75 | ******************************************************************************/ | 75 | ******************************************************************************/ |
76 | |||
76 | #ifdef ACPI_FUTURE_USAGE | 77 | #ifdef ACPI_FUTURE_USAGE |
77 | acpi_status | 78 | acpi_status |
78 | acpi_evaluate_object_typed ( | 79 | acpi_evaluate_object_typed ( |
@@ -307,7 +308,8 @@ acpi_evaluate_object ( | |||
307 | if (ACPI_SUCCESS (status)) { | 308 | if (ACPI_SUCCESS (status)) { |
308 | /* Validate/Allocate/Clear caller buffer */ | 309 | /* Validate/Allocate/Clear caller buffer */ |
309 | 310 | ||
310 | status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed); | 311 | status = acpi_ut_initialize_buffer (return_buffer, |
312 | buffer_space_needed); | ||
311 | if (ACPI_FAILURE (status)) { | 313 | if (ACPI_FAILURE (status)) { |
312 | /* | 314 | /* |
313 | * Caller's buffer is too small or a new one can't be allocated | 315 | * Caller's buffer is too small or a new one can't be allocated |
@@ -423,7 +425,8 @@ acpi_walk_namespace ( | |||
423 | return_ACPI_STATUS (status); | 425 | return_ACPI_STATUS (status); |
424 | } | 426 | } |
425 | 427 | ||
426 | status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK, | 428 | status = acpi_ns_walk_namespace (type, start_object, max_depth, |
429 | ACPI_NS_WALK_UNLOCK, | ||
427 | user_function, context, return_value); | 430 | user_function, context, return_value); |
428 | 431 | ||
429 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 432 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
@@ -525,7 +528,8 @@ acpi_ns_get_device_callback ( | |||
525 | } | 528 | } |
526 | } | 529 | } |
527 | 530 | ||
528 | status = info->user_function (obj_handle, nesting_level, info->context, return_value); | 531 | status = info->user_function (obj_handle, nesting_level, info->context, |
532 | return_value); | ||
529 | return (status); | 533 | return (status); |
530 | } | 534 | } |
531 | 535 | ||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index f2405efd1b9a..8d097914c49a 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -57,9 +57,9 @@ | |||
57 | * FUNCTION: acpi_get_handle | 57 | * FUNCTION: acpi_get_handle |
58 | * | 58 | * |
59 | * PARAMETERS: Parent - Object to search under (search scope). | 59 | * PARAMETERS: Parent - Object to search under (search scope). |
60 | * path_name - Pointer to an asciiz string containing the | 60 | * Pathname - Pointer to an asciiz string containing the |
61 | * name | 61 | * name |
62 | * ret_handle - Where the return handle is placed | 62 | * ret_handle - Where the return handle is returned |
63 | * | 63 | * |
64 | * RETURN: Status | 64 | * RETURN: Status |
65 | * | 65 | * |
@@ -220,7 +220,7 @@ EXPORT_SYMBOL(acpi_get_name); | |||
220 | * FUNCTION: acpi_get_object_info | 220 | * FUNCTION: acpi_get_object_info |
221 | * | 221 | * |
222 | * PARAMETERS: Handle - Object Handle | 222 | * PARAMETERS: Handle - Object Handle |
223 | * Info - Where the info is returned | 223 | * Buffer - Where the info is returned |
224 | * | 224 | * |
225 | * RETURN: Status | 225 | * RETURN: Status |
226 | * | 226 | * |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index 19acf32674b9..363e1f6cfb18 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * FUNCTION: acpi_get_type | 56 | * FUNCTION: acpi_get_type |
57 | * | 57 | * |
58 | * PARAMETERS: Handle - Handle of object whose type is desired | 58 | * PARAMETERS: Handle - Handle of object whose type is desired |
59 | * *ret_type - Where the type will be placed | 59 | * ret_type - Where the type will be placed |
60 | * | 60 | * |
61 | * RETURN: Status | 61 | * RETURN: Status |
62 | * | 62 | * |
@@ -258,5 +258,5 @@ unlock_and_exit: | |||
258 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 258 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); |
259 | return (status); | 259 | return (status); |
260 | } | 260 | } |
261 | EXPORT_SYMBOL(acpi_get_next_object); | ||
262 | 261 | ||
262 | EXPORT_SYMBOL(acpi_get_next_object); | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 5a9128de6226..0d11d6e6abd6 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -71,6 +71,9 @@ EXPORT_SYMBOL(acpi_in_debugger); | |||
71 | extern char line_buf[80]; | 71 | extern char line_buf[80]; |
72 | #endif /*ENABLE_DEBUGGER*/ | 72 | #endif /*ENABLE_DEBUGGER*/ |
73 | 73 | ||
74 | int acpi_specific_hotkey_enabled = TRUE; | ||
75 | EXPORT_SYMBOL(acpi_specific_hotkey_enabled); | ||
76 | |||
74 | static unsigned int acpi_irq_irq; | 77 | static unsigned int acpi_irq_irq; |
75 | static acpi_osd_handler acpi_irq_handler; | 78 | static acpi_osd_handler acpi_irq_handler; |
76 | static void *acpi_irq_context; | 79 | static void *acpi_irq_context; |
@@ -142,10 +145,14 @@ acpi_os_vprintf(const char *fmt, va_list args) | |||
142 | #endif | 145 | #endif |
143 | } | 146 | } |
144 | 147 | ||
148 | extern int acpi_in_resume; | ||
145 | void * | 149 | void * |
146 | acpi_os_allocate(acpi_size size) | 150 | acpi_os_allocate(acpi_size size) |
147 | { | 151 | { |
148 | return kmalloc(size, GFP_KERNEL); | 152 | if (acpi_in_resume) |
153 | return kmalloc(size, GFP_ATOMIC); | ||
154 | else | ||
155 | return kmalloc(size, GFP_KERNEL); | ||
149 | } | 156 | } |
150 | 157 | ||
151 | void | 158 | void |
@@ -1152,6 +1159,15 @@ acpi_wake_gpes_always_on_setup(char *str) | |||
1152 | 1159 | ||
1153 | __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); | 1160 | __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); |
1154 | 1161 | ||
1162 | int __init | ||
1163 | acpi_hotkey_setup(char *str) | ||
1164 | { | ||
1165 | acpi_specific_hotkey_enabled = FALSE; | ||
1166 | return 1; | ||
1167 | } | ||
1168 | |||
1169 | __setup("acpi_generic_hotkey", acpi_hotkey_setup); | ||
1170 | |||
1155 | /* | 1171 | /* |
1156 | * max_cstate is defined in the base kernel so modules can | 1172 | * max_cstate is defined in the base kernel so modules can |
1157 | * change it w/o depending on the state of the processor module. | 1173 | * change it w/o depending on the state of the processor module. |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index b5d98895f6a8..b7ac68cc9e1c 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -50,6 +50,16 @@ | |||
50 | #define _COMPONENT ACPI_PARSER | 50 | #define _COMPONENT ACPI_PARSER |
51 | ACPI_MODULE_NAME ("psargs") | 51 | ACPI_MODULE_NAME ("psargs") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static u32 | ||
56 | acpi_ps_get_next_package_length ( | ||
57 | struct acpi_parse_state *parser_state); | ||
58 | |||
59 | static union acpi_parse_object * | ||
60 | acpi_ps_get_next_field ( | ||
61 | struct acpi_parse_state *parser_state); | ||
62 | |||
53 | 63 | ||
54 | /******************************************************************************* | 64 | /******************************************************************************* |
55 | * | 65 | * |
@@ -64,7 +74,7 @@ | |||
64 | * | 74 | * |
65 | ******************************************************************************/ | 75 | ******************************************************************************/ |
66 | 76 | ||
67 | u32 | 77 | static u32 |
68 | acpi_ps_get_next_package_length ( | 78 | acpi_ps_get_next_package_length ( |
69 | struct acpi_parse_state *parser_state) | 79 | struct acpi_parse_state *parser_state) |
70 | { | 80 | { |
@@ -78,7 +88,6 @@ acpi_ps_get_next_package_length ( | |||
78 | encoded_length = (u32) ACPI_GET8 (parser_state->aml); | 88 | encoded_length = (u32) ACPI_GET8 (parser_state->aml); |
79 | parser_state->aml++; | 89 | parser_state->aml++; |
80 | 90 | ||
81 | |||
82 | switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { | 91 | switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { |
83 | case 0: /* 1-byte encoding (bits 0-5) */ | 92 | case 0: /* 1-byte encoding (bits 0-5) */ |
84 | 93 | ||
@@ -287,13 +296,14 @@ acpi_ps_get_next_namepath ( | |||
287 | * parent tree, but don't open a new scope -- we just want to lookup the | 296 | * parent tree, but don't open a new scope -- we just want to lookup the |
288 | * object (MUST BE mode EXECUTE to perform upsearch) | 297 | * object (MUST BE mode EXECUTE to perform upsearch) |
289 | */ | 298 | */ |
290 | status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 299 | status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, |
291 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); | 300 | ACPI_IMODE_EXECUTE, |
301 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | ||
302 | NULL, &node); | ||
292 | if (ACPI_SUCCESS (status) && method_call) { | 303 | if (ACPI_SUCCESS (status) && method_call) { |
293 | if (node->type == ACPI_TYPE_METHOD) { | 304 | if (node->type == ACPI_TYPE_METHOD) { |
294 | /* | 305 | /* This name is actually a control method invocation */ |
295 | * This name is actually a control method invocation | 306 | |
296 | */ | ||
297 | method_desc = acpi_ns_get_attached_object (node); | 307 | method_desc = acpi_ns_get_attached_object (node); |
298 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 308 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
299 | "Control Method - %p Desc %p Path=%p\n", | 309 | "Control Method - %p Desc %p Path=%p\n", |
@@ -360,7 +370,7 @@ acpi_ps_get_next_namepath ( | |||
360 | /* | 370 | /* |
361 | * We got a NOT_FOUND during table load or we encountered | 371 | * We got a NOT_FOUND during table load or we encountered |
362 | * a cond_ref_of(x) where the target does not exist. | 372 | * a cond_ref_of(x) where the target does not exist. |
363 | * -- either case is ok | 373 | * Either case is ok |
364 | */ | 374 | */ |
365 | status = AE_OK; | 375 | status = AE_OK; |
366 | } | 376 | } |
@@ -486,12 +496,13 @@ acpi_ps_get_next_simple_arg ( | |||
486 | * | 496 | * |
487 | ******************************************************************************/ | 497 | ******************************************************************************/ |
488 | 498 | ||
489 | union acpi_parse_object * | 499 | static union acpi_parse_object * |
490 | acpi_ps_get_next_field ( | 500 | acpi_ps_get_next_field ( |
491 | struct acpi_parse_state *parser_state) | 501 | struct acpi_parse_state *parser_state) |
492 | { | 502 | { |
493 | u32 aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, | 503 | u32 aml_offset = (u32) |
494 | parser_state->aml_start); | 504 | ACPI_PTR_DIFF (parser_state->aml, |
505 | parser_state->aml_start); | ||
495 | union acpi_parse_object *field; | 506 | union acpi_parse_object *field; |
496 | u16 opcode; | 507 | u16 opcode; |
497 | u32 name; | 508 | u32 name; |
@@ -500,7 +511,7 @@ acpi_ps_get_next_field ( | |||
500 | ACPI_FUNCTION_TRACE ("ps_get_next_field"); | 511 | ACPI_FUNCTION_TRACE ("ps_get_next_field"); |
501 | 512 | ||
502 | 513 | ||
503 | /* determine field type */ | 514 | /* Determine field type */ |
504 | 515 | ||
505 | switch (ACPI_GET8 (parser_state->aml)) { | 516 | switch (ACPI_GET8 (parser_state->aml)) { |
506 | default: | 517 | default: |
@@ -521,7 +532,6 @@ acpi_ps_get_next_field ( | |||
521 | break; | 532 | break; |
522 | } | 533 | } |
523 | 534 | ||
524 | |||
525 | /* Allocate a new field op */ | 535 | /* Allocate a new field op */ |
526 | 536 | ||
527 | field = acpi_ps_alloc_op (opcode); | 537 | field = acpi_ps_alloc_op (opcode); |
@@ -582,10 +592,10 @@ acpi_ps_get_next_field ( | |||
582 | * | 592 | * |
583 | * FUNCTION: acpi_ps_get_next_arg | 593 | * FUNCTION: acpi_ps_get_next_arg |
584 | * | 594 | * |
585 | * PARAMETERS: parser_state - Current parser state object | 595 | * PARAMETERS: walk_state - Current state |
596 | * parser_state - Current parser state object | ||
586 | * arg_type - The argument type (AML_*_ARG) | 597 | * arg_type - The argument type (AML_*_ARG) |
587 | * arg_count - If the argument points to a control method | 598 | * return_arg - Where the next arg is returned |
588 | * the method's argument is returned here. | ||
589 | * | 599 | * |
590 | * RETURN: Status, and an op object containing the next argument. | 600 | * RETURN: Status, and an op object containing the next argument. |
591 | * | 601 | * |
@@ -619,7 +629,7 @@ acpi_ps_get_next_arg ( | |||
619 | case ARGP_NAME: | 629 | case ARGP_NAME: |
620 | case ARGP_NAMESTRING: | 630 | case ARGP_NAMESTRING: |
621 | 631 | ||
622 | /* constants, strings, and namestrings are all the same size */ | 632 | /* Constants, strings, and namestrings are all the same size */ |
623 | 633 | ||
624 | arg = acpi_ps_alloc_op (AML_BYTE_OP); | 634 | arg = acpi_ps_alloc_op (AML_BYTE_OP); |
625 | if (!arg) { | 635 | if (!arg) { |
@@ -654,7 +664,6 @@ acpi_ps_get_next_arg ( | |||
654 | else { | 664 | else { |
655 | arg = field; | 665 | arg = field; |
656 | } | 666 | } |
657 | |||
658 | prev = field; | 667 | prev = field; |
659 | } | 668 | } |
660 | 669 | ||
@@ -677,8 +686,8 @@ acpi_ps_get_next_arg ( | |||
677 | 686 | ||
678 | /* Fill in bytelist data */ | 687 | /* Fill in bytelist data */ |
679 | 688 | ||
680 | arg->common.value.size = (u32) ACPI_PTR_DIFF (parser_state->pkg_end, | 689 | arg->common.value.size = (u32) |
681 | parser_state->aml); | 690 | ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml); |
682 | arg->named.data = parser_state->aml; | 691 | arg->named.data = parser_state->aml; |
683 | 692 | ||
684 | /* Skip to End of byte data */ | 693 | /* Skip to End of byte data */ |
@@ -706,7 +715,7 @@ acpi_ps_get_next_arg ( | |||
706 | status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); | 715 | status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); |
707 | } | 716 | } |
708 | else { | 717 | else { |
709 | /* single complex argument, nothing returned */ | 718 | /* Single complex argument, nothing returned */ |
710 | 719 | ||
711 | walk_state->arg_count = 1; | 720 | walk_state->arg_count = 1; |
712 | } | 721 | } |
@@ -716,7 +725,7 @@ acpi_ps_get_next_arg ( | |||
716 | case ARGP_DATAOBJ: | 725 | case ARGP_DATAOBJ: |
717 | case ARGP_TERMARG: | 726 | case ARGP_TERMARG: |
718 | 727 | ||
719 | /* single complex argument, nothing returned */ | 728 | /* Single complex argument, nothing returned */ |
720 | 729 | ||
721 | walk_state->arg_count = 1; | 730 | walk_state->arg_count = 1; |
722 | break; | 731 | break; |
@@ -727,7 +736,7 @@ acpi_ps_get_next_arg ( | |||
727 | case ARGP_OBJLIST: | 736 | case ARGP_OBJLIST: |
728 | 737 | ||
729 | if (parser_state->aml < parser_state->pkg_end) { | 738 | if (parser_state->aml < parser_state->pkg_end) { |
730 | /* non-empty list of variable arguments, nothing returned */ | 739 | /* Non-empty list of variable arguments, nothing returned */ |
731 | 740 | ||
732 | walk_state->arg_count = ACPI_VAR_ARGS; | 741 | walk_state->arg_count = ACPI_VAR_ARGS; |
733 | } | 742 | } |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 03e33fedc11a..5744673568c0 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
47 | #include <acpi/acopcode.h> | ||
47 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
48 | 49 | ||
49 | 50 | ||
@@ -51,23 +52,6 @@ | |||
51 | ACPI_MODULE_NAME ("psopcode") | 52 | ACPI_MODULE_NAME ("psopcode") |
52 | 53 | ||
53 | 54 | ||
54 | #define _UNK 0x6B | ||
55 | /* | ||
56 | * Reserved ASCII characters. Do not use any of these for | ||
57 | * internal opcodes, since they are used to differentiate | ||
58 | * name strings from AML opcodes | ||
59 | */ | ||
60 | #define _ASC 0x6C | ||
61 | #define _NAM 0x6C | ||
62 | #define _PFX 0x6D | ||
63 | #define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ | ||
64 | |||
65 | #define MAX_EXTENDED_OPCODE 0x88 | ||
66 | #define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1) | ||
67 | #define MAX_INTERNAL_OPCODE | ||
68 | #define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1) | ||
69 | |||
70 | |||
71 | /******************************************************************************* | 55 | /******************************************************************************* |
72 | * | 56 | * |
73 | * NAME: acpi_gbl_aml_op_info | 57 | * NAME: acpi_gbl_aml_op_info |
@@ -79,274 +63,9 @@ | |||
79 | * | 63 | * |
80 | ******************************************************************************/ | 64 | ******************************************************************************/ |
81 | 65 | ||
82 | |||
83 | /* | ||
84 | * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed | ||
85 | * into a 32-bit number and stored in the master opcode table at the end of this file. | ||
86 | */ | ||
87 | |||
88 | |||
89 | #define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
90 | #define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA) | ||
91 | #define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
92 | #define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME) | ||
93 | #define ARGP_ARG0 ARG_NONE | ||
94 | #define ARGP_ARG1 ARG_NONE | ||
95 | #define ARGP_ARG2 ARG_NONE | ||
96 | #define ARGP_ARG3 ARG_NONE | ||
97 | #define ARGP_ARG4 ARG_NONE | ||
98 | #define ARGP_ARG5 ARG_NONE | ||
99 | #define ARGP_ARG6 ARG_NONE | ||
100 | #define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
101 | #define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
102 | #define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
103 | #define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
104 | #define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
105 | #define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
106 | #define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
107 | #define ARGP_BREAK_OP ARG_NONE | ||
108 | #define ARGP_BREAK_POINT_OP ARG_NONE | ||
109 | #define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST) | ||
110 | #define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA) | ||
111 | #define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
112 | #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
113 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
114 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) | ||
115 | #define ARGP_CONTINUE_OP ARG_NONE | ||
116 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) | ||
117 | #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
118 | #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
119 | #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
120 | #define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
121 | #define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
122 | #define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
123 | #define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) | ||
124 | #define ARGP_DEBUG_OP ARG_NONE | ||
125 | #define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
126 | #define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG) | ||
127 | #define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) | ||
128 | #define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET) | ||
129 | #define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) | ||
130 | #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) | ||
131 | #define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) | ||
132 | #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) | ||
133 | #define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
134 | #define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
135 | #define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
136 | #define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
137 | #define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) | ||
138 | #define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
139 | #define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
140 | #define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
141 | #define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
142 | #define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
143 | #define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
144 | #define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
145 | #define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
146 | #define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
147 | #define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) | ||
148 | #define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
149 | #define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME) | ||
150 | #define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) | ||
151 | #define ARGP_LOCAL0 ARG_NONE | ||
152 | #define ARGP_LOCAL1 ARG_NONE | ||
153 | #define ARGP_LOCAL2 ARG_NONE | ||
154 | #define ARGP_LOCAL3 ARG_NONE | ||
155 | #define ARGP_LOCAL4 ARG_NONE | ||
156 | #define ARGP_LOCAL5 ARG_NONE | ||
157 | #define ARGP_LOCAL6 ARG_NONE | ||
158 | #define ARGP_LOCAL7 ARG_NONE | ||
159 | #define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
160 | #define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) | ||
161 | #define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST) | ||
162 | #define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
163 | #define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
164 | #define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
165 | #define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
166 | #define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA) | ||
167 | #define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ) | ||
168 | #define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
169 | #define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
170 | #define ARGP_NOOP_OP ARG_NONE | ||
171 | #define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | ||
172 | #define ARGP_ONE_OP ARG_NONE | ||
173 | #define ARGP_ONES_OP ARG_NONE | ||
174 | #define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) | ||
175 | #define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) | ||
176 | #define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) | ||
177 | #define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) | ||
178 | #define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
179 | #define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) | ||
180 | #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
181 | #define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
182 | #define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
183 | #define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) | ||
184 | #define ARGP_REVISION_OP ARG_NONE | ||
185 | #define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) | ||
186 | #define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
187 | #define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
188 | #define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
189 | #define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
190 | #define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG) | ||
191 | #define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG) | ||
192 | #define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
193 | #define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME) | ||
194 | #define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) | ||
195 | #define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
196 | #define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) | ||
197 | #define ARGP_TIMER_OP ARG_NONE | ||
198 | #define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
199 | #define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
200 | #define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
201 | #define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
202 | #define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
203 | #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
204 | #define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
205 | #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
206 | #define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) | ||
207 | #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | ||
208 | #define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) | ||
209 | #define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) | ||
210 | #define ARGP_ZERO_OP ARG_NONE | ||
211 | |||
212 | |||
213 | /* | ||
214 | * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed | ||
215 | * into a 32-bit number and stored in the master opcode table at the end of this file. | ||
216 | * | ||
217 | * (Used by prep_operands procedure and the ASL Compiler) | ||
218 | */ | ||
219 | |||
220 | |||
221 | #define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE | ||
222 | #define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER) | ||
223 | #define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
224 | #define ARGI_ALIAS_OP ARGI_INVALID_OPCODE | ||
225 | #define ARGI_ARG0 ARG_NONE | ||
226 | #define ARGI_ARG1 ARG_NONE | ||
227 | #define ARGI_ARG2 ARG_NONE | ||
228 | #define ARGI_ARG3 ARG_NONE | ||
229 | #define ARGI_ARG4 ARG_NONE | ||
230 | #define ARGI_ARG5 ARG_NONE | ||
231 | #define ARGI_ARG6 ARG_NONE | ||
232 | #define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE | ||
233 | #define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
234 | #define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
235 | #define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
236 | #define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
237 | #define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
238 | #define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
239 | #define ARGI_BREAK_OP ARG_NONE | ||
240 | #define ARGI_BREAK_POINT_OP ARG_NONE | ||
241 | #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) | ||
242 | #define ARGI_BYTE_OP ARGI_INVALID_OPCODE | ||
243 | #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE | ||
244 | #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) | ||
245 | #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) | ||
246 | #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) | ||
247 | #define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE | ||
248 | #define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) | ||
249 | #define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
250 | #define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
251 | #define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
252 | #define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) | ||
253 | #define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
254 | #define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
255 | #define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) | ||
256 | #define ARGI_DEBUG_OP ARG_NONE | ||
257 | #define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) | ||
258 | #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) | ||
259 | #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE | ||
260 | #define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) | ||
261 | #define ARGI_DWORD_OP ARGI_INVALID_OPCODE | ||
262 | #define ARGI_ELSE_OP ARGI_INVALID_OPCODE | ||
263 | #define ARGI_EVENT_OP ARGI_INVALID_OPCODE | ||
264 | #define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) | ||
265 | #define ARGI_FIELD_OP ARGI_INVALID_OPCODE | ||
266 | #define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
267 | #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
268 | #define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
269 | #define ARGI_IF_OP ARGI_INVALID_OPCODE | ||
270 | #define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) | ||
271 | #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE | ||
272 | #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) | ||
273 | #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
274 | #define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
275 | #define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
276 | #define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE | ||
277 | #define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
278 | #define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE | ||
279 | #define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) | ||
280 | #define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE | ||
281 | #define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF) | ||
282 | #define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE) | ||
283 | #define ARGI_LOCAL0 ARG_NONE | ||
284 | #define ARGI_LOCAL1 ARG_NONE | ||
285 | #define ARGI_LOCAL2 ARG_NONE | ||
286 | #define ARGI_LOCAL3 ARG_NONE | ||
287 | #define ARGI_LOCAL4 ARG_NONE | ||
288 | #define ARGI_LOCAL5 ARG_NONE | ||
289 | #define ARGI_LOCAL6 ARG_NONE | ||
290 | #define ARGI_LOCAL7 ARG_NONE | ||
291 | #define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
292 | #define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER) | ||
293 | #define ARGI_METHOD_OP ARGI_INVALID_OPCODE | ||
294 | #define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE | ||
295 | #define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
296 | #define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
297 | #define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
298 | #define ARGI_MUTEX_OP ARGI_INVALID_OPCODE | ||
299 | #define ARGI_NAME_OP ARGI_INVALID_OPCODE | ||
300 | #define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE | ||
301 | #define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE | ||
302 | #define ARGI_NOOP_OP ARG_NONE | ||
303 | #define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) | ||
304 | #define ARGI_ONE_OP ARG_NONE | ||
305 | #define ARGI_ONES_OP ARG_NONE | ||
306 | #define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | ||
307 | #define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE | ||
308 | #define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE | ||
309 | #define ARGI_QWORD_OP ARGI_INVALID_OPCODE | ||
310 | #define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF) | ||
311 | #define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
312 | #define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) | ||
313 | #define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE | ||
314 | #define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) | ||
315 | #define ARGI_RETURN_OP ARGI_INVALID_OPCODE | ||
316 | #define ARGI_REVISION_OP ARG_NONE | ||
317 | #define ARGI_SCOPE_OP ARGI_INVALID_OPCODE | ||
318 | #define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
319 | #define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
320 | #define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) | ||
321 | #define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) | ||
322 | #define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) | ||
323 | #define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) | ||
324 | #define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE | ||
325 | #define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF) | ||
326 | #define ARGI_STRING_OP ARGI_INVALID_OPCODE | ||
327 | #define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
328 | #define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE | ||
329 | #define ARGI_TIMER_OP ARG_NONE | ||
330 | #define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) | ||
331 | #define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
332 | #define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
333 | #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
334 | #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
335 | #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) | ||
336 | #define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) | ||
337 | #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) | ||
338 | #define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | ||
339 | #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) | ||
340 | #define ARGI_WHILE_OP ARGI_INVALID_OPCODE | ||
341 | #define ARGI_WORD_OP ARGI_INVALID_OPCODE | ||
342 | #define ARGI_ZERO_OP ARG_NONE | ||
343 | |||
344 | |||
345 | /* | 66 | /* |
346 | * Summary of opcode types/flags | 67 | * Summary of opcode types/flags |
347 | */ | 68 | * |
348 | |||
349 | /****************************************************************************** | ||
350 | 69 | ||
351 | Opcodes that have associated namespace objects (AML_NSOBJECT flag) | 70 | Opcodes that have associated namespace objects (AML_NSOBJECT flag) |
352 | 71 | ||
@@ -460,14 +179,13 @@ | |||
460 | AML_CREATE_DWORD_FIELD_OP | 179 | AML_CREATE_DWORD_FIELD_OP |
461 | AML_CREATE_QWORD_FIELD_OP | 180 | AML_CREATE_QWORD_FIELD_OP |
462 | 181 | ||
463 | ******************************************************************************/ | 182 | ******************************************************************************/ |
464 | 183 | ||
465 | 184 | ||
466 | /* | 185 | /* |
467 | * Master Opcode information table. A summary of everything we know about each opcode, all in one place. | 186 | * Master Opcode information table. A summary of everything we know about each |
187 | * opcode, all in one place. | ||
468 | */ | 188 | */ |
469 | |||
470 | |||
471 | const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = | 189 | const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = |
472 | { | 190 | { |
473 | /*! [Begin] no source code translation */ | 191 | /*! [Begin] no source code translation */ |
@@ -693,8 +411,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = | |||
693 | * | 411 | * |
694 | * PARAMETERS: Opcode - The AML opcode | 412 | * PARAMETERS: Opcode - The AML opcode |
695 | * | 413 | * |
696 | * RETURN: A pointer to the info about the opcode. NULL if the opcode was | 414 | * RETURN: A pointer to the info about the opcode. |
697 | * not found in the table. | ||
698 | * | 415 | * |
699 | * DESCRIPTION: Find AML opcode description based on the opcode. | 416 | * DESCRIPTION: Find AML opcode description based on the opcode. |
700 | * NOTE: This procedure must ALWAYS return a valid pointer! | 417 | * NOTE: This procedure must ALWAYS return a valid pointer! |
@@ -731,7 +448,8 @@ acpi_ps_get_opcode_info ( | |||
731 | 448 | ||
732 | default: | 449 | default: |
733 | 450 | ||
734 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode)); | 451 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
452 | "Unknown AML opcode [%4.4X]\n", opcode)); | ||
735 | break; | 453 | break; |
736 | } | 454 | } |
737 | 455 | ||
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index e79edb53cb3b..bbfdc1a58c27 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -64,6 +64,23 @@ | |||
64 | 64 | ||
65 | static u32 acpi_gbl_depth = 0; | 65 | static u32 acpi_gbl_depth = 0; |
66 | 66 | ||
67 | /* Local prototypes */ | ||
68 | |||
69 | static void | ||
70 | acpi_ps_complete_this_op ( | ||
71 | struct acpi_walk_state *walk_state, | ||
72 | union acpi_parse_object *op); | ||
73 | |||
74 | static acpi_status | ||
75 | acpi_ps_next_parse_state ( | ||
76 | struct acpi_walk_state *walk_state, | ||
77 | union acpi_parse_object *op, | ||
78 | acpi_status callback_status); | ||
79 | |||
80 | static acpi_status | ||
81 | acpi_ps_parse_loop ( | ||
82 | struct acpi_walk_state *walk_state); | ||
83 | |||
67 | 84 | ||
68 | /******************************************************************************* | 85 | /******************************************************************************* |
69 | * | 86 | * |
@@ -100,7 +117,7 @@ acpi_ps_get_opcode_size ( | |||
100 | * | 117 | * |
101 | * PARAMETERS: parser_state - A parser state object | 118 | * PARAMETERS: parser_state - A parser state object |
102 | * | 119 | * |
103 | * RETURN: Status | 120 | * RETURN: Next AML opcode |
104 | * | 121 | * |
105 | * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) | 122 | * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) |
106 | * | 123 | * |
@@ -117,7 +134,6 @@ acpi_ps_peek_opcode ( | |||
117 | aml = parser_state->aml; | 134 | aml = parser_state->aml; |
118 | opcode = (u16) ACPI_GET8 (aml); | 135 | opcode = (u16) ACPI_GET8 (aml); |
119 | 136 | ||
120 | |||
121 | if (opcode == AML_EXTOP) { | 137 | if (opcode == AML_EXTOP) { |
122 | /* Extended opcode */ | 138 | /* Extended opcode */ |
123 | 139 | ||
@@ -142,7 +158,7 @@ acpi_ps_peek_opcode ( | |||
142 | * | 158 | * |
143 | ******************************************************************************/ | 159 | ******************************************************************************/ |
144 | 160 | ||
145 | void | 161 | static void |
146 | acpi_ps_complete_this_op ( | 162 | acpi_ps_complete_this_op ( |
147 | struct acpi_walk_state *walk_state, | 163 | struct acpi_walk_state *walk_state, |
148 | union acpi_parse_object *op) | 164 | union acpi_parse_object *op) |
@@ -272,7 +288,6 @@ acpi_ps_complete_this_op ( | |||
272 | next = NULL; | 288 | next = NULL; |
273 | } | 289 | } |
274 | } | 290 | } |
275 | |||
276 | prev = next; | 291 | prev = next; |
277 | } | 292 | } |
278 | } | 293 | } |
@@ -280,7 +295,7 @@ acpi_ps_complete_this_op ( | |||
280 | 295 | ||
281 | cleanup: | 296 | cleanup: |
282 | 297 | ||
283 | /* Now we can actually delete the subtree rooted at op */ | 298 | /* Now we can actually delete the subtree rooted at Op */ |
284 | 299 | ||
285 | acpi_ps_delete_parse_tree (op); | 300 | acpi_ps_delete_parse_tree (op); |
286 | return_VOID; | 301 | return_VOID; |
@@ -291,7 +306,9 @@ cleanup: | |||
291 | * | 306 | * |
292 | * FUNCTION: acpi_ps_next_parse_state | 307 | * FUNCTION: acpi_ps_next_parse_state |
293 | * | 308 | * |
294 | * PARAMETERS: parser_state - Current parser state object | 309 | * PARAMETERS: walk_state - Current state |
310 | * Op - Current parse op | ||
311 | * callback_status - Status from previous operation | ||
295 | * | 312 | * |
296 | * RETURN: Status | 313 | * RETURN: Status |
297 | * | 314 | * |
@@ -300,7 +317,7 @@ cleanup: | |||
300 | * | 317 | * |
301 | ******************************************************************************/ | 318 | ******************************************************************************/ |
302 | 319 | ||
303 | acpi_status | 320 | static acpi_status |
304 | acpi_ps_next_parse_state ( | 321 | acpi_ps_next_parse_state ( |
305 | struct acpi_walk_state *walk_state, | 322 | struct acpi_walk_state *walk_state, |
306 | union acpi_parse_object *op, | 323 | union acpi_parse_object *op, |
@@ -382,9 +399,8 @@ acpi_ps_next_parse_state ( | |||
382 | 399 | ||
383 | case AE_CTRL_TRANSFER: | 400 | case AE_CTRL_TRANSFER: |
384 | 401 | ||
385 | /* | 402 | /* A method call (invocation) -- transfer control */ |
386 | * A method call (invocation) -- transfer control | 403 | |
387 | */ | ||
388 | status = AE_CTRL_TRANSFER; | 404 | status = AE_CTRL_TRANSFER; |
389 | walk_state->prev_op = op; | 405 | walk_state->prev_op = op; |
390 | walk_state->method_call_op = op; | 406 | walk_state->method_call_op = op; |
@@ -397,6 +413,7 @@ acpi_ps_next_parse_state ( | |||
397 | 413 | ||
398 | 414 | ||
399 | default: | 415 | default: |
416 | |||
400 | status = callback_status; | 417 | status = callback_status; |
401 | if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { | 418 | if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { |
402 | status = AE_OK; | 419 | status = AE_OK; |
@@ -412,7 +429,7 @@ acpi_ps_next_parse_state ( | |||
412 | * | 429 | * |
413 | * FUNCTION: acpi_ps_parse_loop | 430 | * FUNCTION: acpi_ps_parse_loop |
414 | * | 431 | * |
415 | * PARAMETERS: parser_state - Current parser state object | 432 | * PARAMETERS: walk_state - Current state |
416 | * | 433 | * |
417 | * RETURN: Status | 434 | * RETURN: Status |
418 | * | 435 | * |
@@ -421,7 +438,7 @@ acpi_ps_next_parse_state ( | |||
421 | * | 438 | * |
422 | ******************************************************************************/ | 439 | ******************************************************************************/ |
423 | 440 | ||
424 | acpi_status | 441 | static acpi_status |
425 | acpi_ps_parse_loop ( | 442 | acpi_ps_parse_loop ( |
426 | struct acpi_walk_state *walk_state) | 443 | struct acpi_walk_state *walk_state) |
427 | { | 444 | { |
@@ -443,6 +460,7 @@ acpi_ps_parse_loop ( | |||
443 | walk_state->arg_types = 0; | 460 | walk_state->arg_types = 0; |
444 | 461 | ||
445 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) | 462 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) |
463 | |||
446 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { | 464 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { |
447 | /* We are restarting a preempted control method */ | 465 | /* We are restarting a preempted control method */ |
448 | 466 | ||
@@ -471,7 +489,8 @@ acpi_ps_parse_loop ( | |||
471 | acpi_format_exception (status))); | 489 | acpi_format_exception (status))); |
472 | 490 | ||
473 | } | 491 | } |
474 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "get_predicate Failed, %s\n", | 492 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
493 | "get_predicate Failed, %s\n", | ||
475 | acpi_format_exception (status))); | 494 | acpi_format_exception (status))); |
476 | return_ACPI_STATUS (status); | 495 | return_ACPI_STATUS (status); |
477 | } | 496 | } |
@@ -492,16 +511,15 @@ acpi_ps_parse_loop ( | |||
492 | } | 511 | } |
493 | #endif | 512 | #endif |
494 | 513 | ||
495 | /* | 514 | /* Iterative parsing loop, while there is more AML to process: */ |
496 | * Iterative parsing loop, while there is more aml to process: | 515 | |
497 | */ | ||
498 | while ((parser_state->aml < parser_state->aml_end) || (op)) { | 516 | while ((parser_state->aml < parser_state->aml_end) || (op)) { |
499 | aml_op_start = parser_state->aml; | 517 | aml_op_start = parser_state->aml; |
500 | if (!op) { | 518 | if (!op) { |
501 | /* Get the next opcode from the AML stream */ | 519 | /* Get the next opcode from the AML stream */ |
502 | 520 | ||
503 | walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, | 521 | walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, |
504 | parser_state->aml_start); | 522 | parser_state->aml_start); |
505 | walk_state->opcode = acpi_ps_peek_opcode (parser_state); | 523 | walk_state->opcode = acpi_ps_peek_opcode (parser_state); |
506 | 524 | ||
507 | /* | 525 | /* |
@@ -578,8 +596,10 @@ acpi_ps_parse_loop ( | |||
578 | INCREMENT_ARG_LIST (walk_state->arg_types); | 596 | INCREMENT_ARG_LIST (walk_state->arg_types); |
579 | } | 597 | } |
580 | 598 | ||
581 | /* Make sure that we found a NAME and didn't run out of arguments */ | 599 | /* |
582 | 600 | * Make sure that we found a NAME and didn't run out of | |
601 | * arguments | ||
602 | */ | ||
583 | if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { | 603 | if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { |
584 | status = AE_AML_NO_OPERAND; | 604 | status = AE_AML_NO_OPERAND; |
585 | goto close_this_op; | 605 | goto close_this_op; |
@@ -597,12 +617,13 @@ acpi_ps_parse_loop ( | |||
597 | 617 | ||
598 | status = walk_state->descending_callback (walk_state, &op); | 618 | status = walk_state->descending_callback (walk_state, &op); |
599 | if (ACPI_FAILURE (status)) { | 619 | if (ACPI_FAILURE (status)) { |
600 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", | 620 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
601 | acpi_format_exception (status))); | 621 | "During name lookup/catalog, %s\n", |
622 | acpi_format_exception (status))); | ||
602 | goto close_this_op; | 623 | goto close_this_op; |
603 | } | 624 | } |
604 | 625 | ||
605 | if (op == NULL) { | 626 | if (!op) { |
606 | continue; | 627 | continue; |
607 | } | 628 | } |
608 | 629 | ||
@@ -659,7 +680,7 @@ acpi_ps_parse_loop ( | |||
659 | 680 | ||
660 | if ((walk_state->descending_callback != NULL)) { | 681 | if ((walk_state->descending_callback != NULL)) { |
661 | /* | 682 | /* |
662 | * Find the object. This will either insert the object into | 683 | * Find the object. This will either insert the object into |
663 | * the namespace or simply look it up | 684 | * the namespace or simply look it up |
664 | */ | 685 | */ |
665 | walk_state->op = op; | 686 | walk_state->op = op; |
@@ -688,11 +709,15 @@ acpi_ps_parse_loop ( | |||
688 | } | 709 | } |
689 | 710 | ||
690 | 711 | ||
691 | /* Start arg_count at zero because we don't know if there are any args yet */ | 712 | /* |
692 | 713 | * Start arg_count at zero because we don't know if there are | |
714 | * any args yet | ||
715 | */ | ||
693 | walk_state->arg_count = 0; | 716 | walk_state->arg_count = 0; |
694 | 717 | ||
695 | if (walk_state->arg_types) /* Are there any arguments that must be processed? */ { | 718 | /* Are there any arguments that must be processed? */ |
719 | |||
720 | if (walk_state->arg_types) { | ||
696 | /* Get arguments */ | 721 | /* Get arguments */ |
697 | 722 | ||
698 | switch (op->common.aml_opcode) { | 723 | switch (op->common.aml_opcode) { |
@@ -720,14 +745,18 @@ acpi_ps_parse_loop ( | |||
720 | 745 | ||
721 | default: | 746 | default: |
722 | 747 | ||
723 | /* Op is not a constant or string, append each argument to the Op */ | 748 | /* |
724 | 749 | * Op is not a constant or string, append each argument | |
750 | * to the Op | ||
751 | */ | ||
725 | while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && | 752 | while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && |
726 | !walk_state->arg_count) { | 753 | !walk_state->arg_count) { |
727 | walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, | 754 | walk_state->aml_offset = (u32) |
728 | parser_state->aml_start); | 755 | ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start); |
756 | |||
729 | status = acpi_ps_get_next_arg (walk_state, parser_state, | 757 | status = acpi_ps_get_next_arg (walk_state, parser_state, |
730 | GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); | 758 | GET_CURRENT_ARG_TYPE (walk_state->arg_types), |
759 | &arg); | ||
731 | if (ACPI_FAILURE (status)) { | 760 | if (ACPI_FAILURE (status)) { |
732 | goto close_this_op; | 761 | goto close_this_op; |
733 | } | 762 | } |
@@ -752,7 +781,8 @@ acpi_ps_parse_loop ( | |||
752 | * Save the length and address of the body | 781 | * Save the length and address of the body |
753 | */ | 782 | */ |
754 | op->named.data = parser_state->aml; | 783 | op->named.data = parser_state->aml; |
755 | op->named.length = (u32) (parser_state->pkg_end - parser_state->aml); | 784 | op->named.length = (u32) (parser_state->pkg_end - |
785 | parser_state->aml); | ||
756 | 786 | ||
757 | /* Skip body of method */ | 787 | /* Skip body of method */ |
758 | 788 | ||
@@ -773,7 +803,8 @@ acpi_ps_parse_loop ( | |||
773 | * to parse them correctly. | 803 | * to parse them correctly. |
774 | */ | 804 | */ |
775 | op->named.data = aml_op_start; | 805 | op->named.data = aml_op_start; |
776 | op->named.length = (u32) (parser_state->pkg_end - aml_op_start); | 806 | op->named.length = (u32) (parser_state->pkg_end - |
807 | aml_op_start); | ||
777 | 808 | ||
778 | /* Skip body */ | 809 | /* Skip body */ |
779 | 810 | ||
@@ -785,7 +816,8 @@ acpi_ps_parse_loop ( | |||
785 | case AML_WHILE_OP: | 816 | case AML_WHILE_OP: |
786 | 817 | ||
787 | if (walk_state->control_state) { | 818 | if (walk_state->control_state) { |
788 | walk_state->control_state->control.package_end = parser_state->pkg_end; | 819 | walk_state->control_state->control.package_end = |
820 | parser_state->pkg_end; | ||
789 | } | 821 | } |
790 | break; | 822 | break; |
791 | 823 | ||
@@ -801,8 +833,10 @@ acpi_ps_parse_loop ( | |||
801 | /* Check for arguments that need to be processed */ | 833 | /* Check for arguments that need to be processed */ |
802 | 834 | ||
803 | if (walk_state->arg_count) { | 835 | if (walk_state->arg_count) { |
804 | /* There are arguments (complex ones), push Op and prepare for argument */ | 836 | /* |
805 | 837 | * There are arguments (complex ones), push Op and | |
838 | * prepare for argument | ||
839 | */ | ||
806 | status = acpi_ps_push_scope (parser_state, op, | 840 | status = acpi_ps_push_scope (parser_state, op, |
807 | walk_state->arg_types, walk_state->arg_count); | 841 | walk_state->arg_types, walk_state->arg_count); |
808 | if (ACPI_FAILURE (status)) { | 842 | if (ACPI_FAILURE (status)) { |
@@ -812,8 +846,10 @@ acpi_ps_parse_loop ( | |||
812 | continue; | 846 | continue; |
813 | } | 847 | } |
814 | 848 | ||
815 | /* All arguments have been processed -- Op is complete, prepare for next */ | 849 | /* |
816 | 850 | * All arguments have been processed -- Op is complete, | |
851 | * prepare for next | ||
852 | */ | ||
817 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); | 853 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); |
818 | if (walk_state->op_info->flags & AML_NAMED) { | 854 | if (walk_state->op_info->flags & AML_NAMED) { |
819 | if (acpi_gbl_depth) { | 855 | if (acpi_gbl_depth) { |
@@ -880,9 +916,8 @@ close_this_op: | |||
880 | 916 | ||
881 | case AE_CTRL_TRANSFER: | 917 | case AE_CTRL_TRANSFER: |
882 | 918 | ||
883 | /* | 919 | /* We are about to transfer to a called method. */ |
884 | * We are about to transfer to a called method. | 920 | |
885 | */ | ||
886 | walk_state->prev_op = op; | 921 | walk_state->prev_op = op; |
887 | walk_state->prev_arg_types = walk_state->arg_types; | 922 | walk_state->prev_arg_types = walk_state->arg_types; |
888 | return_ACPI_STATUS (status); | 923 | return_ACPI_STATUS (status); |
@@ -1051,10 +1086,7 @@ close_this_op: | |||
1051 | * | 1086 | * |
1052 | * FUNCTION: acpi_ps_parse_aml | 1087 | * FUNCTION: acpi_ps_parse_aml |
1053 | * | 1088 | * |
1054 | * PARAMETERS: start_scope - The starting point of the parse. Becomes the | 1089 | * PARAMETERS: walk_state - Current state |
1055 | * root of the parsed op tree. | ||
1056 | * Aml - Pointer to the raw AML code to parse | ||
1057 | * aml_size - Length of the AML to parse | ||
1058 | * | 1090 | * |
1059 | * | 1091 | * |
1060 | * RETURN: Status | 1092 | * RETURN: Status |
@@ -1076,8 +1108,10 @@ acpi_ps_parse_aml ( | |||
1076 | 1108 | ||
1077 | ACPI_FUNCTION_TRACE ("ps_parse_aml"); | 1109 | ACPI_FUNCTION_TRACE ("ps_parse_aml"); |
1078 | 1110 | ||
1079 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with walk_state=%p Aml=%p size=%X\n", | 1111 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
1080 | walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size)); | 1112 | "Entered with walk_state=%p Aml=%p size=%X\n", |
1113 | walk_state, walk_state->parser_state.aml, | ||
1114 | walk_state->parser_state.aml_size)); | ||
1081 | 1115 | ||
1082 | 1116 | ||
1083 | /* Create and initialize a new thread state */ | 1117 | /* Create and initialize a new thread state */ |
@@ -1142,9 +1176,10 @@ acpi_ps_parse_aml ( | |||
1142 | if ((status == AE_ALREADY_EXISTS) && | 1176 | if ((status == AE_ALREADY_EXISTS) && |
1143 | (!walk_state->method_desc->method.semaphore)) { | 1177 | (!walk_state->method_desc->method.semaphore)) { |
1144 | /* | 1178 | /* |
1145 | * This method is marked not_serialized, but it tried to create a named | 1179 | * This method is marked not_serialized, but it tried to create |
1146 | * object, causing the second thread entrance to fail. We will workaround | 1180 | * a named object, causing the second thread entrance to fail. |
1147 | * this by marking the method permanently as Serialized. | 1181 | * We will workaround this by marking the method permanently |
1182 | * as Serialized. | ||
1148 | */ | 1183 | */ |
1149 | walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; | 1184 | walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; |
1150 | walk_state->method_desc->method.concurrency = 1; | 1185 | walk_state->method_desc->method.concurrency = 1; |
@@ -1187,7 +1222,8 @@ acpi_ps_parse_aml ( | |||
1187 | 1222 | ||
1188 | previous_walk_state = walk_state; | 1223 | previous_walk_state = walk_state; |
1189 | 1224 | ||
1190 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "return_value=%p, implicit_value=%p State=%p\n", | 1225 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
1226 | "return_value=%p, implicit_value=%p State=%p\n", | ||
1191 | walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); | 1227 | walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); |
1192 | 1228 | ||
1193 | /* Check if we have restarted a preempted walk */ | 1229 | /* Check if we have restarted a preempted walk */ |
@@ -1231,12 +1267,14 @@ acpi_ps_parse_aml ( | |||
1231 | */ | 1267 | */ |
1232 | else if (previous_walk_state->caller_return_desc) { | 1268 | else if (previous_walk_state->caller_return_desc) { |
1233 | if (previous_walk_state->implicit_return_obj) { | 1269 | if (previous_walk_state->implicit_return_obj) { |
1234 | *(previous_walk_state->caller_return_desc) = previous_walk_state->implicit_return_obj; | 1270 | *(previous_walk_state->caller_return_desc) = |
1271 | previous_walk_state->implicit_return_obj; | ||
1235 | } | 1272 | } |
1236 | else { | 1273 | else { |
1237 | /* NULL if no return value */ | 1274 | /* NULL if no return value */ |
1238 | 1275 | ||
1239 | *(previous_walk_state->caller_return_desc) = previous_walk_state->return_desc; | 1276 | *(previous_walk_state->caller_return_desc) = |
1277 | previous_walk_state->return_desc; | ||
1240 | } | 1278 | } |
1241 | } | 1279 | } |
1242 | else { | 1280 | else { |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index dcbed49608b0..8dcd1b1e7131 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -65,6 +65,7 @@ union acpi_parse_object * | |||
65 | acpi_ps_get_parent_scope ( | 65 | acpi_ps_get_parent_scope ( |
66 | struct acpi_parse_state *parser_state) | 66 | struct acpi_parse_state *parser_state) |
67 | { | 67 | { |
68 | |||
68 | return (parser_state->scope->parse_scope.op); | 69 | return (parser_state->scope->parse_scope.op); |
69 | } | 70 | } |
70 | 71 | ||
@@ -87,8 +88,10 @@ u8 | |||
87 | acpi_ps_has_completed_scope ( | 88 | acpi_ps_has_completed_scope ( |
88 | struct acpi_parse_state *parser_state) | 89 | struct acpi_parse_state *parser_state) |
89 | { | 90 | { |
90 | return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || | 91 | |
91 | !parser_state->scope->parse_scope.arg_count))); | 92 | return ((u8) |
93 | ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || | ||
94 | !parser_state->scope->parse_scope.arg_count))); | ||
92 | } | 95 | } |
93 | 96 | ||
94 | 97 | ||
@@ -167,23 +170,23 @@ acpi_ps_push_scope ( | |||
167 | return_ACPI_STATUS (AE_NO_MEMORY); | 170 | return_ACPI_STATUS (AE_NO_MEMORY); |
168 | } | 171 | } |
169 | 172 | ||
170 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; | 173 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; |
171 | scope->parse_scope.op = op; | 174 | scope->parse_scope.op = op; |
172 | scope->parse_scope.arg_list = remaining_args; | 175 | scope->parse_scope.arg_list = remaining_args; |
173 | scope->parse_scope.arg_count = arg_count; | 176 | scope->parse_scope.arg_count = arg_count; |
174 | scope->parse_scope.pkg_end = parser_state->pkg_end; | 177 | scope->parse_scope.pkg_end = parser_state->pkg_end; |
175 | 178 | ||
176 | /* Push onto scope stack */ | 179 | /* Push onto scope stack */ |
177 | 180 | ||
178 | acpi_ut_push_generic_state (&parser_state->scope, scope); | 181 | acpi_ut_push_generic_state (&parser_state->scope, scope); |
179 | 182 | ||
180 | if (arg_count == ACPI_VAR_ARGS) { | 183 | if (arg_count == ACPI_VAR_ARGS) { |
181 | /* multiple arguments */ | 184 | /* Multiple arguments */ |
182 | 185 | ||
183 | scope->parse_scope.arg_end = parser_state->pkg_end; | 186 | scope->parse_scope.arg_end = parser_state->pkg_end; |
184 | } | 187 | } |
185 | else { | 188 | else { |
186 | /* single argument */ | 189 | /* Single argument */ |
187 | 190 | ||
188 | scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); | 191 | scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); |
189 | } | 192 | } |
@@ -221,18 +224,17 @@ acpi_ps_pop_scope ( | |||
221 | ACPI_FUNCTION_TRACE ("ps_pop_scope"); | 224 | ACPI_FUNCTION_TRACE ("ps_pop_scope"); |
222 | 225 | ||
223 | 226 | ||
224 | /* | 227 | /* Only pop the scope if there is in fact a next scope */ |
225 | * Only pop the scope if there is in fact a next scope | 228 | |
226 | */ | ||
227 | if (scope->common.next) { | 229 | if (scope->common.next) { |
228 | scope = acpi_ut_pop_generic_state (&parser_state->scope); | 230 | scope = acpi_ut_pop_generic_state (&parser_state->scope); |
229 | 231 | ||
230 | /* return to parsing previous op */ | 232 | /* return to parsing previous op */ |
231 | 233 | ||
232 | *op = scope->parse_scope.op; | 234 | *op = scope->parse_scope.op; |
233 | *arg_list = scope->parse_scope.arg_list; | 235 | *arg_list = scope->parse_scope.arg_list; |
234 | *arg_count = scope->parse_scope.arg_count; | 236 | *arg_count = scope->parse_scope.arg_count; |
235 | parser_state->pkg_end = scope->parse_scope.pkg_end; | 237 | parser_state->pkg_end = scope->parse_scope.pkg_end; |
236 | 238 | ||
237 | /* All done with this scope state structure */ | 239 | /* All done with this scope state structure */ |
238 | 240 | ||
@@ -241,12 +243,13 @@ acpi_ps_pop_scope ( | |||
241 | else { | 243 | else { |
242 | /* empty parse stack, prepare to fetch next opcode */ | 244 | /* empty parse stack, prepare to fetch next opcode */ |
243 | 245 | ||
244 | *op = NULL; | 246 | *op = NULL; |
245 | *arg_list = 0; | 247 | *arg_list = 0; |
246 | *arg_count = 0; | 248 | *arg_count = 0; |
247 | } | 249 | } |
248 | 250 | ||
249 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *op, *arg_count)); | 251 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, |
252 | "Popped Op %p Args %X\n", *op, *arg_count)); | ||
250 | return_VOID; | 253 | return_VOID; |
251 | } | 254 | } |
252 | 255 | ||
@@ -257,7 +260,7 @@ acpi_ps_pop_scope ( | |||
257 | * | 260 | * |
258 | * PARAMETERS: parser_state - Current parser state object | 261 | * PARAMETERS: parser_state - Current parser state object |
259 | * | 262 | * |
260 | * RETURN: Status | 263 | * RETURN: None |
261 | * | 264 | * |
262 | * DESCRIPTION: Destroy available list, remaining stack levels, and return | 265 | * DESCRIPTION: Destroy available list, remaining stack levels, and return |
263 | * root scope | 266 | * root scope |
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index 2140bd1ac10b..d5aafe73fca0 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c | |||
@@ -49,6 +49,14 @@ | |||
49 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
50 | ACPI_MODULE_NAME ("pstree") | 50 | ACPI_MODULE_NAME ("pstree") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
55 | union acpi_parse_object * | ||
56 | acpi_ps_get_child ( | ||
57 | union acpi_parse_object *op); | ||
58 | #endif | ||
59 | |||
52 | 60 | ||
53 | /******************************************************************************* | 61 | /******************************************************************************* |
54 | * | 62 | * |
@@ -57,7 +65,7 @@ | |||
57 | * PARAMETERS: Op - Get an argument for this op | 65 | * PARAMETERS: Op - Get an argument for this op |
58 | * Argn - Nth argument to get | 66 | * Argn - Nth argument to get |
59 | * | 67 | * |
60 | * RETURN: The argument (as an Op object). NULL if argument does not exist | 68 | * RETURN: The argument (as an Op object). NULL if argument does not exist |
61 | * | 69 | * |
62 | * DESCRIPTION: Get the specified op's argument. | 70 | * DESCRIPTION: Get the specified op's argument. |
63 | * | 71 | * |
@@ -152,7 +160,6 @@ acpi_ps_append_arg ( | |||
152 | return; | 160 | return; |
153 | } | 161 | } |
154 | 162 | ||
155 | |||
156 | /* Append the argument to the linked argument list */ | 163 | /* Append the argument to the linked argument list */ |
157 | 164 | ||
158 | if (op->common.value.arg) { | 165 | if (op->common.value.arg) { |
@@ -164,14 +171,12 @@ acpi_ps_append_arg ( | |||
164 | } | 171 | } |
165 | prev_arg->common.next = arg; | 172 | prev_arg->common.next = arg; |
166 | } | 173 | } |
167 | |||
168 | else { | 174 | else { |
169 | /* No argument list, this will be the first argument */ | 175 | /* No argument list, this will be the first argument */ |
170 | 176 | ||
171 | op->common.value.arg = arg; | 177 | op->common.value.arg = arg; |
172 | } | 178 | } |
173 | 179 | ||
174 | |||
175 | /* Set the parent in this arg and any args linked after it */ | 180 | /* Set the parent in this arg and any args linked after it */ |
176 | 181 | ||
177 | while (arg) { | 182 | while (arg) { |
@@ -182,73 +187,6 @@ acpi_ps_append_arg ( | |||
182 | 187 | ||
183 | 188 | ||
184 | #ifdef ACPI_FUTURE_USAGE | 189 | #ifdef ACPI_FUTURE_USAGE |
185 | |||
186 | /******************************************************************************* | ||
187 | * | ||
188 | * FUNCTION: acpi_ps_get_child | ||
189 | * | ||
190 | * PARAMETERS: Op - Get the child of this Op | ||
191 | * | ||
192 | * RETURN: Child Op, Null if none is found. | ||
193 | * | ||
194 | * DESCRIPTION: Get op's children or NULL if none | ||
195 | * | ||
196 | ******************************************************************************/ | ||
197 | union acpi_parse_object * | ||
198 | acpi_ps_get_child ( | ||
199 | union acpi_parse_object *op) | ||
200 | { | ||
201 | union acpi_parse_object *child = NULL; | ||
202 | |||
203 | |||
204 | ACPI_FUNCTION_ENTRY (); | ||
205 | |||
206 | |||
207 | switch (op->common.aml_opcode) { | ||
208 | case AML_SCOPE_OP: | ||
209 | case AML_ELSE_OP: | ||
210 | case AML_DEVICE_OP: | ||
211 | case AML_THERMAL_ZONE_OP: | ||
212 | case AML_INT_METHODCALL_OP: | ||
213 | |||
214 | child = acpi_ps_get_arg (op, 0); | ||
215 | break; | ||
216 | |||
217 | |||
218 | case AML_BUFFER_OP: | ||
219 | case AML_PACKAGE_OP: | ||
220 | case AML_METHOD_OP: | ||
221 | case AML_IF_OP: | ||
222 | case AML_WHILE_OP: | ||
223 | case AML_FIELD_OP: | ||
224 | |||
225 | child = acpi_ps_get_arg (op, 1); | ||
226 | break; | ||
227 | |||
228 | |||
229 | case AML_POWER_RES_OP: | ||
230 | case AML_INDEX_FIELD_OP: | ||
231 | |||
232 | child = acpi_ps_get_arg (op, 2); | ||
233 | break; | ||
234 | |||
235 | |||
236 | case AML_PROCESSOR_OP: | ||
237 | case AML_BANK_FIELD_OP: | ||
238 | |||
239 | child = acpi_ps_get_arg (op, 3); | ||
240 | break; | ||
241 | |||
242 | |||
243 | default: | ||
244 | /* All others have no children */ | ||
245 | break; | ||
246 | } | ||
247 | |||
248 | return (child); | ||
249 | } | ||
250 | |||
251 | |||
252 | /******************************************************************************* | 190 | /******************************************************************************* |
253 | * | 191 | * |
254 | * FUNCTION: acpi_ps_get_depth_next | 192 | * FUNCTION: acpi_ps_get_depth_next |
@@ -280,21 +218,21 @@ acpi_ps_get_depth_next ( | |||
280 | return (NULL); | 218 | return (NULL); |
281 | } | 219 | } |
282 | 220 | ||
283 | /* look for an argument or child */ | 221 | /* Look for an argument or child */ |
284 | 222 | ||
285 | next = acpi_ps_get_arg (op, 0); | 223 | next = acpi_ps_get_arg (op, 0); |
286 | if (next) { | 224 | if (next) { |
287 | return (next); | 225 | return (next); |
288 | } | 226 | } |
289 | 227 | ||
290 | /* look for a sibling */ | 228 | /* Look for a sibling */ |
291 | 229 | ||
292 | next = op->common.next; | 230 | next = op->common.next; |
293 | if (next) { | 231 | if (next) { |
294 | return (next); | 232 | return (next); |
295 | } | 233 | } |
296 | 234 | ||
297 | /* look for a sibling of parent */ | 235 | /* Look for a sibling of parent */ |
298 | 236 | ||
299 | parent = op->common.parent; | 237 | parent = op->common.parent; |
300 | 238 | ||
@@ -305,13 +243,13 @@ acpi_ps_get_depth_next ( | |||
305 | } | 243 | } |
306 | 244 | ||
307 | if (arg == origin) { | 245 | if (arg == origin) { |
308 | /* reached parent of origin, end search */ | 246 | /* Reached parent of origin, end search */ |
309 | 247 | ||
310 | return (NULL); | 248 | return (NULL); |
311 | } | 249 | } |
312 | 250 | ||
313 | if (parent->common.next) { | 251 | if (parent->common.next) { |
314 | /* found sibling of parent */ | 252 | /* Found sibling of parent */ |
315 | 253 | ||
316 | return (parent->common.next); | 254 | return (parent->common.next); |
317 | } | 255 | } |
@@ -323,5 +261,74 @@ acpi_ps_get_depth_next ( | |||
323 | return (next); | 261 | return (next); |
324 | } | 262 | } |
325 | 263 | ||
264 | |||
265 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
266 | /******************************************************************************* | ||
267 | * | ||
268 | * FUNCTION: acpi_ps_get_child | ||
269 | * | ||
270 | * PARAMETERS: Op - Get the child of this Op | ||
271 | * | ||
272 | * RETURN: Child Op, Null if none is found. | ||
273 | * | ||
274 | * DESCRIPTION: Get op's children or NULL if none | ||
275 | * | ||
276 | ******************************************************************************/ | ||
277 | |||
278 | union acpi_parse_object * | ||
279 | acpi_ps_get_child ( | ||
280 | union acpi_parse_object *op) | ||
281 | { | ||
282 | union acpi_parse_object *child = NULL; | ||
283 | |||
284 | |||
285 | ACPI_FUNCTION_ENTRY (); | ||
286 | |||
287 | |||
288 | switch (op->common.aml_opcode) { | ||
289 | case AML_SCOPE_OP: | ||
290 | case AML_ELSE_OP: | ||
291 | case AML_DEVICE_OP: | ||
292 | case AML_THERMAL_ZONE_OP: | ||
293 | case AML_INT_METHODCALL_OP: | ||
294 | |||
295 | child = acpi_ps_get_arg (op, 0); | ||
296 | break; | ||
297 | |||
298 | |||
299 | case AML_BUFFER_OP: | ||
300 | case AML_PACKAGE_OP: | ||
301 | case AML_METHOD_OP: | ||
302 | case AML_IF_OP: | ||
303 | case AML_WHILE_OP: | ||
304 | case AML_FIELD_OP: | ||
305 | |||
306 | child = acpi_ps_get_arg (op, 1); | ||
307 | break; | ||
308 | |||
309 | |||
310 | case AML_POWER_RES_OP: | ||
311 | case AML_INDEX_FIELD_OP: | ||
312 | |||
313 | child = acpi_ps_get_arg (op, 2); | ||
314 | break; | ||
315 | |||
316 | |||
317 | case AML_PROCESSOR_OP: | ||
318 | case AML_BANK_FIELD_OP: | ||
319 | |||
320 | child = acpi_ps_get_arg (op, 3); | ||
321 | break; | ||
322 | |||
323 | |||
324 | default: | ||
325 | /* All others have no children */ | ||
326 | break; | ||
327 | } | ||
328 | |||
329 | return (child); | ||
330 | } | ||
331 | #endif | ||
332 | |||
326 | #endif /* ACPI_FUTURE_USAGE */ | 333 | #endif /* ACPI_FUTURE_USAGE */ |
327 | 334 | ||
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index b3597cb19f88..a10f88715d43 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
47 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
48 | #include <acpi/acnamesp.h> | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
51 | ACPI_MODULE_NAME ("psutils") | 50 | ACPI_MODULE_NAME ("psutils") |
@@ -57,7 +56,7 @@ | |||
57 | * | 56 | * |
58 | * PARAMETERS: None | 57 | * PARAMETERS: None |
59 | * | 58 | * |
60 | * RETURN: scope_op | 59 | * RETURN: A new Scope object, null on failure |
61 | * | 60 | * |
62 | * DESCRIPTION: Create a Scope and associated namepath op with the root name | 61 | * DESCRIPTION: Create a Scope and associated namepath op with the root name |
63 | * | 62 | * |
@@ -75,7 +74,6 @@ acpi_ps_create_scope_op ( | |||
75 | return (NULL); | 74 | return (NULL); |
76 | } | 75 | } |
77 | 76 | ||
78 | |||
79 | scope_op->named.name = ACPI_ROOT_NAME; | 77 | scope_op->named.name = ACPI_ROOT_NAME; |
80 | return (scope_op); | 78 | return (scope_op); |
81 | } | 79 | } |
@@ -88,10 +86,9 @@ acpi_ps_create_scope_op ( | |||
88 | * PARAMETERS: Op - A newly allocated Op object | 86 | * PARAMETERS: Op - A newly allocated Op object |
89 | * Opcode - Opcode to store in the Op | 87 | * Opcode - Opcode to store in the Op |
90 | * | 88 | * |
91 | * RETURN: Status | 89 | * RETURN: None |
92 | * | 90 | * |
93 | * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on | 91 | * DESCRIPTION: Initialize a parse (Op) object |
94 | * opcode | ||
95 | * | 92 | * |
96 | ******************************************************************************/ | 93 | ******************************************************************************/ |
97 | 94 | ||
@@ -107,7 +104,8 @@ acpi_ps_init_op ( | |||
107 | op->common.aml_opcode = opcode; | 104 | op->common.aml_opcode = opcode; |
108 | 105 | ||
109 | ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, | 106 | ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, |
110 | (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name))); | 107 | (acpi_ps_get_opcode_info (opcode))->name, |
108 | sizeof (op->common.aml_op_name))); | ||
111 | } | 109 | } |
112 | 110 | ||
113 | 111 | ||
@@ -117,7 +115,7 @@ acpi_ps_init_op ( | |||
117 | * | 115 | * |
118 | * PARAMETERS: Opcode - Opcode that will be stored in the new Op | 116 | * PARAMETERS: Opcode - Opcode that will be stored in the new Op |
119 | * | 117 | * |
120 | * RETURN: Pointer to the new Op. | 118 | * RETURN: Pointer to the new Op, null on failure |
121 | * | 119 | * |
122 | * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on | 120 | * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on |
123 | * opcode. A cache of opcodes is available for the pure | 121 | * opcode. A cache of opcodes is available for the pure |
@@ -275,7 +273,6 @@ acpi_ps_get_name ( | |||
275 | union acpi_parse_object *op) | 273 | union acpi_parse_object *op) |
276 | { | 274 | { |
277 | 275 | ||
278 | |||
279 | /* The "generic" object has no name associated with it */ | 276 | /* The "generic" object has no name associated with it */ |
280 | 277 | ||
281 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { | 278 | if (op->common.flags & ACPI_PARSEOP_GENERIC) { |
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 110d2ce917b6..9d20cb2ceb51 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c | |||
@@ -90,17 +90,15 @@ acpi_ps_delete_parse_tree ( | |||
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | /* | 93 | /* No more children, this Op is complete. */ |
94 | * No more children, this Op is complete. | 94 | |
95 | */ | ||
96 | next = op->common.next; | 95 | next = op->common.next; |
97 | parent = op->common.parent; | 96 | parent = op->common.parent; |
98 | 97 | ||
99 | acpi_ps_free_op (op); | 98 | acpi_ps_free_op (op); |
100 | 99 | ||
101 | /* | 100 | /* If we are back to the starting point, the walk is complete. */ |
102 | * If we are back to the starting point, the walk is complete. | 101 | |
103 | */ | ||
104 | if (op == subtree_root) { | 102 | if (op == subtree_root) { |
105 | return_VOID; | 103 | return_VOID; |
106 | } | 104 | } |
@@ -111,5 +109,6 @@ acpi_ps_delete_parse_tree ( | |||
111 | op = parent; | 109 | op = parent; |
112 | } | 110 | } |
113 | } | 111 | } |
112 | |||
114 | return_VOID; | 113 | return_VOID; |
115 | } | 114 | } |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index b318ad24726d..dba893648e84 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -57,13 +57,16 @@ | |||
57 | * | 57 | * |
58 | * FUNCTION: acpi_psx_execute | 58 | * FUNCTION: acpi_psx_execute |
59 | * | 59 | * |
60 | * PARAMETERS: Info->Node - A method object containing both the AML | 60 | * PARAMETERS: Info - Method info block, contains: |
61 | * address and length. | 61 | * Node - Method Node to execute |
62 | * **Params - List of parameters to pass to method, | 62 | * Parameters - List of parameters to pass to the method, |
63 | * terminated by NULL. Params itself may be | 63 | * terminated by NULL. Params itself may be |
64 | * NULL if no parameters are being passed. | 64 | * NULL if no parameters are being passed. |
65 | * **return_obj_desc - Return object from execution of the | 65 | * return_object - Where to put method's return value (if |
66 | * method. | 66 | * any). If NULL, no value is returned. |
67 | * parameter_type - Type of Parameter list | ||
68 | * return_object - Where to put method's return value (if | ||
69 | * any). If NULL, no value is returned. | ||
67 | * | 70 | * |
68 | * RETURN: Status | 71 | * RETURN: Status |
69 | * | 72 | * |
@@ -196,9 +199,8 @@ acpi_psx_execute ( | |||
196 | goto cleanup3; | 199 | goto cleanup3; |
197 | } | 200 | } |
198 | 201 | ||
199 | /* | 202 | /* The walk of the parse tree is where we actually execute the method */ |
200 | * The walk of the parse tree is where we actually execute the method | 203 | |
201 | */ | ||
202 | status = acpi_ps_parse_aml (walk_state); | 204 | status = acpi_ps_parse_aml (walk_state); |
203 | goto cleanup2; /* Walk state already deleted */ | 205 | goto cleanup2; /* Walk state already deleted */ |
204 | 206 | ||
@@ -217,7 +219,8 @@ cleanup1: | |||
217 | for (i = 0; info->parameters[i]; i++) { | 219 | for (i = 0; info->parameters[i]; i++) { |
218 | /* Ignore errors, just do them all */ | 220 | /* Ignore errors, just do them all */ |
219 | 221 | ||
220 | (void) acpi_ut_update_object_reference (info->parameters[i], REF_DECREMENT); | 222 | (void) acpi_ut_update_object_reference ( |
223 | info->parameters[i], REF_DECREMENT); | ||
221 | } | 224 | } |
222 | } | 225 | } |
223 | 226 | ||
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 5d19b39e9e2b..5148f3c10b5c 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -61,15 +61,14 @@ acpi_pci_data_handler ( | |||
61 | 61 | ||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * acpi_os_get_pci_id | 64 | * acpi_get_pci_id |
65 | * ------------------ | 65 | * ------------------ |
66 | * This function is used by the ACPI Interpreter (a.k.a. Core Subsystem) | 66 | * This function is used by the ACPI Interpreter (a.k.a. Core Subsystem) |
67 | * to resolve PCI information for ACPI-PCI devices defined in the namespace. | 67 | * to resolve PCI information for ACPI-PCI devices defined in the namespace. |
68 | * This typically occurs when resolving PCI operation region information. | 68 | * This typically occurs when resolving PCI operation region information. |
69 | */ | 69 | */ |
70 | #ifdef ACPI_FUTURE_USAGE | ||
71 | acpi_status | 70 | acpi_status |
72 | acpi_os_get_pci_id ( | 71 | acpi_get_pci_id ( |
73 | acpi_handle handle, | 72 | acpi_handle handle, |
74 | struct acpi_pci_id *id) | 73 | struct acpi_pci_id *id) |
75 | { | 74 | { |
@@ -78,7 +77,7 @@ acpi_os_get_pci_id ( | |||
78 | struct acpi_device *device = NULL; | 77 | struct acpi_device *device = NULL; |
79 | struct acpi_pci_data *data = NULL; | 78 | struct acpi_pci_data *data = NULL; |
80 | 79 | ||
81 | ACPI_FUNCTION_TRACE("acpi_os_get_pci_id"); | 80 | ACPI_FUNCTION_TRACE("acpi_get_pci_id"); |
82 | 81 | ||
83 | if (!id) | 82 | if (!id) |
84 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 83 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -92,7 +91,7 @@ acpi_os_get_pci_id ( | |||
92 | } | 91 | } |
93 | 92 | ||
94 | status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data); | 93 | status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data); |
95 | if (ACPI_FAILURE(status) || !data || !data->dev) { | 94 | if (ACPI_FAILURE(status) || !data) { |
96 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 95 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
97 | "Invalid ACPI-PCI context for device %s\n", | 96 | "Invalid ACPI-PCI context for device %s\n", |
98 | acpi_device_bid(device))); | 97 | acpi_device_bid(device))); |
@@ -115,7 +114,7 @@ acpi_os_get_pci_id ( | |||
115 | 114 | ||
116 | return_ACPI_STATUS(AE_OK); | 115 | return_ACPI_STATUS(AE_OK); |
117 | } | 116 | } |
118 | #endif /* ACPI_FUTURE_USAGE */ | 117 | EXPORT_SYMBOL(acpi_get_pci_id); |
119 | 118 | ||
120 | 119 | ||
121 | int | 120 | int |
@@ -129,6 +128,8 @@ acpi_pci_bind ( | |||
129 | char *pathname = NULL; | 128 | char *pathname = NULL; |
130 | struct acpi_buffer buffer = {0, NULL}; | 129 | struct acpi_buffer buffer = {0, NULL}; |
131 | acpi_handle handle = NULL; | 130 | acpi_handle handle = NULL; |
131 | struct pci_dev *dev; | ||
132 | struct pci_bus *bus; | ||
132 | 133 | ||
133 | ACPI_FUNCTION_TRACE("acpi_pci_bind"); | 134 | ACPI_FUNCTION_TRACE("acpi_pci_bind"); |
134 | 135 | ||
@@ -193,8 +194,20 @@ acpi_pci_bind ( | |||
193 | * Locate matching device in PCI namespace. If it doesn't exist | 194 | * Locate matching device in PCI namespace. If it doesn't exist |
194 | * this typically means that the device isn't currently inserted | 195 | * this typically means that the device isn't currently inserted |
195 | * (e.g. docking station, port replicator, etc.). | 196 | * (e.g. docking station, port replicator, etc.). |
197 | * We cannot simply search the global pci device list, since | ||
198 | * PCI devices are added to the global pci list when the root | ||
199 | * bridge start ops are run, which may not have happened yet. | ||
196 | */ | 200 | */ |
197 | data->dev = pci_find_slot(data->id.bus, PCI_DEVFN(data->id.device, data->id.function)); | 201 | bus = pci_find_bus(data->id.segment, data->id.bus); |
202 | if (bus) { | ||
203 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
204 | if (dev->devfn == PCI_DEVFN(data->id.device, | ||
205 | data->id.function)) { | ||
206 | data->dev = dev; | ||
207 | break; | ||
208 | } | ||
209 | } | ||
210 | } | ||
198 | if (!data->dev) { | 211 | if (!data->dev) { |
199 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
200 | "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", | 213 | "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 8093f2e00321..bb973d2109a1 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -269,7 +269,51 @@ acpi_pci_irq_del_prt (int segment, int bus) | |||
269 | /* -------------------------------------------------------------------------- | 269 | /* -------------------------------------------------------------------------- |
270 | PCI Interrupt Routing Support | 270 | PCI Interrupt Routing Support |
271 | -------------------------------------------------------------------------- */ | 271 | -------------------------------------------------------------------------- */ |
272 | typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **); | ||
272 | 273 | ||
274 | static int | ||
275 | acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | ||
276 | int *edge_level, | ||
277 | int *active_high_low, | ||
278 | char **link) | ||
279 | { | ||
280 | int irq; | ||
281 | |||
282 | ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq"); | ||
283 | |||
284 | if (entry->link.handle) { | ||
285 | irq = acpi_pci_link_allocate_irq(entry->link.handle, | ||
286 | entry->link.index, edge_level, active_high_low, link); | ||
287 | if (irq < 0) { | ||
288 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); | ||
289 | return_VALUE(-1); | ||
290 | } | ||
291 | } else { | ||
292 | irq = entry->link.index; | ||
293 | *edge_level = ACPI_LEVEL_SENSITIVE; | ||
294 | *active_high_low = ACPI_ACTIVE_LOW; | ||
295 | } | ||
296 | |||
297 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | ||
298 | return_VALUE(irq); | ||
299 | } | ||
300 | |||
301 | static int | ||
302 | acpi_pci_free_irq(struct acpi_prt_entry *entry, | ||
303 | int *edge_level, | ||
304 | int *active_high_low, | ||
305 | char **link) | ||
306 | { | ||
307 | int irq; | ||
308 | |||
309 | ACPI_FUNCTION_TRACE("acpi_pci_free_irq"); | ||
310 | if (entry->link.handle) { | ||
311 | irq = acpi_pci_link_free_irq(entry->link.handle); | ||
312 | } else { | ||
313 | irq = entry->link.index; | ||
314 | } | ||
315 | return_VALUE(irq); | ||
316 | } | ||
273 | /* | 317 | /* |
274 | * acpi_pci_irq_lookup | 318 | * acpi_pci_irq_lookup |
275 | * success: return IRQ >= 0 | 319 | * success: return IRQ >= 0 |
@@ -282,12 +326,13 @@ acpi_pci_irq_lookup ( | |||
282 | int pin, | 326 | int pin, |
283 | int *edge_level, | 327 | int *edge_level, |
284 | int *active_high_low, | 328 | int *active_high_low, |
285 | char **link) | 329 | char **link, |
330 | irq_lookup_func func) | ||
286 | { | 331 | { |
287 | struct acpi_prt_entry *entry = NULL; | 332 | struct acpi_prt_entry *entry = NULL; |
288 | int segment = pci_domain_nr(bus); | 333 | int segment = pci_domain_nr(bus); |
289 | int bus_nr = bus->number; | 334 | int bus_nr = bus->number; |
290 | int irq; | 335 | int ret; |
291 | 336 | ||
292 | ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); | 337 | ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); |
293 | 338 | ||
@@ -301,22 +346,8 @@ acpi_pci_irq_lookup ( | |||
301 | return_VALUE(-1); | 346 | return_VALUE(-1); |
302 | } | 347 | } |
303 | 348 | ||
304 | if (entry->link.handle) { | 349 | ret = func(entry, edge_level, active_high_low, link); |
305 | irq = acpi_pci_link_get_irq(entry->link.handle, | 350 | return_VALUE(ret); |
306 | entry->link.index, edge_level, active_high_low, link); | ||
307 | if (irq < 0) { | ||
308 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); | ||
309 | return_VALUE(-1); | ||
310 | } | ||
311 | } else { | ||
312 | irq = entry->link.index; | ||
313 | *edge_level = ACPI_LEVEL_SENSITIVE; | ||
314 | *active_high_low = ACPI_ACTIVE_LOW; | ||
315 | } | ||
316 | |||
317 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | ||
318 | |||
319 | return_VALUE(irq); | ||
320 | } | 351 | } |
321 | 352 | ||
322 | /* | 353 | /* |
@@ -330,7 +361,8 @@ acpi_pci_irq_derive ( | |||
330 | int pin, | 361 | int pin, |
331 | int *edge_level, | 362 | int *edge_level, |
332 | int *active_high_low, | 363 | int *active_high_low, |
333 | char **link) | 364 | char **link, |
365 | irq_lookup_func func) | ||
334 | { | 366 | { |
335 | struct pci_dev *bridge = dev; | 367 | struct pci_dev *bridge = dev; |
336 | int irq = -1; | 368 | int irq = -1; |
@@ -363,7 +395,7 @@ acpi_pci_irq_derive ( | |||
363 | } | 395 | } |
364 | 396 | ||
365 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), | 397 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), |
366 | pin, edge_level, active_high_low, link); | 398 | pin, edge_level, active_high_low, link, func); |
367 | } | 399 | } |
368 | 400 | ||
369 | if (irq < 0) { | 401 | if (irq < 0) { |
@@ -415,7 +447,7 @@ acpi_pci_irq_enable ( | |||
415 | * values override any BIOS-assigned IRQs set during boot. | 447 | * values override any BIOS-assigned IRQs set during boot. |
416 | */ | 448 | */ |
417 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | 449 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
418 | &edge_level, &active_high_low, &link); | 450 | &edge_level, &active_high_low, &link, acpi_pci_allocate_irq); |
419 | 451 | ||
420 | /* | 452 | /* |
421 | * If no PRT entry was found, we'll try to derive an IRQ from the | 453 | * If no PRT entry was found, we'll try to derive an IRQ from the |
@@ -423,7 +455,7 @@ acpi_pci_irq_enable ( | |||
423 | */ | 455 | */ |
424 | if (irq < 0) | 456 | if (irq < 0) |
425 | irq = acpi_pci_irq_derive(dev, pin, &edge_level, | 457 | irq = acpi_pci_irq_derive(dev, pin, &edge_level, |
426 | &active_high_low, &link); | 458 | &active_high_low, &link, acpi_pci_allocate_irq); |
427 | 459 | ||
428 | /* | 460 | /* |
429 | * No IRQ known to the ACPI subsystem - maybe the BIOS / | 461 | * No IRQ known to the ACPI subsystem - maybe the BIOS / |
@@ -433,8 +465,9 @@ acpi_pci_irq_enable ( | |||
433 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", | 465 | printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", |
434 | pci_name(dev), ('A' + pin)); | 466 | pci_name(dev), ('A' + pin)); |
435 | /* Interrupt Line values above 0xF are forbidden */ | 467 | /* Interrupt Line values above 0xF are forbidden */ |
436 | if (dev->irq >= 0 && (dev->irq <= 0xF)) { | 468 | if (dev->irq > 0 && (dev->irq <= 0xF)) { |
437 | printk(" - using IRQ %d\n", dev->irq); | 469 | printk(" - using IRQ %d\n", dev->irq); |
470 | acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); | ||
438 | return_VALUE(0); | 471 | return_VALUE(0); |
439 | } | 472 | } |
440 | else { | 473 | else { |
@@ -461,7 +494,9 @@ acpi_pci_irq_enable ( | |||
461 | EXPORT_SYMBOL(acpi_pci_irq_enable); | 494 | EXPORT_SYMBOL(acpi_pci_irq_enable); |
462 | 495 | ||
463 | 496 | ||
464 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ | 497 | /* FIXME: implement x86/x86_64 version */ |
498 | void __attribute__((weak)) acpi_unregister_gsi(u32 i) {} | ||
499 | |||
465 | void | 500 | void |
466 | acpi_pci_irq_disable ( | 501 | acpi_pci_irq_disable ( |
467 | struct pci_dev *dev) | 502 | struct pci_dev *dev) |
@@ -488,14 +523,14 @@ acpi_pci_irq_disable ( | |||
488 | * First we check the PCI IRQ routing table (PRT) for an IRQ. | 523 | * First we check the PCI IRQ routing table (PRT) for an IRQ. |
489 | */ | 524 | */ |
490 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | 525 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
491 | &edge_level, &active_high_low, NULL); | 526 | &edge_level, &active_high_low, NULL, acpi_pci_free_irq); |
492 | /* | 527 | /* |
493 | * If no PRT entry was found, we'll try to derive an IRQ from the | 528 | * If no PRT entry was found, we'll try to derive an IRQ from the |
494 | * device's parent bridge. | 529 | * device's parent bridge. |
495 | */ | 530 | */ |
496 | if (gsi < 0) | 531 | if (gsi < 0) |
497 | gsi = acpi_pci_irq_derive(dev, pin, | 532 | gsi = acpi_pci_irq_derive(dev, pin, |
498 | &edge_level, &active_high_low, NULL); | 533 | &edge_level, &active_high_low, NULL, acpi_pci_free_irq); |
499 | if (gsi < 0) | 534 | if (gsi < 0) |
500 | return_VOID; | 535 | return_VOID; |
501 | 536 | ||
@@ -511,4 +546,3 @@ acpi_pci_irq_disable ( | |||
511 | 546 | ||
512 | return_VOID; | 547 | return_VOID; |
513 | } | 548 | } |
514 | #endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ | ||
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 520b28ad0740..834c2ceff1aa 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -68,14 +68,19 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
68 | }, | 68 | }, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /* | ||
72 | * If a link is initialized, we never change its active and initialized | ||
73 | * later even the link is disable. Instead, we just repick the active irq | ||
74 | */ | ||
71 | struct acpi_pci_link_irq { | 75 | struct acpi_pci_link_irq { |
72 | u8 active; /* Current IRQ */ | 76 | u8 active; /* Current IRQ */ |
73 | u8 edge_level; /* All IRQs */ | 77 | u8 edge_level; /* All IRQs */ |
74 | u8 active_high_low; /* All IRQs */ | 78 | u8 active_high_low; /* All IRQs */ |
75 | u8 initialized; | ||
76 | u8 resource_type; | 79 | u8 resource_type; |
77 | u8 possible_count; | 80 | u8 possible_count; |
78 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 81 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
82 | u8 initialized:1; | ||
83 | u8 reserved:7; | ||
79 | }; | 84 | }; |
80 | 85 | ||
81 | struct acpi_pci_link { | 86 | struct acpi_pci_link { |
@@ -83,12 +88,14 @@ struct acpi_pci_link { | |||
83 | struct acpi_device *device; | 88 | struct acpi_device *device; |
84 | acpi_handle handle; | 89 | acpi_handle handle; |
85 | struct acpi_pci_link_irq irq; | 90 | struct acpi_pci_link_irq irq; |
91 | int refcnt; | ||
86 | }; | 92 | }; |
87 | 93 | ||
88 | static struct { | 94 | static struct { |
89 | int count; | 95 | int count; |
90 | struct list_head entries; | 96 | struct list_head entries; |
91 | } acpi_link; | 97 | } acpi_link; |
98 | DECLARE_MUTEX(acpi_link_lock); | ||
92 | 99 | ||
93 | 100 | ||
94 | /* -------------------------------------------------------------------------- | 101 | /* -------------------------------------------------------------------------- |
@@ -530,8 +537,12 @@ static int acpi_pci_link_allocate( | |||
530 | 537 | ||
531 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); | 538 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); |
532 | 539 | ||
533 | if (link->irq.initialized) | 540 | if (link->irq.initialized) { |
541 | if (link->refcnt == 0) | ||
542 | /* This means the link is disabled but initialized */ | ||
543 | acpi_pci_link_set(link, link->irq.active); | ||
534 | return_VALUE(0); | 544 | return_VALUE(0); |
545 | } | ||
535 | 546 | ||
536 | /* | 547 | /* |
537 | * search for active IRQ in list of possible IRQs. | 548 | * search for active IRQ in list of possible IRQs. |
@@ -590,13 +601,13 @@ static int acpi_pci_link_allocate( | |||
590 | } | 601 | } |
591 | 602 | ||
592 | /* | 603 | /* |
593 | * acpi_pci_link_get_irq | 604 | * acpi_pci_link_allocate_irq |
594 | * success: return IRQ >= 0 | 605 | * success: return IRQ >= 0 |
595 | * failure: return -1 | 606 | * failure: return -1 |
596 | */ | 607 | */ |
597 | 608 | ||
598 | int | 609 | int |
599 | acpi_pci_link_get_irq ( | 610 | acpi_pci_link_allocate_irq ( |
600 | acpi_handle handle, | 611 | acpi_handle handle, |
601 | int index, | 612 | int index, |
602 | int *edge_level, | 613 | int *edge_level, |
@@ -607,7 +618,7 @@ acpi_pci_link_get_irq ( | |||
607 | struct acpi_device *device = NULL; | 618 | struct acpi_device *device = NULL; |
608 | struct acpi_pci_link *link = NULL; | 619 | struct acpi_pci_link *link = NULL; |
609 | 620 | ||
610 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_irq"); | 621 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); |
611 | 622 | ||
612 | result = acpi_bus_get_device(handle, &device); | 623 | result = acpi_bus_get_device(handle, &device); |
613 | if (result) { | 624 | if (result) { |
@@ -627,21 +638,81 @@ acpi_pci_link_get_irq ( | |||
627 | return_VALUE(-1); | 638 | return_VALUE(-1); |
628 | } | 639 | } |
629 | 640 | ||
630 | if (acpi_pci_link_allocate(link)) | 641 | down(&acpi_link_lock); |
642 | if (acpi_pci_link_allocate(link)) { | ||
643 | up(&acpi_link_lock); | ||
631 | return_VALUE(-1); | 644 | return_VALUE(-1); |
645 | } | ||
632 | 646 | ||
633 | if (!link->irq.active) { | 647 | if (!link->irq.active) { |
648 | up(&acpi_link_lock); | ||
634 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); | 649 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); |
635 | return_VALUE(-1); | 650 | return_VALUE(-1); |
636 | } | 651 | } |
652 | link->refcnt ++; | ||
653 | up(&acpi_link_lock); | ||
637 | 654 | ||
638 | if (edge_level) *edge_level = link->irq.edge_level; | 655 | if (edge_level) *edge_level = link->irq.edge_level; |
639 | if (active_high_low) *active_high_low = link->irq.active_high_low; | 656 | if (active_high_low) *active_high_low = link->irq.active_high_low; |
640 | if (name) *name = acpi_device_bid(link->device); | 657 | if (name) *name = acpi_device_bid(link->device); |
658 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
659 | "Link %s is referenced\n", acpi_device_bid(link->device))); | ||
641 | return_VALUE(link->irq.active); | 660 | return_VALUE(link->irq.active); |
642 | } | 661 | } |
643 | 662 | ||
663 | /* | ||
664 | * We don't change link's irq information here. After it is reenabled, we | ||
665 | * continue use the info | ||
666 | */ | ||
667 | int | ||
668 | acpi_pci_link_free_irq(acpi_handle handle) | ||
669 | { | ||
670 | struct acpi_device *device = NULL; | ||
671 | struct acpi_pci_link *link = NULL; | ||
672 | acpi_status result; | ||
673 | |||
674 | ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); | ||
675 | |||
676 | result = acpi_bus_get_device(handle, &device); | ||
677 | if (result) { | ||
678 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); | ||
679 | return_VALUE(-1); | ||
680 | } | ||
681 | |||
682 | link = (struct acpi_pci_link *) acpi_driver_data(device); | ||
683 | if (!link) { | ||
684 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | ||
685 | return_VALUE(-1); | ||
686 | } | ||
687 | |||
688 | down(&acpi_link_lock); | ||
689 | if (!link->irq.initialized) { | ||
690 | up(&acpi_link_lock); | ||
691 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); | ||
692 | return_VALUE(-1); | ||
693 | } | ||
644 | 694 | ||
695 | #ifdef FUTURE_USE | ||
696 | /* | ||
697 | * The Link reference count allows us to _DISable an unused link | ||
698 | * and suspend time, and set it again on resume. | ||
699 | * However, 2.6.12 still has irq_router.resume | ||
700 | * which blindly restores the link state. | ||
701 | * So we disable the reference count method | ||
702 | * to prevent duplicate acpi_pci_link_set() | ||
703 | * which would harm some systems | ||
704 | */ | ||
705 | link->refcnt --; | ||
706 | #endif | ||
707 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
708 | "Link %s is dereferenced\n", acpi_device_bid(link->device))); | ||
709 | |||
710 | if (link->refcnt == 0) { | ||
711 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | ||
712 | } | ||
713 | up(&acpi_link_lock); | ||
714 | return_VALUE(link->irq.active); | ||
715 | } | ||
645 | /* -------------------------------------------------------------------------- | 716 | /* -------------------------------------------------------------------------- |
646 | Driver Interface | 717 | Driver Interface |
647 | -------------------------------------------------------------------------- */ | 718 | -------------------------------------------------------------------------- */ |
@@ -671,6 +742,7 @@ acpi_pci_link_add ( | |||
671 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); | 742 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); |
672 | acpi_driver_data(device) = link; | 743 | acpi_driver_data(device) = link; |
673 | 744 | ||
745 | down(&acpi_link_lock); | ||
674 | result = acpi_pci_link_get_possible(link); | 746 | result = acpi_pci_link_get_possible(link); |
675 | if (result) | 747 | if (result) |
676 | goto end; | 748 | goto end; |
@@ -706,6 +778,7 @@ acpi_pci_link_add ( | |||
706 | end: | 778 | end: |
707 | /* disable all links -- to be activated on use */ | 779 | /* disable all links -- to be activated on use */ |
708 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 780 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
781 | up(&acpi_link_lock); | ||
709 | 782 | ||
710 | if (result) | 783 | if (result) |
711 | kfree(link); | 784 | kfree(link); |
@@ -713,20 +786,23 @@ end: | |||
713 | return_VALUE(result); | 786 | return_VALUE(result); |
714 | } | 787 | } |
715 | 788 | ||
716 | |||
717 | static int | 789 | static int |
718 | acpi_pci_link_resume ( | 790 | acpi_pci_link_resume( |
719 | struct acpi_pci_link *link) | 791 | struct acpi_pci_link *link) |
720 | { | 792 | { |
721 | ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); | 793 | ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); |
722 | 794 | ||
723 | if (link->irq.active && link->irq.initialized) | 795 | if (link->refcnt && link->irq.active && link->irq.initialized) |
724 | return_VALUE(acpi_pci_link_set(link, link->irq.active)); | 796 | return_VALUE(acpi_pci_link_set(link, link->irq.active)); |
725 | else | 797 | else |
726 | return_VALUE(0); | 798 | return_VALUE(0); |
727 | } | 799 | } |
728 | 800 | ||
729 | 801 | /* | |
802 | * FIXME: this is a workaround to avoid nasty warning. It will be removed | ||
803 | * after every device calls pci_disable_device in .resume. | ||
804 | */ | ||
805 | int acpi_in_resume; | ||
730 | static int | 806 | static int |
731 | irqrouter_resume( | 807 | irqrouter_resume( |
732 | struct sys_device *dev) | 808 | struct sys_device *dev) |
@@ -736,16 +812,17 @@ irqrouter_resume( | |||
736 | 812 | ||
737 | ACPI_FUNCTION_TRACE("irqrouter_resume"); | 813 | ACPI_FUNCTION_TRACE("irqrouter_resume"); |
738 | 814 | ||
815 | acpi_in_resume = 1; | ||
739 | list_for_each(node, &acpi_link.entries) { | 816 | list_for_each(node, &acpi_link.entries) { |
740 | |||
741 | link = list_entry(node, struct acpi_pci_link, node); | 817 | link = list_entry(node, struct acpi_pci_link, node); |
742 | if (!link) { | 818 | if (!link) { |
743 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 819 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
820 | "Invalid link context\n")); | ||
744 | continue; | 821 | continue; |
745 | } | 822 | } |
746 | |||
747 | acpi_pci_link_resume(link); | 823 | acpi_pci_link_resume(link); |
748 | } | 824 | } |
825 | acpi_in_resume = 0; | ||
749 | return_VALUE(0); | 826 | return_VALUE(0); |
750 | } | 827 | } |
751 | 828 | ||
@@ -764,8 +841,9 @@ acpi_pci_link_remove ( | |||
764 | 841 | ||
765 | link = (struct acpi_pci_link *) acpi_driver_data(device); | 842 | link = (struct acpi_pci_link *) acpi_driver_data(device); |
766 | 843 | ||
767 | /* TBD: Acquire/release lock */ | 844 | down(&acpi_link_lock); |
768 | list_del(&link->node); | 845 | list_del(&link->node); |
846 | up(&acpi_link_lock); | ||
769 | 847 | ||
770 | kfree(link); | 848 | kfree(link); |
771 | 849 | ||
@@ -812,9 +890,12 @@ static int __init acpi_irq_penalty_update(char *str, int used) | |||
812 | * There is no ISA_POSSIBLE weight, so we simply use | 890 | * There is no ISA_POSSIBLE weight, so we simply use |
813 | * the (small) PCI_USING penalty. | 891 | * the (small) PCI_USING penalty. |
814 | */ | 892 | */ |
815 | void acpi_penalize_isa_irq(int irq) | 893 | void acpi_penalize_isa_irq(int irq, int active) |
816 | { | 894 | { |
817 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | 895 | if (active) |
896 | acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; | ||
897 | else | ||
898 | acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; | ||
818 | } | 899 | } |
819 | 900 | ||
820 | /* | 901 | /* |
@@ -854,6 +935,7 @@ int __init acpi_irq_balance_set(char *str) | |||
854 | __setup("acpi_irq_balance", acpi_irq_balance_set); | 935 | __setup("acpi_irq_balance", acpi_irq_balance_set); |
855 | 936 | ||
856 | 937 | ||
938 | /* FIXME: we will remove this interface after all drivers call pci_disable_device */ | ||
857 | static struct sysdev_class irqrouter_sysdev_class = { | 939 | static struct sysdev_class irqrouter_sysdev_class = { |
858 | set_kset_name("irqrouter"), | 940 | set_kset_name("irqrouter"), |
859 | .resume = irqrouter_resume, | 941 | .resume = irqrouter_resume, |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 7e6b8e3b2ed4..5d2f77fcd50c 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -46,6 +46,7 @@ ACPI_MODULE_NAME ("pci_root") | |||
46 | 46 | ||
47 | static int acpi_pci_root_add (struct acpi_device *device); | 47 | static int acpi_pci_root_add (struct acpi_device *device); |
48 | static int acpi_pci_root_remove (struct acpi_device *device, int type); | 48 | static int acpi_pci_root_remove (struct acpi_device *device, int type); |
49 | static int acpi_pci_root_start (struct acpi_device *device); | ||
49 | 50 | ||
50 | static struct acpi_driver acpi_pci_root_driver = { | 51 | static struct acpi_driver acpi_pci_root_driver = { |
51 | .name = ACPI_PCI_ROOT_DRIVER_NAME, | 52 | .name = ACPI_PCI_ROOT_DRIVER_NAME, |
@@ -54,6 +55,7 @@ static struct acpi_driver acpi_pci_root_driver = { | |||
54 | .ops = { | 55 | .ops = { |
55 | .add = acpi_pci_root_add, | 56 | .add = acpi_pci_root_add, |
56 | .remove = acpi_pci_root_remove, | 57 | .remove = acpi_pci_root_remove, |
58 | .start = acpi_pci_root_start, | ||
57 | }, | 59 | }, |
58 | }; | 60 | }; |
59 | 61 | ||
@@ -169,6 +171,7 @@ acpi_pci_root_add ( | |||
169 | if (!root) | 171 | if (!root) |
170 | return_VALUE(-ENOMEM); | 172 | return_VALUE(-ENOMEM); |
171 | memset(root, 0, sizeof(struct acpi_pci_root)); | 173 | memset(root, 0, sizeof(struct acpi_pci_root)); |
174 | INIT_LIST_HEAD(&root->node); | ||
172 | 175 | ||
173 | root->handle = device->handle; | 176 | root->handle = device->handle; |
174 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); | 177 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); |
@@ -298,12 +301,31 @@ acpi_pci_root_add ( | |||
298 | root->id.bus); | 301 | root->id.bus); |
299 | 302 | ||
300 | end: | 303 | end: |
301 | if (result) | 304 | if (result) { |
305 | if (!list_empty(&root->node)) | ||
306 | list_del(&root->node); | ||
302 | kfree(root); | 307 | kfree(root); |
308 | } | ||
303 | 309 | ||
304 | return_VALUE(result); | 310 | return_VALUE(result); |
305 | } | 311 | } |
306 | 312 | ||
313 | static int | ||
314 | acpi_pci_root_start ( | ||
315 | struct acpi_device *device) | ||
316 | { | ||
317 | struct acpi_pci_root *root; | ||
318 | |||
319 | ACPI_FUNCTION_TRACE("acpi_pci_root_start"); | ||
320 | |||
321 | list_for_each_entry(root, &acpi_pci_roots, node) { | ||
322 | if (root->handle == device->handle) { | ||
323 | pci_bus_add_devices(root->bus); | ||
324 | return_VALUE(0); | ||
325 | } | ||
326 | } | ||
327 | return_VALUE(-ENODEV); | ||
328 | } | ||
307 | 329 | ||
308 | static int | 330 | static int |
309 | acpi_pci_root_remove ( | 331 | acpi_pci_root_remove ( |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index f4778747e889..d56a439ac614 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -256,6 +256,43 @@ acpi_processor_errata ( | |||
256 | 256 | ||
257 | 257 | ||
258 | /* -------------------------------------------------------------------------- | 258 | /* -------------------------------------------------------------------------- |
259 | Common ACPI processor fucntions | ||
260 | -------------------------------------------------------------------------- */ | ||
261 | |||
262 | /* | ||
263 | * _PDC is required for a BIOS-OS handshake for most of the newer | ||
264 | * ACPI processor features. | ||
265 | */ | ||
266 | |||
267 | int acpi_processor_set_pdc(struct acpi_processor *pr, | ||
268 | struct acpi_object_list *pdc_in) | ||
269 | { | ||
270 | acpi_status status = AE_OK; | ||
271 | u32 arg0_buf[3]; | ||
272 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | ||
273 | struct acpi_object_list no_object = {1, &arg0}; | ||
274 | struct acpi_object_list *pdc; | ||
275 | |||
276 | ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); | ||
277 | |||
278 | arg0.buffer.length = 12; | ||
279 | arg0.buffer.pointer = (u8 *) arg0_buf; | ||
280 | arg0_buf[0] = ACPI_PDC_REVISION_ID; | ||
281 | arg0_buf[1] = 0; | ||
282 | arg0_buf[2] = 0; | ||
283 | |||
284 | pdc = (pdc_in) ? pdc_in : &no_object; | ||
285 | |||
286 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); | ||
287 | |||
288 | if ((ACPI_FAILURE(status)) && (pdc_in)) | ||
289 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n")); | ||
290 | |||
291 | return_VALUE(status); | ||
292 | } | ||
293 | |||
294 | |||
295 | /* -------------------------------------------------------------------------- | ||
259 | FS Interface (/proc) | 296 | FS Interface (/proc) |
260 | -------------------------------------------------------------------------- */ | 297 | -------------------------------------------------------------------------- */ |
261 | 298 | ||
@@ -723,7 +760,7 @@ int acpi_processor_device_add( | |||
723 | return_VALUE(-ENODEV); | 760 | return_VALUE(-ENODEV); |
724 | } | 761 | } |
725 | 762 | ||
726 | acpi_bus_scan(*device); | 763 | acpi_bus_start(*device); |
727 | 764 | ||
728 | pr = acpi_driver_data(*device); | 765 | pr = acpi_driver_data(*device); |
729 | if (!pr) | 766 | if (!pr) |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index c9d671cf7857..2c04740c6543 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -6,6 +6,8 @@ | |||
6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> | 6 | * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> |
7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | 7 | * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> |
8 | * - Added processor hotplug support | 8 | * - Added processor hotplug support |
9 | * Copyright (C) 2005 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
10 | * - Added support for C3 on SMP | ||
9 | * | 11 | * |
10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 12 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
11 | * | 13 | * |
@@ -79,30 +81,32 @@ module_param(bm_history, uint, 0644); | |||
79 | * | 81 | * |
80 | * To skip this limit, boot/load with a large max_cstate limit. | 82 | * To skip this limit, boot/load with a large max_cstate limit. |
81 | */ | 83 | */ |
82 | static int no_c2c3(struct dmi_system_id *id) | 84 | static int set_max_cstate(struct dmi_system_id *id) |
83 | { | 85 | { |
84 | if (max_cstate > ACPI_PROCESSOR_MAX_POWER) | 86 | if (max_cstate > ACPI_PROCESSOR_MAX_POWER) |
85 | return 0; | 87 | return 0; |
86 | 88 | ||
87 | printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled." | 89 | printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate." |
88 | " Override with \"processor.max_cstate=%d\"\n", id->ident, | 90 | " Override with \"processor.max_cstate=%d\"\n", id->ident, |
89 | ACPI_PROCESSOR_MAX_POWER + 1); | 91 | (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); |
90 | 92 | ||
91 | max_cstate = 1; | 93 | max_cstate = (long)id->driver_data; |
92 | 94 | ||
93 | return 0; | 95 | return 0; |
94 | } | 96 | } |
95 | 97 | ||
96 | 98 | ||
97 | |||
98 | |||
99 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { | 99 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { |
100 | { no_c2c3, "IBM ThinkPad R40e", { | 100 | { set_max_cstate, "IBM ThinkPad R40e", { |
101 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | 101 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
102 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }}, | 102 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, |
103 | { no_c2c3, "Medion 41700", { | 103 | { set_max_cstate, "Medion 41700", { |
104 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | 104 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), |
105 | DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }}, | 105 | DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1}, |
106 | { set_max_cstate, "Clevo 5600D", { | ||
107 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | ||
108 | DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") }, | ||
109 | (void*)2}, | ||
106 | {}, | 110 | {}, |
107 | }; | 111 | }; |
108 | 112 | ||
@@ -142,7 +146,7 @@ acpi_processor_power_activate ( | |||
142 | switch (old->type) { | 146 | switch (old->type) { |
143 | case ACPI_STATE_C3: | 147 | case ACPI_STATE_C3: |
144 | /* Disable bus master reload */ | 148 | /* Disable bus master reload */ |
145 | if (new->type != ACPI_STATE_C3) | 149 | if (new->type != ACPI_STATE_C3 && pr->flags.bm_check) |
146 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); | 150 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); |
147 | break; | 151 | break; |
148 | } | 152 | } |
@@ -152,7 +156,7 @@ acpi_processor_power_activate ( | |||
152 | switch (new->type) { | 156 | switch (new->type) { |
153 | case ACPI_STATE_C3: | 157 | case ACPI_STATE_C3: |
154 | /* Enable bus master reload */ | 158 | /* Enable bus master reload */ |
155 | if (old->type != ACPI_STATE_C3) | 159 | if (old->type != ACPI_STATE_C3 && pr->flags.bm_check) |
156 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); | 160 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); |
157 | break; | 161 | break; |
158 | } | 162 | } |
@@ -163,6 +167,9 @@ acpi_processor_power_activate ( | |||
163 | } | 167 | } |
164 | 168 | ||
165 | 169 | ||
170 | static atomic_t c3_cpu_count; | ||
171 | |||
172 | |||
166 | static void acpi_processor_idle (void) | 173 | static void acpi_processor_idle (void) |
167 | { | 174 | { |
168 | struct acpi_processor *pr = NULL; | 175 | struct acpi_processor *pr = NULL; |
@@ -297,8 +304,22 @@ static void acpi_processor_idle (void) | |||
297 | break; | 304 | break; |
298 | 305 | ||
299 | case ACPI_STATE_C3: | 306 | case ACPI_STATE_C3: |
300 | /* Disable bus master arbitration */ | 307 | |
301 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); | 308 | if (pr->flags.bm_check) { |
309 | if (atomic_inc_return(&c3_cpu_count) == | ||
310 | num_online_cpus()) { | ||
311 | /* | ||
312 | * All CPUs are trying to go to C3 | ||
313 | * Disable bus master arbitration | ||
314 | */ | ||
315 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, | ||
316 | ACPI_MTX_DO_NOT_LOCK); | ||
317 | } | ||
318 | } else { | ||
319 | /* SMP with no shared cache... Invalidate cache */ | ||
320 | ACPI_FLUSH_CPU_CACHE(); | ||
321 | } | ||
322 | |||
302 | /* Get start time (ticks) */ | 323 | /* Get start time (ticks) */ |
303 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); | 324 | t1 = inl(acpi_fadt.xpm_tmr_blk.address); |
304 | /* Invoke C3 */ | 325 | /* Invoke C3 */ |
@@ -307,8 +328,12 @@ static void acpi_processor_idle (void) | |||
307 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 328 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
308 | /* Get end time (ticks) */ | 329 | /* Get end time (ticks) */ |
309 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); | 330 | t2 = inl(acpi_fadt.xpm_tmr_blk.address); |
310 | /* Enable bus master arbitration */ | 331 | if (pr->flags.bm_check) { |
311 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); | 332 | /* Enable bus master arbitration */ |
333 | atomic_dec(&c3_cpu_count); | ||
334 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); | ||
335 | } | ||
336 | |||
312 | /* Re-enable interrupts */ | 337 | /* Re-enable interrupts */ |
313 | local_irq_enable(); | 338 | local_irq_enable(); |
314 | /* Compute time (ticks) that we were actually asleep */ | 339 | /* Compute time (ticks) that we were actually asleep */ |
@@ -519,6 +544,30 @@ static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr) | |||
519 | } | 544 | } |
520 | 545 | ||
521 | 546 | ||
547 | static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) | ||
548 | { | ||
549 | int i; | ||
550 | |||
551 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); | ||
552 | |||
553 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | ||
554 | memset(&(pr->power.states[i]), 0, | ||
555 | sizeof(struct acpi_processor_cx)); | ||
556 | |||
557 | /* if info is obtained from pblk/fadt, type equals state */ | ||
558 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | ||
559 | pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; | ||
560 | pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; | ||
561 | |||
562 | /* the C0 state only exists as a filler in our array, | ||
563 | * and all processors need to support C1 */ | ||
564 | pr->power.states[ACPI_STATE_C0].valid = 1; | ||
565 | pr->power.states[ACPI_STATE_C1].valid = 1; | ||
566 | |||
567 | return_VALUE(0); | ||
568 | } | ||
569 | |||
570 | |||
522 | static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | 571 | static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) |
523 | { | 572 | { |
524 | acpi_status status = 0; | 573 | acpi_status status = 0; |
@@ -529,15 +578,13 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
529 | 578 | ||
530 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); | 579 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); |
531 | 580 | ||
532 | if (errata.smp) | ||
533 | return_VALUE(-ENODEV); | ||
534 | |||
535 | if (nocst) | 581 | if (nocst) |
536 | return_VALUE(-ENODEV); | 582 | return_VALUE(-ENODEV); |
537 | 583 | ||
538 | pr->power.count = 0; | 584 | pr->power.count = 0; |
539 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 585 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) |
540 | memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); | 586 | memset(&(pr->power.states[i]), 0, |
587 | sizeof(struct acpi_processor_cx)); | ||
541 | 588 | ||
542 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); | 589 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); |
543 | if (ACPI_FAILURE(status)) { | 590 | if (ACPI_FAILURE(status)) { |
@@ -664,13 +711,6 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) | |||
664 | return_VOID; | 711 | return_VOID; |
665 | } | 712 | } |
666 | 713 | ||
667 | /* We're (currently) only supporting C2 on UP */ | ||
668 | else if (errata.smp) { | ||
669 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
670 | "C2 not supported in SMP mode\n")); | ||
671 | return_VOID; | ||
672 | } | ||
673 | |||
674 | /* | 714 | /* |
675 | * Otherwise we've met all of our C2 requirements. | 715 | * Otherwise we've met all of our C2 requirements. |
676 | * Normalize the C2 latency to expidite policy | 716 | * Normalize the C2 latency to expidite policy |
@@ -686,6 +726,8 @@ static void acpi_processor_power_verify_c3( | |||
686 | struct acpi_processor *pr, | 726 | struct acpi_processor *pr, |
687 | struct acpi_processor_cx *cx) | 727 | struct acpi_processor_cx *cx) |
688 | { | 728 | { |
729 | static int bm_check_flag; | ||
730 | |||
689 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); | 731 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); |
690 | 732 | ||
691 | if (!cx->address) | 733 | if (!cx->address) |
@@ -702,20 +744,6 @@ static void acpi_processor_power_verify_c3( | |||
702 | return_VOID; | 744 | return_VOID; |
703 | } | 745 | } |
704 | 746 | ||
705 | /* bus mastering control is necessary */ | ||
706 | else if (!pr->flags.bm_control) { | ||
707 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
708 | "C3 support requires bus mastering control\n")); | ||
709 | return_VOID; | ||
710 | } | ||
711 | |||
712 | /* We're (currently) only supporting C2 on UP */ | ||
713 | else if (errata.smp) { | ||
714 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
715 | "C3 not supported in SMP mode\n")); | ||
716 | return_VOID; | ||
717 | } | ||
718 | |||
719 | /* | 747 | /* |
720 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) | 748 | * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) |
721 | * DMA transfers are used by any ISA device to avoid livelock. | 749 | * DMA transfers are used by any ISA device to avoid livelock. |
@@ -729,6 +757,37 @@ static void acpi_processor_power_verify_c3( | |||
729 | return_VOID; | 757 | return_VOID; |
730 | } | 758 | } |
731 | 759 | ||
760 | /* All the logic here assumes flags.bm_check is same across all CPUs */ | ||
761 | if (!bm_check_flag) { | ||
762 | /* Determine whether bm_check is needed based on CPU */ | ||
763 | acpi_processor_power_init_bm_check(&(pr->flags), pr->id); | ||
764 | bm_check_flag = pr->flags.bm_check; | ||
765 | } else { | ||
766 | pr->flags.bm_check = bm_check_flag; | ||
767 | } | ||
768 | |||
769 | if (pr->flags.bm_check) { | ||
770 | /* bus mastering control is necessary */ | ||
771 | if (!pr->flags.bm_control) { | ||
772 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
773 | "C3 support requires bus mastering control\n")); | ||
774 | return_VOID; | ||
775 | } | ||
776 | } else { | ||
777 | /* | ||
778 | * WBINVD should be set in fadt, for C3 state to be | ||
779 | * supported on when bm_check is not required. | ||
780 | */ | ||
781 | if (acpi_fadt.wb_invd != 1) { | ||
782 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
783 | "Cache invalidation should work properly" | ||
784 | " for C3 to be enabled on SMP systems\n")); | ||
785 | return_VOID; | ||
786 | } | ||
787 | acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, | ||
788 | 0, ACPI_MTX_DO_NOT_LOCK); | ||
789 | } | ||
790 | |||
732 | /* | 791 | /* |
733 | * Otherwise we've met all of our C3 requirements. | 792 | * Otherwise we've met all of our C3 requirements. |
734 | * Normalize the C3 latency to expidite policy. Enable | 793 | * Normalize the C3 latency to expidite policy. Enable |
@@ -737,7 +796,6 @@ static void acpi_processor_power_verify_c3( | |||
737 | */ | 796 | */ |
738 | cx->valid = 1; | 797 | cx->valid = 1; |
739 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); | 798 | cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); |
740 | pr->flags.bm_check = 1; | ||
741 | 799 | ||
742 | return_VOID; | 800 | return_VOID; |
743 | } | 801 | } |
@@ -786,11 +844,8 @@ static int acpi_processor_get_power_info ( | |||
786 | result = acpi_processor_get_power_info_cst(pr); | 844 | result = acpi_processor_get_power_info_cst(pr); |
787 | if ((result) || (acpi_processor_power_verify(pr) < 2)) { | 845 | if ((result) || (acpi_processor_power_verify(pr) < 2)) { |
788 | result = acpi_processor_get_power_info_fadt(pr); | 846 | result = acpi_processor_get_power_info_fadt(pr); |
789 | if (result) | 847 | if ((result) || (acpi_processor_power_verify(pr) < 2)) |
790 | return_VALUE(result); | 848 | result = acpi_processor_get_power_info_default_c1(pr); |
791 | |||
792 | if (acpi_processor_power_verify(pr) < 2) | ||
793 | return_VALUE(-ENODEV); | ||
794 | } | 849 | } |
795 | 850 | ||
796 | /* | 851 | /* |
@@ -810,11 +865,10 @@ static int acpi_processor_get_power_info ( | |||
810 | * CPU as being "idle manageable" | 865 | * CPU as being "idle manageable" |
811 | */ | 866 | */ |
812 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 867 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
813 | if (pr->power.states[i].valid) | 868 | if (pr->power.states[i].valid) { |
814 | pr->power.count = i; | 869 | pr->power.count = i; |
815 | if ((pr->power.states[i].valid) && | ||
816 | (pr->power.states[i].type >= ACPI_STATE_C2)) | ||
817 | pr->flags.power = 1; | 870 | pr->flags.power = 1; |
871 | } | ||
818 | } | 872 | } |
819 | 873 | ||
820 | return_VALUE(0); | 874 | return_VALUE(0); |
@@ -829,7 +883,7 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr) | |||
829 | if (!pr) | 883 | if (!pr) |
830 | return_VALUE(-EINVAL); | 884 | return_VALUE(-EINVAL); |
831 | 885 | ||
832 | if (errata.smp || nocst) { | 886 | if ( nocst) { |
833 | return_VALUE(-ENODEV); | 887 | return_VALUE(-ENODEV); |
834 | } | 888 | } |
835 | 889 | ||
@@ -929,7 +983,6 @@ static struct file_operations acpi_processor_power_fops = { | |||
929 | .release = single_release, | 983 | .release = single_release, |
930 | }; | 984 | }; |
931 | 985 | ||
932 | |||
933 | int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) | 986 | int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) |
934 | { | 987 | { |
935 | acpi_status status = 0; | 988 | acpi_status status = 0; |
@@ -946,7 +999,10 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
946 | first_run++; | 999 | first_run++; |
947 | } | 1000 | } |
948 | 1001 | ||
949 | if (!errata.smp && (pr->id == 0) && acpi_fadt.cst_cnt && !nocst) { | 1002 | if (!pr) |
1003 | return_VALUE(-EINVAL); | ||
1004 | |||
1005 | if (acpi_fadt.cst_cnt && !nocst) { | ||
950 | status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); | 1006 | status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); |
951 | if (ACPI_FAILURE(status)) { | 1007 | if (ACPI_FAILURE(status)) { |
952 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1008 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -954,6 +1010,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev | |||
954 | } | 1010 | } |
955 | } | 1011 | } |
956 | 1012 | ||
1013 | acpi_processor_power_init_pdc(&(pr->power), pr->id); | ||
1014 | acpi_processor_set_pdc(pr, pr->power.pdc); | ||
957 | acpi_processor_get_power_info(pr); | 1015 | acpi_processor_get_power_info(pr); |
958 | 1016 | ||
959 | /* | 1017 | /* |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index a9a1a8fe3199..1f0d6256302f 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -165,37 +165,6 @@ void acpi_processor_ppc_exit(void) { | |||
165 | acpi_processor_ppc_status &= ~PPC_REGISTERED; | 165 | acpi_processor_ppc_status &= ~PPC_REGISTERED; |
166 | } | 166 | } |
167 | 167 | ||
168 | /* | ||
169 | * when registering a cpufreq driver with this ACPI processor driver, the | ||
170 | * _PCT and _PSS structures are read out and written into struct | ||
171 | * acpi_processor_performance. | ||
172 | */ | ||
173 | static int acpi_processor_set_pdc (struct acpi_processor *pr) | ||
174 | { | ||
175 | acpi_status status = AE_OK; | ||
176 | u32 arg0_buf[3]; | ||
177 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | ||
178 | struct acpi_object_list no_object = {1, &arg0}; | ||
179 | struct acpi_object_list *pdc; | ||
180 | |||
181 | ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); | ||
182 | |||
183 | arg0.buffer.length = 12; | ||
184 | arg0.buffer.pointer = (u8 *) arg0_buf; | ||
185 | arg0_buf[0] = ACPI_PDC_REVISION_ID; | ||
186 | arg0_buf[1] = 0; | ||
187 | arg0_buf[2] = 0; | ||
188 | |||
189 | pdc = (pr->performance->pdc) ? pr->performance->pdc : &no_object; | ||
190 | |||
191 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); | ||
192 | |||
193 | if ((ACPI_FAILURE(status)) && (pr->performance->pdc)) | ||
194 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n")); | ||
195 | |||
196 | return_VALUE(status); | ||
197 | } | ||
198 | |||
199 | 168 | ||
200 | static int | 169 | static int |
201 | acpi_processor_get_performance_control ( | 170 | acpi_processor_get_performance_control ( |
@@ -357,7 +326,7 @@ acpi_processor_get_performance_info ( | |||
357 | if (!pr || !pr->performance || !pr->handle) | 326 | if (!pr || !pr->performance || !pr->handle) |
358 | return_VALUE(-EINVAL); | 327 | return_VALUE(-EINVAL); |
359 | 328 | ||
360 | acpi_processor_set_pdc(pr); | 329 | acpi_processor_set_pdc(pr, pr->performance->pdc); |
361 | 330 | ||
362 | status = acpi_get_handle(pr->handle, "_PCT", &handle); | 331 | status = acpi_get_handle(pr->handle, "_PCT", &handle); |
363 | if (ACPI_FAILURE(status)) { | 332 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 4788c079735d..55d264771c48 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c | |||
@@ -77,21 +77,21 @@ acpi_rs_address16_resource ( | |||
77 | u8 **output_buffer, | 77 | u8 **output_buffer, |
78 | acpi_size *structure_size) | 78 | acpi_size *structure_size) |
79 | { | 79 | { |
80 | u8 *buffer = byte_stream_buffer; | ||
81 | struct acpi_resource *output_struct = (void *) *output_buffer; | ||
82 | u8 *temp_ptr; | ||
83 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16); | ||
84 | u32 index; | 80 | u32 index; |
85 | u16 temp16; | 81 | u16 temp16; |
86 | u8 temp8; | 82 | u8 temp8; |
83 | u8 *temp_ptr; | ||
84 | u8 *buffer = byte_stream_buffer; | ||
85 | struct acpi_resource *output_struct = (void *) *output_buffer; | ||
86 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( | ||
87 | struct acpi_resource_address16); | ||
87 | 88 | ||
88 | 89 | ||
89 | ACPI_FUNCTION_TRACE ("rs_address16_resource"); | 90 | ACPI_FUNCTION_TRACE ("rs_address16_resource"); |
90 | 91 | ||
91 | 92 | ||
92 | /* | 93 | /* Point past the Descriptor to get the number of bytes consumed */ |
93 | * Point past the Descriptor to get the number of bytes consumed | 94 | |
94 | */ | ||
95 | buffer += 1; | 95 | buffer += 1; |
96 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 96 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
97 | 97 | ||
@@ -104,9 +104,8 @@ acpi_rs_address16_resource ( | |||
104 | *bytes_consumed = temp16 + 3; | 104 | *bytes_consumed = temp16 + 3; |
105 | output_struct->id = ACPI_RSTYPE_ADDRESS16; | 105 | output_struct->id = ACPI_RSTYPE_ADDRESS16; |
106 | 106 | ||
107 | /* | 107 | /* Get the Resource Type (Byte3) */ |
108 | * Get the Resource Type (Byte3) | 108 | |
109 | */ | ||
110 | buffer += 2; | 109 | buffer += 2; |
111 | temp8 = *buffer; | 110 | temp8 = *buffer; |
112 | 111 | ||
@@ -118,9 +117,8 @@ acpi_rs_address16_resource ( | |||
118 | 117 | ||
119 | output_struct->data.address16.resource_type = temp8; | 118 | output_struct->data.address16.resource_type = temp8; |
120 | 119 | ||
121 | /* | 120 | /* Get the General Flags (Byte4) */ |
122 | * Get the General Flags (Byte4) | 121 | |
123 | */ | ||
124 | buffer += 1; | 122 | buffer += 1; |
125 | temp8 = *buffer; | 123 | temp8 = *buffer; |
126 | 124 | ||
@@ -140,9 +138,8 @@ acpi_rs_address16_resource ( | |||
140 | 138 | ||
141 | output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; | 139 | output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; |
142 | 140 | ||
143 | /* | 141 | /* Get the Type Specific Flags (Byte5) */ |
144 | * Get the Type Specific Flags (Byte5) | 142 | |
145 | */ | ||
146 | buffer += 1; | 143 | buffer += 1; |
147 | temp8 = *buffer; | 144 | temp8 = *buffer; |
148 | 145 | ||
@@ -165,39 +162,34 @@ acpi_rs_address16_resource ( | |||
165 | } | 162 | } |
166 | } | 163 | } |
167 | 164 | ||
168 | /* | 165 | /* Get Granularity (Bytes 6-7) */ |
169 | * Get Granularity (Bytes 6-7) | 166 | |
170 | */ | ||
171 | buffer += 1; | 167 | buffer += 1; |
172 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); | 168 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); |
173 | 169 | ||
174 | /* | 170 | /* Get min_address_range (Bytes 8-9) */ |
175 | * Get min_address_range (Bytes 8-9) | 171 | |
176 | */ | ||
177 | buffer += 2; | 172 | buffer += 2; |
178 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); | 173 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); |
179 | 174 | ||
180 | /* | 175 | /* Get max_address_range (Bytes 10-11) */ |
181 | * Get max_address_range (Bytes 10-11) | 176 | |
182 | */ | ||
183 | buffer += 2; | 177 | buffer += 2; |
184 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); | 178 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); |
185 | 179 | ||
186 | /* | 180 | /* Get address_translation_offset (Bytes 12-13) */ |
187 | * Get address_translation_offset (Bytes 12-13) | 181 | |
188 | */ | ||
189 | buffer += 2; | 182 | buffer += 2; |
190 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer); | 183 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, |
184 | buffer); | ||
185 | |||
186 | /* Get address_length (Bytes 14-15) */ | ||
191 | 187 | ||
192 | /* | ||
193 | * Get address_length (Bytes 14-15) | ||
194 | */ | ||
195 | buffer += 2; | 188 | buffer += 2; |
196 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); | 189 | ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); |
197 | 190 | ||
198 | /* | 191 | /* Resource Source Index (if present) */ |
199 | * Resource Source Index (if present) | 192 | |
200 | */ | ||
201 | buffer += 2; | 193 | buffer += 2; |
202 | 194 | ||
203 | /* | 195 | /* |
@@ -225,7 +217,8 @@ acpi_rs_address16_resource ( | |||
225 | output_struct->data.address16.resource_source.string_ptr = | 217 | output_struct->data.address16.resource_source.string_ptr = |
226 | (char *)((u8 * )output_struct + struct_size); | 218 | (char *)((u8 * )output_struct + struct_size); |
227 | 219 | ||
228 | temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr; | 220 | temp_ptr = (u8 *) |
221 | output_struct->data.address16.resource_source.string_ptr; | ||
229 | 222 | ||
230 | /* Copy the string into the buffer */ | 223 | /* Copy the string into the buffer */ |
231 | 224 | ||
@@ -239,9 +232,8 @@ acpi_rs_address16_resource ( | |||
239 | index += 1; | 232 | index += 1; |
240 | } | 233 | } |
241 | 234 | ||
242 | /* | 235 | /* Add the terminating null */ |
243 | * Add the terminating null | 236 | |
244 | */ | ||
245 | *temp_ptr = 0x00; | 237 | *temp_ptr = 0x00; |
246 | 238 | ||
247 | output_struct->data.address16.resource_source.string_length = index + 1; | 239 | output_struct->data.address16.resource_source.string_length = index + 1; |
@@ -260,14 +252,12 @@ acpi_rs_address16_resource ( | |||
260 | output_struct->data.address16.resource_source.string_ptr = NULL; | 252 | output_struct->data.address16.resource_source.string_ptr = NULL; |
261 | } | 253 | } |
262 | 254 | ||
263 | /* | 255 | /* Set the Length parameter */ |
264 | * Set the Length parameter | 256 | |
265 | */ | ||
266 | output_struct->length = (u32) struct_size; | 257 | output_struct->length = (u32) struct_size; |
267 | 258 | ||
268 | /* | 259 | /* Return the final size of the structure */ |
269 | * Return the final size of the structure | 260 | |
270 | */ | ||
271 | *structure_size = struct_size; | 261 | *structure_size = struct_size; |
272 | return_ACPI_STATUS (AE_OK); | 262 | return_ACPI_STATUS (AE_OK); |
273 | } | 263 | } |
@@ -305,28 +295,24 @@ acpi_rs_address16_stream ( | |||
305 | ACPI_FUNCTION_TRACE ("rs_address16_stream"); | 295 | ACPI_FUNCTION_TRACE ("rs_address16_stream"); |
306 | 296 | ||
307 | 297 | ||
308 | /* | 298 | /* The descriptor field is static */ |
309 | * The descriptor field is static | 299 | |
310 | */ | ||
311 | *buffer = 0x88; | 300 | *buffer = 0x88; |
312 | buffer += 1; | 301 | buffer += 1; |
313 | 302 | ||
314 | /* | 303 | /* Save a pointer to the Length field - to be filled in later */ |
315 | * Save a pointer to the Length field - to be filled in later | 304 | |
316 | */ | ||
317 | length_field = buffer; | 305 | length_field = buffer; |
318 | buffer += 2; | 306 | buffer += 2; |
319 | 307 | ||
320 | /* | 308 | /* Set the Resource Type (Memory, Io, bus_number) */ |
321 | * Set the Resource Type (Memory, Io, bus_number) | 309 | |
322 | */ | ||
323 | temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); | 310 | temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); |
324 | *buffer = temp8; | 311 | *buffer = temp8; |
325 | buffer += 1; | 312 | buffer += 1; |
326 | 313 | ||
327 | /* | 314 | /* Set the general flags */ |
328 | * Set the general flags | 315 | |
329 | */ | ||
330 | temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); | 316 | temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); |
331 | 317 | ||
332 | temp8 |= (linked_list->data.address16.decode & 0x01) << 1; | 318 | temp8 |= (linked_list->data.address16.decode & 0x01) << 1; |
@@ -336,9 +322,8 @@ acpi_rs_address16_stream ( | |||
336 | *buffer = temp8; | 322 | *buffer = temp8; |
337 | buffer += 1; | 323 | buffer += 1; |
338 | 324 | ||
339 | /* | 325 | /* Set the type specific flags */ |
340 | * Set the type specific flags | 326 | |
341 | */ | ||
342 | temp8 = 0; | 327 | temp8 = 0; |
343 | 328 | ||
344 | if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { | 329 | if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { |
@@ -362,39 +347,34 @@ acpi_rs_address16_stream ( | |||
362 | *buffer = temp8; | 347 | *buffer = temp8; |
363 | buffer += 1; | 348 | buffer += 1; |
364 | 349 | ||
365 | /* | 350 | /* Set the address space granularity */ |
366 | * Set the address space granularity | 351 | |
367 | */ | ||
368 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); | 352 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); |
369 | buffer += 2; | 353 | buffer += 2; |
370 | 354 | ||
371 | /* | 355 | /* Set the address range minimum */ |
372 | * Set the address range minimum | 356 | |
373 | */ | ||
374 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); | 357 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); |
375 | buffer += 2; | 358 | buffer += 2; |
376 | 359 | ||
377 | /* | 360 | /* Set the address range maximum */ |
378 | * Set the address range maximum | 361 | |
379 | */ | ||
380 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); | 362 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); |
381 | buffer += 2; | 363 | buffer += 2; |
382 | 364 | ||
383 | /* | 365 | /* Set the address translation offset */ |
384 | * Set the address translation offset | 366 | |
385 | */ | 367 | ACPI_MOVE_32_TO_16 (buffer, |
386 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset); | 368 | &linked_list->data.address16.address_translation_offset); |
387 | buffer += 2; | 369 | buffer += 2; |
388 | 370 | ||
389 | /* | 371 | /* Set the address length */ |
390 | * Set the address length | 372 | |
391 | */ | ||
392 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); | 373 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); |
393 | buffer += 2; | 374 | buffer += 2; |
394 | 375 | ||
395 | /* | 376 | /* Resource Source Index and Resource Source are optional */ |
396 | * Resource Source Index and Resource Source are optional | 377 | |
397 | */ | ||
398 | if (0 != linked_list->data.address16.resource_source.string_length) { | 378 | if (0 != linked_list->data.address16.resource_source.string_length) { |
399 | temp8 = (u8) linked_list->data.address16.resource_source.index; | 379 | temp8 = (u8) linked_list->data.address16.resource_source.index; |
400 | 380 | ||
@@ -403,9 +383,8 @@ acpi_rs_address16_stream ( | |||
403 | 383 | ||
404 | temp_pointer = (char *) buffer; | 384 | temp_pointer = (char *) buffer; |
405 | 385 | ||
406 | /* | 386 | /* Copy the string */ |
407 | * Copy the string | 387 | |
408 | */ | ||
409 | ACPI_STRCPY (temp_pointer, | 388 | ACPI_STRCPY (temp_pointer, |
410 | linked_list->data.address16.resource_source.string_ptr); | 389 | linked_list->data.address16.resource_source.string_ptr); |
411 | 390 | ||
@@ -413,12 +392,12 @@ acpi_rs_address16_stream ( | |||
413 | * Buffer needs to be set to the length of the sting + one for the | 392 | * Buffer needs to be set to the length of the sting + one for the |
414 | * terminating null | 393 | * terminating null |
415 | */ | 394 | */ |
416 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1); | 395 | buffer += (acpi_size)(ACPI_STRLEN ( |
396 | linked_list->data.address16.resource_source.string_ptr) + 1); | ||
417 | } | 397 | } |
418 | 398 | ||
419 | /* | 399 | /* Return the number of bytes consumed in this operation */ |
420 | * Return the number of bytes consumed in this operation | 400 | |
421 | */ | ||
422 | actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); | 401 | actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); |
423 | *bytes_consumed = actual_bytes; | 402 | *bytes_consumed = actual_bytes; |
424 | 403 | ||
@@ -475,9 +454,8 @@ acpi_rs_address32_resource ( | |||
475 | buffer = byte_stream_buffer; | 454 | buffer = byte_stream_buffer; |
476 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); | 455 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); |
477 | 456 | ||
478 | /* | 457 | /* Point past the Descriptor to get the number of bytes consumed */ |
479 | * Point past the Descriptor to get the number of bytes consumed | 458 | |
480 | */ | ||
481 | buffer += 1; | 459 | buffer += 1; |
482 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 460 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
483 | 461 | ||
@@ -490,9 +468,8 @@ acpi_rs_address32_resource ( | |||
490 | *bytes_consumed = temp16 + 3; | 468 | *bytes_consumed = temp16 + 3; |
491 | output_struct->id = ACPI_RSTYPE_ADDRESS32; | 469 | output_struct->id = ACPI_RSTYPE_ADDRESS32; |
492 | 470 | ||
493 | /* | 471 | /* Get the Resource Type (Byte3) */ |
494 | * Get the Resource Type (Byte3) | 472 | |
495 | */ | ||
496 | buffer += 2; | 473 | buffer += 2; |
497 | temp8 = *buffer; | 474 | temp8 = *buffer; |
498 | 475 | ||
@@ -504,35 +481,29 @@ acpi_rs_address32_resource ( | |||
504 | 481 | ||
505 | output_struct->data.address32.resource_type = temp8; | 482 | output_struct->data.address32.resource_type = temp8; |
506 | 483 | ||
507 | /* | 484 | /* Get the General Flags (Byte4) */ |
508 | * Get the General Flags (Byte4) | 485 | |
509 | */ | ||
510 | buffer += 1; | 486 | buffer += 1; |
511 | temp8 = *buffer; | 487 | temp8 = *buffer; |
512 | 488 | ||
513 | /* | 489 | /* Producer / Consumer */ |
514 | * Producer / Consumer | 490 | |
515 | */ | ||
516 | output_struct->data.address32.producer_consumer = temp8 & 0x01; | 491 | output_struct->data.address32.producer_consumer = temp8 & 0x01; |
517 | 492 | ||
518 | /* | 493 | /* Decode */ |
519 | * Decode | 494 | |
520 | */ | ||
521 | output_struct->data.address32.decode = (temp8 >> 1) & 0x01; | 495 | output_struct->data.address32.decode = (temp8 >> 1) & 0x01; |
522 | 496 | ||
523 | /* | 497 | /* Min Address Fixed */ |
524 | * Min Address Fixed | 498 | |
525 | */ | ||
526 | output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; | 499 | output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; |
527 | 500 | ||
528 | /* | 501 | /* Max Address Fixed */ |
529 | * Max Address Fixed | 502 | |
530 | */ | ||
531 | output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; | 503 | output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; |
532 | 504 | ||
533 | /* | 505 | /* Get the Type Specific Flags (Byte5) */ |
534 | * Get the Type Specific Flags (Byte5) | 506 | |
535 | */ | ||
536 | buffer += 1; | 507 | buffer += 1; |
537 | temp8 = *buffer; | 508 | temp8 = *buffer; |
538 | 509 | ||
@@ -556,39 +527,34 @@ acpi_rs_address32_resource ( | |||
556 | } | 527 | } |
557 | } | 528 | } |
558 | 529 | ||
559 | /* | 530 | /* Get Granularity (Bytes 6-9) */ |
560 | * Get Granularity (Bytes 6-9) | 531 | |
561 | */ | ||
562 | buffer += 1; | 532 | buffer += 1; |
563 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); | 533 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); |
564 | 534 | ||
565 | /* | 535 | /* Get min_address_range (Bytes 10-13) */ |
566 | * Get min_address_range (Bytes 10-13) | 536 | |
567 | */ | ||
568 | buffer += 4; | 537 | buffer += 4; |
569 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); | 538 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); |
570 | 539 | ||
571 | /* | 540 | /* Get max_address_range (Bytes 14-17) */ |
572 | * Get max_address_range (Bytes 14-17) | 541 | |
573 | */ | ||
574 | buffer += 4; | 542 | buffer += 4; |
575 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); | 543 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); |
576 | 544 | ||
577 | /* | 545 | /* Get address_translation_offset (Bytes 18-21) */ |
578 | * Get address_translation_offset (Bytes 18-21) | 546 | |
579 | */ | ||
580 | buffer += 4; | 547 | buffer += 4; |
581 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer); | 548 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, |
549 | buffer); | ||
550 | |||
551 | /* Get address_length (Bytes 22-25) */ | ||
582 | 552 | ||
583 | /* | ||
584 | * Get address_length (Bytes 22-25) | ||
585 | */ | ||
586 | buffer += 4; | 553 | buffer += 4; |
587 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); | 554 | ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); |
588 | 555 | ||
589 | /* | 556 | /* Resource Source Index (if present) */ |
590 | * Resource Source Index (if present) | 557 | |
591 | */ | ||
592 | buffer += 4; | 558 | buffer += 4; |
593 | 559 | ||
594 | /* | 560 | /* |
@@ -615,7 +581,8 @@ acpi_rs_address32_resource ( | |||
615 | output_struct->data.address32.resource_source.string_ptr = | 581 | output_struct->data.address32.resource_source.string_ptr = |
616 | (char *)((u8 *)output_struct + struct_size); | 582 | (char *)((u8 *)output_struct + struct_size); |
617 | 583 | ||
618 | temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr; | 584 | temp_ptr = (u8 *) |
585 | output_struct->data.address32.resource_source.string_ptr; | ||
619 | 586 | ||
620 | /* Copy the string into the buffer */ | 587 | /* Copy the string into the buffer */ |
621 | 588 | ||
@@ -628,9 +595,8 @@ acpi_rs_address32_resource ( | |||
628 | index += 1; | 595 | index += 1; |
629 | } | 596 | } |
630 | 597 | ||
631 | /* | 598 | /* Add the terminating null */ |
632 | * Add the terminating null | 599 | |
633 | */ | ||
634 | *temp_ptr = 0x00; | 600 | *temp_ptr = 0x00; |
635 | output_struct->data.address32.resource_source.string_length = index + 1; | 601 | output_struct->data.address32.resource_source.string_length = index + 1; |
636 | 602 | ||
@@ -648,14 +614,12 @@ acpi_rs_address32_resource ( | |||
648 | output_struct->data.address32.resource_source.string_ptr = NULL; | 614 | output_struct->data.address32.resource_source.string_ptr = NULL; |
649 | } | 615 | } |
650 | 616 | ||
651 | /* | 617 | /* Set the Length parameter */ |
652 | * Set the Length parameter | 618 | |
653 | */ | ||
654 | output_struct->length = (u32) struct_size; | 619 | output_struct->length = (u32) struct_size; |
655 | 620 | ||
656 | /* | 621 | /* Return the final size of the structure */ |
657 | * Return the final size of the structure | 622 | |
658 | */ | ||
659 | *structure_size = struct_size; | 623 | *structure_size = struct_size; |
660 | return_ACPI_STATUS (AE_OK); | 624 | return_ACPI_STATUS (AE_OK); |
661 | } | 625 | } |
@@ -694,29 +658,25 @@ acpi_rs_address32_stream ( | |||
694 | 658 | ||
695 | buffer = *output_buffer; | 659 | buffer = *output_buffer; |
696 | 660 | ||
697 | /* | 661 | /* The descriptor field is static */ |
698 | * The descriptor field is static | 662 | |
699 | */ | ||
700 | *buffer = 0x87; | 663 | *buffer = 0x87; |
701 | buffer += 1; | 664 | buffer += 1; |
702 | 665 | ||
703 | /* | 666 | /* Set a pointer to the Length field - to be filled in later */ |
704 | * Set a pointer to the Length field - to be filled in later | 667 | |
705 | */ | ||
706 | length_field = ACPI_CAST_PTR (u16, buffer); | 668 | length_field = ACPI_CAST_PTR (u16, buffer); |
707 | buffer += 2; | 669 | buffer += 2; |
708 | 670 | ||
709 | /* | 671 | /* Set the Resource Type (Memory, Io, bus_number) */ |
710 | * Set the Resource Type (Memory, Io, bus_number) | 672 | |
711 | */ | ||
712 | temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); | 673 | temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); |
713 | 674 | ||
714 | *buffer = temp8; | 675 | *buffer = temp8; |
715 | buffer += 1; | 676 | buffer += 1; |
716 | 677 | ||
717 | /* | 678 | /* Set the general flags */ |
718 | * Set the general flags | 679 | |
719 | */ | ||
720 | temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); | 680 | temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); |
721 | temp8 |= (linked_list->data.address32.decode & 0x01) << 1; | 681 | temp8 |= (linked_list->data.address32.decode & 0x01) << 1; |
722 | temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; | 682 | temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; |
@@ -725,9 +685,8 @@ acpi_rs_address32_stream ( | |||
725 | *buffer = temp8; | 685 | *buffer = temp8; |
726 | buffer += 1; | 686 | buffer += 1; |
727 | 687 | ||
728 | /* | 688 | /* Set the type specific flags */ |
729 | * Set the type specific flags | 689 | |
730 | */ | ||
731 | temp8 = 0; | 690 | temp8 = 0; |
732 | 691 | ||
733 | if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { | 692 | if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { |
@@ -751,39 +710,34 @@ acpi_rs_address32_stream ( | |||
751 | *buffer = temp8; | 710 | *buffer = temp8; |
752 | buffer += 1; | 711 | buffer += 1; |
753 | 712 | ||
754 | /* | 713 | /* Set the address space granularity */ |
755 | * Set the address space granularity | 714 | |
756 | */ | ||
757 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); | 715 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); |
758 | buffer += 4; | 716 | buffer += 4; |
759 | 717 | ||
760 | /* | 718 | /* Set the address range minimum */ |
761 | * Set the address range minimum | 719 | |
762 | */ | ||
763 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); | 720 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); |
764 | buffer += 4; | 721 | buffer += 4; |
765 | 722 | ||
766 | /* | 723 | /* Set the address range maximum */ |
767 | * Set the address range maximum | 724 | |
768 | */ | ||
769 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); | 725 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); |
770 | buffer += 4; | 726 | buffer += 4; |
771 | 727 | ||
772 | /* | 728 | /* Set the address translation offset */ |
773 | * Set the address translation offset | 729 | |
774 | */ | 730 | ACPI_MOVE_32_TO_32 (buffer, |
775 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset); | 731 | &linked_list->data.address32.address_translation_offset); |
776 | buffer += 4; | 732 | buffer += 4; |
777 | 733 | ||
778 | /* | 734 | /* Set the address length */ |
779 | * Set the address length | 735 | |
780 | */ | ||
781 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); | 736 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); |
782 | buffer += 4; | 737 | buffer += 4; |
783 | 738 | ||
784 | /* | 739 | /* Resource Source Index and Resource Source are optional */ |
785 | * Resource Source Index and Resource Source are optional | 740 | |
786 | */ | ||
787 | if (0 != linked_list->data.address32.resource_source.string_length) { | 741 | if (0 != linked_list->data.address32.resource_source.string_length) { |
788 | temp8 = (u8) linked_list->data.address32.resource_source.index; | 742 | temp8 = (u8) linked_list->data.address32.resource_source.index; |
789 | 743 | ||
@@ -792,9 +746,8 @@ acpi_rs_address32_stream ( | |||
792 | 746 | ||
793 | temp_pointer = (char *) buffer; | 747 | temp_pointer = (char *) buffer; |
794 | 748 | ||
795 | /* | 749 | /* Copy the string */ |
796 | * Copy the string | 750 | |
797 | */ | ||
798 | ACPI_STRCPY (temp_pointer, | 751 | ACPI_STRCPY (temp_pointer, |
799 | linked_list->data.address32.resource_source.string_ptr); | 752 | linked_list->data.address32.resource_source.string_ptr); |
800 | 753 | ||
@@ -802,12 +755,12 @@ acpi_rs_address32_stream ( | |||
802 | * Buffer needs to be set to the length of the sting + one for the | 755 | * Buffer needs to be set to the length of the sting + one for the |
803 | * terminating null | 756 | * terminating null |
804 | */ | 757 | */ |
805 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1); | 758 | buffer += (acpi_size)(ACPI_STRLEN ( |
759 | linked_list->data.address32.resource_source.string_ptr) + 1); | ||
806 | } | 760 | } |
807 | 761 | ||
808 | /* | 762 | /* Return the number of bytes consumed in this operation */ |
809 | * Return the number of bytes consumed in this operation | 763 | |
810 | */ | ||
811 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 764 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
812 | 765 | ||
813 | /* | 766 | /* |
@@ -864,9 +817,8 @@ acpi_rs_address64_resource ( | |||
864 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); | 817 | struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); |
865 | resource_type = *buffer; | 818 | resource_type = *buffer; |
866 | 819 | ||
867 | /* | 820 | /* Point past the Descriptor to get the number of bytes consumed */ |
868 | * Point past the Descriptor to get the number of bytes consumed | 821 | |
869 | */ | ||
870 | buffer += 1; | 822 | buffer += 1; |
871 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 823 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
872 | 824 | ||
@@ -879,9 +831,8 @@ acpi_rs_address64_resource ( | |||
879 | *bytes_consumed = temp16 + 3; | 831 | *bytes_consumed = temp16 + 3; |
880 | output_struct->id = ACPI_RSTYPE_ADDRESS64; | 832 | output_struct->id = ACPI_RSTYPE_ADDRESS64; |
881 | 833 | ||
882 | /* | 834 | /* Get the Resource Type (Byte3) */ |
883 | * Get the Resource Type (Byte3) | 835 | |
884 | */ | ||
885 | buffer += 2; | 836 | buffer += 2; |
886 | temp8 = *buffer; | 837 | temp8 = *buffer; |
887 | 838 | ||
@@ -893,35 +844,29 @@ acpi_rs_address64_resource ( | |||
893 | 844 | ||
894 | output_struct->data.address64.resource_type = temp8; | 845 | output_struct->data.address64.resource_type = temp8; |
895 | 846 | ||
896 | /* | 847 | /* Get the General Flags (Byte4) */ |
897 | * Get the General Flags (Byte4) | 848 | |
898 | */ | ||
899 | buffer += 1; | 849 | buffer += 1; |
900 | temp8 = *buffer; | 850 | temp8 = *buffer; |
901 | 851 | ||
902 | /* | 852 | /* Producer / Consumer */ |
903 | * Producer / Consumer | 853 | |
904 | */ | ||
905 | output_struct->data.address64.producer_consumer = temp8 & 0x01; | 854 | output_struct->data.address64.producer_consumer = temp8 & 0x01; |
906 | 855 | ||
907 | /* | 856 | /* Decode */ |
908 | * Decode | 857 | |
909 | */ | ||
910 | output_struct->data.address64.decode = (temp8 >> 1) & 0x01; | 858 | output_struct->data.address64.decode = (temp8 >> 1) & 0x01; |
911 | 859 | ||
912 | /* | 860 | /* Min Address Fixed */ |
913 | * Min Address Fixed | 861 | |
914 | */ | ||
915 | output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; | 862 | output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; |
916 | 863 | ||
917 | /* | 864 | /* Max Address Fixed */ |
918 | * Max Address Fixed | 865 | |
919 | */ | ||
920 | output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; | 866 | output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; |
921 | 867 | ||
922 | /* | 868 | /* Get the Type Specific Flags (Byte5) */ |
923 | * Get the Type Specific Flags (Byte5) | 869 | |
924 | */ | ||
925 | buffer += 1; | 870 | buffer += 1; |
926 | temp8 = *buffer; | 871 | temp8 = *buffer; |
927 | 872 | ||
@@ -951,33 +896,29 @@ acpi_rs_address64_resource ( | |||
951 | buffer += 2; | 896 | buffer += 2; |
952 | } | 897 | } |
953 | 898 | ||
954 | /* | 899 | /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ |
955 | * Get Granularity (Bytes 6-13) or (Bytes 8-15) | 900 | |
956 | */ | ||
957 | buffer += 1; | 901 | buffer += 1; |
958 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); | 902 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); |
959 | 903 | ||
960 | /* | 904 | /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ |
961 | * Get min_address_range (Bytes 14-21) or (Bytes 16-23) | 905 | |
962 | */ | ||
963 | buffer += 8; | 906 | buffer += 8; |
964 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); | 907 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); |
965 | 908 | ||
966 | /* | 909 | /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ |
967 | * Get max_address_range (Bytes 22-29) or (Bytes 24-31) | 910 | |
968 | */ | ||
969 | buffer += 8; | 911 | buffer += 8; |
970 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); | 912 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); |
971 | 913 | ||
972 | /* | 914 | /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ |
973 | * Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) | 915 | |
974 | */ | ||
975 | buffer += 8; | 916 | buffer += 8; |
976 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer); | 917 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, |
918 | buffer); | ||
919 | |||
920 | /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ | ||
977 | 921 | ||
978 | /* | ||
979 | * Get address_length (Bytes 38-45) or (Bytes 40-47) | ||
980 | */ | ||
981 | buffer += 8; | 922 | buffer += 8; |
982 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); | 923 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); |
983 | 924 | ||
@@ -989,14 +930,15 @@ acpi_rs_address64_resource ( | |||
989 | /* Get type_specific_attribute (Bytes 48-55) */ | 930 | /* Get type_specific_attribute (Bytes 48-55) */ |
990 | 931 | ||
991 | buffer += 8; | 932 | buffer += 8; |
992 | ACPI_MOVE_64_TO_64 (&output_struct->data.address64.type_specific_attributes, buffer); | 933 | ACPI_MOVE_64_TO_64 ( |
934 | &output_struct->data.address64.type_specific_attributes, | ||
935 | buffer); | ||
993 | } | 936 | } |
994 | else { | 937 | else { |
995 | output_struct->data.address64.type_specific_attributes = 0; | 938 | output_struct->data.address64.type_specific_attributes = 0; |
996 | 939 | ||
997 | /* | 940 | /* Resource Source Index (if present) */ |
998 | * Resource Source Index (if present) | 941 | |
999 | */ | ||
1000 | buffer += 8; | 942 | buffer += 8; |
1001 | 943 | ||
1002 | /* | 944 | /* |
@@ -1025,7 +967,8 @@ acpi_rs_address64_resource ( | |||
1025 | output_struct->data.address64.resource_source.string_ptr = | 967 | output_struct->data.address64.resource_source.string_ptr = |
1026 | (char *)((u8 *)output_struct + struct_size); | 968 | (char *)((u8 *)output_struct + struct_size); |
1027 | 969 | ||
1028 | temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr; | 970 | temp_ptr = (u8 *) |
971 | output_struct->data.address64.resource_source.string_ptr; | ||
1029 | 972 | ||
1030 | /* Copy the string into the buffer */ | 973 | /* Copy the string into the buffer */ |
1031 | 974 | ||
@@ -1042,7 +985,8 @@ acpi_rs_address64_resource ( | |||
1042 | * Add the terminating null | 985 | * Add the terminating null |
1043 | */ | 986 | */ |
1044 | *temp_ptr = 0x00; | 987 | *temp_ptr = 0x00; |
1045 | output_struct->data.address64.resource_source.string_length = index + 1; | 988 | output_struct->data.address64.resource_source.string_length = |
989 | index + 1; | ||
1046 | 990 | ||
1047 | /* | 991 | /* |
1048 | * In order for the struct_size to fall on a 32-bit boundary, | 992 | * In order for the struct_size to fall on a 32-bit boundary, |
@@ -1054,14 +998,12 @@ acpi_rs_address64_resource ( | |||
1054 | } | 998 | } |
1055 | } | 999 | } |
1056 | 1000 | ||
1057 | /* | 1001 | /* Set the Length parameter */ |
1058 | * Set the Length parameter | 1002 | |
1059 | */ | ||
1060 | output_struct->length = (u32) struct_size; | 1003 | output_struct->length = (u32) struct_size; |
1061 | 1004 | ||
1062 | /* | 1005 | /* Return the final size of the structure */ |
1063 | * Return the final size of the structure | 1006 | |
1064 | */ | ||
1065 | *structure_size = struct_size; | 1007 | *structure_size = struct_size; |
1066 | return_ACPI_STATUS (AE_OK); | 1008 | return_ACPI_STATUS (AE_OK); |
1067 | } | 1009 | } |
@@ -1100,29 +1042,25 @@ acpi_rs_address64_stream ( | |||
1100 | 1042 | ||
1101 | buffer = *output_buffer; | 1043 | buffer = *output_buffer; |
1102 | 1044 | ||
1103 | /* | 1045 | /* The descriptor field is static */ |
1104 | * The descriptor field is static | 1046 | |
1105 | */ | ||
1106 | *buffer = 0x8A; | 1047 | *buffer = 0x8A; |
1107 | buffer += 1; | 1048 | buffer += 1; |
1108 | 1049 | ||
1109 | /* | 1050 | /* Set a pointer to the Length field - to be filled in later */ |
1110 | * Set a pointer to the Length field - to be filled in later | 1051 | |
1111 | */ | ||
1112 | length_field = ACPI_CAST_PTR (u16, buffer); | 1052 | length_field = ACPI_CAST_PTR (u16, buffer); |
1113 | buffer += 2; | 1053 | buffer += 2; |
1114 | 1054 | ||
1115 | /* | 1055 | /* Set the Resource Type (Memory, Io, bus_number) */ |
1116 | * Set the Resource Type (Memory, Io, bus_number) | 1056 | |
1117 | */ | ||
1118 | temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); | 1057 | temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); |
1119 | 1058 | ||
1120 | *buffer = temp8; | 1059 | *buffer = temp8; |
1121 | buffer += 1; | 1060 | buffer += 1; |
1122 | 1061 | ||
1123 | /* | 1062 | /* Set the general flags */ |
1124 | * Set the general flags | 1063 | |
1125 | */ | ||
1126 | temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); | 1064 | temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); |
1127 | temp8 |= (linked_list->data.address64.decode & 0x01) << 1; | 1065 | temp8 |= (linked_list->data.address64.decode & 0x01) << 1; |
1128 | temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; | 1066 | temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; |
@@ -1131,9 +1069,8 @@ acpi_rs_address64_stream ( | |||
1131 | *buffer = temp8; | 1069 | *buffer = temp8; |
1132 | buffer += 1; | 1070 | buffer += 1; |
1133 | 1071 | ||
1134 | /* | 1072 | /* Set the type specific flags */ |
1135 | * Set the type specific flags | 1073 | |
1136 | */ | ||
1137 | temp8 = 0; | 1074 | temp8 = 0; |
1138 | 1075 | ||
1139 | if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { | 1076 | if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { |
@@ -1157,39 +1094,34 @@ acpi_rs_address64_stream ( | |||
1157 | *buffer = temp8; | 1094 | *buffer = temp8; |
1158 | buffer += 1; | 1095 | buffer += 1; |
1159 | 1096 | ||
1160 | /* | 1097 | /* Set the address space granularity */ |
1161 | * Set the address space granularity | 1098 | |
1162 | */ | ||
1163 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); | 1099 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); |
1164 | buffer += 8; | 1100 | buffer += 8; |
1165 | 1101 | ||
1166 | /* | 1102 | /* Set the address range minimum */ |
1167 | * Set the address range minimum | 1103 | |
1168 | */ | ||
1169 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); | 1104 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); |
1170 | buffer += 8; | 1105 | buffer += 8; |
1171 | 1106 | ||
1172 | /* | 1107 | /* Set the address range maximum */ |
1173 | * Set the address range maximum | 1108 | |
1174 | */ | ||
1175 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); | 1109 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); |
1176 | buffer += 8; | 1110 | buffer += 8; |
1177 | 1111 | ||
1178 | /* | 1112 | /* Set the address translation offset */ |
1179 | * Set the address translation offset | 1113 | |
1180 | */ | 1114 | ACPI_MOVE_64_TO_64 (buffer, |
1181 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset); | 1115 | &linked_list->data.address64.address_translation_offset); |
1182 | buffer += 8; | 1116 | buffer += 8; |
1183 | 1117 | ||
1184 | /* | 1118 | /* Set the address length */ |
1185 | * Set the address length | 1119 | |
1186 | */ | ||
1187 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); | 1120 | ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); |
1188 | buffer += 8; | 1121 | buffer += 8; |
1189 | 1122 | ||
1190 | /* | 1123 | /* Resource Source Index and Resource Source are optional */ |
1191 | * Resource Source Index and Resource Source are optional | 1124 | |
1192 | */ | ||
1193 | if (0 != linked_list->data.address64.resource_source.string_length) { | 1125 | if (0 != linked_list->data.address64.resource_source.string_length) { |
1194 | temp8 = (u8) linked_list->data.address64.resource_source.index; | 1126 | temp8 = (u8) linked_list->data.address64.resource_source.index; |
1195 | 1127 | ||
@@ -1198,21 +1130,21 @@ acpi_rs_address64_stream ( | |||
1198 | 1130 | ||
1199 | temp_pointer = (char *) buffer; | 1131 | temp_pointer = (char *) buffer; |
1200 | 1132 | ||
1201 | /* | 1133 | /* Copy the string */ |
1202 | * Copy the string | 1134 | |
1203 | */ | 1135 | ACPI_STRCPY (temp_pointer, |
1204 | ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr); | 1136 | linked_list->data.address64.resource_source.string_ptr); |
1205 | 1137 | ||
1206 | /* | 1138 | /* |
1207 | * Buffer needs to be set to the length of the sting + one for the | 1139 | * Buffer needs to be set to the length of the sting + one for the |
1208 | * terminating null | 1140 | * terminating null |
1209 | */ | 1141 | */ |
1210 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1); | 1142 | buffer += (acpi_size)(ACPI_STRLEN ( |
1143 | linked_list->data.address64.resource_source.string_ptr) + 1); | ||
1211 | } | 1144 | } |
1212 | 1145 | ||
1213 | /* | 1146 | /* Return the number of bytes consumed in this operation */ |
1214 | * Return the number of bytes consumed in this operation | 1147 | |
1215 | */ | ||
1216 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 1148 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
1217 | 1149 | ||
1218 | /* | 1150 | /* |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 8a5f0a52371d..98176f2fcb5d 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -81,9 +81,8 @@ acpi_rs_get_byte_stream_length ( | |||
81 | 81 | ||
82 | 82 | ||
83 | while (!done) { | 83 | while (!done) { |
84 | /* | 84 | /* Init the variable that will hold the size to add to the total. */ |
85 | * Init the variable that will hold the size to add to the total. | 85 | |
86 | */ | ||
87 | segment_size = 0; | 86 | segment_size = 0; |
88 | 87 | ||
89 | switch (linked_list->id) { | 88 | switch (linked_list->id) { |
@@ -196,7 +195,8 @@ acpi_rs_get_byte_stream_length ( | |||
196 | segment_size = 16; | 195 | segment_size = 16; |
197 | 196 | ||
198 | if (linked_list->data.address16.resource_source.string_ptr) { | 197 | if (linked_list->data.address16.resource_source.string_ptr) { |
199 | segment_size += linked_list->data.address16.resource_source.string_length; | 198 | segment_size += |
199 | linked_list->data.address16.resource_source.string_length; | ||
200 | segment_size++; | 200 | segment_size++; |
201 | } | 201 | } |
202 | break; | 202 | break; |
@@ -212,7 +212,8 @@ acpi_rs_get_byte_stream_length ( | |||
212 | segment_size = 26; | 212 | segment_size = 26; |
213 | 213 | ||
214 | if (linked_list->data.address32.resource_source.string_ptr) { | 214 | if (linked_list->data.address32.resource_source.string_ptr) { |
215 | segment_size += linked_list->data.address32.resource_source.string_length; | 215 | segment_size += |
216 | linked_list->data.address32.resource_source.string_length; | ||
216 | segment_size++; | 217 | segment_size++; |
217 | } | 218 | } |
218 | break; | 219 | break; |
@@ -227,7 +228,8 @@ acpi_rs_get_byte_stream_length ( | |||
227 | segment_size = 46; | 228 | segment_size = 46; |
228 | 229 | ||
229 | if (linked_list->data.address64.resource_source.string_ptr) { | 230 | if (linked_list->data.address64.resource_source.string_ptr) { |
230 | segment_size += linked_list->data.address64.resource_source.string_length; | 231 | segment_size += |
232 | linked_list->data.address64.resource_source.string_length; | ||
231 | segment_size++; | 233 | segment_size++; |
232 | } | 234 | } |
233 | break; | 235 | break; |
@@ -241,38 +243,36 @@ acpi_rs_get_byte_stream_length ( | |||
241 | * Index + the length of the null terminated string | 243 | * Index + the length of the null terminated string |
242 | * Resource Source + 1 for the null. | 244 | * Resource Source + 1 for the null. |
243 | */ | 245 | */ |
244 | segment_size = 9 + | 246 | segment_size = 9 + (((acpi_size) |
245 | (((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4); | 247 | linked_list->data.extended_irq.number_of_interrupts - 1) * 4); |
246 | 248 | ||
247 | if (linked_list->data.extended_irq.resource_source.string_ptr) { | 249 | if (linked_list->data.extended_irq.resource_source.string_ptr) { |
248 | segment_size += linked_list->data.extended_irq.resource_source.string_length; | 250 | segment_size += |
251 | linked_list->data.extended_irq.resource_source.string_length; | ||
249 | segment_size++; | 252 | segment_size++; |
250 | } | 253 | } |
251 | break; | 254 | break; |
252 | 255 | ||
253 | default: | 256 | default: |
254 | /* | 257 | |
255 | * If we get here, everything is out of sync, exit with error | 258 | /* If we get here, everything is out of sync, exit with error */ |
256 | */ | 259 | |
257 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); | 260 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); |
258 | 261 | ||
259 | } /* switch (linked_list->Id) */ | 262 | } /* switch (linked_list->Id) */ |
260 | 263 | ||
261 | /* | 264 | /* Update the total */ |
262 | * Update the total | 265 | |
263 | */ | ||
264 | byte_stream_size_needed += segment_size; | 266 | byte_stream_size_needed += segment_size; |
265 | 267 | ||
266 | /* | 268 | /* Point to the next object */ |
267 | * Point to the next object | 269 | |
268 | */ | ||
269 | linked_list = ACPI_PTR_ADD (struct acpi_resource, | 270 | linked_list = ACPI_PTR_ADD (struct acpi_resource, |
270 | linked_list, linked_list->length); | 271 | linked_list, linked_list->length); |
271 | } | 272 | } |
272 | 273 | ||
273 | /* | 274 | /* This is the data the caller needs */ |
274 | * This is the data the caller needs | 275 | |
275 | */ | ||
276 | *size_needed = byte_stream_size_needed; | 276 | *size_needed = byte_stream_size_needed; |
277 | return_ACPI_STATUS (AE_OK); | 277 | return_ACPI_STATUS (AE_OK); |
278 | } | 278 | } |
@@ -320,9 +320,8 @@ acpi_rs_get_list_length ( | |||
320 | 320 | ||
321 | 321 | ||
322 | while (bytes_parsed < byte_stream_buffer_length) { | 322 | while (bytes_parsed < byte_stream_buffer_length) { |
323 | /* | 323 | /* The next byte in the stream is the resource type */ |
324 | * The next byte in the stream is the resource type | 324 | |
325 | */ | ||
326 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); | 325 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); |
327 | 326 | ||
328 | switch (resource_type) { | 327 | switch (resource_type) { |
@@ -346,9 +345,8 @@ acpi_rs_get_list_length ( | |||
346 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 345 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
347 | bytes_consumed = temp16 + 3; | 346 | bytes_consumed = temp16 + 3; |
348 | 347 | ||
349 | /* | 348 | /* Ensure a 32-bit boundary for the structure */ |
350 | * Ensure a 32-bit boundary for the structure | 349 | |
351 | */ | ||
352 | temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); | 350 | temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); |
353 | 351 | ||
354 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + | 352 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + |
@@ -416,9 +414,8 @@ acpi_rs_get_list_length ( | |||
416 | temp8 = 0; | 414 | temp8 = 0; |
417 | } | 415 | } |
418 | 416 | ||
419 | /* | 417 | /* Ensure a 64-bit boundary for the structure */ |
420 | * Ensure a 64-bit boundary for the structure | 418 | |
421 | */ | ||
422 | temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); | 419 | temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); |
423 | 420 | ||
424 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + | 421 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + |
@@ -452,9 +449,8 @@ acpi_rs_get_list_length ( | |||
452 | temp8 = 0; | 449 | temp8 = 0; |
453 | } | 450 | } |
454 | 451 | ||
455 | /* | 452 | /* Ensure a 32-bit boundary for the structure */ |
456 | * Ensure a 32-bit boundary for the structure | 453 | |
457 | */ | ||
458 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 454 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
459 | 455 | ||
460 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + | 456 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + |
@@ -488,9 +484,8 @@ acpi_rs_get_list_length ( | |||
488 | temp8 = 0; | 484 | temp8 = 0; |
489 | } | 485 | } |
490 | 486 | ||
491 | /* | 487 | /* Ensure a 32-bit boundary for the structure */ |
492 | * Ensure a 32-bit boundary for the structure | 488 | |
493 | */ | ||
494 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 489 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
495 | 490 | ||
496 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + | 491 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + |
@@ -537,9 +532,8 @@ acpi_rs_get_list_length ( | |||
537 | temp8 = 0; | 532 | temp8 = 0; |
538 | } | 533 | } |
539 | 534 | ||
540 | /* | 535 | /* Ensure a 32-bit boundary for the structure */ |
541 | * Ensure a 32-bit boundary for the structure | 536 | |
542 | */ | ||
543 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 537 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
544 | 538 | ||
545 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + | 539 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + |
@@ -567,9 +561,8 @@ acpi_rs_get_list_length ( | |||
567 | 561 | ||
568 | ++buffer; | 562 | ++buffer; |
569 | 563 | ||
570 | /* | 564 | /* Look at the number of bits set */ |
571 | * Look at the number of bits set | 565 | |
572 | */ | ||
573 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 566 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
574 | 567 | ||
575 | for (index = 0; index < 16; index++) { | 568 | for (index = 0; index < 16; index++) { |
@@ -596,9 +589,8 @@ acpi_rs_get_list_length ( | |||
596 | 589 | ||
597 | ++buffer; | 590 | ++buffer; |
598 | 591 | ||
599 | /* | 592 | /* Look at the number of bits set */ |
600 | * Look at the number of bits set | 593 | |
601 | */ | ||
602 | temp8 = *buffer; | 594 | temp8 = *buffer; |
603 | 595 | ||
604 | for(index = 0; index < 8; index++) { | 596 | for(index = 0; index < 8; index++) { |
@@ -670,9 +662,8 @@ acpi_rs_get_list_length ( | |||
670 | temp8 = (u8) (temp8 & 0x7); | 662 | temp8 = (u8) (temp8 & 0x7); |
671 | bytes_consumed = temp8 + 1; | 663 | bytes_consumed = temp8 + 1; |
672 | 664 | ||
673 | /* | 665 | /* Ensure a 32-bit boundary for the structure */ |
674 | * Ensure a 32-bit boundary for the structure | 666 | |
675 | */ | ||
676 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); | 667 | temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); |
677 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + | 668 | structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + |
678 | (temp8 * sizeof (u8)); | 669 | (temp8 * sizeof (u8)); |
@@ -697,21 +688,18 @@ acpi_rs_get_list_length ( | |||
697 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); | 688 | return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); |
698 | } | 689 | } |
699 | 690 | ||
700 | /* | 691 | /* Update the return value and counter */ |
701 | * Update the return value and counter | 692 | |
702 | */ | ||
703 | buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); | 693 | buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); |
704 | bytes_parsed += bytes_consumed; | 694 | bytes_parsed += bytes_consumed; |
705 | 695 | ||
706 | /* | 696 | /* Set the byte stream to point to the next resource */ |
707 | * Set the byte stream to point to the next resource | 697 | |
708 | */ | ||
709 | byte_stream_buffer += bytes_consumed; | 698 | byte_stream_buffer += bytes_consumed; |
710 | } | 699 | } |
711 | 700 | ||
712 | /* | 701 | /* This is the data the caller needs */ |
713 | * This is the data the caller needs | 702 | |
714 | */ | ||
715 | *size_needed = buffer_size; | 703 | *size_needed = buffer_size; |
716 | return_ACPI_STATUS (AE_OK); | 704 | return_ACPI_STATUS (AE_OK); |
717 | } | 705 | } |
@@ -767,9 +755,8 @@ acpi_rs_get_pci_routing_table_length ( | |||
767 | top_object_list = package_object->package.elements; | 755 | top_object_list = package_object->package.elements; |
768 | 756 | ||
769 | for (index = 0; index < number_of_elements; index++) { | 757 | for (index = 0; index < number_of_elements; index++) { |
770 | /* | 758 | /* Dereference the sub-package */ |
771 | * Dereference the sub-package | 759 | |
772 | */ | ||
773 | package_element = *top_object_list; | 760 | package_element = *top_object_list; |
774 | 761 | ||
775 | /* | 762 | /* |
@@ -778,37 +765,40 @@ acpi_rs_get_pci_routing_table_length ( | |||
778 | */ | 765 | */ |
779 | sub_object_list = package_element->package.elements; | 766 | sub_object_list = package_element->package.elements; |
780 | 767 | ||
781 | /* | 768 | /* Scan the irq_table_elements for the Source Name String */ |
782 | * Scan the irq_table_elements for the Source Name String | 769 | |
783 | */ | ||
784 | name_found = FALSE; | 770 | name_found = FALSE; |
785 | 771 | ||
786 | for (table_index = 0; table_index < 4 && !name_found; table_index++) { | 772 | for (table_index = 0; table_index < 4 && !name_found; table_index++) { |
787 | if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) || | 773 | if ((ACPI_TYPE_STRING == |
788 | ((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) && | 774 | ACPI_GET_OBJECT_TYPE (*sub_object_list)) || |
789 | ((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) { | 775 | |
776 | ((ACPI_TYPE_LOCAL_REFERENCE == | ||
777 | ACPI_GET_OBJECT_TYPE (*sub_object_list)) && | ||
778 | |||
779 | ((*sub_object_list)->reference.opcode == | ||
780 | AML_INT_NAMEPATH_OP))) { | ||
790 | name_found = TRUE; | 781 | name_found = TRUE; |
791 | } | 782 | } |
792 | else { | 783 | else { |
793 | /* | 784 | /* Look at the next element */ |
794 | * Look at the next element | 785 | |
795 | */ | ||
796 | sub_object_list++; | 786 | sub_object_list++; |
797 | } | 787 | } |
798 | } | 788 | } |
799 | 789 | ||
800 | temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); | 790 | temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); |
801 | 791 | ||
802 | /* | 792 | /* Was a String type found? */ |
803 | * Was a String type found? | 793 | |
804 | */ | ||
805 | if (name_found) { | 794 | if (name_found) { |
806 | if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { | 795 | if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { |
807 | /* | 796 | /* |
808 | * The length String.Length field does not include the | 797 | * The length String.Length field does not include the |
809 | * terminating NULL, add 1 | 798 | * terminating NULL, add 1 |
810 | */ | 799 | */ |
811 | temp_size_needed += ((acpi_size) (*sub_object_list)->string.length + 1); | 800 | temp_size_needed += ((acpi_size) |
801 | (*sub_object_list)->string.length + 1); | ||
812 | } | 802 | } |
813 | else { | 803 | else { |
814 | temp_size_needed += acpi_ns_get_pathname_length ( | 804 | temp_size_needed += acpi_ns_get_pathname_length ( |
@@ -827,14 +817,14 @@ acpi_rs_get_pci_routing_table_length ( | |||
827 | 817 | ||
828 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); | 818 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); |
829 | 819 | ||
830 | /* | 820 | /* Point to the next union acpi_operand_object */ |
831 | * Point to the next union acpi_operand_object | 821 | |
832 | */ | ||
833 | top_object_list++; | 822 | top_object_list++; |
834 | } | 823 | } |
835 | 824 | ||
836 | /* | 825 | /* |
837 | * Adding an extra element to the end of the list, essentially a NULL terminator | 826 | * Adding an extra element to the end of the list, essentially a |
827 | * NULL terminator | ||
838 | */ | 828 | */ |
839 | *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); | 829 | *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); |
840 | return_ACPI_STATUS (AE_OK); | 830 | return_ACPI_STATUS (AE_OK); |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index a3a0cbfda68d..8e0eae0d50bb 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -87,9 +87,8 @@ acpi_rs_create_resource_list ( | |||
87 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", | 87 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", |
88 | byte_stream_buffer)); | 88 | byte_stream_buffer)); |
89 | 89 | ||
90 | /* | 90 | /* Params already validated, so we don't re-validate here */ |
91 | * Params already validated, so we don't re-validate here | 91 | |
92 | */ | ||
93 | byte_stream_buffer_length = byte_stream_buffer->buffer.length; | 92 | byte_stream_buffer_length = byte_stream_buffer->buffer.length; |
94 | byte_stream_start = byte_stream_buffer->buffer.pointer; | 93 | byte_stream_start = byte_stream_buffer->buffer.pointer; |
95 | 94 | ||
@@ -171,9 +170,8 @@ acpi_rs_create_pci_routing_table ( | |||
171 | 170 | ||
172 | /* Params already validated, so we don't re-validate here */ | 171 | /* Params already validated, so we don't re-validate here */ |
173 | 172 | ||
174 | /* | 173 | /* Get the required buffer length */ |
175 | * Get the required buffer length | 174 | |
176 | */ | ||
177 | status = acpi_rs_get_pci_routing_table_length (package_object, | 175 | status = acpi_rs_get_pci_routing_table_length (package_object, |
178 | &buffer_size_needed); | 176 | &buffer_size_needed); |
179 | if (ACPI_FAILURE (status)) { | 177 | if (ACPI_FAILURE (status)) { |
@@ -217,9 +215,8 @@ acpi_rs_create_pci_routing_table ( | |||
217 | */ | 215 | */ |
218 | user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); | 216 | user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); |
219 | 217 | ||
220 | /* | 218 | /* Each element of the top-level package must also be a package */ |
221 | * Each element of the top-level package must also be a package | 219 | |
222 | */ | ||
223 | if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { | 220 | if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { |
224 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 221 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
225 | "(PRT[%X]) Need sub-package, found %s\n", | 222 | "(PRT[%X]) Need sub-package, found %s\n", |
@@ -243,9 +240,8 @@ acpi_rs_create_pci_routing_table ( | |||
243 | */ | 240 | */ |
244 | sub_object_list = (*top_object_list)->package.elements; | 241 | sub_object_list = (*top_object_list)->package.elements; |
245 | 242 | ||
246 | /* | 243 | /* 1) First subobject: Dereference the PRT.Address */ |
247 | * 1) First subobject: Dereference the PRT.Address | 244 | |
248 | */ | ||
249 | obj_desc = sub_object_list[0]; | 245 | obj_desc = sub_object_list[0]; |
250 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 246 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { |
251 | user_prt->address = obj_desc->integer.value; | 247 | user_prt->address = obj_desc->integer.value; |
@@ -257,9 +253,8 @@ acpi_rs_create_pci_routing_table ( | |||
257 | return_ACPI_STATUS (AE_BAD_DATA); | 253 | return_ACPI_STATUS (AE_BAD_DATA); |
258 | } | 254 | } |
259 | 255 | ||
260 | /* | 256 | /* 2) Second subobject: Dereference the PRT.Pin */ |
261 | * 2) Second subobject: Dereference the PRT.Pin | 257 | |
262 | */ | ||
263 | obj_desc = sub_object_list[1]; | 258 | obj_desc = sub_object_list[1]; |
264 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 259 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { |
265 | user_prt->pin = (u32) obj_desc->integer.value; | 260 | user_prt->pin = (u32) obj_desc->integer.value; |
@@ -271,9 +266,8 @@ acpi_rs_create_pci_routing_table ( | |||
271 | return_ACPI_STATUS (AE_BAD_DATA); | 266 | return_ACPI_STATUS (AE_BAD_DATA); |
272 | } | 267 | } |
273 | 268 | ||
274 | /* | 269 | /* 3) Third subobject: Dereference the PRT.source_name */ |
275 | * 3) Third subobject: Dereference the PRT.source_name | 270 | |
276 | */ | ||
277 | obj_desc = sub_object_list[2]; | 271 | obj_desc = sub_object_list[2]; |
278 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 272 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { |
279 | case ACPI_TYPE_LOCAL_REFERENCE: | 273 | case ACPI_TYPE_LOCAL_REFERENCE: |
@@ -296,7 +290,9 @@ acpi_rs_create_pci_routing_table ( | |||
296 | 290 | ||
297 | status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); | 291 | status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); |
298 | 292 | ||
299 | user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */ | 293 | /* +1 to include null terminator */ |
294 | |||
295 | user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; | ||
300 | break; | 296 | break; |
301 | 297 | ||
302 | 298 | ||
@@ -304,8 +300,10 @@ acpi_rs_create_pci_routing_table ( | |||
304 | 300 | ||
305 | ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); | 301 | ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); |
306 | 302 | ||
307 | /* Add to the Length field the length of the string (add 1 for terminator) */ | 303 | /* |
308 | 304 | * Add to the Length field the length of the string | |
305 | * (add 1 for terminator) | ||
306 | */ | ||
309 | user_prt->length += obj_desc->string.length + 1; | 307 | user_prt->length += obj_desc->string.length + 1; |
310 | break; | 308 | break; |
311 | 309 | ||
@@ -333,9 +331,8 @@ acpi_rs_create_pci_routing_table ( | |||
333 | 331 | ||
334 | user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); | 332 | user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); |
335 | 333 | ||
336 | /* | 334 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
337 | * 4) Fourth subobject: Dereference the PRT.source_index | 335 | |
338 | */ | ||
339 | obj_desc = sub_object_list[3]; | 336 | obj_desc = sub_object_list[3]; |
340 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 337 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { |
341 | user_prt->source_index = (u32) obj_desc->integer.value; | 338 | user_prt->source_index = (u32) obj_desc->integer.value; |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index eef1b1f2c685..1935dab2ab51 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -48,9 +48,62 @@ | |||
48 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
49 | ACPI_MODULE_NAME ("rsdump") | 49 | ACPI_MODULE_NAME ("rsdump") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
51 | 52 | ||
52 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 53 | static void |
54 | acpi_rs_dump_irq ( | ||
55 | union acpi_resource_data *data); | ||
56 | |||
57 | static void | ||
58 | acpi_rs_dump_address16 ( | ||
59 | union acpi_resource_data *data); | ||
60 | |||
61 | static void | ||
62 | acpi_rs_dump_address32 ( | ||
63 | union acpi_resource_data *data); | ||
64 | |||
65 | static void | ||
66 | acpi_rs_dump_address64 ( | ||
67 | union acpi_resource_data *data); | ||
68 | |||
69 | static void | ||
70 | acpi_rs_dump_dma ( | ||
71 | union acpi_resource_data *data); | ||
72 | |||
73 | static void | ||
74 | acpi_rs_dump_io ( | ||
75 | union acpi_resource_data *data); | ||
76 | |||
77 | static void | ||
78 | acpi_rs_dump_extended_irq ( | ||
79 | union acpi_resource_data *data); | ||
53 | 80 | ||
81 | static void | ||
82 | acpi_rs_dump_fixed_io ( | ||
83 | union acpi_resource_data *data); | ||
84 | |||
85 | static void | ||
86 | acpi_rs_dump_fixed_memory32 ( | ||
87 | union acpi_resource_data *data); | ||
88 | |||
89 | static void | ||
90 | acpi_rs_dump_memory24 ( | ||
91 | union acpi_resource_data *data); | ||
92 | |||
93 | static void | ||
94 | acpi_rs_dump_memory32 ( | ||
95 | union acpi_resource_data *data); | ||
96 | |||
97 | static void | ||
98 | acpi_rs_dump_start_depend_fns ( | ||
99 | union acpi_resource_data *data); | ||
100 | |||
101 | static void | ||
102 | acpi_rs_dump_vendor_specific ( | ||
103 | union acpi_resource_data *data); | ||
104 | |||
105 | |||
106 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
54 | /******************************************************************************* | 107 | /******************************************************************************* |
55 | * | 108 | * |
56 | * FUNCTION: acpi_rs_dump_irq | 109 | * FUNCTION: acpi_rs_dump_irq |
@@ -63,7 +116,7 @@ | |||
63 | * | 116 | * |
64 | ******************************************************************************/ | 117 | ******************************************************************************/ |
65 | 118 | ||
66 | void | 119 | static void |
67 | acpi_rs_dump_irq ( | 120 | acpi_rs_dump_irq ( |
68 | union acpi_resource_data *data) | 121 | union acpi_resource_data *data) |
69 | { | 122 | { |
@@ -77,13 +130,13 @@ acpi_rs_dump_irq ( | |||
77 | acpi_os_printf ("IRQ Resource\n"); | 130 | acpi_os_printf ("IRQ Resource\n"); |
78 | 131 | ||
79 | acpi_os_printf (" %s Triggered\n", | 132 | acpi_os_printf (" %s Triggered\n", |
80 | ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); | 133 | ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); |
81 | 134 | ||
82 | acpi_os_printf (" Active %s\n", | 135 | acpi_os_printf (" Active %s\n", |
83 | ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); | 136 | ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); |
84 | 137 | ||
85 | acpi_os_printf (" %s\n", | 138 | acpi_os_printf (" %s\n", |
86 | ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); | 139 | ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); |
87 | 140 | ||
88 | acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); | 141 | acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); |
89 | 142 | ||
@@ -108,7 +161,7 @@ acpi_rs_dump_irq ( | |||
108 | * | 161 | * |
109 | ******************************************************************************/ | 162 | ******************************************************************************/ |
110 | 163 | ||
111 | void | 164 | static void |
112 | acpi_rs_dump_dma ( | 165 | acpi_rs_dump_dma ( |
113 | union acpi_resource_data *data) | 166 | union acpi_resource_data *data) |
114 | { | 167 | { |
@@ -144,7 +197,7 @@ acpi_rs_dump_dma ( | |||
144 | } | 197 | } |
145 | 198 | ||
146 | acpi_os_printf (" %sBus Master\n", | 199 | acpi_os_printf (" %sBus Master\n", |
147 | ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); | 200 | ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); |
148 | 201 | ||
149 | 202 | ||
150 | switch (dma_data->transfer) { | 203 | switch (dma_data->transfer) { |
@@ -165,7 +218,8 @@ acpi_rs_dump_dma ( | |||
165 | break; | 218 | break; |
166 | } | 219 | } |
167 | 220 | ||
168 | acpi_os_printf (" Number of Channels: %X ( ", dma_data->number_of_channels); | 221 | acpi_os_printf (" Number of Channels: %X ( ", |
222 | dma_data->number_of_channels); | ||
169 | 223 | ||
170 | for (index = 0; index < dma_data->number_of_channels; index++) { | 224 | for (index = 0; index < dma_data->number_of_channels; index++) { |
171 | acpi_os_printf ("%X ", dma_data->channels[index]); | 225 | acpi_os_printf ("%X ", dma_data->channels[index]); |
@@ -188,7 +242,7 @@ acpi_rs_dump_dma ( | |||
188 | * | 242 | * |
189 | ******************************************************************************/ | 243 | ******************************************************************************/ |
190 | 244 | ||
191 | void | 245 | static void |
192 | acpi_rs_dump_start_depend_fns ( | 246 | acpi_rs_dump_start_depend_fns ( |
193 | union acpi_resource_data *data) | 247 | union acpi_resource_data *data) |
194 | { | 248 | { |
@@ -232,8 +286,7 @@ acpi_rs_dump_start_depend_fns ( | |||
232 | break; | 286 | break; |
233 | 287 | ||
234 | default: | 288 | default: |
235 | acpi_os_printf (" Invalid performance " | 289 | acpi_os_printf (" Invalid performance robustness preference\n"); |
236 | "robustness preference\n"); | ||
237 | break; | 290 | break; |
238 | } | 291 | } |
239 | 292 | ||
@@ -253,7 +306,7 @@ acpi_rs_dump_start_depend_fns ( | |||
253 | * | 306 | * |
254 | ******************************************************************************/ | 307 | ******************************************************************************/ |
255 | 308 | ||
256 | void | 309 | static void |
257 | acpi_rs_dump_io ( | 310 | acpi_rs_dump_io ( |
258 | union acpi_resource_data *data) | 311 | union acpi_resource_data *data) |
259 | { | 312 | { |
@@ -266,19 +319,15 @@ acpi_rs_dump_io ( | |||
266 | acpi_os_printf ("Io Resource\n"); | 319 | acpi_os_printf ("Io Resource\n"); |
267 | 320 | ||
268 | acpi_os_printf (" %d bit decode\n", | 321 | acpi_os_printf (" %d bit decode\n", |
269 | ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); | 322 | ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); |
270 | 323 | ||
271 | acpi_os_printf (" Range minimum base: %08X\n", | 324 | acpi_os_printf (" Range minimum base: %08X\n", io_data->min_base_address); |
272 | io_data->min_base_address); | ||
273 | 325 | ||
274 | acpi_os_printf (" Range maximum base: %08X\n", | 326 | acpi_os_printf (" Range maximum base: %08X\n", io_data->max_base_address); |
275 | io_data->max_base_address); | ||
276 | 327 | ||
277 | acpi_os_printf (" Alignment: %08X\n", | 328 | acpi_os_printf (" Alignment: %08X\n", io_data->alignment); |
278 | io_data->alignment); | ||
279 | 329 | ||
280 | acpi_os_printf (" Range Length: %08X\n", | 330 | acpi_os_printf (" Range Length: %08X\n", io_data->range_length); |
281 | io_data->range_length); | ||
282 | 331 | ||
283 | return; | 332 | return; |
284 | } | 333 | } |
@@ -296,7 +345,7 @@ acpi_rs_dump_io ( | |||
296 | * | 345 | * |
297 | ******************************************************************************/ | 346 | ******************************************************************************/ |
298 | 347 | ||
299 | void | 348 | static void |
300 | acpi_rs_dump_fixed_io ( | 349 | acpi_rs_dump_fixed_io ( |
301 | union acpi_resource_data *data) | 350 | union acpi_resource_data *data) |
302 | { | 351 | { |
@@ -307,11 +356,9 @@ acpi_rs_dump_fixed_io ( | |||
307 | 356 | ||
308 | 357 | ||
309 | acpi_os_printf ("Fixed Io Resource\n"); | 358 | acpi_os_printf ("Fixed Io Resource\n"); |
310 | acpi_os_printf (" Range base address: %08X", | 359 | acpi_os_printf (" Range base address: %08X", fixed_io_data->base_address); |
311 | fixed_io_data->base_address); | ||
312 | 360 | ||
313 | acpi_os_printf (" Range length: %08X", | 361 | acpi_os_printf (" Range length: %08X", fixed_io_data->range_length); |
314 | fixed_io_data->range_length); | ||
315 | 362 | ||
316 | return; | 363 | return; |
317 | } | 364 | } |
@@ -329,7 +376,7 @@ acpi_rs_dump_fixed_io ( | |||
329 | * | 376 | * |
330 | ******************************************************************************/ | 377 | ******************************************************************************/ |
331 | 378 | ||
332 | void | 379 | static void |
333 | acpi_rs_dump_vendor_specific ( | 380 | acpi_rs_dump_vendor_specific ( |
334 | union acpi_resource_data *data) | 381 | union acpi_resource_data *data) |
335 | { | 382 | { |
@@ -346,7 +393,7 @@ acpi_rs_dump_vendor_specific ( | |||
346 | 393 | ||
347 | for (index = 0; index < vendor_data->length; index++) { | 394 | for (index = 0; index < vendor_data->length; index++) { |
348 | acpi_os_printf (" Byte %X: %08X\n", | 395 | acpi_os_printf (" Byte %X: %08X\n", |
349 | index, vendor_data->reserved[index]); | 396 | index, vendor_data->reserved[index]); |
350 | } | 397 | } |
351 | 398 | ||
352 | return; | 399 | return; |
@@ -365,7 +412,7 @@ acpi_rs_dump_vendor_specific ( | |||
365 | * | 412 | * |
366 | ******************************************************************************/ | 413 | ******************************************************************************/ |
367 | 414 | ||
368 | void | 415 | static void |
369 | acpi_rs_dump_memory24 ( | 416 | acpi_rs_dump_memory24 ( |
370 | union acpi_resource_data *data) | 417 | union acpi_resource_data *data) |
371 | { | 418 | { |
@@ -378,21 +425,19 @@ acpi_rs_dump_memory24 ( | |||
378 | acpi_os_printf ("24-Bit Memory Range Resource\n"); | 425 | acpi_os_printf ("24-Bit Memory Range Resource\n"); |
379 | 426 | ||
380 | acpi_os_printf (" Read%s\n", | 427 | acpi_os_printf (" Read%s\n", |
381 | ACPI_READ_WRITE_MEMORY == | 428 | ACPI_READ_WRITE_MEMORY == |
382 | memory24_data->read_write_attribute ? | 429 | memory24_data->read_write_attribute ? |
383 | "/Write" : " only"); | 430 | "/Write" : " only"); |
384 | 431 | ||
385 | acpi_os_printf (" Range minimum base: %08X\n", | 432 | acpi_os_printf (" Range minimum base: %08X\n", |
386 | memory24_data->min_base_address); | 433 | memory24_data->min_base_address); |
387 | 434 | ||
388 | acpi_os_printf (" Range maximum base: %08X\n", | 435 | acpi_os_printf (" Range maximum base: %08X\n", |
389 | memory24_data->max_base_address); | 436 | memory24_data->max_base_address); |
390 | 437 | ||
391 | acpi_os_printf (" Alignment: %08X\n", | 438 | acpi_os_printf (" Alignment: %08X\n", memory24_data->alignment); |
392 | memory24_data->alignment); | ||
393 | 439 | ||
394 | acpi_os_printf (" Range length: %08X\n", | 440 | acpi_os_printf (" Range length: %08X\n", memory24_data->range_length); |
395 | memory24_data->range_length); | ||
396 | 441 | ||
397 | return; | 442 | return; |
398 | } | 443 | } |
@@ -410,7 +455,7 @@ acpi_rs_dump_memory24 ( | |||
410 | * | 455 | * |
411 | ******************************************************************************/ | 456 | ******************************************************************************/ |
412 | 457 | ||
413 | void | 458 | static void |
414 | acpi_rs_dump_memory32 ( | 459 | acpi_rs_dump_memory32 ( |
415 | union acpi_resource_data *data) | 460 | union acpi_resource_data *data) |
416 | { | 461 | { |
@@ -423,21 +468,19 @@ acpi_rs_dump_memory32 ( | |||
423 | acpi_os_printf ("32-Bit Memory Range Resource\n"); | 468 | acpi_os_printf ("32-Bit Memory Range Resource\n"); |
424 | 469 | ||
425 | acpi_os_printf (" Read%s\n", | 470 | acpi_os_printf (" Read%s\n", |
426 | ACPI_READ_WRITE_MEMORY == | 471 | ACPI_READ_WRITE_MEMORY == |
427 | memory32_data->read_write_attribute ? | 472 | memory32_data->read_write_attribute ? |
428 | "/Write" : " only"); | 473 | "/Write" : " only"); |
429 | 474 | ||
430 | acpi_os_printf (" Range minimum base: %08X\n", | 475 | acpi_os_printf (" Range minimum base: %08X\n", |
431 | memory32_data->min_base_address); | 476 | memory32_data->min_base_address); |
432 | 477 | ||
433 | acpi_os_printf (" Range maximum base: %08X\n", | 478 | acpi_os_printf (" Range maximum base: %08X\n", |
434 | memory32_data->max_base_address); | 479 | memory32_data->max_base_address); |
435 | 480 | ||
436 | acpi_os_printf (" Alignment: %08X\n", | 481 | acpi_os_printf (" Alignment: %08X\n", memory32_data->alignment); |
437 | memory32_data->alignment); | ||
438 | 482 | ||
439 | acpi_os_printf (" Range length: %08X\n", | 483 | acpi_os_printf (" Range length: %08X\n", memory32_data->range_length); |
440 | memory32_data->range_length); | ||
441 | 484 | ||
442 | return; | 485 | return; |
443 | } | 486 | } |
@@ -455,11 +498,12 @@ acpi_rs_dump_memory32 ( | |||
455 | * | 498 | * |
456 | ******************************************************************************/ | 499 | ******************************************************************************/ |
457 | 500 | ||
458 | void | 501 | static void |
459 | acpi_rs_dump_fixed_memory32 ( | 502 | acpi_rs_dump_fixed_memory32 ( |
460 | union acpi_resource_data *data) | 503 | union acpi_resource_data *data) |
461 | { | 504 | { |
462 | struct acpi_resource_fixed_mem32 *fixed_memory32_data = (struct acpi_resource_fixed_mem32 *) data; | 505 | struct acpi_resource_fixed_mem32 *fixed_memory32_data = |
506 | (struct acpi_resource_fixed_mem32 *) data; | ||
463 | 507 | ||
464 | 508 | ||
465 | ACPI_FUNCTION_ENTRY (); | 509 | ACPI_FUNCTION_ENTRY (); |
@@ -468,15 +512,14 @@ acpi_rs_dump_fixed_memory32 ( | |||
468 | acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); | 512 | acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); |
469 | 513 | ||
470 | acpi_os_printf (" Read%s\n", | 514 | acpi_os_printf (" Read%s\n", |
471 | ACPI_READ_WRITE_MEMORY == | 515 | ACPI_READ_WRITE_MEMORY == |
472 | fixed_memory32_data->read_write_attribute ? | 516 | fixed_memory32_data->read_write_attribute ? "/Write" : " Only"); |
473 | "/Write" : " Only"); | ||
474 | 517 | ||
475 | acpi_os_printf (" Range base address: %08X\n", | 518 | acpi_os_printf (" Range base address: %08X\n", |
476 | fixed_memory32_data->range_base_address); | 519 | fixed_memory32_data->range_base_address); |
477 | 520 | ||
478 | acpi_os_printf (" Range length: %08X\n", | 521 | acpi_os_printf (" Range length: %08X\n", |
479 | fixed_memory32_data->range_length); | 522 | fixed_memory32_data->range_length); |
480 | 523 | ||
481 | return; | 524 | return; |
482 | } | 525 | } |
@@ -494,7 +537,7 @@ acpi_rs_dump_fixed_memory32 ( | |||
494 | * | 537 | * |
495 | ******************************************************************************/ | 538 | ******************************************************************************/ |
496 | 539 | ||
497 | void | 540 | static void |
498 | acpi_rs_dump_address16 ( | 541 | acpi_rs_dump_address16 ( |
499 | union acpi_resource_data *data) | 542 | union acpi_resource_data *data) |
500 | { | 543 | { |
@@ -514,35 +557,30 @@ acpi_rs_dump_address16 ( | |||
514 | 557 | ||
515 | switch (address16_data->attribute.memory.cache_attribute) { | 558 | switch (address16_data->attribute.memory.cache_attribute) { |
516 | case ACPI_NON_CACHEABLE_MEMORY: | 559 | case ACPI_NON_CACHEABLE_MEMORY: |
517 | acpi_os_printf (" Type Specific: " | 560 | acpi_os_printf (" Type Specific: Noncacheable memory\n"); |
518 | "Noncacheable memory\n"); | ||
519 | break; | 561 | break; |
520 | 562 | ||
521 | case ACPI_CACHABLE_MEMORY: | 563 | case ACPI_CACHABLE_MEMORY: |
522 | acpi_os_printf (" Type Specific: " | 564 | acpi_os_printf (" Type Specific: Cacheable memory\n"); |
523 | "Cacheable memory\n"); | ||
524 | break; | 565 | break; |
525 | 566 | ||
526 | case ACPI_WRITE_COMBINING_MEMORY: | 567 | case ACPI_WRITE_COMBINING_MEMORY: |
527 | acpi_os_printf (" Type Specific: " | 568 | acpi_os_printf (" Type Specific: Write-combining memory\n"); |
528 | "Write-combining memory\n"); | ||
529 | break; | 569 | break; |
530 | 570 | ||
531 | case ACPI_PREFETCHABLE_MEMORY: | 571 | case ACPI_PREFETCHABLE_MEMORY: |
532 | acpi_os_printf (" Type Specific: " | 572 | acpi_os_printf (" Type Specific: Prefetchable memory\n"); |
533 | "Prefetchable memory\n"); | ||
534 | break; | 573 | break; |
535 | 574 | ||
536 | default: | 575 | default: |
537 | acpi_os_printf (" Type Specific: " | 576 | acpi_os_printf (" Type Specific: Invalid cache attribute\n"); |
538 | "Invalid cache attribute\n"); | ||
539 | break; | 577 | break; |
540 | } | 578 | } |
541 | 579 | ||
542 | acpi_os_printf (" Type Specific: Read%s\n", | 580 | acpi_os_printf (" Type Specific: Read%s\n", |
543 | ACPI_READ_WRITE_MEMORY == | 581 | ACPI_READ_WRITE_MEMORY == |
544 | address16_data->attribute.memory.read_write_attribute ? | 582 | address16_data->attribute.memory.read_write_attribute ? |
545 | "/Write" : " Only"); | 583 | "/Write" : " Only"); |
546 | break; | 584 | break; |
547 | 585 | ||
548 | case ACPI_IO_RANGE: | 586 | case ACPI_IO_RANGE: |
@@ -551,30 +589,26 @@ acpi_rs_dump_address16 ( | |||
551 | 589 | ||
552 | switch (address16_data->attribute.io.range_attribute) { | 590 | switch (address16_data->attribute.io.range_attribute) { |
553 | case ACPI_NON_ISA_ONLY_RANGES: | 591 | case ACPI_NON_ISA_ONLY_RANGES: |
554 | acpi_os_printf (" Type Specific: " | 592 | acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); |
555 | "Non-ISA Io Addresses\n"); | ||
556 | break; | 593 | break; |
557 | 594 | ||
558 | case ACPI_ISA_ONLY_RANGES: | 595 | case ACPI_ISA_ONLY_RANGES: |
559 | acpi_os_printf (" Type Specific: " | 596 | acpi_os_printf (" Type Specific: ISA Io Addresses\n"); |
560 | "ISA Io Addresses\n"); | ||
561 | break; | 597 | break; |
562 | 598 | ||
563 | case ACPI_ENTIRE_RANGE: | 599 | case ACPI_ENTIRE_RANGE: |
564 | acpi_os_printf (" Type Specific: " | 600 | acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); |
565 | "ISA and non-ISA Io Addresses\n"); | ||
566 | break; | 601 | break; |
567 | 602 | ||
568 | default: | 603 | default: |
569 | acpi_os_printf (" Type Specific: " | 604 | acpi_os_printf (" Type Specific: Invalid range attribute\n"); |
570 | "Invalid range attribute\n"); | ||
571 | break; | 605 | break; |
572 | } | 606 | } |
573 | 607 | ||
574 | acpi_os_printf (" Type Specific: %s Translation\n", | 608 | acpi_os_printf (" Type Specific: %s Translation\n", |
575 | ACPI_SPARSE_TRANSLATION == | 609 | ACPI_SPARSE_TRANSLATION == |
576 | address16_data->attribute.io.translation_attribute ? | 610 | address16_data->attribute.io.translation_attribute ? |
577 | "Sparse" : "Dense"); | 611 | "Sparse" : "Dense"); |
578 | break; | 612 | break; |
579 | 613 | ||
580 | case ACPI_BUS_NUMBER_RANGE: | 614 | case ACPI_BUS_NUMBER_RANGE: |
@@ -589,41 +623,42 @@ acpi_rs_dump_address16 ( | |||
589 | } | 623 | } |
590 | 624 | ||
591 | acpi_os_printf (" Resource %s\n", | 625 | acpi_os_printf (" Resource %s\n", |
592 | ACPI_CONSUMER == address16_data->producer_consumer ? | 626 | ACPI_CONSUMER == address16_data->producer_consumer ? |
593 | "Consumer" : "Producer"); | 627 | "Consumer" : "Producer"); |
594 | 628 | ||
595 | acpi_os_printf (" %s decode\n", | 629 | acpi_os_printf (" %s decode\n", |
596 | ACPI_SUB_DECODE == address16_data->decode ? | 630 | ACPI_SUB_DECODE == address16_data->decode ? |
597 | "Subtractive" : "Positive"); | 631 | "Subtractive" : "Positive"); |
598 | 632 | ||
599 | acpi_os_printf (" Min address is %s fixed\n", | 633 | acpi_os_printf (" Min address is %s fixed\n", |
600 | ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? | 634 | ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? |
601 | "" : "not"); | 635 | "" : "not"); |
602 | 636 | ||
603 | acpi_os_printf (" Max address is %s fixed\n", | 637 | acpi_os_printf (" Max address is %s fixed\n", |
604 | ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? | 638 | ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? |
605 | "" : "not"); | 639 | "" : "not"); |
606 | 640 | ||
607 | acpi_os_printf (" Granularity: %08X\n", | 641 | acpi_os_printf (" Granularity: %08X\n", |
608 | address16_data->granularity); | 642 | address16_data->granularity); |
609 | 643 | ||
610 | acpi_os_printf (" Address range min: %08X\n", | 644 | acpi_os_printf (" Address range min: %08X\n", |
611 | address16_data->min_address_range); | 645 | address16_data->min_address_range); |
612 | 646 | ||
613 | acpi_os_printf (" Address range max: %08X\n", | 647 | acpi_os_printf (" Address range max: %08X\n", |
614 | address16_data->max_address_range); | 648 | address16_data->max_address_range); |
615 | 649 | ||
616 | acpi_os_printf (" Address translation offset: %08X\n", | 650 | acpi_os_printf (" Address translation offset: %08X\n", |
617 | address16_data->address_translation_offset); | 651 | address16_data->address_translation_offset); |
618 | 652 | ||
619 | acpi_os_printf (" Address Length: %08X\n", | 653 | acpi_os_printf (" Address Length: %08X\n", |
620 | address16_data->address_length); | 654 | address16_data->address_length); |
621 | 655 | ||
622 | if (0xFF != address16_data->resource_source.index) { | 656 | if (0xFF != address16_data->resource_source.index) { |
623 | acpi_os_printf (" Resource Source Index: %X\n", | 657 | acpi_os_printf (" Resource Source Index: %X\n", |
624 | address16_data->resource_source.index); | 658 | address16_data->resource_source.index); |
659 | |||
625 | acpi_os_printf (" Resource Source: %s\n", | 660 | acpi_os_printf (" Resource Source: %s\n", |
626 | address16_data->resource_source.string_ptr); | 661 | address16_data->resource_source.string_ptr); |
627 | } | 662 | } |
628 | 663 | ||
629 | return; | 664 | return; |
@@ -642,7 +677,7 @@ acpi_rs_dump_address16 ( | |||
642 | * | 677 | * |
643 | ******************************************************************************/ | 678 | ******************************************************************************/ |
644 | 679 | ||
645 | void | 680 | static void |
646 | acpi_rs_dump_address32 ( | 681 | acpi_rs_dump_address32 ( |
647 | union acpi_resource_data *data) | 682 | union acpi_resource_data *data) |
648 | { | 683 | { |
@@ -661,35 +696,30 @@ acpi_rs_dump_address32 ( | |||
661 | 696 | ||
662 | switch (address32_data->attribute.memory.cache_attribute) { | 697 | switch (address32_data->attribute.memory.cache_attribute) { |
663 | case ACPI_NON_CACHEABLE_MEMORY: | 698 | case ACPI_NON_CACHEABLE_MEMORY: |
664 | acpi_os_printf (" Type Specific: " | 699 | acpi_os_printf (" Type Specific: Noncacheable memory\n"); |
665 | "Noncacheable memory\n"); | ||
666 | break; | 700 | break; |
667 | 701 | ||
668 | case ACPI_CACHABLE_MEMORY: | 702 | case ACPI_CACHABLE_MEMORY: |
669 | acpi_os_printf (" Type Specific: " | 703 | acpi_os_printf (" Type Specific: Cacheable memory\n"); |
670 | "Cacheable memory\n"); | ||
671 | break; | 704 | break; |
672 | 705 | ||
673 | case ACPI_WRITE_COMBINING_MEMORY: | 706 | case ACPI_WRITE_COMBINING_MEMORY: |
674 | acpi_os_printf (" Type Specific: " | 707 | acpi_os_printf (" Type Specific: Write-combining memory\n"); |
675 | "Write-combining memory\n"); | ||
676 | break; | 708 | break; |
677 | 709 | ||
678 | case ACPI_PREFETCHABLE_MEMORY: | 710 | case ACPI_PREFETCHABLE_MEMORY: |
679 | acpi_os_printf (" Type Specific: " | 711 | acpi_os_printf (" Type Specific: Prefetchable memory\n"); |
680 | "Prefetchable memory\n"); | ||
681 | break; | 712 | break; |
682 | 713 | ||
683 | default: | 714 | default: |
684 | acpi_os_printf (" Type Specific: " | 715 | acpi_os_printf (" Type Specific: Invalid cache attribute\n"); |
685 | "Invalid cache attribute\n"); | ||
686 | break; | 716 | break; |
687 | } | 717 | } |
688 | 718 | ||
689 | acpi_os_printf (" Type Specific: Read%s\n", | 719 | acpi_os_printf (" Type Specific: Read%s\n", |
690 | ACPI_READ_WRITE_MEMORY == | 720 | ACPI_READ_WRITE_MEMORY == |
691 | address32_data->attribute.memory.read_write_attribute ? | 721 | address32_data->attribute.memory.read_write_attribute ? |
692 | "/Write" : " Only"); | 722 | "/Write" : " Only"); |
693 | break; | 723 | break; |
694 | 724 | ||
695 | case ACPI_IO_RANGE: | 725 | case ACPI_IO_RANGE: |
@@ -698,30 +728,26 @@ acpi_rs_dump_address32 ( | |||
698 | 728 | ||
699 | switch (address32_data->attribute.io.range_attribute) { | 729 | switch (address32_data->attribute.io.range_attribute) { |
700 | case ACPI_NON_ISA_ONLY_RANGES: | 730 | case ACPI_NON_ISA_ONLY_RANGES: |
701 | acpi_os_printf (" Type Specific: " | 731 | acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); |
702 | "Non-ISA Io Addresses\n"); | ||
703 | break; | 732 | break; |
704 | 733 | ||
705 | case ACPI_ISA_ONLY_RANGES: | 734 | case ACPI_ISA_ONLY_RANGES: |
706 | acpi_os_printf (" Type Specific: " | 735 | acpi_os_printf (" Type Specific: ISA Io Addresses\n"); |
707 | "ISA Io Addresses\n"); | ||
708 | break; | 736 | break; |
709 | 737 | ||
710 | case ACPI_ENTIRE_RANGE: | 738 | case ACPI_ENTIRE_RANGE: |
711 | acpi_os_printf (" Type Specific: " | 739 | acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); |
712 | "ISA and non-ISA Io Addresses\n"); | ||
713 | break; | 740 | break; |
714 | 741 | ||
715 | default: | 742 | default: |
716 | acpi_os_printf (" Type Specific: " | 743 | acpi_os_printf (" Type Specific: Invalid Range attribute"); |
717 | "Invalid Range attribute"); | ||
718 | break; | 744 | break; |
719 | } | 745 | } |
720 | 746 | ||
721 | acpi_os_printf (" Type Specific: %s Translation\n", | 747 | acpi_os_printf (" Type Specific: %s Translation\n", |
722 | ACPI_SPARSE_TRANSLATION == | 748 | ACPI_SPARSE_TRANSLATION == |
723 | address32_data->attribute.io.translation_attribute ? | 749 | address32_data->attribute.io.translation_attribute ? |
724 | "Sparse" : "Dense"); | 750 | "Sparse" : "Dense"); |
725 | break; | 751 | break; |
726 | 752 | ||
727 | case ACPI_BUS_NUMBER_RANGE: | 753 | case ACPI_BUS_NUMBER_RANGE: |
@@ -731,46 +757,48 @@ acpi_rs_dump_address32 ( | |||
731 | 757 | ||
732 | default: | 758 | default: |
733 | 759 | ||
734 | acpi_os_printf (" Resource Type: 0x%2.2X\n", address32_data->resource_type); | 760 | acpi_os_printf (" Resource Type: 0x%2.2X\n", |
761 | address32_data->resource_type); | ||
735 | break; | 762 | break; |
736 | } | 763 | } |
737 | 764 | ||
738 | acpi_os_printf (" Resource %s\n", | 765 | acpi_os_printf (" Resource %s\n", |
739 | ACPI_CONSUMER == address32_data->producer_consumer ? | 766 | ACPI_CONSUMER == address32_data->producer_consumer ? |
740 | "Consumer" : "Producer"); | 767 | "Consumer" : "Producer"); |
741 | 768 | ||
742 | acpi_os_printf (" %s decode\n", | 769 | acpi_os_printf (" %s decode\n", |
743 | ACPI_SUB_DECODE == address32_data->decode ? | 770 | ACPI_SUB_DECODE == address32_data->decode ? |
744 | "Subtractive" : "Positive"); | 771 | "Subtractive" : "Positive"); |
745 | 772 | ||
746 | acpi_os_printf (" Min address is %s fixed\n", | 773 | acpi_os_printf (" Min address is %s fixed\n", |
747 | ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? | 774 | ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? |
748 | "" : "not "); | 775 | "" : "not "); |
749 | 776 | ||
750 | acpi_os_printf (" Max address is %s fixed\n", | 777 | acpi_os_printf (" Max address is %s fixed\n", |
751 | ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? | 778 | ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? |
752 | "" : "not "); | 779 | "" : "not "); |
753 | 780 | ||
754 | acpi_os_printf (" Granularity: %08X\n", | 781 | acpi_os_printf (" Granularity: %08X\n", |
755 | address32_data->granularity); | 782 | address32_data->granularity); |
756 | 783 | ||
757 | acpi_os_printf (" Address range min: %08X\n", | 784 | acpi_os_printf (" Address range min: %08X\n", |
758 | address32_data->min_address_range); | 785 | address32_data->min_address_range); |
759 | 786 | ||
760 | acpi_os_printf (" Address range max: %08X\n", | 787 | acpi_os_printf (" Address range max: %08X\n", |
761 | address32_data->max_address_range); | 788 | address32_data->max_address_range); |
762 | 789 | ||
763 | acpi_os_printf (" Address translation offset: %08X\n", | 790 | acpi_os_printf (" Address translation offset: %08X\n", |
764 | address32_data->address_translation_offset); | 791 | address32_data->address_translation_offset); |
765 | 792 | ||
766 | acpi_os_printf (" Address Length: %08X\n", | 793 | acpi_os_printf (" Address Length: %08X\n", |
767 | address32_data->address_length); | 794 | address32_data->address_length); |
768 | 795 | ||
769 | if(0xFF != address32_data->resource_source.index) { | 796 | if(0xFF != address32_data->resource_source.index) { |
770 | acpi_os_printf (" Resource Source Index: %X\n", | 797 | acpi_os_printf (" Resource Source Index: %X\n", |
771 | address32_data->resource_source.index); | 798 | address32_data->resource_source.index); |
799 | |||
772 | acpi_os_printf (" Resource Source: %s\n", | 800 | acpi_os_printf (" Resource Source: %s\n", |
773 | address32_data->resource_source.string_ptr); | 801 | address32_data->resource_source.string_ptr); |
774 | } | 802 | } |
775 | 803 | ||
776 | return; | 804 | return; |
@@ -789,7 +817,7 @@ acpi_rs_dump_address32 ( | |||
789 | * | 817 | * |
790 | ******************************************************************************/ | 818 | ******************************************************************************/ |
791 | 819 | ||
792 | void | 820 | static void |
793 | acpi_rs_dump_address64 ( | 821 | acpi_rs_dump_address64 ( |
794 | union acpi_resource_data *data) | 822 | union acpi_resource_data *data) |
795 | { | 823 | { |
@@ -808,35 +836,30 @@ acpi_rs_dump_address64 ( | |||
808 | 836 | ||
809 | switch (address64_data->attribute.memory.cache_attribute) { | 837 | switch (address64_data->attribute.memory.cache_attribute) { |
810 | case ACPI_NON_CACHEABLE_MEMORY: | 838 | case ACPI_NON_CACHEABLE_MEMORY: |
811 | acpi_os_printf (" Type Specific: " | 839 | acpi_os_printf (" Type Specific: Noncacheable memory\n"); |
812 | "Noncacheable memory\n"); | ||
813 | break; | 840 | break; |
814 | 841 | ||
815 | case ACPI_CACHABLE_MEMORY: | 842 | case ACPI_CACHABLE_MEMORY: |
816 | acpi_os_printf (" Type Specific: " | 843 | acpi_os_printf (" Type Specific: Cacheable memory\n"); |
817 | "Cacheable memory\n"); | ||
818 | break; | 844 | break; |
819 | 845 | ||
820 | case ACPI_WRITE_COMBINING_MEMORY: | 846 | case ACPI_WRITE_COMBINING_MEMORY: |
821 | acpi_os_printf (" Type Specific: " | 847 | acpi_os_printf (" Type Specific: Write-combining memory\n"); |
822 | "Write-combining memory\n"); | ||
823 | break; | 848 | break; |
824 | 849 | ||
825 | case ACPI_PREFETCHABLE_MEMORY: | 850 | case ACPI_PREFETCHABLE_MEMORY: |
826 | acpi_os_printf (" Type Specific: " | 851 | acpi_os_printf (" Type Specific: Prefetchable memory\n"); |
827 | "Prefetchable memory\n"); | ||
828 | break; | 852 | break; |
829 | 853 | ||
830 | default: | 854 | default: |
831 | acpi_os_printf (" Type Specific: " | 855 | acpi_os_printf (" Type Specific: Invalid cache attribute\n"); |
832 | "Invalid cache attribute\n"); | ||
833 | break; | 856 | break; |
834 | } | 857 | } |
835 | 858 | ||
836 | acpi_os_printf (" Type Specific: Read%s\n", | 859 | acpi_os_printf (" Type Specific: Read%s\n", |
837 | ACPI_READ_WRITE_MEMORY == | 860 | ACPI_READ_WRITE_MEMORY == |
838 | address64_data->attribute.memory.read_write_attribute ? | 861 | address64_data->attribute.memory.read_write_attribute ? |
839 | "/Write" : " Only"); | 862 | "/Write" : " Only"); |
840 | break; | 863 | break; |
841 | 864 | ||
842 | case ACPI_IO_RANGE: | 865 | case ACPI_IO_RANGE: |
@@ -845,30 +868,26 @@ acpi_rs_dump_address64 ( | |||
845 | 868 | ||
846 | switch (address64_data->attribute.io.range_attribute) { | 869 | switch (address64_data->attribute.io.range_attribute) { |
847 | case ACPI_NON_ISA_ONLY_RANGES: | 870 | case ACPI_NON_ISA_ONLY_RANGES: |
848 | acpi_os_printf (" Type Specific: " | 871 | acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); |
849 | "Non-ISA Io Addresses\n"); | ||
850 | break; | 872 | break; |
851 | 873 | ||
852 | case ACPI_ISA_ONLY_RANGES: | 874 | case ACPI_ISA_ONLY_RANGES: |
853 | acpi_os_printf (" Type Specific: " | 875 | acpi_os_printf (" Type Specific: ISA Io Addresses\n"); |
854 | "ISA Io Addresses\n"); | ||
855 | break; | 876 | break; |
856 | 877 | ||
857 | case ACPI_ENTIRE_RANGE: | 878 | case ACPI_ENTIRE_RANGE: |
858 | acpi_os_printf (" Type Specific: " | 879 | acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); |
859 | "ISA and non-ISA Io Addresses\n"); | ||
860 | break; | 880 | break; |
861 | 881 | ||
862 | default: | 882 | default: |
863 | acpi_os_printf (" Type Specific: " | 883 | acpi_os_printf (" Type Specific: Invalid Range attribute"); |
864 | "Invalid Range attribute"); | ||
865 | break; | 884 | break; |
866 | } | 885 | } |
867 | 886 | ||
868 | acpi_os_printf (" Type Specific: %s Translation\n", | 887 | acpi_os_printf (" Type Specific: %s Translation\n", |
869 | ACPI_SPARSE_TRANSLATION == | 888 | ACPI_SPARSE_TRANSLATION == |
870 | address64_data->attribute.io.translation_attribute ? | 889 | address64_data->attribute.io.translation_attribute ? |
871 | "Sparse" : "Dense"); | 890 | "Sparse" : "Dense"); |
872 | break; | 891 | break; |
873 | 892 | ||
874 | case ACPI_BUS_NUMBER_RANGE: | 893 | case ACPI_BUS_NUMBER_RANGE: |
@@ -878,49 +897,51 @@ acpi_rs_dump_address64 ( | |||
878 | 897 | ||
879 | default: | 898 | default: |
880 | 899 | ||
881 | acpi_os_printf (" Resource Type: 0x%2.2X\n", address64_data->resource_type); | 900 | acpi_os_printf (" Resource Type: 0x%2.2X\n", |
901 | address64_data->resource_type); | ||
882 | break; | 902 | break; |
883 | } | 903 | } |
884 | 904 | ||
885 | acpi_os_printf (" Resource %s\n", | 905 | acpi_os_printf (" Resource %s\n", |
886 | ACPI_CONSUMER == address64_data->producer_consumer ? | 906 | ACPI_CONSUMER == address64_data->producer_consumer ? |
887 | "Consumer" : "Producer"); | 907 | "Consumer" : "Producer"); |
888 | 908 | ||
889 | acpi_os_printf (" %s decode\n", | 909 | acpi_os_printf (" %s decode\n", |
890 | ACPI_SUB_DECODE == address64_data->decode ? | 910 | ACPI_SUB_DECODE == address64_data->decode ? |
891 | "Subtractive" : "Positive"); | 911 | "Subtractive" : "Positive"); |
892 | 912 | ||
893 | acpi_os_printf (" Min address is %s fixed\n", | 913 | acpi_os_printf (" Min address is %s fixed\n", |
894 | ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? | 914 | ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? |
895 | "" : "not "); | 915 | "" : "not "); |
896 | 916 | ||
897 | acpi_os_printf (" Max address is %s fixed\n", | 917 | acpi_os_printf (" Max address is %s fixed\n", |
898 | ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? | 918 | ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? |
899 | "" : "not "); | 919 | "" : "not "); |
900 | 920 | ||
901 | acpi_os_printf (" Granularity: %8.8X%8.8X\n", | 921 | acpi_os_printf (" Granularity: %8.8X%8.8X\n", |
902 | ACPI_FORMAT_UINT64 (address64_data->granularity)); | 922 | ACPI_FORMAT_UINT64 (address64_data->granularity)); |
903 | 923 | ||
904 | acpi_os_printf (" Address range min: %8.8X%8.8X\n", | 924 | acpi_os_printf (" Address range min: %8.8X%8.8X\n", |
905 | ACPI_FORMAT_UINT64 (address64_data->min_address_range)); | 925 | ACPI_FORMAT_UINT64 (address64_data->min_address_range)); |
906 | 926 | ||
907 | acpi_os_printf (" Address range max: %8.8X%8.8X\n", | 927 | acpi_os_printf (" Address range max: %8.8X%8.8X\n", |
908 | ACPI_FORMAT_UINT64 (address64_data->max_address_range)); | 928 | ACPI_FORMAT_UINT64 (address64_data->max_address_range)); |
909 | 929 | ||
910 | acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", | 930 | acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", |
911 | ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); | 931 | ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); |
912 | 932 | ||
913 | acpi_os_printf (" Address Length: %8.8X%8.8X\n", | 933 | acpi_os_printf (" Address Length: %8.8X%8.8X\n", |
914 | ACPI_FORMAT_UINT64 (address64_data->address_length)); | 934 | ACPI_FORMAT_UINT64 (address64_data->address_length)); |
915 | 935 | ||
916 | acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", | 936 | acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", |
917 | ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); | 937 | ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); |
918 | 938 | ||
919 | if (0xFF != address64_data->resource_source.index) { | 939 | if (0xFF != address64_data->resource_source.index) { |
920 | acpi_os_printf (" Resource Source Index: %X\n", | 940 | acpi_os_printf (" Resource Source Index: %X\n", |
921 | address64_data->resource_source.index); | 941 | address64_data->resource_source.index); |
942 | |||
922 | acpi_os_printf (" Resource Source: %s\n", | 943 | acpi_os_printf (" Resource Source: %s\n", |
923 | address64_data->resource_source.string_ptr); | 944 | address64_data->resource_source.string_ptr); |
924 | } | 945 | } |
925 | 946 | ||
926 | return; | 947 | return; |
@@ -939,7 +960,7 @@ acpi_rs_dump_address64 ( | |||
939 | * | 960 | * |
940 | ******************************************************************************/ | 961 | ******************************************************************************/ |
941 | 962 | ||
942 | void | 963 | static void |
943 | acpi_rs_dump_extended_irq ( | 964 | acpi_rs_dump_extended_irq ( |
944 | union acpi_resource_data *data) | 965 | union acpi_resource_data *data) |
945 | { | 966 | { |
@@ -953,23 +974,22 @@ acpi_rs_dump_extended_irq ( | |||
953 | acpi_os_printf ("Extended IRQ Resource\n"); | 974 | acpi_os_printf ("Extended IRQ Resource\n"); |
954 | 975 | ||
955 | acpi_os_printf (" Resource %s\n", | 976 | acpi_os_printf (" Resource %s\n", |
956 | ACPI_CONSUMER == ext_irq_data->producer_consumer ? | 977 | ACPI_CONSUMER == ext_irq_data->producer_consumer ? |
957 | "Consumer" : "Producer"); | 978 | "Consumer" : "Producer"); |
958 | 979 | ||
959 | acpi_os_printf (" %s\n", | 980 | acpi_os_printf (" %s\n", |
960 | ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? | 981 | ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? |
961 | "Level" : "Edge"); | 982 | "Level" : "Edge"); |
962 | 983 | ||
963 | acpi_os_printf (" Active %s\n", | 984 | acpi_os_printf (" Active %s\n", |
964 | ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? | 985 | ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? |
965 | "low" : "high"); | 986 | "low" : "high"); |
966 | 987 | ||
967 | acpi_os_printf (" %s\n", | 988 | acpi_os_printf (" %s\n", |
968 | ACPI_SHARED == ext_irq_data->shared_exclusive ? | 989 | ACPI_SHARED == ext_irq_data->shared_exclusive ? |
969 | "Shared" : "Exclusive"); | 990 | "Shared" : "Exclusive"); |
970 | 991 | ||
971 | acpi_os_printf (" Interrupts : %X ( ", | 992 | acpi_os_printf (" Interrupts : %X ( ", ext_irq_data->number_of_interrupts); |
972 | ext_irq_data->number_of_interrupts); | ||
973 | 993 | ||
974 | for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { | 994 | for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { |
975 | acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); | 995 | acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); |
@@ -979,9 +999,10 @@ acpi_rs_dump_extended_irq ( | |||
979 | 999 | ||
980 | if(0xFF != ext_irq_data->resource_source.index) { | 1000 | if(0xFF != ext_irq_data->resource_source.index) { |
981 | acpi_os_printf (" Resource Source Index: %X", | 1001 | acpi_os_printf (" Resource Source Index: %X", |
982 | ext_irq_data->resource_source.index); | 1002 | ext_irq_data->resource_source.index); |
1003 | |||
983 | acpi_os_printf (" Resource Source: %s", | 1004 | acpi_os_printf (" Resource Source: %s", |
984 | ext_irq_data->resource_source.string_ptr); | 1005 | ext_irq_data->resource_source.string_ptr); |
985 | } | 1006 | } |
986 | 1007 | ||
987 | return; | 1008 | return; |
@@ -992,7 +1013,7 @@ acpi_rs_dump_extended_irq ( | |||
992 | * | 1013 | * |
993 | * FUNCTION: acpi_rs_dump_resource_list | 1014 | * FUNCTION: acpi_rs_dump_resource_list |
994 | * | 1015 | * |
995 | * PARAMETERS: Data - pointer to the resource structure to dump. | 1016 | * PARAMETERS: Resource - pointer to the resource structure to dump. |
996 | * | 1017 | * |
997 | * RETURN: None | 1018 | * RETURN: None |
998 | * | 1019 | * |
@@ -1096,7 +1117,7 @@ acpi_rs_dump_resource_list ( | |||
1096 | * | 1117 | * |
1097 | * FUNCTION: acpi_rs_dump_irq_list | 1118 | * FUNCTION: acpi_rs_dump_irq_list |
1098 | * | 1119 | * |
1099 | * PARAMETERS: Data - pointer to the routing table to dump. | 1120 | * PARAMETERS: route_table - pointer to the routing table to dump. |
1100 | * | 1121 | * |
1101 | * RETURN: None | 1122 | * RETURN: None |
1102 | * | 1123 | * |
@@ -1124,20 +1145,17 @@ acpi_rs_dump_irq_list ( | |||
1124 | acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); | 1145 | acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); |
1125 | 1146 | ||
1126 | acpi_os_printf (" Address: %8.8X%8.8X\n", | 1147 | acpi_os_printf (" Address: %8.8X%8.8X\n", |
1127 | ACPI_FORMAT_UINT64 (prt_element->address)); | 1148 | ACPI_FORMAT_UINT64 (prt_element->address)); |
1128 | 1149 | ||
1129 | acpi_os_printf (" Pin: %X\n", prt_element->pin); | 1150 | acpi_os_printf (" Pin: %X\n", prt_element->pin); |
1130 | 1151 | ||
1131 | acpi_os_printf (" Source: %s\n", prt_element->source); | 1152 | acpi_os_printf (" Source: %s\n", prt_element->source); |
1132 | 1153 | ||
1133 | acpi_os_printf (" source_index: %X\n", | 1154 | acpi_os_printf (" source_index: %X\n", prt_element->source_index); |
1134 | prt_element->source_index); | ||
1135 | 1155 | ||
1136 | buffer += prt_element->length; | 1156 | buffer += prt_element->length; |
1137 | |||
1138 | prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); | 1157 | prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); |
1139 | 1158 | if (0 == prt_element->length) { | |
1140 | if(0 == prt_element->length) { | ||
1141 | done = TRUE; | 1159 | done = TRUE; |
1142 | } | 1160 | } |
1143 | } | 1161 | } |
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index 972c746d37e4..23a4d149fac8 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c | |||
@@ -81,67 +81,60 @@ acpi_rs_io_resource ( | |||
81 | struct acpi_resource *output_struct = (void *) *output_buffer; | 81 | struct acpi_resource *output_struct = (void *) *output_buffer; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | u8 temp8 = 0; | 83 | u8 temp8 = 0; |
84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io); | 84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
85 | struct acpi_resource_io); | ||
85 | 86 | ||
86 | 87 | ||
87 | ACPI_FUNCTION_TRACE ("rs_io_resource"); | 88 | ACPI_FUNCTION_TRACE ("rs_io_resource"); |
88 | 89 | ||
89 | 90 | ||
90 | /* | 91 | /* The number of bytes consumed are Constant */ |
91 | * The number of bytes consumed are Constant | 92 | |
92 | */ | ||
93 | *bytes_consumed = 8; | 93 | *bytes_consumed = 8; |
94 | 94 | ||
95 | output_struct->id = ACPI_RSTYPE_IO; | 95 | output_struct->id = ACPI_RSTYPE_IO; |
96 | 96 | ||
97 | /* | 97 | /* Check Decode */ |
98 | * Check Decode | 98 | |
99 | */ | ||
100 | buffer += 1; | 99 | buffer += 1; |
101 | temp8 = *buffer; | 100 | temp8 = *buffer; |
102 | 101 | ||
103 | output_struct->data.io.io_decode = temp8 & 0x01; | 102 | output_struct->data.io.io_decode = temp8 & 0x01; |
104 | 103 | ||
105 | /* | 104 | /* Check min_base Address */ |
106 | * Check min_base Address | 105 | |
107 | */ | ||
108 | buffer += 1; | 106 | buffer += 1; |
109 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 107 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
110 | 108 | ||
111 | output_struct->data.io.min_base_address = temp16; | 109 | output_struct->data.io.min_base_address = temp16; |
112 | 110 | ||
113 | /* | 111 | /* Check max_base Address */ |
114 | * Check max_base Address | 112 | |
115 | */ | ||
116 | buffer += 2; | 113 | buffer += 2; |
117 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 114 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
118 | 115 | ||
119 | output_struct->data.io.max_base_address = temp16; | 116 | output_struct->data.io.max_base_address = temp16; |
120 | 117 | ||
121 | /* | 118 | /* Check Base alignment */ |
122 | * Check Base alignment | 119 | |
123 | */ | ||
124 | buffer += 2; | 120 | buffer += 2; |
125 | temp8 = *buffer; | 121 | temp8 = *buffer; |
126 | 122 | ||
127 | output_struct->data.io.alignment = temp8; | 123 | output_struct->data.io.alignment = temp8; |
128 | 124 | ||
129 | /* | 125 | /* Check range_length */ |
130 | * Check range_length | 126 | |
131 | */ | ||
132 | buffer += 1; | 127 | buffer += 1; |
133 | temp8 = *buffer; | 128 | temp8 = *buffer; |
134 | 129 | ||
135 | output_struct->data.io.range_length = temp8; | 130 | output_struct->data.io.range_length = temp8; |
136 | 131 | ||
137 | /* | 132 | /* Set the Length parameter */ |
138 | * Set the Length parameter | 133 | |
139 | */ | ||
140 | output_struct->length = (u32) struct_size; | 134 | output_struct->length = (u32) struct_size; |
141 | 135 | ||
142 | /* | 136 | /* Return the final size of the structure */ |
143 | * Return the final size of the structure | 137 | |
144 | */ | ||
145 | *structure_size = struct_size; | 138 | *structure_size = struct_size; |
146 | return_ACPI_STATUS (AE_OK); | 139 | return_ACPI_STATUS (AE_OK); |
147 | } | 140 | } |
@@ -179,43 +172,39 @@ acpi_rs_fixed_io_resource ( | |||
179 | struct acpi_resource *output_struct = (void *) *output_buffer; | 172 | struct acpi_resource *output_struct = (void *) *output_buffer; |
180 | u16 temp16 = 0; | 173 | u16 temp16 = 0; |
181 | u8 temp8 = 0; | 174 | u8 temp8 = 0; |
182 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io); | 175 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
176 | struct acpi_resource_fixed_io); | ||
183 | 177 | ||
184 | 178 | ||
185 | ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); | 179 | ACPI_FUNCTION_TRACE ("rs_fixed_io_resource"); |
186 | 180 | ||
187 | 181 | ||
188 | /* | 182 | /* The number of bytes consumed are Constant */ |
189 | * The number of bytes consumed are Constant | 183 | |
190 | */ | ||
191 | *bytes_consumed = 4; | 184 | *bytes_consumed = 4; |
192 | 185 | ||
193 | output_struct->id = ACPI_RSTYPE_FIXED_IO; | 186 | output_struct->id = ACPI_RSTYPE_FIXED_IO; |
194 | 187 | ||
195 | /* | 188 | /* Check Range Base Address */ |
196 | * Check Range Base Address | 189 | |
197 | */ | ||
198 | buffer += 1; | 190 | buffer += 1; |
199 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 191 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
200 | 192 | ||
201 | output_struct->data.fixed_io.base_address = temp16; | 193 | output_struct->data.fixed_io.base_address = temp16; |
202 | 194 | ||
203 | /* | 195 | /* Check range_length */ |
204 | * Check range_length | 196 | |
205 | */ | ||
206 | buffer += 2; | 197 | buffer += 2; |
207 | temp8 = *buffer; | 198 | temp8 = *buffer; |
208 | 199 | ||
209 | output_struct->data.fixed_io.range_length = temp8; | 200 | output_struct->data.fixed_io.range_length = temp8; |
210 | 201 | ||
211 | /* | 202 | /* Set the Length parameter */ |
212 | * Set the Length parameter | 203 | |
213 | */ | ||
214 | output_struct->length = (u32) struct_size; | 204 | output_struct->length = (u32) struct_size; |
215 | 205 | ||
216 | /* | 206 | /* Return the final size of the structure */ |
217 | * Return the final size of the structure | 207 | |
218 | */ | ||
219 | *structure_size = struct_size; | 208 | *structure_size = struct_size; |
220 | return_ACPI_STATUS (AE_OK); | 209 | return_ACPI_STATUS (AE_OK); |
221 | } | 210 | } |
@@ -251,55 +240,48 @@ acpi_rs_io_stream ( | |||
251 | ACPI_FUNCTION_TRACE ("rs_io_stream"); | 240 | ACPI_FUNCTION_TRACE ("rs_io_stream"); |
252 | 241 | ||
253 | 242 | ||
254 | /* | 243 | /* The descriptor field is static */ |
255 | * The descriptor field is static | 244 | |
256 | */ | ||
257 | *buffer = 0x47; | 245 | *buffer = 0x47; |
258 | buffer += 1; | 246 | buffer += 1; |
259 | 247 | ||
260 | /* | 248 | /* Io Information Byte */ |
261 | * Io Information Byte | 249 | |
262 | */ | ||
263 | temp8 = (u8) (linked_list->data.io.io_decode & 0x01); | 250 | temp8 = (u8) (linked_list->data.io.io_decode & 0x01); |
264 | 251 | ||
265 | *buffer = temp8; | 252 | *buffer = temp8; |
266 | buffer += 1; | 253 | buffer += 1; |
267 | 254 | ||
268 | /* | 255 | /* Set the Range minimum base address */ |
269 | * Set the Range minimum base address | 256 | |
270 | */ | ||
271 | temp16 = (u16) linked_list->data.io.min_base_address; | 257 | temp16 = (u16) linked_list->data.io.min_base_address; |
272 | 258 | ||
273 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 259 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
274 | buffer += 2; | 260 | buffer += 2; |
275 | 261 | ||
276 | /* | 262 | /* Set the Range maximum base address */ |
277 | * Set the Range maximum base address | 263 | |
278 | */ | ||
279 | temp16 = (u16) linked_list->data.io.max_base_address; | 264 | temp16 = (u16) linked_list->data.io.max_base_address; |
280 | 265 | ||
281 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 266 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
282 | buffer += 2; | 267 | buffer += 2; |
283 | 268 | ||
284 | /* | 269 | /* Set the base alignment */ |
285 | * Set the base alignment | 270 | |
286 | */ | ||
287 | temp8 = (u8) linked_list->data.io.alignment; | 271 | temp8 = (u8) linked_list->data.io.alignment; |
288 | 272 | ||
289 | *buffer = temp8; | 273 | *buffer = temp8; |
290 | buffer += 1; | 274 | buffer += 1; |
291 | 275 | ||
292 | /* | 276 | /* Set the range length */ |
293 | * Set the range length | 277 | |
294 | */ | ||
295 | temp8 = (u8) linked_list->data.io.range_length; | 278 | temp8 = (u8) linked_list->data.io.range_length; |
296 | 279 | ||
297 | *buffer = temp8; | 280 | *buffer = temp8; |
298 | buffer += 1; | 281 | buffer += 1; |
299 | 282 | ||
300 | /* | 283 | /* Return the number of bytes consumed in this operation */ |
301 | * Return the number of bytes consumed in this operation | 284 | |
302 | */ | ||
303 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 285 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
304 | return_ACPI_STATUS (AE_OK); | 286 | return_ACPI_STATUS (AE_OK); |
305 | } | 287 | } |
@@ -335,32 +317,28 @@ acpi_rs_fixed_io_stream ( | |||
335 | ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); | 317 | ACPI_FUNCTION_TRACE ("rs_fixed_io_stream"); |
336 | 318 | ||
337 | 319 | ||
338 | /* | 320 | /* The descriptor field is static */ |
339 | * The descriptor field is static | 321 | |
340 | */ | ||
341 | *buffer = 0x4B; | 322 | *buffer = 0x4B; |
342 | 323 | ||
343 | buffer += 1; | 324 | buffer += 1; |
344 | 325 | ||
345 | /* | 326 | /* Set the Range base address */ |
346 | * Set the Range base address | 327 | |
347 | */ | ||
348 | temp16 = (u16) linked_list->data.fixed_io.base_address; | 328 | temp16 = (u16) linked_list->data.fixed_io.base_address; |
349 | 329 | ||
350 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 330 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
351 | buffer += 2; | 331 | buffer += 2; |
352 | 332 | ||
353 | /* | 333 | /* Set the range length */ |
354 | * Set the range length | 334 | |
355 | */ | ||
356 | temp8 = (u8) linked_list->data.fixed_io.range_length; | 335 | temp8 = (u8) linked_list->data.fixed_io.range_length; |
357 | 336 | ||
358 | *buffer = temp8; | 337 | *buffer = temp8; |
359 | buffer += 1; | 338 | buffer += 1; |
360 | 339 | ||
361 | /* | 340 | /* Return the number of bytes consumed in this operation */ |
362 | * Return the number of bytes consumed in this operation | 341 | |
363 | */ | ||
364 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 342 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
365 | return_ACPI_STATUS (AE_OK); | 343 | return_ACPI_STATUS (AE_OK); |
366 | } | 344 | } |
@@ -399,21 +377,20 @@ acpi_rs_dma_resource ( | |||
399 | u8 temp8 = 0; | 377 | u8 temp8 = 0; |
400 | u8 index; | 378 | u8 index; |
401 | u8 i; | 379 | u8 i; |
402 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma); | 380 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
381 | struct acpi_resource_dma); | ||
403 | 382 | ||
404 | 383 | ||
405 | ACPI_FUNCTION_TRACE ("rs_dma_resource"); | 384 | ACPI_FUNCTION_TRACE ("rs_dma_resource"); |
406 | 385 | ||
407 | 386 | ||
408 | /* | 387 | /* The number of bytes consumed are Constant */ |
409 | * The number of bytes consumed are Constant | 388 | |
410 | */ | ||
411 | *bytes_consumed = 3; | 389 | *bytes_consumed = 3; |
412 | output_struct->id = ACPI_RSTYPE_DMA; | 390 | output_struct->id = ACPI_RSTYPE_DMA; |
413 | 391 | ||
414 | /* | 392 | /* Point to the 8-bits of Byte 1 */ |
415 | * Point to the 8-bits of Byte 1 | 393 | |
416 | */ | ||
417 | buffer += 1; | 394 | buffer += 1; |
418 | temp8 = *buffer; | 395 | temp8 = *buffer; |
419 | 396 | ||
@@ -430,46 +407,40 @@ acpi_rs_dma_resource ( | |||
430 | 407 | ||
431 | output_struct->data.dma.number_of_channels = i; | 408 | output_struct->data.dma.number_of_channels = i; |
432 | if (i > 0) { | 409 | if (i > 0) { |
433 | /* | 410 | /* Calculate the structure size based upon the number of interrupts */ |
434 | * Calculate the structure size based upon the number of interrupts | 411 | |
435 | */ | ||
436 | struct_size += ((acpi_size) i - 1) * 4; | 412 | struct_size += ((acpi_size) i - 1) * 4; |
437 | } | 413 | } |
438 | 414 | ||
439 | /* | 415 | /* Point to Byte 2 */ |
440 | * Point to Byte 2 | 416 | |
441 | */ | ||
442 | buffer += 1; | 417 | buffer += 1; |
443 | temp8 = *buffer; | 418 | temp8 = *buffer; |
444 | 419 | ||
445 | /* | 420 | /* Check for transfer preference (Bits[1:0]) */ |
446 | * Check for transfer preference (Bits[1:0]) | 421 | |
447 | */ | ||
448 | output_struct->data.dma.transfer = temp8 & 0x03; | 422 | output_struct->data.dma.transfer = temp8 & 0x03; |
449 | 423 | ||
450 | if (0x03 == output_struct->data.dma.transfer) { | 424 | if (0x03 == output_struct->data.dma.transfer) { |
451 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n")); | 425 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
426 | "Invalid DMA.Transfer preference (3)\n")); | ||
452 | return_ACPI_STATUS (AE_BAD_DATA); | 427 | return_ACPI_STATUS (AE_BAD_DATA); |
453 | } | 428 | } |
454 | 429 | ||
455 | /* | 430 | /* Get bus master preference (Bit[2]) */ |
456 | * Get bus master preference (Bit[2]) | 431 | |
457 | */ | ||
458 | output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; | 432 | output_struct->data.dma.bus_master = (temp8 >> 2) & 0x01; |
459 | 433 | ||
460 | /* | 434 | /* Get channel speed support (Bits[6:5]) */ |
461 | * Get channel speed support (Bits[6:5]) | 435 | |
462 | */ | ||
463 | output_struct->data.dma.type = (temp8 >> 5) & 0x03; | 436 | output_struct->data.dma.type = (temp8 >> 5) & 0x03; |
464 | 437 | ||
465 | /* | 438 | /* Set the Length parameter */ |
466 | * Set the Length parameter | 439 | |
467 | */ | ||
468 | output_struct->length = (u32) struct_size; | 440 | output_struct->length = (u32) struct_size; |
469 | 441 | ||
470 | /* | 442 | /* Return the final size of the structure */ |
471 | * Return the final size of the structure | 443 | |
472 | */ | ||
473 | *structure_size = struct_size; | 444 | *structure_size = struct_size; |
474 | return_ACPI_STATUS (AE_OK); | 445 | return_ACPI_STATUS (AE_OK); |
475 | } | 446 | } |
@@ -506,16 +477,14 @@ acpi_rs_dma_stream ( | |||
506 | ACPI_FUNCTION_TRACE ("rs_dma_stream"); | 477 | ACPI_FUNCTION_TRACE ("rs_dma_stream"); |
507 | 478 | ||
508 | 479 | ||
509 | /* | 480 | /* The descriptor field is static */ |
510 | * The descriptor field is static | 481 | |
511 | */ | ||
512 | *buffer = 0x2A; | 482 | *buffer = 0x2A; |
513 | buffer += 1; | 483 | buffer += 1; |
514 | temp8 = 0; | 484 | temp8 = 0; |
515 | 485 | ||
516 | /* | 486 | /* Loop through all of the Channels and set the mask bits */ |
517 | * Loop through all of the Channels and set the mask bits | 487 | |
518 | */ | ||
519 | for (index = 0; | 488 | for (index = 0; |
520 | index < linked_list->data.dma.number_of_channels; | 489 | index < linked_list->data.dma.number_of_channels; |
521 | index++) { | 490 | index++) { |
@@ -526,9 +495,8 @@ acpi_rs_dma_stream ( | |||
526 | *buffer = temp8; | 495 | *buffer = temp8; |
527 | buffer += 1; | 496 | buffer += 1; |
528 | 497 | ||
529 | /* | 498 | /* Set the DMA Info */ |
530 | * Set the DMA Info | 499 | |
531 | */ | ||
532 | temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); | 500 | temp8 = (u8) ((linked_list->data.dma.type & 0x03) << 5); |
533 | temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); | 501 | temp8 |= ((linked_list->data.dma.bus_master & 0x01) << 2); |
534 | temp8 |= (linked_list->data.dma.transfer & 0x03); | 502 | temp8 |= (linked_list->data.dma.transfer & 0x03); |
@@ -536,9 +504,8 @@ acpi_rs_dma_stream ( | |||
536 | *buffer = temp8; | 504 | *buffer = temp8; |
537 | buffer += 1; | 505 | buffer += 1; |
538 | 506 | ||
539 | /* | 507 | /* Return the number of bytes consumed in this operation */ |
540 | * Return the number of bytes consumed in this operation | 508 | |
541 | */ | ||
542 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 509 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
543 | return_ACPI_STATUS (AE_OK); | 510 | return_ACPI_STATUS (AE_OK); |
544 | } | 511 | } |
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index fd07a8702fbe..8a2b630be45b 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c | |||
@@ -83,7 +83,8 @@ acpi_rs_irq_resource ( | |||
83 | u8 temp8 = 0; | 83 | u8 temp8 = 0; |
84 | u8 index; | 84 | u8 index; |
85 | u8 i; | 85 | u8 i; |
86 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_irq); | 86 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
87 | struct acpi_resource_irq); | ||
87 | 88 | ||
88 | 89 | ||
89 | ACPI_FUNCTION_TRACE ("rs_irq_resource"); | 90 | ACPI_FUNCTION_TRACE ("rs_irq_resource"); |
@@ -91,15 +92,14 @@ acpi_rs_irq_resource ( | |||
91 | 92 | ||
92 | /* | 93 | /* |
93 | * The number of bytes consumed are contained in the descriptor | 94 | * The number of bytes consumed are contained in the descriptor |
94 | * (Bits:0-1) | 95 | * (Bits:0-1) |
95 | */ | 96 | */ |
96 | temp8 = *buffer; | 97 | temp8 = *buffer; |
97 | *bytes_consumed = (temp8 & 0x03) + 1; | 98 | *bytes_consumed = (temp8 & 0x03) + 1; |
98 | output_struct->id = ACPI_RSTYPE_IRQ; | 99 | output_struct->id = ACPI_RSTYPE_IRQ; |
99 | 100 | ||
100 | /* | 101 | /* Point to the 16-bits of Bytes 1 and 2 */ |
101 | * Point to the 16-bits of Bytes 1 and 2 | 102 | |
102 | */ | ||
103 | buffer += 1; | 103 | buffer += 1; |
104 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 104 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
105 | 105 | ||
@@ -118,22 +118,19 @@ acpi_rs_irq_resource ( | |||
118 | 118 | ||
119 | output_struct->data.irq.number_of_interrupts = i; | 119 | output_struct->data.irq.number_of_interrupts = i; |
120 | if (i > 0) { | 120 | if (i > 0) { |
121 | /* | 121 | /* Calculate the structure size based upon the number of interrupts */ |
122 | * Calculate the structure size based upon the number of interrupts | 122 | |
123 | */ | ||
124 | struct_size += ((acpi_size) i - 1) * 4; | 123 | struct_size += ((acpi_size) i - 1) * 4; |
125 | } | 124 | } |
126 | 125 | ||
127 | /* | 126 | /* Point to Byte 3 if it is used */ |
128 | * Point to Byte 3 if it is used | 127 | |
129 | */ | ||
130 | if (4 == *bytes_consumed) { | 128 | if (4 == *bytes_consumed) { |
131 | buffer += 2; | 129 | buffer += 2; |
132 | temp8 = *buffer; | 130 | temp8 = *buffer; |
133 | 131 | ||
134 | /* | 132 | /* Check for HE, LL interrupts */ |
135 | * Check for HE, LL interrupts | 133 | |
136 | */ | ||
137 | switch (temp8 & 0x09) { | 134 | switch (temp8 & 0x09) { |
138 | case 0x01: /* HE */ | 135 | case 0x01: /* HE */ |
139 | output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; | 136 | output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; |
@@ -152,13 +149,13 @@ acpi_rs_irq_resource ( | |||
152 | * so 0x00 and 0x09 are illegal. | 149 | * so 0x00 and 0x09 are illegal. |
153 | */ | 150 | */ |
154 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 151 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
155 | "Invalid interrupt polarity/trigger in resource list, %X\n", temp8)); | 152 | "Invalid interrupt polarity/trigger in resource list, %X\n", |
153 | temp8)); | ||
156 | return_ACPI_STATUS (AE_BAD_DATA); | 154 | return_ACPI_STATUS (AE_BAD_DATA); |
157 | } | 155 | } |
158 | 156 | ||
159 | /* | 157 | /* Check for sharable */ |
160 | * Check for sharable | 158 | |
161 | */ | ||
162 | output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; | 159 | output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; |
163 | } | 160 | } |
164 | else { | 161 | else { |
@@ -171,14 +168,12 @@ acpi_rs_irq_resource ( | |||
171 | output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 168 | output_struct->data.irq.shared_exclusive = ACPI_EXCLUSIVE; |
172 | } | 169 | } |
173 | 170 | ||
174 | /* | 171 | /* Set the Length parameter */ |
175 | * Set the Length parameter | 172 | |
176 | */ | ||
177 | output_struct->length = (u32) struct_size; | 173 | output_struct->length = (u32) struct_size; |
178 | 174 | ||
179 | /* | 175 | /* Return the final size of the structure */ |
180 | * Return the final size of the structure | 176 | |
181 | */ | ||
182 | *structure_size = struct_size; | 177 | *structure_size = struct_size; |
183 | return_ACPI_STATUS (AE_OK); | 178 | return_ACPI_STATUS (AE_OK); |
184 | } | 179 | } |
@@ -234,9 +229,8 @@ acpi_rs_irq_stream ( | |||
234 | buffer += 1; | 229 | buffer += 1; |
235 | temp16 = 0; | 230 | temp16 = 0; |
236 | 231 | ||
237 | /* | 232 | /* Loop through all of the interrupts and set the mask bits */ |
238 | * Loop through all of the interrupts and set the mask bits | 233 | |
239 | */ | ||
240 | for(index = 0; | 234 | for(index = 0; |
241 | index < linked_list->data.irq.number_of_interrupts; | 235 | index < linked_list->data.irq.number_of_interrupts; |
242 | index++) { | 236 | index++) { |
@@ -247,9 +241,8 @@ acpi_rs_irq_stream ( | |||
247 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 241 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
248 | buffer += 2; | 242 | buffer += 2; |
249 | 243 | ||
250 | /* | 244 | /* Set the IRQ Info byte if needed. */ |
251 | * Set the IRQ Info byte if needed. | 245 | |
252 | */ | ||
253 | if (IRqinfo_byte_needed) { | 246 | if (IRqinfo_byte_needed) { |
254 | temp8 = 0; | 247 | temp8 = 0; |
255 | temp8 = (u8) ((linked_list->data.irq.shared_exclusive & | 248 | temp8 = (u8) ((linked_list->data.irq.shared_exclusive & |
@@ -267,9 +260,8 @@ acpi_rs_irq_stream ( | |||
267 | buffer += 1; | 260 | buffer += 1; |
268 | } | 261 | } |
269 | 262 | ||
270 | /* | 263 | /* Return the number of bytes consumed in this operation */ |
271 | * Return the number of bytes consumed in this operation | 264 | |
272 | */ | ||
273 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 265 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
274 | return_ACPI_STATUS (AE_OK); | 266 | return_ACPI_STATUS (AE_OK); |
275 | } | 267 | } |
@@ -309,15 +301,15 @@ acpi_rs_extended_irq_resource ( | |||
309 | u8 temp8 = 0; | 301 | u8 temp8 = 0; |
310 | u8 *temp_ptr; | 302 | u8 *temp_ptr; |
311 | u8 index; | 303 | u8 index; |
312 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq); | 304 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
305 | struct acpi_resource_ext_irq); | ||
313 | 306 | ||
314 | 307 | ||
315 | ACPI_FUNCTION_TRACE ("rs_extended_irq_resource"); | 308 | ACPI_FUNCTION_TRACE ("rs_extended_irq_resource"); |
316 | 309 | ||
317 | 310 | ||
318 | /* | 311 | /* Point past the Descriptor to get the number of bytes consumed */ |
319 | * Point past the Descriptor to get the number of bytes consumed | 312 | |
320 | */ | ||
321 | buffer += 1; | 313 | buffer += 1; |
322 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 314 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
323 | 315 | ||
@@ -330,9 +322,8 @@ acpi_rs_extended_irq_resource ( | |||
330 | *bytes_consumed = temp16 + 3; | 322 | *bytes_consumed = temp16 + 3; |
331 | output_struct->id = ACPI_RSTYPE_EXT_IRQ; | 323 | output_struct->id = ACPI_RSTYPE_EXT_IRQ; |
332 | 324 | ||
333 | /* | 325 | /* Point to the Byte3 */ |
334 | * Point to the Byte3 | 326 | |
335 | */ | ||
336 | buffer += 2; | 327 | buffer += 2; |
337 | temp8 = *buffer; | 328 | temp8 = *buffer; |
338 | 329 | ||
@@ -347,21 +338,18 @@ acpi_rs_extended_irq_resource ( | |||
347 | * - Edge/Level are defined opposite in the table vs the headers | 338 | * - Edge/Level are defined opposite in the table vs the headers |
348 | */ | 339 | */ |
349 | output_struct->data.extended_irq.edge_level = | 340 | output_struct->data.extended_irq.edge_level = |
350 | (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; | 341 | (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; |
342 | |||
343 | /* Check Interrupt Polarity */ | ||
351 | 344 | ||
352 | /* | ||
353 | * Check Interrupt Polarity | ||
354 | */ | ||
355 | output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; | 345 | output_struct->data.extended_irq.active_high_low = (temp8 >> 2) & 0x1; |
356 | 346 | ||
357 | /* | 347 | /* Check for sharable */ |
358 | * Check for sharable | 348 | |
359 | */ | ||
360 | output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; | 349 | output_struct->data.extended_irq.shared_exclusive = (temp8 >> 3) & 0x01; |
361 | 350 | ||
362 | /* | 351 | /* Point to Byte4 (IRQ Table length) */ |
363 | * Point to Byte4 (IRQ Table length) | 352 | |
364 | */ | ||
365 | buffer += 1; | 353 | buffer += 1; |
366 | temp8 = *buffer; | 354 | temp8 = *buffer; |
367 | 355 | ||
@@ -379,14 +367,12 @@ acpi_rs_extended_irq_resource ( | |||
379 | */ | 367 | */ |
380 | struct_size += (temp8 - 1) * 4; | 368 | struct_size += (temp8 - 1) * 4; |
381 | 369 | ||
382 | /* | 370 | /* Point to Byte5 (First IRQ Number) */ |
383 | * Point to Byte5 (First IRQ Number) | 371 | |
384 | */ | ||
385 | buffer += 1; | 372 | buffer += 1; |
386 | 373 | ||
387 | /* | 374 | /* Cycle through every IRQ in the table */ |
388 | * Cycle through every IRQ in the table | 375 | |
389 | */ | ||
390 | for (index = 0; index < temp8; index++) { | 376 | for (index = 0; index < temp8; index++) { |
391 | ACPI_MOVE_32_TO_32 ( | 377 | ACPI_MOVE_32_TO_32 ( |
392 | &output_struct->data.extended_irq.interrupts[index], buffer); | 378 | &output_struct->data.extended_irq.interrupts[index], buffer); |
@@ -407,7 +393,8 @@ acpi_rs_extended_irq_resource ( | |||
407 | * we add 1 to the length. | 393 | * we add 1 to the length. |
408 | */ | 394 | */ |
409 | if (*bytes_consumed > | 395 | if (*bytes_consumed > |
410 | ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + (5 + 1)) { | 396 | ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + |
397 | (5 + 1)) { | ||
411 | /* Dereference the Index */ | 398 | /* Dereference the Index */ |
412 | 399 | ||
413 | temp8 = *buffer; | 400 | temp8 = *buffer; |
@@ -417,13 +404,13 @@ acpi_rs_extended_irq_resource ( | |||
417 | 404 | ||
418 | buffer += 1; | 405 | buffer += 1; |
419 | 406 | ||
420 | /* | 407 | /* Point the String pointer to the end of this structure. */ |
421 | * Point the String pointer to the end of this structure. | 408 | |
422 | */ | ||
423 | output_struct->data.extended_irq.resource_source.string_ptr = | 409 | output_struct->data.extended_irq.resource_source.string_ptr = |
424 | (char *)((char *) output_struct + struct_size); | 410 | (char *)((char *) output_struct + struct_size); |
425 | 411 | ||
426 | temp_ptr = (u8 *) output_struct->data.extended_irq.resource_source.string_ptr; | 412 | temp_ptr = (u8 *) |
413 | output_struct->data.extended_irq.resource_source.string_ptr; | ||
427 | 414 | ||
428 | /* Copy the string into the buffer */ | 415 | /* Copy the string into the buffer */ |
429 | 416 | ||
@@ -436,9 +423,8 @@ acpi_rs_extended_irq_resource ( | |||
436 | index += 1; | 423 | index += 1; |
437 | } | 424 | } |
438 | 425 | ||
439 | /* | 426 | /* Add the terminating null */ |
440 | * Add the terminating null | 427 | |
441 | */ | ||
442 | *temp_ptr = 0x00; | 428 | *temp_ptr = 0x00; |
443 | output_struct->data.extended_irq.resource_source.string_length = index + 1; | 429 | output_struct->data.extended_irq.resource_source.string_length = index + 1; |
444 | 430 | ||
@@ -456,14 +442,12 @@ acpi_rs_extended_irq_resource ( | |||
456 | output_struct->data.extended_irq.resource_source.string_ptr = NULL; | 442 | output_struct->data.extended_irq.resource_source.string_ptr = NULL; |
457 | } | 443 | } |
458 | 444 | ||
459 | /* | 445 | /* Set the Length parameter */ |
460 | * Set the Length parameter | 446 | |
461 | */ | ||
462 | output_struct->length = (u32) struct_size; | 447 | output_struct->length = (u32) struct_size; |
463 | 448 | ||
464 | /* | 449 | /* Return the final size of the structure */ |
465 | * Return the final size of the structure | 450 | |
466 | */ | ||
467 | *structure_size = struct_size; | 451 | *structure_size = struct_size; |
468 | return_ACPI_STATUS (AE_OK); | 452 | return_ACPI_STATUS (AE_OK); |
469 | } | 453 | } |
@@ -501,21 +485,18 @@ acpi_rs_extended_irq_stream ( | |||
501 | ACPI_FUNCTION_TRACE ("rs_extended_irq_stream"); | 485 | ACPI_FUNCTION_TRACE ("rs_extended_irq_stream"); |
502 | 486 | ||
503 | 487 | ||
504 | /* | 488 | /* The descriptor field is static */ |
505 | * The descriptor field is static | 489 | |
506 | */ | ||
507 | *buffer = 0x89; | 490 | *buffer = 0x89; |
508 | buffer += 1; | 491 | buffer += 1; |
509 | 492 | ||
510 | /* | 493 | /* Set a pointer to the Length field - to be filled in later */ |
511 | * Set a pointer to the Length field - to be filled in later | 494 | |
512 | */ | ||
513 | length_field = ACPI_CAST_PTR (u16, buffer); | 495 | length_field = ACPI_CAST_PTR (u16, buffer); |
514 | buffer += 2; | 496 | buffer += 2; |
515 | 497 | ||
516 | /* | 498 | /* Set the Interrupt vector flags */ |
517 | * Set the Interrupt vector flags | 499 | |
518 | */ | ||
519 | temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); | 500 | temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); |
520 | temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); | 501 | temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); |
521 | 502 | ||
@@ -532,17 +513,15 @@ acpi_rs_extended_irq_stream ( | |||
532 | temp8 |= 0x2; | 513 | temp8 |= 0x2; |
533 | } | 514 | } |
534 | 515 | ||
535 | /* | 516 | /* Set the Interrupt Polarity */ |
536 | * Set the Interrupt Polarity | 517 | |
537 | */ | ||
538 | temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); | 518 | temp8 |= ((linked_list->data.extended_irq.active_high_low & 0x1) << 2); |
539 | 519 | ||
540 | *buffer = temp8; | 520 | *buffer = temp8; |
541 | buffer += 1; | 521 | buffer += 1; |
542 | 522 | ||
543 | /* | 523 | /* Set the Interrupt table length */ |
544 | * Set the Interrupt table length | 524 | |
545 | */ | ||
546 | temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; | 525 | temp8 = (u8) linked_list->data.extended_irq.number_of_interrupts; |
547 | 526 | ||
548 | *buffer = temp8; | 527 | *buffer = temp8; |
@@ -555,18 +534,16 @@ acpi_rs_extended_irq_stream ( | |||
555 | buffer += 4; | 534 | buffer += 4; |
556 | } | 535 | } |
557 | 536 | ||
558 | /* | 537 | /* Resource Source Index and Resource Source are optional */ |
559 | * Resource Source Index and Resource Source are optional | 538 | |
560 | */ | ||
561 | if (0 != linked_list->data.extended_irq.resource_source.string_length) { | 539 | if (0 != linked_list->data.extended_irq.resource_source.string_length) { |
562 | *buffer = (u8) linked_list->data.extended_irq.resource_source.index; | 540 | *buffer = (u8) linked_list->data.extended_irq.resource_source.index; |
563 | buffer += 1; | 541 | buffer += 1; |
564 | 542 | ||
565 | temp_pointer = (char *) buffer; | 543 | temp_pointer = (char *) buffer; |
566 | 544 | ||
567 | /* | 545 | /* Copy the string */ |
568 | * Copy the string | 546 | |
569 | */ | ||
570 | ACPI_STRCPY (temp_pointer, | 547 | ACPI_STRCPY (temp_pointer, |
571 | linked_list->data.extended_irq.resource_source.string_ptr); | 548 | linked_list->data.extended_irq.resource_source.string_ptr); |
572 | 549 | ||
@@ -574,12 +551,12 @@ acpi_rs_extended_irq_stream ( | |||
574 | * Buffer needs to be set to the length of the sting + one for the | 551 | * Buffer needs to be set to the length of the sting + one for the |
575 | * terminating null | 552 | * terminating null |
576 | */ | 553 | */ |
577 | buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.extended_irq.resource_source.string_ptr) + 1); | 554 | buffer += (acpi_size) (ACPI_STRLEN ( |
555 | linked_list->data.extended_irq.resource_source.string_ptr) + 1); | ||
578 | } | 556 | } |
579 | 557 | ||
580 | /* | 558 | /* Return the number of bytes consumed in this operation */ |
581 | * Return the number of bytes consumed in this operation | 559 | |
582 | */ | ||
583 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 560 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
584 | 561 | ||
585 | /* | 562 | /* |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index e49c1e030f99..db7bcb4e60e3 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -55,7 +55,7 @@ | |||
55 | * | 55 | * |
56 | * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor | 56 | * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor |
57 | * | 57 | * |
58 | * RETURN: The Resource Type (Name) with no extraneous bits | 58 | * RETURN: The Resource Type with no extraneous bits |
59 | * | 59 | * |
60 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of | 60 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of |
61 | * a resource descriptor. | 61 | * a resource descriptor. |
@@ -70,28 +70,25 @@ acpi_rs_get_resource_type ( | |||
70 | ACPI_FUNCTION_ENTRY (); | 70 | ACPI_FUNCTION_ENTRY (); |
71 | 71 | ||
72 | 72 | ||
73 | /* | 73 | /* Determine if this is a small or large resource */ |
74 | * Determine if this is a small or large resource | 74 | |
75 | */ | ||
76 | switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { | 75 | switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { |
77 | case ACPI_RDESC_TYPE_SMALL: | 76 | case ACPI_RDESC_TYPE_SMALL: |
78 | 77 | ||
79 | /* | 78 | /* Small Resource Type -- Only bits 6:3 are valid */ |
80 | * Small Resource Type -- Only bits 6:3 are valid | 79 | |
81 | */ | ||
82 | return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); | 80 | return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); |
83 | 81 | ||
84 | 82 | ||
85 | case ACPI_RDESC_TYPE_LARGE: | 83 | case ACPI_RDESC_TYPE_LARGE: |
86 | 84 | ||
87 | /* | 85 | /* Large Resource Type -- All bits are valid */ |
88 | * Large Resource Type -- All bits are valid | 86 | |
89 | */ | ||
90 | return (resource_start_byte); | 87 | return (resource_start_byte); |
91 | 88 | ||
92 | 89 | ||
93 | default: | 90 | default: |
94 | /* No other types of resource descriptor */ | 91 | /* Invalid type */ |
95 | break; | 92 | break; |
96 | } | 93 | } |
97 | 94 | ||
@@ -135,9 +132,8 @@ acpi_rs_byte_stream_to_list ( | |||
135 | 132 | ||
136 | while (bytes_parsed < byte_stream_buffer_length && | 133 | while (bytes_parsed < byte_stream_buffer_length && |
137 | !end_tag_processed) { | 134 | !end_tag_processed) { |
138 | /* | 135 | /* The next byte in the stream is the resource type */ |
139 | * The next byte in the stream is the resource type | 136 | |
140 | */ | ||
141 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); | 137 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); |
142 | 138 | ||
143 | switch (resource_type) { | 139 | switch (resource_type) { |
@@ -299,28 +295,23 @@ acpi_rs_byte_stream_to_list ( | |||
299 | return_ACPI_STATUS (status); | 295 | return_ACPI_STATUS (status); |
300 | } | 296 | } |
301 | 297 | ||
302 | /* | 298 | /* Update the return value and counter */ |
303 | * Update the return value and counter | 299 | |
304 | */ | ||
305 | bytes_parsed += bytes_consumed; | 300 | bytes_parsed += bytes_consumed; |
306 | 301 | ||
307 | /* | 302 | /* Set the byte stream to point to the next resource */ |
308 | * Set the byte stream to point to the next resource | 303 | |
309 | */ | ||
310 | byte_stream_buffer += bytes_consumed; | 304 | byte_stream_buffer += bytes_consumed; |
311 | 305 | ||
312 | /* | 306 | /* Set the Buffer to the next structure */ |
313 | * Set the Buffer to the next structure | 307 | |
314 | */ | ||
315 | resource = ACPI_CAST_PTR (struct acpi_resource, buffer); | 308 | resource = ACPI_CAST_PTR (struct acpi_resource, buffer); |
316 | resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); | 309 | resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); |
317 | buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); | 310 | buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); |
311 | } | ||
318 | 312 | ||
319 | } /* end while */ | 313 | /* Check the reason for exiting the while loop */ |
320 | 314 | ||
321 | /* | ||
322 | * Check the reason for exiting the while loop | ||
323 | */ | ||
324 | if (!end_tag_processed) { | 315 | if (!end_tag_processed) { |
325 | return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); | 316 | return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); |
326 | } | 317 | } |
@@ -424,9 +415,8 @@ acpi_rs_list_to_byte_stream ( | |||
424 | */ | 415 | */ |
425 | status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); | 416 | status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); |
426 | 417 | ||
427 | /* | 418 | /* An End Tag indicates the end of the Resource Template */ |
428 | * An End Tag indicates the end of the Resource Template | 419 | |
429 | */ | ||
430 | done = TRUE; | 420 | done = TRUE; |
431 | break; | 421 | break; |
432 | 422 | ||
@@ -488,27 +478,25 @@ acpi_rs_list_to_byte_stream ( | |||
488 | default: | 478 | default: |
489 | /* | 479 | /* |
490 | * If we get here, everything is out of sync, | 480 | * If we get here, everything is out of sync, |
491 | * so exit with an error | 481 | * so exit with an error |
492 | */ | 482 | */ |
493 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", | 483 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
484 | "Invalid descriptor type (%X) in resource list\n", | ||
494 | linked_list->id)); | 485 | linked_list->id)); |
495 | status = AE_BAD_DATA; | 486 | status = AE_BAD_DATA; |
496 | break; | 487 | break; |
497 | 488 | } | |
498 | } /* switch (linked_list->Id) */ | ||
499 | 489 | ||
500 | if (ACPI_FAILURE (status)) { | 490 | if (ACPI_FAILURE (status)) { |
501 | return_ACPI_STATUS (status); | 491 | return_ACPI_STATUS (status); |
502 | } | 492 | } |
503 | 493 | ||
504 | /* | 494 | /* Set the Buffer to point to the open byte */ |
505 | * Set the Buffer to point to the open byte | 495 | |
506 | */ | ||
507 | buffer += bytes_consumed; | 496 | buffer += bytes_consumed; |
508 | 497 | ||
509 | /* | 498 | /* Point to the next object */ |
510 | * Point to the next object | 499 | |
511 | */ | ||
512 | linked_list = ACPI_PTR_ADD (struct acpi_resource, | 500 | linked_list = ACPI_PTR_ADD (struct acpi_resource, |
513 | linked_list, linked_list->length); | 501 | linked_list, linked_list->length); |
514 | } | 502 | } |
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 7c935aecf075..91d0207f01ac 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c | |||
@@ -81,15 +81,15 @@ acpi_rs_memory24_resource ( | |||
81 | struct acpi_resource *output_struct = (void *) *output_buffer; | 81 | struct acpi_resource *output_struct = (void *) *output_buffer; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | u8 temp8 = 0; | 83 | u8 temp8 = 0; |
84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem24); | 84 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
85 | struct acpi_resource_mem24); | ||
85 | 86 | ||
86 | 87 | ||
87 | ACPI_FUNCTION_TRACE ("rs_memory24_resource"); | 88 | ACPI_FUNCTION_TRACE ("rs_memory24_resource"); |
88 | 89 | ||
89 | 90 | ||
90 | /* | 91 | /* Point past the Descriptor to get the number of bytes consumed */ |
91 | * Point past the Descriptor to get the number of bytes consumed | 92 | |
92 | */ | ||
93 | buffer += 1; | 93 | buffer += 1; |
94 | 94 | ||
95 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 95 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
@@ -97,48 +97,41 @@ acpi_rs_memory24_resource ( | |||
97 | *bytes_consumed = (acpi_size) temp16 + 3; | 97 | *bytes_consumed = (acpi_size) temp16 + 3; |
98 | output_struct->id = ACPI_RSTYPE_MEM24; | 98 | output_struct->id = ACPI_RSTYPE_MEM24; |
99 | 99 | ||
100 | /* | 100 | /* Check Byte 3 the Read/Write bit */ |
101 | * Check Byte 3 the Read/Write bit | 101 | |
102 | */ | ||
103 | temp8 = *buffer; | 102 | temp8 = *buffer; |
104 | buffer += 1; | 103 | buffer += 1; |
105 | output_struct->data.memory24.read_write_attribute = temp8 & 0x01; | 104 | output_struct->data.memory24.read_write_attribute = temp8 & 0x01; |
106 | 105 | ||
107 | /* | 106 | /* Get min_base_address (Bytes 4-5) */ |
108 | * Get min_base_address (Bytes 4-5) | 107 | |
109 | */ | ||
110 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 108 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
111 | buffer += 2; | 109 | buffer += 2; |
112 | output_struct->data.memory24.min_base_address = temp16; | 110 | output_struct->data.memory24.min_base_address = temp16; |
113 | 111 | ||
114 | /* | 112 | /* Get max_base_address (Bytes 6-7) */ |
115 | * Get max_base_address (Bytes 6-7) | 113 | |
116 | */ | ||
117 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 114 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
118 | buffer += 2; | 115 | buffer += 2; |
119 | output_struct->data.memory24.max_base_address = temp16; | 116 | output_struct->data.memory24.max_base_address = temp16; |
120 | 117 | ||
121 | /* | 118 | /* Get Alignment (Bytes 8-9) */ |
122 | * Get Alignment (Bytes 8-9) | 119 | |
123 | */ | ||
124 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 120 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
125 | buffer += 2; | 121 | buffer += 2; |
126 | output_struct->data.memory24.alignment = temp16; | 122 | output_struct->data.memory24.alignment = temp16; |
127 | 123 | ||
128 | /* | 124 | /* Get range_length (Bytes 10-11) */ |
129 | * Get range_length (Bytes 10-11) | 125 | |
130 | */ | ||
131 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 126 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
132 | output_struct->data.memory24.range_length = temp16; | 127 | output_struct->data.memory24.range_length = temp16; |
133 | 128 | ||
134 | /* | 129 | /* Set the Length parameter */ |
135 | * Set the Length parameter | 130 | |
136 | */ | ||
137 | output_struct->length = (u32) struct_size; | 131 | output_struct->length = (u32) struct_size; |
138 | 132 | ||
139 | /* | 133 | /* Return the final size of the structure */ |
140 | * Return the final size of the structure | 134 | |
141 | */ | ||
142 | *structure_size = struct_size; | 135 | *structure_size = struct_size; |
143 | return_ACPI_STATUS (AE_OK); | 136 | return_ACPI_STATUS (AE_OK); |
144 | } | 137 | } |
@@ -174,53 +167,45 @@ acpi_rs_memory24_stream ( | |||
174 | ACPI_FUNCTION_TRACE ("rs_memory24_stream"); | 167 | ACPI_FUNCTION_TRACE ("rs_memory24_stream"); |
175 | 168 | ||
176 | 169 | ||
177 | /* | 170 | /* The descriptor field is static */ |
178 | * The descriptor field is static | 171 | |
179 | */ | ||
180 | *buffer = 0x81; | 172 | *buffer = 0x81; |
181 | buffer += 1; | 173 | buffer += 1; |
182 | 174 | ||
183 | /* | 175 | /* The length field is static */ |
184 | * The length field is static | 176 | |
185 | */ | ||
186 | temp16 = 0x09; | 177 | temp16 = 0x09; |
187 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 178 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
188 | buffer += 2; | 179 | buffer += 2; |
189 | 180 | ||
190 | /* | 181 | /* Set the Information Byte */ |
191 | * Set the Information Byte | 182 | |
192 | */ | ||
193 | temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); | 183 | temp8 = (u8) (linked_list->data.memory24.read_write_attribute & 0x01); |
194 | *buffer = temp8; | 184 | *buffer = temp8; |
195 | buffer += 1; | 185 | buffer += 1; |
196 | 186 | ||
197 | /* | 187 | /* Set the Range minimum base address */ |
198 | * Set the Range minimum base address | 188 | |
199 | */ | ||
200 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); | 189 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); |
201 | buffer += 2; | 190 | buffer += 2; |
202 | 191 | ||
203 | /* | 192 | /* Set the Range maximum base address */ |
204 | * Set the Range maximum base address | 193 | |
205 | */ | ||
206 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); | 194 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); |
207 | buffer += 2; | 195 | buffer += 2; |
208 | 196 | ||
209 | /* | 197 | /* Set the base alignment */ |
210 | * Set the base alignment | 198 | |
211 | */ | ||
212 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); | 199 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); |
213 | buffer += 2; | 200 | buffer += 2; |
214 | 201 | ||
215 | /* | 202 | /* Set the range length */ |
216 | * Set the range length | 203 | |
217 | */ | ||
218 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); | 204 | ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); |
219 | buffer += 2; | 205 | buffer += 2; |
220 | 206 | ||
221 | /* | 207 | /* Return the number of bytes consumed in this operation */ |
222 | * Return the number of bytes consumed in this operation | 208 | |
223 | */ | ||
224 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 209 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
225 | return_ACPI_STATUS (AE_OK); | 210 | return_ACPI_STATUS (AE_OK); |
226 | } | 211 | } |
@@ -258,15 +243,15 @@ acpi_rs_memory32_range_resource ( | |||
258 | struct acpi_resource *output_struct = (void *) *output_buffer; | 243 | struct acpi_resource *output_struct = (void *) *output_buffer; |
259 | u16 temp16 = 0; | 244 | u16 temp16 = 0; |
260 | u8 temp8 = 0; | 245 | u8 temp8 = 0; |
261 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); | 246 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
247 | struct acpi_resource_mem32); | ||
262 | 248 | ||
263 | 249 | ||
264 | ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); | 250 | ACPI_FUNCTION_TRACE ("rs_memory32_range_resource"); |
265 | 251 | ||
266 | 252 | ||
267 | /* | 253 | /* Point past the Descriptor to get the number of bytes consumed */ |
268 | * Point past the Descriptor to get the number of bytes consumed | 254 | |
269 | */ | ||
270 | buffer += 1; | 255 | buffer += 1; |
271 | 256 | ||
272 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 257 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
@@ -285,45 +270,38 @@ acpi_rs_memory32_range_resource ( | |||
285 | * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) | 270 | * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(u8) |
286 | */ | 271 | */ |
287 | 272 | ||
288 | /* | 273 | /* Check Byte 3 the Read/Write bit */ |
289 | * Check Byte 3 the Read/Write bit | 274 | |
290 | */ | ||
291 | temp8 = *buffer; | 275 | temp8 = *buffer; |
292 | buffer += 1; | 276 | buffer += 1; |
293 | 277 | ||
294 | output_struct->data.memory32.read_write_attribute = temp8 & 0x01; | 278 | output_struct->data.memory32.read_write_attribute = temp8 & 0x01; |
295 | 279 | ||
296 | /* | 280 | /* Get min_base_address (Bytes 4-7) */ |
297 | * Get min_base_address (Bytes 4-7) | 281 | |
298 | */ | ||
299 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); | 282 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); |
300 | buffer += 4; | 283 | buffer += 4; |
301 | 284 | ||
302 | /* | 285 | /* Get max_base_address (Bytes 8-11) */ |
303 | * Get max_base_address (Bytes 8-11) | 286 | |
304 | */ | ||
305 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); | 287 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); |
306 | buffer += 4; | 288 | buffer += 4; |
307 | 289 | ||
308 | /* | 290 | /* Get Alignment (Bytes 12-15) */ |
309 | * Get Alignment (Bytes 12-15) | 291 | |
310 | */ | ||
311 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); | 292 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); |
312 | buffer += 4; | 293 | buffer += 4; |
313 | 294 | ||
314 | /* | 295 | /* Get range_length (Bytes 16-19) */ |
315 | * Get range_length (Bytes 16-19) | 296 | |
316 | */ | ||
317 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); | 297 | ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); |
318 | 298 | ||
319 | /* | 299 | /* Set the Length parameter */ |
320 | * Set the Length parameter | 300 | |
321 | */ | ||
322 | output_struct->length = (u32) struct_size; | 301 | output_struct->length = (u32) struct_size; |
323 | 302 | ||
324 | /* | 303 | /* Return the final size of the structure */ |
325 | * Return the final size of the structure | 304 | |
326 | */ | ||
327 | *structure_size = struct_size; | 305 | *structure_size = struct_size; |
328 | return_ACPI_STATUS (AE_OK); | 306 | return_ACPI_STATUS (AE_OK); |
329 | } | 307 | } |
@@ -361,15 +339,15 @@ acpi_rs_fixed_memory32_resource ( | |||
361 | struct acpi_resource *output_struct = (void *) *output_buffer; | 339 | struct acpi_resource *output_struct = (void *) *output_buffer; |
362 | u16 temp16 = 0; | 340 | u16 temp16 = 0; |
363 | u8 temp8 = 0; | 341 | u8 temp8 = 0; |
364 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32); | 342 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
343 | struct acpi_resource_fixed_mem32); | ||
365 | 344 | ||
366 | 345 | ||
367 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); | 346 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource"); |
368 | 347 | ||
369 | 348 | ||
370 | /* | 349 | /* Point past the Descriptor to get the number of bytes consumed */ |
371 | * Point past the Descriptor to get the number of bytes consumed | 350 | |
372 | */ | ||
373 | buffer += 1; | 351 | buffer += 1; |
374 | ACPI_MOVE_16_TO_16 (&temp16, buffer); | 352 | ACPI_MOVE_16_TO_16 (&temp16, buffer); |
375 | 353 | ||
@@ -378,32 +356,28 @@ acpi_rs_fixed_memory32_resource ( | |||
378 | 356 | ||
379 | output_struct->id = ACPI_RSTYPE_FIXED_MEM32; | 357 | output_struct->id = ACPI_RSTYPE_FIXED_MEM32; |
380 | 358 | ||
381 | /* | 359 | /* Check Byte 3 the Read/Write bit */ |
382 | * Check Byte 3 the Read/Write bit | 360 | |
383 | */ | ||
384 | temp8 = *buffer; | 361 | temp8 = *buffer; |
385 | buffer += 1; | 362 | buffer += 1; |
386 | output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; | 363 | output_struct->data.fixed_memory32.read_write_attribute = temp8 & 0x01; |
387 | 364 | ||
388 | /* | 365 | /* Get range_base_address (Bytes 4-7) */ |
389 | * Get range_base_address (Bytes 4-7) | 366 | |
390 | */ | 367 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, |
391 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, buffer); | 368 | buffer); |
392 | buffer += 4; | 369 | buffer += 4; |
393 | 370 | ||
394 | /* | 371 | /* Get range_length (Bytes 8-11) */ |
395 | * Get range_length (Bytes 8-11) | 372 | |
396 | */ | ||
397 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); | 373 | ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); |
398 | 374 | ||
399 | /* | 375 | /* Set the Length parameter */ |
400 | * Set the Length parameter | 376 | |
401 | */ | ||
402 | output_struct->length = (u32) struct_size; | 377 | output_struct->length = (u32) struct_size; |
403 | 378 | ||
404 | /* | 379 | /* Return the final size of the structure */ |
405 | * Return the final size of the structure | 380 | |
406 | */ | ||
407 | *structure_size = struct_size; | 381 | *structure_size = struct_size; |
408 | return_ACPI_STATUS (AE_OK); | 382 | return_ACPI_STATUS (AE_OK); |
409 | } | 383 | } |
@@ -439,54 +413,46 @@ acpi_rs_memory32_range_stream ( | |||
439 | ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); | 413 | ACPI_FUNCTION_TRACE ("rs_memory32_range_stream"); |
440 | 414 | ||
441 | 415 | ||
442 | /* | 416 | /* The descriptor field is static */ |
443 | * The descriptor field is static | 417 | |
444 | */ | ||
445 | *buffer = 0x85; | 418 | *buffer = 0x85; |
446 | buffer += 1; | 419 | buffer += 1; |
447 | 420 | ||
448 | /* | 421 | /* The length field is static */ |
449 | * The length field is static | 422 | |
450 | */ | ||
451 | temp16 = 0x11; | 423 | temp16 = 0x11; |
452 | 424 | ||
453 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 425 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
454 | buffer += 2; | 426 | buffer += 2; |
455 | 427 | ||
456 | /* | 428 | /* Set the Information Byte */ |
457 | * Set the Information Byte | 429 | |
458 | */ | ||
459 | temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); | 430 | temp8 = (u8) (linked_list->data.memory32.read_write_attribute & 0x01); |
460 | *buffer = temp8; | 431 | *buffer = temp8; |
461 | buffer += 1; | 432 | buffer += 1; |
462 | 433 | ||
463 | /* | 434 | /* Set the Range minimum base address */ |
464 | * Set the Range minimum base address | 435 | |
465 | */ | ||
466 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); | 436 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); |
467 | buffer += 4; | 437 | buffer += 4; |
468 | 438 | ||
469 | /* | 439 | /* Set the Range maximum base address */ |
470 | * Set the Range maximum base address | 440 | |
471 | */ | ||
472 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); | 441 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); |
473 | buffer += 4; | 442 | buffer += 4; |
474 | 443 | ||
475 | /* | 444 | /* Set the base alignment */ |
476 | * Set the base alignment | 445 | |
477 | */ | ||
478 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); | 446 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); |
479 | buffer += 4; | 447 | buffer += 4; |
480 | 448 | ||
481 | /* | 449 | /* Set the range length */ |
482 | * Set the range length | 450 | |
483 | */ | ||
484 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); | 451 | ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); |
485 | buffer += 4; | 452 | buffer += 4; |
486 | 453 | ||
487 | /* | 454 | /* Return the number of bytes consumed in this operation */ |
488 | * Return the number of bytes consumed in this operation | 455 | |
489 | */ | ||
490 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 456 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
491 | return_ACPI_STATUS (AE_OK); | 457 | return_ACPI_STATUS (AE_OK); |
492 | } | 458 | } |
@@ -522,44 +488,38 @@ acpi_rs_fixed_memory32_stream ( | |||
522 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); | 488 | ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream"); |
523 | 489 | ||
524 | 490 | ||
525 | /* | 491 | /* The descriptor field is static */ |
526 | * The descriptor field is static | 492 | |
527 | */ | ||
528 | *buffer = 0x86; | 493 | *buffer = 0x86; |
529 | buffer += 1; | 494 | buffer += 1; |
530 | 495 | ||
531 | /* | 496 | /* The length field is static */ |
532 | * The length field is static | 497 | |
533 | */ | ||
534 | temp16 = 0x09; | 498 | temp16 = 0x09; |
535 | 499 | ||
536 | ACPI_MOVE_16_TO_16 (buffer, &temp16); | 500 | ACPI_MOVE_16_TO_16 (buffer, &temp16); |
537 | buffer += 2; | 501 | buffer += 2; |
538 | 502 | ||
539 | /* | 503 | /* Set the Information Byte */ |
540 | * Set the Information Byte | 504 | |
541 | */ | ||
542 | temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); | 505 | temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); |
543 | *buffer = temp8; | 506 | *buffer = temp8; |
544 | buffer += 1; | 507 | buffer += 1; |
545 | 508 | ||
546 | /* | 509 | /* Set the Range base address */ |
547 | * Set the Range base address | 510 | |
548 | */ | ||
549 | ACPI_MOVE_32_TO_32 (buffer, | 511 | ACPI_MOVE_32_TO_32 (buffer, |
550 | &linked_list->data.fixed_memory32.range_base_address); | 512 | &linked_list->data.fixed_memory32.range_base_address); |
551 | buffer += 4; | 513 | buffer += 4; |
552 | 514 | ||
553 | /* | 515 | /* Set the range length */ |
554 | * Set the range length | 516 | |
555 | */ | ||
556 | ACPI_MOVE_32_TO_32 (buffer, | 517 | ACPI_MOVE_32_TO_32 (buffer, |
557 | &linked_list->data.fixed_memory32.range_length); | 518 | &linked_list->data.fixed_memory32.range_length); |
558 | buffer += 4; | 519 | buffer += 4; |
559 | 520 | ||
560 | /* | 521 | /* Return the number of bytes consumed in this operation */ |
561 | * Return the number of bytes consumed in this operation | 522 | |
562 | */ | ||
563 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 523 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
564 | return_ACPI_STATUS (AE_OK); | 524 | return_ACPI_STATUS (AE_OK); |
565 | } | 525 | } |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index d16be44b5df7..a1f1741f0d83 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -84,24 +84,20 @@ acpi_rs_end_tag_resource ( | |||
84 | ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); | 84 | ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); |
85 | 85 | ||
86 | 86 | ||
87 | /* | 87 | /* The number of bytes consumed is static */ |
88 | * The number of bytes consumed is static | 88 | |
89 | */ | ||
90 | *bytes_consumed = 2; | 89 | *bytes_consumed = 2; |
91 | 90 | ||
92 | /* | 91 | /* Fill out the structure */ |
93 | * Fill out the structure | 92 | |
94 | */ | ||
95 | output_struct->id = ACPI_RSTYPE_END_TAG; | 93 | output_struct->id = ACPI_RSTYPE_END_TAG; |
96 | 94 | ||
97 | /* | 95 | /* Set the Length parameter */ |
98 | * Set the Length parameter | 96 | |
99 | */ | ||
100 | output_struct->length = 0; | 97 | output_struct->length = 0; |
101 | 98 | ||
102 | /* | 99 | /* Return the final size of the structure */ |
103 | * Return the final size of the structure | 100 | |
104 | */ | ||
105 | *structure_size = struct_size; | 101 | *structure_size = struct_size; |
106 | return_ACPI_STATUS (AE_OK); | 102 | return_ACPI_STATUS (AE_OK); |
107 | } | 103 | } |
@@ -136,9 +132,8 @@ acpi_rs_end_tag_stream ( | |||
136 | ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); | 132 | ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); |
137 | 133 | ||
138 | 134 | ||
139 | /* | 135 | /* The descriptor field is static */ |
140 | * The descriptor field is static | 136 | |
141 | */ | ||
142 | *buffer = 0x79; | 137 | *buffer = 0x79; |
143 | buffer += 1; | 138 | buffer += 1; |
144 | 139 | ||
@@ -151,9 +146,8 @@ acpi_rs_end_tag_stream ( | |||
151 | *buffer = temp8; | 146 | *buffer = temp8; |
152 | buffer += 1; | 147 | buffer += 1; |
153 | 148 | ||
154 | /* | 149 | /* Return the number of bytes consumed in this operation */ |
155 | * Return the number of bytes consumed in this operation | 150 | |
156 | */ | ||
157 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 151 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
158 | return_ACPI_STATUS (AE_OK); | 152 | return_ACPI_STATUS (AE_OK); |
159 | } | 153 | } |
@@ -192,21 +186,20 @@ acpi_rs_vendor_resource ( | |||
192 | u16 temp16 = 0; | 186 | u16 temp16 = 0; |
193 | u8 temp8 = 0; | 187 | u8 temp8 = 0; |
194 | u8 index; | 188 | u8 index; |
195 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor); | 189 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
190 | struct acpi_resource_vendor); | ||
196 | 191 | ||
197 | 192 | ||
198 | ACPI_FUNCTION_TRACE ("rs_vendor_resource"); | 193 | ACPI_FUNCTION_TRACE ("rs_vendor_resource"); |
199 | 194 | ||
200 | 195 | ||
201 | /* | 196 | /* Dereference the Descriptor to find if this is a large or small item. */ |
202 | * Dereference the Descriptor to find if this is a large or small item. | 197 | |
203 | */ | ||
204 | temp8 = *buffer; | 198 | temp8 = *buffer; |
205 | 199 | ||
206 | if (temp8 & 0x80) { | 200 | if (temp8 & 0x80) { |
207 | /* | 201 | /* Large Item, point to the length field */ |
208 | * Large Item, point to the length field | 202 | |
209 | */ | ||
210 | buffer += 1; | 203 | buffer += 1; |
211 | 204 | ||
212 | /* Dereference */ | 205 | /* Dereference */ |
@@ -222,9 +215,8 @@ acpi_rs_vendor_resource ( | |||
222 | buffer += 2; | 215 | buffer += 2; |
223 | } | 216 | } |
224 | else { | 217 | else { |
225 | /* | 218 | /* Small Item, dereference the size */ |
226 | * Small Item, dereference the size | 219 | |
227 | */ | ||
228 | temp16 = (u8)(*buffer & 0x07); | 220 | temp16 = (u8)(*buffer & 0x07); |
229 | 221 | ||
230 | /* Calculate bytes consumed */ | 222 | /* Calculate bytes consumed */ |
@@ -251,14 +243,12 @@ acpi_rs_vendor_resource ( | |||
251 | */ | 243 | */ |
252 | struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); | 244 | struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); |
253 | 245 | ||
254 | /* | 246 | /* Set the Length parameter */ |
255 | * Set the Length parameter | 247 | |
256 | */ | ||
257 | output_struct->length = (u32) struct_size; | 248 | output_struct->length = (u32) struct_size; |
258 | 249 | ||
259 | /* | 250 | /* Return the final size of the structure */ |
260 | * Return the final size of the structure | 251 | |
261 | */ | ||
262 | *structure_size = struct_size; | 252 | *structure_size = struct_size; |
263 | return_ACPI_STATUS (AE_OK); | 253 | return_ACPI_STATUS (AE_OK); |
264 | } | 254 | } |
@@ -295,13 +285,11 @@ acpi_rs_vendor_stream ( | |||
295 | ACPI_FUNCTION_TRACE ("rs_vendor_stream"); | 285 | ACPI_FUNCTION_TRACE ("rs_vendor_stream"); |
296 | 286 | ||
297 | 287 | ||
298 | /* | 288 | /* Dereference the length to find if this is a large or small item. */ |
299 | * Dereference the length to find if this is a large or small item. | 289 | |
300 | */ | ||
301 | if(linked_list->data.vendor_specific.length > 7) { | 290 | if(linked_list->data.vendor_specific.length > 7) { |
302 | /* | 291 | /* Large Item, Set the descriptor field and length bytes */ |
303 | * Large Item, Set the descriptor field and length bytes | 292 | |
304 | */ | ||
305 | *buffer = 0x84; | 293 | *buffer = 0x84; |
306 | buffer += 1; | 294 | buffer += 1; |
307 | 295 | ||
@@ -311,9 +299,8 @@ acpi_rs_vendor_stream ( | |||
311 | buffer += 2; | 299 | buffer += 2; |
312 | } | 300 | } |
313 | else { | 301 | else { |
314 | /* | 302 | /* Small Item, Set the descriptor field */ |
315 | * Small Item, Set the descriptor field | 303 | |
316 | */ | ||
317 | temp8 = 0x70; | 304 | temp8 = 0x70; |
318 | temp8 |= (u8) linked_list->data.vendor_specific.length; | 305 | temp8 |= (u8) linked_list->data.vendor_specific.length; |
319 | 306 | ||
@@ -321,9 +308,8 @@ acpi_rs_vendor_stream ( | |||
321 | buffer += 1; | 308 | buffer += 1; |
322 | } | 309 | } |
323 | 310 | ||
324 | /* | 311 | /* Loop through all of the Vendor Specific fields */ |
325 | * Loop through all of the Vendor Specific fields | 312 | |
326 | */ | ||
327 | for (index = 0; index < linked_list->data.vendor_specific.length; index++) { | 313 | for (index = 0; index < linked_list->data.vendor_specific.length; index++) { |
328 | temp8 = linked_list->data.vendor_specific.reserved[index]; | 314 | temp8 = linked_list->data.vendor_specific.reserved[index]; |
329 | 315 | ||
@@ -331,9 +317,8 @@ acpi_rs_vendor_stream ( | |||
331 | buffer += 1; | 317 | buffer += 1; |
332 | } | 318 | } |
333 | 319 | ||
334 | /* | 320 | /* Return the number of bytes consumed in this operation */ |
335 | * Return the number of bytes consumed in this operation | 321 | |
336 | */ | ||
337 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 322 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
338 | return_ACPI_STATUS (AE_OK); | 323 | return_ACPI_STATUS (AE_OK); |
339 | } | 324 | } |
@@ -370,40 +355,37 @@ acpi_rs_start_depend_fns_resource ( | |||
370 | u8 *buffer = byte_stream_buffer; | 355 | u8 *buffer = byte_stream_buffer; |
371 | struct acpi_resource *output_struct = (void *) *output_buffer; | 356 | struct acpi_resource *output_struct = (void *) *output_buffer; |
372 | u8 temp8 = 0; | 357 | u8 temp8 = 0; |
373 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf); | 358 | acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( |
359 | struct acpi_resource_start_dpf); | ||
374 | 360 | ||
375 | 361 | ||
376 | ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); | 362 | ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); |
377 | 363 | ||
378 | 364 | ||
379 | /* | 365 | /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ |
380 | * The number of bytes consumed are contained in the descriptor (Bits:0-1) | 366 | |
381 | */ | ||
382 | temp8 = *buffer; | 367 | temp8 = *buffer; |
383 | 368 | ||
384 | *bytes_consumed = (temp8 & 0x01) + 1; | 369 | *bytes_consumed = (temp8 & 0x01) + 1; |
385 | 370 | ||
386 | output_struct->id = ACPI_RSTYPE_START_DPF; | 371 | output_struct->id = ACPI_RSTYPE_START_DPF; |
387 | 372 | ||
388 | /* | 373 | /* Point to Byte 1 if it is used */ |
389 | * Point to Byte 1 if it is used | 374 | |
390 | */ | ||
391 | if (2 == *bytes_consumed) { | 375 | if (2 == *bytes_consumed) { |
392 | buffer += 1; | 376 | buffer += 1; |
393 | temp8 = *buffer; | 377 | temp8 = *buffer; |
394 | 378 | ||
395 | /* | 379 | /* Check Compatibility priority */ |
396 | * Check Compatibility priority | 380 | |
397 | */ | ||
398 | output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; | 381 | output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; |
399 | 382 | ||
400 | if (3 == output_struct->data.start_dpf.compatibility_priority) { | 383 | if (3 == output_struct->data.start_dpf.compatibility_priority) { |
401 | return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); | 384 | return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); |
402 | } | 385 | } |
403 | 386 | ||
404 | /* | 387 | /* Check Performance/Robustness preference */ |
405 | * Check Performance/Robustness preference | 388 | |
406 | */ | ||
407 | output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; | 389 | output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; |
408 | 390 | ||
409 | if (3 == output_struct->data.start_dpf.performance_robustness) { | 391 | if (3 == output_struct->data.start_dpf.performance_robustness) { |
@@ -412,20 +394,18 @@ acpi_rs_start_depend_fns_resource ( | |||
412 | } | 394 | } |
413 | else { | 395 | else { |
414 | output_struct->data.start_dpf.compatibility_priority = | 396 | output_struct->data.start_dpf.compatibility_priority = |
415 | ACPI_ACCEPTABLE_CONFIGURATION; | 397 | ACPI_ACCEPTABLE_CONFIGURATION; |
416 | 398 | ||
417 | output_struct->data.start_dpf.performance_robustness = | 399 | output_struct->data.start_dpf.performance_robustness = |
418 | ACPI_ACCEPTABLE_CONFIGURATION; | 400 | ACPI_ACCEPTABLE_CONFIGURATION; |
419 | } | 401 | } |
420 | 402 | ||
421 | /* | 403 | /* Set the Length parameter */ |
422 | * Set the Length parameter | 404 | |
423 | */ | ||
424 | output_struct->length = (u32) struct_size; | 405 | output_struct->length = (u32) struct_size; |
425 | 406 | ||
426 | /* | 407 | /* Return the final size of the structure */ |
427 | * Return the final size of the structure | 408 | |
428 | */ | ||
429 | *structure_size = struct_size; | 409 | *structure_size = struct_size; |
430 | return_ACPI_STATUS (AE_OK); | 410 | return_ACPI_STATUS (AE_OK); |
431 | } | 411 | } |
@@ -466,24 +446,20 @@ acpi_rs_end_depend_fns_resource ( | |||
466 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); | 446 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); |
467 | 447 | ||
468 | 448 | ||
469 | /* | 449 | /* The number of bytes consumed is static */ |
470 | * The number of bytes consumed is static | 450 | |
471 | */ | ||
472 | *bytes_consumed = 1; | 451 | *bytes_consumed = 1; |
473 | 452 | ||
474 | /* | 453 | /* Fill out the structure */ |
475 | * Fill out the structure | 454 | |
476 | */ | ||
477 | output_struct->id = ACPI_RSTYPE_END_DPF; | 455 | output_struct->id = ACPI_RSTYPE_END_DPF; |
478 | 456 | ||
479 | /* | 457 | /* Set the Length parameter */ |
480 | * Set the Length parameter | 458 | |
481 | */ | ||
482 | output_struct->length = (u32) struct_size; | 459 | output_struct->length = (u32) struct_size; |
483 | 460 | ||
484 | /* | 461 | /* Return the final size of the structure */ |
485 | * Return the final size of the structure | 462 | |
486 | */ | ||
487 | *structure_size = struct_size; | 463 | *structure_size = struct_size; |
488 | return_ACPI_STATUS (AE_OK); | 464 | return_ACPI_STATUS (AE_OK); |
489 | } | 465 | } |
@@ -533,9 +509,8 @@ acpi_rs_start_depend_fns_stream ( | |||
533 | *buffer = 0x31; | 509 | *buffer = 0x31; |
534 | buffer += 1; | 510 | buffer += 1; |
535 | 511 | ||
536 | /* | 512 | /* Set the Priority Byte Definition */ |
537 | * Set the Priority Byte Definition | 513 | |
538 | */ | ||
539 | temp8 = 0; | 514 | temp8 = 0; |
540 | temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & | 515 | temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & |
541 | 0x03) << 2); | 516 | 0x03) << 2); |
@@ -546,9 +521,8 @@ acpi_rs_start_depend_fns_stream ( | |||
546 | 521 | ||
547 | buffer += 1; | 522 | buffer += 1; |
548 | 523 | ||
549 | /* | 524 | /* Return the number of bytes consumed in this operation */ |
550 | * Return the number of bytes consumed in this operation | 525 | |
551 | */ | ||
552 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 526 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
553 | return_ACPI_STATUS (AE_OK); | 527 | return_ACPI_STATUS (AE_OK); |
554 | } | 528 | } |
@@ -582,15 +556,13 @@ acpi_rs_end_depend_fns_stream ( | |||
582 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); | 556 | ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); |
583 | 557 | ||
584 | 558 | ||
585 | /* | 559 | /* The descriptor field is static */ |
586 | * The descriptor field is static | 560 | |
587 | */ | ||
588 | *buffer = 0x38; | 561 | *buffer = 0x38; |
589 | buffer += 1; | 562 | buffer += 1; |
590 | 563 | ||
591 | /* | 564 | /* Return the number of bytes consumed in this operation */ |
592 | * Return the number of bytes consumed in this operation | 565 | |
593 | */ | ||
594 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); | 566 | *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); |
595 | return_ACPI_STATUS (AE_OK); | 567 | return_ACPI_STATUS (AE_OK); |
596 | } | 568 | } |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index ee9ce13c053d..700cf7d65d76 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -83,10 +83,10 @@ acpi_rs_get_prt_method_data ( | |||
83 | 83 | ||
84 | /* Parameters guaranteed valid by caller */ | 84 | /* Parameters guaranteed valid by caller */ |
85 | 85 | ||
86 | /* | 86 | /* Execute the method, no parameters */ |
87 | * Execute the method, no parameters | 87 | |
88 | */ | 88 | status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRT, |
89 | status = acpi_ut_evaluate_object (handle, "_PRT", ACPI_BTYPE_PACKAGE, &obj_desc); | 89 | ACPI_BTYPE_PACKAGE, &obj_desc); |
90 | if (ACPI_FAILURE (status)) { | 90 | if (ACPI_FAILURE (status)) { |
91 | return_ACPI_STATUS (status); | 91 | return_ACPI_STATUS (status); |
92 | } | 92 | } |
@@ -136,10 +136,10 @@ acpi_rs_get_crs_method_data ( | |||
136 | 136 | ||
137 | /* Parameters guaranteed valid by caller */ | 137 | /* Parameters guaranteed valid by caller */ |
138 | 138 | ||
139 | /* | 139 | /* Execute the method, no parameters */ |
140 | * Execute the method, no parameters | 140 | |
141 | */ | 141 | status = acpi_ut_evaluate_object (handle, METHOD_NAME__CRS, |
142 | status = acpi_ut_evaluate_object (handle, "_CRS", ACPI_BTYPE_BUFFER, &obj_desc); | 142 | ACPI_BTYPE_BUFFER, &obj_desc); |
143 | if (ACPI_FAILURE (status)) { | 143 | if (ACPI_FAILURE (status)) { |
144 | return_ACPI_STATUS (status); | 144 | return_ACPI_STATUS (status); |
145 | } | 145 | } |
@@ -175,6 +175,7 @@ acpi_rs_get_crs_method_data ( | |||
175 | * and the contents of the callers buffer is undefined. | 175 | * and the contents of the callers buffer is undefined. |
176 | * | 176 | * |
177 | ******************************************************************************/ | 177 | ******************************************************************************/ |
178 | |||
178 | #ifdef ACPI_FUTURE_USAGE | 179 | #ifdef ACPI_FUTURE_USAGE |
179 | acpi_status | 180 | acpi_status |
180 | acpi_rs_get_prs_method_data ( | 181 | acpi_rs_get_prs_method_data ( |
@@ -190,10 +191,10 @@ acpi_rs_get_prs_method_data ( | |||
190 | 191 | ||
191 | /* Parameters guaranteed valid by caller */ | 192 | /* Parameters guaranteed valid by caller */ |
192 | 193 | ||
193 | /* | 194 | /* Execute the method, no parameters */ |
194 | * Execute the method, no parameters | 195 | |
195 | */ | 196 | status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRS, |
196 | status = acpi_ut_evaluate_object (handle, "_PRS", ACPI_BTYPE_BUFFER, &obj_desc); | 197 | ACPI_BTYPE_BUFFER, &obj_desc); |
197 | if (ACPI_FAILURE (status)) { | 198 | if (ACPI_FAILURE (status)) { |
198 | return_ACPI_STATUS (status); | 199 | return_ACPI_STATUS (status); |
199 | } | 200 | } |
@@ -218,6 +219,7 @@ acpi_rs_get_prs_method_data ( | |||
218 | * FUNCTION: acpi_rs_get_method_data | 219 | * FUNCTION: acpi_rs_get_method_data |
219 | * | 220 | * |
220 | * PARAMETERS: Handle - a handle to the containing object | 221 | * PARAMETERS: Handle - a handle to the containing object |
222 | * Path - Path to method, relative to Handle | ||
221 | * ret_buffer - a pointer to a buffer structure for the | 223 | * ret_buffer - a pointer to a buffer structure for the |
222 | * results | 224 | * results |
223 | * | 225 | * |
@@ -246,9 +248,8 @@ acpi_rs_get_method_data ( | |||
246 | 248 | ||
247 | /* Parameters guaranteed valid by caller */ | 249 | /* Parameters guaranteed valid by caller */ |
248 | 250 | ||
249 | /* | 251 | /* Execute the method, no parameters */ |
250 | * Execute the method, no parameters | 252 | |
251 | */ | ||
252 | status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); | 253 | status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); |
253 | if (ACPI_FAILURE (status)) { | 254 | if (ACPI_FAILURE (status)) { |
254 | return_ACPI_STATUS (status); | 255 | return_ACPI_STATUS (status); |
@@ -314,18 +315,16 @@ acpi_rs_set_srs_method_data ( | |||
314 | return_ACPI_STATUS (status); | 315 | return_ACPI_STATUS (status); |
315 | } | 316 | } |
316 | 317 | ||
317 | /* | 318 | /* Init the param object */ |
318 | * Init the param object | 319 | |
319 | */ | ||
320 | params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); | 320 | params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); |
321 | if (!params[0]) { | 321 | if (!params[0]) { |
322 | acpi_os_free (buffer.pointer); | 322 | acpi_os_free (buffer.pointer); |
323 | return_ACPI_STATUS (AE_NO_MEMORY); | 323 | return_ACPI_STATUS (AE_NO_MEMORY); |
324 | } | 324 | } |
325 | 325 | ||
326 | /* | 326 | /* Set up the parameter object */ |
327 | * Set up the parameter object | 327 | |
328 | */ | ||
329 | params[0]->buffer.length = (u32) buffer.length; | 328 | params[0]->buffer.length = (u32) buffer.length; |
330 | params[0]->buffer.pointer = buffer.pointer; | 329 | params[0]->buffer.pointer = buffer.pointer; |
331 | params[0]->common.flags = AOPOBJ_DATA_VALID; | 330 | params[0]->common.flags = AOPOBJ_DATA_VALID; |
@@ -335,10 +334,9 @@ acpi_rs_set_srs_method_data ( | |||
335 | info.parameters = params; | 334 | info.parameters = params; |
336 | info.parameter_type = ACPI_PARAM_ARGS; | 335 | info.parameter_type = ACPI_PARAM_ARGS; |
337 | 336 | ||
338 | /* | 337 | /* Execute the method, no return value */ |
339 | * Execute the method, no return value | 338 | |
340 | */ | 339 | status = acpi_ns_evaluate_relative (METHOD_NAME__SRS, &info); |
341 | status = acpi_ns_evaluate_relative ("_SRS", &info); | ||
342 | if (ACPI_SUCCESS (status)) { | 340 | if (ACPI_SUCCESS (status)) { |
343 | /* Delete any return object (especially if implicit_return is enabled) */ | 341 | /* Delete any return object (especially if implicit_return is enabled) */ |
344 | 342 | ||
@@ -347,9 +345,8 @@ acpi_rs_set_srs_method_data ( | |||
347 | } | 345 | } |
348 | } | 346 | } |
349 | 347 | ||
350 | /* | 348 | /* Clean up and return the status from acpi_ns_evaluate_relative */ |
351 | * Clean up and return the status from acpi_ns_evaluate_relative | 349 | |
352 | */ | ||
353 | acpi_ut_remove_reference (params[0]); | 350 | acpi_ut_remove_reference (params[0]); |
354 | return_ACPI_STATUS (status); | 351 | return_ACPI_STATUS (status); |
355 | } | 352 | } |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index a9cdcbeb3432..83c944b8b097 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -49,6 +49,23 @@ | |||
49 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
50 | ACPI_MODULE_NAME ("rsxface") | 50 | ACPI_MODULE_NAME ("rsxface") |
51 | 51 | ||
52 | /* Local macros for 16,32-bit to 64-bit conversion */ | ||
53 | |||
54 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) | ||
55 | #define ACPI_COPY_ADDRESS(out, in) \ | ||
56 | ACPI_COPY_FIELD(out, in, resource_type); \ | ||
57 | ACPI_COPY_FIELD(out, in, producer_consumer); \ | ||
58 | ACPI_COPY_FIELD(out, in, decode); \ | ||
59 | ACPI_COPY_FIELD(out, in, min_address_fixed); \ | ||
60 | ACPI_COPY_FIELD(out, in, max_address_fixed); \ | ||
61 | ACPI_COPY_FIELD(out, in, attribute); \ | ||
62 | ACPI_COPY_FIELD(out, in, granularity); \ | ||
63 | ACPI_COPY_FIELD(out, in, min_address_range); \ | ||
64 | ACPI_COPY_FIELD(out, in, max_address_range); \ | ||
65 | ACPI_COPY_FIELD(out, in, address_translation_offset); \ | ||
66 | ACPI_COPY_FIELD(out, in, address_length); \ | ||
67 | ACPI_COPY_FIELD(out, in, resource_source); | ||
68 | |||
52 | 69 | ||
53 | /******************************************************************************* | 70 | /******************************************************************************* |
54 | * | 71 | * |
@@ -180,6 +197,7 @@ EXPORT_SYMBOL(acpi_get_current_resources); | |||
180 | * and the value of ret_buffer is undefined. | 197 | * and the value of ret_buffer is undefined. |
181 | * | 198 | * |
182 | ******************************************************************************/ | 199 | ******************************************************************************/ |
200 | |||
183 | #ifdef ACPI_FUTURE_USAGE | 201 | #ifdef ACPI_FUTURE_USAGE |
184 | acpi_status | 202 | acpi_status |
185 | acpi_get_possible_resources ( | 203 | acpi_get_possible_resources ( |
@@ -346,9 +364,8 @@ acpi_set_current_resources ( | |||
346 | ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); | 364 | ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); |
347 | 365 | ||
348 | 366 | ||
349 | /* | 367 | /* Must have a valid handle and buffer */ |
350 | * Must have a valid handle and buffer | 368 | |
351 | */ | ||
352 | if ((!device_handle) || | 369 | if ((!device_handle) || |
353 | (!in_buffer) || | 370 | (!in_buffer) || |
354 | (!in_buffer->pointer) || | 371 | (!in_buffer->pointer) || |
@@ -362,21 +379,6 @@ acpi_set_current_resources ( | |||
362 | EXPORT_SYMBOL(acpi_set_current_resources); | 379 | EXPORT_SYMBOL(acpi_set_current_resources); |
363 | 380 | ||
364 | 381 | ||
365 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) | ||
366 | #define ACPI_COPY_ADDRESS(out, in) \ | ||
367 | ACPI_COPY_FIELD(out, in, resource_type); \ | ||
368 | ACPI_COPY_FIELD(out, in, producer_consumer); \ | ||
369 | ACPI_COPY_FIELD(out, in, decode); \ | ||
370 | ACPI_COPY_FIELD(out, in, min_address_fixed); \ | ||
371 | ACPI_COPY_FIELD(out, in, max_address_fixed); \ | ||
372 | ACPI_COPY_FIELD(out, in, attribute); \ | ||
373 | ACPI_COPY_FIELD(out, in, granularity); \ | ||
374 | ACPI_COPY_FIELD(out, in, min_address_range); \ | ||
375 | ACPI_COPY_FIELD(out, in, max_address_range); \ | ||
376 | ACPI_COPY_FIELD(out, in, address_translation_offset); \ | ||
377 | ACPI_COPY_FIELD(out, in, address_length); \ | ||
378 | ACPI_COPY_FIELD(out, in, resource_source); | ||
379 | |||
380 | /****************************************************************************** | 382 | /****************************************************************************** |
381 | * | 383 | * |
382 | * FUNCTION: acpi_resource_to_address64 | 384 | * FUNCTION: acpi_resource_to_address64 |
@@ -408,14 +410,14 @@ acpi_resource_to_address64 ( | |||
408 | case ACPI_RSTYPE_ADDRESS16: | 410 | case ACPI_RSTYPE_ADDRESS16: |
409 | 411 | ||
410 | address16 = (struct acpi_resource_address16 *) &resource->data; | 412 | address16 = (struct acpi_resource_address16 *) &resource->data; |
411 | ACPI_COPY_ADDRESS(out, address16); | 413 | ACPI_COPY_ADDRESS (out, address16); |
412 | break; | 414 | break; |
413 | 415 | ||
414 | 416 | ||
415 | case ACPI_RSTYPE_ADDRESS32: | 417 | case ACPI_RSTYPE_ADDRESS32: |
416 | 418 | ||
417 | address32 = (struct acpi_resource_address32 *) &resource->data; | 419 | address32 = (struct acpi_resource_address32 *) &resource->data; |
418 | ACPI_COPY_ADDRESS(out, address32); | 420 | ACPI_COPY_ADDRESS (out, address32); |
419 | break; | 421 | break; |
420 | 422 | ||
421 | 423 | ||
@@ -434,4 +436,3 @@ acpi_resource_to_address64 ( | |||
434 | return (AE_OK); | 436 | return (AE_OK); |
435 | } | 437 | } |
436 | EXPORT_SYMBOL(acpi_resource_to_address64); | 438 | EXPORT_SYMBOL(acpi_resource_to_address64); |
437 | |||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index e85885593280..cbcda30c172d 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -553,20 +553,29 @@ acpi_bus_driver_init ( | |||
553 | * upon possible configuration and currently allocated resources. | 553 | * upon possible configuration and currently allocated resources. |
554 | */ | 554 | */ |
555 | 555 | ||
556 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n")); | ||
557 | return_VALUE(0); | ||
558 | } | ||
559 | |||
560 | int | ||
561 | acpi_start_single_object ( | ||
562 | struct acpi_device *device) | ||
563 | { | ||
564 | int result = 0; | ||
565 | struct acpi_driver *driver; | ||
566 | |||
567 | ACPI_FUNCTION_TRACE("acpi_start_single_object"); | ||
568 | |||
569 | if (!(driver = device->driver)) | ||
570 | return_VALUE(0); | ||
571 | |||
556 | if (driver->ops.start) { | 572 | if (driver->ops.start) { |
557 | result = driver->ops.start(device); | 573 | result = driver->ops.start(device); |
558 | if (result && driver->ops.remove) | 574 | if (result && driver->ops.remove) |
559 | driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); | 575 | driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); |
560 | return_VALUE(result); | ||
561 | } | ||
562 | |||
563 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n")); | ||
564 | |||
565 | if (driver->ops.scan) { | ||
566 | driver->ops.scan(device); | ||
567 | } | 576 | } |
568 | 577 | ||
569 | return_VALUE(0); | 578 | return_VALUE(result); |
570 | } | 579 | } |
571 | 580 | ||
572 | static int acpi_driver_attach(struct acpi_driver * drv) | 581 | static int acpi_driver_attach(struct acpi_driver * drv) |
@@ -586,6 +595,7 @@ static int acpi_driver_attach(struct acpi_driver * drv) | |||
586 | 595 | ||
587 | if (!acpi_bus_match(dev, drv)) { | 596 | if (!acpi_bus_match(dev, drv)) { |
588 | if (!acpi_bus_driver_init(dev, drv)) { | 597 | if (!acpi_bus_driver_init(dev, drv)) { |
598 | acpi_start_single_object(dev); | ||
589 | atomic_inc(&drv->references); | 599 | atomic_inc(&drv->references); |
590 | count++; | 600 | count++; |
591 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", | 601 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", |
@@ -1009,8 +1019,8 @@ acpi_bus_remove ( | |||
1009 | } | 1019 | } |
1010 | 1020 | ||
1011 | 1021 | ||
1012 | int | 1022 | static int |
1013 | acpi_bus_add ( | 1023 | acpi_add_single_object ( |
1014 | struct acpi_device **child, | 1024 | struct acpi_device **child, |
1015 | struct acpi_device *parent, | 1025 | struct acpi_device *parent, |
1016 | acpi_handle handle, | 1026 | acpi_handle handle, |
@@ -1019,7 +1029,7 @@ acpi_bus_add ( | |||
1019 | int result = 0; | 1029 | int result = 0; |
1020 | struct acpi_device *device = NULL; | 1030 | struct acpi_device *device = NULL; |
1021 | 1031 | ||
1022 | ACPI_FUNCTION_TRACE("acpi_bus_add"); | 1032 | ACPI_FUNCTION_TRACE("acpi_add_single_object"); |
1023 | 1033 | ||
1024 | if (!child) | 1034 | if (!child) |
1025 | return_VALUE(-EINVAL); | 1035 | return_VALUE(-EINVAL); |
@@ -1051,13 +1061,15 @@ acpi_bus_add ( | |||
1051 | /* | 1061 | /* |
1052 | * Status | 1062 | * Status |
1053 | * ------ | 1063 | * ------ |
1054 | * See if the device is present. We always assume that non-Device() | 1064 | * See if the device is present. We always assume that non-Device |
1055 | * objects (e.g. thermal zones, power resources, processors, etc.) are | 1065 | * and non-Processor objects (e.g. thermal zones, power resources, |
1056 | * present, functioning, etc. (at least when parent object is present). | 1066 | * etc.) are present, functioning, etc. (at least when parent object |
1057 | * Note that _STA has a different meaning for some objects (e.g. | 1067 | * is present). Note that _STA has a different meaning for some |
1058 | * power resources) so we need to be careful how we use it. | 1068 | * objects (e.g. power resources) so we need to be careful how we use |
1069 | * it. | ||
1059 | */ | 1070 | */ |
1060 | switch (type) { | 1071 | switch (type) { |
1072 | case ACPI_BUS_TYPE_PROCESSOR: | ||
1061 | case ACPI_BUS_TYPE_DEVICE: | 1073 | case ACPI_BUS_TYPE_DEVICE: |
1062 | result = acpi_bus_get_status(device); | 1074 | result = acpi_bus_get_status(device); |
1063 | if (ACPI_FAILURE(result) || !device->status.present) { | 1075 | if (ACPI_FAILURE(result) || !device->status.present) { |
@@ -1140,7 +1152,7 @@ acpi_bus_add ( | |||
1140 | * | 1152 | * |
1141 | * TBD: Assumes LDM provides driver hot-plug capability. | 1153 | * TBD: Assumes LDM provides driver hot-plug capability. |
1142 | */ | 1154 | */ |
1143 | acpi_bus_find_driver(device); | 1155 | result = acpi_bus_find_driver(device); |
1144 | 1156 | ||
1145 | end: | 1157 | end: |
1146 | if (!result) | 1158 | if (!result) |
@@ -1153,10 +1165,10 @@ end: | |||
1153 | 1165 | ||
1154 | return_VALUE(result); | 1166 | return_VALUE(result); |
1155 | } | 1167 | } |
1156 | EXPORT_SYMBOL(acpi_bus_add); | ||
1157 | 1168 | ||
1158 | 1169 | ||
1159 | int acpi_bus_scan (struct acpi_device *start) | 1170 | static int acpi_bus_scan (struct acpi_device *start, |
1171 | struct acpi_bus_ops *ops) | ||
1160 | { | 1172 | { |
1161 | acpi_status status = AE_OK; | 1173 | acpi_status status = AE_OK; |
1162 | struct acpi_device *parent = NULL; | 1174 | struct acpi_device *parent = NULL; |
@@ -1229,9 +1241,20 @@ int acpi_bus_scan (struct acpi_device *start) | |||
1229 | continue; | 1241 | continue; |
1230 | } | 1242 | } |
1231 | 1243 | ||
1232 | status = acpi_bus_add(&child, parent, chandle, type); | 1244 | if (ops->acpi_op_add) |
1233 | if (ACPI_FAILURE(status)) | 1245 | status = acpi_add_single_object(&child, parent, |
1234 | continue; | 1246 | chandle, type); |
1247 | else | ||
1248 | status = acpi_bus_get_device(chandle, &child); | ||
1249 | |||
1250 | if (ACPI_FAILURE(status)) | ||
1251 | continue; | ||
1252 | |||
1253 | if (ops->acpi_op_start) { | ||
1254 | status = acpi_start_single_object(child); | ||
1255 | if (ACPI_FAILURE(status)) | ||
1256 | continue; | ||
1257 | } | ||
1235 | 1258 | ||
1236 | /* | 1259 | /* |
1237 | * If the device is present, enabled, and functioning then | 1260 | * If the device is present, enabled, and functioning then |
@@ -1257,8 +1280,50 @@ int acpi_bus_scan (struct acpi_device *start) | |||
1257 | 1280 | ||
1258 | return_VALUE(0); | 1281 | return_VALUE(0); |
1259 | } | 1282 | } |
1260 | EXPORT_SYMBOL(acpi_bus_scan); | ||
1261 | 1283 | ||
1284 | int | ||
1285 | acpi_bus_add ( | ||
1286 | struct acpi_device **child, | ||
1287 | struct acpi_device *parent, | ||
1288 | acpi_handle handle, | ||
1289 | int type) | ||
1290 | { | ||
1291 | int result; | ||
1292 | struct acpi_bus_ops ops; | ||
1293 | |||
1294 | ACPI_FUNCTION_TRACE("acpi_bus_add"); | ||
1295 | |||
1296 | result = acpi_add_single_object(child, parent, handle, type); | ||
1297 | if (!result) { | ||
1298 | memset(&ops, 0, sizeof(ops)); | ||
1299 | ops.acpi_op_add = 1; | ||
1300 | result = acpi_bus_scan(*child, &ops); | ||
1301 | } | ||
1302 | return_VALUE(result); | ||
1303 | } | ||
1304 | EXPORT_SYMBOL(acpi_bus_add); | ||
1305 | |||
1306 | int | ||
1307 | acpi_bus_start ( | ||
1308 | struct acpi_device *device) | ||
1309 | { | ||
1310 | int result; | ||
1311 | struct acpi_bus_ops ops; | ||
1312 | |||
1313 | ACPI_FUNCTION_TRACE("acpi_bus_start"); | ||
1314 | |||
1315 | if (!device) | ||
1316 | return_VALUE(-EINVAL); | ||
1317 | |||
1318 | result = acpi_start_single_object(device); | ||
1319 | if (!result) { | ||
1320 | memset(&ops, 0, sizeof(ops)); | ||
1321 | ops.acpi_op_start = 1; | ||
1322 | result = acpi_bus_scan(device, &ops); | ||
1323 | } | ||
1324 | return_VALUE(result); | ||
1325 | } | ||
1326 | EXPORT_SYMBOL(acpi_bus_start); | ||
1262 | 1327 | ||
1263 | static int | 1328 | static int |
1264 | acpi_bus_trim(struct acpi_device *start, | 1329 | acpi_bus_trim(struct acpi_device *start, |
@@ -1331,13 +1396,19 @@ acpi_bus_scan_fixed ( | |||
1331 | /* | 1396 | /* |
1332 | * Enumerate all fixed-feature devices. | 1397 | * Enumerate all fixed-feature devices. |
1333 | */ | 1398 | */ |
1334 | if (acpi_fadt.pwr_button == 0) | 1399 | if (acpi_fadt.pwr_button == 0) { |
1335 | result = acpi_bus_add(&device, acpi_root, | 1400 | result = acpi_add_single_object(&device, acpi_root, |
1336 | NULL, ACPI_BUS_TYPE_POWER_BUTTON); | 1401 | NULL, ACPI_BUS_TYPE_POWER_BUTTON); |
1402 | if (!result) | ||
1403 | result = acpi_start_single_object(device); | ||
1404 | } | ||
1337 | 1405 | ||
1338 | if (acpi_fadt.sleep_button == 0) | 1406 | if (acpi_fadt.sleep_button == 0) { |
1339 | result = acpi_bus_add(&device, acpi_root, | 1407 | result = acpi_add_single_object(&device, acpi_root, |
1340 | NULL, ACPI_BUS_TYPE_SLEEP_BUTTON); | 1408 | NULL, ACPI_BUS_TYPE_SLEEP_BUTTON); |
1409 | if (!result) | ||
1410 | result = acpi_start_single_object(device); | ||
1411 | } | ||
1341 | 1412 | ||
1342 | return_VALUE(result); | 1413 | return_VALUE(result); |
1343 | } | 1414 | } |
@@ -1346,6 +1417,7 @@ acpi_bus_scan_fixed ( | |||
1346 | static int __init acpi_scan_init(void) | 1417 | static int __init acpi_scan_init(void) |
1347 | { | 1418 | { |
1348 | int result; | 1419 | int result; |
1420 | struct acpi_bus_ops ops; | ||
1349 | 1421 | ||
1350 | ACPI_FUNCTION_TRACE("acpi_scan_init"); | 1422 | ACPI_FUNCTION_TRACE("acpi_scan_init"); |
1351 | 1423 | ||
@@ -1357,17 +1429,23 @@ static int __init acpi_scan_init(void) | |||
1357 | /* | 1429 | /* |
1358 | * Create the root device in the bus's device tree | 1430 | * Create the root device in the bus's device tree |
1359 | */ | 1431 | */ |
1360 | result = acpi_bus_add(&acpi_root, NULL, ACPI_ROOT_OBJECT, | 1432 | result = acpi_add_single_object(&acpi_root, NULL, ACPI_ROOT_OBJECT, |
1361 | ACPI_BUS_TYPE_SYSTEM); | 1433 | ACPI_BUS_TYPE_SYSTEM); |
1362 | if (result) | 1434 | if (result) |
1363 | goto Done; | 1435 | goto Done; |
1364 | 1436 | ||
1437 | result = acpi_start_single_object(acpi_root); | ||
1438 | |||
1365 | /* | 1439 | /* |
1366 | * Enumerate devices in the ACPI namespace. | 1440 | * Enumerate devices in the ACPI namespace. |
1367 | */ | 1441 | */ |
1368 | result = acpi_bus_scan_fixed(acpi_root); | 1442 | result = acpi_bus_scan_fixed(acpi_root); |
1369 | if (!result) | 1443 | if (!result) { |
1370 | result = acpi_bus_scan(acpi_root); | 1444 | memset(&ops, 0, sizeof(ops)); |
1445 | ops.acpi_op_add = 1; | ||
1446 | ops.acpi_op_start = 1; | ||
1447 | result = acpi_bus_scan(acpi_root, &ops); | ||
1448 | } | ||
1371 | 1449 | ||
1372 | if (result) | 1450 | if (result) |
1373 | acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); | 1451 | acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 0a5d2a94131e..7249ba2b7a27 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sleep.c - ACPI sleep support. | 2 | * sleep.c - ACPI sleep support. |
3 | * | 3 | * |
4 | * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> | ||
4 | * Copyright (c) 2004 David Shaohua Li <shaohua.li@intel.com> | 5 | * Copyright (c) 2004 David Shaohua Li <shaohua.li@intel.com> |
5 | * Copyright (c) 2000-2003 Patrick Mochel | 6 | * Copyright (c) 2000-2003 Patrick Mochel |
6 | * Copyright (c) 2003 Open Source Development Lab | 7 | * Copyright (c) 2003 Open Source Development Lab |
@@ -14,7 +15,6 @@ | |||
14 | #include <linux/dmi.h> | 15 | #include <linux/dmi.h> |
15 | #include <linux/device.h> | 16 | #include <linux/device.h> |
16 | #include <linux/suspend.h> | 17 | #include <linux/suspend.h> |
17 | #include <asm/io.h> | ||
18 | #include <acpi/acpi_bus.h> | 18 | #include <acpi/acpi_bus.h> |
19 | #include <acpi/acpi_drivers.h> | 19 | #include <acpi/acpi_drivers.h> |
20 | #include "sleep.h" | 20 | #include "sleep.h" |
@@ -27,10 +27,11 @@ extern void do_suspend_lowlevel_s4bios(void); | |||
27 | extern void do_suspend_lowlevel(void); | 27 | extern void do_suspend_lowlevel(void); |
28 | 28 | ||
29 | static u32 acpi_suspend_states[] = { | 29 | static u32 acpi_suspend_states[] = { |
30 | [PM_SUSPEND_ON] = ACPI_STATE_S0, | 30 | [PM_SUSPEND_ON] = ACPI_STATE_S0, |
31 | [PM_SUSPEND_STANDBY] = ACPI_STATE_S1, | 31 | [PM_SUSPEND_STANDBY] = ACPI_STATE_S1, |
32 | [PM_SUSPEND_MEM] = ACPI_STATE_S3, | 32 | [PM_SUSPEND_MEM] = ACPI_STATE_S3, |
33 | [PM_SUSPEND_DISK] = ACPI_STATE_S4, | 33 | [PM_SUSPEND_DISK] = ACPI_STATE_S4, |
34 | [PM_SUSPEND_MAX] = ACPI_STATE_S5 | ||
34 | }; | 35 | }; |
35 | 36 | ||
36 | static int init_8259A_after_S1; | 37 | static int init_8259A_after_S1; |
@@ -44,30 +45,20 @@ static int init_8259A_after_S1; | |||
44 | * wakeup code to the waking vector. | 45 | * wakeup code to the waking vector. |
45 | */ | 46 | */ |
46 | 47 | ||
48 | extern int acpi_sleep_prepare(u32 acpi_state); | ||
49 | extern void acpi_power_off(void); | ||
50 | |||
47 | static int acpi_pm_prepare(suspend_state_t pm_state) | 51 | static int acpi_pm_prepare(suspend_state_t pm_state) |
48 | { | 52 | { |
49 | u32 acpi_state = acpi_suspend_states[pm_state]; | 53 | u32 acpi_state = acpi_suspend_states[pm_state]; |
50 | 54 | ||
51 | if (!sleep_states[acpi_state]) | 55 | if (!sleep_states[acpi_state]) { |
56 | printk("acpi_pm_prepare does not support %d \n", pm_state); | ||
52 | return -EPERM; | 57 | return -EPERM; |
53 | |||
54 | /* do we have a wakeup address for S2 and S3? */ | ||
55 | /* Here, we support only S4BIOS, those we set the wakeup address */ | ||
56 | /* S4OS is only supported for now via swsusp.. */ | ||
57 | if (pm_state == PM_SUSPEND_MEM || pm_state == PM_SUSPEND_DISK) { | ||
58 | if (!acpi_wakeup_address) | ||
59 | return -EFAULT; | ||
60 | acpi_set_firmware_waking_vector( | ||
61 | (acpi_physical_address) virt_to_phys( | ||
62 | (void *)acpi_wakeup_address)); | ||
63 | } | 58 | } |
64 | ACPI_FLUSH_CPU_CACHE(); | 59 | return acpi_sleep_prepare(acpi_state); |
65 | acpi_enable_wakeup_device_prep(acpi_state); | ||
66 | acpi_enter_sleep_state_prep(acpi_state); | ||
67 | return 0; | ||
68 | } | 60 | } |
69 | 61 | ||
70 | |||
71 | /** | 62 | /** |
72 | * acpi_pm_enter - Actually enter a sleep state. | 63 | * acpi_pm_enter - Actually enter a sleep state. |
73 | * @pm_state: State we're entering. | 64 | * @pm_state: State we're entering. |
@@ -92,11 +83,9 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
92 | return error; | 83 | return error; |
93 | } | 84 | } |
94 | 85 | ||
95 | |||
96 | local_irq_save(flags); | 86 | local_irq_save(flags); |
97 | acpi_enable_wakeup_device(acpi_state); | 87 | acpi_enable_wakeup_device(acpi_state); |
98 | switch (pm_state) | 88 | switch (pm_state) { |
99 | { | ||
100 | case PM_SUSPEND_STANDBY: | 89 | case PM_SUSPEND_STANDBY: |
101 | barrier(); | 90 | barrier(); |
102 | status = acpi_enter_sleep_state(acpi_state); | 91 | status = acpi_enter_sleep_state(acpi_state); |
@@ -112,6 +101,10 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
112 | else | 101 | else |
113 | do_suspend_lowlevel_s4bios(); | 102 | do_suspend_lowlevel_s4bios(); |
114 | break; | 103 | break; |
104 | case PM_SUSPEND_MAX: | ||
105 | acpi_power_off(); | ||
106 | break; | ||
107 | |||
115 | default: | 108 | default: |
116 | return -EINVAL; | 109 | return -EINVAL; |
117 | } | 110 | } |
@@ -126,11 +119,9 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
126 | if (pm_state > PM_SUSPEND_STANDBY) | 119 | if (pm_state > PM_SUSPEND_STANDBY) |
127 | acpi_restore_state_mem(); | 120 | acpi_restore_state_mem(); |
128 | 121 | ||
129 | |||
130 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 122 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
131 | } | 123 | } |
132 | 124 | ||
133 | |||
134 | /** | 125 | /** |
135 | * acpi_pm_finish - Finish up suspend sequence. | 126 | * acpi_pm_finish - Finish up suspend sequence. |
136 | * @pm_state: State we're coming out of. | 127 | * @pm_state: State we're coming out of. |
@@ -156,27 +147,26 @@ static int acpi_pm_finish(suspend_state_t pm_state) | |||
156 | return 0; | 147 | return 0; |
157 | } | 148 | } |
158 | 149 | ||
159 | |||
160 | int acpi_suspend(u32 acpi_state) | 150 | int acpi_suspend(u32 acpi_state) |
161 | { | 151 | { |
162 | suspend_state_t states[] = { | 152 | suspend_state_t states[] = { |
163 | [1] = PM_SUSPEND_STANDBY, | 153 | [1] = PM_SUSPEND_STANDBY, |
164 | [3] = PM_SUSPEND_MEM, | 154 | [3] = PM_SUSPEND_MEM, |
165 | [4] = PM_SUSPEND_DISK, | 155 | [4] = PM_SUSPEND_DISK, |
156 | [5] = PM_SUSPEND_MAX | ||
166 | }; | 157 | }; |
167 | 158 | ||
168 | if (acpi_state <= 4 && states[acpi_state]) | 159 | if (acpi_state < 6 && states[acpi_state]) |
169 | return pm_suspend(states[acpi_state]); | 160 | return pm_suspend(states[acpi_state]); |
170 | return -EINVAL; | 161 | return -EINVAL; |
171 | } | 162 | } |
172 | 163 | ||
173 | static struct pm_ops acpi_pm_ops = { | 164 | static struct pm_ops acpi_pm_ops = { |
174 | .prepare = acpi_pm_prepare, | 165 | .prepare = acpi_pm_prepare, |
175 | .enter = acpi_pm_enter, | 166 | .enter = acpi_pm_enter, |
176 | .finish = acpi_pm_finish, | 167 | .finish = acpi_pm_finish, |
177 | }; | 168 | }; |
178 | 169 | ||
179 | |||
180 | /* | 170 | /* |
181 | * Toshiba fails to preserve interrupts over S1, reinitialization | 171 | * Toshiba fails to preserve interrupts over S1, reinitialization |
182 | * of 8259 is needed after S1 resume. | 172 | * of 8259 is needed after S1 resume. |
@@ -190,16 +180,16 @@ static int __init init_ints_after_s1(struct dmi_system_id *d) | |||
190 | 180 | ||
191 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | 181 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { |
192 | { | 182 | { |
193 | .callback = init_ints_after_s1, | 183 | .callback = init_ints_after_s1, |
194 | .ident = "Toshiba Satellite 4030cdt", | 184 | .ident = "Toshiba Satellite 4030cdt", |
195 | .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"), }, | 185 | .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),}, |
196 | }, | 186 | }, |
197 | { }, | 187 | {}, |
198 | }; | 188 | }; |
199 | 189 | ||
200 | static int __init acpi_sleep_init(void) | 190 | static int __init acpi_sleep_init(void) |
201 | { | 191 | { |
202 | int i = 0; | 192 | int i = 0; |
203 | 193 | ||
204 | dmi_check_system(acpisleep_dmi_table); | 194 | dmi_check_system(acpisleep_dmi_table); |
205 | 195 | ||
@@ -207,7 +197,7 @@ static int __init acpi_sleep_init(void) | |||
207 | return 0; | 197 | return 0; |
208 | 198 | ||
209 | printk(KERN_INFO PREFIX "(supports"); | 199 | printk(KERN_INFO PREFIX "(supports"); |
210 | for (i=0; i < ACPI_S_STATE_COUNT; i++) { | 200 | for (i = 0; i < ACPI_S_STATE_COUNT; i++) { |
211 | acpi_status status; | 201 | acpi_status status; |
212 | u8 type_a, type_b; | 202 | u8 type_a, type_b; |
213 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); | 203 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); |
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index da237754ded9..f93d2ee54800 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c | |||
@@ -3,37 +3,96 @@ | |||
3 | * | 3 | * |
4 | * AKA S5, but it is independent of whether or not the kernel supports | 4 | * AKA S5, but it is independent of whether or not the kernel supports |
5 | * any other sleep support in the system. | 5 | * any other sleep support in the system. |
6 | * | ||
7 | * Copyright (c) 2005 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> | ||
8 | * | ||
9 | * This file is released under the GPLv2. | ||
6 | */ | 10 | */ |
7 | 11 | ||
8 | #include <linux/pm.h> | 12 | #include <linux/pm.h> |
9 | #include <linux/init.h> | 13 | #include <linux/init.h> |
10 | #include <acpi/acpi_bus.h> | 14 | #include <acpi/acpi_bus.h> |
11 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/sysdev.h> | ||
17 | #include <asm/io.h> | ||
12 | #include "sleep.h" | 18 | #include "sleep.h" |
13 | 19 | ||
14 | static void | 20 | int acpi_sleep_prepare(u32 acpi_state) |
15 | acpi_power_off (void) | 21 | { |
22 | #ifdef CONFIG_ACPI_SLEEP | ||
23 | /* do we have a wakeup address for S2 and S3? */ | ||
24 | /* Here, we support only S4BIOS, those we set the wakeup address */ | ||
25 | /* S4OS is only supported for now via swsusp.. */ | ||
26 | if (acpi_state == ACPI_STATE_S3 || acpi_state == ACPI_STATE_S4) { | ||
27 | if (!acpi_wakeup_address) { | ||
28 | return -EFAULT; | ||
29 | } | ||
30 | acpi_set_firmware_waking_vector((acpi_physical_address) | ||
31 | virt_to_phys((void *) | ||
32 | acpi_wakeup_address)); | ||
33 | |||
34 | } | ||
35 | ACPI_FLUSH_CPU_CACHE(); | ||
36 | acpi_enable_wakeup_device_prep(acpi_state); | ||
37 | #endif | ||
38 | if (acpi_state == ACPI_STATE_S5) { | ||
39 | acpi_wakeup_gpe_poweroff_prepare(); | ||
40 | } | ||
41 | acpi_enter_sleep_state_prep(acpi_state); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | #ifdef CONFIG_PM | ||
46 | |||
47 | void acpi_power_off(void) | ||
16 | { | 48 | { |
17 | printk("%s called\n",__FUNCTION__); | 49 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
50 | printk("%s called\n", __FUNCTION__); | ||
51 | local_irq_disable(); | ||
18 | /* Some SMP machines only can poweroff in boot CPU */ | 52 | /* Some SMP machines only can poweroff in boot CPU */ |
19 | set_cpus_allowed(current, cpumask_of_cpu(0)); | ||
20 | acpi_wakeup_gpe_poweroff_prepare(); | ||
21 | acpi_enter_sleep_state_prep(ACPI_STATE_S5); | ||
22 | ACPI_DISABLE_IRQS(); | ||
23 | acpi_enter_sleep_state(ACPI_STATE_S5); | 53 | acpi_enter_sleep_state(ACPI_STATE_S5); |
24 | } | 54 | } |
25 | 55 | ||
56 | static int acpi_shutdown(struct sys_device *x) | ||
57 | { | ||
58 | if (system_state == SYSTEM_POWER_OFF) { | ||
59 | /* Prepare if we are going to power off the system */ | ||
60 | return acpi_sleep_prepare(ACPI_STATE_S5); | ||
61 | } | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static struct sysdev_class acpi_sysclass = { | ||
66 | set_kset_name("acpi"), | ||
67 | .shutdown = acpi_shutdown | ||
68 | }; | ||
69 | |||
70 | static struct sys_device device_acpi = { | ||
71 | .id = 0, | ||
72 | .cls = &acpi_sysclass, | ||
73 | }; | ||
74 | |||
26 | static int acpi_poweroff_init(void) | 75 | static int acpi_poweroff_init(void) |
27 | { | 76 | { |
28 | if (!acpi_disabled) { | 77 | if (!acpi_disabled) { |
29 | u8 type_a, type_b; | 78 | u8 type_a, type_b; |
30 | acpi_status status; | 79 | acpi_status status; |
31 | 80 | ||
32 | status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); | 81 | status = |
33 | if (ACPI_SUCCESS(status)) | 82 | acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); |
34 | pm_power_off = acpi_power_off; | 83 | if (ACPI_SUCCESS(status)) { |
84 | int error; | ||
85 | error = sysdev_class_register(&acpi_sysclass); | ||
86 | if (!error) | ||
87 | error = sysdev_register(&device_acpi); | ||
88 | if (!error) | ||
89 | pm_power_off = acpi_power_off; | ||
90 | return error; | ||
91 | } | ||
35 | } | 92 | } |
36 | return 0; | 93 | return 0; |
37 | } | 94 | } |
38 | 95 | ||
39 | late_initcall(acpi_poweroff_init); | 96 | late_initcall(acpi_poweroff_init); |
97 | |||
98 | #endif /* CONFIG_PM */ | ||
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index fd7c5a0649af..1be99f0996d6 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
@@ -13,13 +13,17 @@ | |||
13 | 13 | ||
14 | #include "sleep.h" | 14 | #include "sleep.h" |
15 | 15 | ||
16 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
16 | #define ACPI_SYSTEM_FILE_SLEEP "sleep" | 17 | #define ACPI_SYSTEM_FILE_SLEEP "sleep" |
18 | #endif | ||
19 | |||
17 | #define ACPI_SYSTEM_FILE_ALARM "alarm" | 20 | #define ACPI_SYSTEM_FILE_ALARM "alarm" |
18 | #define ACPI_SYSTEM_FILE_WAKEUP_DEVICE "wakeup" | 21 | #define ACPI_SYSTEM_FILE_WAKEUP_DEVICE "wakeup" |
19 | 22 | ||
20 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 23 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
21 | ACPI_MODULE_NAME ("sleep") | 24 | ACPI_MODULE_NAME ("sleep") |
22 | 25 | ||
26 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
23 | 27 | ||
24 | static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) | 28 | static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) |
25 | { | 29 | { |
@@ -78,6 +82,7 @@ acpi_system_write_sleep ( | |||
78 | Done: | 82 | Done: |
79 | return error ? error : count; | 83 | return error ? error : count; |
80 | } | 84 | } |
85 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | ||
81 | 86 | ||
82 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) | 87 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) |
83 | { | 88 | { |
@@ -452,6 +457,7 @@ static struct file_operations acpi_system_wakeup_device_fops = { | |||
452 | .release = single_release, | 457 | .release = single_release, |
453 | }; | 458 | }; |
454 | 459 | ||
460 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
455 | static struct file_operations acpi_system_sleep_fops = { | 461 | static struct file_operations acpi_system_sleep_fops = { |
456 | .open = acpi_system_sleep_open_fs, | 462 | .open = acpi_system_sleep_open_fs, |
457 | .read = seq_read, | 463 | .read = seq_read, |
@@ -459,6 +465,7 @@ static struct file_operations acpi_system_sleep_fops = { | |||
459 | .llseek = seq_lseek, | 465 | .llseek = seq_lseek, |
460 | .release = single_release, | 466 | .release = single_release, |
461 | }; | 467 | }; |
468 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | ||
462 | 469 | ||
463 | static struct file_operations acpi_system_alarm_fops = { | 470 | static struct file_operations acpi_system_alarm_fops = { |
464 | .open = acpi_system_alarm_open_fs, | 471 | .open = acpi_system_alarm_open_fs, |
@@ -484,11 +491,13 @@ static int acpi_sleep_proc_init(void) | |||
484 | if (acpi_disabled) | 491 | if (acpi_disabled) |
485 | return 0; | 492 | return 0; |
486 | 493 | ||
494 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | ||
487 | /* 'sleep' [R/W]*/ | 495 | /* 'sleep' [R/W]*/ |
488 | entry = create_proc_entry(ACPI_SYSTEM_FILE_SLEEP, | 496 | entry = create_proc_entry(ACPI_SYSTEM_FILE_SLEEP, |
489 | S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir); | 497 | S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir); |
490 | if (entry) | 498 | if (entry) |
491 | entry->proc_fops = &acpi_system_sleep_fops; | 499 | entry->proc_fops = &acpi_system_sleep_fops; |
500 | #endif | ||
492 | 501 | ||
493 | /* 'alarm' [R/W] */ | 502 | /* 'alarm' [R/W] */ |
494 | entry = create_proc_entry(ACPI_SYSTEM_FILE_ALARM, | 503 | entry = create_proc_entry(ACPI_SYSTEM_FILE_ALARM, |
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 334327c1f66f..92e0c31539be 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -50,6 +50,24 @@ | |||
50 | #define _COMPONENT ACPI_TABLES | 50 | #define _COMPONENT ACPI_TABLES |
51 | ACPI_MODULE_NAME ("tbconvrt") | 51 | ACPI_MODULE_NAME ("tbconvrt") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static void | ||
56 | acpi_tb_init_generic_address ( | ||
57 | struct acpi_generic_address *new_gas_struct, | ||
58 | u8 register_bit_width, | ||
59 | acpi_physical_address address); | ||
60 | |||
61 | static void | ||
62 | acpi_tb_convert_fadt1 ( | ||
63 | struct fadt_descriptor_rev2 *local_fadt, | ||
64 | struct fadt_descriptor_rev1 *original_fadt); | ||
65 | |||
66 | static void | ||
67 | acpi_tb_convert_fadt2 ( | ||
68 | struct fadt_descriptor_rev2 *local_fadt, | ||
69 | struct fadt_descriptor_rev2 *original_fadt); | ||
70 | |||
53 | 71 | ||
54 | u8 acpi_fadt_is_v1; | 72 | u8 acpi_fadt_is_v1; |
55 | EXPORT_SYMBOL(acpi_fadt_is_v1); | 73 | EXPORT_SYMBOL(acpi_fadt_is_v1); |
@@ -142,11 +160,13 @@ acpi_tb_convert_to_xsdt ( | |||
142 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 160 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
143 | if (acpi_gbl_RSDP->revision < 2) { | 161 | if (acpi_gbl_RSDP->revision < 2) { |
144 | ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], | 162 | ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], |
145 | (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]); | 163 | (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, |
164 | table_info->pointer))->table_offset_entry[i]); | ||
146 | } | 165 | } |
147 | else { | 166 | else { |
148 | new_table->table_offset_entry[i] = | 167 | new_table->table_offset_entry[i] = |
149 | (ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info->pointer))->table_offset_entry[i]; | 168 | (ACPI_CAST_PTR (XSDT_DESCRIPTOR, |
169 | table_info->pointer))->table_offset_entry[i]; | ||
150 | } | 170 | } |
151 | } | 171 | } |
152 | 172 | ||
@@ -164,7 +184,7 @@ acpi_tb_convert_to_xsdt ( | |||
164 | } | 184 | } |
165 | 185 | ||
166 | 186 | ||
167 | /****************************************************************************** | 187 | /******************************************************************************* |
168 | * | 188 | * |
169 | * FUNCTION: acpi_tb_init_generic_address | 189 | * FUNCTION: acpi_tb_init_generic_address |
170 | * | 190 | * |
@@ -201,7 +221,7 @@ acpi_tb_init_generic_address ( | |||
201 | * PARAMETERS: local_fadt - Pointer to new FADT | 221 | * PARAMETERS: local_fadt - Pointer to new FADT |
202 | * original_fadt - Pointer to old FADT | 222 | * original_fadt - Pointer to old FADT |
203 | * | 223 | * |
204 | * RETURN: Populates local_fadt | 224 | * RETURN: None, populates local_fadt |
205 | * | 225 | * |
206 | * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format | 226 | * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format |
207 | * | 227 | * |
@@ -213,7 +233,6 @@ acpi_tb_convert_fadt1 ( | |||
213 | struct fadt_descriptor_rev1 *original_fadt) | 233 | struct fadt_descriptor_rev1 *original_fadt) |
214 | { | 234 | { |
215 | 235 | ||
216 | |||
217 | /* ACPI 1.0 FACS */ | 236 | /* ACPI 1.0 FACS */ |
218 | /* The BIOS stored FADT should agree with Revision 1.0 */ | 237 | /* The BIOS stored FADT should agree with Revision 1.0 */ |
219 | acpi_fadt_is_v1 = 1; | 238 | acpi_fadt_is_v1 = 1; |
@@ -232,7 +251,8 @@ acpi_tb_convert_fadt1 ( | |||
232 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); | 251 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); |
233 | 252 | ||
234 | /* | 253 | /* |
235 | * System Interrupt Model isn't used in ACPI 2.0 (local_fadt->Reserved1 = 0;) | 254 | * System Interrupt Model isn't used in ACPI 2.0 |
255 | * (local_fadt->Reserved1 = 0;) | ||
236 | */ | 256 | */ |
237 | 257 | ||
238 | /* | 258 | /* |
@@ -269,7 +289,8 @@ acpi_tb_convert_fadt1 ( | |||
269 | * that immediately follows. | 289 | * that immediately follows. |
270 | */ | 290 | */ |
271 | ACPI_MEMCPY (&local_fadt->reset_register, | 291 | ACPI_MEMCPY (&local_fadt->reset_register, |
272 | &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, original_fadt))->reset_register, | 292 | &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, |
293 | original_fadt))->reset_register, | ||
273 | sizeof (struct acpi_generic_address) + 1); | 294 | sizeof (struct acpi_generic_address) + 1); |
274 | } | 295 | } |
275 | else { | 296 | else { |
@@ -304,7 +325,8 @@ acpi_tb_convert_fadt1 ( | |||
304 | 325 | ||
305 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 326 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, |
306 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 327 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
307 | (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + | 328 | (acpi_physical_address) |
329 | (local_fadt->xpm1a_evt_blk.address + | ||
308 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 330 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
309 | 331 | ||
310 | /* PM1B is optional; leave null if not present */ | 332 | /* PM1B is optional; leave null if not present */ |
@@ -312,7 +334,8 @@ acpi_tb_convert_fadt1 ( | |||
312 | if (local_fadt->xpm1b_evt_blk.address) { | 334 | if (local_fadt->xpm1b_evt_blk.address) { |
313 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 335 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, |
314 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 336 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
315 | (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + | 337 | (acpi_physical_address) |
338 | (local_fadt->xpm1b_evt_blk.address + | ||
316 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 339 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
317 | } | 340 | } |
318 | } | 341 | } |
@@ -325,7 +348,7 @@ acpi_tb_convert_fadt1 ( | |||
325 | * PARAMETERS: local_fadt - Pointer to new FADT | 348 | * PARAMETERS: local_fadt - Pointer to new FADT |
326 | * original_fadt - Pointer to old FADT | 349 | * original_fadt - Pointer to old FADT |
327 | * | 350 | * |
328 | * RETURN: Populates local_fadt | 351 | * RETURN: None, populates local_fadt |
329 | * | 352 | * |
330 | * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. | 353 | * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. |
331 | * Handles optional "X" fields. | 354 | * Handles optional "X" fields. |
@@ -348,7 +371,8 @@ acpi_tb_convert_fadt2 ( | |||
348 | * is zero. | 371 | * is zero. |
349 | */ | 372 | */ |
350 | if (!(local_fadt->xfirmware_ctrl)) { | 373 | if (!(local_fadt->xfirmware_ctrl)) { |
351 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); | 374 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, |
375 | local_fadt->V1_firmware_ctrl); | ||
352 | } | 376 | } |
353 | 377 | ||
354 | if (!(local_fadt->Xdsdt)) { | 378 | if (!(local_fadt->Xdsdt)) { |
@@ -357,32 +381,38 @@ acpi_tb_convert_fadt2 ( | |||
357 | 381 | ||
358 | if (!(local_fadt->xpm1a_evt_blk.address)) { | 382 | if (!(local_fadt->xpm1a_evt_blk.address)) { |
359 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, | 383 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, |
360 | local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | 384 | local_fadt->pm1_evt_len, |
385 | (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | ||
361 | } | 386 | } |
362 | 387 | ||
363 | if (!(local_fadt->xpm1b_evt_blk.address)) { | 388 | if (!(local_fadt->xpm1b_evt_blk.address)) { |
364 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, | 389 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, |
365 | local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | 390 | local_fadt->pm1_evt_len, |
391 | (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | ||
366 | } | 392 | } |
367 | 393 | ||
368 | if (!(local_fadt->xpm1a_cnt_blk.address)) { | 394 | if (!(local_fadt->xpm1a_cnt_blk.address)) { |
369 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, | 395 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, |
370 | local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | 396 | local_fadt->pm1_cnt_len, |
397 | (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | ||
371 | } | 398 | } |
372 | 399 | ||
373 | if (!(local_fadt->xpm1b_cnt_blk.address)) { | 400 | if (!(local_fadt->xpm1b_cnt_blk.address)) { |
374 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, | 401 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, |
375 | local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | 402 | local_fadt->pm1_cnt_len, |
403 | (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | ||
376 | } | 404 | } |
377 | 405 | ||
378 | if (!(local_fadt->xpm2_cnt_blk.address)) { | 406 | if (!(local_fadt->xpm2_cnt_blk.address)) { |
379 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, | 407 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, |
380 | local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | 408 | local_fadt->pm2_cnt_len, |
409 | (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | ||
381 | } | 410 | } |
382 | 411 | ||
383 | if (!(local_fadt->xpm_tmr_blk.address)) { | 412 | if (!(local_fadt->xpm_tmr_blk.address)) { |
384 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, | 413 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, |
385 | local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | 414 | local_fadt->pm_tm_len, |
415 | (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | ||
386 | } | 416 | } |
387 | 417 | ||
388 | if (!(local_fadt->xgpe0_blk.address)) { | 418 | if (!(local_fadt->xgpe0_blk.address)) { |
@@ -399,18 +429,24 @@ acpi_tb_convert_fadt2 ( | |||
399 | 429 | ||
400 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 430 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, |
401 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 431 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
402 | (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address + | 432 | (acpi_physical_address) |
433 | (local_fadt->xpm1a_evt_blk.address + | ||
403 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 434 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
404 | acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id; | 435 | |
436 | acpi_gbl_xpm1a_enable.address_space_id = | ||
437 | local_fadt->xpm1a_evt_blk.address_space_id; | ||
405 | 438 | ||
406 | /* PM1B is optional; leave null if not present */ | 439 | /* PM1B is optional; leave null if not present */ |
407 | 440 | ||
408 | if (local_fadt->xpm1b_evt_blk.address) { | 441 | if (local_fadt->xpm1b_evt_blk.address) { |
409 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 442 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, |
410 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 443 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), |
411 | (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address + | 444 | (acpi_physical_address) |
445 | (local_fadt->xpm1b_evt_blk.address + | ||
412 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 446 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); |
413 | acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id; | 447 | |
448 | acpi_gbl_xpm1b_enable.address_space_id = | ||
449 | local_fadt->xpm1b_evt_blk.address_space_id; | ||
414 | } | 450 | } |
415 | } | 451 | } |
416 | 452 | ||
@@ -432,7 +468,8 @@ acpi_tb_convert_fadt2 ( | |||
432 | ******************************************************************************/ | 468 | ******************************************************************************/ |
433 | 469 | ||
434 | acpi_status | 470 | acpi_status |
435 | acpi_tb_convert_table_fadt (void) | 471 | acpi_tb_convert_table_fadt ( |
472 | void) | ||
436 | { | 473 | { |
437 | struct fadt_descriptor_rev2 *local_fadt; | 474 | struct fadt_descriptor_rev2 *local_fadt; |
438 | struct acpi_table_desc *table_desc; | 475 | struct acpi_table_desc *table_desc; |
@@ -446,7 +483,8 @@ acpi_tb_convert_table_fadt (void) | |||
446 | * at least as long as the version 1.0 FADT | 483 | * at least as long as the version 1.0 FADT |
447 | */ | 484 | */ |
448 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { | 485 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { |
449 | ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length)); | 486 | ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", |
487 | acpi_gbl_FADT->length)); | ||
450 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 488 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); |
451 | } | 489 | } |
452 | 490 | ||
@@ -461,8 +499,9 @@ acpi_tb_convert_table_fadt (void) | |||
461 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { | 499 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { |
462 | /* Length is too short to be a V2.0 table */ | 500 | /* Length is too short to be a V2.0 table */ |
463 | 501 | ||
464 | ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", | 502 | ACPI_REPORT_WARNING (( |
465 | acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); | 503 | "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", |
504 | acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); | ||
466 | 505 | ||
467 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 506 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); |
468 | } | 507 | } |
@@ -478,9 +517,8 @@ acpi_tb_convert_table_fadt (void) | |||
478 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 517 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); |
479 | } | 518 | } |
480 | 519 | ||
481 | /* | 520 | /* Global FADT pointer will point to the new common V2.0 FADT */ |
482 | * Global FADT pointer will point to the new common V2.0 FADT | 521 | |
483 | */ | ||
484 | acpi_gbl_FADT = local_fadt; | 522 | acpi_gbl_FADT = local_fadt; |
485 | acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); | 523 | acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); |
486 | 524 | ||
@@ -508,7 +546,7 @@ acpi_tb_convert_table_fadt (void) | |||
508 | 546 | ||
509 | /******************************************************************************* | 547 | /******************************************************************************* |
510 | * | 548 | * |
511 | * FUNCTION: acpi_tb_convert_table_facs | 549 | * FUNCTION: acpi_tb_build_common_facs |
512 | * | 550 | * |
513 | * PARAMETERS: table_info - Info for currently installed FACS | 551 | * PARAMETERS: table_info - Info for currently installed FACS |
514 | * | 552 | * |
@@ -530,12 +568,14 @@ acpi_tb_build_common_facs ( | |||
530 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ | 568 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ |
531 | 569 | ||
532 | if (acpi_gbl_FACS->length < 24) { | 570 | if (acpi_gbl_FACS->length < 24) { |
533 | ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length)); | 571 | ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", |
572 | acpi_gbl_FACS->length)); | ||
534 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 573 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); |
535 | } | 574 | } |
536 | 575 | ||
537 | if (acpi_gbl_FACS->length < 64) { | 576 | if (acpi_gbl_FACS->length < 64) { |
538 | ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", | 577 | ACPI_REPORT_WARNING (( |
578 | "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", | ||
539 | acpi_gbl_FACS->length)); | 579 | acpi_gbl_FACS->length)); |
540 | } | 580 | } |
541 | 581 | ||
@@ -548,7 +588,8 @@ acpi_tb_build_common_facs ( | |||
548 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { | 588 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { |
549 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ | 589 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ |
550 | 590 | ||
551 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector)); | 591 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, |
592 | &(acpi_gbl_FACS->firmware_waking_vector)); | ||
552 | acpi_gbl_common_fACS.vector_width = 32; | 593 | acpi_gbl_common_fACS.vector_width = 32; |
553 | } | 594 | } |
554 | else { | 595 | else { |
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 896f3ddda62e..4ab2aadc6133 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
@@ -49,6 +49,19 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbget") | 50 | ACPI_MODULE_NAME ("tbget") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_tb_get_this_table ( | ||
56 | struct acpi_pointer *address, | ||
57 | struct acpi_table_header *header, | ||
58 | struct acpi_table_desc *table_info); | ||
59 | |||
60 | static acpi_status | ||
61 | acpi_tb_table_override ( | ||
62 | struct acpi_table_header *header, | ||
63 | struct acpi_table_desc *table_info); | ||
64 | |||
52 | 65 | ||
53 | /******************************************************************************* | 66 | /******************************************************************************* |
54 | * | 67 | * |
@@ -76,9 +89,8 @@ acpi_tb_get_table ( | |||
76 | ACPI_FUNCTION_TRACE ("tb_get_table"); | 89 | ACPI_FUNCTION_TRACE ("tb_get_table"); |
77 | 90 | ||
78 | 91 | ||
79 | /* | 92 | /* Get the header in order to get signature and table size */ |
80 | * Get the header in order to get signature and table size | 93 | |
81 | */ | ||
82 | status = acpi_tb_get_table_header (address, &header); | 94 | status = acpi_tb_get_table_header (address, &header); |
83 | if (ACPI_FAILURE (status)) { | 95 | if (ACPI_FAILURE (status)) { |
84 | return_ACPI_STATUS (status); | 96 | return_ACPI_STATUS (status); |
@@ -127,8 +139,8 @@ acpi_tb_get_table_header ( | |||
127 | 139 | ||
128 | 140 | ||
129 | /* | 141 | /* |
130 | * Flags contains the current processor mode (Virtual or Physical addressing) | 142 | * Flags contains the current processor mode (Virtual or Physical |
131 | * The pointer_type is either Logical or Physical | 143 | * addressing) The pointer_type is either Logical or Physical |
132 | */ | 144 | */ |
133 | switch (address->pointer_type) { | 145 | switch (address->pointer_type) { |
134 | case ACPI_PHYSMODE_PHYSPTR: | 146 | case ACPI_PHYSMODE_PHYSPTR: |
@@ -136,7 +148,8 @@ acpi_tb_get_table_header ( | |||
136 | 148 | ||
137 | /* Pointer matches processor mode, copy the header */ | 149 | /* Pointer matches processor mode, copy the header */ |
138 | 150 | ||
139 | ACPI_MEMCPY (return_header, address->pointer.logical, sizeof (struct acpi_table_header)); | 151 | ACPI_MEMCPY (return_header, address->pointer.logical, |
152 | sizeof (struct acpi_table_header)); | ||
140 | break; | 153 | break; |
141 | 154 | ||
142 | 155 | ||
@@ -144,10 +157,11 @@ acpi_tb_get_table_header ( | |||
144 | 157 | ||
145 | /* Create a logical address for the physical pointer*/ | 158 | /* Create a logical address for the physical pointer*/ |
146 | 159 | ||
147 | status = acpi_os_map_memory (address->pointer.physical, sizeof (struct acpi_table_header), | 160 | status = acpi_os_map_memory (address->pointer.physical, |
148 | (void *) &header); | 161 | sizeof (struct acpi_table_header), (void *) &header); |
149 | if (ACPI_FAILURE (status)) { | 162 | if (ACPI_FAILURE (status)) { |
150 | ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", | 163 | ACPI_REPORT_ERROR (( |
164 | "Could not map memory at %8.8X%8.8X for length %X\n", | ||
151 | ACPI_FORMAT_UINT64 (address->pointer.physical), | 165 | ACPI_FORMAT_UINT64 (address->pointer.physical), |
152 | sizeof (struct acpi_table_header))); | 166 | sizeof (struct acpi_table_header))); |
153 | return_ACPI_STATUS (status); | 167 | return_ACPI_STATUS (status); |
@@ -210,9 +224,8 @@ acpi_tb_get_table_body ( | |||
210 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 224 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
211 | } | 225 | } |
212 | 226 | ||
213 | /* | 227 | /* Attempt table override. */ |
214 | * Attempt table override. | 228 | |
215 | */ | ||
216 | status = acpi_tb_table_override (header, table_info); | 229 | status = acpi_tb_table_override (header, table_info); |
217 | if (ACPI_SUCCESS (status)) { | 230 | if (ACPI_SUCCESS (status)) { |
218 | /* Table was overridden by the host OS */ | 231 | /* Table was overridden by the host OS */ |
@@ -241,7 +254,7 @@ acpi_tb_get_table_body ( | |||
241 | * | 254 | * |
242 | ******************************************************************************/ | 255 | ******************************************************************************/ |
243 | 256 | ||
244 | acpi_status | 257 | static acpi_status |
245 | acpi_tb_table_override ( | 258 | acpi_tb_table_override ( |
246 | struct acpi_table_header *header, | 259 | struct acpi_table_header *header, |
247 | struct acpi_table_desc *table_info) | 260 | struct acpi_table_desc *table_info) |
@@ -315,7 +328,7 @@ acpi_tb_table_override ( | |||
315 | * | 328 | * |
316 | ******************************************************************************/ | 329 | ******************************************************************************/ |
317 | 330 | ||
318 | acpi_status | 331 | static acpi_status |
319 | acpi_tb_get_this_table ( | 332 | acpi_tb_get_this_table ( |
320 | struct acpi_pointer *address, | 333 | struct acpi_pointer *address, |
321 | struct acpi_table_header *header, | 334 | struct acpi_table_header *header, |
@@ -330,8 +343,8 @@ acpi_tb_get_this_table ( | |||
330 | 343 | ||
331 | 344 | ||
332 | /* | 345 | /* |
333 | * Flags contains the current processor mode (Virtual or Physical addressing) | 346 | * Flags contains the current processor mode (Virtual or Physical |
334 | * The pointer_type is either Logical or Physical | 347 | * addressing) The pointer_type is either Logical or Physical |
335 | */ | 348 | */ |
336 | switch (address->pointer_type) { | 349 | switch (address->pointer_type) { |
337 | case ACPI_PHYSMODE_PHYSPTR: | 350 | case ACPI_PHYSMODE_PHYSPTR: |
@@ -341,7 +354,8 @@ acpi_tb_get_this_table ( | |||
341 | 354 | ||
342 | full_table = ACPI_MEM_ALLOCATE (header->length); | 355 | full_table = ACPI_MEM_ALLOCATE (header->length); |
343 | if (!full_table) { | 356 | if (!full_table) { |
344 | ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n", | 357 | ACPI_REPORT_ERROR (( |
358 | "Could not allocate table memory for [%4.4s] length %X\n", | ||
345 | header->signature, header->length)); | 359 | header->signature, header->length)); |
346 | return_ACPI_STATUS (AE_NO_MEMORY); | 360 | return_ACPI_STATUS (AE_NO_MEMORY); |
347 | } | 361 | } |
@@ -362,12 +376,14 @@ acpi_tb_get_this_table ( | |||
362 | * Just map the table's physical memory | 376 | * Just map the table's physical memory |
363 | * into our address space. | 377 | * into our address space. |
364 | */ | 378 | */ |
365 | status = acpi_os_map_memory (address->pointer.physical, (acpi_size) header->length, | 379 | status = acpi_os_map_memory (address->pointer.physical, |
366 | (void *) &full_table); | 380 | (acpi_size) header->length, (void *) &full_table); |
367 | if (ACPI_FAILURE (status)) { | 381 | if (ACPI_FAILURE (status)) { |
368 | ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", | 382 | ACPI_REPORT_ERROR (( |
383 | "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", | ||
369 | header->signature, | 384 | header->signature, |
370 | ACPI_FORMAT_UINT64 (address->pointer.physical), header->length)); | 385 | ACPI_FORMAT_UINT64 (address->pointer.physical), |
386 | header->length)); | ||
371 | return (status); | 387 | return (status); |
372 | } | 388 | } |
373 | 389 | ||
@@ -465,9 +481,8 @@ acpi_tb_get_table_ptr ( | |||
465 | return_ACPI_STATUS (AE_OK); | 481 | return_ACPI_STATUS (AE_OK); |
466 | } | 482 | } |
467 | 483 | ||
468 | /* | 484 | /* Check for instance out of range */ |
469 | * Check for instance out of range | 485 | |
470 | */ | ||
471 | if (instance > acpi_gbl_table_lists[table_type].count) { | 486 | if (instance > acpi_gbl_table_lists[table_type].count) { |
472 | return_ACPI_STATUS (AE_NOT_EXIST); | 487 | return_ACPI_STATUS (AE_NOT_EXIST); |
473 | } | 488 | } |
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index adc4270988bc..eea5b8cb5ebb 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c | |||
@@ -49,6 +49,19 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbgetall") | 50 | ACPI_MODULE_NAME ("tbgetall") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_tb_get_primary_table ( | ||
56 | struct acpi_pointer *address, | ||
57 | struct acpi_table_desc *table_info); | ||
58 | |||
59 | static acpi_status | ||
60 | acpi_tb_get_secondary_table ( | ||
61 | struct acpi_pointer *address, | ||
62 | acpi_string signature, | ||
63 | struct acpi_table_desc *table_info); | ||
64 | |||
52 | 65 | ||
53 | /******************************************************************************* | 66 | /******************************************************************************* |
54 | * | 67 | * |
@@ -63,7 +76,7 @@ | |||
63 | * | 76 | * |
64 | ******************************************************************************/ | 77 | ******************************************************************************/ |
65 | 78 | ||
66 | acpi_status | 79 | static acpi_status |
67 | acpi_tb_get_primary_table ( | 80 | acpi_tb_get_primary_table ( |
68 | struct acpi_pointer *address, | 81 | struct acpi_pointer *address, |
69 | struct acpi_table_desc *table_info) | 82 | struct acpi_table_desc *table_info) |
@@ -81,9 +94,8 @@ acpi_tb_get_primary_table ( | |||
81 | return_ACPI_STATUS (AE_OK); | 94 | return_ACPI_STATUS (AE_OK); |
82 | } | 95 | } |
83 | 96 | ||
84 | /* | 97 | /* Get the header in order to get signature and table size */ |
85 | * Get the header in order to get signature and table size | 98 | |
86 | */ | ||
87 | status = acpi_tb_get_table_header (address, &header); | 99 | status = acpi_tb_get_table_header (address, &header); |
88 | if (ACPI_FAILURE (status)) { | 100 | if (ACPI_FAILURE (status)) { |
89 | return_ACPI_STATUS (status); | 101 | return_ACPI_STATUS (status); |
@@ -130,7 +142,7 @@ acpi_tb_get_primary_table ( | |||
130 | * | 142 | * |
131 | ******************************************************************************/ | 143 | ******************************************************************************/ |
132 | 144 | ||
133 | acpi_status | 145 | static acpi_status |
134 | acpi_tb_get_secondary_table ( | 146 | acpi_tb_get_secondary_table ( |
135 | struct acpi_pointer *address, | 147 | struct acpi_pointer *address, |
136 | acpi_string signature, | 148 | acpi_string signature, |
@@ -153,7 +165,8 @@ acpi_tb_get_secondary_table ( | |||
153 | /* Signature must match request */ | 165 | /* Signature must match request */ |
154 | 166 | ||
155 | if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { | 167 | if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) { |
156 | ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n", | 168 | ACPI_REPORT_ERROR (( |
169 | "Incorrect table signature - wanted [%s] found [%4.4s]\n", | ||
157 | signature, header.signature)); | 170 | signature, header.signature)); |
158 | return_ACPI_STATUS (AE_BAD_SIGNATURE); | 171 | return_ACPI_STATUS (AE_BAD_SIGNATURE); |
159 | } | 172 | } |
@@ -230,7 +243,8 @@ acpi_tb_get_required_tables ( | |||
230 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 243 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
231 | /* Get the table address from the common internal XSDT */ | 244 | /* Get the table address from the common internal XSDT */ |
232 | 245 | ||
233 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; | 246 | address.pointer.value = |
247 | acpi_gbl_XSDT->table_offset_entry[i]; | ||
234 | 248 | ||
235 | /* | 249 | /* |
236 | * Get the tables needed by this subsystem (FADT and any SSDTs). | 250 | * Get the tables needed by this subsystem (FADT and any SSDTs). |
@@ -252,18 +266,18 @@ acpi_tb_get_required_tables ( | |||
252 | } | 266 | } |
253 | 267 | ||
254 | /* | 268 | /* |
255 | * Convert the FADT to a common format. This allows earlier revisions of the | 269 | * Convert the FADT to a common format. This allows earlier revisions of |
256 | * table to coexist with newer versions, using common access code. | 270 | * the table to coexist with newer versions, using common access code. |
257 | */ | 271 | */ |
258 | status = acpi_tb_convert_table_fadt (); | 272 | status = acpi_tb_convert_table_fadt (); |
259 | if (ACPI_FAILURE (status)) { | 273 | if (ACPI_FAILURE (status)) { |
260 | ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n")); | 274 | ACPI_REPORT_ERROR (( |
275 | "Could not convert FADT to internal common format\n")); | ||
261 | return_ACPI_STATUS (status); | 276 | return_ACPI_STATUS (status); |
262 | } | 277 | } |
263 | 278 | ||
264 | /* | 279 | /* Get the FACS (Pointed to by the FADT) */ |
265 | * Get the FACS (Pointed to by the FADT) | 280 | |
266 | */ | ||
267 | address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; | 281 | address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl; |
268 | 282 | ||
269 | status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); | 283 | status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info); |
@@ -282,9 +296,8 @@ acpi_tb_get_required_tables ( | |||
282 | return_ACPI_STATUS (status); | 296 | return_ACPI_STATUS (status); |
283 | } | 297 | } |
284 | 298 | ||
285 | /* | 299 | /* Get/install the DSDT (Pointed to by the FADT) */ |
286 | * Get/install the DSDT (Pointed to by the FADT) | 300 | |
287 | */ | ||
288 | address.pointer.value = acpi_gbl_FADT->Xdsdt; | 301 | address.pointer.value = acpi_gbl_FADT->Xdsdt; |
289 | 302 | ||
290 | status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); | 303 | status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info); |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 85d5bb01022c..629b64c8193d 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -49,6 +49,14 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbinstal") | 50 | ACPI_MODULE_NAME ("tbinstal") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_tb_match_signature ( | ||
56 | char *signature, | ||
57 | struct acpi_table_desc *table_info, | ||
58 | u8 search_type); | ||
59 | |||
52 | 60 | ||
53 | /******************************************************************************* | 61 | /******************************************************************************* |
54 | * | 62 | * |
@@ -56,6 +64,7 @@ | |||
56 | * | 64 | * |
57 | * PARAMETERS: Signature - Table signature to match | 65 | * PARAMETERS: Signature - Table signature to match |
58 | * table_info - Return data | 66 | * table_info - Return data |
67 | * search_type - Table type to match (primary/secondary) | ||
59 | * | 68 | * |
60 | * RETURN: Status | 69 | * RETURN: Status |
61 | * | 70 | * |
@@ -64,7 +73,7 @@ | |||
64 | * | 73 | * |
65 | ******************************************************************************/ | 74 | ******************************************************************************/ |
66 | 75 | ||
67 | acpi_status | 76 | static acpi_status |
68 | acpi_tb_match_signature ( | 77 | acpi_tb_match_signature ( |
69 | char *signature, | 78 | char *signature, |
70 | struct acpi_table_desc *table_info, | 79 | struct acpi_table_desc *table_info, |
@@ -76,9 +85,8 @@ acpi_tb_match_signature ( | |||
76 | ACPI_FUNCTION_TRACE ("tb_match_signature"); | 85 | ACPI_FUNCTION_TRACE ("tb_match_signature"); |
77 | 86 | ||
78 | 87 | ||
79 | /* | 88 | /* Search for a signature match among the known table types */ |
80 | * Search for a signature match among the known table types | 89 | |
81 | */ | ||
82 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 90 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { |
83 | if (!(acpi_gbl_table_data[i].flags & search_type)) { | 91 | if (!(acpi_gbl_table_data[i].flags & search_type)) { |
84 | continue; | 92 | continue; |
@@ -161,6 +169,7 @@ acpi_tb_install_table ( | |||
161 | * FUNCTION: acpi_tb_recognize_table | 169 | * FUNCTION: acpi_tb_recognize_table |
162 | * | 170 | * |
163 | * PARAMETERS: table_info - Return value from acpi_tb_get_table_body | 171 | * PARAMETERS: table_info - Return value from acpi_tb_get_table_body |
172 | * search_type - Table type to match (primary/secondary) | ||
164 | * | 173 | * |
165 | * RETURN: Status | 174 | * RETURN: Status |
166 | * | 175 | * |
@@ -203,7 +212,8 @@ acpi_tb_recognize_table ( | |||
203 | * This can be any one of many valid ACPI tables, it just isn't one of | 212 | * This can be any one of many valid ACPI tables, it just isn't one of |
204 | * the tables that is consumed by the core subsystem | 213 | * the tables that is consumed by the core subsystem |
205 | */ | 214 | */ |
206 | status = acpi_tb_match_signature (table_header->signature, table_info, search_type); | 215 | status = acpi_tb_match_signature (table_header->signature, |
216 | table_info, search_type); | ||
207 | if (ACPI_FAILURE (status)) { | 217 | if (ACPI_FAILURE (status)) { |
208 | return_ACPI_STATUS (status); | 218 | return_ACPI_STATUS (status); |
209 | } | 219 | } |
@@ -253,9 +263,8 @@ acpi_tb_init_table_descriptor ( | |||
253 | return_ACPI_STATUS (AE_NO_MEMORY); | 263 | return_ACPI_STATUS (AE_NO_MEMORY); |
254 | } | 264 | } |
255 | 265 | ||
256 | /* | 266 | /* Install the table into the global data structure */ |
257 | * Install the table into the global data structure | 267 | |
258 | */ | ||
259 | list_head = &acpi_gbl_table_lists[table_type]; | 268 | list_head = &acpi_gbl_table_lists[table_type]; |
260 | 269 | ||
261 | /* | 270 | /* |
@@ -316,7 +325,8 @@ acpi_tb_init_table_descriptor ( | |||
316 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), | 325 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), |
317 | table_desc->aml_length = (u32) (table_desc->length - | 326 | table_desc->aml_length = (u32) (table_desc->length - |
318 | (u32) sizeof (struct acpi_table_header)); | 327 | (u32) sizeof (struct acpi_table_header)); |
319 | table_desc->table_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_TABLE); | 328 | table_desc->table_id = acpi_ut_allocate_owner_id ( |
329 | ACPI_OWNER_TYPE_TABLE); | ||
320 | table_desc->loaded_into_namespace = FALSE; | 330 | table_desc->loaded_into_namespace = FALSE; |
321 | 331 | ||
322 | /* | 332 | /* |
@@ -349,7 +359,8 @@ acpi_tb_init_table_descriptor ( | |||
349 | ******************************************************************************/ | 359 | ******************************************************************************/ |
350 | 360 | ||
351 | void | 361 | void |
352 | acpi_tb_delete_all_tables (void) | 362 | acpi_tb_delete_all_tables ( |
363 | void) | ||
353 | { | 364 | { |
354 | acpi_table_type type; | 365 | acpi_table_type type; |
355 | 366 | ||
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 9c6913238d52..b7ffe39c3626 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -84,8 +84,9 @@ acpi_tb_verify_rsdp ( | |||
84 | /* | 84 | /* |
85 | * Obtain access to the RSDP structure | 85 | * Obtain access to the RSDP structure |
86 | */ | 86 | */ |
87 | status = acpi_os_map_memory (address->pointer.physical, sizeof (struct rsdp_descriptor), | 87 | status = acpi_os_map_memory (address->pointer.physical, |
88 | (void *) &rsdp); | 88 | sizeof (struct rsdp_descriptor), |
89 | (void *) &rsdp); | ||
89 | if (ACPI_FAILURE (status)) { | 90 | if (ACPI_FAILURE (status)) { |
90 | return_ACPI_STATUS (status); | 91 | return_ACPI_STATUS (status); |
91 | } | 92 | } |
@@ -154,9 +155,9 @@ cleanup: | |||
154 | * | 155 | * |
155 | * FUNCTION: acpi_tb_get_rsdt_address | 156 | * FUNCTION: acpi_tb_get_rsdt_address |
156 | * | 157 | * |
157 | * PARAMETERS: None | 158 | * PARAMETERS: out_address - Where the address is returned |
158 | * | 159 | * |
159 | * RETURN: RSDT physical address | 160 | * RETURN: None, Address |
160 | * | 161 | * |
161 | * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the | 162 | * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the |
162 | * version of the RSDP | 163 | * version of the RSDP |
@@ -181,7 +182,8 @@ acpi_tb_get_rsdt_address ( | |||
181 | out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; | 182 | out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address; |
182 | } | 183 | } |
183 | else { | 184 | else { |
184 | out_address->pointer.value = acpi_gbl_RSDP->xsdt_physical_address; | 185 | out_address->pointer.value = |
186 | acpi_gbl_RSDP->xsdt_physical_address; | ||
185 | } | 187 | } |
186 | } | 188 | } |
187 | 189 | ||
@@ -224,7 +226,8 @@ acpi_tb_validate_rsdt ( | |||
224 | if (no_match) { | 226 | if (no_match) { |
225 | /* Invalid RSDT or XSDT signature */ | 227 | /* Invalid RSDT or XSDT signature */ |
226 | 228 | ||
227 | ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); | 229 | ACPI_REPORT_ERROR (( |
230 | "Invalid signature where RSDP indicates RSDT/XSDT should be located\n")); | ||
228 | 231 | ||
229 | ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); | 232 | ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20); |
230 | 233 | ||
@@ -282,6 +285,7 @@ acpi_tb_get_table_rsdt ( | |||
282 | if (ACPI_FAILURE (status)) { | 285 | if (ACPI_FAILURE (status)) { |
283 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", | 286 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n", |
284 | acpi_format_exception (status))); | 287 | acpi_format_exception (status))); |
288 | |||
285 | return_ACPI_STATUS (status); | 289 | return_ACPI_STATUS (status); |
286 | } | 290 | } |
287 | 291 | ||
@@ -299,7 +303,8 @@ acpi_tb_get_table_rsdt ( | |||
299 | 303 | ||
300 | /* Get the number of tables defined in the RSDT or XSDT */ | 304 | /* Get the number of tables defined in the RSDT or XSDT */ |
301 | 305 | ||
302 | acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer); | 306 | acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, |
307 | table_info.pointer); | ||
303 | 308 | ||
304 | /* Convert and/or copy to an XSDT structure */ | 309 | /* Convert and/or copy to an XSDT structure */ |
305 | 310 | ||
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index fede5804c783..e69d01d443d2 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -49,48 +49,14 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbutils") | 50 | ACPI_MODULE_NAME ("tbutils") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
52 | 53 | ||
53 | /******************************************************************************* | 54 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
54 | * | ||
55 | * FUNCTION: acpi_tb_handle_to_object | ||
56 | * | ||
57 | * PARAMETERS: table_id - Id for which the function is searching | ||
58 | * table_desc - Pointer to return the matching table | ||
59 | * descriptor. | ||
60 | * | ||
61 | * RETURN: Search the tables to find one with a matching table_id and | ||
62 | * return a pointer to that table descriptor. | ||
63 | * | ||
64 | ******************************************************************************/ | ||
65 | #ifdef ACPI_FUTURE_USAGE | ||
66 | acpi_status | 55 | acpi_status |
67 | acpi_tb_handle_to_object ( | 56 | acpi_tb_handle_to_object ( |
68 | u16 table_id, | 57 | u16 table_id, |
69 | struct acpi_table_desc **return_table_desc) | 58 | struct acpi_table_desc **table_desc); |
70 | { | 59 | #endif |
71 | u32 i; | ||
72 | struct acpi_table_desc *table_desc; | ||
73 | |||
74 | |||
75 | ACPI_FUNCTION_NAME ("tb_handle_to_object"); | ||
76 | |||
77 | |||
78 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | ||
79 | table_desc = acpi_gbl_table_lists[i].next; | ||
80 | while (table_desc) { | ||
81 | if (table_desc->table_id == table_id) { | ||
82 | *return_table_desc = table_desc; | ||
83 | return (AE_OK); | ||
84 | } | ||
85 | |||
86 | table_desc = table_desc->next; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); | ||
91 | return (AE_BAD_PARAMETER); | ||
92 | } | ||
93 | #endif /* ACPI_FUTURE_USAGE */ | ||
94 | 60 | ||
95 | 61 | ||
96 | /******************************************************************************* | 62 | /******************************************************************************* |
@@ -128,6 +94,7 @@ acpi_tb_validate_table_header ( | |||
128 | if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { | 94 | if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { |
129 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 95 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
130 | "Cannot read table header at %p\n", table_header)); | 96 | "Cannot read table header at %p\n", table_header)); |
97 | |||
131 | return (AE_BAD_ADDRESS); | 98 | return (AE_BAD_ADDRESS); |
132 | } | 99 | } |
133 | 100 | ||
@@ -141,6 +108,7 @@ acpi_tb_validate_table_header ( | |||
141 | 108 | ||
142 | ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", | 109 | ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", |
143 | (char *) &signature)); | 110 | (char *) &signature)); |
111 | |||
144 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); | 112 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); |
145 | return (AE_BAD_SIGNATURE); | 113 | return (AE_BAD_SIGNATURE); |
146 | } | 114 | } |
@@ -154,6 +122,7 @@ acpi_tb_validate_table_header ( | |||
154 | 122 | ||
155 | ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", | 123 | ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", |
156 | (u32) table_header->length)); | 124 | (u32) table_header->length)); |
125 | |||
157 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); | 126 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); |
158 | return (AE_BAD_HEADER); | 127 | return (AE_BAD_HEADER); |
159 | } | 128 | } |
@@ -193,8 +162,10 @@ acpi_tb_verify_table_checksum ( | |||
193 | /* Return the appropriate exception */ | 162 | /* Return the appropriate exception */ |
194 | 163 | ||
195 | if (checksum) { | 164 | if (checksum) { |
196 | ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", | 165 | ACPI_REPORT_WARNING (( |
197 | table_header->signature, (u32) table_header->checksum, (u32) checksum)); | 166 | "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", |
167 | table_header->signature, (u32) table_header->checksum, | ||
168 | (u32) checksum)); | ||
198 | 169 | ||
199 | status = AE_BAD_CHECKSUM; | 170 | status = AE_BAD_CHECKSUM; |
200 | } | 171 | } |
@@ -209,7 +180,7 @@ acpi_tb_verify_table_checksum ( | |||
209 | * PARAMETERS: Buffer - Buffer to checksum | 180 | * PARAMETERS: Buffer - Buffer to checksum |
210 | * Length - Size of the buffer | 181 | * Length - Size of the buffer |
211 | * | 182 | * |
212 | * RETURNS 8 bit checksum of buffer | 183 | * RETURN: 8 bit checksum of buffer |
213 | * | 184 | * |
214 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. | 185 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. |
215 | * | 186 | * |
@@ -238,3 +209,47 @@ acpi_tb_checksum ( | |||
238 | } | 209 | } |
239 | 210 | ||
240 | 211 | ||
212 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
213 | /******************************************************************************* | ||
214 | * | ||
215 | * FUNCTION: acpi_tb_handle_to_object | ||
216 | * | ||
217 | * PARAMETERS: table_id - Id for which the function is searching | ||
218 | * table_desc - Pointer to return the matching table | ||
219 | * descriptor. | ||
220 | * | ||
221 | * RETURN: Search the tables to find one with a matching table_id and | ||
222 | * return a pointer to that table descriptor. | ||
223 | * | ||
224 | ******************************************************************************/ | ||
225 | |||
226 | acpi_status | ||
227 | acpi_tb_handle_to_object ( | ||
228 | u16 table_id, | ||
229 | struct acpi_table_desc **return_table_desc) | ||
230 | { | ||
231 | u32 i; | ||
232 | struct acpi_table_desc *table_desc; | ||
233 | |||
234 | |||
235 | ACPI_FUNCTION_NAME ("tb_handle_to_object"); | ||
236 | |||
237 | |||
238 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | ||
239 | table_desc = acpi_gbl_table_lists[i].next; | ||
240 | while (table_desc) { | ||
241 | if (table_desc->table_id == table_id) { | ||
242 | *return_table_desc = table_desc; | ||
243 | return (AE_OK); | ||
244 | } | ||
245 | |||
246 | table_desc = table_desc->next; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); | ||
251 | return (AE_BAD_PARAMETER); | ||
252 | } | ||
253 | #endif | ||
254 | |||
255 | |||
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 7715043461c4..0c0b9085dbeb 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -67,7 +67,8 @@ | |||
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | 68 | ||
69 | acpi_status | 69 | acpi_status |
70 | acpi_load_tables (void) | 70 | acpi_load_tables ( |
71 | void) | ||
71 | { | 72 | { |
72 | struct acpi_pointer rsdp_address; | 73 | struct acpi_pointer rsdp_address; |
73 | acpi_status status; | 74 | acpi_status status; |
@@ -82,7 +83,7 @@ acpi_load_tables (void) | |||
82 | &rsdp_address); | 83 | &rsdp_address); |
83 | if (ACPI_FAILURE (status)) { | 84 | if (ACPI_FAILURE (status)) { |
84 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", | 85 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n", |
85 | acpi_format_exception (status))); | 86 | acpi_format_exception (status))); |
86 | goto error_exit; | 87 | goto error_exit; |
87 | } | 88 | } |
88 | 89 | ||
@@ -93,7 +94,7 @@ acpi_load_tables (void) | |||
93 | status = acpi_tb_verify_rsdp (&rsdp_address); | 94 | status = acpi_tb_verify_rsdp (&rsdp_address); |
94 | if (ACPI_FAILURE (status)) { | 95 | if (ACPI_FAILURE (status)) { |
95 | ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", | 96 | ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n", |
96 | acpi_format_exception (status))); | 97 | acpi_format_exception (status))); |
97 | goto error_exit; | 98 | goto error_exit; |
98 | } | 99 | } |
99 | 100 | ||
@@ -102,7 +103,7 @@ acpi_load_tables (void) | |||
102 | status = acpi_tb_get_table_rsdt (); | 103 | status = acpi_tb_get_table_rsdt (); |
103 | if (ACPI_FAILURE (status)) { | 104 | if (ACPI_FAILURE (status)) { |
104 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", | 105 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n", |
105 | acpi_format_exception (status))); | 106 | acpi_format_exception (status))); |
106 | goto error_exit; | 107 | goto error_exit; |
107 | } | 108 | } |
108 | 109 | ||
@@ -110,20 +111,20 @@ acpi_load_tables (void) | |||
110 | 111 | ||
111 | status = acpi_tb_get_required_tables (); | 112 | status = acpi_tb_get_required_tables (); |
112 | if (ACPI_FAILURE (status)) { | 113 | if (ACPI_FAILURE (status)) { |
113 | ACPI_REPORT_ERROR (("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", | 114 | ACPI_REPORT_ERROR (( |
114 | acpi_format_exception (status))); | 115 | "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", |
116 | acpi_format_exception (status))); | ||
115 | goto error_exit; | 117 | goto error_exit; |
116 | } | 118 | } |
117 | 119 | ||
118 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); | 120 | ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); |
119 | 121 | ||
120 | |||
121 | /* Load the namespace from the tables */ | 122 | /* Load the namespace from the tables */ |
122 | 123 | ||
123 | status = acpi_ns_load_namespace (); | 124 | status = acpi_ns_load_namespace (); |
124 | if (ACPI_FAILURE (status)) { | 125 | if (ACPI_FAILURE (status)) { |
125 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", | 126 | ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n", |
126 | acpi_format_exception (status))); | 127 | acpi_format_exception (status))); |
127 | goto error_exit; | 128 | goto error_exit; |
128 | } | 129 | } |
129 | 130 | ||
@@ -139,7 +140,6 @@ error_exit: | |||
139 | 140 | ||
140 | 141 | ||
141 | #ifdef ACPI_FUTURE_USAGE | 142 | #ifdef ACPI_FUTURE_USAGE |
142 | |||
143 | /******************************************************************************* | 143 | /******************************************************************************* |
144 | * | 144 | * |
145 | * FUNCTION: acpi_load_table | 145 | * FUNCTION: acpi_load_table |
@@ -250,7 +250,6 @@ acpi_unload_table ( | |||
250 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 250 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
251 | } | 251 | } |
252 | 252 | ||
253 | |||
254 | /* Find all tables of the requested type */ | 253 | /* Find all tables of the requested type */ |
255 | 254 | ||
256 | table_desc = acpi_gbl_table_lists[table_type].next; | 255 | table_desc = acpi_gbl_table_lists[table_type].next; |
@@ -321,7 +320,6 @@ acpi_get_table_header ( | |||
321 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 320 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
322 | } | 321 | } |
323 | 322 | ||
324 | |||
325 | /* Get a pointer to the entire table */ | 323 | /* Get a pointer to the entire table */ |
326 | 324 | ||
327 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); | 325 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); |
@@ -329,23 +327,20 @@ acpi_get_table_header ( | |||
329 | return_ACPI_STATUS (status); | 327 | return_ACPI_STATUS (status); |
330 | } | 328 | } |
331 | 329 | ||
332 | /* | 330 | /* The function will return a NULL pointer if the table is not loaded */ |
333 | * The function will return a NULL pointer if the table is not loaded | 331 | |
334 | */ | ||
335 | if (tbl_ptr == NULL) { | 332 | if (tbl_ptr == NULL) { |
336 | return_ACPI_STATUS (AE_NOT_EXIST); | 333 | return_ACPI_STATUS (AE_NOT_EXIST); |
337 | } | 334 | } |
338 | 335 | ||
339 | /* | 336 | /* Copy the header to the caller's buffer */ |
340 | * Copy the header to the caller's buffer | 337 | |
341 | */ | ||
342 | ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, | 338 | ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr, |
343 | sizeof (struct acpi_table_header)); | 339 | sizeof (struct acpi_table_header)); |
344 | 340 | ||
345 | return_ACPI_STATUS (status); | 341 | return_ACPI_STATUS (status); |
346 | } | 342 | } |
347 | 343 | ||
348 | |||
349 | #endif /* ACPI_FUTURE_USAGE */ | 344 | #endif /* ACPI_FUTURE_USAGE */ |
350 | 345 | ||
351 | /******************************************************************************* | 346 | /******************************************************************************* |
@@ -404,7 +399,6 @@ acpi_get_table ( | |||
404 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 399 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
405 | } | 400 | } |
406 | 401 | ||
407 | |||
408 | /* Get a pointer to the entire table */ | 402 | /* Get a pointer to the entire table */ |
409 | 403 | ||
410 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); | 404 | status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr); |
@@ -423,9 +417,8 @@ acpi_get_table ( | |||
423 | /* Get the table length */ | 417 | /* Get the table length */ |
424 | 418 | ||
425 | if (table_type == ACPI_TABLE_RSDP) { | 419 | if (table_type == ACPI_TABLE_RSDP) { |
426 | /* | 420 | /* RSD PTR is the only "table" without a header */ |
427 | * RSD PTR is the only "table" without a header | 421 | |
428 | */ | ||
429 | table_length = sizeof (struct rsdp_descriptor); | 422 | table_length = sizeof (struct rsdp_descriptor); |
430 | } | 423 | } |
431 | else { | 424 | else { |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 6e8072ebbac6..dc3c3f6a9f62 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -50,6 +50,18 @@ | |||
50 | #define _COMPONENT ACPI_TABLES | 50 | #define _COMPONENT ACPI_TABLES |
51 | ACPI_MODULE_NAME ("tbxfroot") | 51 | ACPI_MODULE_NAME ("tbxfroot") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static acpi_status | ||
56 | acpi_tb_find_rsdp ( | ||
57 | struct acpi_table_desc *table_info, | ||
58 | u32 flags); | ||
59 | |||
60 | static u8 * | ||
61 | acpi_tb_scan_memory_for_rsdp ( | ||
62 | u8 *start_address, | ||
63 | u32 length); | ||
64 | |||
53 | 65 | ||
54 | /******************************************************************************* | 66 | /******************************************************************************* |
55 | * | 67 | * |
@@ -57,7 +69,8 @@ | |||
57 | * | 69 | * |
58 | * PARAMETERS: Signature - String with ACPI table signature | 70 | * PARAMETERS: Signature - String with ACPI table signature |
59 | * oem_id - String with the table OEM ID | 71 | * oem_id - String with the table OEM ID |
60 | * oem_table_id - String with the OEM Table ID. | 72 | * oem_table_id - String with the OEM Table ID |
73 | * table_ptr - Where the table pointer is returned | ||
61 | * | 74 | * |
62 | * RETURN: Status | 75 | * RETURN: Status |
63 | * | 76 | * |
@@ -99,14 +112,13 @@ acpi_tb_find_table ( | |||
99 | if (!acpi_gbl_DSDT) { | 112 | if (!acpi_gbl_DSDT) { |
100 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 113 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); |
101 | } | 114 | } |
102 | |||
103 | table = acpi_gbl_DSDT; | 115 | table = acpi_gbl_DSDT; |
104 | } | 116 | } |
105 | else { | 117 | else { |
106 | /* Find the table */ | 118 | /* Find the table */ |
107 | 119 | ||
108 | status = acpi_get_firmware_table (signature, 1, | 120 | status = acpi_get_firmware_table (signature, 1, |
109 | ACPI_LOGICAL_ADDRESSING, &table); | 121 | ACPI_LOGICAL_ADDRESSING, &table); |
110 | if (ACPI_FAILURE (status)) { | 122 | if (ACPI_FAILURE (status)) { |
111 | return_ACPI_STATUS (status); | 123 | return_ACPI_STATUS (status); |
112 | } | 124 | } |
@@ -114,14 +126,19 @@ acpi_tb_find_table ( | |||
114 | 126 | ||
115 | /* Check oem_id and oem_table_id */ | 127 | /* Check oem_id and oem_table_id */ |
116 | 128 | ||
117 | if ((oem_id[0] && ACPI_STRNCMP ( | 129 | if ((oem_id[0] && ACPI_STRNCMP ( |
118 | oem_id, table->oem_id, sizeof (table->oem_id))) || | 130 | oem_id, table->oem_id, |
131 | sizeof (table->oem_id))) || | ||
132 | |||
119 | (oem_table_id[0] && ACPI_STRNCMP ( | 133 | (oem_table_id[0] && ACPI_STRNCMP ( |
120 | oem_table_id, table->oem_table_id, sizeof (table->oem_table_id)))) { | 134 | oem_table_id, table->oem_table_id, |
135 | sizeof (table->oem_table_id)))) { | ||
121 | return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); | 136 | return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); |
122 | } | 137 | } |
123 | 138 | ||
124 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", table->signature)); | 139 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", |
140 | table->signature)); | ||
141 | |||
125 | *table_ptr = table; | 142 | *table_ptr = table; |
126 | return_ACPI_STATUS (AE_OK); | 143 | return_ACPI_STATUS (AE_OK); |
127 | } | 144 | } |
@@ -191,8 +208,8 @@ acpi_get_firmware_table ( | |||
191 | /* Map and validate the RSDP */ | 208 | /* Map and validate the RSDP */ |
192 | 209 | ||
193 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 210 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
194 | status = acpi_os_map_memory (address.pointer.physical, sizeof (struct rsdp_descriptor), | 211 | status = acpi_os_map_memory (address.pointer.physical, |
195 | (void *) &acpi_gbl_RSDP); | 212 | sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP); |
196 | if (ACPI_FAILURE (status)) { | 213 | if (ACPI_FAILURE (status)) { |
197 | return_ACPI_STATUS (status); | 214 | return_ACPI_STATUS (status); |
198 | } | 215 | } |
@@ -203,7 +220,8 @@ acpi_get_firmware_table ( | |||
203 | 220 | ||
204 | /* The signature and checksum must both be correct */ | 221 | /* The signature and checksum must both be correct */ |
205 | 222 | ||
206 | if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { | 223 | if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, |
224 | sizeof (RSDP_SIG)-1) != 0) { | ||
207 | /* Nope, BAD Signature */ | 225 | /* Nope, BAD Signature */ |
208 | 226 | ||
209 | return_ACPI_STATUS (AE_BAD_SIGNATURE); | 227 | return_ACPI_STATUS (AE_BAD_SIGNATURE); |
@@ -313,7 +331,8 @@ acpi_get_firmware_table ( | |||
313 | 331 | ||
314 | 332 | ||
315 | cleanup: | 333 | cleanup: |
316 | acpi_os_unmap_memory (rsdt_info->pointer, (acpi_size) rsdt_info->pointer->length); | 334 | acpi_os_unmap_memory (rsdt_info->pointer, |
335 | (acpi_size) rsdt_info->pointer->length); | ||
317 | ACPI_MEM_FREE (rsdt_info); | 336 | ACPI_MEM_FREE (rsdt_info); |
318 | 337 | ||
319 | if (header) { | 338 | if (header) { |
@@ -335,8 +354,8 @@ EXPORT_SYMBOL(acpi_get_firmware_table); | |||
335 | * | 354 | * |
336 | * FUNCTION: acpi_find_root_pointer | 355 | * FUNCTION: acpi_find_root_pointer |
337 | * | 356 | * |
338 | * PARAMETERS: **rsdp_address - Where to place the RSDP address | 357 | * PARAMETERS: Flags - Logical/Physical addressing |
339 | * Flags - Logical/Physical addressing | 358 | * rsdp_address - Where to place the RSDP address |
340 | * | 359 | * |
341 | * RETURN: Status, Physical address of the RSDP | 360 | * RETURN: Status, Physical address of the RSDP |
342 | * | 361 | * |
@@ -363,6 +382,7 @@ acpi_find_root_pointer ( | |||
363 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 382 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
364 | "RSDP structure not found, %s Flags=%X\n", | 383 | "RSDP structure not found, %s Flags=%X\n", |
365 | acpi_format_exception (status), flags)); | 384 | acpi_format_exception (status), flags)); |
385 | |||
366 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 386 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); |
367 | } | 387 | } |
368 | 388 | ||
@@ -385,7 +405,7 @@ acpi_find_root_pointer ( | |||
385 | * | 405 | * |
386 | ******************************************************************************/ | 406 | ******************************************************************************/ |
387 | 407 | ||
388 | u8 * | 408 | static u8 * |
389 | acpi_tb_scan_memory_for_rsdp ( | 409 | acpi_tb_scan_memory_for_rsdp ( |
390 | u8 *start_address, | 410 | u8 *start_address, |
391 | u32 length) | 411 | u32 length) |
@@ -406,7 +426,8 @@ acpi_tb_scan_memory_for_rsdp ( | |||
406 | mem_rover += ACPI_RSDP_SCAN_STEP) { | 426 | mem_rover += ACPI_RSDP_SCAN_STEP) { |
407 | /* The signature and checksum must both be correct */ | 427 | /* The signature and checksum must both be correct */ |
408 | 428 | ||
409 | if (ACPI_STRNCMP ((char *) mem_rover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { | 429 | if (ACPI_STRNCMP ((char *) mem_rover, |
430 | RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) { | ||
410 | /* No signature match, keep looking */ | 431 | /* No signature match, keep looking */ |
411 | 432 | ||
412 | continue; | 433 | continue; |
@@ -450,7 +471,7 @@ acpi_tb_scan_memory_for_rsdp ( | |||
450 | * | 471 | * |
451 | * FUNCTION: acpi_tb_find_rsdp | 472 | * FUNCTION: acpi_tb_find_rsdp |
452 | * | 473 | * |
453 | * PARAMETERS: *table_info - Where the table info is returned | 474 | * PARAMETERS: table_info - Where the table info is returned |
454 | * Flags - Current memory mode (logical vs. | 475 | * Flags - Current memory mode (logical vs. |
455 | * physical addressing) | 476 | * physical addressing) |
456 | * | 477 | * |
@@ -468,7 +489,7 @@ acpi_tb_scan_memory_for_rsdp ( | |||
468 | * | 489 | * |
469 | ******************************************************************************/ | 490 | ******************************************************************************/ |
470 | 491 | ||
471 | acpi_status | 492 | static acpi_status |
472 | acpi_tb_find_rsdp ( | 493 | acpi_tb_find_rsdp ( |
473 | struct acpi_table_desc *table_info, | 494 | struct acpi_table_desc *table_info, |
474 | u32 flags) | 495 | u32 flags) |
@@ -483,43 +504,49 @@ acpi_tb_find_rsdp ( | |||
483 | 504 | ||
484 | 505 | ||
485 | /* | 506 | /* |
486 | * Scan supports either 1) Logical addressing or 2) Physical addressing | 507 | * Scan supports either logical addressing or physical addressing |
487 | */ | 508 | */ |
488 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 509 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
489 | /* | 510 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
490 | * 1a) Get the location of the EBDA | 511 | |
491 | */ | 512 | status = acpi_os_map_memory ( |
492 | status = acpi_os_map_memory ((acpi_physical_address) ACPI_EBDA_PTR_LOCATION, | 513 | (acpi_physical_address) ACPI_EBDA_PTR_LOCATION, |
493 | ACPI_EBDA_PTR_LENGTH, | 514 | ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr); |
494 | (void *) &table_ptr); | ||
495 | if (ACPI_FAILURE (status)) { | 515 | if (ACPI_FAILURE (status)) { |
496 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 516 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
497 | "Could not map memory at %8.8X for length %X\n", | 517 | "Could not map memory at %8.8X for length %X\n", |
498 | ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); | 518 | ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); |
519 | |||
499 | return_ACPI_STATUS (status); | 520 | return_ACPI_STATUS (status); |
500 | } | 521 | } |
501 | 522 | ||
502 | ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); | 523 | ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); |
503 | physical_address <<= 4; /* Convert segment to physical address */ | 524 | |
525 | /* Convert segment part to physical address */ | ||
526 | |||
527 | physical_address <<= 4; | ||
504 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); | 528 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); |
505 | 529 | ||
506 | /* EBDA present? */ | 530 | /* EBDA present? */ |
507 | 531 | ||
508 | if (physical_address > 0x400) { | 532 | if (physical_address > 0x400) { |
509 | /* | 533 | /* |
510 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) | 534 | * 1b) Search EBDA paragraphs (EBDa is required to be a |
535 | * minimum of 1_k length) | ||
511 | */ | 536 | */ |
512 | status = acpi_os_map_memory ((acpi_physical_address) physical_address, | 537 | status = acpi_os_map_memory ( |
513 | ACPI_EBDA_WINDOW_SIZE, | 538 | (acpi_physical_address) physical_address, |
514 | (void *) &table_ptr); | 539 | ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr); |
515 | if (ACPI_FAILURE (status)) { | 540 | if (ACPI_FAILURE (status)) { |
516 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 541 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
517 | "Could not map memory at %8.8X for length %X\n", | 542 | "Could not map memory at %8.8X for length %X\n", |
518 | physical_address, ACPI_EBDA_WINDOW_SIZE)); | 543 | physical_address, ACPI_EBDA_WINDOW_SIZE)); |
544 | |||
519 | return_ACPI_STATUS (status); | 545 | return_ACPI_STATUS (status); |
520 | } | 546 | } |
521 | 547 | ||
522 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_EBDA_WINDOW_SIZE); | 548 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, |
549 | ACPI_EBDA_WINDOW_SIZE); | ||
523 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); | 550 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); |
524 | 551 | ||
525 | if (mem_rover) { | 552 | if (mem_rover) { |
@@ -527,7 +554,8 @@ acpi_tb_find_rsdp ( | |||
527 | 554 | ||
528 | physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); | 555 | physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); |
529 | 556 | ||
530 | table_info->physical_address = (acpi_physical_address) physical_address; | 557 | table_info->physical_address = |
558 | (acpi_physical_address) physical_address; | ||
531 | return_ACPI_STATUS (AE_OK); | 559 | return_ACPI_STATUS (AE_OK); |
532 | } | 560 | } |
533 | } | 561 | } |
@@ -535,13 +563,15 @@ acpi_tb_find_rsdp ( | |||
535 | /* | 563 | /* |
536 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh | 564 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh |
537 | */ | 565 | */ |
538 | status = acpi_os_map_memory ((acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, | 566 | status = acpi_os_map_memory ( |
539 | ACPI_HI_RSDP_WINDOW_SIZE, | 567 | (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, |
540 | (void *) &table_ptr); | 568 | ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr); |
569 | |||
541 | if (ACPI_FAILURE (status)) { | 570 | if (ACPI_FAILURE (status)) { |
542 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 571 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
543 | "Could not map memory at %8.8X for length %X\n", | 572 | "Could not map memory at %8.8X for length %X\n", |
544 | ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); | 573 | ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); |
574 | |||
545 | return_ACPI_STATUS (status); | 575 | return_ACPI_STATUS (status); |
546 | } | 576 | } |
547 | 577 | ||
@@ -551,9 +581,11 @@ acpi_tb_find_rsdp ( | |||
551 | if (mem_rover) { | 581 | if (mem_rover) { |
552 | /* Found it, return the physical address */ | 582 | /* Found it, return the physical address */ |
553 | 583 | ||
554 | physical_address = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); | 584 | physical_address = |
585 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); | ||
555 | 586 | ||
556 | table_info->physical_address = (acpi_physical_address) physical_address; | 587 | table_info->physical_address = |
588 | (acpi_physical_address) physical_address; | ||
557 | return_ACPI_STATUS (AE_OK); | 589 | return_ACPI_STATUS (AE_OK); |
558 | } | 590 | } |
559 | } | 591 | } |
@@ -562,9 +594,8 @@ acpi_tb_find_rsdp ( | |||
562 | * Physical addressing | 594 | * Physical addressing |
563 | */ | 595 | */ |
564 | else { | 596 | else { |
565 | /* | 597 | /* 1a) Get the location of the EBDA */ |
566 | * 1a) Get the location of the EBDA | 598 | |
567 | */ | ||
568 | ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); | 599 | ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); |
569 | physical_address <<= 4; /* Convert segment to physical address */ | 600 | physical_address <<= 4; /* Convert segment to physical address */ |
570 | 601 | ||
@@ -572,9 +603,11 @@ acpi_tb_find_rsdp ( | |||
572 | 603 | ||
573 | if (physical_address > 0x400) { | 604 | if (physical_address > 0x400) { |
574 | /* | 605 | /* |
575 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of 1_k length) | 606 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of |
607 | * 1_k length) | ||
576 | */ | 608 | */ |
577 | mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (physical_address), | 609 | mem_rover = acpi_tb_scan_memory_for_rsdp ( |
610 | ACPI_PHYSADDR_TO_PTR (physical_address), | ||
578 | ACPI_EBDA_WINDOW_SIZE); | 611 | ACPI_EBDA_WINDOW_SIZE); |
579 | if (mem_rover) { | 612 | if (mem_rover) { |
580 | /* Found it, return the physical address */ | 613 | /* Found it, return the physical address */ |
@@ -584,10 +617,10 @@ acpi_tb_find_rsdp ( | |||
584 | } | 617 | } |
585 | } | 618 | } |
586 | 619 | ||
587 | /* | 620 | /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ |
588 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh | 621 | |
589 | */ | 622 | mem_rover = acpi_tb_scan_memory_for_rsdp ( |
590 | mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), | 623 | ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), |
591 | ACPI_HI_RSDP_WINDOW_SIZE); | 624 | ACPI_HI_RSDP_WINDOW_SIZE); |
592 | if (mem_rover) { | 625 | if (mem_rover) { |
593 | /* Found it, return the physical address */ | 626 | /* Found it, return the physical address */ |
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index c84997c9f964..73b1d8aeae9d 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -263,6 +263,9 @@ dispatch_write(struct file* file, const char __user * buffer, | |||
263 | * destination so that sscanf can be used on it safely. | 263 | * destination so that sscanf can be used on it safely. |
264 | */ | 264 | */ |
265 | tmp_buffer = kmalloc(count + 1, GFP_KERNEL); | 265 | tmp_buffer = kmalloc(count + 1, GFP_KERNEL); |
266 | if(!tmp_buffer) | ||
267 | return -ENOMEM; | ||
268 | |||
266 | if (copy_from_user(tmp_buffer, buffer, count)) { | 269 | if (copy_from_user(tmp_buffer, buffer, count)) { |
267 | result = -EFAULT; | 270 | result = -EFAULT; |
268 | } | 271 | } |
@@ -529,6 +532,11 @@ toshiba_acpi_init(void) | |||
529 | 532 | ||
530 | if (acpi_disabled) | 533 | if (acpi_disabled) |
531 | return -ENODEV; | 534 | return -ENODEV; |
535 | |||
536 | if (!acpi_specific_hotkey_enabled){ | ||
537 | printk(MY_INFO "Using generic hotkey driver\n"); | ||
538 | return -ENODEV; | ||
539 | } | ||
532 | /* simple device detection: look for HCI method */ | 540 | /* simple device detection: look for HCI method */ |
533 | if (is_valid_acpi_path(METHOD_HCI_1)) | 541 | if (is_valid_acpi_path(METHOD_HCI_1)) |
534 | method_hci = METHOD_HCI_1; | 542 | method_hci = METHOD_HCI_1; |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 3313439c4bc7..c4e7f989a2bd 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -47,8 +47,35 @@ | |||
47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME ("utalloc") | 48 | ACPI_MODULE_NAME ("utalloc") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
50 | 51 | ||
51 | /****************************************************************************** | 52 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
53 | static struct acpi_debug_mem_block * | ||
54 | acpi_ut_find_allocation ( | ||
55 | u32 list_id, | ||
56 | void *allocation); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ut_track_allocation ( | ||
60 | u32 list_id, | ||
61 | struct acpi_debug_mem_block *address, | ||
62 | acpi_size size, | ||
63 | u8 alloc_type, | ||
64 | u32 component, | ||
65 | char *module, | ||
66 | u32 line); | ||
67 | |||
68 | static acpi_status | ||
69 | acpi_ut_remove_allocation ( | ||
70 | u32 list_id, | ||
71 | struct acpi_debug_mem_block *address, | ||
72 | u32 component, | ||
73 | char *module, | ||
74 | u32 line); | ||
75 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | ||
76 | |||
77 | |||
78 | /******************************************************************************* | ||
52 | * | 79 | * |
53 | * FUNCTION: acpi_ut_release_to_cache | 80 | * FUNCTION: acpi_ut_release_to_cache |
54 | * | 81 | * |
@@ -98,7 +125,8 @@ acpi_ut_release_to_cache ( | |||
98 | 125 | ||
99 | /* Put the object at the head of the cache list */ | 126 | /* Put the object at the head of the cache list */ |
100 | 127 | ||
101 | * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; | 128 | * (ACPI_CAST_INDIRECT_PTR (char, |
129 | &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; | ||
102 | cache_info->list_head = object; | 130 | cache_info->list_head = object; |
103 | cache_info->cache_depth++; | 131 | cache_info->cache_depth++; |
104 | 132 | ||
@@ -115,7 +143,7 @@ acpi_ut_release_to_cache ( | |||
115 | } | 143 | } |
116 | 144 | ||
117 | 145 | ||
118 | /****************************************************************************** | 146 | /******************************************************************************* |
119 | * | 147 | * |
120 | * FUNCTION: acpi_ut_acquire_from_cache | 148 | * FUNCTION: acpi_ut_acquire_from_cache |
121 | * | 149 | * |
@@ -156,7 +184,8 @@ acpi_ut_acquire_from_cache ( | |||
156 | /* There is an object available, use it */ | 184 | /* There is an object available, use it */ |
157 | 185 | ||
158 | object = cache_info->list_head; | 186 | object = cache_info->list_head; |
159 | cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))); | 187 | cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, |
188 | &(((char *) object)[cache_info->link_offset]))); | ||
160 | 189 | ||
161 | ACPI_MEM_TRACKING (cache_info->cache_hits++); | 190 | ACPI_MEM_TRACKING (cache_info->cache_hits++); |
162 | cache_info->cache_depth--; | 191 | cache_info->cache_depth--; |
@@ -201,7 +230,7 @@ acpi_ut_acquire_from_cache ( | |||
201 | 230 | ||
202 | 231 | ||
203 | #ifdef ACPI_ENABLE_OBJECT_CACHE | 232 | #ifdef ACPI_ENABLE_OBJECT_CACHE |
204 | /****************************************************************************** | 233 | /******************************************************************************* |
205 | * | 234 | * |
206 | * FUNCTION: acpi_ut_delete_generic_cache | 235 | * FUNCTION: acpi_ut_delete_generic_cache |
207 | * | 236 | * |
@@ -228,7 +257,8 @@ acpi_ut_delete_generic_cache ( | |||
228 | while (cache_info->list_head) { | 257 | while (cache_info->list_head) { |
229 | /* Delete one cached state object */ | 258 | /* Delete one cached state object */ |
230 | 259 | ||
231 | next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) cache_info->list_head)[cache_info->link_offset]))); | 260 | next = *(ACPI_CAST_INDIRECT_PTR (char, |
261 | &(((char *) cache_info->list_head)[cache_info->link_offset]))); | ||
232 | ACPI_MEM_FREE (cache_info->list_head); | 262 | ACPI_MEM_FREE (cache_info->list_head); |
233 | 263 | ||
234 | cache_info->list_head = next; | 264 | cache_info->list_head = next; |
@@ -497,8 +527,8 @@ acpi_ut_allocate_and_track ( | |||
497 | acpi_status status; | 527 | acpi_status status; |
498 | 528 | ||
499 | 529 | ||
500 | allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), component, | 530 | allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), |
501 | module, line); | 531 | component, module, line); |
502 | if (!allocation) { | 532 | if (!allocation) { |
503 | return (NULL); | 533 | return (NULL); |
504 | } | 534 | } |
@@ -543,8 +573,8 @@ acpi_ut_callocate_and_track ( | |||
543 | acpi_status status; | 573 | acpi_status status; |
544 | 574 | ||
545 | 575 | ||
546 | allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), component, | 576 | allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), |
547 | module, line); | 577 | component, module, line); |
548 | if (!allocation) { | 578 | if (!allocation) { |
549 | /* Report allocation error */ | 579 | /* Report allocation error */ |
550 | 580 | ||
@@ -637,7 +667,7 @@ acpi_ut_free_and_track ( | |||
637 | * | 667 | * |
638 | ******************************************************************************/ | 668 | ******************************************************************************/ |
639 | 669 | ||
640 | struct acpi_debug_mem_block * | 670 | static struct acpi_debug_mem_block * |
641 | acpi_ut_find_allocation ( | 671 | acpi_ut_find_allocation ( |
642 | u32 list_id, | 672 | u32 list_id, |
643 | void *allocation) | 673 | void *allocation) |
@@ -686,7 +716,7 @@ acpi_ut_find_allocation ( | |||
686 | * | 716 | * |
687 | ******************************************************************************/ | 717 | ******************************************************************************/ |
688 | 718 | ||
689 | acpi_status | 719 | static acpi_status |
690 | acpi_ut_track_allocation ( | 720 | acpi_ut_track_allocation ( |
691 | u32 list_id, | 721 | u32 list_id, |
692 | struct acpi_debug_mem_block *allocation, | 722 | struct acpi_debug_mem_block *allocation, |
@@ -721,10 +751,12 @@ acpi_ut_track_allocation ( | |||
721 | 751 | ||
722 | element = acpi_ut_find_allocation (list_id, allocation); | 752 | element = acpi_ut_find_allocation (list_id, allocation); |
723 | if (element) { | 753 | if (element) { |
724 | ACPI_REPORT_ERROR (("ut_track_allocation: Allocation already present in list! (%p)\n", | 754 | ACPI_REPORT_ERROR (( |
755 | "ut_track_allocation: Allocation already present in list! (%p)\n", | ||
725 | allocation)); | 756 | allocation)); |
726 | 757 | ||
727 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, allocation)); | 758 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", |
759 | element, allocation)); | ||
728 | 760 | ||
729 | goto unlock_and_exit; | 761 | goto unlock_and_exit; |
730 | } | 762 | } |
@@ -773,7 +805,7 @@ unlock_and_exit: | |||
773 | * | 805 | * |
774 | ******************************************************************************/ | 806 | ******************************************************************************/ |
775 | 807 | ||
776 | acpi_status | 808 | static acpi_status |
777 | acpi_ut_remove_allocation ( | 809 | acpi_ut_remove_allocation ( |
778 | u32 list_id, | 810 | u32 list_id, |
779 | struct acpi_debug_mem_block *allocation, | 811 | struct acpi_debug_mem_block *allocation, |
@@ -797,7 +829,7 @@ acpi_ut_remove_allocation ( | |||
797 | /* No allocations! */ | 829 | /* No allocations! */ |
798 | 830 | ||
799 | _ACPI_REPORT_ERROR (module, line, component, | 831 | _ACPI_REPORT_ERROR (module, line, component, |
800 | ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); | 832 | ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); |
801 | 833 | ||
802 | return_ACPI_STATUS (AE_OK); | 834 | return_ACPI_STATUS (AE_OK); |
803 | } | 835 | } |
@@ -824,7 +856,8 @@ acpi_ut_remove_allocation ( | |||
824 | 856 | ||
825 | ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size); | 857 | ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size); |
826 | 858 | ||
827 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", allocation->size)); | 859 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", |
860 | allocation->size)); | ||
828 | 861 | ||
829 | status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); | 862 | status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); |
830 | return_ACPI_STATUS (status); | 863 | return_ACPI_STATUS (status); |
@@ -842,6 +875,7 @@ acpi_ut_remove_allocation ( | |||
842 | * DESCRIPTION: Print some info about the outstanding allocations. | 875 | * DESCRIPTION: Print some info about the outstanding allocations. |
843 | * | 876 | * |
844 | ******************************************************************************/ | 877 | ******************************************************************************/ |
878 | |||
845 | #ifdef ACPI_FUTURE_USAGE | 879 | #ifdef ACPI_FUTURE_USAGE |
846 | void | 880 | void |
847 | acpi_ut_dump_allocation_info ( | 881 | acpi_ut_dump_allocation_info ( |
@@ -884,7 +918,8 @@ acpi_ut_dump_allocation_info ( | |||
884 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | 918 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, |
885 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", | 919 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", |
886 | acpi_gbl_max_concurrent_node_count, | 920 | acpi_gbl_max_concurrent_node_count, |
887 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * sizeof (struct acpi_namespace_node))))); | 921 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * |
922 | sizeof (struct acpi_namespace_node))))); | ||
888 | */ | 923 | */ |
889 | return_VOID; | 924 | return_VOID; |
890 | } | 925 | } |
@@ -933,26 +968,26 @@ acpi_ut_dump_allocations ( | |||
933 | descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space); | 968 | descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space); |
934 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { | 969 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { |
935 | acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ", | 970 | acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ", |
936 | descriptor, element->size, element->module, | 971 | descriptor, element->size, element->module, |
937 | element->line, acpi_ut_get_descriptor_name (descriptor)); | 972 | element->line, acpi_ut_get_descriptor_name (descriptor)); |
938 | 973 | ||
939 | /* Most of the elements will be Operand objects. */ | 974 | /* Most of the elements will be Operand objects. */ |
940 | 975 | ||
941 | switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { | 976 | switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { |
942 | case ACPI_DESC_TYPE_OPERAND: | 977 | case ACPI_DESC_TYPE_OPERAND: |
943 | acpi_os_printf ("%12.12s R%hd", | 978 | acpi_os_printf ("%12.12s R%hd", |
944 | acpi_ut_get_type_name (descriptor->object.common.type), | 979 | acpi_ut_get_type_name (descriptor->object.common.type), |
945 | descriptor->object.common.reference_count); | 980 | descriptor->object.common.reference_count); |
946 | break; | 981 | break; |
947 | 982 | ||
948 | case ACPI_DESC_TYPE_PARSER: | 983 | case ACPI_DESC_TYPE_PARSER: |
949 | acpi_os_printf ("aml_opcode %04hX", | 984 | acpi_os_printf ("aml_opcode %04hX", |
950 | descriptor->op.asl.aml_opcode); | 985 | descriptor->op.asl.aml_opcode); |
951 | break; | 986 | break; |
952 | 987 | ||
953 | case ACPI_DESC_TYPE_NAMED: | 988 | case ACPI_DESC_TYPE_NAMED: |
954 | acpi_os_printf ("%4.4s", | 989 | acpi_os_printf ("%4.4s", |
955 | acpi_ut_get_node_name (&descriptor->node)); | 990 | acpi_ut_get_node_name (&descriptor->node)); |
956 | break; | 991 | break; |
957 | 992 | ||
958 | default: | 993 | default: |
@@ -983,6 +1018,5 @@ acpi_ut_dump_allocations ( | |||
983 | return_VOID; | 1018 | return_VOID; |
984 | } | 1019 | } |
985 | 1020 | ||
986 | |||
987 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ | 1021 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ |
988 | 1022 | ||
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 0fcd98bde0d1..11e884957162 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -49,21 +49,69 @@ | |||
49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME ("utcopy") | 50 | ACPI_MODULE_NAME ("utcopy") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ut_copy_isimple_to_esimple ( | ||
56 | union acpi_operand_object *internal_object, | ||
57 | union acpi_object *external_object, | ||
58 | u8 *data_space, | ||
59 | acpi_size *buffer_space_used); | ||
60 | |||
61 | static acpi_status | ||
62 | acpi_ut_copy_ielement_to_ielement ( | ||
63 | u8 object_type, | ||
64 | union acpi_operand_object *source_object, | ||
65 | union acpi_generic_state *state, | ||
66 | void *context); | ||
67 | |||
68 | static acpi_status | ||
69 | acpi_ut_copy_ipackage_to_epackage ( | ||
70 | union acpi_operand_object *internal_object, | ||
71 | u8 *buffer, | ||
72 | acpi_size *space_used); | ||
73 | |||
74 | static acpi_status | ||
75 | acpi_ut_copy_esimple_to_isimple( | ||
76 | union acpi_object *user_obj, | ||
77 | union acpi_operand_object **return_obj); | ||
78 | |||
79 | static acpi_status | ||
80 | acpi_ut_copy_simple_object ( | ||
81 | union acpi_operand_object *source_desc, | ||
82 | union acpi_operand_object *dest_desc); | ||
83 | |||
84 | static acpi_status | ||
85 | acpi_ut_copy_ielement_to_eelement ( | ||
86 | u8 object_type, | ||
87 | union acpi_operand_object *source_object, | ||
88 | union acpi_generic_state *state, | ||
89 | void *context); | ||
90 | |||
91 | static acpi_status | ||
92 | acpi_ut_copy_ipackage_to_ipackage ( | ||
93 | union acpi_operand_object *source_obj, | ||
94 | union acpi_operand_object *dest_obj, | ||
95 | struct acpi_walk_state *walk_state); | ||
96 | |||
52 | 97 | ||
53 | /******************************************************************************* | 98 | /******************************************************************************* |
54 | * | 99 | * |
55 | * FUNCTION: acpi_ut_copy_isimple_to_esimple | 100 | * FUNCTION: acpi_ut_copy_isimple_to_esimple |
56 | * | 101 | * |
57 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 102 | * PARAMETERS: internal_object - Source object to be copied |
58 | * *Buffer - Where the object is returned | 103 | * external_object - Where to return the copied object |
59 | * *space_used - Where the data length is returned | 104 | * data_space - Where object data is returned (such as |
105 | * buffer and string data) | ||
106 | * buffer_space_used - Length of data_space that was used | ||
60 | * | 107 | * |
61 | * RETURN: Status | 108 | * RETURN: Status |
62 | * | 109 | * |
63 | * DESCRIPTION: This function is called to place a simple object in a user | 110 | * DESCRIPTION: This function is called to copy a simple internal object to |
64 | * buffer. | 111 | * an external object. |
65 | * | 112 | * |
66 | * The buffer is assumed to have sufficient space for the object. | 113 | * The data_space buffer is assumed to have sufficient space for |
114 | * the object. | ||
67 | * | 115 | * |
68 | ******************************************************************************/ | 116 | ******************************************************************************/ |
69 | 117 | ||
@@ -107,10 +155,12 @@ acpi_ut_copy_isimple_to_esimple ( | |||
107 | 155 | ||
108 | external_object->string.pointer = (char *) data_space; | 156 | external_object->string.pointer = (char *) data_space; |
109 | external_object->string.length = internal_object->string.length; | 157 | external_object->string.length = internal_object->string.length; |
110 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ((acpi_size) internal_object->string.length + 1); | 158 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ( |
159 | (acpi_size) internal_object->string.length + 1); | ||
111 | 160 | ||
112 | ACPI_MEMCPY ((void *) data_space, (void *) internal_object->string.pointer, | 161 | ACPI_MEMCPY ((void *) data_space, |
113 | (acpi_size) internal_object->string.length + 1); | 162 | (void *) internal_object->string.pointer, |
163 | (acpi_size) internal_object->string.length + 1); | ||
114 | break; | 164 | break; |
115 | 165 | ||
116 | 166 | ||
@@ -118,10 +168,12 @@ acpi_ut_copy_isimple_to_esimple ( | |||
118 | 168 | ||
119 | external_object->buffer.pointer = data_space; | 169 | external_object->buffer.pointer = data_space; |
120 | external_object->buffer.length = internal_object->buffer.length; | 170 | external_object->buffer.length = internal_object->buffer.length; |
121 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (internal_object->string.length); | 171 | *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD ( |
172 | internal_object->string.length); | ||
122 | 173 | ||
123 | ACPI_MEMCPY ((void *) data_space, (void *) internal_object->buffer.pointer, | 174 | ACPI_MEMCPY ((void *) data_space, |
124 | internal_object->buffer.length); | 175 | (void *) internal_object->buffer.pointer, |
176 | internal_object->buffer.length); | ||
125 | break; | 177 | break; |
126 | 178 | ||
127 | 179 | ||
@@ -194,7 +246,7 @@ acpi_ut_copy_isimple_to_esimple ( | |||
194 | * | 246 | * |
195 | ******************************************************************************/ | 247 | ******************************************************************************/ |
196 | 248 | ||
197 | acpi_status | 249 | static acpi_status |
198 | acpi_ut_copy_ielement_to_eelement ( | 250 | acpi_ut_copy_ielement_to_eelement ( |
199 | u8 object_type, | 251 | u8 object_type, |
200 | union acpi_operand_object *source_object, | 252 | union acpi_operand_object *source_object, |
@@ -213,7 +265,7 @@ acpi_ut_copy_ielement_to_eelement ( | |||
213 | 265 | ||
214 | this_index = state->pkg.index; | 266 | this_index = state->pkg.index; |
215 | target_object = (union acpi_object *) | 267 | target_object = (union acpi_object *) |
216 | &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index]; | 268 | &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index]; |
217 | 269 | ||
218 | switch (object_type) { | 270 | switch (object_type) { |
219 | case ACPI_COPY_TYPE_SIMPLE: | 271 | case ACPI_COPY_TYPE_SIMPLE: |
@@ -236,7 +288,8 @@ acpi_ut_copy_ielement_to_eelement ( | |||
236 | */ | 288 | */ |
237 | target_object->type = ACPI_TYPE_PACKAGE; | 289 | target_object->type = ACPI_TYPE_PACKAGE; |
238 | target_object->package.count = source_object->package.count; | 290 | target_object->package.count = source_object->package.count; |
239 | target_object->package.elements = ACPI_CAST_PTR (union acpi_object, info->free_space); | 291 | target_object->package.elements = |
292 | ACPI_CAST_PTR (union acpi_object, info->free_space); | ||
240 | 293 | ||
241 | /* | 294 | /* |
242 | * Pass the new package object back to the package walk routine | 295 | * Pass the new package object back to the package walk routine |
@@ -248,7 +301,8 @@ acpi_ut_copy_ielement_to_eelement ( | |||
248 | * update the buffer length counter | 301 | * update the buffer length counter |
249 | */ | 302 | */ |
250 | object_space = ACPI_ROUND_UP_TO_NATIVE_WORD ( | 303 | object_space = ACPI_ROUND_UP_TO_NATIVE_WORD ( |
251 | (acpi_size) target_object->package.count * sizeof (union acpi_object)); | 304 | (acpi_size) target_object->package.count * |
305 | sizeof (union acpi_object)); | ||
252 | break; | 306 | break; |
253 | 307 | ||
254 | 308 | ||
@@ -266,9 +320,9 @@ acpi_ut_copy_ielement_to_eelement ( | |||
266 | * | 320 | * |
267 | * FUNCTION: acpi_ut_copy_ipackage_to_epackage | 321 | * FUNCTION: acpi_ut_copy_ipackage_to_epackage |
268 | * | 322 | * |
269 | * PARAMETERS: *internal_object - Pointer to the object we are returning | 323 | * PARAMETERS: internal_object - Pointer to the object we are returning |
270 | * *Buffer - Where the object is returned | 324 | * Buffer - Where the object is returned |
271 | * *space_used - Where the object length is returned | 325 | * space_used - Where the object length is returned |
272 | * | 326 | * |
273 | * RETURN: Status | 327 | * RETURN: Status |
274 | * | 328 | * |
@@ -304,13 +358,15 @@ acpi_ut_copy_ipackage_to_epackage ( | |||
304 | * Free space begins right after the first package | 358 | * Free space begins right after the first package |
305 | */ | 359 | */ |
306 | info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); | 360 | info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); |
307 | info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)); | 361 | info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD ( |
362 | sizeof (union acpi_object)); | ||
308 | info.object_space = 0; | 363 | info.object_space = 0; |
309 | info.num_packages = 1; | 364 | info.num_packages = 1; |
310 | 365 | ||
311 | external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); | 366 | external_object->type = ACPI_GET_OBJECT_TYPE (internal_object); |
312 | external_object->package.count = internal_object->package.count; | 367 | external_object->package.count = internal_object->package.count; |
313 | external_object->package.elements = ACPI_CAST_PTR (union acpi_object, info.free_space); | 368 | external_object->package.elements = ACPI_CAST_PTR (union acpi_object, |
369 | info.free_space); | ||
314 | 370 | ||
315 | /* | 371 | /* |
316 | * Leave room for an array of ACPI_OBJECTS in the buffer | 372 | * Leave room for an array of ACPI_OBJECTS in the buffer |
@@ -333,8 +389,8 @@ acpi_ut_copy_ipackage_to_epackage ( | |||
333 | * | 389 | * |
334 | * FUNCTION: acpi_ut_copy_iobject_to_eobject | 390 | * FUNCTION: acpi_ut_copy_iobject_to_eobject |
335 | * | 391 | * |
336 | * PARAMETERS: *internal_object - The internal object to be converted | 392 | * PARAMETERS: internal_object - The internal object to be converted |
337 | * *buffer_ptr - Where the object is returned | 393 | * buffer_ptr - Where the object is returned |
338 | * | 394 | * |
339 | * RETURN: Status | 395 | * RETURN: Status |
340 | * | 396 | * |
@@ -367,10 +423,10 @@ acpi_ut_copy_iobject_to_eobject ( | |||
367 | * Build a simple object (no nested objects) | 423 | * Build a simple object (no nested objects) |
368 | */ | 424 | */ |
369 | status = acpi_ut_copy_isimple_to_esimple (internal_object, | 425 | status = acpi_ut_copy_isimple_to_esimple (internal_object, |
370 | (union acpi_object *) ret_buffer->pointer, | 426 | (union acpi_object *) ret_buffer->pointer, |
371 | ((u8 *) ret_buffer->pointer + | 427 | ((u8 *) ret_buffer->pointer + |
372 | ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))), | 428 | ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))), |
373 | &ret_buffer->length); | 429 | &ret_buffer->length); |
374 | /* | 430 | /* |
375 | * build simple does not include the object size in the length | 431 | * build simple does not include the object size in the length |
376 | * so we add it in here | 432 | * so we add it in here |
@@ -386,8 +442,8 @@ acpi_ut_copy_iobject_to_eobject ( | |||
386 | * | 442 | * |
387 | * FUNCTION: acpi_ut_copy_esimple_to_isimple | 443 | * FUNCTION: acpi_ut_copy_esimple_to_isimple |
388 | * | 444 | * |
389 | * PARAMETERS: *external_object - The external object to be converted | 445 | * PARAMETERS: external_object - The external object to be converted |
390 | * *internal_object - Where the internal object is returned | 446 | * ret_internal_object - Where the internal object is returned |
391 | * | 447 | * |
392 | * RETURN: Status | 448 | * RETURN: Status |
393 | * | 449 | * |
@@ -398,7 +454,7 @@ acpi_ut_copy_iobject_to_eobject ( | |||
398 | * | 454 | * |
399 | ******************************************************************************/ | 455 | ******************************************************************************/ |
400 | 456 | ||
401 | acpi_status | 457 | static acpi_status |
402 | acpi_ut_copy_esimple_to_isimple ( | 458 | acpi_ut_copy_esimple_to_isimple ( |
403 | union acpi_object *external_object, | 459 | union acpi_object *external_object, |
404 | union acpi_operand_object **ret_internal_object) | 460 | union acpi_operand_object **ret_internal_object) |
@@ -417,7 +473,8 @@ acpi_ut_copy_esimple_to_isimple ( | |||
417 | case ACPI_TYPE_BUFFER: | 473 | case ACPI_TYPE_BUFFER: |
418 | case ACPI_TYPE_INTEGER: | 474 | case ACPI_TYPE_INTEGER: |
419 | 475 | ||
420 | internal_object = acpi_ut_create_internal_object ((u8) external_object->type); | 476 | internal_object = acpi_ut_create_internal_object ( |
477 | (u8) external_object->type); | ||
421 | if (!internal_object) { | 478 | if (!internal_object) { |
422 | return_ACPI_STATUS (AE_NO_MEMORY); | 479 | return_ACPI_STATUS (AE_NO_MEMORY); |
423 | } | 480 | } |
@@ -486,7 +543,6 @@ error_exit: | |||
486 | 543 | ||
487 | 544 | ||
488 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 545 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
489 | |||
490 | /* Code to convert packages that are parameters to control methods */ | 546 | /* Code to convert packages that are parameters to control methods */ |
491 | 547 | ||
492 | /******************************************************************************* | 548 | /******************************************************************************* |
@@ -614,7 +670,7 @@ acpi_ut_copy_eobject_to_iobject ( | |||
614 | * | 670 | * |
615 | ******************************************************************************/ | 671 | ******************************************************************************/ |
616 | 672 | ||
617 | acpi_status | 673 | static acpi_status |
618 | acpi_ut_copy_simple_object ( | 674 | acpi_ut_copy_simple_object ( |
619 | union acpi_operand_object *source_desc, | 675 | union acpi_operand_object *source_desc, |
620 | union acpi_operand_object *dest_desc) | 676 | union acpi_operand_object *dest_desc) |
@@ -724,7 +780,7 @@ acpi_ut_copy_simple_object ( | |||
724 | * | 780 | * |
725 | ******************************************************************************/ | 781 | ******************************************************************************/ |
726 | 782 | ||
727 | acpi_status | 783 | static acpi_status |
728 | acpi_ut_copy_ielement_to_ielement ( | 784 | acpi_ut_copy_ielement_to_ielement ( |
729 | u8 object_type, | 785 | u8 object_type, |
730 | union acpi_operand_object *source_object, | 786 | union acpi_operand_object *source_object, |
@@ -837,7 +893,7 @@ error_exit: | |||
837 | * | 893 | * |
838 | ******************************************************************************/ | 894 | ******************************************************************************/ |
839 | 895 | ||
840 | acpi_status | 896 | static acpi_status |
841 | acpi_ut_copy_ipackage_to_ipackage ( | 897 | acpi_ut_copy_ipackage_to_ipackage ( |
842 | union acpi_operand_object *source_obj, | 898 | union acpi_operand_object *source_obj, |
843 | union acpi_operand_object *dest_obj, | 899 | union acpi_operand_object *dest_obj, |
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 985c5d045b78..794c7df3f2ad 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -56,7 +56,7 @@ static char *acpi_gbl_fn_entry_str = "----Entry"; | |||
56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; | 56 | static char *acpi_gbl_fn_exit_str = "----Exit-"; |
57 | 57 | ||
58 | 58 | ||
59 | /***************************************************************************** | 59 | /******************************************************************************* |
60 | * | 60 | * |
61 | * FUNCTION: acpi_ut_init_stack_ptr_trace | 61 | * FUNCTION: acpi_ut_init_stack_ptr_trace |
62 | * | 62 | * |
@@ -64,9 +64,9 @@ static char *acpi_gbl_fn_exit_str = "----Exit-"; | |||
64 | * | 64 | * |
65 | * RETURN: None | 65 | * RETURN: None |
66 | * | 66 | * |
67 | * DESCRIPTION: Save the current stack pointer | 67 | * DESCRIPTION: Save the current CPU stack pointer at subsystem startup |
68 | * | 68 | * |
69 | ****************************************************************************/ | 69 | ******************************************************************************/ |
70 | 70 | ||
71 | void | 71 | void |
72 | acpi_ut_init_stack_ptr_trace ( | 72 | acpi_ut_init_stack_ptr_trace ( |
@@ -79,7 +79,7 @@ acpi_ut_init_stack_ptr_trace ( | |||
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | /***************************************************************************** | 82 | /******************************************************************************* |
83 | * | 83 | * |
84 | * FUNCTION: acpi_ut_track_stack_ptr | 84 | * FUNCTION: acpi_ut_track_stack_ptr |
85 | * | 85 | * |
@@ -87,9 +87,9 @@ acpi_ut_init_stack_ptr_trace ( | |||
87 | * | 87 | * |
88 | * RETURN: None | 88 | * RETURN: None |
89 | * | 89 | * |
90 | * DESCRIPTION: Save the current stack pointer | 90 | * DESCRIPTION: Save the current CPU stack pointer |
91 | * | 91 | * |
92 | ****************************************************************************/ | 92 | ******************************************************************************/ |
93 | 93 | ||
94 | void | 94 | void |
95 | acpi_ut_track_stack_ptr ( | 95 | acpi_ut_track_stack_ptr ( |
@@ -110,16 +110,16 @@ acpi_ut_track_stack_ptr ( | |||
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | /***************************************************************************** | 113 | /******************************************************************************* |
114 | * | 114 | * |
115 | * FUNCTION: acpi_ut_debug_print | 115 | * FUNCTION: acpi_ut_debug_print |
116 | * | 116 | * |
117 | * PARAMETERS: debug_level - Requested debug print level | 117 | * PARAMETERS: requested_debug_level - Requested debug print level |
118 | * proc_name - Caller's procedure name | ||
119 | * module_name - Caller's module name (for error output) | ||
120 | * line_number - Caller's line number (for error output) | 118 | * line_number - Caller's line number (for error output) |
121 | * component_id - Caller's component ID (for error output) | 119 | * dbg_info - Contains: |
122 | * | 120 | * proc_name - Caller's procedure name |
121 | * module_name - Caller's module name | ||
122 | * component_id - Caller's component ID | ||
123 | * Format - Printf format field | 123 | * Format - Printf format field |
124 | * ... - Optional printf arguments | 124 | * ... - Optional printf arguments |
125 | * | 125 | * |
@@ -128,7 +128,7 @@ acpi_ut_track_stack_ptr ( | |||
128 | * DESCRIPTION: Print error message with prefix consisting of the module name, | 128 | * DESCRIPTION: Print error message with prefix consisting of the module name, |
129 | * line number, and component ID. | 129 | * line number, and component ID. |
130 | * | 130 | * |
131 | ****************************************************************************/ | 131 | ******************************************************************************/ |
132 | 132 | ||
133 | void ACPI_INTERNAL_VAR_XFACE | 133 | void ACPI_INTERNAL_VAR_XFACE |
134 | acpi_ut_debug_print ( | 134 | acpi_ut_debug_print ( |
@@ -157,7 +157,8 @@ acpi_ut_debug_print ( | |||
157 | 157 | ||
158 | if (thread_id != acpi_gbl_prev_thread_id) { | 158 | if (thread_id != acpi_gbl_prev_thread_id) { |
159 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 159 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
160 | acpi_os_printf ("\n**** Context Switch from TID %X to TID %X ****\n\n", | 160 | acpi_os_printf ( |
161 | "\n**** Context Switch from TID %X to TID %X ****\n\n", | ||
161 | acpi_gbl_prev_thread_id, thread_id); | 162 | acpi_gbl_prev_thread_id, thread_id); |
162 | } | 163 | } |
163 | 164 | ||
@@ -174,15 +175,16 @@ acpi_ut_debug_print ( | |||
174 | acpi_os_printf ("[%04lX] ", thread_id); | 175 | acpi_os_printf ("[%04lX] ", thread_id); |
175 | } | 176 | } |
176 | 177 | ||
177 | acpi_os_printf ("[%02ld] %-22.22s: ", acpi_gbl_nesting_level, dbg_info->proc_name); | 178 | acpi_os_printf ("[%02ld] %-22.22s: ", |
179 | acpi_gbl_nesting_level, dbg_info->proc_name); | ||
178 | 180 | ||
179 | va_start (args, format); | 181 | va_start (args, format); |
180 | acpi_os_vprintf (format, args); | 182 | acpi_os_vprintf (format, args); |
181 | } | 183 | } |
182 | EXPORT_SYMBOL(acpi_ut_debug_print); | ||
183 | 184 | ||
185 | EXPORT_SYMBOL(acpi_ut_debug_print); | ||
184 | 186 | ||
185 | /***************************************************************************** | 187 | /******************************************************************************* |
186 | * | 188 | * |
187 | * FUNCTION: acpi_ut_debug_print_raw | 189 | * FUNCTION: acpi_ut_debug_print_raw |
188 | * | 190 | * |
@@ -200,7 +202,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print); | |||
200 | * DESCRIPTION: Print message with no headers. Has same interface as | 202 | * DESCRIPTION: Print message with no headers. Has same interface as |
201 | * debug_print so that the same macros can be used. | 203 | * debug_print so that the same macros can be used. |
202 | * | 204 | * |
203 | ****************************************************************************/ | 205 | ******************************************************************************/ |
204 | 206 | ||
205 | void ACPI_INTERNAL_VAR_XFACE | 207 | void ACPI_INTERNAL_VAR_XFACE |
206 | acpi_ut_debug_print_raw ( | 208 | acpi_ut_debug_print_raw ( |
@@ -224,7 +226,7 @@ acpi_ut_debug_print_raw ( | |||
224 | EXPORT_SYMBOL(acpi_ut_debug_print_raw); | 226 | EXPORT_SYMBOL(acpi_ut_debug_print_raw); |
225 | 227 | ||
226 | 228 | ||
227 | /***************************************************************************** | 229 | /******************************************************************************* |
228 | * | 230 | * |
229 | * FUNCTION: acpi_ut_trace | 231 | * FUNCTION: acpi_ut_trace |
230 | * | 232 | * |
@@ -239,7 +241,7 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); | |||
239 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 241 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
240 | * set in debug_level | 242 | * set in debug_level |
241 | * | 243 | * |
242 | ****************************************************************************/ | 244 | ******************************************************************************/ |
243 | 245 | ||
244 | void | 246 | void |
245 | acpi_ut_trace ( | 247 | acpi_ut_trace ( |
@@ -256,7 +258,7 @@ acpi_ut_trace ( | |||
256 | EXPORT_SYMBOL(acpi_ut_trace); | 258 | EXPORT_SYMBOL(acpi_ut_trace); |
257 | 259 | ||
258 | 260 | ||
259 | /***************************************************************************** | 261 | /******************************************************************************* |
260 | * | 262 | * |
261 | * FUNCTION: acpi_ut_trace_ptr | 263 | * FUNCTION: acpi_ut_trace_ptr |
262 | * | 264 | * |
@@ -272,7 +274,7 @@ EXPORT_SYMBOL(acpi_ut_trace); | |||
272 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 274 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
273 | * set in debug_level | 275 | * set in debug_level |
274 | * | 276 | * |
275 | ****************************************************************************/ | 277 | ******************************************************************************/ |
276 | 278 | ||
277 | void | 279 | void |
278 | acpi_ut_trace_ptr ( | 280 | acpi_ut_trace_ptr ( |
@@ -288,7 +290,7 @@ acpi_ut_trace_ptr ( | |||
288 | } | 290 | } |
289 | 291 | ||
290 | 292 | ||
291 | /***************************************************************************** | 293 | /******************************************************************************* |
292 | * | 294 | * |
293 | * FUNCTION: acpi_ut_trace_str | 295 | * FUNCTION: acpi_ut_trace_str |
294 | * | 296 | * |
@@ -304,7 +306,7 @@ acpi_ut_trace_ptr ( | |||
304 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 306 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
305 | * set in debug_level | 307 | * set in debug_level |
306 | * | 308 | * |
307 | ****************************************************************************/ | 309 | ******************************************************************************/ |
308 | 310 | ||
309 | void | 311 | void |
310 | acpi_ut_trace_str ( | 312 | acpi_ut_trace_str ( |
@@ -321,7 +323,7 @@ acpi_ut_trace_str ( | |||
321 | } | 323 | } |
322 | 324 | ||
323 | 325 | ||
324 | /***************************************************************************** | 326 | /******************************************************************************* |
325 | * | 327 | * |
326 | * FUNCTION: acpi_ut_trace_u32 | 328 | * FUNCTION: acpi_ut_trace_u32 |
327 | * | 329 | * |
@@ -337,7 +339,7 @@ acpi_ut_trace_str ( | |||
337 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is | 339 | * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is |
338 | * set in debug_level | 340 | * set in debug_level |
339 | * | 341 | * |
340 | ****************************************************************************/ | 342 | ******************************************************************************/ |
341 | 343 | ||
342 | void | 344 | void |
343 | acpi_ut_trace_u32 ( | 345 | acpi_ut_trace_u32 ( |
@@ -354,7 +356,7 @@ acpi_ut_trace_u32 ( | |||
354 | } | 356 | } |
355 | 357 | ||
356 | 358 | ||
357 | /***************************************************************************** | 359 | /******************************************************************************* |
358 | * | 360 | * |
359 | * FUNCTION: acpi_ut_exit | 361 | * FUNCTION: acpi_ut_exit |
360 | * | 362 | * |
@@ -369,7 +371,7 @@ acpi_ut_trace_u32 ( | |||
369 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 371 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
370 | * set in debug_level | 372 | * set in debug_level |
371 | * | 373 | * |
372 | ****************************************************************************/ | 374 | ******************************************************************************/ |
373 | 375 | ||
374 | void | 376 | void |
375 | acpi_ut_exit ( | 377 | acpi_ut_exit ( |
@@ -385,7 +387,7 @@ acpi_ut_exit ( | |||
385 | EXPORT_SYMBOL(acpi_ut_exit); | 387 | EXPORT_SYMBOL(acpi_ut_exit); |
386 | 388 | ||
387 | 389 | ||
388 | /***************************************************************************** | 390 | /******************************************************************************* |
389 | * | 391 | * |
390 | * FUNCTION: acpi_ut_status_exit | 392 | * FUNCTION: acpi_ut_status_exit |
391 | * | 393 | * |
@@ -401,7 +403,7 @@ EXPORT_SYMBOL(acpi_ut_exit); | |||
401 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 403 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
402 | * set in debug_level. Prints exit status also. | 404 | * set in debug_level. Prints exit status also. |
403 | * | 405 | * |
404 | ****************************************************************************/ | 406 | ******************************************************************************/ |
405 | 407 | ||
406 | void | 408 | void |
407 | acpi_ut_status_exit ( | 409 | acpi_ut_status_exit ( |
@@ -426,7 +428,7 @@ acpi_ut_status_exit ( | |||
426 | EXPORT_SYMBOL(acpi_ut_status_exit); | 428 | EXPORT_SYMBOL(acpi_ut_status_exit); |
427 | 429 | ||
428 | 430 | ||
429 | /***************************************************************************** | 431 | /******************************************************************************* |
430 | * | 432 | * |
431 | * FUNCTION: acpi_ut_value_exit | 433 | * FUNCTION: acpi_ut_value_exit |
432 | * | 434 | * |
@@ -442,7 +444,7 @@ EXPORT_SYMBOL(acpi_ut_status_exit); | |||
442 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 444 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
443 | * set in debug_level. Prints exit value also. | 445 | * set in debug_level. Prints exit value also. |
444 | * | 446 | * |
445 | ****************************************************************************/ | 447 | ******************************************************************************/ |
446 | 448 | ||
447 | void | 449 | void |
448 | acpi_ut_value_exit ( | 450 | acpi_ut_value_exit ( |
@@ -460,7 +462,7 @@ acpi_ut_value_exit ( | |||
460 | EXPORT_SYMBOL(acpi_ut_value_exit); | 462 | EXPORT_SYMBOL(acpi_ut_value_exit); |
461 | 463 | ||
462 | 464 | ||
463 | /***************************************************************************** | 465 | /******************************************************************************* |
464 | * | 466 | * |
465 | * FUNCTION: acpi_ut_ptr_exit | 467 | * FUNCTION: acpi_ut_ptr_exit |
466 | * | 468 | * |
@@ -469,14 +471,14 @@ EXPORT_SYMBOL(acpi_ut_value_exit); | |||
469 | * proc_name - Caller's procedure name | 471 | * proc_name - Caller's procedure name |
470 | * module_name - Caller's module name | 472 | * module_name - Caller's module name |
471 | * component_id - Caller's component ID | 473 | * component_id - Caller's component ID |
472 | * Value - Value to be printed with exit msg | 474 | * Ptr - Pointer to display |
473 | * | 475 | * |
474 | * RETURN: None | 476 | * RETURN: None |
475 | * | 477 | * |
476 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is | 478 | * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is |
477 | * set in debug_level. Prints exit value also. | 479 | * set in debug_level. Prints exit value also. |
478 | * | 480 | * |
479 | ****************************************************************************/ | 481 | ******************************************************************************/ |
480 | 482 | ||
481 | void | 483 | void |
482 | acpi_ut_ptr_exit ( | 484 | acpi_ut_ptr_exit ( |
@@ -494,7 +496,7 @@ acpi_ut_ptr_exit ( | |||
494 | #endif | 496 | #endif |
495 | 497 | ||
496 | 498 | ||
497 | /***************************************************************************** | 499 | /******************************************************************************* |
498 | * | 500 | * |
499 | * FUNCTION: acpi_ut_dump_buffer | 501 | * FUNCTION: acpi_ut_dump_buffer |
500 | * | 502 | * |
@@ -507,7 +509,7 @@ acpi_ut_ptr_exit ( | |||
507 | * | 509 | * |
508 | * DESCRIPTION: Generic dump buffer in both hex and ascii. | 510 | * DESCRIPTION: Generic dump buffer in both hex and ascii. |
509 | * | 511 | * |
510 | ****************************************************************************/ | 512 | ******************************************************************************/ |
511 | 513 | ||
512 | void | 514 | void |
513 | acpi_ut_dump_buffer ( | 515 | acpi_ut_dump_buffer ( |
@@ -533,34 +535,28 @@ acpi_ut_dump_buffer ( | |||
533 | display = DB_BYTE_DISPLAY; | 535 | display = DB_BYTE_DISPLAY; |
534 | } | 536 | } |
535 | 537 | ||
536 | acpi_os_printf ("\nOffset Value\n"); | 538 | /* Nasty little dump buffer routine! */ |
537 | 539 | ||
538 | /* | ||
539 | * Nasty little dump buffer routine! | ||
540 | */ | ||
541 | while (i < count) { | 540 | while (i < count) { |
542 | /* Print current offset */ | 541 | /* Print current offset */ |
543 | 542 | ||
544 | acpi_os_printf ("%05X ", (u32) i); | 543 | acpi_os_printf ("%6.4X: ", (u32) i); |
545 | 544 | ||
546 | /* Print 16 hex chars */ | 545 | /* Print 16 hex chars */ |
547 | 546 | ||
548 | for (j = 0; j < 16;) { | 547 | for (j = 0; j < 16;) { |
549 | if (i + j >= count) { | 548 | if (i + j >= count) { |
550 | acpi_os_printf ("\n"); | 549 | /* Dump fill spaces */ |
551 | return; | ||
552 | } | ||
553 | 550 | ||
554 | /* Make sure that the s8 doesn't get sign-extended! */ | 551 | acpi_os_printf ("%*s", ((display * 2) + 1), " "); |
552 | j += display; | ||
553 | continue; | ||
554 | } | ||
555 | 555 | ||
556 | switch (display) { | 556 | switch (display) { |
557 | /* Default is BYTE display */ | 557 | default: /* Default is BYTE display */ |
558 | 558 | ||
559 | default: | 559 | acpi_os_printf ("%02X ", buffer[i + j]); |
560 | |||
561 | acpi_os_printf ("%02X ", | ||
562 | *((u8 *) &buffer[i + j])); | ||
563 | j += 1; | ||
564 | break; | 560 | break; |
565 | 561 | ||
566 | 562 | ||
@@ -568,7 +564,6 @@ acpi_ut_dump_buffer ( | |||
568 | 564 | ||
569 | ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); | 565 | ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]); |
570 | acpi_os_printf ("%04X ", temp32); | 566 | acpi_os_printf ("%04X ", temp32); |
571 | j += 2; | ||
572 | break; | 567 | break; |
573 | 568 | ||
574 | 569 | ||
@@ -576,7 +571,6 @@ acpi_ut_dump_buffer ( | |||
576 | 571 | ||
577 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); | 572 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]); |
578 | acpi_os_printf ("%08X ", temp32); | 573 | acpi_os_printf ("%08X ", temp32); |
579 | j += 4; | ||
580 | break; | 574 | break; |
581 | 575 | ||
582 | 576 | ||
@@ -587,15 +581,17 @@ acpi_ut_dump_buffer ( | |||
587 | 581 | ||
588 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); | 582 | ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]); |
589 | acpi_os_printf ("%08X ", temp32); | 583 | acpi_os_printf ("%08X ", temp32); |
590 | j += 8; | ||
591 | break; | 584 | break; |
592 | } | 585 | } |
586 | |||
587 | j += display; | ||
593 | } | 588 | } |
594 | 589 | ||
595 | /* | 590 | /* |
596 | * Print the ASCII equivalent characters | 591 | * Print the ASCII equivalent characters |
597 | * But watch out for the bad unprintable ones... | 592 | * But watch out for the bad unprintable ones... |
598 | */ | 593 | */ |
594 | acpi_os_printf (" "); | ||
599 | for (j = 0; j < 16; j++) { | 595 | for (j = 0; j < 16; j++) { |
600 | if (i + j >= count) { | 596 | if (i + j >= count) { |
601 | acpi_os_printf ("\n"); | 597 | acpi_os_printf ("\n"); |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 9a52ad52a23a..bc5403022681 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -51,12 +51,23 @@ | |||
51 | #define _COMPONENT ACPI_UTILITIES | 51 | #define _COMPONENT ACPI_UTILITIES |
52 | ACPI_MODULE_NAME ("utdelete") | 52 | ACPI_MODULE_NAME ("utdelete") |
53 | 53 | ||
54 | /* Local prototypes */ | ||
55 | |||
56 | static void | ||
57 | acpi_ut_delete_internal_obj ( | ||
58 | union acpi_operand_object *object); | ||
59 | |||
60 | static void | ||
61 | acpi_ut_update_ref_count ( | ||
62 | union acpi_operand_object *object, | ||
63 | u32 action); | ||
64 | |||
54 | 65 | ||
55 | /******************************************************************************* | 66 | /******************************************************************************* |
56 | * | 67 | * |
57 | * FUNCTION: acpi_ut_delete_internal_obj | 68 | * FUNCTION: acpi_ut_delete_internal_obj |
58 | * | 69 | * |
59 | * PARAMETERS: *Object - Pointer to the list to be deleted | 70 | * PARAMETERS: Object - Object to be deleted |
60 | * | 71 | * |
61 | * RETURN: None | 72 | * RETURN: None |
62 | * | 73 | * |
@@ -65,7 +76,7 @@ | |||
65 | * | 76 | * |
66 | ******************************************************************************/ | 77 | ******************************************************************************/ |
67 | 78 | ||
68 | void | 79 | static void |
69 | acpi_ut_delete_internal_obj ( | 80 | acpi_ut_delete_internal_obj ( |
70 | union acpi_operand_object *object) | 81 | union acpi_operand_object *object) |
71 | { | 82 | { |
@@ -152,7 +163,8 @@ acpi_ut_delete_internal_obj ( | |||
152 | 163 | ||
153 | case ACPI_TYPE_MUTEX: | 164 | case ACPI_TYPE_MUTEX: |
154 | 165 | ||
155 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n", | 166 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
167 | "***** Mutex %p, Semaphore %p\n", | ||
156 | object, object->mutex.semaphore)); | 168 | object, object->mutex.semaphore)); |
157 | 169 | ||
158 | acpi_ex_unlink_mutex (object); | 170 | acpi_ex_unlink_mutex (object); |
@@ -162,7 +174,8 @@ acpi_ut_delete_internal_obj ( | |||
162 | 174 | ||
163 | case ACPI_TYPE_EVENT: | 175 | case ACPI_TYPE_EVENT: |
164 | 176 | ||
165 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n", | 177 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
178 | "***** Event %p, Semaphore %p\n", | ||
166 | object, object->event.semaphore)); | 179 | object, object->event.semaphore)); |
167 | 180 | ||
168 | (void) acpi_os_delete_semaphore (object->event.semaphore); | 181 | (void) acpi_os_delete_semaphore (object->event.semaphore); |
@@ -172,7 +185,8 @@ acpi_ut_delete_internal_obj ( | |||
172 | 185 | ||
173 | case ACPI_TYPE_METHOD: | 186 | case ACPI_TYPE_METHOD: |
174 | 187 | ||
175 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", object)); | 188 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
189 | "***** Method %p\n", object)); | ||
176 | 190 | ||
177 | /* Delete the method semaphore if it exists */ | 191 | /* Delete the method semaphore if it exists */ |
178 | 192 | ||
@@ -185,7 +199,8 @@ acpi_ut_delete_internal_obj ( | |||
185 | 199 | ||
186 | case ACPI_TYPE_REGION: | 200 | case ACPI_TYPE_REGION: |
187 | 201 | ||
188 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", object)); | 202 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
203 | "***** Region %p\n", object)); | ||
189 | 204 | ||
190 | second_desc = acpi_ns_get_secondary_object (object); | 205 | second_desc = acpi_ns_get_secondary_object (object); |
191 | if (second_desc) { | 206 | if (second_desc) { |
@@ -212,7 +227,8 @@ acpi_ut_delete_internal_obj ( | |||
212 | 227 | ||
213 | case ACPI_TYPE_BUFFER_FIELD: | 228 | case ACPI_TYPE_BUFFER_FIELD: |
214 | 229 | ||
215 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", object)); | 230 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
231 | "***** Buffer Field %p\n", object)); | ||
216 | 232 | ||
217 | second_desc = acpi_ns_get_secondary_object (object); | 233 | second_desc = acpi_ns_get_secondary_object (object); |
218 | if (second_desc) { | 234 | if (second_desc) { |
@@ -247,7 +263,7 @@ acpi_ut_delete_internal_obj ( | |||
247 | * | 263 | * |
248 | * FUNCTION: acpi_ut_delete_internal_object_list | 264 | * FUNCTION: acpi_ut_delete_internal_object_list |
249 | * | 265 | * |
250 | * PARAMETERS: *obj_list - Pointer to the list to be deleted | 266 | * PARAMETERS: obj_list - Pointer to the list to be deleted |
251 | * | 267 | * |
252 | * RETURN: None | 268 | * RETURN: None |
253 | * | 269 | * |
@@ -283,7 +299,7 @@ acpi_ut_delete_internal_object_list ( | |||
283 | * | 299 | * |
284 | * FUNCTION: acpi_ut_update_ref_count | 300 | * FUNCTION: acpi_ut_update_ref_count |
285 | * | 301 | * |
286 | * PARAMETERS: *Object - Object whose ref count is to be updated | 302 | * PARAMETERS: Object - Object whose ref count is to be updated |
287 | * Action - What to do | 303 | * Action - What to do |
288 | * | 304 | * |
289 | * RETURN: New ref count | 305 | * RETURN: New ref count |
@@ -312,7 +328,8 @@ acpi_ut_update_ref_count ( | |||
312 | new_count = count; | 328 | new_count = count; |
313 | 329 | ||
314 | /* | 330 | /* |
315 | * Perform the reference count action (increment, decrement, or force delete) | 331 | * Perform the reference count action |
332 | * (increment, decrement, or force delete) | ||
316 | */ | 333 | */ |
317 | switch (action) { | 334 | switch (action) { |
318 | 335 | ||
@@ -321,7 +338,8 @@ acpi_ut_update_ref_count ( | |||
321 | new_count++; | 338 | new_count++; |
322 | object->common.reference_count = new_count; | 339 | object->common.reference_count = new_count; |
323 | 340 | ||
324 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n", | 341 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
342 | "Obj %p Refs=%X, [Incremented]\n", | ||
325 | object, new_count)); | 343 | object, new_count)); |
326 | break; | 344 | break; |
327 | 345 | ||
@@ -329,7 +347,8 @@ acpi_ut_update_ref_count ( | |||
329 | case REF_DECREMENT: | 347 | case REF_DECREMENT: |
330 | 348 | ||
331 | if (count < 1) { | 349 | if (count < 1) { |
332 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n", | 350 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
351 | "Obj %p Refs=%X, can't decrement! (Set to 0)\n", | ||
333 | object, new_count)); | 352 | object, new_count)); |
334 | 353 | ||
335 | new_count = 0; | 354 | new_count = 0; |
@@ -337,12 +356,14 @@ acpi_ut_update_ref_count ( | |||
337 | else { | 356 | else { |
338 | new_count--; | 357 | new_count--; |
339 | 358 | ||
340 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n", | 359 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
360 | "Obj %p Refs=%X, [Decremented]\n", | ||
341 | object, new_count)); | 361 | object, new_count)); |
342 | } | 362 | } |
343 | 363 | ||
344 | if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) { | 364 | if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) { |
345 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n", | 365 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
366 | "Method Obj %p Refs=%X, [Decremented]\n", | ||
346 | object, new_count)); | 367 | object, new_count)); |
347 | } | 368 | } |
348 | 369 | ||
@@ -356,7 +377,8 @@ acpi_ut_update_ref_count ( | |||
356 | 377 | ||
357 | case REF_FORCE_DELETE: | 378 | case REF_FORCE_DELETE: |
358 | 379 | ||
359 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n", | 380 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
381 | "Obj %p Refs=%X, Force delete! (Set to 0)\n", | ||
360 | object, count)); | 382 | object, count)); |
361 | 383 | ||
362 | new_count = 0; | 384 | new_count = 0; |
@@ -390,7 +412,7 @@ acpi_ut_update_ref_count ( | |||
390 | * | 412 | * |
391 | * FUNCTION: acpi_ut_update_object_reference | 413 | * FUNCTION: acpi_ut_update_object_reference |
392 | * | 414 | * |
393 | * PARAMETERS: *Object - Increment ref count for this object | 415 | * PARAMETERS: Object - Increment ref count for this object |
394 | * and all sub-objects | 416 | * and all sub-objects |
395 | * Action - Either REF_INCREMENT or REF_DECREMENT or | 417 | * Action - Either REF_INCREMENT or REF_DECREMENT or |
396 | * REF_FORCE_DELETE | 418 | * REF_FORCE_DELETE |
@@ -431,7 +453,8 @@ acpi_ut_update_object_reference ( | |||
431 | /* Make sure that this isn't a namespace handle */ | 453 | /* Make sure that this isn't a namespace handle */ |
432 | 454 | ||
433 | if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { | 455 | if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { |
434 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", object)); | 456 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, |
457 | "Object %p is NS handle\n", object)); | ||
435 | return_ACPI_STATUS (AE_OK); | 458 | return_ACPI_STATUS (AE_OK); |
436 | } | 459 | } |
437 | 460 | ||
@@ -614,8 +637,8 @@ error_exit: | |||
614 | * | 637 | * |
615 | * FUNCTION: acpi_ut_add_reference | 638 | * FUNCTION: acpi_ut_add_reference |
616 | * | 639 | * |
617 | * PARAMETERS: *Object - Object whose reference count is to be | 640 | * PARAMETERS: Object - Object whose reference count is to be |
618 | * incremented | 641 | * incremented |
619 | * | 642 | * |
620 | * RETURN: None | 643 | * RETURN: None |
621 | * | 644 | * |
@@ -652,7 +675,7 @@ acpi_ut_add_reference ( | |||
652 | * | 675 | * |
653 | * FUNCTION: acpi_ut_remove_reference | 676 | * FUNCTION: acpi_ut_remove_reference |
654 | * | 677 | * |
655 | * PARAMETERS: *Object - Object whose ref count will be decremented | 678 | * PARAMETERS: Object - Object whose ref count will be decremented |
656 | * | 679 | * |
657 | * RETURN: None | 680 | * RETURN: None |
658 | * | 681 | * |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index ead27d2c4d18..00046dd5d925 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -50,6 +50,19 @@ | |||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME ("uteval") | 51 | ACPI_MODULE_NAME ("uteval") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static void | ||
56 | acpi_ut_copy_id_string ( | ||
57 | char *destination, | ||
58 | char *source, | ||
59 | acpi_size max_length); | ||
60 | |||
61 | static acpi_status | ||
62 | acpi_ut_translate_one_cid ( | ||
63 | union acpi_operand_object *obj_desc, | ||
64 | struct acpi_compatible_id *one_cid); | ||
65 | |||
53 | 66 | ||
54 | /******************************************************************************* | 67 | /******************************************************************************* |
55 | * | 68 | * |
@@ -237,9 +250,9 @@ acpi_ut_evaluate_object ( | |||
237 | * | 250 | * |
238 | * FUNCTION: acpi_ut_evaluate_numeric_object | 251 | * FUNCTION: acpi_ut_evaluate_numeric_object |
239 | * | 252 | * |
240 | * PARAMETERS: *object_name - Object name to be evaluated | 253 | * PARAMETERS: object_name - Object name to be evaluated |
241 | * device_node - Node for the device | 254 | * device_node - Node for the device |
242 | * *Address - Where the value is returned | 255 | * Address - Where the value is returned |
243 | * | 256 | * |
244 | * RETURN: Status | 257 | * RETURN: Status |
245 | * | 258 | * |
@@ -303,7 +316,6 @@ acpi_ut_copy_id_string ( | |||
303 | acpi_size max_length) | 316 | acpi_size max_length) |
304 | { | 317 | { |
305 | 318 | ||
306 | |||
307 | /* | 319 | /* |
308 | * Workaround for ID strings that have a leading asterisk. This construct | 320 | * Workaround for ID strings that have a leading asterisk. This construct |
309 | * is not allowed by the ACPI specification (ID strings must be | 321 | * is not allowed by the ACPI specification (ID strings must be |
@@ -325,7 +337,7 @@ acpi_ut_copy_id_string ( | |||
325 | * FUNCTION: acpi_ut_execute_HID | 337 | * FUNCTION: acpi_ut_execute_HID |
326 | * | 338 | * |
327 | * PARAMETERS: device_node - Node for the device | 339 | * PARAMETERS: device_node - Node for the device |
328 | * *Hid - Where the HID is returned | 340 | * Hid - Where the HID is returned |
329 | * | 341 | * |
330 | * RETURN: Status | 342 | * RETURN: Status |
331 | * | 343 | * |
@@ -429,7 +441,7 @@ acpi_ut_translate_one_cid ( | |||
429 | * FUNCTION: acpi_ut_execute_CID | 441 | * FUNCTION: acpi_ut_execute_CID |
430 | * | 442 | * |
431 | * PARAMETERS: device_node - Node for the device | 443 | * PARAMETERS: device_node - Node for the device |
432 | * *Cid - Where the CID is returned | 444 | * return_cid_list - Where the CID list is returned |
433 | * | 445 | * |
434 | * RETURN: Status | 446 | * RETURN: Status |
435 | * | 447 | * |
@@ -488,10 +500,10 @@ acpi_ut_execute_CID ( | |||
488 | cid_list->size = size; | 500 | cid_list->size = size; |
489 | 501 | ||
490 | /* | 502 | /* |
491 | * A _CID can return either a single compatible ID or a package of compatible | 503 | * A _CID can return either a single compatible ID or a package of |
492 | * IDs. Each compatible ID can be one of the following: | 504 | * compatible IDs. Each compatible ID can be one of the following: |
493 | * -- Number (32 bit compressed EISA ID) or | 505 | * 1) Integer (32 bit compressed EISA ID) or |
494 | * -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). | 506 | * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") |
495 | */ | 507 | */ |
496 | 508 | ||
497 | /* The _CID object can be either a single CID or a package (list) of CIDs */ | 509 | /* The _CID object can be either a single CID or a package (list) of CIDs */ |
@@ -534,7 +546,7 @@ acpi_ut_execute_CID ( | |||
534 | * FUNCTION: acpi_ut_execute_UID | 546 | * FUNCTION: acpi_ut_execute_UID |
535 | * | 547 | * |
536 | * PARAMETERS: device_node - Node for the device | 548 | * PARAMETERS: device_node - Node for the device |
537 | * *Uid - Where the UID is returned | 549 | * Uid - Where the UID is returned |
538 | * | 550 | * |
539 | * RETURN: Status | 551 | * RETURN: Status |
540 | * | 552 | * |
@@ -587,7 +599,7 @@ acpi_ut_execute_UID ( | |||
587 | * FUNCTION: acpi_ut_execute_STA | 599 | * FUNCTION: acpi_ut_execute_STA |
588 | * | 600 | * |
589 | * PARAMETERS: device_node - Node for the device | 601 | * PARAMETERS: device_node - Node for the device |
590 | * *Flags - Where the status flags are returned | 602 | * Flags - Where the status flags are returned |
591 | * | 603 | * |
592 | * RETURN: Status | 604 | * RETURN: Status |
593 | * | 605 | * |
@@ -641,7 +653,7 @@ acpi_ut_execute_STA ( | |||
641 | * FUNCTION: acpi_ut_execute_Sxds | 653 | * FUNCTION: acpi_ut_execute_Sxds |
642 | * | 654 | * |
643 | * PARAMETERS: device_node - Node for the device | 655 | * PARAMETERS: device_node - Node for the device |
644 | * *Flags - Where the status flags are returned | 656 | * Flags - Where the status flags are returned |
645 | * | 657 | * |
646 | * RETURN: Status | 658 | * RETURN: Status |
647 | * | 659 | * |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 25b0f8ae1bc6..4146019b543f 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #define DEFINE_ACPI_GLOBALS | 44 | #define DEFINE_ACPI_GLOBALS |
45 | 45 | ||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | |||
48 | #include <acpi/acpi.h> | 47 | #include <acpi/acpi.h> |
49 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
50 | 49 | ||
@@ -52,13 +51,14 @@ | |||
52 | ACPI_MODULE_NAME ("utglobal") | 51 | ACPI_MODULE_NAME ("utglobal") |
53 | 52 | ||
54 | 53 | ||
55 | /****************************************************************************** | 54 | /******************************************************************************* |
56 | * | 55 | * |
57 | * FUNCTION: acpi_format_exception | 56 | * FUNCTION: acpi_format_exception |
58 | * | 57 | * |
59 | * PARAMETERS: Status - The acpi_status code to be formatted | 58 | * PARAMETERS: Status - The acpi_status code to be formatted |
60 | * | 59 | * |
61 | * RETURN: A string containing the exception text | 60 | * RETURN: A string containing the exception text. A valid pointer is |
61 | * always returned. | ||
62 | * | 62 | * |
63 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string. | 63 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string. |
64 | * | 64 | * |
@@ -68,8 +68,8 @@ const char * | |||
68 | acpi_format_exception ( | 68 | acpi_format_exception ( |
69 | acpi_status status) | 69 | acpi_status status) |
70 | { | 70 | { |
71 | const char *exception = "UNKNOWN_STATUS_CODE"; | ||
72 | acpi_status sub_status; | 71 | acpi_status sub_status; |
72 | const char *exception = NULL; | ||
73 | 73 | ||
74 | 74 | ||
75 | ACPI_FUNCTION_NAME ("format_exception"); | 75 | ACPI_FUNCTION_NAME ("format_exception"); |
@@ -82,57 +82,55 @@ acpi_format_exception ( | |||
82 | 82 | ||
83 | if (sub_status <= AE_CODE_ENV_MAX) { | 83 | if (sub_status <= AE_CODE_ENV_MAX) { |
84 | exception = acpi_gbl_exception_names_env [sub_status]; | 84 | exception = acpi_gbl_exception_names_env [sub_status]; |
85 | break; | ||
86 | } | 85 | } |
87 | goto unknown; | 86 | break; |
88 | 87 | ||
89 | case AE_CODE_PROGRAMMER: | 88 | case AE_CODE_PROGRAMMER: |
90 | 89 | ||
91 | if (sub_status <= AE_CODE_PGM_MAX) { | 90 | if (sub_status <= AE_CODE_PGM_MAX) { |
92 | exception = acpi_gbl_exception_names_pgm [sub_status -1]; | 91 | exception = acpi_gbl_exception_names_pgm [sub_status -1]; |
93 | break; | ||
94 | } | 92 | } |
95 | goto unknown; | 93 | break; |
96 | 94 | ||
97 | case AE_CODE_ACPI_TABLES: | 95 | case AE_CODE_ACPI_TABLES: |
98 | 96 | ||
99 | if (sub_status <= AE_CODE_TBL_MAX) { | 97 | if (sub_status <= AE_CODE_TBL_MAX) { |
100 | exception = acpi_gbl_exception_names_tbl [sub_status -1]; | 98 | exception = acpi_gbl_exception_names_tbl [sub_status -1]; |
101 | break; | ||
102 | } | 99 | } |
103 | goto unknown; | 100 | break; |
104 | 101 | ||
105 | case AE_CODE_AML: | 102 | case AE_CODE_AML: |
106 | 103 | ||
107 | if (sub_status <= AE_CODE_AML_MAX) { | 104 | if (sub_status <= AE_CODE_AML_MAX) { |
108 | exception = acpi_gbl_exception_names_aml [sub_status -1]; | 105 | exception = acpi_gbl_exception_names_aml [sub_status -1]; |
109 | break; | ||
110 | } | 106 | } |
111 | goto unknown; | 107 | break; |
112 | 108 | ||
113 | case AE_CODE_CONTROL: | 109 | case AE_CODE_CONTROL: |
114 | 110 | ||
115 | if (sub_status <= AE_CODE_CTRL_MAX) { | 111 | if (sub_status <= AE_CODE_CTRL_MAX) { |
116 | exception = acpi_gbl_exception_names_ctrl [sub_status -1]; | 112 | exception = acpi_gbl_exception_names_ctrl [sub_status -1]; |
117 | break; | ||
118 | } | 113 | } |
119 | goto unknown; | 114 | break; |
120 | 115 | ||
121 | default: | 116 | default: |
122 | goto unknown; | 117 | break; |
123 | } | 118 | } |
124 | 119 | ||
120 | if (!exception) { | ||
121 | /* Exception code was not recognized */ | ||
125 | 122 | ||
126 | return ((const char *) exception); | 123 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
124 | "Unknown exception code: 0x%8.8X\n", status)); | ||
127 | 125 | ||
128 | unknown: | 126 | return ((const char *) "UNKNOWN_STATUS_CODE"); |
127 | } | ||
129 | 128 | ||
130 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown exception code: 0x%8.8X\n", status)); | ||
131 | return ((const char *) exception); | 129 | return ((const char *) exception); |
132 | } | 130 | } |
133 | 131 | ||
134 | 132 | ||
135 | /****************************************************************************** | 133 | /******************************************************************************* |
136 | * | 134 | * |
137 | * Static global variable initialization. | 135 | * Static global variable initialization. |
138 | * | 136 | * |
@@ -212,13 +210,12 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR | |||
212 | }; | 210 | }; |
213 | 211 | ||
214 | 212 | ||
215 | /****************************************************************************** | 213 | /******************************************************************************* |
216 | * | 214 | * |
217 | * Namespace globals | 215 | * Namespace globals |
218 | * | 216 | * |
219 | ******************************************************************************/ | 217 | ******************************************************************************/ |
220 | 218 | ||
221 | |||
222 | /* | 219 | /* |
223 | * Predefined ACPI Names (Built-in to the Interpreter) | 220 | * Predefined ACPI Names (Built-in to the Interpreter) |
224 | * | 221 | * |
@@ -241,9 +238,11 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = | |||
241 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) | 238 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) |
242 | {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, | 239 | {"_OSI", ACPI_TYPE_METHOD, (char *) 1}, |
243 | #endif | 240 | #endif |
244 | {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */ | ||
245 | }; | ||
246 | 241 | ||
242 | /* Table terminator */ | ||
243 | |||
244 | {NULL, ACPI_TYPE_ANY, NULL} | ||
245 | }; | ||
247 | 246 | ||
248 | /* | 247 | /* |
249 | * Properties of the ACPI Object Types, both internal and external. | 248 | * Properties of the ACPI Object Types, both internal and external. |
@@ -288,22 +287,25 @@ const u8 acpi_gbl_ns_properties[] = | |||
288 | /* Hex to ASCII conversion table */ | 287 | /* Hex to ASCII conversion table */ |
289 | 288 | ||
290 | static const char acpi_gbl_hex_to_ascii[] = | 289 | static const char acpi_gbl_hex_to_ascii[] = |
291 | {'0','1','2','3','4','5','6','7', | 290 | { |
292 | '8','9','A','B','C','D','E','F'}; | 291 | '0','1','2','3','4','5','6','7', |
292 | '8','9','A','B','C','D','E','F' | ||
293 | }; | ||
294 | |||
293 | 295 | ||
294 | /***************************************************************************** | 296 | /******************************************************************************* |
295 | * | 297 | * |
296 | * FUNCTION: acpi_ut_hex_to_ascii_char | 298 | * FUNCTION: acpi_ut_hex_to_ascii_char |
297 | * | 299 | * |
298 | * PARAMETERS: Integer - Contains the hex digit | 300 | * PARAMETERS: Integer - Contains the hex digit |
299 | * Position - bit position of the digit within the | 301 | * Position - bit position of the digit within the |
300 | * integer | 302 | * integer (multiple of 4) |
301 | * | 303 | * |
302 | * RETURN: Ascii character | 304 | * RETURN: The converted Ascii character |
303 | * | 305 | * |
304 | * DESCRIPTION: Convert a hex digit to an ascii character | 306 | * DESCRIPTION: Convert a hex digit to an Ascii character |
305 | * | 307 | * |
306 | ****************************************************************************/ | 308 | ******************************************************************************/ |
307 | 309 | ||
308 | char | 310 | char |
309 | acpi_ut_hex_to_ascii_char ( | 311 | acpi_ut_hex_to_ascii_char ( |
@@ -315,7 +317,7 @@ acpi_ut_hex_to_ascii_char ( | |||
315 | } | 317 | } |
316 | 318 | ||
317 | 319 | ||
318 | /****************************************************************************** | 320 | /******************************************************************************* |
319 | * | 321 | * |
320 | * Table name globals | 322 | * Table name globals |
321 | * | 323 | * |
@@ -324,7 +326,7 @@ acpi_ut_hex_to_ascii_char ( | |||
324 | * that are not used by the subsystem are simply ignored. | 326 | * that are not used by the subsystem are simply ignored. |
325 | * | 327 | * |
326 | * Do NOT add any table to this list that is not consumed directly by this | 328 | * Do NOT add any table to this list that is not consumed directly by this |
327 | * subsystem. | 329 | * subsystem (No MADT, ECDT, SBST, etc.) |
328 | * | 330 | * |
329 | ******************************************************************************/ | 331 | ******************************************************************************/ |
330 | 332 | ||
@@ -391,7 +393,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE | |||
391 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, | 393 | /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, |
392 | }; | 394 | }; |
393 | 395 | ||
394 | /***************************************************************************** | 396 | /******************************************************************************* |
395 | * | 397 | * |
396 | * FUNCTION: acpi_ut_get_region_name | 398 | * FUNCTION: acpi_ut_get_region_name |
397 | * | 399 | * |
@@ -401,7 +403,7 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE | |||
401 | * | 403 | * |
402 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) | 404 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) |
403 | * | 405 | * |
404 | ****************************************************************************/ | 406 | ******************************************************************************/ |
405 | 407 | ||
406 | /* Region type decoding */ | 408 | /* Region type decoding */ |
407 | 409 | ||
@@ -429,7 +431,6 @@ acpi_ut_get_region_name ( | |||
429 | { | 431 | { |
430 | return ("user_defined_region"); | 432 | return ("user_defined_region"); |
431 | } | 433 | } |
432 | |||
433 | else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) | 434 | else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) |
434 | { | 435 | { |
435 | return ("invalid_space_id"); | 436 | return ("invalid_space_id"); |
@@ -439,7 +440,7 @@ acpi_ut_get_region_name ( | |||
439 | } | 440 | } |
440 | 441 | ||
441 | 442 | ||
442 | /***************************************************************************** | 443 | /******************************************************************************* |
443 | * | 444 | * |
444 | * FUNCTION: acpi_ut_get_event_name | 445 | * FUNCTION: acpi_ut_get_event_name |
445 | * | 446 | * |
@@ -449,7 +450,7 @@ acpi_ut_get_region_name ( | |||
449 | * | 450 | * |
450 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) | 451 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) |
451 | * | 452 | * |
452 | ****************************************************************************/ | 453 | ******************************************************************************/ |
453 | 454 | ||
454 | /* Event type decoding */ | 455 | /* Event type decoding */ |
455 | 456 | ||
@@ -477,7 +478,7 @@ acpi_ut_get_event_name ( | |||
477 | } | 478 | } |
478 | 479 | ||
479 | 480 | ||
480 | /***************************************************************************** | 481 | /******************************************************************************* |
481 | * | 482 | * |
482 | * FUNCTION: acpi_ut_get_type_name | 483 | * FUNCTION: acpi_ut_get_type_name |
483 | * | 484 | * |
@@ -487,20 +488,21 @@ acpi_ut_get_event_name ( | |||
487 | * | 488 | * |
488 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) | 489 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) |
489 | * | 490 | * |
490 | ****************************************************************************/ | 491 | ******************************************************************************/ |
491 | 492 | ||
492 | /* | 493 | /* |
493 | * Elements of acpi_gbl_ns_type_names below must match | 494 | * Elements of acpi_gbl_ns_type_names below must match |
494 | * one-to-one with values of acpi_object_type | 495 | * one-to-one with values of acpi_object_type |
495 | * | 496 | * |
496 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when | 497 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; |
497 | * stored in a table it really means that we have thus far seen no evidence to | 498 | * when stored in a table it really means that we have thus far seen no |
498 | * indicate what type is actually going to be stored for this entry. | 499 | * evidence to indicate what type is actually going to be stored for this entry. |
499 | */ | 500 | */ |
500 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; | 501 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; |
501 | #define TYPE_NAME_LENGTH 12 /* Maximum length of each string */ | ||
502 | 502 | ||
503 | static const char *acpi_gbl_ns_type_names[] = /* printable names of ACPI types */ | 503 | /* Printable names of the ACPI object types */ |
504 | |||
505 | static const char *acpi_gbl_ns_type_names[] = | ||
504 | { | 506 | { |
505 | /* 00 */ "Untyped", | 507 | /* 00 */ "Untyped", |
506 | /* 01 */ "Integer", | 508 | /* 01 */ "Integer", |
@@ -564,7 +566,7 @@ acpi_ut_get_object_type_name ( | |||
564 | } | 566 | } |
565 | 567 | ||
566 | 568 | ||
567 | /***************************************************************************** | 569 | /******************************************************************************* |
568 | * | 570 | * |
569 | * FUNCTION: acpi_ut_get_node_name | 571 | * FUNCTION: acpi_ut_get_node_name |
570 | * | 572 | * |
@@ -574,7 +576,7 @@ acpi_ut_get_object_type_name ( | |||
574 | * | 576 | * |
575 | * DESCRIPTION: Validate the node and return the node's ACPI name. | 577 | * DESCRIPTION: Validate the node and return the node's ACPI name. |
576 | * | 578 | * |
577 | ****************************************************************************/ | 579 | ******************************************************************************/ |
578 | 580 | ||
579 | char * | 581 | char * |
580 | acpi_ut_get_node_name ( | 582 | acpi_ut_get_node_name ( |
@@ -618,7 +620,7 @@ acpi_ut_get_node_name ( | |||
618 | } | 620 | } |
619 | 621 | ||
620 | 622 | ||
621 | /***************************************************************************** | 623 | /******************************************************************************* |
622 | * | 624 | * |
623 | * FUNCTION: acpi_ut_get_descriptor_name | 625 | * FUNCTION: acpi_ut_get_descriptor_name |
624 | * | 626 | * |
@@ -628,9 +630,11 @@ acpi_ut_get_node_name ( | |||
628 | * | 630 | * |
629 | * DESCRIPTION: Validate object and return the descriptor type | 631 | * DESCRIPTION: Validate object and return the descriptor type |
630 | * | 632 | * |
631 | ****************************************************************************/ | 633 | ******************************************************************************/ |
634 | |||
635 | /* Printable names of object descriptor types */ | ||
632 | 636 | ||
633 | static const char *acpi_gbl_desc_type_names[] = /* printable names of descriptor types */ | 637 | static const char *acpi_gbl_desc_type_names[] = |
634 | { | 638 | { |
635 | /* 00 */ "Invalid", | 639 | /* 00 */ "Invalid", |
636 | /* 01 */ "Cached", | 640 | /* 01 */ "Cached", |
@@ -676,17 +680,18 @@ acpi_ut_get_descriptor_name ( | |||
676 | * Strings and procedures used for debug only | 680 | * Strings and procedures used for debug only |
677 | */ | 681 | */ |
678 | 682 | ||
679 | /***************************************************************************** | 683 | /******************************************************************************* |
680 | * | 684 | * |
681 | * FUNCTION: acpi_ut_get_mutex_name | 685 | * FUNCTION: acpi_ut_get_mutex_name |
682 | * | 686 | * |
683 | * PARAMETERS: None. | 687 | * PARAMETERS: mutex_id - The predefined ID for this mutex. |
684 | * | 688 | * |
685 | * RETURN: Status | 689 | * RETURN: String containing the name of the mutex. Always returns a valid |
690 | * pointer. | ||
686 | * | 691 | * |
687 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) | 692 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) |
688 | * | 693 | * |
689 | ****************************************************************************/ | 694 | ******************************************************************************/ |
690 | 695 | ||
691 | char * | 696 | char * |
692 | acpi_ut_get_mutex_name ( | 697 | acpi_ut_get_mutex_name ( |
@@ -700,21 +705,20 @@ acpi_ut_get_mutex_name ( | |||
700 | 705 | ||
701 | return (acpi_gbl_mutex_names[mutex_id]); | 706 | return (acpi_gbl_mutex_names[mutex_id]); |
702 | } | 707 | } |
703 | |||
704 | #endif | 708 | #endif |
705 | 709 | ||
706 | 710 | ||
707 | /***************************************************************************** | 711 | /******************************************************************************* |
708 | * | 712 | * |
709 | * FUNCTION: acpi_ut_valid_object_type | 713 | * FUNCTION: acpi_ut_valid_object_type |
710 | * | 714 | * |
711 | * PARAMETERS: Type - Object type to be validated | 715 | * PARAMETERS: Type - Object type to be validated |
712 | * | 716 | * |
713 | * RETURN: TRUE if valid object type | 717 | * RETURN: TRUE if valid object type, FALSE otherwise |
714 | * | 718 | * |
715 | * DESCRIPTION: Validate an object type | 719 | * DESCRIPTION: Validate an object type |
716 | * | 720 | * |
717 | ****************************************************************************/ | 721 | ******************************************************************************/ |
718 | 722 | ||
719 | u8 | 723 | u8 |
720 | acpi_ut_valid_object_type ( | 724 | acpi_ut_valid_object_type ( |
@@ -732,7 +736,7 @@ acpi_ut_valid_object_type ( | |||
732 | } | 736 | } |
733 | 737 | ||
734 | 738 | ||
735 | /**************************************************************************** | 739 | /******************************************************************************* |
736 | * | 740 | * |
737 | * FUNCTION: acpi_ut_allocate_owner_id | 741 | * FUNCTION: acpi_ut_allocate_owner_id |
738 | * | 742 | * |
@@ -740,7 +744,10 @@ acpi_ut_valid_object_type ( | |||
740 | * | 744 | * |
741 | * DESCRIPTION: Allocate a table or method owner id | 745 | * DESCRIPTION: Allocate a table or method owner id |
742 | * | 746 | * |
743 | ***************************************************************************/ | 747 | * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and |
748 | * should be revisited (TBD) | ||
749 | * | ||
750 | ******************************************************************************/ | ||
744 | 751 | ||
745 | acpi_owner_id | 752 | acpi_owner_id |
746 | acpi_ut_allocate_owner_id ( | 753 | acpi_ut_allocate_owner_id ( |
@@ -796,16 +803,18 @@ acpi_ut_allocate_owner_id ( | |||
796 | } | 803 | } |
797 | 804 | ||
798 | 805 | ||
799 | /**************************************************************************** | 806 | /******************************************************************************* |
800 | * | 807 | * |
801 | * FUNCTION: acpi_ut_init_globals | 808 | * FUNCTION: acpi_ut_init_globals |
802 | * | 809 | * |
803 | * PARAMETERS: none | 810 | * PARAMETERS: None |
811 | * | ||
812 | * RETURN: None | ||
804 | * | 813 | * |
805 | * DESCRIPTION: Init library globals. All globals that require specific | 814 | * DESCRIPTION: Init library globals. All globals that require specific |
806 | * initialization should be initialized here! | 815 | * initialization should be initialized here! |
807 | * | 816 | * |
808 | ***************************************************************************/ | 817 | ******************************************************************************/ |
809 | 818 | ||
810 | void | 819 | void |
811 | acpi_ut_init_globals ( | 820 | acpi_ut_init_globals ( |
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index bdbadaf48d29..7f3713889ff0 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -49,19 +49,29 @@ | |||
49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME ("utinit") | 50 | ACPI_MODULE_NAME ("utinit") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ut_fadt_register_error ( | ||
56 | char *register_name, | ||
57 | u32 value, | ||
58 | acpi_size offset); | ||
59 | |||
60 | static void acpi_ut_terminate ( | ||
61 | void); | ||
62 | |||
52 | 63 | ||
53 | /******************************************************************************* | 64 | /******************************************************************************* |
54 | * | 65 | * |
55 | * FUNCTION: acpi_ut_fadt_register_error | 66 | * FUNCTION: acpi_ut_fadt_register_error |
56 | * | 67 | * |
57 | * PARAMETERS: *register_name - Pointer to string identifying register | 68 | * PARAMETERS: register_name - Pointer to string identifying register |
58 | * Value - Actual register contents value | 69 | * Value - Actual register contents value |
59 | * acpi_test_spec_section - TDS section containing assertion | 70 | * Offset - Byte offset in the FADT |
60 | * acpi_assertion - Assertion number being tested | ||
61 | * | 71 | * |
62 | * RETURN: AE_BAD_VALUE | 72 | * RETURN: AE_BAD_VALUE |
63 | * | 73 | * |
64 | * DESCRIPTION: Display failure message and link failure to TDS assertion | 74 | * DESCRIPTION: Display failure message |
65 | * | 75 | * |
66 | ******************************************************************************/ | 76 | ******************************************************************************/ |
67 | 77 | ||
@@ -166,12 +176,13 @@ acpi_ut_validate_fadt ( | |||
166 | * | 176 | * |
167 | * RETURN: none | 177 | * RETURN: none |
168 | * | 178 | * |
169 | * DESCRIPTION: free global memory | 179 | * DESCRIPTION: Free global memory |
170 | * | 180 | * |
171 | ******************************************************************************/ | 181 | ******************************************************************************/ |
172 | 182 | ||
173 | void | 183 | static void |
174 | acpi_ut_terminate (void) | 184 | acpi_ut_terminate ( |
185 | void) | ||
175 | { | 186 | { |
176 | struct acpi_gpe_block_info *gpe_block; | 187 | struct acpi_gpe_block_info *gpe_block; |
177 | struct acpi_gpe_block_info *next_gpe_block; | 188 | struct acpi_gpe_block_info *next_gpe_block; |
@@ -183,8 +194,6 @@ acpi_ut_terminate (void) | |||
183 | 194 | ||
184 | 195 | ||
185 | /* Free global tables, etc. */ | 196 | /* Free global tables, etc. */ |
186 | |||
187 | |||
188 | /* Free global GPE blocks and related info structures */ | 197 | /* Free global GPE blocks and related info structures */ |
189 | 198 | ||
190 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | 199 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; |
@@ -221,7 +230,8 @@ acpi_ut_terminate (void) | |||
221 | ******************************************************************************/ | 230 | ******************************************************************************/ |
222 | 231 | ||
223 | void | 232 | void |
224 | acpi_ut_subsystem_shutdown (void) | 233 | acpi_ut_subsystem_shutdown ( |
234 | void) | ||
225 | { | 235 | { |
226 | 236 | ||
227 | ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown"); | 237 | ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown"); |
@@ -229,14 +239,16 @@ acpi_ut_subsystem_shutdown (void) | |||
229 | /* Just exit if subsystem is already shutdown */ | 239 | /* Just exit if subsystem is already shutdown */ |
230 | 240 | ||
231 | if (acpi_gbl_shutdown) { | 241 | if (acpi_gbl_shutdown) { |
232 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n")); | 242 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
243 | "ACPI Subsystem is already terminated\n")); | ||
233 | return_VOID; | 244 | return_VOID; |
234 | } | 245 | } |
235 | 246 | ||
236 | /* Subsystem appears active, go ahead and shut it down */ | 247 | /* Subsystem appears active, go ahead and shut it down */ |
237 | 248 | ||
238 | acpi_gbl_shutdown = TRUE; | 249 | acpi_gbl_shutdown = TRUE; |
239 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); | 250 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
251 | "Shutting down ACPI Subsystem...\n")); | ||
240 | 252 | ||
241 | /* Close the acpi_event Handling */ | 253 | /* Close the acpi_event Handling */ |
242 | 254 | ||
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 2525c1a93547..0d527c91543c 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c | |||
@@ -259,6 +259,8 @@ acpi_ut_divide ( | |||
259 | * | 259 | * |
260 | * FUNCTION: acpi_ut_short_divide, acpi_ut_divide | 260 | * FUNCTION: acpi_ut_short_divide, acpi_ut_divide |
261 | * | 261 | * |
262 | * PARAMETERS: See function headers above | ||
263 | * | ||
262 | * DESCRIPTION: Native versions of the ut_divide functions. Use these if either | 264 | * DESCRIPTION: Native versions of the ut_divide functions. Use these if either |
263 | * 1) The target is a 64-bit platform and therefore 64-bit | 265 | * 1) The target is a 64-bit platform and therefore 64-bit |
264 | * integer math is supported directly by the machine. | 266 | * integer math is supported directly by the machine. |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index f6598547389b..f6de4ed3d527 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -49,12 +49,57 @@ | |||
49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME ("utmisc") | 50 | ACPI_MODULE_NAME ("utmisc") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ut_create_mutex ( | ||
56 | acpi_mutex_handle mutex_id); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ut_delete_mutex ( | ||
60 | acpi_mutex_handle mutex_id); | ||
61 | |||
62 | |||
63 | /******************************************************************************* | ||
64 | * | ||
65 | * FUNCTION: acpi_ut_strupr (strupr) | ||
66 | * | ||
67 | * PARAMETERS: src_string - The source string to convert | ||
68 | * | ||
69 | * RETURN: Converted src_string (same as input pointer) | ||
70 | * | ||
71 | * DESCRIPTION: Convert string to uppercase | ||
72 | * | ||
73 | * NOTE: This is not a POSIX function, so it appears here, not in utclib.c | ||
74 | * | ||
75 | ******************************************************************************/ | ||
76 | |||
77 | char * | ||
78 | acpi_ut_strupr ( | ||
79 | char *src_string) | ||
80 | { | ||
81 | char *string; | ||
82 | |||
83 | |||
84 | ACPI_FUNCTION_ENTRY (); | ||
85 | |||
86 | |||
87 | /* Walk entire string, uppercasing the letters */ | ||
88 | |||
89 | for (string = src_string; *string; string++) { | ||
90 | *string = (char) ACPI_TOUPPER (*string); | ||
91 | } | ||
92 | |||
93 | return (src_string); | ||
94 | } | ||
95 | |||
52 | 96 | ||
53 | /******************************************************************************* | 97 | /******************************************************************************* |
54 | * | 98 | * |
55 | * FUNCTION: acpi_ut_print_string | 99 | * FUNCTION: acpi_ut_print_string |
56 | * | 100 | * |
57 | * PARAMETERS: String - Null terminated ASCII string | 101 | * PARAMETERS: String - Null terminated ASCII string |
102 | * max_length - Maximum output length | ||
58 | * | 103 | * |
59 | * RETURN: None | 104 | * RETURN: None |
60 | * | 105 | * |
@@ -148,6 +193,8 @@ acpi_ut_print_string ( | |||
148 | * | 193 | * |
149 | * PARAMETERS: Value - Value to be converted | 194 | * PARAMETERS: Value - Value to be converted |
150 | * | 195 | * |
196 | * RETURN: u32 integer with bytes swapped | ||
197 | * | ||
151 | * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) | 198 | * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) |
152 | * | 199 | * |
153 | ******************************************************************************/ | 200 | ******************************************************************************/ |
@@ -160,7 +207,6 @@ acpi_ut_dword_byte_swap ( | |||
160 | u32 value; | 207 | u32 value; |
161 | u8 bytes[4]; | 208 | u8 bytes[4]; |
162 | } out; | 209 | } out; |
163 | |||
164 | union { | 210 | union { |
165 | u32 value; | 211 | u32 value; |
166 | u8 bytes[4]; | 212 | u8 bytes[4]; |
@@ -219,7 +265,8 @@ acpi_ut_set_integer_width ( | |||
219 | * | 265 | * |
220 | * FUNCTION: acpi_ut_display_init_pathname | 266 | * FUNCTION: acpi_ut_display_init_pathname |
221 | * | 267 | * |
222 | * PARAMETERS: obj_handle - Handle whose pathname will be displayed | 268 | * PARAMETERS: Type - Object type of the node |
269 | * obj_handle - Handle whose pathname will be displayed | ||
223 | * Path - Additional path string to be appended. | 270 | * Path - Additional path string to be appended. |
224 | * (NULL if no extra path) | 271 | * (NULL if no extra path) |
225 | * | 272 | * |
@@ -270,7 +317,8 @@ acpi_ut_display_init_pathname ( | |||
270 | 317 | ||
271 | /* Print the object type and pathname */ | 318 | /* Print the object type and pathname */ |
272 | 319 | ||
273 | acpi_os_printf ("%-12s %s", acpi_ut_get_type_name (type), (char *) buffer.pointer); | 320 | acpi_os_printf ("%-12s %s", |
321 | acpi_ut_get_type_name (type), (char *) buffer.pointer); | ||
274 | 322 | ||
275 | /* Extra path is used to append names like _STA, _INI, etc. */ | 323 | /* Extra path is used to append names like _STA, _INI, etc. */ |
276 | 324 | ||
@@ -288,9 +336,9 @@ acpi_ut_display_init_pathname ( | |||
288 | * | 336 | * |
289 | * FUNCTION: acpi_ut_valid_acpi_name | 337 | * FUNCTION: acpi_ut_valid_acpi_name |
290 | * | 338 | * |
291 | * PARAMETERS: Character - The character to be examined | 339 | * PARAMETERS: Name - The name to be examined |
292 | * | 340 | * |
293 | * RETURN: 1 if Character may appear in a name, else 0 | 341 | * RETURN: TRUE if the name is valid, FALSE otherwise |
294 | * | 342 | * |
295 | * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: | 343 | * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: |
296 | * 1) Upper case alpha | 344 | * 1) Upper case alpha |
@@ -495,40 +543,6 @@ error_exit: | |||
495 | 543 | ||
496 | /******************************************************************************* | 544 | /******************************************************************************* |
497 | * | 545 | * |
498 | * FUNCTION: acpi_ut_strupr | ||
499 | * | ||
500 | * PARAMETERS: src_string - The source string to convert to | ||
501 | * | ||
502 | * RETURN: src_string | ||
503 | * | ||
504 | * DESCRIPTION: Convert string to uppercase | ||
505 | * | ||
506 | ******************************************************************************/ | ||
507 | #ifdef ACPI_FUTURE_USAGE | ||
508 | char * | ||
509 | acpi_ut_strupr ( | ||
510 | char *src_string) | ||
511 | { | ||
512 | char *string; | ||
513 | |||
514 | |||
515 | ACPI_FUNCTION_ENTRY (); | ||
516 | |||
517 | |||
518 | /* Walk entire string, uppercasing the letters */ | ||
519 | |||
520 | for (string = src_string; *string; ) { | ||
521 | *string = (char) ACPI_TOUPPER (*string); | ||
522 | string++; | ||
523 | } | ||
524 | |||
525 | return (src_string); | ||
526 | } | ||
527 | #endif /* ACPI_FUTURE_USAGE */ | ||
528 | |||
529 | |||
530 | /******************************************************************************* | ||
531 | * | ||
532 | * FUNCTION: acpi_ut_mutex_initialize | 546 | * FUNCTION: acpi_ut_mutex_initialize |
533 | * | 547 | * |
534 | * PARAMETERS: None. | 548 | * PARAMETERS: None. |
@@ -611,7 +625,7 @@ acpi_ut_mutex_terminate ( | |||
611 | * | 625 | * |
612 | ******************************************************************************/ | 626 | ******************************************************************************/ |
613 | 627 | ||
614 | acpi_status | 628 | static acpi_status |
615 | acpi_ut_create_mutex ( | 629 | acpi_ut_create_mutex ( |
616 | acpi_mutex_handle mutex_id) | 630 | acpi_mutex_handle mutex_id) |
617 | { | 631 | { |
@@ -648,7 +662,7 @@ acpi_ut_create_mutex ( | |||
648 | * | 662 | * |
649 | ******************************************************************************/ | 663 | ******************************************************************************/ |
650 | 664 | ||
651 | acpi_status | 665 | static acpi_status |
652 | acpi_ut_delete_mutex ( | 666 | acpi_ut_delete_mutex ( |
653 | acpi_mutex_handle mutex_id) | 667 | acpi_mutex_handle mutex_id) |
654 | { | 668 | { |
@@ -715,16 +729,16 @@ acpi_ut_acquire_mutex ( | |||
715 | if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { | 729 | if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) { |
716 | if (i == mutex_id) { | 730 | if (i == mutex_id) { |
717 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 731 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
718 | "Mutex [%s] already acquired by this thread [%X]\n", | 732 | "Mutex [%s] already acquired by this thread [%X]\n", |
719 | acpi_ut_get_mutex_name (mutex_id), this_thread_id)); | 733 | acpi_ut_get_mutex_name (mutex_id), this_thread_id)); |
720 | 734 | ||
721 | return (AE_ALREADY_ACQUIRED); | 735 | return (AE_ALREADY_ACQUIRED); |
722 | } | 736 | } |
723 | 737 | ||
724 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 738 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
725 | "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", | 739 | "Invalid acquire order: Thread %X owns [%s], wants [%s]\n", |
726 | this_thread_id, acpi_ut_get_mutex_name (i), | 740 | this_thread_id, acpi_ut_get_mutex_name (i), |
727 | acpi_ut_get_mutex_name (mutex_id))); | 741 | acpi_ut_get_mutex_name (mutex_id))); |
728 | 742 | ||
729 | return (AE_ACQUIRE_DEADLOCK); | 743 | return (AE_ACQUIRE_DEADLOCK); |
730 | } | 744 | } |
@@ -733,22 +747,23 @@ acpi_ut_acquire_mutex ( | |||
733 | #endif | 747 | #endif |
734 | 748 | ||
735 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, | 749 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, |
736 | "Thread %X attempting to acquire Mutex [%s]\n", | 750 | "Thread %X attempting to acquire Mutex [%s]\n", |
737 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); | 751 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); |
738 | 752 | ||
739 | status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, | 753 | status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, |
740 | 1, ACPI_WAIT_FOREVER); | 754 | 1, ACPI_WAIT_FOREVER); |
741 | if (ACPI_SUCCESS (status)) { | 755 | if (ACPI_SUCCESS (status)) { |
742 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", | 756 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", |
743 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); | 757 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); |
744 | 758 | ||
745 | acpi_gbl_mutex_info[mutex_id].use_count++; | 759 | acpi_gbl_mutex_info[mutex_id].use_count++; |
746 | acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; | 760 | acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; |
747 | } | 761 | } |
748 | else { | 762 | else { |
749 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n", | 763 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
750 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), | 764 | "Thread %X could not acquire Mutex [%s] %s\n", |
751 | acpi_format_exception (status))); | 765 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), |
766 | acpi_format_exception (status))); | ||
752 | } | 767 | } |
753 | 768 | ||
754 | return (status); | 769 | return (status); |
@@ -793,8 +808,8 @@ acpi_ut_release_mutex ( | |||
793 | */ | 808 | */ |
794 | if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { | 809 | if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { |
795 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 810 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
796 | "Mutex [%s] is not acquired, cannot release\n", | 811 | "Mutex [%s] is not acquired, cannot release\n", |
797 | acpi_ut_get_mutex_name (mutex_id))); | 812 | acpi_ut_get_mutex_name (mutex_id))); |
798 | 813 | ||
799 | return (AE_NOT_ACQUIRED); | 814 | return (AE_NOT_ACQUIRED); |
800 | } | 815 | } |
@@ -812,8 +827,8 @@ acpi_ut_release_mutex ( | |||
812 | } | 827 | } |
813 | 828 | ||
814 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 829 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
815 | "Invalid release order: owns [%s], releasing [%s]\n", | 830 | "Invalid release order: owns [%s], releasing [%s]\n", |
816 | acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); | 831 | acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id))); |
817 | 832 | ||
818 | return (AE_RELEASE_DEADLOCK); | 833 | return (AE_RELEASE_DEADLOCK); |
819 | } | 834 | } |
@@ -826,13 +841,14 @@ acpi_ut_release_mutex ( | |||
826 | status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); | 841 | status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); |
827 | 842 | ||
828 | if (ACPI_FAILURE (status)) { | 843 | if (ACPI_FAILURE (status)) { |
829 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n", | 844 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
830 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), | 845 | "Thread %X could not release Mutex [%s] %s\n", |
831 | acpi_format_exception (status))); | 846 | this_thread_id, acpi_ut_get_mutex_name (mutex_id), |
847 | acpi_format_exception (status))); | ||
832 | } | 848 | } |
833 | else { | 849 | else { |
834 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", | 850 | ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n", |
835 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); | 851 | this_thread_id, acpi_ut_get_mutex_name (mutex_id))); |
836 | } | 852 | } |
837 | 853 | ||
838 | return (status); | 854 | return (status); |
@@ -843,11 +859,11 @@ acpi_ut_release_mutex ( | |||
843 | * | 859 | * |
844 | * FUNCTION: acpi_ut_create_update_state_and_push | 860 | * FUNCTION: acpi_ut_create_update_state_and_push |
845 | * | 861 | * |
846 | * PARAMETERS: *Object - Object to be added to the new state | 862 | * PARAMETERS: Object - Object to be added to the new state |
847 | * Action - Increment/Decrement | 863 | * Action - Increment/Decrement |
848 | * state_list - List the state will be added to | 864 | * state_list - List the state will be added to |
849 | * | 865 | * |
850 | * RETURN: None | 866 | * RETURN: Status |
851 | * | 867 | * |
852 | * DESCRIPTION: Create a new state and push it | 868 | * DESCRIPTION: Create a new state and push it |
853 | * | 869 | * |
@@ -885,15 +901,16 @@ acpi_ut_create_update_state_and_push ( | |||
885 | * | 901 | * |
886 | * FUNCTION: acpi_ut_create_pkg_state_and_push | 902 | * FUNCTION: acpi_ut_create_pkg_state_and_push |
887 | * | 903 | * |
888 | * PARAMETERS: *Object - Object to be added to the new state | 904 | * PARAMETERS: Object - Object to be added to the new state |
889 | * Action - Increment/Decrement | 905 | * Action - Increment/Decrement |
890 | * state_list - List the state will be added to | 906 | * state_list - List the state will be added to |
891 | * | 907 | * |
892 | * RETURN: None | 908 | * RETURN: Status |
893 | * | 909 | * |
894 | * DESCRIPTION: Create a new state and push it | 910 | * DESCRIPTION: Create a new state and push it |
895 | * | 911 | * |
896 | ******************************************************************************/ | 912 | ******************************************************************************/ |
913 | |||
897 | #ifdef ACPI_FUTURE_USAGE | 914 | #ifdef ACPI_FUTURE_USAGE |
898 | acpi_status | 915 | acpi_status |
899 | acpi_ut_create_pkg_state_and_push ( | 916 | acpi_ut_create_pkg_state_and_push ( |
@@ -925,7 +942,7 @@ acpi_ut_create_pkg_state_and_push ( | |||
925 | * PARAMETERS: list_head - Head of the state stack | 942 | * PARAMETERS: list_head - Head of the state stack |
926 | * State - State object to push | 943 | * State - State object to push |
927 | * | 944 | * |
928 | * RETURN: Status | 945 | * RETURN: None |
929 | * | 946 | * |
930 | * DESCRIPTION: Push a state object onto a state stack | 947 | * DESCRIPTION: Push a state object onto a state stack |
931 | * | 948 | * |
@@ -954,7 +971,7 @@ acpi_ut_push_generic_state ( | |||
954 | * | 971 | * |
955 | * PARAMETERS: list_head - Head of the state stack | 972 | * PARAMETERS: list_head - Head of the state stack |
956 | * | 973 | * |
957 | * RETURN: Status | 974 | * RETURN: The popped state object |
958 | * | 975 | * |
959 | * DESCRIPTION: Pop a state object from a state stack | 976 | * DESCRIPTION: Pop a state object from a state stack |
960 | * | 977 | * |
@@ -989,7 +1006,7 @@ acpi_ut_pop_generic_state ( | |||
989 | * | 1006 | * |
990 | * PARAMETERS: None | 1007 | * PARAMETERS: None |
991 | * | 1008 | * |
992 | * RETURN: Status | 1009 | * RETURN: The new state object. NULL on failure. |
993 | * | 1010 | * |
994 | * DESCRIPTION: Create a generic state object. Attempt to obtain one from | 1011 | * DESCRIPTION: Create a generic state object. Attempt to obtain one from |
995 | * the global state cache; If none available, create a new one. | 1012 | * the global state cache; If none available, create a new one. |
@@ -997,7 +1014,8 @@ acpi_ut_pop_generic_state ( | |||
997 | ******************************************************************************/ | 1014 | ******************************************************************************/ |
998 | 1015 | ||
999 | union acpi_generic_state * | 1016 | union acpi_generic_state * |
1000 | acpi_ut_create_generic_state (void) | 1017 | acpi_ut_create_generic_state ( |
1018 | void) | ||
1001 | { | 1019 | { |
1002 | union acpi_generic_state *state; | 1020 | union acpi_generic_state *state; |
1003 | 1021 | ||
@@ -1023,7 +1041,7 @@ acpi_ut_create_generic_state (void) | |||
1023 | * | 1041 | * |
1024 | * PARAMETERS: None | 1042 | * PARAMETERS: None |
1025 | * | 1043 | * |
1026 | * RETURN: Thread State | 1044 | * RETURN: New Thread State. NULL on failure |
1027 | * | 1045 | * |
1028 | * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used | 1046 | * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used |
1029 | * to track per-thread info during method execution | 1047 | * to track per-thread info during method execution |
@@ -1060,11 +1078,10 @@ acpi_ut_create_thread_state ( | |||
1060 | * | 1078 | * |
1061 | * FUNCTION: acpi_ut_create_update_state | 1079 | * FUNCTION: acpi_ut_create_update_state |
1062 | * | 1080 | * |
1063 | * PARAMETERS: Object - Initial Object to be installed in the | 1081 | * PARAMETERS: Object - Initial Object to be installed in the state |
1064 | * state | 1082 | * Action - Update action to be performed |
1065 | * Action - Update action to be performed | ||
1066 | * | 1083 | * |
1067 | * RETURN: Status | 1084 | * RETURN: New state object, null on failure |
1068 | * | 1085 | * |
1069 | * DESCRIPTION: Create an "Update State" - a flavor of the generic state used | 1086 | * DESCRIPTION: Create an "Update State" - a flavor of the generic state used |
1070 | * to update reference counts and delete complex objects such | 1087 | * to update reference counts and delete complex objects such |
@@ -1104,11 +1121,10 @@ acpi_ut_create_update_state ( | |||
1104 | * | 1121 | * |
1105 | * FUNCTION: acpi_ut_create_pkg_state | 1122 | * FUNCTION: acpi_ut_create_pkg_state |
1106 | * | 1123 | * |
1107 | * PARAMETERS: Object - Initial Object to be installed in the | 1124 | * PARAMETERS: Object - Initial Object to be installed in the state |
1108 | * state | 1125 | * Action - Update action to be performed |
1109 | * Action - Update action to be performed | ||
1110 | * | 1126 | * |
1111 | * RETURN: Status | 1127 | * RETURN: New state object, null on failure |
1112 | * | 1128 | * |
1113 | * DESCRIPTION: Create a "Package State" | 1129 | * DESCRIPTION: Create a "Package State" |
1114 | * | 1130 | * |
@@ -1151,7 +1167,7 @@ acpi_ut_create_pkg_state ( | |||
1151 | * | 1167 | * |
1152 | * PARAMETERS: None | 1168 | * PARAMETERS: None |
1153 | * | 1169 | * |
1154 | * RETURN: Status | 1170 | * RETURN: New state object, null on failure |
1155 | * | 1171 | * |
1156 | * DESCRIPTION: Create a "Control State" - a flavor of the generic state used | 1172 | * DESCRIPTION: Create a "Control State" - a flavor of the generic state used |
1157 | * to support nested IF/WHILE constructs in the AML. | 1173 | * to support nested IF/WHILE constructs in the AML. |
@@ -1190,7 +1206,7 @@ acpi_ut_create_control_state ( | |||
1190 | * | 1206 | * |
1191 | * PARAMETERS: State - The state object to be deleted | 1207 | * PARAMETERS: State - The state object to be deleted |
1192 | * | 1208 | * |
1193 | * RETURN: Status | 1209 | * RETURN: None |
1194 | * | 1210 | * |
1195 | * DESCRIPTION: Put a state object back into the global state cache. The object | 1211 | * DESCRIPTION: Put a state object back into the global state cache. The object |
1196 | * is not actually freed at this time. | 1212 | * is not actually freed at this time. |
@@ -1216,7 +1232,7 @@ acpi_ut_delete_generic_state ( | |||
1216 | * | 1232 | * |
1217 | * PARAMETERS: None | 1233 | * PARAMETERS: None |
1218 | * | 1234 | * |
1219 | * RETURN: Status | 1235 | * RETURN: None |
1220 | * | 1236 | * |
1221 | * DESCRIPTION: Purge the global state object cache. Used during subsystem | 1237 | * DESCRIPTION: Purge the global state object cache. Used during subsystem |
1222 | * termination. | 1238 | * termination. |
@@ -1240,7 +1256,10 @@ acpi_ut_delete_generic_state_cache ( | |||
1240 | * | 1256 | * |
1241 | * FUNCTION: acpi_ut_walk_package_tree | 1257 | * FUNCTION: acpi_ut_walk_package_tree |
1242 | * | 1258 | * |
1243 | * PARAMETERS: obj_desc - The Package object on which to resolve refs | 1259 | * PARAMETERS: source_object - The package to walk |
1260 | * target_object - Target object (if package is being copied) | ||
1261 | * walk_callback - Called once for each package element | ||
1262 | * Context - Passed to the callback function | ||
1244 | * | 1263 | * |
1245 | * RETURN: Status | 1264 | * RETURN: Status |
1246 | * | 1265 | * |
@@ -1359,7 +1378,7 @@ acpi_ut_walk_package_tree ( | |||
1359 | * PARAMETERS: Buffer - Buffer to be scanned | 1378 | * PARAMETERS: Buffer - Buffer to be scanned |
1360 | * Length - number of bytes to examine | 1379 | * Length - number of bytes to examine |
1361 | * | 1380 | * |
1362 | * RETURN: checksum | 1381 | * RETURN: The generated checksum |
1363 | * | 1382 | * |
1364 | * DESCRIPTION: Generate a checksum on a raw buffer | 1383 | * DESCRIPTION: Generate a checksum on a raw buffer |
1365 | * | 1384 | * |
@@ -1442,7 +1461,6 @@ acpi_ut_get_resource_end_tag ( | |||
1442 | * PARAMETERS: module_name - Caller's module name (for error output) | 1461 | * PARAMETERS: module_name - Caller's module name (for error output) |
1443 | * line_number - Caller's line number (for error output) | 1462 | * line_number - Caller's line number (for error output) |
1444 | * component_id - Caller's component ID (for error output) | 1463 | * component_id - Caller's component ID (for error output) |
1445 | * Message - Error message to use on failure | ||
1446 | * | 1464 | * |
1447 | * RETURN: None | 1465 | * RETURN: None |
1448 | * | 1466 | * |
@@ -1457,7 +1475,6 @@ acpi_ut_report_error ( | |||
1457 | u32 component_id) | 1475 | u32 component_id) |
1458 | { | 1476 | { |
1459 | 1477 | ||
1460 | |||
1461 | acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); | 1478 | acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); |
1462 | } | 1479 | } |
1463 | 1480 | ||
@@ -1469,7 +1486,6 @@ acpi_ut_report_error ( | |||
1469 | * PARAMETERS: module_name - Caller's module name (for error output) | 1486 | * PARAMETERS: module_name - Caller's module name (for error output) |
1470 | * line_number - Caller's line number (for error output) | 1487 | * line_number - Caller's line number (for error output) |
1471 | * component_id - Caller's component ID (for error output) | 1488 | * component_id - Caller's component ID (for error output) |
1472 | * Message - Error message to use on failure | ||
1473 | * | 1489 | * |
1474 | * RETURN: None | 1490 | * RETURN: None |
1475 | * | 1491 | * |
@@ -1495,7 +1511,6 @@ acpi_ut_report_warning ( | |||
1495 | * PARAMETERS: module_name - Caller's module name (for error output) | 1511 | * PARAMETERS: module_name - Caller's module name (for error output) |
1496 | * line_number - Caller's line number (for error output) | 1512 | * line_number - Caller's line number (for error output) |
1497 | * component_id - Caller's component ID (for error output) | 1513 | * component_id - Caller's component ID (for error output) |
1498 | * Message - Error message to use on failure | ||
1499 | * | 1514 | * |
1500 | * RETURN: None | 1515 | * RETURN: None |
1501 | * | 1516 | * |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 9ee40a484e07..cd3899b9cc5a 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -50,6 +50,25 @@ | |||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME ("utobject") | 51 | ACPI_MODULE_NAME ("utobject") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
54 | |||
55 | static acpi_status | ||
56 | acpi_ut_get_simple_object_size ( | ||
57 | union acpi_operand_object *obj, | ||
58 | acpi_size *obj_length); | ||
59 | |||
60 | static acpi_status | ||
61 | acpi_ut_get_package_object_size ( | ||
62 | union acpi_operand_object *obj, | ||
63 | acpi_size *obj_length); | ||
64 | |||
65 | static acpi_status | ||
66 | acpi_ut_get_element_length ( | ||
67 | u8 object_type, | ||
68 | union acpi_operand_object *source_object, | ||
69 | union acpi_generic_state *state, | ||
70 | void *context); | ||
71 | |||
53 | 72 | ||
54 | /******************************************************************************* | 73 | /******************************************************************************* |
55 | * | 74 | * |
@@ -60,7 +79,7 @@ | |||
60 | * component_id - Component type of caller | 79 | * component_id - Component type of caller |
61 | * Type - ACPI Type of the new object | 80 | * Type - ACPI Type of the new object |
62 | * | 81 | * |
63 | * RETURN: Object - The new object. Null on failure | 82 | * RETURN: A new internal object, null on failure |
64 | * | 83 | * |
65 | * DESCRIPTION: Create and initialize a new internal object. | 84 | * DESCRIPTION: Create and initialize a new internal object. |
66 | * | 85 | * |
@@ -83,7 +102,8 @@ acpi_ut_create_internal_object_dbg ( | |||
83 | union acpi_operand_object *second_object; | 102 | union acpi_operand_object *second_object; |
84 | 103 | ||
85 | 104 | ||
86 | ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg", acpi_ut_get_type_name (type)); | 105 | ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg", |
106 | acpi_ut_get_type_name (type)); | ||
87 | 107 | ||
88 | 108 | ||
89 | /* Allocate the raw object descriptor */ | 109 | /* Allocate the raw object descriptor */ |
@@ -99,7 +119,8 @@ acpi_ut_create_internal_object_dbg ( | |||
99 | 119 | ||
100 | /* These types require a secondary object */ | 120 | /* These types require a secondary object */ |
101 | 121 | ||
102 | second_object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id); | 122 | second_object = acpi_ut_allocate_object_desc_dbg (module_name, |
123 | line_number, component_id); | ||
103 | if (!second_object) { | 124 | if (!second_object) { |
104 | acpi_ut_delete_object_desc (object); | 125 | acpi_ut_delete_object_desc (object); |
105 | return_PTR (NULL); | 126 | return_PTR (NULL); |
@@ -138,7 +159,7 @@ acpi_ut_create_internal_object_dbg ( | |||
138 | * | 159 | * |
139 | * PARAMETERS: buffer_size - Size of buffer to be created | 160 | * PARAMETERS: buffer_size - Size of buffer to be created |
140 | * | 161 | * |
141 | * RETURN: Pointer to a new Buffer object | 162 | * RETURN: Pointer to a new Buffer object, null on failure |
142 | * | 163 | * |
143 | * DESCRIPTION: Create a fully initialized buffer object | 164 | * DESCRIPTION: Create a fully initialized buffer object |
144 | * | 165 | * |
@@ -192,9 +213,9 @@ acpi_ut_create_buffer_object ( | |||
192 | * | 213 | * |
193 | * FUNCTION: acpi_ut_create_string_object | 214 | * FUNCTION: acpi_ut_create_string_object |
194 | * | 215 | * |
195 | * PARAMETERS: string_size - Size of string to be created. Does not | 216 | * PARAMETERS: string_size - Size of string to be created. Does not |
196 | * include NULL terminator, this is added | 217 | * include NULL terminator, this is added |
197 | * automatically. | 218 | * automatically. |
198 | * | 219 | * |
199 | * RETURN: Pointer to a new String object | 220 | * RETURN: Pointer to a new String object |
200 | * | 221 | * |
@@ -249,7 +270,9 @@ acpi_ut_create_string_object ( | |||
249 | * | 270 | * |
250 | * PARAMETERS: Object - Object to be validated | 271 | * PARAMETERS: Object - Object to be validated |
251 | * | 272 | * |
252 | * RETURN: Validate a pointer to be an union acpi_operand_object | 273 | * RETURN: TRUE if object is valid, FALSE otherwise |
274 | * | ||
275 | * DESCRIPTION: Validate a pointer to be an union acpi_operand_object | ||
253 | * | 276 | * |
254 | ******************************************************************************/ | 277 | ******************************************************************************/ |
255 | 278 | ||
@@ -399,8 +422,8 @@ acpi_ut_delete_object_cache ( | |||
399 | * | 422 | * |
400 | * FUNCTION: acpi_ut_get_simple_object_size | 423 | * FUNCTION: acpi_ut_get_simple_object_size |
401 | * | 424 | * |
402 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 425 | * PARAMETERS: internal_object - An ACPI operand object |
403 | * *obj_length - Where the length is returned | 426 | * obj_length - Where the length is returned |
404 | * | 427 | * |
405 | * RETURN: Status | 428 | * RETURN: Status |
406 | * | 429 | * |
@@ -412,7 +435,7 @@ acpi_ut_delete_object_cache ( | |||
412 | * | 435 | * |
413 | ******************************************************************************/ | 436 | ******************************************************************************/ |
414 | 437 | ||
415 | acpi_status | 438 | static acpi_status |
416 | acpi_ut_get_simple_object_size ( | 439 | acpi_ut_get_simple_object_size ( |
417 | union acpi_operand_object *internal_object, | 440 | union acpi_operand_object *internal_object, |
418 | acpi_size *obj_length) | 441 | acpi_size *obj_length) |
@@ -424,8 +447,10 @@ acpi_ut_get_simple_object_size ( | |||
424 | ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object); | 447 | ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object); |
425 | 448 | ||
426 | 449 | ||
427 | /* Handle a null object (Could be a uninitialized package element -- which is legal) */ | 450 | /* |
428 | 451 | * Handle a null object (Could be a uninitialized package | |
452 | * element -- which is legal) | ||
453 | */ | ||
429 | if (!internal_object) { | 454 | if (!internal_object) { |
430 | *obj_length = 0; | 455 | *obj_length = 0; |
431 | return_ACPI_STATUS (AE_OK); | 456 | return_ACPI_STATUS (AE_OK); |
@@ -480,7 +505,8 @@ acpi_ut_get_simple_object_size ( | |||
480 | * Get the actual length of the full pathname to this object. | 505 | * Get the actual length of the full pathname to this object. |
481 | * The reference will be converted to the pathname to the object | 506 | * The reference will be converted to the pathname to the object |
482 | */ | 507 | */ |
483 | length += ACPI_ROUND_UP_TO_NATIVE_WORD (acpi_ns_get_pathname_length (internal_object->reference.node)); | 508 | length += ACPI_ROUND_UP_TO_NATIVE_WORD ( |
509 | acpi_ns_get_pathname_length (internal_object->reference.node)); | ||
484 | break; | 510 | break; |
485 | 511 | ||
486 | default: | 512 | default: |
@@ -530,7 +556,7 @@ acpi_ut_get_simple_object_size ( | |||
530 | * | 556 | * |
531 | ******************************************************************************/ | 557 | ******************************************************************************/ |
532 | 558 | ||
533 | acpi_status | 559 | static acpi_status |
534 | acpi_ut_get_element_length ( | 560 | acpi_ut_get_element_length ( |
535 | u8 object_type, | 561 | u8 object_type, |
536 | union acpi_operand_object *source_object, | 562 | union acpi_operand_object *source_object, |
@@ -582,8 +608,8 @@ acpi_ut_get_element_length ( | |||
582 | * | 608 | * |
583 | * FUNCTION: acpi_ut_get_package_object_size | 609 | * FUNCTION: acpi_ut_get_package_object_size |
584 | * | 610 | * |
585 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 611 | * PARAMETERS: internal_object - An ACPI internal object |
586 | * *obj_length - Where the length is returned | 612 | * obj_length - Where the length is returned |
587 | * | 613 | * |
588 | * RETURN: Status | 614 | * RETURN: Status |
589 | * | 615 | * |
@@ -595,7 +621,7 @@ acpi_ut_get_element_length ( | |||
595 | * | 621 | * |
596 | ******************************************************************************/ | 622 | ******************************************************************************/ |
597 | 623 | ||
598 | acpi_status | 624 | static acpi_status |
599 | acpi_ut_get_package_object_size ( | 625 | acpi_ut_get_package_object_size ( |
600 | union acpi_operand_object *internal_object, | 626 | union acpi_operand_object *internal_object, |
601 | acpi_size *obj_length) | 627 | acpi_size *obj_length) |
@@ -636,8 +662,8 @@ acpi_ut_get_package_object_size ( | |||
636 | * | 662 | * |
637 | * FUNCTION: acpi_ut_get_object_size | 663 | * FUNCTION: acpi_ut_get_object_size |
638 | * | 664 | * |
639 | * PARAMETERS: *internal_object - Pointer to the object we are examining | 665 | * PARAMETERS: internal_object - An ACPI internal object |
640 | * *obj_length - Where the length will be returned | 666 | * obj_length - Where the length will be returned |
641 | * | 667 | * |
642 | * RETURN: Status | 668 | * RETURN: Status |
643 | * | 669 | * |
@@ -647,7 +673,7 @@ acpi_ut_get_package_object_size ( | |||
647 | ******************************************************************************/ | 673 | ******************************************************************************/ |
648 | 674 | ||
649 | acpi_status | 675 | acpi_status |
650 | acpi_ut_get_object_size( | 676 | acpi_ut_get_object_size ( |
651 | union acpi_operand_object *internal_object, | 677 | union acpi_operand_object *internal_object, |
652 | acpi_size *obj_length) | 678 | acpi_size *obj_length) |
653 | { | 679 | { |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 97a91f3f06f0..e8803d810656 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -73,6 +73,7 @@ acpi_initialize_subsystem ( | |||
73 | { | 73 | { |
74 | acpi_status status; | 74 | acpi_status status; |
75 | 75 | ||
76 | |||
76 | ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem"); | 77 | ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem"); |
77 | 78 | ||
78 | 79 | ||
@@ -105,7 +106,6 @@ acpi_initialize_subsystem ( | |||
105 | * Initialize the namespace manager and | 106 | * Initialize the namespace manager and |
106 | * the root of the namespace tree | 107 | * the root of the namespace tree |
107 | */ | 108 | */ |
108 | |||
109 | status = acpi_ns_root_initialize (); | 109 | status = acpi_ns_root_initialize (); |
110 | if (ACPI_FAILURE (status)) { | 110 | if (ACPI_FAILURE (status)) { |
111 | ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n", | 111 | ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n", |
@@ -113,7 +113,6 @@ acpi_initialize_subsystem ( | |||
113 | return_ACPI_STATUS (status); | 113 | return_ACPI_STATUS (status); |
114 | } | 114 | } |
115 | 115 | ||
116 | |||
117 | /* If configured, initialize the AML debugger */ | 116 | /* If configured, initialize the AML debugger */ |
118 | 117 | ||
119 | ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ()); | 118 | ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ()); |
@@ -150,7 +149,8 @@ acpi_enable_subsystem ( | |||
150 | * The values from the FADT are validated here. | 149 | * The values from the FADT are validated here. |
151 | */ | 150 | */ |
152 | if (!(flags & ACPI_NO_HARDWARE_INIT)) { | 151 | if (!(flags & ACPI_NO_HARDWARE_INIT)) { |
153 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n")); | 152 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
153 | "[Init] Initializing ACPI hardware\n")); | ||
154 | 154 | ||
155 | status = acpi_hw_initialize (); | 155 | status = acpi_hw_initialize (); |
156 | if (ACPI_FAILURE (status)) { | 156 | if (ACPI_FAILURE (status)) { |
@@ -178,7 +178,8 @@ acpi_enable_subsystem ( | |||
178 | * install_address_space_handler interface. | 178 | * install_address_space_handler interface. |
179 | */ | 179 | */ |
180 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 180 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
181 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); | 181 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
182 | "[Init] Installing default address space handlers\n")); | ||
182 | 183 | ||
183 | status = acpi_ev_install_region_handlers (); | 184 | status = acpi_ev_install_region_handlers (); |
184 | if (ACPI_FAILURE (status)) { | 185 | if (ACPI_FAILURE (status)) { |
@@ -189,12 +190,14 @@ acpi_enable_subsystem ( | |||
189 | /* | 190 | /* |
190 | * Initialize ACPI Event handling (Fixed and General Purpose) | 191 | * Initialize ACPI Event handling (Fixed and General Purpose) |
191 | * | 192 | * |
192 | * NOTE: We must have the hardware AND events initialized before we can execute | 193 | * NOTE: We must have the hardware AND events initialized before we can |
193 | * ANY control methods SAFELY. Any control method can require ACPI hardware | 194 | * execute ANY control methods SAFELY. Any control method can require |
194 | * support, so the hardware MUST be initialized before execution! | 195 | * ACPI hardware support, so the hardware MUST be initialized before |
196 | * execution! | ||
195 | */ | 197 | */ |
196 | if (!(flags & ACPI_NO_EVENT_INIT)) { | 198 | if (!(flags & ACPI_NO_EVENT_INIT)) { |
197 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n")); | 199 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
200 | "[Init] Initializing ACPI events\n")); | ||
198 | 201 | ||
199 | status = acpi_ev_initialize_events (); | 202 | status = acpi_ev_initialize_events (); |
200 | if (ACPI_FAILURE (status)) { | 203 | if (ACPI_FAILURE (status)) { |
@@ -205,7 +208,8 @@ acpi_enable_subsystem ( | |||
205 | /* Install the SCI handler and Global Lock handler */ | 208 | /* Install the SCI handler and Global Lock handler */ |
206 | 209 | ||
207 | if (!(flags & ACPI_NO_HANDLER_INIT)) { | 210 | if (!(flags & ACPI_NO_HANDLER_INIT)) { |
208 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n")); | 211 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
212 | "[Init] Installing SCI/GL handlers\n")); | ||
209 | 213 | ||
210 | status = acpi_ev_install_xrupt_handlers (); | 214 | status = acpi_ev_install_xrupt_handlers (); |
211 | if (ACPI_FAILURE (status)) { | 215 | if (ACPI_FAILURE (status)) { |
@@ -247,7 +251,8 @@ acpi_initialize_objects ( | |||
247 | * contain executable AML (see call to acpi_ns_initialize_objects below). | 251 | * contain executable AML (see call to acpi_ns_initialize_objects below). |
248 | */ | 252 | */ |
249 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 253 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
250 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Executing _REG op_region methods\n")); | 254 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
255 | "[Init] Executing _REG op_region methods\n")); | ||
251 | 256 | ||
252 | status = acpi_ev_initialize_op_regions (); | 257 | status = acpi_ev_initialize_op_regions (); |
253 | if (ACPI_FAILURE (status)) { | 258 | if (ACPI_FAILURE (status)) { |
@@ -261,7 +266,8 @@ acpi_initialize_objects ( | |||
261 | * objects: operation_regions, buffer_fields, Buffers, and Packages. | 266 | * objects: operation_regions, buffer_fields, Buffers, and Packages. |
262 | */ | 267 | */ |
263 | if (!(flags & ACPI_NO_OBJECT_INIT)) { | 268 | if (!(flags & ACPI_NO_OBJECT_INIT)) { |
264 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Completing Initialization of ACPI Objects\n")); | 269 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
270 | "[Init] Completing Initialization of ACPI Objects\n")); | ||
265 | 271 | ||
266 | status = acpi_ns_initialize_objects (); | 272 | status = acpi_ns_initialize_objects (); |
267 | if (ACPI_FAILURE (status)) { | 273 | if (ACPI_FAILURE (status)) { |
@@ -274,7 +280,8 @@ acpi_initialize_objects ( | |||
274 | * This runs the _STA and _INI methods. | 280 | * This runs the _STA and _INI methods. |
275 | */ | 281 | */ |
276 | if (!(flags & ACPI_NO_DEVICE_INIT)) { | 282 | if (!(flags & ACPI_NO_DEVICE_INIT)) { |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n")); | 283 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
284 | "[Init] Initializing ACPI Devices\n")); | ||
278 | 285 | ||
279 | status = acpi_ns_initialize_devices (); | 286 | status = acpi_ns_initialize_devices (); |
280 | if (ACPI_FAILURE (status)) { | 287 | if (ACPI_FAILURE (status)) { |
@@ -307,7 +314,8 @@ acpi_initialize_objects ( | |||
307 | ******************************************************************************/ | 314 | ******************************************************************************/ |
308 | 315 | ||
309 | acpi_status | 316 | acpi_status |
310 | acpi_terminate (void) | 317 | acpi_terminate ( |
318 | void) | ||
311 | { | 319 | { |
312 | acpi_status status; | 320 | acpi_status status; |
313 | 321 | ||
@@ -344,8 +352,7 @@ acpi_terminate (void) | |||
344 | 352 | ||
345 | 353 | ||
346 | #ifdef ACPI_FUTURE_USAGE | 354 | #ifdef ACPI_FUTURE_USAGE |
347 | 355 | /******************************************************************************* | |
348 | /***************************************************************************** | ||
349 | * | 356 | * |
350 | * FUNCTION: acpi_subsystem_status | 357 | * FUNCTION: acpi_subsystem_status |
351 | * | 358 | * |
@@ -354,14 +361,16 @@ acpi_terminate (void) | |||
354 | * RETURN: Status of the ACPI subsystem | 361 | * RETURN: Status of the ACPI subsystem |
355 | * | 362 | * |
356 | * DESCRIPTION: Other drivers that use the ACPI subsystem should call this | 363 | * DESCRIPTION: Other drivers that use the ACPI subsystem should call this |
357 | * before making any other calls, to ensure the subsystem initial- | 364 | * before making any other calls, to ensure the subsystem |
358 | * ized successfully. | 365 | * initialized successfully. |
359 | * | 366 | * |
360 | ****************************************************************************/ | 367 | ******************************************************************************/ |
361 | 368 | ||
362 | acpi_status | 369 | acpi_status |
363 | acpi_subsystem_status (void) | 370 | acpi_subsystem_status ( |
371 | void) | ||
364 | { | 372 | { |
373 | |||
365 | if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) { | 374 | if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) { |
366 | return (AE_OK); | 375 | return (AE_OK); |
367 | } | 376 | } |
@@ -371,13 +380,12 @@ acpi_subsystem_status (void) | |||
371 | } | 380 | } |
372 | 381 | ||
373 | 382 | ||
374 | /****************************************************************************** | 383 | /******************************************************************************* |
375 | * | 384 | * |
376 | * FUNCTION: acpi_get_system_info | 385 | * FUNCTION: acpi_get_system_info |
377 | * | 386 | * |
378 | * PARAMETERS: out_buffer - a pointer to a buffer to receive the | 387 | * PARAMETERS: out_buffer - A buffer to receive the resources for the |
379 | * resources for the device | 388 | * device |
380 | * buffer_length - the number of bytes available in the buffer | ||
381 | * | 389 | * |
382 | * RETURN: Status - the status of the call | 390 | * RETURN: Status - the status of the call |
383 | * | 391 | * |
@@ -395,8 +403,8 @@ acpi_get_system_info ( | |||
395 | struct acpi_buffer *out_buffer) | 403 | struct acpi_buffer *out_buffer) |
396 | { | 404 | { |
397 | struct acpi_system_info *info_ptr; | 405 | struct acpi_system_info *info_ptr; |
398 | u32 i; | ||
399 | acpi_status status; | 406 | acpi_status status; |
407 | u32 i; | ||
400 | 408 | ||
401 | 409 | ||
402 | ACPI_FUNCTION_TRACE ("acpi_get_system_info"); | 410 | ACPI_FUNCTION_TRACE ("acpi_get_system_info"); |
@@ -466,6 +474,7 @@ EXPORT_SYMBOL(acpi_get_system_info); | |||
466 | * FUNCTION: acpi_install_initialization_handler | 474 | * FUNCTION: acpi_install_initialization_handler |
467 | * | 475 | * |
468 | * PARAMETERS: Handler - Callback procedure | 476 | * PARAMETERS: Handler - Callback procedure |
477 | * Function - Not (currently) used, see below | ||
469 | * | 478 | * |
470 | * RETURN: Status | 479 | * RETURN: Status |
471 | * | 480 | * |
@@ -495,7 +504,6 @@ acpi_install_initialization_handler ( | |||
495 | 504 | ||
496 | #endif /* ACPI_FUTURE_USAGE */ | 505 | #endif /* ACPI_FUTURE_USAGE */ |
497 | 506 | ||
498 | |||
499 | /***************************************************************************** | 507 | /***************************************************************************** |
500 | * | 508 | * |
501 | * FUNCTION: acpi_purge_cached_objects | 509 | * FUNCTION: acpi_purge_cached_objects |
@@ -509,7 +517,8 @@ acpi_install_initialization_handler ( | |||
509 | ****************************************************************************/ | 517 | ****************************************************************************/ |
510 | 518 | ||
511 | acpi_status | 519 | acpi_status |
512 | acpi_purge_cached_objects (void) | 520 | acpi_purge_cached_objects ( |
521 | void) | ||
513 | { | 522 | { |
514 | ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); | 523 | ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); |
515 | 524 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 71fa1011715f..2cf264fd52e0 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -564,12 +564,13 @@ acpi_video_device_find_cap (struct acpi_video_device *device) | |||
564 | int count = 0; | 564 | int count = 0; |
565 | union acpi_object *o; | 565 | union acpi_object *o; |
566 | 566 | ||
567 | br = kmalloc(sizeof &br, GFP_KERNEL); | 567 | br = kmalloc(sizeof(*br), GFP_KERNEL); |
568 | if (!br) { | 568 | if (!br) { |
569 | printk(KERN_ERR "can't allocate memory\n"); | 569 | printk(KERN_ERR "can't allocate memory\n"); |
570 | } else { | 570 | } else { |
571 | memset(br, 0, sizeof &br); | 571 | memset(br, 0, sizeof(*br)); |
572 | br->levels = kmalloc(obj->package.count * sizeof &br->levels, GFP_KERNEL); | 572 | br->levels = kmalloc(obj->package.count * |
573 | sizeof *(br->levels), GFP_KERNEL); | ||
573 | if (!br->levels) | 574 | if (!br->levels) |
574 | goto out; | 575 | goto out; |
575 | 576 | ||
@@ -584,8 +585,7 @@ acpi_video_device_find_cap (struct acpi_video_device *device) | |||
584 | } | 585 | } |
585 | out: | 586 | out: |
586 | if (count < 2) { | 587 | if (count < 2) { |
587 | if (br->levels) | 588 | kfree(br->levels); |
588 | kfree(br->levels); | ||
589 | kfree(br); | 589 | kfree(br); |
590 | } else { | 590 | } else { |
591 | br->count = count; | 591 | br->count = count; |
@@ -595,8 +595,7 @@ out: | |||
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
598 | if (obj) | 598 | kfree(obj); |
599 | kfree(obj); | ||
600 | 599 | ||
601 | return_VOID; | 600 | return_VOID; |
602 | } | 601 | } |
@@ -1585,7 +1584,7 @@ acpi_video_switch_output( | |||
1585 | ACPI_FUNCTION_TRACE("acpi_video_switch_output"); | 1584 | ACPI_FUNCTION_TRACE("acpi_video_switch_output"); |
1586 | 1585 | ||
1587 | list_for_each_safe(node, next, &video->video_device_list) { | 1586 | list_for_each_safe(node, next, &video->video_device_list) { |
1588 | struct acpi_video_device * dev = container_of(node, struct acpi_video_device, entry); | 1587 | dev = container_of(node, struct acpi_video_device, entry); |
1589 | status = acpi_video_device_get_state(dev, &state); | 1588 | status = acpi_video_device_get_state(dev, &state); |
1590 | if (state & 0x2){ | 1589 | if (state & 0x2){ |
1591 | dev_next = container_of(node->next, struct acpi_video_device, entry); | 1590 | dev_next = container_of(node->next, struct acpi_video_device, entry); |