diff options
Diffstat (limited to 'drivers/acpi')
201 files changed, 6347 insertions, 5746 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 38c5078da11d..78105b3a5262 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -337,7 +337,7 @@ config X86_PM_TIMER | |||
337 | systems require this timer. | 337 | systems require this timer. |
338 | 338 | ||
339 | config ACPI_CONTAINER | 339 | config ACPI_CONTAINER |
340 | tristate "Container and Module Devices (EXPERIMENTAL)" | 340 | bool "Container and Module Devices (EXPERIMENTAL)" |
341 | depends on EXPERIMENTAL | 341 | depends on EXPERIMENTAL |
342 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) | 342 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) |
343 | help | 343 | help |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 2a4502becd13..474fcfeba66c 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -37,7 +37,8 @@ acpi-y += resource.o | |||
37 | acpi-y += processor_core.o | 37 | acpi-y += processor_core.o |
38 | acpi-y += ec.o | 38 | acpi-y += ec.o |
39 | acpi-$(CONFIG_ACPI_DOCK) += dock.o | 39 | acpi-$(CONFIG_ACPI_DOCK) += dock.o |
40 | acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o | 40 | acpi-y += pci_root.o pci_link.o pci_irq.o |
41 | acpi-y += csrt.o | ||
41 | acpi-y += acpi_platform.o | 42 | acpi-y += acpi_platform.o |
42 | acpi-y += power.o | 43 | acpi-y += power.o |
43 | acpi-y += event.o | 44 | acpi-y += event.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index d5fdd36190cc..6d5bf649196d 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -60,7 +60,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file); | |||
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | static int acpi_ac_add(struct acpi_device *device); | 62 | static int acpi_ac_add(struct acpi_device *device); |
63 | static int acpi_ac_remove(struct acpi_device *device, int type); | 63 | static int acpi_ac_remove(struct acpi_device *device); |
64 | static void acpi_ac_notify(struct acpi_device *device, u32 event); | 64 | static void acpi_ac_notify(struct acpi_device *device, u32 event); |
65 | 65 | ||
66 | static const struct acpi_device_id ac_device_ids[] = { | 66 | static const struct acpi_device_id ac_device_ids[] = { |
@@ -337,7 +337,7 @@ static int acpi_ac_resume(struct device *dev) | |||
337 | } | 337 | } |
338 | #endif | 338 | #endif |
339 | 339 | ||
340 | static int acpi_ac_remove(struct acpi_device *device, int type) | 340 | static int acpi_ac_remove(struct acpi_device *device) |
341 | { | 341 | { |
342 | struct acpi_ac *ac = NULL; | 342 | struct acpi_ac *ac = NULL; |
343 | 343 | ||
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index b679bf8478f7..034d3e72aa92 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -54,7 +54,7 @@ MODULE_LICENSE("GPL"); | |||
54 | #define MEMORY_POWER_OFF_STATE 2 | 54 | #define MEMORY_POWER_OFF_STATE 2 |
55 | 55 | ||
56 | static int acpi_memory_device_add(struct acpi_device *device); | 56 | static int acpi_memory_device_add(struct acpi_device *device); |
57 | static int acpi_memory_device_remove(struct acpi_device *device, int type); | 57 | static int acpi_memory_device_remove(struct acpi_device *device); |
58 | 58 | ||
59 | static const struct acpi_device_id memory_device_ids[] = { | 59 | static const struct acpi_device_id memory_device_ids[] = { |
60 | {ACPI_MEMORY_DEVICE_HID, 0}, | 60 | {ACPI_MEMORY_DEVICE_HID, 0}, |
@@ -153,51 +153,46 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
156 | static int | 156 | static int acpi_memory_get_device(acpi_handle handle, |
157 | acpi_memory_get_device(acpi_handle handle, | 157 | struct acpi_memory_device **mem_device) |
158 | struct acpi_memory_device **mem_device) | ||
159 | { | 158 | { |
160 | acpi_status status; | ||
161 | acpi_handle phandle; | ||
162 | struct acpi_device *device = NULL; | 159 | struct acpi_device *device = NULL; |
163 | struct acpi_device *pdevice = NULL; | 160 | int result = 0; |
164 | int result; | ||
165 | 161 | ||
162 | acpi_scan_lock_acquire(); | ||
166 | 163 | ||
167 | if (!acpi_bus_get_device(handle, &device) && device) | 164 | acpi_bus_get_device(handle, &device); |
165 | if (device) | ||
168 | goto end; | 166 | goto end; |
169 | 167 | ||
170 | status = acpi_get_parent(handle, &phandle); | ||
171 | if (ACPI_FAILURE(status)) { | ||
172 | ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); | ||
173 | return -EINVAL; | ||
174 | } | ||
175 | |||
176 | /* Get the parent device */ | ||
177 | result = acpi_bus_get_device(phandle, &pdevice); | ||
178 | if (result) { | ||
179 | acpi_handle_warn(phandle, "Cannot get acpi bus device\n"); | ||
180 | return -EINVAL; | ||
181 | } | ||
182 | |||
183 | /* | 168 | /* |
184 | * Now add the notified device. This creates the acpi_device | 169 | * Now add the notified device. This creates the acpi_device |
185 | * and invokes .add function | 170 | * and invokes .add function |
186 | */ | 171 | */ |
187 | result = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); | 172 | result = acpi_bus_scan(handle); |
188 | if (result) { | 173 | if (result) { |
189 | acpi_handle_warn(handle, "Cannot add acpi bus\n"); | 174 | acpi_handle_warn(handle, "ACPI namespace scan failed\n"); |
190 | return -EINVAL; | 175 | result = -EINVAL; |
176 | goto out; | ||
177 | } | ||
178 | result = acpi_bus_get_device(handle, &device); | ||
179 | if (result) { | ||
180 | acpi_handle_warn(handle, "Missing device object\n"); | ||
181 | result = -EINVAL; | ||
182 | goto out; | ||
191 | } | 183 | } |
192 | 184 | ||
193 | end: | 185 | end: |
194 | *mem_device = acpi_driver_data(device); | 186 | *mem_device = acpi_driver_data(device); |
195 | if (!(*mem_device)) { | 187 | if (!(*mem_device)) { |
196 | dev_err(&device->dev, "driver data not found\n"); | 188 | dev_err(&device->dev, "driver data not found\n"); |
197 | return -ENODEV; | 189 | result = -ENODEV; |
190 | goto out; | ||
198 | } | 191 | } |
199 | 192 | ||
200 | return 0; | 193 | out: |
194 | acpi_scan_lock_release(); | ||
195 | return result; | ||
201 | } | 196 | } |
202 | 197 | ||
203 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) | 198 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) |
@@ -317,6 +312,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
317 | struct acpi_device *device; | 312 | struct acpi_device *device; |
318 | struct acpi_eject_event *ej_event = NULL; | 313 | struct acpi_eject_event *ej_event = NULL; |
319 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 314 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ |
315 | acpi_status status; | ||
320 | 316 | ||
321 | switch (event) { | 317 | switch (event) { |
322 | case ACPI_NOTIFY_BUS_CHECK: | 318 | case ACPI_NOTIFY_BUS_CHECK: |
@@ -339,29 +335,40 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
339 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 335 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
340 | "\nReceived EJECT REQUEST notification for device\n")); | 336 | "\nReceived EJECT REQUEST notification for device\n")); |
341 | 337 | ||
338 | status = AE_ERROR; | ||
339 | acpi_scan_lock_acquire(); | ||
340 | |||
342 | if (acpi_bus_get_device(handle, &device)) { | 341 | if (acpi_bus_get_device(handle, &device)) { |
343 | acpi_handle_err(handle, "Device doesn't exist\n"); | 342 | acpi_handle_err(handle, "Device doesn't exist\n"); |
344 | break; | 343 | goto unlock; |
345 | } | 344 | } |
346 | mem_device = acpi_driver_data(device); | 345 | mem_device = acpi_driver_data(device); |
347 | if (!mem_device) { | 346 | if (!mem_device) { |
348 | acpi_handle_err(handle, "Driver Data is NULL\n"); | 347 | acpi_handle_err(handle, "Driver Data is NULL\n"); |
349 | break; | 348 | goto unlock; |
350 | } | 349 | } |
351 | 350 | ||
352 | ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); | 351 | ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); |
353 | if (!ej_event) { | 352 | if (!ej_event) { |
354 | pr_err(PREFIX "No memory, dropping EJECT\n"); | 353 | pr_err(PREFIX "No memory, dropping EJECT\n"); |
355 | break; | 354 | goto unlock; |
356 | } | 355 | } |
357 | 356 | ||
358 | ej_event->handle = handle; | 357 | get_device(&device->dev); |
358 | ej_event->device = device; | ||
359 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | 359 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; |
360 | acpi_os_hotplug_execute(acpi_bus_hot_remove_device, | 360 | /* The eject is carried out asynchronously. */ |
361 | (void *)ej_event); | 361 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, |
362 | ej_event); | ||
363 | if (ACPI_FAILURE(status)) { | ||
364 | put_device(&device->dev); | ||
365 | kfree(ej_event); | ||
366 | } | ||
362 | 367 | ||
363 | /* eject is performed asynchronously */ | 368 | unlock: |
364 | return; | 369 | acpi_scan_lock_release(); |
370 | if (ACPI_SUCCESS(status)) | ||
371 | return; | ||
365 | default: | 372 | default: |
366 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 373 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
367 | "Unsupported event [0x%x]\n", event)); | 374 | "Unsupported event [0x%x]\n", event)); |
@@ -372,7 +379,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
372 | 379 | ||
373 | /* Inform firmware that the hotplug operation has completed */ | 380 | /* Inform firmware that the hotplug operation has completed */ |
374 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | 381 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); |
375 | return; | ||
376 | } | 382 | } |
377 | 383 | ||
378 | static void acpi_memory_device_free(struct acpi_memory_device *mem_device) | 384 | static void acpi_memory_device_free(struct acpi_memory_device *mem_device) |
@@ -427,7 +433,7 @@ static int acpi_memory_device_add(struct acpi_device *device) | |||
427 | return result; | 433 | return result; |
428 | } | 434 | } |
429 | 435 | ||
430 | static int acpi_memory_device_remove(struct acpi_device *device, int type) | 436 | static int acpi_memory_device_remove(struct acpi_device *device) |
431 | { | 437 | { |
432 | struct acpi_memory_device *mem_device = NULL; | 438 | struct acpi_memory_device *mem_device = NULL; |
433 | int result; | 439 | int result; |
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 16fa979f7180..31de1043eea0 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -482,8 +482,7 @@ static int acpi_pad_add(struct acpi_device *device) | |||
482 | return 0; | 482 | return 0; |
483 | } | 483 | } |
484 | 484 | ||
485 | static int acpi_pad_remove(struct acpi_device *device, | 485 | static int acpi_pad_remove(struct acpi_device *device) |
486 | int type) | ||
487 | { | 486 | { |
488 | mutex_lock(&isolated_cpus_lock); | 487 | mutex_lock(&isolated_cpus_lock); |
489 | acpi_pad_idle_cpus(0); | 488 | acpi_pad_idle_cpus(0); |
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index db129b9f52cb..26fce4b8a632 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/acpi.h> | 14 | #include <linux/acpi.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/err.h> | ||
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
@@ -21,18 +22,59 @@ | |||
21 | 22 | ||
22 | ACPI_MODULE_NAME("platform"); | 23 | ACPI_MODULE_NAME("platform"); |
23 | 24 | ||
25 | /* Flags for acpi_create_platform_device */ | ||
26 | #define ACPI_PLATFORM_CLK BIT(0) | ||
27 | |||
28 | /* | ||
29 | * The following ACPI IDs are known to be suitable for representing as | ||
30 | * platform devices. | ||
31 | */ | ||
32 | static const struct acpi_device_id acpi_platform_device_ids[] = { | ||
33 | |||
34 | { "PNP0D40" }, | ||
35 | |||
36 | /* Haswell LPSS devices */ | ||
37 | { "INT33C0", ACPI_PLATFORM_CLK }, | ||
38 | { "INT33C1", ACPI_PLATFORM_CLK }, | ||
39 | { "INT33C2", ACPI_PLATFORM_CLK }, | ||
40 | { "INT33C3", ACPI_PLATFORM_CLK }, | ||
41 | { "INT33C4", ACPI_PLATFORM_CLK }, | ||
42 | { "INT33C5", ACPI_PLATFORM_CLK }, | ||
43 | { "INT33C6", ACPI_PLATFORM_CLK }, | ||
44 | { "INT33C7", ACPI_PLATFORM_CLK }, | ||
45 | |||
46 | { } | ||
47 | }; | ||
48 | |||
49 | static int acpi_create_platform_clks(struct acpi_device *adev) | ||
50 | { | ||
51 | static struct platform_device *pdev; | ||
52 | |||
53 | /* Create Lynxpoint LPSS clocks */ | ||
54 | if (!pdev && !strncmp(acpi_device_hid(adev), "INT33C", 6)) { | ||
55 | pdev = platform_device_register_simple("clk-lpt", -1, NULL, 0); | ||
56 | if (IS_ERR(pdev)) | ||
57 | return PTR_ERR(pdev); | ||
58 | } | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
24 | /** | 63 | /** |
25 | * acpi_create_platform_device - Create platform device for ACPI device node | 64 | * acpi_create_platform_device - Create platform device for ACPI device node |
26 | * @adev: ACPI device node to create a platform device for. | 65 | * @adev: ACPI device node to create a platform device for. |
66 | * @id: ACPI device ID used to match @adev. | ||
27 | * | 67 | * |
28 | * Check if the given @adev can be represented as a platform device and, if | 68 | * Check if the given @adev can be represented as a platform device and, if |
29 | * that's the case, create and register a platform device, populate its common | 69 | * that's the case, create and register a platform device, populate its common |
30 | * resources and returns a pointer to it. Otherwise, return %NULL. | 70 | * resources and returns a pointer to it. Otherwise, return %NULL. |
31 | * | 71 | * |
32 | * The platform device's name will be taken from the @adev's _HID and _UID. | 72 | * Name of the platform device will be the same as @adev's. |
33 | */ | 73 | */ |
34 | struct platform_device *acpi_create_platform_device(struct acpi_device *adev) | 74 | static int acpi_create_platform_device(struct acpi_device *adev, |
75 | const struct acpi_device_id *id) | ||
35 | { | 76 | { |
77 | unsigned long flags = id->driver_data; | ||
36 | struct platform_device *pdev = NULL; | 78 | struct platform_device *pdev = NULL; |
37 | struct acpi_device *acpi_parent; | 79 | struct acpi_device *acpi_parent; |
38 | struct platform_device_info pdevinfo; | 80 | struct platform_device_info pdevinfo; |
@@ -41,20 +83,28 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev) | |||
41 | struct resource *resources; | 83 | struct resource *resources; |
42 | int count; | 84 | int count; |
43 | 85 | ||
86 | if (flags & ACPI_PLATFORM_CLK) { | ||
87 | int ret = acpi_create_platform_clks(adev); | ||
88 | if (ret) { | ||
89 | dev_err(&adev->dev, "failed to create clocks\n"); | ||
90 | return ret; | ||
91 | } | ||
92 | } | ||
93 | |||
44 | /* If the ACPI node already has a physical device attached, skip it. */ | 94 | /* If the ACPI node already has a physical device attached, skip it. */ |
45 | if (adev->physical_node_count) | 95 | if (adev->physical_node_count) |
46 | return NULL; | 96 | return 0; |
47 | 97 | ||
48 | INIT_LIST_HEAD(&resource_list); | 98 | INIT_LIST_HEAD(&resource_list); |
49 | count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); | 99 | count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); |
50 | if (count <= 0) | 100 | if (count <= 0) |
51 | return NULL; | 101 | return 0; |
52 | 102 | ||
53 | resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL); | 103 | resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL); |
54 | if (!resources) { | 104 | if (!resources) { |
55 | dev_err(&adev->dev, "No memory for resources\n"); | 105 | dev_err(&adev->dev, "No memory for resources\n"); |
56 | acpi_dev_free_resource_list(&resource_list); | 106 | acpi_dev_free_resource_list(&resource_list); |
57 | return NULL; | 107 | return -ENOMEM; |
58 | } | 108 | } |
59 | count = 0; | 109 | count = 0; |
60 | list_for_each_entry(rentry, &resource_list, node) | 110 | list_for_each_entry(rentry, &resource_list, node) |
@@ -100,5 +150,15 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev) | |||
100 | } | 150 | } |
101 | 151 | ||
102 | kfree(resources); | 152 | kfree(resources); |
103 | return pdev; | 153 | return 1; |
154 | } | ||
155 | |||
156 | static struct acpi_scan_handler platform_handler = { | ||
157 | .ids = acpi_platform_device_ids, | ||
158 | .attach = acpi_create_platform_device, | ||
159 | }; | ||
160 | |||
161 | void __init acpi_platform_init(void) | ||
162 | { | ||
163 | acpi_scan_add_handler(&platform_handler); | ||
104 | } | 164 | } |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index bc7a03ded064..a1b9bf5085a2 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -31,6 +31,7 @@ acpi-y += \ | |||
31 | evgpeinit.o \ | 31 | evgpeinit.o \ |
32 | evgpeutil.o \ | 32 | evgpeutil.o \ |
33 | evglock.o \ | 33 | evglock.o \ |
34 | evhandler.o \ | ||
34 | evmisc.o \ | 35 | evmisc.o \ |
35 | evregion.o \ | 36 | evregion.o \ |
36 | evrgnini.o \ | 37 | evrgnini.o \ |
@@ -90,6 +91,7 @@ acpi-y += \ | |||
90 | nsobject.o \ | 91 | nsobject.o \ |
91 | nsparse.o \ | 92 | nsparse.o \ |
92 | nspredef.o \ | 93 | nspredef.o \ |
94 | nsprepkg.o \ | ||
93 | nsrepair.o \ | 95 | nsrepair.o \ |
94 | nsrepair2.o \ | 96 | nsrepair2.o \ |
95 | nssearch.o \ | 97 | nssearch.o \ |
@@ -104,7 +106,9 @@ acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o | |||
104 | acpi-y += \ | 106 | acpi-y += \ |
105 | psargs.o \ | 107 | psargs.o \ |
106 | psloop.o \ | 108 | psloop.o \ |
109 | psobject.o \ | ||
107 | psopcode.o \ | 110 | psopcode.o \ |
111 | psopinfo.o \ | ||
108 | psparse.o \ | 112 | psparse.o \ |
109 | psscope.o \ | 113 | psscope.o \ |
110 | pstree.o \ | 114 | pstree.o \ |
@@ -126,7 +130,7 @@ acpi-y += \ | |||
126 | rsutils.o \ | 130 | rsutils.o \ |
127 | rsxface.o | 131 | rsxface.o |
128 | 132 | ||
129 | acpi-$(ACPI_FUTURE_USAGE) += rsdump.o | 133 | acpi-$(ACPI_FUTURE_USAGE) += rsdump.o rsdumpinfo.o |
130 | 134 | ||
131 | acpi-y += \ | 135 | acpi-y += \ |
132 | tbfadt.o \ | 136 | tbfadt.o \ |
@@ -155,8 +159,10 @@ acpi-y += \ | |||
155 | utmutex.o \ | 159 | utmutex.o \ |
156 | utobject.o \ | 160 | utobject.o \ |
157 | utosi.o \ | 161 | utosi.o \ |
162 | utownerid.o \ | ||
158 | utresrc.o \ | 163 | utresrc.o \ |
159 | utstate.o \ | 164 | utstate.o \ |
165 | utstring.o \ | ||
160 | utxface.o \ | 166 | utxface.o \ |
161 | utxfinit.o \ | 167 | utxfinit.o \ |
162 | utxferror.o \ | 168 | utxferror.o \ |
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h index 8a7d51bfb3b3..8a6c4a0d22db 100644 --- a/drivers/acpi/acpica/accommon.h +++ b/drivers/acpi/acpica/accommon.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -51,6 +51,7 @@ | |||
51 | * | 51 | * |
52 | * Note: The order of these include files is important. | 52 | * Note: The order of these include files is important. |
53 | */ | 53 | */ |
54 | #include <acpi/acconfig.h> /* Global configuration constants */ | ||
54 | #include "acmacros.h" /* C macros */ | 55 | #include "acmacros.h" /* C macros */ |
55 | #include "aclocal.h" /* Internal data types */ | 56 | #include "aclocal.h" /* Internal data types */ |
56 | #include "acobject.h" /* ACPI internal object */ | 57 | #include "acobject.h" /* ACPI internal object */ |
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index 432a318c9ed1..9feba08c29fe 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -115,6 +115,21 @@ ACPI_HW_DEPENDENT_RETURN_VOID(void | |||
115 | char *block_arg)) | 115 | char *block_arg)) |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * dbconvert - miscellaneous conversion routines | ||
119 | */ | ||
120 | acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value); | ||
121 | |||
122 | acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object); | ||
123 | |||
124 | acpi_status | ||
125 | acpi_db_convert_to_object(acpi_object_type type, | ||
126 | char *string, union acpi_object *object); | ||
127 | |||
128 | u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info); | ||
129 | |||
130 | void acpi_db_dump_pld_buffer(union acpi_object *obj_desc); | ||
131 | |||
132 | /* | ||
118 | * dbmethod - control method commands | 133 | * dbmethod - control method commands |
119 | */ | 134 | */ |
120 | void | 135 | void |
@@ -191,6 +206,8 @@ void | |||
191 | acpi_db_create_execution_threads(char *num_threads_arg, | 206 | acpi_db_create_execution_threads(char *num_threads_arg, |
192 | char *num_loops_arg, char *method_name_arg); | 207 | char *num_loops_arg, char *method_name_arg); |
193 | 208 | ||
209 | void acpi_db_delete_objects(u32 count, union acpi_object *objects); | ||
210 | |||
194 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 211 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
195 | u32 acpi_db_get_cache_info(struct acpi_memory_list *cache); | 212 | u32 acpi_db_get_cache_info(struct acpi_memory_list *cache); |
196 | #endif | 213 | #endif |
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h index ed33ebcdaebe..427db72a6302 100644 --- a/drivers/acpi/acpica/acdispat.h +++ b/drivers/acpi/acpica/acdispat.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index e975c6720448..ab0e97710381 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -158,10 +158,23 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
158 | void *context); | 158 | void *context); |
159 | 159 | ||
160 | /* | 160 | /* |
161 | * evregion - Address Space handling | 161 | * evhandler - Address space handling |
162 | */ | 162 | */ |
163 | u8 | ||
164 | acpi_ev_has_default_handler(struct acpi_namespace_node *node, | ||
165 | acpi_adr_space_type space_id); | ||
166 | |||
163 | acpi_status acpi_ev_install_region_handlers(void); | 167 | acpi_status acpi_ev_install_region_handlers(void); |
164 | 168 | ||
169 | acpi_status | ||
170 | acpi_ev_install_space_handler(struct acpi_namespace_node *node, | ||
171 | acpi_adr_space_type space_id, | ||
172 | acpi_adr_space_handler handler, | ||
173 | acpi_adr_space_setup setup, void *context); | ||
174 | |||
175 | /* | ||
176 | * evregion - Operation region support | ||
177 | */ | ||
165 | acpi_status acpi_ev_initialize_op_regions(void); | 178 | acpi_status acpi_ev_initialize_op_regions(void); |
166 | 179 | ||
167 | acpi_status | 180 | acpi_status |
@@ -180,12 +193,6 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
180 | u8 acpi_ns_is_locked); | 193 | u8 acpi_ns_is_locked); |
181 | 194 | ||
182 | acpi_status | 195 | acpi_status |
183 | acpi_ev_install_space_handler(struct acpi_namespace_node *node, | ||
184 | acpi_adr_space_type space_id, | ||
185 | acpi_adr_space_handler handler, | ||
186 | acpi_adr_space_setup setup, void *context); | ||
187 | |||
188 | acpi_status | ||
189 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | 196 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, |
190 | acpi_adr_space_type space_id); | 197 | acpi_adr_space_type space_id); |
191 | 198 | ||
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 64472e4ec329..ecb49927b817 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -192,14 +192,6 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width; | |||
192 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; | 192 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; |
193 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | 193 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; |
194 | 194 | ||
195 | /* Mutex for _OSI support */ | ||
196 | |||
197 | ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex; | ||
198 | |||
199 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ | ||
200 | |||
201 | ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; | ||
202 | |||
203 | /***************************************************************************** | 195 | /***************************************************************************** |
204 | * | 196 | * |
205 | * Mutual exclusion within ACPICA subsystem | 197 | * Mutual exclusion within ACPICA subsystem |
@@ -233,6 +225,14 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_pending; | |||
233 | ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock; /* For GPE data structs and registers */ | 225 | ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock; /* For GPE data structs and registers */ |
234 | ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ | 226 | ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ |
235 | 227 | ||
228 | /* Mutex for _OSI support */ | ||
229 | |||
230 | ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex; | ||
231 | |||
232 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ | ||
233 | |||
234 | ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; | ||
235 | |||
236 | /***************************************************************************** | 236 | /***************************************************************************** |
237 | * | 237 | * |
238 | * Miscellaneous globals | 238 | * Miscellaneous globals |
@@ -252,7 +252,7 @@ ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; | |||
252 | ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2]; | 252 | ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2]; |
253 | ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; | 253 | ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; |
254 | ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; | 254 | ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; |
255 | ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; | 255 | ACPI_EXTERN acpi_table_handler acpi_gbl_table_handler; |
256 | ACPI_EXTERN void *acpi_gbl_table_handler_context; | 256 | ACPI_EXTERN void *acpi_gbl_table_handler_context; |
257 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; | 257 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; |
258 | ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; | 258 | ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; |
@@ -304,6 +304,7 @@ extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | |||
304 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; | 304 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; |
305 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; | 305 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; |
306 | ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats; | 306 | ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats; |
307 | ACPI_EXTERN u8 acpi_gbl_disable_mem_tracking; | ||
307 | #endif | 308 | #endif |
308 | 309 | ||
309 | /***************************************************************************** | 310 | /***************************************************************************** |
@@ -365,19 +366,18 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b; | |||
365 | * | 366 | * |
366 | ****************************************************************************/ | 367 | ****************************************************************************/ |
367 | 368 | ||
368 | extern struct acpi_fixed_event_info | ||
369 | acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; | ||
370 | ACPI_EXTERN struct acpi_fixed_event_handler | ||
371 | acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; | ||
372 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | ||
373 | ACPI_EXTERN struct acpi_gpe_block_info | ||
374 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | ||
375 | |||
376 | #if (!ACPI_REDUCED_HARDWARE) | 369 | #if (!ACPI_REDUCED_HARDWARE) |
377 | 370 | ||
378 | ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized; | 371 | ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized; |
372 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | ||
373 | ACPI_EXTERN struct acpi_gpe_block_info | ||
374 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | ||
379 | ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler; | 375 | ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler; |
380 | ACPI_EXTERN void *acpi_gbl_global_event_handler_context; | 376 | ACPI_EXTERN void *acpi_gbl_global_event_handler_context; |
377 | ACPI_EXTERN struct acpi_fixed_event_handler | ||
378 | acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; | ||
379 | extern struct acpi_fixed_event_info | ||
380 | acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; | ||
381 | 381 | ||
382 | #endif /* !ACPI_REDUCED_HARDWARE */ | 382 | #endif /* !ACPI_REDUCED_HARDWARE */ |
383 | 383 | ||
@@ -405,7 +405,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; | |||
405 | 405 | ||
406 | /***************************************************************************** | 406 | /***************************************************************************** |
407 | * | 407 | * |
408 | * Debugger globals | 408 | * Debugger and Disassembler globals |
409 | * | 409 | * |
410 | ****************************************************************************/ | 410 | ****************************************************************************/ |
411 | 411 | ||
@@ -413,8 +413,12 @@ ACPI_EXTERN u8 acpi_gbl_db_output_flags; | |||
413 | 413 | ||
414 | #ifdef ACPI_DISASSEMBLER | 414 | #ifdef ACPI_DISASSEMBLER |
415 | 415 | ||
416 | u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE); | ||
417 | |||
416 | ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; | 418 | ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; |
417 | ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; | 419 | ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; |
420 | ACPI_EXTERN struct acpi_external_list *acpi_gbl_external_list; | ||
421 | ACPI_EXTERN struct acpi_external_file *acpi_gbl_external_file_list; | ||
418 | #endif | 422 | #endif |
419 | 423 | ||
420 | #ifdef ACPI_DEBUGGER | 424 | #ifdef ACPI_DEBUGGER |
@@ -426,6 +430,7 @@ extern u8 acpi_gbl_db_terminate_threads; | |||
426 | ACPI_EXTERN u8 acpi_gbl_db_opt_tables; | 430 | ACPI_EXTERN u8 acpi_gbl_db_opt_tables; |
427 | ACPI_EXTERN u8 acpi_gbl_db_opt_stats; | 431 | ACPI_EXTERN u8 acpi_gbl_db_opt_stats; |
428 | ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; | 432 | ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; |
433 | ACPI_EXTERN u8 acpi_gbl_db_opt_no_region_support; | ||
429 | 434 | ||
430 | ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; | 435 | ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; |
431 | ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]; | 436 | ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]; |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index d902d31abc6c..6357e932bfd9 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index eb308635da72..8af8c9bdeb35 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -458,7 +458,7 @@ void acpi_ex_reacquire_interpreter(void); | |||
458 | 458 | ||
459 | void acpi_ex_relinquish_interpreter(void); | 459 | void acpi_ex_relinquish_interpreter(void); |
460 | 460 | ||
461 | void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); | 461 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); |
462 | 462 | ||
463 | void acpi_ex_acquire_global_lock(u32 rule); | 463 | void acpi_ex_acquire_global_lock(u32 rule); |
464 | 464 | ||
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index ff8bd0061e8b..805f419086ab 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -189,11 +189,10 @@ struct acpi_namespace_node { | |||
189 | #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ | 189 | #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ |
190 | #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */ | 190 | #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */ |
191 | 191 | ||
192 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ | 192 | #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */ |
193 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ | 193 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */ |
194 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ | 194 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */ |
195 | #define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ | 195 | #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */ |
196 | #define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ | ||
197 | 196 | ||
198 | /* Internal ACPI table management - master table list */ | 197 | /* Internal ACPI table management - master table list */ |
199 | 198 | ||
@@ -411,11 +410,10 @@ struct acpi_gpe_notify_info { | |||
411 | struct acpi_gpe_notify_info *next; | 410 | struct acpi_gpe_notify_info *next; |
412 | }; | 411 | }; |
413 | 412 | ||
414 | struct acpi_gpe_notify_object { | 413 | /* |
415 | struct acpi_namespace_node *node; | 414 | * GPE dispatch info. At any time, the GPE can have at most one type |
416 | struct acpi_gpe_notify_object *next; | 415 | * of dispatch - Method, Handler, or Implicit Notify. |
417 | }; | 416 | */ |
418 | |||
419 | union acpi_gpe_dispatch_info { | 417 | union acpi_gpe_dispatch_info { |
420 | struct acpi_namespace_node *method_node; /* Method node for this GPE level */ | 418 | struct acpi_namespace_node *method_node; /* Method node for this GPE level */ |
421 | struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ | 419 | struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ |
@@ -679,6 +677,8 @@ struct acpi_opcode_info { | |||
679 | u8 type; /* Opcode type */ | 677 | u8 type; /* Opcode type */ |
680 | }; | 678 | }; |
681 | 679 | ||
680 | /* Value associated with the parse object */ | ||
681 | |||
682 | union acpi_parse_value { | 682 | union acpi_parse_value { |
683 | u64 integer; /* Integer constant (Up to 64 bits) */ | 683 | u64 integer; /* Integer constant (Up to 64 bits) */ |
684 | u32 size; /* bytelist or field size */ | 684 | u32 size; /* bytelist or field size */ |
@@ -1025,6 +1025,31 @@ struct acpi_port_info { | |||
1025 | 1025 | ||
1026 | /***************************************************************************** | 1026 | /***************************************************************************** |
1027 | * | 1027 | * |
1028 | * Disassembler | ||
1029 | * | ||
1030 | ****************************************************************************/ | ||
1031 | |||
1032 | struct acpi_external_list { | ||
1033 | char *path; | ||
1034 | char *internal_path; | ||
1035 | struct acpi_external_list *next; | ||
1036 | u32 value; | ||
1037 | u16 length; | ||
1038 | u8 type; | ||
1039 | u8 flags; | ||
1040 | }; | ||
1041 | |||
1042 | /* Values for Flags field above */ | ||
1043 | |||
1044 | #define ACPI_IPATH_ALLOCATED 0x01 | ||
1045 | |||
1046 | struct acpi_external_file { | ||
1047 | char *path; | ||
1048 | struct acpi_external_file *next; | ||
1049 | }; | ||
1050 | |||
1051 | /***************************************************************************** | ||
1052 | * | ||
1028 | * Debugger | 1053 | * Debugger |
1029 | * | 1054 | * |
1030 | ****************************************************************************/ | 1055 | ****************************************************************************/ |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 5efad99f2169..ed7943b9044f 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -49,14 +49,18 @@ | |||
49 | * get into potential aligment issues -- see the STORE macros below. | 49 | * get into potential aligment issues -- see the STORE macros below. |
50 | * Use with care. | 50 | * Use with care. |
51 | */ | 51 | */ |
52 | #define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) | 52 | #define ACPI_CAST8(ptr) ACPI_CAST_PTR (u8, (ptr)) |
53 | #define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) | 53 | #define ACPI_CAST16(ptr) ACPI_CAST_PTR (u16, (ptr)) |
54 | #define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr) | 54 | #define ACPI_CAST32(ptr) ACPI_CAST_PTR (u32, (ptr)) |
55 | #define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr) | 55 | #define ACPI_CAST64(ptr) ACPI_CAST_PTR (u64, (ptr)) |
56 | #define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr) | 56 | #define ACPI_GET8(ptr) (*ACPI_CAST8 (ptr)) |
57 | #define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr) | 57 | #define ACPI_GET16(ptr) (*ACPI_CAST16 (ptr)) |
58 | #define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) | 58 | #define ACPI_GET32(ptr) (*ACPI_CAST32 (ptr)) |
59 | #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) | 59 | #define ACPI_GET64(ptr) (*ACPI_CAST64 (ptr)) |
60 | #define ACPI_SET8(ptr, val) (*ACPI_CAST8 (ptr) = (u8) (val)) | ||
61 | #define ACPI_SET16(ptr, val) (*ACPI_CAST16 (ptr) = (u16) (val)) | ||
62 | #define ACPI_SET32(ptr, val) (*ACPI_CAST32 (ptr) = (u32) (val)) | ||
63 | #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) | ||
60 | 64 | ||
61 | /* | 65 | /* |
62 | * printf() format helpers | 66 | * printf() format helpers |
@@ -293,6 +297,26 @@ | |||
293 | #define ACPI_16BIT_MASK 0x0000FFFF | 297 | #define ACPI_16BIT_MASK 0x0000FFFF |
294 | #define ACPI_24BIT_MASK 0x00FFFFFF | 298 | #define ACPI_24BIT_MASK 0x00FFFFFF |
295 | 299 | ||
300 | /* Macros to extract flag bits from position zero */ | ||
301 | |||
302 | #define ACPI_GET_1BIT_FLAG(value) ((value) & ACPI_1BIT_MASK) | ||
303 | #define ACPI_GET_2BIT_FLAG(value) ((value) & ACPI_2BIT_MASK) | ||
304 | #define ACPI_GET_3BIT_FLAG(value) ((value) & ACPI_3BIT_MASK) | ||
305 | #define ACPI_GET_4BIT_FLAG(value) ((value) & ACPI_4BIT_MASK) | ||
306 | |||
307 | /* Macros to extract flag bits from position one and above */ | ||
308 | |||
309 | #define ACPI_EXTRACT_1BIT_FLAG(field, position) (ACPI_GET_1BIT_FLAG ((field) >> position)) | ||
310 | #define ACPI_EXTRACT_2BIT_FLAG(field, position) (ACPI_GET_2BIT_FLAG ((field) >> position)) | ||
311 | #define ACPI_EXTRACT_3BIT_FLAG(field, position) (ACPI_GET_3BIT_FLAG ((field) >> position)) | ||
312 | #define ACPI_EXTRACT_4BIT_FLAG(field, position) (ACPI_GET_4BIT_FLAG ((field) >> position)) | ||
313 | |||
314 | /* ACPI Pathname helpers */ | ||
315 | |||
316 | #define ACPI_IS_ROOT_PREFIX(c) ((c) == (u8) 0x5C) /* Backslash */ | ||
317 | #define ACPI_IS_PARENT_PREFIX(c) ((c) == (u8) 0x5E) /* Carat */ | ||
318 | #define ACPI_IS_PATH_SEPARATOR(c) ((c) == (u8) 0x2E) /* Period (dot) */ | ||
319 | |||
296 | /* | 320 | /* |
297 | * An object of type struct acpi_namespace_node can appear in some contexts | 321 | * An object of type struct acpi_namespace_node can appear in some contexts |
298 | * where a pointer to an object of type union acpi_operand_object can also | 322 | * where a pointer to an object of type union acpi_operand_object can also |
@@ -364,137 +388,6 @@ | |||
364 | 388 | ||
365 | #endif /* ACPI_NO_ERROR_MESSAGES */ | 389 | #endif /* ACPI_NO_ERROR_MESSAGES */ |
366 | 390 | ||
367 | /* | ||
368 | * Debug macros that are conditionally compiled | ||
369 | */ | ||
370 | #ifdef ACPI_DEBUG_OUTPUT | ||
371 | /* | ||
372 | * Function entry tracing | ||
373 | */ | ||
374 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ | ||
375 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) | ||
376 | #define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \ | ||
377 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b) | ||
378 | #define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \ | ||
379 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b) | ||
380 | #define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \ | ||
381 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b) | ||
382 | |||
383 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() | ||
384 | |||
385 | /* | ||
386 | * Function exit tracing. | ||
387 | * WARNING: These macros include a return statement. This is usually considered | ||
388 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | ||
389 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | ||
390 | * so that "_AcpiFunctionName" is defined. | ||
391 | * | ||
392 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining | ||
393 | * about these constructs. | ||
394 | */ | ||
395 | #ifdef ACPI_USE_DO_WHILE_0 | ||
396 | #define ACPI_DO_WHILE0(a) do a while(0) | ||
397 | #else | ||
398 | #define ACPI_DO_WHILE0(a) a | ||
399 | #endif | ||
400 | |||
401 | #define return_VOID ACPI_DO_WHILE0 ({ \ | ||
402 | acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ | ||
403 | return;}) | ||
404 | /* | ||
405 | * There are two versions of most of the return macros. The default version is | ||
406 | * safer, since it avoids side-effects by guaranteeing that the argument will | ||
407 | * not be evaluated twice. | ||
408 | * | ||
409 | * A less-safe version of the macros is provided for optional use if the | ||
410 | * compiler uses excessive CPU stack (for example, this may happen in the | ||
411 | * debug case if code optimzation is disabled.) | ||
412 | */ | ||
413 | #ifndef ACPI_SIMPLE_RETURN_MACROS | ||
414 | |||
415 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
416 | register acpi_status _s = (s); \ | ||
417 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
418 | return (_s); }) | ||
419 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
420 | register void *_s = (void *) (s); \ | ||
421 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ | ||
422 | return (_s); }) | ||
423 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
424 | register u64 _s = (s); \ | ||
425 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
426 | return (_s); }) | ||
427 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ | ||
428 | register u8 _s = (u8) (s); \ | ||
429 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \ | ||
430 | return (_s); }) | ||
431 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ | ||
432 | register u32 _s = (u32) (s); \ | ||
433 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \ | ||
434 | return (_s); }) | ||
435 | #else /* Use original less-safe macros */ | ||
436 | |||
437 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
438 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ | ||
439 | return((s)); }) | ||
440 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
441 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ | ||
442 | return((s)); }) | ||
443 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
444 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \ | ||
445 | return((s)); }) | ||
446 | #define return_UINT8(s) return_VALUE(s) | ||
447 | #define return_UINT32(s) return_VALUE(s) | ||
448 | |||
449 | #endif /* ACPI_SIMPLE_RETURN_MACROS */ | ||
450 | |||
451 | /* Conditional execution */ | ||
452 | |||
453 | #define ACPI_DEBUG_EXEC(a) a | ||
454 | #define ACPI_DEBUG_ONLY_MEMBERS(a) a; | ||
455 | #define _VERBOSE_STRUCTURES | ||
456 | |||
457 | /* Various object display routines for debug */ | ||
458 | |||
459 | #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0) | ||
460 | #define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c) | ||
461 | #define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b) | ||
462 | #define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d) | ||
463 | #define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) | ||
464 | |||
465 | #else | ||
466 | /* | ||
467 | * This is the non-debug case -- make everything go away, | ||
468 | * leaving no executable debug code! | ||
469 | */ | ||
470 | #define ACPI_DEBUG_EXEC(a) | ||
471 | #define ACPI_DEBUG_ONLY_MEMBERS(a) | ||
472 | #define ACPI_FUNCTION_TRACE(a) | ||
473 | #define ACPI_FUNCTION_TRACE_PTR(a, b) | ||
474 | #define ACPI_FUNCTION_TRACE_U32(a, b) | ||
475 | #define ACPI_FUNCTION_TRACE_STR(a, b) | ||
476 | #define ACPI_FUNCTION_EXIT | ||
477 | #define ACPI_FUNCTION_STATUS_EXIT(s) | ||
478 | #define ACPI_FUNCTION_VALUE_EXIT(s) | ||
479 | #define ACPI_FUNCTION_ENTRY() | ||
480 | #define ACPI_DUMP_STACK_ENTRY(a) | ||
481 | #define ACPI_DUMP_OPERANDS(a, b, c) | ||
482 | #define ACPI_DUMP_ENTRY(a, b) | ||
483 | #define ACPI_DUMP_TABLES(a, b) | ||
484 | #define ACPI_DUMP_PATHNAME(a, b, c, d) | ||
485 | #define ACPI_DUMP_BUFFER(a, b) | ||
486 | #define ACPI_DEBUG_PRINT(pl) | ||
487 | #define ACPI_DEBUG_PRINT_RAW(pl) | ||
488 | |||
489 | #define return_VOID return | ||
490 | #define return_ACPI_STATUS(s) return(s) | ||
491 | #define return_VALUE(s) return(s) | ||
492 | #define return_UINT8(s) return(s) | ||
493 | #define return_UINT32(s) return(s) | ||
494 | #define return_PTR(s) return(s) | ||
495 | |||
496 | #endif /* ACPI_DEBUG_OUTPUT */ | ||
497 | |||
498 | #if (!ACPI_REDUCED_HARDWARE) | 391 | #if (!ACPI_REDUCED_HARDWARE) |
499 | #define ACPI_HW_OPTIONAL_FUNCTION(addr) addr | 392 | #define ACPI_HW_OPTIONAL_FUNCTION(addr) addr |
500 | #else | 393 | #else |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 9b19d4b86424..02cd5482ff8b 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -218,6 +218,18 @@ acpi_ns_check_parameter_count(char *pathname, | |||
218 | u32 user_param_count, | 218 | u32 user_param_count, |
219 | const union acpi_predefined_info *info); | 219 | const union acpi_predefined_info *info); |
220 | 220 | ||
221 | acpi_status | ||
222 | acpi_ns_check_object_type(struct acpi_predefined_data *data, | ||
223 | union acpi_operand_object **return_object_ptr, | ||
224 | u32 expected_btypes, u32 package_index); | ||
225 | |||
226 | /* | ||
227 | * nsprepkg - Validation of predefined name packages | ||
228 | */ | ||
229 | acpi_status | ||
230 | acpi_ns_check_package(struct acpi_predefined_data *data, | ||
231 | union acpi_operand_object **return_object_ptr); | ||
232 | |||
221 | /* | 233 | /* |
222 | * nsnames - Name and Scope manipulation | 234 | * nsnames - Name and Scope manipulation |
223 | */ | 235 | */ |
@@ -333,8 +345,6 @@ acpi_ns_install_node(struct acpi_walk_state *walk_state, | |||
333 | /* | 345 | /* |
334 | * nsutils - Utility functions | 346 | * nsutils - Utility functions |
335 | */ | 347 | */ |
336 | u8 acpi_ns_valid_root_prefix(char prefix); | ||
337 | |||
338 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); | 348 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); |
339 | 349 | ||
340 | u32 acpi_ns_local(acpi_object_type type); | 350 | u32 acpi_ns_local(acpi_object_type type); |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 24eb9eac9514..cc7ab6dd724e 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -307,7 +307,7 @@ struct acpi_object_addr_handler { | |||
307 | struct acpi_namespace_node *node; /* Parent device */ | 307 | struct acpi_namespace_node *node; /* Parent device */ |
308 | void *context; | 308 | void *context; |
309 | acpi_adr_space_setup setup; | 309 | acpi_adr_space_setup setup; |
310 | union acpi_operand_object *region_list; /* regions using this handler */ | 310 | union acpi_operand_object *region_list; /* Regions using this handler */ |
311 | union acpi_operand_object *next; | 311 | union acpi_operand_object *next; |
312 | }; | 312 | }; |
313 | 313 | ||
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h index d786a5128b78..3fc9ca7e8aa3 100644 --- a/drivers/acpi/acpica/acopcode.h +++ b/drivers/acpi/acpica/acopcode.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h index eefcf47a61a0..aed319318835 100644 --- a/drivers/acpi/acpica/acparser.h +++ b/drivers/acpi/acpica/acparser.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -105,7 +105,28 @@ union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope, | |||
105 | union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op); | 105 | union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op); |
106 | 106 | ||
107 | /* | 107 | /* |
108 | * psopcode - AML Opcode information | 108 | * psobject - support for parse object processing |
109 | */ | ||
110 | acpi_status | ||
111 | acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | ||
112 | u8 *aml_op_start, | ||
113 | union acpi_parse_object *unnamed_op, | ||
114 | union acpi_parse_object **op); | ||
115 | |||
116 | acpi_status | ||
117 | acpi_ps_create_op(struct acpi_walk_state *walk_state, | ||
118 | u8 *aml_op_start, union acpi_parse_object **new_op); | ||
119 | |||
120 | acpi_status | ||
121 | acpi_ps_complete_op(struct acpi_walk_state *walk_state, | ||
122 | union acpi_parse_object **op, acpi_status status); | ||
123 | |||
124 | acpi_status | ||
125 | acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, | ||
126 | union acpi_parse_object *op, acpi_status status); | ||
127 | |||
128 | /* | ||
129 | * psopinfo - AML Opcode information | ||
109 | */ | 130 | */ |
110 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); | 131 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); |
111 | 132 | ||
@@ -211,8 +232,6 @@ void acpi_ps_free_op(union acpi_parse_object *op); | |||
211 | 232 | ||
212 | u8 acpi_ps_is_leading_char(u32 c); | 233 | u8 acpi_ps_is_leading_char(u32 c); |
213 | 234 | ||
214 | u8 acpi_ps_is_prefix_char(u32 c); | ||
215 | |||
216 | #ifdef ACPI_FUTURE_USAGE | 235 | #ifdef ACPI_FUTURE_USAGE |
217 | u32 acpi_ps_get_name(union acpi_parse_object *op); | 236 | u32 acpi_ps_get_name(union acpi_parse_object *op); |
218 | #endif /* ACPI_FUTURE_USAGE */ | 237 | #endif /* ACPI_FUTURE_USAGE */ |
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index 9dfa1c83bd4e..752cc40cdc1e 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h | |||
@@ -1,12 +1,11 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Name: acpredef - Information table for ACPI predefined methods and objects | 3 | * Name: acpredef - Information table for ACPI predefined methods and objects |
4 | * $Revision: 1.1 $ | ||
5 | * | 4 | * |
6 | *****************************************************************************/ | 5 | *****************************************************************************/ |
7 | 6 | ||
8 | /* | 7 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 9 | * All rights reserved. |
11 | * | 10 | * |
12 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -51,13 +50,13 @@ | |||
51 | * | 50 | * |
52 | * 1) PTYPE1 packages do not contain sub-packages. | 51 | * 1) PTYPE1 packages do not contain sub-packages. |
53 | * | 52 | * |
54 | * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types: | 53 | * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types: |
55 | * object type | 54 | * object type |
56 | * count | 55 | * count |
57 | * object type | 56 | * object type |
58 | * count | 57 | * count |
59 | * | 58 | * |
60 | * ACPI_PTYPE1_VAR: Variable length: | 59 | * ACPI_PTYPE1_VAR: Variable-length length: |
61 | * object type (Int/Buf/Ref) | 60 | * object type (Int/Buf/Ref) |
62 | * | 61 | * |
63 | * ACPI_PTYPE1_OPTION: Package has some required and some optional elements | 62 | * ACPI_PTYPE1_OPTION: Package has some required and some optional elements |
@@ -85,10 +84,10 @@ | |||
85 | * count | 84 | * count |
86 | * (Used for _CST) | 85 | * (Used for _CST) |
87 | * | 86 | * |
88 | * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length | 87 | * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length |
89 | * (Used for _PRT) | 88 | * (Used for _PRT) |
90 | * | 89 | * |
91 | * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length | 90 | * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length |
92 | * (Used for _HPX) | 91 | * (Used for _HPX) |
93 | * | 92 | * |
94 | * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length | 93 | * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length |
@@ -124,7 +123,8 @@ enum acpi_return_package_types { | |||
124 | * These are the names that can actually be evaluated via acpi_evaluate_object. | 123 | * These are the names that can actually be evaluated via acpi_evaluate_object. |
125 | * Not present in this table are the following: | 124 | * Not present in this table are the following: |
126 | * | 125 | * |
127 | * 1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object: | 126 | * 1) Predefined/Reserved names that are never evaluated via |
127 | * acpi_evaluate_object: | ||
128 | * _Lxx and _Exx GPE methods | 128 | * _Lxx and _Exx GPE methods |
129 | * _Qxx EC methods | 129 | * _Qxx EC methods |
130 | * _T_x compiler temporary variables | 130 | * _T_x compiler temporary variables |
@@ -149,6 +149,8 @@ enum acpi_return_package_types { | |||
149 | * information about the expected structure of the package. This information | 149 | * information about the expected structure of the package. This information |
150 | * is saved here (rather than in a separate table) in order to minimize the | 150 | * is saved here (rather than in a separate table) in order to minimize the |
151 | * overall size of the stored data. | 151 | * overall size of the stored data. |
152 | * | ||
153 | * Note: The additional braces are intended to promote portability. | ||
152 | */ | 154 | */ |
153 | static const union acpi_predefined_info predefined_names[] = { | 155 | static const union acpi_predefined_info predefined_names[] = { |
154 | {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, | 156 | {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, |
@@ -212,9 +214,8 @@ static const union acpi_predefined_info predefined_names[] = { | |||
212 | {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, | 214 | {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, |
213 | {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, | 215 | {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, |
214 | {{"_BFS", 1, 0}}, | 216 | {{"_BFS", 1, 0}}, |
215 | {{"_BIF", 0, ACPI_RTYPE_PACKAGE} }, /* Fixed-length (9 Int),(4 Str/Buf) */ | 217 | {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */ |
216 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, | 218 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4, 0}}, |
217 | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}, 4, 0} }, | ||
218 | 219 | ||
219 | {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ | 220 | {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ |
220 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4, | 221 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4, |
@@ -236,7 +237,8 @@ static const union acpi_predefined_info predefined_names[] = { | |||
236 | {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ | 237 | {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ |
237 | {{"_CDM", 0, ACPI_RTYPE_INTEGER}}, | 238 | {{"_CDM", 0, ACPI_RTYPE_INTEGER}}, |
238 | {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ | 239 | {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ |
239 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}}, | 240 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0}, 0, |
241 | 0}}, | ||
240 | 242 | ||
241 | {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ | 243 | {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ |
242 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}}, | 244 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}}, |
@@ -251,7 +253,8 @@ static const union acpi_predefined_info predefined_names[] = { | |||
251 | {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, | 253 | {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, |
252 | 254 | ||
253 | {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ | 255 | {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ |
254 | {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}}, | 256 | {{{ACPI_PTYPE2_PKG_COUNT, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3, |
257 | 0}}, | ||
255 | 258 | ||
256 | {{"_CWS", 1, ACPI_RTYPE_INTEGER}}, | 259 | {{"_CWS", 1, ACPI_RTYPE_INTEGER}}, |
257 | {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, | 260 | {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, |
@@ -342,8 +345,8 @@ static const union acpi_predefined_info predefined_names[] = { | |||
342 | {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */ | 345 | {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */ |
343 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}}, | 346 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}}, |
344 | 347 | ||
345 | {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */ | 348 | {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */ |
346 | {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}}, | 349 | {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER}, 1, 0}}, |
347 | 350 | ||
348 | {{"_MSG", 1, 0}}, | 351 | {{"_MSG", 1, 0}}, |
349 | {{"_MSM", 4, ACPI_RTYPE_INTEGER}}, | 352 | {{"_MSM", 4, ACPI_RTYPE_INTEGER}}, |
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h index 0347d0993497..f691d0e4d9fa 100644 --- a/drivers/acpi/acpica/acresrc.h +++ b/drivers/acpi/acpica/acresrc.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -347,18 +347,21 @@ extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; | |||
347 | extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[]; | 347 | extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[]; |
348 | 348 | ||
349 | /* | 349 | /* |
350 | * rsdump | 350 | * rsdumpinfo |
351 | */ | 351 | */ |
352 | extern struct acpi_rsdump_info acpi_rs_dump_irq[]; | 352 | extern struct acpi_rsdump_info acpi_rs_dump_irq[]; |
353 | extern struct acpi_rsdump_info acpi_rs_dump_prt[]; | ||
353 | extern struct acpi_rsdump_info acpi_rs_dump_dma[]; | 354 | extern struct acpi_rsdump_info acpi_rs_dump_dma[]; |
354 | extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; | 355 | extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; |
355 | extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; | 356 | extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; |
356 | extern struct acpi_rsdump_info acpi_rs_dump_io[]; | 357 | extern struct acpi_rsdump_info acpi_rs_dump_io[]; |
358 | extern struct acpi_rsdump_info acpi_rs_dump_io_flags[]; | ||
357 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; | 359 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; |
358 | extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; | 360 | extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; |
359 | extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; | 361 | extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; |
360 | extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; | 362 | extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; |
361 | extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; | 363 | extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; |
364 | extern struct acpi_rsdump_info acpi_rs_dump_memory_flags[]; | ||
362 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; | 365 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; |
363 | extern struct acpi_rsdump_info acpi_rs_dump_address16[]; | 366 | extern struct acpi_rsdump_info acpi_rs_dump_address16[]; |
364 | extern struct acpi_rsdump_info acpi_rs_dump_address32[]; | 367 | extern struct acpi_rsdump_info acpi_rs_dump_address32[]; |
@@ -372,6 +375,7 @@ extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[]; | |||
372 | extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[]; | 375 | extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[]; |
373 | extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[]; | 376 | extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[]; |
374 | extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[]; | 377 | extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[]; |
378 | extern struct acpi_rsdump_info acpi_rs_dump_general_flags[]; | ||
375 | #endif | 379 | #endif |
376 | 380 | ||
377 | #endif /* __ACRESRC_H__ */ | 381 | #endif /* __ACRESRC_H__ */ |
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h index 937e66c65d1e..7896d85876ca 100644 --- a/drivers/acpi/acpica/acstruct.h +++ b/drivers/acpi/acpica/acstruct.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index 6712965ba8ae..7755e915a007 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index b0f5f92b674a..0082fa0a6139 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -483,39 +483,17 @@ acpi_ut_short_divide(u64 in_dividend, | |||
483 | /* | 483 | /* |
484 | * utmisc | 484 | * utmisc |
485 | */ | 485 | */ |
486 | void ut_convert_backslashes(char *pathname); | ||
487 | |||
488 | const char *acpi_ut_validate_exception(acpi_status status); | 486 | const char *acpi_ut_validate_exception(acpi_status status); |
489 | 487 | ||
490 | u8 acpi_ut_is_pci_root_bridge(char *id); | 488 | u8 acpi_ut_is_pci_root_bridge(char *id); |
491 | 489 | ||
492 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table); | 490 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table); |
493 | 491 | ||
494 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); | ||
495 | |||
496 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id); | ||
497 | |||
498 | acpi_status | 492 | acpi_status |
499 | acpi_ut_walk_package_tree(union acpi_operand_object *source_object, | 493 | acpi_ut_walk_package_tree(union acpi_operand_object *source_object, |
500 | void *target_object, | 494 | void *target_object, |
501 | acpi_pkg_callback walk_callback, void *context); | 495 | acpi_pkg_callback walk_callback, void *context); |
502 | 496 | ||
503 | void acpi_ut_strupr(char *src_string); | ||
504 | |||
505 | void acpi_ut_strlwr(char *src_string); | ||
506 | |||
507 | int acpi_ut_stricmp(char *string1, char *string2); | ||
508 | |||
509 | void acpi_ut_print_string(char *string, u8 max_length); | ||
510 | |||
511 | u8 acpi_ut_valid_acpi_name(u32 name); | ||
512 | |||
513 | void acpi_ut_repair_name(char *name); | ||
514 | |||
515 | u8 acpi_ut_valid_acpi_char(char character, u32 position); | ||
516 | |||
517 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer); | ||
518 | |||
519 | /* Values for Base above (16=Hex, 10=Decimal) */ | 497 | /* Values for Base above (16=Hex, 10=Decimal) */ |
520 | 498 | ||
521 | #define ACPI_ANY_BASE 0 | 499 | #define ACPI_ANY_BASE 0 |
@@ -532,15 +510,25 @@ acpi_ut_display_init_pathname(u8 type, | |||
532 | #endif | 510 | #endif |
533 | 511 | ||
534 | /* | 512 | /* |
513 | * utownerid - Support for Table/Method Owner IDs | ||
514 | */ | ||
515 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); | ||
516 | |||
517 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id); | ||
518 | |||
519 | /* | ||
535 | * utresrc | 520 | * utresrc |
536 | */ | 521 | */ |
537 | acpi_status | 522 | acpi_status |
538 | acpi_ut_walk_aml_resources(u8 *aml, | 523 | acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, |
524 | u8 *aml, | ||
539 | acpi_size aml_length, | 525 | acpi_size aml_length, |
540 | acpi_walk_aml_callback user_function, | 526 | acpi_walk_aml_callback user_function, |
541 | void **context); | 527 | void **context); |
542 | 528 | ||
543 | acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index); | 529 | acpi_status |
530 | acpi_ut_validate_resource(struct acpi_walk_state *walk_state, | ||
531 | void *aml, u8 *return_index); | ||
544 | 532 | ||
545 | u32 acpi_ut_get_descriptor_length(void *aml); | 533 | u32 acpi_ut_get_descriptor_length(void *aml); |
546 | 534 | ||
@@ -554,6 +542,27 @@ acpi_status | |||
554 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag); | 542 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag); |
555 | 543 | ||
556 | /* | 544 | /* |
545 | * utstring - String and character utilities | ||
546 | */ | ||
547 | void acpi_ut_strupr(char *src_string); | ||
548 | |||
549 | void acpi_ut_strlwr(char *src_string); | ||
550 | |||
551 | int acpi_ut_stricmp(char *string1, char *string2); | ||
552 | |||
553 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer); | ||
554 | |||
555 | void acpi_ut_print_string(char *string, u8 max_length); | ||
556 | |||
557 | void ut_convert_backslashes(char *pathname); | ||
558 | |||
559 | u8 acpi_ut_valid_acpi_name(u32 name); | ||
560 | |||
561 | u8 acpi_ut_valid_acpi_char(char character, u32 position); | ||
562 | |||
563 | void acpi_ut_repair_name(char *name); | ||
564 | |||
565 | /* | ||
557 | * utmutex - mutex support | 566 | * utmutex - mutex support |
558 | */ | 567 | */ |
559 | acpi_status acpi_ut_mutex_initialize(void); | 568 | acpi_status acpi_ut_mutex_initialize(void); |
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h index c26f8ff6c3b9..48a3e331b72d 100644 --- a/drivers/acpi/acpica/amlcode.h +++ b/drivers/acpi/acpica/amlcode.h | |||
@@ -7,7 +7,7 @@ | |||
7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Copyright (C) 2000 - 2012, Intel Corp. | 10 | * Copyright (C) 2000 - 2013, Intel Corp. |
11 | * All rights reserved. | 11 | * All rights reserved. |
12 | * | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h index 968449685e06..87c26366d1df 100644 --- a/drivers/acpi/acpica/amlresrc.h +++ b/drivers/acpi/acpica/amlresrc.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -199,6 +199,12 @@ struct aml_resource_fixed_dma { | |||
199 | struct aml_resource_large_header { | 199 | struct aml_resource_large_header { |
200 | AML_RESOURCE_LARGE_HEADER_COMMON}; | 200 | AML_RESOURCE_LARGE_HEADER_COMMON}; |
201 | 201 | ||
202 | /* General Flags for address space resource descriptors */ | ||
203 | |||
204 | #define ACPI_RESOURCE_FLAG_DEC 2 | ||
205 | #define ACPI_RESOURCE_FLAG_MIF 4 | ||
206 | #define ACPI_RESOURCE_FLAG_MAF 8 | ||
207 | |||
202 | struct aml_resource_memory24 { | 208 | struct aml_resource_memory24 { |
203 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; | 209 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; |
204 | u16 minimum; | 210 | u16 minimum; |
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c index c8b5e2565b98..fb09b08d7080 100644 --- a/drivers/acpi/acpica/dsargs.c +++ b/drivers/acpi/acpica/dsargs.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c index 57895db3231a..7ea0f162f11c 100644 --- a/drivers/acpi/acpica/dscontrol.c +++ b/drivers/acpi/acpica/dscontrol.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index b5b904ee815f..feadeed1012d 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index 87eff701ecfa..bc8e63f7784b 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 52eb4e01622a..a9ffd44c18fe 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -47,7 +47,7 @@ | |||
47 | #include "acinterp.h" | 47 | #include "acinterp.h" |
48 | #include "acnamesp.h" | 48 | #include "acnamesp.h" |
49 | #ifdef ACPI_DISASSEMBLER | 49 | #ifdef ACPI_DISASSEMBLER |
50 | #include <acpi/acdisasm.h> | 50 | #include "acdisasm.h" |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
@@ -151,6 +151,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc) | |||
151 | 151 | ||
152 | status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex); | 152 | status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex); |
153 | if (ACPI_FAILURE(status)) { | 153 | if (ACPI_FAILURE(status)) { |
154 | acpi_ut_delete_object_desc(mutex_desc); | ||
154 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
155 | } | 156 | } |
156 | 157 | ||
@@ -378,7 +379,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
378 | */ | 379 | */ |
379 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | 380 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
380 | if (!info) { | 381 | if (!info) { |
381 | return_ACPI_STATUS(AE_NO_MEMORY); | 382 | status = AE_NO_MEMORY; |
383 | goto cleanup; | ||
382 | } | 384 | } |
383 | 385 | ||
384 | info->parameters = &this_walk_state->operands[0]; | 386 | info->parameters = &this_walk_state->operands[0]; |
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index 9a83b7e0f3ba..3da80460ce38 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index c9f15d3a3686..e20e9f84eee8 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -388,7 +388,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
388 | union acpi_parse_object *parent; | 388 | union acpi_parse_object *parent; |
389 | union acpi_operand_object *obj_desc = NULL; | 389 | union acpi_operand_object *obj_desc = NULL; |
390 | acpi_status status = AE_OK; | 390 | acpi_status status = AE_OK; |
391 | unsigned i; | 391 | u32 i; |
392 | u16 index; | 392 | u16 index; |
393 | u16 reference_count; | 393 | u16 reference_count; |
394 | 394 | ||
@@ -525,7 +525,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
525 | } | 525 | } |
526 | 526 | ||
527 | ACPI_INFO((AE_INFO, | 527 | ACPI_INFO((AE_INFO, |
528 | "Actual Package length (%u) is larger than NumElements field (%u), truncated\n", | 528 | "Actual Package length (%u) is larger than NumElements field (%u), truncated", |
529 | i, element_count)); | 529 | i, element_count)); |
530 | } else if (i < element_count) { | 530 | } else if (i < element_count) { |
531 | /* | 531 | /* |
@@ -703,7 +703,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
703 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 703 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
704 | 704 | ||
705 | #ifndef ACPI_NO_METHOD_EXECUTION | 705 | #ifndef ACPI_NO_METHOD_EXECUTION |
706 | acpi_ex_truncate_for32bit_table(obj_desc); | 706 | (void)acpi_ex_truncate_for32bit_table(obj_desc); |
707 | #endif | 707 | #endif |
708 | break; | 708 | break; |
709 | 709 | ||
@@ -725,8 +725,18 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
725 | case AML_TYPE_LITERAL: | 725 | case AML_TYPE_LITERAL: |
726 | 726 | ||
727 | obj_desc->integer.value = op->common.value.integer; | 727 | obj_desc->integer.value = op->common.value.integer; |
728 | |||
728 | #ifndef ACPI_NO_METHOD_EXECUTION | 729 | #ifndef ACPI_NO_METHOD_EXECUTION |
729 | acpi_ex_truncate_for32bit_table(obj_desc); | 730 | if (acpi_ex_truncate_for32bit_table(obj_desc)) { |
731 | |||
732 | /* Warn if we found a 64-bit constant in a 32-bit table */ | ||
733 | |||
734 | ACPI_WARNING((AE_INFO, | ||
735 | "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X", | ||
736 | ACPI_FORMAT_UINT64(op->common. | ||
737 | value.integer), | ||
738 | (u32)obj_desc->integer.value)); | ||
739 | } | ||
730 | #endif | 740 | #endif |
731 | break; | 741 | break; |
732 | 742 | ||
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index d09c6b4bab2c..ee6367b8eaf7 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -486,18 +486,18 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, | |||
486 | ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op); | 486 | ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op); |
487 | 487 | ||
488 | /* | 488 | /* |
489 | * This is where we evaluate the signature_string and oem_iDString | 489 | * This is where we evaluate the Signature string, oem_id string, |
490 | * and oem_table_iDString of the data_table_region declaration | 490 | * and oem_table_id string of the Data Table Region declaration |
491 | */ | 491 | */ |
492 | node = op->common.node; | 492 | node = op->common.node; |
493 | 493 | ||
494 | /* next_op points to signature_string op */ | 494 | /* next_op points to Signature string op */ |
495 | 495 | ||
496 | next_op = op->common.value.arg; | 496 | next_op = op->common.value.arg; |
497 | 497 | ||
498 | /* | 498 | /* |
499 | * Evaluate/create the signature_string and oem_iDString | 499 | * Evaluate/create the Signature string, oem_id string, |
500 | * and oem_table_iDString operands | 500 | * and oem_table_id string operands |
501 | */ | 501 | */ |
502 | status = acpi_ds_create_operands(walk_state, next_op); | 502 | status = acpi_ds_create_operands(walk_state, next_op); |
503 | if (ACPI_FAILURE(status)) { | 503 | if (ACPI_FAILURE(status)) { |
@@ -505,8 +505,8 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, | |||
505 | } | 505 | } |
506 | 506 | ||
507 | /* | 507 | /* |
508 | * Resolve the signature_string and oem_iDString | 508 | * Resolve the Signature string, oem_id string, |
509 | * and oem_table_iDString operands | 509 | * and oem_table_id string operands |
510 | */ | 510 | */ |
511 | status = acpi_ex_resolve_operands(op->common.aml_opcode, | 511 | status = acpi_ex_resolve_operands(op->common.aml_opcode, |
512 | ACPI_WALK_OPERANDS, walk_state); | 512 | ACPI_WALK_OPERANDS, walk_state); |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index afeb99f49482..4d8c992a51d8 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -178,7 +178,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
178 | 178 | ||
179 | if (!op) { | 179 | if (!op) { |
180 | ACPI_ERROR((AE_INFO, "Null Op")); | 180 | ACPI_ERROR((AE_INFO, "Null Op")); |
181 | return_UINT8(TRUE); | 181 | return_VALUE(TRUE); |
182 | } | 182 | } |
183 | 183 | ||
184 | /* | 184 | /* |
@@ -210,7 +210,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
210 | "At Method level, result of [%s] not used\n", | 210 | "At Method level, result of [%s] not used\n", |
211 | acpi_ps_get_opcode_name(op->common. | 211 | acpi_ps_get_opcode_name(op->common. |
212 | aml_opcode))); | 212 | aml_opcode))); |
213 | return_UINT8(FALSE); | 213 | return_VALUE(FALSE); |
214 | } | 214 | } |
215 | 215 | ||
216 | /* Get info on the parent. The root_op is AML_SCOPE */ | 216 | /* Get info on the parent. The root_op is AML_SCOPE */ |
@@ -219,7 +219,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
219 | acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); | 219 | acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); |
220 | if (parent_info->class == AML_CLASS_UNKNOWN) { | 220 | if (parent_info->class == AML_CLASS_UNKNOWN) { |
221 | ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op)); | 221 | ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op)); |
222 | return_UINT8(FALSE); | 222 | return_VALUE(FALSE); |
223 | } | 223 | } |
224 | 224 | ||
225 | /* | 225 | /* |
@@ -307,7 +307,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
307 | acpi_ps_get_opcode_name(op->common.parent->common. | 307 | acpi_ps_get_opcode_name(op->common.parent->common. |
308 | aml_opcode), op)); | 308 | aml_opcode), op)); |
309 | 309 | ||
310 | return_UINT8(TRUE); | 310 | return_VALUE(TRUE); |
311 | 311 | ||
312 | result_not_used: | 312 | result_not_used: |
313 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 313 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
@@ -316,7 +316,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
316 | acpi_ps_get_opcode_name(op->common.parent->common. | 316 | acpi_ps_get_opcode_name(op->common.parent->common. |
317 | aml_opcode), op)); | 317 | aml_opcode), op)); |
318 | 318 | ||
319 | return_UINT8(FALSE); | 319 | return_VALUE(FALSE); |
320 | } | 320 | } |
321 | 321 | ||
322 | /******************************************************************************* | 322 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index 58593931be96..44f8325c2bae 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -149,7 +149,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
149 | 149 | ||
150 | /* Truncate the predicate to 32-bits if necessary */ | 150 | /* Truncate the predicate to 32-bits if necessary */ |
151 | 151 | ||
152 | acpi_ex_truncate_for32bit_table(local_obj_desc); | 152 | (void)acpi_ex_truncate_for32bit_table(local_obj_desc); |
153 | 153 | ||
154 | /* | 154 | /* |
155 | * Save the result of the predicate evaluation on | 155 | * Save the result of the predicate evaluation on |
@@ -706,7 +706,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
706 | * ACPI 2.0 support for 64-bit integers: Truncate numeric | 706 | * ACPI 2.0 support for 64-bit integers: Truncate numeric |
707 | * result value if we are executing from a 32-bit ACPI table | 707 | * result value if we are executing from a 32-bit ACPI table |
708 | */ | 708 | */ |
709 | acpi_ex_truncate_for32bit_table(walk_state->result_obj); | 709 | (void)acpi_ex_truncate_for32bit_table(walk_state->result_obj); |
710 | 710 | ||
711 | /* | 711 | /* |
712 | * Check if we just completed the evaluation of a | 712 | * Check if we just completed the evaluation of a |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 557510084c7a..6e17c0e24e63 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -50,7 +50,7 @@ | |||
50 | #include "acnamesp.h" | 50 | #include "acnamesp.h" |
51 | 51 | ||
52 | #ifdef ACPI_ASL_COMPILER | 52 | #ifdef ACPI_ASL_COMPILER |
53 | #include <acpi/acdisasm.h> | 53 | #include "acdisasm.h" |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #define _COMPONENT ACPI_DISPATCHER | 56 | #define _COMPONENT ACPI_DISPATCHER |
@@ -178,7 +178,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
178 | * Target of Scope() not found. Generate an External for it, and | 178 | * Target of Scope() not found. Generate an External for it, and |
179 | * insert the name into the namespace. | 179 | * insert the name into the namespace. |
180 | */ | 180 | */ |
181 | acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); | 181 | acpi_dm_add_to_external_list(op, path, ACPI_TYPE_DEVICE, |
182 | 0); | ||
182 | status = | 183 | status = |
183 | acpi_ns_lookup(walk_state->scope_info, path, | 184 | acpi_ns_lookup(walk_state->scope_info, path, |
184 | object_type, ACPI_IMODE_LOAD_PASS1, | 185 | object_type, ACPI_IMODE_LOAD_PASS1, |
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index 379835748357..4407ff2377d5 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -222,7 +222,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
222 | */ | 222 | */ |
223 | ACPI_WARNING((AE_INFO, | 223 | ACPI_WARNING((AE_INFO, |
224 | "Type override - [%4.4s] had invalid type (%s) " | 224 | "Type override - [%4.4s] had invalid type (%s) " |
225 | "for Scope operator, changed to type ANY\n", | 225 | "for Scope operator, changed to type ANY", |
226 | acpi_ut_get_node_name(node), | 226 | acpi_ut_get_node_name(node), |
227 | acpi_ut_get_type_name(node->type))); | 227 | acpi_ut_get_type_name(node->type))); |
228 | 228 | ||
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c index f6c4295470ae..d67891de1b54 100644 --- a/drivers/acpi/acpica/dswscope.c +++ b/drivers/acpi/acpica/dswscope.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c index 3e65a15a735f..ecb12e2137ff 100644 --- a/drivers/acpi/acpica/dswstate.c +++ b/drivers/acpi/acpica/dswstate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index d4acfbbe5b29..b8ea0b26cde3 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c index af14a7137632..a621481c6cf2 100644 --- a/drivers/acpi/acpica/evglock.c +++ b/drivers/acpi/acpica/evglock.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 36d120574423..b9adb9a7ed85 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -561,8 +561,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
561 | status = AE_NO_MEMORY; | 561 | status = AE_NO_MEMORY; |
562 | } else { | 562 | } else { |
563 | /* | 563 | /* |
564 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | 564 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the |
565 | * control method that corresponds to this GPE | 565 | * _Lxx/_Exx control method that corresponds to this GPE |
566 | */ | 566 | */ |
567 | info->prefix_node = | 567 | info->prefix_node = |
568 | local_gpe_event_info->dispatch.method_node; | 568 | local_gpe_event_info->dispatch.method_node; |
@@ -707,7 +707,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
707 | if (ACPI_FAILURE(status)) { | 707 | if (ACPI_FAILURE(status)) { |
708 | ACPI_EXCEPTION((AE_INFO, status, | 708 | ACPI_EXCEPTION((AE_INFO, status, |
709 | "Unable to clear GPE%02X", gpe_number)); | 709 | "Unable to clear GPE%02X", gpe_number)); |
710 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); | 710 | return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | 713 | ||
@@ -724,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
724 | if (ACPI_FAILURE(status)) { | 724 | if (ACPI_FAILURE(status)) { |
725 | ACPI_EXCEPTION((AE_INFO, status, | 725 | ACPI_EXCEPTION((AE_INFO, status, |
726 | "Unable to disable GPE%02X", gpe_number)); | 726 | "Unable to disable GPE%02X", gpe_number)); |
727 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); | 727 | return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); |
728 | } | 728 | } |
729 | 729 | ||
730 | /* | 730 | /* |
@@ -765,7 +765,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
765 | gpe_event_info); | 765 | gpe_event_info); |
766 | if (ACPI_FAILURE(status)) { | 766 | if (ACPI_FAILURE(status)) { |
767 | ACPI_EXCEPTION((AE_INFO, status, | 767 | ACPI_EXCEPTION((AE_INFO, status, |
768 | "Unable to queue handler for GPE%2X - event disabled", | 768 | "Unable to queue handler for GPE%02X - event disabled", |
769 | gpe_number)); | 769 | gpe_number)); |
770 | } | 770 | } |
771 | break; | 771 | break; |
@@ -784,7 +784,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
784 | break; | 784 | break; |
785 | } | 785 | } |
786 | 786 | ||
787 | return_UINT32(ACPI_INTERRUPT_HANDLED); | 787 | return_VALUE(ACPI_INTERRUPT_HANDLED); |
788 | } | 788 | } |
789 | 789 | ||
790 | #endif /* !ACPI_REDUCED_HARDWARE */ | 790 | #endif /* !ACPI_REDUCED_HARDWARE */ |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 1571a61a7833..a2d688bbac02 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -405,13 +405,13 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
405 | (*return_gpe_block) = gpe_block; | 405 | (*return_gpe_block) = gpe_block; |
406 | } | 406 | } |
407 | 407 | ||
408 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 408 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
409 | "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n", | 409 | " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n", |
410 | (u32) gpe_block->block_base_number, | 410 | (u32)gpe_block->block_base_number, |
411 | (u32) (gpe_block->block_base_number + | 411 | (u32)(gpe_block->block_base_number + |
412 | (gpe_block->gpe_count - 1)), | 412 | (gpe_block->gpe_count - 1)), |
413 | gpe_device->name.ascii, gpe_block->register_count, | 413 | gpe_device->name.ascii, gpe_block->register_count, |
414 | interrupt_number)); | 414 | interrupt_number)); |
415 | 415 | ||
416 | /* Update global count of currently available GPEs */ | 416 | /* Update global count of currently available GPEs */ |
417 | 417 | ||
@@ -496,9 +496,11 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
496 | } | 496 | } |
497 | 497 | ||
498 | if (gpe_enabled_count) { | 498 | if (gpe_enabled_count) { |
499 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 499 | ACPI_INFO((AE_INFO, |
500 | "Enabled %u GPEs in this block\n", | 500 | "Enabled %u GPEs in block %02X to %02X", |
501 | gpe_enabled_count)); | 501 | gpe_enabled_count, (u32)gpe_block->block_base_number, |
502 | (u32)(gpe_block->block_base_number + | ||
503 | (gpe_block->gpe_count - 1)))); | ||
502 | } | 504 | } |
503 | 505 | ||
504 | gpe_block->initialized = TRUE; | 506 | gpe_block->initialized = TRUE; |
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index da0add858f81..72b8f6b3f4ca 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -86,6 +86,9 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
86 | 86 | ||
87 | ACPI_FUNCTION_TRACE(ev_gpe_initialize); | 87 | ACPI_FUNCTION_TRACE(ev_gpe_initialize); |
88 | 88 | ||
89 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | ||
90 | "Initializing General Purpose Events (GPEs):\n")); | ||
91 | |||
89 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 92 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
90 | if (ACPI_FAILURE(status)) { | 93 | if (ACPI_FAILURE(status)) { |
91 | return_ACPI_STATUS(status); | 94 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c index 228a0c3b1d49..b24dbb80fab8 100644 --- a/drivers/acpi/acpica/evgpeutil.c +++ b/drivers/acpi/acpica/evgpeutil.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c new file mode 100644 index 000000000000..d4f83112c2e2 --- /dev/null +++ b/drivers/acpi/acpica/evhandler.c | |||
@@ -0,0 +1,529 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: evhandler - Support for Address Space handlers | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acevents.h" | ||
47 | #include "acnamesp.h" | ||
48 | #include "acinterp.h" | ||
49 | |||
50 | #define _COMPONENT ACPI_EVENTS | ||
51 | ACPI_MODULE_NAME("evhandler") | ||
52 | |||
53 | /* Local prototypes */ | ||
54 | static acpi_status | ||
55 | acpi_ev_install_handler(acpi_handle obj_handle, | ||
56 | u32 level, void *context, void **return_value); | ||
57 | |||
58 | /* These are the address spaces that will get default handlers */ | ||
59 | |||
60 | u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { | ||
61 | ACPI_ADR_SPACE_SYSTEM_MEMORY, | ||
62 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
63 | ACPI_ADR_SPACE_PCI_CONFIG, | ||
64 | ACPI_ADR_SPACE_DATA_TABLE | ||
65 | }; | ||
66 | |||
67 | /******************************************************************************* | ||
68 | * | ||
69 | * FUNCTION: acpi_ev_install_region_handlers | ||
70 | * | ||
71 | * PARAMETERS: None | ||
72 | * | ||
73 | * RETURN: Status | ||
74 | * | ||
75 | * DESCRIPTION: Installs the core subsystem default address space handlers. | ||
76 | * | ||
77 | ******************************************************************************/ | ||
78 | |||
79 | acpi_status acpi_ev_install_region_handlers(void) | ||
80 | { | ||
81 | acpi_status status; | ||
82 | u32 i; | ||
83 | |||
84 | ACPI_FUNCTION_TRACE(ev_install_region_handlers); | ||
85 | |||
86 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
87 | if (ACPI_FAILURE(status)) { | ||
88 | return_ACPI_STATUS(status); | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * All address spaces (PCI Config, EC, SMBus) are scope dependent and | ||
93 | * registration must occur for a specific device. | ||
94 | * | ||
95 | * In the case of the system memory and IO address spaces there is | ||
96 | * currently no device associated with the address space. For these we | ||
97 | * use the root. | ||
98 | * | ||
99 | * We install the default PCI config space handler at the root so that | ||
100 | * this space is immediately available even though the we have not | ||
101 | * enumerated all the PCI Root Buses yet. This is to conform to the ACPI | ||
102 | * specification which states that the PCI config space must be always | ||
103 | * available -- even though we are nowhere near ready to find the PCI root | ||
104 | * buses at this point. | ||
105 | * | ||
106 | * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler | ||
107 | * has already been installed (via acpi_install_address_space_handler). | ||
108 | * Similar for AE_SAME_HANDLER. | ||
109 | */ | ||
110 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { | ||
111 | status = acpi_ev_install_space_handler(acpi_gbl_root_node, | ||
112 | acpi_gbl_default_address_spaces | ||
113 | [i], | ||
114 | ACPI_DEFAULT_HANDLER, | ||
115 | NULL, NULL); | ||
116 | switch (status) { | ||
117 | case AE_OK: | ||
118 | case AE_SAME_HANDLER: | ||
119 | case AE_ALREADY_EXISTS: | ||
120 | |||
121 | /* These exceptions are all OK */ | ||
122 | |||
123 | status = AE_OK; | ||
124 | break; | ||
125 | |||
126 | default: | ||
127 | |||
128 | goto unlock_and_exit; | ||
129 | } | ||
130 | } | ||
131 | |||
132 | unlock_and_exit: | ||
133 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
134 | return_ACPI_STATUS(status); | ||
135 | } | ||
136 | |||
137 | /******************************************************************************* | ||
138 | * | ||
139 | * FUNCTION: acpi_ev_has_default_handler | ||
140 | * | ||
141 | * PARAMETERS: node - Namespace node for the device | ||
142 | * space_id - The address space ID | ||
143 | * | ||
144 | * RETURN: TRUE if default handler is installed, FALSE otherwise | ||
145 | * | ||
146 | * DESCRIPTION: Check if the default handler is installed for the requested | ||
147 | * space ID. | ||
148 | * | ||
149 | ******************************************************************************/ | ||
150 | |||
151 | u8 | ||
152 | acpi_ev_has_default_handler(struct acpi_namespace_node *node, | ||
153 | acpi_adr_space_type space_id) | ||
154 | { | ||
155 | union acpi_operand_object *obj_desc; | ||
156 | union acpi_operand_object *handler_obj; | ||
157 | |||
158 | /* Must have an existing internal object */ | ||
159 | |||
160 | obj_desc = acpi_ns_get_attached_object(node); | ||
161 | if (obj_desc) { | ||
162 | handler_obj = obj_desc->device.handler; | ||
163 | |||
164 | /* Walk the linked list of handlers for this object */ | ||
165 | |||
166 | while (handler_obj) { | ||
167 | if (handler_obj->address_space.space_id == space_id) { | ||
168 | if (handler_obj->address_space.handler_flags & | ||
169 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | ||
170 | return (TRUE); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | handler_obj = handler_obj->address_space.next; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | return (FALSE); | ||
179 | } | ||
180 | |||
181 | /******************************************************************************* | ||
182 | * | ||
183 | * FUNCTION: acpi_ev_install_handler | ||
184 | * | ||
185 | * PARAMETERS: walk_namespace callback | ||
186 | * | ||
187 | * DESCRIPTION: This routine installs an address handler into objects that are | ||
188 | * of type Region or Device. | ||
189 | * | ||
190 | * If the Object is a Device, and the device has a handler of | ||
191 | * the same type then the search is terminated in that branch. | ||
192 | * | ||
193 | * This is because the existing handler is closer in proximity | ||
194 | * to any more regions than the one we are trying to install. | ||
195 | * | ||
196 | ******************************************************************************/ | ||
197 | |||
198 | static acpi_status | ||
199 | acpi_ev_install_handler(acpi_handle obj_handle, | ||
200 | u32 level, void *context, void **return_value) | ||
201 | { | ||
202 | union acpi_operand_object *handler_obj; | ||
203 | union acpi_operand_object *next_handler_obj; | ||
204 | union acpi_operand_object *obj_desc; | ||
205 | struct acpi_namespace_node *node; | ||
206 | acpi_status status; | ||
207 | |||
208 | ACPI_FUNCTION_NAME(ev_install_handler); | ||
209 | |||
210 | handler_obj = (union acpi_operand_object *)context; | ||
211 | |||
212 | /* Parameter validation */ | ||
213 | |||
214 | if (!handler_obj) { | ||
215 | return (AE_OK); | ||
216 | } | ||
217 | |||
218 | /* Convert and validate the device handle */ | ||
219 | |||
220 | node = acpi_ns_validate_handle(obj_handle); | ||
221 | if (!node) { | ||
222 | return (AE_BAD_PARAMETER); | ||
223 | } | ||
224 | |||
225 | /* | ||
226 | * We only care about regions and objects that are allowed to have | ||
227 | * address space handlers | ||
228 | */ | ||
229 | if ((node->type != ACPI_TYPE_DEVICE) && | ||
230 | (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { | ||
231 | return (AE_OK); | ||
232 | } | ||
233 | |||
234 | /* Check for an existing internal object */ | ||
235 | |||
236 | obj_desc = acpi_ns_get_attached_object(node); | ||
237 | if (!obj_desc) { | ||
238 | |||
239 | /* No object, just exit */ | ||
240 | |||
241 | return (AE_OK); | ||
242 | } | ||
243 | |||
244 | /* Devices are handled different than regions */ | ||
245 | |||
246 | if (obj_desc->common.type == ACPI_TYPE_DEVICE) { | ||
247 | |||
248 | /* Check if this Device already has a handler for this address space */ | ||
249 | |||
250 | next_handler_obj = obj_desc->device.handler; | ||
251 | while (next_handler_obj) { | ||
252 | |||
253 | /* Found a handler, is it for the same address space? */ | ||
254 | |||
255 | if (next_handler_obj->address_space.space_id == | ||
256 | handler_obj->address_space.space_id) { | ||
257 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
258 | "Found handler for region [%s] in device %p(%p) " | ||
259 | "handler %p\n", | ||
260 | acpi_ut_get_region_name | ||
261 | (handler_obj->address_space. | ||
262 | space_id), obj_desc, | ||
263 | next_handler_obj, | ||
264 | handler_obj)); | ||
265 | |||
266 | /* | ||
267 | * Since the object we found it on was a device, then it | ||
268 | * means that someone has already installed a handler for | ||
269 | * the branch of the namespace from this device on. Just | ||
270 | * bail out telling the walk routine to not traverse this | ||
271 | * branch. This preserves the scoping rule for handlers. | ||
272 | */ | ||
273 | return (AE_CTRL_DEPTH); | ||
274 | } | ||
275 | |||
276 | /* Walk the linked list of handlers attached to this device */ | ||
277 | |||
278 | next_handler_obj = next_handler_obj->address_space.next; | ||
279 | } | ||
280 | |||
281 | /* | ||
282 | * As long as the device didn't have a handler for this space we | ||
283 | * don't care about it. We just ignore it and proceed. | ||
284 | */ | ||
285 | return (AE_OK); | ||
286 | } | ||
287 | |||
288 | /* Object is a Region */ | ||
289 | |||
290 | if (obj_desc->region.space_id != handler_obj->address_space.space_id) { | ||
291 | |||
292 | /* This region is for a different address space, just ignore it */ | ||
293 | |||
294 | return (AE_OK); | ||
295 | } | ||
296 | |||
297 | /* | ||
298 | * Now we have a region and it is for the handler's address space type. | ||
299 | * | ||
300 | * First disconnect region for any previous handler (if any) | ||
301 | */ | ||
302 | acpi_ev_detach_region(obj_desc, FALSE); | ||
303 | |||
304 | /* Connect the region to the new handler */ | ||
305 | |||
306 | status = acpi_ev_attach_region(handler_obj, obj_desc, FALSE); | ||
307 | return (status); | ||
308 | } | ||
309 | |||
310 | /******************************************************************************* | ||
311 | * | ||
312 | * FUNCTION: acpi_ev_install_space_handler | ||
313 | * | ||
314 | * PARAMETERS: node - Namespace node for the device | ||
315 | * space_id - The address space ID | ||
316 | * handler - Address of the handler | ||
317 | * setup - Address of the setup function | ||
318 | * context - Value passed to the handler on each access | ||
319 | * | ||
320 | * RETURN: Status | ||
321 | * | ||
322 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. | ||
323 | * Assumes namespace is locked | ||
324 | * | ||
325 | ******************************************************************************/ | ||
326 | |||
327 | acpi_status | ||
328 | acpi_ev_install_space_handler(struct acpi_namespace_node * node, | ||
329 | acpi_adr_space_type space_id, | ||
330 | acpi_adr_space_handler handler, | ||
331 | acpi_adr_space_setup setup, void *context) | ||
332 | { | ||
333 | union acpi_operand_object *obj_desc; | ||
334 | union acpi_operand_object *handler_obj; | ||
335 | acpi_status status; | ||
336 | acpi_object_type type; | ||
337 | u8 flags = 0; | ||
338 | |||
339 | ACPI_FUNCTION_TRACE(ev_install_space_handler); | ||
340 | |||
341 | /* | ||
342 | * This registration is valid for only the types below and the root. This | ||
343 | * is where the default handlers get placed. | ||
344 | */ | ||
345 | if ((node->type != ACPI_TYPE_DEVICE) && | ||
346 | (node->type != ACPI_TYPE_PROCESSOR) && | ||
347 | (node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) { | ||
348 | status = AE_BAD_PARAMETER; | ||
349 | goto unlock_and_exit; | ||
350 | } | ||
351 | |||
352 | if (handler == ACPI_DEFAULT_HANDLER) { | ||
353 | flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED; | ||
354 | |||
355 | switch (space_id) { | ||
356 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
357 | handler = acpi_ex_system_memory_space_handler; | ||
358 | setup = acpi_ev_system_memory_region_setup; | ||
359 | break; | ||
360 | |||
361 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
362 | handler = acpi_ex_system_io_space_handler; | ||
363 | setup = acpi_ev_io_space_region_setup; | ||
364 | break; | ||
365 | |||
366 | case ACPI_ADR_SPACE_PCI_CONFIG: | ||
367 | handler = acpi_ex_pci_config_space_handler; | ||
368 | setup = acpi_ev_pci_config_region_setup; | ||
369 | break; | ||
370 | |||
371 | case ACPI_ADR_SPACE_CMOS: | ||
372 | handler = acpi_ex_cmos_space_handler; | ||
373 | setup = acpi_ev_cmos_region_setup; | ||
374 | break; | ||
375 | |||
376 | case ACPI_ADR_SPACE_PCI_BAR_TARGET: | ||
377 | handler = acpi_ex_pci_bar_space_handler; | ||
378 | setup = acpi_ev_pci_bar_region_setup; | ||
379 | break; | ||
380 | |||
381 | case ACPI_ADR_SPACE_DATA_TABLE: | ||
382 | handler = acpi_ex_data_table_space_handler; | ||
383 | setup = NULL; | ||
384 | break; | ||
385 | |||
386 | default: | ||
387 | status = AE_BAD_PARAMETER; | ||
388 | goto unlock_and_exit; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | /* If the caller hasn't specified a setup routine, use the default */ | ||
393 | |||
394 | if (!setup) { | ||
395 | setup = acpi_ev_default_region_setup; | ||
396 | } | ||
397 | |||
398 | /* Check for an existing internal object */ | ||
399 | |||
400 | obj_desc = acpi_ns_get_attached_object(node); | ||
401 | if (obj_desc) { | ||
402 | /* | ||
403 | * The attached device object already exists. Make sure the handler | ||
404 | * is not already installed. | ||
405 | */ | ||
406 | handler_obj = obj_desc->device.handler; | ||
407 | |||
408 | /* Walk the handler list for this device */ | ||
409 | |||
410 | while (handler_obj) { | ||
411 | |||
412 | /* Same space_id indicates a handler already installed */ | ||
413 | |||
414 | if (handler_obj->address_space.space_id == space_id) { | ||
415 | if (handler_obj->address_space.handler == | ||
416 | handler) { | ||
417 | /* | ||
418 | * It is (relatively) OK to attempt to install the SAME | ||
419 | * handler twice. This can easily happen with the | ||
420 | * PCI_Config space. | ||
421 | */ | ||
422 | status = AE_SAME_HANDLER; | ||
423 | goto unlock_and_exit; | ||
424 | } else { | ||
425 | /* A handler is already installed */ | ||
426 | |||
427 | status = AE_ALREADY_EXISTS; | ||
428 | } | ||
429 | goto unlock_and_exit; | ||
430 | } | ||
431 | |||
432 | /* Walk the linked list of handlers */ | ||
433 | |||
434 | handler_obj = handler_obj->address_space.next; | ||
435 | } | ||
436 | } else { | ||
437 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
438 | "Creating object on Device %p while installing handler\n", | ||
439 | node)); | ||
440 | |||
441 | /* obj_desc does not exist, create one */ | ||
442 | |||
443 | if (node->type == ACPI_TYPE_ANY) { | ||
444 | type = ACPI_TYPE_DEVICE; | ||
445 | } else { | ||
446 | type = node->type; | ||
447 | } | ||
448 | |||
449 | obj_desc = acpi_ut_create_internal_object(type); | ||
450 | if (!obj_desc) { | ||
451 | status = AE_NO_MEMORY; | ||
452 | goto unlock_and_exit; | ||
453 | } | ||
454 | |||
455 | /* Init new descriptor */ | ||
456 | |||
457 | obj_desc->common.type = (u8)type; | ||
458 | |||
459 | /* Attach the new object to the Node */ | ||
460 | |||
461 | status = acpi_ns_attach_object(node, obj_desc, type); | ||
462 | |||
463 | /* Remove local reference to the object */ | ||
464 | |||
465 | acpi_ut_remove_reference(obj_desc); | ||
466 | |||
467 | if (ACPI_FAILURE(status)) { | ||
468 | goto unlock_and_exit; | ||
469 | } | ||
470 | } | ||
471 | |||
472 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
473 | "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", | ||
474 | acpi_ut_get_region_name(space_id), space_id, | ||
475 | acpi_ut_get_node_name(node), node, obj_desc)); | ||
476 | |||
477 | /* | ||
478 | * Install the handler | ||
479 | * | ||
480 | * At this point there is no existing handler. Just allocate the object | ||
481 | * for the handler and link it into the list. | ||
482 | */ | ||
483 | handler_obj = | ||
484 | acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); | ||
485 | if (!handler_obj) { | ||
486 | status = AE_NO_MEMORY; | ||
487 | goto unlock_and_exit; | ||
488 | } | ||
489 | |||
490 | /* Init handler obj */ | ||
491 | |||
492 | handler_obj->address_space.space_id = (u8)space_id; | ||
493 | handler_obj->address_space.handler_flags = flags; | ||
494 | handler_obj->address_space.region_list = NULL; | ||
495 | handler_obj->address_space.node = node; | ||
496 | handler_obj->address_space.handler = handler; | ||
497 | handler_obj->address_space.context = context; | ||
498 | handler_obj->address_space.setup = setup; | ||
499 | |||
500 | /* Install at head of Device.address_space list */ | ||
501 | |||
502 | handler_obj->address_space.next = obj_desc->device.handler; | ||
503 | |||
504 | /* | ||
505 | * The Device object is the first reference on the handler_obj. | ||
506 | * Each region that uses the handler adds a reference. | ||
507 | */ | ||
508 | obj_desc->device.handler = handler_obj; | ||
509 | |||
510 | /* | ||
511 | * Walk the namespace finding all of the regions this | ||
512 | * handler will manage. | ||
513 | * | ||
514 | * Start at the device and search the branch toward | ||
515 | * the leaf nodes until either the leaf is encountered or | ||
516 | * a device is detected that has an address handler of the | ||
517 | * same type. | ||
518 | * | ||
519 | * In either case, back up and search down the remainder | ||
520 | * of the branch | ||
521 | */ | ||
522 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, | ||
523 | ACPI_NS_WALK_UNLOCK, | ||
524 | acpi_ev_install_handler, NULL, | ||
525 | handler_obj, NULL); | ||
526 | |||
527 | unlock_and_exit: | ||
528 | return_ACPI_STATUS(status); | ||
529 | } | ||
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index 51f537937c1f..c986b2336b81 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 0cc6a16fedc7..6555e350fc1f 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: evregion - ACPI address_space (op_region) handler dispatch | 3 | * Module Name: evregion - Operation Region support |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -50,10 +50,9 @@ | |||
50 | #define _COMPONENT ACPI_EVENTS | 50 | #define _COMPONENT ACPI_EVENTS |
51 | ACPI_MODULE_NAME("evregion") | 51 | ACPI_MODULE_NAME("evregion") |
52 | 52 | ||
53 | extern u8 acpi_gbl_default_address_spaces[]; | ||
54 | |||
53 | /* Local prototypes */ | 55 | /* Local prototypes */ |
54 | static u8 | ||
55 | acpi_ev_has_default_handler(struct acpi_namespace_node *node, | ||
56 | acpi_adr_space_type space_id); | ||
57 | 56 | ||
58 | static void acpi_ev_orphan_ec_reg_method(void); | 57 | static void acpi_ev_orphan_ec_reg_method(void); |
59 | 58 | ||
@@ -61,135 +60,6 @@ static acpi_status | |||
61 | acpi_ev_reg_run(acpi_handle obj_handle, | 60 | acpi_ev_reg_run(acpi_handle obj_handle, |
62 | u32 level, void *context, void **return_value); | 61 | u32 level, void *context, void **return_value); |
63 | 62 | ||
64 | static acpi_status | ||
65 | acpi_ev_install_handler(acpi_handle obj_handle, | ||
66 | u32 level, void *context, void **return_value); | ||
67 | |||
68 | /* These are the address spaces that will get default handlers */ | ||
69 | |||
70 | #define ACPI_NUM_DEFAULT_SPACES 4 | ||
71 | |||
72 | static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { | ||
73 | ACPI_ADR_SPACE_SYSTEM_MEMORY, | ||
74 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
75 | ACPI_ADR_SPACE_PCI_CONFIG, | ||
76 | ACPI_ADR_SPACE_DATA_TABLE | ||
77 | }; | ||
78 | |||
79 | /******************************************************************************* | ||
80 | * | ||
81 | * FUNCTION: acpi_ev_install_region_handlers | ||
82 | * | ||
83 | * PARAMETERS: None | ||
84 | * | ||
85 | * RETURN: Status | ||
86 | * | ||
87 | * DESCRIPTION: Installs the core subsystem default address space handlers. | ||
88 | * | ||
89 | ******************************************************************************/ | ||
90 | |||
91 | acpi_status acpi_ev_install_region_handlers(void) | ||
92 | { | ||
93 | acpi_status status; | ||
94 | u32 i; | ||
95 | |||
96 | ACPI_FUNCTION_TRACE(ev_install_region_handlers); | ||
97 | |||
98 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
99 | if (ACPI_FAILURE(status)) { | ||
100 | return_ACPI_STATUS(status); | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * All address spaces (PCI Config, EC, SMBus) are scope dependent and | ||
105 | * registration must occur for a specific device. | ||
106 | * | ||
107 | * In the case of the system memory and IO address spaces there is | ||
108 | * currently no device associated with the address space. For these we | ||
109 | * use the root. | ||
110 | * | ||
111 | * We install the default PCI config space handler at the root so that | ||
112 | * this space is immediately available even though the we have not | ||
113 | * enumerated all the PCI Root Buses yet. This is to conform to the ACPI | ||
114 | * specification which states that the PCI config space must be always | ||
115 | * available -- even though we are nowhere near ready to find the PCI root | ||
116 | * buses at this point. | ||
117 | * | ||
118 | * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler | ||
119 | * has already been installed (via acpi_install_address_space_handler). | ||
120 | * Similar for AE_SAME_HANDLER. | ||
121 | */ | ||
122 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { | ||
123 | status = acpi_ev_install_space_handler(acpi_gbl_root_node, | ||
124 | acpi_gbl_default_address_spaces | ||
125 | [i], | ||
126 | ACPI_DEFAULT_HANDLER, | ||
127 | NULL, NULL); | ||
128 | switch (status) { | ||
129 | case AE_OK: | ||
130 | case AE_SAME_HANDLER: | ||
131 | case AE_ALREADY_EXISTS: | ||
132 | |||
133 | /* These exceptions are all OK */ | ||
134 | |||
135 | status = AE_OK; | ||
136 | break; | ||
137 | |||
138 | default: | ||
139 | |||
140 | goto unlock_and_exit; | ||
141 | } | ||
142 | } | ||
143 | |||
144 | unlock_and_exit: | ||
145 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
146 | return_ACPI_STATUS(status); | ||
147 | } | ||
148 | |||
149 | /******************************************************************************* | ||
150 | * | ||
151 | * FUNCTION: acpi_ev_has_default_handler | ||
152 | * | ||
153 | * PARAMETERS: node - Namespace node for the device | ||
154 | * space_id - The address space ID | ||
155 | * | ||
156 | * RETURN: TRUE if default handler is installed, FALSE otherwise | ||
157 | * | ||
158 | * DESCRIPTION: Check if the default handler is installed for the requested | ||
159 | * space ID. | ||
160 | * | ||
161 | ******************************************************************************/ | ||
162 | |||
163 | static u8 | ||
164 | acpi_ev_has_default_handler(struct acpi_namespace_node *node, | ||
165 | acpi_adr_space_type space_id) | ||
166 | { | ||
167 | union acpi_operand_object *obj_desc; | ||
168 | union acpi_operand_object *handler_obj; | ||
169 | |||
170 | /* Must have an existing internal object */ | ||
171 | |||
172 | obj_desc = acpi_ns_get_attached_object(node); | ||
173 | if (obj_desc) { | ||
174 | handler_obj = obj_desc->device.handler; | ||
175 | |||
176 | /* Walk the linked list of handlers for this object */ | ||
177 | |||
178 | while (handler_obj) { | ||
179 | if (handler_obj->address_space.space_id == space_id) { | ||
180 | if (handler_obj->address_space.handler_flags & | ||
181 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | ||
182 | return (TRUE); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | handler_obj = handler_obj->address_space.next; | ||
187 | } | ||
188 | } | ||
189 | |||
190 | return (FALSE); | ||
191 | } | ||
192 | |||
193 | /******************************************************************************* | 63 | /******************************************************************************* |
194 | * | 64 | * |
195 | * FUNCTION: acpi_ev_initialize_op_regions | 65 | * FUNCTION: acpi_ev_initialize_op_regions |
@@ -241,91 +111,6 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
241 | 111 | ||
242 | /******************************************************************************* | 112 | /******************************************************************************* |
243 | * | 113 | * |
244 | * FUNCTION: acpi_ev_execute_reg_method | ||
245 | * | ||
246 | * PARAMETERS: region_obj - Region object | ||
247 | * function - Passed to _REG: On (1) or Off (0) | ||
248 | * | ||
249 | * RETURN: Status | ||
250 | * | ||
251 | * DESCRIPTION: Execute _REG method for a region | ||
252 | * | ||
253 | ******************************************************************************/ | ||
254 | |||
255 | acpi_status | ||
256 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | ||
257 | { | ||
258 | struct acpi_evaluate_info *info; | ||
259 | union acpi_operand_object *args[3]; | ||
260 | union acpi_operand_object *region_obj2; | ||
261 | acpi_status status; | ||
262 | |||
263 | ACPI_FUNCTION_TRACE(ev_execute_reg_method); | ||
264 | |||
265 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | ||
266 | if (!region_obj2) { | ||
267 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
268 | } | ||
269 | |||
270 | if (region_obj2->extra.method_REG == NULL) { | ||
271 | return_ACPI_STATUS(AE_OK); | ||
272 | } | ||
273 | |||
274 | /* Allocate and initialize the evaluation information block */ | ||
275 | |||
276 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
277 | if (!info) { | ||
278 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
279 | } | ||
280 | |||
281 | info->prefix_node = region_obj2->extra.method_REG; | ||
282 | info->pathname = NULL; | ||
283 | info->parameters = args; | ||
284 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
285 | |||
286 | /* | ||
287 | * The _REG method has two arguments: | ||
288 | * | ||
289 | * arg0 - Integer: | ||
290 | * Operation region space ID Same value as region_obj->Region.space_id | ||
291 | * | ||
292 | * arg1 - Integer: | ||
293 | * connection status 1 for connecting the handler, 0 for disconnecting | ||
294 | * the handler (Passed as a parameter) | ||
295 | */ | ||
296 | args[0] = | ||
297 | acpi_ut_create_integer_object((u64) region_obj->region.space_id); | ||
298 | if (!args[0]) { | ||
299 | status = AE_NO_MEMORY; | ||
300 | goto cleanup1; | ||
301 | } | ||
302 | |||
303 | args[1] = acpi_ut_create_integer_object((u64) function); | ||
304 | if (!args[1]) { | ||
305 | status = AE_NO_MEMORY; | ||
306 | goto cleanup2; | ||
307 | } | ||
308 | |||
309 | args[2] = NULL; /* Terminate list */ | ||
310 | |||
311 | /* Execute the method, no return value */ | ||
312 | |||
313 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | ||
314 | (ACPI_TYPE_METHOD, info->prefix_node, NULL)); | ||
315 | |||
316 | status = acpi_ns_evaluate(info); | ||
317 | acpi_ut_remove_reference(args[1]); | ||
318 | |||
319 | cleanup2: | ||
320 | acpi_ut_remove_reference(args[0]); | ||
321 | |||
322 | cleanup1: | ||
323 | ACPI_FREE(info); | ||
324 | return_ACPI_STATUS(status); | ||
325 | } | ||
326 | |||
327 | /******************************************************************************* | ||
328 | * | ||
329 | * FUNCTION: acpi_ev_address_space_dispatch | 114 | * FUNCTION: acpi_ev_address_space_dispatch |
330 | * | 115 | * |
331 | * PARAMETERS: region_obj - Internal region object | 116 | * PARAMETERS: region_obj - Internal region object |
@@ -709,351 +494,86 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, | |||
709 | 494 | ||
710 | /******************************************************************************* | 495 | /******************************************************************************* |
711 | * | 496 | * |
712 | * FUNCTION: acpi_ev_install_handler | 497 | * FUNCTION: acpi_ev_execute_reg_method |
713 | * | ||
714 | * PARAMETERS: walk_namespace callback | ||
715 | * | ||
716 | * DESCRIPTION: This routine installs an address handler into objects that are | ||
717 | * of type Region or Device. | ||
718 | * | ||
719 | * If the Object is a Device, and the device has a handler of | ||
720 | * the same type then the search is terminated in that branch. | ||
721 | * | ||
722 | * This is because the existing handler is closer in proximity | ||
723 | * to any more regions than the one we are trying to install. | ||
724 | * | ||
725 | ******************************************************************************/ | ||
726 | |||
727 | static acpi_status | ||
728 | acpi_ev_install_handler(acpi_handle obj_handle, | ||
729 | u32 level, void *context, void **return_value) | ||
730 | { | ||
731 | union acpi_operand_object *handler_obj; | ||
732 | union acpi_operand_object *next_handler_obj; | ||
733 | union acpi_operand_object *obj_desc; | ||
734 | struct acpi_namespace_node *node; | ||
735 | acpi_status status; | ||
736 | |||
737 | ACPI_FUNCTION_NAME(ev_install_handler); | ||
738 | |||
739 | handler_obj = (union acpi_operand_object *)context; | ||
740 | |||
741 | /* Parameter validation */ | ||
742 | |||
743 | if (!handler_obj) { | ||
744 | return (AE_OK); | ||
745 | } | ||
746 | |||
747 | /* Convert and validate the device handle */ | ||
748 | |||
749 | node = acpi_ns_validate_handle(obj_handle); | ||
750 | if (!node) { | ||
751 | return (AE_BAD_PARAMETER); | ||
752 | } | ||
753 | |||
754 | /* | ||
755 | * We only care about regions and objects that are allowed to have | ||
756 | * address space handlers | ||
757 | */ | ||
758 | if ((node->type != ACPI_TYPE_DEVICE) && | ||
759 | (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { | ||
760 | return (AE_OK); | ||
761 | } | ||
762 | |||
763 | /* Check for an existing internal object */ | ||
764 | |||
765 | obj_desc = acpi_ns_get_attached_object(node); | ||
766 | if (!obj_desc) { | ||
767 | |||
768 | /* No object, just exit */ | ||
769 | |||
770 | return (AE_OK); | ||
771 | } | ||
772 | |||
773 | /* Devices are handled different than regions */ | ||
774 | |||
775 | if (obj_desc->common.type == ACPI_TYPE_DEVICE) { | ||
776 | |||
777 | /* Check if this Device already has a handler for this address space */ | ||
778 | |||
779 | next_handler_obj = obj_desc->device.handler; | ||
780 | while (next_handler_obj) { | ||
781 | |||
782 | /* Found a handler, is it for the same address space? */ | ||
783 | |||
784 | if (next_handler_obj->address_space.space_id == | ||
785 | handler_obj->address_space.space_id) { | ||
786 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
787 | "Found handler for region [%s] in device %p(%p) " | ||
788 | "handler %p\n", | ||
789 | acpi_ut_get_region_name | ||
790 | (handler_obj->address_space. | ||
791 | space_id), obj_desc, | ||
792 | next_handler_obj, | ||
793 | handler_obj)); | ||
794 | |||
795 | /* | ||
796 | * Since the object we found it on was a device, then it | ||
797 | * means that someone has already installed a handler for | ||
798 | * the branch of the namespace from this device on. Just | ||
799 | * bail out telling the walk routine to not traverse this | ||
800 | * branch. This preserves the scoping rule for handlers. | ||
801 | */ | ||
802 | return (AE_CTRL_DEPTH); | ||
803 | } | ||
804 | |||
805 | /* Walk the linked list of handlers attached to this device */ | ||
806 | |||
807 | next_handler_obj = next_handler_obj->address_space.next; | ||
808 | } | ||
809 | |||
810 | /* | ||
811 | * As long as the device didn't have a handler for this space we | ||
812 | * don't care about it. We just ignore it and proceed. | ||
813 | */ | ||
814 | return (AE_OK); | ||
815 | } | ||
816 | |||
817 | /* Object is a Region */ | ||
818 | |||
819 | if (obj_desc->region.space_id != handler_obj->address_space.space_id) { | ||
820 | |||
821 | /* This region is for a different address space, just ignore it */ | ||
822 | |||
823 | return (AE_OK); | ||
824 | } | ||
825 | |||
826 | /* | ||
827 | * Now we have a region and it is for the handler's address space type. | ||
828 | * | ||
829 | * First disconnect region for any previous handler (if any) | ||
830 | */ | ||
831 | acpi_ev_detach_region(obj_desc, FALSE); | ||
832 | |||
833 | /* Connect the region to the new handler */ | ||
834 | |||
835 | status = acpi_ev_attach_region(handler_obj, obj_desc, FALSE); | ||
836 | return (status); | ||
837 | } | ||
838 | |||
839 | /******************************************************************************* | ||
840 | * | ||
841 | * FUNCTION: acpi_ev_install_space_handler | ||
842 | * | 498 | * |
843 | * PARAMETERS: node - Namespace node for the device | 499 | * PARAMETERS: region_obj - Region object |
844 | * space_id - The address space ID | 500 | * function - Passed to _REG: On (1) or Off (0) |
845 | * handler - Address of the handler | ||
846 | * setup - Address of the setup function | ||
847 | * context - Value passed to the handler on each access | ||
848 | * | 501 | * |
849 | * RETURN: Status | 502 | * RETURN: Status |
850 | * | 503 | * |
851 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. | 504 | * DESCRIPTION: Execute _REG method for a region |
852 | * Assumes namespace is locked | ||
853 | * | 505 | * |
854 | ******************************************************************************/ | 506 | ******************************************************************************/ |
855 | 507 | ||
856 | acpi_status | 508 | acpi_status |
857 | acpi_ev_install_space_handler(struct acpi_namespace_node * node, | 509 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) |
858 | acpi_adr_space_type space_id, | ||
859 | acpi_adr_space_handler handler, | ||
860 | acpi_adr_space_setup setup, void *context) | ||
861 | { | 510 | { |
862 | union acpi_operand_object *obj_desc; | 511 | struct acpi_evaluate_info *info; |
863 | union acpi_operand_object *handler_obj; | 512 | union acpi_operand_object *args[3]; |
513 | union acpi_operand_object *region_obj2; | ||
864 | acpi_status status; | 514 | acpi_status status; |
865 | acpi_object_type type; | ||
866 | u8 flags = 0; | ||
867 | 515 | ||
868 | ACPI_FUNCTION_TRACE(ev_install_space_handler); | 516 | ACPI_FUNCTION_TRACE(ev_execute_reg_method); |
869 | |||
870 | /* | ||
871 | * This registration is valid for only the types below and the root. This | ||
872 | * is where the default handlers get placed. | ||
873 | */ | ||
874 | if ((node->type != ACPI_TYPE_DEVICE) && | ||
875 | (node->type != ACPI_TYPE_PROCESSOR) && | ||
876 | (node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) { | ||
877 | status = AE_BAD_PARAMETER; | ||
878 | goto unlock_and_exit; | ||
879 | } | ||
880 | 517 | ||
881 | if (handler == ACPI_DEFAULT_HANDLER) { | 518 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
882 | flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED; | 519 | if (!region_obj2) { |
883 | 520 | return_ACPI_STATUS(AE_NOT_EXIST); | |
884 | switch (space_id) { | ||
885 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
886 | handler = acpi_ex_system_memory_space_handler; | ||
887 | setup = acpi_ev_system_memory_region_setup; | ||
888 | break; | ||
889 | |||
890 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
891 | handler = acpi_ex_system_io_space_handler; | ||
892 | setup = acpi_ev_io_space_region_setup; | ||
893 | break; | ||
894 | |||
895 | case ACPI_ADR_SPACE_PCI_CONFIG: | ||
896 | handler = acpi_ex_pci_config_space_handler; | ||
897 | setup = acpi_ev_pci_config_region_setup; | ||
898 | break; | ||
899 | |||
900 | case ACPI_ADR_SPACE_CMOS: | ||
901 | handler = acpi_ex_cmos_space_handler; | ||
902 | setup = acpi_ev_cmos_region_setup; | ||
903 | break; | ||
904 | |||
905 | case ACPI_ADR_SPACE_PCI_BAR_TARGET: | ||
906 | handler = acpi_ex_pci_bar_space_handler; | ||
907 | setup = acpi_ev_pci_bar_region_setup; | ||
908 | break; | ||
909 | |||
910 | case ACPI_ADR_SPACE_DATA_TABLE: | ||
911 | handler = acpi_ex_data_table_space_handler; | ||
912 | setup = NULL; | ||
913 | break; | ||
914 | |||
915 | default: | ||
916 | status = AE_BAD_PARAMETER; | ||
917 | goto unlock_and_exit; | ||
918 | } | ||
919 | } | 521 | } |
920 | 522 | ||
921 | /* If the caller hasn't specified a setup routine, use the default */ | 523 | if (region_obj2->extra.method_REG == NULL) { |
922 | 524 | return_ACPI_STATUS(AE_OK); | |
923 | if (!setup) { | ||
924 | setup = acpi_ev_default_region_setup; | ||
925 | } | 525 | } |
926 | 526 | ||
927 | /* Check for an existing internal object */ | 527 | /* Allocate and initialize the evaluation information block */ |
928 | |||
929 | obj_desc = acpi_ns_get_attached_object(node); | ||
930 | if (obj_desc) { | ||
931 | /* | ||
932 | * The attached device object already exists. Make sure the handler | ||
933 | * is not already installed. | ||
934 | */ | ||
935 | handler_obj = obj_desc->device.handler; | ||
936 | |||
937 | /* Walk the handler list for this device */ | ||
938 | |||
939 | while (handler_obj) { | ||
940 | |||
941 | /* Same space_id indicates a handler already installed */ | ||
942 | |||
943 | if (handler_obj->address_space.space_id == space_id) { | ||
944 | if (handler_obj->address_space.handler == | ||
945 | handler) { | ||
946 | /* | ||
947 | * It is (relatively) OK to attempt to install the SAME | ||
948 | * handler twice. This can easily happen with the | ||
949 | * PCI_Config space. | ||
950 | */ | ||
951 | status = AE_SAME_HANDLER; | ||
952 | goto unlock_and_exit; | ||
953 | } else { | ||
954 | /* A handler is already installed */ | ||
955 | |||
956 | status = AE_ALREADY_EXISTS; | ||
957 | } | ||
958 | goto unlock_and_exit; | ||
959 | } | ||
960 | |||
961 | /* Walk the linked list of handlers */ | ||
962 | |||
963 | handler_obj = handler_obj->address_space.next; | ||
964 | } | ||
965 | } else { | ||
966 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
967 | "Creating object on Device %p while installing handler\n", | ||
968 | node)); | ||
969 | |||
970 | /* obj_desc does not exist, create one */ | ||
971 | |||
972 | if (node->type == ACPI_TYPE_ANY) { | ||
973 | type = ACPI_TYPE_DEVICE; | ||
974 | } else { | ||
975 | type = node->type; | ||
976 | } | ||
977 | |||
978 | obj_desc = acpi_ut_create_internal_object(type); | ||
979 | if (!obj_desc) { | ||
980 | status = AE_NO_MEMORY; | ||
981 | goto unlock_and_exit; | ||
982 | } | ||
983 | |||
984 | /* Init new descriptor */ | ||
985 | |||
986 | obj_desc->common.type = (u8) type; | ||
987 | |||
988 | /* Attach the new object to the Node */ | ||
989 | |||
990 | status = acpi_ns_attach_object(node, obj_desc, type); | ||
991 | |||
992 | /* Remove local reference to the object */ | ||
993 | |||
994 | acpi_ut_remove_reference(obj_desc); | ||
995 | 528 | ||
996 | if (ACPI_FAILURE(status)) { | 529 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
997 | goto unlock_and_exit; | 530 | if (!info) { |
998 | } | 531 | return_ACPI_STATUS(AE_NO_MEMORY); |
999 | } | 532 | } |
1000 | 533 | ||
1001 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 534 | info->prefix_node = region_obj2->extra.method_REG; |
1002 | "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", | 535 | info->pathname = NULL; |
1003 | acpi_ut_get_region_name(space_id), space_id, | 536 | info->parameters = args; |
1004 | acpi_ut_get_node_name(node), node, obj_desc)); | 537 | info->flags = ACPI_IGNORE_RETURN_VALUE; |
1005 | 538 | ||
1006 | /* | 539 | /* |
1007 | * Install the handler | 540 | * The _REG method has two arguments: |
541 | * | ||
542 | * arg0 - Integer: | ||
543 | * Operation region space ID Same value as region_obj->Region.space_id | ||
1008 | * | 544 | * |
1009 | * At this point there is no existing handler. Just allocate the object | 545 | * arg1 - Integer: |
1010 | * for the handler and link it into the list. | 546 | * connection status 1 for connecting the handler, 0 for disconnecting |
547 | * the handler (Passed as a parameter) | ||
1011 | */ | 548 | */ |
1012 | handler_obj = | 549 | args[0] = |
1013 | acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); | 550 | acpi_ut_create_integer_object((u64)region_obj->region.space_id); |
1014 | if (!handler_obj) { | 551 | if (!args[0]) { |
1015 | status = AE_NO_MEMORY; | 552 | status = AE_NO_MEMORY; |
1016 | goto unlock_and_exit; | 553 | goto cleanup1; |
1017 | } | 554 | } |
1018 | 555 | ||
1019 | /* Init handler obj */ | 556 | args[1] = acpi_ut_create_integer_object((u64)function); |
557 | if (!args[1]) { | ||
558 | status = AE_NO_MEMORY; | ||
559 | goto cleanup2; | ||
560 | } | ||
1020 | 561 | ||
1021 | handler_obj->address_space.space_id = (u8) space_id; | 562 | args[2] = NULL; /* Terminate list */ |
1022 | handler_obj->address_space.handler_flags = flags; | ||
1023 | handler_obj->address_space.region_list = NULL; | ||
1024 | handler_obj->address_space.node = node; | ||
1025 | handler_obj->address_space.handler = handler; | ||
1026 | handler_obj->address_space.context = context; | ||
1027 | handler_obj->address_space.setup = setup; | ||
1028 | 563 | ||
1029 | /* Install at head of Device.address_space list */ | 564 | /* Execute the method, no return value */ |
1030 | 565 | ||
1031 | handler_obj->address_space.next = obj_desc->device.handler; | 566 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
567 | (ACPI_TYPE_METHOD, info->prefix_node, NULL)); | ||
1032 | 568 | ||
1033 | /* | 569 | status = acpi_ns_evaluate(info); |
1034 | * The Device object is the first reference on the handler_obj. | 570 | acpi_ut_remove_reference(args[1]); |
1035 | * Each region that uses the handler adds a reference. | ||
1036 | */ | ||
1037 | obj_desc->device.handler = handler_obj; | ||
1038 | 571 | ||
1039 | /* | 572 | cleanup2: |
1040 | * Walk the namespace finding all of the regions this | 573 | acpi_ut_remove_reference(args[0]); |
1041 | * handler will manage. | ||
1042 | * | ||
1043 | * Start at the device and search the branch toward | ||
1044 | * the leaf nodes until either the leaf is encountered or | ||
1045 | * a device is detected that has an address handler of the | ||
1046 | * same type. | ||
1047 | * | ||
1048 | * In either case, back up and search down the remainder | ||
1049 | * of the branch | ||
1050 | */ | ||
1051 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, | ||
1052 | ACPI_NS_WALK_UNLOCK, | ||
1053 | acpi_ev_install_handler, NULL, | ||
1054 | handler_obj, NULL); | ||
1055 | 574 | ||
1056 | unlock_and_exit: | 575 | cleanup1: |
576 | ACPI_FREE(info); | ||
1057 | return_ACPI_STATUS(status); | 577 | return_ACPI_STATUS(status); |
1058 | } | 578 | } |
1059 | 579 | ||
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index 1474241bfc7e..3bb616794b3b 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c index f9661e2b46a9..f4b43bede015 100644 --- a/drivers/acpi/acpica/evsci.c +++ b/drivers/acpi/acpica/evsci.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -89,7 +89,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) | |||
89 | */ | 89 | */ |
90 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); | 90 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); |
91 | 91 | ||
92 | return_UINT32(interrupt_handled); | 92 | return_VALUE(interrupt_handled); |
93 | } | 93 | } |
94 | 94 | ||
95 | /******************************************************************************* | 95 | /******************************************************************************* |
@@ -120,7 +120,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) | |||
120 | 120 | ||
121 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); | 121 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); |
122 | 122 | ||
123 | return_UINT32(interrupt_handled); | 123 | return_VALUE(interrupt_handled); |
124 | } | 124 | } |
125 | 125 | ||
126 | /****************************************************************************** | 126 | /****************************************************************************** |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index ae668f32cf16..ddffd6847914 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -56,13 +56,13 @@ ACPI_MODULE_NAME("evxface") | |||
56 | * | 56 | * |
57 | * FUNCTION: acpi_install_notify_handler | 57 | * FUNCTION: acpi_install_notify_handler |
58 | * | 58 | * |
59 | * PARAMETERS: Device - The device for which notifies will be handled | 59 | * PARAMETERS: device - The device for which notifies will be handled |
60 | * handler_type - The type of handler: | 60 | * handler_type - The type of handler: |
61 | * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) | 61 | * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) |
62 | * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) | 62 | * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) |
63 | * ACPI_ALL_NOTIFY: Both System and Device | 63 | * ACPI_ALL_NOTIFY: Both System and Device |
64 | * Handler - Address of the handler | 64 | * handler - Address of the handler |
65 | * Context - Value passed to the handler on each GPE | 65 | * context - Value passed to the handler on each GPE |
66 | * | 66 | * |
67 | * RETURN: Status | 67 | * RETURN: Status |
68 | * | 68 | * |
@@ -217,12 +217,12 @@ ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) | |||
217 | * | 217 | * |
218 | * FUNCTION: acpi_remove_notify_handler | 218 | * FUNCTION: acpi_remove_notify_handler |
219 | * | 219 | * |
220 | * PARAMETERS: Device - The device for which the handler is installed | 220 | * PARAMETERS: device - The device for which the handler is installed |
221 | * handler_type - The type of handler: | 221 | * handler_type - The type of handler: |
222 | * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) | 222 | * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) |
223 | * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) | 223 | * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) |
224 | * ACPI_ALL_NOTIFY: Both System and Device | 224 | * ACPI_ALL_NOTIFY: Both System and Device |
225 | * Handler - Address of the handler | 225 | * handler - Address of the handler |
226 | * | 226 | * |
227 | * RETURN: Status | 227 | * RETURN: Status |
228 | * | 228 | * |
@@ -249,7 +249,8 @@ acpi_remove_notify_handler(acpi_handle device, | |||
249 | (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { | 249 | (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { |
250 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 250 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
251 | } | 251 | } |
252 | /* Make sure all deferred tasks are completed */ | 252 | |
253 | /* Make sure all deferred notify tasks are completed */ | ||
253 | 254 | ||
254 | acpi_os_wait_events_complete(); | 255 | acpi_os_wait_events_complete(); |
255 | 256 | ||
@@ -596,7 +597,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
596 | return_ACPI_STATUS(status); | 597 | return_ACPI_STATUS(status); |
597 | } | 598 | } |
598 | 599 | ||
599 | /* Allocate memory for the handler object */ | 600 | /* Allocate and init handler object (before lock) */ |
600 | 601 | ||
601 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_handler_info)); | 602 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_handler_info)); |
602 | if (!handler) { | 603 | if (!handler) { |
@@ -622,16 +623,15 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
622 | goto free_and_exit; | 623 | goto free_and_exit; |
623 | } | 624 | } |
624 | 625 | ||
625 | /* Allocate and init handler object */ | ||
626 | |||
627 | handler->address = address; | 626 | handler->address = address; |
628 | handler->context = context; | 627 | handler->context = context; |
629 | handler->method_node = gpe_event_info->dispatch.method_node; | 628 | handler->method_node = gpe_event_info->dispatch.method_node; |
630 | handler->original_flags = gpe_event_info->flags & | 629 | handler->original_flags = (u8)(gpe_event_info->flags & |
631 | (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); | 630 | (ACPI_GPE_XRUPT_TYPE_MASK | |
631 | ACPI_GPE_DISPATCH_MASK)); | ||
632 | 632 | ||
633 | /* | 633 | /* |
634 | * If the GPE is associated with a method, it might have been enabled | 634 | * If the GPE is associated with a method, it may have been enabled |
635 | * automatically during initialization, in which case it has to be | 635 | * automatically during initialization, in which case it has to be |
636 | * disabled now to avoid spurious execution of the handler. | 636 | * disabled now to avoid spurious execution of the handler. |
637 | */ | 637 | */ |
@@ -646,7 +646,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
646 | 646 | ||
647 | gpe_event_info->dispatch.handler = handler; | 647 | gpe_event_info->dispatch.handler = handler; |
648 | 648 | ||
649 | /* Setup up dispatch flags to indicate handler (vs. method) */ | 649 | /* Setup up dispatch flags to indicate handler (vs. method/notify) */ |
650 | 650 | ||
651 | gpe_event_info->flags &= | 651 | gpe_event_info->flags &= |
652 | ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); | 652 | ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); |
@@ -697,7 +697,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
697 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 697 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
698 | } | 698 | } |
699 | 699 | ||
700 | /* Make sure all deferred tasks are completed */ | 700 | /* Make sure all deferred GPE tasks are completed */ |
701 | 701 | ||
702 | acpi_os_wait_events_complete(); | 702 | acpi_os_wait_events_complete(); |
703 | 703 | ||
@@ -747,10 +747,10 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
747 | * enabled, it should be enabled at this point to restore the | 747 | * enabled, it should be enabled at this point to restore the |
748 | * post-initialization configuration. | 748 | * post-initialization configuration. |
749 | */ | 749 | */ |
750 | 750 | if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) && | |
751 | if ((handler->original_flags & ACPI_GPE_DISPATCH_METHOD) | 751 | handler->originally_enabled) { |
752 | && handler->originally_enabled) | ||
753 | (void)acpi_ev_add_gpe_reference(gpe_event_info); | 752 | (void)acpi_ev_add_gpe_reference(gpe_event_info); |
753 | } | ||
754 | 754 | ||
755 | /* Now we can free the handler object */ | 755 | /* Now we can free the handler object */ |
756 | 756 | ||
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 35520c6eeefb..d6e4e42316db 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -61,7 +61,6 @@ ACPI_MODULE_NAME("evxfevnt") | |||
61 | * DESCRIPTION: Transfers the system into ACPI mode. | 61 | * DESCRIPTION: Transfers the system into ACPI mode. |
62 | * | 62 | * |
63 | ******************************************************************************/ | 63 | ******************************************************************************/ |
64 | |||
65 | acpi_status acpi_enable(void) | 64 | acpi_status acpi_enable(void) |
66 | { | 65 | { |
67 | acpi_status status; | 66 | acpi_status status; |
@@ -210,8 +209,8 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event) | |||
210 | * | 209 | * |
211 | * FUNCTION: acpi_disable_event | 210 | * FUNCTION: acpi_disable_event |
212 | * | 211 | * |
213 | * PARAMETERS: Event - The fixed eventto be enabled | 212 | * PARAMETERS: event - The fixed event to be disabled |
214 | * Flags - Reserved | 213 | * flags - Reserved |
215 | * | 214 | * |
216 | * RETURN: Status | 215 | * RETURN: Status |
217 | * | 216 | * |
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 3f30e753b652..aff4cc261211 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -51,7 +51,7 @@ | |||
51 | ACPI_MODULE_NAME("evxfgpe") | 51 | ACPI_MODULE_NAME("evxfgpe") |
52 | 52 | ||
53 | #if (!ACPI_REDUCED_HARDWARE) /* Entire module */ | 53 | #if (!ACPI_REDUCED_HARDWARE) /* Entire module */ |
54 | /****************************************************************************** | 54 | /******************************************************************************* |
55 | * | 55 | * |
56 | * FUNCTION: acpi_update_all_gpes | 56 | * FUNCTION: acpi_update_all_gpes |
57 | * | 57 | * |
@@ -172,6 +172,7 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) | |||
172 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 172 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
173 | return_ACPI_STATUS(status); | 173 | return_ACPI_STATUS(status); |
174 | } | 174 | } |
175 | |||
175 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | 176 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) |
176 | 177 | ||
177 | 178 | ||
@@ -225,7 +226,7 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, | |||
225 | ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); | 226 | ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); |
226 | } | 227 | } |
227 | 228 | ||
228 | /* Validate WakeDevice is of type Device */ | 229 | /* Validate wake_device is of type Device */ |
229 | 230 | ||
230 | if (device_node->type != ACPI_TYPE_DEVICE) { | 231 | if (device_node->type != ACPI_TYPE_DEVICE) { |
231 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 232 | return_ACPI_STATUS (AE_BAD_PARAMETER); |
@@ -432,8 +433,8 @@ ACPI_EXPORT_SYMBOL(acpi_clear_gpe) | |||
432 | * | 433 | * |
433 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | 434 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
434 | * gpe_number - GPE level within the GPE block | 435 | * gpe_number - GPE level within the GPE block |
435 | * event_status - Where the current status of the event will | 436 | * event_status - Where the current status of the event |
436 | * be returned | 437 | * will be returned |
437 | * | 438 | * |
438 | * RETURN: Status | 439 | * RETURN: Status |
439 | * | 440 | * |
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index 96b412d03950..96c9e5f355ae 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 16219bde48da..d93b70be60ad 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -48,6 +48,7 @@ | |||
48 | #include "actables.h" | 48 | #include "actables.h" |
49 | #include "acdispat.h" | 49 | #include "acdispat.h" |
50 | #include "acevents.h" | 50 | #include "acevents.h" |
51 | #include "amlcode.h" | ||
51 | 52 | ||
52 | #define _COMPONENT ACPI_EXECUTER | 53 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME("exconfig") | 54 | ACPI_MODULE_NAME("exconfig") |
@@ -120,8 +121,11 @@ acpi_ex_add_table(u32 table_index, | |||
120 | acpi_ns_exec_module_code_list(); | 121 | acpi_ns_exec_module_code_list(); |
121 | acpi_ex_enter_interpreter(); | 122 | acpi_ex_enter_interpreter(); |
122 | 123 | ||
123 | /* Update GPEs for any new _Lxx/_Exx methods. Ignore errors */ | 124 | /* |
124 | 125 | * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is | |
126 | * responsible for discovering any new wake GPEs by running _PRW methods | ||
127 | * that may have been loaded by this table. | ||
128 | */ | ||
125 | status = acpi_tb_get_owner_id(table_index, &owner_id); | 129 | status = acpi_tb_get_owner_id(table_index, &owner_id); |
126 | if (ACPI_SUCCESS(status)) { | 130 | if (ACPI_SUCCESS(status)) { |
127 | acpi_ev_update_gpes(owner_id); | 131 | acpi_ev_update_gpes(owner_id); |
@@ -158,12 +162,12 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
158 | 162 | ||
159 | ACPI_FUNCTION_TRACE(ex_load_table_op); | 163 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
160 | 164 | ||
161 | /* Validate lengths for the signature_string, OEMIDString, OEMtable_iD */ | 165 | /* Validate lengths for the Signature, oem_id, and oem_table_id strings */ |
162 | 166 | ||
163 | if ((operand[0]->string.length > ACPI_NAME_SIZE) || | 167 | if ((operand[0]->string.length > ACPI_NAME_SIZE) || |
164 | (operand[1]->string.length > ACPI_OEM_ID_SIZE) || | 168 | (operand[1]->string.length > ACPI_OEM_ID_SIZE) || |
165 | (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) { | 169 | (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) { |
166 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 170 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
167 | } | 171 | } |
168 | 172 | ||
169 | /* Find the ACPI table in the RSDT/XSDT */ | 173 | /* Find the ACPI table in the RSDT/XSDT */ |
@@ -210,8 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
210 | /* parameter_path (optional parameter) */ | 214 | /* parameter_path (optional parameter) */ |
211 | 215 | ||
212 | if (operand[4]->string.length > 0) { | 216 | if (operand[4]->string.length > 0) { |
213 | if ((operand[4]->string.pointer[0] != '\\') && | 217 | if ((operand[4]->string.pointer[0] != AML_ROOT_PREFIX) && |
214 | (operand[4]->string.pointer[0] != '^')) { | 218 | (operand[4]->string.pointer[0] != AML_PARENT_PREFIX)) { |
215 | /* | 219 | /* |
216 | * Path is not absolute, so it will be relative to the node | 220 | * Path is not absolute, so it will be relative to the node |
217 | * referenced by the root_path_string (or the NS root if omitted) | 221 | * referenced by the root_path_string (or the NS root if omitted) |
@@ -301,7 +305,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) | |||
301 | acpi_ev_address_space_dispatch(obj_desc, NULL, ACPI_READ, | 305 | acpi_ev_address_space_dispatch(obj_desc, NULL, ACPI_READ, |
302 | region_offset, 8, &value); | 306 | region_offset, 8, &value); |
303 | if (ACPI_FAILURE(status)) { | 307 | if (ACPI_FAILURE(status)) { |
304 | return status; | 308 | return (status); |
305 | } | 309 | } |
306 | 310 | ||
307 | *buffer = (u8)value; | 311 | *buffer = (u8)value; |
@@ -309,7 +313,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) | |||
309 | region_offset++; | 313 | region_offset++; |
310 | } | 314 | } |
311 | 315 | ||
312 | return AE_OK; | 316 | return (AE_OK); |
313 | } | 317 | } |
314 | 318 | ||
315 | /******************************************************************************* | 319 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 4492a4e03022..d2b9613bbf01 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -176,7 +176,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
176 | 176 | ||
177 | /* Save the Result */ | 177 | /* Save the Result */ |
178 | 178 | ||
179 | acpi_ex_truncate_for32bit_table(return_desc); | 179 | (void)acpi_ex_truncate_for32bit_table(return_desc); |
180 | *result_desc = return_desc; | 180 | *result_desc = return_desc; |
181 | return_ACPI_STATUS(AE_OK); | 181 | return_ACPI_STATUS(AE_OK); |
182 | } | 182 | } |
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index 66554bc6f9a8..26a13f67977e 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c index d7c9f51608a7..7eb853cd279f 100644 --- a/drivers/acpi/acpica/exdebug.c +++ b/drivers/acpi/acpica/exdebug.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index 858b43a7dcf6..e5a3c249f7fa 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -464,9 +464,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
464 | 464 | ||
465 | ACPI_FUNCTION_NAME(ex_dump_operand) | 465 | ACPI_FUNCTION_NAME(ex_dump_operand) |
466 | 466 | ||
467 | if (! | 467 | /* Check if debug output enabled */ |
468 | ((ACPI_LV_EXEC & acpi_dbg_level) | 468 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) { |
469 | && (_COMPONENT & acpi_dbg_layer))) { | ||
470 | return; | 469 | return; |
471 | } | 470 | } |
472 | 471 | ||
@@ -811,9 +810,10 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) | |||
811 | ACPI_FUNCTION_ENTRY(); | 810 | ACPI_FUNCTION_ENTRY(); |
812 | 811 | ||
813 | if (!flags) { | 812 | if (!flags) { |
814 | if (! | 813 | |
815 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | 814 | /* Check if debug output enabled */ |
816 | && (_COMPONENT & acpi_dbg_layer))) { | 815 | |
816 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) { | ||
817 | return; | 817 | return; |
818 | } | 818 | } |
819 | } | 819 | } |
@@ -999,9 +999,10 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
999 | } | 999 | } |
1000 | 1000 | ||
1001 | if (!flags) { | 1001 | if (!flags) { |
1002 | if (! | 1002 | |
1003 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | 1003 | /* Check if debug output enabled */ |
1004 | && (_COMPONENT & acpi_dbg_layer))) { | 1004 | |
1005 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) { | ||
1005 | return_VOID; | 1006 | return_VOID; |
1006 | } | 1007 | } |
1007 | } | 1008 | } |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index ebc55fbf3ff7..7d4bae71e8c6 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index aa2ccfb7cb61..ec7f5690031b 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -329,7 +329,6 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
329 | static u8 | 329 | static u8 |
330 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value) | 330 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value) |
331 | { | 331 | { |
332 | ACPI_FUNCTION_NAME(ex_register_overflow); | ||
333 | 332 | ||
334 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { | 333 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { |
335 | /* | 334 | /* |
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index 84058705ed12..72a2a13b6d36 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index d1f449d93dcf..7be0205ad067 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -377,7 +377,8 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
377 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); | 377 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); |
378 | } | 378 | } |
379 | 379 | ||
380 | /* Must have a valid thread. */ | 380 | /* Must have a valid thread ID */ |
381 | |||
381 | if (!walk_state->thread) { | 382 | if (!walk_state->thread) { |
382 | ACPI_ERROR((AE_INFO, | 383 | ACPI_ERROR((AE_INFO, |
383 | "Cannot release Mutex [%4.4s], null thread info", | 384 | "Cannot release Mutex [%4.4s], null thread info", |
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c index 2ff578a16adc..14689dec4960 100644 --- a/drivers/acpi/acpica/exnames.c +++ b/drivers/acpi/acpica/exnames.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index bbf01e9bf057..b60c877f5906 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -948,13 +948,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
948 | */ | 948 | */ |
949 | return_desc = | 949 | return_desc = |
950 | acpi_ut_create_integer_object((u64) | 950 | acpi_ut_create_integer_object((u64) |
951 | temp_desc-> | 951 | temp_desc->buffer.pointer[operand[0]->reference.value]); |
952 | buffer. | ||
953 | pointer | ||
954 | [operand | ||
955 | [0]-> | ||
956 | reference. | ||
957 | value]); | ||
958 | if (!return_desc) { | 952 | if (!return_desc) { |
959 | status = AE_NO_MEMORY; | 953 | status = AE_NO_MEMORY; |
960 | goto cleanup; | 954 | goto cleanup; |
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index ee5634a074c4..e491e46f17df 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index 2c89b4651f08..2d7491f3126e 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index 3e08695c3b30..b76b97002dff 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index ba9db4de7c89..d6eab81f54fb 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
276 | /* Invalid field access type */ | 276 | /* Invalid field access type */ |
277 | 277 | ||
278 | ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); | 278 | ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); |
279 | return_UINT32(0); | 279 | return_VALUE(0); |
280 | } | 280 | } |
281 | 281 | ||
282 | if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) { | 282 | if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) { |
@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | *return_byte_alignment = byte_alignment; | 291 | *return_byte_alignment = byte_alignment; |
292 | return_UINT32(bit_length); | 292 | return_VALUE(bit_length); |
293 | } | 293 | } |
294 | 294 | ||
295 | /******************************************************************************* | 295 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 1db2c0bfde0b..182abaf045e1 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -142,9 +142,9 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * Attempt to map from the requested address to the end of the region. | 145 | * October 2009: Attempt to map from the requested address to the |
146 | * However, we will never map more than one page, nor will we cross | 146 | * end of the region. However, we will never map more than one |
147 | * a page boundary. | 147 | * page, nor will we cross a page boundary. |
148 | */ | 148 | */ |
149 | map_length = (acpi_size) | 149 | map_length = (acpi_size) |
150 | ((mem_info->address + mem_info->length) - address); | 150 | ((mem_info->address + mem_info->length) - address); |
@@ -154,12 +154,15 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
154 | * a page boundary, just map up to the page boundary, do not cross. | 154 | * a page boundary, just map up to the page boundary, do not cross. |
155 | * On some systems, crossing a page boundary while mapping regions | 155 | * On some systems, crossing a page boundary while mapping regions |
156 | * can cause warnings if the pages have different attributes | 156 | * can cause warnings if the pages have different attributes |
157 | * due to resource management | 157 | * due to resource management. |
158 | * | ||
159 | * This has the added benefit of constraining a single mapping to | ||
160 | * one page, which is similar to the original code that used a 4k | ||
161 | * maximum window. | ||
158 | */ | 162 | */ |
159 | page_boundary_map_length = | 163 | page_boundary_map_length = |
160 | ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address; | 164 | ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address; |
161 | 165 | if (page_boundary_map_length == 0) { | |
162 | if (!page_boundary_map_length) { | ||
163 | page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE; | 166 | page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE; |
164 | } | 167 | } |
165 | 168 | ||
@@ -236,19 +239,19 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
236 | 239 | ||
237 | switch (bit_width) { | 240 | switch (bit_width) { |
238 | case 8: | 241 | case 8: |
239 | ACPI_SET8(logical_addr_ptr) = (u8) * value; | 242 | ACPI_SET8(logical_addr_ptr, *value); |
240 | break; | 243 | break; |
241 | 244 | ||
242 | case 16: | 245 | case 16: |
243 | ACPI_SET16(logical_addr_ptr) = (u16) * value; | 246 | ACPI_SET16(logical_addr_ptr, *value); |
244 | break; | 247 | break; |
245 | 248 | ||
246 | case 32: | 249 | case 32: |
247 | ACPI_SET32(logical_addr_ptr) = (u32) * value; | 250 | ACPI_SET32(logical_addr_ptr, *value); |
248 | break; | 251 | break; |
249 | 252 | ||
250 | case 64: | 253 | case 64: |
251 | ACPI_SET64(logical_addr_ptr) = (u64) * value; | 254 | ACPI_SET64(logical_addr_ptr, *value); |
252 | break; | 255 | break; |
253 | 256 | ||
254 | default: | 257 | default: |
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c index 6239956786eb..8565b6bd12bb 100644 --- a/drivers/acpi/acpica/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index cc176b245e22..e4f9dfbb2a13 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c index b9ebff2f6a09..9fb9f5e9a4da 100644 --- a/drivers/acpi/acpica/exresop.c +++ b/drivers/acpi/acpica/exresop.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index 90431f12f831..93c6049c2d75 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -487,14 +487,33 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
487 | default: | 487 | default: |
488 | 488 | ||
489 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 489 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
490 | "Storing %s (%p) directly into node (%p) with no implicit conversion\n", | 490 | "Storing [%s] (%p) directly into node [%s] (%p)" |
491 | " with no implicit conversion\n", | ||
491 | acpi_ut_get_object_type_name(source_desc), | 492 | acpi_ut_get_object_type_name(source_desc), |
492 | source_desc, node)); | 493 | source_desc, |
494 | acpi_ut_get_object_type_name(target_desc), | ||
495 | node)); | ||
493 | 496 | ||
494 | /* No conversions for all other types. Just attach the source object */ | 497 | /* |
498 | * No conversions for all other types. Directly store a copy of | ||
499 | * the source object. NOTE: This is a departure from the ACPI | ||
500 | * spec, which states "If conversion is impossible, abort the | ||
501 | * running control method". | ||
502 | * | ||
503 | * This code implements "If conversion is impossible, treat the | ||
504 | * Store operation as a CopyObject". | ||
505 | */ | ||
506 | status = | ||
507 | acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc, | ||
508 | walk_state); | ||
509 | if (ACPI_FAILURE(status)) { | ||
510 | return_ACPI_STATUS(status); | ||
511 | } | ||
495 | 512 | ||
496 | status = acpi_ns_attach_object(node, source_desc, | 513 | status = |
497 | source_desc->common.type); | 514 | acpi_ns_attach_object(node, new_desc, |
515 | new_desc->common.type); | ||
516 | acpi_ut_remove_reference(new_desc); | ||
498 | break; | 517 | break; |
499 | } | 518 | } |
500 | 519 | ||
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c index 87153bbc4b43..1cefe777068e 100644 --- a/drivers/acpi/acpica/exstoren.c +++ b/drivers/acpi/acpica/exstoren.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -253,7 +253,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
253 | 253 | ||
254 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 254 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
255 | 255 | ||
256 | acpi_ex_truncate_for32bit_table(dest_desc); | 256 | (void)acpi_ex_truncate_for32bit_table(dest_desc); |
257 | break; | 257 | break; |
258 | 258 | ||
259 | case ACPI_TYPE_STRING: | 259 | case ACPI_TYPE_STRING: |
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c index b5f339cb1305..26e371073b1a 100644 --- a/drivers/acpi/acpica/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index c8a0ad5c1f55..6578dee2e51b 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 264d22d8018c..b205cbb4b50c 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -202,35 +202,39 @@ void acpi_ex_relinquish_interpreter(void) | |||
202 | * | 202 | * |
203 | * PARAMETERS: obj_desc - Object to be truncated | 203 | * PARAMETERS: obj_desc - Object to be truncated |
204 | * | 204 | * |
205 | * RETURN: none | 205 | * RETURN: TRUE if a truncation was performed, FALSE otherwise. |
206 | * | 206 | * |
207 | * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is | 207 | * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is |
208 | * 32-bit, as determined by the revision of the DSDT. | 208 | * 32-bit, as determined by the revision of the DSDT. |
209 | * | 209 | * |
210 | ******************************************************************************/ | 210 | ******************************************************************************/ |
211 | 211 | ||
212 | void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | 212 | u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) |
213 | { | 213 | { |
214 | 214 | ||
215 | ACPI_FUNCTION_ENTRY(); | 215 | ACPI_FUNCTION_ENTRY(); |
216 | 216 | ||
217 | /* | 217 | /* |
218 | * Object must be a valid number and we must be executing | 218 | * Object must be a valid number and we must be executing |
219 | * a control method. NS node could be there for AML_INT_NAMEPATH_OP. | 219 | * a control method. Object could be NS node for AML_INT_NAMEPATH_OP. |
220 | */ | 220 | */ |
221 | if ((!obj_desc) || | 221 | if ((!obj_desc) || |
222 | (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || | 222 | (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || |
223 | (obj_desc->common.type != ACPI_TYPE_INTEGER)) { | 223 | (obj_desc->common.type != ACPI_TYPE_INTEGER)) { |
224 | return; | 224 | return (FALSE); |
225 | } | 225 | } |
226 | 226 | ||
227 | if (acpi_gbl_integer_byte_width == 4) { | 227 | if ((acpi_gbl_integer_byte_width == 4) && |
228 | (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) { | ||
228 | /* | 229 | /* |
229 | * We are running a method that exists in a 32-bit ACPI table. | 230 | * We are executing in a 32-bit ACPI table. |
230 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field | 231 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field |
231 | */ | 232 | */ |
232 | obj_desc->integer.value &= (u64) ACPI_UINT32_MAX; | 233 | obj_desc->integer.value &= (u64)ACPI_UINT32_MAX; |
234 | return (TRUE); | ||
233 | } | 235 | } |
236 | |||
237 | return (FALSE); | ||
234 | } | 238 | } |
235 | 239 | ||
236 | /******************************************************************************* | 240 | /******************************************************************************* |
@@ -336,7 +340,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base) | |||
336 | /* u64 is unsigned, so we don't worry about a '-' prefix */ | 340 | /* u64 is unsigned, so we don't worry about a '-' prefix */ |
337 | 341 | ||
338 | if (value == 0) { | 342 | if (value == 0) { |
339 | return_UINT32(1); | 343 | return_VALUE(1); |
340 | } | 344 | } |
341 | 345 | ||
342 | current_value = value; | 346 | current_value = value; |
@@ -350,7 +354,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base) | |||
350 | num_digits++; | 354 | num_digits++; |
351 | } | 355 | } |
352 | 356 | ||
353 | return_UINT32(num_digits); | 357 | return_VALUE(num_digits); |
354 | } | 358 | } |
355 | 359 | ||
356 | /******************************************************************************* | 360 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c index 90a9aea1cee9..deb3f61e2bd1 100644 --- a/drivers/acpi/acpica/hwacpi.c +++ b/drivers/acpi/acpica/hwacpi.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -108,8 +108,7 @@ acpi_status acpi_hw_set_mode(u32 mode) | |||
108 | * enable bits to default | 108 | * enable bits to default |
109 | */ | 109 | */ |
110 | status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, | 110 | status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, |
111 | (u32) acpi_gbl_FADT.acpi_disable, | 111 | (u32)acpi_gbl_FADT.acpi_disable, 8); |
112 | 8); | ||
113 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 112 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
114 | "Attempting to enable Legacy (non-ACPI) mode\n")); | 113 | "Attempting to enable Legacy (non-ACPI) mode\n")); |
115 | break; | 114 | break; |
@@ -152,18 +151,18 @@ u32 acpi_hw_get_mode(void) | |||
152 | * system does not support mode transition. | 151 | * system does not support mode transition. |
153 | */ | 152 | */ |
154 | if (!acpi_gbl_FADT.smi_command) { | 153 | if (!acpi_gbl_FADT.smi_command) { |
155 | return_UINT32(ACPI_SYS_MODE_ACPI); | 154 | return_VALUE(ACPI_SYS_MODE_ACPI); |
156 | } | 155 | } |
157 | 156 | ||
158 | status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); | 157 | status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); |
159 | if (ACPI_FAILURE(status)) { | 158 | if (ACPI_FAILURE(status)) { |
160 | return_UINT32(ACPI_SYS_MODE_LEGACY); | 159 | return_VALUE(ACPI_SYS_MODE_LEGACY); |
161 | } | 160 | } |
162 | 161 | ||
163 | if (value) { | 162 | if (value) { |
164 | return_UINT32(ACPI_SYS_MODE_ACPI); | 163 | return_VALUE(ACPI_SYS_MODE_ACPI); |
165 | } else { | 164 | } else { |
166 | return_UINT32(ACPI_SYS_MODE_LEGACY); | 165 | return_VALUE(ACPI_SYS_MODE_LEGACY); |
167 | } | 166 | } |
168 | } | 167 | } |
169 | 168 | ||
diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c index 94996f9ae3ad..5e5f76230f5e 100644 --- a/drivers/acpi/acpica/hwesleep.c +++ b/drivers/acpi/acpica/hwesleep.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -200,7 +200,6 @@ acpi_status acpi_hw_extended_wake_prep(u8 sleep_state) | |||
200 | * FUNCTION: acpi_hw_extended_wake | 200 | * FUNCTION: acpi_hw_extended_wake |
201 | * | 201 | * |
202 | * PARAMETERS: sleep_state - Which sleep state we just exited | 202 | * PARAMETERS: sleep_state - Which sleep state we just exited |
203 | * flags - Reserved, set to zero | ||
204 | * | 203 | * |
205 | * RETURN: Status | 204 | * RETURN: Status |
206 | * | 205 | * |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 64560045052d..20d02e93c990 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -69,8 +69,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
69 | 69 | ||
70 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info) | 70 | u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info) |
71 | { | 71 | { |
72 | return (u32)1 << (gpe_event_info->gpe_number - | 72 | |
73 | gpe_event_info->register_info->base_gpe_number); | 73 | return ((u32)1 << |
74 | (gpe_event_info->gpe_number - | ||
75 | gpe_event_info->register_info->base_gpe_number)); | ||
74 | } | 76 | } |
75 | 77 | ||
76 | /****************************************************************************** | 78 | /****************************************************************************** |
@@ -133,7 +135,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) | |||
133 | break; | 135 | break; |
134 | 136 | ||
135 | default: | 137 | default: |
136 | ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u\n", action)); | 138 | ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u", action)); |
137 | return (AE_BAD_PARAMETER); | 139 | return (AE_BAD_PARAMETER); |
138 | } | 140 | } |
139 | 141 | ||
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c index 65bc3453a29c..0889a629505f 100644 --- a/drivers/acpi/acpica/hwpci.c +++ b/drivers/acpi/acpica/hwpci.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index f4e57503576b..083d6551f0e2 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -44,7 +44,6 @@ | |||
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | ||
48 | #include "acevents.h" | 47 | #include "acevents.h" |
49 | 48 | ||
50 | #define _COMPONENT ACPI_HARDWARE | 49 | #define _COMPONENT ACPI_HARDWARE |
@@ -364,8 +363,7 @@ acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control) | |||
364 | * DESCRIPTION: Read from the specified ACPI register | 363 | * DESCRIPTION: Read from the specified ACPI register |
365 | * | 364 | * |
366 | ******************************************************************************/ | 365 | ******************************************************************************/ |
367 | acpi_status | 366 | acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value) |
368 | acpi_hw_register_read(u32 register_id, u32 * return_value) | ||
369 | { | 367 | { |
370 | u32 value = 0; | 368 | u32 value = 0; |
371 | acpi_status status; | 369 | acpi_status status; |
@@ -485,7 +483,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) | |||
485 | &acpi_gbl_xpm1b_status); | 483 | &acpi_gbl_xpm1b_status); |
486 | break; | 484 | break; |
487 | 485 | ||
488 | case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access */ | 486 | case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ |
489 | 487 | ||
490 | status = acpi_hw_write_multiple(value, | 488 | status = acpi_hw_write_multiple(value, |
491 | &acpi_gbl_xpm1a_enable, | 489 | &acpi_gbl_xpm1a_enable, |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 3fddde056a5e..e3828cc4361b 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <linux/acpi.h> | 46 | #include <linux/acpi.h> |
47 | #include "accommon.h" | 47 | #include "accommon.h" |
48 | #include <linux/module.h> | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_HARDWARE | 49 | #define _COMPONENT ACPI_HARDWARE |
51 | ACPI_MODULE_NAME("hwsleep") | 50 | ACPI_MODULE_NAME("hwsleep") |
@@ -178,7 +177,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) | |||
178 | * to still read the right value. Ideally, this block would go | 177 | * to still read the right value. Ideally, this block would go |
179 | * away entirely. | 178 | * away entirely. |
180 | */ | 179 | */ |
181 | acpi_os_stall(10000000); | 180 | acpi_os_stall(10 * ACPI_USEC_PER_SEC); |
182 | 181 | ||
183 | status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL, | 182 | status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL, |
184 | sleep_enable_reg_info-> | 183 | sleep_enable_reg_info-> |
@@ -323,7 +322,8 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state) | |||
323 | * and use it to determine whether the system is rebooting or | 322 | * and use it to determine whether the system is rebooting or |
324 | * resuming. Clear WAK_STS for compatibility. | 323 | * resuming. Clear WAK_STS for compatibility. |
325 | */ | 324 | */ |
326 | acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, 1); | 325 | (void)acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, |
326 | ACPI_CLEAR_STATUS); | ||
327 | acpi_gbl_system_awake_and_running = TRUE; | 327 | acpi_gbl_system_awake_and_running = TRUE; |
328 | 328 | ||
329 | /* Enable power button */ | 329 | /* Enable power button */ |
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c index bfdce22f3798..0c1a8bbd05d6 100644 --- a/drivers/acpi/acpica/hwtimer.c +++ b/drivers/acpi/acpica/hwtimer.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -176,10 +176,11 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
176 | /* | 176 | /* |
177 | * Compute Duration (Requires a 64-bit multiply and divide): | 177 | * Compute Duration (Requires a 64-bit multiply and divide): |
178 | * | 178 | * |
179 | * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY; | 179 | * time_elapsed (microseconds) = |
180 | * (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY; | ||
180 | */ | 181 | */ |
181 | status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000, | 182 | status = acpi_ut_short_divide(((u64)delta_ticks) * ACPI_USEC_PER_SEC, |
182 | PM_TIMER_FREQUENCY, "ient, NULL); | 183 | ACPI_PM_TIMER_FREQUENCY, "ient, NULL); |
183 | 184 | ||
184 | *time_elapsed = (u32) quotient; | 185 | *time_elapsed = (u32) quotient; |
185 | return_ACPI_STATUS(status); | 186 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index b6aae58299dc..eab70d58852a 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -135,7 +135,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
135 | if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) { | 135 | if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) { |
136 | ACPI_ERROR((AE_INFO, | 136 | ACPI_ERROR((AE_INFO, |
137 | "Bad BitWidth parameter: %8.8X", bit_width)); | 137 | "Bad BitWidth parameter: %8.8X", bit_width)); |
138 | return AE_BAD_PARAMETER; | 138 | return (AE_BAD_PARAMETER); |
139 | } | 139 | } |
140 | 140 | ||
141 | port_info = acpi_protected_ports; | 141 | port_info = acpi_protected_ports; |
@@ -234,11 +234,11 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
234 | status = acpi_hw_validate_io_request(address, width); | 234 | status = acpi_hw_validate_io_request(address, width); |
235 | if (ACPI_SUCCESS(status)) { | 235 | if (ACPI_SUCCESS(status)) { |
236 | status = acpi_os_read_port(address, value, width); | 236 | status = acpi_os_read_port(address, value, width); |
237 | return status; | 237 | return (status); |
238 | } | 238 | } |
239 | 239 | ||
240 | if (status != AE_AML_ILLEGAL_ADDRESS) { | 240 | if (status != AE_AML_ILLEGAL_ADDRESS) { |
241 | return status; | 241 | return (status); |
242 | } | 242 | } |
243 | 243 | ||
244 | /* | 244 | /* |
@@ -253,7 +253,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
253 | if (acpi_hw_validate_io_request(address, 8) == AE_OK) { | 253 | if (acpi_hw_validate_io_request(address, 8) == AE_OK) { |
254 | status = acpi_os_read_port(address, &one_byte, 8); | 254 | status = acpi_os_read_port(address, &one_byte, 8); |
255 | if (ACPI_FAILURE(status)) { | 255 | if (ACPI_FAILURE(status)) { |
256 | return status; | 256 | return (status); |
257 | } | 257 | } |
258 | 258 | ||
259 | *value |= (one_byte << i); | 259 | *value |= (one_byte << i); |
@@ -262,7 +262,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
262 | address++; | 262 | address++; |
263 | } | 263 | } |
264 | 264 | ||
265 | return AE_OK; | 265 | return (AE_OK); |
266 | } | 266 | } |
267 | 267 | ||
268 | /****************************************************************************** | 268 | /****************************************************************************** |
@@ -297,11 +297,11 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) | |||
297 | status = acpi_hw_validate_io_request(address, width); | 297 | status = acpi_hw_validate_io_request(address, width); |
298 | if (ACPI_SUCCESS(status)) { | 298 | if (ACPI_SUCCESS(status)) { |
299 | status = acpi_os_write_port(address, value, width); | 299 | status = acpi_os_write_port(address, value, width); |
300 | return status; | 300 | return (status); |
301 | } | 301 | } |
302 | 302 | ||
303 | if (status != AE_AML_ILLEGAL_ADDRESS) { | 303 | if (status != AE_AML_ILLEGAL_ADDRESS) { |
304 | return status; | 304 | return (status); |
305 | } | 305 | } |
306 | 306 | ||
307 | /* | 307 | /* |
@@ -317,12 +317,12 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) | |||
317 | status = | 317 | status = |
318 | acpi_os_write_port(address, (value >> i) & 0xFF, 8); | 318 | acpi_os_write_port(address, (value >> i) & 0xFF, 8); |
319 | if (ACPI_FAILURE(status)) { | 319 | if (ACPI_FAILURE(status)) { |
320 | return status; | 320 | return (status); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | address++; | 324 | address++; |
325 | } | 325 | } |
326 | 326 | ||
327 | return AE_OK; | 327 | return (AE_OK); |
328 | } | 328 | } |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index 05a154c3c9ac..04c2e16f2c0a 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -80,10 +80,10 @@ acpi_status acpi_reset(void) | |||
80 | 80 | ||
81 | if (reset_reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { | 81 | if (reset_reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { |
82 | /* | 82 | /* |
83 | * For I/O space, write directly to the OSL. This | 83 | * For I/O space, write directly to the OSL. This bypasses the port |
84 | * bypasses the port validation mechanism, which may | 84 | * validation mechanism, which may block a valid write to the reset |
85 | * block a valid write to the reset register. Spec | 85 | * register. |
86 | * section 4.7.3.6 requires register width to be 8. | 86 | * Spec section 4.7.3.6 requires register width to be 8. |
87 | */ | 87 | */ |
88 | status = | 88 | status = |
89 | acpi_os_write_port((acpi_io_address) reset_reg->address, | 89 | acpi_os_write_port((acpi_io_address) reset_reg->address, |
@@ -333,7 +333,7 @@ ACPI_EXPORT_SYMBOL(acpi_read_bit_register) | |||
333 | * FUNCTION: acpi_write_bit_register | 333 | * FUNCTION: acpi_write_bit_register |
334 | * | 334 | * |
335 | * PARAMETERS: register_id - ID of ACPI Bit Register to access | 335 | * PARAMETERS: register_id - ID of ACPI Bit Register to access |
336 | * Value - Value to write to the register, in bit | 336 | * value - Value to write to the register, in bit |
337 | * position zero. The bit is automatically | 337 | * position zero. The bit is automatically |
338 | * shifted to the correct position. | 338 | * shifted to the correct position. |
339 | * | 339 | * |
@@ -440,17 +440,41 @@ ACPI_EXPORT_SYMBOL(acpi_write_bit_register) | |||
440 | * *sleep_type_a - Where SLP_TYPa is returned | 440 | * *sleep_type_a - Where SLP_TYPa is returned |
441 | * *sleep_type_b - Where SLP_TYPb is returned | 441 | * *sleep_type_b - Where SLP_TYPb is returned |
442 | * | 442 | * |
443 | * RETURN: status - ACPI status | 443 | * RETURN: Status |
444 | * | ||
445 | * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested | ||
446 | * sleep state via the appropriate \_Sx object. | ||
447 | * | ||
448 | * The sleep state package returned from the corresponding \_Sx_ object | ||
449 | * must contain at least one integer. | ||
450 | * | ||
451 | * March 2005: | ||
452 | * Added support for a package that contains two integers. This | ||
453 | * goes against the ACPI specification which defines this object as a | ||
454 | * package with one encoded DWORD integer. However, existing practice | ||
455 | * by many BIOS vendors is to return a package with 2 or more integer | ||
456 | * elements, at least one per sleep type (A/B). | ||
444 | * | 457 | * |
445 | * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep | 458 | * January 2013: |
446 | * state. | 459 | * Therefore, we must be prepared to accept a package with either a |
460 | * single integer or multiple integers. | ||
461 | * | ||
462 | * The single integer DWORD format is as follows: | ||
463 | * BYTE 0 - Value for the PM1A SLP_TYP register | ||
464 | * BYTE 1 - Value for the PM1B SLP_TYP register | ||
465 | * BYTE 2-3 - Reserved | ||
466 | * | ||
467 | * The dual integer format is as follows: | ||
468 | * Integer 0 - Value for the PM1A SLP_TYP register | ||
469 | * Integer 1 - Value for the PM1A SLP_TYP register | ||
447 | * | 470 | * |
448 | ******************************************************************************/ | 471 | ******************************************************************************/ |
449 | acpi_status | 472 | acpi_status |
450 | acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | 473 | acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) |
451 | { | 474 | { |
452 | acpi_status status = AE_OK; | 475 | acpi_status status; |
453 | struct acpi_evaluate_info *info; | 476 | struct acpi_evaluate_info *info; |
477 | union acpi_operand_object **elements; | ||
454 | 478 | ||
455 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); | 479 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); |
456 | 480 | ||
@@ -467,18 +491,14 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | |||
467 | return_ACPI_STATUS(AE_NO_MEMORY); | 491 | return_ACPI_STATUS(AE_NO_MEMORY); |
468 | } | 492 | } |
469 | 493 | ||
494 | /* | ||
495 | * Evaluate the \_Sx namespace object containing the register values | ||
496 | * for this state | ||
497 | */ | ||
470 | info->pathname = | 498 | info->pathname = |
471 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | 499 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); |
472 | |||
473 | /* Evaluate the namespace object containing the values for this state */ | ||
474 | |||
475 | status = acpi_ns_evaluate(info); | 500 | status = acpi_ns_evaluate(info); |
476 | if (ACPI_FAILURE(status)) { | 501 | if (ACPI_FAILURE(status)) { |
477 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
478 | "%s while evaluating SleepState [%s]\n", | ||
479 | acpi_format_exception(status), | ||
480 | info->pathname)); | ||
481 | |||
482 | goto cleanup; | 502 | goto cleanup; |
483 | } | 503 | } |
484 | 504 | ||
@@ -487,64 +507,67 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) | |||
487 | if (!info->return_object) { | 507 | if (!info->return_object) { |
488 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | 508 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", |
489 | info->pathname)); | 509 | info->pathname)); |
490 | status = AE_NOT_EXIST; | 510 | status = AE_AML_NO_RETURN_VALUE; |
511 | goto cleanup; | ||
491 | } | 512 | } |
492 | 513 | ||
493 | /* It must be of type Package */ | 514 | /* Return object must be of type Package */ |
494 | 515 | ||
495 | else if (info->return_object->common.type != ACPI_TYPE_PACKAGE) { | 516 | if (info->return_object->common.type != ACPI_TYPE_PACKAGE) { |
496 | ACPI_ERROR((AE_INFO, | 517 | ACPI_ERROR((AE_INFO, |
497 | "Sleep State return object is not a Package")); | 518 | "Sleep State return object is not a Package")); |
498 | status = AE_AML_OPERAND_TYPE; | 519 | status = AE_AML_OPERAND_TYPE; |
520 | goto cleanup1; | ||
499 | } | 521 | } |
500 | 522 | ||
501 | /* | 523 | /* |
502 | * The package must have at least two elements. NOTE (March 2005): This | 524 | * Any warnings about the package length or the object types have |
503 | * goes against the current ACPI spec which defines this object as a | 525 | * already been issued by the predefined name module -- there is no |
504 | * package with one encoded DWORD element. However, existing practice | 526 | * need to repeat them here. |
505 | * by BIOS vendors seems to be to have 2 or more elements, at least | ||
506 | * one per sleep type (A/B). | ||
507 | */ | 527 | */ |
508 | else if (info->return_object->package.count < 2) { | 528 | elements = info->return_object->package.elements; |
509 | ACPI_ERROR((AE_INFO, | 529 | switch (info->return_object->package.count) { |
510 | "Sleep State return package does not have at least two elements")); | 530 | case 0: |
511 | status = AE_AML_NO_OPERAND; | 531 | status = AE_AML_PACKAGE_LIMIT; |
512 | } | 532 | break; |
533 | |||
534 | case 1: | ||
535 | if (elements[0]->common.type != ACPI_TYPE_INTEGER) { | ||
536 | status = AE_AML_OPERAND_TYPE; | ||
537 | break; | ||
538 | } | ||
513 | 539 | ||
514 | /* The first two elements must both be of type Integer */ | 540 | /* A valid _Sx_ package with one integer */ |
515 | 541 | ||
516 | else if (((info->return_object->package.elements[0])->common.type | 542 | *sleep_type_a = (u8)elements[0]->integer.value; |
517 | != ACPI_TYPE_INTEGER) || | 543 | *sleep_type_b = (u8)(elements[0]->integer.value >> 8); |
518 | ((info->return_object->package.elements[1])->common.type | 544 | break; |
519 | != ACPI_TYPE_INTEGER)) { | ||
520 | ACPI_ERROR((AE_INFO, | ||
521 | "Sleep State return package elements are not both Integers " | ||
522 | "(%s, %s)", | ||
523 | acpi_ut_get_object_type_name(info->return_object-> | ||
524 | package.elements[0]), | ||
525 | acpi_ut_get_object_type_name(info->return_object-> | ||
526 | package.elements[1]))); | ||
527 | status = AE_AML_OPERAND_TYPE; | ||
528 | } else { | ||
529 | /* Valid _Sx_ package size, type, and value */ | ||
530 | 545 | ||
531 | *sleep_type_a = (u8) | 546 | case 2: |
532 | (info->return_object->package.elements[0])->integer.value; | 547 | default: |
533 | *sleep_type_b = (u8) | 548 | if ((elements[0]->common.type != ACPI_TYPE_INTEGER) || |
534 | (info->return_object->package.elements[1])->integer.value; | 549 | (elements[1]->common.type != ACPI_TYPE_INTEGER)) { |
535 | } | 550 | status = AE_AML_OPERAND_TYPE; |
551 | break; | ||
552 | } | ||
536 | 553 | ||
537 | if (ACPI_FAILURE(status)) { | 554 | /* A valid _Sx_ package with two integers */ |
538 | ACPI_EXCEPTION((AE_INFO, status, | 555 | |
539 | "While evaluating SleepState [%s], bad Sleep object %p type %s", | 556 | *sleep_type_a = (u8)elements[0]->integer.value; |
540 | info->pathname, info->return_object, | 557 | *sleep_type_b = (u8)elements[1]->integer.value; |
541 | acpi_ut_get_object_type_name(info-> | 558 | break; |
542 | return_object))); | ||
543 | } | 559 | } |
544 | 560 | ||
561 | cleanup1: | ||
545 | acpi_ut_remove_reference(info->return_object); | 562 | acpi_ut_remove_reference(info->return_object); |
546 | 563 | ||
547 | cleanup: | 564 | cleanup: |
565 | if (ACPI_FAILURE(status)) { | ||
566 | ACPI_EXCEPTION((AE_INFO, status, | ||
567 | "While evaluating Sleep State [%s]", | ||
568 | info->pathname)); | ||
569 | } | ||
570 | |||
548 | ACPI_FREE(info); | 571 | ACPI_FREE(info); |
549 | return_ACPI_STATUS(status); | 572 | return_ACPI_STATUS(status); |
550 | } | 573 | } |
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index ae443fe2ebf6..35eebdac0f9d 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -41,9 +41,9 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/export.h> | ||
44 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | 46 | #include "accommon.h" |
46 | #include <linux/module.h> | ||
47 | 47 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
49 | ACPI_MODULE_NAME("hwxfsleep") | 49 | ACPI_MODULE_NAME("hwxfsleep") |
@@ -207,7 +207,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) | |||
207 | (u32)acpi_gbl_FADT.s4_bios_request, 8); | 207 | (u32)acpi_gbl_FADT.s4_bios_request, 8); |
208 | 208 | ||
209 | do { | 209 | do { |
210 | acpi_os_stall(1000); | 210 | acpi_os_stall(ACPI_USEC_PER_MSEC); |
211 | status = | 211 | status = |
212 | acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); | 212 | acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value); |
213 | if (ACPI_FAILURE(status)) { | 213 | if (ACPI_FAILURE(status)) { |
@@ -350,7 +350,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) | |||
350 | * | 350 | * |
351 | * RETURN: Status | 351 | * RETURN: Status |
352 | * | 352 | * |
353 | * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231) | 353 | * DESCRIPTION: Enter a system sleep state |
354 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 354 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
355 | * | 355 | * |
356 | ******************************************************************************/ | 356 | ******************************************************************************/ |
@@ -382,8 +382,9 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) | |||
382 | * RETURN: Status | 382 | * RETURN: Status |
383 | * | 383 | * |
384 | * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a | 384 | * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a |
385 | * sleep. | 385 | * sleep. Called with interrupts DISABLED. |
386 | * Called with interrupts DISABLED. | 386 | * We break wake/resume into 2 stages so that OSPM can handle |
387 | * various OS-specific tasks between the two steps. | ||
387 | * | 388 | * |
388 | ******************************************************************************/ | 389 | ******************************************************************************/ |
389 | acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) | 390 | acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) |
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index d70eaf39dfdf..8769cf83b044 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index 15143c44f5e5..243737363fb8 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 924b3c71473a..ce6e97326205 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -44,6 +44,7 @@ | |||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
47 | #include <acpi/acoutput.h> | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsdump") | 50 | ACPI_MODULE_NAME("nsdump") |
@@ -77,8 +78,9 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname) | |||
77 | 78 | ||
78 | ACPI_FUNCTION_NAME(ns_print_pathname); | 79 | ACPI_FUNCTION_NAME(ns_print_pathname); |
79 | 80 | ||
80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) | 81 | /* Check if debug output enabled */ |
81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { | 82 | |
83 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_NAMES, ACPI_NAMESPACE)) { | ||
82 | return; | 84 | return; |
83 | } | 85 | } |
84 | 86 | ||
@@ -127,7 +129,7 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) | |||
127 | 129 | ||
128 | /* Do this only if the requested debug level and component are enabled */ | 130 | /* Do this only if the requested debug level and component are enabled */ |
129 | 131 | ||
130 | if (!(acpi_dbg_level & level) || !(acpi_dbg_layer & component)) { | 132 | if (!ACPI_IS_DEBUG_ENABLED(level, component)) { |
131 | return_VOID; | 133 | return_VOID; |
132 | } | 134 | } |
133 | 135 | ||
@@ -729,5 +731,5 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
729 | ACPI_OWNER_ID_MAX, search_handle); | 731 | ACPI_OWNER_ID_MAX, search_handle); |
730 | return_VOID; | 732 | return_VOID; |
731 | } | 733 | } |
732 | #endif /* _ACPI_ASL_COMPILER */ | 734 | #endif |
733 | #endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ | 735 | #endif |
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 944d4c8d9438..409ae80824d1 100644 --- a/drivers/acpi/acpica/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -42,7 +42,6 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | ||
46 | 45 | ||
47 | /* TBD: This entire module is apparently obsolete and should be removed */ | 46 | /* TBD: This entire module is apparently obsolete and should be removed */ |
48 | 47 | ||
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index 69074be498e8..1538f3eb2a8f 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 4328e2adfeb9..2a431ec50a25 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -46,7 +46,6 @@ | |||
46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
47 | #include "acdispat.h" | 47 | #include "acdispat.h" |
48 | #include "acinterp.h" | 48 | #include "acinterp.h" |
49 | #include <linux/nmi.h> | ||
50 | 49 | ||
51 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME("nsinit") | 51 | ACPI_MODULE_NAME("nsinit") |
@@ -87,7 +86,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
87 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 86 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
88 | "**** Starting initialization of namespace objects ****\n")); | 87 | "**** Starting initialization of namespace objects ****\n")); |
89 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 88 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
90 | "Completing Region/Field/Buffer/Package initialization:")); | 89 | "Completing Region/Field/Buffer/Package initialization:\n")); |
91 | 90 | ||
92 | /* Set all init info to zero */ | 91 | /* Set all init info to zero */ |
93 | 92 | ||
@@ -103,7 +102,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
103 | } | 102 | } |
104 | 103 | ||
105 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 104 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
106 | "\nInitialized %u/%u Regions %u/%u Fields %u/%u " | 105 | " Initialized %u/%u Regions %u/%u Fields %u/%u " |
107 | "Buffers %u/%u Packages (%u nodes)\n", | 106 | "Buffers %u/%u Packages (%u nodes)\n", |
108 | info.op_region_init, info.op_region_count, | 107 | info.op_region_init, info.op_region_count, |
109 | info.field_init, info.field_count, | 108 | info.field_init, info.field_count, |
@@ -150,7 +149,7 @@ acpi_status acpi_ns_initialize_devices(void) | |||
150 | 149 | ||
151 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 150 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
152 | "Initializing Device/Processor/Thermal objects " | 151 | "Initializing Device/Processor/Thermal objects " |
153 | "by executing _INI methods:")); | 152 | "and executing _INI/_STA methods:\n")); |
154 | 153 | ||
155 | /* Tree analysis: find all subtrees that contain _INI methods */ | 154 | /* Tree analysis: find all subtrees that contain _INI methods */ |
156 | 155 | ||
@@ -208,7 +207,7 @@ acpi_status acpi_ns_initialize_devices(void) | |||
208 | } | 207 | } |
209 | 208 | ||
210 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 209 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
211 | "\nExecuted %u _INI methods requiring %u _STA executions " | 210 | " Executed %u _INI methods requiring %u _STA executions " |
212 | "(examined %u objects)\n", | 211 | "(examined %u objects)\n", |
213 | info.num_INI, info.num_STA, info.device_count)); | 212 | info.num_INI, info.num_STA, info.device_count)); |
214 | 213 | ||
@@ -350,14 +349,6 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
350 | } | 349 | } |
351 | 350 | ||
352 | /* | 351 | /* |
353 | * Print a dot for each object unless we are going to print the entire | ||
354 | * pathname | ||
355 | */ | ||
356 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | ||
357 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
358 | } | ||
359 | |||
360 | /* | ||
361 | * We ignore errors from above, and always return OK, since we don't want | 352 | * We ignore errors from above, and always return OK, since we don't want |
362 | * to abort the walk on any single error. | 353 | * to abort the walk on any single error. |
363 | */ | 354 | */ |
@@ -572,20 +563,10 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
572 | info->parameters = NULL; | 563 | info->parameters = NULL; |
573 | info->flags = ACPI_IGNORE_RETURN_VALUE; | 564 | info->flags = ACPI_IGNORE_RETURN_VALUE; |
574 | 565 | ||
575 | /* | ||
576 | * Some hardware relies on this being executed as atomically | ||
577 | * as possible (without an NMI being received in the middle of | ||
578 | * this) - so disable NMIs and initialize the device: | ||
579 | */ | ||
580 | status = acpi_ns_evaluate(info); | 566 | status = acpi_ns_evaluate(info); |
581 | 567 | ||
582 | if (ACPI_SUCCESS(status)) { | 568 | if (ACPI_SUCCESS(status)) { |
583 | walk_info->num_INI++; | 569 | walk_info->num_INI++; |
584 | |||
585 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
586 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
587 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
588 | } | ||
589 | } | 570 | } |
590 | #ifdef ACPI_DEBUG_OUTPUT | 571 | #ifdef ACPI_DEBUG_OUTPUT |
591 | else if (status != AE_NOT_FOUND) { | 572 | else if (status != AE_NOT_FOUND) { |
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index 911f99127b99..0a7badc3179f 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 55a175eadcc3..90a0380fb8a0 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -126,7 +126,8 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
126 | * the node, In external format (name segments separated by path | 126 | * the node, In external format (name segments separated by path |
127 | * separators.) | 127 | * separators.) |
128 | * | 128 | * |
129 | * DESCRIPTION: Used for debug printing in acpi_ns_search_table(). | 129 | * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually |
130 | * for error and debug statements. | ||
130 | * | 131 | * |
131 | ******************************************************************************/ | 132 | ******************************************************************************/ |
132 | 133 | ||
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index e69f7fa2579d..7a736f4d1fd8 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 233f756d5cfa..35dde8151c0d 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index 2419f417ea33..224c30053401 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -1,12 +1,11 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: nspredef - Validation of ACPI predefined methods and objects | 3 | * Module Name: nspredef - Validation of ACPI predefined methods and objects |
4 | * $Revision: 1.1 $ | ||
5 | * | 4 | * |
6 | *****************************************************************************/ | 5 | *****************************************************************************/ |
7 | 6 | ||
8 | /* | 7 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 9 | * All rights reserved. |
11 | * | 10 | * |
12 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -74,27 +73,6 @@ ACPI_MODULE_NAME("nspredef") | |||
74 | ******************************************************************************/ | 73 | ******************************************************************************/ |
75 | /* Local prototypes */ | 74 | /* Local prototypes */ |
76 | static acpi_status | 75 | static acpi_status |
77 | acpi_ns_check_package(struct acpi_predefined_data *data, | ||
78 | union acpi_operand_object **return_object_ptr); | ||
79 | |||
80 | static acpi_status | ||
81 | acpi_ns_check_package_list(struct acpi_predefined_data *data, | ||
82 | const union acpi_predefined_info *package, | ||
83 | union acpi_operand_object **elements, u32 count); | ||
84 | |||
85 | static acpi_status | ||
86 | acpi_ns_check_package_elements(struct acpi_predefined_data *data, | ||
87 | union acpi_operand_object **elements, | ||
88 | u8 type1, | ||
89 | u32 count1, | ||
90 | u8 type2, u32 count2, u32 start_index); | ||
91 | |||
92 | static acpi_status | ||
93 | acpi_ns_check_object_type(struct acpi_predefined_data *data, | ||
94 | union acpi_operand_object **return_object_ptr, | ||
95 | u32 expected_btypes, u32 package_index); | ||
96 | |||
97 | static acpi_status | ||
98 | acpi_ns_check_reference(struct acpi_predefined_data *data, | 76 | acpi_ns_check_reference(struct acpi_predefined_data *data, |
99 | union acpi_operand_object *return_object); | 77 | union acpi_operand_object *return_object); |
100 | 78 | ||
@@ -148,7 +126,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
148 | 126 | ||
149 | pathname = acpi_ns_get_external_pathname(node); | 127 | pathname = acpi_ns_get_external_pathname(node); |
150 | if (!pathname) { | 128 | if (!pathname) { |
151 | return AE_OK; /* Could not get pathname, ignore */ | 129 | return (AE_OK); /* Could not get pathname, ignore */ |
152 | } | 130 | } |
153 | 131 | ||
154 | /* | 132 | /* |
@@ -408,564 +386,6 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | |||
408 | 386 | ||
409 | /******************************************************************************* | 387 | /******************************************************************************* |
410 | * | 388 | * |
411 | * FUNCTION: acpi_ns_check_package | ||
412 | * | ||
413 | * PARAMETERS: data - Pointer to validation data structure | ||
414 | * return_object_ptr - Pointer to the object returned from the | ||
415 | * evaluation of a method or object | ||
416 | * | ||
417 | * RETURN: Status | ||
418 | * | ||
419 | * DESCRIPTION: Check a returned package object for the correct count and | ||
420 | * correct type of all sub-objects. | ||
421 | * | ||
422 | ******************************************************************************/ | ||
423 | |||
424 | static acpi_status | ||
425 | acpi_ns_check_package(struct acpi_predefined_data *data, | ||
426 | union acpi_operand_object **return_object_ptr) | ||
427 | { | ||
428 | union acpi_operand_object *return_object = *return_object_ptr; | ||
429 | const union acpi_predefined_info *package; | ||
430 | union acpi_operand_object **elements; | ||
431 | acpi_status status = AE_OK; | ||
432 | u32 expected_count; | ||
433 | u32 count; | ||
434 | u32 i; | ||
435 | |||
436 | ACPI_FUNCTION_NAME(ns_check_package); | ||
437 | |||
438 | /* The package info for this name is in the next table entry */ | ||
439 | |||
440 | package = data->predefined + 1; | ||
441 | |||
442 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
443 | "%s Validating return Package of Type %X, Count %X\n", | ||
444 | data->pathname, package->ret_info.type, | ||
445 | return_object->package.count)); | ||
446 | |||
447 | /* | ||
448 | * For variable-length Packages, we can safely remove all embedded | ||
449 | * and trailing NULL package elements | ||
450 | */ | ||
451 | acpi_ns_remove_null_elements(data, package->ret_info.type, | ||
452 | return_object); | ||
453 | |||
454 | /* Extract package count and elements array */ | ||
455 | |||
456 | elements = return_object->package.elements; | ||
457 | count = return_object->package.count; | ||
458 | |||
459 | /* The package must have at least one element, else invalid */ | ||
460 | |||
461 | if (!count) { | ||
462 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
463 | "Return Package has no elements (empty)")); | ||
464 | |||
465 | return (AE_AML_OPERAND_VALUE); | ||
466 | } | ||
467 | |||
468 | /* | ||
469 | * Decode the type of the expected package contents | ||
470 | * | ||
471 | * PTYPE1 packages contain no subpackages | ||
472 | * PTYPE2 packages contain sub-packages | ||
473 | */ | ||
474 | switch (package->ret_info.type) { | ||
475 | case ACPI_PTYPE1_FIXED: | ||
476 | |||
477 | /* | ||
478 | * The package count is fixed and there are no sub-packages | ||
479 | * | ||
480 | * If package is too small, exit. | ||
481 | * If package is larger than expected, issue warning but continue | ||
482 | */ | ||
483 | expected_count = | ||
484 | package->ret_info.count1 + package->ret_info.count2; | ||
485 | if (count < expected_count) { | ||
486 | goto package_too_small; | ||
487 | } else if (count > expected_count) { | ||
488 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
489 | "%s: Return Package is larger than needed - " | ||
490 | "found %u, expected %u\n", | ||
491 | data->pathname, count, | ||
492 | expected_count)); | ||
493 | } | ||
494 | |||
495 | /* Validate all elements of the returned package */ | ||
496 | |||
497 | status = acpi_ns_check_package_elements(data, elements, | ||
498 | package->ret_info. | ||
499 | object_type1, | ||
500 | package->ret_info. | ||
501 | count1, | ||
502 | package->ret_info. | ||
503 | object_type2, | ||
504 | package->ret_info. | ||
505 | count2, 0); | ||
506 | break; | ||
507 | |||
508 | case ACPI_PTYPE1_VAR: | ||
509 | |||
510 | /* | ||
511 | * The package count is variable, there are no sub-packages, and all | ||
512 | * elements must be of the same type | ||
513 | */ | ||
514 | for (i = 0; i < count; i++) { | ||
515 | status = acpi_ns_check_object_type(data, elements, | ||
516 | package->ret_info. | ||
517 | object_type1, i); | ||
518 | if (ACPI_FAILURE(status)) { | ||
519 | return (status); | ||
520 | } | ||
521 | elements++; | ||
522 | } | ||
523 | break; | ||
524 | |||
525 | case ACPI_PTYPE1_OPTION: | ||
526 | |||
527 | /* | ||
528 | * The package count is variable, there are no sub-packages. There are | ||
529 | * a fixed number of required elements, and a variable number of | ||
530 | * optional elements. | ||
531 | * | ||
532 | * Check if package is at least as large as the minimum required | ||
533 | */ | ||
534 | expected_count = package->ret_info3.count; | ||
535 | if (count < expected_count) { | ||
536 | goto package_too_small; | ||
537 | } | ||
538 | |||
539 | /* Variable number of sub-objects */ | ||
540 | |||
541 | for (i = 0; i < count; i++) { | ||
542 | if (i < package->ret_info3.count) { | ||
543 | |||
544 | /* These are the required package elements (0, 1, or 2) */ | ||
545 | |||
546 | status = | ||
547 | acpi_ns_check_object_type(data, elements, | ||
548 | package-> | ||
549 | ret_info3. | ||
550 | object_type[i], | ||
551 | i); | ||
552 | if (ACPI_FAILURE(status)) { | ||
553 | return (status); | ||
554 | } | ||
555 | } else { | ||
556 | /* These are the optional package elements */ | ||
557 | |||
558 | status = | ||
559 | acpi_ns_check_object_type(data, elements, | ||
560 | package-> | ||
561 | ret_info3. | ||
562 | tail_object_type, | ||
563 | i); | ||
564 | if (ACPI_FAILURE(status)) { | ||
565 | return (status); | ||
566 | } | ||
567 | } | ||
568 | elements++; | ||
569 | } | ||
570 | break; | ||
571 | |||
572 | case ACPI_PTYPE2_REV_FIXED: | ||
573 | |||
574 | /* First element is the (Integer) revision */ | ||
575 | |||
576 | status = acpi_ns_check_object_type(data, elements, | ||
577 | ACPI_RTYPE_INTEGER, 0); | ||
578 | if (ACPI_FAILURE(status)) { | ||
579 | return (status); | ||
580 | } | ||
581 | |||
582 | elements++; | ||
583 | count--; | ||
584 | |||
585 | /* Examine the sub-packages */ | ||
586 | |||
587 | status = | ||
588 | acpi_ns_check_package_list(data, package, elements, count); | ||
589 | break; | ||
590 | |||
591 | case ACPI_PTYPE2_PKG_COUNT: | ||
592 | |||
593 | /* First element is the (Integer) count of sub-packages to follow */ | ||
594 | |||
595 | status = acpi_ns_check_object_type(data, elements, | ||
596 | ACPI_RTYPE_INTEGER, 0); | ||
597 | if (ACPI_FAILURE(status)) { | ||
598 | return (status); | ||
599 | } | ||
600 | |||
601 | /* | ||
602 | * Count cannot be larger than the parent package length, but allow it | ||
603 | * to be smaller. The >= accounts for the Integer above. | ||
604 | */ | ||
605 | expected_count = (u32) (*elements)->integer.value; | ||
606 | if (expected_count >= count) { | ||
607 | goto package_too_small; | ||
608 | } | ||
609 | |||
610 | count = expected_count; | ||
611 | elements++; | ||
612 | |||
613 | /* Examine the sub-packages */ | ||
614 | |||
615 | status = | ||
616 | acpi_ns_check_package_list(data, package, elements, count); | ||
617 | break; | ||
618 | |||
619 | case ACPI_PTYPE2: | ||
620 | case ACPI_PTYPE2_FIXED: | ||
621 | case ACPI_PTYPE2_MIN: | ||
622 | case ACPI_PTYPE2_COUNT: | ||
623 | case ACPI_PTYPE2_FIX_VAR: | ||
624 | |||
625 | /* | ||
626 | * These types all return a single Package that consists of a | ||
627 | * variable number of sub-Packages. | ||
628 | * | ||
629 | * First, ensure that the first element is a sub-Package. If not, | ||
630 | * the BIOS may have incorrectly returned the object as a single | ||
631 | * package instead of a Package of Packages (a common error if | ||
632 | * there is only one entry). We may be able to repair this by | ||
633 | * wrapping the returned Package with a new outer Package. | ||
634 | */ | ||
635 | if (*elements | ||
636 | && ((*elements)->common.type != ACPI_TYPE_PACKAGE)) { | ||
637 | |||
638 | /* Create the new outer package and populate it */ | ||
639 | |||
640 | status = | ||
641 | acpi_ns_wrap_with_package(data, return_object, | ||
642 | return_object_ptr); | ||
643 | if (ACPI_FAILURE(status)) { | ||
644 | return (status); | ||
645 | } | ||
646 | |||
647 | /* Update locals to point to the new package (of 1 element) */ | ||
648 | |||
649 | return_object = *return_object_ptr; | ||
650 | elements = return_object->package.elements; | ||
651 | count = 1; | ||
652 | } | ||
653 | |||
654 | /* Examine the sub-packages */ | ||
655 | |||
656 | status = | ||
657 | acpi_ns_check_package_list(data, package, elements, count); | ||
658 | break; | ||
659 | |||
660 | default: | ||
661 | |||
662 | /* Should not get here if predefined info table is correct */ | ||
663 | |||
664 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
665 | "Invalid internal return type in table entry: %X", | ||
666 | package->ret_info.type)); | ||
667 | |||
668 | return (AE_AML_INTERNAL); | ||
669 | } | ||
670 | |||
671 | return (status); | ||
672 | |||
673 | package_too_small: | ||
674 | |||
675 | /* Error exit for the case with an incorrect package count */ | ||
676 | |||
677 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
678 | "Return Package is too small - found %u elements, expected %u", | ||
679 | count, expected_count)); | ||
680 | |||
681 | return (AE_AML_OPERAND_VALUE); | ||
682 | } | ||
683 | |||
684 | /******************************************************************************* | ||
685 | * | ||
686 | * FUNCTION: acpi_ns_check_package_list | ||
687 | * | ||
688 | * PARAMETERS: data - Pointer to validation data structure | ||
689 | * package - Pointer to package-specific info for method | ||
690 | * elements - Element list of parent package. All elements | ||
691 | * of this list should be of type Package. | ||
692 | * count - Count of subpackages | ||
693 | * | ||
694 | * RETURN: Status | ||
695 | * | ||
696 | * DESCRIPTION: Examine a list of subpackages | ||
697 | * | ||
698 | ******************************************************************************/ | ||
699 | |||
700 | static acpi_status | ||
701 | acpi_ns_check_package_list(struct acpi_predefined_data *data, | ||
702 | const union acpi_predefined_info *package, | ||
703 | union acpi_operand_object **elements, u32 count) | ||
704 | { | ||
705 | union acpi_operand_object *sub_package; | ||
706 | union acpi_operand_object **sub_elements; | ||
707 | acpi_status status; | ||
708 | u32 expected_count; | ||
709 | u32 i; | ||
710 | u32 j; | ||
711 | |||
712 | /* | ||
713 | * Validate each sub-Package in the parent Package | ||
714 | * | ||
715 | * NOTE: assumes list of sub-packages contains no NULL elements. | ||
716 | * Any NULL elements should have been removed by earlier call | ||
717 | * to acpi_ns_remove_null_elements. | ||
718 | */ | ||
719 | for (i = 0; i < count; i++) { | ||
720 | sub_package = *elements; | ||
721 | sub_elements = sub_package->package.elements; | ||
722 | data->parent_package = sub_package; | ||
723 | |||
724 | /* Each sub-object must be of type Package */ | ||
725 | |||
726 | status = acpi_ns_check_object_type(data, &sub_package, | ||
727 | ACPI_RTYPE_PACKAGE, i); | ||
728 | if (ACPI_FAILURE(status)) { | ||
729 | return (status); | ||
730 | } | ||
731 | |||
732 | /* Examine the different types of expected sub-packages */ | ||
733 | |||
734 | data->parent_package = sub_package; | ||
735 | switch (package->ret_info.type) { | ||
736 | case ACPI_PTYPE2: | ||
737 | case ACPI_PTYPE2_PKG_COUNT: | ||
738 | case ACPI_PTYPE2_REV_FIXED: | ||
739 | |||
740 | /* Each subpackage has a fixed number of elements */ | ||
741 | |||
742 | expected_count = | ||
743 | package->ret_info.count1 + package->ret_info.count2; | ||
744 | if (sub_package->package.count < expected_count) { | ||
745 | goto package_too_small; | ||
746 | } | ||
747 | |||
748 | status = | ||
749 | acpi_ns_check_package_elements(data, sub_elements, | ||
750 | package->ret_info. | ||
751 | object_type1, | ||
752 | package->ret_info. | ||
753 | count1, | ||
754 | package->ret_info. | ||
755 | object_type2, | ||
756 | package->ret_info. | ||
757 | count2, 0); | ||
758 | if (ACPI_FAILURE(status)) { | ||
759 | return (status); | ||
760 | } | ||
761 | break; | ||
762 | |||
763 | case ACPI_PTYPE2_FIX_VAR: | ||
764 | /* | ||
765 | * Each subpackage has a fixed number of elements and an | ||
766 | * optional element | ||
767 | */ | ||
768 | expected_count = | ||
769 | package->ret_info.count1 + package->ret_info.count2; | ||
770 | if (sub_package->package.count < expected_count) { | ||
771 | goto package_too_small; | ||
772 | } | ||
773 | |||
774 | status = | ||
775 | acpi_ns_check_package_elements(data, sub_elements, | ||
776 | package->ret_info. | ||
777 | object_type1, | ||
778 | package->ret_info. | ||
779 | count1, | ||
780 | package->ret_info. | ||
781 | object_type2, | ||
782 | sub_package->package. | ||
783 | count - | ||
784 | package->ret_info. | ||
785 | count1, 0); | ||
786 | if (ACPI_FAILURE(status)) { | ||
787 | return (status); | ||
788 | } | ||
789 | break; | ||
790 | |||
791 | case ACPI_PTYPE2_FIXED: | ||
792 | |||
793 | /* Each sub-package has a fixed length */ | ||
794 | |||
795 | expected_count = package->ret_info2.count; | ||
796 | if (sub_package->package.count < expected_count) { | ||
797 | goto package_too_small; | ||
798 | } | ||
799 | |||
800 | /* Check the type of each sub-package element */ | ||
801 | |||
802 | for (j = 0; j < expected_count; j++) { | ||
803 | status = | ||
804 | acpi_ns_check_object_type(data, | ||
805 | &sub_elements[j], | ||
806 | package-> | ||
807 | ret_info2. | ||
808 | object_type[j], | ||
809 | j); | ||
810 | if (ACPI_FAILURE(status)) { | ||
811 | return (status); | ||
812 | } | ||
813 | } | ||
814 | break; | ||
815 | |||
816 | case ACPI_PTYPE2_MIN: | ||
817 | |||
818 | /* Each sub-package has a variable but minimum length */ | ||
819 | |||
820 | expected_count = package->ret_info.count1; | ||
821 | if (sub_package->package.count < expected_count) { | ||
822 | goto package_too_small; | ||
823 | } | ||
824 | |||
825 | /* Check the type of each sub-package element */ | ||
826 | |||
827 | status = | ||
828 | acpi_ns_check_package_elements(data, sub_elements, | ||
829 | package->ret_info. | ||
830 | object_type1, | ||
831 | sub_package->package. | ||
832 | count, 0, 0, 0); | ||
833 | if (ACPI_FAILURE(status)) { | ||
834 | return (status); | ||
835 | } | ||
836 | break; | ||
837 | |||
838 | case ACPI_PTYPE2_COUNT: | ||
839 | |||
840 | /* | ||
841 | * First element is the (Integer) count of elements, including | ||
842 | * the count field (the ACPI name is num_elements) | ||
843 | */ | ||
844 | status = acpi_ns_check_object_type(data, sub_elements, | ||
845 | ACPI_RTYPE_INTEGER, | ||
846 | 0); | ||
847 | if (ACPI_FAILURE(status)) { | ||
848 | return (status); | ||
849 | } | ||
850 | |||
851 | /* | ||
852 | * Make sure package is large enough for the Count and is | ||
853 | * is as large as the minimum size | ||
854 | */ | ||
855 | expected_count = (u32)(*sub_elements)->integer.value; | ||
856 | if (sub_package->package.count < expected_count) { | ||
857 | goto package_too_small; | ||
858 | } | ||
859 | if (sub_package->package.count < | ||
860 | package->ret_info.count1) { | ||
861 | expected_count = package->ret_info.count1; | ||
862 | goto package_too_small; | ||
863 | } | ||
864 | if (expected_count == 0) { | ||
865 | /* | ||
866 | * Either the num_entries element was originally zero or it was | ||
867 | * a NULL element and repaired to an Integer of value zero. | ||
868 | * In either case, repair it by setting num_entries to be the | ||
869 | * actual size of the subpackage. | ||
870 | */ | ||
871 | expected_count = sub_package->package.count; | ||
872 | (*sub_elements)->integer.value = expected_count; | ||
873 | } | ||
874 | |||
875 | /* Check the type of each sub-package element */ | ||
876 | |||
877 | status = | ||
878 | acpi_ns_check_package_elements(data, | ||
879 | (sub_elements + 1), | ||
880 | package->ret_info. | ||
881 | object_type1, | ||
882 | (expected_count - 1), | ||
883 | 0, 0, 1); | ||
884 | if (ACPI_FAILURE(status)) { | ||
885 | return (status); | ||
886 | } | ||
887 | break; | ||
888 | |||
889 | default: /* Should not get here, type was validated by caller */ | ||
890 | |||
891 | return (AE_AML_INTERNAL); | ||
892 | } | ||
893 | |||
894 | elements++; | ||
895 | } | ||
896 | |||
897 | return (AE_OK); | ||
898 | |||
899 | package_too_small: | ||
900 | |||
901 | /* The sub-package count was smaller than required */ | ||
902 | |||
903 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
904 | "Return Sub-Package[%u] is too small - found %u elements, expected %u", | ||
905 | i, sub_package->package.count, expected_count)); | ||
906 | |||
907 | return (AE_AML_OPERAND_VALUE); | ||
908 | } | ||
909 | |||
910 | /******************************************************************************* | ||
911 | * | ||
912 | * FUNCTION: acpi_ns_check_package_elements | ||
913 | * | ||
914 | * PARAMETERS: data - Pointer to validation data structure | ||
915 | * elements - Pointer to the package elements array | ||
916 | * type1 - Object type for first group | ||
917 | * count1 - Count for first group | ||
918 | * type2 - Object type for second group | ||
919 | * count2 - Count for second group | ||
920 | * start_index - Start of the first group of elements | ||
921 | * | ||
922 | * RETURN: Status | ||
923 | * | ||
924 | * DESCRIPTION: Check that all elements of a package are of the correct object | ||
925 | * type. Supports up to two groups of different object types. | ||
926 | * | ||
927 | ******************************************************************************/ | ||
928 | |||
929 | static acpi_status | ||
930 | acpi_ns_check_package_elements(struct acpi_predefined_data *data, | ||
931 | union acpi_operand_object **elements, | ||
932 | u8 type1, | ||
933 | u32 count1, | ||
934 | u8 type2, u32 count2, u32 start_index) | ||
935 | { | ||
936 | union acpi_operand_object **this_element = elements; | ||
937 | acpi_status status; | ||
938 | u32 i; | ||
939 | |||
940 | /* | ||
941 | * Up to two groups of package elements are supported by the data | ||
942 | * structure. All elements in each group must be of the same type. | ||
943 | * The second group can have a count of zero. | ||
944 | */ | ||
945 | for (i = 0; i < count1; i++) { | ||
946 | status = acpi_ns_check_object_type(data, this_element, | ||
947 | type1, i + start_index); | ||
948 | if (ACPI_FAILURE(status)) { | ||
949 | return (status); | ||
950 | } | ||
951 | this_element++; | ||
952 | } | ||
953 | |||
954 | for (i = 0; i < count2; i++) { | ||
955 | status = acpi_ns_check_object_type(data, this_element, | ||
956 | type2, | ||
957 | (i + count1 + start_index)); | ||
958 | if (ACPI_FAILURE(status)) { | ||
959 | return (status); | ||
960 | } | ||
961 | this_element++; | ||
962 | } | ||
963 | |||
964 | return (AE_OK); | ||
965 | } | ||
966 | |||
967 | /******************************************************************************* | ||
968 | * | ||
969 | * FUNCTION: acpi_ns_check_object_type | 389 | * FUNCTION: acpi_ns_check_object_type |
970 | * | 390 | * |
971 | * PARAMETERS: data - Pointer to validation data structure | 391 | * PARAMETERS: data - Pointer to validation data structure |
@@ -983,7 +403,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data, | |||
983 | * | 403 | * |
984 | ******************************************************************************/ | 404 | ******************************************************************************/ |
985 | 405 | ||
986 | static acpi_status | 406 | acpi_status |
987 | acpi_ns_check_object_type(struct acpi_predefined_data *data, | 407 | acpi_ns_check_object_type(struct acpi_predefined_data *data, |
988 | union acpi_operand_object **return_object_ptr, | 408 | union acpi_operand_object **return_object_ptr, |
989 | u32 expected_btypes, u32 package_index) | 409 | u32 expected_btypes, u32 package_index) |
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c new file mode 100644 index 000000000000..a40155467d2e --- /dev/null +++ b/drivers/acpi/acpica/nsprepkg.c | |||
@@ -0,0 +1,621 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: nsprepkg - Validation of package objects for predefined names | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | #include "acpredef.h" | ||
48 | |||
49 | #define _COMPONENT ACPI_NAMESPACE | ||
50 | ACPI_MODULE_NAME("nsprepkg") | ||
51 | |||
52 | /* Local prototypes */ | ||
53 | static acpi_status | ||
54 | acpi_ns_check_package_list(struct acpi_predefined_data *data, | ||
55 | const union acpi_predefined_info *package, | ||
56 | union acpi_operand_object **elements, u32 count); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ns_check_package_elements(struct acpi_predefined_data *data, | ||
60 | union acpi_operand_object **elements, | ||
61 | u8 type1, | ||
62 | u32 count1, | ||
63 | u8 type2, u32 count2, u32 start_index); | ||
64 | |||
65 | /******************************************************************************* | ||
66 | * | ||
67 | * FUNCTION: acpi_ns_check_package | ||
68 | * | ||
69 | * PARAMETERS: data - Pointer to validation data structure | ||
70 | * return_object_ptr - Pointer to the object returned from the | ||
71 | * evaluation of a method or object | ||
72 | * | ||
73 | * RETURN: Status | ||
74 | * | ||
75 | * DESCRIPTION: Check a returned package object for the correct count and | ||
76 | * correct type of all sub-objects. | ||
77 | * | ||
78 | ******************************************************************************/ | ||
79 | |||
80 | acpi_status | ||
81 | acpi_ns_check_package(struct acpi_predefined_data *data, | ||
82 | union acpi_operand_object **return_object_ptr) | ||
83 | { | ||
84 | union acpi_operand_object *return_object = *return_object_ptr; | ||
85 | const union acpi_predefined_info *package; | ||
86 | union acpi_operand_object **elements; | ||
87 | acpi_status status = AE_OK; | ||
88 | u32 expected_count; | ||
89 | u32 count; | ||
90 | u32 i; | ||
91 | |||
92 | ACPI_FUNCTION_NAME(ns_check_package); | ||
93 | |||
94 | /* The package info for this name is in the next table entry */ | ||
95 | |||
96 | package = data->predefined + 1; | ||
97 | |||
98 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
99 | "%s Validating return Package of Type %X, Count %X\n", | ||
100 | data->pathname, package->ret_info.type, | ||
101 | return_object->package.count)); | ||
102 | |||
103 | /* | ||
104 | * For variable-length Packages, we can safely remove all embedded | ||
105 | * and trailing NULL package elements | ||
106 | */ | ||
107 | acpi_ns_remove_null_elements(data, package->ret_info.type, | ||
108 | return_object); | ||
109 | |||
110 | /* Extract package count and elements array */ | ||
111 | |||
112 | elements = return_object->package.elements; | ||
113 | count = return_object->package.count; | ||
114 | |||
115 | /* The package must have at least one element, else invalid */ | ||
116 | |||
117 | if (!count) { | ||
118 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
119 | "Return Package has no elements (empty)")); | ||
120 | |||
121 | return (AE_AML_OPERAND_VALUE); | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * Decode the type of the expected package contents | ||
126 | * | ||
127 | * PTYPE1 packages contain no subpackages | ||
128 | * PTYPE2 packages contain sub-packages | ||
129 | */ | ||
130 | switch (package->ret_info.type) { | ||
131 | case ACPI_PTYPE1_FIXED: | ||
132 | |||
133 | /* | ||
134 | * The package count is fixed and there are no sub-packages | ||
135 | * | ||
136 | * If package is too small, exit. | ||
137 | * If package is larger than expected, issue warning but continue | ||
138 | */ | ||
139 | expected_count = | ||
140 | package->ret_info.count1 + package->ret_info.count2; | ||
141 | if (count < expected_count) { | ||
142 | goto package_too_small; | ||
143 | } else if (count > expected_count) { | ||
144 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
145 | "%s: Return Package is larger than needed - " | ||
146 | "found %u, expected %u\n", | ||
147 | data->pathname, count, | ||
148 | expected_count)); | ||
149 | } | ||
150 | |||
151 | /* Validate all elements of the returned package */ | ||
152 | |||
153 | status = acpi_ns_check_package_elements(data, elements, | ||
154 | package->ret_info. | ||
155 | object_type1, | ||
156 | package->ret_info. | ||
157 | count1, | ||
158 | package->ret_info. | ||
159 | object_type2, | ||
160 | package->ret_info. | ||
161 | count2, 0); | ||
162 | break; | ||
163 | |||
164 | case ACPI_PTYPE1_VAR: | ||
165 | |||
166 | /* | ||
167 | * The package count is variable, there are no sub-packages, and all | ||
168 | * elements must be of the same type | ||
169 | */ | ||
170 | for (i = 0; i < count; i++) { | ||
171 | status = acpi_ns_check_object_type(data, elements, | ||
172 | package->ret_info. | ||
173 | object_type1, i); | ||
174 | if (ACPI_FAILURE(status)) { | ||
175 | return (status); | ||
176 | } | ||
177 | elements++; | ||
178 | } | ||
179 | break; | ||
180 | |||
181 | case ACPI_PTYPE1_OPTION: | ||
182 | |||
183 | /* | ||
184 | * The package count is variable, there are no sub-packages. There are | ||
185 | * a fixed number of required elements, and a variable number of | ||
186 | * optional elements. | ||
187 | * | ||
188 | * Check if package is at least as large as the minimum required | ||
189 | */ | ||
190 | expected_count = package->ret_info3.count; | ||
191 | if (count < expected_count) { | ||
192 | goto package_too_small; | ||
193 | } | ||
194 | |||
195 | /* Variable number of sub-objects */ | ||
196 | |||
197 | for (i = 0; i < count; i++) { | ||
198 | if (i < package->ret_info3.count) { | ||
199 | |||
200 | /* These are the required package elements (0, 1, or 2) */ | ||
201 | |||
202 | status = | ||
203 | acpi_ns_check_object_type(data, elements, | ||
204 | package-> | ||
205 | ret_info3. | ||
206 | object_type[i], | ||
207 | i); | ||
208 | if (ACPI_FAILURE(status)) { | ||
209 | return (status); | ||
210 | } | ||
211 | } else { | ||
212 | /* These are the optional package elements */ | ||
213 | |||
214 | status = | ||
215 | acpi_ns_check_object_type(data, elements, | ||
216 | package-> | ||
217 | ret_info3. | ||
218 | tail_object_type, | ||
219 | i); | ||
220 | if (ACPI_FAILURE(status)) { | ||
221 | return (status); | ||
222 | } | ||
223 | } | ||
224 | elements++; | ||
225 | } | ||
226 | break; | ||
227 | |||
228 | case ACPI_PTYPE2_REV_FIXED: | ||
229 | |||
230 | /* First element is the (Integer) revision */ | ||
231 | |||
232 | status = acpi_ns_check_object_type(data, elements, | ||
233 | ACPI_RTYPE_INTEGER, 0); | ||
234 | if (ACPI_FAILURE(status)) { | ||
235 | return (status); | ||
236 | } | ||
237 | |||
238 | elements++; | ||
239 | count--; | ||
240 | |||
241 | /* Examine the sub-packages */ | ||
242 | |||
243 | status = | ||
244 | acpi_ns_check_package_list(data, package, elements, count); | ||
245 | break; | ||
246 | |||
247 | case ACPI_PTYPE2_PKG_COUNT: | ||
248 | |||
249 | /* First element is the (Integer) count of sub-packages to follow */ | ||
250 | |||
251 | status = acpi_ns_check_object_type(data, elements, | ||
252 | ACPI_RTYPE_INTEGER, 0); | ||
253 | if (ACPI_FAILURE(status)) { | ||
254 | return (status); | ||
255 | } | ||
256 | |||
257 | /* | ||
258 | * Count cannot be larger than the parent package length, but allow it | ||
259 | * to be smaller. The >= accounts for the Integer above. | ||
260 | */ | ||
261 | expected_count = (u32)(*elements)->integer.value; | ||
262 | if (expected_count >= count) { | ||
263 | goto package_too_small; | ||
264 | } | ||
265 | |||
266 | count = expected_count; | ||
267 | elements++; | ||
268 | |||
269 | /* Examine the sub-packages */ | ||
270 | |||
271 | status = | ||
272 | acpi_ns_check_package_list(data, package, elements, count); | ||
273 | break; | ||
274 | |||
275 | case ACPI_PTYPE2: | ||
276 | case ACPI_PTYPE2_FIXED: | ||
277 | case ACPI_PTYPE2_MIN: | ||
278 | case ACPI_PTYPE2_COUNT: | ||
279 | case ACPI_PTYPE2_FIX_VAR: | ||
280 | |||
281 | /* | ||
282 | * These types all return a single Package that consists of a | ||
283 | * variable number of sub-Packages. | ||
284 | * | ||
285 | * First, ensure that the first element is a sub-Package. If not, | ||
286 | * the BIOS may have incorrectly returned the object as a single | ||
287 | * package instead of a Package of Packages (a common error if | ||
288 | * there is only one entry). We may be able to repair this by | ||
289 | * wrapping the returned Package with a new outer Package. | ||
290 | */ | ||
291 | if (*elements | ||
292 | && ((*elements)->common.type != ACPI_TYPE_PACKAGE)) { | ||
293 | |||
294 | /* Create the new outer package and populate it */ | ||
295 | |||
296 | status = | ||
297 | acpi_ns_wrap_with_package(data, return_object, | ||
298 | return_object_ptr); | ||
299 | if (ACPI_FAILURE(status)) { | ||
300 | return (status); | ||
301 | } | ||
302 | |||
303 | /* Update locals to point to the new package (of 1 element) */ | ||
304 | |||
305 | return_object = *return_object_ptr; | ||
306 | elements = return_object->package.elements; | ||
307 | count = 1; | ||
308 | } | ||
309 | |||
310 | /* Examine the sub-packages */ | ||
311 | |||
312 | status = | ||
313 | acpi_ns_check_package_list(data, package, elements, count); | ||
314 | break; | ||
315 | |||
316 | default: | ||
317 | |||
318 | /* Should not get here if predefined info table is correct */ | ||
319 | |||
320 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
321 | "Invalid internal return type in table entry: %X", | ||
322 | package->ret_info.type)); | ||
323 | |||
324 | return (AE_AML_INTERNAL); | ||
325 | } | ||
326 | |||
327 | return (status); | ||
328 | |||
329 | package_too_small: | ||
330 | |||
331 | /* Error exit for the case with an incorrect package count */ | ||
332 | |||
333 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
334 | "Return Package is too small - found %u elements, expected %u", | ||
335 | count, expected_count)); | ||
336 | |||
337 | return (AE_AML_OPERAND_VALUE); | ||
338 | } | ||
339 | |||
340 | /******************************************************************************* | ||
341 | * | ||
342 | * FUNCTION: acpi_ns_check_package_list | ||
343 | * | ||
344 | * PARAMETERS: data - Pointer to validation data structure | ||
345 | * package - Pointer to package-specific info for method | ||
346 | * elements - Element list of parent package. All elements | ||
347 | * of this list should be of type Package. | ||
348 | * count - Count of subpackages | ||
349 | * | ||
350 | * RETURN: Status | ||
351 | * | ||
352 | * DESCRIPTION: Examine a list of subpackages | ||
353 | * | ||
354 | ******************************************************************************/ | ||
355 | |||
356 | static acpi_status | ||
357 | acpi_ns_check_package_list(struct acpi_predefined_data *data, | ||
358 | const union acpi_predefined_info *package, | ||
359 | union acpi_operand_object **elements, u32 count) | ||
360 | { | ||
361 | union acpi_operand_object *sub_package; | ||
362 | union acpi_operand_object **sub_elements; | ||
363 | acpi_status status; | ||
364 | u32 expected_count; | ||
365 | u32 i; | ||
366 | u32 j; | ||
367 | |||
368 | /* | ||
369 | * Validate each sub-Package in the parent Package | ||
370 | * | ||
371 | * NOTE: assumes list of sub-packages contains no NULL elements. | ||
372 | * Any NULL elements should have been removed by earlier call | ||
373 | * to acpi_ns_remove_null_elements. | ||
374 | */ | ||
375 | for (i = 0; i < count; i++) { | ||
376 | sub_package = *elements; | ||
377 | sub_elements = sub_package->package.elements; | ||
378 | data->parent_package = sub_package; | ||
379 | |||
380 | /* Each sub-object must be of type Package */ | ||
381 | |||
382 | status = acpi_ns_check_object_type(data, &sub_package, | ||
383 | ACPI_RTYPE_PACKAGE, i); | ||
384 | if (ACPI_FAILURE(status)) { | ||
385 | return (status); | ||
386 | } | ||
387 | |||
388 | /* Examine the different types of expected sub-packages */ | ||
389 | |||
390 | data->parent_package = sub_package; | ||
391 | switch (package->ret_info.type) { | ||
392 | case ACPI_PTYPE2: | ||
393 | case ACPI_PTYPE2_PKG_COUNT: | ||
394 | case ACPI_PTYPE2_REV_FIXED: | ||
395 | |||
396 | /* Each subpackage has a fixed number of elements */ | ||
397 | |||
398 | expected_count = | ||
399 | package->ret_info.count1 + package->ret_info.count2; | ||
400 | if (sub_package->package.count < expected_count) { | ||
401 | goto package_too_small; | ||
402 | } | ||
403 | |||
404 | status = | ||
405 | acpi_ns_check_package_elements(data, sub_elements, | ||
406 | package->ret_info. | ||
407 | object_type1, | ||
408 | package->ret_info. | ||
409 | count1, | ||
410 | package->ret_info. | ||
411 | object_type2, | ||
412 | package->ret_info. | ||
413 | count2, 0); | ||
414 | if (ACPI_FAILURE(status)) { | ||
415 | return (status); | ||
416 | } | ||
417 | break; | ||
418 | |||
419 | case ACPI_PTYPE2_FIX_VAR: | ||
420 | /* | ||
421 | * Each subpackage has a fixed number of elements and an | ||
422 | * optional element | ||
423 | */ | ||
424 | expected_count = | ||
425 | package->ret_info.count1 + package->ret_info.count2; | ||
426 | if (sub_package->package.count < expected_count) { | ||
427 | goto package_too_small; | ||
428 | } | ||
429 | |||
430 | status = | ||
431 | acpi_ns_check_package_elements(data, sub_elements, | ||
432 | package->ret_info. | ||
433 | object_type1, | ||
434 | package->ret_info. | ||
435 | count1, | ||
436 | package->ret_info. | ||
437 | object_type2, | ||
438 | sub_package->package. | ||
439 | count - | ||
440 | package->ret_info. | ||
441 | count1, 0); | ||
442 | if (ACPI_FAILURE(status)) { | ||
443 | return (status); | ||
444 | } | ||
445 | break; | ||
446 | |||
447 | case ACPI_PTYPE2_FIXED: | ||
448 | |||
449 | /* Each sub-package has a fixed length */ | ||
450 | |||
451 | expected_count = package->ret_info2.count; | ||
452 | if (sub_package->package.count < expected_count) { | ||
453 | goto package_too_small; | ||
454 | } | ||
455 | |||
456 | /* Check the type of each sub-package element */ | ||
457 | |||
458 | for (j = 0; j < expected_count; j++) { | ||
459 | status = | ||
460 | acpi_ns_check_object_type(data, | ||
461 | &sub_elements[j], | ||
462 | package-> | ||
463 | ret_info2. | ||
464 | object_type[j], | ||
465 | j); | ||
466 | if (ACPI_FAILURE(status)) { | ||
467 | return (status); | ||
468 | } | ||
469 | } | ||
470 | break; | ||
471 | |||
472 | case ACPI_PTYPE2_MIN: | ||
473 | |||
474 | /* Each sub-package has a variable but minimum length */ | ||
475 | |||
476 | expected_count = package->ret_info.count1; | ||
477 | if (sub_package->package.count < expected_count) { | ||
478 | goto package_too_small; | ||
479 | } | ||
480 | |||
481 | /* Check the type of each sub-package element */ | ||
482 | |||
483 | status = | ||
484 | acpi_ns_check_package_elements(data, sub_elements, | ||
485 | package->ret_info. | ||
486 | object_type1, | ||
487 | sub_package->package. | ||
488 | count, 0, 0, 0); | ||
489 | if (ACPI_FAILURE(status)) { | ||
490 | return (status); | ||
491 | } | ||
492 | break; | ||
493 | |||
494 | case ACPI_PTYPE2_COUNT: | ||
495 | |||
496 | /* | ||
497 | * First element is the (Integer) count of elements, including | ||
498 | * the count field (the ACPI name is num_elements) | ||
499 | */ | ||
500 | status = acpi_ns_check_object_type(data, sub_elements, | ||
501 | ACPI_RTYPE_INTEGER, | ||
502 | 0); | ||
503 | if (ACPI_FAILURE(status)) { | ||
504 | return (status); | ||
505 | } | ||
506 | |||
507 | /* | ||
508 | * Make sure package is large enough for the Count and is | ||
509 | * is as large as the minimum size | ||
510 | */ | ||
511 | expected_count = (u32)(*sub_elements)->integer.value; | ||
512 | if (sub_package->package.count < expected_count) { | ||
513 | goto package_too_small; | ||
514 | } | ||
515 | if (sub_package->package.count < | ||
516 | package->ret_info.count1) { | ||
517 | expected_count = package->ret_info.count1; | ||
518 | goto package_too_small; | ||
519 | } | ||
520 | if (expected_count == 0) { | ||
521 | /* | ||
522 | * Either the num_entries element was originally zero or it was | ||
523 | * a NULL element and repaired to an Integer of value zero. | ||
524 | * In either case, repair it by setting num_entries to be the | ||
525 | * actual size of the subpackage. | ||
526 | */ | ||
527 | expected_count = sub_package->package.count; | ||
528 | (*sub_elements)->integer.value = expected_count; | ||
529 | } | ||
530 | |||
531 | /* Check the type of each sub-package element */ | ||
532 | |||
533 | status = | ||
534 | acpi_ns_check_package_elements(data, | ||
535 | (sub_elements + 1), | ||
536 | package->ret_info. | ||
537 | object_type1, | ||
538 | (expected_count - 1), | ||
539 | 0, 0, 1); | ||
540 | if (ACPI_FAILURE(status)) { | ||
541 | return (status); | ||
542 | } | ||
543 | break; | ||
544 | |||
545 | default: /* Should not get here, type was validated by caller */ | ||
546 | |||
547 | return (AE_AML_INTERNAL); | ||
548 | } | ||
549 | |||
550 | elements++; | ||
551 | } | ||
552 | |||
553 | return (AE_OK); | ||
554 | |||
555 | package_too_small: | ||
556 | |||
557 | /* The sub-package count was smaller than required */ | ||
558 | |||
559 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
560 | "Return Sub-Package[%u] is too small - found %u elements, expected %u", | ||
561 | i, sub_package->package.count, expected_count)); | ||
562 | |||
563 | return (AE_AML_OPERAND_VALUE); | ||
564 | } | ||
565 | |||
566 | /******************************************************************************* | ||
567 | * | ||
568 | * FUNCTION: acpi_ns_check_package_elements | ||
569 | * | ||
570 | * PARAMETERS: data - Pointer to validation data structure | ||
571 | * elements - Pointer to the package elements array | ||
572 | * type1 - Object type for first group | ||
573 | * count1 - Count for first group | ||
574 | * type2 - Object type for second group | ||
575 | * count2 - Count for second group | ||
576 | * start_index - Start of the first group of elements | ||
577 | * | ||
578 | * RETURN: Status | ||
579 | * | ||
580 | * DESCRIPTION: Check that all elements of a package are of the correct object | ||
581 | * type. Supports up to two groups of different object types. | ||
582 | * | ||
583 | ******************************************************************************/ | ||
584 | |||
585 | static acpi_status | ||
586 | acpi_ns_check_package_elements(struct acpi_predefined_data *data, | ||
587 | union acpi_operand_object **elements, | ||
588 | u8 type1, | ||
589 | u32 count1, | ||
590 | u8 type2, u32 count2, u32 start_index) | ||
591 | { | ||
592 | union acpi_operand_object **this_element = elements; | ||
593 | acpi_status status; | ||
594 | u32 i; | ||
595 | |||
596 | /* | ||
597 | * Up to two groups of package elements are supported by the data | ||
598 | * structure. All elements in each group must be of the same type. | ||
599 | * The second group can have a count of zero. | ||
600 | */ | ||
601 | for (i = 0; i < count1; i++) { | ||
602 | status = acpi_ns_check_object_type(data, this_element, | ||
603 | type1, i + start_index); | ||
604 | if (ACPI_FAILURE(status)) { | ||
605 | return (status); | ||
606 | } | ||
607 | this_element++; | ||
608 | } | ||
609 | |||
610 | for (i = 0; i < count2; i++) { | ||
611 | status = acpi_ns_check_object_type(data, this_element, | ||
612 | type2, | ||
613 | (i + count1 + start_index)); | ||
614 | if (ACPI_FAILURE(status)) { | ||
615 | return (status); | ||
616 | } | ||
617 | this_element++; | ||
618 | } | ||
619 | |||
620 | return (AE_OK); | ||
621 | } | ||
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index 8c5f292860fc..9e833353c06a 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 90189251cdf0..ba4d98287c6a 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -55,7 +55,8 @@ ACPI_MODULE_NAME("nsrepair2") | |||
55 | */ | 55 | */ |
56 | typedef | 56 | typedef |
57 | acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data, | 57 | acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data, |
58 | union acpi_operand_object **return_object_ptr); | 58 | union acpi_operand_object |
59 | **return_object_ptr); | ||
59 | 60 | ||
60 | typedef struct acpi_repair_info { | 61 | typedef struct acpi_repair_info { |
61 | char name[ACPI_NAME_SIZE]; | 62 | char name[ACPI_NAME_SIZE]; |
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index 1d2d8ffc1bc5..5d43efc53a61 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -328,6 +328,11 @@ acpi_ns_search_and_enter(u32 target_name, | |||
328 | if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) { | 328 | if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) { |
329 | status = AE_ALREADY_EXISTS; | 329 | status = AE_ALREADY_EXISTS; |
330 | } | 330 | } |
331 | #ifdef ACPI_ASL_COMPILER | ||
332 | if (*return_node && (*return_node)->type == ACPI_TYPE_ANY) { | ||
333 | (*return_node)->flags |= ANOBJ_IS_EXTERNAL; | ||
334 | } | ||
335 | #endif | ||
331 | 336 | ||
332 | /* Either found it or there was an error: finished either way */ | 337 | /* Either found it or there was an error: finished either way */ |
333 | 338 | ||
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index b5b4cb72a8a8..686420df684f 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -46,14 +46,11 @@ | |||
46 | #include "accommon.h" | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | 47 | #include "acnamesp.h" |
48 | #include "amlcode.h" | 48 | #include "amlcode.h" |
49 | #include "actables.h" | ||
50 | 49 | ||
51 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME("nsutils") | 51 | ACPI_MODULE_NAME("nsutils") |
53 | 52 | ||
54 | /* Local prototypes */ | 53 | /* Local prototypes */ |
55 | static u8 acpi_ns_valid_path_separator(char sep); | ||
56 | |||
57 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 54 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
58 | acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); | 55 | acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); |
59 | #endif | 56 | #endif |
@@ -99,42 +96,6 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, | |||
99 | 96 | ||
100 | /******************************************************************************* | 97 | /******************************************************************************* |
101 | * | 98 | * |
102 | * FUNCTION: acpi_ns_valid_root_prefix | ||
103 | * | ||
104 | * PARAMETERS: prefix - Character to be checked | ||
105 | * | ||
106 | * RETURN: TRUE if a valid prefix | ||
107 | * | ||
108 | * DESCRIPTION: Check if a character is a valid ACPI Root prefix | ||
109 | * | ||
110 | ******************************************************************************/ | ||
111 | |||
112 | u8 acpi_ns_valid_root_prefix(char prefix) | ||
113 | { | ||
114 | |||
115 | return ((u8) (prefix == '\\')); | ||
116 | } | ||
117 | |||
118 | /******************************************************************************* | ||
119 | * | ||
120 | * FUNCTION: acpi_ns_valid_path_separator | ||
121 | * | ||
122 | * PARAMETERS: sep - Character to be checked | ||
123 | * | ||
124 | * RETURN: TRUE if a valid path separator | ||
125 | * | ||
126 | * DESCRIPTION: Check if a character is a valid ACPI path separator | ||
127 | * | ||
128 | ******************************************************************************/ | ||
129 | |||
130 | static u8 acpi_ns_valid_path_separator(char sep) | ||
131 | { | ||
132 | |||
133 | return ((u8) (sep == '.')); | ||
134 | } | ||
135 | |||
136 | /******************************************************************************* | ||
137 | * | ||
138 | * FUNCTION: acpi_ns_get_type | 99 | * FUNCTION: acpi_ns_get_type |
139 | * | 100 | * |
140 | * PARAMETERS: node - Parent Node to be examined | 101 | * PARAMETERS: node - Parent Node to be examined |
@@ -151,10 +112,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | |||
151 | 112 | ||
152 | if (!node) { | 113 | if (!node) { |
153 | ACPI_WARNING((AE_INFO, "Null Node parameter")); | 114 | ACPI_WARNING((AE_INFO, "Null Node parameter")); |
154 | return_UINT32(ACPI_TYPE_ANY); | 115 | return_VALUE(ACPI_TYPE_ANY); |
155 | } | 116 | } |
156 | 117 | ||
157 | return_UINT32((acpi_object_type) node->type); | 118 | return_VALUE(node->type); |
158 | } | 119 | } |
159 | 120 | ||
160 | /******************************************************************************* | 121 | /******************************************************************************* |
@@ -179,10 +140,10 @@ u32 acpi_ns_local(acpi_object_type type) | |||
179 | /* Type code out of range */ | 140 | /* Type code out of range */ |
180 | 141 | ||
181 | ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); | 142 | ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); |
182 | return_UINT32(ACPI_NS_NORMAL); | 143 | return_VALUE(ACPI_NS_NORMAL); |
183 | } | 144 | } |
184 | 145 | ||
185 | return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); | 146 | return_VALUE(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); |
186 | } | 147 | } |
187 | 148 | ||
188 | /******************************************************************************* | 149 | /******************************************************************************* |
@@ -218,19 +179,19 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) | |||
218 | * | 179 | * |
219 | * strlen() + 1 covers the first name_seg, which has no path separator | 180 | * strlen() + 1 covers the first name_seg, which has no path separator |
220 | */ | 181 | */ |
221 | if (acpi_ns_valid_root_prefix(*next_external_char)) { | 182 | if (ACPI_IS_ROOT_PREFIX(*next_external_char)) { |
222 | info->fully_qualified = TRUE; | 183 | info->fully_qualified = TRUE; |
223 | next_external_char++; | 184 | next_external_char++; |
224 | 185 | ||
225 | /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */ | 186 | /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */ |
226 | 187 | ||
227 | while (acpi_ns_valid_root_prefix(*next_external_char)) { | 188 | while (ACPI_IS_ROOT_PREFIX(*next_external_char)) { |
228 | next_external_char++; | 189 | next_external_char++; |
229 | } | 190 | } |
230 | } else { | 191 | } else { |
231 | /* Handle Carat prefixes */ | 192 | /* Handle Carat prefixes */ |
232 | 193 | ||
233 | while (*next_external_char == '^') { | 194 | while (ACPI_IS_PARENT_PREFIX(*next_external_char)) { |
234 | info->num_carats++; | 195 | info->num_carats++; |
235 | next_external_char++; | 196 | next_external_char++; |
236 | } | 197 | } |
@@ -244,7 +205,7 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) | |||
244 | if (*next_external_char) { | 205 | if (*next_external_char) { |
245 | info->num_segments = 1; | 206 | info->num_segments = 1; |
246 | for (i = 0; next_external_char[i]; i++) { | 207 | for (i = 0; next_external_char[i]; i++) { |
247 | if (acpi_ns_valid_path_separator(next_external_char[i])) { | 208 | if (ACPI_IS_PATH_SEPARATOR(next_external_char[i])) { |
248 | info->num_segments++; | 209 | info->num_segments++; |
249 | } | 210 | } |
250 | } | 211 | } |
@@ -282,7 +243,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
282 | /* Setup the correct prefixes, counts, and pointers */ | 243 | /* Setup the correct prefixes, counts, and pointers */ |
283 | 244 | ||
284 | if (info->fully_qualified) { | 245 | if (info->fully_qualified) { |
285 | internal_name[0] = '\\'; | 246 | internal_name[0] = AML_ROOT_PREFIX; |
286 | 247 | ||
287 | if (num_segments <= 1) { | 248 | if (num_segments <= 1) { |
288 | result = &internal_name[1]; | 249 | result = &internal_name[1]; |
@@ -302,7 +263,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
302 | i = 0; | 263 | i = 0; |
303 | if (info->num_carats) { | 264 | if (info->num_carats) { |
304 | for (i = 0; i < info->num_carats; i++) { | 265 | for (i = 0; i < info->num_carats; i++) { |
305 | internal_name[i] = '^'; | 266 | internal_name[i] = AML_PARENT_PREFIX; |
306 | } | 267 | } |
307 | } | 268 | } |
308 | 269 | ||
@@ -322,7 +283,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
322 | 283 | ||
323 | for (; num_segments; num_segments--) { | 284 | for (; num_segments; num_segments--) { |
324 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 285 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
325 | if (acpi_ns_valid_path_separator(*external_name) || | 286 | if (ACPI_IS_PATH_SEPARATOR(*external_name) || |
326 | (*external_name == 0)) { | 287 | (*external_name == 0)) { |
327 | 288 | ||
328 | /* Pad the segment with underscore(s) if segment is short */ | 289 | /* Pad the segment with underscore(s) if segment is short */ |
@@ -339,7 +300,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
339 | 300 | ||
340 | /* Now we must have a path separator, or the pathname is bad */ | 301 | /* Now we must have a path separator, or the pathname is bad */ |
341 | 302 | ||
342 | if (!acpi_ns_valid_path_separator(*external_name) && | 303 | if (!ACPI_IS_PATH_SEPARATOR(*external_name) && |
343 | (*external_name != 0)) { | 304 | (*external_name != 0)) { |
344 | return_ACPI_STATUS(AE_BAD_PATHNAME); | 305 | return_ACPI_STATUS(AE_BAD_PATHNAME); |
345 | } | 306 | } |
@@ -457,13 +418,13 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
457 | /* Check for a prefix (one '\' | one or more '^') */ | 418 | /* Check for a prefix (one '\' | one or more '^') */ |
458 | 419 | ||
459 | switch (internal_name[0]) { | 420 | switch (internal_name[0]) { |
460 | case '\\': | 421 | case AML_ROOT_PREFIX: |
461 | prefix_length = 1; | 422 | prefix_length = 1; |
462 | break; | 423 | break; |
463 | 424 | ||
464 | case '^': | 425 | case AML_PARENT_PREFIX: |
465 | for (i = 0; i < internal_name_length; i++) { | 426 | for (i = 0; i < internal_name_length; i++) { |
466 | if (internal_name[i] == '^') { | 427 | if (ACPI_IS_PARENT_PREFIX(internal_name[i])) { |
467 | prefix_length = i + 1; | 428 | prefix_length = i + 1; |
468 | } else { | 429 | } else { |
469 | break; | 430 | break; |
@@ -664,17 +625,17 @@ void acpi_ns_terminate(void) | |||
664 | 625 | ||
665 | u32 acpi_ns_opens_scope(acpi_object_type type) | 626 | u32 acpi_ns_opens_scope(acpi_object_type type) |
666 | { | 627 | { |
667 | ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type)); | 628 | ACPI_FUNCTION_ENTRY(); |
668 | 629 | ||
669 | if (!acpi_ut_valid_object_type(type)) { | 630 | if (type > ACPI_TYPE_LOCAL_MAX) { |
670 | 631 | ||
671 | /* type code out of range */ | 632 | /* type code out of range */ |
672 | 633 | ||
673 | ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); | 634 | ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); |
674 | return_UINT32(ACPI_NS_NORMAL); | 635 | return (ACPI_NS_NORMAL); |
675 | } | 636 | } |
676 | 637 | ||
677 | return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); | 638 | return (((u32)acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); |
678 | } | 639 | } |
679 | 640 | ||
680 | /******************************************************************************* | 641 | /******************************************************************************* |
@@ -710,6 +671,8 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | |||
710 | 671 | ||
711 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname)); | 672 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname)); |
712 | 673 | ||
674 | /* Simplest case is a null pathname */ | ||
675 | |||
713 | if (!pathname) { | 676 | if (!pathname) { |
714 | *return_node = prefix_node; | 677 | *return_node = prefix_node; |
715 | if (!prefix_node) { | 678 | if (!prefix_node) { |
@@ -718,6 +681,13 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | |||
718 | return_ACPI_STATUS(AE_OK); | 681 | return_ACPI_STATUS(AE_OK); |
719 | } | 682 | } |
720 | 683 | ||
684 | /* Quick check for a reference to the root */ | ||
685 | |||
686 | if (ACPI_IS_ROOT_PREFIX(pathname[0]) && (!pathname[1])) { | ||
687 | *return_node = acpi_gbl_root_node; | ||
688 | return_ACPI_STATUS(AE_OK); | ||
689 | } | ||
690 | |||
721 | /* Convert path to internal representation */ | 691 | /* Convert path to internal representation */ |
722 | 692 | ||
723 | status = acpi_ns_internalize_name(pathname, &internal_path); | 693 | status = acpi_ns_internalize_name(pathname, &internal_path); |
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c index 0483877f26b8..e70911a9e441 100644 --- a/drivers/acpi/acpica/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -76,12 +76,12 @@ struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node | |||
76 | 76 | ||
77 | /* It's really the parent's _scope_ that we want */ | 77 | /* It's really the parent's _scope_ that we want */ |
78 | 78 | ||
79 | return parent_node->child; | 79 | return (parent_node->child); |
80 | } | 80 | } |
81 | 81 | ||
82 | /* Otherwise just return the next peer */ | 82 | /* Otherwise just return the next peer */ |
83 | 83 | ||
84 | return child_node->peer; | 84 | return (child_node->peer); |
85 | } | 85 | } |
86 | 86 | ||
87 | /******************************************************************************* | 87 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index d6a9f77972b6..fc69949151bb 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -236,7 +236,7 @@ acpi_evaluate_object(acpi_handle handle, | |||
236 | * 2) No handle, not fully qualified pathname (error) | 236 | * 2) No handle, not fully qualified pathname (error) |
237 | * 3) Valid handle | 237 | * 3) Valid handle |
238 | */ | 238 | */ |
239 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { | 239 | if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) { |
240 | 240 | ||
241 | /* The path is fully qualified, just evaluate by name */ | 241 | /* The path is fully qualified, just evaluate by name */ |
242 | 242 | ||
@@ -492,7 +492,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
492 | */ | 492 | */ |
493 | status = acpi_ut_acquire_read_lock(&acpi_gbl_namespace_rw_lock); | 493 | status = acpi_ut_acquire_read_lock(&acpi_gbl_namespace_rw_lock); |
494 | if (ACPI_FAILURE(status)) { | 494 | if (ACPI_FAILURE(status)) { |
495 | return status; | 495 | return_ACPI_STATUS(status); |
496 | } | 496 | } |
497 | 497 | ||
498 | /* | 498 | /* |
@@ -550,7 +550,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
550 | 550 | ||
551 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 551 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
552 | if (ACPI_FAILURE(status)) { | 552 | if (ACPI_FAILURE(status)) { |
553 | return_ACPI_STATUS(status); | 553 | return (status); |
554 | } | 554 | } |
555 | 555 | ||
556 | node = acpi_ns_validate_handle(obj_handle); | 556 | node = acpi_ns_validate_handle(obj_handle); |
@@ -602,17 +602,22 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
602 | 602 | ||
603 | /* Walk the CID list */ | 603 | /* Walk the CID list */ |
604 | 604 | ||
605 | found = 0; | 605 | found = FALSE; |
606 | for (i = 0; i < cid->count; i++) { | 606 | for (i = 0; i < cid->count; i++) { |
607 | if (ACPI_STRCMP(cid->ids[i].string, info->hid) | 607 | if (ACPI_STRCMP(cid->ids[i].string, info->hid) |
608 | == 0) { | 608 | == 0) { |
609 | found = 1; | 609 | |
610 | /* Found a matching CID */ | ||
611 | |||
612 | found = TRUE; | ||
610 | break; | 613 | break; |
611 | } | 614 | } |
612 | } | 615 | } |
616 | |||
613 | ACPI_FREE(cid); | 617 | ACPI_FREE(cid); |
614 | if (!found) | 618 | if (!found) { |
615 | return (AE_OK); | 619 | return (AE_OK); |
620 | } | ||
616 | } | 621 | } |
617 | } | 622 | } |
618 | 623 | ||
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index 811c6f13f476..f3a4d95899f7 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -107,7 +107,7 @@ acpi_get_handle(acpi_handle parent, | |||
107 | * | 107 | * |
108 | * Error for <null Parent + relative path> | 108 | * Error for <null Parent + relative path> |
109 | */ | 109 | */ |
110 | if (acpi_ns_valid_root_prefix(pathname[0])) { | 110 | if (ACPI_IS_ROOT_PREFIX(pathname[0])) { |
111 | 111 | ||
112 | /* Pathname is fully qualified (starts with '\') */ | 112 | /* Pathname is fully qualified (starts with '\') */ |
113 | 113 | ||
@@ -290,7 +290,7 @@ acpi_get_object_info(acpi_handle handle, | |||
290 | 290 | ||
291 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 291 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
292 | if (ACPI_FAILURE(status)) { | 292 | if (ACPI_FAILURE(status)) { |
293 | goto cleanup; | 293 | return (status); |
294 | } | 294 | } |
295 | 295 | ||
296 | node = acpi_ns_validate_handle(handle); | 296 | node = acpi_ns_validate_handle(handle); |
@@ -539,14 +539,14 @@ acpi_status acpi_install_method(u8 *buffer) | |||
539 | /* Parameter validation */ | 539 | /* Parameter validation */ |
540 | 540 | ||
541 | if (!buffer) { | 541 | if (!buffer) { |
542 | return AE_BAD_PARAMETER; | 542 | return (AE_BAD_PARAMETER); |
543 | } | 543 | } |
544 | 544 | ||
545 | /* Table must be a DSDT or SSDT */ | 545 | /* Table must be a DSDT or SSDT */ |
546 | 546 | ||
547 | if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) && | 547 | if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) && |
548 | !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { | 548 | !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { |
549 | return AE_BAD_HEADER; | 549 | return (AE_BAD_HEADER); |
550 | } | 550 | } |
551 | 551 | ||
552 | /* First AML opcode in the table must be a control method */ | 552 | /* First AML opcode in the table must be a control method */ |
@@ -554,7 +554,7 @@ acpi_status acpi_install_method(u8 *buffer) | |||
554 | parser_state.aml = buffer + sizeof(struct acpi_table_header); | 554 | parser_state.aml = buffer + sizeof(struct acpi_table_header); |
555 | opcode = acpi_ps_peek_opcode(&parser_state); | 555 | opcode = acpi_ps_peek_opcode(&parser_state); |
556 | if (opcode != AML_METHOD_OP) { | 556 | if (opcode != AML_METHOD_OP) { |
557 | return AE_BAD_PARAMETER; | 557 | return (AE_BAD_PARAMETER); |
558 | } | 558 | } |
559 | 559 | ||
560 | /* Extract method information from the raw AML */ | 560 | /* Extract method information from the raw AML */ |
@@ -572,13 +572,13 @@ acpi_status acpi_install_method(u8 *buffer) | |||
572 | */ | 572 | */ |
573 | aml_buffer = ACPI_ALLOCATE(aml_length); | 573 | aml_buffer = ACPI_ALLOCATE(aml_length); |
574 | if (!aml_buffer) { | 574 | if (!aml_buffer) { |
575 | return AE_NO_MEMORY; | 575 | return (AE_NO_MEMORY); |
576 | } | 576 | } |
577 | 577 | ||
578 | method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); | 578 | method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); |
579 | if (!method_obj) { | 579 | if (!method_obj) { |
580 | ACPI_FREE(aml_buffer); | 580 | ACPI_FREE(aml_buffer); |
581 | return AE_NO_MEMORY; | 581 | return (AE_NO_MEMORY); |
582 | } | 582 | } |
583 | 583 | ||
584 | /* Lock namespace for acpi_ns_lookup, we may be creating a new node */ | 584 | /* Lock namespace for acpi_ns_lookup, we may be creating a new node */ |
@@ -644,12 +644,12 @@ acpi_status acpi_install_method(u8 *buffer) | |||
644 | /* Remove local reference to the method object */ | 644 | /* Remove local reference to the method object */ |
645 | 645 | ||
646 | acpi_ut_remove_reference(method_obj); | 646 | acpi_ut_remove_reference(method_obj); |
647 | return status; | 647 | return (status); |
648 | 648 | ||
649 | error_exit: | 649 | error_exit: |
650 | 650 | ||
651 | ACPI_FREE(aml_buffer); | 651 | ACPI_FREE(aml_buffer); |
652 | ACPI_FREE(method_obj); | 652 | ACPI_FREE(method_obj); |
653 | return status; | 653 | return (status); |
654 | } | 654 | } |
655 | ACPI_EXPORT_SYMBOL(acpi_install_method) | 655 | ACPI_EXPORT_SYMBOL(acpi_install_method) |
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 9d029dac6b64..c0853ef294e4 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2012, Intel Corp. | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index cb79e2d4d743..f51308cdbc65 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -108,7 +108,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | |||
108 | /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ | 108 | /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */ |
109 | 109 | ||
110 | package_length |= (aml[0] & byte_zero_mask); | 110 | package_length |= (aml[0] & byte_zero_mask); |
111 | return_UINT32(package_length); | 111 | return_VALUE(package_length); |
112 | } | 112 | } |
113 | 113 | ||
114 | /******************************************************************************* | 114 | /******************************************************************************* |
@@ -162,7 +162,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
162 | 162 | ||
163 | /* Point past any namestring prefix characters (backslash or carat) */ | 163 | /* Point past any namestring prefix characters (backslash or carat) */ |
164 | 164 | ||
165 | while (acpi_ps_is_prefix_char(*end)) { | 165 | while (ACPI_IS_ROOT_PREFIX(*end) || ACPI_IS_PARENT_PREFIX(*end)) { |
166 | end++; | 166 | end++; |
167 | } | 167 | } |
168 | 168 | ||
@@ -798,7 +798,8 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
798 | subop = acpi_ps_peek_opcode(parser_state); | 798 | subop = acpi_ps_peek_opcode(parser_state); |
799 | if (subop == 0 || | 799 | if (subop == 0 || |
800 | acpi_ps_is_leading_char(subop) || | 800 | acpi_ps_is_leading_char(subop) || |
801 | acpi_ps_is_prefix_char(subop)) { | 801 | ACPI_IS_ROOT_PREFIX(subop) || |
802 | ACPI_IS_PARENT_PREFIX(subop)) { | ||
802 | 803 | ||
803 | /* null_name or name_string */ | 804 | /* null_name or name_string */ |
804 | 805 | ||
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index 5607805aab26..63c455447481 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -58,352 +58,17 @@ | |||
58 | #define _COMPONENT ACPI_PARSER | 58 | #define _COMPONENT ACPI_PARSER |
59 | ACPI_MODULE_NAME("psloop") | 59 | ACPI_MODULE_NAME("psloop") |
60 | 60 | ||
61 | static u32 acpi_gbl_depth = 0; | ||
62 | |||
63 | /* Local prototypes */ | 61 | /* Local prototypes */ |
64 | |||
65 | static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state); | ||
66 | |||
67 | static acpi_status | ||
68 | acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | ||
69 | u8 * aml_op_start, | ||
70 | union acpi_parse_object *unnamed_op, | ||
71 | union acpi_parse_object **op); | ||
72 | |||
73 | static acpi_status | ||
74 | acpi_ps_create_op(struct acpi_walk_state *walk_state, | ||
75 | u8 * aml_op_start, union acpi_parse_object **new_op); | ||
76 | |||
77 | static acpi_status | 62 | static acpi_status |
78 | acpi_ps_get_arguments(struct acpi_walk_state *walk_state, | 63 | acpi_ps_get_arguments(struct acpi_walk_state *walk_state, |
79 | u8 * aml_op_start, union acpi_parse_object *op); | 64 | u8 * aml_op_start, union acpi_parse_object *op); |
80 | 65 | ||
81 | static acpi_status | ||
82 | acpi_ps_complete_op(struct acpi_walk_state *walk_state, | ||
83 | union acpi_parse_object **op, acpi_status status); | ||
84 | |||
85 | static acpi_status | ||
86 | acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, | ||
87 | union acpi_parse_object *op, acpi_status status); | ||
88 | |||
89 | static void | 66 | static void |
90 | acpi_ps_link_module_code(union acpi_parse_object *parent_op, | 67 | acpi_ps_link_module_code(union acpi_parse_object *parent_op, |
91 | u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); | 68 | u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); |
92 | 69 | ||
93 | /******************************************************************************* | 70 | /******************************************************************************* |
94 | * | 71 | * |
95 | * FUNCTION: acpi_ps_get_aml_opcode | ||
96 | * | ||
97 | * PARAMETERS: walk_state - Current state | ||
98 | * | ||
99 | * RETURN: Status | ||
100 | * | ||
101 | * DESCRIPTION: Extract the next AML opcode from the input stream. | ||
102 | * | ||
103 | ******************************************************************************/ | ||
104 | |||
105 | static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state) | ||
106 | { | ||
107 | |||
108 | ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state); | ||
109 | |||
110 | walk_state->aml_offset = | ||
111 | (u32) ACPI_PTR_DIFF(walk_state->parser_state.aml, | ||
112 | walk_state->parser_state.aml_start); | ||
113 | walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state)); | ||
114 | |||
115 | /* | ||
116 | * First cut to determine what we have found: | ||
117 | * 1) A valid AML opcode | ||
118 | * 2) A name string | ||
119 | * 3) An unknown/invalid opcode | ||
120 | */ | ||
121 | walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode); | ||
122 | |||
123 | switch (walk_state->op_info->class) { | ||
124 | case AML_CLASS_ASCII: | ||
125 | case AML_CLASS_PREFIX: | ||
126 | /* | ||
127 | * Starts with a valid prefix or ASCII char, this is a name | ||
128 | * string. Convert the bare name string to a namepath. | ||
129 | */ | ||
130 | walk_state->opcode = AML_INT_NAMEPATH_OP; | ||
131 | walk_state->arg_types = ARGP_NAMESTRING; | ||
132 | break; | ||
133 | |||
134 | case AML_CLASS_UNKNOWN: | ||
135 | |||
136 | /* The opcode is unrecognized. Complain and skip unknown opcodes */ | ||
137 | |||
138 | if (walk_state->pass_number == 2) { | ||
139 | ACPI_ERROR((AE_INFO, | ||
140 | "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", | ||
141 | walk_state->opcode, | ||
142 | (u32)(walk_state->aml_offset + | ||
143 | sizeof(struct acpi_table_header)))); | ||
144 | |||
145 | ACPI_DUMP_BUFFER(walk_state->parser_state.aml - 16, 48); | ||
146 | |||
147 | #ifdef ACPI_ASL_COMPILER | ||
148 | /* | ||
149 | * This is executed for the disassembler only. Output goes | ||
150 | * to the disassembled ASL output file. | ||
151 | */ | ||
152 | acpi_os_printf | ||
153 | ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", | ||
154 | walk_state->opcode, | ||
155 | (u32)(walk_state->aml_offset + | ||
156 | sizeof(struct acpi_table_header))); | ||
157 | |||
158 | /* Dump the context surrounding the invalid opcode */ | ||
159 | |||
160 | acpi_ut_dump_buffer(((u8 *)walk_state->parser_state. | ||
161 | aml - 16), 48, DB_BYTE_DISPLAY, | ||
162 | walk_state->aml_offset + | ||
163 | sizeof(struct acpi_table_header) - | ||
164 | 16); | ||
165 | acpi_os_printf(" */\n"); | ||
166 | #endif | ||
167 | } | ||
168 | |||
169 | /* Increment past one-byte or two-byte opcode */ | ||
170 | |||
171 | walk_state->parser_state.aml++; | ||
172 | if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */ | ||
173 | walk_state->parser_state.aml++; | ||
174 | } | ||
175 | |||
176 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
177 | |||
178 | default: | ||
179 | |||
180 | /* Found opcode info, this is a normal opcode */ | ||
181 | |||
182 | walk_state->parser_state.aml += | ||
183 | acpi_ps_get_opcode_size(walk_state->opcode); | ||
184 | walk_state->arg_types = walk_state->op_info->parse_args; | ||
185 | break; | ||
186 | } | ||
187 | |||
188 | return_ACPI_STATUS(AE_OK); | ||
189 | } | ||
190 | |||
191 | /******************************************************************************* | ||
192 | * | ||
193 | * FUNCTION: acpi_ps_build_named_op | ||
194 | * | ||
195 | * PARAMETERS: walk_state - Current state | ||
196 | * aml_op_start - Begin of named Op in AML | ||
197 | * unnamed_op - Early Op (not a named Op) | ||
198 | * op - Returned Op | ||
199 | * | ||
200 | * RETURN: Status | ||
201 | * | ||
202 | * DESCRIPTION: Parse a named Op | ||
203 | * | ||
204 | ******************************************************************************/ | ||
205 | |||
206 | static acpi_status | ||
207 | acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | ||
208 | u8 * aml_op_start, | ||
209 | union acpi_parse_object *unnamed_op, | ||
210 | union acpi_parse_object **op) | ||
211 | { | ||
212 | acpi_status status = AE_OK; | ||
213 | union acpi_parse_object *arg = NULL; | ||
214 | |||
215 | ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state); | ||
216 | |||
217 | unnamed_op->common.value.arg = NULL; | ||
218 | unnamed_op->common.arg_list_length = 0; | ||
219 | unnamed_op->common.aml_opcode = walk_state->opcode; | ||
220 | |||
221 | /* | ||
222 | * Get and append arguments until we find the node that contains | ||
223 | * the name (the type ARGP_NAME). | ||
224 | */ | ||
225 | while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) && | ||
226 | (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) { | ||
227 | status = | ||
228 | acpi_ps_get_next_arg(walk_state, | ||
229 | &(walk_state->parser_state), | ||
230 | GET_CURRENT_ARG_TYPE(walk_state-> | ||
231 | arg_types), &arg); | ||
232 | if (ACPI_FAILURE(status)) { | ||
233 | return_ACPI_STATUS(status); | ||
234 | } | ||
235 | |||
236 | acpi_ps_append_arg(unnamed_op, arg); | ||
237 | INCREMENT_ARG_LIST(walk_state->arg_types); | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * Make sure that we found a NAME and didn't run out of arguments | ||
242 | */ | ||
243 | if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) { | ||
244 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | ||
245 | } | ||
246 | |||
247 | /* We know that this arg is a name, move to next arg */ | ||
248 | |||
249 | INCREMENT_ARG_LIST(walk_state->arg_types); | ||
250 | |||
251 | /* | ||
252 | * Find the object. This will either insert the object into | ||
253 | * the namespace or simply look it up | ||
254 | */ | ||
255 | walk_state->op = NULL; | ||
256 | |||
257 | status = walk_state->descending_callback(walk_state, op); | ||
258 | if (ACPI_FAILURE(status)) { | ||
259 | ACPI_EXCEPTION((AE_INFO, status, "During name lookup/catalog")); | ||
260 | return_ACPI_STATUS(status); | ||
261 | } | ||
262 | |||
263 | if (!*op) { | ||
264 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
265 | } | ||
266 | |||
267 | status = acpi_ps_next_parse_state(walk_state, *op, status); | ||
268 | if (ACPI_FAILURE(status)) { | ||
269 | if (status == AE_CTRL_PENDING) { | ||
270 | return_ACPI_STATUS(AE_CTRL_PARSE_PENDING); | ||
271 | } | ||
272 | return_ACPI_STATUS(status); | ||
273 | } | ||
274 | |||
275 | acpi_ps_append_arg(*op, unnamed_op->common.value.arg); | ||
276 | acpi_gbl_depth++; | ||
277 | |||
278 | if ((*op)->common.aml_opcode == AML_REGION_OP || | ||
279 | (*op)->common.aml_opcode == AML_DATA_REGION_OP) { | ||
280 | /* | ||
281 | * Defer final parsing of an operation_region body, because we don't | ||
282 | * have enough info in the first pass to parse it correctly (i.e., | ||
283 | * there may be method calls within the term_arg elements of the body.) | ||
284 | * | ||
285 | * However, we must continue parsing because the opregion is not a | ||
286 | * standalone package -- we don't know where the end is at this point. | ||
287 | * | ||
288 | * (Length is unknown until parse of the body complete) | ||
289 | */ | ||
290 | (*op)->named.data = aml_op_start; | ||
291 | (*op)->named.length = 0; | ||
292 | } | ||
293 | |||
294 | return_ACPI_STATUS(AE_OK); | ||
295 | } | ||
296 | |||
297 | /******************************************************************************* | ||
298 | * | ||
299 | * FUNCTION: acpi_ps_create_op | ||
300 | * | ||
301 | * PARAMETERS: walk_state - Current state | ||
302 | * aml_op_start - Op start in AML | ||
303 | * new_op - Returned Op | ||
304 | * | ||
305 | * RETURN: Status | ||
306 | * | ||
307 | * DESCRIPTION: Get Op from AML | ||
308 | * | ||
309 | ******************************************************************************/ | ||
310 | |||
311 | static acpi_status | ||
312 | acpi_ps_create_op(struct acpi_walk_state *walk_state, | ||
313 | u8 * aml_op_start, union acpi_parse_object **new_op) | ||
314 | { | ||
315 | acpi_status status = AE_OK; | ||
316 | union acpi_parse_object *op; | ||
317 | union acpi_parse_object *named_op = NULL; | ||
318 | union acpi_parse_object *parent_scope; | ||
319 | u8 argument_count; | ||
320 | const struct acpi_opcode_info *op_info; | ||
321 | |||
322 | ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state); | ||
323 | |||
324 | status = acpi_ps_get_aml_opcode(walk_state); | ||
325 | if (status == AE_CTRL_PARSE_CONTINUE) { | ||
326 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
327 | } | ||
328 | |||
329 | /* Create Op structure and append to parent's argument list */ | ||
330 | |||
331 | walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode); | ||
332 | op = acpi_ps_alloc_op(walk_state->opcode); | ||
333 | if (!op) { | ||
334 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
335 | } | ||
336 | |||
337 | if (walk_state->op_info->flags & AML_NAMED) { | ||
338 | status = | ||
339 | acpi_ps_build_named_op(walk_state, aml_op_start, op, | ||
340 | &named_op); | ||
341 | acpi_ps_free_op(op); | ||
342 | if (ACPI_FAILURE(status)) { | ||
343 | return_ACPI_STATUS(status); | ||
344 | } | ||
345 | |||
346 | *new_op = named_op; | ||
347 | return_ACPI_STATUS(AE_OK); | ||
348 | } | ||
349 | |||
350 | /* Not a named opcode, just allocate Op and append to parent */ | ||
351 | |||
352 | if (walk_state->op_info->flags & AML_CREATE) { | ||
353 | /* | ||
354 | * Backup to beginning of create_XXXfield declaration | ||
355 | * body_length is unknown until we parse the body | ||
356 | */ | ||
357 | op->named.data = aml_op_start; | ||
358 | op->named.length = 0; | ||
359 | } | ||
360 | |||
361 | if (walk_state->opcode == AML_BANK_FIELD_OP) { | ||
362 | /* | ||
363 | * Backup to beginning of bank_field declaration | ||
364 | * body_length is unknown until we parse the body | ||
365 | */ | ||
366 | op->named.data = aml_op_start; | ||
367 | op->named.length = 0; | ||
368 | } | ||
369 | |||
370 | parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state)); | ||
371 | acpi_ps_append_arg(parent_scope, op); | ||
372 | |||
373 | if (parent_scope) { | ||
374 | op_info = | ||
375 | acpi_ps_get_opcode_info(parent_scope->common.aml_opcode); | ||
376 | if (op_info->flags & AML_HAS_TARGET) { | ||
377 | argument_count = | ||
378 | acpi_ps_get_argument_count(op_info->type); | ||
379 | if (parent_scope->common.arg_list_length > | ||
380 | argument_count) { | ||
381 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
382 | } | ||
383 | } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) { | ||
384 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
385 | } | ||
386 | } | ||
387 | |||
388 | if (walk_state->descending_callback != NULL) { | ||
389 | /* | ||
390 | * Find the object. This will either insert the object into | ||
391 | * the namespace or simply look it up | ||
392 | */ | ||
393 | walk_state->op = *new_op = op; | ||
394 | |||
395 | status = walk_state->descending_callback(walk_state, &op); | ||
396 | status = acpi_ps_next_parse_state(walk_state, op, status); | ||
397 | if (status == AE_CTRL_PENDING) { | ||
398 | status = AE_CTRL_PARSE_PENDING; | ||
399 | } | ||
400 | } | ||
401 | |||
402 | return_ACPI_STATUS(status); | ||
403 | } | ||
404 | |||
405 | /******************************************************************************* | ||
406 | * | ||
407 | * FUNCTION: acpi_ps_get_arguments | 72 | * FUNCTION: acpi_ps_get_arguments |
408 | * | 73 | * |
409 | * PARAMETERS: walk_state - Current state | 74 | * PARAMETERS: walk_state - Current state |
@@ -711,288 +376,6 @@ acpi_ps_link_module_code(union acpi_parse_object *parent_op, | |||
711 | 376 | ||
712 | /******************************************************************************* | 377 | /******************************************************************************* |
713 | * | 378 | * |
714 | * FUNCTION: acpi_ps_complete_op | ||
715 | * | ||
716 | * PARAMETERS: walk_state - Current state | ||
717 | * op - Returned Op | ||
718 | * status - Parse status before complete Op | ||
719 | * | ||
720 | * RETURN: Status | ||
721 | * | ||
722 | * DESCRIPTION: Complete Op | ||
723 | * | ||
724 | ******************************************************************************/ | ||
725 | |||
726 | static acpi_status | ||
727 | acpi_ps_complete_op(struct acpi_walk_state *walk_state, | ||
728 | union acpi_parse_object **op, acpi_status status) | ||
729 | { | ||
730 | acpi_status status2; | ||
731 | |||
732 | ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state); | ||
733 | |||
734 | /* | ||
735 | * Finished one argument of the containing scope | ||
736 | */ | ||
737 | walk_state->parser_state.scope->parse_scope.arg_count--; | ||
738 | |||
739 | /* Close this Op (will result in parse subtree deletion) */ | ||
740 | |||
741 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
742 | if (ACPI_FAILURE(status2)) { | ||
743 | return_ACPI_STATUS(status2); | ||
744 | } | ||
745 | |||
746 | *op = NULL; | ||
747 | |||
748 | switch (status) { | ||
749 | case AE_OK: | ||
750 | break; | ||
751 | |||
752 | case AE_CTRL_TRANSFER: | ||
753 | |||
754 | /* We are about to transfer to a called method */ | ||
755 | |||
756 | walk_state->prev_op = NULL; | ||
757 | walk_state->prev_arg_types = walk_state->arg_types; | ||
758 | return_ACPI_STATUS(status); | ||
759 | |||
760 | case AE_CTRL_END: | ||
761 | |||
762 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
763 | &walk_state->arg_types, | ||
764 | &walk_state->arg_count); | ||
765 | |||
766 | if (*op) { | ||
767 | walk_state->op = *op; | ||
768 | walk_state->op_info = | ||
769 | acpi_ps_get_opcode_info((*op)->common.aml_opcode); | ||
770 | walk_state->opcode = (*op)->common.aml_opcode; | ||
771 | |||
772 | status = walk_state->ascending_callback(walk_state); | ||
773 | status = | ||
774 | acpi_ps_next_parse_state(walk_state, *op, status); | ||
775 | |||
776 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
777 | if (ACPI_FAILURE(status2)) { | ||
778 | return_ACPI_STATUS(status2); | ||
779 | } | ||
780 | } | ||
781 | |||
782 | status = AE_OK; | ||
783 | break; | ||
784 | |||
785 | case AE_CTRL_BREAK: | ||
786 | case AE_CTRL_CONTINUE: | ||
787 | |||
788 | /* Pop off scopes until we find the While */ | ||
789 | |||
790 | while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) { | ||
791 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
792 | &walk_state->arg_types, | ||
793 | &walk_state->arg_count); | ||
794 | } | ||
795 | |||
796 | /* Close this iteration of the While loop */ | ||
797 | |||
798 | walk_state->op = *op; | ||
799 | walk_state->op_info = | ||
800 | acpi_ps_get_opcode_info((*op)->common.aml_opcode); | ||
801 | walk_state->opcode = (*op)->common.aml_opcode; | ||
802 | |||
803 | status = walk_state->ascending_callback(walk_state); | ||
804 | status = acpi_ps_next_parse_state(walk_state, *op, status); | ||
805 | |||
806 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
807 | if (ACPI_FAILURE(status2)) { | ||
808 | return_ACPI_STATUS(status2); | ||
809 | } | ||
810 | |||
811 | status = AE_OK; | ||
812 | break; | ||
813 | |||
814 | case AE_CTRL_TERMINATE: | ||
815 | |||
816 | /* Clean up */ | ||
817 | do { | ||
818 | if (*op) { | ||
819 | status2 = | ||
820 | acpi_ps_complete_this_op(walk_state, *op); | ||
821 | if (ACPI_FAILURE(status2)) { | ||
822 | return_ACPI_STATUS(status2); | ||
823 | } | ||
824 | |||
825 | acpi_ut_delete_generic_state | ||
826 | (acpi_ut_pop_generic_state | ||
827 | (&walk_state->control_state)); | ||
828 | } | ||
829 | |||
830 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
831 | &walk_state->arg_types, | ||
832 | &walk_state->arg_count); | ||
833 | |||
834 | } while (*op); | ||
835 | |||
836 | return_ACPI_STATUS(AE_OK); | ||
837 | |||
838 | default: /* All other non-AE_OK status */ | ||
839 | |||
840 | do { | ||
841 | if (*op) { | ||
842 | status2 = | ||
843 | acpi_ps_complete_this_op(walk_state, *op); | ||
844 | if (ACPI_FAILURE(status2)) { | ||
845 | return_ACPI_STATUS(status2); | ||
846 | } | ||
847 | } | ||
848 | |||
849 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
850 | &walk_state->arg_types, | ||
851 | &walk_state->arg_count); | ||
852 | |||
853 | } while (*op); | ||
854 | |||
855 | #if 0 | ||
856 | /* | ||
857 | * TBD: Cleanup parse ops on error | ||
858 | */ | ||
859 | if (*op == NULL) { | ||
860 | acpi_ps_pop_scope(parser_state, op, | ||
861 | &walk_state->arg_types, | ||
862 | &walk_state->arg_count); | ||
863 | } | ||
864 | #endif | ||
865 | walk_state->prev_op = NULL; | ||
866 | walk_state->prev_arg_types = walk_state->arg_types; | ||
867 | return_ACPI_STATUS(status); | ||
868 | } | ||
869 | |||
870 | /* This scope complete? */ | ||
871 | |||
872 | if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) { | ||
873 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
874 | &walk_state->arg_types, | ||
875 | &walk_state->arg_count); | ||
876 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op)); | ||
877 | } else { | ||
878 | *op = NULL; | ||
879 | } | ||
880 | |||
881 | return_ACPI_STATUS(AE_OK); | ||
882 | } | ||
883 | |||
884 | /******************************************************************************* | ||
885 | * | ||
886 | * FUNCTION: acpi_ps_complete_final_op | ||
887 | * | ||
888 | * PARAMETERS: walk_state - Current state | ||
889 | * op - Current Op | ||
890 | * status - Current parse status before complete last | ||
891 | * Op | ||
892 | * | ||
893 | * RETURN: Status | ||
894 | * | ||
895 | * DESCRIPTION: Complete last Op. | ||
896 | * | ||
897 | ******************************************************************************/ | ||
898 | |||
899 | static acpi_status | ||
900 | acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, | ||
901 | union acpi_parse_object *op, acpi_status status) | ||
902 | { | ||
903 | acpi_status status2; | ||
904 | |||
905 | ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state); | ||
906 | |||
907 | /* | ||
908 | * Complete the last Op (if not completed), and clear the scope stack. | ||
909 | * It is easily possible to end an AML "package" with an unbounded number | ||
910 | * of open scopes (such as when several ASL blocks are closed with | ||
911 | * sequential closing braces). We want to terminate each one cleanly. | ||
912 | */ | ||
913 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n", | ||
914 | op)); | ||
915 | do { | ||
916 | if (op) { | ||
917 | if (walk_state->ascending_callback != NULL) { | ||
918 | walk_state->op = op; | ||
919 | walk_state->op_info = | ||
920 | acpi_ps_get_opcode_info(op->common. | ||
921 | aml_opcode); | ||
922 | walk_state->opcode = op->common.aml_opcode; | ||
923 | |||
924 | status = | ||
925 | walk_state->ascending_callback(walk_state); | ||
926 | status = | ||
927 | acpi_ps_next_parse_state(walk_state, op, | ||
928 | status); | ||
929 | if (status == AE_CTRL_PENDING) { | ||
930 | status = | ||
931 | acpi_ps_complete_op(walk_state, &op, | ||
932 | AE_OK); | ||
933 | if (ACPI_FAILURE(status)) { | ||
934 | return_ACPI_STATUS(status); | ||
935 | } | ||
936 | } | ||
937 | |||
938 | if (status == AE_CTRL_TERMINATE) { | ||
939 | status = AE_OK; | ||
940 | |||
941 | /* Clean up */ | ||
942 | do { | ||
943 | if (op) { | ||
944 | status2 = | ||
945 | acpi_ps_complete_this_op | ||
946 | (walk_state, op); | ||
947 | if (ACPI_FAILURE | ||
948 | (status2)) { | ||
949 | return_ACPI_STATUS | ||
950 | (status2); | ||
951 | } | ||
952 | } | ||
953 | |||
954 | acpi_ps_pop_scope(& | ||
955 | (walk_state-> | ||
956 | parser_state), | ||
957 | &op, | ||
958 | &walk_state-> | ||
959 | arg_types, | ||
960 | &walk_state-> | ||
961 | arg_count); | ||
962 | |||
963 | } while (op); | ||
964 | |||
965 | return_ACPI_STATUS(status); | ||
966 | } | ||
967 | |||
968 | else if (ACPI_FAILURE(status)) { | ||
969 | |||
970 | /* First error is most important */ | ||
971 | |||
972 | (void) | ||
973 | acpi_ps_complete_this_op(walk_state, | ||
974 | op); | ||
975 | return_ACPI_STATUS(status); | ||
976 | } | ||
977 | } | ||
978 | |||
979 | status2 = acpi_ps_complete_this_op(walk_state, op); | ||
980 | if (ACPI_FAILURE(status2)) { | ||
981 | return_ACPI_STATUS(status2); | ||
982 | } | ||
983 | } | ||
984 | |||
985 | acpi_ps_pop_scope(&(walk_state->parser_state), &op, | ||
986 | &walk_state->arg_types, | ||
987 | &walk_state->arg_count); | ||
988 | |||
989 | } while (op); | ||
990 | |||
991 | return_ACPI_STATUS(status); | ||
992 | } | ||
993 | |||
994 | /******************************************************************************* | ||
995 | * | ||
996 | * FUNCTION: acpi_ps_parse_loop | 379 | * FUNCTION: acpi_ps_parse_loop |
997 | * | 380 | * |
998 | * PARAMETERS: walk_state - Current state | 381 | * PARAMETERS: walk_state - Current state |
@@ -1177,10 +560,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
1177 | walk_state->op_info = | 560 | walk_state->op_info = |
1178 | acpi_ps_get_opcode_info(op->common.aml_opcode); | 561 | acpi_ps_get_opcode_info(op->common.aml_opcode); |
1179 | if (walk_state->op_info->flags & AML_NAMED) { | 562 | if (walk_state->op_info->flags & AML_NAMED) { |
1180 | if (acpi_gbl_depth) { | ||
1181 | acpi_gbl_depth--; | ||
1182 | } | ||
1183 | |||
1184 | if (op->common.aml_opcode == AML_REGION_OP || | 563 | if (op->common.aml_opcode == AML_REGION_OP || |
1185 | op->common.aml_opcode == AML_DATA_REGION_OP) { | 564 | op->common.aml_opcode == AML_DATA_REGION_OP) { |
1186 | /* | 565 | /* |
diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c new file mode 100644 index 000000000000..12c4028002b1 --- /dev/null +++ b/drivers/acpi/acpica/psobject.c | |||
@@ -0,0 +1,647 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: psobject - Support for parse objects | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acparser.h" | ||
47 | #include "amlcode.h" | ||
48 | |||
49 | #define _COMPONENT ACPI_PARSER | ||
50 | ACPI_MODULE_NAME("psobject") | ||
51 | |||
52 | /* Local prototypes */ | ||
53 | static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state); | ||
54 | |||
55 | /******************************************************************************* | ||
56 | * | ||
57 | * FUNCTION: acpi_ps_get_aml_opcode | ||
58 | * | ||
59 | * PARAMETERS: walk_state - Current state | ||
60 | * | ||
61 | * RETURN: Status | ||
62 | * | ||
63 | * DESCRIPTION: Extract the next AML opcode from the input stream. | ||
64 | * | ||
65 | ******************************************************************************/ | ||
66 | |||
67 | static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state) | ||
68 | { | ||
69 | |||
70 | ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state); | ||
71 | |||
72 | walk_state->aml_offset = | ||
73 | (u32)ACPI_PTR_DIFF(walk_state->parser_state.aml, | ||
74 | walk_state->parser_state.aml_start); | ||
75 | walk_state->opcode = acpi_ps_peek_opcode(&(walk_state->parser_state)); | ||
76 | |||
77 | /* | ||
78 | * First cut to determine what we have found: | ||
79 | * 1) A valid AML opcode | ||
80 | * 2) A name string | ||
81 | * 3) An unknown/invalid opcode | ||
82 | */ | ||
83 | walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode); | ||
84 | |||
85 | switch (walk_state->op_info->class) { | ||
86 | case AML_CLASS_ASCII: | ||
87 | case AML_CLASS_PREFIX: | ||
88 | /* | ||
89 | * Starts with a valid prefix or ASCII char, this is a name | ||
90 | * string. Convert the bare name string to a namepath. | ||
91 | */ | ||
92 | walk_state->opcode = AML_INT_NAMEPATH_OP; | ||
93 | walk_state->arg_types = ARGP_NAMESTRING; | ||
94 | break; | ||
95 | |||
96 | case AML_CLASS_UNKNOWN: | ||
97 | |||
98 | /* The opcode is unrecognized. Complain and skip unknown opcodes */ | ||
99 | |||
100 | if (walk_state->pass_number == 2) { | ||
101 | ACPI_ERROR((AE_INFO, | ||
102 | "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", | ||
103 | walk_state->opcode, | ||
104 | (u32)(walk_state->aml_offset + | ||
105 | sizeof(struct acpi_table_header)))); | ||
106 | |||
107 | ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16), | ||
108 | 48); | ||
109 | |||
110 | #ifdef ACPI_ASL_COMPILER | ||
111 | /* | ||
112 | * This is executed for the disassembler only. Output goes | ||
113 | * to the disassembled ASL output file. | ||
114 | */ | ||
115 | acpi_os_printf | ||
116 | ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", | ||
117 | walk_state->opcode, | ||
118 | (u32)(walk_state->aml_offset + | ||
119 | sizeof(struct acpi_table_header))); | ||
120 | |||
121 | /* Dump the context surrounding the invalid opcode */ | ||
122 | |||
123 | acpi_ut_dump_buffer(((u8 *)walk_state->parser_state. | ||
124 | aml - 16), 48, DB_BYTE_DISPLAY, | ||
125 | (walk_state->aml_offset + | ||
126 | sizeof(struct acpi_table_header) - | ||
127 | 16)); | ||
128 | acpi_os_printf(" */\n"); | ||
129 | #endif | ||
130 | } | ||
131 | |||
132 | /* Increment past one-byte or two-byte opcode */ | ||
133 | |||
134 | walk_state->parser_state.aml++; | ||
135 | if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */ | ||
136 | walk_state->parser_state.aml++; | ||
137 | } | ||
138 | |||
139 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
140 | |||
141 | default: | ||
142 | |||
143 | /* Found opcode info, this is a normal opcode */ | ||
144 | |||
145 | walk_state->parser_state.aml += | ||
146 | acpi_ps_get_opcode_size(walk_state->opcode); | ||
147 | walk_state->arg_types = walk_state->op_info->parse_args; | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | return_ACPI_STATUS(AE_OK); | ||
152 | } | ||
153 | |||
154 | /******************************************************************************* | ||
155 | * | ||
156 | * FUNCTION: acpi_ps_build_named_op | ||
157 | * | ||
158 | * PARAMETERS: walk_state - Current state | ||
159 | * aml_op_start - Begin of named Op in AML | ||
160 | * unnamed_op - Early Op (not a named Op) | ||
161 | * op - Returned Op | ||
162 | * | ||
163 | * RETURN: Status | ||
164 | * | ||
165 | * DESCRIPTION: Parse a named Op | ||
166 | * | ||
167 | ******************************************************************************/ | ||
168 | |||
169 | acpi_status | ||
170 | acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | ||
171 | u8 *aml_op_start, | ||
172 | union acpi_parse_object *unnamed_op, | ||
173 | union acpi_parse_object **op) | ||
174 | { | ||
175 | acpi_status status = AE_OK; | ||
176 | union acpi_parse_object *arg = NULL; | ||
177 | |||
178 | ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state); | ||
179 | |||
180 | unnamed_op->common.value.arg = NULL; | ||
181 | unnamed_op->common.arg_list_length = 0; | ||
182 | unnamed_op->common.aml_opcode = walk_state->opcode; | ||
183 | |||
184 | /* | ||
185 | * Get and append arguments until we find the node that contains | ||
186 | * the name (the type ARGP_NAME). | ||
187 | */ | ||
188 | while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) && | ||
189 | (GET_CURRENT_ARG_TYPE(walk_state->arg_types) != ARGP_NAME)) { | ||
190 | status = | ||
191 | acpi_ps_get_next_arg(walk_state, | ||
192 | &(walk_state->parser_state), | ||
193 | GET_CURRENT_ARG_TYPE(walk_state-> | ||
194 | arg_types), &arg); | ||
195 | if (ACPI_FAILURE(status)) { | ||
196 | return_ACPI_STATUS(status); | ||
197 | } | ||
198 | |||
199 | acpi_ps_append_arg(unnamed_op, arg); | ||
200 | INCREMENT_ARG_LIST(walk_state->arg_types); | ||
201 | } | ||
202 | |||
203 | /* | ||
204 | * Make sure that we found a NAME and didn't run out of arguments | ||
205 | */ | ||
206 | if (!GET_CURRENT_ARG_TYPE(walk_state->arg_types)) { | ||
207 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | ||
208 | } | ||
209 | |||
210 | /* We know that this arg is a name, move to next arg */ | ||
211 | |||
212 | INCREMENT_ARG_LIST(walk_state->arg_types); | ||
213 | |||
214 | /* | ||
215 | * Find the object. This will either insert the object into | ||
216 | * the namespace or simply look it up | ||
217 | */ | ||
218 | walk_state->op = NULL; | ||
219 | |||
220 | status = walk_state->descending_callback(walk_state, op); | ||
221 | if (ACPI_FAILURE(status)) { | ||
222 | ACPI_EXCEPTION((AE_INFO, status, "During name lookup/catalog")); | ||
223 | return_ACPI_STATUS(status); | ||
224 | } | ||
225 | |||
226 | if (!*op) { | ||
227 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
228 | } | ||
229 | |||
230 | status = acpi_ps_next_parse_state(walk_state, *op, status); | ||
231 | if (ACPI_FAILURE(status)) { | ||
232 | if (status == AE_CTRL_PENDING) { | ||
233 | return_ACPI_STATUS(AE_CTRL_PARSE_PENDING); | ||
234 | } | ||
235 | return_ACPI_STATUS(status); | ||
236 | } | ||
237 | |||
238 | acpi_ps_append_arg(*op, unnamed_op->common.value.arg); | ||
239 | |||
240 | if ((*op)->common.aml_opcode == AML_REGION_OP || | ||
241 | (*op)->common.aml_opcode == AML_DATA_REGION_OP) { | ||
242 | /* | ||
243 | * Defer final parsing of an operation_region body, because we don't | ||
244 | * have enough info in the first pass to parse it correctly (i.e., | ||
245 | * there may be method calls within the term_arg elements of the body.) | ||
246 | * | ||
247 | * However, we must continue parsing because the opregion is not a | ||
248 | * standalone package -- we don't know where the end is at this point. | ||
249 | * | ||
250 | * (Length is unknown until parse of the body complete) | ||
251 | */ | ||
252 | (*op)->named.data = aml_op_start; | ||
253 | (*op)->named.length = 0; | ||
254 | } | ||
255 | |||
256 | return_ACPI_STATUS(AE_OK); | ||
257 | } | ||
258 | |||
259 | /******************************************************************************* | ||
260 | * | ||
261 | * FUNCTION: acpi_ps_create_op | ||
262 | * | ||
263 | * PARAMETERS: walk_state - Current state | ||
264 | * aml_op_start - Op start in AML | ||
265 | * new_op - Returned Op | ||
266 | * | ||
267 | * RETURN: Status | ||
268 | * | ||
269 | * DESCRIPTION: Get Op from AML | ||
270 | * | ||
271 | ******************************************************************************/ | ||
272 | |||
273 | acpi_status | ||
274 | acpi_ps_create_op(struct acpi_walk_state *walk_state, | ||
275 | u8 *aml_op_start, union acpi_parse_object **new_op) | ||
276 | { | ||
277 | acpi_status status = AE_OK; | ||
278 | union acpi_parse_object *op; | ||
279 | union acpi_parse_object *named_op = NULL; | ||
280 | union acpi_parse_object *parent_scope; | ||
281 | u8 argument_count; | ||
282 | const struct acpi_opcode_info *op_info; | ||
283 | |||
284 | ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state); | ||
285 | |||
286 | status = acpi_ps_get_aml_opcode(walk_state); | ||
287 | if (status == AE_CTRL_PARSE_CONTINUE) { | ||
288 | return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE); | ||
289 | } | ||
290 | |||
291 | /* Create Op structure and append to parent's argument list */ | ||
292 | |||
293 | walk_state->op_info = acpi_ps_get_opcode_info(walk_state->opcode); | ||
294 | op = acpi_ps_alloc_op(walk_state->opcode); | ||
295 | if (!op) { | ||
296 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
297 | } | ||
298 | |||
299 | if (walk_state->op_info->flags & AML_NAMED) { | ||
300 | status = | ||
301 | acpi_ps_build_named_op(walk_state, aml_op_start, op, | ||
302 | &named_op); | ||
303 | acpi_ps_free_op(op); | ||
304 | if (ACPI_FAILURE(status)) { | ||
305 | return_ACPI_STATUS(status); | ||
306 | } | ||
307 | |||
308 | *new_op = named_op; | ||
309 | return_ACPI_STATUS(AE_OK); | ||
310 | } | ||
311 | |||
312 | /* Not a named opcode, just allocate Op and append to parent */ | ||
313 | |||
314 | if (walk_state->op_info->flags & AML_CREATE) { | ||
315 | /* | ||
316 | * Backup to beginning of create_XXXfield declaration | ||
317 | * body_length is unknown until we parse the body | ||
318 | */ | ||
319 | op->named.data = aml_op_start; | ||
320 | op->named.length = 0; | ||
321 | } | ||
322 | |||
323 | if (walk_state->opcode == AML_BANK_FIELD_OP) { | ||
324 | /* | ||
325 | * Backup to beginning of bank_field declaration | ||
326 | * body_length is unknown until we parse the body | ||
327 | */ | ||
328 | op->named.data = aml_op_start; | ||
329 | op->named.length = 0; | ||
330 | } | ||
331 | |||
332 | parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state)); | ||
333 | acpi_ps_append_arg(parent_scope, op); | ||
334 | |||
335 | if (parent_scope) { | ||
336 | op_info = | ||
337 | acpi_ps_get_opcode_info(parent_scope->common.aml_opcode); | ||
338 | if (op_info->flags & AML_HAS_TARGET) { | ||
339 | argument_count = | ||
340 | acpi_ps_get_argument_count(op_info->type); | ||
341 | if (parent_scope->common.arg_list_length > | ||
342 | argument_count) { | ||
343 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
344 | } | ||
345 | } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) { | ||
346 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
347 | } | ||
348 | } | ||
349 | |||
350 | if (walk_state->descending_callback != NULL) { | ||
351 | /* | ||
352 | * Find the object. This will either insert the object into | ||
353 | * the namespace or simply look it up | ||
354 | */ | ||
355 | walk_state->op = *new_op = op; | ||
356 | |||
357 | status = walk_state->descending_callback(walk_state, &op); | ||
358 | status = acpi_ps_next_parse_state(walk_state, op, status); | ||
359 | if (status == AE_CTRL_PENDING) { | ||
360 | status = AE_CTRL_PARSE_PENDING; | ||
361 | } | ||
362 | } | ||
363 | |||
364 | return_ACPI_STATUS(status); | ||
365 | } | ||
366 | |||
367 | /******************************************************************************* | ||
368 | * | ||
369 | * FUNCTION: acpi_ps_complete_op | ||
370 | * | ||
371 | * PARAMETERS: walk_state - Current state | ||
372 | * op - Returned Op | ||
373 | * status - Parse status before complete Op | ||
374 | * | ||
375 | * RETURN: Status | ||
376 | * | ||
377 | * DESCRIPTION: Complete Op | ||
378 | * | ||
379 | ******************************************************************************/ | ||
380 | |||
381 | acpi_status | ||
382 | acpi_ps_complete_op(struct acpi_walk_state *walk_state, | ||
383 | union acpi_parse_object **op, acpi_status status) | ||
384 | { | ||
385 | acpi_status status2; | ||
386 | |||
387 | ACPI_FUNCTION_TRACE_PTR(ps_complete_op, walk_state); | ||
388 | |||
389 | /* | ||
390 | * Finished one argument of the containing scope | ||
391 | */ | ||
392 | walk_state->parser_state.scope->parse_scope.arg_count--; | ||
393 | |||
394 | /* Close this Op (will result in parse subtree deletion) */ | ||
395 | |||
396 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
397 | if (ACPI_FAILURE(status2)) { | ||
398 | return_ACPI_STATUS(status2); | ||
399 | } | ||
400 | |||
401 | *op = NULL; | ||
402 | |||
403 | switch (status) { | ||
404 | case AE_OK: | ||
405 | break; | ||
406 | |||
407 | case AE_CTRL_TRANSFER: | ||
408 | |||
409 | /* We are about to transfer to a called method */ | ||
410 | |||
411 | walk_state->prev_op = NULL; | ||
412 | walk_state->prev_arg_types = walk_state->arg_types; | ||
413 | return_ACPI_STATUS(status); | ||
414 | |||
415 | case AE_CTRL_END: | ||
416 | |||
417 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
418 | &walk_state->arg_types, | ||
419 | &walk_state->arg_count); | ||
420 | |||
421 | if (*op) { | ||
422 | walk_state->op = *op; | ||
423 | walk_state->op_info = | ||
424 | acpi_ps_get_opcode_info((*op)->common.aml_opcode); | ||
425 | walk_state->opcode = (*op)->common.aml_opcode; | ||
426 | |||
427 | status = walk_state->ascending_callback(walk_state); | ||
428 | status = | ||
429 | acpi_ps_next_parse_state(walk_state, *op, status); | ||
430 | |||
431 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
432 | if (ACPI_FAILURE(status2)) { | ||
433 | return_ACPI_STATUS(status2); | ||
434 | } | ||
435 | } | ||
436 | |||
437 | status = AE_OK; | ||
438 | break; | ||
439 | |||
440 | case AE_CTRL_BREAK: | ||
441 | case AE_CTRL_CONTINUE: | ||
442 | |||
443 | /* Pop off scopes until we find the While */ | ||
444 | |||
445 | while (!(*op) || ((*op)->common.aml_opcode != AML_WHILE_OP)) { | ||
446 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
447 | &walk_state->arg_types, | ||
448 | &walk_state->arg_count); | ||
449 | } | ||
450 | |||
451 | /* Close this iteration of the While loop */ | ||
452 | |||
453 | walk_state->op = *op; | ||
454 | walk_state->op_info = | ||
455 | acpi_ps_get_opcode_info((*op)->common.aml_opcode); | ||
456 | walk_state->opcode = (*op)->common.aml_opcode; | ||
457 | |||
458 | status = walk_state->ascending_callback(walk_state); | ||
459 | status = acpi_ps_next_parse_state(walk_state, *op, status); | ||
460 | |||
461 | status2 = acpi_ps_complete_this_op(walk_state, *op); | ||
462 | if (ACPI_FAILURE(status2)) { | ||
463 | return_ACPI_STATUS(status2); | ||
464 | } | ||
465 | |||
466 | status = AE_OK; | ||
467 | break; | ||
468 | |||
469 | case AE_CTRL_TERMINATE: | ||
470 | |||
471 | /* Clean up */ | ||
472 | do { | ||
473 | if (*op) { | ||
474 | status2 = | ||
475 | acpi_ps_complete_this_op(walk_state, *op); | ||
476 | if (ACPI_FAILURE(status2)) { | ||
477 | return_ACPI_STATUS(status2); | ||
478 | } | ||
479 | |||
480 | acpi_ut_delete_generic_state | ||
481 | (acpi_ut_pop_generic_state | ||
482 | (&walk_state->control_state)); | ||
483 | } | ||
484 | |||
485 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
486 | &walk_state->arg_types, | ||
487 | &walk_state->arg_count); | ||
488 | |||
489 | } while (*op); | ||
490 | |||
491 | return_ACPI_STATUS(AE_OK); | ||
492 | |||
493 | default: /* All other non-AE_OK status */ | ||
494 | |||
495 | do { | ||
496 | if (*op) { | ||
497 | status2 = | ||
498 | acpi_ps_complete_this_op(walk_state, *op); | ||
499 | if (ACPI_FAILURE(status2)) { | ||
500 | return_ACPI_STATUS(status2); | ||
501 | } | ||
502 | } | ||
503 | |||
504 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
505 | &walk_state->arg_types, | ||
506 | &walk_state->arg_count); | ||
507 | |||
508 | } while (*op); | ||
509 | |||
510 | #if 0 | ||
511 | /* | ||
512 | * TBD: Cleanup parse ops on error | ||
513 | */ | ||
514 | if (*op == NULL) { | ||
515 | acpi_ps_pop_scope(parser_state, op, | ||
516 | &walk_state->arg_types, | ||
517 | &walk_state->arg_count); | ||
518 | } | ||
519 | #endif | ||
520 | walk_state->prev_op = NULL; | ||
521 | walk_state->prev_arg_types = walk_state->arg_types; | ||
522 | return_ACPI_STATUS(status); | ||
523 | } | ||
524 | |||
525 | /* This scope complete? */ | ||
526 | |||
527 | if (acpi_ps_has_completed_scope(&(walk_state->parser_state))) { | ||
528 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | ||
529 | &walk_state->arg_types, | ||
530 | &walk_state->arg_count); | ||
531 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *op)); | ||
532 | } else { | ||
533 | *op = NULL; | ||
534 | } | ||
535 | |||
536 | return_ACPI_STATUS(AE_OK); | ||
537 | } | ||
538 | |||
539 | /******************************************************************************* | ||
540 | * | ||
541 | * FUNCTION: acpi_ps_complete_final_op | ||
542 | * | ||
543 | * PARAMETERS: walk_state - Current state | ||
544 | * op - Current Op | ||
545 | * status - Current parse status before complete last | ||
546 | * Op | ||
547 | * | ||
548 | * RETURN: Status | ||
549 | * | ||
550 | * DESCRIPTION: Complete last Op. | ||
551 | * | ||
552 | ******************************************************************************/ | ||
553 | |||
554 | acpi_status | ||
555 | acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, | ||
556 | union acpi_parse_object *op, acpi_status status) | ||
557 | { | ||
558 | acpi_status status2; | ||
559 | |||
560 | ACPI_FUNCTION_TRACE_PTR(ps_complete_final_op, walk_state); | ||
561 | |||
562 | /* | ||
563 | * Complete the last Op (if not completed), and clear the scope stack. | ||
564 | * It is easily possible to end an AML "package" with an unbounded number | ||
565 | * of open scopes (such as when several ASL blocks are closed with | ||
566 | * sequential closing braces). We want to terminate each one cleanly. | ||
567 | */ | ||
568 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n", | ||
569 | op)); | ||
570 | do { | ||
571 | if (op) { | ||
572 | if (walk_state->ascending_callback != NULL) { | ||
573 | walk_state->op = op; | ||
574 | walk_state->op_info = | ||
575 | acpi_ps_get_opcode_info(op->common. | ||
576 | aml_opcode); | ||
577 | walk_state->opcode = op->common.aml_opcode; | ||
578 | |||
579 | status = | ||
580 | walk_state->ascending_callback(walk_state); | ||
581 | status = | ||
582 | acpi_ps_next_parse_state(walk_state, op, | ||
583 | status); | ||
584 | if (status == AE_CTRL_PENDING) { | ||
585 | status = | ||
586 | acpi_ps_complete_op(walk_state, &op, | ||
587 | AE_OK); | ||
588 | if (ACPI_FAILURE(status)) { | ||
589 | return_ACPI_STATUS(status); | ||
590 | } | ||
591 | } | ||
592 | |||
593 | if (status == AE_CTRL_TERMINATE) { | ||
594 | status = AE_OK; | ||
595 | |||
596 | /* Clean up */ | ||
597 | do { | ||
598 | if (op) { | ||
599 | status2 = | ||
600 | acpi_ps_complete_this_op | ||
601 | (walk_state, op); | ||
602 | if (ACPI_FAILURE | ||
603 | (status2)) { | ||
604 | return_ACPI_STATUS | ||
605 | (status2); | ||
606 | } | ||
607 | } | ||
608 | |||
609 | acpi_ps_pop_scope(& | ||
610 | (walk_state-> | ||
611 | parser_state), | ||
612 | &op, | ||
613 | &walk_state-> | ||
614 | arg_types, | ||
615 | &walk_state-> | ||
616 | arg_count); | ||
617 | |||
618 | } while (op); | ||
619 | |||
620 | return_ACPI_STATUS(status); | ||
621 | } | ||
622 | |||
623 | else if (ACPI_FAILURE(status)) { | ||
624 | |||
625 | /* First error is most important */ | ||
626 | |||
627 | (void) | ||
628 | acpi_ps_complete_this_op(walk_state, | ||
629 | op); | ||
630 | return_ACPI_STATUS(status); | ||
631 | } | ||
632 | } | ||
633 | |||
634 | status2 = acpi_ps_complete_this_op(walk_state, op); | ||
635 | if (ACPI_FAILURE(status2)) { | ||
636 | return_ACPI_STATUS(status2); | ||
637 | } | ||
638 | } | ||
639 | |||
640 | acpi_ps_pop_scope(&(walk_state->parser_state), &op, | ||
641 | &walk_state->arg_types, | ||
642 | &walk_state->arg_count); | ||
643 | |||
644 | } while (op); | ||
645 | |||
646 | return_ACPI_STATUS(status); | ||
647 | } | ||
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c index 1793d934aa30..1b659e59710a 100644 --- a/drivers/acpi/acpica/psopcode.c +++ b/drivers/acpi/acpica/psopcode.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -43,16 +43,12 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | 45 | #include "accommon.h" |
46 | #include "acparser.h" | ||
47 | #include "acopcode.h" | 46 | #include "acopcode.h" |
48 | #include "amlcode.h" | 47 | #include "amlcode.h" |
49 | 48 | ||
50 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
51 | ACPI_MODULE_NAME("psopcode") | 50 | ACPI_MODULE_NAME("psopcode") |
52 | 51 | ||
53 | static const u8 acpi_gbl_argument_count[] = | ||
54 | { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 }; | ||
55 | |||
56 | /******************************************************************************* | 52 | /******************************************************************************* |
57 | * | 53 | * |
58 | * NAME: acpi_gbl_aml_op_info | 54 | * NAME: acpi_gbl_aml_op_info |
@@ -63,7 +59,6 @@ static const u8 acpi_gbl_argument_count[] = | |||
63 | * the operand type. | 59 | * the operand type. |
64 | * | 60 | * |
65 | ******************************************************************************/ | 61 | ******************************************************************************/ |
66 | |||
67 | /* | 62 | /* |
68 | * Summary of opcode types/flags | 63 | * Summary of opcode types/flags |
69 | * | 64 | * |
@@ -181,7 +176,6 @@ static const u8 acpi_gbl_argument_count[] = | |||
181 | AML_CREATE_QWORD_FIELD_OP | 176 | AML_CREATE_QWORD_FIELD_OP |
182 | 177 | ||
183 | ******************************************************************************/ | 178 | ******************************************************************************/ |
184 | |||
185 | /* | 179 | /* |
186 | * Master Opcode information table. A summary of everything we know about each | 180 | * Master Opcode information table. A summary of everything we know about each |
187 | * opcode, all in one place. | 181 | * opcode, all in one place. |
@@ -656,169 +650,3 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { | |||
656 | 650 | ||
657 | /*! [End] no source code translation !*/ | 651 | /*! [End] no source code translation !*/ |
658 | }; | 652 | }; |
659 | |||
660 | /* | ||
661 | * This table is directly indexed by the opcodes, and returns an | ||
662 | * index into the table above | ||
663 | */ | ||
664 | static const u8 acpi_gbl_short_op_index[256] = { | ||
665 | /* 0 1 2 3 4 5 6 7 */ | ||
666 | /* 8 9 A B C D E F */ | ||
667 | /* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, | ||
668 | /* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK, | ||
669 | /* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK, | ||
670 | /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
671 | /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
672 | /* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, | ||
673 | /* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D, | ||
674 | /* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
675 | /* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, | ||
676 | /* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, | ||
677 | /* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, | ||
678 | /* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC, | ||
679 | /* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, | ||
680 | /* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, | ||
681 | /* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, | ||
682 | /* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, | ||
683 | /* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30, | ||
684 | /* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72, | ||
685 | /* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74, | ||
686 | /* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A, | ||
687 | /* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, | ||
688 | /* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
689 | /* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
690 | /* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
691 | /* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
692 | /* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK, | ||
693 | /* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
694 | /* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
695 | /* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
696 | /* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
697 | /* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
698 | /* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, | ||
699 | }; | ||
700 | |||
701 | /* | ||
702 | * This table is indexed by the second opcode of the extended opcode | ||
703 | * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info) | ||
704 | */ | ||
705 | static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { | ||
706 | /* 0 1 2 3 4 5 6 7 */ | ||
707 | /* 8 9 A B C D E F */ | ||
708 | /* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
709 | /* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
710 | /* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, | ||
711 | /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, | ||
712 | /* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, | ||
713 | /* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
714 | /* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK, | ||
715 | /* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
716 | /* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
717 | /* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
718 | /* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
719 | /* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
720 | /* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
721 | /* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
722 | /* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
723 | /* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
724 | /* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | ||
725 | /* 0x88 */ 0x7C, | ||
726 | }; | ||
727 | |||
728 | /******************************************************************************* | ||
729 | * | ||
730 | * FUNCTION: acpi_ps_get_opcode_info | ||
731 | * | ||
732 | * PARAMETERS: opcode - The AML opcode | ||
733 | * | ||
734 | * RETURN: A pointer to the info about the opcode. | ||
735 | * | ||
736 | * DESCRIPTION: Find AML opcode description based on the opcode. | ||
737 | * NOTE: This procedure must ALWAYS return a valid pointer! | ||
738 | * | ||
739 | ******************************************************************************/ | ||
740 | |||
741 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | ||
742 | { | ||
743 | ACPI_FUNCTION_NAME(ps_get_opcode_info); | ||
744 | |||
745 | /* | ||
746 | * Detect normal 8-bit opcode or extended 16-bit opcode | ||
747 | */ | ||
748 | if (!(opcode & 0xFF00)) { | ||
749 | |||
750 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ | ||
751 | |||
752 | return (&acpi_gbl_aml_op_info | ||
753 | [acpi_gbl_short_op_index[(u8) opcode]]); | ||
754 | } | ||
755 | |||
756 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && | ||
757 | (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { | ||
758 | |||
759 | /* Valid extended (16-bit) opcode */ | ||
760 | |||
761 | return (&acpi_gbl_aml_op_info | ||
762 | [acpi_gbl_long_op_index[(u8) opcode]]); | ||
763 | } | ||
764 | |||
765 | /* Unknown AML opcode */ | ||
766 | |||
767 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
768 | "Unknown AML opcode [%4.4X]\n", opcode)); | ||
769 | |||
770 | return (&acpi_gbl_aml_op_info[_UNK]); | ||
771 | } | ||
772 | |||
773 | /******************************************************************************* | ||
774 | * | ||
775 | * FUNCTION: acpi_ps_get_opcode_name | ||
776 | * | ||
777 | * PARAMETERS: opcode - The AML opcode | ||
778 | * | ||
779 | * RETURN: A pointer to the name of the opcode (ASCII String) | ||
780 | * Note: Never returns NULL. | ||
781 | * | ||
782 | * DESCRIPTION: Translate an opcode into a human-readable string | ||
783 | * | ||
784 | ******************************************************************************/ | ||
785 | |||
786 | char *acpi_ps_get_opcode_name(u16 opcode) | ||
787 | { | ||
788 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) | ||
789 | |||
790 | const struct acpi_opcode_info *op; | ||
791 | |||
792 | op = acpi_ps_get_opcode_info(opcode); | ||
793 | |||
794 | /* Always guaranteed to return a valid pointer */ | ||
795 | |||
796 | return (op->name); | ||
797 | |||
798 | #else | ||
799 | return ("OpcodeName unavailable"); | ||
800 | |||
801 | #endif | ||
802 | } | ||
803 | |||
804 | /******************************************************************************* | ||
805 | * | ||
806 | * FUNCTION: acpi_ps_get_argument_count | ||
807 | * | ||
808 | * PARAMETERS: op_type - Type associated with the AML opcode | ||
809 | * | ||
810 | * RETURN: Argument count | ||
811 | * | ||
812 | * DESCRIPTION: Obtain the number of expected arguments for an AML opcode | ||
813 | * | ||
814 | ******************************************************************************/ | ||
815 | |||
816 | u8 acpi_ps_get_argument_count(u32 op_type) | ||
817 | { | ||
818 | |||
819 | if (op_type <= AML_TYPE_EXEC_6A_0T_1R) { | ||
820 | return (acpi_gbl_argument_count[op_type]); | ||
821 | } | ||
822 | |||
823 | return (0); | ||
824 | } | ||
diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c new file mode 100644 index 000000000000..9ba5301e5751 --- /dev/null +++ b/drivers/acpi/acpica/psopinfo.c | |||
@@ -0,0 +1,223 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: psopinfo - AML opcode information functions and dispatch tables | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acparser.h" | ||
47 | #include "acopcode.h" | ||
48 | #include "amlcode.h" | ||
49 | |||
50 | #define _COMPONENT ACPI_PARSER | ||
51 | ACPI_MODULE_NAME("psopinfo") | ||
52 | |||
53 | extern const u8 acpi_gbl_short_op_index[]; | ||
54 | extern const u8 acpi_gbl_long_op_index[]; | ||
55 | |||
56 | static const u8 acpi_gbl_argument_count[] = | ||
57 | { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 }; | ||
58 | |||
59 | /******************************************************************************* | ||
60 | * | ||
61 | * FUNCTION: acpi_ps_get_opcode_info | ||
62 | * | ||
63 | * PARAMETERS: opcode - The AML opcode | ||
64 | * | ||
65 | * RETURN: A pointer to the info about the opcode. | ||
66 | * | ||
67 | * DESCRIPTION: Find AML opcode description based on the opcode. | ||
68 | * NOTE: This procedure must ALWAYS return a valid pointer! | ||
69 | * | ||
70 | ******************************************************************************/ | ||
71 | |||
72 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | ||
73 | { | ||
74 | ACPI_FUNCTION_NAME(ps_get_opcode_info); | ||
75 | |||
76 | /* | ||
77 | * Detect normal 8-bit opcode or extended 16-bit opcode | ||
78 | */ | ||
79 | if (!(opcode & 0xFF00)) { | ||
80 | |||
81 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ | ||
82 | |||
83 | return (&acpi_gbl_aml_op_info | ||
84 | [acpi_gbl_short_op_index[(u8)opcode]]); | ||
85 | } | ||
86 | |||
87 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && | ||
88 | (((u8)opcode) <= MAX_EXTENDED_OPCODE)) { | ||
89 | |||
90 | /* Valid extended (16-bit) opcode */ | ||
91 | |||
92 | return (&acpi_gbl_aml_op_info | ||
93 | [acpi_gbl_long_op_index[(u8)opcode]]); | ||
94 | } | ||
95 | |||
96 | /* Unknown AML opcode */ | ||
97 | |||
98 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
99 | "Unknown AML opcode [%4.4X]\n", opcode)); | ||
100 | |||
101 | return (&acpi_gbl_aml_op_info[_UNK]); | ||
102 | } | ||
103 | |||
104 | /******************************************************************************* | ||
105 | * | ||
106 | * FUNCTION: acpi_ps_get_opcode_name | ||
107 | * | ||
108 | * PARAMETERS: opcode - The AML opcode | ||
109 | * | ||
110 | * RETURN: A pointer to the name of the opcode (ASCII String) | ||
111 | * Note: Never returns NULL. | ||
112 | * | ||
113 | * DESCRIPTION: Translate an opcode into a human-readable string | ||
114 | * | ||
115 | ******************************************************************************/ | ||
116 | |||
117 | char *acpi_ps_get_opcode_name(u16 opcode) | ||
118 | { | ||
119 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) | ||
120 | |||
121 | const struct acpi_opcode_info *op; | ||
122 | |||
123 | op = acpi_ps_get_opcode_info(opcode); | ||
124 | |||
125 | /* Always guaranteed to return a valid pointer */ | ||
126 | |||
127 | return (op->name); | ||
128 | |||
129 | #else | ||
130 | return ("OpcodeName unavailable"); | ||
131 | |||
132 | #endif | ||
133 | } | ||
134 | |||
135 | /******************************************************************************* | ||
136 | * | ||
137 | * FUNCTION: acpi_ps_get_argument_count | ||
138 | * | ||
139 | * PARAMETERS: op_type - Type associated with the AML opcode | ||
140 | * | ||
141 | * RETURN: Argument count | ||
142 | * | ||
143 | * DESCRIPTION: Obtain the number of expected arguments for an AML opcode | ||
144 | * | ||
145 | ******************************************************************************/ | ||
146 | |||
147 | u8 acpi_ps_get_argument_count(u32 op_type) | ||
148 | { | ||
149 | |||
150 | if (op_type <= AML_TYPE_EXEC_6A_0T_1R) { | ||
151 | return (acpi_gbl_argument_count[op_type]); | ||
152 | } | ||
153 | |||
154 | return (0); | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * This table is directly indexed by the opcodes It returns | ||
159 | * an index into the opcode table (acpi_gbl_aml_op_info) | ||
160 | */ | ||
161 | const u8 acpi_gbl_short_op_index[256] = { | ||
162 | /* 0 1 2 3 4 5 6 7 */ | ||
163 | /* 8 9 A B C D E F */ | ||
164 | /* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK, | ||
165 | /* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK, | ||
166 | /* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK, | ||
167 | /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
168 | /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
169 | /* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX, | ||
170 | /* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D, | ||
171 | /* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
172 | /* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, | ||
173 | /* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, | ||
174 | /* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, | ||
175 | /* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC, | ||
176 | /* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, | ||
177 | /* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK, | ||
178 | /* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, | ||
179 | /* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, | ||
180 | /* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30, | ||
181 | /* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72, | ||
182 | /* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74, | ||
183 | /* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A, | ||
184 | /* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61, | ||
185 | /* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
186 | /* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
187 | /* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
188 | /* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
189 | /* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK, | ||
190 | /* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
191 | /* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
192 | /* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
193 | /* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
194 | /* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
195 | /* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45, | ||
196 | }; | ||
197 | |||
198 | /* | ||
199 | * This table is indexed by the second opcode of the extended opcode | ||
200 | * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info) | ||
201 | */ | ||
202 | const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { | ||
203 | /* 0 1 2 3 4 5 6 7 */ | ||
204 | /* 8 9 A B C D E F */ | ||
205 | /* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
206 | /* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
207 | /* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK, | ||
208 | /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B, | ||
209 | /* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, | ||
210 | /* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
211 | /* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK, | ||
212 | /* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
213 | /* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
214 | /* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
215 | /* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
216 | /* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
217 | /* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
218 | /* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
219 | /* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
220 | /* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, | ||
221 | /* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, | ||
222 | /* 0x88 */ 0x7C, | ||
223 | }; | ||
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 2494caf47755..abc4c48b2edd 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c index 608dc20dc173..6a4b6fb39f32 100644 --- a/drivers/acpi/acpica/psscope.c +++ b/drivers/acpi/acpica/psscope.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c index fdb2e71f3046..c1934bf04f0a 100644 --- a/drivers/acpi/acpica/pstree.c +++ b/drivers/acpi/acpica/pstree.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c index 4137dcb352d1..91fa73a6e55e 100644 --- a/drivers/acpi/acpica/psutils.c +++ b/drivers/acpi/acpica/psutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -202,14 +202,6 @@ u8 acpi_ps_is_leading_char(u32 c) | |||
202 | } | 202 | } |
203 | 203 | ||
204 | /* | 204 | /* |
205 | * Is "c" a namestring prefix character? | ||
206 | */ | ||
207 | u8 acpi_ps_is_prefix_char(u32 c) | ||
208 | { | ||
209 | return ((u8) (c == '\\' || c == '^')); | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | * Get op's name (4-byte name segment) or 0 if unnamed | 205 | * Get op's name (4-byte name segment) or 0 if unnamed |
214 | */ | 206 | */ |
215 | #ifdef ACPI_FUTURE_USAGE | 207 | #ifdef ACPI_FUTURE_USAGE |
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index ab96cf47896d..abd65624754f 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c index 963e16225797..f68254268965 100644 --- a/drivers/acpi/acpica/psxface.c +++ b/drivers/acpi/acpica/psxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c index 856ff075b6ab..f3a9276ac665 100644 --- a/drivers/acpi/acpica/rsaddr.c +++ b/drivers/acpi/acpica/rsaddr.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index 147feb6aa2a0..7816d4eef04e 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -84,7 +84,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) | |||
84 | bit_field &= (u16) (bit_field - 1); | 84 | bit_field &= (u16) (bit_field - 1); |
85 | } | 85 | } |
86 | 86 | ||
87 | return bits_set; | 87 | return (bits_set); |
88 | } | 88 | } |
89 | 89 | ||
90 | /******************************************************************************* | 90 | /******************************************************************************* |
@@ -407,7 +407,9 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
407 | 407 | ||
408 | /* Validate the Resource Type and Resource Length */ | 408 | /* Validate the Resource Type and Resource Length */ |
409 | 409 | ||
410 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); | 410 | status = |
411 | acpi_ut_validate_resource(NULL, aml_buffer, | ||
412 | &resource_index); | ||
411 | if (ACPI_FAILURE(status)) { | 413 | if (ACPI_FAILURE(status)) { |
412 | /* | 414 | /* |
413 | * Exit on failure. Cannot continue because the descriptor length | 415 | * Exit on failure. Cannot continue because the descriptor length |
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 311cbc4f05fa..f8b55b426c9d 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -98,7 +98,7 @@ acpi_buffer_to_resource(u8 *aml_buffer, | |||
98 | 98 | ||
99 | /* Perform the AML-to-Resource conversion */ | 99 | /* Perform the AML-to-Resource conversion */ |
100 | 100 | ||
101 | status = acpi_ut_walk_aml_resources(aml_buffer, aml_buffer_length, | 101 | status = acpi_ut_walk_aml_resources(NULL, aml_buffer, aml_buffer_length, |
102 | acpi_rs_convert_aml_to_resources, | 102 | acpi_rs_convert_aml_to_resources, |
103 | ¤t_resource_ptr); | 103 | ¤t_resource_ptr); |
104 | if (status == AE_AML_NO_RESOURCE_END_TAG) { | 104 | if (status == AE_AML_NO_RESOURCE_END_TAG) { |
@@ -174,7 +174,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
174 | /* Do the conversion */ | 174 | /* Do the conversion */ |
175 | 175 | ||
176 | resource = output_buffer->pointer; | 176 | resource = output_buffer->pointer; |
177 | status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length, | 177 | status = acpi_ut_walk_aml_resources(NULL, aml_start, aml_buffer_length, |
178 | acpi_rs_convert_aml_to_resources, | 178 | acpi_rs_convert_aml_to_resources, |
179 | &resource); | 179 | &resource); |
180 | if (ACPI_FAILURE(status)) { | 180 | if (ACPI_FAILURE(status)) { |
@@ -480,8 +480,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
480 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); | 480 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); |
481 | 481 | ||
482 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", | 482 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", |
483 | (u32) aml_size_needed, | 483 | (u32)aml_size_needed, acpi_format_exception(status))); |
484 | acpi_format_exception(status))); | ||
485 | if (ACPI_FAILURE(status)) { | 484 | if (ACPI_FAILURE(status)) { |
486 | return_ACPI_STATUS(status); | 485 | return_ACPI_STATUS(status); |
487 | } | 486 | } |
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c index 4d11b072388c..cab51445189d 100644 --- a/drivers/acpi/acpica/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -77,419 +77,16 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource); | |||
77 | static void | 77 | static void |
78 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); | 78 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); |
79 | 79 | ||
80 | #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) | ||
81 | #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) | ||
82 | #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) | ||
83 | |||
84 | /******************************************************************************* | ||
85 | * | ||
86 | * Resource Descriptor info tables | ||
87 | * | ||
88 | * Note: The first table entry must be a Title or Literal and must contain | ||
89 | * the table length (number of table entries) | ||
90 | * | ||
91 | ******************************************************************************/ | ||
92 | |||
93 | struct acpi_rsdump_info acpi_rs_dump_irq[7] = { | ||
94 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, | ||
95 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length), | ||
96 | "Descriptor Length", NULL}, | ||
97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", | ||
98 | acpi_gbl_he_decode}, | ||
99 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", | ||
100 | acpi_gbl_ll_decode}, | ||
101 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", | ||
102 | acpi_gbl_shr_decode}, | ||
103 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), | ||
104 | "Interrupt Count", NULL}, | ||
105 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), | ||
106 | "Interrupt List", NULL} | ||
107 | }; | ||
108 | |||
109 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { | ||
110 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, | ||
111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", | ||
112 | acpi_gbl_typ_decode}, | ||
113 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", | ||
114 | acpi_gbl_bm_decode}, | ||
115 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", | ||
116 | acpi_gbl_siz_decode}, | ||
117 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", | ||
118 | NULL}, | ||
119 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", | ||
120 | NULL} | ||
121 | }; | ||
122 | |||
123 | struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = { | ||
124 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), | ||
125 | "Start-Dependent-Functions", NULL}, | ||
126 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length), | ||
127 | "Descriptor Length", NULL}, | ||
128 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), | ||
129 | "Compatibility Priority", acpi_gbl_config_decode}, | ||
130 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), | ||
131 | "Performance/Robustness", acpi_gbl_config_decode} | ||
132 | }; | ||
133 | |||
134 | struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = { | ||
135 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf), | ||
136 | "End-Dependent-Functions", NULL} | ||
137 | }; | ||
138 | |||
139 | struct acpi_rsdump_info acpi_rs_dump_io[6] = { | ||
140 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL}, | ||
141 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding", | ||
142 | acpi_gbl_io_decode}, | ||
143 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL}, | ||
144 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL}, | ||
145 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL}, | ||
146 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length", | ||
147 | NULL} | ||
148 | }; | ||
149 | |||
150 | struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = { | ||
151 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io), | ||
152 | "Fixed I/O", NULL}, | ||
153 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL}, | ||
154 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length), | ||
155 | "Address Length", NULL} | ||
156 | }; | ||
157 | |||
158 | struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { | ||
159 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor), | ||
160 | "Vendor Specific", NULL}, | ||
161 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL}, | ||
162 | {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data", | ||
163 | NULL} | ||
164 | }; | ||
165 | |||
166 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { | ||
167 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag", | ||
168 | NULL} | ||
169 | }; | ||
170 | |||
171 | struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { | ||
172 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), | ||
173 | "24-Bit Memory Range", NULL}, | ||
174 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), | ||
175 | "Write Protect", acpi_gbl_rw_decode}, | ||
176 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", | ||
177 | NULL}, | ||
178 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", | ||
179 | NULL}, | ||
180 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment", | ||
181 | NULL}, | ||
182 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length), | ||
183 | "Address Length", NULL} | ||
184 | }; | ||
185 | |||
186 | struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { | ||
187 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), | ||
188 | "32-Bit Memory Range", NULL}, | ||
189 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), | ||
190 | "Write Protect", acpi_gbl_rw_decode}, | ||
191 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", | ||
192 | NULL}, | ||
193 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", | ||
194 | NULL}, | ||
195 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment", | ||
196 | NULL}, | ||
197 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length), | ||
198 | "Address Length", NULL} | ||
199 | }; | ||
200 | |||
201 | struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { | ||
202 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), | ||
203 | "32-Bit Fixed Memory Range", NULL}, | ||
204 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), | ||
205 | "Write Protect", acpi_gbl_rw_decode}, | ||
206 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", | ||
207 | NULL}, | ||
208 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), | ||
209 | "Address Length", NULL} | ||
210 | }; | ||
211 | |||
212 | struct acpi_rsdump_info acpi_rs_dump_address16[8] = { | ||
213 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), | ||
214 | "16-Bit WORD Address Space", NULL}, | ||
215 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
216 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", | ||
217 | NULL}, | ||
218 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", | ||
219 | NULL}, | ||
220 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", | ||
221 | NULL}, | ||
222 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), | ||
223 | "Translation Offset", NULL}, | ||
224 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), | ||
225 | "Address Length", NULL}, | ||
226 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} | ||
227 | }; | ||
228 | |||
229 | struct acpi_rsdump_info acpi_rs_dump_address32[8] = { | ||
230 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), | ||
231 | "32-Bit DWORD Address Space", NULL}, | ||
232 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
233 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", | ||
234 | NULL}, | ||
235 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", | ||
236 | NULL}, | ||
237 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", | ||
238 | NULL}, | ||
239 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), | ||
240 | "Translation Offset", NULL}, | ||
241 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), | ||
242 | "Address Length", NULL}, | ||
243 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} | ||
244 | }; | ||
245 | |||
246 | struct acpi_rsdump_info acpi_rs_dump_address64[8] = { | ||
247 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), | ||
248 | "64-Bit QWORD Address Space", NULL}, | ||
249 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
250 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", | ||
251 | NULL}, | ||
252 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", | ||
253 | NULL}, | ||
254 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", | ||
255 | NULL}, | ||
256 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), | ||
257 | "Translation Offset", NULL}, | ||
258 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), | ||
259 | "Address Length", NULL}, | ||
260 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} | ||
261 | }; | ||
262 | |||
263 | struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = { | ||
264 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), | ||
265 | "64-Bit Extended Address Space", NULL}, | ||
266 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
267 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), | ||
268 | "Granularity", NULL}, | ||
269 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), | ||
270 | "Address Minimum", NULL}, | ||
271 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), | ||
272 | "Address Maximum", NULL}, | ||
273 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), | ||
274 | "Translation Offset", NULL}, | ||
275 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), | ||
276 | "Address Length", NULL}, | ||
277 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), | ||
278 | "Type-Specific Attribute", NULL} | ||
279 | }; | ||
280 | |||
281 | struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { | ||
282 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq), | ||
283 | "Extended IRQ", NULL}, | ||
284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), | ||
285 | "Type", acpi_gbl_consume_decode}, | ||
286 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), | ||
287 | "Triggering", acpi_gbl_he_decode}, | ||
288 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", | ||
289 | acpi_gbl_ll_decode}, | ||
290 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", | ||
291 | acpi_gbl_shr_decode}, | ||
292 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, | ||
293 | NULL}, | ||
294 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), | ||
295 | "Interrupt Count", NULL}, | ||
296 | {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]), | ||
297 | "Interrupt List", NULL} | ||
298 | }; | ||
299 | |||
300 | struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = { | ||
301 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg), | ||
302 | "Generic Register", NULL}, | ||
303 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID", | ||
304 | NULL}, | ||
305 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width", | ||
306 | NULL}, | ||
307 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset", | ||
308 | NULL}, | ||
309 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size), | ||
310 | "Access Size", NULL}, | ||
311 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} | ||
312 | }; | ||
313 | |||
314 | struct acpi_rsdump_info acpi_rs_dump_gpio[16] = { | ||
315 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL}, | ||
316 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL}, | ||
317 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type), | ||
318 | "ConnectionType", acpi_gbl_ct_decode}, | ||
319 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer), | ||
320 | "ProducerConsumer", acpi_gbl_consume_decode}, | ||
321 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig", | ||
322 | acpi_gbl_ppc_decode}, | ||
323 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharable", | ||
324 | acpi_gbl_shr_decode}, | ||
325 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction), | ||
326 | "IoRestriction", acpi_gbl_ior_decode}, | ||
327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering", | ||
328 | acpi_gbl_he_decode}, | ||
329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity", | ||
330 | acpi_gbl_ll_decode}, | ||
331 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength", | ||
332 | NULL}, | ||
333 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout), | ||
334 | "DebounceTimeout", NULL}, | ||
335 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source), | ||
336 | "ResourceSource", NULL}, | ||
337 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length), | ||
338 | "PinTableLength", NULL}, | ||
339 | {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL}, | ||
340 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength", | ||
341 | NULL}, | ||
342 | {ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData", | ||
343 | NULL}, | ||
344 | }; | ||
345 | |||
346 | struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = { | ||
347 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma), | ||
348 | "FixedDma", NULL}, | ||
349 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines), | ||
350 | "RequestLines", NULL}, | ||
351 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels", | ||
352 | NULL}, | ||
353 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth", | ||
354 | acpi_gbl_dts_decode}, | ||
355 | }; | ||
356 | |||
357 | #define ACPI_RS_DUMP_COMMON_SERIAL_BUS \ | ||
358 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \ | ||
359 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \ | ||
360 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \ | ||
361 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \ | ||
362 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \ | ||
363 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \ | ||
364 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \ | ||
365 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \ | ||
366 | {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL}, | ||
367 | |||
368 | struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = { | ||
369 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus), | ||
370 | "Common Serial Bus", NULL}, | ||
371 | ACPI_RS_DUMP_COMMON_SERIAL_BUS | ||
372 | }; | ||
373 | |||
374 | struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = { | ||
375 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus), | ||
376 | "I2C Serial Bus", NULL}, | ||
377 | ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, | ||
378 | ACPI_RSD_OFFSET(i2c_serial_bus. | ||
379 | access_mode), | ||
380 | "AccessMode", acpi_gbl_am_decode}, | ||
381 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed), | ||
382 | "ConnectionSpeed", NULL}, | ||
383 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address), | ||
384 | "SlaveAddress", NULL}, | ||
385 | }; | ||
386 | |||
387 | struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = { | ||
388 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus), | ||
389 | "Spi Serial Bus", NULL}, | ||
390 | ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, | ||
391 | ACPI_RSD_OFFSET(spi_serial_bus. | ||
392 | wire_mode), "WireMode", | ||
393 | acpi_gbl_wm_decode}, | ||
394 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity), | ||
395 | "DevicePolarity", acpi_gbl_dp_decode}, | ||
396 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length), | ||
397 | "DataBitLength", NULL}, | ||
398 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase), | ||
399 | "ClockPhase", acpi_gbl_cph_decode}, | ||
400 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity), | ||
401 | "ClockPolarity", acpi_gbl_cpo_decode}, | ||
402 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection), | ||
403 | "DeviceSelection", NULL}, | ||
404 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed), | ||
405 | "ConnectionSpeed", NULL}, | ||
406 | }; | ||
407 | |||
408 | struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = { | ||
409 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus), | ||
410 | "Uart Serial Bus", NULL}, | ||
411 | ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG, | ||
412 | ACPI_RSD_OFFSET(uart_serial_bus. | ||
413 | flow_control), | ||
414 | "FlowControl", acpi_gbl_fc_decode}, | ||
415 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits), | ||
416 | "StopBits", acpi_gbl_sb_decode}, | ||
417 | {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits), | ||
418 | "DataBits", acpi_gbl_bpb_decode}, | ||
419 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian", | ||
420 | acpi_gbl_ed_decode}, | ||
421 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity", | ||
422 | acpi_gbl_pt_decode}, | ||
423 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled), | ||
424 | "LinesEnabled", NULL}, | ||
425 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size), | ||
426 | "RxFifoSize", NULL}, | ||
427 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size), | ||
428 | "TxFifoSize", NULL}, | ||
429 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate), | ||
430 | "ConnectionSpeed", NULL}, | ||
431 | }; | ||
432 | |||
433 | /* | ||
434 | * Tables used for common address descriptor flag fields | ||
435 | */ | ||
436 | static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { | ||
437 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL, | ||
438 | NULL}, | ||
439 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), | ||
440 | "Consumer/Producer", acpi_gbl_consume_decode}, | ||
441 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", | ||
442 | acpi_gbl_dec_decode}, | ||
443 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), | ||
444 | "Min Relocatability", acpi_gbl_min_decode}, | ||
445 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), | ||
446 | "Max Relocatability", acpi_gbl_max_decode} | ||
447 | }; | ||
448 | |||
449 | static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { | ||
450 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), | ||
451 | "Resource Type", (void *)"Memory Range"}, | ||
452 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), | ||
453 | "Write Protect", acpi_gbl_rw_decode}, | ||
454 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), | ||
455 | "Caching", acpi_gbl_mem_decode}, | ||
456 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), | ||
457 | "Range Type", acpi_gbl_mtp_decode}, | ||
458 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), | ||
459 | "Translation", acpi_gbl_ttp_decode} | ||
460 | }; | ||
461 | |||
462 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { | ||
463 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), | ||
464 | "Resource Type", (void *)"I/O Range"}, | ||
465 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), | ||
466 | "Range Type", acpi_gbl_rng_decode}, | ||
467 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), | ||
468 | "Translation", acpi_gbl_ttp_decode}, | ||
469 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), | ||
470 | "Translation Type", acpi_gbl_trs_decode} | ||
471 | }; | ||
472 | |||
473 | /* | ||
474 | * Table used to dump _PRT contents | ||
475 | */ | ||
476 | static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { | ||
477 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL}, | ||
478 | {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL}, | ||
479 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL}, | ||
480 | {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL}, | ||
481 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL} | ||
482 | }; | ||
483 | |||
484 | /******************************************************************************* | 80 | /******************************************************************************* |
485 | * | 81 | * |
486 | * FUNCTION: acpi_rs_dump_descriptor | 82 | * FUNCTION: acpi_rs_dump_descriptor |
487 | * | 83 | * |
488 | * PARAMETERS: Resource | 84 | * PARAMETERS: resource - Buffer containing the resource |
85 | * table - Table entry to decode the resource | ||
489 | * | 86 | * |
490 | * RETURN: None | 87 | * RETURN: None |
491 | * | 88 | * |
492 | * DESCRIPTION: | 89 | * DESCRIPTION: Dump a resource descriptor based on a dump table entry. |
493 | * | 90 | * |
494 | ******************************************************************************/ | 91 | ******************************************************************************/ |
495 | 92 | ||
@@ -654,7 +251,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) | |||
654 | /* | 251 | /* |
655 | * Optional resource_source for Address resources | 252 | * Optional resource_source for Address resources |
656 | */ | 253 | */ |
657 | acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct | 254 | acpi_rs_dump_resource_source(ACPI_CAST_PTR |
255 | (struct | ||
658 | acpi_resource_source, | 256 | acpi_resource_source, |
659 | target)); | 257 | target)); |
660 | break; | 258 | break; |
@@ -765,8 +363,9 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) | |||
765 | 363 | ||
766 | ACPI_FUNCTION_ENTRY(); | 364 | ACPI_FUNCTION_ENTRY(); |
767 | 365 | ||
768 | if (!(acpi_dbg_level & ACPI_LV_RESOURCES) | 366 | /* Check if debug output enabled */ |
769 | || !(_COMPONENT & acpi_dbg_layer)) { | 367 | |
368 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) { | ||
770 | return; | 369 | return; |
771 | } | 370 | } |
772 | 371 | ||
@@ -827,8 +426,9 @@ void acpi_rs_dump_irq_list(u8 * route_table) | |||
827 | 426 | ||
828 | ACPI_FUNCTION_ENTRY(); | 427 | ACPI_FUNCTION_ENTRY(); |
829 | 428 | ||
830 | if (!(acpi_dbg_level & ACPI_LV_RESOURCES) | 429 | /* Check if debug output enabled */ |
831 | || !(_COMPONENT & acpi_dbg_layer)) { | 430 | |
431 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) { | ||
832 | return; | 432 | return; |
833 | } | 433 | } |
834 | 434 | ||
diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c new file mode 100644 index 000000000000..46192bd53653 --- /dev/null +++ b/drivers/acpi/acpica/rsdumpinfo.c | |||
@@ -0,0 +1,454 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: rsdumpinfo - Tables used to display resource descriptors. | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acresrc.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_RESOURCES | ||
49 | ACPI_MODULE_NAME("rsdumpinfo") | ||
50 | |||
51 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
52 | #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) | ||
53 | #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) | ||
54 | #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) | ||
55 | /******************************************************************************* | ||
56 | * | ||
57 | * Resource Descriptor info tables | ||
58 | * | ||
59 | * Note: The first table entry must be a Title or Literal and must contain | ||
60 | * the table length (number of table entries) | ||
61 | * | ||
62 | ******************************************************************************/ | ||
63 | struct acpi_rsdump_info acpi_rs_dump_irq[7] = { | ||
64 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, | ||
65 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length), | ||
66 | "Descriptor Length", NULL}, | ||
67 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", | ||
68 | acpi_gbl_he_decode}, | ||
69 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", | ||
70 | acpi_gbl_ll_decode}, | ||
71 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", | ||
72 | acpi_gbl_shr_decode}, | ||
73 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), | ||
74 | "Interrupt Count", NULL}, | ||
75 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), | ||
76 | "Interrupt List", NULL} | ||
77 | }; | ||
78 | |||
79 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { | ||
80 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, | ||
81 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", | ||
82 | acpi_gbl_typ_decode}, | ||
83 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", | ||
84 | acpi_gbl_bm_decode}, | ||
85 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", | ||
86 | acpi_gbl_siz_decode}, | ||
87 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", | ||
88 | NULL}, | ||
89 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", | ||
90 | NULL} | ||
91 | }; | ||
92 | |||
93 | struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = { | ||
94 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), | ||
95 | "Start-Dependent-Functions", NULL}, | ||
96 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length), | ||
97 | "Descriptor Length", NULL}, | ||
98 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), | ||
99 | "Compatibility Priority", acpi_gbl_config_decode}, | ||
100 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), | ||
101 | "Performance/Robustness", acpi_gbl_config_decode} | ||
102 | }; | ||
103 | |||
104 | struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = { | ||
105 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf), | ||
106 | "End-Dependent-Functions", NULL} | ||
107 | }; | ||
108 | |||
109 | struct acpi_rsdump_info acpi_rs_dump_io[6] = { | ||
110 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL}, | ||
111 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding", | ||
112 | acpi_gbl_io_decode}, | ||
113 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL}, | ||
114 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL}, | ||
115 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL}, | ||
116 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length", | ||
117 | NULL} | ||
118 | }; | ||
119 | |||
120 | struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = { | ||
121 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io), | ||
122 | "Fixed I/O", NULL}, | ||
123 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL}, | ||
124 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length), | ||
125 | "Address Length", NULL} | ||
126 | }; | ||
127 | |||
128 | struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { | ||
129 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor), | ||
130 | "Vendor Specific", NULL}, | ||
131 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL}, | ||
132 | {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data", | ||
133 | NULL} | ||
134 | }; | ||
135 | |||
136 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { | ||
137 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag", | ||
138 | NULL} | ||
139 | }; | ||
140 | |||
141 | struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { | ||
142 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), | ||
143 | "24-Bit Memory Range", NULL}, | ||
144 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), | ||
145 | "Write Protect", acpi_gbl_rw_decode}, | ||
146 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", | ||
147 | NULL}, | ||
148 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", | ||
149 | NULL}, | ||
150 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment", | ||
151 | NULL}, | ||
152 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length), | ||
153 | "Address Length", NULL} | ||
154 | }; | ||
155 | |||
156 | struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { | ||
157 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), | ||
158 | "32-Bit Memory Range", NULL}, | ||
159 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), | ||
160 | "Write Protect", acpi_gbl_rw_decode}, | ||
161 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", | ||
162 | NULL}, | ||
163 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", | ||
164 | NULL}, | ||
165 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment", | ||
166 | NULL}, | ||
167 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length), | ||
168 | "Address Length", NULL} | ||
169 | }; | ||
170 | |||
171 | struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { | ||
172 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), | ||
173 | "32-Bit Fixed Memory Range", NULL}, | ||
174 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), | ||
175 | "Write Protect", acpi_gbl_rw_decode}, | ||
176 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", | ||
177 | NULL}, | ||
178 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), | ||
179 | "Address Length", NULL} | ||
180 | }; | ||
181 | |||
182 | struct acpi_rsdump_info acpi_rs_dump_address16[8] = { | ||
183 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), | ||
184 | "16-Bit WORD Address Space", NULL}, | ||
185 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
186 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", | ||
187 | NULL}, | ||
188 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", | ||
189 | NULL}, | ||
190 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", | ||
191 | NULL}, | ||
192 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), | ||
193 | "Translation Offset", NULL}, | ||
194 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), | ||
195 | "Address Length", NULL}, | ||
196 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} | ||
197 | }; | ||
198 | |||
199 | struct acpi_rsdump_info acpi_rs_dump_address32[8] = { | ||
200 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), | ||
201 | "32-Bit DWORD Address Space", NULL}, | ||
202 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
203 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", | ||
204 | NULL}, | ||
205 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", | ||
206 | NULL}, | ||
207 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", | ||
208 | NULL}, | ||
209 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), | ||
210 | "Translation Offset", NULL}, | ||
211 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), | ||
212 | "Address Length", NULL}, | ||
213 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} | ||
214 | }; | ||
215 | |||
216 | struct acpi_rsdump_info acpi_rs_dump_address64[8] = { | ||
217 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), | ||
218 | "64-Bit QWORD Address Space", NULL}, | ||
219 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
220 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", | ||
221 | NULL}, | ||
222 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", | ||
223 | NULL}, | ||
224 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", | ||
225 | NULL}, | ||
226 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), | ||
227 | "Translation Offset", NULL}, | ||
228 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), | ||
229 | "Address Length", NULL}, | ||
230 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} | ||
231 | }; | ||
232 | |||
233 | struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = { | ||
234 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), | ||
235 | "64-Bit Extended Address Space", NULL}, | ||
236 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, | ||
237 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), | ||
238 | "Granularity", NULL}, | ||
239 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), | ||
240 | "Address Minimum", NULL}, | ||
241 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), | ||
242 | "Address Maximum", NULL}, | ||
243 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), | ||
244 | "Translation Offset", NULL}, | ||
245 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), | ||
246 | "Address Length", NULL}, | ||
247 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), | ||
248 | "Type-Specific Attribute", NULL} | ||
249 | }; | ||
250 | |||
251 | struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { | ||
252 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq), | ||
253 | "Extended IRQ", NULL}, | ||
254 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), | ||
255 | "Type", acpi_gbl_consume_decode}, | ||
256 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), | ||
257 | "Triggering", acpi_gbl_he_decode}, | ||
258 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", | ||
259 | acpi_gbl_ll_decode}, | ||
260 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", | ||
261 | acpi_gbl_shr_decode}, | ||
262 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, | ||
263 | NULL}, | ||
264 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), | ||
265 | "Interrupt Count", NULL}, | ||
266 | {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]), | ||
267 | "Interrupt List", NULL} | ||
268 | }; | ||
269 | |||
270 | struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = { | ||
271 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg), | ||
272 | "Generic Register", NULL}, | ||
273 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID", | ||
274 | NULL}, | ||
275 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width", | ||
276 | NULL}, | ||
277 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset", | ||
278 | NULL}, | ||
279 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size), | ||
280 | "Access Size", NULL}, | ||
281 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} | ||
282 | }; | ||
283 | |||
284 | struct acpi_rsdump_info acpi_rs_dump_gpio[16] = { | ||
285 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL}, | ||
286 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL}, | ||
287 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type), | ||
288 | "ConnectionType", acpi_gbl_ct_decode}, | ||
289 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer), | ||
290 | "ProducerConsumer", acpi_gbl_consume_decode}, | ||
291 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig", | ||
292 | acpi_gbl_ppc_decode}, | ||
293 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharing", | ||
294 | acpi_gbl_shr_decode}, | ||
295 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction), | ||
296 | "IoRestriction", acpi_gbl_ior_decode}, | ||
297 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering", | ||
298 | acpi_gbl_he_decode}, | ||
299 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity", | ||
300 | acpi_gbl_ll_decode}, | ||
301 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength", | ||
302 | NULL}, | ||
303 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout), | ||
304 | "DebounceTimeout", NULL}, | ||
305 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source), | ||
306 | "ResourceSource", NULL}, | ||
307 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length), | ||
308 | "PinTableLength", NULL}, | ||
309 | {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL}, | ||
310 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength", | ||
311 | NULL}, | ||
312 | {ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData", | ||
313 | NULL}, | ||
314 | }; | ||
315 | |||
316 | struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = { | ||
317 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma), | ||
318 | "FixedDma", NULL}, | ||
319 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines), | ||
320 | "RequestLines", NULL}, | ||
321 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels", | ||
322 | NULL}, | ||
323 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth", | ||
324 | acpi_gbl_dts_decode}, | ||
325 | }; | ||
326 | |||
327 | #define ACPI_RS_DUMP_COMMON_SERIAL_BUS \ | ||
328 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \ | ||
329 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \ | ||
330 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \ | ||
331 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \ | ||
332 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \ | ||
333 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \ | ||
334 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \ | ||
335 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \ | ||
336 | {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL}, | ||
337 | |||
338 | struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = { | ||
339 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus), | ||
340 | "Common Serial Bus", NULL}, | ||
341 | ACPI_RS_DUMP_COMMON_SERIAL_BUS | ||
342 | }; | ||
343 | |||
344 | struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = { | ||
345 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus), | ||
346 | "I2C Serial Bus", NULL}, | ||
347 | ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, | ||
348 | ACPI_RSD_OFFSET(i2c_serial_bus. | ||
349 | access_mode), | ||
350 | "AccessMode", acpi_gbl_am_decode}, | ||
351 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed), | ||
352 | "ConnectionSpeed", NULL}, | ||
353 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address), | ||
354 | "SlaveAddress", NULL}, | ||
355 | }; | ||
356 | |||
357 | struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = { | ||
358 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus), | ||
359 | "Spi Serial Bus", NULL}, | ||
360 | ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG, | ||
361 | ACPI_RSD_OFFSET(spi_serial_bus. | ||
362 | wire_mode), "WireMode", | ||
363 | acpi_gbl_wm_decode}, | ||
364 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity), | ||
365 | "DevicePolarity", acpi_gbl_dp_decode}, | ||
366 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length), | ||
367 | "DataBitLength", NULL}, | ||
368 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase), | ||
369 | "ClockPhase", acpi_gbl_cph_decode}, | ||
370 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity), | ||
371 | "ClockPolarity", acpi_gbl_cpo_decode}, | ||
372 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection), | ||
373 | "DeviceSelection", NULL}, | ||
374 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed), | ||
375 | "ConnectionSpeed", NULL}, | ||
376 | }; | ||
377 | |||
378 | struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = { | ||
379 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus), | ||
380 | "Uart Serial Bus", NULL}, | ||
381 | ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG, | ||
382 | ACPI_RSD_OFFSET(uart_serial_bus. | ||
383 | flow_control), | ||
384 | "FlowControl", acpi_gbl_fc_decode}, | ||
385 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits), | ||
386 | "StopBits", acpi_gbl_sb_decode}, | ||
387 | {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits), | ||
388 | "DataBits", acpi_gbl_bpb_decode}, | ||
389 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian", | ||
390 | acpi_gbl_ed_decode}, | ||
391 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity", | ||
392 | acpi_gbl_pt_decode}, | ||
393 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled), | ||
394 | "LinesEnabled", NULL}, | ||
395 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size), | ||
396 | "RxFifoSize", NULL}, | ||
397 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size), | ||
398 | "TxFifoSize", NULL}, | ||
399 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate), | ||
400 | "ConnectionSpeed", NULL}, | ||
401 | }; | ||
402 | |||
403 | /* | ||
404 | * Tables used for common address descriptor flag fields | ||
405 | */ | ||
406 | struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { | ||
407 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL, | ||
408 | NULL}, | ||
409 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), | ||
410 | "Consumer/Producer", acpi_gbl_consume_decode}, | ||
411 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", | ||
412 | acpi_gbl_dec_decode}, | ||
413 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), | ||
414 | "Min Relocatability", acpi_gbl_min_decode}, | ||
415 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), | ||
416 | "Max Relocatability", acpi_gbl_max_decode} | ||
417 | }; | ||
418 | |||
419 | struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { | ||
420 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), | ||
421 | "Resource Type", (void *)"Memory Range"}, | ||
422 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), | ||
423 | "Write Protect", acpi_gbl_rw_decode}, | ||
424 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), | ||
425 | "Caching", acpi_gbl_mem_decode}, | ||
426 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), | ||
427 | "Range Type", acpi_gbl_mtp_decode}, | ||
428 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), | ||
429 | "Translation", acpi_gbl_ttp_decode} | ||
430 | }; | ||
431 | |||
432 | struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { | ||
433 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), | ||
434 | "Resource Type", (void *)"I/O Range"}, | ||
435 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), | ||
436 | "Range Type", acpi_gbl_rng_decode}, | ||
437 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), | ||
438 | "Translation", acpi_gbl_ttp_decode}, | ||
439 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), | ||
440 | "Translation Type", acpi_gbl_trs_decode} | ||
441 | }; | ||
442 | |||
443 | /* | ||
444 | * Table used to dump _PRT contents | ||
445 | */ | ||
446 | struct acpi_rsdump_info acpi_rs_dump_prt[5] = { | ||
447 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL}, | ||
448 | {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL}, | ||
449 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL}, | ||
450 | {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL}, | ||
451 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL} | ||
452 | }; | ||
453 | |||
454 | #endif | ||
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c index a9fa5158200b..41fed78e0de6 100644 --- a/drivers/acpi/acpica/rsinfo.c +++ b/drivers/acpi/acpica/rsinfo.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c index f6a081057a22..ca183755a6f9 100644 --- a/drivers/acpi/acpica/rsio.c +++ b/drivers/acpi/acpica/rsio.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c index e23a9ec248cb..364decc1028a 100644 --- a/drivers/acpi/acpica/rsirq.c +++ b/drivers/acpi/acpica/rsirq.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsirq") | |||
53 | * acpi_rs_get_irq | 53 | * acpi_rs_get_irq |
54 | * | 54 | * |
55 | ******************************************************************************/ | 55 | ******************************************************************************/ |
56 | struct acpi_rsconvert_info acpi_rs_get_irq[8] = { | 56 | struct acpi_rsconvert_info acpi_rs_get_irq[9] = { |
57 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, | 57 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, |
58 | ACPI_RS_SIZE(struct acpi_resource_irq), | 58 | ACPI_RS_SIZE(struct acpi_resource_irq), |
59 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, | 59 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, |
@@ -80,7 +80,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = { | |||
80 | 80 | ||
81 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, | 81 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, |
82 | 82 | ||
83 | /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ | 83 | /* Get flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */ |
84 | 84 | ||
85 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), | 85 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), |
86 | AML_OFFSET(irq.flags), | 86 | AML_OFFSET(irq.flags), |
@@ -92,7 +92,11 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = { | |||
92 | 92 | ||
93 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), | 93 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), |
94 | AML_OFFSET(irq.flags), | 94 | AML_OFFSET(irq.flags), |
95 | 4} | 95 | 4}, |
96 | |||
97 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.wake_capable), | ||
98 | AML_OFFSET(irq.flags), | ||
99 | 5} | ||
96 | }; | 100 | }; |
97 | 101 | ||
98 | /******************************************************************************* | 102 | /******************************************************************************* |
@@ -101,7 +105,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = { | |||
101 | * | 105 | * |
102 | ******************************************************************************/ | 106 | ******************************************************************************/ |
103 | 107 | ||
104 | struct acpi_rsconvert_info acpi_rs_set_irq[13] = { | 108 | struct acpi_rsconvert_info acpi_rs_set_irq[14] = { |
105 | /* Start with a default descriptor of length 3 */ | 109 | /* Start with a default descriptor of length 3 */ |
106 | 110 | ||
107 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, | 111 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, |
@@ -114,7 +118,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = { | |||
114 | AML_OFFSET(irq.irq_mask), | 118 | AML_OFFSET(irq.irq_mask), |
115 | ACPI_RS_OFFSET(data.irq.interrupt_count)}, | 119 | ACPI_RS_OFFSET(data.irq.interrupt_count)}, |
116 | 120 | ||
117 | /* Set the flags byte */ | 121 | /* Set flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */ |
118 | 122 | ||
119 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), | 123 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), |
120 | AML_OFFSET(irq.flags), | 124 | AML_OFFSET(irq.flags), |
@@ -128,6 +132,10 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = { | |||
128 | AML_OFFSET(irq.flags), | 132 | AML_OFFSET(irq.flags), |
129 | 4}, | 133 | 4}, |
130 | 134 | ||
135 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.wake_capable), | ||
136 | AML_OFFSET(irq.flags), | ||
137 | 5}, | ||
138 | |||
131 | /* | 139 | /* |
132 | * All done if the output descriptor length is required to be 3 | 140 | * All done if the output descriptor length is required to be 3 |
133 | * (i.e., optimization to 2 bytes cannot be attempted) | 141 | * (i.e., optimization to 2 bytes cannot be attempted) |
@@ -181,7 +189,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = { | |||
181 | * | 189 | * |
182 | ******************************************************************************/ | 190 | ******************************************************************************/ |
183 | 191 | ||
184 | struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { | 192 | struct acpi_rsconvert_info acpi_rs_convert_ext_irq[10] = { |
185 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, | 193 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, |
186 | ACPI_RS_SIZE(struct acpi_resource_extended_irq), | 194 | ACPI_RS_SIZE(struct acpi_resource_extended_irq), |
187 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)}, | 195 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)}, |
@@ -190,8 +198,10 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { | |||
190 | sizeof(struct aml_resource_extended_irq), | 198 | sizeof(struct aml_resource_extended_irq), |
191 | 0}, | 199 | 0}, |
192 | 200 | ||
193 | /* Flag bits */ | 201 | /* |
194 | 202 | * Flags: Producer/Consumer[0], Triggering[1], Polarity[2], | |
203 | * Sharing[3], Wake[4] | ||
204 | */ | ||
195 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), | 205 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer), |
196 | AML_OFFSET(extended_irq.flags), | 206 | AML_OFFSET(extended_irq.flags), |
197 | 0}, | 207 | 0}, |
@@ -208,19 +218,21 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = { | |||
208 | AML_OFFSET(extended_irq.flags), | 218 | AML_OFFSET(extended_irq.flags), |
209 | 3}, | 219 | 3}, |
210 | 220 | ||
221 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.wake_capable), | ||
222 | AML_OFFSET(extended_irq.flags), | ||
223 | 4}, | ||
224 | |||
211 | /* IRQ Table length (Byte4) */ | 225 | /* IRQ Table length (Byte4) */ |
212 | 226 | ||
213 | {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), | 227 | {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count), |
214 | AML_OFFSET(extended_irq.interrupt_count), | 228 | AML_OFFSET(extended_irq.interrupt_count), |
215 | sizeof(u32)} | 229 | sizeof(u32)}, |
216 | , | ||
217 | 230 | ||
218 | /* Copy every IRQ in the table, each is 32 bits */ | 231 | /* Copy every IRQ in the table, each is 32 bits */ |
219 | 232 | ||
220 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), | 233 | {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]), |
221 | AML_OFFSET(extended_irq.interrupts[0]), | 234 | AML_OFFSET(extended_irq.interrupts[0]), |
222 | 0} | 235 | 0}, |
223 | , | ||
224 | 236 | ||
225 | /* Optional resource_source (Index and String) */ | 237 | /* Optional resource_source (Index and String) */ |
226 | 238 | ||
@@ -285,7 +297,6 @@ struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = { | |||
285 | * request_lines | 297 | * request_lines |
286 | * Channels | 298 | * Channels |
287 | */ | 299 | */ |
288 | |||
289 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines), | 300 | {ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines), |
290 | AML_OFFSET(fixed_dma.request_lines), | 301 | AML_OFFSET(fixed_dma.request_lines), |
291 | 2}, | 302 | 2}, |
@@ -293,5 +304,4 @@ struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = { | |||
293 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width), | 304 | {ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width), |
294 | AML_OFFSET(fixed_dma.width), | 305 | AML_OFFSET(fixed_dma.width), |
295 | 1}, | 306 | 1}, |
296 | |||
297 | }; | 307 | }; |
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c index 8b64db9a3fd2..ee2e206fc6c8 100644 --- a/drivers/acpi/acpica/rslist.c +++ b/drivers/acpi/acpica/rslist.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -217,9 +217,10 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
217 | 217 | ||
218 | /* Perform final sanity check on the new AML resource descriptor */ | 218 | /* Perform final sanity check on the new AML resource descriptor */ |
219 | 219 | ||
220 | status = | 220 | status = acpi_ut_validate_resource(NULL, |
221 | acpi_ut_validate_resource(ACPI_CAST_PTR | 221 | ACPI_CAST_PTR(union |
222 | (union aml_resource, aml), NULL); | 222 | aml_resource, |
223 | aml), NULL); | ||
223 | if (ACPI_FAILURE(status)) { | 224 | if (ACPI_FAILURE(status)) { |
224 | return_ACPI_STATUS(status); | 225 | return_ACPI_STATUS(status); |
225 | } | 226 | } |
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c index 4fd611ad02b4..ebc773a1b350 100644 --- a/drivers/acpi/acpica/rsmemory.c +++ b/drivers/acpi/acpica/rsmemory.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -156,8 +156,7 @@ struct acpi_rsconvert_info acpi_rs_get_vendor_small[3] = { | |||
156 | 156 | ||
157 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), | 157 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
158 | 0, | 158 | 0, |
159 | sizeof(u8)} | 159 | sizeof(u8)}, |
160 | , | ||
161 | 160 | ||
162 | /* Vendor data */ | 161 | /* Vendor data */ |
163 | 162 | ||
@@ -181,8 +180,7 @@ struct acpi_rsconvert_info acpi_rs_get_vendor_large[3] = { | |||
181 | 180 | ||
182 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), | 181 | {ACPI_RSC_COUNT16, ACPI_RS_OFFSET(data.vendor.byte_length), |
183 | 0, | 182 | 0, |
184 | sizeof(u8)} | 183 | sizeof(u8)}, |
185 | , | ||
186 | 184 | ||
187 | /* Vendor data */ | 185 | /* Vendor data */ |
188 | 186 | ||
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index c6f291c2bc83..d5bf05a96096 100644 --- a/drivers/acpi/acpica/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -136,30 +136,30 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
136 | /* | 136 | /* |
137 | * Mask and shift the flag bit | 137 | * Mask and shift the flag bit |
138 | */ | 138 | */ |
139 | ACPI_SET8(destination) = (u8) | 139 | ACPI_SET8(destination, |
140 | ((ACPI_GET8(source) >> info->value) & 0x01); | 140 | ((ACPI_GET8(source) >> info->value) & 0x01)); |
141 | break; | 141 | break; |
142 | 142 | ||
143 | case ACPI_RSC_2BITFLAG: | 143 | case ACPI_RSC_2BITFLAG: |
144 | /* | 144 | /* |
145 | * Mask and shift the flag bits | 145 | * Mask and shift the flag bits |
146 | */ | 146 | */ |
147 | ACPI_SET8(destination) = (u8) | 147 | ACPI_SET8(destination, |
148 | ((ACPI_GET8(source) >> info->value) & 0x03); | 148 | ((ACPI_GET8(source) >> info->value) & 0x03)); |
149 | break; | 149 | break; |
150 | 150 | ||
151 | case ACPI_RSC_3BITFLAG: | 151 | case ACPI_RSC_3BITFLAG: |
152 | /* | 152 | /* |
153 | * Mask and shift the flag bits | 153 | * Mask and shift the flag bits |
154 | */ | 154 | */ |
155 | ACPI_SET8(destination) = (u8) | 155 | ACPI_SET8(destination, |
156 | ((ACPI_GET8(source) >> info->value) & 0x07); | 156 | ((ACPI_GET8(source) >> info->value) & 0x07)); |
157 | break; | 157 | break; |
158 | 158 | ||
159 | case ACPI_RSC_COUNT: | 159 | case ACPI_RSC_COUNT: |
160 | 160 | ||
161 | item_count = ACPI_GET8(source); | 161 | item_count = ACPI_GET8(source); |
162 | ACPI_SET8(destination) = (u8) item_count; | 162 | ACPI_SET8(destination, item_count); |
163 | 163 | ||
164 | resource->length = resource->length + | 164 | resource->length = resource->length + |
165 | (info->value * (item_count - 1)); | 165 | (info->value * (item_count - 1)); |
@@ -168,7 +168,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
168 | case ACPI_RSC_COUNT16: | 168 | case ACPI_RSC_COUNT16: |
169 | 169 | ||
170 | item_count = aml_resource_length; | 170 | item_count = aml_resource_length; |
171 | ACPI_SET16(destination) = item_count; | 171 | ACPI_SET16(destination, item_count); |
172 | 172 | ||
173 | resource->length = resource->length + | 173 | resource->length = resource->length + |
174 | (info->value * (item_count - 1)); | 174 | (info->value * (item_count - 1)); |
@@ -181,13 +181,13 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
181 | 181 | ||
182 | resource->length = resource->length + item_count; | 182 | resource->length = resource->length + item_count; |
183 | item_count = item_count / 2; | 183 | item_count = item_count / 2; |
184 | ACPI_SET16(destination) = item_count; | 184 | ACPI_SET16(destination, item_count); |
185 | break; | 185 | break; |
186 | 186 | ||
187 | case ACPI_RSC_COUNT_GPIO_VEN: | 187 | case ACPI_RSC_COUNT_GPIO_VEN: |
188 | 188 | ||
189 | item_count = ACPI_GET8(source); | 189 | item_count = ACPI_GET8(source); |
190 | ACPI_SET8(destination) = (u8)item_count; | 190 | ACPI_SET8(destination, item_count); |
191 | 191 | ||
192 | resource->length = resource->length + | 192 | resource->length = resource->length + |
193 | (info->value * item_count); | 193 | (info->value * item_count); |
@@ -216,7 +216,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
216 | } | 216 | } |
217 | 217 | ||
218 | resource->length = resource->length + item_count; | 218 | resource->length = resource->length + item_count; |
219 | ACPI_SET16(destination) = item_count; | 219 | ACPI_SET16(destination, item_count); |
220 | break; | 220 | break; |
221 | 221 | ||
222 | case ACPI_RSC_COUNT_SERIAL_VEN: | 222 | case ACPI_RSC_COUNT_SERIAL_VEN: |
@@ -224,7 +224,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
224 | item_count = ACPI_GET16(source) - info->value; | 224 | item_count = ACPI_GET16(source) - info->value; |
225 | 225 | ||
226 | resource->length = resource->length + item_count; | 226 | resource->length = resource->length + item_count; |
227 | ACPI_SET16(destination) = item_count; | 227 | ACPI_SET16(destination, item_count); |
228 | break; | 228 | break; |
229 | 229 | ||
230 | case ACPI_RSC_COUNT_SERIAL_RES: | 230 | case ACPI_RSC_COUNT_SERIAL_RES: |
@@ -234,7 +234,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
234 | - ACPI_GET16(source) - info->value; | 234 | - ACPI_GET16(source) - info->value; |
235 | 235 | ||
236 | resource->length = resource->length + item_count; | 236 | resource->length = resource->length + item_count; |
237 | ACPI_SET16(destination) = item_count; | 237 | ACPI_SET16(destination, item_count); |
238 | break; | 238 | break; |
239 | 239 | ||
240 | case ACPI_RSC_LENGTH: | 240 | case ACPI_RSC_LENGTH: |
@@ -385,7 +385,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
385 | } | 385 | } |
386 | 386 | ||
387 | target = ACPI_ADD_PTR(char, resource, info->value); | 387 | target = ACPI_ADD_PTR(char, resource, info->value); |
388 | ACPI_SET8(target) = (u8) item_count; | 388 | ACPI_SET8(target, item_count); |
389 | break; | 389 | break; |
390 | 390 | ||
391 | case ACPI_RSC_BITMASK16: | 391 | case ACPI_RSC_BITMASK16: |
@@ -401,7 +401,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
401 | } | 401 | } |
402 | 402 | ||
403 | target = ACPI_ADD_PTR(char, resource, info->value); | 403 | target = ACPI_ADD_PTR(char, resource, info->value); |
404 | ACPI_SET8(target) = (u8) item_count; | 404 | ACPI_SET8(target, item_count); |
405 | break; | 405 | break; |
406 | 406 | ||
407 | case ACPI_RSC_EXIT_NE: | 407 | case ACPI_RSC_EXIT_NE: |
@@ -514,37 +514,40 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
514 | /* | 514 | /* |
515 | * Clear the flag byte | 515 | * Clear the flag byte |
516 | */ | 516 | */ |
517 | ACPI_SET8(destination) = 0; | 517 | ACPI_SET8(destination, 0); |
518 | break; | 518 | break; |
519 | 519 | ||
520 | case ACPI_RSC_1BITFLAG: | 520 | case ACPI_RSC_1BITFLAG: |
521 | /* | 521 | /* |
522 | * Mask and shift the flag bit | 522 | * Mask and shift the flag bit |
523 | */ | 523 | */ |
524 | ACPI_SET8(destination) |= (u8) | 524 | ACPI_SET_BIT(*ACPI_CAST8(destination), (u8) |
525 | ((ACPI_GET8(source) & 0x01) << info->value); | 525 | ((ACPI_GET8(source) & 0x01) << info-> |
526 | value)); | ||
526 | break; | 527 | break; |
527 | 528 | ||
528 | case ACPI_RSC_2BITFLAG: | 529 | case ACPI_RSC_2BITFLAG: |
529 | /* | 530 | /* |
530 | * Mask and shift the flag bits | 531 | * Mask and shift the flag bits |
531 | */ | 532 | */ |
532 | ACPI_SET8(destination) |= (u8) | 533 | ACPI_SET_BIT(*ACPI_CAST8(destination), (u8) |
533 | ((ACPI_GET8(source) & 0x03) << info->value); | 534 | ((ACPI_GET8(source) & 0x03) << info-> |
535 | value)); | ||
534 | break; | 536 | break; |
535 | 537 | ||
536 | case ACPI_RSC_3BITFLAG: | 538 | case ACPI_RSC_3BITFLAG: |
537 | /* | 539 | /* |
538 | * Mask and shift the flag bits | 540 | * Mask and shift the flag bits |
539 | */ | 541 | */ |
540 | ACPI_SET8(destination) |= (u8) | 542 | ACPI_SET_BIT(*ACPI_CAST8(destination), (u8) |
541 | ((ACPI_GET8(source) & 0x07) << info->value); | 543 | ((ACPI_GET8(source) & 0x07) << info-> |
544 | value)); | ||
542 | break; | 545 | break; |
543 | 546 | ||
544 | case ACPI_RSC_COUNT: | 547 | case ACPI_RSC_COUNT: |
545 | 548 | ||
546 | item_count = ACPI_GET8(source); | 549 | item_count = ACPI_GET8(source); |
547 | ACPI_SET8(destination) = (u8) item_count; | 550 | ACPI_SET8(destination, item_count); |
548 | 551 | ||
549 | aml_length = | 552 | aml_length = |
550 | (u16) (aml_length + | 553 | (u16) (aml_length + |
@@ -561,18 +564,18 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
561 | case ACPI_RSC_COUNT_GPIO_PIN: | 564 | case ACPI_RSC_COUNT_GPIO_PIN: |
562 | 565 | ||
563 | item_count = ACPI_GET16(source); | 566 | item_count = ACPI_GET16(source); |
564 | ACPI_SET16(destination) = (u16)aml_length; | 567 | ACPI_SET16(destination, aml_length); |
565 | 568 | ||
566 | aml_length = (u16)(aml_length + item_count * 2); | 569 | aml_length = (u16)(aml_length + item_count * 2); |
567 | target = ACPI_ADD_PTR(void, aml, info->value); | 570 | target = ACPI_ADD_PTR(void, aml, info->value); |
568 | ACPI_SET16(target) = (u16)aml_length; | 571 | ACPI_SET16(target, aml_length); |
569 | acpi_rs_set_resource_length(aml_length, aml); | 572 | acpi_rs_set_resource_length(aml_length, aml); |
570 | break; | 573 | break; |
571 | 574 | ||
572 | case ACPI_RSC_COUNT_GPIO_VEN: | 575 | case ACPI_RSC_COUNT_GPIO_VEN: |
573 | 576 | ||
574 | item_count = ACPI_GET16(source); | 577 | item_count = ACPI_GET16(source); |
575 | ACPI_SET16(destination) = (u16)item_count; | 578 | ACPI_SET16(destination, item_count); |
576 | 579 | ||
577 | aml_length = | 580 | aml_length = |
578 | (u16)(aml_length + (info->value * item_count)); | 581 | (u16)(aml_length + (info->value * item_count)); |
@@ -584,7 +587,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
584 | /* Set resource source string length */ | 587 | /* Set resource source string length */ |
585 | 588 | ||
586 | item_count = ACPI_GET16(source); | 589 | item_count = ACPI_GET16(source); |
587 | ACPI_SET16(destination) = (u16)aml_length; | 590 | ACPI_SET16(destination, aml_length); |
588 | 591 | ||
589 | /* Compute offset for the Vendor Data */ | 592 | /* Compute offset for the Vendor Data */ |
590 | 593 | ||
@@ -594,7 +597,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
594 | /* Set vendor offset only if there is vendor data */ | 597 | /* Set vendor offset only if there is vendor data */ |
595 | 598 | ||
596 | if (resource->data.gpio.vendor_length) { | 599 | if (resource->data.gpio.vendor_length) { |
597 | ACPI_SET16(target) = (u16)aml_length; | 600 | ACPI_SET16(target, aml_length); |
598 | } | 601 | } |
599 | 602 | ||
600 | acpi_rs_set_resource_length(aml_length, aml); | 603 | acpi_rs_set_resource_length(aml_length, aml); |
@@ -603,7 +606,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
603 | case ACPI_RSC_COUNT_SERIAL_VEN: | 606 | case ACPI_RSC_COUNT_SERIAL_VEN: |
604 | 607 | ||
605 | item_count = ACPI_GET16(source); | 608 | item_count = ACPI_GET16(source); |
606 | ACPI_SET16(destination) = item_count + info->value; | 609 | ACPI_SET16(destination, item_count + info->value); |
607 | aml_length = (u16)(aml_length + item_count); | 610 | aml_length = (u16)(aml_length + item_count); |
608 | acpi_rs_set_resource_length(aml_length, aml); | 611 | acpi_rs_set_resource_length(aml_length, aml); |
609 | break; | 612 | break; |
@@ -686,7 +689,8 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
686 | * Optional resource_source (Index and String) | 689 | * Optional resource_source (Index and String) |
687 | */ | 690 | */ |
688 | aml_length = | 691 | aml_length = |
689 | acpi_rs_set_resource_source(aml, (acpi_rs_length) | 692 | acpi_rs_set_resource_source(aml, |
693 | (acpi_rs_length) | ||
690 | aml_length, source); | 694 | aml_length, source); |
691 | acpi_rs_set_resource_length(aml_length, aml); | 695 | acpi_rs_set_resource_length(aml_length, aml); |
692 | break; | 696 | break; |
@@ -706,10 +710,12 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
706 | /* | 710 | /* |
707 | * 8-bit encoded bitmask (DMA macro) | 711 | * 8-bit encoded bitmask (DMA macro) |
708 | */ | 712 | */ |
709 | ACPI_SET8(destination) = (u8) | 713 | ACPI_SET8(destination, |
710 | acpi_rs_encode_bitmask(source, | 714 | acpi_rs_encode_bitmask(source, |
711 | *ACPI_ADD_PTR(u8, resource, | 715 | *ACPI_ADD_PTR(u8, |
712 | info->value)); | 716 | resource, |
717 | info-> | ||
718 | value))); | ||
713 | break; | 719 | break; |
714 | 720 | ||
715 | case ACPI_RSC_BITMASK16: | 721 | case ACPI_RSC_BITMASK16: |
diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c index 9aa5e689b444..fe49fc43e10f 100644 --- a/drivers/acpi/acpica/rsserial.c +++ b/drivers/acpi/acpica/rsserial.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsserial") | |||
53 | * acpi_rs_convert_gpio | 53 | * acpi_rs_convert_gpio |
54 | * | 54 | * |
55 | ******************************************************************************/ | 55 | ******************************************************************************/ |
56 | struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = { | 56 | struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = { |
57 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO, | 57 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO, |
58 | ACPI_RS_SIZE(struct acpi_resource_gpio), | 58 | ACPI_RS_SIZE(struct acpi_resource_gpio), |
59 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)}, | 59 | ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)}, |
@@ -75,10 +75,14 @@ struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = { | |||
75 | AML_OFFSET(gpio.flags), | 75 | AML_OFFSET(gpio.flags), |
76 | 0}, | 76 | 0}, |
77 | 77 | ||
78 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable), | 78 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable), |
79 | AML_OFFSET(gpio.int_flags), | 79 | AML_OFFSET(gpio.int_flags), |
80 | 3}, | 80 | 3}, |
81 | 81 | ||
82 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.wake_capable), | ||
83 | AML_OFFSET(gpio.int_flags), | ||
84 | 4}, | ||
85 | |||
82 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction), | 86 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction), |
83 | AML_OFFSET(gpio.int_flags), | 87 | AML_OFFSET(gpio.int_flags), |
84 | 0}, | 88 | 0}, |
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index 37d5241c0acf..a44953c6f75d 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -108,7 +108,7 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count) | |||
108 | mask |= (0x1 << list[i]); | 108 | mask |= (0x1 << list[i]); |
109 | } | 109 | } |
110 | 110 | ||
111 | return mask; | 111 | return (mask); |
112 | } | 112 | } |
113 | 113 | ||
114 | /******************************************************************************* | 114 | /******************************************************************************* |
@@ -358,8 +358,10 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
358 | * | 358 | * |
359 | * Zero the entire area of the buffer. | 359 | * Zero the entire area of the buffer. |
360 | */ | 360 | */ |
361 | total_length = (u32) | 361 | total_length = |
362 | ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 1; | 362 | (u32) |
363 | ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + | ||
364 | 1; | ||
363 | total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); | 365 | total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); |
364 | 366 | ||
365 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); | 367 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); |
@@ -675,7 +677,9 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
675 | /* Execute the method, no parameters */ | 677 | /* Execute the method, no parameters */ |
676 | 678 | ||
677 | status = | 679 | status = |
678 | acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc); | 680 | acpi_ut_evaluate_object(ACPI_CAST_PTR |
681 | (struct acpi_namespace_node, handle), path, | ||
682 | ACPI_BTYPE_BUFFER, &obj_desc); | ||
679 | if (ACPI_FAILURE(status)) { | 683 | if (ACPI_FAILURE(status)) { |
680 | return_ACPI_STATUS(status); | 684 | return_ACPI_STATUS(status); |
681 | } | 685 | } |
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 5aad744b5b83..15d6eaef0e28 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -423,7 +423,7 @@ ACPI_EXPORT_SYMBOL(acpi_resource_to_address64) | |||
423 | * | 423 | * |
424 | * RETURN: Status | 424 | * RETURN: Status |
425 | * | 425 | * |
426 | * DESCRIPTION: Walk a resource template for the specified evice to find a | 426 | * DESCRIPTION: Walk a resource template for the specified device to find a |
427 | * vendor-defined resource that matches the supplied UUID and | 427 | * vendor-defined resource that matches the supplied UUID and |
428 | * UUID subtype. Returns a struct acpi_resource of type Vendor. | 428 | * UUID subtype. Returns a struct acpi_resource of type Vendor. |
429 | * | 429 | * |
@@ -522,57 +522,42 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | |||
522 | 522 | ||
523 | /******************************************************************************* | 523 | /******************************************************************************* |
524 | * | 524 | * |
525 | * FUNCTION: acpi_walk_resources | 525 | * FUNCTION: acpi_walk_resource_buffer |
526 | * | 526 | * |
527 | * PARAMETERS: device_handle - Handle to the device object for the | 527 | * PARAMETERS: buffer - Formatted buffer returned by one of the |
528 | * device we are querying | 528 | * various Get*Resource functions |
529 | * name - Method name of the resources we want. | ||
530 | * (METHOD_NAME__CRS, METHOD_NAME__PRS, or | ||
531 | * METHOD_NAME__AEI) | ||
532 | * user_function - Called for each resource | 529 | * user_function - Called for each resource |
533 | * context - Passed to user_function | 530 | * context - Passed to user_function |
534 | * | 531 | * |
535 | * RETURN: Status | 532 | * RETURN: Status |
536 | * | 533 | * |
537 | * DESCRIPTION: Retrieves the current or possible resource list for the | 534 | * DESCRIPTION: Walks the input resource template. The user_function is called |
538 | * specified device. The user_function is called once for | 535 | * once for each resource in the list. |
539 | * each resource in the list. | ||
540 | * | 536 | * |
541 | ******************************************************************************/ | 537 | ******************************************************************************/ |
538 | |||
542 | acpi_status | 539 | acpi_status |
543 | acpi_walk_resources(acpi_handle device_handle, | 540 | acpi_walk_resource_buffer(struct acpi_buffer * buffer, |
544 | char *name, | 541 | acpi_walk_resource_callback user_function, |
545 | acpi_walk_resource_callback user_function, void *context) | 542 | void *context) |
546 | { | 543 | { |
547 | acpi_status status; | 544 | acpi_status status = AE_OK; |
548 | struct acpi_buffer buffer; | ||
549 | struct acpi_resource *resource; | 545 | struct acpi_resource *resource; |
550 | struct acpi_resource *resource_end; | 546 | struct acpi_resource *resource_end; |
551 | 547 | ||
552 | ACPI_FUNCTION_TRACE(acpi_walk_resources); | 548 | ACPI_FUNCTION_TRACE(acpi_walk_resource_buffer); |
553 | 549 | ||
554 | /* Parameter validation */ | 550 | /* Parameter validation */ |
555 | 551 | ||
556 | if (!device_handle || !user_function || !name || | 552 | if (!buffer || !buffer->pointer || !user_function) { |
557 | (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && | ||
558 | !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) && | ||
559 | !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) { | ||
560 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 553 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
561 | } | 554 | } |
562 | 555 | ||
563 | /* Get the _CRS/_PRS/_AEI resource list */ | 556 | /* Buffer contains the resource list and length */ |
564 | |||
565 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
566 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
567 | if (ACPI_FAILURE(status)) { | ||
568 | return_ACPI_STATUS(status); | ||
569 | } | ||
570 | |||
571 | /* Buffer now contains the resource list */ | ||
572 | 557 | ||
573 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); | 558 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer->pointer); |
574 | resource_end = | 559 | resource_end = |
575 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); | 560 | ACPI_ADD_PTR(struct acpi_resource, buffer->pointer, buffer->length); |
576 | 561 | ||
577 | /* Walk the resource list until the end_tag is found (or buffer end) */ | 562 | /* Walk the resource list until the end_tag is found (or buffer end) */ |
578 | 563 | ||
@@ -606,11 +591,63 @@ acpi_walk_resources(acpi_handle device_handle, | |||
606 | 591 | ||
607 | /* Get the next resource descriptor */ | 592 | /* Get the next resource descriptor */ |
608 | 593 | ||
609 | resource = | 594 | resource = ACPI_NEXT_RESOURCE(resource); |
610 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
611 | resource->length); | ||
612 | } | 595 | } |
613 | 596 | ||
597 | return_ACPI_STATUS(status); | ||
598 | } | ||
599 | |||
600 | ACPI_EXPORT_SYMBOL(acpi_walk_resource_buffer) | ||
601 | |||
602 | /******************************************************************************* | ||
603 | * | ||
604 | * FUNCTION: acpi_walk_resources | ||
605 | * | ||
606 | * PARAMETERS: device_handle - Handle to the device object for the | ||
607 | * device we are querying | ||
608 | * name - Method name of the resources we want. | ||
609 | * (METHOD_NAME__CRS, METHOD_NAME__PRS, or | ||
610 | * METHOD_NAME__AEI) | ||
611 | * user_function - Called for each resource | ||
612 | * context - Passed to user_function | ||
613 | * | ||
614 | * RETURN: Status | ||
615 | * | ||
616 | * DESCRIPTION: Retrieves the current or possible resource list for the | ||
617 | * specified device. The user_function is called once for | ||
618 | * each resource in the list. | ||
619 | * | ||
620 | ******************************************************************************/ | ||
621 | acpi_status | ||
622 | acpi_walk_resources(acpi_handle device_handle, | ||
623 | char *name, | ||
624 | acpi_walk_resource_callback user_function, void *context) | ||
625 | { | ||
626 | acpi_status status; | ||
627 | struct acpi_buffer buffer; | ||
628 | |||
629 | ACPI_FUNCTION_TRACE(acpi_walk_resources); | ||
630 | |||
631 | /* Parameter validation */ | ||
632 | |||
633 | if (!device_handle || !user_function || !name || | ||
634 | (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && | ||
635 | !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) && | ||
636 | !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) { | ||
637 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
638 | } | ||
639 | |||
640 | /* Get the _CRS/_PRS/_AEI resource list */ | ||
641 | |||
642 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
643 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
644 | if (ACPI_FAILURE(status)) { | ||
645 | return_ACPI_STATUS(status); | ||
646 | } | ||
647 | |||
648 | /* Walk the resource list and cleanup */ | ||
649 | |||
650 | status = acpi_walk_resource_buffer(&buffer, user_function, context); | ||
614 | ACPI_FREE(buffer.pointer); | 651 | ACPI_FREE(buffer.pointer); |
615 | return_ACPI_STATUS(status); | 652 | return_ACPI_STATUS(status); |
616 | } | 653 | } |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 390651860bf0..74181bf181ec 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -172,6 +172,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { | |||
172 | * FUNCTION: acpi_tb_init_generic_address | 172 | * FUNCTION: acpi_tb_init_generic_address |
173 | * | 173 | * |
174 | * PARAMETERS: generic_address - GAS struct to be initialized | 174 | * PARAMETERS: generic_address - GAS struct to be initialized |
175 | * space_id - ACPI Space ID for this register | ||
175 | * byte_width - Width of this register | 176 | * byte_width - Width of this register |
176 | * address - Address of the register | 177 | * address - Address of the register |
177 | * | 178 | * |
@@ -407,8 +408,8 @@ static void acpi_tb_convert_fadt(void) | |||
407 | * should be zero are indeed zero. This will workaround BIOSs that | 408 | * should be zero are indeed zero. This will workaround BIOSs that |
408 | * inadvertently place values in these fields. | 409 | * inadvertently place values in these fields. |
409 | * | 410 | * |
410 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at | 411 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located |
411 | * offset 45, 55, 95, and the word located at offset 109, 110. | 412 | * at offset 45, 55, 95, and the word located at offset 109, 110. |
412 | * | 413 | * |
413 | * Note: The FADT revision value is unreliable. Only the length can be | 414 | * Note: The FADT revision value is unreliable. Only the length can be |
414 | * trusted. | 415 | * trusted. |
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c index 77d1db29a725..e4f4f02d49e7 100644 --- a/drivers/acpi/acpica/tbfind.c +++ b/drivers/acpi/acpica/tbfind.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index f540ae462925..e57cd38004e3 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 285e24b97382..ce3d5db39a9c 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -147,7 +147,7 @@ acpi_status acpi_tb_initialize_facs(void) | |||
147 | ACPI_CAST_INDIRECT_PTR(struct | 147 | ACPI_CAST_INDIRECT_PTR(struct |
148 | acpi_table_header, | 148 | acpi_table_header, |
149 | &acpi_gbl_FACS)); | 149 | &acpi_gbl_FACS)); |
150 | return status; | 150 | return (status); |
151 | } | 151 | } |
152 | #endif /* !ACPI_REDUCED_HARDWARE */ | 152 | #endif /* !ACPI_REDUCED_HARDWARE */ |
153 | 153 | ||
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index f5632780421d..b35a5e6d653a 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/export.h> | 44 | #include <linux/export.h> |
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | ||
48 | #include "actables.h" | 47 | #include "actables.h" |
49 | 48 | ||
50 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
@@ -437,7 +436,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_by_index) | |||
437 | * | 436 | * |
438 | ******************************************************************************/ | 437 | ******************************************************************************/ |
439 | acpi_status | 438 | acpi_status |
440 | acpi_install_table_handler(acpi_tbl_handler handler, void *context) | 439 | acpi_install_table_handler(acpi_table_handler handler, void *context) |
441 | { | 440 | { |
442 | acpi_status status; | 441 | acpi_status status; |
443 | 442 | ||
@@ -483,7 +482,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_table_handler) | |||
483 | * DESCRIPTION: Remove table event handler | 482 | * DESCRIPTION: Remove table event handler |
484 | * | 483 | * |
485 | ******************************************************************************/ | 484 | ******************************************************************************/ |
486 | acpi_status acpi_remove_table_handler(acpi_tbl_handler handler) | 485 | acpi_status acpi_remove_table_handler(acpi_table_handler handler) |
487 | { | 486 | { |
488 | acpi_status status; | 487 | acpi_status status; |
489 | 488 | ||
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index a5e1e4e47098..67e046ec8f0a 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -192,7 +192,7 @@ static acpi_status acpi_tb_load_namespace(void) | |||
192 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 192 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
193 | } | 193 | } |
194 | 194 | ||
195 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); | 195 | ACPI_INFO((AE_INFO, "All ACPI Tables successfully acquired")); |
196 | 196 | ||
197 | unlock_and_exit: | 197 | unlock_and_exit: |
198 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | 198 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index 28f330230f99..7c2ecfb7c2c3 100644 --- a/drivers/acpi/acpica/tbxfroot.c +++ b/drivers/acpi/acpica/tbxfroot.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c index 64880306133d..698b9d385516 100644 --- a/drivers/acpi/acpica/utaddress.c +++ b/drivers/acpi/acpica/utaddress.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -214,7 +214,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, | |||
214 | 214 | ||
215 | if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && | 215 | if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && |
216 | (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { | 216 | (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { |
217 | return_UINT32(0); | 217 | return_VALUE(0); |
218 | } | 218 | } |
219 | 219 | ||
220 | range_info = acpi_gbl_address_range_list[space_id]; | 220 | range_info = acpi_gbl_address_range_list[space_id]; |
@@ -256,7 +256,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, | |||
256 | range_info = range_info->next; | 256 | range_info = range_info->next; |
257 | } | 257 | } |
258 | 258 | ||
259 | return_UINT32(overlap_count); | 259 | return_VALUE(overlap_count); |
260 | } | 260 | } |
261 | 261 | ||
262 | /******************************************************************************* | 262 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c index ed29d474095e..e0ffb580f4b0 100644 --- a/drivers/acpi/acpica/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c index e1d40ed26390..e0e8579deaac 100644 --- a/drivers/acpi/acpica/utcache.c +++ b/drivers/acpi/acpica/utcache.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index 294692ae76e9..e4c9291fc0a3 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -785,7 +785,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
785 | 785 | ||
786 | status = acpi_os_create_mutex(&dest_desc->mutex.os_mutex); | 786 | status = acpi_os_create_mutex(&dest_desc->mutex.os_mutex); |
787 | if (ACPI_FAILURE(status)) { | 787 | if (ACPI_FAILURE(status)) { |
788 | return status; | 788 | return (status); |
789 | } | 789 | } |
790 | break; | 790 | break; |
791 | 791 | ||
@@ -795,7 +795,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
795 | &dest_desc->event. | 795 | &dest_desc->event. |
796 | os_semaphore); | 796 | os_semaphore); |
797 | if (ACPI_FAILURE(status)) { | 797 | if (ACPI_FAILURE(status)) { |
798 | return status; | 798 | return (status); |
799 | } | 799 | } |
800 | break; | 800 | break; |
801 | 801 | ||
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 5d95166245ae..c57d9cc07ba9 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -166,11 +166,9 @@ acpi_debug_print(u32 requested_debug_level, | |||
166 | acpi_thread_id thread_id; | 166 | acpi_thread_id thread_id; |
167 | va_list args; | 167 | va_list args; |
168 | 168 | ||
169 | /* | 169 | /* Check if debug output enabled */ |
170 | * Stay silent if the debug level or component ID is disabled | 170 | |
171 | */ | 171 | if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) { |
172 | if (!(requested_debug_level & acpi_dbg_level) || | ||
173 | !(component_id & acpi_dbg_layer)) { | ||
174 | return; | 172 | return; |
175 | } | 173 | } |
176 | 174 | ||
@@ -236,8 +234,9 @@ acpi_debug_print_raw(u32 requested_debug_level, | |||
236 | { | 234 | { |
237 | va_list args; | 235 | va_list args; |
238 | 236 | ||
239 | if (!(requested_debug_level & acpi_dbg_level) || | 237 | /* Check if debug output enabled */ |
240 | !(component_id & acpi_dbg_layer)) { | 238 | |
239 | if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) { | ||
241 | return; | 240 | return; |
242 | } | 241 | } |
243 | 242 | ||
@@ -272,9 +271,13 @@ acpi_ut_trace(u32 line_number, | |||
272 | acpi_gbl_nesting_level++; | 271 | acpi_gbl_nesting_level++; |
273 | acpi_ut_track_stack_ptr(); | 272 | acpi_ut_track_stack_ptr(); |
274 | 273 | ||
275 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 274 | /* Check if enabled up-front for performance */ |
276 | line_number, function_name, module_name, component_id, | 275 | |
277 | "%s\n", acpi_gbl_fn_entry_str); | 276 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
277 | acpi_debug_print(ACPI_LV_FUNCTIONS, | ||
278 | line_number, function_name, module_name, | ||
279 | component_id, "%s\n", acpi_gbl_fn_entry_str); | ||
280 | } | ||
278 | } | 281 | } |
279 | 282 | ||
280 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) | 283 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) |
@@ -304,9 +307,14 @@ acpi_ut_trace_ptr(u32 line_number, | |||
304 | acpi_gbl_nesting_level++; | 307 | acpi_gbl_nesting_level++; |
305 | acpi_ut_track_stack_ptr(); | 308 | acpi_ut_track_stack_ptr(); |
306 | 309 | ||
307 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 310 | /* Check if enabled up-front for performance */ |
308 | line_number, function_name, module_name, component_id, | 311 | |
309 | "%s %p\n", acpi_gbl_fn_entry_str, pointer); | 312 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
313 | acpi_debug_print(ACPI_LV_FUNCTIONS, | ||
314 | line_number, function_name, module_name, | ||
315 | component_id, "%s %p\n", acpi_gbl_fn_entry_str, | ||
316 | pointer); | ||
317 | } | ||
310 | } | 318 | } |
311 | 319 | ||
312 | /******************************************************************************* | 320 | /******************************************************************************* |
@@ -335,9 +343,14 @@ acpi_ut_trace_str(u32 line_number, | |||
335 | acpi_gbl_nesting_level++; | 343 | acpi_gbl_nesting_level++; |
336 | acpi_ut_track_stack_ptr(); | 344 | acpi_ut_track_stack_ptr(); |
337 | 345 | ||
338 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 346 | /* Check if enabled up-front for performance */ |
339 | line_number, function_name, module_name, component_id, | 347 | |
340 | "%s %s\n", acpi_gbl_fn_entry_str, string); | 348 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
349 | acpi_debug_print(ACPI_LV_FUNCTIONS, | ||
350 | line_number, function_name, module_name, | ||
351 | component_id, "%s %s\n", acpi_gbl_fn_entry_str, | ||
352 | string); | ||
353 | } | ||
341 | } | 354 | } |
342 | 355 | ||
343 | /******************************************************************************* | 356 | /******************************************************************************* |
@@ -366,9 +379,14 @@ acpi_ut_trace_u32(u32 line_number, | |||
366 | acpi_gbl_nesting_level++; | 379 | acpi_gbl_nesting_level++; |
367 | acpi_ut_track_stack_ptr(); | 380 | acpi_ut_track_stack_ptr(); |
368 | 381 | ||
369 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 382 | /* Check if enabled up-front for performance */ |
370 | line_number, function_name, module_name, component_id, | 383 | |
371 | "%s %08X\n", acpi_gbl_fn_entry_str, integer); | 384 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
385 | acpi_debug_print(ACPI_LV_FUNCTIONS, | ||
386 | line_number, function_name, module_name, | ||
387 | component_id, "%s %08X\n", | ||
388 | acpi_gbl_fn_entry_str, integer); | ||
389 | } | ||
372 | } | 390 | } |
373 | 391 | ||
374 | /******************************************************************************* | 392 | /******************************************************************************* |
@@ -393,9 +411,13 @@ acpi_ut_exit(u32 line_number, | |||
393 | const char *module_name, u32 component_id) | 411 | const char *module_name, u32 component_id) |
394 | { | 412 | { |
395 | 413 | ||
396 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 414 | /* Check if enabled up-front for performance */ |
397 | line_number, function_name, module_name, component_id, | 415 | |
398 | "%s\n", acpi_gbl_fn_exit_str); | 416 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
417 | acpi_debug_print(ACPI_LV_FUNCTIONS, | ||
418 | line_number, function_name, module_name, | ||
419 | component_id, "%s\n", acpi_gbl_fn_exit_str); | ||
420 | } | ||
399 | 421 | ||
400 | acpi_gbl_nesting_level--; | 422 | acpi_gbl_nesting_level--; |
401 | } | 423 | } |
@@ -425,17 +447,23 @@ acpi_ut_status_exit(u32 line_number, | |||
425 | u32 component_id, acpi_status status) | 447 | u32 component_id, acpi_status status) |
426 | { | 448 | { |
427 | 449 | ||
428 | if (ACPI_SUCCESS(status)) { | 450 | /* Check if enabled up-front for performance */ |
429 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 451 | |
430 | line_number, function_name, module_name, | 452 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
431 | component_id, "%s %s\n", acpi_gbl_fn_exit_str, | 453 | if (ACPI_SUCCESS(status)) { |
432 | acpi_format_exception(status)); | 454 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
433 | } else { | 455 | line_number, function_name, |
434 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 456 | module_name, component_id, "%s %s\n", |
435 | line_number, function_name, module_name, | 457 | acpi_gbl_fn_exit_str, |
436 | component_id, "%s ****Exception****: %s\n", | 458 | acpi_format_exception(status)); |
437 | acpi_gbl_fn_exit_str, | 459 | } else { |
438 | acpi_format_exception(status)); | 460 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
461 | line_number, function_name, | ||
462 | module_name, component_id, | ||
463 | "%s ****Exception****: %s\n", | ||
464 | acpi_gbl_fn_exit_str, | ||
465 | acpi_format_exception(status)); | ||
466 | } | ||
439 | } | 467 | } |
440 | 468 | ||
441 | acpi_gbl_nesting_level--; | 469 | acpi_gbl_nesting_level--; |
@@ -465,10 +493,15 @@ acpi_ut_value_exit(u32 line_number, | |||
465 | const char *module_name, u32 component_id, u64 value) | 493 | const char *module_name, u32 component_id, u64 value) |
466 | { | 494 | { |
467 | 495 | ||
468 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 496 | /* Check if enabled up-front for performance */ |
469 | line_number, function_name, module_name, component_id, | 497 | |
470 | "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, | 498 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
471 | ACPI_FORMAT_UINT64(value)); | 499 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
500 | line_number, function_name, module_name, | ||
501 | component_id, "%s %8.8X%8.8X\n", | ||
502 | acpi_gbl_fn_exit_str, | ||
503 | ACPI_FORMAT_UINT64(value)); | ||
504 | } | ||
472 | 505 | ||
473 | acpi_gbl_nesting_level--; | 506 | acpi_gbl_nesting_level--; |
474 | } | 507 | } |
@@ -497,9 +530,14 @@ acpi_ut_ptr_exit(u32 line_number, | |||
497 | const char *module_name, u32 component_id, u8 *ptr) | 530 | const char *module_name, u32 component_id, u8 *ptr) |
498 | { | 531 | { |
499 | 532 | ||
500 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 533 | /* Check if enabled up-front for performance */ |
501 | line_number, function_name, module_name, component_id, | 534 | |
502 | "%s %p\n", acpi_gbl_fn_exit_str, ptr); | 535 | if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) { |
536 | acpi_debug_print(ACPI_LV_FUNCTIONS, | ||
537 | line_number, function_name, module_name, | ||
538 | component_id, "%s %p\n", acpi_gbl_fn_exit_str, | ||
539 | ptr); | ||
540 | } | ||
503 | 541 | ||
504 | acpi_gbl_nesting_level--; | 542 | acpi_gbl_nesting_level--; |
505 | } | 543 | } |
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c index 60a158472d82..11e2e02e1618 100644 --- a/drivers/acpi/acpica/utdecode.c +++ b/drivers/acpi/acpica/utdecode.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index 798105443d0f..2541de420249 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -340,7 +340,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
340 | { | 340 | { |
341 | union acpi_operand_object **internal_obj; | 341 | union acpi_operand_object **internal_obj; |
342 | 342 | ||
343 | ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); | 343 | ACPI_FUNCTION_ENTRY(); |
344 | 344 | ||
345 | /* Walk the null-terminated internal list */ | 345 | /* Walk the null-terminated internal list */ |
346 | 346 | ||
@@ -351,7 +351,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
351 | /* Free the combined parameter pointer list and object array */ | 351 | /* Free the combined parameter pointer list and object array */ |
352 | 352 | ||
353 | ACPI_FREE(obj_list); | 353 | ACPI_FREE(obj_list); |
354 | return_VOID; | 354 | return; |
355 | } | 355 | } |
356 | 356 | ||
357 | /******************************************************************************* | 357 | /******************************************************************************* |
@@ -484,7 +484,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
484 | union acpi_generic_state *state; | 484 | union acpi_generic_state *state; |
485 | u32 i; | 485 | u32 i; |
486 | 486 | ||
487 | ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); | 487 | ACPI_FUNCTION_NAME(ut_update_object_reference); |
488 | 488 | ||
489 | while (object) { | 489 | while (object) { |
490 | 490 | ||
@@ -493,7 +493,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
493 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { | 493 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { |
494 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 494 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
495 | "Object %p is NS handle\n", object)); | 495 | "Object %p is NS handle\n", object)); |
496 | return_ACPI_STATUS(AE_OK); | 496 | return (AE_OK); |
497 | } | 497 | } |
498 | 498 | ||
499 | /* | 499 | /* |
@@ -530,18 +530,42 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
530 | */ | 530 | */ |
531 | for (i = 0; i < object->package.count; i++) { | 531 | for (i = 0; i < object->package.count; i++) { |
532 | /* | 532 | /* |
533 | * Push each element onto the stack for later processing. | 533 | * Null package elements are legal and can be simply |
534 | * Note: There can be null elements within the package, | 534 | * ignored. |
535 | * these are simply ignored | ||
536 | */ | 535 | */ |
537 | status = | 536 | next_object = object->package.elements[i]; |
538 | acpi_ut_create_update_state_and_push | 537 | if (!next_object) { |
539 | (object->package.elements[i], action, | 538 | continue; |
540 | &state_list); | 539 | } |
541 | if (ACPI_FAILURE(status)) { | 540 | |
542 | goto error_exit; | 541 | switch (next_object->common.type) { |
542 | case ACPI_TYPE_INTEGER: | ||
543 | case ACPI_TYPE_STRING: | ||
544 | case ACPI_TYPE_BUFFER: | ||
545 | /* | ||
546 | * For these very simple sub-objects, we can just | ||
547 | * update the reference count here and continue. | ||
548 | * Greatly increases performance of this operation. | ||
549 | */ | ||
550 | acpi_ut_update_ref_count(next_object, | ||
551 | action); | ||
552 | break; | ||
553 | |||
554 | default: | ||
555 | /* | ||
556 | * For complex sub-objects, push them onto the stack | ||
557 | * for later processing (this eliminates recursion.) | ||
558 | */ | ||
559 | status = | ||
560 | acpi_ut_create_update_state_and_push | ||
561 | (next_object, action, &state_list); | ||
562 | if (ACPI_FAILURE(status)) { | ||
563 | goto error_exit; | ||
564 | } | ||
565 | break; | ||
543 | } | 566 | } |
544 | } | 567 | } |
568 | next_object = NULL; | ||
545 | break; | 569 | break; |
546 | 570 | ||
547 | case ACPI_TYPE_BUFFER_FIELD: | 571 | case ACPI_TYPE_BUFFER_FIELD: |
@@ -619,7 +643,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
619 | } | 643 | } |
620 | } | 644 | } |
621 | 645 | ||
622 | return_ACPI_STATUS(AE_OK); | 646 | return (AE_OK); |
623 | 647 | ||
624 | error_exit: | 648 | error_exit: |
625 | 649 | ||
@@ -633,7 +657,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
633 | acpi_ut_delete_generic_state(state); | 657 | acpi_ut_delete_generic_state(state); |
634 | } | 658 | } |
635 | 659 | ||
636 | return_ACPI_STATUS(status); | 660 | return (status); |
637 | } | 661 | } |
638 | 662 | ||
639 | /******************************************************************************* | 663 | /******************************************************************************* |
@@ -652,12 +676,12 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
652 | void acpi_ut_add_reference(union acpi_operand_object *object) | 676 | void acpi_ut_add_reference(union acpi_operand_object *object) |
653 | { | 677 | { |
654 | 678 | ||
655 | ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); | 679 | ACPI_FUNCTION_NAME(ut_add_reference); |
656 | 680 | ||
657 | /* Ensure that we have a valid object */ | 681 | /* Ensure that we have a valid object */ |
658 | 682 | ||
659 | if (!acpi_ut_valid_internal_object(object)) { | 683 | if (!acpi_ut_valid_internal_object(object)) { |
660 | return_VOID; | 684 | return; |
661 | } | 685 | } |
662 | 686 | ||
663 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 687 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
@@ -667,7 +691,7 @@ void acpi_ut_add_reference(union acpi_operand_object *object) | |||
667 | /* Increment the reference count */ | 691 | /* Increment the reference count */ |
668 | 692 | ||
669 | (void)acpi_ut_update_object_reference(object, REF_INCREMENT); | 693 | (void)acpi_ut_update_object_reference(object, REF_INCREMENT); |
670 | return_VOID; | 694 | return; |
671 | } | 695 | } |
672 | 696 | ||
673 | /******************************************************************************* | 697 | /******************************************************************************* |
@@ -685,7 +709,7 @@ void acpi_ut_add_reference(union acpi_operand_object *object) | |||
685 | void acpi_ut_remove_reference(union acpi_operand_object *object) | 709 | void acpi_ut_remove_reference(union acpi_operand_object *object) |
686 | { | 710 | { |
687 | 711 | ||
688 | ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); | 712 | ACPI_FUNCTION_NAME(ut_remove_reference); |
689 | 713 | ||
690 | /* | 714 | /* |
691 | * Allow a NULL pointer to be passed in, just ignore it. This saves | 715 | * Allow a NULL pointer to be passed in, just ignore it. This saves |
@@ -694,13 +718,13 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) | |||
694 | */ | 718 | */ |
695 | if (!object || | 719 | if (!object || |
696 | (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) { | 720 | (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) { |
697 | return_VOID; | 721 | return; |
698 | } | 722 | } |
699 | 723 | ||
700 | /* Ensure that we have a valid object */ | 724 | /* Ensure that we have a valid object */ |
701 | 725 | ||
702 | if (!acpi_ut_valid_internal_object(object)) { | 726 | if (!acpi_ut_valid_internal_object(object)) { |
703 | return_VOID; | 727 | return; |
704 | } | 728 | } |
705 | 729 | ||
706 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 730 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
@@ -713,5 +737,5 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) | |||
713 | * of all subobjects!) | 737 | * of all subobjects!) |
714 | */ | 738 | */ |
715 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); | 739 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); |
716 | return_VOID; | 740 | return; |
717 | } | 741 | } |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index a9c65fbea5f4..c3f3a7e7bdc7 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("uteval") | |||
68 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | 69 | ||
70 | acpi_status | 70 | acpi_status |
71 | acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | 71 | acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node, |
72 | char *path, | 72 | char *path, |
73 | u32 expected_return_btypes, | 73 | u32 expected_return_btypes, |
74 | union acpi_operand_object **return_desc) | 74 | union acpi_operand_object **return_desc) |
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c index 23b98945f6b7..a0ab7c02e87c 100644 --- a/drivers/acpi/acpica/utexcep.c +++ b/drivers/acpi/acpica/utexcep.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index ed1893155f8b..ffecf4b4f0dd 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -293,11 +293,11 @@ acpi_status acpi_ut_init_globals(void) | |||
293 | 293 | ||
294 | /* GPE support */ | 294 | /* GPE support */ |
295 | 295 | ||
296 | acpi_gbl_all_gpes_initialized = FALSE; | ||
296 | acpi_gbl_gpe_xrupt_list_head = NULL; | 297 | acpi_gbl_gpe_xrupt_list_head = NULL; |
297 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | 298 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
298 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | 299 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
299 | acpi_current_gpe_count = 0; | 300 | acpi_current_gpe_count = 0; |
300 | acpi_gbl_all_gpes_initialized = FALSE; | ||
301 | 301 | ||
302 | acpi_gbl_global_event_handler = NULL; | 302 | acpi_gbl_global_event_handler = NULL; |
303 | 303 | ||
@@ -357,17 +357,24 @@ acpi_status acpi_ut_init_globals(void) | |||
357 | acpi_gbl_root_node_struct.peer = NULL; | 357 | acpi_gbl_root_node_struct.peer = NULL; |
358 | acpi_gbl_root_node_struct.object = NULL; | 358 | acpi_gbl_root_node_struct.object = NULL; |
359 | 359 | ||
360 | #ifdef ACPI_DISASSEMBLER | ||
361 | acpi_gbl_external_list = NULL; | ||
362 | #endif | ||
363 | |||
360 | #ifdef ACPI_DEBUG_OUTPUT | 364 | #ifdef ACPI_DEBUG_OUTPUT |
361 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); | 365 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); |
362 | #endif | 366 | #endif |
363 | 367 | ||
364 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 368 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
365 | acpi_gbl_display_final_mem_stats = FALSE; | 369 | acpi_gbl_display_final_mem_stats = FALSE; |
370 | acpi_gbl_disable_mem_tracking = FALSE; | ||
366 | #endif | 371 | #endif |
367 | 372 | ||
368 | return_ACPI_STATUS(AE_OK); | 373 | return_ACPI_STATUS(AE_OK); |
369 | } | 374 | } |
370 | 375 | ||
376 | /* Public globals */ | ||
377 | |||
371 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | 378 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) |
372 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | 379 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
373 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | 380 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index 774c3aefbf5d..43a170a74a61 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index 246798e4c938..c5d1ac44c07d 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c index b1eb7f17e110..5c26ad420344 100644 --- a/drivers/acpi/acpica/utlock.c +++ b/drivers/acpi/acpica/utlock.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -66,11 +66,11 @@ acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock) | |||
66 | lock->num_readers = 0; | 66 | lock->num_readers = 0; |
67 | status = acpi_os_create_mutex(&lock->reader_mutex); | 67 | status = acpi_os_create_mutex(&lock->reader_mutex); |
68 | if (ACPI_FAILURE(status)) { | 68 | if (ACPI_FAILURE(status)) { |
69 | return status; | 69 | return (status); |
70 | } | 70 | } |
71 | 71 | ||
72 | status = acpi_os_create_mutex(&lock->writer_mutex); | 72 | status = acpi_os_create_mutex(&lock->writer_mutex); |
73 | return status; | 73 | return (status); |
74 | } | 74 | } |
75 | 75 | ||
76 | void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock) | 76 | void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock) |
@@ -108,7 +108,7 @@ acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock) | |||
108 | 108 | ||
109 | status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER); | 109 | status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER); |
110 | if (ACPI_FAILURE(status)) { | 110 | if (ACPI_FAILURE(status)) { |
111 | return status; | 111 | return (status); |
112 | } | 112 | } |
113 | 113 | ||
114 | /* Acquire the write lock only for the first reader */ | 114 | /* Acquire the write lock only for the first reader */ |
@@ -121,7 +121,7 @@ acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | acpi_os_release_mutex(lock->reader_mutex); | 123 | acpi_os_release_mutex(lock->reader_mutex); |
124 | return status; | 124 | return (status); |
125 | } | 125 | } |
126 | 126 | ||
127 | acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock) | 127 | acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock) |
@@ -130,7 +130,7 @@ acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock) | |||
130 | 130 | ||
131 | status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER); | 131 | status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER); |
132 | if (ACPI_FAILURE(status)) { | 132 | if (ACPI_FAILURE(status)) { |
133 | return status; | 133 | return (status); |
134 | } | 134 | } |
135 | 135 | ||
136 | /* Release the write lock only for the very last reader */ | 136 | /* Release the write lock only for the very last reader */ |
@@ -141,7 +141,7 @@ acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock) | |||
141 | } | 141 | } |
142 | 142 | ||
143 | acpi_os_release_mutex(lock->reader_mutex); | 143 | acpi_os_release_mutex(lock->reader_mutex); |
144 | return status; | 144 | return (status); |
145 | } | 145 | } |
146 | 146 | ||
147 | /******************************************************************************* | 147 | /******************************************************************************* |
@@ -165,7 +165,7 @@ acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock) | |||
165 | acpi_status status; | 165 | acpi_status status; |
166 | 166 | ||
167 | status = acpi_os_acquire_mutex(lock->writer_mutex, ACPI_WAIT_FOREVER); | 167 | status = acpi_os_acquire_mutex(lock->writer_mutex, ACPI_WAIT_FOREVER); |
168 | return status; | 168 | return (status); |
169 | } | 169 | } |
170 | 170 | ||
171 | void acpi_ut_release_write_lock(struct acpi_rw_lock *lock) | 171 | void acpi_ut_release_write_lock(struct acpi_rw_lock *lock) |
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index 49563674833a..909fe66e1934 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index 9286a69eb9aa..785fdd07ae56 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -48,36 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME("utmisc") | 49 | ACPI_MODULE_NAME("utmisc") |
50 | 50 | ||
51 | #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP | ||
52 | /******************************************************************************* | ||
53 | * | ||
54 | * FUNCTION: ut_convert_backslashes | ||
55 | * | ||
56 | * PARAMETERS: pathname - File pathname string to be converted | ||
57 | * | ||
58 | * RETURN: Modifies the input Pathname | ||
59 | * | ||
60 | * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within | ||
61 | * the entire input file pathname string. | ||
62 | * | ||
63 | ******************************************************************************/ | ||
64 | void ut_convert_backslashes(char *pathname) | ||
65 | { | ||
66 | |||
67 | if (!pathname) { | ||
68 | return; | ||
69 | } | ||
70 | |||
71 | while (*pathname) { | ||
72 | if (*pathname == '\\') { | ||
73 | *pathname = '/'; | ||
74 | } | ||
75 | |||
76 | pathname++; | ||
77 | } | ||
78 | } | ||
79 | #endif | ||
80 | |||
81 | /******************************************************************************* | 51 | /******************************************************************************* |
82 | * | 52 | * |
83 | * FUNCTION: acpi_ut_is_pci_root_bridge | 53 | * FUNCTION: acpi_ut_is_pci_root_bridge |
@@ -89,7 +59,6 @@ void ut_convert_backslashes(char *pathname) | |||
89 | * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. | 59 | * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. |
90 | * | 60 | * |
91 | ******************************************************************************/ | 61 | ******************************************************************************/ |
92 | |||
93 | u8 acpi_ut_is_pci_root_bridge(char *id) | 62 | u8 acpi_ut_is_pci_root_bridge(char *id) |
94 | { | 63 | { |
95 | 64 | ||
@@ -136,362 +105,6 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table) | |||
136 | 105 | ||
137 | /******************************************************************************* | 106 | /******************************************************************************* |
138 | * | 107 | * |
139 | * FUNCTION: acpi_ut_allocate_owner_id | ||
140 | * | ||
141 | * PARAMETERS: owner_id - Where the new owner ID is returned | ||
142 | * | ||
143 | * RETURN: Status | ||
144 | * | ||
145 | * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to | ||
146 | * track objects created by the table or method, to be deleted | ||
147 | * when the method exits or the table is unloaded. | ||
148 | * | ||
149 | ******************************************************************************/ | ||
150 | |||
151 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | ||
152 | { | ||
153 | u32 i; | ||
154 | u32 j; | ||
155 | u32 k; | ||
156 | acpi_status status; | ||
157 | |||
158 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); | ||
159 | |||
160 | /* Guard against multiple allocations of ID to the same location */ | ||
161 | |||
162 | if (*owner_id) { | ||
163 | ACPI_ERROR((AE_INFO, "Owner ID [0x%2.2X] already exists", | ||
164 | *owner_id)); | ||
165 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | ||
166 | } | ||
167 | |||
168 | /* Mutex for the global ID mask */ | ||
169 | |||
170 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | ||
171 | if (ACPI_FAILURE(status)) { | ||
172 | return_ACPI_STATUS(status); | ||
173 | } | ||
174 | |||
175 | /* | ||
176 | * Find a free owner ID, cycle through all possible IDs on repeated | ||
177 | * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have | ||
178 | * to be scanned twice. | ||
179 | */ | ||
180 | for (i = 0, j = acpi_gbl_last_owner_id_index; | ||
181 | i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { | ||
182 | if (j >= ACPI_NUM_OWNERID_MASKS) { | ||
183 | j = 0; /* Wraparound to start of mask array */ | ||
184 | } | ||
185 | |||
186 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { | ||
187 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { | ||
188 | |||
189 | /* There are no free IDs in this mask */ | ||
190 | |||
191 | break; | ||
192 | } | ||
193 | |||
194 | if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) { | ||
195 | /* | ||
196 | * Found a free ID. The actual ID is the bit index plus one, | ||
197 | * making zero an invalid Owner ID. Save this as the last ID | ||
198 | * allocated and update the global ID mask. | ||
199 | */ | ||
200 | acpi_gbl_owner_id_mask[j] |= (1 << k); | ||
201 | |||
202 | acpi_gbl_last_owner_id_index = (u8)j; | ||
203 | acpi_gbl_next_owner_id_offset = (u8)(k + 1); | ||
204 | |||
205 | /* | ||
206 | * Construct encoded ID from the index and bit position | ||
207 | * | ||
208 | * Note: Last [j].k (bit 255) is never used and is marked | ||
209 | * permanently allocated (prevents +1 overflow) | ||
210 | */ | ||
211 | *owner_id = | ||
212 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); | ||
213 | |||
214 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, | ||
215 | "Allocated OwnerId: %2.2X\n", | ||
216 | (unsigned int)*owner_id)); | ||
217 | goto exit; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | acpi_gbl_next_owner_id_offset = 0; | ||
222 | } | ||
223 | |||
224 | /* | ||
225 | * All owner_ids have been allocated. This typically should | ||
226 | * not happen since the IDs are reused after deallocation. The IDs are | ||
227 | * allocated upon table load (one per table) and method execution, and | ||
228 | * they are released when a table is unloaded or a method completes | ||
229 | * execution. | ||
230 | * | ||
231 | * If this error happens, there may be very deep nesting of invoked control | ||
232 | * methods, or there may be a bug where the IDs are not released. | ||
233 | */ | ||
234 | status = AE_OWNER_ID_LIMIT; | ||
235 | ACPI_ERROR((AE_INFO, | ||
236 | "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); | ||
237 | |||
238 | exit: | ||
239 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | ||
240 | return_ACPI_STATUS(status); | ||
241 | } | ||
242 | |||
243 | /******************************************************************************* | ||
244 | * | ||
245 | * FUNCTION: acpi_ut_release_owner_id | ||
246 | * | ||
247 | * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_ID | ||
248 | * | ||
249 | * RETURN: None. No error is returned because we are either exiting a | ||
250 | * control method or unloading a table. Either way, we would | ||
251 | * ignore any error anyway. | ||
252 | * | ||
253 | * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 | ||
254 | * | ||
255 | ******************************************************************************/ | ||
256 | |||
257 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | ||
258 | { | ||
259 | acpi_owner_id owner_id = *owner_id_ptr; | ||
260 | acpi_status status; | ||
261 | u32 index; | ||
262 | u32 bit; | ||
263 | |||
264 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); | ||
265 | |||
266 | /* Always clear the input owner_id (zero is an invalid ID) */ | ||
267 | |||
268 | *owner_id_ptr = 0; | ||
269 | |||
270 | /* Zero is not a valid owner_ID */ | ||
271 | |||
272 | if (owner_id == 0) { | ||
273 | ACPI_ERROR((AE_INFO, "Invalid OwnerId: 0x%2.2X", owner_id)); | ||
274 | return_VOID; | ||
275 | } | ||
276 | |||
277 | /* Mutex for the global ID mask */ | ||
278 | |||
279 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | ||
280 | if (ACPI_FAILURE(status)) { | ||
281 | return_VOID; | ||
282 | } | ||
283 | |||
284 | /* Normalize the ID to zero */ | ||
285 | |||
286 | owner_id--; | ||
287 | |||
288 | /* Decode ID to index/offset pair */ | ||
289 | |||
290 | index = ACPI_DIV_32(owner_id); | ||
291 | bit = 1 << ACPI_MOD_32(owner_id); | ||
292 | |||
293 | /* Free the owner ID only if it is valid */ | ||
294 | |||
295 | if (acpi_gbl_owner_id_mask[index] & bit) { | ||
296 | acpi_gbl_owner_id_mask[index] ^= bit; | ||
297 | } else { | ||
298 | ACPI_ERROR((AE_INFO, | ||
299 | "Release of non-allocated OwnerId: 0x%2.2X", | ||
300 | owner_id + 1)); | ||
301 | } | ||
302 | |||
303 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | ||
304 | return_VOID; | ||
305 | } | ||
306 | |||
307 | /******************************************************************************* | ||
308 | * | ||
309 | * FUNCTION: acpi_ut_strupr (strupr) | ||
310 | * | ||
311 | * PARAMETERS: src_string - The source string to convert | ||
312 | * | ||
313 | * RETURN: None | ||
314 | * | ||
315 | * DESCRIPTION: Convert string to uppercase | ||
316 | * | ||
317 | * NOTE: This is not a POSIX function, so it appears here, not in utclib.c | ||
318 | * | ||
319 | ******************************************************************************/ | ||
320 | |||
321 | void acpi_ut_strupr(char *src_string) | ||
322 | { | ||
323 | char *string; | ||
324 | |||
325 | ACPI_FUNCTION_ENTRY(); | ||
326 | |||
327 | if (!src_string) { | ||
328 | return; | ||
329 | } | ||
330 | |||
331 | /* Walk entire string, uppercasing the letters */ | ||
332 | |||
333 | for (string = src_string; *string; string++) { | ||
334 | *string = (char)ACPI_TOUPPER(*string); | ||
335 | } | ||
336 | |||
337 | return; | ||
338 | } | ||
339 | |||
340 | #ifdef ACPI_ASL_COMPILER | ||
341 | /******************************************************************************* | ||
342 | * | ||
343 | * FUNCTION: acpi_ut_strlwr (strlwr) | ||
344 | * | ||
345 | * PARAMETERS: src_string - The source string to convert | ||
346 | * | ||
347 | * RETURN: None | ||
348 | * | ||
349 | * DESCRIPTION: Convert string to lowercase | ||
350 | * | ||
351 | * NOTE: This is not a POSIX function, so it appears here, not in utclib.c | ||
352 | * | ||
353 | ******************************************************************************/ | ||
354 | |||
355 | void acpi_ut_strlwr(char *src_string) | ||
356 | { | ||
357 | char *string; | ||
358 | |||
359 | ACPI_FUNCTION_ENTRY(); | ||
360 | |||
361 | if (!src_string) { | ||
362 | return; | ||
363 | } | ||
364 | |||
365 | /* Walk entire string, lowercasing the letters */ | ||
366 | |||
367 | for (string = src_string; *string; string++) { | ||
368 | *string = (char)ACPI_TOLOWER(*string); | ||
369 | } | ||
370 | |||
371 | return; | ||
372 | } | ||
373 | |||
374 | /****************************************************************************** | ||
375 | * | ||
376 | * FUNCTION: acpi_ut_stricmp | ||
377 | * | ||
378 | * PARAMETERS: string1 - first string to compare | ||
379 | * string2 - second string to compare | ||
380 | * | ||
381 | * RETURN: int that signifies string relationship. Zero means strings | ||
382 | * are equal. | ||
383 | * | ||
384 | * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare | ||
385 | * strings with no case sensitivity) | ||
386 | * | ||
387 | ******************************************************************************/ | ||
388 | |||
389 | int acpi_ut_stricmp(char *string1, char *string2) | ||
390 | { | ||
391 | int c1; | ||
392 | int c2; | ||
393 | |||
394 | do { | ||
395 | c1 = tolower((int)*string1); | ||
396 | c2 = tolower((int)*string2); | ||
397 | |||
398 | string1++; | ||
399 | string2++; | ||
400 | } | ||
401 | while ((c1 == c2) && (c1)); | ||
402 | |||
403 | return (c1 - c2); | ||
404 | } | ||
405 | #endif | ||
406 | |||
407 | /******************************************************************************* | ||
408 | * | ||
409 | * FUNCTION: acpi_ut_print_string | ||
410 | * | ||
411 | * PARAMETERS: string - Null terminated ASCII string | ||
412 | * max_length - Maximum output length | ||
413 | * | ||
414 | * RETURN: None | ||
415 | * | ||
416 | * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape | ||
417 | * sequences. | ||
418 | * | ||
419 | ******************************************************************************/ | ||
420 | |||
421 | void acpi_ut_print_string(char *string, u8 max_length) | ||
422 | { | ||
423 | u32 i; | ||
424 | |||
425 | if (!string) { | ||
426 | acpi_os_printf("<\"NULL STRING PTR\">"); | ||
427 | return; | ||
428 | } | ||
429 | |||
430 | acpi_os_printf("\""); | ||
431 | for (i = 0; string[i] && (i < max_length); i++) { | ||
432 | |||
433 | /* Escape sequences */ | ||
434 | |||
435 | switch (string[i]) { | ||
436 | case 0x07: | ||
437 | acpi_os_printf("\\a"); /* BELL */ | ||
438 | break; | ||
439 | |||
440 | case 0x08: | ||
441 | acpi_os_printf("\\b"); /* BACKSPACE */ | ||
442 | break; | ||
443 | |||
444 | case 0x0C: | ||
445 | acpi_os_printf("\\f"); /* FORMFEED */ | ||
446 | break; | ||
447 | |||
448 | case 0x0A: | ||
449 | acpi_os_printf("\\n"); /* LINEFEED */ | ||
450 | break; | ||
451 | |||
452 | case 0x0D: | ||
453 | acpi_os_printf("\\r"); /* CARRIAGE RETURN */ | ||
454 | break; | ||
455 | |||
456 | case 0x09: | ||
457 | acpi_os_printf("\\t"); /* HORIZONTAL TAB */ | ||
458 | break; | ||
459 | |||
460 | case 0x0B: | ||
461 | acpi_os_printf("\\v"); /* VERTICAL TAB */ | ||
462 | break; | ||
463 | |||
464 | case '\'': /* Single Quote */ | ||
465 | case '\"': /* Double Quote */ | ||
466 | case '\\': /* Backslash */ | ||
467 | acpi_os_printf("\\%c", (int)string[i]); | ||
468 | break; | ||
469 | |||
470 | default: | ||
471 | |||
472 | /* Check for printable character or hex escape */ | ||
473 | |||
474 | if (ACPI_IS_PRINT(string[i])) { | ||
475 | /* This is a normal character */ | ||
476 | |||
477 | acpi_os_printf("%c", (int)string[i]); | ||
478 | } else { | ||
479 | /* All others will be Hex escapes */ | ||
480 | |||
481 | acpi_os_printf("\\x%2.2X", (s32) string[i]); | ||
482 | } | ||
483 | break; | ||
484 | } | ||
485 | } | ||
486 | acpi_os_printf("\""); | ||
487 | |||
488 | if (i == max_length && string[i]) { | ||
489 | acpi_os_printf("..."); | ||
490 | } | ||
491 | } | ||
492 | |||
493 | /******************************************************************************* | ||
494 | * | ||
495 | * FUNCTION: acpi_ut_dword_byte_swap | 108 | * FUNCTION: acpi_ut_dword_byte_swap |
496 | * | 109 | * |
497 | * PARAMETERS: value - Value to be converted | 110 | * PARAMETERS: value - Value to be converted |
@@ -559,379 +172,6 @@ void acpi_ut_set_integer_width(u8 revision) | |||
559 | } | 172 | } |
560 | } | 173 | } |
561 | 174 | ||
562 | #ifdef ACPI_DEBUG_OUTPUT | ||
563 | /******************************************************************************* | ||
564 | * | ||
565 | * FUNCTION: acpi_ut_display_init_pathname | ||
566 | * | ||
567 | * PARAMETERS: type - Object type of the node | ||
568 | * obj_handle - Handle whose pathname will be displayed | ||
569 | * path - Additional path string to be appended. | ||
570 | * (NULL if no extra path) | ||
571 | * | ||
572 | * RETURN: acpi_status | ||
573 | * | ||
574 | * DESCRIPTION: Display full pathname of an object, DEBUG ONLY | ||
575 | * | ||
576 | ******************************************************************************/ | ||
577 | |||
578 | void | ||
579 | acpi_ut_display_init_pathname(u8 type, | ||
580 | struct acpi_namespace_node *obj_handle, | ||
581 | char *path) | ||
582 | { | ||
583 | acpi_status status; | ||
584 | struct acpi_buffer buffer; | ||
585 | |||
586 | ACPI_FUNCTION_ENTRY(); | ||
587 | |||
588 | /* Only print the path if the appropriate debug level is enabled */ | ||
589 | |||
590 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | ||
591 | return; | ||
592 | } | ||
593 | |||
594 | /* Get the full pathname to the node */ | ||
595 | |||
596 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
597 | status = acpi_ns_handle_to_pathname(obj_handle, &buffer); | ||
598 | if (ACPI_FAILURE(status)) { | ||
599 | return; | ||
600 | } | ||
601 | |||
602 | /* Print what we're doing */ | ||
603 | |||
604 | switch (type) { | ||
605 | case ACPI_TYPE_METHOD: | ||
606 | acpi_os_printf("Executing "); | ||
607 | break; | ||
608 | |||
609 | default: | ||
610 | acpi_os_printf("Initializing "); | ||
611 | break; | ||
612 | } | ||
613 | |||
614 | /* Print the object type and pathname */ | ||
615 | |||
616 | acpi_os_printf("%-12s %s", | ||
617 | acpi_ut_get_type_name(type), (char *)buffer.pointer); | ||
618 | |||
619 | /* Extra path is used to append names like _STA, _INI, etc. */ | ||
620 | |||
621 | if (path) { | ||
622 | acpi_os_printf(".%s", path); | ||
623 | } | ||
624 | acpi_os_printf("\n"); | ||
625 | |||
626 | ACPI_FREE(buffer.pointer); | ||
627 | } | ||
628 | #endif | ||
629 | |||
630 | /******************************************************************************* | ||
631 | * | ||
632 | * FUNCTION: acpi_ut_valid_acpi_char | ||
633 | * | ||
634 | * PARAMETERS: char - The character to be examined | ||
635 | * position - Byte position (0-3) | ||
636 | * | ||
637 | * RETURN: TRUE if the character is valid, FALSE otherwise | ||
638 | * | ||
639 | * DESCRIPTION: Check for a valid ACPI character. Must be one of: | ||
640 | * 1) Upper case alpha | ||
641 | * 2) numeric | ||
642 | * 3) underscore | ||
643 | * | ||
644 | * We allow a '!' as the last character because of the ASF! table | ||
645 | * | ||
646 | ******************************************************************************/ | ||
647 | |||
648 | u8 acpi_ut_valid_acpi_char(char character, u32 position) | ||
649 | { | ||
650 | |||
651 | if (!((character >= 'A' && character <= 'Z') || | ||
652 | (character >= '0' && character <= '9') || (character == '_'))) { | ||
653 | |||
654 | /* Allow a '!' in the last position */ | ||
655 | |||
656 | if (character == '!' && position == 3) { | ||
657 | return (TRUE); | ||
658 | } | ||
659 | |||
660 | return (FALSE); | ||
661 | } | ||
662 | |||
663 | return (TRUE); | ||
664 | } | ||
665 | |||
666 | /******************************************************************************* | ||
667 | * | ||
668 | * FUNCTION: acpi_ut_valid_acpi_name | ||
669 | * | ||
670 | * PARAMETERS: name - The name to be examined | ||
671 | * | ||
672 | * RETURN: TRUE if the name is valid, FALSE otherwise | ||
673 | * | ||
674 | * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: | ||
675 | * 1) Upper case alpha | ||
676 | * 2) numeric | ||
677 | * 3) underscore | ||
678 | * | ||
679 | ******************************************************************************/ | ||
680 | |||
681 | u8 acpi_ut_valid_acpi_name(u32 name) | ||
682 | { | ||
683 | u32 i; | ||
684 | |||
685 | ACPI_FUNCTION_ENTRY(); | ||
686 | |||
687 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | ||
688 | if (!acpi_ut_valid_acpi_char | ||
689 | ((ACPI_CAST_PTR(char, &name))[i], i)) { | ||
690 | return (FALSE); | ||
691 | } | ||
692 | } | ||
693 | |||
694 | return (TRUE); | ||
695 | } | ||
696 | |||
697 | /******************************************************************************* | ||
698 | * | ||
699 | * FUNCTION: acpi_ut_repair_name | ||
700 | * | ||
701 | * PARAMETERS: name - The ACPI name to be repaired | ||
702 | * | ||
703 | * RETURN: Repaired version of the name | ||
704 | * | ||
705 | * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and | ||
706 | * return the new name. NOTE: the Name parameter must reside in | ||
707 | * read/write memory, cannot be a const. | ||
708 | * | ||
709 | * An ACPI Name must consist of valid ACPI characters. We will repair the name | ||
710 | * if necessary because we don't want to abort because of this, but we want | ||
711 | * all namespace names to be printable. A warning message is appropriate. | ||
712 | * | ||
713 | * This issue came up because there are in fact machines that exhibit | ||
714 | * this problem, and we want to be able to enable ACPI support for them, | ||
715 | * even though there are a few bad names. | ||
716 | * | ||
717 | ******************************************************************************/ | ||
718 | |||
719 | void acpi_ut_repair_name(char *name) | ||
720 | { | ||
721 | u32 i; | ||
722 | u8 found_bad_char = FALSE; | ||
723 | u32 original_name; | ||
724 | |||
725 | ACPI_FUNCTION_NAME(ut_repair_name); | ||
726 | |||
727 | ACPI_MOVE_NAME(&original_name, name); | ||
728 | |||
729 | /* Check each character in the name */ | ||
730 | |||
731 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | ||
732 | if (acpi_ut_valid_acpi_char(name[i], i)) { | ||
733 | continue; | ||
734 | } | ||
735 | |||
736 | /* | ||
737 | * Replace a bad character with something printable, yet technically | ||
738 | * still invalid. This prevents any collisions with existing "good" | ||
739 | * names in the namespace. | ||
740 | */ | ||
741 | name[i] = '*'; | ||
742 | found_bad_char = TRUE; | ||
743 | } | ||
744 | |||
745 | if (found_bad_char) { | ||
746 | |||
747 | /* Report warning only if in strict mode or debug mode */ | ||
748 | |||
749 | if (!acpi_gbl_enable_interpreter_slack) { | ||
750 | ACPI_WARNING((AE_INFO, | ||
751 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
752 | name)); | ||
753 | } else { | ||
754 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
755 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
756 | name)); | ||
757 | } | ||
758 | } | ||
759 | } | ||
760 | |||
761 | /******************************************************************************* | ||
762 | * | ||
763 | * FUNCTION: acpi_ut_strtoul64 | ||
764 | * | ||
765 | * PARAMETERS: string - Null terminated string | ||
766 | * base - Radix of the string: 16 or ACPI_ANY_BASE; | ||
767 | * ACPI_ANY_BASE means 'in behalf of to_integer' | ||
768 | * ret_integer - Where the converted integer is returned | ||
769 | * | ||
770 | * RETURN: Status and Converted value | ||
771 | * | ||
772 | * DESCRIPTION: Convert a string into an unsigned value. Performs either a | ||
773 | * 32-bit or 64-bit conversion, depending on the current mode | ||
774 | * of the interpreter. | ||
775 | * NOTE: Does not support Octal strings, not needed. | ||
776 | * | ||
777 | ******************************************************************************/ | ||
778 | |||
779 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer) | ||
780 | { | ||
781 | u32 this_digit = 0; | ||
782 | u64 return_value = 0; | ||
783 | u64 quotient; | ||
784 | u64 dividend; | ||
785 | u32 to_integer_op = (base == ACPI_ANY_BASE); | ||
786 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); | ||
787 | u8 valid_digits = 0; | ||
788 | u8 sign_of0x = 0; | ||
789 | u8 term = 0; | ||
790 | |||
791 | ACPI_FUNCTION_TRACE_STR(ut_stroul64, string); | ||
792 | |||
793 | switch (base) { | ||
794 | case ACPI_ANY_BASE: | ||
795 | case 16: | ||
796 | break; | ||
797 | |||
798 | default: | ||
799 | /* Invalid Base */ | ||
800 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
801 | } | ||
802 | |||
803 | if (!string) { | ||
804 | goto error_exit; | ||
805 | } | ||
806 | |||
807 | /* Skip over any white space in the buffer */ | ||
808 | |||
809 | while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { | ||
810 | string++; | ||
811 | } | ||
812 | |||
813 | if (to_integer_op) { | ||
814 | /* | ||
815 | * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. | ||
816 | * We need to determine if it is decimal or hexadecimal. | ||
817 | */ | ||
818 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | ||
819 | sign_of0x = 1; | ||
820 | base = 16; | ||
821 | |||
822 | /* Skip over the leading '0x' */ | ||
823 | string += 2; | ||
824 | } else { | ||
825 | base = 10; | ||
826 | } | ||
827 | } | ||
828 | |||
829 | /* Any string left? Check that '0x' is not followed by white space. */ | ||
830 | |||
831 | if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { | ||
832 | if (to_integer_op) { | ||
833 | goto error_exit; | ||
834 | } else { | ||
835 | goto all_done; | ||
836 | } | ||
837 | } | ||
838 | |||
839 | /* | ||
840 | * Perform a 32-bit or 64-bit conversion, depending upon the current | ||
841 | * execution mode of the interpreter | ||
842 | */ | ||
843 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; | ||
844 | |||
845 | /* Main loop: convert the string to a 32- or 64-bit integer */ | ||
846 | |||
847 | while (*string) { | ||
848 | if (ACPI_IS_DIGIT(*string)) { | ||
849 | |||
850 | /* Convert ASCII 0-9 to Decimal value */ | ||
851 | |||
852 | this_digit = ((u8)*string) - '0'; | ||
853 | } else if (base == 10) { | ||
854 | |||
855 | /* Digit is out of range; possible in to_integer case only */ | ||
856 | |||
857 | term = 1; | ||
858 | } else { | ||
859 | this_digit = (u8)ACPI_TOUPPER(*string); | ||
860 | if (ACPI_IS_XDIGIT((char)this_digit)) { | ||
861 | |||
862 | /* Convert ASCII Hex char to value */ | ||
863 | |||
864 | this_digit = this_digit - 'A' + 10; | ||
865 | } else { | ||
866 | term = 1; | ||
867 | } | ||
868 | } | ||
869 | |||
870 | if (term) { | ||
871 | if (to_integer_op) { | ||
872 | goto error_exit; | ||
873 | } else { | ||
874 | break; | ||
875 | } | ||
876 | } else if ((valid_digits == 0) && (this_digit == 0) | ||
877 | && !sign_of0x) { | ||
878 | |||
879 | /* Skip zeros */ | ||
880 | string++; | ||
881 | continue; | ||
882 | } | ||
883 | |||
884 | valid_digits++; | ||
885 | |||
886 | if (sign_of0x | ||
887 | && ((valid_digits > 16) | ||
888 | || ((valid_digits > 8) && mode32))) { | ||
889 | /* | ||
890 | * This is to_integer operation case. | ||
891 | * No any restrictions for string-to-integer conversion, | ||
892 | * see ACPI spec. | ||
893 | */ | ||
894 | goto error_exit; | ||
895 | } | ||
896 | |||
897 | /* Divide the digit into the correct position */ | ||
898 | |||
899 | (void)acpi_ut_short_divide((dividend - (u64)this_digit), | ||
900 | base, "ient, NULL); | ||
901 | |||
902 | if (return_value > quotient) { | ||
903 | if (to_integer_op) { | ||
904 | goto error_exit; | ||
905 | } else { | ||
906 | break; | ||
907 | } | ||
908 | } | ||
909 | |||
910 | return_value *= base; | ||
911 | return_value += this_digit; | ||
912 | string++; | ||
913 | } | ||
914 | |||
915 | /* All done, normal exit */ | ||
916 | |||
917 | all_done: | ||
918 | |||
919 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", | ||
920 | ACPI_FORMAT_UINT64(return_value))); | ||
921 | |||
922 | *ret_integer = return_value; | ||
923 | return_ACPI_STATUS(AE_OK); | ||
924 | |||
925 | error_exit: | ||
926 | /* Base was set/validated above */ | ||
927 | |||
928 | if (base == 10) { | ||
929 | return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT); | ||
930 | } else { | ||
931 | return_ACPI_STATUS(AE_BAD_HEX_CONSTANT); | ||
932 | } | ||
933 | } | ||
934 | |||
935 | /******************************************************************************* | 175 | /******************************************************************************* |
936 | * | 176 | * |
937 | * FUNCTION: acpi_ut_create_update_state_and_push | 177 | * FUNCTION: acpi_ut_create_update_state_and_push |
@@ -1097,3 +337,71 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object, | |||
1097 | 337 | ||
1098 | return_ACPI_STATUS(AE_AML_INTERNAL); | 338 | return_ACPI_STATUS(AE_AML_INTERNAL); |
1099 | } | 339 | } |
340 | |||
341 | #ifdef ACPI_DEBUG_OUTPUT | ||
342 | /******************************************************************************* | ||
343 | * | ||
344 | * FUNCTION: acpi_ut_display_init_pathname | ||
345 | * | ||
346 | * PARAMETERS: type - Object type of the node | ||
347 | * obj_handle - Handle whose pathname will be displayed | ||
348 | * path - Additional path string to be appended. | ||
349 | * (NULL if no extra path) | ||
350 | * | ||
351 | * RETURN: acpi_status | ||
352 | * | ||
353 | * DESCRIPTION: Display full pathname of an object, DEBUG ONLY | ||
354 | * | ||
355 | ******************************************************************************/ | ||
356 | |||
357 | void | ||
358 | acpi_ut_display_init_pathname(u8 type, | ||
359 | struct acpi_namespace_node *obj_handle, | ||
360 | char *path) | ||
361 | { | ||
362 | acpi_status status; | ||
363 | struct acpi_buffer buffer; | ||
364 | |||
365 | ACPI_FUNCTION_ENTRY(); | ||
366 | |||
367 | /* Only print the path if the appropriate debug level is enabled */ | ||
368 | |||
369 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | ||
370 | return; | ||
371 | } | ||
372 | |||
373 | /* Get the full pathname to the node */ | ||
374 | |||
375 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
376 | status = acpi_ns_handle_to_pathname(obj_handle, &buffer); | ||
377 | if (ACPI_FAILURE(status)) { | ||
378 | return; | ||
379 | } | ||
380 | |||
381 | /* Print what we're doing */ | ||
382 | |||
383 | switch (type) { | ||
384 | case ACPI_TYPE_METHOD: | ||
385 | acpi_os_printf("Executing "); | ||
386 | break; | ||
387 | |||
388 | default: | ||
389 | acpi_os_printf("Initializing "); | ||
390 | break; | ||
391 | } | ||
392 | |||
393 | /* Print the object type and pathname */ | ||
394 | |||
395 | acpi_os_printf("%-12s %s", | ||
396 | acpi_ut_get_type_name(type), (char *)buffer.pointer); | ||
397 | |||
398 | /* Extra path is used to append names like _STA, _INI, etc. */ | ||
399 | |||
400 | if (path) { | ||
401 | acpi_os_printf(".%s", path); | ||
402 | } | ||
403 | acpi_os_printf("\n"); | ||
404 | |||
405 | ACPI_FREE(buffer.pointer); | ||
406 | } | ||
407 | #endif | ||
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index 5ccf57c0d87e..22feb99b8e35 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 5c52ca78f6fa..1099f5c069f8 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -419,7 +419,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object) | |||
419 | { | 419 | { |
420 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); | 420 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); |
421 | 421 | ||
422 | /* Object must be a union acpi_operand_object */ | 422 | /* Object must be of type union acpi_operand_object */ |
423 | 423 | ||
424 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { | 424 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { |
425 | ACPI_ERROR((AE_INFO, | 425 | ACPI_ERROR((AE_INFO, |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 676285d6116d..36a7d361d7cb 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c new file mode 100644 index 000000000000..835340b26d37 --- /dev/null +++ b/drivers/acpi/acpica/utownerid.c | |||
@@ -0,0 +1,218 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: utownerid - Support for Table/Method Owner IDs | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utownerid") | ||
50 | |||
51 | /******************************************************************************* | ||
52 | * | ||
53 | * FUNCTION: acpi_ut_allocate_owner_id | ||
54 | * | ||
55 | * PARAMETERS: owner_id - Where the new owner ID is returned | ||
56 | * | ||
57 | * RETURN: Status | ||
58 | * | ||
59 | * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to | ||
60 | * track objects created by the table or method, to be deleted | ||
61 | * when the method exits or the table is unloaded. | ||
62 | * | ||
63 | ******************************************************************************/ | ||
64 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | ||
65 | { | ||
66 | u32 i; | ||
67 | u32 j; | ||
68 | u32 k; | ||
69 | acpi_status status; | ||
70 | |||
71 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); | ||
72 | |||
73 | /* Guard against multiple allocations of ID to the same location */ | ||
74 | |||
75 | if (*owner_id) { | ||
76 | ACPI_ERROR((AE_INFO, "Owner ID [0x%2.2X] already exists", | ||
77 | *owner_id)); | ||
78 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | ||
79 | } | ||
80 | |||
81 | /* Mutex for the global ID mask */ | ||
82 | |||
83 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | ||
84 | if (ACPI_FAILURE(status)) { | ||
85 | return_ACPI_STATUS(status); | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * Find a free owner ID, cycle through all possible IDs on repeated | ||
90 | * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have | ||
91 | * to be scanned twice. | ||
92 | */ | ||
93 | for (i = 0, j = acpi_gbl_last_owner_id_index; | ||
94 | i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { | ||
95 | if (j >= ACPI_NUM_OWNERID_MASKS) { | ||
96 | j = 0; /* Wraparound to start of mask array */ | ||
97 | } | ||
98 | |||
99 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { | ||
100 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { | ||
101 | |||
102 | /* There are no free IDs in this mask */ | ||
103 | |||
104 | break; | ||
105 | } | ||
106 | |||
107 | if (!(acpi_gbl_owner_id_mask[j] & (1 << k))) { | ||
108 | /* | ||
109 | * Found a free ID. The actual ID is the bit index plus one, | ||
110 | * making zero an invalid Owner ID. Save this as the last ID | ||
111 | * allocated and update the global ID mask. | ||
112 | */ | ||
113 | acpi_gbl_owner_id_mask[j] |= (1 << k); | ||
114 | |||
115 | acpi_gbl_last_owner_id_index = (u8)j; | ||
116 | acpi_gbl_next_owner_id_offset = (u8)(k + 1); | ||
117 | |||
118 | /* | ||
119 | * Construct encoded ID from the index and bit position | ||
120 | * | ||
121 | * Note: Last [j].k (bit 255) is never used and is marked | ||
122 | * permanently allocated (prevents +1 overflow) | ||
123 | */ | ||
124 | *owner_id = | ||
125 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); | ||
126 | |||
127 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, | ||
128 | "Allocated OwnerId: %2.2X\n", | ||
129 | (unsigned int)*owner_id)); | ||
130 | goto exit; | ||
131 | } | ||
132 | } | ||
133 | |||
134 | acpi_gbl_next_owner_id_offset = 0; | ||
135 | } | ||
136 | |||
137 | /* | ||
138 | * All owner_ids have been allocated. This typically should | ||
139 | * not happen since the IDs are reused after deallocation. The IDs are | ||
140 | * allocated upon table load (one per table) and method execution, and | ||
141 | * they are released when a table is unloaded or a method completes | ||
142 | * execution. | ||
143 | * | ||
144 | * If this error happens, there may be very deep nesting of invoked control | ||
145 | * methods, or there may be a bug where the IDs are not released. | ||
146 | */ | ||
147 | status = AE_OWNER_ID_LIMIT; | ||
148 | ACPI_ERROR((AE_INFO, | ||
149 | "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); | ||
150 | |||
151 | exit: | ||
152 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | ||
153 | return_ACPI_STATUS(status); | ||
154 | } | ||
155 | |||
156 | /******************************************************************************* | ||
157 | * | ||
158 | * FUNCTION: acpi_ut_release_owner_id | ||
159 | * | ||
160 | * PARAMETERS: owner_id_ptr - Pointer to a previously allocated owner_ID | ||
161 | * | ||
162 | * RETURN: None. No error is returned because we are either exiting a | ||
163 | * control method or unloading a table. Either way, we would | ||
164 | * ignore any error anyway. | ||
165 | * | ||
166 | * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255 | ||
167 | * | ||
168 | ******************************************************************************/ | ||
169 | |||
170 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | ||
171 | { | ||
172 | acpi_owner_id owner_id = *owner_id_ptr; | ||
173 | acpi_status status; | ||
174 | u32 index; | ||
175 | u32 bit; | ||
176 | |||
177 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); | ||
178 | |||
179 | /* Always clear the input owner_id (zero is an invalid ID) */ | ||
180 | |||
181 | *owner_id_ptr = 0; | ||
182 | |||
183 | /* Zero is not a valid owner_ID */ | ||
184 | |||
185 | if (owner_id == 0) { | ||
186 | ACPI_ERROR((AE_INFO, "Invalid OwnerId: 0x%2.2X", owner_id)); | ||
187 | return_VOID; | ||
188 | } | ||
189 | |||
190 | /* Mutex for the global ID mask */ | ||
191 | |||
192 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | ||
193 | if (ACPI_FAILURE(status)) { | ||
194 | return_VOID; | ||
195 | } | ||
196 | |||
197 | /* Normalize the ID to zero */ | ||
198 | |||
199 | owner_id--; | ||
200 | |||
201 | /* Decode ID to index/offset pair */ | ||
202 | |||
203 | index = ACPI_DIV_32(owner_id); | ||
204 | bit = 1 << ACPI_MOD_32(owner_id); | ||
205 | |||
206 | /* Free the owner ID only if it is valid */ | ||
207 | |||
208 | if (acpi_gbl_owner_id_mask[index] & bit) { | ||
209 | acpi_gbl_owner_id_mask[index] ^= bit; | ||
210 | } else { | ||
211 | ACPI_ERROR((AE_INFO, | ||
212 | "Release of non-allocated OwnerId: 0x%2.2X", | ||
213 | owner_id + 1)); | ||
214 | } | ||
215 | |||
216 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | ||
217 | return_VOID; | ||
218 | } | ||
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index e38bef4980bc..cb7fa491decf 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -127,7 +127,9 @@ const char *acpi_gbl_rw_decode[] = { | |||
127 | 127 | ||
128 | const char *acpi_gbl_shr_decode[] = { | 128 | const char *acpi_gbl_shr_decode[] = { |
129 | "Exclusive", | 129 | "Exclusive", |
130 | "Shared" | 130 | "Shared", |
131 | "ExclusiveAndWake", /* ACPI 5.0 */ | ||
132 | "SharedAndWake" /* ACPI 5.0 */ | ||
131 | }; | 133 | }; |
132 | 134 | ||
133 | const char *acpi_gbl_siz_decode[] = { | 135 | const char *acpi_gbl_siz_decode[] = { |
@@ -383,26 +385,16 @@ static const u8 acpi_gbl_resource_types[] = { | |||
383 | ACPI_VARIABLE_LENGTH /* 0E *serial_bus */ | 385 | ACPI_VARIABLE_LENGTH /* 0E *serial_bus */ |
384 | }; | 386 | }; |
385 | 387 | ||
386 | /* | ||
387 | * For the iASL compiler/disassembler, we don't want any error messages | ||
388 | * because the disassembler uses the resource validation code to determine | ||
389 | * if Buffer objects are actually Resource Templates. | ||
390 | */ | ||
391 | #ifdef ACPI_ASL_COMPILER | ||
392 | #define ACPI_RESOURCE_ERROR(plist) | ||
393 | #else | ||
394 | #define ACPI_RESOURCE_ERROR(plist) ACPI_ERROR(plist) | ||
395 | #endif | ||
396 | |||
397 | /******************************************************************************* | 388 | /******************************************************************************* |
398 | * | 389 | * |
399 | * FUNCTION: acpi_ut_walk_aml_resources | 390 | * FUNCTION: acpi_ut_walk_aml_resources |
400 | * | 391 | * |
401 | * PARAMETERS: aml - Pointer to the raw AML resource template | 392 | * PARAMETERS: walk_state - Current walk info |
402 | * aml_length - Length of the entire template | 393 | * PARAMETERS: aml - Pointer to the raw AML resource template |
403 | * user_function - Called once for each descriptor found. If | 394 | * aml_length - Length of the entire template |
404 | * NULL, a pointer to the end_tag is returned | 395 | * user_function - Called once for each descriptor found. If |
405 | * context - Passed to user_function | 396 | * NULL, a pointer to the end_tag is returned |
397 | * context - Passed to user_function | ||
406 | * | 398 | * |
407 | * RETURN: Status | 399 | * RETURN: Status |
408 | * | 400 | * |
@@ -412,7 +404,8 @@ static const u8 acpi_gbl_resource_types[] = { | |||
412 | ******************************************************************************/ | 404 | ******************************************************************************/ |
413 | 405 | ||
414 | acpi_status | 406 | acpi_status |
415 | acpi_ut_walk_aml_resources(u8 * aml, | 407 | acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, |
408 | u8 *aml, | ||
416 | acpi_size aml_length, | 409 | acpi_size aml_length, |
417 | acpi_walk_aml_callback user_function, void **context) | 410 | acpi_walk_aml_callback user_function, void **context) |
418 | { | 411 | { |
@@ -441,7 +434,8 @@ acpi_ut_walk_aml_resources(u8 * aml, | |||
441 | 434 | ||
442 | /* Validate the Resource Type and Resource Length */ | 435 | /* Validate the Resource Type and Resource Length */ |
443 | 436 | ||
444 | status = acpi_ut_validate_resource(aml, &resource_index); | 437 | status = |
438 | acpi_ut_validate_resource(walk_state, aml, &resource_index); | ||
445 | if (ACPI_FAILURE(status)) { | 439 | if (ACPI_FAILURE(status)) { |
446 | /* | 440 | /* |
447 | * Exit on failure. Cannot continue because the descriptor length | 441 | * Exit on failure. Cannot continue because the descriptor length |
@@ -498,7 +492,8 @@ acpi_ut_walk_aml_resources(u8 * aml, | |||
498 | 492 | ||
499 | /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */ | 493 | /* Insert an end_tag anyway. acpi_rs_get_list_length always leaves room */ |
500 | 494 | ||
501 | (void)acpi_ut_validate_resource(end_tag, &resource_index); | 495 | (void)acpi_ut_validate_resource(walk_state, end_tag, |
496 | &resource_index); | ||
502 | status = | 497 | status = |
503 | user_function(end_tag, 2, offset, resource_index, context); | 498 | user_function(end_tag, 2, offset, resource_index, context); |
504 | if (ACPI_FAILURE(status)) { | 499 | if (ACPI_FAILURE(status)) { |
@@ -513,9 +508,10 @@ acpi_ut_walk_aml_resources(u8 * aml, | |||
513 | * | 508 | * |
514 | * FUNCTION: acpi_ut_validate_resource | 509 | * FUNCTION: acpi_ut_validate_resource |
515 | * | 510 | * |
516 | * PARAMETERS: aml - Pointer to the raw AML resource descriptor | 511 | * PARAMETERS: walk_state - Current walk info |
517 | * return_index - Where the resource index is returned. NULL | 512 | * aml - Pointer to the raw AML resource descriptor |
518 | * if the index is not required. | 513 | * return_index - Where the resource index is returned. NULL |
514 | * if the index is not required. | ||
519 | * | 515 | * |
520 | * RETURN: Status, and optionally the Index into the global resource tables | 516 | * RETURN: Status, and optionally the Index into the global resource tables |
521 | * | 517 | * |
@@ -525,7 +521,9 @@ acpi_ut_walk_aml_resources(u8 * aml, | |||
525 | * | 521 | * |
526 | ******************************************************************************/ | 522 | ******************************************************************************/ |
527 | 523 | ||
528 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) | 524 | acpi_status |
525 | acpi_ut_validate_resource(struct acpi_walk_state *walk_state, | ||
526 | void *aml, u8 *return_index) | ||
529 | { | 527 | { |
530 | union aml_resource *aml_resource; | 528 | union aml_resource *aml_resource; |
531 | u8 resource_type; | 529 | u8 resource_type; |
@@ -627,10 +625,12 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) | |||
627 | if ((aml_resource->common_serial_bus.type == 0) || | 625 | if ((aml_resource->common_serial_bus.type == 0) || |
628 | (aml_resource->common_serial_bus.type > | 626 | (aml_resource->common_serial_bus.type > |
629 | AML_RESOURCE_MAX_SERIALBUSTYPE)) { | 627 | AML_RESOURCE_MAX_SERIALBUSTYPE)) { |
630 | ACPI_RESOURCE_ERROR((AE_INFO, | 628 | if (walk_state) { |
631 | "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", | 629 | ACPI_ERROR((AE_INFO, |
632 | aml_resource->common_serial_bus. | 630 | "Invalid/unsupported SerialBus resource descriptor: BusType 0x%2.2X", |
633 | type)); | 631 | aml_resource->common_serial_bus. |
632 | type)); | ||
633 | } | ||
634 | return (AE_AML_INVALID_RESOURCE_TYPE); | 634 | return (AE_AML_INVALID_RESOURCE_TYPE); |
635 | } | 635 | } |
636 | } | 636 | } |
@@ -645,18 +645,22 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) | |||
645 | 645 | ||
646 | invalid_resource: | 646 | invalid_resource: |
647 | 647 | ||
648 | ACPI_RESOURCE_ERROR((AE_INFO, | 648 | if (walk_state) { |
649 | "Invalid/unsupported resource descriptor: Type 0x%2.2X", | 649 | ACPI_ERROR((AE_INFO, |
650 | resource_type)); | 650 | "Invalid/unsupported resource descriptor: Type 0x%2.2X", |
651 | resource_type)); | ||
652 | } | ||
651 | return (AE_AML_INVALID_RESOURCE_TYPE); | 653 | return (AE_AML_INVALID_RESOURCE_TYPE); |
652 | 654 | ||
653 | bad_resource_length: | 655 | bad_resource_length: |
654 | 656 | ||
655 | ACPI_RESOURCE_ERROR((AE_INFO, | 657 | if (walk_state) { |
656 | "Invalid resource descriptor length: Type " | 658 | ACPI_ERROR((AE_INFO, |
657 | "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", | 659 | "Invalid resource descriptor length: Type " |
658 | resource_type, resource_length, | 660 | "0x%2.2X, Length 0x%4.4X, MinLength 0x%4.4X", |
659 | minimum_resource_length)); | 661 | resource_type, resource_length, |
662 | minimum_resource_length)); | ||
663 | } | ||
660 | return (AE_AML_BAD_RESOURCE_LENGTH); | 664 | return (AE_AML_BAD_RESOURCE_LENGTH); |
661 | } | 665 | } |
662 | 666 | ||
@@ -800,8 +804,7 @@ u32 acpi_ut_get_descriptor_length(void *aml) | |||
800 | ******************************************************************************/ | 804 | ******************************************************************************/ |
801 | 805 | ||
802 | acpi_status | 806 | acpi_status |
803 | acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, | 807 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag) |
804 | u8 ** end_tag) | ||
805 | { | 808 | { |
806 | acpi_status status; | 809 | acpi_status status; |
807 | 810 | ||
@@ -816,7 +819,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, | |||
816 | 819 | ||
817 | /* Validate the template and get a pointer to the end_tag */ | 820 | /* Validate the template and get a pointer to the end_tag */ |
818 | 821 | ||
819 | status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, | 822 | status = acpi_ut_walk_aml_resources(NULL, obj_desc->buffer.pointer, |
820 | obj_desc->buffer.length, NULL, | 823 | obj_desc->buffer.length, NULL, |
821 | (void **)end_tag); | 824 | (void **)end_tag); |
822 | 825 | ||
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c index cee0473ba813..a6b729d4c1dc 100644 --- a/drivers/acpi/acpica/utstate.c +++ b/drivers/acpi/acpica/utstate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -97,14 +97,13 @@ void | |||
97 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, | 97 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, |
98 | union acpi_generic_state *state) | 98 | union acpi_generic_state *state) |
99 | { | 99 | { |
100 | ACPI_FUNCTION_TRACE(ut_push_generic_state); | 100 | ACPI_FUNCTION_ENTRY(); |
101 | 101 | ||
102 | /* Push the state object onto the front of the list (stack) */ | 102 | /* Push the state object onto the front of the list (stack) */ |
103 | 103 | ||
104 | state->common.next = *list_head; | 104 | state->common.next = *list_head; |
105 | *list_head = state; | 105 | *list_head = state; |
106 | 106 | return; | |
107 | return_VOID; | ||
108 | } | 107 | } |
109 | 108 | ||
110 | /******************************************************************************* | 109 | /******************************************************************************* |
@@ -124,7 +123,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state | |||
124 | { | 123 | { |
125 | union acpi_generic_state *state; | 124 | union acpi_generic_state *state; |
126 | 125 | ||
127 | ACPI_FUNCTION_TRACE(ut_pop_generic_state); | 126 | ACPI_FUNCTION_ENTRY(); |
128 | 127 | ||
129 | /* Remove the state object at the head of the list (stack) */ | 128 | /* Remove the state object at the head of the list (stack) */ |
130 | 129 | ||
@@ -136,7 +135,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state | |||
136 | *list_head = state->common.next; | 135 | *list_head = state->common.next; |
137 | } | 136 | } |
138 | 137 | ||
139 | return_PTR(state); | 138 | return (state); |
140 | } | 139 | } |
141 | 140 | ||
142 | /******************************************************************************* | 141 | /******************************************************************************* |
@@ -186,13 +185,13 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
186 | { | 185 | { |
187 | union acpi_generic_state *state; | 186 | union acpi_generic_state *state; |
188 | 187 | ||
189 | ACPI_FUNCTION_TRACE(ut_create_thread_state); | 188 | ACPI_FUNCTION_ENTRY(); |
190 | 189 | ||
191 | /* Create the generic state object */ | 190 | /* Create the generic state object */ |
192 | 191 | ||
193 | state = acpi_ut_create_generic_state(); | 192 | state = acpi_ut_create_generic_state(); |
194 | if (!state) { | 193 | if (!state) { |
195 | return_PTR(NULL); | 194 | return (NULL); |
196 | } | 195 | } |
197 | 196 | ||
198 | /* Init fields specific to the update struct */ | 197 | /* Init fields specific to the update struct */ |
@@ -207,7 +206,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
207 | state->thread.thread_id = (acpi_thread_id) 1; | 206 | state->thread.thread_id = (acpi_thread_id) 1; |
208 | } | 207 | } |
209 | 208 | ||
210 | return_PTR((struct acpi_thread_state *)state); | 209 | return ((struct acpi_thread_state *)state); |
211 | } | 210 | } |
212 | 211 | ||
213 | /******************************************************************************* | 212 | /******************************************************************************* |
@@ -230,13 +229,13 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
230 | { | 229 | { |
231 | union acpi_generic_state *state; | 230 | union acpi_generic_state *state; |
232 | 231 | ||
233 | ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object); | 232 | ACPI_FUNCTION_ENTRY(); |
234 | 233 | ||
235 | /* Create the generic state object */ | 234 | /* Create the generic state object */ |
236 | 235 | ||
237 | state = acpi_ut_create_generic_state(); | 236 | state = acpi_ut_create_generic_state(); |
238 | if (!state) { | 237 | if (!state) { |
239 | return_PTR(NULL); | 238 | return (NULL); |
240 | } | 239 | } |
241 | 240 | ||
242 | /* Init fields specific to the update struct */ | 241 | /* Init fields specific to the update struct */ |
@@ -244,8 +243,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
244 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; | 243 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; |
245 | state->update.object = object; | 244 | state->update.object = object; |
246 | state->update.value = action; | 245 | state->update.value = action; |
247 | 246 | return (state); | |
248 | return_PTR(state); | ||
249 | } | 247 | } |
250 | 248 | ||
251 | /******************************************************************************* | 249 | /******************************************************************************* |
@@ -267,13 +265,13 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
267 | { | 265 | { |
268 | union acpi_generic_state *state; | 266 | union acpi_generic_state *state; |
269 | 267 | ||
270 | ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object); | 268 | ACPI_FUNCTION_ENTRY(); |
271 | 269 | ||
272 | /* Create the generic state object */ | 270 | /* Create the generic state object */ |
273 | 271 | ||
274 | state = acpi_ut_create_generic_state(); | 272 | state = acpi_ut_create_generic_state(); |
275 | if (!state) { | 273 | if (!state) { |
276 | return_PTR(NULL); | 274 | return (NULL); |
277 | } | 275 | } |
278 | 276 | ||
279 | /* Init fields specific to the update struct */ | 277 | /* Init fields specific to the update struct */ |
@@ -283,8 +281,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
283 | state->pkg.dest_object = external_object; | 281 | state->pkg.dest_object = external_object; |
284 | state->pkg.index = index; | 282 | state->pkg.index = index; |
285 | state->pkg.num_packages = 1; | 283 | state->pkg.num_packages = 1; |
286 | 284 | return (state); | |
287 | return_PTR(state); | ||
288 | } | 285 | } |
289 | 286 | ||
290 | /******************************************************************************* | 287 | /******************************************************************************* |
@@ -304,21 +301,20 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
304 | { | 301 | { |
305 | union acpi_generic_state *state; | 302 | union acpi_generic_state *state; |
306 | 303 | ||
307 | ACPI_FUNCTION_TRACE(ut_create_control_state); | 304 | ACPI_FUNCTION_ENTRY(); |
308 | 305 | ||
309 | /* Create the generic state object */ | 306 | /* Create the generic state object */ |
310 | 307 | ||
311 | state = acpi_ut_create_generic_state(); | 308 | state = acpi_ut_create_generic_state(); |
312 | if (!state) { | 309 | if (!state) { |
313 | return_PTR(NULL); | 310 | return (NULL); |
314 | } | 311 | } |
315 | 312 | ||
316 | /* Init fields specific to the control struct */ | 313 | /* Init fields specific to the control struct */ |
317 | 314 | ||
318 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; | 315 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; |
319 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; | 316 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
320 | 317 | return (state); | |
321 | return_PTR(state); | ||
322 | } | 318 | } |
323 | 319 | ||
324 | /******************************************************************************* | 320 | /******************************************************************************* |
@@ -336,12 +332,12 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
336 | 332 | ||
337 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) | 333 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) |
338 | { | 334 | { |
339 | ACPI_FUNCTION_TRACE(ut_delete_generic_state); | 335 | ACPI_FUNCTION_ENTRY(); |
340 | 336 | ||
341 | /* Ignore null state */ | 337 | /* Ignore null state */ |
342 | 338 | ||
343 | if (state) { | 339 | if (state) { |
344 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | 340 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); |
345 | } | 341 | } |
346 | return_VOID; | 342 | return; |
347 | } | 343 | } |
diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c new file mode 100644 index 000000000000..b3e36a81aa4d --- /dev/null +++ b/drivers/acpi/acpica/utstring.c | |||
@@ -0,0 +1,574 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: utstring - Common functions for strings and characters | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utstring") | ||
50 | |||
51 | /* | ||
52 | * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit | ||
53 | * version of strtoul. | ||
54 | */ | ||
55 | #ifdef ACPI_ASL_COMPILER | ||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * FUNCTION: acpi_ut_strlwr (strlwr) | ||
59 | * | ||
60 | * PARAMETERS: src_string - The source string to convert | ||
61 | * | ||
62 | * RETURN: None | ||
63 | * | ||
64 | * DESCRIPTION: Convert string to lowercase | ||
65 | * | ||
66 | * NOTE: This is not a POSIX function, so it appears here, not in utclib.c | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | void acpi_ut_strlwr(char *src_string) | ||
70 | { | ||
71 | char *string; | ||
72 | |||
73 | ACPI_FUNCTION_ENTRY(); | ||
74 | |||
75 | if (!src_string) { | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | /* Walk entire string, lowercasing the letters */ | ||
80 | |||
81 | for (string = src_string; *string; string++) { | ||
82 | *string = (char)ACPI_TOLOWER(*string); | ||
83 | } | ||
84 | |||
85 | return; | ||
86 | } | ||
87 | |||
88 | /****************************************************************************** | ||
89 | * | ||
90 | * FUNCTION: acpi_ut_stricmp (stricmp) | ||
91 | * | ||
92 | * PARAMETERS: string1 - first string to compare | ||
93 | * string2 - second string to compare | ||
94 | * | ||
95 | * RETURN: int that signifies string relationship. Zero means strings | ||
96 | * are equal. | ||
97 | * | ||
98 | * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare | ||
99 | * strings with no case sensitivity) | ||
100 | * | ||
101 | ******************************************************************************/ | ||
102 | |||
103 | int acpi_ut_stricmp(char *string1, char *string2) | ||
104 | { | ||
105 | int c1; | ||
106 | int c2; | ||
107 | |||
108 | do { | ||
109 | c1 = tolower((int)*string1); | ||
110 | c2 = tolower((int)*string2); | ||
111 | |||
112 | string1++; | ||
113 | string2++; | ||
114 | } | ||
115 | while ((c1 == c2) && (c1)); | ||
116 | |||
117 | return (c1 - c2); | ||
118 | } | ||
119 | #endif | ||
120 | |||
121 | /******************************************************************************* | ||
122 | * | ||
123 | * FUNCTION: acpi_ut_strupr (strupr) | ||
124 | * | ||
125 | * PARAMETERS: src_string - The source string to convert | ||
126 | * | ||
127 | * RETURN: None | ||
128 | * | ||
129 | * DESCRIPTION: Convert string to uppercase | ||
130 | * | ||
131 | * NOTE: This is not a POSIX function, so it appears here, not in utclib.c | ||
132 | * | ||
133 | ******************************************************************************/ | ||
134 | |||
135 | void acpi_ut_strupr(char *src_string) | ||
136 | { | ||
137 | char *string; | ||
138 | |||
139 | ACPI_FUNCTION_ENTRY(); | ||
140 | |||
141 | if (!src_string) { | ||
142 | return; | ||
143 | } | ||
144 | |||
145 | /* Walk entire string, uppercasing the letters */ | ||
146 | |||
147 | for (string = src_string; *string; string++) { | ||
148 | *string = (char)ACPI_TOUPPER(*string); | ||
149 | } | ||
150 | |||
151 | return; | ||
152 | } | ||
153 | |||
154 | /******************************************************************************* | ||
155 | * | ||
156 | * FUNCTION: acpi_ut_strtoul64 | ||
157 | * | ||
158 | * PARAMETERS: string - Null terminated string | ||
159 | * base - Radix of the string: 16 or ACPI_ANY_BASE; | ||
160 | * ACPI_ANY_BASE means 'in behalf of to_integer' | ||
161 | * ret_integer - Where the converted integer is returned | ||
162 | * | ||
163 | * RETURN: Status and Converted value | ||
164 | * | ||
165 | * DESCRIPTION: Convert a string into an unsigned value. Performs either a | ||
166 | * 32-bit or 64-bit conversion, depending on the current mode | ||
167 | * of the interpreter. | ||
168 | * NOTE: Does not support Octal strings, not needed. | ||
169 | * | ||
170 | ******************************************************************************/ | ||
171 | |||
172 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer) | ||
173 | { | ||
174 | u32 this_digit = 0; | ||
175 | u64 return_value = 0; | ||
176 | u64 quotient; | ||
177 | u64 dividend; | ||
178 | u32 to_integer_op = (base == ACPI_ANY_BASE); | ||
179 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); | ||
180 | u8 valid_digits = 0; | ||
181 | u8 sign_of0x = 0; | ||
182 | u8 term = 0; | ||
183 | |||
184 | ACPI_FUNCTION_TRACE_STR(ut_stroul64, string); | ||
185 | |||
186 | switch (base) { | ||
187 | case ACPI_ANY_BASE: | ||
188 | case 16: | ||
189 | break; | ||
190 | |||
191 | default: | ||
192 | /* Invalid Base */ | ||
193 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
194 | } | ||
195 | |||
196 | if (!string) { | ||
197 | goto error_exit; | ||
198 | } | ||
199 | |||
200 | /* Skip over any white space in the buffer */ | ||
201 | |||
202 | while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { | ||
203 | string++; | ||
204 | } | ||
205 | |||
206 | if (to_integer_op) { | ||
207 | /* | ||
208 | * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. | ||
209 | * We need to determine if it is decimal or hexadecimal. | ||
210 | */ | ||
211 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | ||
212 | sign_of0x = 1; | ||
213 | base = 16; | ||
214 | |||
215 | /* Skip over the leading '0x' */ | ||
216 | string += 2; | ||
217 | } else { | ||
218 | base = 10; | ||
219 | } | ||
220 | } | ||
221 | |||
222 | /* Any string left? Check that '0x' is not followed by white space. */ | ||
223 | |||
224 | if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { | ||
225 | if (to_integer_op) { | ||
226 | goto error_exit; | ||
227 | } else { | ||
228 | goto all_done; | ||
229 | } | ||
230 | } | ||
231 | |||
232 | /* | ||
233 | * Perform a 32-bit or 64-bit conversion, depending upon the current | ||
234 | * execution mode of the interpreter | ||
235 | */ | ||
236 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; | ||
237 | |||
238 | /* Main loop: convert the string to a 32- or 64-bit integer */ | ||
239 | |||
240 | while (*string) { | ||
241 | if (ACPI_IS_DIGIT(*string)) { | ||
242 | |||
243 | /* Convert ASCII 0-9 to Decimal value */ | ||
244 | |||
245 | this_digit = ((u8)*string) - '0'; | ||
246 | } else if (base == 10) { | ||
247 | |||
248 | /* Digit is out of range; possible in to_integer case only */ | ||
249 | |||
250 | term = 1; | ||
251 | } else { | ||
252 | this_digit = (u8)ACPI_TOUPPER(*string); | ||
253 | if (ACPI_IS_XDIGIT((char)this_digit)) { | ||
254 | |||
255 | /* Convert ASCII Hex char to value */ | ||
256 | |||
257 | this_digit = this_digit - 'A' + 10; | ||
258 | } else { | ||
259 | term = 1; | ||
260 | } | ||
261 | } | ||
262 | |||
263 | if (term) { | ||
264 | if (to_integer_op) { | ||
265 | goto error_exit; | ||
266 | } else { | ||
267 | break; | ||
268 | } | ||
269 | } else if ((valid_digits == 0) && (this_digit == 0) | ||
270 | && !sign_of0x) { | ||
271 | |||
272 | /* Skip zeros */ | ||
273 | string++; | ||
274 | continue; | ||
275 | } | ||
276 | |||
277 | valid_digits++; | ||
278 | |||
279 | if (sign_of0x | ||
280 | && ((valid_digits > 16) | ||
281 | || ((valid_digits > 8) && mode32))) { | ||
282 | /* | ||
283 | * This is to_integer operation case. | ||
284 | * No any restrictions for string-to-integer conversion, | ||
285 | * see ACPI spec. | ||
286 | */ | ||
287 | goto error_exit; | ||
288 | } | ||
289 | |||
290 | /* Divide the digit into the correct position */ | ||
291 | |||
292 | (void)acpi_ut_short_divide((dividend - (u64)this_digit), | ||
293 | base, "ient, NULL); | ||
294 | |||
295 | if (return_value > quotient) { | ||
296 | if (to_integer_op) { | ||
297 | goto error_exit; | ||
298 | } else { | ||
299 | break; | ||
300 | } | ||
301 | } | ||
302 | |||
303 | return_value *= base; | ||
304 | return_value += this_digit; | ||
305 | string++; | ||
306 | } | ||
307 | |||
308 | /* All done, normal exit */ | ||
309 | |||
310 | all_done: | ||
311 | |||
312 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", | ||
313 | ACPI_FORMAT_UINT64(return_value))); | ||
314 | |||
315 | *ret_integer = return_value; | ||
316 | return_ACPI_STATUS(AE_OK); | ||
317 | |||
318 | error_exit: | ||
319 | /* Base was set/validated above */ | ||
320 | |||
321 | if (base == 10) { | ||
322 | return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT); | ||
323 | } else { | ||
324 | return_ACPI_STATUS(AE_BAD_HEX_CONSTANT); | ||
325 | } | ||
326 | } | ||
327 | |||
328 | /******************************************************************************* | ||
329 | * | ||
330 | * FUNCTION: acpi_ut_print_string | ||
331 | * | ||
332 | * PARAMETERS: string - Null terminated ASCII string | ||
333 | * max_length - Maximum output length | ||
334 | * | ||
335 | * RETURN: None | ||
336 | * | ||
337 | * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape | ||
338 | * sequences. | ||
339 | * | ||
340 | ******************************************************************************/ | ||
341 | |||
342 | void acpi_ut_print_string(char *string, u8 max_length) | ||
343 | { | ||
344 | u32 i; | ||
345 | |||
346 | if (!string) { | ||
347 | acpi_os_printf("<\"NULL STRING PTR\">"); | ||
348 | return; | ||
349 | } | ||
350 | |||
351 | acpi_os_printf("\""); | ||
352 | for (i = 0; string[i] && (i < max_length); i++) { | ||
353 | |||
354 | /* Escape sequences */ | ||
355 | |||
356 | switch (string[i]) { | ||
357 | case 0x07: | ||
358 | acpi_os_printf("\\a"); /* BELL */ | ||
359 | break; | ||
360 | |||
361 | case 0x08: | ||
362 | acpi_os_printf("\\b"); /* BACKSPACE */ | ||
363 | break; | ||
364 | |||
365 | case 0x0C: | ||
366 | acpi_os_printf("\\f"); /* FORMFEED */ | ||
367 | break; | ||
368 | |||
369 | case 0x0A: | ||
370 | acpi_os_printf("\\n"); /* LINEFEED */ | ||
371 | break; | ||
372 | |||
373 | case 0x0D: | ||
374 | acpi_os_printf("\\r"); /* CARRIAGE RETURN */ | ||
375 | break; | ||
376 | |||
377 | case 0x09: | ||
378 | acpi_os_printf("\\t"); /* HORIZONTAL TAB */ | ||
379 | break; | ||
380 | |||
381 | case 0x0B: | ||
382 | acpi_os_printf("\\v"); /* VERTICAL TAB */ | ||
383 | break; | ||
384 | |||
385 | case '\'': /* Single Quote */ | ||
386 | case '\"': /* Double Quote */ | ||
387 | case '\\': /* Backslash */ | ||
388 | acpi_os_printf("\\%c", (int)string[i]); | ||
389 | break; | ||
390 | |||
391 | default: | ||
392 | |||
393 | /* Check for printable character or hex escape */ | ||
394 | |||
395 | if (ACPI_IS_PRINT(string[i])) { | ||
396 | /* This is a normal character */ | ||
397 | |||
398 | acpi_os_printf("%c", (int)string[i]); | ||
399 | } else { | ||
400 | /* All others will be Hex escapes */ | ||
401 | |||
402 | acpi_os_printf("\\x%2.2X", (s32) string[i]); | ||
403 | } | ||
404 | break; | ||
405 | } | ||
406 | } | ||
407 | acpi_os_printf("\""); | ||
408 | |||
409 | if (i == max_length && string[i]) { | ||
410 | acpi_os_printf("..."); | ||
411 | } | ||
412 | } | ||
413 | |||
414 | /******************************************************************************* | ||
415 | * | ||
416 | * FUNCTION: acpi_ut_valid_acpi_char | ||
417 | * | ||
418 | * PARAMETERS: char - The character to be examined | ||
419 | * position - Byte position (0-3) | ||
420 | * | ||
421 | * RETURN: TRUE if the character is valid, FALSE otherwise | ||
422 | * | ||
423 | * DESCRIPTION: Check for a valid ACPI character. Must be one of: | ||
424 | * 1) Upper case alpha | ||
425 | * 2) numeric | ||
426 | * 3) underscore | ||
427 | * | ||
428 | * We allow a '!' as the last character because of the ASF! table | ||
429 | * | ||
430 | ******************************************************************************/ | ||
431 | |||
432 | u8 acpi_ut_valid_acpi_char(char character, u32 position) | ||
433 | { | ||
434 | |||
435 | if (!((character >= 'A' && character <= 'Z') || | ||
436 | (character >= '0' && character <= '9') || (character == '_'))) { | ||
437 | |||
438 | /* Allow a '!' in the last position */ | ||
439 | |||
440 | if (character == '!' && position == 3) { | ||
441 | return (TRUE); | ||
442 | } | ||
443 | |||
444 | return (FALSE); | ||
445 | } | ||
446 | |||
447 | return (TRUE); | ||
448 | } | ||
449 | |||
450 | /******************************************************************************* | ||
451 | * | ||
452 | * FUNCTION: acpi_ut_valid_acpi_name | ||
453 | * | ||
454 | * PARAMETERS: name - The name to be examined | ||
455 | * | ||
456 | * RETURN: TRUE if the name is valid, FALSE otherwise | ||
457 | * | ||
458 | * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: | ||
459 | * 1) Upper case alpha | ||
460 | * 2) numeric | ||
461 | * 3) underscore | ||
462 | * | ||
463 | ******************************************************************************/ | ||
464 | |||
465 | u8 acpi_ut_valid_acpi_name(u32 name) | ||
466 | { | ||
467 | u32 i; | ||
468 | |||
469 | ACPI_FUNCTION_ENTRY(); | ||
470 | |||
471 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | ||
472 | if (!acpi_ut_valid_acpi_char | ||
473 | ((ACPI_CAST_PTR(char, &name))[i], i)) { | ||
474 | return (FALSE); | ||
475 | } | ||
476 | } | ||
477 | |||
478 | return (TRUE); | ||
479 | } | ||
480 | |||
481 | /******************************************************************************* | ||
482 | * | ||
483 | * FUNCTION: acpi_ut_repair_name | ||
484 | * | ||
485 | * PARAMETERS: name - The ACPI name to be repaired | ||
486 | * | ||
487 | * RETURN: Repaired version of the name | ||
488 | * | ||
489 | * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and | ||
490 | * return the new name. NOTE: the Name parameter must reside in | ||
491 | * read/write memory, cannot be a const. | ||
492 | * | ||
493 | * An ACPI Name must consist of valid ACPI characters. We will repair the name | ||
494 | * if necessary because we don't want to abort because of this, but we want | ||
495 | * all namespace names to be printable. A warning message is appropriate. | ||
496 | * | ||
497 | * This issue came up because there are in fact machines that exhibit | ||
498 | * this problem, and we want to be able to enable ACPI support for them, | ||
499 | * even though there are a few bad names. | ||
500 | * | ||
501 | ******************************************************************************/ | ||
502 | |||
503 | void acpi_ut_repair_name(char *name) | ||
504 | { | ||
505 | u32 i; | ||
506 | u8 found_bad_char = FALSE; | ||
507 | u32 original_name; | ||
508 | |||
509 | ACPI_FUNCTION_NAME(ut_repair_name); | ||
510 | |||
511 | ACPI_MOVE_NAME(&original_name, name); | ||
512 | |||
513 | /* Check each character in the name */ | ||
514 | |||
515 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | ||
516 | if (acpi_ut_valid_acpi_char(name[i], i)) { | ||
517 | continue; | ||
518 | } | ||
519 | |||
520 | /* | ||
521 | * Replace a bad character with something printable, yet technically | ||
522 | * still invalid. This prevents any collisions with existing "good" | ||
523 | * names in the namespace. | ||
524 | */ | ||
525 | name[i] = '*'; | ||
526 | found_bad_char = TRUE; | ||
527 | } | ||
528 | |||
529 | if (found_bad_char) { | ||
530 | |||
531 | /* Report warning only if in strict mode or debug mode */ | ||
532 | |||
533 | if (!acpi_gbl_enable_interpreter_slack) { | ||
534 | ACPI_WARNING((AE_INFO, | ||
535 | "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]", | ||
536 | original_name, name)); | ||
537 | } else { | ||
538 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
539 | "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]", | ||
540 | original_name, name)); | ||
541 | } | ||
542 | } | ||
543 | } | ||
544 | |||
545 | #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP | ||
546 | /******************************************************************************* | ||
547 | * | ||
548 | * FUNCTION: ut_convert_backslashes | ||
549 | * | ||
550 | * PARAMETERS: pathname - File pathname string to be converted | ||
551 | * | ||
552 | * RETURN: Modifies the input Pathname | ||
553 | * | ||
554 | * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within | ||
555 | * the entire input file pathname string. | ||
556 | * | ||
557 | ******************************************************************************/ | ||
558 | |||
559 | void ut_convert_backslashes(char *pathname) | ||
560 | { | ||
561 | |||
562 | if (!pathname) { | ||
563 | return; | ||
564 | } | ||
565 | |||
566 | while (*pathname) { | ||
567 | if (*pathname == '\\') { | ||
568 | *pathname = '/'; | ||
569 | } | ||
570 | |||
571 | pathname++; | ||
572 | } | ||
573 | } | ||
574 | #endif | ||
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c index a424a9e3fea4..62774c7b76a8 100644 --- a/drivers/acpi/acpica/uttrack.c +++ b/drivers/acpi/acpica/uttrack.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -436,10 +436,10 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | |||
436 | struct acpi_memory_list *mem_list; | 436 | struct acpi_memory_list *mem_list; |
437 | acpi_status status; | 437 | acpi_status status; |
438 | 438 | ||
439 | ACPI_FUNCTION_TRACE(ut_remove_allocation); | 439 | ACPI_FUNCTION_NAME(ut_remove_allocation); |
440 | 440 | ||
441 | if (acpi_gbl_disable_mem_tracking) { | 441 | if (acpi_gbl_disable_mem_tracking) { |
442 | return_ACPI_STATUS(AE_OK); | 442 | return (AE_OK); |
443 | } | 443 | } |
444 | 444 | ||
445 | mem_list = acpi_gbl_global_list; | 445 | mem_list = acpi_gbl_global_list; |
@@ -450,12 +450,12 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | |||
450 | ACPI_ERROR((module, line, | 450 | ACPI_ERROR((module, line, |
451 | "Empty allocation list, nothing to free!")); | 451 | "Empty allocation list, nothing to free!")); |
452 | 452 | ||
453 | return_ACPI_STATUS(AE_OK); | 453 | return (AE_OK); |
454 | } | 454 | } |
455 | 455 | ||
456 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | 456 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); |
457 | if (ACPI_FAILURE(status)) { | 457 | if (ACPI_FAILURE(status)) { |
458 | return_ACPI_STATUS(status); | 458 | return (status); |
459 | } | 459 | } |
460 | 460 | ||
461 | /* Unlink */ | 461 | /* Unlink */ |
@@ -470,15 +470,15 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | |||
470 | (allocation->next)->previous = allocation->previous; | 470 | (allocation->next)->previous = allocation->previous; |
471 | } | 471 | } |
472 | 472 | ||
473 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing %p, size 0%X\n", | ||
474 | &allocation->user_space, allocation->size)); | ||
475 | |||
473 | /* Mark the segment as deleted */ | 476 | /* Mark the segment as deleted */ |
474 | 477 | ||
475 | ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); | 478 | ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); |
476 | 479 | ||
477 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", | ||
478 | allocation->size)); | ||
479 | |||
480 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | 480 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); |
481 | return_ACPI_STATUS(status); | 481 | return (status); |
482 | } | 482 | } |
483 | 483 | ||
484 | /******************************************************************************* | 484 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 390db0ca5e2e..48efb446258c 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -44,11 +44,7 @@ | |||
44 | #include <linux/export.h> | 44 | #include <linux/export.h> |
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | 46 | #include "accommon.h" |
47 | #include "acevents.h" | ||
48 | #include "acnamesp.h" | ||
49 | #include "acdebug.h" | 47 | #include "acdebug.h" |
50 | #include "actables.h" | ||
51 | #include "acinterp.h" | ||
52 | 48 | ||
53 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
54 | ACPI_MODULE_NAME("utxface") | 50 | ACPI_MODULE_NAME("utxface") |
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index d4d3826140d8..976b6c734fce 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -297,9 +297,9 @@ ACPI_EXPORT_SYMBOL(acpi_bios_warning) | |||
297 | * | 297 | * |
298 | * PARAMETERS: module_name - Caller's module name (for error output) | 298 | * PARAMETERS: module_name - Caller's module name (for error output) |
299 | * line_number - Caller's line number (for error output) | 299 | * line_number - Caller's line number (for error output) |
300 | * Pathname - Full pathname to the node | 300 | * pathname - Full pathname to the node |
301 | * node_flags - From Namespace node for the method/object | 301 | * node_flags - From Namespace node for the method/object |
302 | * Format - Printf format string + additional args | 302 | * format - Printf format string + additional args |
303 | * | 303 | * |
304 | * RETURN: None | 304 | * RETURN: None |
305 | * | 305 | * |
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 14f523627a5e..41ebaaf8bb1a 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utxfmutex.c b/drivers/acpi/acpica/utxfmutex.c index 0a40a851b354..312299721ba1 100644 --- a/drivers/acpi/acpica/utxfmutex.c +++ b/drivers/acpi/acpica/utxfmutex.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2012, Intel Corp. | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 7efaeaa53b88..c5cd5b5513e6 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -1111,7 +1111,7 @@ fail: | |||
1111 | return result; | 1111 | return result; |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | static int acpi_battery_remove(struct acpi_device *device, int type) | 1114 | static int acpi_battery_remove(struct acpi_device *device) |
1115 | { | 1115 | { |
1116 | struct acpi_battery *battery = NULL; | 1116 | struct acpi_battery *battery = NULL; |
1117 | 1117 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 1f0d457ecbcf..01708a165368 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -178,276 +178,6 @@ int acpi_bus_get_private_data(acpi_handle handle, void **data) | |||
178 | } | 178 | } |
179 | EXPORT_SYMBOL(acpi_bus_get_private_data); | 179 | EXPORT_SYMBOL(acpi_bus_get_private_data); |
180 | 180 | ||
181 | /* -------------------------------------------------------------------------- | ||
182 | Power Management | ||
183 | -------------------------------------------------------------------------- */ | ||
184 | |||
185 | static const char *state_string(int state) | ||
186 | { | ||
187 | switch (state) { | ||
188 | case ACPI_STATE_D0: | ||
189 | return "D0"; | ||
190 | case ACPI_STATE_D1: | ||
191 | return "D1"; | ||
192 | case ACPI_STATE_D2: | ||
193 | return "D2"; | ||
194 | case ACPI_STATE_D3_HOT: | ||
195 | return "D3hot"; | ||
196 | case ACPI_STATE_D3_COLD: | ||
197 | return "D3"; | ||
198 | default: | ||
199 | return "(unknown)"; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | static int __acpi_bus_get_power(struct acpi_device *device, int *state) | ||
204 | { | ||
205 | int result = ACPI_STATE_UNKNOWN; | ||
206 | |||
207 | if (!device || !state) | ||
208 | return -EINVAL; | ||
209 | |||
210 | if (!device->flags.power_manageable) { | ||
211 | /* TBD: Non-recursive algorithm for walking up hierarchy. */ | ||
212 | *state = device->parent ? | ||
213 | device->parent->power.state : ACPI_STATE_D0; | ||
214 | goto out; | ||
215 | } | ||
216 | |||
217 | /* | ||
218 | * Get the device's power state either directly (via _PSC) or | ||
219 | * indirectly (via power resources). | ||
220 | */ | ||
221 | if (device->power.flags.explicit_get) { | ||
222 | unsigned long long psc; | ||
223 | acpi_status status = acpi_evaluate_integer(device->handle, | ||
224 | "_PSC", NULL, &psc); | ||
225 | if (ACPI_FAILURE(status)) | ||
226 | return -ENODEV; | ||
227 | |||
228 | result = psc; | ||
229 | } | ||
230 | /* The test below covers ACPI_STATE_UNKNOWN too. */ | ||
231 | if (result <= ACPI_STATE_D2) { | ||
232 | ; /* Do nothing. */ | ||
233 | } else if (device->power.flags.power_resources) { | ||
234 | int error = acpi_power_get_inferred_state(device, &result); | ||
235 | if (error) | ||
236 | return error; | ||
237 | } else if (result == ACPI_STATE_D3_HOT) { | ||
238 | result = ACPI_STATE_D3; | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * If we were unsure about the device parent's power state up to this | ||
243 | * point, the fact that the device is in D0 implies that the parent has | ||
244 | * to be in D0 too. | ||
245 | */ | ||
246 | if (device->parent && device->parent->power.state == ACPI_STATE_UNKNOWN | ||
247 | && result == ACPI_STATE_D0) | ||
248 | device->parent->power.state = ACPI_STATE_D0; | ||
249 | |||
250 | *state = result; | ||
251 | |||
252 | out: | ||
253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n", | ||
254 | device->pnp.bus_id, state_string(*state))); | ||
255 | |||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | |||
260 | /** | ||
261 | * acpi_device_set_power - Set power state of an ACPI device. | ||
262 | * @device: Device to set the power state of. | ||
263 | * @state: New power state to set. | ||
264 | * | ||
265 | * Callers must ensure that the device is power manageable before using this | ||
266 | * function. | ||
267 | */ | ||
268 | int acpi_device_set_power(struct acpi_device *device, int state) | ||
269 | { | ||
270 | int result = 0; | ||
271 | acpi_status status = AE_OK; | ||
272 | char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' }; | ||
273 | |||
274 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) | ||
275 | return -EINVAL; | ||
276 | |||
277 | /* Make sure this is a valid target state */ | ||
278 | |||
279 | if (state == device->power.state) { | ||
280 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n", | ||
281 | state_string(state))); | ||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | if (!device->power.states[state].flags.valid) { | ||
286 | printk(KERN_WARNING PREFIX "Device does not support %s\n", | ||
287 | state_string(state)); | ||
288 | return -ENODEV; | ||
289 | } | ||
290 | if (device->parent && (state < device->parent->power.state)) { | ||
291 | printk(KERN_WARNING PREFIX | ||
292 | "Cannot set device to a higher-powered" | ||
293 | " state than parent\n"); | ||
294 | return -ENODEV; | ||
295 | } | ||
296 | |||
297 | /* For D3cold we should execute _PS3, not _PS4. */ | ||
298 | if (state == ACPI_STATE_D3_COLD) | ||
299 | object_name[3] = '3'; | ||
300 | |||
301 | /* | ||
302 | * Transition Power | ||
303 | * ---------------- | ||
304 | * On transitions to a high-powered state we first apply power (via | ||
305 | * power resources) then evalute _PSx. Conversly for transitions to | ||
306 | * a lower-powered state. | ||
307 | */ | ||
308 | if (state < device->power.state) { | ||
309 | if (device->power.state >= ACPI_STATE_D3_HOT && | ||
310 | state != ACPI_STATE_D0) { | ||
311 | printk(KERN_WARNING PREFIX | ||
312 | "Cannot transition to non-D0 state from D3\n"); | ||
313 | return -ENODEV; | ||
314 | } | ||
315 | if (device->power.flags.power_resources) { | ||
316 | result = acpi_power_transition(device, state); | ||
317 | if (result) | ||
318 | goto end; | ||
319 | } | ||
320 | if (device->power.states[state].flags.explicit_set) { | ||
321 | status = acpi_evaluate_object(device->handle, | ||
322 | object_name, NULL, NULL); | ||
323 | if (ACPI_FAILURE(status)) { | ||
324 | result = -ENODEV; | ||
325 | goto end; | ||
326 | } | ||
327 | } | ||
328 | } else { | ||
329 | if (device->power.states[state].flags.explicit_set) { | ||
330 | status = acpi_evaluate_object(device->handle, | ||
331 | object_name, NULL, NULL); | ||
332 | if (ACPI_FAILURE(status)) { | ||
333 | result = -ENODEV; | ||
334 | goto end; | ||
335 | } | ||
336 | } | ||
337 | if (device->power.flags.power_resources) { | ||
338 | result = acpi_power_transition(device, state); | ||
339 | if (result) | ||
340 | goto end; | ||
341 | } | ||
342 | } | ||
343 | |||
344 | end: | ||
345 | if (result) | ||
346 | printk(KERN_WARNING PREFIX | ||
347 | "Device [%s] failed to transition to %s\n", | ||
348 | device->pnp.bus_id, state_string(state)); | ||
349 | else { | ||
350 | device->power.state = state; | ||
351 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
352 | "Device [%s] transitioned to %s\n", | ||
353 | device->pnp.bus_id, state_string(state))); | ||
354 | } | ||
355 | |||
356 | return result; | ||
357 | } | ||
358 | EXPORT_SYMBOL(acpi_device_set_power); | ||
359 | |||
360 | |||
361 | int acpi_bus_set_power(acpi_handle handle, int state) | ||
362 | { | ||
363 | struct acpi_device *device; | ||
364 | int result; | ||
365 | |||
366 | result = acpi_bus_get_device(handle, &device); | ||
367 | if (result) | ||
368 | return result; | ||
369 | |||
370 | if (!device->flags.power_manageable) { | ||
371 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
372 | "Device [%s] is not power manageable\n", | ||
373 | dev_name(&device->dev))); | ||
374 | return -ENODEV; | ||
375 | } | ||
376 | |||
377 | return acpi_device_set_power(device, state); | ||
378 | } | ||
379 | EXPORT_SYMBOL(acpi_bus_set_power); | ||
380 | |||
381 | |||
382 | int acpi_bus_init_power(struct acpi_device *device) | ||
383 | { | ||
384 | int state; | ||
385 | int result; | ||
386 | |||
387 | if (!device) | ||
388 | return -EINVAL; | ||
389 | |||
390 | device->power.state = ACPI_STATE_UNKNOWN; | ||
391 | |||
392 | result = __acpi_bus_get_power(device, &state); | ||
393 | if (result) | ||
394 | return result; | ||
395 | |||
396 | if (device->power.flags.power_resources) | ||
397 | result = acpi_power_on_resources(device, state); | ||
398 | |||
399 | if (!result) | ||
400 | device->power.state = state; | ||
401 | |||
402 | return result; | ||
403 | } | ||
404 | |||
405 | |||
406 | int acpi_bus_update_power(acpi_handle handle, int *state_p) | ||
407 | { | ||
408 | struct acpi_device *device; | ||
409 | int state; | ||
410 | int result; | ||
411 | |||
412 | result = acpi_bus_get_device(handle, &device); | ||
413 | if (result) | ||
414 | return result; | ||
415 | |||
416 | result = __acpi_bus_get_power(device, &state); | ||
417 | if (result) | ||
418 | return result; | ||
419 | |||
420 | result = acpi_device_set_power(device, state); | ||
421 | if (!result && state_p) | ||
422 | *state_p = state; | ||
423 | |||
424 | return result; | ||
425 | } | ||
426 | EXPORT_SYMBOL_GPL(acpi_bus_update_power); | ||
427 | |||
428 | |||
429 | bool acpi_bus_power_manageable(acpi_handle handle) | ||
430 | { | ||
431 | struct acpi_device *device; | ||
432 | int result; | ||
433 | |||
434 | result = acpi_bus_get_device(handle, &device); | ||
435 | return result ? false : device->flags.power_manageable; | ||
436 | } | ||
437 | |||
438 | EXPORT_SYMBOL(acpi_bus_power_manageable); | ||
439 | |||
440 | bool acpi_bus_can_wakeup(acpi_handle handle) | ||
441 | { | ||
442 | struct acpi_device *device; | ||
443 | int result; | ||
444 | |||
445 | result = acpi_bus_get_device(handle, &device); | ||
446 | return result ? false : device->wakeup.flags.valid; | ||
447 | } | ||
448 | |||
449 | EXPORT_SYMBOL(acpi_bus_can_wakeup); | ||
450 | |||
451 | static void acpi_print_osc_error(acpi_handle handle, | 181 | static void acpi_print_osc_error(acpi_handle handle, |
452 | struct acpi_osc_context *context, char *error) | 182 | struct acpi_osc_context *context, char *error) |
453 | { | 183 | { |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index f0d936b65e37..86c7d5445c38 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -75,7 +75,7 @@ static const struct acpi_device_id button_device_ids[] = { | |||
75 | MODULE_DEVICE_TABLE(acpi, button_device_ids); | 75 | MODULE_DEVICE_TABLE(acpi, button_device_ids); |
76 | 76 | ||
77 | static int acpi_button_add(struct acpi_device *device); | 77 | static int acpi_button_add(struct acpi_device *device); |
78 | static int acpi_button_remove(struct acpi_device *device, int type); | 78 | static int acpi_button_remove(struct acpi_device *device); |
79 | static void acpi_button_notify(struct acpi_device *device, u32 event); | 79 | static void acpi_button_notify(struct acpi_device *device, u32 event); |
80 | 80 | ||
81 | #ifdef CONFIG_PM_SLEEP | 81 | #ifdef CONFIG_PM_SLEEP |
@@ -433,7 +433,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
433 | return error; | 433 | return error; |
434 | } | 434 | } |
435 | 435 | ||
436 | static int acpi_button_remove(struct acpi_device *device, int type) | 436 | static int acpi_button_remove(struct acpi_device *device) |
437 | { | 437 | { |
438 | struct acpi_button *button = acpi_driver_data(device); | 438 | struct acpi_button *button = acpi_driver_data(device); |
439 | 439 | ||
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 811910b50b75..5523ba7d764d 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -34,46 +34,34 @@ | |||
34 | #include <linux/acpi.h> | 34 | #include <linux/acpi.h> |
35 | #include <acpi/acpi_bus.h> | 35 | #include <acpi/acpi_bus.h> |
36 | #include <acpi/acpi_drivers.h> | 36 | #include <acpi/acpi_drivers.h> |
37 | #include <acpi/container.h> | ||
38 | 37 | ||
39 | #define PREFIX "ACPI: " | 38 | #define PREFIX "ACPI: " |
40 | 39 | ||
41 | #define ACPI_CONTAINER_DEVICE_NAME "ACPI container device" | ||
42 | #define ACPI_CONTAINER_CLASS "container" | ||
43 | |||
44 | #define INSTALL_NOTIFY_HANDLER 1 | ||
45 | #define UNINSTALL_NOTIFY_HANDLER 2 | ||
46 | |||
47 | #define _COMPONENT ACPI_CONTAINER_COMPONENT | 40 | #define _COMPONENT ACPI_CONTAINER_COMPONENT |
48 | ACPI_MODULE_NAME("container"); | 41 | ACPI_MODULE_NAME("container"); |
49 | 42 | ||
50 | MODULE_AUTHOR("Anil S Keshavamurthy"); | ||
51 | MODULE_DESCRIPTION("ACPI container driver"); | ||
52 | MODULE_LICENSE("GPL"); | ||
53 | |||
54 | static int acpi_container_add(struct acpi_device *device); | ||
55 | static int acpi_container_remove(struct acpi_device *device, int type); | ||
56 | |||
57 | static const struct acpi_device_id container_device_ids[] = { | 43 | static const struct acpi_device_id container_device_ids[] = { |
58 | {"ACPI0004", 0}, | 44 | {"ACPI0004", 0}, |
59 | {"PNP0A05", 0}, | 45 | {"PNP0A05", 0}, |
60 | {"PNP0A06", 0}, | 46 | {"PNP0A06", 0}, |
61 | {"", 0}, | 47 | {"", 0}, |
62 | }; | 48 | }; |
63 | MODULE_DEVICE_TABLE(acpi, container_device_ids); | ||
64 | 49 | ||
65 | static struct acpi_driver acpi_container_driver = { | 50 | static int container_device_attach(struct acpi_device *device, |
66 | .name = "container", | 51 | const struct acpi_device_id *not_used) |
67 | .class = ACPI_CONTAINER_CLASS, | 52 | { |
53 | /* | ||
54 | * FIXME: This is necessary, so that acpi_eject_store() doesn't return | ||
55 | * -ENODEV for containers. | ||
56 | */ | ||
57 | return 1; | ||
58 | } | ||
59 | |||
60 | static struct acpi_scan_handler container_device_handler = { | ||
68 | .ids = container_device_ids, | 61 | .ids = container_device_ids, |
69 | .ops = { | 62 | .attach = container_device_attach, |
70 | .add = acpi_container_add, | ||
71 | .remove = acpi_container_remove, | ||
72 | }, | ||
73 | }; | 63 | }; |
74 | 64 | ||
75 | /*******************************************************************/ | ||
76 | |||
77 | static int is_device_present(acpi_handle handle) | 65 | static int is_device_present(acpi_handle handle) |
78 | { | 66 | { |
79 | acpi_handle temp; | 67 | acpi_handle temp; |
@@ -92,73 +80,6 @@ static int is_device_present(acpi_handle handle) | |||
92 | return ((sta & ACPI_STA_DEVICE_PRESENT) == ACPI_STA_DEVICE_PRESENT); | 80 | return ((sta & ACPI_STA_DEVICE_PRESENT) == ACPI_STA_DEVICE_PRESENT); |
93 | } | 81 | } |
94 | 82 | ||
95 | static bool is_container_device(const char *hid) | ||
96 | { | ||
97 | const struct acpi_device_id *container_id; | ||
98 | |||
99 | for (container_id = container_device_ids; | ||
100 | container_id->id[0]; container_id++) { | ||
101 | if (!strcmp((char *)container_id->id, hid)) | ||
102 | return true; | ||
103 | } | ||
104 | |||
105 | return false; | ||
106 | } | ||
107 | |||
108 | /*******************************************************************/ | ||
109 | static int acpi_container_add(struct acpi_device *device) | ||
110 | { | ||
111 | struct acpi_container *container; | ||
112 | |||
113 | container = kzalloc(sizeof(struct acpi_container), GFP_KERNEL); | ||
114 | if (!container) | ||
115 | return -ENOMEM; | ||
116 | |||
117 | container->handle = device->handle; | ||
118 | strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME); | ||
119 | strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS); | ||
120 | device->driver_data = container; | ||
121 | |||
122 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", | ||
123 | acpi_device_name(device), acpi_device_bid(device))); | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static int acpi_container_remove(struct acpi_device *device, int type) | ||
129 | { | ||
130 | acpi_status status = AE_OK; | ||
131 | struct acpi_container *pc = NULL; | ||
132 | |||
133 | pc = acpi_driver_data(device); | ||
134 | kfree(pc); | ||
135 | return status; | ||
136 | } | ||
137 | |||
138 | static int container_device_add(struct acpi_device **device, acpi_handle handle) | ||
139 | { | ||
140 | acpi_handle phandle; | ||
141 | struct acpi_device *pdev; | ||
142 | int result; | ||
143 | |||
144 | |||
145 | if (acpi_get_parent(handle, &phandle)) { | ||
146 | return -ENODEV; | ||
147 | } | ||
148 | |||
149 | if (acpi_bus_get_device(phandle, &pdev)) { | ||
150 | return -ENODEV; | ||
151 | } | ||
152 | |||
153 | if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { | ||
154 | return -ENODEV; | ||
155 | } | ||
156 | |||
157 | result = acpi_bus_start(*device); | ||
158 | |||
159 | return result; | ||
160 | } | ||
161 | |||
162 | static void container_notify_cb(acpi_handle handle, u32 type, void *context) | 83 | static void container_notify_cb(acpi_handle handle, u32 type, void *context) |
163 | { | 84 | { |
164 | struct acpi_device *device = NULL; | 85 | struct acpi_device *device = NULL; |
@@ -167,6 +88,8 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) | |||
167 | acpi_status status; | 88 | acpi_status status; |
168 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 89 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ |
169 | 90 | ||
91 | acpi_scan_lock_acquire(); | ||
92 | |||
170 | switch (type) { | 93 | switch (type) { |
171 | case ACPI_NOTIFY_BUS_CHECK: | 94 | case ACPI_NOTIFY_BUS_CHECK: |
172 | /* Fall through */ | 95 | /* Fall through */ |
@@ -182,7 +105,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) | |||
182 | /* device exist and this is a remove request */ | 105 | /* device exist and this is a remove request */ |
183 | device->flags.eject_pending = 1; | 106 | device->flags.eject_pending = 1; |
184 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | 107 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); |
185 | return; | 108 | goto out; |
186 | } | 109 | } |
187 | break; | 110 | break; |
188 | } | 111 | } |
@@ -190,11 +113,16 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) | |||
190 | if (!ACPI_FAILURE(status) || device) | 113 | if (!ACPI_FAILURE(status) || device) |
191 | break; | 114 | break; |
192 | 115 | ||
193 | result = container_device_add(&device, handle); | 116 | result = acpi_bus_scan(handle); |
194 | if (result) { | 117 | if (result) { |
195 | acpi_handle_warn(handle, "Failed to add container\n"); | 118 | acpi_handle_warn(handle, "Failed to add container\n"); |
196 | break; | 119 | break; |
197 | } | 120 | } |
121 | result = acpi_bus_get_device(handle, &device); | ||
122 | if (result) { | ||
123 | acpi_handle_warn(handle, "Missing device object\n"); | ||
124 | break; | ||
125 | } | ||
198 | 126 | ||
199 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); | 127 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); |
200 | ost_code = ACPI_OST_SC_SUCCESS; | 128 | ost_code = ACPI_OST_SC_SUCCESS; |
@@ -204,98 +132,59 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) | |||
204 | if (!acpi_bus_get_device(handle, &device) && device) { | 132 | if (!acpi_bus_get_device(handle, &device) && device) { |
205 | device->flags.eject_pending = 1; | 133 | device->flags.eject_pending = 1; |
206 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | 134 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); |
207 | return; | 135 | goto out; |
208 | } | 136 | } |
209 | break; | 137 | break; |
210 | 138 | ||
211 | default: | 139 | default: |
212 | /* non-hotplug event; possibly handled by other handler */ | 140 | /* non-hotplug event; possibly handled by other handler */ |
213 | return; | 141 | goto out; |
214 | } | 142 | } |
215 | 143 | ||
216 | /* Inform firmware that the hotplug operation has completed */ | 144 | /* Inform firmware that the hotplug operation has completed */ |
217 | (void) acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); | 145 | (void) acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); |
218 | return; | 146 | |
147 | out: | ||
148 | acpi_scan_lock_release(); | ||
219 | } | 149 | } |
220 | 150 | ||
221 | static acpi_status | 151 | static bool is_container(acpi_handle handle) |
222 | container_walk_namespace_cb(acpi_handle handle, | ||
223 | u32 lvl, void *context, void **rv) | ||
224 | { | 152 | { |
225 | char *hid = NULL; | ||
226 | struct acpi_device_info *info; | 153 | struct acpi_device_info *info; |
227 | acpi_status status; | 154 | bool ret = false; |
228 | int *action = context; | ||
229 | |||
230 | status = acpi_get_object_info(handle, &info); | ||
231 | if (ACPI_FAILURE(status)) { | ||
232 | return AE_OK; | ||
233 | } | ||
234 | 155 | ||
235 | if (info->valid & ACPI_VALID_HID) | 156 | if (ACPI_FAILURE(acpi_get_object_info(handle, &info))) |
236 | hid = info->hardware_id.string; | 157 | return false; |
237 | 158 | ||
238 | if (hid == NULL) { | 159 | if (info->valid & ACPI_VALID_HID) { |
239 | goto end; | 160 | const struct acpi_device_id *id; |
240 | } | ||
241 | |||
242 | if (!is_container_device(hid)) | ||
243 | goto end; | ||
244 | 161 | ||
245 | switch (*action) { | 162 | for (id = container_device_ids; id->id[0]; id++) { |
246 | case INSTALL_NOTIFY_HANDLER: | 163 | ret = !strcmp((char *)id->id, info->hardware_id.string); |
247 | acpi_install_notify_handler(handle, | 164 | if (ret) |
248 | ACPI_SYSTEM_NOTIFY, | 165 | break; |
249 | container_notify_cb, NULL); | 166 | } |
250 | break; | ||
251 | case UNINSTALL_NOTIFY_HANDLER: | ||
252 | acpi_remove_notify_handler(handle, | ||
253 | ACPI_SYSTEM_NOTIFY, | ||
254 | container_notify_cb); | ||
255 | break; | ||
256 | default: | ||
257 | break; | ||
258 | } | 167 | } |
259 | |||
260 | end: | ||
261 | kfree(info); | 168 | kfree(info); |
262 | 169 | return ret; | |
263 | return AE_OK; | ||
264 | } | 170 | } |
265 | 171 | ||
266 | static int __init acpi_container_init(void) | 172 | static acpi_status acpi_container_register_notify_handler(acpi_handle handle, |
173 | u32 lvl, void *ctxt, | ||
174 | void **retv) | ||
267 | { | 175 | { |
268 | int result = 0; | 176 | if (is_container(handle)) |
269 | int action = INSTALL_NOTIFY_HANDLER; | 177 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, |
270 | 178 | container_notify_cb, NULL); | |
271 | result = acpi_bus_register_driver(&acpi_container_driver); | ||
272 | if (result < 0) { | ||
273 | return (result); | ||
274 | } | ||
275 | |||
276 | /* register notify handler to every container device */ | ||
277 | acpi_walk_namespace(ACPI_TYPE_DEVICE, | ||
278 | ACPI_ROOT_OBJECT, | ||
279 | ACPI_UINT32_MAX, | ||
280 | container_walk_namespace_cb, NULL, &action, NULL); | ||
281 | 179 | ||
282 | return (0); | 180 | return AE_OK; |
283 | } | 181 | } |
284 | 182 | ||
285 | static void __exit acpi_container_exit(void) | 183 | void __init acpi_container_init(void) |
286 | { | 184 | { |
287 | int action = UNINSTALL_NOTIFY_HANDLER; | 185 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, |
186 | acpi_container_register_notify_handler, NULL, | ||
187 | NULL, NULL); | ||
288 | 188 | ||
289 | 189 | acpi_scan_add_handler(&container_device_handler); | |
290 | acpi_walk_namespace(ACPI_TYPE_DEVICE, | ||
291 | ACPI_ROOT_OBJECT, | ||
292 | ACPI_UINT32_MAX, | ||
293 | container_walk_namespace_cb, NULL, &action, NULL); | ||
294 | |||
295 | acpi_bus_unregister_driver(&acpi_container_driver); | ||
296 | |||
297 | return; | ||
298 | } | 190 | } |
299 | |||
300 | module_init(acpi_container_init); | ||
301 | module_exit(acpi_container_exit); | ||
diff --git a/drivers/acpi/csrt.c b/drivers/acpi/csrt.c new file mode 100644 index 000000000000..5c15a91faf0b --- /dev/null +++ b/drivers/acpi/csrt.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Support for Core System Resources Table (CSRT) | ||
3 | * | ||
4 | * Copyright (C) 2013, Intel Corporation | ||
5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
6 | * Andy Shevchenko <andriy.shevchenko@linux.intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #define pr_fmt(fmt) "ACPI: CSRT: " fmt | ||
14 | |||
15 | #include <linux/acpi.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/sizes.h> | ||
21 | |||
22 | ACPI_MODULE_NAME("CSRT"); | ||
23 | |||
24 | static int __init acpi_csrt_parse_shared_info(struct platform_device *pdev, | ||
25 | const struct acpi_csrt_group *grp) | ||
26 | { | ||
27 | const struct acpi_csrt_shared_info *si; | ||
28 | struct resource res[3]; | ||
29 | size_t nres; | ||
30 | int ret; | ||
31 | |||
32 | memset(res, 0, sizeof(res)); | ||
33 | nres = 0; | ||
34 | |||
35 | si = (const struct acpi_csrt_shared_info *)&grp[1]; | ||
36 | /* | ||
37 | * The peripherals that are listed on CSRT typically support only | ||
38 | * 32-bit addresses so we only use the low part of MMIO base for | ||
39 | * now. | ||
40 | */ | ||
41 | if (!si->mmio_base_high && si->mmio_base_low) { | ||
42 | /* | ||
43 | * There is no size of the memory resource in shared_info | ||
44 | * so we assume that it is 4k here. | ||
45 | */ | ||
46 | res[nres].start = si->mmio_base_low; | ||
47 | res[nres].end = res[0].start + SZ_4K - 1; | ||
48 | res[nres++].flags = IORESOURCE_MEM; | ||
49 | } | ||
50 | |||
51 | if (si->gsi_interrupt) { | ||
52 | int irq = acpi_register_gsi(NULL, si->gsi_interrupt, | ||
53 | si->interrupt_mode, | ||
54 | si->interrupt_polarity); | ||
55 | res[nres].start = irq; | ||
56 | res[nres].end = irq; | ||
57 | res[nres++].flags = IORESOURCE_IRQ; | ||
58 | } | ||
59 | |||
60 | if (si->base_request_line || si->num_handshake_signals) { | ||
61 | /* | ||
62 | * We pass the driver a DMA resource describing the range | ||
63 | * of request lines the device supports. | ||
64 | */ | ||
65 | res[nres].start = si->base_request_line; | ||
66 | res[nres].end = res[nres].start + si->num_handshake_signals - 1; | ||
67 | res[nres++].flags = IORESOURCE_DMA; | ||
68 | } | ||
69 | |||
70 | ret = platform_device_add_resources(pdev, res, nres); | ||
71 | if (ret) { | ||
72 | if (si->gsi_interrupt) | ||
73 | acpi_unregister_gsi(si->gsi_interrupt); | ||
74 | return ret; | ||
75 | } | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int __init | ||
81 | acpi_csrt_parse_resource_group(const struct acpi_csrt_group *grp) | ||
82 | { | ||
83 | struct platform_device *pdev; | ||
84 | char vendor[5], name[16]; | ||
85 | int ret, i; | ||
86 | |||
87 | vendor[0] = grp->vendor_id; | ||
88 | vendor[1] = grp->vendor_id >> 8; | ||
89 | vendor[2] = grp->vendor_id >> 16; | ||
90 | vendor[3] = grp->vendor_id >> 24; | ||
91 | vendor[4] = '\0'; | ||
92 | |||
93 | if (grp->shared_info_length != sizeof(struct acpi_csrt_shared_info)) | ||
94 | return -ENODEV; | ||
95 | |||
96 | snprintf(name, sizeof(name), "%s%04X", vendor, grp->device_id); | ||
97 | pdev = platform_device_alloc(name, PLATFORM_DEVID_AUTO); | ||
98 | if (!pdev) | ||
99 | return -ENOMEM; | ||
100 | |||
101 | /* Add resources based on the shared info */ | ||
102 | ret = acpi_csrt_parse_shared_info(pdev, grp); | ||
103 | if (ret) | ||
104 | goto fail; | ||
105 | |||
106 | ret = platform_device_add(pdev); | ||
107 | if (ret) | ||
108 | goto fail; | ||
109 | |||
110 | for (i = 0; i < pdev->num_resources; i++) | ||
111 | dev_dbg(&pdev->dev, "%pR\n", &pdev->resource[i]); | ||
112 | |||
113 | return 0; | ||
114 | |||
115 | fail: | ||
116 | platform_device_put(pdev); | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | * CSRT or Core System Resources Table is a proprietary ACPI table | ||
122 | * introduced by Microsoft. This table can contain devices that are not in | ||
123 | * the system DSDT table. In particular DMA controllers might be described | ||
124 | * here. | ||
125 | * | ||
126 | * We present these devices as normal platform devices that don't have ACPI | ||
127 | * IDs or handle. The platform device name will be something like | ||
128 | * <VENDOR><DEVID>.<n>.auto for example: INTL9C06.0.auto. | ||
129 | */ | ||
130 | void __init acpi_csrt_init(void) | ||
131 | { | ||
132 | struct acpi_csrt_group *grp, *end; | ||
133 | struct acpi_table_csrt *csrt; | ||
134 | acpi_status status; | ||
135 | int ret; | ||
136 | |||
137 | status = acpi_get_table(ACPI_SIG_CSRT, 0, | ||
138 | (struct acpi_table_header **)&csrt); | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | if (status != AE_NOT_FOUND) | ||
141 | pr_warn("failed to get the CSRT table\n"); | ||
142 | return; | ||
143 | } | ||
144 | |||
145 | pr_debug("parsing CSRT table for devices\n"); | ||
146 | |||
147 | grp = (struct acpi_csrt_group *)(csrt + 1); | ||
148 | end = (struct acpi_csrt_group *)((void *)csrt + csrt->header.length); | ||
149 | |||
150 | while (grp < end) { | ||
151 | ret = acpi_csrt_parse_resource_group(grp); | ||
152 | if (ret) { | ||
153 | pr_warn("error in parsing resource group: %d\n", ret); | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | grp = (struct acpi_csrt_group *)((void *)grp + grp->length); | ||
158 | } | ||
159 | } | ||
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c index 5d42c2414ae5..6adfc706a1de 100644 --- a/drivers/acpi/custom_method.c +++ b/drivers/acpi/custom_method.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * debugfs.c - ACPI debugfs interface to userspace. | 2 | * custom_method.c - debugfs interface for customizing ACPI control method |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index c6ff606c6d5b..dd314ef9bff1 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -30,6 +30,12 @@ | |||
30 | 30 | ||
31 | #include <acpi/acpi.h> | 31 | #include <acpi/acpi.h> |
32 | #include <acpi/acpi_bus.h> | 32 | #include <acpi/acpi_bus.h> |
33 | #include <acpi/acpi_drivers.h> | ||
34 | |||
35 | #include "internal.h" | ||
36 | |||
37 | #define _COMPONENT ACPI_POWER_COMPONENT | ||
38 | ACPI_MODULE_NAME("device_pm"); | ||
33 | 39 | ||
34 | static DEFINE_MUTEX(acpi_pm_notifier_lock); | 40 | static DEFINE_MUTEX(acpi_pm_notifier_lock); |
35 | 41 | ||
@@ -94,6 +100,293 @@ acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | |||
94 | } | 100 | } |
95 | 101 | ||
96 | /** | 102 | /** |
103 | * acpi_power_state_string - String representation of ACPI device power state. | ||
104 | * @state: ACPI device power state to return the string representation of. | ||
105 | */ | ||
106 | const char *acpi_power_state_string(int state) | ||
107 | { | ||
108 | switch (state) { | ||
109 | case ACPI_STATE_D0: | ||
110 | return "D0"; | ||
111 | case ACPI_STATE_D1: | ||
112 | return "D1"; | ||
113 | case ACPI_STATE_D2: | ||
114 | return "D2"; | ||
115 | case ACPI_STATE_D3_HOT: | ||
116 | return "D3hot"; | ||
117 | case ACPI_STATE_D3_COLD: | ||
118 | return "D3cold"; | ||
119 | default: | ||
120 | return "(unknown)"; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * acpi_device_get_power - Get power state of an ACPI device. | ||
126 | * @device: Device to get the power state of. | ||
127 | * @state: Place to store the power state of the device. | ||
128 | * | ||
129 | * This function does not update the device's power.state field, but it may | ||
130 | * update its parent's power.state field (when the parent's power state is | ||
131 | * unknown and the device's power state turns out to be D0). | ||
132 | */ | ||
133 | int acpi_device_get_power(struct acpi_device *device, int *state) | ||
134 | { | ||
135 | int result = ACPI_STATE_UNKNOWN; | ||
136 | |||
137 | if (!device || !state) | ||
138 | return -EINVAL; | ||
139 | |||
140 | if (!device->flags.power_manageable) { | ||
141 | /* TBD: Non-recursive algorithm for walking up hierarchy. */ | ||
142 | *state = device->parent ? | ||
143 | device->parent->power.state : ACPI_STATE_D0; | ||
144 | goto out; | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * Get the device's power state either directly (via _PSC) or | ||
149 | * indirectly (via power resources). | ||
150 | */ | ||
151 | if (device->power.flags.explicit_get) { | ||
152 | unsigned long long psc; | ||
153 | acpi_status status = acpi_evaluate_integer(device->handle, | ||
154 | "_PSC", NULL, &psc); | ||
155 | if (ACPI_FAILURE(status)) | ||
156 | return -ENODEV; | ||
157 | |||
158 | result = psc; | ||
159 | } | ||
160 | /* The test below covers ACPI_STATE_UNKNOWN too. */ | ||
161 | if (result <= ACPI_STATE_D2) { | ||
162 | ; /* Do nothing. */ | ||
163 | } else if (device->power.flags.power_resources) { | ||
164 | int error = acpi_power_get_inferred_state(device, &result); | ||
165 | if (error) | ||
166 | return error; | ||
167 | } else if (result == ACPI_STATE_D3_HOT) { | ||
168 | result = ACPI_STATE_D3; | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * If we were unsure about the device parent's power state up to this | ||
173 | * point, the fact that the device is in D0 implies that the parent has | ||
174 | * to be in D0 too. | ||
175 | */ | ||
176 | if (device->parent && device->parent->power.state == ACPI_STATE_UNKNOWN | ||
177 | && result == ACPI_STATE_D0) | ||
178 | device->parent->power.state = ACPI_STATE_D0; | ||
179 | |||
180 | *state = result; | ||
181 | |||
182 | out: | ||
183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n", | ||
184 | device->pnp.bus_id, acpi_power_state_string(*state))); | ||
185 | |||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | static int acpi_dev_pm_explicit_set(struct acpi_device *adev, int state) | ||
190 | { | ||
191 | if (adev->power.states[state].flags.explicit_set) { | ||
192 | char method[5] = { '_', 'P', 'S', '0' + state, '\0' }; | ||
193 | acpi_status status; | ||
194 | |||
195 | status = acpi_evaluate_object(adev->handle, method, NULL, NULL); | ||
196 | if (ACPI_FAILURE(status)) | ||
197 | return -ENODEV; | ||
198 | } | ||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | /** | ||
203 | * acpi_device_set_power - Set power state of an ACPI device. | ||
204 | * @device: Device to set the power state of. | ||
205 | * @state: New power state to set. | ||
206 | * | ||
207 | * Callers must ensure that the device is power manageable before using this | ||
208 | * function. | ||
209 | */ | ||
210 | int acpi_device_set_power(struct acpi_device *device, int state) | ||
211 | { | ||
212 | int result = 0; | ||
213 | bool cut_power = false; | ||
214 | |||
215 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) | ||
216 | return -EINVAL; | ||
217 | |||
218 | /* Make sure this is a valid target state */ | ||
219 | |||
220 | if (state == device->power.state) { | ||
221 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n", | ||
222 | acpi_power_state_string(state))); | ||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | if (!device->power.states[state].flags.valid) { | ||
227 | printk(KERN_WARNING PREFIX "Device does not support %s\n", | ||
228 | acpi_power_state_string(state)); | ||
229 | return -ENODEV; | ||
230 | } | ||
231 | if (device->parent && (state < device->parent->power.state)) { | ||
232 | printk(KERN_WARNING PREFIX | ||
233 | "Cannot set device to a higher-powered" | ||
234 | " state than parent\n"); | ||
235 | return -ENODEV; | ||
236 | } | ||
237 | |||
238 | /* For D3cold we should first transition into D3hot. */ | ||
239 | if (state == ACPI_STATE_D3_COLD | ||
240 | && device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible) { | ||
241 | state = ACPI_STATE_D3_HOT; | ||
242 | cut_power = true; | ||
243 | } | ||
244 | |||
245 | if (state < device->power.state && state != ACPI_STATE_D0 | ||
246 | && device->power.state >= ACPI_STATE_D3_HOT) { | ||
247 | printk(KERN_WARNING PREFIX | ||
248 | "Cannot transition to non-D0 state from D3\n"); | ||
249 | return -ENODEV; | ||
250 | } | ||
251 | |||
252 | /* | ||
253 | * Transition Power | ||
254 | * ---------------- | ||
255 | * In accordance with the ACPI specification first apply power (via | ||
256 | * power resources) and then evalute _PSx. | ||
257 | */ | ||
258 | if (device->power.flags.power_resources) { | ||
259 | result = acpi_power_transition(device, state); | ||
260 | if (result) | ||
261 | goto end; | ||
262 | } | ||
263 | result = acpi_dev_pm_explicit_set(device, state); | ||
264 | if (result) | ||
265 | goto end; | ||
266 | |||
267 | if (cut_power) { | ||
268 | device->power.state = state; | ||
269 | state = ACPI_STATE_D3_COLD; | ||
270 | result = acpi_power_transition(device, state); | ||
271 | } | ||
272 | |||
273 | end: | ||
274 | if (result) { | ||
275 | printk(KERN_WARNING PREFIX | ||
276 | "Device [%s] failed to transition to %s\n", | ||
277 | device->pnp.bus_id, | ||
278 | acpi_power_state_string(state)); | ||
279 | } else { | ||
280 | device->power.state = state; | ||
281 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
282 | "Device [%s] transitioned to %s\n", | ||
283 | device->pnp.bus_id, | ||
284 | acpi_power_state_string(state))); | ||
285 | } | ||
286 | |||
287 | return result; | ||
288 | } | ||
289 | EXPORT_SYMBOL(acpi_device_set_power); | ||
290 | |||
291 | int acpi_bus_set_power(acpi_handle handle, int state) | ||
292 | { | ||
293 | struct acpi_device *device; | ||
294 | int result; | ||
295 | |||
296 | result = acpi_bus_get_device(handle, &device); | ||
297 | if (result) | ||
298 | return result; | ||
299 | |||
300 | if (!device->flags.power_manageable) { | ||
301 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
302 | "Device [%s] is not power manageable\n", | ||
303 | dev_name(&device->dev))); | ||
304 | return -ENODEV; | ||
305 | } | ||
306 | |||
307 | return acpi_device_set_power(device, state); | ||
308 | } | ||
309 | EXPORT_SYMBOL(acpi_bus_set_power); | ||
310 | |||
311 | int acpi_bus_init_power(struct acpi_device *device) | ||
312 | { | ||
313 | int state; | ||
314 | int result; | ||
315 | |||
316 | if (!device) | ||
317 | return -EINVAL; | ||
318 | |||
319 | device->power.state = ACPI_STATE_UNKNOWN; | ||
320 | |||
321 | result = acpi_device_get_power(device, &state); | ||
322 | if (result) | ||
323 | return result; | ||
324 | |||
325 | if (state < ACPI_STATE_D3_COLD && device->power.flags.power_resources) { | ||
326 | result = acpi_power_on_resources(device, state); | ||
327 | if (result) | ||
328 | return result; | ||
329 | |||
330 | result = acpi_dev_pm_explicit_set(device, state); | ||
331 | if (result) | ||
332 | return result; | ||
333 | } else if (state == ACPI_STATE_UNKNOWN) { | ||
334 | /* No power resources and missing _PSC? Try to force D0. */ | ||
335 | state = ACPI_STATE_D0; | ||
336 | result = acpi_dev_pm_explicit_set(device, state); | ||
337 | if (result) | ||
338 | return result; | ||
339 | } | ||
340 | device->power.state = state; | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | int acpi_bus_update_power(acpi_handle handle, int *state_p) | ||
345 | { | ||
346 | struct acpi_device *device; | ||
347 | int state; | ||
348 | int result; | ||
349 | |||
350 | result = acpi_bus_get_device(handle, &device); | ||
351 | if (result) | ||
352 | return result; | ||
353 | |||
354 | result = acpi_device_get_power(device, &state); | ||
355 | if (result) | ||
356 | return result; | ||
357 | |||
358 | if (state == ACPI_STATE_UNKNOWN) | ||
359 | state = ACPI_STATE_D0; | ||
360 | |||
361 | result = acpi_device_set_power(device, state); | ||
362 | if (!result && state_p) | ||
363 | *state_p = state; | ||
364 | |||
365 | return result; | ||
366 | } | ||
367 | EXPORT_SYMBOL_GPL(acpi_bus_update_power); | ||
368 | |||
369 | bool acpi_bus_power_manageable(acpi_handle handle) | ||
370 | { | ||
371 | struct acpi_device *device; | ||
372 | int result; | ||
373 | |||
374 | result = acpi_bus_get_device(handle, &device); | ||
375 | return result ? false : device->flags.power_manageable; | ||
376 | } | ||
377 | EXPORT_SYMBOL(acpi_bus_power_manageable); | ||
378 | |||
379 | bool acpi_bus_can_wakeup(acpi_handle handle) | ||
380 | { | ||
381 | struct acpi_device *device; | ||
382 | int result; | ||
383 | |||
384 | result = acpi_bus_get_device(handle, &device); | ||
385 | return result ? false : device->wakeup.flags.valid; | ||
386 | } | ||
387 | EXPORT_SYMBOL(acpi_bus_can_wakeup); | ||
388 | |||
389 | /** | ||
97 | * acpi_device_power_state - Get preferred power state of ACPI device. | 390 | * acpi_device_power_state - Get preferred power state of ACPI device. |
98 | * @dev: Device whose preferred target power state to return. | 391 | * @dev: Device whose preferred target power state to return. |
99 | * @adev: ACPI device node corresponding to @dev. | 392 | * @adev: ACPI device node corresponding to @dev. |
@@ -213,7 +506,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) | |||
213 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | 506 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); |
214 | struct acpi_device *adev; | 507 | struct acpi_device *adev; |
215 | 508 | ||
216 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | 509 | if (!handle || acpi_bus_get_device(handle, &adev)) { |
217 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); | 510 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); |
218 | return -ENODEV; | 511 | return -ENODEV; |
219 | } | 512 | } |
@@ -290,7 +583,7 @@ int acpi_pm_device_run_wake(struct device *phys_dev, bool enable) | |||
290 | return -EINVAL; | 583 | return -EINVAL; |
291 | 584 | ||
292 | handle = DEVICE_ACPI_HANDLE(phys_dev); | 585 | handle = DEVICE_ACPI_HANDLE(phys_dev); |
293 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | 586 | if (!handle || acpi_bus_get_device(handle, &adev)) { |
294 | dev_dbg(phys_dev, "ACPI handle without context in %s!\n", | 587 | dev_dbg(phys_dev, "ACPI handle without context in %s!\n", |
295 | __func__); | 588 | __func__); |
296 | return -ENODEV; | 589 | return -ENODEV; |
@@ -304,7 +597,7 @@ static inline void acpi_wakeup_device(acpi_handle handle, u32 event, | |||
304 | void *context) {} | 597 | void *context) {} |
305 | #endif /* CONFIG_PM_RUNTIME */ | 598 | #endif /* CONFIG_PM_RUNTIME */ |
306 | 599 | ||
307 | #ifdef CONFIG_PM_SLEEP | 600 | #ifdef CONFIG_PM_SLEEP |
308 | /** | 601 | /** |
309 | * __acpi_device_sleep_wake - Enable or disable device to wake up the system. | 602 | * __acpi_device_sleep_wake - Enable or disable device to wake up the system. |
310 | * @dev: Device to enable/desible to wake up the system. | 603 | * @dev: Device to enable/desible to wake up the system. |
@@ -334,7 +627,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
334 | return -EINVAL; | 627 | return -EINVAL; |
335 | 628 | ||
336 | handle = DEVICE_ACPI_HANDLE(dev); | 629 | handle = DEVICE_ACPI_HANDLE(dev); |
337 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | 630 | if (!handle || acpi_bus_get_device(handle, &adev)) { |
338 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); | 631 | dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); |
339 | return -ENODEV; | 632 | return -ENODEV; |
340 | } | 633 | } |
@@ -353,7 +646,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
353 | * acpi_dev_pm_get_node - Get ACPI device node for the given physical device. | 646 | * acpi_dev_pm_get_node - Get ACPI device node for the given physical device. |
354 | * @dev: Device to get the ACPI node for. | 647 | * @dev: Device to get the ACPI node for. |
355 | */ | 648 | */ |
356 | static struct acpi_device *acpi_dev_pm_get_node(struct device *dev) | 649 | struct acpi_device *acpi_dev_pm_get_node(struct device *dev) |
357 | { | 650 | { |
358 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | 651 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); |
359 | struct acpi_device *adev; | 652 | struct acpi_device *adev; |
@@ -665,3 +958,59 @@ void acpi_dev_pm_detach(struct device *dev, bool power_off) | |||
665 | } | 958 | } |
666 | } | 959 | } |
667 | EXPORT_SYMBOL_GPL(acpi_dev_pm_detach); | 960 | EXPORT_SYMBOL_GPL(acpi_dev_pm_detach); |
961 | |||
962 | /** | ||
963 | * acpi_dev_pm_add_dependent - Add physical device depending for PM. | ||
964 | * @handle: Handle of ACPI device node. | ||
965 | * @depdev: Device depending on that node for PM. | ||
966 | */ | ||
967 | void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev) | ||
968 | { | ||
969 | struct acpi_device_physical_node *dep; | ||
970 | struct acpi_device *adev; | ||
971 | |||
972 | if (!depdev || acpi_bus_get_device(handle, &adev)) | ||
973 | return; | ||
974 | |||
975 | mutex_lock(&adev->physical_node_lock); | ||
976 | |||
977 | list_for_each_entry(dep, &adev->power_dependent, node) | ||
978 | if (dep->dev == depdev) | ||
979 | goto out; | ||
980 | |||
981 | dep = kzalloc(sizeof(*dep), GFP_KERNEL); | ||
982 | if (dep) { | ||
983 | dep->dev = depdev; | ||
984 | list_add_tail(&dep->node, &adev->power_dependent); | ||
985 | } | ||
986 | |||
987 | out: | ||
988 | mutex_unlock(&adev->physical_node_lock); | ||
989 | } | ||
990 | EXPORT_SYMBOL_GPL(acpi_dev_pm_add_dependent); | ||
991 | |||
992 | /** | ||
993 | * acpi_dev_pm_remove_dependent - Remove physical device depending for PM. | ||
994 | * @handle: Handle of ACPI device node. | ||
995 | * @depdev: Device depending on that node for PM. | ||
996 | */ | ||
997 | void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev) | ||
998 | { | ||
999 | struct acpi_device_physical_node *dep; | ||
1000 | struct acpi_device *adev; | ||
1001 | |||
1002 | if (!depdev || acpi_bus_get_device(handle, &adev)) | ||
1003 | return; | ||
1004 | |||
1005 | mutex_lock(&adev->physical_node_lock); | ||
1006 | |||
1007 | list_for_each_entry(dep, &adev->power_dependent, node) | ||
1008 | if (dep->dev == depdev) { | ||
1009 | list_del(&dep->node); | ||
1010 | kfree(dep); | ||
1011 | break; | ||
1012 | } | ||
1013 | |||
1014 | mutex_unlock(&adev->physical_node_lock); | ||
1015 | } | ||
1016 | EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent); | ||
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index f32bd47b35e0..4fdea381ef21 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -310,8 +310,6 @@ static int dock_present(struct dock_station *ds) | |||
310 | static struct acpi_device * dock_create_acpi_device(acpi_handle handle) | 310 | static struct acpi_device * dock_create_acpi_device(acpi_handle handle) |
311 | { | 311 | { |
312 | struct acpi_device *device; | 312 | struct acpi_device *device; |
313 | struct acpi_device *parent_device; | ||
314 | acpi_handle parent; | ||
315 | int ret; | 313 | int ret; |
316 | 314 | ||
317 | if (acpi_bus_get_device(handle, &device)) { | 315 | if (acpi_bus_get_device(handle, &device)) { |
@@ -319,16 +317,11 @@ static struct acpi_device * dock_create_acpi_device(acpi_handle handle) | |||
319 | * no device created for this object, | 317 | * no device created for this object, |
320 | * so we should create one. | 318 | * so we should create one. |
321 | */ | 319 | */ |
322 | acpi_get_parent(handle, &parent); | 320 | ret = acpi_bus_scan(handle); |
323 | if (acpi_bus_get_device(parent, &parent_device)) | 321 | if (ret) |
324 | parent_device = NULL; | ||
325 | |||
326 | ret = acpi_bus_add(&device, parent_device, handle, | ||
327 | ACPI_BUS_TYPE_DEVICE); | ||
328 | if (ret) { | ||
329 | pr_debug("error adding bus, %x\n", -ret); | 322 | pr_debug("error adding bus, %x\n", -ret); |
330 | return NULL; | 323 | |
331 | } | 324 | acpi_bus_get_device(handle, &device); |
332 | } | 325 | } |
333 | return device; | 326 | return device; |
334 | } | 327 | } |
@@ -343,13 +336,9 @@ static struct acpi_device * dock_create_acpi_device(acpi_handle handle) | |||
343 | static void dock_remove_acpi_device(acpi_handle handle) | 336 | static void dock_remove_acpi_device(acpi_handle handle) |
344 | { | 337 | { |
345 | struct acpi_device *device; | 338 | struct acpi_device *device; |
346 | int ret; | ||
347 | 339 | ||
348 | if (!acpi_bus_get_device(handle, &device)) { | 340 | if (!acpi_bus_get_device(handle, &device)) |
349 | ret = acpi_bus_trim(device, 1); | 341 | acpi_bus_trim(device); |
350 | if (ret) | ||
351 | pr_debug("error removing bus, %x\n", -ret); | ||
352 | } | ||
353 | } | 342 | } |
354 | 343 | ||
355 | /** | 344 | /** |
@@ -755,7 +744,9 @@ static void acpi_dock_deferred_cb(void *context) | |||
755 | { | 744 | { |
756 | struct dock_data *data = context; | 745 | struct dock_data *data = context; |
757 | 746 | ||
747 | acpi_scan_lock_acquire(); | ||
758 | dock_notify(data->handle, data->event, data->ds); | 748 | dock_notify(data->handle, data->event, data->ds); |
749 | acpi_scan_lock_release(); | ||
759 | kfree(data); | 750 | kfree(data); |
760 | } | 751 | } |
761 | 752 | ||
@@ -768,20 +759,31 @@ static int acpi_dock_notifier_call(struct notifier_block *this, | |||
768 | if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK | 759 | if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK |
769 | && event != ACPI_NOTIFY_EJECT_REQUEST) | 760 | && event != ACPI_NOTIFY_EJECT_REQUEST) |
770 | return 0; | 761 | return 0; |
762 | |||
763 | acpi_scan_lock_acquire(); | ||
764 | |||
771 | list_for_each_entry(dock_station, &dock_stations, sibling) { | 765 | list_for_each_entry(dock_station, &dock_stations, sibling) { |
772 | if (dock_station->handle == handle) { | 766 | if (dock_station->handle == handle) { |
773 | struct dock_data *dd; | 767 | struct dock_data *dd; |
768 | acpi_status status; | ||
774 | 769 | ||
775 | dd = kmalloc(sizeof(*dd), GFP_KERNEL); | 770 | dd = kmalloc(sizeof(*dd), GFP_KERNEL); |
776 | if (!dd) | 771 | if (!dd) |
777 | return 0; | 772 | break; |
773 | |||
778 | dd->handle = handle; | 774 | dd->handle = handle; |
779 | dd->event = event; | 775 | dd->event = event; |
780 | dd->ds = dock_station; | 776 | dd->ds = dock_station; |
781 | acpi_os_hotplug_execute(acpi_dock_deferred_cb, dd); | 777 | status = acpi_os_hotplug_execute(acpi_dock_deferred_cb, |
782 | return 0 ; | 778 | dd); |
779 | if (ACPI_FAILURE(status)) | ||
780 | kfree(dd); | ||
781 | |||
782 | break; | ||
783 | } | 783 | } |
784 | } | 784 | } |
785 | |||
786 | acpi_scan_lock_release(); | ||
785 | return 0; | 787 | return 0; |
786 | } | 788 | } |
787 | 789 | ||
@@ -836,7 +838,7 @@ static ssize_t show_docked(struct device *dev, | |||
836 | 838 | ||
837 | struct dock_station *dock_station = dev->platform_data; | 839 | struct dock_station *dock_station = dev->platform_data; |
838 | 840 | ||
839 | if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp))) | 841 | if (!acpi_bus_get_device(dock_station->handle, &tmp)) |
840 | return snprintf(buf, PAGE_SIZE, "1\n"); | 842 | return snprintf(buf, PAGE_SIZE, "1\n"); |
841 | return snprintf(buf, PAGE_SIZE, "0\n"); | 843 | return snprintf(buf, PAGE_SIZE, "0\n"); |
842 | } | 844 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 354007d490d1..d45b2871d33b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -852,7 +852,7 @@ static int acpi_ec_add(struct acpi_device *device) | |||
852 | return ret; | 852 | return ret; |
853 | } | 853 | } |
854 | 854 | ||
855 | static int acpi_ec_remove(struct acpi_device *device, int type) | 855 | static int acpi_ec_remove(struct acpi_device *device) |
856 | { | 856 | { |
857 | struct acpi_ec *ec; | 857 | struct acpi_ec *ec; |
858 | struct acpi_ec_query_handler *handler, *tmp; | 858 | struct acpi_ec_query_handler *handler, *tmp; |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 3bd6a54702d6..f815da82c765 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -45,7 +45,7 @@ MODULE_DESCRIPTION("ACPI Fan Driver"); | |||
45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
46 | 46 | ||
47 | static int acpi_fan_add(struct acpi_device *device); | 47 | static int acpi_fan_add(struct acpi_device *device); |
48 | static int acpi_fan_remove(struct acpi_device *device, int type); | 48 | static int acpi_fan_remove(struct acpi_device *device); |
49 | 49 | ||
50 | static const struct acpi_device_id fan_device_ids[] = { | 50 | static const struct acpi_device_id fan_device_ids[] = { |
51 | {"PNP0C0B", 0}, | 51 | {"PNP0C0B", 0}, |
@@ -172,7 +172,7 @@ static int acpi_fan_add(struct acpi_device *device) | |||
172 | return result; | 172 | return result; |
173 | } | 173 | } |
174 | 174 | ||
175 | static int acpi_fan_remove(struct acpi_device *device, int type) | 175 | static int acpi_fan_remove(struct acpi_device *device) |
176 | { | 176 | { |
177 | struct thermal_cooling_device *cdev = acpi_driver_data(device); | 177 | struct thermal_cooling_device *cdev = acpi_driver_data(device); |
178 | 178 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 35da18113216..ef6f155469b5 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -68,6 +68,9 @@ static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type) | |||
68 | { | 68 | { |
69 | struct acpi_bus_type *tmp, *ret = NULL; | 69 | struct acpi_bus_type *tmp, *ret = NULL; |
70 | 70 | ||
71 | if (!type) | ||
72 | return NULL; | ||
73 | |||
71 | down_read(&bus_type_sem); | 74 | down_read(&bus_type_sem); |
72 | list_for_each_entry(tmp, &bus_type_list, list) { | 75 | list_for_each_entry(tmp, &bus_type_list, list) { |
73 | if (tmp->bus == type) { | 76 | if (tmp->bus == type) { |
@@ -95,40 +98,31 @@ static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) | |||
95 | return ret; | 98 | return ret; |
96 | } | 99 | } |
97 | 100 | ||
98 | /* Get device's handler per its address under its parent */ | 101 | static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, |
99 | struct acpi_find_child { | 102 | void *addr_p, void **ret_p) |
100 | acpi_handle handle; | ||
101 | u64 address; | ||
102 | }; | ||
103 | |||
104 | static acpi_status | ||
105 | do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
106 | { | 103 | { |
104 | unsigned long long addr; | ||
107 | acpi_status status; | 105 | acpi_status status; |
108 | struct acpi_device_info *info; | 106 | |
109 | struct acpi_find_child *find = context; | 107 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); |
110 | 108 | if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { | |
111 | status = acpi_get_object_info(handle, &info); | 109 | *ret_p = handle; |
112 | if (ACPI_SUCCESS(status)) { | 110 | return AE_CTRL_TERMINATE; |
113 | if ((info->address == find->address) | ||
114 | && (info->valid & ACPI_VALID_ADR)) | ||
115 | find->handle = handle; | ||
116 | kfree(info); | ||
117 | } | 111 | } |
118 | return AE_OK; | 112 | return AE_OK; |
119 | } | 113 | } |
120 | 114 | ||
121 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) | 115 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) |
122 | { | 116 | { |
123 | struct acpi_find_child find = { NULL, address }; | 117 | void *ret = NULL; |
124 | 118 | ||
125 | if (!parent) | 119 | if (!parent) |
126 | return NULL; | 120 | return NULL; |
127 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, | ||
128 | 1, do_acpi_find_child, NULL, &find, NULL); | ||
129 | return find.handle; | ||
130 | } | ||
131 | 121 | ||
122 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, | ||
123 | do_acpi_find_child, &address, &ret); | ||
124 | return (acpi_handle)ret; | ||
125 | } | ||
132 | EXPORT_SYMBOL(acpi_get_child); | 126 | EXPORT_SYMBOL(acpi_get_child); |
133 | 127 | ||
134 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | 128 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
@@ -269,28 +263,39 @@ static int acpi_platform_notify(struct device *dev) | |||
269 | { | 263 | { |
270 | struct acpi_bus_type *type; | 264 | struct acpi_bus_type *type; |
271 | acpi_handle handle; | 265 | acpi_handle handle; |
272 | int ret = -EINVAL; | 266 | int ret; |
273 | 267 | ||
274 | ret = acpi_bind_one(dev, NULL); | 268 | ret = acpi_bind_one(dev, NULL); |
275 | if (!ret) | 269 | if (ret && (!dev->bus || !dev->parent)) { |
276 | goto out; | ||
277 | |||
278 | if (!dev->bus || !dev->parent) { | ||
279 | /* bridge devices genernally haven't bus or parent */ | 270 | /* bridge devices genernally haven't bus or parent */ |
280 | ret = acpi_find_bridge_device(dev, &handle); | 271 | ret = acpi_find_bridge_device(dev, &handle); |
281 | goto end; | 272 | if (!ret) { |
273 | ret = acpi_bind_one(dev, handle); | ||
274 | if (ret) | ||
275 | goto out; | ||
276 | } | ||
282 | } | 277 | } |
278 | |||
283 | type = acpi_get_bus_type(dev->bus); | 279 | type = acpi_get_bus_type(dev->bus); |
284 | if (!type) { | 280 | if (ret) { |
285 | DBG("No ACPI bus support for %s\n", dev_name(dev)); | 281 | if (!type || !type->find_device) { |
286 | ret = -EINVAL; | 282 | DBG("No ACPI bus support for %s\n", dev_name(dev)); |
287 | goto end; | 283 | ret = -EINVAL; |
284 | goto out; | ||
285 | } | ||
286 | |||
287 | ret = type->find_device(dev, &handle); | ||
288 | if (ret) { | ||
289 | DBG("Unable to get handle for %s\n", dev_name(dev)); | ||
290 | goto out; | ||
291 | } | ||
292 | ret = acpi_bind_one(dev, handle); | ||
293 | if (ret) | ||
294 | goto out; | ||
288 | } | 295 | } |
289 | if ((ret = type->find_device(dev, &handle)) != 0) | 296 | |
290 | DBG("Can't get handler for %s\n", dev_name(dev)); | 297 | if (type && type->setup) |
291 | end: | 298 | type->setup(dev); |
292 | if (!ret) | ||
293 | acpi_bind_one(dev, handle); | ||
294 | 299 | ||
295 | out: | 300 | out: |
296 | #if ACPI_GLUE_DEBUG | 301 | #if ACPI_GLUE_DEBUG |
@@ -309,6 +314,12 @@ static int acpi_platform_notify(struct device *dev) | |||
309 | 314 | ||
310 | static int acpi_platform_notify_remove(struct device *dev) | 315 | static int acpi_platform_notify_remove(struct device *dev) |
311 | { | 316 | { |
317 | struct acpi_bus_type *type; | ||
318 | |||
319 | type = acpi_get_bus_type(dev->bus); | ||
320 | if (type && type->cleanup) | ||
321 | type->cleanup(dev); | ||
322 | |||
312 | acpi_unbind_one(dev); | 323 | acpi_unbind_one(dev); |
313 | return 0; | 324 | return 0; |
314 | } | 325 | } |
diff --git a/drivers/acpi/hed.c b/drivers/acpi/hed.c index a0cc796932f7..13b1d39d7cdf 100644 --- a/drivers/acpi/hed.c +++ b/drivers/acpi/hed.c | |||
@@ -70,7 +70,7 @@ static int acpi_hed_add(struct acpi_device *device) | |||
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | static int acpi_hed_remove(struct acpi_device *device, int type) | 73 | static int acpi_hed_remove(struct acpi_device *device) |
74 | { | 74 | { |
75 | hed_handle = NULL; | 75 | hed_handle = NULL; |
76 | return 0; | 76 | return 0; |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 3c407cdc1ec1..79092328cf06 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -25,7 +25,16 @@ | |||
25 | 25 | ||
26 | int init_acpi_device_notify(void); | 26 | int init_acpi_device_notify(void); |
27 | int acpi_scan_init(void); | 27 | int acpi_scan_init(void); |
28 | void acpi_pci_root_init(void); | ||
29 | void acpi_pci_link_init(void); | ||
30 | void acpi_platform_init(void); | ||
28 | int acpi_sysfs_init(void); | 31 | int acpi_sysfs_init(void); |
32 | void acpi_csrt_init(void); | ||
33 | #ifdef CONFIG_ACPI_CONTAINER | ||
34 | void acpi_container_init(void); | ||
35 | #else | ||
36 | static inline void acpi_container_init(void) {} | ||
37 | #endif | ||
29 | 38 | ||
30 | #ifdef CONFIG_DEBUG_FS | 39 | #ifdef CONFIG_DEBUG_FS |
31 | extern struct dentry *acpi_debugfs_dir; | 40 | extern struct dentry *acpi_debugfs_dir; |
@@ -35,15 +44,33 @@ static inline void acpi_debugfs_init(void) { return; } | |||
35 | #endif | 44 | #endif |
36 | 45 | ||
37 | /* -------------------------------------------------------------------------- | 46 | /* -------------------------------------------------------------------------- |
47 | Device Node Initialization / Removal | ||
48 | -------------------------------------------------------------------------- */ | ||
49 | #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ | ||
50 | ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) | ||
51 | |||
52 | int acpi_device_add(struct acpi_device *device, | ||
53 | void (*release)(struct device *)); | ||
54 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | ||
55 | int type, unsigned long long sta); | ||
56 | void acpi_device_add_finalize(struct acpi_device *device); | ||
57 | void acpi_free_ids(struct acpi_device *device); | ||
58 | |||
59 | /* -------------------------------------------------------------------------- | ||
38 | Power Resource | 60 | Power Resource |
39 | -------------------------------------------------------------------------- */ | 61 | -------------------------------------------------------------------------- */ |
40 | int acpi_power_init(void); | 62 | int acpi_power_init(void); |
63 | void acpi_power_resources_list_free(struct list_head *list); | ||
64 | int acpi_extract_power_resources(union acpi_object *package, unsigned int start, | ||
65 | struct list_head *list); | ||
66 | int acpi_add_power_resource(acpi_handle handle); | ||
67 | void acpi_power_add_remove_device(struct acpi_device *adev, bool add); | ||
68 | int acpi_power_min_system_level(struct list_head *list); | ||
41 | int acpi_device_sleep_wake(struct acpi_device *dev, | 69 | int acpi_device_sleep_wake(struct acpi_device *dev, |
42 | int enable, int sleep_state, int dev_state); | 70 | int enable, int sleep_state, int dev_state); |
43 | int acpi_power_get_inferred_state(struct acpi_device *device, int *state); | 71 | int acpi_power_get_inferred_state(struct acpi_device *device, int *state); |
44 | int acpi_power_on_resources(struct acpi_device *device, int state); | 72 | int acpi_power_on_resources(struct acpi_device *device, int state); |
45 | int acpi_power_transition(struct acpi_device *device, int state); | 73 | int acpi_power_transition(struct acpi_device *device, int state); |
46 | int acpi_bus_init_power(struct acpi_device *device); | ||
47 | 74 | ||
48 | int acpi_wakeup_device_init(void); | 75 | int acpi_wakeup_device_init(void); |
49 | void acpi_early_processor_set_pdc(void); | 76 | void acpi_early_processor_set_pdc(void); |
@@ -98,6 +125,4 @@ static inline void suspend_nvs_restore(void) {} | |||
98 | -------------------------------------------------------------------------- */ | 125 | -------------------------------------------------------------------------- */ |
99 | struct platform_device; | 126 | struct platform_device; |
100 | 127 | ||
101 | struct platform_device *acpi_create_platform_device(struct acpi_device *adev); | ||
102 | |||
103 | #endif /* _ACPI_INTERNAL_H_ */ | 128 | #endif /* _ACPI_INTERNAL_H_ */ |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index cb31298ca684..33e609f63585 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -116,14 +116,16 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) | |||
116 | struct acpi_srat_mem_affinity *p = | 116 | struct acpi_srat_mem_affinity *p = |
117 | (struct acpi_srat_mem_affinity *)header; | 117 | (struct acpi_srat_mem_affinity *)header; |
118 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 118 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
119 | "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s\n", | 119 | "SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n", |
120 | (unsigned long)p->base_address, | 120 | (unsigned long)p->base_address, |
121 | (unsigned long)p->length, | 121 | (unsigned long)p->length, |
122 | p->proximity_domain, | 122 | p->proximity_domain, |
123 | (p->flags & ACPI_SRAT_MEM_ENABLED)? | 123 | (p->flags & ACPI_SRAT_MEM_ENABLED)? |
124 | "enabled" : "disabled", | 124 | "enabled" : "disabled", |
125 | (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)? | 125 | (p->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)? |
126 | " hot-pluggable" : "")); | 126 | " hot-pluggable" : "", |
127 | (p->flags & ACPI_SRAT_MEM_NON_VOLATILE)? | ||
128 | " non-volatile" : "")); | ||
127 | } | 129 | } |
128 | #endif /* ACPI_DEBUG_OUTPUT */ | 130 | #endif /* ACPI_DEBUG_OUTPUT */ |
129 | break; | 131 | break; |
@@ -273,7 +275,7 @@ static int __init acpi_parse_srat(struct acpi_table_header *table) | |||
273 | 275 | ||
274 | static int __init | 276 | static int __init |
275 | acpi_table_parse_srat(enum acpi_srat_type id, | 277 | acpi_table_parse_srat(enum acpi_srat_type id, |
276 | acpi_table_entry_handler handler, unsigned int max_entries) | 278 | acpi_tbl_entry_handler handler, unsigned int max_entries) |
277 | { | 279 | { |
278 | return acpi_table_parse_entries(ACPI_SIG_SRAT, | 280 | return acpi_table_parse_entries(ACPI_SIG_SRAT, |
279 | sizeof(struct acpi_table_srat), id, | 281 | sizeof(struct acpi_table_srat), id, |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 3adeb10ff3ec..908b02d5da1b 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -250,7 +250,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void) | |||
250 | return acpi_rsdp; | 250 | return acpi_rsdp; |
251 | #endif | 251 | #endif |
252 | 252 | ||
253 | if (efi_enabled) { | 253 | if (efi_enabled(EFI_CONFIG_TABLES)) { |
254 | if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) | 254 | if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) |
255 | return efi.acpi20; | 255 | return efi.acpi20; |
256 | else if (efi.acpi != EFI_INVALID_TABLE_ADDR) | 256 | else if (efi.acpi != EFI_INVALID_TABLE_ADDR) |
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c deleted file mode 100644 index a1dee29beed3..000000000000 --- a/drivers/acpi/pci_bind.c +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* | ||
2 | * pci_bind.c - ACPI PCI Device Binding ($Revision: 2 $) | ||
3 | * | ||
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | ||
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
6 | * | ||
7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or (at | ||
12 | * your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
21 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
22 | * | ||
23 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
24 | */ | ||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/pci.h> | ||
29 | #include <linux/pci-acpi.h> | ||
30 | #include <linux/acpi.h> | ||
31 | #include <linux/pm_runtime.h> | ||
32 | #include <acpi/acpi_bus.h> | ||
33 | #include <acpi/acpi_drivers.h> | ||
34 | |||
35 | #define _COMPONENT ACPI_PCI_COMPONENT | ||
36 | ACPI_MODULE_NAME("pci_bind"); | ||
37 | |||
38 | static int acpi_pci_unbind(struct acpi_device *device) | ||
39 | { | ||
40 | struct pci_dev *dev; | ||
41 | |||
42 | dev = acpi_get_pci_dev(device->handle); | ||
43 | if (!dev) | ||
44 | goto out; | ||
45 | |||
46 | device_set_run_wake(&dev->dev, false); | ||
47 | pci_acpi_remove_pm_notifier(device); | ||
48 | acpi_power_resource_unregister_device(&dev->dev, device->handle); | ||
49 | |||
50 | if (!dev->subordinate) | ||
51 | goto out; | ||
52 | |||
53 | acpi_pci_irq_del_prt(pci_domain_nr(dev->bus), dev->subordinate->number); | ||
54 | |||
55 | device->ops.bind = NULL; | ||
56 | device->ops.unbind = NULL; | ||
57 | |||
58 | out: | ||
59 | pci_dev_put(dev); | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int acpi_pci_bind(struct acpi_device *device) | ||
64 | { | ||
65 | acpi_status status; | ||
66 | acpi_handle handle; | ||
67 | unsigned char bus; | ||
68 | struct pci_dev *dev; | ||
69 | |||
70 | dev = acpi_get_pci_dev(device->handle); | ||
71 | if (!dev) | ||
72 | return 0; | ||
73 | |||
74 | pci_acpi_add_pm_notifier(device, dev); | ||
75 | acpi_power_resource_register_device(&dev->dev, device->handle); | ||
76 | if (device->wakeup.flags.run_wake) | ||
77 | device_set_run_wake(&dev->dev, true); | ||
78 | |||
79 | /* | ||
80 | * Install the 'bind' function to facilitate callbacks for | ||
81 | * children of the P2P bridge. | ||
82 | */ | ||
83 | if (dev->subordinate) { | ||
84 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
85 | "Device %04x:%02x:%02x.%d is a PCI bridge\n", | ||
86 | pci_domain_nr(dev->bus), dev->bus->number, | ||
87 | PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn))); | ||
88 | device->ops.bind = acpi_pci_bind; | ||
89 | device->ops.unbind = acpi_pci_unbind; | ||
90 | } | ||
91 | |||
92 | /* | ||
93 | * Evaluate and parse _PRT, if exists. This code allows parsing of | ||
94 | * _PRT objects within the scope of non-bridge devices. Note that | ||
95 | * _PRTs within the scope of a PCI bridge assume the bridge's | ||
96 | * subordinate bus number. | ||
97 | * | ||
98 | * TBD: Can _PRTs exist within the scope of non-bridge PCI devices? | ||
99 | */ | ||
100 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); | ||
101 | if (ACPI_FAILURE(status)) | ||
102 | goto out; | ||
103 | |||
104 | if (dev->subordinate) | ||
105 | bus = dev->subordinate->number; | ||
106 | else | ||
107 | bus = dev->bus->number; | ||
108 | |||
109 | acpi_pci_irq_add_prt(device->handle, pci_domain_nr(dev->bus), bus); | ||
110 | |||
111 | out: | ||
112 | pci_dev_put(dev); | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | int acpi_pci_bind_root(struct acpi_device *device) | ||
117 | { | ||
118 | device->ops.bind = acpi_pci_bind; | ||
119 | device->ops.unbind = acpi_pci_unbind; | ||
120 | |||
121 | return 0; | ||
122 | } | ||
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index a12808259dfb..ab764ed34a50 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -53,23 +53,19 @@ ACPI_MODULE_NAME("pci_link"); | |||
53 | #define ACPI_PCI_LINK_FILE_STATUS "state" | 53 | #define ACPI_PCI_LINK_FILE_STATUS "state" |
54 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 | 54 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 |
55 | 55 | ||
56 | static int acpi_pci_link_add(struct acpi_device *device); | 56 | static int acpi_pci_link_add(struct acpi_device *device, |
57 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 57 | const struct acpi_device_id *not_used); |
58 | static void acpi_pci_link_remove(struct acpi_device *device); | ||
58 | 59 | ||
59 | static const struct acpi_device_id link_device_ids[] = { | 60 | static const struct acpi_device_id link_device_ids[] = { |
60 | {"PNP0C0F", 0}, | 61 | {"PNP0C0F", 0}, |
61 | {"", 0}, | 62 | {"", 0}, |
62 | }; | 63 | }; |
63 | MODULE_DEVICE_TABLE(acpi, link_device_ids); | ||
64 | 64 | ||
65 | static struct acpi_driver acpi_pci_link_driver = { | 65 | static struct acpi_scan_handler pci_link_handler = { |
66 | .name = "pci_link", | ||
67 | .class = ACPI_PCI_LINK_CLASS, | ||
68 | .ids = link_device_ids, | 66 | .ids = link_device_ids, |
69 | .ops = { | 67 | .attach = acpi_pci_link_add, |
70 | .add = acpi_pci_link_add, | 68 | .detach = acpi_pci_link_remove, |
71 | .remove = acpi_pci_link_remove, | ||
72 | }, | ||
73 | }; | 69 | }; |
74 | 70 | ||
75 | /* | 71 | /* |
@@ -692,7 +688,8 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
692 | Driver Interface | 688 | Driver Interface |
693 | -------------------------------------------------------------------------- */ | 689 | -------------------------------------------------------------------------- */ |
694 | 690 | ||
695 | static int acpi_pci_link_add(struct acpi_device *device) | 691 | static int acpi_pci_link_add(struct acpi_device *device, |
692 | const struct acpi_device_id *not_used) | ||
696 | { | 693 | { |
697 | int result; | 694 | int result; |
698 | struct acpi_pci_link *link; | 695 | struct acpi_pci_link *link; |
@@ -746,7 +743,7 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
746 | if (result) | 743 | if (result) |
747 | kfree(link); | 744 | kfree(link); |
748 | 745 | ||
749 | return result; | 746 | return result < 0 ? result : 1; |
750 | } | 747 | } |
751 | 748 | ||
752 | static int acpi_pci_link_resume(struct acpi_pci_link *link) | 749 | static int acpi_pci_link_resume(struct acpi_pci_link *link) |
@@ -766,7 +763,7 @@ static void irqrouter_resume(void) | |||
766 | } | 763 | } |
767 | } | 764 | } |
768 | 765 | ||
769 | static int acpi_pci_link_remove(struct acpi_device *device, int type) | 766 | static void acpi_pci_link_remove(struct acpi_device *device) |
770 | { | 767 | { |
771 | struct acpi_pci_link *link; | 768 | struct acpi_pci_link *link; |
772 | 769 | ||
@@ -777,7 +774,6 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) | |||
777 | mutex_unlock(&acpi_link_lock); | 774 | mutex_unlock(&acpi_link_lock); |
778 | 775 | ||
779 | kfree(link); | 776 | kfree(link); |
780 | return 0; | ||
781 | } | 777 | } |
782 | 778 | ||
783 | /* | 779 | /* |
@@ -874,20 +870,10 @@ static struct syscore_ops irqrouter_syscore_ops = { | |||
874 | .resume = irqrouter_resume, | 870 | .resume = irqrouter_resume, |
875 | }; | 871 | }; |
876 | 872 | ||
877 | static int __init irqrouter_init_ops(void) | 873 | void __init acpi_pci_link_init(void) |
878 | { | ||
879 | if (!acpi_disabled && !acpi_noirq) | ||
880 | register_syscore_ops(&irqrouter_syscore_ops); | ||
881 | |||
882 | return 0; | ||
883 | } | ||
884 | |||
885 | device_initcall(irqrouter_init_ops); | ||
886 | |||
887 | static int __init acpi_pci_link_init(void) | ||
888 | { | 874 | { |
889 | if (acpi_noirq) | 875 | if (acpi_noirq) |
890 | return 0; | 876 | return; |
891 | 877 | ||
892 | if (acpi_irq_balance == -1) { | 878 | if (acpi_irq_balance == -1) { |
893 | /* no command line switch: enable balancing in IOAPIC mode */ | 879 | /* no command line switch: enable balancing in IOAPIC mode */ |
@@ -896,11 +882,6 @@ static int __init acpi_pci_link_init(void) | |||
896 | else | 882 | else |
897 | acpi_irq_balance = 0; | 883 | acpi_irq_balance = 0; |
898 | } | 884 | } |
899 | 885 | register_syscore_ops(&irqrouter_syscore_ops); | |
900 | if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) | 886 | acpi_scan_add_handler(&pci_link_handler); |
901 | return -ENODEV; | ||
902 | |||
903 | return 0; | ||
904 | } | 887 | } |
905 | |||
906 | subsys_initcall(acpi_pci_link_init); | ||
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 7928d4dc7056..b3cc69c5caf1 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -45,9 +45,9 @@ | |||
45 | ACPI_MODULE_NAME("pci_root"); | 45 | ACPI_MODULE_NAME("pci_root"); |
46 | #define ACPI_PCI_ROOT_CLASS "pci_bridge" | 46 | #define ACPI_PCI_ROOT_CLASS "pci_bridge" |
47 | #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" | 47 | #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" |
48 | static int acpi_pci_root_add(struct acpi_device *device); | 48 | static int acpi_pci_root_add(struct acpi_device *device, |
49 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 49 | const struct acpi_device_id *not_used); |
50 | static int acpi_pci_root_start(struct acpi_device *device); | 50 | static void acpi_pci_root_remove(struct acpi_device *device); |
51 | 51 | ||
52 | #define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ | 52 | #define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ |
53 | | OSC_ACTIVE_STATE_PWR_SUPPORT \ | 53 | | OSC_ACTIVE_STATE_PWR_SUPPORT \ |
@@ -58,17 +58,11 @@ static const struct acpi_device_id root_device_ids[] = { | |||
58 | {"PNP0A03", 0}, | 58 | {"PNP0A03", 0}, |
59 | {"", 0}, | 59 | {"", 0}, |
60 | }; | 60 | }; |
61 | MODULE_DEVICE_TABLE(acpi, root_device_ids); | ||
62 | 61 | ||
63 | static struct acpi_driver acpi_pci_root_driver = { | 62 | static struct acpi_scan_handler pci_root_handler = { |
64 | .name = "pci_root", | ||
65 | .class = ACPI_PCI_ROOT_CLASS, | ||
66 | .ids = root_device_ids, | 63 | .ids = root_device_ids, |
67 | .ops = { | 64 | .attach = acpi_pci_root_add, |
68 | .add = acpi_pci_root_add, | 65 | .detach = acpi_pci_root_remove, |
69 | .remove = acpi_pci_root_remove, | ||
70 | .start = acpi_pci_root_start, | ||
71 | }, | ||
72 | }; | 66 | }; |
73 | 67 | ||
74 | /* Lock to protect both acpi_pci_roots and acpi_pci_drivers lists */ | 68 | /* Lock to protect both acpi_pci_roots and acpi_pci_drivers lists */ |
@@ -188,21 +182,6 @@ static acpi_status try_get_root_bridge_busnr(acpi_handle handle, | |||
188 | return AE_OK; | 182 | return AE_OK; |
189 | } | 183 | } |
190 | 184 | ||
191 | static void acpi_pci_bridge_scan(struct acpi_device *device) | ||
192 | { | ||
193 | int status; | ||
194 | struct acpi_device *child = NULL; | ||
195 | |||
196 | if (device->flags.bus_address) | ||
197 | if (device->parent && device->parent->ops.bind) { | ||
198 | status = device->parent->ops.bind(device); | ||
199 | if (!status) { | ||
200 | list_for_each_entry(child, &device->children, node) | ||
201 | acpi_pci_bridge_scan(child); | ||
202 | } | ||
203 | } | ||
204 | } | ||
205 | |||
206 | static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766"; | 185 | static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766"; |
207 | 186 | ||
208 | static acpi_status acpi_pci_run_osc(acpi_handle handle, | 187 | static acpi_status acpi_pci_run_osc(acpi_handle handle, |
@@ -445,14 +424,15 @@ out: | |||
445 | } | 424 | } |
446 | EXPORT_SYMBOL(acpi_pci_osc_control_set); | 425 | EXPORT_SYMBOL(acpi_pci_osc_control_set); |
447 | 426 | ||
448 | static int acpi_pci_root_add(struct acpi_device *device) | 427 | static int acpi_pci_root_add(struct acpi_device *device, |
428 | const struct acpi_device_id *not_used) | ||
449 | { | 429 | { |
450 | unsigned long long segment, bus; | 430 | unsigned long long segment, bus; |
451 | acpi_status status; | 431 | acpi_status status; |
452 | int result; | 432 | int result; |
453 | struct acpi_pci_root *root; | 433 | struct acpi_pci_root *root; |
454 | acpi_handle handle; | 434 | acpi_handle handle; |
455 | struct acpi_device *child; | 435 | struct acpi_pci_driver *driver; |
456 | u32 flags, base_flags; | 436 | u32 flags, base_flags; |
457 | bool is_osc_granted = false; | 437 | bool is_osc_granted = false; |
458 | 438 | ||
@@ -603,21 +583,6 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
603 | goto out_del_root; | 583 | goto out_del_root; |
604 | } | 584 | } |
605 | 585 | ||
606 | /* | ||
607 | * Attach ACPI-PCI Context | ||
608 | * ----------------------- | ||
609 | * Thus binding the ACPI and PCI devices. | ||
610 | */ | ||
611 | result = acpi_pci_bind_root(device); | ||
612 | if (result) | ||
613 | goto out_del_root; | ||
614 | |||
615 | /* | ||
616 | * Scan and bind all _ADR-Based Devices | ||
617 | */ | ||
618 | list_for_each_entry(child, &device->children, node) | ||
619 | acpi_pci_bridge_scan(child); | ||
620 | |||
621 | /* ASPM setting */ | 586 | /* ASPM setting */ |
622 | if (is_osc_granted) { | 587 | if (is_osc_granted) { |
623 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) | 588 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) |
@@ -632,24 +597,6 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
632 | if (device->wakeup.flags.run_wake) | 597 | if (device->wakeup.flags.run_wake) |
633 | device_set_run_wake(root->bus->bridge, true); | 598 | device_set_run_wake(root->bus->bridge, true); |
634 | 599 | ||
635 | return 0; | ||
636 | |||
637 | out_del_root: | ||
638 | mutex_lock(&acpi_pci_root_lock); | ||
639 | list_del(&root->node); | ||
640 | mutex_unlock(&acpi_pci_root_lock); | ||
641 | |||
642 | acpi_pci_irq_del_prt(root->segment, root->secondary.start); | ||
643 | end: | ||
644 | kfree(root); | ||
645 | return result; | ||
646 | } | ||
647 | |||
648 | static int acpi_pci_root_start(struct acpi_device *device) | ||
649 | { | ||
650 | struct acpi_pci_root *root = acpi_driver_data(device); | ||
651 | struct acpi_pci_driver *driver; | ||
652 | |||
653 | if (system_state != SYSTEM_BOOTING) | 600 | if (system_state != SYSTEM_BOOTING) |
654 | pci_assign_unassigned_bus_resources(root->bus); | 601 | pci_assign_unassigned_bus_resources(root->bus); |
655 | 602 | ||
@@ -664,11 +611,20 @@ static int acpi_pci_root_start(struct acpi_device *device) | |||
664 | pci_enable_bridges(root->bus); | 611 | pci_enable_bridges(root->bus); |
665 | 612 | ||
666 | pci_bus_add_devices(root->bus); | 613 | pci_bus_add_devices(root->bus); |
614 | return 1; | ||
667 | 615 | ||
668 | return 0; | 616 | out_del_root: |
617 | mutex_lock(&acpi_pci_root_lock); | ||
618 | list_del(&root->node); | ||
619 | mutex_unlock(&acpi_pci_root_lock); | ||
620 | |||
621 | acpi_pci_irq_del_prt(root->segment, root->secondary.start); | ||
622 | end: | ||
623 | kfree(root); | ||
624 | return result; | ||
669 | } | 625 | } |
670 | 626 | ||
671 | static int acpi_pci_root_remove(struct acpi_device *device, int type) | 627 | static void acpi_pci_root_remove(struct acpi_device *device) |
672 | { | 628 | { |
673 | acpi_status status; | 629 | acpi_status status; |
674 | acpi_handle handle; | 630 | acpi_handle handle; |
@@ -696,21 +652,14 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) | |||
696 | list_del(&root->node); | 652 | list_del(&root->node); |
697 | mutex_unlock(&acpi_pci_root_lock); | 653 | mutex_unlock(&acpi_pci_root_lock); |
698 | kfree(root); | 654 | kfree(root); |
699 | return 0; | ||
700 | } | 655 | } |
701 | 656 | ||
702 | static int __init acpi_pci_root_init(void) | 657 | void __init acpi_pci_root_init(void) |
703 | { | 658 | { |
704 | acpi_hest_init(); | 659 | acpi_hest_init(); |
705 | 660 | ||
706 | if (acpi_pci_disabled) | 661 | if (!acpi_pci_disabled) { |
707 | return 0; | 662 | pci_acpi_crs_quirks(); |
708 | 663 | acpi_scan_add_handler(&pci_root_handler); | |
709 | pci_acpi_crs_quirks(); | 664 | } |
710 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) | ||
711 | return -ENODEV; | ||
712 | |||
713 | return 0; | ||
714 | } | 665 | } |
715 | |||
716 | subsys_initcall(acpi_pci_root_init); | ||
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c index d22585f21aeb..2c630c006c2f 100644 --- a/drivers/acpi/pci_slot.c +++ b/drivers/acpi/pci_slot.c | |||
@@ -50,13 +50,12 @@ module_param(debug, bool, 0644); | |||
50 | ACPI_MODULE_NAME("pci_slot"); | 50 | ACPI_MODULE_NAME("pci_slot"); |
51 | 51 | ||
52 | #define MY_NAME "pci_slot" | 52 | #define MY_NAME "pci_slot" |
53 | #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) | 53 | #define err(format, arg...) pr_err("%s: " format , MY_NAME , ## arg) |
54 | #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) | 54 | #define info(format, arg...) pr_info("%s: " format , MY_NAME , ## arg) |
55 | #define dbg(format, arg...) \ | 55 | #define dbg(format, arg...) \ |
56 | do { \ | 56 | do { \ |
57 | if (debug) \ | 57 | if (debug) \ |
58 | printk(KERN_DEBUG "%s: " format, \ | 58 | pr_debug("%s: " format, MY_NAME , ## arg); \ |
59 | MY_NAME , ## arg); \ | ||
60 | } while (0) | 59 | } while (0) |
61 | 60 | ||
62 | #define SLOT_NAME_SIZE 21 /* Inspired by #define in acpiphp.h */ | 61 | #define SLOT_NAME_SIZE 21 /* Inspired by #define in acpiphp.h */ |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 6e7b9d523812..b820528a5fa3 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/types.h> | 41 | #include <linux/types.h> |
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <linux/pm_runtime.h> | 43 | #include <linux/pm_runtime.h> |
44 | #include <linux/sysfs.h> | ||
44 | #include <acpi/acpi_bus.h> | 45 | #include <acpi/acpi_bus.h> |
45 | #include <acpi/acpi_drivers.h> | 46 | #include <acpi/acpi_drivers.h> |
46 | #include "sleep.h" | 47 | #include "sleep.h" |
@@ -58,88 +59,121 @@ ACPI_MODULE_NAME("power"); | |||
58 | #define ACPI_POWER_RESOURCE_STATE_ON 0x01 | 59 | #define ACPI_POWER_RESOURCE_STATE_ON 0x01 |
59 | #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF | 60 | #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF |
60 | 61 | ||
61 | static int acpi_power_add(struct acpi_device *device); | 62 | struct acpi_power_dependent_device { |
62 | static int acpi_power_remove(struct acpi_device *device, int type); | 63 | struct list_head node; |
63 | 64 | struct acpi_device *adev; | |
64 | static const struct acpi_device_id power_device_ids[] = { | 65 | struct work_struct work; |
65 | {ACPI_POWER_HID, 0}, | ||
66 | {"", 0}, | ||
67 | }; | ||
68 | MODULE_DEVICE_TABLE(acpi, power_device_ids); | ||
69 | |||
70 | #ifdef CONFIG_PM_SLEEP | ||
71 | static int acpi_power_resume(struct device *dev); | ||
72 | #endif | ||
73 | static SIMPLE_DEV_PM_OPS(acpi_power_pm, NULL, acpi_power_resume); | ||
74 | |||
75 | static struct acpi_driver acpi_power_driver = { | ||
76 | .name = "power", | ||
77 | .class = ACPI_POWER_CLASS, | ||
78 | .ids = power_device_ids, | ||
79 | .ops = { | ||
80 | .add = acpi_power_add, | ||
81 | .remove = acpi_power_remove, | ||
82 | }, | ||
83 | .drv.pm = &acpi_power_pm, | ||
84 | }; | ||
85 | |||
86 | /* | ||
87 | * A power managed device | ||
88 | * A device may rely on multiple power resources. | ||
89 | * */ | ||
90 | struct acpi_power_managed_device { | ||
91 | struct device *dev; /* The physical device */ | ||
92 | acpi_handle *handle; | ||
93 | }; | ||
94 | |||
95 | struct acpi_power_resource_device { | ||
96 | struct acpi_power_managed_device *device; | ||
97 | struct acpi_power_resource_device *next; | ||
98 | }; | 66 | }; |
99 | 67 | ||
100 | struct acpi_power_resource { | 68 | struct acpi_power_resource { |
101 | struct acpi_device * device; | 69 | struct acpi_device device; |
102 | acpi_bus_id name; | 70 | struct list_head list_node; |
71 | struct list_head dependent; | ||
72 | char *name; | ||
103 | u32 system_level; | 73 | u32 system_level; |
104 | u32 order; | 74 | u32 order; |
105 | unsigned int ref_count; | 75 | unsigned int ref_count; |
106 | struct mutex resource_lock; | 76 | struct mutex resource_lock; |
77 | }; | ||
107 | 78 | ||
108 | /* List of devices relying on this power resource */ | 79 | struct acpi_power_resource_entry { |
109 | struct acpi_power_resource_device *devices; | 80 | struct list_head node; |
110 | struct mutex devices_lock; | 81 | struct acpi_power_resource *resource; |
111 | }; | 82 | }; |
112 | 83 | ||
113 | static struct list_head acpi_power_resource_list; | 84 | static LIST_HEAD(acpi_power_resource_list); |
85 | static DEFINE_MUTEX(power_resource_list_lock); | ||
114 | 86 | ||
115 | /* -------------------------------------------------------------------------- | 87 | /* -------------------------------------------------------------------------- |
116 | Power Resource Management | 88 | Power Resource Management |
117 | -------------------------------------------------------------------------- */ | 89 | -------------------------------------------------------------------------- */ |
118 | 90 | ||
119 | static int | 91 | static inline |
120 | acpi_power_get_context(acpi_handle handle, | 92 | struct acpi_power_resource *to_power_resource(struct acpi_device *device) |
121 | struct acpi_power_resource **resource) | ||
122 | { | 93 | { |
123 | int result = 0; | 94 | return container_of(device, struct acpi_power_resource, device); |
124 | struct acpi_device *device = NULL; | 95 | } |
96 | |||
97 | static struct acpi_power_resource *acpi_power_get_context(acpi_handle handle) | ||
98 | { | ||
99 | struct acpi_device *device; | ||
125 | 100 | ||
101 | if (acpi_bus_get_device(handle, &device)) | ||
102 | return NULL; | ||
126 | 103 | ||
127 | if (!resource) | 104 | return to_power_resource(device); |
128 | return -ENODEV; | 105 | } |
129 | 106 | ||
130 | result = acpi_bus_get_device(handle, &device); | 107 | static int acpi_power_resources_list_add(acpi_handle handle, |
131 | if (result) { | 108 | struct list_head *list) |
132 | printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle); | 109 | { |
133 | return result; | 110 | struct acpi_power_resource *resource = acpi_power_get_context(handle); |
134 | } | 111 | struct acpi_power_resource_entry *entry; |
135 | 112 | ||
136 | *resource = acpi_driver_data(device); | 113 | if (!resource || !list) |
137 | if (!*resource) | 114 | return -EINVAL; |
138 | return -ENODEV; | 115 | |
116 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | ||
117 | if (!entry) | ||
118 | return -ENOMEM; | ||
119 | |||
120 | entry->resource = resource; | ||
121 | if (!list_empty(list)) { | ||
122 | struct acpi_power_resource_entry *e; | ||
139 | 123 | ||
124 | list_for_each_entry(e, list, node) | ||
125 | if (e->resource->order > resource->order) { | ||
126 | list_add_tail(&entry->node, &e->node); | ||
127 | return 0; | ||
128 | } | ||
129 | } | ||
130 | list_add_tail(&entry->node, list); | ||
140 | return 0; | 131 | return 0; |
141 | } | 132 | } |
142 | 133 | ||
134 | void acpi_power_resources_list_free(struct list_head *list) | ||
135 | { | ||
136 | struct acpi_power_resource_entry *entry, *e; | ||
137 | |||
138 | list_for_each_entry_safe(entry, e, list, node) { | ||
139 | list_del(&entry->node); | ||
140 | kfree(entry); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | int acpi_extract_power_resources(union acpi_object *package, unsigned int start, | ||
145 | struct list_head *list) | ||
146 | { | ||
147 | unsigned int i; | ||
148 | int err = 0; | ||
149 | |||
150 | for (i = start; i < package->package.count; i++) { | ||
151 | union acpi_object *element = &package->package.elements[i]; | ||
152 | acpi_handle rhandle; | ||
153 | |||
154 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { | ||
155 | err = -ENODATA; | ||
156 | break; | ||
157 | } | ||
158 | rhandle = element->reference.handle; | ||
159 | if (!rhandle) { | ||
160 | err = -ENODEV; | ||
161 | break; | ||
162 | } | ||
163 | err = acpi_add_power_resource(rhandle); | ||
164 | if (err) | ||
165 | break; | ||
166 | |||
167 | err = acpi_power_resources_list_add(rhandle, list); | ||
168 | if (err) | ||
169 | break; | ||
170 | } | ||
171 | if (err) | ||
172 | acpi_power_resources_list_free(list); | ||
173 | |||
174 | return err; | ||
175 | } | ||
176 | |||
143 | static int acpi_power_get_state(acpi_handle handle, int *state) | 177 | static int acpi_power_get_state(acpi_handle handle, int *state) |
144 | { | 178 | { |
145 | acpi_status status = AE_OK; | 179 | acpi_status status = AE_OK; |
@@ -167,31 +201,23 @@ static int acpi_power_get_state(acpi_handle handle, int *state) | |||
167 | return 0; | 201 | return 0; |
168 | } | 202 | } |
169 | 203 | ||
170 | static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | 204 | static int acpi_power_get_list_state(struct list_head *list, int *state) |
171 | { | 205 | { |
206 | struct acpi_power_resource_entry *entry; | ||
172 | int cur_state; | 207 | int cur_state; |
173 | int i = 0; | ||
174 | 208 | ||
175 | if (!list || !state) | 209 | if (!list || !state) |
176 | return -EINVAL; | 210 | return -EINVAL; |
177 | 211 | ||
178 | /* The state of the list is 'on' IFF all resources are 'on'. */ | 212 | /* The state of the list is 'on' IFF all resources are 'on'. */ |
179 | 213 | list_for_each_entry(entry, list, node) { | |
180 | for (i = 0; i < list->count; i++) { | 214 | struct acpi_power_resource *resource = entry->resource; |
181 | struct acpi_power_resource *resource; | 215 | acpi_handle handle = resource->device.handle; |
182 | acpi_handle handle = list->handles[i]; | ||
183 | int result; | 216 | int result; |
184 | 217 | ||
185 | result = acpi_power_get_context(handle, &resource); | ||
186 | if (result) | ||
187 | return result; | ||
188 | |||
189 | mutex_lock(&resource->resource_lock); | 218 | mutex_lock(&resource->resource_lock); |
190 | |||
191 | result = acpi_power_get_state(handle, &cur_state); | 219 | result = acpi_power_get_state(handle, &cur_state); |
192 | |||
193 | mutex_unlock(&resource->resource_lock); | 220 | mutex_unlock(&resource->resource_lock); |
194 | |||
195 | if (result) | 221 | if (result) |
196 | return result; | 222 | return result; |
197 | 223 | ||
@@ -203,54 +229,52 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | |||
203 | cur_state ? "on" : "off")); | 229 | cur_state ? "on" : "off")); |
204 | 230 | ||
205 | *state = cur_state; | 231 | *state = cur_state; |
206 | |||
207 | return 0; | 232 | return 0; |
208 | } | 233 | } |
209 | 234 | ||
210 | /* Resume the device when all power resources in _PR0 are on */ | 235 | static void acpi_power_resume_dependent(struct work_struct *work) |
211 | static void acpi_power_on_device(struct acpi_power_managed_device *device) | ||
212 | { | 236 | { |
213 | struct acpi_device *acpi_dev; | 237 | struct acpi_power_dependent_device *dep; |
214 | acpi_handle handle = device->handle; | 238 | struct acpi_device_physical_node *pn; |
239 | struct acpi_device *adev; | ||
215 | int state; | 240 | int state; |
216 | 241 | ||
217 | if (acpi_bus_get_device(handle, &acpi_dev)) | 242 | dep = container_of(work, struct acpi_power_dependent_device, work); |
243 | adev = dep->adev; | ||
244 | if (acpi_power_get_inferred_state(adev, &state)) | ||
218 | return; | 245 | return; |
219 | 246 | ||
220 | if(acpi_power_get_inferred_state(acpi_dev, &state)) | 247 | if (state > ACPI_STATE_D0) |
221 | return; | 248 | return; |
222 | 249 | ||
223 | if (state == ACPI_STATE_D0 && pm_runtime_suspended(device->dev)) | 250 | mutex_lock(&adev->physical_node_lock); |
224 | pm_request_resume(device->dev); | 251 | |
252 | list_for_each_entry(pn, &adev->physical_node_list, node) | ||
253 | pm_request_resume(pn->dev); | ||
254 | |||
255 | list_for_each_entry(pn, &adev->power_dependent, node) | ||
256 | pm_request_resume(pn->dev); | ||
257 | |||
258 | mutex_unlock(&adev->physical_node_lock); | ||
225 | } | 259 | } |
226 | 260 | ||
227 | static int __acpi_power_on(struct acpi_power_resource *resource) | 261 | static int __acpi_power_on(struct acpi_power_resource *resource) |
228 | { | 262 | { |
229 | acpi_status status = AE_OK; | 263 | acpi_status status = AE_OK; |
230 | 264 | ||
231 | status = acpi_evaluate_object(resource->device->handle, "_ON", NULL, NULL); | 265 | status = acpi_evaluate_object(resource->device.handle, "_ON", NULL, NULL); |
232 | if (ACPI_FAILURE(status)) | 266 | if (ACPI_FAILURE(status)) |
233 | return -ENODEV; | 267 | return -ENODEV; |
234 | 268 | ||
235 | /* Update the power resource's _device_ power state */ | ||
236 | resource->device->power.state = ACPI_STATE_D0; | ||
237 | |||
238 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n", | 269 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned on\n", |
239 | resource->name)); | 270 | resource->name)); |
240 | 271 | ||
241 | return 0; | 272 | return 0; |
242 | } | 273 | } |
243 | 274 | ||
244 | static int acpi_power_on(acpi_handle handle) | 275 | static int acpi_power_on(struct acpi_power_resource *resource) |
245 | { | 276 | { |
246 | int result = 0; | 277 | int result = 0;; |
247 | bool resume_device = false; | ||
248 | struct acpi_power_resource *resource = NULL; | ||
249 | struct acpi_power_resource_device *device_list; | ||
250 | |||
251 | result = acpi_power_get_context(handle, &resource); | ||
252 | if (result) | ||
253 | return result; | ||
254 | 278 | ||
255 | mutex_lock(&resource->resource_lock); | 279 | mutex_lock(&resource->resource_lock); |
256 | 280 | ||
@@ -260,39 +284,38 @@ static int acpi_power_on(acpi_handle handle) | |||
260 | resource->name)); | 284 | resource->name)); |
261 | } else { | 285 | } else { |
262 | result = __acpi_power_on(resource); | 286 | result = __acpi_power_on(resource); |
263 | if (result) | 287 | if (result) { |
264 | resource->ref_count--; | 288 | resource->ref_count--; |
265 | else | 289 | } else { |
266 | resume_device = true; | 290 | struct acpi_power_dependent_device *dep; |
291 | |||
292 | list_for_each_entry(dep, &resource->dependent, node) | ||
293 | schedule_work(&dep->work); | ||
294 | } | ||
267 | } | 295 | } |
268 | 296 | ||
269 | mutex_unlock(&resource->resource_lock); | 297 | mutex_unlock(&resource->resource_lock); |
270 | 298 | ||
271 | if (!resume_device) | 299 | return result; |
272 | return result; | 300 | } |
273 | |||
274 | mutex_lock(&resource->devices_lock); | ||
275 | 301 | ||
276 | device_list = resource->devices; | 302 | static int __acpi_power_off(struct acpi_power_resource *resource) |
277 | while (device_list) { | 303 | { |
278 | acpi_power_on_device(device_list->device); | 304 | acpi_status status; |
279 | device_list = device_list->next; | ||
280 | } | ||
281 | 305 | ||
282 | mutex_unlock(&resource->devices_lock); | 306 | status = acpi_evaluate_object(resource->device.handle, "_OFF", |
307 | NULL, NULL); | ||
308 | if (ACPI_FAILURE(status)) | ||
309 | return -ENODEV; | ||
283 | 310 | ||
284 | return result; | 311 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Power resource [%s] turned off\n", |
312 | resource->name)); | ||
313 | return 0; | ||
285 | } | 314 | } |
286 | 315 | ||
287 | static int acpi_power_off(acpi_handle handle) | 316 | static int acpi_power_off(struct acpi_power_resource *resource) |
288 | { | 317 | { |
289 | int result = 0; | 318 | int result = 0; |
290 | acpi_status status = AE_OK; | ||
291 | struct acpi_power_resource *resource = NULL; | ||
292 | |||
293 | result = acpi_power_get_context(handle, &resource); | ||
294 | if (result) | ||
295 | return result; | ||
296 | 319 | ||
297 | mutex_lock(&resource->resource_lock); | 320 | mutex_lock(&resource->resource_lock); |
298 | 321 | ||
@@ -307,19 +330,10 @@ static int acpi_power_off(acpi_handle handle) | |||
307 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 330 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
308 | "Power resource [%s] still in use\n", | 331 | "Power resource [%s] still in use\n", |
309 | resource->name)); | 332 | resource->name)); |
310 | goto unlock; | ||
311 | } | ||
312 | |||
313 | status = acpi_evaluate_object(resource->device->handle, "_OFF", NULL, NULL); | ||
314 | if (ACPI_FAILURE(status)) { | ||
315 | result = -ENODEV; | ||
316 | } else { | 333 | } else { |
317 | /* Update the power resource's _device_ power state */ | 334 | result = __acpi_power_off(resource); |
318 | resource->device->power.state = ACPI_STATE_D3; | 335 | if (result) |
319 | 336 | resource->ref_count++; | |
320 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
321 | "Power resource [%s] turned off\n", | ||
322 | resource->name)); | ||
323 | } | 337 | } |
324 | 338 | ||
325 | unlock: | 339 | unlock: |
@@ -328,148 +342,202 @@ static int acpi_power_off(acpi_handle handle) | |||
328 | return result; | 342 | return result; |
329 | } | 343 | } |
330 | 344 | ||
331 | static void __acpi_power_off_list(struct acpi_handle_list *list, int num_res) | 345 | static int acpi_power_off_list(struct list_head *list) |
332 | { | 346 | { |
333 | int i; | 347 | struct acpi_power_resource_entry *entry; |
348 | int result = 0; | ||
334 | 349 | ||
335 | for (i = num_res - 1; i >= 0 ; i--) | 350 | list_for_each_entry_reverse(entry, list, node) { |
336 | acpi_power_off(list->handles[i]); | 351 | result = acpi_power_off(entry->resource); |
337 | } | 352 | if (result) |
353 | goto err; | ||
354 | } | ||
355 | return 0; | ||
338 | 356 | ||
339 | static void acpi_power_off_list(struct acpi_handle_list *list) | 357 | err: |
340 | { | 358 | list_for_each_entry_continue(entry, list, node) |
341 | __acpi_power_off_list(list, list->count); | 359 | acpi_power_on(entry->resource); |
360 | |||
361 | return result; | ||
342 | } | 362 | } |
343 | 363 | ||
344 | static int acpi_power_on_list(struct acpi_handle_list *list) | 364 | static int acpi_power_on_list(struct list_head *list) |
345 | { | 365 | { |
366 | struct acpi_power_resource_entry *entry; | ||
346 | int result = 0; | 367 | int result = 0; |
347 | int i; | ||
348 | 368 | ||
349 | for (i = 0; i < list->count; i++) { | 369 | list_for_each_entry(entry, list, node) { |
350 | result = acpi_power_on(list->handles[i]); | 370 | result = acpi_power_on(entry->resource); |
351 | if (result) { | 371 | if (result) |
352 | __acpi_power_off_list(list, i); | 372 | goto err; |
353 | break; | ||
354 | } | ||
355 | } | 373 | } |
374 | return 0; | ||
375 | |||
376 | err: | ||
377 | list_for_each_entry_continue_reverse(entry, list, node) | ||
378 | acpi_power_off(entry->resource); | ||
356 | 379 | ||
357 | return result; | 380 | return result; |
358 | } | 381 | } |
359 | 382 | ||
360 | static void __acpi_power_resource_unregister_device(struct device *dev, | 383 | static void acpi_power_add_dependent(struct acpi_power_resource *resource, |
361 | acpi_handle res_handle) | 384 | struct acpi_device *adev) |
362 | { | 385 | { |
363 | struct acpi_power_resource *resource = NULL; | 386 | struct acpi_power_dependent_device *dep; |
364 | struct acpi_power_resource_device *prev, *curr; | ||
365 | 387 | ||
366 | if (acpi_power_get_context(res_handle, &resource)) | 388 | mutex_lock(&resource->resource_lock); |
367 | return; | 389 | |
390 | list_for_each_entry(dep, &resource->dependent, node) | ||
391 | if (dep->adev == adev) | ||
392 | goto out; | ||
393 | |||
394 | dep = kzalloc(sizeof(*dep), GFP_KERNEL); | ||
395 | if (!dep) | ||
396 | goto out; | ||
397 | |||
398 | dep->adev = adev; | ||
399 | INIT_WORK(&dep->work, acpi_power_resume_dependent); | ||
400 | list_add_tail(&dep->node, &resource->dependent); | ||
368 | 401 | ||
369 | mutex_lock(&resource->devices_lock); | 402 | out: |
370 | prev = NULL; | 403 | mutex_unlock(&resource->resource_lock); |
371 | curr = resource->devices; | 404 | } |
372 | while (curr) { | 405 | |
373 | if (curr->device->dev == dev) { | 406 | static void acpi_power_remove_dependent(struct acpi_power_resource *resource, |
374 | if (!prev) | 407 | struct acpi_device *adev) |
375 | resource->devices = curr->next; | 408 | { |
376 | else | 409 | struct acpi_power_dependent_device *dep; |
377 | prev->next = curr->next; | 410 | struct work_struct *work = NULL; |
378 | 411 | ||
379 | kfree(curr); | 412 | mutex_lock(&resource->resource_lock); |
413 | |||
414 | list_for_each_entry(dep, &resource->dependent, node) | ||
415 | if (dep->adev == adev) { | ||
416 | list_del(&dep->node); | ||
417 | work = &dep->work; | ||
380 | break; | 418 | break; |
381 | } | 419 | } |
382 | 420 | ||
383 | prev = curr; | 421 | mutex_unlock(&resource->resource_lock); |
384 | curr = curr->next; | 422 | |
423 | if (work) { | ||
424 | cancel_work_sync(work); | ||
425 | kfree(dep); | ||
385 | } | 426 | } |
386 | mutex_unlock(&resource->devices_lock); | ||
387 | } | 427 | } |
388 | 428 | ||
389 | /* Unlink dev from all power resources in _PR0 */ | 429 | static struct attribute *attrs[] = { |
390 | void acpi_power_resource_unregister_device(struct device *dev, acpi_handle handle) | 430 | NULL, |
391 | { | 431 | }; |
392 | struct acpi_device *acpi_dev; | ||
393 | struct acpi_handle_list *list; | ||
394 | int i; | ||
395 | 432 | ||
396 | if (!dev || !handle) | 433 | static struct attribute_group attr_groups[] = { |
397 | return; | 434 | [ACPI_STATE_D0] = { |
435 | .name = "power_resources_D0", | ||
436 | .attrs = attrs, | ||
437 | }, | ||
438 | [ACPI_STATE_D1] = { | ||
439 | .name = "power_resources_D1", | ||
440 | .attrs = attrs, | ||
441 | }, | ||
442 | [ACPI_STATE_D2] = { | ||
443 | .name = "power_resources_D2", | ||
444 | .attrs = attrs, | ||
445 | }, | ||
446 | [ACPI_STATE_D3_HOT] = { | ||
447 | .name = "power_resources_D3hot", | ||
448 | .attrs = attrs, | ||
449 | }, | ||
450 | }; | ||
398 | 451 | ||
399 | if (acpi_bus_get_device(handle, &acpi_dev)) | 452 | static void acpi_power_hide_list(struct acpi_device *adev, int state) |
453 | { | ||
454 | struct acpi_device_power_state *ps = &adev->power.states[state]; | ||
455 | struct acpi_power_resource_entry *entry; | ||
456 | |||
457 | if (list_empty(&ps->resources)) | ||
400 | return; | 458 | return; |
401 | 459 | ||
402 | list = &acpi_dev->power.states[ACPI_STATE_D0].resources; | 460 | list_for_each_entry_reverse(entry, &ps->resources, node) { |
461 | struct acpi_device *res_dev = &entry->resource->device; | ||
403 | 462 | ||
404 | for (i = 0; i < list->count; i++) | 463 | sysfs_remove_link_from_group(&adev->dev.kobj, |
405 | __acpi_power_resource_unregister_device(dev, | 464 | attr_groups[state].name, |
406 | list->handles[i]); | 465 | dev_name(&res_dev->dev)); |
466 | } | ||
467 | sysfs_remove_group(&adev->dev.kobj, &attr_groups[state]); | ||
407 | } | 468 | } |
408 | EXPORT_SYMBOL_GPL(acpi_power_resource_unregister_device); | ||
409 | 469 | ||
410 | static int __acpi_power_resource_register_device( | 470 | static void acpi_power_expose_list(struct acpi_device *adev, int state) |
411 | struct acpi_power_managed_device *powered_device, acpi_handle handle) | ||
412 | { | 471 | { |
413 | struct acpi_power_resource *resource = NULL; | 472 | struct acpi_device_power_state *ps = &adev->power.states[state]; |
414 | struct acpi_power_resource_device *power_resource_device; | 473 | struct acpi_power_resource_entry *entry; |
415 | int result; | 474 | int ret; |
416 | |||
417 | result = acpi_power_get_context(handle, &resource); | ||
418 | if (result) | ||
419 | return result; | ||
420 | 475 | ||
421 | power_resource_device = kzalloc( | 476 | if (list_empty(&ps->resources)) |
422 | sizeof(*power_resource_device), GFP_KERNEL); | 477 | return; |
423 | if (!power_resource_device) | ||
424 | return -ENOMEM; | ||
425 | 478 | ||
426 | power_resource_device->device = powered_device; | 479 | ret = sysfs_create_group(&adev->dev.kobj, &attr_groups[state]); |
480 | if (ret) | ||
481 | return; | ||
427 | 482 | ||
428 | mutex_lock(&resource->devices_lock); | 483 | list_for_each_entry(entry, &ps->resources, node) { |
429 | power_resource_device->next = resource->devices; | 484 | struct acpi_device *res_dev = &entry->resource->device; |
430 | resource->devices = power_resource_device; | ||
431 | mutex_unlock(&resource->devices_lock); | ||
432 | 485 | ||
433 | return 0; | 486 | ret = sysfs_add_link_to_group(&adev->dev.kobj, |
487 | attr_groups[state].name, | ||
488 | &res_dev->dev.kobj, | ||
489 | dev_name(&res_dev->dev)); | ||
490 | if (ret) { | ||
491 | acpi_power_hide_list(adev, state); | ||
492 | break; | ||
493 | } | ||
494 | } | ||
434 | } | 495 | } |
435 | 496 | ||
436 | /* Link dev to all power resources in _PR0 */ | 497 | void acpi_power_add_remove_device(struct acpi_device *adev, bool add) |
437 | int acpi_power_resource_register_device(struct device *dev, acpi_handle handle) | ||
438 | { | 498 | { |
439 | struct acpi_device *acpi_dev; | 499 | struct acpi_device_power_state *ps; |
440 | struct acpi_handle_list *list; | 500 | struct acpi_power_resource_entry *entry; |
441 | struct acpi_power_managed_device *powered_device; | 501 | int state; |
442 | int i, ret; | ||
443 | 502 | ||
444 | if (!dev || !handle) | 503 | if (!adev->power.flags.power_resources) |
445 | return -ENODEV; | 504 | return; |
446 | 505 | ||
447 | ret = acpi_bus_get_device(handle, &acpi_dev); | 506 | ps = &adev->power.states[ACPI_STATE_D0]; |
448 | if (ret || !acpi_dev->power.flags.power_resources) | 507 | list_for_each_entry(entry, &ps->resources, node) { |
449 | return -ENODEV; | 508 | struct acpi_power_resource *resource = entry->resource; |
450 | 509 | ||
451 | powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL); | 510 | if (add) |
452 | if (!powered_device) | 511 | acpi_power_add_dependent(resource, adev); |
453 | return -ENOMEM; | 512 | else |
513 | acpi_power_remove_dependent(resource, adev); | ||
514 | } | ||
454 | 515 | ||
455 | powered_device->dev = dev; | 516 | for (state = ACPI_STATE_D0; state <= ACPI_STATE_D3_HOT; state++) { |
456 | powered_device->handle = handle; | 517 | if (add) |
518 | acpi_power_expose_list(adev, state); | ||
519 | else | ||
520 | acpi_power_hide_list(adev, state); | ||
521 | } | ||
522 | } | ||
457 | 523 | ||
458 | list = &acpi_dev->power.states[ACPI_STATE_D0].resources; | 524 | int acpi_power_min_system_level(struct list_head *list) |
525 | { | ||
526 | struct acpi_power_resource_entry *entry; | ||
527 | int system_level = 5; | ||
459 | 528 | ||
460 | for (i = 0; i < list->count; i++) { | 529 | list_for_each_entry(entry, list, node) { |
461 | ret = __acpi_power_resource_register_device(powered_device, | 530 | struct acpi_power_resource *resource = entry->resource; |
462 | list->handles[i]); | ||
463 | 531 | ||
464 | if (ret) { | 532 | if (system_level > resource->system_level) |
465 | acpi_power_resource_unregister_device(dev, handle); | 533 | system_level = resource->system_level; |
466 | break; | ||
467 | } | ||
468 | } | 534 | } |
469 | 535 | return system_level; | |
470 | return ret; | ||
471 | } | 536 | } |
472 | EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); | 537 | |
538 | /* -------------------------------------------------------------------------- | ||
539 | Device Power Management | ||
540 | -------------------------------------------------------------------------- */ | ||
473 | 541 | ||
474 | /** | 542 | /** |
475 | * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in | 543 | * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in |
@@ -542,7 +610,7 @@ int acpi_device_sleep_wake(struct acpi_device *dev, | |||
542 | */ | 610 | */ |
543 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) | 611 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) |
544 | { | 612 | { |
545 | int i, err = 0; | 613 | int err = 0; |
546 | 614 | ||
547 | if (!dev || !dev->wakeup.flags.valid) | 615 | if (!dev || !dev->wakeup.flags.valid) |
548 | return -EINVAL; | 616 | return -EINVAL; |
@@ -552,24 +620,17 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) | |||
552 | if (dev->wakeup.prepare_count++) | 620 | if (dev->wakeup.prepare_count++) |
553 | goto out; | 621 | goto out; |
554 | 622 | ||
555 | /* Open power resource */ | 623 | err = acpi_power_on_list(&dev->wakeup.resources); |
556 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 624 | if (err) { |
557 | int ret = acpi_power_on(dev->wakeup.resources.handles[i]); | 625 | dev_err(&dev->dev, "Cannot turn wakeup power resources on\n"); |
558 | if (ret) { | 626 | dev->wakeup.flags.valid = 0; |
559 | printk(KERN_ERR PREFIX "Transition power state\n"); | 627 | } else { |
560 | dev->wakeup.flags.valid = 0; | 628 | /* |
561 | err = -ENODEV; | 629 | * Passing 3 as the third argument below means the device may be |
562 | goto err_out; | 630 | * put into arbitrary power state afterward. |
563 | } | 631 | */ |
632 | err = acpi_device_sleep_wake(dev, 1, sleep_state, 3); | ||
564 | } | 633 | } |
565 | |||
566 | /* | ||
567 | * Passing 3 as the third argument below means the device may be placed | ||
568 | * in arbitrary power state afterwards. | ||
569 | */ | ||
570 | err = acpi_device_sleep_wake(dev, 1, sleep_state, 3); | ||
571 | |||
572 | err_out: | ||
573 | if (err) | 634 | if (err) |
574 | dev->wakeup.prepare_count = 0; | 635 | dev->wakeup.prepare_count = 0; |
575 | 636 | ||
@@ -586,7 +647,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state) | |||
586 | */ | 647 | */ |
587 | int acpi_disable_wakeup_device_power(struct acpi_device *dev) | 648 | int acpi_disable_wakeup_device_power(struct acpi_device *dev) |
588 | { | 649 | { |
589 | int i, err = 0; | 650 | int err = 0; |
590 | 651 | ||
591 | if (!dev || !dev->wakeup.flags.valid) | 652 | if (!dev || !dev->wakeup.flags.valid) |
592 | return -EINVAL; | 653 | return -EINVAL; |
@@ -607,15 +668,10 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) | |||
607 | if (err) | 668 | if (err) |
608 | goto out; | 669 | goto out; |
609 | 670 | ||
610 | /* Close power resource */ | 671 | err = acpi_power_off_list(&dev->wakeup.resources); |
611 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 672 | if (err) { |
612 | int ret = acpi_power_off(dev->wakeup.resources.handles[i]); | 673 | dev_err(&dev->dev, "Cannot turn wakeup power resources off\n"); |
613 | if (ret) { | 674 | dev->wakeup.flags.valid = 0; |
614 | printk(KERN_ERR PREFIX "Transition power state\n"); | ||
615 | dev->wakeup.flags.valid = 0; | ||
616 | err = -ENODEV; | ||
617 | goto out; | ||
618 | } | ||
619 | } | 675 | } |
620 | 676 | ||
621 | out: | 677 | out: |
@@ -623,14 +679,9 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) | |||
623 | return err; | 679 | return err; |
624 | } | 680 | } |
625 | 681 | ||
626 | /* -------------------------------------------------------------------------- | ||
627 | Device Power Management | ||
628 | -------------------------------------------------------------------------- */ | ||
629 | |||
630 | int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | 682 | int acpi_power_get_inferred_state(struct acpi_device *device, int *state) |
631 | { | 683 | { |
632 | int result = 0; | 684 | int result = 0; |
633 | struct acpi_handle_list *list = NULL; | ||
634 | int list_state = 0; | 685 | int list_state = 0; |
635 | int i = 0; | 686 | int i = 0; |
636 | 687 | ||
@@ -642,8 +693,9 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | |||
642 | * required for a given D-state are 'on'. | 693 | * required for a given D-state are 'on'. |
643 | */ | 694 | */ |
644 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { | 695 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { |
645 | list = &device->power.states[i].resources; | 696 | struct list_head *list = &device->power.states[i].resources; |
646 | if (list->count < 1) | 697 | |
698 | if (list_empty(list)) | ||
647 | continue; | 699 | continue; |
648 | 700 | ||
649 | result = acpi_power_get_list_state(list, &list_state); | 701 | result = acpi_power_get_list_state(list, &list_state); |
@@ -662,7 +714,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | |||
662 | 714 | ||
663 | int acpi_power_on_resources(struct acpi_device *device, int state) | 715 | int acpi_power_on_resources(struct acpi_device *device, int state) |
664 | { | 716 | { |
665 | if (!device || state < ACPI_STATE_D0 || state > ACPI_STATE_D3) | 717 | if (!device || state < ACPI_STATE_D0 || state > ACPI_STATE_D3_HOT) |
666 | return -EINVAL; | 718 | return -EINVAL; |
667 | 719 | ||
668 | return acpi_power_on_list(&device->power.states[state].resources); | 720 | return acpi_power_on_list(&device->power.states[state].resources); |
@@ -675,7 +727,7 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
675 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) | 727 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) |
676 | return -EINVAL; | 728 | return -EINVAL; |
677 | 729 | ||
678 | if (device->power.state == state) | 730 | if (device->power.state == state || !device->flags.power_manageable) |
679 | return 0; | 731 | return 0; |
680 | 732 | ||
681 | if ((device->power.state < ACPI_STATE_D0) | 733 | if ((device->power.state < ACPI_STATE_D0) |
@@ -703,118 +755,126 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
703 | return result; | 755 | return result; |
704 | } | 756 | } |
705 | 757 | ||
706 | /* -------------------------------------------------------------------------- | 758 | static void acpi_release_power_resource(struct device *dev) |
707 | Driver Interface | 759 | { |
708 | -------------------------------------------------------------------------- */ | 760 | struct acpi_device *device = to_acpi_device(dev); |
761 | struct acpi_power_resource *resource; | ||
762 | |||
763 | resource = container_of(device, struct acpi_power_resource, device); | ||
764 | |||
765 | mutex_lock(&power_resource_list_lock); | ||
766 | list_del(&resource->list_node); | ||
767 | mutex_unlock(&power_resource_list_lock); | ||
768 | |||
769 | acpi_free_ids(device); | ||
770 | kfree(resource); | ||
771 | } | ||
709 | 772 | ||
710 | static int acpi_power_add(struct acpi_device *device) | 773 | static ssize_t acpi_power_in_use_show(struct device *dev, |
774 | struct device_attribute *attr, | ||
775 | char *buf) { | ||
776 | struct acpi_power_resource *resource; | ||
777 | |||
778 | resource = to_power_resource(to_acpi_device(dev)); | ||
779 | return sprintf(buf, "%u\n", !!resource->ref_count); | ||
780 | } | ||
781 | static DEVICE_ATTR(resource_in_use, 0444, acpi_power_in_use_show, NULL); | ||
782 | |||
783 | static void acpi_power_sysfs_remove(struct acpi_device *device) | ||
711 | { | 784 | { |
712 | int result = 0, state; | 785 | device_remove_file(&device->dev, &dev_attr_resource_in_use); |
713 | acpi_status status = AE_OK; | 786 | } |
714 | struct acpi_power_resource *resource = NULL; | 787 | |
788 | int acpi_add_power_resource(acpi_handle handle) | ||
789 | { | ||
790 | struct acpi_power_resource *resource; | ||
791 | struct acpi_device *device = NULL; | ||
715 | union acpi_object acpi_object; | 792 | union acpi_object acpi_object; |
716 | struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; | 793 | struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; |
794 | acpi_status status; | ||
795 | int state, result = -ENODEV; | ||
717 | 796 | ||
797 | acpi_bus_get_device(handle, &device); | ||
798 | if (device) | ||
799 | return 0; | ||
718 | 800 | ||
719 | if (!device) | 801 | resource = kzalloc(sizeof(*resource), GFP_KERNEL); |
720 | return -EINVAL; | ||
721 | |||
722 | resource = kzalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); | ||
723 | if (!resource) | 802 | if (!resource) |
724 | return -ENOMEM; | 803 | return -ENOMEM; |
725 | 804 | ||
726 | resource->device = device; | 805 | device = &resource->device; |
806 | acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER, | ||
807 | ACPI_STA_DEFAULT); | ||
727 | mutex_init(&resource->resource_lock); | 808 | mutex_init(&resource->resource_lock); |
728 | mutex_init(&resource->devices_lock); | 809 | INIT_LIST_HEAD(&resource->dependent); |
729 | strcpy(resource->name, device->pnp.bus_id); | 810 | resource->name = device->pnp.bus_id; |
730 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); | 811 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); |
731 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); | 812 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); |
732 | device->driver_data = resource; | 813 | device->power.state = ACPI_STATE_UNKNOWN; |
733 | 814 | ||
734 | /* Evalute the object to get the system level and resource order. */ | 815 | /* Evalute the object to get the system level and resource order. */ |
735 | status = acpi_evaluate_object(device->handle, NULL, NULL, &buffer); | 816 | status = acpi_evaluate_object(handle, NULL, NULL, &buffer); |
736 | if (ACPI_FAILURE(status)) { | 817 | if (ACPI_FAILURE(status)) |
737 | result = -ENODEV; | 818 | goto err; |
738 | goto end; | 819 | |
739 | } | ||
740 | resource->system_level = acpi_object.power_resource.system_level; | 820 | resource->system_level = acpi_object.power_resource.system_level; |
741 | resource->order = acpi_object.power_resource.resource_order; | 821 | resource->order = acpi_object.power_resource.resource_order; |
742 | 822 | ||
743 | result = acpi_power_get_state(device->handle, &state); | 823 | result = acpi_power_get_state(handle, &state); |
744 | if (result) | 824 | if (result) |
745 | goto end; | 825 | goto err; |
746 | |||
747 | switch (state) { | ||
748 | case ACPI_POWER_RESOURCE_STATE_ON: | ||
749 | device->power.state = ACPI_STATE_D0; | ||
750 | break; | ||
751 | case ACPI_POWER_RESOURCE_STATE_OFF: | ||
752 | device->power.state = ACPI_STATE_D3; | ||
753 | break; | ||
754 | default: | ||
755 | device->power.state = ACPI_STATE_UNKNOWN; | ||
756 | break; | ||
757 | } | ||
758 | 826 | ||
759 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), | 827 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), |
760 | acpi_device_bid(device), state ? "on" : "off"); | 828 | acpi_device_bid(device), state ? "on" : "off"); |
761 | 829 | ||
762 | end: | 830 | device->flags.match_driver = true; |
831 | result = acpi_device_add(device, acpi_release_power_resource); | ||
763 | if (result) | 832 | if (result) |
764 | kfree(resource); | 833 | goto err; |
765 | 834 | ||
766 | return result; | 835 | if (!device_create_file(&device->dev, &dev_attr_resource_in_use)) |
767 | } | 836 | device->remove = acpi_power_sysfs_remove; |
768 | |||
769 | static int acpi_power_remove(struct acpi_device *device, int type) | ||
770 | { | ||
771 | struct acpi_power_resource *resource; | ||
772 | |||
773 | if (!device) | ||
774 | return -EINVAL; | ||
775 | |||
776 | resource = acpi_driver_data(device); | ||
777 | if (!resource) | ||
778 | return -EINVAL; | ||
779 | |||
780 | kfree(resource); | ||
781 | 837 | ||
838 | mutex_lock(&power_resource_list_lock); | ||
839 | list_add(&resource->list_node, &acpi_power_resource_list); | ||
840 | mutex_unlock(&power_resource_list_lock); | ||
841 | acpi_device_add_finalize(device); | ||
782 | return 0; | 842 | return 0; |
843 | |||
844 | err: | ||
845 | acpi_release_power_resource(&device->dev); | ||
846 | return result; | ||
783 | } | 847 | } |
784 | 848 | ||
785 | #ifdef CONFIG_PM_SLEEP | 849 | #ifdef CONFIG_ACPI_SLEEP |
786 | static int acpi_power_resume(struct device *dev) | 850 | void acpi_resume_power_resources(void) |
787 | { | 851 | { |
788 | int result = 0, state; | ||
789 | struct acpi_device *device; | ||
790 | struct acpi_power_resource *resource; | 852 | struct acpi_power_resource *resource; |
791 | 853 | ||
792 | if (!dev) | 854 | mutex_lock(&power_resource_list_lock); |
793 | return -EINVAL; | ||
794 | 855 | ||
795 | device = to_acpi_device(dev); | 856 | list_for_each_entry(resource, &acpi_power_resource_list, list_node) { |
796 | resource = acpi_driver_data(device); | 857 | int result, state; |
797 | if (!resource) | ||
798 | return -EINVAL; | ||
799 | 858 | ||
800 | mutex_lock(&resource->resource_lock); | 859 | mutex_lock(&resource->resource_lock); |
801 | 860 | ||
802 | result = acpi_power_get_state(device->handle, &state); | 861 | result = acpi_power_get_state(resource->device.handle, &state); |
803 | if (result) | 862 | if (result) |
804 | goto unlock; | 863 | continue; |
805 | 864 | ||
806 | if (state == ACPI_POWER_RESOURCE_STATE_OFF && resource->ref_count) | 865 | if (state == ACPI_POWER_RESOURCE_STATE_OFF |
807 | result = __acpi_power_on(resource); | 866 | && resource->ref_count) { |
867 | dev_info(&resource->device.dev, "Turning ON\n"); | ||
868 | __acpi_power_on(resource); | ||
869 | } else if (state == ACPI_POWER_RESOURCE_STATE_ON | ||
870 | && !resource->ref_count) { | ||
871 | dev_info(&resource->device.dev, "Turning OFF\n"); | ||
872 | __acpi_power_off(resource); | ||
873 | } | ||
808 | 874 | ||
809 | unlock: | 875 | mutex_unlock(&resource->resource_lock); |
810 | mutex_unlock(&resource->resource_lock); | 876 | } |
811 | 877 | ||
812 | return result; | 878 | mutex_unlock(&power_resource_list_lock); |
813 | } | 879 | } |
814 | #endif | 880 | #endif |
815 | |||
816 | int __init acpi_power_init(void) | ||
817 | { | ||
818 | INIT_LIST_HEAD(&acpi_power_resource_list); | ||
819 | return acpi_bus_register_driver(&acpi_power_driver); | ||
820 | } | ||
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index ef98796b3824..52ce76725c20 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -311,11 +311,12 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
311 | dev->pnp.bus_id, | 311 | dev->pnp.bus_id, |
312 | (u32) dev->wakeup.sleep_state); | 312 | (u32) dev->wakeup.sleep_state); |
313 | 313 | ||
314 | if (!dev->physical_node_count) | 314 | if (!dev->physical_node_count) { |
315 | seq_printf(seq, "%c%-8s\n", | 315 | seq_printf(seq, "%c%-8s\n", |
316 | dev->wakeup.flags.run_wake ? | 316 | dev->wakeup.flags.run_wake ? '*' : ' ', |
317 | '*' : ' ', "disabled"); | 317 | device_may_wakeup(&dev->dev) ? |
318 | else { | 318 | "enabled" : "disabled"); |
319 | } else { | ||
319 | struct device *ldev; | 320 | struct device *ldev; |
320 | list_for_each_entry(entry, &dev->physical_node_list, | 321 | list_for_each_entry(entry, &dev->physical_node_list, |
321 | node) { | 322 | node) { |
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index e83311bf1ebd..cbf1f122666b 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -81,7 +81,7 @@ MODULE_DESCRIPTION("ACPI Processor Driver"); | |||
81 | MODULE_LICENSE("GPL"); | 81 | MODULE_LICENSE("GPL"); |
82 | 82 | ||
83 | static int acpi_processor_add(struct acpi_device *device); | 83 | static int acpi_processor_add(struct acpi_device *device); |
84 | static int acpi_processor_remove(struct acpi_device *device, int type); | 84 | static int acpi_processor_remove(struct acpi_device *device); |
85 | static void acpi_processor_notify(struct acpi_device *device, u32 event); | 85 | static void acpi_processor_notify(struct acpi_device *device, u32 event); |
86 | static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr); | 86 | static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr); |
87 | static int acpi_processor_handle_eject(struct acpi_processor *pr); | 87 | static int acpi_processor_handle_eject(struct acpi_processor *pr); |
@@ -610,7 +610,7 @@ err_free_pr: | |||
610 | return result; | 610 | return result; |
611 | } | 611 | } |
612 | 612 | ||
613 | static int acpi_processor_remove(struct acpi_device *device, int type) | 613 | static int acpi_processor_remove(struct acpi_device *device) |
614 | { | 614 | { |
615 | struct acpi_processor *pr = NULL; | 615 | struct acpi_processor *pr = NULL; |
616 | 616 | ||
@@ -623,7 +623,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
623 | if (pr->id >= nr_cpu_ids) | 623 | if (pr->id >= nr_cpu_ids) |
624 | goto free; | 624 | goto free; |
625 | 625 | ||
626 | if (type == ACPI_BUS_REMOVAL_EJECT) { | 626 | if (device->removal_type == ACPI_BUS_REMOVAL_EJECT) { |
627 | if (acpi_processor_handle_eject(pr)) | 627 | if (acpi_processor_handle_eject(pr)) |
628 | return -EINVAL; | 628 | return -EINVAL; |
629 | } | 629 | } |
@@ -677,36 +677,17 @@ static int is_processor_present(acpi_handle handle) | |||
677 | return 0; | 677 | return 0; |
678 | } | 678 | } |
679 | 679 | ||
680 | static | ||
681 | int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | ||
682 | { | ||
683 | acpi_handle phandle; | ||
684 | struct acpi_device *pdev; | ||
685 | |||
686 | |||
687 | if (acpi_get_parent(handle, &phandle)) { | ||
688 | return -ENODEV; | ||
689 | } | ||
690 | |||
691 | if (acpi_bus_get_device(phandle, &pdev)) { | ||
692 | return -ENODEV; | ||
693 | } | ||
694 | |||
695 | if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { | ||
696 | return -ENODEV; | ||
697 | } | ||
698 | |||
699 | return 0; | ||
700 | } | ||
701 | |||
702 | static void acpi_processor_hotplug_notify(acpi_handle handle, | 680 | static void acpi_processor_hotplug_notify(acpi_handle handle, |
703 | u32 event, void *data) | 681 | u32 event, void *data) |
704 | { | 682 | { |
705 | struct acpi_device *device = NULL; | 683 | struct acpi_device *device = NULL; |
706 | struct acpi_eject_event *ej_event = NULL; | 684 | struct acpi_eject_event *ej_event = NULL; |
707 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 685 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ |
686 | acpi_status status; | ||
708 | int result; | 687 | int result; |
709 | 688 | ||
689 | acpi_scan_lock_acquire(); | ||
690 | |||
710 | switch (event) { | 691 | switch (event) { |
711 | case ACPI_NOTIFY_BUS_CHECK: | 692 | case ACPI_NOTIFY_BUS_CHECK: |
712 | case ACPI_NOTIFY_DEVICE_CHECK: | 693 | case ACPI_NOTIFY_DEVICE_CHECK: |
@@ -721,12 +702,16 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
721 | if (!acpi_bus_get_device(handle, &device)) | 702 | if (!acpi_bus_get_device(handle, &device)) |
722 | break; | 703 | break; |
723 | 704 | ||
724 | result = acpi_processor_device_add(handle, &device); | 705 | result = acpi_bus_scan(handle); |
725 | if (result) { | 706 | if (result) { |
726 | acpi_handle_err(handle, "Unable to add the device\n"); | 707 | acpi_handle_err(handle, "Unable to add the device\n"); |
727 | break; | 708 | break; |
728 | } | 709 | } |
729 | 710 | result = acpi_bus_get_device(handle, &device); | |
711 | if (result) { | ||
712 | acpi_handle_err(handle, "Missing device object\n"); | ||
713 | break; | ||
714 | } | ||
730 | ost_code = ACPI_OST_SC_SUCCESS; | 715 | ost_code = ACPI_OST_SC_SUCCESS; |
731 | break; | 716 | break; |
732 | 717 | ||
@@ -751,25 +736,32 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
751 | break; | 736 | break; |
752 | } | 737 | } |
753 | 738 | ||
754 | ej_event->handle = handle; | 739 | get_device(&device->dev); |
740 | ej_event->device = device; | ||
755 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | 741 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; |
756 | acpi_os_hotplug_execute(acpi_bus_hot_remove_device, | 742 | /* The eject is carried out asynchronously. */ |
757 | (void *)ej_event); | 743 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, |
758 | 744 | ej_event); | |
759 | /* eject is performed asynchronously */ | 745 | if (ACPI_FAILURE(status)) { |
760 | return; | 746 | put_device(&device->dev); |
747 | kfree(ej_event); | ||
748 | break; | ||
749 | } | ||
750 | goto out; | ||
761 | 751 | ||
762 | default: | 752 | default: |
763 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 753 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
764 | "Unsupported event [0x%x]\n", event)); | 754 | "Unsupported event [0x%x]\n", event)); |
765 | 755 | ||
766 | /* non-hotplug event; possibly handled by other handler */ | 756 | /* non-hotplug event; possibly handled by other handler */ |
767 | return; | 757 | goto out; |
768 | } | 758 | } |
769 | 759 | ||
770 | /* Inform firmware that the hotplug operation has completed */ | 760 | /* Inform firmware that the hotplug operation has completed */ |
771 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | 761 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); |
772 | return; | 762 | |
763 | out: | ||
764 | acpi_scan_lock_release(); | ||
773 | } | 765 | } |
774 | 766 | ||
775 | static acpi_status is_processor_device(acpi_handle handle) | 767 | static acpi_status is_processor_device(acpi_handle handle) |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index ed9a1cc690be..e606e3603d81 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -64,10 +64,11 @@ | |||
64 | #define ACPI_PROCESSOR_CLASS "processor" | 64 | #define ACPI_PROCESSOR_CLASS "processor" |
65 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 65 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
66 | ACPI_MODULE_NAME("processor_idle"); | 66 | ACPI_MODULE_NAME("processor_idle"); |
67 | #define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) | 67 | #define PM_TIMER_TICK_NS (1000000000ULL/ACPI_PM_TIMER_FREQUENCY) |
68 | #define C2_OVERHEAD 1 /* 1us */ | 68 | #define C2_OVERHEAD 1 /* 1us */ |
69 | #define C3_OVERHEAD 1 /* 1us */ | 69 | #define C3_OVERHEAD 1 /* 1us */ |
70 | #define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) | 70 | #define PM_TIMER_TICKS_TO_US(p) \ |
71 | (((p) * 1000)/(ACPI_PM_TIMER_FREQUENCY/1000)) | ||
71 | 72 | ||
72 | static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; | 73 | static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; |
73 | module_param(max_cstate, uint, 0000); | 74 | module_param(max_cstate, uint, 0000); |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index ff0740e0a9c2..e523245643ac 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -130,7 +130,7 @@ struct acpi_sbs { | |||
130 | 130 | ||
131 | #define to_acpi_sbs(x) container_of(x, struct acpi_sbs, charger) | 131 | #define to_acpi_sbs(x) container_of(x, struct acpi_sbs, charger) |
132 | 132 | ||
133 | static int acpi_sbs_remove(struct acpi_device *device, int type); | 133 | static int acpi_sbs_remove(struct acpi_device *device); |
134 | static int acpi_battery_get_state(struct acpi_battery *battery); | 134 | static int acpi_battery_get_state(struct acpi_battery *battery); |
135 | 135 | ||
136 | static inline int battery_scale(int log) | 136 | static inline int battery_scale(int log) |
@@ -949,11 +949,11 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
949 | acpi_smbus_register_callback(sbs->hc, acpi_sbs_callback, sbs); | 949 | acpi_smbus_register_callback(sbs->hc, acpi_sbs_callback, sbs); |
950 | end: | 950 | end: |
951 | if (result) | 951 | if (result) |
952 | acpi_sbs_remove(device, 0); | 952 | acpi_sbs_remove(device); |
953 | return result; | 953 | return result; |
954 | } | 954 | } |
955 | 955 | ||
956 | static int acpi_sbs_remove(struct acpi_device *device, int type) | 956 | static int acpi_sbs_remove(struct acpi_device *device) |
957 | { | 957 | { |
958 | struct acpi_sbs *sbs; | 958 | struct acpi_sbs *sbs; |
959 | int id; | 959 | int id; |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index cf6129a8af7c..b78bc605837e 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -33,7 +33,7 @@ struct acpi_smb_hc { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | static int acpi_smbus_hc_add(struct acpi_device *device); | 35 | static int acpi_smbus_hc_add(struct acpi_device *device); |
36 | static int acpi_smbus_hc_remove(struct acpi_device *device, int type); | 36 | static int acpi_smbus_hc_remove(struct acpi_device *device); |
37 | 37 | ||
38 | static const struct acpi_device_id sbs_device_ids[] = { | 38 | static const struct acpi_device_id sbs_device_ids[] = { |
39 | {"ACPI0001", 0}, | 39 | {"ACPI0001", 0}, |
@@ -296,7 +296,7 @@ static int acpi_smbus_hc_add(struct acpi_device *device) | |||
296 | 296 | ||
297 | extern void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); | 297 | extern void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); |
298 | 298 | ||
299 | static int acpi_smbus_hc_remove(struct acpi_device *device, int type) | 299 | static int acpi_smbus_hc_remove(struct acpi_device *device) |
300 | { | 300 | { |
301 | struct acpi_smb_hc *hc; | 301 | struct acpi_smb_hc *hc; |
302 | 302 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index c88be6c37c30..daee7497efd3 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -29,29 +29,10 @@ extern struct acpi_device *acpi_root; | |||
29 | 29 | ||
30 | static const char *dummy_hid = "device"; | 30 | static const char *dummy_hid = "device"; |
31 | 31 | ||
32 | /* | ||
33 | * The following ACPI IDs are known to be suitable for representing as | ||
34 | * platform devices. | ||
35 | */ | ||
36 | static const struct acpi_device_id acpi_platform_device_ids[] = { | ||
37 | |||
38 | { "PNP0D40" }, | ||
39 | |||
40 | /* Haswell LPSS devices */ | ||
41 | { "INT33C0", 0 }, | ||
42 | { "INT33C1", 0 }, | ||
43 | { "INT33C2", 0 }, | ||
44 | { "INT33C3", 0 }, | ||
45 | { "INT33C4", 0 }, | ||
46 | { "INT33C5", 0 }, | ||
47 | { "INT33C6", 0 }, | ||
48 | { "INT33C7", 0 }, | ||
49 | |||
50 | { } | ||
51 | }; | ||
52 | |||
53 | static LIST_HEAD(acpi_device_list); | 32 | static LIST_HEAD(acpi_device_list); |
54 | static LIST_HEAD(acpi_bus_id_list); | 33 | static LIST_HEAD(acpi_bus_id_list); |
34 | static DEFINE_MUTEX(acpi_scan_lock); | ||
35 | static LIST_HEAD(acpi_scan_handlers_list); | ||
55 | DEFINE_MUTEX(acpi_device_lock); | 36 | DEFINE_MUTEX(acpi_device_lock); |
56 | LIST_HEAD(acpi_wakeup_device_list); | 37 | LIST_HEAD(acpi_wakeup_device_list); |
57 | 38 | ||
@@ -61,6 +42,27 @@ struct acpi_device_bus_id{ | |||
61 | struct list_head node; | 42 | struct list_head node; |
62 | }; | 43 | }; |
63 | 44 | ||
45 | void acpi_scan_lock_acquire(void) | ||
46 | { | ||
47 | mutex_lock(&acpi_scan_lock); | ||
48 | } | ||
49 | EXPORT_SYMBOL_GPL(acpi_scan_lock_acquire); | ||
50 | |||
51 | void acpi_scan_lock_release(void) | ||
52 | { | ||
53 | mutex_unlock(&acpi_scan_lock); | ||
54 | } | ||
55 | EXPORT_SYMBOL_GPL(acpi_scan_lock_release); | ||
56 | |||
57 | int acpi_scan_add_handler(struct acpi_scan_handler *handler) | ||
58 | { | ||
59 | if (!handler || !handler->attach) | ||
60 | return -EINVAL; | ||
61 | |||
62 | list_add_tail(&handler->list_node, &acpi_scan_handlers_list); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
64 | /* | 66 | /* |
65 | * Creates hid/cid(s) string needed for modalias and uevent | 67 | * Creates hid/cid(s) string needed for modalias and uevent |
66 | * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: | 68 | * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: |
@@ -115,39 +117,32 @@ static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); | |||
115 | */ | 117 | */ |
116 | void acpi_bus_hot_remove_device(void *context) | 118 | void acpi_bus_hot_remove_device(void *context) |
117 | { | 119 | { |
118 | struct acpi_eject_event *ej_event = (struct acpi_eject_event *) context; | 120 | struct acpi_eject_event *ej_event = context; |
119 | struct acpi_device *device; | 121 | struct acpi_device *device = ej_event->device; |
120 | acpi_handle handle = ej_event->handle; | 122 | acpi_handle handle = device->handle; |
121 | acpi_handle temp; | 123 | acpi_handle temp; |
122 | struct acpi_object_list arg_list; | 124 | struct acpi_object_list arg_list; |
123 | union acpi_object arg; | 125 | union acpi_object arg; |
124 | acpi_status status = AE_OK; | 126 | acpi_status status = AE_OK; |
125 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 127 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ |
126 | 128 | ||
127 | if (acpi_bus_get_device(handle, &device)) | 129 | mutex_lock(&acpi_scan_lock); |
128 | goto err_out; | ||
129 | 130 | ||
130 | if (!device) | 131 | /* If there is no handle, the device node has been unregistered. */ |
131 | goto err_out; | 132 | if (!device->handle) { |
133 | dev_dbg(&device->dev, "ACPI handle missing\n"); | ||
134 | put_device(&device->dev); | ||
135 | goto out; | ||
136 | } | ||
132 | 137 | ||
133 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 138 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
134 | "Hot-removing device %s...\n", dev_name(&device->dev))); | 139 | "Hot-removing device %s...\n", dev_name(&device->dev))); |
135 | 140 | ||
136 | if (acpi_bus_trim(device, 1)) { | 141 | acpi_bus_trim(device); |
137 | printk(KERN_ERR PREFIX | 142 | /* Device node has been unregistered. */ |
138 | "Removing device failed\n"); | 143 | put_device(&device->dev); |
139 | goto err_out; | ||
140 | } | ||
141 | |||
142 | /* device has been freed */ | ||
143 | device = NULL; | 144 | device = NULL; |
144 | 145 | ||
145 | /* power off device */ | ||
146 | status = acpi_evaluate_object(handle, "_PS3", NULL, NULL); | ||
147 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) | ||
148 | printk(KERN_WARNING PREFIX | ||
149 | "Power-off device failed\n"); | ||
150 | |||
151 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_LCK", &temp))) { | 146 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_LCK", &temp))) { |
152 | arg_list.count = 1; | 147 | arg_list.count = 1; |
153 | arg_list.pointer = &arg; | 148 | arg_list.pointer = &arg; |
@@ -167,23 +162,46 @@ void acpi_bus_hot_remove_device(void *context) | |||
167 | status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); | 162 | status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); |
168 | if (ACPI_FAILURE(status)) { | 163 | if (ACPI_FAILURE(status)) { |
169 | if (status != AE_NOT_FOUND) | 164 | if (status != AE_NOT_FOUND) |
170 | printk(KERN_WARNING PREFIX | 165 | acpi_handle_warn(handle, "Eject failed\n"); |
171 | "Eject device failed\n"); | ||
172 | goto err_out; | ||
173 | } | ||
174 | 166 | ||
175 | kfree(context); | 167 | /* Tell the firmware the hot-remove operation has failed. */ |
176 | return; | 168 | acpi_evaluate_hotplug_ost(handle, ej_event->event, |
169 | ost_code, NULL); | ||
170 | } | ||
177 | 171 | ||
178 | err_out: | 172 | out: |
179 | /* Inform firmware the hot-remove operation has completed w/ error */ | 173 | mutex_unlock(&acpi_scan_lock); |
180 | (void) acpi_evaluate_hotplug_ost(handle, | ||
181 | ej_event->event, ost_code, NULL); | ||
182 | kfree(context); | 174 | kfree(context); |
183 | return; | 175 | return; |
184 | } | 176 | } |
185 | EXPORT_SYMBOL(acpi_bus_hot_remove_device); | 177 | EXPORT_SYMBOL(acpi_bus_hot_remove_device); |
186 | 178 | ||
179 | static ssize_t real_power_state_show(struct device *dev, | ||
180 | struct device_attribute *attr, char *buf) | ||
181 | { | ||
182 | struct acpi_device *adev = to_acpi_device(dev); | ||
183 | int state; | ||
184 | int ret; | ||
185 | |||
186 | ret = acpi_device_get_power(adev, &state); | ||
187 | if (ret) | ||
188 | return ret; | ||
189 | |||
190 | return sprintf(buf, "%s\n", acpi_power_state_string(state)); | ||
191 | } | ||
192 | |||
193 | static DEVICE_ATTR(real_power_state, 0444, real_power_state_show, NULL); | ||
194 | |||
195 | static ssize_t power_state_show(struct device *dev, | ||
196 | struct device_attribute *attr, char *buf) | ||
197 | { | ||
198 | struct acpi_device *adev = to_acpi_device(dev); | ||
199 | |||
200 | return sprintf(buf, "%s\n", acpi_power_state_string(adev->power.state)); | ||
201 | } | ||
202 | |||
203 | static DEVICE_ATTR(power_state, 0444, power_state_show, NULL); | ||
204 | |||
187 | static ssize_t | 205 | static ssize_t |
188 | acpi_eject_store(struct device *d, struct device_attribute *attr, | 206 | acpi_eject_store(struct device *d, struct device_attribute *attr, |
189 | const char *buf, size_t count) | 207 | const char *buf, size_t count) |
@@ -197,12 +215,10 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, | |||
197 | if ((!count) || (buf[0] != '1')) { | 215 | if ((!count) || (buf[0] != '1')) { |
198 | return -EINVAL; | 216 | return -EINVAL; |
199 | } | 217 | } |
200 | #ifndef FORCE_EJECT | 218 | if (!acpi_device->driver && !acpi_device->handler) { |
201 | if (acpi_device->driver == NULL) { | ||
202 | ret = -ENODEV; | 219 | ret = -ENODEV; |
203 | goto err; | 220 | goto err; |
204 | } | 221 | } |
205 | #endif | ||
206 | status = acpi_get_type(acpi_device->handle, &type); | 222 | status = acpi_get_type(acpi_device->handle, &type); |
207 | if (ACPI_FAILURE(status) || (!acpi_device->flags.ejectable)) { | 223 | if (ACPI_FAILURE(status) || (!acpi_device->flags.ejectable)) { |
208 | ret = -ENODEV; | 224 | ret = -ENODEV; |
@@ -215,7 +231,8 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, | |||
215 | goto err; | 231 | goto err; |
216 | } | 232 | } |
217 | 233 | ||
218 | ej_event->handle = acpi_device->handle; | 234 | get_device(&acpi_device->dev); |
235 | ej_event->device = acpi_device; | ||
219 | if (acpi_device->flags.eject_pending) { | 236 | if (acpi_device->flags.eject_pending) { |
220 | /* event originated from ACPI eject notification */ | 237 | /* event originated from ACPI eject notification */ |
221 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | 238 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; |
@@ -223,11 +240,15 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, | |||
223 | } else { | 240 | } else { |
224 | /* event originated from user */ | 241 | /* event originated from user */ |
225 | ej_event->event = ACPI_OST_EC_OSPM_EJECT; | 242 | ej_event->event = ACPI_OST_EC_OSPM_EJECT; |
226 | (void) acpi_evaluate_hotplug_ost(ej_event->handle, | 243 | (void) acpi_evaluate_hotplug_ost(acpi_device->handle, |
227 | ej_event->event, ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | 244 | ej_event->event, ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); |
228 | } | 245 | } |
229 | 246 | ||
230 | acpi_os_hotplug_execute(acpi_bus_hot_remove_device, (void *)ej_event); | 247 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event); |
248 | if (ACPI_FAILURE(status)) { | ||
249 | put_device(&acpi_device->dev); | ||
250 | kfree(ej_event); | ||
251 | } | ||
231 | err: | 252 | err: |
232 | return ret; | 253 | return ret; |
233 | } | 254 | } |
@@ -375,8 +396,22 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
375 | * hot-removal function from userland. | 396 | * hot-removal function from userland. |
376 | */ | 397 | */ |
377 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); | 398 | status = acpi_get_handle(dev->handle, "_EJ0", &temp); |
378 | if (ACPI_SUCCESS(status)) | 399 | if (ACPI_SUCCESS(status)) { |
379 | result = device_create_file(&dev->dev, &dev_attr_eject); | 400 | result = device_create_file(&dev->dev, &dev_attr_eject); |
401 | if (result) | ||
402 | return result; | ||
403 | } | ||
404 | |||
405 | if (dev->flags.power_manageable) { | ||
406 | result = device_create_file(&dev->dev, &dev_attr_power_state); | ||
407 | if (result) | ||
408 | return result; | ||
409 | |||
410 | if (dev->power.flags.power_resources) | ||
411 | result = device_create_file(&dev->dev, | ||
412 | &dev_attr_real_power_state); | ||
413 | } | ||
414 | |||
380 | end: | 415 | end: |
381 | return result; | 416 | return result; |
382 | } | 417 | } |
@@ -386,6 +421,13 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
386 | acpi_status status; | 421 | acpi_status status; |
387 | acpi_handle temp; | 422 | acpi_handle temp; |
388 | 423 | ||
424 | if (dev->flags.power_manageable) { | ||
425 | device_remove_file(&dev->dev, &dev_attr_power_state); | ||
426 | if (dev->power.flags.power_resources) | ||
427 | device_remove_file(&dev->dev, | ||
428 | &dev_attr_real_power_state); | ||
429 | } | ||
430 | |||
389 | /* | 431 | /* |
390 | * If device has _STR, remove 'description' file | 432 | * If device has _STR, remove 'description' file |
391 | */ | 433 | */ |
@@ -454,9 +496,9 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | |||
454 | const struct device *dev) | 496 | const struct device *dev) |
455 | { | 497 | { |
456 | struct acpi_device *adev; | 498 | struct acpi_device *adev; |
499 | acpi_handle handle = ACPI_HANDLE(dev); | ||
457 | 500 | ||
458 | if (!ids || !ACPI_HANDLE(dev) | 501 | if (!ids || !handle || acpi_bus_get_device(handle, &adev)) |
459 | || ACPI_FAILURE(acpi_bus_get_device(ACPI_HANDLE(dev), &adev))) | ||
460 | return NULL; | 502 | return NULL; |
461 | 503 | ||
462 | return __acpi_match_device(adev, ids); | 504 | return __acpi_match_device(adev, ids); |
@@ -470,7 +512,7 @@ int acpi_match_device_ids(struct acpi_device *device, | |||
470 | } | 512 | } |
471 | EXPORT_SYMBOL(acpi_match_device_ids); | 513 | EXPORT_SYMBOL(acpi_match_device_ids); |
472 | 514 | ||
473 | static void acpi_free_ids(struct acpi_device *device) | 515 | void acpi_free_ids(struct acpi_device *device) |
474 | { | 516 | { |
475 | struct acpi_hardware_id *id, *tmp; | 517 | struct acpi_hardware_id *id, *tmp; |
476 | 518 | ||
@@ -478,6 +520,23 @@ static void acpi_free_ids(struct acpi_device *device) | |||
478 | kfree(id->id); | 520 | kfree(id->id); |
479 | kfree(id); | 521 | kfree(id); |
480 | } | 522 | } |
523 | kfree(device->pnp.unique_id); | ||
524 | } | ||
525 | |||
526 | static void acpi_free_power_resources_lists(struct acpi_device *device) | ||
527 | { | ||
528 | int i; | ||
529 | |||
530 | if (device->wakeup.flags.valid) | ||
531 | acpi_power_resources_list_free(&device->wakeup.resources); | ||
532 | |||
533 | if (!device->flags.power_manageable) | ||
534 | return; | ||
535 | |||
536 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { | ||
537 | struct acpi_device_power_state *ps = &device->power.states[i]; | ||
538 | acpi_power_resources_list_free(&ps->resources); | ||
539 | } | ||
481 | } | 540 | } |
482 | 541 | ||
483 | static void acpi_device_release(struct device *dev) | 542 | static void acpi_device_release(struct device *dev) |
@@ -485,7 +544,7 @@ static void acpi_device_release(struct device *dev) | |||
485 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 544 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
486 | 545 | ||
487 | acpi_free_ids(acpi_dev); | 546 | acpi_free_ids(acpi_dev); |
488 | kfree(acpi_dev->pnp.unique_id); | 547 | acpi_free_power_resources_lists(acpi_dev); |
489 | kfree(acpi_dev); | 548 | kfree(acpi_dev); |
490 | } | 549 | } |
491 | 550 | ||
@@ -494,7 +553,8 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv) | |||
494 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 553 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
495 | struct acpi_driver *acpi_drv = to_acpi_driver(drv); | 554 | struct acpi_driver *acpi_drv = to_acpi_driver(drv); |
496 | 555 | ||
497 | return !acpi_match_device_ids(acpi_dev, acpi_drv->ids); | 556 | return acpi_dev->flags.match_driver |
557 | && !acpi_match_device_ids(acpi_dev, acpi_drv->ids); | ||
498 | } | 558 | } |
499 | 559 | ||
500 | static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *env) | 560 | static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *env) |
@@ -570,7 +630,6 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) | |||
570 | } | 630 | } |
571 | 631 | ||
572 | static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *); | 632 | static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *); |
573 | static int acpi_start_single_object(struct acpi_device *); | ||
574 | static int acpi_device_probe(struct device * dev) | 633 | static int acpi_device_probe(struct device * dev) |
575 | { | 634 | { |
576 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 635 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
@@ -579,15 +638,13 @@ static int acpi_device_probe(struct device * dev) | |||
579 | 638 | ||
580 | ret = acpi_bus_driver_init(acpi_dev, acpi_drv); | 639 | ret = acpi_bus_driver_init(acpi_dev, acpi_drv); |
581 | if (!ret) { | 640 | if (!ret) { |
582 | if (acpi_dev->bus_ops.acpi_op_start) | ||
583 | acpi_start_single_object(acpi_dev); | ||
584 | |||
585 | if (acpi_drv->ops.notify) { | 641 | if (acpi_drv->ops.notify) { |
586 | ret = acpi_device_install_notify_handler(acpi_dev); | 642 | ret = acpi_device_install_notify_handler(acpi_dev); |
587 | if (ret) { | 643 | if (ret) { |
588 | if (acpi_drv->ops.remove) | 644 | if (acpi_drv->ops.remove) |
589 | acpi_drv->ops.remove(acpi_dev, | 645 | acpi_drv->ops.remove(acpi_dev); |
590 | acpi_dev->removal_type); | 646 | acpi_dev->driver = NULL; |
647 | acpi_dev->driver_data = NULL; | ||
591 | return ret; | 648 | return ret; |
592 | } | 649 | } |
593 | } | 650 | } |
@@ -609,7 +666,7 @@ static int acpi_device_remove(struct device * dev) | |||
609 | if (acpi_drv->ops.notify) | 666 | if (acpi_drv->ops.notify) |
610 | acpi_device_remove_notify_handler(acpi_dev); | 667 | acpi_device_remove_notify_handler(acpi_dev); |
611 | if (acpi_drv->ops.remove) | 668 | if (acpi_drv->ops.remove) |
612 | acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type); | 669 | acpi_drv->ops.remove(acpi_dev); |
613 | } | 670 | } |
614 | acpi_dev->driver = NULL; | 671 | acpi_dev->driver = NULL; |
615 | acpi_dev->driver_data = NULL; | 672 | acpi_dev->driver_data = NULL; |
@@ -626,12 +683,25 @@ struct bus_type acpi_bus_type = { | |||
626 | .uevent = acpi_device_uevent, | 683 | .uevent = acpi_device_uevent, |
627 | }; | 684 | }; |
628 | 685 | ||
629 | static int acpi_device_register(struct acpi_device *device) | 686 | int acpi_device_add(struct acpi_device *device, |
687 | void (*release)(struct device *)) | ||
630 | { | 688 | { |
631 | int result; | 689 | int result; |
632 | struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id; | 690 | struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id; |
633 | int found = 0; | 691 | int found = 0; |
634 | 692 | ||
693 | if (device->handle) { | ||
694 | acpi_status status; | ||
695 | |||
696 | status = acpi_attach_data(device->handle, acpi_bus_data_handler, | ||
697 | device); | ||
698 | if (ACPI_FAILURE(status)) { | ||
699 | acpi_handle_err(device->handle, | ||
700 | "Unable to attach device data\n"); | ||
701 | return -ENODEV; | ||
702 | } | ||
703 | } | ||
704 | |||
635 | /* | 705 | /* |
636 | * Linkage | 706 | * Linkage |
637 | * ------- | 707 | * ------- |
@@ -642,11 +712,13 @@ static int acpi_device_register(struct acpi_device *device) | |||
642 | INIT_LIST_HEAD(&device->wakeup_list); | 712 | INIT_LIST_HEAD(&device->wakeup_list); |
643 | INIT_LIST_HEAD(&device->physical_node_list); | 713 | INIT_LIST_HEAD(&device->physical_node_list); |
644 | mutex_init(&device->physical_node_lock); | 714 | mutex_init(&device->physical_node_lock); |
715 | INIT_LIST_HEAD(&device->power_dependent); | ||
645 | 716 | ||
646 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); | 717 | new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); |
647 | if (!new_bus_id) { | 718 | if (!new_bus_id) { |
648 | printk(KERN_ERR PREFIX "Memory allocation error\n"); | 719 | pr_err(PREFIX "Memory allocation error\n"); |
649 | return -ENOMEM; | 720 | result = -ENOMEM; |
721 | goto err_detach; | ||
650 | } | 722 | } |
651 | 723 | ||
652 | mutex_lock(&acpi_device_lock); | 724 | mutex_lock(&acpi_device_lock); |
@@ -681,11 +753,11 @@ static int acpi_device_register(struct acpi_device *device) | |||
681 | if (device->parent) | 753 | if (device->parent) |
682 | device->dev.parent = &device->parent->dev; | 754 | device->dev.parent = &device->parent->dev; |
683 | device->dev.bus = &acpi_bus_type; | 755 | device->dev.bus = &acpi_bus_type; |
684 | device->dev.release = &acpi_device_release; | 756 | device->dev.release = release; |
685 | result = device_register(&device->dev); | 757 | result = device_add(&device->dev); |
686 | if (result) { | 758 | if (result) { |
687 | dev_err(&device->dev, "Error registering device\n"); | 759 | dev_err(&device->dev, "Error registering device\n"); |
688 | goto end; | 760 | goto err; |
689 | } | 761 | } |
690 | 762 | ||
691 | result = acpi_device_setup_files(device); | 763 | result = acpi_device_setup_files(device); |
@@ -695,16 +767,20 @@ static int acpi_device_register(struct acpi_device *device) | |||
695 | 767 | ||
696 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; | 768 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; |
697 | return 0; | 769 | return 0; |
698 | end: | 770 | |
771 | err: | ||
699 | mutex_lock(&acpi_device_lock); | 772 | mutex_lock(&acpi_device_lock); |
700 | if (device->parent) | 773 | if (device->parent) |
701 | list_del(&device->node); | 774 | list_del(&device->node); |
702 | list_del(&device->wakeup_list); | 775 | list_del(&device->wakeup_list); |
703 | mutex_unlock(&acpi_device_lock); | 776 | mutex_unlock(&acpi_device_lock); |
777 | |||
778 | err_detach: | ||
779 | acpi_detach_data(device->handle, acpi_bus_data_handler); | ||
704 | return result; | 780 | return result; |
705 | } | 781 | } |
706 | 782 | ||
707 | static void acpi_device_unregister(struct acpi_device *device, int type) | 783 | static void acpi_device_unregister(struct acpi_device *device) |
708 | { | 784 | { |
709 | mutex_lock(&acpi_device_lock); | 785 | mutex_lock(&acpi_device_lock); |
710 | if (device->parent) | 786 | if (device->parent) |
@@ -715,8 +791,20 @@ static void acpi_device_unregister(struct acpi_device *device, int type) | |||
715 | 791 | ||
716 | acpi_detach_data(device->handle, acpi_bus_data_handler); | 792 | acpi_detach_data(device->handle, acpi_bus_data_handler); |
717 | 793 | ||
794 | acpi_power_add_remove_device(device, false); | ||
718 | acpi_device_remove_files(device); | 795 | acpi_device_remove_files(device); |
719 | device_unregister(&device->dev); | 796 | if (device->remove) |
797 | device->remove(device); | ||
798 | |||
799 | device_del(&device->dev); | ||
800 | /* | ||
801 | * Transition the device to D3cold to drop the reference counts of all | ||
802 | * power resources the device depends on and turn off the ones that have | ||
803 | * no more references. | ||
804 | */ | ||
805 | acpi_device_set_power(device, ACPI_STATE_D3_COLD); | ||
806 | device->handle = NULL; | ||
807 | put_device(&device->dev); | ||
720 | } | 808 | } |
721 | 809 | ||
722 | /* -------------------------------------------------------------------------- | 810 | /* -------------------------------------------------------------------------- |
@@ -760,24 +848,6 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) | |||
760 | return 0; | 848 | return 0; |
761 | } | 849 | } |
762 | 850 | ||
763 | static int acpi_start_single_object(struct acpi_device *device) | ||
764 | { | ||
765 | int result = 0; | ||
766 | struct acpi_driver *driver; | ||
767 | |||
768 | |||
769 | if (!(driver = device->driver)) | ||
770 | return 0; | ||
771 | |||
772 | if (driver->ops.start) { | ||
773 | result = driver->ops.start(device); | ||
774 | if (result && driver->ops.remove) | ||
775 | driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); | ||
776 | } | ||
777 | |||
778 | return result; | ||
779 | } | ||
780 | |||
781 | /** | 851 | /** |
782 | * acpi_bus_register_driver - register a driver with the ACPI bus | 852 | * acpi_bus_register_driver - register a driver with the ACPI bus |
783 | * @driver: driver being registered | 853 | * @driver: driver being registered |
@@ -821,29 +891,23 @@ EXPORT_SYMBOL(acpi_bus_unregister_driver); | |||
821 | -------------------------------------------------------------------------- */ | 891 | -------------------------------------------------------------------------- */ |
822 | static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) | 892 | static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) |
823 | { | 893 | { |
894 | struct acpi_device *device = NULL; | ||
824 | acpi_status status; | 895 | acpi_status status; |
825 | int ret; | ||
826 | struct acpi_device *device; | ||
827 | 896 | ||
828 | /* | 897 | /* |
829 | * Fixed hardware devices do not appear in the namespace and do not | 898 | * Fixed hardware devices do not appear in the namespace and do not |
830 | * have handles, but we fabricate acpi_devices for them, so we have | 899 | * have handles, but we fabricate acpi_devices for them, so we have |
831 | * to deal with them specially. | 900 | * to deal with them specially. |
832 | */ | 901 | */ |
833 | if (handle == NULL) | 902 | if (!handle) |
834 | return acpi_root; | 903 | return acpi_root; |
835 | 904 | ||
836 | do { | 905 | do { |
837 | status = acpi_get_parent(handle, &handle); | 906 | status = acpi_get_parent(handle, &handle); |
838 | if (status == AE_NULL_ENTRY) | ||
839 | return NULL; | ||
840 | if (ACPI_FAILURE(status)) | 907 | if (ACPI_FAILURE(status)) |
841 | return acpi_root; | 908 | return status == AE_NULL_ENTRY ? NULL : acpi_root; |
842 | 909 | } while (acpi_bus_get_device(handle, &device)); | |
843 | ret = acpi_bus_get_device(handle, &device); | 910 | return device; |
844 | if (ret == 0) | ||
845 | return device; | ||
846 | } while (1); | ||
847 | } | 911 | } |
848 | 912 | ||
849 | acpi_status | 913 | acpi_status |
@@ -877,52 +941,43 @@ void acpi_bus_data_handler(acpi_handle handle, void *context) | |||
877 | return; | 941 | return; |
878 | } | 942 | } |
879 | 943 | ||
880 | static int acpi_bus_get_perf_flags(struct acpi_device *device) | 944 | static int acpi_bus_extract_wakeup_device_power_package(acpi_handle handle, |
881 | { | 945 | struct acpi_device_wakeup *wakeup) |
882 | device->performance.state = ACPI_STATE_UNKNOWN; | ||
883 | return 0; | ||
884 | } | ||
885 | |||
886 | static acpi_status | ||
887 | acpi_bus_extract_wakeup_device_power_package(acpi_handle handle, | ||
888 | struct acpi_device_wakeup *wakeup) | ||
889 | { | 946 | { |
890 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 947 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
891 | union acpi_object *package = NULL; | 948 | union acpi_object *package = NULL; |
892 | union acpi_object *element = NULL; | 949 | union acpi_object *element = NULL; |
893 | acpi_status status; | 950 | acpi_status status; |
894 | int i = 0; | 951 | int err = -ENODATA; |
895 | 952 | ||
896 | if (!wakeup) | 953 | if (!wakeup) |
897 | return AE_BAD_PARAMETER; | 954 | return -EINVAL; |
955 | |||
956 | INIT_LIST_HEAD(&wakeup->resources); | ||
898 | 957 | ||
899 | /* _PRW */ | 958 | /* _PRW */ |
900 | status = acpi_evaluate_object(handle, "_PRW", NULL, &buffer); | 959 | status = acpi_evaluate_object(handle, "_PRW", NULL, &buffer); |
901 | if (ACPI_FAILURE(status)) { | 960 | if (ACPI_FAILURE(status)) { |
902 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW")); | 961 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW")); |
903 | return status; | 962 | return err; |
904 | } | 963 | } |
905 | 964 | ||
906 | package = (union acpi_object *)buffer.pointer; | 965 | package = (union acpi_object *)buffer.pointer; |
907 | 966 | ||
908 | if (!package || (package->package.count < 2)) { | 967 | if (!package || package->package.count < 2) |
909 | status = AE_BAD_DATA; | ||
910 | goto out; | 968 | goto out; |
911 | } | ||
912 | 969 | ||
913 | element = &(package->package.elements[0]); | 970 | element = &(package->package.elements[0]); |
914 | if (!element) { | 971 | if (!element) |
915 | status = AE_BAD_DATA; | ||
916 | goto out; | 972 | goto out; |
917 | } | 973 | |
918 | if (element->type == ACPI_TYPE_PACKAGE) { | 974 | if (element->type == ACPI_TYPE_PACKAGE) { |
919 | if ((element->package.count < 2) || | 975 | if ((element->package.count < 2) || |
920 | (element->package.elements[0].type != | 976 | (element->package.elements[0].type != |
921 | ACPI_TYPE_LOCAL_REFERENCE) | 977 | ACPI_TYPE_LOCAL_REFERENCE) |
922 | || (element->package.elements[1].type != ACPI_TYPE_INTEGER)) { | 978 | || (element->package.elements[1].type != ACPI_TYPE_INTEGER)) |
923 | status = AE_BAD_DATA; | ||
924 | goto out; | 979 | goto out; |
925 | } | 980 | |
926 | wakeup->gpe_device = | 981 | wakeup->gpe_device = |
927 | element->package.elements[0].reference.handle; | 982 | element->package.elements[0].reference.handle; |
928 | wakeup->gpe_number = | 983 | wakeup->gpe_number = |
@@ -931,38 +986,35 @@ acpi_bus_extract_wakeup_device_power_package(acpi_handle handle, | |||
931 | wakeup->gpe_device = NULL; | 986 | wakeup->gpe_device = NULL; |
932 | wakeup->gpe_number = element->integer.value; | 987 | wakeup->gpe_number = element->integer.value; |
933 | } else { | 988 | } else { |
934 | status = AE_BAD_DATA; | ||
935 | goto out; | 989 | goto out; |
936 | } | 990 | } |
937 | 991 | ||
938 | element = &(package->package.elements[1]); | 992 | element = &(package->package.elements[1]); |
939 | if (element->type != ACPI_TYPE_INTEGER) { | 993 | if (element->type != ACPI_TYPE_INTEGER) |
940 | status = AE_BAD_DATA; | ||
941 | goto out; | 994 | goto out; |
942 | } | 995 | |
943 | wakeup->sleep_state = element->integer.value; | 996 | wakeup->sleep_state = element->integer.value; |
944 | 997 | ||
945 | if ((package->package.count - 2) > ACPI_MAX_HANDLES) { | 998 | err = acpi_extract_power_resources(package, 2, &wakeup->resources); |
946 | status = AE_NO_MEMORY; | 999 | if (err) |
947 | goto out; | 1000 | goto out; |
948 | } | ||
949 | wakeup->resources.count = package->package.count - 2; | ||
950 | for (i = 0; i < wakeup->resources.count; i++) { | ||
951 | element = &(package->package.elements[i + 2]); | ||
952 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { | ||
953 | status = AE_BAD_DATA; | ||
954 | goto out; | ||
955 | } | ||
956 | 1001 | ||
957 | wakeup->resources.handles[i] = element->reference.handle; | 1002 | if (!list_empty(&wakeup->resources)) { |
958 | } | 1003 | int sleep_state; |
959 | 1004 | ||
1005 | sleep_state = acpi_power_min_system_level(&wakeup->resources); | ||
1006 | if (sleep_state < wakeup->sleep_state) { | ||
1007 | acpi_handle_warn(handle, "Overriding _PRW sleep state " | ||
1008 | "(S%d) by S%d from power resources\n", | ||
1009 | (int)wakeup->sleep_state, sleep_state); | ||
1010 | wakeup->sleep_state = sleep_state; | ||
1011 | } | ||
1012 | } | ||
960 | acpi_setup_gpe_for_wake(handle, wakeup->gpe_device, wakeup->gpe_number); | 1013 | acpi_setup_gpe_for_wake(handle, wakeup->gpe_device, wakeup->gpe_number); |
961 | 1014 | ||
962 | out: | 1015 | out: |
963 | kfree(buffer.pointer); | 1016 | kfree(buffer.pointer); |
964 | 1017 | return err; | |
965 | return status; | ||
966 | } | 1018 | } |
967 | 1019 | ||
968 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | 1020 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) |
@@ -1002,17 +1054,17 @@ static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
1002 | { | 1054 | { |
1003 | acpi_handle temp; | 1055 | acpi_handle temp; |
1004 | acpi_status status = 0; | 1056 | acpi_status status = 0; |
1005 | int psw_error; | 1057 | int err; |
1006 | 1058 | ||
1007 | /* Presence of _PRW indicates wake capable */ | 1059 | /* Presence of _PRW indicates wake capable */ |
1008 | status = acpi_get_handle(device->handle, "_PRW", &temp); | 1060 | status = acpi_get_handle(device->handle, "_PRW", &temp); |
1009 | if (ACPI_FAILURE(status)) | 1061 | if (ACPI_FAILURE(status)) |
1010 | return; | 1062 | return; |
1011 | 1063 | ||
1012 | status = acpi_bus_extract_wakeup_device_power_package(device->handle, | 1064 | err = acpi_bus_extract_wakeup_device_power_package(device->handle, |
1013 | &device->wakeup); | 1065 | &device->wakeup); |
1014 | if (ACPI_FAILURE(status)) { | 1066 | if (err) { |
1015 | ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package")); | 1067 | dev_err(&device->dev, "_PRW evaluation error: %d\n", err); |
1016 | return; | 1068 | return; |
1017 | } | 1069 | } |
1018 | 1070 | ||
@@ -1025,20 +1077,73 @@ static void acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
1025 | * So it is necessary to call _DSW object first. Only when it is not | 1077 | * So it is necessary to call _DSW object first. Only when it is not |
1026 | * present will the _PSW object used. | 1078 | * present will the _PSW object used. |
1027 | */ | 1079 | */ |
1028 | psw_error = acpi_device_sleep_wake(device, 0, 0, 0); | 1080 | err = acpi_device_sleep_wake(device, 0, 0, 0); |
1029 | if (psw_error) | 1081 | if (err) |
1030 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1082 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1031 | "error in _DSW or _PSW evaluation\n")); | 1083 | "error in _DSW or _PSW evaluation\n")); |
1032 | } | 1084 | } |
1033 | 1085 | ||
1034 | static void acpi_bus_add_power_resource(acpi_handle handle); | 1086 | static void acpi_bus_init_power_state(struct acpi_device *device, int state) |
1087 | { | ||
1088 | struct acpi_device_power_state *ps = &device->power.states[state]; | ||
1089 | char pathname[5] = { '_', 'P', 'R', '0' + state, '\0' }; | ||
1090 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
1091 | acpi_handle handle; | ||
1092 | acpi_status status; | ||
1093 | |||
1094 | INIT_LIST_HEAD(&ps->resources); | ||
1095 | |||
1096 | /* Evaluate "_PRx" to get referenced power resources */ | ||
1097 | status = acpi_evaluate_object(device->handle, pathname, NULL, &buffer); | ||
1098 | if (ACPI_SUCCESS(status)) { | ||
1099 | union acpi_object *package = buffer.pointer; | ||
1100 | |||
1101 | if (buffer.length && package | ||
1102 | && package->type == ACPI_TYPE_PACKAGE | ||
1103 | && package->package.count) { | ||
1104 | int err = acpi_extract_power_resources(package, 0, | ||
1105 | &ps->resources); | ||
1106 | if (!err) | ||
1107 | device->power.flags.power_resources = 1; | ||
1108 | } | ||
1109 | ACPI_FREE(buffer.pointer); | ||
1110 | } | ||
1111 | |||
1112 | /* Evaluate "_PSx" to see if we can do explicit sets */ | ||
1113 | pathname[2] = 'S'; | ||
1114 | status = acpi_get_handle(device->handle, pathname, &handle); | ||
1115 | if (ACPI_SUCCESS(status)) | ||
1116 | ps->flags.explicit_set = 1; | ||
1117 | |||
1118 | /* | ||
1119 | * State is valid if there are means to put the device into it. | ||
1120 | * D3hot is only valid if _PR3 present. | ||
1121 | */ | ||
1122 | if (!list_empty(&ps->resources) | ||
1123 | || (ps->flags.explicit_set && state < ACPI_STATE_D3_HOT)) { | ||
1124 | ps->flags.valid = 1; | ||
1125 | ps->flags.os_accessible = 1; | ||
1126 | } | ||
1127 | |||
1128 | ps->power = -1; /* Unknown - driver assigned */ | ||
1129 | ps->latency = -1; /* Unknown - driver assigned */ | ||
1130 | } | ||
1035 | 1131 | ||
1036 | static int acpi_bus_get_power_flags(struct acpi_device *device) | 1132 | static void acpi_bus_get_power_flags(struct acpi_device *device) |
1037 | { | 1133 | { |
1038 | acpi_status status = 0; | 1134 | acpi_status status; |
1039 | acpi_handle handle = NULL; | 1135 | acpi_handle handle; |
1040 | u32 i = 0; | 1136 | u32 i; |
1137 | |||
1138 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ | ||
1139 | status = acpi_get_handle(device->handle, "_PS0", &handle); | ||
1140 | if (ACPI_FAILURE(status)) { | ||
1141 | status = acpi_get_handle(device->handle, "_PR0", &handle); | ||
1142 | if (ACPI_FAILURE(status)) | ||
1143 | return; | ||
1144 | } | ||
1041 | 1145 | ||
1146 | device->flags.power_manageable = 1; | ||
1042 | 1147 | ||
1043 | /* | 1148 | /* |
1044 | * Power Management Flags | 1149 | * Power Management Flags |
@@ -1053,40 +1158,10 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
1053 | /* | 1158 | /* |
1054 | * Enumerate supported power management states | 1159 | * Enumerate supported power management states |
1055 | */ | 1160 | */ |
1056 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { | 1161 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) |
1057 | struct acpi_device_power_state *ps = &device->power.states[i]; | 1162 | acpi_bus_init_power_state(device, i); |
1058 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; | ||
1059 | |||
1060 | /* Evaluate "_PRx" to se if power resources are referenced */ | ||
1061 | acpi_evaluate_reference(device->handle, object_name, NULL, | ||
1062 | &ps->resources); | ||
1063 | if (ps->resources.count) { | ||
1064 | int j; | ||
1065 | |||
1066 | device->power.flags.power_resources = 1; | ||
1067 | for (j = 0; j < ps->resources.count; j++) | ||
1068 | acpi_bus_add_power_resource(ps->resources.handles[j]); | ||
1069 | } | ||
1070 | 1163 | ||
1071 | /* Evaluate "_PSx" to see if we can do explicit sets */ | 1164 | INIT_LIST_HEAD(&device->power.states[ACPI_STATE_D3_COLD].resources); |
1072 | object_name[2] = 'S'; | ||
1073 | status = acpi_get_handle(device->handle, object_name, &handle); | ||
1074 | if (ACPI_SUCCESS(status)) | ||
1075 | ps->flags.explicit_set = 1; | ||
1076 | |||
1077 | /* | ||
1078 | * State is valid if there are means to put the device into it. | ||
1079 | * D3hot is only valid if _PR3 present. | ||
1080 | */ | ||
1081 | if (ps->resources.count || | ||
1082 | (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT)) { | ||
1083 | ps->flags.valid = 1; | ||
1084 | ps->flags.os_accessible = 1; | ||
1085 | } | ||
1086 | |||
1087 | ps->power = -1; /* Unknown - driver assigned */ | ||
1088 | ps->latency = -1; /* Unknown - driver assigned */ | ||
1089 | } | ||
1090 | 1165 | ||
1091 | /* Set defaults for D0 and D3 states (always valid) */ | 1166 | /* Set defaults for D0 and D3 states (always valid) */ |
1092 | device->power.states[ACPI_STATE_D0].flags.valid = 1; | 1167 | device->power.states[ACPI_STATE_D0].flags.valid = 1; |
@@ -1103,17 +1178,17 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
1103 | device->power.flags.power_resources) | 1178 | device->power.flags.power_resources) |
1104 | device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1; | 1179 | device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1; |
1105 | 1180 | ||
1106 | acpi_bus_init_power(device); | 1181 | if (acpi_bus_init_power(device)) { |
1107 | 1182 | acpi_free_power_resources_lists(device); | |
1108 | return 0; | 1183 | device->flags.power_manageable = 0; |
1184 | } | ||
1109 | } | 1185 | } |
1110 | 1186 | ||
1111 | static int acpi_bus_get_flags(struct acpi_device *device) | 1187 | static void acpi_bus_get_flags(struct acpi_device *device) |
1112 | { | 1188 | { |
1113 | acpi_status status = AE_OK; | 1189 | acpi_status status = AE_OK; |
1114 | acpi_handle temp = NULL; | 1190 | acpi_handle temp = NULL; |
1115 | 1191 | ||
1116 | |||
1117 | /* Presence of _STA indicates 'dynamic_status' */ | 1192 | /* Presence of _STA indicates 'dynamic_status' */ |
1118 | status = acpi_get_handle(device->handle, "_STA", &temp); | 1193 | status = acpi_get_handle(device->handle, "_STA", &temp); |
1119 | if (ACPI_SUCCESS(status)) | 1194 | if (ACPI_SUCCESS(status)) |
@@ -1133,21 +1208,6 @@ static int acpi_bus_get_flags(struct acpi_device *device) | |||
1133 | if (ACPI_SUCCESS(status)) | 1208 | if (ACPI_SUCCESS(status)) |
1134 | device->flags.ejectable = 1; | 1209 | device->flags.ejectable = 1; |
1135 | } | 1210 | } |
1136 | |||
1137 | /* Power resources cannot be power manageable. */ | ||
1138 | if (device->device_type == ACPI_BUS_TYPE_POWER) | ||
1139 | return 0; | ||
1140 | |||
1141 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ | ||
1142 | status = acpi_get_handle(device->handle, "_PS0", &temp); | ||
1143 | if (ACPI_FAILURE(status)) | ||
1144 | status = acpi_get_handle(device->handle, "_PR0", &temp); | ||
1145 | if (ACPI_SUCCESS(status)) | ||
1146 | device->flags.power_manageable = 1; | ||
1147 | |||
1148 | /* TBD: Performance management */ | ||
1149 | |||
1150 | return 0; | ||
1151 | } | 1211 | } |
1152 | 1212 | ||
1153 | static void acpi_device_get_busid(struct acpi_device *device) | 1213 | static void acpi_device_get_busid(struct acpi_device *device) |
@@ -1372,56 +1432,32 @@ static void acpi_device_set_id(struct acpi_device *device) | |||
1372 | } | 1432 | } |
1373 | } | 1433 | } |
1374 | 1434 | ||
1375 | static int acpi_device_set_context(struct acpi_device *device) | 1435 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, |
1436 | int type, unsigned long long sta) | ||
1376 | { | 1437 | { |
1377 | acpi_status status; | 1438 | INIT_LIST_HEAD(&device->pnp.ids); |
1378 | 1439 | device->device_type = type; | |
1379 | /* | 1440 | device->handle = handle; |
1380 | * Context | 1441 | device->parent = acpi_bus_get_parent(handle); |
1381 | * ------- | 1442 | STRUCT_TO_INT(device->status) = sta; |
1382 | * Attach this 'struct acpi_device' to the ACPI object. This makes | 1443 | acpi_device_get_busid(device); |
1383 | * resolutions from handle->device very efficient. Fixed hardware | 1444 | acpi_device_set_id(device); |
1384 | * devices have no handles, so we skip them. | 1445 | acpi_bus_get_flags(device); |
1385 | */ | 1446 | device->flags.match_driver = false; |
1386 | if (!device->handle) | 1447 | device_initialize(&device->dev); |
1387 | return 0; | 1448 | dev_set_uevent_suppress(&device->dev, true); |
1388 | |||
1389 | status = acpi_attach_data(device->handle, | ||
1390 | acpi_bus_data_handler, device); | ||
1391 | if (ACPI_SUCCESS(status)) | ||
1392 | return 0; | ||
1393 | |||
1394 | printk(KERN_ERR PREFIX "Error attaching device data\n"); | ||
1395 | return -ENODEV; | ||
1396 | } | 1449 | } |
1397 | 1450 | ||
1398 | static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) | 1451 | void acpi_device_add_finalize(struct acpi_device *device) |
1399 | { | 1452 | { |
1400 | if (!dev) | 1453 | device->flags.match_driver = true; |
1401 | return -EINVAL; | 1454 | dev_set_uevent_suppress(&device->dev, false); |
1402 | 1455 | kobject_uevent(&device->dev.kobj, KOBJ_ADD); | |
1403 | dev->removal_type = ACPI_BUS_REMOVAL_EJECT; | ||
1404 | device_release_driver(&dev->dev); | ||
1405 | |||
1406 | if (!rmdevice) | ||
1407 | return 0; | ||
1408 | |||
1409 | /* | ||
1410 | * unbind _ADR-Based Devices when hot removal | ||
1411 | */ | ||
1412 | if (dev->flags.bus_address) { | ||
1413 | if ((dev->parent) && (dev->parent->ops.unbind)) | ||
1414 | dev->parent->ops.unbind(dev); | ||
1415 | } | ||
1416 | acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); | ||
1417 | |||
1418 | return 0; | ||
1419 | } | 1456 | } |
1420 | 1457 | ||
1421 | static int acpi_add_single_object(struct acpi_device **child, | 1458 | static int acpi_add_single_object(struct acpi_device **child, |
1422 | acpi_handle handle, int type, | 1459 | acpi_handle handle, int type, |
1423 | unsigned long long sta, | 1460 | unsigned long long sta) |
1424 | struct acpi_bus_ops *ops) | ||
1425 | { | 1461 | { |
1426 | int result; | 1462 | int result; |
1427 | struct acpi_device *device; | 1463 | struct acpi_device *device; |
@@ -1433,102 +1469,25 @@ static int acpi_add_single_object(struct acpi_device **child, | |||
1433 | return -ENOMEM; | 1469 | return -ENOMEM; |
1434 | } | 1470 | } |
1435 | 1471 | ||
1436 | INIT_LIST_HEAD(&device->pnp.ids); | 1472 | acpi_init_device_object(device, handle, type, sta); |
1437 | device->device_type = type; | 1473 | acpi_bus_get_power_flags(device); |
1438 | device->handle = handle; | ||
1439 | device->parent = acpi_bus_get_parent(handle); | ||
1440 | device->bus_ops = *ops; /* workround for not call .start */ | ||
1441 | STRUCT_TO_INT(device->status) = sta; | ||
1442 | |||
1443 | acpi_device_get_busid(device); | ||
1444 | |||
1445 | /* | ||
1446 | * Flags | ||
1447 | * ----- | ||
1448 | * Note that we only look for object handles -- cannot evaluate objects | ||
1449 | * until we know the device is present and properly initialized. | ||
1450 | */ | ||
1451 | result = acpi_bus_get_flags(device); | ||
1452 | if (result) | ||
1453 | goto end; | ||
1454 | |||
1455 | /* | ||
1456 | * Initialize Device | ||
1457 | * ----------------- | ||
1458 | * TBD: Synch with Core's enumeration/initialization process. | ||
1459 | */ | ||
1460 | acpi_device_set_id(device); | ||
1461 | |||
1462 | /* | ||
1463 | * Power Management | ||
1464 | * ---------------- | ||
1465 | */ | ||
1466 | if (device->flags.power_manageable) { | ||
1467 | result = acpi_bus_get_power_flags(device); | ||
1468 | if (result) | ||
1469 | goto end; | ||
1470 | } | ||
1471 | |||
1472 | /* | ||
1473 | * Wakeup device management | ||
1474 | *----------------------- | ||
1475 | */ | ||
1476 | acpi_bus_get_wakeup_device_flags(device); | 1474 | acpi_bus_get_wakeup_device_flags(device); |
1477 | 1475 | ||
1478 | /* | 1476 | result = acpi_device_add(device, acpi_device_release); |
1479 | * Performance Management | 1477 | if (result) { |
1480 | * ---------------------- | ||
1481 | */ | ||
1482 | if (device->flags.performance_manageable) { | ||
1483 | result = acpi_bus_get_perf_flags(device); | ||
1484 | if (result) | ||
1485 | goto end; | ||
1486 | } | ||
1487 | |||
1488 | if ((result = acpi_device_set_context(device))) | ||
1489 | goto end; | ||
1490 | |||
1491 | result = acpi_device_register(device); | ||
1492 | |||
1493 | /* | ||
1494 | * Bind _ADR-Based Devices when hot add | ||
1495 | */ | ||
1496 | if (device->flags.bus_address) { | ||
1497 | if (device->parent && device->parent->ops.bind) | ||
1498 | device->parent->ops.bind(device); | ||
1499 | } | ||
1500 | |||
1501 | end: | ||
1502 | if (!result) { | ||
1503 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | ||
1504 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
1505 | "Adding %s [%s] parent %s\n", dev_name(&device->dev), | ||
1506 | (char *) buffer.pointer, | ||
1507 | device->parent ? dev_name(&device->parent->dev) : | ||
1508 | "(null)")); | ||
1509 | kfree(buffer.pointer); | ||
1510 | *child = device; | ||
1511 | } else | ||
1512 | acpi_device_release(&device->dev); | 1478 | acpi_device_release(&device->dev); |
1479 | return result; | ||
1480 | } | ||
1513 | 1481 | ||
1514 | return result; | 1482 | acpi_power_add_remove_device(device, true); |
1515 | } | 1483 | acpi_device_add_finalize(device); |
1516 | 1484 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | |
1517 | #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ | 1485 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Added %s [%s] parent %s\n", |
1518 | ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) | 1486 | dev_name(&device->dev), (char *) buffer.pointer, |
1519 | 1487 | device->parent ? dev_name(&device->parent->dev) : "(null)")); | |
1520 | static void acpi_bus_add_power_resource(acpi_handle handle) | 1488 | kfree(buffer.pointer); |
1521 | { | 1489 | *child = device; |
1522 | struct acpi_bus_ops ops = { | 1490 | return 0; |
1523 | .acpi_op_add = 1, | ||
1524 | .acpi_op_start = 1, | ||
1525 | }; | ||
1526 | struct acpi_device *device = NULL; | ||
1527 | |||
1528 | acpi_bus_get_device(handle, &device); | ||
1529 | if (!device) | ||
1530 | acpi_add_single_object(&device, handle, ACPI_BUS_TYPE_POWER, | ||
1531 | ACPI_STA_DEFAULT, &ops); | ||
1532 | } | 1491 | } |
1533 | 1492 | ||
1534 | static int acpi_bus_type_and_status(acpi_handle handle, int *type, | 1493 | static int acpi_bus_type_and_status(acpi_handle handle, int *type, |
@@ -1570,218 +1529,248 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, | |||
1570 | return 0; | 1529 | return 0; |
1571 | } | 1530 | } |
1572 | 1531 | ||
1573 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl, | 1532 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, |
1574 | void *context, void **return_value) | 1533 | void *not_used, void **return_value) |
1575 | { | 1534 | { |
1576 | struct acpi_bus_ops *ops = context; | 1535 | struct acpi_device *device = NULL; |
1577 | int type; | 1536 | int type; |
1578 | unsigned long long sta; | 1537 | unsigned long long sta; |
1579 | struct acpi_device *device; | ||
1580 | acpi_status status; | 1538 | acpi_status status; |
1581 | int result; | 1539 | int result; |
1582 | 1540 | ||
1541 | acpi_bus_get_device(handle, &device); | ||
1542 | if (device) | ||
1543 | goto out; | ||
1544 | |||
1583 | result = acpi_bus_type_and_status(handle, &type, &sta); | 1545 | result = acpi_bus_type_and_status(handle, &type, &sta); |
1584 | if (result) | 1546 | if (result) |
1585 | return AE_OK; | 1547 | return AE_OK; |
1586 | 1548 | ||
1549 | if (type == ACPI_BUS_TYPE_POWER) { | ||
1550 | acpi_add_power_resource(handle); | ||
1551 | return AE_OK; | ||
1552 | } | ||
1553 | |||
1587 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && | 1554 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && |
1588 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { | 1555 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { |
1589 | struct acpi_device_wakeup wakeup; | 1556 | struct acpi_device_wakeup wakeup; |
1590 | acpi_handle temp; | 1557 | acpi_handle temp; |
1591 | 1558 | ||
1592 | status = acpi_get_handle(handle, "_PRW", &temp); | 1559 | status = acpi_get_handle(handle, "_PRW", &temp); |
1593 | if (ACPI_SUCCESS(status)) | 1560 | if (ACPI_SUCCESS(status)) { |
1594 | acpi_bus_extract_wakeup_device_power_package(handle, | 1561 | acpi_bus_extract_wakeup_device_power_package(handle, |
1595 | &wakeup); | 1562 | &wakeup); |
1563 | acpi_power_resources_list_free(&wakeup.resources); | ||
1564 | } | ||
1596 | return AE_CTRL_DEPTH; | 1565 | return AE_CTRL_DEPTH; |
1597 | } | 1566 | } |
1598 | 1567 | ||
1599 | /* | 1568 | acpi_add_single_object(&device, handle, type, sta); |
1600 | * We may already have an acpi_device from a previous enumeration. If | ||
1601 | * so, we needn't add it again, but we may still have to start it. | ||
1602 | */ | ||
1603 | device = NULL; | ||
1604 | acpi_bus_get_device(handle, &device); | ||
1605 | if (ops->acpi_op_add && !device) { | ||
1606 | acpi_add_single_object(&device, handle, type, sta, ops); | ||
1607 | /* Is the device a known good platform device? */ | ||
1608 | if (device | ||
1609 | && !acpi_match_device_ids(device, acpi_platform_device_ids)) | ||
1610 | acpi_create_platform_device(device); | ||
1611 | } | ||
1612 | |||
1613 | if (!device) | 1569 | if (!device) |
1614 | return AE_CTRL_DEPTH; | 1570 | return AE_CTRL_DEPTH; |
1615 | 1571 | ||
1616 | if (ops->acpi_op_start && !(ops->acpi_op_add)) { | 1572 | out: |
1617 | status = acpi_start_single_object(device); | ||
1618 | if (ACPI_FAILURE(status)) | ||
1619 | return AE_CTRL_DEPTH; | ||
1620 | } | ||
1621 | |||
1622 | if (!*return_value) | 1573 | if (!*return_value) |
1623 | *return_value = device; | 1574 | *return_value = device; |
1575 | |||
1624 | return AE_OK; | 1576 | return AE_OK; |
1625 | } | 1577 | } |
1626 | 1578 | ||
1627 | static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops, | 1579 | static int acpi_scan_do_attach_handler(struct acpi_device *device, char *id) |
1628 | struct acpi_device **child) | ||
1629 | { | 1580 | { |
1630 | acpi_status status; | 1581 | struct acpi_scan_handler *handler; |
1631 | void *device = NULL; | ||
1632 | 1582 | ||
1633 | status = acpi_bus_check_add(handle, 0, ops, &device); | 1583 | list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) { |
1634 | if (ACPI_SUCCESS(status)) | 1584 | const struct acpi_device_id *devid; |
1635 | acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, | ||
1636 | acpi_bus_check_add, NULL, ops, &device); | ||
1637 | 1585 | ||
1638 | if (child) | 1586 | for (devid = handler->ids; devid->id[0]; devid++) { |
1639 | *child = device; | 1587 | int ret; |
1640 | 1588 | ||
1641 | if (device) | 1589 | if (strcmp((char *)devid->id, id)) |
1642 | return 0; | 1590 | continue; |
1643 | else | ||
1644 | return -ENODEV; | ||
1645 | } | ||
1646 | 1591 | ||
1647 | /* | 1592 | ret = handler->attach(device, devid); |
1648 | * acpi_bus_add and acpi_bus_start | 1593 | if (ret > 0) { |
1649 | * | 1594 | device->handler = handler; |
1650 | * scan a given ACPI tree and (probably recently hot-plugged) | 1595 | return ret; |
1651 | * create and add or starts found devices. | 1596 | } else if (ret < 0) { |
1652 | * | 1597 | return ret; |
1653 | * If no devices were found -ENODEV is returned which does not | 1598 | } |
1654 | * mean that this is a real error, there just have been no suitable | 1599 | } |
1655 | * ACPI objects in the table trunk from which the kernel could create | 1600 | } |
1656 | * a device and add/start an appropriate driver. | 1601 | return 0; |
1657 | */ | 1602 | } |
1658 | 1603 | ||
1659 | int | 1604 | static int acpi_scan_attach_handler(struct acpi_device *device) |
1660 | acpi_bus_add(struct acpi_device **child, | ||
1661 | struct acpi_device *parent, acpi_handle handle, int type) | ||
1662 | { | 1605 | { |
1663 | struct acpi_bus_ops ops; | 1606 | struct acpi_hardware_id *hwid; |
1607 | int ret = 0; | ||
1664 | 1608 | ||
1665 | memset(&ops, 0, sizeof(ops)); | 1609 | list_for_each_entry(hwid, &device->pnp.ids, list) { |
1666 | ops.acpi_op_add = 1; | 1610 | ret = acpi_scan_do_attach_handler(device, hwid->id); |
1611 | if (ret) | ||
1612 | break; | ||
1667 | 1613 | ||
1668 | return acpi_bus_scan(handle, &ops, child); | 1614 | } |
1615 | return ret; | ||
1669 | } | 1616 | } |
1670 | EXPORT_SYMBOL(acpi_bus_add); | ||
1671 | 1617 | ||
1672 | int acpi_bus_start(struct acpi_device *device) | 1618 | static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used, |
1619 | void *not_used, void **ret_not_used) | ||
1673 | { | 1620 | { |
1674 | struct acpi_bus_ops ops; | 1621 | struct acpi_device *device; |
1675 | int result; | 1622 | unsigned long long sta_not_used; |
1676 | 1623 | int ret; | |
1677 | if (!device) | ||
1678 | return -EINVAL; | ||
1679 | 1624 | ||
1680 | memset(&ops, 0, sizeof(ops)); | 1625 | /* |
1681 | ops.acpi_op_start = 1; | 1626 | * Ignore errors ignored by acpi_bus_check_add() to avoid terminating |
1627 | * namespace walks prematurely. | ||
1628 | */ | ||
1629 | if (acpi_bus_type_and_status(handle, &ret, &sta_not_used)) | ||
1630 | return AE_OK; | ||
1682 | 1631 | ||
1683 | result = acpi_bus_scan(device->handle, &ops, NULL); | 1632 | if (acpi_bus_get_device(handle, &device)) |
1633 | return AE_CTRL_DEPTH; | ||
1684 | 1634 | ||
1685 | acpi_update_all_gpes(); | 1635 | ret = acpi_scan_attach_handler(device); |
1636 | if (ret) | ||
1637 | return ret > 0 ? AE_OK : AE_CTRL_DEPTH; | ||
1686 | 1638 | ||
1687 | return result; | 1639 | ret = device_attach(&device->dev); |
1640 | return ret >= 0 ? AE_OK : AE_CTRL_DEPTH; | ||
1688 | } | 1641 | } |
1689 | EXPORT_SYMBOL(acpi_bus_start); | ||
1690 | 1642 | ||
1691 | int acpi_bus_trim(struct acpi_device *start, int rmdevice) | 1643 | /** |
1644 | * acpi_bus_scan - Add ACPI device node objects in a given namespace scope. | ||
1645 | * @handle: Root of the namespace scope to scan. | ||
1646 | * | ||
1647 | * Scan a given ACPI tree (probably recently hot-plugged) and create and add | ||
1648 | * found devices. | ||
1649 | * | ||
1650 | * If no devices were found, -ENODEV is returned, but it does not mean that | ||
1651 | * there has been a real error. There just have been no suitable ACPI objects | ||
1652 | * in the table trunk from which the kernel could create a device and add an | ||
1653 | * appropriate driver. | ||
1654 | * | ||
1655 | * Must be called under acpi_scan_lock. | ||
1656 | */ | ||
1657 | int acpi_bus_scan(acpi_handle handle) | ||
1692 | { | 1658 | { |
1693 | acpi_status status; | 1659 | void *device = NULL; |
1694 | struct acpi_device *parent, *child; | 1660 | int error = 0; |
1695 | acpi_handle phandle, chandle; | ||
1696 | acpi_object_type type; | ||
1697 | u32 level = 1; | ||
1698 | int err = 0; | ||
1699 | 1661 | ||
1700 | parent = start; | 1662 | if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device))) |
1701 | phandle = start->handle; | 1663 | acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, |
1702 | child = chandle = NULL; | 1664 | acpi_bus_check_add, NULL, NULL, &device); |
1703 | 1665 | ||
1704 | while ((level > 0) && parent && (!err)) { | 1666 | if (!device) |
1705 | status = acpi_get_next_object(ACPI_TYPE_ANY, phandle, | 1667 | error = -ENODEV; |
1706 | chandle, &chandle); | 1668 | else if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL))) |
1669 | acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, | ||
1670 | acpi_bus_device_attach, NULL, NULL, NULL); | ||
1707 | 1671 | ||
1708 | /* | 1672 | return error; |
1709 | * If this scope is exhausted then move our way back up. | 1673 | } |
1710 | */ | 1674 | EXPORT_SYMBOL(acpi_bus_scan); |
1711 | if (ACPI_FAILURE(status)) { | ||
1712 | level--; | ||
1713 | chandle = phandle; | ||
1714 | acpi_get_parent(phandle, &phandle); | ||
1715 | child = parent; | ||
1716 | parent = parent->parent; | ||
1717 | |||
1718 | if (level == 0) | ||
1719 | err = acpi_bus_remove(child, rmdevice); | ||
1720 | else | ||
1721 | err = acpi_bus_remove(child, 1); | ||
1722 | 1675 | ||
1723 | continue; | 1676 | static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used, |
1724 | } | 1677 | void *not_used, void **ret_not_used) |
1678 | { | ||
1679 | struct acpi_device *device = NULL; | ||
1725 | 1680 | ||
1726 | status = acpi_get_type(chandle, &type); | 1681 | if (!acpi_bus_get_device(handle, &device)) { |
1727 | if (ACPI_FAILURE(status)) { | 1682 | struct acpi_scan_handler *dev_handler = device->handler; |
1728 | continue; | 1683 | |
1729 | } | 1684 | device->removal_type = ACPI_BUS_REMOVAL_EJECT; |
1730 | /* | 1685 | if (dev_handler) { |
1731 | * If there is a device corresponding to chandle then | 1686 | if (dev_handler->detach) |
1732 | * parse it (depth-first). | 1687 | dev_handler->detach(device); |
1733 | */ | 1688 | |
1734 | if (acpi_bus_get_device(chandle, &child) == 0) { | 1689 | device->handler = NULL; |
1735 | level++; | 1690 | } else { |
1736 | phandle = chandle; | 1691 | device_release_driver(&device->dev); |
1737 | chandle = NULL; | ||
1738 | parent = child; | ||
1739 | } | 1692 | } |
1740 | continue; | ||
1741 | } | 1693 | } |
1742 | return err; | 1694 | return AE_OK; |
1695 | } | ||
1696 | |||
1697 | static acpi_status acpi_bus_remove(acpi_handle handle, u32 lvl_not_used, | ||
1698 | void *not_used, void **ret_not_used) | ||
1699 | { | ||
1700 | struct acpi_device *device = NULL; | ||
1701 | |||
1702 | if (!acpi_bus_get_device(handle, &device)) | ||
1703 | acpi_device_unregister(device); | ||
1704 | |||
1705 | return AE_OK; | ||
1706 | } | ||
1707 | |||
1708 | /** | ||
1709 | * acpi_bus_trim - Remove ACPI device node and all of its descendants | ||
1710 | * @start: Root of the ACPI device nodes subtree to remove. | ||
1711 | * | ||
1712 | * Must be called under acpi_scan_lock. | ||
1713 | */ | ||
1714 | void acpi_bus_trim(struct acpi_device *start) | ||
1715 | { | ||
1716 | /* | ||
1717 | * Execute acpi_bus_device_detach() as a post-order callback to detach | ||
1718 | * all ACPI drivers from the device nodes being removed. | ||
1719 | */ | ||
1720 | acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, | ||
1721 | acpi_bus_device_detach, NULL, NULL); | ||
1722 | acpi_bus_device_detach(start->handle, 0, NULL, NULL); | ||
1723 | /* | ||
1724 | * Execute acpi_bus_remove() as a post-order callback to remove device | ||
1725 | * nodes in the given namespace scope. | ||
1726 | */ | ||
1727 | acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, | ||
1728 | acpi_bus_remove, NULL, NULL); | ||
1729 | acpi_bus_remove(start->handle, 0, NULL, NULL); | ||
1743 | } | 1730 | } |
1744 | EXPORT_SYMBOL_GPL(acpi_bus_trim); | 1731 | EXPORT_SYMBOL_GPL(acpi_bus_trim); |
1745 | 1732 | ||
1746 | static int acpi_bus_scan_fixed(void) | 1733 | static int acpi_bus_scan_fixed(void) |
1747 | { | 1734 | { |
1748 | int result = 0; | 1735 | int result = 0; |
1749 | struct acpi_device *device = NULL; | ||
1750 | struct acpi_bus_ops ops; | ||
1751 | |||
1752 | memset(&ops, 0, sizeof(ops)); | ||
1753 | ops.acpi_op_add = 1; | ||
1754 | ops.acpi_op_start = 1; | ||
1755 | 1736 | ||
1756 | /* | 1737 | /* |
1757 | * Enumerate all fixed-feature devices. | 1738 | * Enumerate all fixed-feature devices. |
1758 | */ | 1739 | */ |
1759 | if ((acpi_gbl_FADT.flags & ACPI_FADT_POWER_BUTTON) == 0) { | 1740 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_POWER_BUTTON)) { |
1741 | struct acpi_device *device = NULL; | ||
1742 | |||
1760 | result = acpi_add_single_object(&device, NULL, | 1743 | result = acpi_add_single_object(&device, NULL, |
1761 | ACPI_BUS_TYPE_POWER_BUTTON, | 1744 | ACPI_BUS_TYPE_POWER_BUTTON, |
1762 | ACPI_STA_DEFAULT, | 1745 | ACPI_STA_DEFAULT); |
1763 | &ops); | 1746 | if (result) |
1747 | return result; | ||
1748 | |||
1749 | result = device_attach(&device->dev); | ||
1750 | if (result < 0) | ||
1751 | return result; | ||
1752 | |||
1764 | device_init_wakeup(&device->dev, true); | 1753 | device_init_wakeup(&device->dev, true); |
1765 | } | 1754 | } |
1766 | 1755 | ||
1767 | if ((acpi_gbl_FADT.flags & ACPI_FADT_SLEEP_BUTTON) == 0) { | 1756 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_SLEEP_BUTTON)) { |
1757 | struct acpi_device *device = NULL; | ||
1758 | |||
1768 | result = acpi_add_single_object(&device, NULL, | 1759 | result = acpi_add_single_object(&device, NULL, |
1769 | ACPI_BUS_TYPE_SLEEP_BUTTON, | 1760 | ACPI_BUS_TYPE_SLEEP_BUTTON, |
1770 | ACPI_STA_DEFAULT, | 1761 | ACPI_STA_DEFAULT); |
1771 | &ops); | 1762 | if (result) |
1763 | return result; | ||
1764 | |||
1765 | result = device_attach(&device->dev); | ||
1772 | } | 1766 | } |
1773 | 1767 | ||
1774 | return result; | 1768 | return result < 0 ? result : 0; |
1775 | } | 1769 | } |
1776 | 1770 | ||
1777 | int __init acpi_scan_init(void) | 1771 | int __init acpi_scan_init(void) |
1778 | { | 1772 | { |
1779 | int result; | 1773 | int result; |
1780 | struct acpi_bus_ops ops; | ||
1781 | |||
1782 | memset(&ops, 0, sizeof(ops)); | ||
1783 | ops.acpi_op_add = 1; | ||
1784 | ops.acpi_op_start = 1; | ||
1785 | 1774 | ||
1786 | result = bus_register(&acpi_bus_type); | 1775 | result = bus_register(&acpi_bus_type); |
1787 | if (result) { | 1776 | if (result) { |
@@ -1789,20 +1778,33 @@ int __init acpi_scan_init(void) | |||
1789 | printk(KERN_ERR PREFIX "Could not register bus type\n"); | 1778 | printk(KERN_ERR PREFIX "Could not register bus type\n"); |
1790 | } | 1779 | } |
1791 | 1780 | ||
1792 | acpi_power_init(); | 1781 | acpi_pci_root_init(); |
1782 | acpi_pci_link_init(); | ||
1783 | acpi_platform_init(); | ||
1784 | acpi_csrt_init(); | ||
1785 | acpi_container_init(); | ||
1793 | 1786 | ||
1787 | mutex_lock(&acpi_scan_lock); | ||
1794 | /* | 1788 | /* |
1795 | * Enumerate devices in the ACPI namespace. | 1789 | * Enumerate devices in the ACPI namespace. |
1796 | */ | 1790 | */ |
1797 | result = acpi_bus_scan(ACPI_ROOT_OBJECT, &ops, &acpi_root); | 1791 | result = acpi_bus_scan(ACPI_ROOT_OBJECT); |
1798 | 1792 | if (result) | |
1799 | if (!result) | 1793 | goto out; |
1800 | result = acpi_bus_scan_fixed(); | ||
1801 | 1794 | ||
1795 | result = acpi_bus_get_device(ACPI_ROOT_OBJECT, &acpi_root); | ||
1802 | if (result) | 1796 | if (result) |
1803 | acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); | 1797 | goto out; |
1804 | else | 1798 | |
1805 | acpi_update_all_gpes(); | 1799 | result = acpi_bus_scan_fixed(); |
1800 | if (result) { | ||
1801 | acpi_device_unregister(acpi_root); | ||
1802 | goto out; | ||
1803 | } | ||
1806 | 1804 | ||
1805 | acpi_update_all_gpes(); | ||
1806 | |||
1807 | out: | ||
1808 | mutex_unlock(&acpi_scan_lock); | ||
1807 | return result; | 1809 | return result; |
1808 | } | 1810 | } |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 2fcc67d34b11..6d3a06a629a1 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -177,6 +177,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
177 | }, | 177 | }, |
178 | { | 178 | { |
179 | .callback = init_nvs_nosave, | 179 | .callback = init_nvs_nosave, |
180 | .ident = "Sony Vaio VGN-FW41E_H", | ||
181 | .matches = { | ||
182 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
183 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW41E_H"), | ||
184 | }, | ||
185 | }, | ||
186 | { | ||
187 | .callback = init_nvs_nosave, | ||
180 | .ident = "Sony Vaio VGN-FW21E", | 188 | .ident = "Sony Vaio VGN-FW21E", |
181 | .matches = { | 189 | .matches = { |
182 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | 190 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
@@ -386,6 +394,8 @@ static void acpi_pm_finish(void) | |||
386 | 394 | ||
387 | acpi_target_sleep_state = ACPI_STATE_S0; | 395 | acpi_target_sleep_state = ACPI_STATE_S0; |
388 | 396 | ||
397 | acpi_resume_power_resources(); | ||
398 | |||
389 | /* If we were woken with the fixed power button, provide a small | 399 | /* If we were woken with the fixed power button, provide a small |
390 | * hint to userspace in the form of a wakeup event on the fixed power | 400 | * hint to userspace in the form of a wakeup event on the fixed power |
391 | * button device (if it can be found). | 401 | * button device (if it can be found). |
@@ -577,7 +587,28 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = { | |||
577 | .end = acpi_pm_end, | 587 | .end = acpi_pm_end, |
578 | .recover = acpi_pm_finish, | 588 | .recover = acpi_pm_finish, |
579 | }; | 589 | }; |
580 | #endif /* CONFIG_SUSPEND */ | 590 | |
591 | static void acpi_sleep_suspend_setup(void) | ||
592 | { | ||
593 | int i; | ||
594 | |||
595 | for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) { | ||
596 | acpi_status status; | ||
597 | u8 type_a, type_b; | ||
598 | |||
599 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); | ||
600 | if (ACPI_SUCCESS(status)) { | ||
601 | sleep_states[i] = 1; | ||
602 | pr_cont(" S%d", i); | ||
603 | } | ||
604 | } | ||
605 | |||
606 | suspend_set_ops(old_suspend_ordering ? | ||
607 | &acpi_suspend_ops_old : &acpi_suspend_ops); | ||
608 | } | ||
609 | #else /* !CONFIG_SUSPEND */ | ||
610 | static inline void acpi_sleep_suspend_setup(void) {} | ||
611 | #endif /* !CONFIG_SUSPEND */ | ||
581 | 612 | ||
582 | #ifdef CONFIG_HIBERNATION | 613 | #ifdef CONFIG_HIBERNATION |
583 | static unsigned long s4_hardware_signature; | 614 | static unsigned long s4_hardware_signature; |
@@ -698,7 +729,30 @@ static const struct platform_hibernation_ops acpi_hibernation_ops_old = { | |||
698 | .restore_cleanup = acpi_pm_thaw, | 729 | .restore_cleanup = acpi_pm_thaw, |
699 | .recover = acpi_pm_finish, | 730 | .recover = acpi_pm_finish, |
700 | }; | 731 | }; |
701 | #endif /* CONFIG_HIBERNATION */ | 732 | |
733 | static void acpi_sleep_hibernate_setup(void) | ||
734 | { | ||
735 | acpi_status status; | ||
736 | u8 type_a, type_b; | ||
737 | |||
738 | status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b); | ||
739 | if (ACPI_FAILURE(status)) | ||
740 | return; | ||
741 | |||
742 | hibernation_set_ops(old_suspend_ordering ? | ||
743 | &acpi_hibernation_ops_old : &acpi_hibernation_ops); | ||
744 | sleep_states[ACPI_STATE_S4] = 1; | ||
745 | pr_cont(KERN_CONT " S4"); | ||
746 | if (nosigcheck) | ||
747 | return; | ||
748 | |||
749 | acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs); | ||
750 | if (facs) | ||
751 | s4_hardware_signature = facs->hardware_signature; | ||
752 | } | ||
753 | #else /* !CONFIG_HIBERNATION */ | ||
754 | static inline void acpi_sleep_hibernate_setup(void) {} | ||
755 | #endif /* !CONFIG_HIBERNATION */ | ||
702 | 756 | ||
703 | int acpi_suspend(u32 acpi_state) | 757 | int acpi_suspend(u32 acpi_state) |
704 | { | 758 | { |
@@ -734,9 +788,6 @@ int __init acpi_sleep_init(void) | |||
734 | { | 788 | { |
735 | acpi_status status; | 789 | acpi_status status; |
736 | u8 type_a, type_b; | 790 | u8 type_a, type_b; |
737 | #ifdef CONFIG_SUSPEND | ||
738 | int i = 0; | ||
739 | #endif | ||
740 | 791 | ||
741 | if (acpi_disabled) | 792 | if (acpi_disabled) |
742 | return 0; | 793 | return 0; |
@@ -744,45 +795,19 @@ int __init acpi_sleep_init(void) | |||
744 | acpi_sleep_dmi_check(); | 795 | acpi_sleep_dmi_check(); |
745 | 796 | ||
746 | sleep_states[ACPI_STATE_S0] = 1; | 797 | sleep_states[ACPI_STATE_S0] = 1; |
747 | printk(KERN_INFO PREFIX "(supports S0"); | 798 | pr_info(PREFIX "(supports S0"); |
748 | |||
749 | #ifdef CONFIG_SUSPEND | ||
750 | for (i = ACPI_STATE_S1; i < ACPI_STATE_S4; i++) { | ||
751 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); | ||
752 | if (ACPI_SUCCESS(status)) { | ||
753 | sleep_states[i] = 1; | ||
754 | printk(KERN_CONT " S%d", i); | ||
755 | } | ||
756 | } | ||
757 | 799 | ||
758 | suspend_set_ops(old_suspend_ordering ? | 800 | acpi_sleep_suspend_setup(); |
759 | &acpi_suspend_ops_old : &acpi_suspend_ops); | 801 | acpi_sleep_hibernate_setup(); |
760 | #endif | ||
761 | 802 | ||
762 | #ifdef CONFIG_HIBERNATION | ||
763 | status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b); | ||
764 | if (ACPI_SUCCESS(status)) { | ||
765 | hibernation_set_ops(old_suspend_ordering ? | ||
766 | &acpi_hibernation_ops_old : &acpi_hibernation_ops); | ||
767 | sleep_states[ACPI_STATE_S4] = 1; | ||
768 | printk(KERN_CONT " S4"); | ||
769 | if (!nosigcheck) { | ||
770 | acpi_get_table(ACPI_SIG_FACS, 1, | ||
771 | (struct acpi_table_header **)&facs); | ||
772 | if (facs) | ||
773 | s4_hardware_signature = | ||
774 | facs->hardware_signature; | ||
775 | } | ||
776 | } | ||
777 | #endif | ||
778 | status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); | 803 | status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); |
779 | if (ACPI_SUCCESS(status)) { | 804 | if (ACPI_SUCCESS(status)) { |
780 | sleep_states[ACPI_STATE_S5] = 1; | 805 | sleep_states[ACPI_STATE_S5] = 1; |
781 | printk(KERN_CONT " S5"); | 806 | pr_cont(" S5"); |
782 | pm_power_off_prepare = acpi_power_off_prepare; | 807 | pm_power_off_prepare = acpi_power_off_prepare; |
783 | pm_power_off = acpi_power_off; | 808 | pm_power_off = acpi_power_off; |
784 | } | 809 | } |
785 | printk(KERN_CONT ")\n"); | 810 | pr_cont(")\n"); |
786 | /* | 811 | /* |
787 | * Register the tts_notifier to reboot notifier list so that the _TTS | 812 | * Register the tts_notifier to reboot notifier list so that the _TTS |
788 | * object can also be evaluated when the system enters S5. | 813 | * object can also be evaluated when the system enters S5. |
diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h index 74d59c8f4678..0143540a2519 100644 --- a/drivers/acpi/sleep.h +++ b/drivers/acpi/sleep.h | |||
@@ -6,3 +6,5 @@ extern void acpi_disable_wakeup_devices(u8 sleep_state); | |||
6 | 6 | ||
7 | extern struct list_head acpi_wakeup_device_list; | 7 | extern struct list_head acpi_wakeup_device_list; |
8 | extern struct mutex acpi_device_lock; | 8 | extern struct mutex acpi_device_lock; |
9 | |||
10 | extern void acpi_resume_power_resources(void); | ||
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index ea61ca9129cd..41c0504470db 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -498,7 +498,7 @@ static int get_status(u32 index, acpi_event_status *status, | |||
498 | result = acpi_get_gpe_device(index, handle); | 498 | result = acpi_get_gpe_device(index, handle); |
499 | if (result) { | 499 | if (result) { |
500 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, | 500 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, |
501 | "Invalid GPE 0x%x\n", index)); | 501 | "Invalid GPE 0x%x", index)); |
502 | goto end; | 502 | goto end; |
503 | } | 503 | } |
504 | result = acpi_get_gpe_status(*handle, index, status); | 504 | result = acpi_get_gpe_status(*handle, index, status); |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 2572d9715bda..d67a1fe07f0e 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -204,7 +204,7 @@ int __init | |||
204 | acpi_table_parse_entries(char *id, | 204 | acpi_table_parse_entries(char *id, |
205 | unsigned long table_size, | 205 | unsigned long table_size, |
206 | int entry_id, | 206 | int entry_id, |
207 | acpi_table_entry_handler handler, | 207 | acpi_tbl_entry_handler handler, |
208 | unsigned int max_entries) | 208 | unsigned int max_entries) |
209 | { | 209 | { |
210 | struct acpi_table_header *table_header = NULL; | 210 | struct acpi_table_header *table_header = NULL; |
@@ -269,7 +269,7 @@ err: | |||
269 | 269 | ||
270 | int __init | 270 | int __init |
271 | acpi_table_parse_madt(enum acpi_madt_type id, | 271 | acpi_table_parse_madt(enum acpi_madt_type id, |
272 | acpi_table_entry_handler handler, unsigned int max_entries) | 272 | acpi_tbl_entry_handler handler, unsigned int max_entries) |
273 | { | 273 | { |
274 | return acpi_table_parse_entries(ACPI_SIG_MADT, | 274 | return acpi_table_parse_entries(ACPI_SIG_MADT, |
275 | sizeof(struct acpi_table_madt), id, | 275 | sizeof(struct acpi_table_madt), id, |
@@ -285,7 +285,7 @@ acpi_table_parse_madt(enum acpi_madt_type id, | |||
285 | * Scan the ACPI System Descriptor Table (STD) for a table matching @id, | 285 | * Scan the ACPI System Descriptor Table (STD) for a table matching @id, |
286 | * run @handler on it. Return 0 if table found, return on if not. | 286 | * run @handler on it. Return 0 if table found, return on if not. |
287 | */ | 287 | */ |
288 | int __init acpi_table_parse(char *id, acpi_table_handler handler) | 288 | int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler) |
289 | { | 289 | { |
290 | struct acpi_table_header *table = NULL; | 290 | struct acpi_table_header *table = NULL; |
291 | acpi_size tbl_size; | 291 | acpi_size tbl_size; |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 506fbd4b5733..8470771e5eae 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -97,7 +97,7 @@ module_param(psv, int, 0644); | |||
97 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); | 97 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points."); |
98 | 98 | ||
99 | static int acpi_thermal_add(struct acpi_device *device); | 99 | static int acpi_thermal_add(struct acpi_device *device); |
100 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 100 | static int acpi_thermal_remove(struct acpi_device *device); |
101 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); | 101 | static void acpi_thermal_notify(struct acpi_device *device, u32 event); |
102 | 102 | ||
103 | static const struct acpi_device_id thermal_device_ids[] = { | 103 | static const struct acpi_device_id thermal_device_ids[] = { |
@@ -288,7 +288,7 @@ do { \ | |||
288 | if (flags != ACPI_TRIPS_INIT) \ | 288 | if (flags != ACPI_TRIPS_INIT) \ |
289 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, \ | 289 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, \ |
290 | "ACPI thermal trip point %s changed\n" \ | 290 | "ACPI thermal trip point %s changed\n" \ |
291 | "Please send acpidump to linux-acpi@vger.kernel.org\n", str)); \ | 291 | "Please send acpidump to linux-acpi@vger.kernel.org", str)); \ |
292 | } while (0) | 292 | } while (0) |
293 | 293 | ||
294 | static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | 294 | static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) |
@@ -531,6 +531,10 @@ static void acpi_thermal_check(void *data) | |||
531 | { | 531 | { |
532 | struct acpi_thermal *tz = data; | 532 | struct acpi_thermal *tz = data; |
533 | 533 | ||
534 | if (!tz->tz_enabled) { | ||
535 | pr_warn("thermal zone is disabled \n"); | ||
536 | return; | ||
537 | } | ||
534 | thermal_zone_device_update(tz->thermal_zone); | 538 | thermal_zone_device_update(tz->thermal_zone); |
535 | } | 539 | } |
536 | 540 | ||
@@ -1111,7 +1115,7 @@ end: | |||
1111 | return result; | 1115 | return result; |
1112 | } | 1116 | } |
1113 | 1117 | ||
1114 | static int acpi_thermal_remove(struct acpi_device *device, int type) | 1118 | static int acpi_thermal_remove(struct acpi_device *device) |
1115 | { | 1119 | { |
1116 | struct acpi_thermal *tz = NULL; | 1120 | struct acpi_thermal *tz = NULL; |
1117 | 1121 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index ac9a69cd45f5..313f959413dc 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -88,7 +88,7 @@ module_param(use_bios_initial_backlight, bool, 0644); | |||
88 | 88 | ||
89 | static int register_count = 0; | 89 | static int register_count = 0; |
90 | static int acpi_video_bus_add(struct acpi_device *device); | 90 | static int acpi_video_bus_add(struct acpi_device *device); |
91 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 91 | static int acpi_video_bus_remove(struct acpi_device *device); |
92 | static void acpi_video_bus_notify(struct acpi_device *device, u32 event); | 92 | static void acpi_video_bus_notify(struct acpi_device *device, u32 event); |
93 | 93 | ||
94 | static const struct acpi_device_id video_device_ids[] = { | 94 | static const struct acpi_device_id video_device_ids[] = { |
@@ -673,7 +673,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
673 | br->levels[i] = br->levels[i - level_ac_battery]; | 673 | br->levels[i] = br->levels[i - level_ac_battery]; |
674 | count += level_ac_battery; | 674 | count += level_ac_battery; |
675 | } else if (level_ac_battery > 2) | 675 | } else if (level_ac_battery > 2) |
676 | ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package\n")); | 676 | ACPI_ERROR((AE_INFO, "Too many duplicates in _BCL package")); |
677 | 677 | ||
678 | /* Check if the _BCL package is in a reversed order */ | 678 | /* Check if the _BCL package is in a reversed order */ |
679 | if (max_level == br->levels[2]) { | 679 | if (max_level == br->levels[2]) { |
@@ -682,7 +682,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
682 | acpi_video_cmp_level, NULL); | 682 | acpi_video_cmp_level, NULL); |
683 | } else if (max_level != br->levels[count - 1]) | 683 | } else if (max_level != br->levels[count - 1]) |
684 | ACPI_ERROR((AE_INFO, | 684 | ACPI_ERROR((AE_INFO, |
685 | "Found unordered _BCL package\n")); | 685 | "Found unordered _BCL package")); |
686 | 686 | ||
687 | br->count = count; | 687 | br->count = count; |
688 | device->brightness = br; | 688 | device->brightness = br; |
@@ -1740,7 +1740,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1740 | return error; | 1740 | return error; |
1741 | } | 1741 | } |
1742 | 1742 | ||
1743 | static int acpi_video_bus_remove(struct acpi_device *device, int type) | 1743 | static int acpi_video_bus_remove(struct acpi_device *device) |
1744 | { | 1744 | { |
1745 | struct acpi_video_bus *video = NULL; | 1745 | struct acpi_video_bus *video = NULL; |
1746 | 1746 | ||