diff options
Diffstat (limited to 'drivers/acpi')
66 files changed, 3440 insertions, 1779 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 4bf68c8d4797..100bd724f648 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -298,14 +298,6 @@ config ACPI_DEBUG | |||
298 | Documentation/kernel-parameters.txt to control the type and | 298 | Documentation/kernel-parameters.txt to control the type and |
299 | amount of debug output. | 299 | amount of debug output. |
300 | 300 | ||
301 | config ACPI_DEBUG_FUNC_TRACE | ||
302 | bool "Additionally enable ACPI function tracing" | ||
303 | default n | ||
304 | depends on ACPI_DEBUG | ||
305 | help | ||
306 | ACPI Debug Statements slow down ACPI processing. Function trace | ||
307 | is about half of the penalty and is rarely useful. | ||
308 | |||
309 | config ACPI_PCI_SLOT | 301 | config ACPI_PCI_SLOT |
310 | bool "PCI slot detection driver" | 302 | bool "PCI slot detection driver" |
311 | depends on SYSFS | 303 | depends on SYSFS |
@@ -334,7 +326,7 @@ config X86_PM_TIMER | |||
334 | 326 | ||
335 | config ACPI_CONTAINER | 327 | config ACPI_CONTAINER |
336 | bool "Container and Module Devices" | 328 | bool "Container and Module Devices" |
337 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) | 329 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU) |
338 | help | 330 | help |
339 | This driver supports ACPI Container and Module devices (IDs | 331 | This driver supports ACPI Container and Module devices (IDs |
340 | ACPI0004, PNP0A05, and PNP0A06). | 332 | ACPI0004, PNP0A05, and PNP0A06). |
@@ -345,9 +337,8 @@ config ACPI_CONTAINER | |||
345 | the module will be called container. | 337 | the module will be called container. |
346 | 338 | ||
347 | config ACPI_HOTPLUG_MEMORY | 339 | config ACPI_HOTPLUG_MEMORY |
348 | tristate "Memory Hotplug" | 340 | bool "Memory Hotplug" |
349 | depends on MEMORY_HOTPLUG | 341 | depends on MEMORY_HOTPLUG |
350 | default n | ||
351 | help | 342 | help |
352 | This driver supports ACPI memory hotplug. The driver | 343 | This driver supports ACPI memory hotplug. The driver |
353 | fields notifications on ACPI memory devices (PNP0C80), | 344 | fields notifications on ACPI memory devices (PNP0C80), |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 474fcfeba66c..ecb743bf05a5 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -39,6 +39,7 @@ 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 | 40 | acpi-y += pci_root.o pci_link.o pci_irq.o |
41 | acpi-y += csrt.o | 41 | acpi-y += csrt.o |
42 | acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o | ||
42 | acpi-y += acpi_platform.o | 43 | acpi-y += acpi_platform.o |
43 | acpi-y += power.o | 44 | acpi-y += power.o |
44 | acpi-y += event.o | 45 | acpi-y += event.o |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c new file mode 100644 index 000000000000..b1c95422ce74 --- /dev/null +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -0,0 +1,292 @@ | |||
1 | /* | ||
2 | * ACPI support for Intel Lynxpoint LPSS. | ||
3 | * | ||
4 | * Copyright (C) 2013, Intel Corporation | ||
5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
6 | * Rafael J. Wysocki <rafael.j.wysocki@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 | #include <linux/acpi.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <linux/clkdev.h> | ||
16 | #include <linux/clk-provider.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/platform_data/clk-lpss.h> | ||
21 | #include <linux/pm_runtime.h> | ||
22 | |||
23 | #include "internal.h" | ||
24 | |||
25 | ACPI_MODULE_NAME("acpi_lpss"); | ||
26 | |||
27 | #define LPSS_CLK_SIZE 0x04 | ||
28 | #define LPSS_LTR_SIZE 0x18 | ||
29 | |||
30 | /* Offsets relative to LPSS_PRIVATE_OFFSET */ | ||
31 | #define LPSS_GENERAL 0x08 | ||
32 | #define LPSS_GENERAL_LTR_MODE_SW BIT(2) | ||
33 | #define LPSS_SW_LTR 0x10 | ||
34 | #define LPSS_AUTO_LTR 0x14 | ||
35 | |||
36 | struct lpss_device_desc { | ||
37 | bool clk_required; | ||
38 | const char *clk_parent; | ||
39 | bool ltr_required; | ||
40 | unsigned int prv_offset; | ||
41 | }; | ||
42 | |||
43 | struct lpss_private_data { | ||
44 | void __iomem *mmio_base; | ||
45 | resource_size_t mmio_size; | ||
46 | struct clk *clk; | ||
47 | const struct lpss_device_desc *dev_desc; | ||
48 | }; | ||
49 | |||
50 | static struct lpss_device_desc lpt_dev_desc = { | ||
51 | .clk_required = true, | ||
52 | .clk_parent = "lpss_clk", | ||
53 | .prv_offset = 0x800, | ||
54 | .ltr_required = true, | ||
55 | }; | ||
56 | |||
57 | static struct lpss_device_desc lpt_sdio_dev_desc = { | ||
58 | .prv_offset = 0x1000, | ||
59 | .ltr_required = true, | ||
60 | }; | ||
61 | |||
62 | static const struct acpi_device_id acpi_lpss_device_ids[] = { | ||
63 | /* Lynxpoint LPSS devices */ | ||
64 | { "INT33C0", (unsigned long)&lpt_dev_desc }, | ||
65 | { "INT33C1", (unsigned long)&lpt_dev_desc }, | ||
66 | { "INT33C2", (unsigned long)&lpt_dev_desc }, | ||
67 | { "INT33C3", (unsigned long)&lpt_dev_desc }, | ||
68 | { "INT33C4", (unsigned long)&lpt_dev_desc }, | ||
69 | { "INT33C5", (unsigned long)&lpt_dev_desc }, | ||
70 | { "INT33C6", (unsigned long)&lpt_sdio_dev_desc }, | ||
71 | { "INT33C7", }, | ||
72 | |||
73 | { } | ||
74 | }; | ||
75 | |||
76 | static int is_memory(struct acpi_resource *res, void *not_used) | ||
77 | { | ||
78 | struct resource r; | ||
79 | return !acpi_dev_resource_memory(res, &r); | ||
80 | } | ||
81 | |||
82 | /* LPSS main clock device. */ | ||
83 | static struct platform_device *lpss_clk_dev; | ||
84 | |||
85 | static inline void lpt_register_clock_device(void) | ||
86 | { | ||
87 | lpss_clk_dev = platform_device_register_simple("clk-lpt", -1, NULL, 0); | ||
88 | } | ||
89 | |||
90 | static int register_device_clock(struct acpi_device *adev, | ||
91 | struct lpss_private_data *pdata) | ||
92 | { | ||
93 | const struct lpss_device_desc *dev_desc = pdata->dev_desc; | ||
94 | |||
95 | if (!lpss_clk_dev) | ||
96 | lpt_register_clock_device(); | ||
97 | |||
98 | if (!dev_desc->clk_parent || !pdata->mmio_base | ||
99 | || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE) | ||
100 | return -ENODATA; | ||
101 | |||
102 | pdata->clk = clk_register_gate(NULL, dev_name(&adev->dev), | ||
103 | dev_desc->clk_parent, 0, | ||
104 | pdata->mmio_base + dev_desc->prv_offset, | ||
105 | 0, 0, NULL); | ||
106 | if (IS_ERR(pdata->clk)) | ||
107 | return PTR_ERR(pdata->clk); | ||
108 | |||
109 | clk_register_clkdev(pdata->clk, NULL, dev_name(&adev->dev)); | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static int acpi_lpss_create_device(struct acpi_device *adev, | ||
114 | const struct acpi_device_id *id) | ||
115 | { | ||
116 | struct lpss_device_desc *dev_desc; | ||
117 | struct lpss_private_data *pdata; | ||
118 | struct resource_list_entry *rentry; | ||
119 | struct list_head resource_list; | ||
120 | int ret; | ||
121 | |||
122 | dev_desc = (struct lpss_device_desc *)id->driver_data; | ||
123 | if (!dev_desc) | ||
124 | return acpi_create_platform_device(adev, id); | ||
125 | |||
126 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | ||
127 | if (!pdata) | ||
128 | return -ENOMEM; | ||
129 | |||
130 | INIT_LIST_HEAD(&resource_list); | ||
131 | ret = acpi_dev_get_resources(adev, &resource_list, is_memory, NULL); | ||
132 | if (ret < 0) | ||
133 | goto err_out; | ||
134 | |||
135 | list_for_each_entry(rentry, &resource_list, node) | ||
136 | if (resource_type(&rentry->res) == IORESOURCE_MEM) { | ||
137 | pdata->mmio_size = resource_size(&rentry->res); | ||
138 | pdata->mmio_base = ioremap(rentry->res.start, | ||
139 | pdata->mmio_size); | ||
140 | pdata->dev_desc = dev_desc; | ||
141 | break; | ||
142 | } | ||
143 | |||
144 | acpi_dev_free_resource_list(&resource_list); | ||
145 | |||
146 | if (dev_desc->clk_required) { | ||
147 | ret = register_device_clock(adev, pdata); | ||
148 | if (ret) { | ||
149 | /* | ||
150 | * Skip the device, but don't terminate the namespace | ||
151 | * scan. | ||
152 | */ | ||
153 | kfree(pdata); | ||
154 | return 0; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | adev->driver_data = pdata; | ||
159 | ret = acpi_create_platform_device(adev, id); | ||
160 | if (ret > 0) | ||
161 | return ret; | ||
162 | |||
163 | adev->driver_data = NULL; | ||
164 | |||
165 | err_out: | ||
166 | kfree(pdata); | ||
167 | return ret; | ||
168 | } | ||
169 | |||
170 | static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) | ||
171 | { | ||
172 | struct acpi_device *adev; | ||
173 | struct lpss_private_data *pdata; | ||
174 | unsigned long flags; | ||
175 | int ret; | ||
176 | |||
177 | ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev); | ||
178 | if (WARN_ON(ret)) | ||
179 | return ret; | ||
180 | |||
181 | spin_lock_irqsave(&dev->power.lock, flags); | ||
182 | if (pm_runtime_suspended(dev)) { | ||
183 | ret = -EAGAIN; | ||
184 | goto out; | ||
185 | } | ||
186 | pdata = acpi_driver_data(adev); | ||
187 | if (WARN_ON(!pdata || !pdata->mmio_base)) { | ||
188 | ret = -ENODEV; | ||
189 | goto out; | ||
190 | } | ||
191 | *val = readl(pdata->mmio_base + pdata->dev_desc->prv_offset + reg); | ||
192 | |||
193 | out: | ||
194 | spin_unlock_irqrestore(&dev->power.lock, flags); | ||
195 | return ret; | ||
196 | } | ||
197 | |||
198 | static ssize_t lpss_ltr_show(struct device *dev, struct device_attribute *attr, | ||
199 | char *buf) | ||
200 | { | ||
201 | u32 ltr_value = 0; | ||
202 | unsigned int reg; | ||
203 | int ret; | ||
204 | |||
205 | reg = strcmp(attr->attr.name, "auto_ltr") ? LPSS_SW_LTR : LPSS_AUTO_LTR; | ||
206 | ret = lpss_reg_read(dev, reg, <r_value); | ||
207 | if (ret) | ||
208 | return ret; | ||
209 | |||
210 | return snprintf(buf, PAGE_SIZE, "%08x\n", ltr_value); | ||
211 | } | ||
212 | |||
213 | static ssize_t lpss_ltr_mode_show(struct device *dev, | ||
214 | struct device_attribute *attr, char *buf) | ||
215 | { | ||
216 | u32 ltr_mode = 0; | ||
217 | char *outstr; | ||
218 | int ret; | ||
219 | |||
220 | ret = lpss_reg_read(dev, LPSS_GENERAL, <r_mode); | ||
221 | if (ret) | ||
222 | return ret; | ||
223 | |||
224 | outstr = (ltr_mode & LPSS_GENERAL_LTR_MODE_SW) ? "sw" : "auto"; | ||
225 | return sprintf(buf, "%s\n", outstr); | ||
226 | } | ||
227 | |||
228 | static DEVICE_ATTR(auto_ltr, S_IRUSR, lpss_ltr_show, NULL); | ||
229 | static DEVICE_ATTR(sw_ltr, S_IRUSR, lpss_ltr_show, NULL); | ||
230 | static DEVICE_ATTR(ltr_mode, S_IRUSR, lpss_ltr_mode_show, NULL); | ||
231 | |||
232 | static struct attribute *lpss_attrs[] = { | ||
233 | &dev_attr_auto_ltr.attr, | ||
234 | &dev_attr_sw_ltr.attr, | ||
235 | &dev_attr_ltr_mode.attr, | ||
236 | NULL, | ||
237 | }; | ||
238 | |||
239 | static struct attribute_group lpss_attr_group = { | ||
240 | .attrs = lpss_attrs, | ||
241 | .name = "lpss_ltr", | ||
242 | }; | ||
243 | |||
244 | static int acpi_lpss_platform_notify(struct notifier_block *nb, | ||
245 | unsigned long action, void *data) | ||
246 | { | ||
247 | struct platform_device *pdev = to_platform_device(data); | ||
248 | struct lpss_private_data *pdata; | ||
249 | struct acpi_device *adev; | ||
250 | const struct acpi_device_id *id; | ||
251 | int ret = 0; | ||
252 | |||
253 | id = acpi_match_device(acpi_lpss_device_ids, &pdev->dev); | ||
254 | if (!id || !id->driver_data) | ||
255 | return 0; | ||
256 | |||
257 | if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) | ||
258 | return 0; | ||
259 | |||
260 | pdata = acpi_driver_data(adev); | ||
261 | if (!pdata || !pdata->mmio_base || !pdata->dev_desc->ltr_required) | ||
262 | return 0; | ||
263 | |||
264 | if (pdata->mmio_size < pdata->dev_desc->prv_offset + LPSS_LTR_SIZE) { | ||
265 | dev_err(&pdev->dev, "MMIO size insufficient to access LTR\n"); | ||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | if (action == BUS_NOTIFY_ADD_DEVICE) | ||
270 | ret = sysfs_create_group(&pdev->dev.kobj, &lpss_attr_group); | ||
271 | else if (action == BUS_NOTIFY_DEL_DEVICE) | ||
272 | sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); | ||
273 | |||
274 | return ret; | ||
275 | } | ||
276 | |||
277 | static struct notifier_block acpi_lpss_nb = { | ||
278 | .notifier_call = acpi_lpss_platform_notify, | ||
279 | }; | ||
280 | |||
281 | static struct acpi_scan_handler lpss_handler = { | ||
282 | .ids = acpi_lpss_device_ids, | ||
283 | .attach = acpi_lpss_create_device, | ||
284 | }; | ||
285 | |||
286 | void __init acpi_lpss_init(void) | ||
287 | { | ||
288 | if (!lpt_clk_init()) { | ||
289 | bus_register_notifier(&platform_bus_type, &acpi_lpss_nb); | ||
290 | acpi_scan_add_handler(&lpss_handler); | ||
291 | } | ||
292 | } | ||
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index da1f82b445e0..5e6301e94920 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -1,5 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004 Intel Corporation <naveen.b.s@intel.com> | 2 | * Copyright (C) 2004, 2013 Intel Corporation |
3 | * Author: Naveen B S <naveen.b.s@intel.com> | ||
4 | * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
3 | * | 5 | * |
4 | * All rights reserved. | 6 | * All rights reserved. |
5 | * | 7 | * |
@@ -25,14 +27,10 @@ | |||
25 | * ranges. | 27 | * ranges. |
26 | */ | 28 | */ |
27 | 29 | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/module.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/types.h> | ||
32 | #include <linux/memory_hotplug.h> | ||
33 | #include <linux/slab.h> | ||
34 | #include <linux/acpi.h> | 30 | #include <linux/acpi.h> |
35 | #include <acpi/acpi_drivers.h> | 31 | #include <linux/memory_hotplug.h> |
32 | |||
33 | #include "internal.h" | ||
36 | 34 | ||
37 | #define ACPI_MEMORY_DEVICE_CLASS "memory" | 35 | #define ACPI_MEMORY_DEVICE_CLASS "memory" |
38 | #define ACPI_MEMORY_DEVICE_HID "PNP0C80" | 36 | #define ACPI_MEMORY_DEVICE_HID "PNP0C80" |
@@ -44,32 +42,28 @@ | |||
44 | #define PREFIX "ACPI:memory_hp:" | 42 | #define PREFIX "ACPI:memory_hp:" |
45 | 43 | ||
46 | ACPI_MODULE_NAME("acpi_memhotplug"); | 44 | ACPI_MODULE_NAME("acpi_memhotplug"); |
47 | MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>"); | ||
48 | MODULE_DESCRIPTION("Hotplug Mem Driver"); | ||
49 | MODULE_LICENSE("GPL"); | ||
50 | 45 | ||
51 | /* Memory Device States */ | 46 | /* Memory Device States */ |
52 | #define MEMORY_INVALID_STATE 0 | 47 | #define MEMORY_INVALID_STATE 0 |
53 | #define MEMORY_POWER_ON_STATE 1 | 48 | #define MEMORY_POWER_ON_STATE 1 |
54 | #define MEMORY_POWER_OFF_STATE 2 | 49 | #define MEMORY_POWER_OFF_STATE 2 |
55 | 50 | ||
56 | static int acpi_memory_device_add(struct acpi_device *device); | 51 | static int acpi_memory_device_add(struct acpi_device *device, |
57 | static int acpi_memory_device_remove(struct acpi_device *device); | 52 | const struct acpi_device_id *not_used); |
53 | static void acpi_memory_device_remove(struct acpi_device *device); | ||
58 | 54 | ||
59 | static const struct acpi_device_id memory_device_ids[] = { | 55 | static const struct acpi_device_id memory_device_ids[] = { |
60 | {ACPI_MEMORY_DEVICE_HID, 0}, | 56 | {ACPI_MEMORY_DEVICE_HID, 0}, |
61 | {"", 0}, | 57 | {"", 0}, |
62 | }; | 58 | }; |
63 | MODULE_DEVICE_TABLE(acpi, memory_device_ids); | ||
64 | 59 | ||
65 | static struct acpi_driver acpi_memory_device_driver = { | 60 | static struct acpi_scan_handler memory_device_handler = { |
66 | .name = "acpi_memhotplug", | ||
67 | .class = ACPI_MEMORY_DEVICE_CLASS, | ||
68 | .ids = memory_device_ids, | 61 | .ids = memory_device_ids, |
69 | .ops = { | 62 | .attach = acpi_memory_device_add, |
70 | .add = acpi_memory_device_add, | 63 | .detach = acpi_memory_device_remove, |
71 | .remove = acpi_memory_device_remove, | 64 | .hotplug = { |
72 | }, | 65 | .enabled = true, |
66 | }, | ||
73 | }; | 67 | }; |
74 | 68 | ||
75 | struct acpi_memory_info { | 69 | struct acpi_memory_info { |
@@ -79,7 +73,6 @@ struct acpi_memory_info { | |||
79 | unsigned short caching; /* memory cache attribute */ | 73 | unsigned short caching; /* memory cache attribute */ |
80 | unsigned short write_protect; /* memory read/write attribute */ | 74 | unsigned short write_protect; /* memory read/write attribute */ |
81 | unsigned int enabled:1; | 75 | unsigned int enabled:1; |
82 | unsigned int failed:1; | ||
83 | }; | 76 | }; |
84 | 77 | ||
85 | struct acpi_memory_device { | 78 | struct acpi_memory_device { |
@@ -153,48 +146,6 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
153 | return 0; | 146 | return 0; |
154 | } | 147 | } |
155 | 148 | ||
156 | static int acpi_memory_get_device(acpi_handle handle, | ||
157 | struct acpi_memory_device **mem_device) | ||
158 | { | ||
159 | struct acpi_device *device = NULL; | ||
160 | int result = 0; | ||
161 | |||
162 | acpi_scan_lock_acquire(); | ||
163 | |||
164 | acpi_bus_get_device(handle, &device); | ||
165 | if (device) | ||
166 | goto end; | ||
167 | |||
168 | /* | ||
169 | * Now add the notified device. This creates the acpi_device | ||
170 | * and invokes .add function | ||
171 | */ | ||
172 | result = acpi_bus_scan(handle); | ||
173 | if (result) { | ||
174 | acpi_handle_warn(handle, "ACPI namespace scan failed\n"); | ||
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; | ||
183 | } | ||
184 | |||
185 | end: | ||
186 | *mem_device = acpi_driver_data(device); | ||
187 | if (!(*mem_device)) { | ||
188 | dev_err(&device->dev, "driver data not found\n"); | ||
189 | result = -ENODEV; | ||
190 | goto out; | ||
191 | } | ||
192 | |||
193 | out: | ||
194 | acpi_scan_lock_release(); | ||
195 | return result; | ||
196 | } | ||
197 | |||
198 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) | 149 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) |
199 | { | 150 | { |
200 | unsigned long long current_status; | 151 | unsigned long long current_status; |
@@ -249,13 +200,11 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
249 | * returns -EEXIST. If add_memory() returns the other error, it | 200 | * returns -EEXIST. If add_memory() returns the other error, it |
250 | * means that this memory block is not used by the kernel. | 201 | * means that this memory block is not used by the kernel. |
251 | */ | 202 | */ |
252 | if (result && result != -EEXIST) { | 203 | if (result && result != -EEXIST) |
253 | info->failed = 1; | ||
254 | continue; | 204 | continue; |
255 | } | ||
256 | 205 | ||
257 | if (!result) | 206 | info->enabled = 1; |
258 | info->enabled = 1; | 207 | |
259 | /* | 208 | /* |
260 | * Add num_enable even if add_memory() returns -EEXIST, so the | 209 | * Add num_enable even if add_memory() returns -EEXIST, so the |
261 | * device is bound to this driver. | 210 | * device is bound to this driver. |
@@ -286,16 +235,8 @@ static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device) | |||
286 | nid = acpi_get_node(mem_device->device->handle); | 235 | nid = acpi_get_node(mem_device->device->handle); |
287 | 236 | ||
288 | list_for_each_entry_safe(info, n, &mem_device->res_list, list) { | 237 | list_for_each_entry_safe(info, n, &mem_device->res_list, list) { |
289 | if (info->failed) | ||
290 | /* The kernel does not use this memory block */ | ||
291 | continue; | ||
292 | |||
293 | if (!info->enabled) | 238 | if (!info->enabled) |
294 | /* | 239 | continue; |
295 | * The kernel uses this memory block, but it may be not | ||
296 | * managed by us. | ||
297 | */ | ||
298 | return -EBUSY; | ||
299 | 240 | ||
300 | if (nid < 0) | 241 | if (nid < 0) |
301 | nid = memory_add_physaddr_to_nid(info->start_addr); | 242 | nid = memory_add_physaddr_to_nid(info->start_addr); |
@@ -310,95 +251,21 @@ static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device) | |||
310 | return result; | 251 | return result; |
311 | } | 252 | } |
312 | 253 | ||
313 | static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | ||
314 | { | ||
315 | struct acpi_memory_device *mem_device; | ||
316 | struct acpi_device *device; | ||
317 | struct acpi_eject_event *ej_event = NULL; | ||
318 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | ||
319 | acpi_status status; | ||
320 | |||
321 | switch (event) { | ||
322 | case ACPI_NOTIFY_BUS_CHECK: | ||
323 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
324 | "\nReceived BUS CHECK notification for device\n")); | ||
325 | /* Fall Through */ | ||
326 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
327 | if (event == ACPI_NOTIFY_DEVICE_CHECK) | ||
328 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
329 | "\nReceived DEVICE CHECK notification for device\n")); | ||
330 | if (acpi_memory_get_device(handle, &mem_device)) { | ||
331 | acpi_handle_err(handle, "Cannot find driver data\n"); | ||
332 | break; | ||
333 | } | ||
334 | |||
335 | ost_code = ACPI_OST_SC_SUCCESS; | ||
336 | break; | ||
337 | |||
338 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
339 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
340 | "\nReceived EJECT REQUEST notification for device\n")); | ||
341 | |||
342 | status = AE_ERROR; | ||
343 | acpi_scan_lock_acquire(); | ||
344 | |||
345 | if (acpi_bus_get_device(handle, &device)) { | ||
346 | acpi_handle_err(handle, "Device doesn't exist\n"); | ||
347 | goto unlock; | ||
348 | } | ||
349 | mem_device = acpi_driver_data(device); | ||
350 | if (!mem_device) { | ||
351 | acpi_handle_err(handle, "Driver Data is NULL\n"); | ||
352 | goto unlock; | ||
353 | } | ||
354 | |||
355 | ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); | ||
356 | if (!ej_event) { | ||
357 | pr_err(PREFIX "No memory, dropping EJECT\n"); | ||
358 | goto unlock; | ||
359 | } | ||
360 | |||
361 | get_device(&device->dev); | ||
362 | ej_event->device = device; | ||
363 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | ||
364 | /* The eject is carried out asynchronously. */ | ||
365 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, | ||
366 | ej_event); | ||
367 | if (ACPI_FAILURE(status)) { | ||
368 | put_device(&device->dev); | ||
369 | kfree(ej_event); | ||
370 | } | ||
371 | |||
372 | unlock: | ||
373 | acpi_scan_lock_release(); | ||
374 | if (ACPI_SUCCESS(status)) | ||
375 | return; | ||
376 | default: | ||
377 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
378 | "Unsupported event [0x%x]\n", event)); | ||
379 | |||
380 | /* non-hotplug event; possibly handled by other handler */ | ||
381 | return; | ||
382 | } | ||
383 | |||
384 | /* Inform firmware that the hotplug operation has completed */ | ||
385 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | ||
386 | } | ||
387 | |||
388 | static void acpi_memory_device_free(struct acpi_memory_device *mem_device) | 254 | static void acpi_memory_device_free(struct acpi_memory_device *mem_device) |
389 | { | 255 | { |
390 | if (!mem_device) | 256 | if (!mem_device) |
391 | return; | 257 | return; |
392 | 258 | ||
393 | acpi_memory_free_device_resources(mem_device); | 259 | acpi_memory_free_device_resources(mem_device); |
260 | mem_device->device->driver_data = NULL; | ||
394 | kfree(mem_device); | 261 | kfree(mem_device); |
395 | } | 262 | } |
396 | 263 | ||
397 | static int acpi_memory_device_add(struct acpi_device *device) | 264 | static int acpi_memory_device_add(struct acpi_device *device, |
265 | const struct acpi_device_id *not_used) | ||
398 | { | 266 | { |
267 | struct acpi_memory_device *mem_device; | ||
399 | int result; | 268 | int result; |
400 | struct acpi_memory_device *mem_device = NULL; | ||
401 | |||
402 | 269 | ||
403 | if (!device) | 270 | if (!device) |
404 | return -EINVAL; | 271 | return -EINVAL; |
@@ -423,147 +290,36 @@ static int acpi_memory_device_add(struct acpi_device *device) | |||
423 | /* Set the device state */ | 290 | /* Set the device state */ |
424 | mem_device->state = MEMORY_POWER_ON_STATE; | 291 | mem_device->state = MEMORY_POWER_ON_STATE; |
425 | 292 | ||
426 | pr_debug("%s\n", acpi_device_name(device)); | 293 | result = acpi_memory_check_device(mem_device); |
294 | if (result) { | ||
295 | acpi_memory_device_free(mem_device); | ||
296 | return 0; | ||
297 | } | ||
427 | 298 | ||
428 | if (!acpi_memory_check_device(mem_device)) { | 299 | result = acpi_memory_enable_device(mem_device); |
429 | /* call add_memory func */ | 300 | if (result) { |
430 | result = acpi_memory_enable_device(mem_device); | 301 | dev_err(&device->dev, "acpi_memory_enable_device() error\n"); |
431 | if (result) { | 302 | acpi_memory_device_free(mem_device); |
432 | dev_err(&device->dev, | 303 | return -ENODEV; |
433 | "Error in acpi_memory_enable_device\n"); | ||
434 | acpi_memory_device_free(mem_device); | ||
435 | } | ||
436 | } | 304 | } |
437 | return result; | 305 | |
306 | dev_dbg(&device->dev, "Memory device configured by ACPI\n"); | ||
307 | return 1; | ||
438 | } | 308 | } |
439 | 309 | ||
440 | static int acpi_memory_device_remove(struct acpi_device *device) | 310 | static void acpi_memory_device_remove(struct acpi_device *device) |
441 | { | 311 | { |
442 | struct acpi_memory_device *mem_device = NULL; | 312 | struct acpi_memory_device *mem_device; |
443 | int result; | ||
444 | 313 | ||
445 | if (!device || !acpi_driver_data(device)) | 314 | if (!device || !acpi_driver_data(device)) |
446 | return -EINVAL; | 315 | return; |
447 | 316 | ||
448 | mem_device = acpi_driver_data(device); | 317 | mem_device = acpi_driver_data(device); |
449 | 318 | acpi_memory_remove_memory(mem_device); | |
450 | result = acpi_memory_remove_memory(mem_device); | ||
451 | if (result) | ||
452 | return result; | ||
453 | |||
454 | acpi_memory_device_free(mem_device); | 319 | acpi_memory_device_free(mem_device); |
455 | |||
456 | return 0; | ||
457 | } | ||
458 | |||
459 | /* | ||
460 | * Helper function to check for memory device | ||
461 | */ | ||
462 | static acpi_status is_memory_device(acpi_handle handle) | ||
463 | { | ||
464 | char *hardware_id; | ||
465 | acpi_status status; | ||
466 | struct acpi_device_info *info; | ||
467 | |||
468 | status = acpi_get_object_info(handle, &info); | ||
469 | if (ACPI_FAILURE(status)) | ||
470 | return status; | ||
471 | |||
472 | if (!(info->valid & ACPI_VALID_HID)) { | ||
473 | kfree(info); | ||
474 | return AE_ERROR; | ||
475 | } | ||
476 | |||
477 | hardware_id = info->hardware_id.string; | ||
478 | if ((hardware_id == NULL) || | ||
479 | (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) | ||
480 | status = AE_ERROR; | ||
481 | |||
482 | kfree(info); | ||
483 | return status; | ||
484 | } | ||
485 | |||
486 | static acpi_status | ||
487 | acpi_memory_register_notify_handler(acpi_handle handle, | ||
488 | u32 level, void *ctxt, void **retv) | ||
489 | { | ||
490 | acpi_status status; | ||
491 | |||
492 | |||
493 | status = is_memory_device(handle); | ||
494 | if (ACPI_FAILURE(status)) | ||
495 | return AE_OK; /* continue */ | ||
496 | |||
497 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
498 | acpi_memory_device_notify, NULL); | ||
499 | /* continue */ | ||
500 | return AE_OK; | ||
501 | } | ||
502 | |||
503 | static acpi_status | ||
504 | acpi_memory_deregister_notify_handler(acpi_handle handle, | ||
505 | u32 level, void *ctxt, void **retv) | ||
506 | { | ||
507 | acpi_status status; | ||
508 | |||
509 | |||
510 | status = is_memory_device(handle); | ||
511 | if (ACPI_FAILURE(status)) | ||
512 | return AE_OK; /* continue */ | ||
513 | |||
514 | status = acpi_remove_notify_handler(handle, | ||
515 | ACPI_SYSTEM_NOTIFY, | ||
516 | acpi_memory_device_notify); | ||
517 | |||
518 | return AE_OK; /* continue */ | ||
519 | } | ||
520 | |||
521 | static int __init acpi_memory_device_init(void) | ||
522 | { | ||
523 | int result; | ||
524 | acpi_status status; | ||
525 | |||
526 | |||
527 | result = acpi_bus_register_driver(&acpi_memory_device_driver); | ||
528 | |||
529 | if (result < 0) | ||
530 | return -ENODEV; | ||
531 | |||
532 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
533 | ACPI_UINT32_MAX, | ||
534 | acpi_memory_register_notify_handler, NULL, | ||
535 | NULL, NULL); | ||
536 | |||
537 | if (ACPI_FAILURE(status)) { | ||
538 | ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); | ||
539 | acpi_bus_unregister_driver(&acpi_memory_device_driver); | ||
540 | return -ENODEV; | ||
541 | } | ||
542 | |||
543 | return 0; | ||
544 | } | 320 | } |
545 | 321 | ||
546 | static void __exit acpi_memory_device_exit(void) | 322 | void __init acpi_memory_hotplug_init(void) |
547 | { | 323 | { |
548 | acpi_status status; | 324 | acpi_scan_add_handler_with_hotplug(&memory_device_handler, "memory"); |
549 | |||
550 | |||
551 | /* | ||
552 | * Adding this to un-install notification handlers for all the device | ||
553 | * handles. | ||
554 | */ | ||
555 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
556 | ACPI_UINT32_MAX, | ||
557 | acpi_memory_deregister_notify_handler, NULL, | ||
558 | NULL, NULL); | ||
559 | |||
560 | if (ACPI_FAILURE(status)) | ||
561 | ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); | ||
562 | |||
563 | acpi_bus_unregister_driver(&acpi_memory_device_driver); | ||
564 | |||
565 | return; | ||
566 | } | 325 | } |
567 | |||
568 | module_init(acpi_memory_device_init); | ||
569 | module_exit(acpi_memory_device_exit); | ||
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 31de1043eea0..27bb6a91de5f 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -236,7 +236,7 @@ static int create_power_saving_task(void) | |||
236 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, | 236 | ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, |
237 | (void *)(unsigned long)ps_tsk_num, | 237 | (void *)(unsigned long)ps_tsk_num, |
238 | "acpi_pad/%d", ps_tsk_num); | 238 | "acpi_pad/%d", ps_tsk_num); |
239 | rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; | 239 | rc = PTR_RET(ps_tsks[ps_tsk_num]); |
240 | if (!rc) | 240 | if (!rc) |
241 | ps_tsk_num++; | 241 | ps_tsk_num++; |
242 | else | 242 | else |
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 26fce4b8a632..fafec5ddf17f 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c | |||
@@ -22,9 +22,6 @@ | |||
22 | 22 | ||
23 | ACPI_MODULE_NAME("platform"); | 23 | ACPI_MODULE_NAME("platform"); |
24 | 24 | ||
25 | /* Flags for acpi_create_platform_device */ | ||
26 | #define ACPI_PLATFORM_CLK BIT(0) | ||
27 | |||
28 | /* | 25 | /* |
29 | * The following ACPI IDs are known to be suitable for representing as | 26 | * The following ACPI IDs are known to be suitable for representing as |
30 | * platform devices. | 27 | * platform devices. |
@@ -33,33 +30,9 @@ static const struct acpi_device_id acpi_platform_device_ids[] = { | |||
33 | 30 | ||
34 | { "PNP0D40" }, | 31 | { "PNP0D40" }, |
35 | 32 | ||
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 | { } | 33 | { } |
47 | }; | 34 | }; |
48 | 35 | ||
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 | |||
63 | /** | 36 | /** |
64 | * acpi_create_platform_device - Create platform device for ACPI device node | 37 | * acpi_create_platform_device - Create platform device for ACPI device node |
65 | * @adev: ACPI device node to create a platform device for. | 38 | * @adev: ACPI device node to create a platform device for. |
@@ -71,10 +44,9 @@ static int acpi_create_platform_clks(struct acpi_device *adev) | |||
71 | * | 44 | * |
72 | * Name of the platform device will be the same as @adev's. | 45 | * Name of the platform device will be the same as @adev's. |
73 | */ | 46 | */ |
74 | static int acpi_create_platform_device(struct acpi_device *adev, | 47 | int acpi_create_platform_device(struct acpi_device *adev, |
75 | const struct acpi_device_id *id) | 48 | const struct acpi_device_id *id) |
76 | { | 49 | { |
77 | unsigned long flags = id->driver_data; | ||
78 | struct platform_device *pdev = NULL; | 50 | struct platform_device *pdev = NULL; |
79 | struct acpi_device *acpi_parent; | 51 | struct acpi_device *acpi_parent; |
80 | struct platform_device_info pdevinfo; | 52 | struct platform_device_info pdevinfo; |
@@ -83,14 +55,6 @@ static int acpi_create_platform_device(struct acpi_device *adev, | |||
83 | struct resource *resources; | 55 | struct resource *resources; |
84 | int count; | 56 | int count; |
85 | 57 | ||
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 | |||
94 | /* If the ACPI node already has a physical device attached, skip it. */ | 58 | /* If the ACPI node already has a physical device attached, skip it. */ |
95 | if (adev->physical_node_count) | 59 | if (adev->physical_node_count) |
96 | return 0; | 60 | return 0; |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index a1b9bf5085a2..7ddf29eca9f5 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -83,6 +83,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o | |||
83 | acpi-y += \ | 83 | acpi-y += \ |
84 | nsaccess.o \ | 84 | nsaccess.o \ |
85 | nsalloc.o \ | 85 | nsalloc.o \ |
86 | nsconvert.o \ | ||
86 | nsdump.o \ | 87 | nsdump.o \ |
87 | nseval.o \ | 88 | nseval.o \ |
88 | nsinit.o \ | 89 | nsinit.o \ |
@@ -160,6 +161,7 @@ acpi-y += \ | |||
160 | utobject.o \ | 161 | utobject.o \ |
161 | utosi.o \ | 162 | utosi.o \ |
162 | utownerid.o \ | 163 | utownerid.o \ |
164 | utpredef.o \ | ||
163 | utresrc.o \ | 165 | utresrc.o \ |
164 | utstate.o \ | 166 | utstate.o \ |
165 | utstring.o \ | 167 | utstring.o \ |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index ecb49927b817..07160928ca25 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -224,6 +224,7 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_pending; | |||
224 | */ | 224 | */ |
225 | 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 */ |
226 | 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 */ |
227 | ACPI_EXTERN acpi_spinlock acpi_gbl_reference_count_lock; | ||
227 | 228 | ||
228 | /* Mutex for _OSI support */ | 229 | /* Mutex for _OSI support */ |
229 | 230 | ||
@@ -413,10 +414,12 @@ ACPI_EXTERN u8 acpi_gbl_db_output_flags; | |||
413 | 414 | ||
414 | #ifdef ACPI_DISASSEMBLER | 415 | #ifdef ACPI_DISASSEMBLER |
415 | 416 | ||
416 | u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE); | 417 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_ignore_noop_operator, FALSE); |
417 | 418 | ||
418 | ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; | 419 | ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; |
419 | ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; | 420 | ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; |
421 | ACPI_EXTERN u8 acpi_gbl_num_external_methods; | ||
422 | ACPI_EXTERN u32 acpi_gbl_resolved_external_methods; | ||
420 | ACPI_EXTERN struct acpi_external_list *acpi_gbl_external_list; | 423 | ACPI_EXTERN struct acpi_external_list *acpi_gbl_external_list; |
421 | ACPI_EXTERN struct acpi_external_file *acpi_gbl_external_file_list; | 424 | ACPI_EXTERN struct acpi_external_file *acpi_gbl_external_file_list; |
422 | #endif | 425 | #endif |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 805f419086ab..d5bfbd331bfd 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -294,6 +294,8 @@ acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state); | |||
294 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | 294 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ |
295 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | 295 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF |
296 | 296 | ||
297 | #pragma pack(1) | ||
298 | |||
297 | /* | 299 | /* |
298 | * Information structure for ACPI predefined names. | 300 | * Information structure for ACPI predefined names. |
299 | * Each entry in the table contains the following items: | 301 | * Each entry in the table contains the following items: |
@@ -304,7 +306,7 @@ acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state); | |||
304 | */ | 306 | */ |
305 | struct acpi_name_info { | 307 | struct acpi_name_info { |
306 | char name[ACPI_NAME_SIZE]; | 308 | char name[ACPI_NAME_SIZE]; |
307 | u8 param_count; | 309 | u16 argument_list; |
308 | u8 expected_btypes; | 310 | u8 expected_btypes; |
309 | }; | 311 | }; |
310 | 312 | ||
@@ -327,7 +329,7 @@ struct acpi_package_info { | |||
327 | u8 count1; | 329 | u8 count1; |
328 | u8 object_type2; | 330 | u8 object_type2; |
329 | u8 count2; | 331 | u8 count2; |
330 | u8 reserved; | 332 | u16 reserved; |
331 | }; | 333 | }; |
332 | 334 | ||
333 | /* Used for ACPI_PTYPE2_FIXED */ | 335 | /* Used for ACPI_PTYPE2_FIXED */ |
@@ -336,6 +338,7 @@ struct acpi_package_info2 { | |||
336 | u8 type; | 338 | u8 type; |
337 | u8 count; | 339 | u8 count; |
338 | u8 object_type[4]; | 340 | u8 object_type[4]; |
341 | u8 reserved; | ||
339 | }; | 342 | }; |
340 | 343 | ||
341 | /* Used for ACPI_PTYPE1_OPTION */ | 344 | /* Used for ACPI_PTYPE1_OPTION */ |
@@ -345,7 +348,7 @@ struct acpi_package_info3 { | |||
345 | u8 count; | 348 | u8 count; |
346 | u8 object_type[2]; | 349 | u8 object_type[2]; |
347 | u8 tail_object_type; | 350 | u8 tail_object_type; |
348 | u8 reserved; | 351 | u16 reserved; |
349 | }; | 352 | }; |
350 | 353 | ||
351 | union acpi_predefined_info { | 354 | union acpi_predefined_info { |
@@ -355,6 +358,10 @@ union acpi_predefined_info { | |||
355 | struct acpi_package_info3 ret_info3; | 358 | struct acpi_package_info3 ret_info3; |
356 | }; | 359 | }; |
357 | 360 | ||
361 | /* Reset to default packing */ | ||
362 | |||
363 | #pragma pack() | ||
364 | |||
358 | /* Data block used during object validation */ | 365 | /* Data block used during object validation */ |
359 | 366 | ||
360 | struct acpi_predefined_data { | 367 | struct acpi_predefined_data { |
@@ -363,6 +370,7 @@ struct acpi_predefined_data { | |||
363 | union acpi_operand_object *parent_package; | 370 | union acpi_operand_object *parent_package; |
364 | struct acpi_namespace_node *node; | 371 | struct acpi_namespace_node *node; |
365 | u32 flags; | 372 | u32 flags; |
373 | u32 return_btype; | ||
366 | u8 node_flags; | 374 | u8 node_flags; |
367 | }; | 375 | }; |
368 | 376 | ||
@@ -371,6 +379,20 @@ struct acpi_predefined_data { | |||
371 | #define ACPI_OBJECT_REPAIRED 1 | 379 | #define ACPI_OBJECT_REPAIRED 1 |
372 | #define ACPI_OBJECT_WRAPPED 2 | 380 | #define ACPI_OBJECT_WRAPPED 2 |
373 | 381 | ||
382 | /* Return object auto-repair info */ | ||
383 | |||
384 | typedef acpi_status(*acpi_object_converter) (union acpi_operand_object | ||
385 | *original_object, | ||
386 | union acpi_operand_object | ||
387 | **converted_object); | ||
388 | |||
389 | struct acpi_simple_repair_info { | ||
390 | char name[ACPI_NAME_SIZE]; | ||
391 | u32 unexpected_btypes; | ||
392 | u32 package_index; | ||
393 | acpi_object_converter object_converter; | ||
394 | }; | ||
395 | |||
374 | /* | 396 | /* |
375 | * Bitmapped return value types | 397 | * Bitmapped return value types |
376 | * Note: the actual data types must be contiguous, a loop in nspredef.c | 398 | * Note: the actual data types must be contiguous, a loop in nspredef.c |
@@ -1037,6 +1059,7 @@ struct acpi_external_list { | |||
1037 | u16 length; | 1059 | u16 length; |
1038 | u8 type; | 1060 | u8 type; |
1039 | u8 flags; | 1061 | u8 flags; |
1062 | u8 resolved; | ||
1040 | }; | 1063 | }; |
1041 | 1064 | ||
1042 | /* Values for Flags field above */ | 1065 | /* Values for Flags field above */ |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index ed7943b9044f..53666bd9193d 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -322,10 +322,12 @@ | |||
322 | * 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 |
323 | * appear. This macro is used to distinguish them. | 323 | * appear. This macro is used to distinguish them. |
324 | * | 324 | * |
325 | * The "Descriptor" field is the first field in both structures. | 325 | * The "DescriptorType" field is the second field in both structures. |
326 | */ | 326 | */ |
327 | #define ACPI_GET_DESCRIPTOR_PTR(d) (((union acpi_descriptor *)(void *)(d))->common.common_pointer) | ||
328 | #define ACPI_SET_DESCRIPTOR_PTR(d, p) (((union acpi_descriptor *)(void *)(d))->common.common_pointer = (p)) | ||
327 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) | 329 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) |
328 | #define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) | 330 | #define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = (t)) |
329 | 331 | ||
330 | /* | 332 | /* |
331 | * Macros for the master AML opcode table | 333 | * Macros for the master AML opcode table |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 02cd5482ff8b..d2e491876bc0 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -167,6 +167,29 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent); | |||
167 | int acpi_ns_compare_names(char *name1, char *name2); | 167 | int acpi_ns_compare_names(char *name1, char *name2); |
168 | 168 | ||
169 | /* | 169 | /* |
170 | * nsconvert - Dynamic object conversion routines | ||
171 | */ | ||
172 | acpi_status | ||
173 | acpi_ns_convert_to_integer(union acpi_operand_object *original_object, | ||
174 | union acpi_operand_object **return_object); | ||
175 | |||
176 | acpi_status | ||
177 | acpi_ns_convert_to_string(union acpi_operand_object *original_object, | ||
178 | union acpi_operand_object **return_object); | ||
179 | |||
180 | acpi_status | ||
181 | acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | ||
182 | union acpi_operand_object **return_object); | ||
183 | |||
184 | acpi_status | ||
185 | acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, | ||
186 | union acpi_operand_object **return_object); | ||
187 | |||
188 | acpi_status | ||
189 | acpi_ns_convert_to_resource(union acpi_operand_object *original_object, | ||
190 | union acpi_operand_object **return_object); | ||
191 | |||
192 | /* | ||
170 | * nsdump - Namespace dump/print utilities | 193 | * nsdump - Namespace dump/print utilities |
171 | */ | 194 | */ |
172 | #ifdef ACPI_FUTURE_USAGE | 195 | #ifdef ACPI_FUTURE_USAGE |
@@ -208,10 +231,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
208 | acpi_status return_status, | 231 | acpi_status return_status, |
209 | union acpi_operand_object **return_object); | 232 | union acpi_operand_object **return_object); |
210 | 233 | ||
211 | const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | ||
212 | acpi_namespace_node | ||
213 | *node); | ||
214 | |||
215 | void | 234 | void |
216 | acpi_ns_check_parameter_count(char *pathname, | 235 | acpi_ns_check_parameter_count(char *pathname, |
217 | struct acpi_namespace_node *node, | 236 | struct acpi_namespace_node *node, |
@@ -289,7 +308,7 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node, | |||
289 | * predefined methods/objects | 308 | * predefined methods/objects |
290 | */ | 309 | */ |
291 | acpi_status | 310 | acpi_status |
292 | acpi_ns_repair_object(struct acpi_predefined_data *data, | 311 | acpi_ns_simple_repair(struct acpi_predefined_data *data, |
293 | u32 expected_btypes, | 312 | u32 expected_btypes, |
294 | u32 package_index, | 313 | u32 package_index, |
295 | union acpi_operand_object **return_object_ptr); | 314 | union acpi_operand_object **return_object_ptr); |
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index 752cc40cdc1e..b22b70944fd6 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h | |||
@@ -56,7 +56,7 @@ | |||
56 | * object type | 56 | * object type |
57 | * count | 57 | * count |
58 | * | 58 | * |
59 | * ACPI_PTYPE1_VAR: Variable-length length: | 59 | * ACPI_PTYPE1_VAR: Variable-length length. Zero-length package is allowed: |
60 | * object type (Int/Buf/Ref) | 60 | * object type (Int/Buf/Ref) |
61 | * | 61 | * |
62 | * ACPI_PTYPE1_OPTION: Package has some required and some optional elements | 62 | * ACPI_PTYPE1_OPTION: Package has some required and some optional elements |
@@ -66,14 +66,16 @@ | |||
66 | * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each | 66 | * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each |
67 | * of the different types describe the contents of each of the sub-packages. | 67 | * of the different types describe the contents of each of the sub-packages. |
68 | * | 68 | * |
69 | * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: | 69 | * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length |
70 | * parent package is allowed: | ||
70 | * object type | 71 | * object type |
71 | * count | 72 | * count |
72 | * object type | 73 | * object type |
73 | * count | 74 | * count |
74 | * (Used for _ALR,_MLS,_PSS,_TRT,_TSS) | 75 | * (Used for _ALR,_MLS,_PSS,_TRT,_TSS) |
75 | * | 76 | * |
76 | * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element: | 77 | * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element. |
78 | * Zero-length parent package is allowed: | ||
77 | * object type | 79 | * object type |
78 | * (Used for _CSD,_PSD,_TSD) | 80 | * (Used for _CSD,_PSD,_TSD) |
79 | * | 81 | * |
@@ -84,17 +86,19 @@ | |||
84 | * count | 86 | * count |
85 | * (Used for _CST) | 87 | * (Used for _CST) |
86 | * | 88 | * |
87 | * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length | 89 | * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length. Zero-length |
90 | * parent package is allowed. | ||
88 | * (Used for _PRT) | 91 | * (Used for _PRT) |
89 | * | 92 | * |
90 | * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length | 93 | * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length. |
94 | * Zero-length parent package is allowed: | ||
91 | * (Used for _HPX) | 95 | * (Used for _HPX) |
92 | * | 96 | * |
93 | * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length | 97 | * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length |
94 | * (Used for _ART, _FPS) | 98 | * (Used for _ART, _FPS) |
95 | * | 99 | * |
96 | * ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements | 100 | * ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements |
97 | * followed by an optional element | 101 | * followed by an optional element. Zero-length parent package is allowed. |
98 | * object type | 102 | * object type |
99 | * count | 103 | * count |
100 | * object type | 104 | * object type |
@@ -116,8 +120,47 @@ enum acpi_return_package_types { | |||
116 | ACPI_PTYPE2_FIX_VAR = 10 | 120 | ACPI_PTYPE2_FIX_VAR = 10 |
117 | }; | 121 | }; |
118 | 122 | ||
123 | /* Support macros for users of the predefined info table */ | ||
124 | |||
125 | #define METHOD_PREDEF_ARGS_MAX 4 | ||
126 | #define METHOD_ARG_BIT_WIDTH 3 | ||
127 | #define METHOD_ARG_MASK 0x0007 | ||
128 | #define ARG_COUNT_IS_MINIMUM 0x8000 | ||
129 | #define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE | ||
130 | |||
131 | #define METHOD_GET_COUNT(arg_list) (arg_list & METHOD_ARG_MASK) | ||
132 | #define METHOD_GET_NEXT_ARG(arg_list) (arg_list >> METHOD_ARG_BIT_WIDTH) | ||
133 | |||
134 | /* Macros used to build the predefined info table */ | ||
135 | |||
136 | #define METHOD_0ARGS 0 | ||
137 | #define METHOD_1ARGS(a1) (1 | (a1 << 3)) | ||
138 | #define METHOD_2ARGS(a1,a2) (2 | (a1 << 3) | (a2 << 6)) | ||
139 | #define METHOD_3ARGS(a1,a2,a3) (3 | (a1 << 3) | (a2 << 6) | (a3 << 9)) | ||
140 | #define METHOD_4ARGS(a1,a2,a3,a4) (4 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12)) | ||
141 | |||
142 | #define METHOD_RETURNS(type) (type) | ||
143 | #define METHOD_NO_RETURN_VALUE 0 | ||
144 | |||
145 | #define PACKAGE_INFO(a,b,c,d,e,f) {{{(a),(b),(c),(d)}, ((((u16)(f)) << 8) | (e)), 0}} | ||
146 | |||
147 | /* Support macros for the resource descriptor info table */ | ||
148 | |||
149 | #define WIDTH_1 0x0001 | ||
150 | #define WIDTH_2 0x0002 | ||
151 | #define WIDTH_3 0x0004 | ||
152 | #define WIDTH_8 0x0008 | ||
153 | #define WIDTH_16 0x0010 | ||
154 | #define WIDTH_32 0x0020 | ||
155 | #define WIDTH_64 0x0040 | ||
156 | #define VARIABLE_DATA 0x0080 | ||
157 | #define NUM_RESOURCE_WIDTHS 8 | ||
158 | |||
159 | #define WIDTH_ADDRESS WIDTH_16 | WIDTH_32 | WIDTH_64 | ||
160 | |||
119 | #ifdef ACPI_CREATE_PREDEFINED_TABLE | 161 | #ifdef ACPI_CREATE_PREDEFINED_TABLE |
120 | /* | 162 | /****************************************************************************** |
163 | * | ||
121 | * Predefined method/object information table. | 164 | * Predefined method/object information table. |
122 | * | 165 | * |
123 | * These are the names that can actually be evaluated via acpi_evaluate_object. | 166 | * These are the names that can actually be evaluated via acpi_evaluate_object. |
@@ -125,23 +168,24 @@ enum acpi_return_package_types { | |||
125 | * | 168 | * |
126 | * 1) Predefined/Reserved names that are never evaluated via | 169 | * 1) Predefined/Reserved names that are never evaluated via |
127 | * acpi_evaluate_object: | 170 | * acpi_evaluate_object: |
128 | * _Lxx and _Exx GPE methods | 171 | * _Lxx and _Exx GPE methods |
129 | * _Qxx EC methods | 172 | * _Qxx EC methods |
130 | * _T_x compiler temporary variables | 173 | * _T_x compiler temporary variables |
174 | * _Wxx wake events | ||
131 | * | 175 | * |
132 | * 2) Predefined names that never actually exist within the AML code: | 176 | * 2) Predefined names that never actually exist within the AML code: |
133 | * Predefined resource descriptor field names | 177 | * Predefined resource descriptor field names |
134 | * | 178 | * |
135 | * 3) Predefined names that are implemented within ACPICA: | 179 | * 3) Predefined names that are implemented within ACPICA: |
136 | * _OSI | 180 | * _OSI |
137 | * | ||
138 | * 4) Some predefined names that are not documented within the ACPI spec. | ||
139 | * _WDG, _WED | ||
140 | * | 181 | * |
141 | * The main entries in the table each contain the following items: | 182 | * The main entries in the table each contain the following items: |
142 | * | 183 | * |
143 | * name - The ACPI reserved name | 184 | * name - The ACPI reserved name |
144 | * param_count - Number of arguments to the method | 185 | * argument_list - Contains (in 16 bits), the number of required |
186 | * arguments to the method (3 bits), and a 3-bit type | ||
187 | * field for each argument (up to 4 arguments). The | ||
188 | * METHOD_?ARGS macros generate the correct packed data. | ||
145 | * expected_btypes - Allowed type(s) for the return value. | 189 | * expected_btypes - Allowed type(s) for the return value. |
146 | * 0 means that no return value is expected. | 190 | * 0 means that no return value is expected. |
147 | * | 191 | * |
@@ -151,256 +195,511 @@ enum acpi_return_package_types { | |||
151 | * overall size of the stored data. | 195 | * overall size of the stored data. |
152 | * | 196 | * |
153 | * Note: The additional braces are intended to promote portability. | 197 | * Note: The additional braces are intended to promote portability. |
154 | */ | 198 | * |
155 | static const union acpi_predefined_info predefined_names[] = { | 199 | * Note2: Table is used by the kernel-resident subsystem, the iASL compiler, |
156 | {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, | 200 | * and the acpi_help utility. |
157 | {{"_AC1", 0, ACPI_RTYPE_INTEGER}}, | 201 | * |
158 | {{"_AC2", 0, ACPI_RTYPE_INTEGER}}, | 202 | * TBD: _PRT - currently ignore reversed entries. Attempt to fix in nsrepair. |
159 | {{"_AC3", 0, ACPI_RTYPE_INTEGER}}, | 203 | * Possibly fixing package elements like _BIF, etc. |
160 | {{"_AC4", 0, ACPI_RTYPE_INTEGER}}, | 204 | * |
161 | {{"_AC5", 0, ACPI_RTYPE_INTEGER}}, | 205 | *****************************************************************************/ |
162 | {{"_AC6", 0, ACPI_RTYPE_INTEGER}}, | 206 | |
163 | {{"_AC7", 0, ACPI_RTYPE_INTEGER}}, | 207 | const union acpi_predefined_info acpi_gbl_predefined_methods[] = { |
164 | {{"_AC8", 0, ACPI_RTYPE_INTEGER}}, | 208 | {{"_AC0", METHOD_0ARGS, |
165 | {{"_AC9", 0, ACPI_RTYPE_INTEGER}}, | 209 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
166 | {{"_ADR", 0, ACPI_RTYPE_INTEGER}}, | 210 | |
167 | {{"_AEI", 0, ACPI_RTYPE_BUFFER}}, | 211 | {{"_AC1", METHOD_0ARGS, |
168 | {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 212 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
169 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 213 | |
170 | 214 | {{"_AC2", METHOD_0ARGS, | |
171 | {{"_AL1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 215 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
172 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 216 | |
173 | 217 | {{"_AC3", METHOD_0ARGS, | |
174 | {{"_AL2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 218 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
175 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 219 | |
176 | 220 | {{"_AC4", METHOD_0ARGS, | |
177 | {{"_AL3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 221 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
178 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 222 | |
179 | 223 | {{"_AC5", METHOD_0ARGS, | |
180 | {{"_AL4", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 224 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
181 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 225 | |
182 | 226 | {{"_AC6", METHOD_0ARGS, | |
183 | {{"_AL5", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 227 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
184 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 228 | |
185 | 229 | {{"_AC7", METHOD_0ARGS, | |
186 | {{"_AL6", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 230 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
187 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 231 | |
188 | 232 | {{"_AC8", METHOD_0ARGS, | |
189 | {{"_AL7", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 233 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
190 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 234 | |
191 | 235 | {{"_AC9", METHOD_0ARGS, | |
192 | {{"_AL8", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 236 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
193 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 237 | |
194 | 238 | {{"_ADR", METHOD_0ARGS, | |
195 | {{"_AL9", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 239 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
196 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 240 | |
197 | 241 | {{"_AEI", METHOD_0ARGS, | |
198 | {{"_ALC", 0, ACPI_RTYPE_INTEGER}}, | 242 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, |
199 | {{"_ALI", 0, ACPI_RTYPE_INTEGER}}, | 243 | |
200 | {{"_ALP", 0, ACPI_RTYPE_INTEGER}}, | 244 | {{"_AL0", METHOD_0ARGS, |
201 | {{"_ALR", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 (Ints) */ | 245 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
202 | {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, | 246 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
203 | 247 | ||
204 | {{"_ALT", 0, ACPI_RTYPE_INTEGER}}, | 248 | {{"_AL1", METHOD_0ARGS, |
205 | {{"_ART", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */ | 249 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
206 | {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, | 250 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
207 | 11, 0}}, | 251 | |
208 | 252 | {{"_AL2", METHOD_0ARGS, | |
209 | {{"_BBN", 0, ACPI_RTYPE_INTEGER}}, | 253 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
210 | {{"_BCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ | 254 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
211 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, | 255 | |
212 | 256 | {{"_AL3", METHOD_0ARGS, | |
213 | {{"_BCM", 1, 0}}, | 257 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
214 | {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, | 258 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
215 | {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, | 259 | |
216 | {{"_BFS", 1, 0}}, | 260 | {{"_AL4", METHOD_0ARGS, |
217 | {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */ | 261 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
218 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4, 0}}, | 262 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
219 | 263 | ||
220 | {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ | 264 | {{"_AL5", METHOD_0ARGS, |
221 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4, | 265 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
222 | 0}}, | 266 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
223 | 267 | ||
224 | {{"_BLT", 3, 0}}, | 268 | {{"_AL6", METHOD_0ARGS, |
225 | {{"_BMA", 1, ACPI_RTYPE_INTEGER}}, | 269 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
226 | {{"_BMC", 1, 0}}, | 270 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
227 | {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */ | 271 | |
228 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, | 272 | {{"_AL7", METHOD_0ARGS, |
229 | 273 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | |
230 | {{"_BMS", 1, ACPI_RTYPE_INTEGER}}, | 274 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
231 | {{"_BQC", 0, ACPI_RTYPE_INTEGER}}, | 275 | |
232 | {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ | 276 | {{"_AL8", METHOD_0ARGS, |
233 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, | 277 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
234 | 278 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | |
235 | {{"_BTM", 1, ACPI_RTYPE_INTEGER}}, | 279 | |
236 | {{"_BTP", 1, 0}}, | 280 | {{"_AL9", METHOD_0ARGS, |
237 | {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ | 281 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
238 | {{"_CDM", 0, ACPI_RTYPE_INTEGER}}, | 282 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
239 | {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ | 283 | |
240 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0}, 0, | 284 | {{"_ALC", METHOD_0ARGS, |
241 | 0}}, | 285 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
242 | 286 | ||
243 | {{"_CLS", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ | 287 | {{"_ALI", METHOD_0ARGS, |
244 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}}, | 288 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
245 | 289 | ||
246 | {{"_CPC", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Bufs) */ | 290 | {{"_ALP", METHOD_0ARGS, |
247 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0, 0}, 0, | 291 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
248 | 0}}, | 292 | |
249 | 293 | {{"_ALR", METHOD_0ARGS, | |
250 | {{"_CRS", 0, ACPI_RTYPE_BUFFER}}, | 294 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 (Ints) */ |
251 | {{"_CRT", 0, ACPI_RTYPE_INTEGER}}, | 295 | PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0), |
252 | {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */ | 296 | |
253 | {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, | 297 | {{"_ALT", METHOD_0ARGS, |
254 | 298 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | |
255 | {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ | 299 | |
256 | {{{ACPI_PTYPE2_PKG_COUNT, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3, | 300 | {{"_ART", METHOD_0ARGS, |
257 | 0}}, | 301 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */ |
258 | 302 | PACKAGE_INFO(ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2, | |
259 | {{"_CWS", 1, ACPI_RTYPE_INTEGER}}, | 303 | ACPI_RTYPE_INTEGER, 11, 0), |
260 | {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, | 304 | |
261 | {{"_DCS", 0, ACPI_RTYPE_INTEGER}}, | 305 | {{"_BBN", METHOD_0ARGS, |
262 | {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, | 306 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
263 | {{"_DDN", 0, ACPI_RTYPE_STRING}}, | 307 | |
264 | {{"_DEP", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 308 | {{"_BCL", METHOD_0ARGS, |
265 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, | 309 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ |
266 | 310 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0), | |
267 | {{"_DGS", 0, ACPI_RTYPE_INTEGER}}, | 311 | |
268 | {{"_DIS", 0, 0}}, | 312 | {{"_BCM", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
269 | 313 | METHOD_NO_RETURN_VALUE}}, | |
270 | {{"_DLM", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */ | 314 | |
271 | {{{ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1, | 315 | {{"_BCT", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
272 | ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER}, 0, 0}}, | 316 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
273 | 317 | ||
274 | {{"_DMA", 0, ACPI_RTYPE_BUFFER}}, | 318 | {{"_BDN", METHOD_0ARGS, |
275 | {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ | 319 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
276 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, | 320 | |
277 | 321 | {{"_BFS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | |
278 | {{"_DOS", 1, 0}}, | 322 | METHOD_NO_RETURN_VALUE}}, |
279 | {{"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ | 323 | |
280 | {{"_DSS", 1, 0}}, | 324 | {{"_BIF", METHOD_0ARGS, |
281 | {{"_DSW", 3, 0}}, | 325 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (9 Int),(4 Str) */ |
282 | {{"_DTI", 1, 0}}, | 326 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, |
283 | {{"_EC_", 0, ACPI_RTYPE_INTEGER}}, | 327 | ACPI_RTYPE_STRING, 4, 0), |
284 | {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/ | 328 | |
285 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 329 | {{"_BIX", METHOD_0ARGS, |
286 | 330 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */ | |
287 | {{"_EJ0", 1, 0}}, | 331 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, |
288 | {{"_EJ1", 1, 0}}, | 332 | ACPI_RTYPE_STRING, 4, 0), |
289 | {{"_EJ2", 1, 0}}, | 333 | |
290 | {{"_EJ3", 1, 0}}, | 334 | {{"_BLT", |
291 | {{"_EJ4", 1, 0}}, | 335 | METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), |
292 | {{"_EJD", 0, ACPI_RTYPE_STRING}}, | 336 | METHOD_NO_RETURN_VALUE}}, |
293 | {{"_EVT", 1, 0}}, | 337 | |
294 | {{"_FDE", 0, ACPI_RTYPE_BUFFER}}, | 338 | {{"_BMA", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
295 | {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */ | 339 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
296 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}}, | 340 | |
297 | 341 | {{"_BMC", METHOD_1ARGS(ACPI_TYPE_INTEGER), | |
298 | {{"_FDM", 1, 0}}, | 342 | METHOD_NO_RETURN_VALUE}}, |
299 | {{"_FIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ | 343 | |
300 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0}, 0, 0}}, | 344 | {{"_BMD", METHOD_0ARGS, |
301 | 345 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (5 Int) */ | |
302 | {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ | 346 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0), |
303 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, | 347 | |
304 | 348 | {{"_BMS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | |
305 | {{"_FPS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */ | 349 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
306 | {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 5, 0}, 0, 0}}, | 350 | |
307 | 351 | {{"_BQC", METHOD_0ARGS, | |
308 | {{"_FSL", 1, 0}}, | 352 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
309 | {{"_FST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ | 353 | |
310 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}}, | 354 | {{"_BST", METHOD_0ARGS, |
311 | 355 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ | |
312 | {{"_GAI", 0, ACPI_RTYPE_INTEGER}}, | 356 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0), |
313 | {{"_GCP", 0, ACPI_RTYPE_INTEGER}}, | 357 | |
314 | {{"_GHL", 0, ACPI_RTYPE_INTEGER}}, | 358 | {{"_BTM", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
315 | {{"_GLK", 0, ACPI_RTYPE_INTEGER}}, | 359 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
316 | {{"_GPD", 0, ACPI_RTYPE_INTEGER}}, | 360 | |
317 | {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ | 361 | {{"_BTP", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
318 | {{"_GRT", 0, ACPI_RTYPE_BUFFER}}, | 362 | METHOD_NO_RETURN_VALUE}}, |
319 | {{"_GSB", 0, ACPI_RTYPE_INTEGER}}, | 363 | |
320 | {{"_GTF", 0, ACPI_RTYPE_BUFFER}}, | 364 | {{"_CBA", METHOD_0ARGS, |
321 | {{"_GTM", 0, ACPI_RTYPE_BUFFER}}, | 365 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */ |
322 | {{"_GTS", 1, 0}}, | 366 | |
323 | {{"_GWS", 1, ACPI_RTYPE_INTEGER}}, | 367 | {{"_CDM", METHOD_0ARGS, |
324 | {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, | 368 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
325 | {{"_HOT", 0, ACPI_RTYPE_INTEGER}}, | 369 | |
326 | {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ | 370 | {{"_CID", METHOD_0ARGS, |
327 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, | 371 | METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Strs) */ |
372 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, | ||
373 | 0, 0, 0), | ||
374 | |||
375 | {{"_CLS", METHOD_0ARGS, | ||
376 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */ | ||
377 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0, 0, 0), | ||
378 | |||
379 | {{"_CPC", METHOD_0ARGS, | ||
380 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Bufs) */ | ||
381 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0, | ||
382 | 0, 0, 0), | ||
383 | |||
384 | {{"_CRS", METHOD_0ARGS, | ||
385 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
386 | |||
387 | {{"_CRT", METHOD_0ARGS, | ||
388 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
389 | |||
390 | {{"_CSD", METHOD_0ARGS, | ||
391 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n-1 Int) */ | ||
392 | PACKAGE_INFO(ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0), | ||
393 | |||
394 | {{"_CST", METHOD_0ARGS, | ||
395 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ | ||
396 | PACKAGE_INFO(ACPI_PTYPE2_PKG_COUNT, ACPI_RTYPE_BUFFER, 1, | ||
397 | ACPI_RTYPE_INTEGER, 3, 0), | ||
398 | |||
399 | {{"_CWS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
400 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
401 | |||
402 | {{"_DCK", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
403 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
404 | |||
405 | {{"_DCS", METHOD_0ARGS, | ||
406 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
407 | |||
408 | {{"_DDC", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
409 | METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER)}}, | ||
410 | |||
411 | {{"_DDN", METHOD_0ARGS, | ||
412 | METHOD_RETURNS(ACPI_RTYPE_STRING)}}, | ||
413 | |||
414 | {{"_DEP", METHOD_0ARGS, | ||
415 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
416 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
417 | |||
418 | {{"_DGS", METHOD_0ARGS, | ||
419 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
420 | |||
421 | {{"_DIS", METHOD_0ARGS, | ||
422 | METHOD_NO_RETURN_VALUE}}, | ||
423 | |||
424 | {{"_DLM", METHOD_0ARGS, | ||
425 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */ | ||
426 | PACKAGE_INFO(ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1, | ||
427 | ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER, 0, 0), | ||
428 | |||
429 | {{"_DMA", METHOD_0ARGS, | ||
430 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
431 | |||
432 | {{"_DOD", METHOD_0ARGS, | ||
433 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ | ||
434 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0), | ||
435 | |||
436 | {{"_DOS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
437 | METHOD_NO_RETURN_VALUE}}, | ||
438 | |||
439 | {{"_DSM", | ||
440 | METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, | ||
441 | ACPI_TYPE_PACKAGE), | ||
442 | METHOD_RETURNS(ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */ | ||
443 | |||
444 | {{"_DSS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
445 | METHOD_NO_RETURN_VALUE}}, | ||
446 | |||
447 | {{"_DSW", | ||
448 | METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), | ||
449 | METHOD_NO_RETURN_VALUE}}, | ||
450 | |||
451 | {{"_DTI", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
452 | METHOD_NO_RETURN_VALUE}}, | ||
453 | |||
454 | {{"_EC_", METHOD_0ARGS, | ||
455 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
456 | |||
457 | {{"_EDL", METHOD_0ARGS, | ||
458 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
459 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
460 | |||
461 | {{"_EJ0", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
462 | METHOD_NO_RETURN_VALUE}}, | ||
463 | |||
464 | {{"_EJ1", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
465 | METHOD_NO_RETURN_VALUE}}, | ||
466 | |||
467 | {{"_EJ2", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
468 | METHOD_NO_RETURN_VALUE}}, | ||
469 | |||
470 | {{"_EJ3", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
471 | METHOD_NO_RETURN_VALUE}}, | ||
472 | |||
473 | {{"_EJ4", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
474 | METHOD_NO_RETURN_VALUE}}, | ||
475 | |||
476 | {{"_EJD", METHOD_0ARGS, | ||
477 | METHOD_RETURNS(ACPI_RTYPE_STRING)}}, | ||
478 | |||
479 | {{"_ERR", | ||
480 | METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_STRING, ACPI_TYPE_INTEGER), | ||
481 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* Internal use only, used by ACPICA test suites */ | ||
482 | |||
483 | {{"_EVT", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
484 | METHOD_NO_RETURN_VALUE}}, | ||
485 | |||
486 | {{"_FDE", METHOD_0ARGS, | ||
487 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
488 | |||
489 | {{"_FDI", METHOD_0ARGS, | ||
490 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int) */ | ||
491 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0), | ||
492 | |||
493 | {{"_FDM", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
494 | METHOD_NO_RETURN_VALUE}}, | ||
495 | |||
496 | {{"_FIF", METHOD_0ARGS, | ||
497 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ | ||
498 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0), | ||
499 | |||
500 | {{"_FIX", METHOD_0ARGS, | ||
501 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */ | ||
502 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0), | ||
503 | |||
504 | {{"_FPS", METHOD_0ARGS, | ||
505 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */ | ||
506 | PACKAGE_INFO(ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0), | ||
507 | |||
508 | {{"_FSL", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
509 | METHOD_NO_RETURN_VALUE}}, | ||
510 | |||
511 | {{"_FST", METHOD_0ARGS, | ||
512 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */ | ||
513 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0, 0, 0), | ||
514 | |||
515 | {{"_GAI", METHOD_0ARGS, | ||
516 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
517 | |||
518 | {{"_GCP", METHOD_0ARGS, | ||
519 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
520 | |||
521 | {{"_GHL", METHOD_0ARGS, | ||
522 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
523 | |||
524 | {{"_GLK", METHOD_0ARGS, | ||
525 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
526 | |||
527 | {{"_GPD", METHOD_0ARGS, | ||
528 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
529 | |||
530 | {{"_GPE", METHOD_0ARGS, | ||
531 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* _GPE method, not _GPE scope */ | ||
532 | |||
533 | {{"_GRT", METHOD_0ARGS, | ||
534 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
535 | |||
536 | {{"_GSB", METHOD_0ARGS, | ||
537 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
538 | |||
539 | {{"_GTF", METHOD_0ARGS, | ||
540 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
541 | |||
542 | {{"_GTM", METHOD_0ARGS, | ||
543 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
544 | |||
545 | {{"_GTS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
546 | METHOD_NO_RETURN_VALUE}}, | ||
547 | |||
548 | {{"_GWS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
549 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
550 | |||
551 | {{"_HID", METHOD_0ARGS, | ||
552 | METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}}, | ||
553 | |||
554 | {{"_HOT", METHOD_0ARGS, | ||
555 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
556 | |||
557 | {{"_HPP", METHOD_0ARGS, | ||
558 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ | ||
559 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0), | ||
328 | 560 | ||
329 | /* | 561 | /* |
330 | * For _HPX, a single package is returned, containing a Variable-length number | 562 | * For _HPX, a single package is returned, containing a variable-length number |
331 | * of sub-packages. Each sub-package contains a PCI record setting. | 563 | * of sub-packages. Each sub-package contains a PCI record setting. |
332 | * There are several different type of record settings, of different | 564 | * There are several different type of record settings, of different |
333 | * lengths, but all elements of all settings are Integers. | 565 | * lengths, but all elements of all settings are Integers. |
334 | */ | 566 | */ |
335 | {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */ | 567 | {{"_HPX", METHOD_0ARGS, |
336 | {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, | 568 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (var Ints) */ |
337 | 569 | PACKAGE_INFO(ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0), | |
338 | {{"_HRV", 0, ACPI_RTYPE_INTEGER}}, | 570 | |
339 | {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ | 571 | {{"_HRV", METHOD_0ARGS, |
340 | {{"_INI", 0, 0}}, | 572 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
341 | {{"_IRC", 0, 0}}, | 573 | |
342 | {{"_LCK", 1, 0}}, | 574 | {{"_IFT", METHOD_0ARGS, |
343 | {{"_LID", 0, ACPI_RTYPE_INTEGER}}, | 575 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */ |
344 | {{"_MAT", 0, ACPI_RTYPE_BUFFER}}, | 576 | |
345 | {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */ | 577 | {{"_INI", METHOD_0ARGS, |
346 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}}, | 578 | METHOD_NO_RETURN_VALUE}}, |
347 | 579 | ||
348 | {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */ | 580 | {{"_IRC", METHOD_0ARGS, |
349 | {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER}, 1, 0}}, | 581 | METHOD_NO_RETURN_VALUE}}, |
350 | 582 | ||
351 | {{"_MSG", 1, 0}}, | 583 | {{"_LCK", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
352 | {{"_MSM", 4, ACPI_RTYPE_INTEGER}}, | 584 | METHOD_NO_RETURN_VALUE}}, |
353 | {{"_NTT", 0, ACPI_RTYPE_INTEGER}}, | 585 | |
354 | {{"_OFF", 0, 0}}, | 586 | {{"_LID", METHOD_0ARGS, |
355 | {{"_ON_", 0, 0}}, | 587 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
356 | {{"_OS_", 0, ACPI_RTYPE_STRING}}, | 588 | |
357 | {{"_OSC", 4, ACPI_RTYPE_BUFFER}}, | 589 | {{"_MAT", METHOD_0ARGS, |
358 | {{"_OST", 3, 0}}, | 590 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, |
359 | {{"_PAI", 1, ACPI_RTYPE_INTEGER}}, | 591 | |
360 | {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 592 | {{"_MBM", METHOD_0ARGS, |
361 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 593 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (8 Int) */ |
362 | 594 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0, 0, 0), | |
363 | {{"_PCT", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ | 595 | |
364 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, | 596 | {{"_MLS", METHOD_0ARGS, |
365 | 597 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */ | |
366 | {{"_PDC", 1, 0}}, | 598 | PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER, 1, |
367 | {{"_PDL", 0, ACPI_RTYPE_INTEGER}}, | 599 | 0), |
368 | {{"_PIC", 1, 0}}, | 600 | |
369 | {{"_PIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int),(3 Str) */ | 601 | {{"_MSG", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
370 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING}, 3, 0}}, | 602 | METHOD_NO_RETURN_VALUE}}, |
371 | 603 | ||
372 | {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */ | 604 | {{"_MSM", |
373 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}}, | 605 | METHOD_4ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, |
374 | 606 | ACPI_TYPE_INTEGER), | |
375 | {{"_PMC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (11 Int),(3 Str) */ | 607 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
376 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING}, 3, | 608 | |
377 | 0}}, | 609 | {{"_NTT", METHOD_0ARGS, |
378 | 610 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | |
379 | {{"_PMD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 611 | |
380 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, | 612 | {{"_OFF", METHOD_0ARGS, |
381 | 613 | METHOD_NO_RETURN_VALUE}}, | |
382 | {{"_PMM", 0, ACPI_RTYPE_INTEGER}}, | 614 | |
383 | {{"_PPC", 0, ACPI_RTYPE_INTEGER}}, | 615 | {{"_ON_", METHOD_0ARGS, |
384 | {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */ | 616 | METHOD_NO_RETURN_VALUE}}, |
385 | {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 617 | |
386 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 618 | {{"_OS_", METHOD_0ARGS, |
387 | 619 | METHOD_RETURNS(ACPI_RTYPE_STRING)}}, | |
388 | {{"_PR1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 620 | |
389 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 621 | {{"_OSC", |
390 | 622 | METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, | |
391 | {{"_PR2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 623 | ACPI_TYPE_BUFFER), |
392 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 624 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, |
393 | 625 | ||
394 | {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 626 | {{"_OST", |
395 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, | 627 | METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER), |
396 | 628 | METHOD_NO_RETURN_VALUE}}, | |
397 | {{"_PRE", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 629 | |
398 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, | 630 | {{"_PAI", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
399 | 631 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | |
400 | {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 632 | |
401 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, | 633 | {{"_PCL", METHOD_0ARGS, |
402 | 634 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | |
403 | {{"_PRS", 0, ACPI_RTYPE_BUFFER}}, | 635 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
636 | |||
637 | {{"_PCT", METHOD_0ARGS, | ||
638 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */ | ||
639 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0), | ||
640 | |||
641 | {{"_PDC", METHOD_1ARGS(ACPI_TYPE_BUFFER), | ||
642 | METHOD_NO_RETURN_VALUE}}, | ||
643 | |||
644 | {{"_PDL", METHOD_0ARGS, | ||
645 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
646 | |||
647 | {{"_PIC", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
648 | METHOD_NO_RETURN_VALUE}}, | ||
649 | |||
650 | {{"_PIF", METHOD_0ARGS, | ||
651 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int),(3 Str) */ | ||
652 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, | ||
653 | ACPI_RTYPE_STRING, 3, 0), | ||
654 | |||
655 | {{"_PLD", METHOD_0ARGS, | ||
656 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Bufs) */ | ||
657 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0), | ||
658 | |||
659 | {{"_PMC", METHOD_0ARGS, | ||
660 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (11 Int),(3 Str) */ | ||
661 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, | ||
662 | ACPI_RTYPE_STRING, 3, 0), | ||
663 | |||
664 | {{"_PMD", METHOD_0ARGS, | ||
665 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
666 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
667 | |||
668 | {{"_PMM", METHOD_0ARGS, | ||
669 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
670 | |||
671 | {{"_PPC", METHOD_0ARGS, | ||
672 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
673 | |||
674 | {{"_PPE", METHOD_0ARGS, | ||
675 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See dig64 spec */ | ||
676 | |||
677 | {{"_PR0", METHOD_0ARGS, | ||
678 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
679 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
680 | |||
681 | {{"_PR1", METHOD_0ARGS, | ||
682 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
683 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
684 | |||
685 | {{"_PR2", METHOD_0ARGS, | ||
686 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
687 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
688 | |||
689 | {{"_PR3", METHOD_0ARGS, | ||
690 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
691 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
692 | |||
693 | {{"_PRE", METHOD_0ARGS, | ||
694 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
695 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
696 | |||
697 | {{"_PRL", METHOD_0ARGS, | ||
698 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
699 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
700 | |||
701 | {{"_PRS", METHOD_0ARGS, | ||
702 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
404 | 703 | ||
405 | /* | 704 | /* |
406 | * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source | 705 | * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source |
@@ -410,47 +709,89 @@ static const union acpi_predefined_info predefined_names[] = { | |||
410 | * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3) | 709 | * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3) |
411 | * in the statement below. | 710 | * in the statement below. |
412 | */ | 711 | */ |
413 | {{"_PRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */ | 712 | {{"_PRT", METHOD_0ARGS, |
414 | {{{ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,ACPI_RTYPE_INTEGER}, | 713 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */ |
415 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, | 714 | PACKAGE_INFO(ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER, |
416 | ACPI_RTYPE_INTEGER}}, | 715 | ACPI_RTYPE_INTEGER, |
417 | 716 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, | |
418 | {{"_PRW", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */ | 717 | ACPI_RTYPE_INTEGER), |
419 | {{{ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE, | 718 | |
420 | ACPI_RTYPE_INTEGER}, ACPI_RTYPE_REFERENCE,0}}, | 719 | {{"_PRW", METHOD_0ARGS, |
421 | 720 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */ | |
422 | {{"_PS0", 0, 0}}, | 721 | PACKAGE_INFO(ACPI_PTYPE1_OPTION, 2, |
423 | {{"_PS1", 0, 0}}, | 722 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE, |
424 | {{"_PS2", 0, 0}}, | 723 | ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0), |
425 | {{"_PS3", 0, 0}}, | 724 | |
426 | {{"_PSC", 0, ACPI_RTYPE_INTEGER}}, | 725 | {{"_PS0", METHOD_0ARGS, |
427 | {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */ | 726 | METHOD_NO_RETURN_VALUE}}, |
428 | {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}}, | 727 | |
429 | 728 | {{"_PS1", METHOD_0ARGS, | |
430 | {{"_PSE", 1, 0}}, | 729 | METHOD_NO_RETURN_VALUE}}, |
431 | {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 730 | |
432 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 731 | {{"_PS2", METHOD_0ARGS, |
433 | 732 | METHOD_NO_RETURN_VALUE}}, | |
434 | {{"_PSR", 0, ACPI_RTYPE_INTEGER}}, | 733 | |
435 | {{"_PSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (6 Int) */ | 734 | {{"_PS3", METHOD_0ARGS, |
436 | {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0}, 0,0}}, | 735 | METHOD_NO_RETURN_VALUE}}, |
437 | 736 | ||
438 | {{"_PSV", 0, ACPI_RTYPE_INTEGER}}, | 737 | {{"_PSC", METHOD_0ARGS, |
439 | {{"_PSW", 1, 0}}, | 738 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
440 | {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ | 739 | |
441 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, | 740 | {{"_PSD", METHOD_0ARGS, |
442 | 741 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (5 Int) with count */ | |
443 | {{"_PTP", 2, ACPI_RTYPE_INTEGER}}, | 742 | PACKAGE_INFO(ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0), |
444 | {{"_PTS", 1, 0}}, | 743 | |
445 | {{"_PUR", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Int) */ | 744 | {{"_PSE", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
446 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0}, 0, 0}}, | 745 | METHOD_NO_RETURN_VALUE}}, |
447 | 746 | ||
448 | {{"_PXM", 0, ACPI_RTYPE_INTEGER}}, | 747 | {{"_PSL", METHOD_0ARGS, |
449 | {{"_REG", 2, 0}}, | 748 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ |
450 | {{"_REV", 0, ACPI_RTYPE_INTEGER}}, | 749 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), |
451 | {{"_RMV", 0, ACPI_RTYPE_INTEGER}}, | 750 | |
452 | {{"_ROM", 2, ACPI_RTYPE_BUFFER}}, | 751 | {{"_PSR", METHOD_0ARGS, |
453 | {{"_RTV", 0, ACPI_RTYPE_INTEGER}}, | 752 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
753 | |||
754 | {{"_PSS", METHOD_0ARGS, | ||
755 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (6 Int) */ | ||
756 | PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0), | ||
757 | |||
758 | {{"_PSV", METHOD_0ARGS, | ||
759 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
760 | |||
761 | {{"_PSW", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
762 | METHOD_NO_RETURN_VALUE}}, | ||
763 | |||
764 | {{"_PTC", METHOD_0ARGS, | ||
765 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */ | ||
766 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0), | ||
767 | |||
768 | {{"_PTP", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), | ||
769 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
770 | |||
771 | {{"_PTS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
772 | METHOD_NO_RETURN_VALUE}}, | ||
773 | |||
774 | {{"_PUR", METHOD_0ARGS, | ||
775 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int) */ | ||
776 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0), | ||
777 | |||
778 | {{"_PXM", METHOD_0ARGS, | ||
779 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
780 | |||
781 | {{"_REG", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), | ||
782 | METHOD_NO_RETURN_VALUE}}, | ||
783 | |||
784 | {{"_REV", METHOD_0ARGS, | ||
785 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
786 | |||
787 | {{"_RMV", METHOD_0ARGS, | ||
788 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
789 | |||
790 | {{"_ROM", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), | ||
791 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
792 | |||
793 | {{"_RTV", METHOD_0ARGS, | ||
794 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
454 | 795 | ||
455 | /* | 796 | /* |
456 | * For _S0_ through _S5_, the ACPI spec defines a return Package | 797 | * For _S0_ through _S5_, the ACPI spec defines a return Package |
@@ -458,111 +799,285 @@ static const union acpi_predefined_info predefined_names[] = { | |||
458 | * Allow this by making the objects "Variable-length length", but all elements | 799 | * Allow this by making the objects "Variable-length length", but all elements |
459 | * must be Integers. | 800 | * must be Integers. |
460 | */ | 801 | */ |
461 | {{"_S0_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ | 802 | {{"_S0_", METHOD_0ARGS, |
462 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, | 803 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ |
463 | 804 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0), | |
464 | {{"_S1_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ | 805 | |
465 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, | 806 | {{"_S1_", METHOD_0ARGS, |
466 | 807 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ | |
467 | {{"_S2_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ | 808 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0), |
468 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, | 809 | |
469 | 810 | {{"_S2_", METHOD_0ARGS, | |
470 | {{"_S3_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ | 811 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ |
471 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, | 812 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0), |
472 | 813 | ||
473 | {{"_S4_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ | 814 | {{"_S3_", METHOD_0ARGS, |
474 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, | 815 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ |
475 | 816 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0), | |
476 | {{"_S5_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ | 817 | |
477 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, | 818 | {{"_S4_", METHOD_0ARGS, |
478 | 819 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ | |
479 | {{"_S1D", 0, ACPI_RTYPE_INTEGER}}, | 820 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0), |
480 | {{"_S2D", 0, ACPI_RTYPE_INTEGER}}, | 821 | |
481 | {{"_S3D", 0, ACPI_RTYPE_INTEGER}}, | 822 | {{"_S5_", METHOD_0ARGS, |
482 | {{"_S4D", 0, ACPI_RTYPE_INTEGER}}, | 823 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */ |
483 | {{"_S0W", 0, ACPI_RTYPE_INTEGER}}, | 824 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0), |
484 | {{"_S1W", 0, ACPI_RTYPE_INTEGER}}, | 825 | |
485 | {{"_S2W", 0, ACPI_RTYPE_INTEGER}}, | 826 | {{"_S1D", METHOD_0ARGS, |
486 | {{"_S3W", 0, ACPI_RTYPE_INTEGER}}, | 827 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
487 | {{"_S4W", 0, ACPI_RTYPE_INTEGER}}, | 828 | |
488 | {{"_SBS", 0, ACPI_RTYPE_INTEGER}}, | 829 | {{"_S2D", METHOD_0ARGS, |
489 | {{"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ | 830 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
490 | /* Note: the 3-arg definition may be removed for ACPI 4.0 */ | 831 | |
491 | {{"_SDD", 1, 0}}, | 832 | {{"_S3D", METHOD_0ARGS, |
492 | {{"_SEG", 0, ACPI_RTYPE_INTEGER}}, | 833 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
493 | {{"_SHL", 1, ACPI_RTYPE_INTEGER}}, | 834 | |
494 | {{"_SLI", 0, ACPI_RTYPE_BUFFER}}, | 835 | {{"_S4D", METHOD_0ARGS, |
495 | {{"_SPD", 1, ACPI_RTYPE_INTEGER}}, | 836 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
496 | {{"_SRS", 1, 0}}, | 837 | |
497 | {{"_SRT", 1, ACPI_RTYPE_INTEGER}}, | 838 | {{"_S0W", METHOD_0ARGS, |
498 | {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ | 839 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
499 | {{"_SST", 1, 0}}, | 840 | |
500 | {{"_STA", 0, ACPI_RTYPE_INTEGER}}, | 841 | {{"_S1W", METHOD_0ARGS, |
501 | {{"_STM", 3, 0}}, | 842 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
502 | {{"_STP", 2, ACPI_RTYPE_INTEGER}}, | 843 | |
503 | {{"_STR", 0, ACPI_RTYPE_BUFFER}}, | 844 | {{"_S2W", METHOD_0ARGS, |
504 | {{"_STV", 2, ACPI_RTYPE_INTEGER}}, | 845 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
505 | {{"_SUB", 0, ACPI_RTYPE_STRING}}, | 846 | |
506 | {{"_SUN", 0, ACPI_RTYPE_INTEGER}}, | 847 | {{"_S3W", METHOD_0ARGS, |
507 | {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, | 848 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
508 | {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, | 849 | |
509 | {{"_TC2", 0, ACPI_RTYPE_INTEGER}}, | 850 | {{"_S4W", METHOD_0ARGS, |
510 | {{"_TDL", 0, ACPI_RTYPE_INTEGER}}, | 851 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
511 | {{"_TIP", 1, ACPI_RTYPE_INTEGER}}, | 852 | |
512 | {{"_TIV", 1, ACPI_RTYPE_INTEGER}}, | 853 | {{"_SBS", METHOD_0ARGS, |
513 | {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, | 854 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
514 | {{"_TPC", 0, ACPI_RTYPE_INTEGER}}, | 855 | |
515 | {{"_TPT", 1, 0}}, | 856 | {{"_SCP", METHOD_1ARGS(ACPI_TYPE_INTEGER) | ARG_COUNT_IS_MINIMUM, |
516 | {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */ | 857 | METHOD_NO_RETURN_VALUE}}, /* Acpi 1.0 allowed 1 integer arg. Acpi 3.0 expanded to 3 args. Allow both. */ |
517 | {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}}, | 858 | |
518 | 859 | {{"_SDD", METHOD_1ARGS(ACPI_TYPE_BUFFER), | |
519 | {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int with count */ | 860 | METHOD_NO_RETURN_VALUE}}, |
520 | {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, | 861 | |
521 | 862 | {{"_SEG", METHOD_0ARGS, | |
522 | {{"_TSP", 0, ACPI_RTYPE_INTEGER}}, | 863 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
523 | {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int */ | 864 | |
524 | {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, | 865 | {{"_SHL", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
525 | 866 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | |
526 | {{"_TST", 0, ACPI_RTYPE_INTEGER}}, | 867 | |
527 | {{"_TTS", 1, 0}}, | 868 | {{"_SLI", METHOD_0ARGS, |
528 | {{"_TZD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ | 869 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, |
529 | {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, | 870 | |
530 | 871 | {{"_SPD", METHOD_1ARGS(ACPI_TYPE_INTEGER), | |
531 | {{"_TZM", 0, ACPI_RTYPE_REFERENCE}}, | 872 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
532 | {{"_TZP", 0, ACPI_RTYPE_INTEGER}}, | 873 | |
533 | {{"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, | 874 | {{"_SRS", METHOD_1ARGS(ACPI_TYPE_BUFFER), |
534 | {{"_UPC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ | 875 | METHOD_NO_RETURN_VALUE}}, |
535 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, | 876 | |
536 | 877 | {{"_SRT", METHOD_1ARGS(ACPI_TYPE_BUFFER), | |
537 | {{"_UPD", 0, ACPI_RTYPE_INTEGER}}, | 878 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, |
538 | {{"_UPP", 0, ACPI_RTYPE_INTEGER}}, | 879 | |
539 | {{"_VPO", 0, ACPI_RTYPE_INTEGER}}, | 880 | {{"_SRV", METHOD_0ARGS, |
881 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */ | ||
882 | |||
883 | {{"_SST", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
884 | METHOD_NO_RETURN_VALUE}}, | ||
885 | |||
886 | {{"_STA", METHOD_0ARGS, | ||
887 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
888 | |||
889 | {{"_STM", | ||
890 | METHOD_3ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER), | ||
891 | METHOD_NO_RETURN_VALUE}}, | ||
892 | |||
893 | {{"_STP", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), | ||
894 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
895 | |||
896 | {{"_STR", METHOD_0ARGS, | ||
897 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, | ||
898 | |||
899 | {{"_STV", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), | ||
900 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
901 | |||
902 | {{"_SUB", METHOD_0ARGS, | ||
903 | METHOD_RETURNS(ACPI_RTYPE_STRING)}}, | ||
904 | |||
905 | {{"_SUN", METHOD_0ARGS, | ||
906 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
907 | |||
908 | {{"_SWS", METHOD_0ARGS, | ||
909 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
910 | |||
911 | {{"_TC1", METHOD_0ARGS, | ||
912 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
913 | |||
914 | {{"_TC2", METHOD_0ARGS, | ||
915 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
916 | |||
917 | {{"_TDL", METHOD_0ARGS, | ||
918 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
919 | |||
920 | {{"_TIP", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
921 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
922 | |||
923 | {{"_TIV", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
924 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
925 | |||
926 | {{"_TMP", METHOD_0ARGS, | ||
927 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
928 | |||
929 | {{"_TPC", METHOD_0ARGS, | ||
930 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
931 | |||
932 | {{"_TPT", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
933 | METHOD_NO_RETURN_VALUE}}, | ||
934 | |||
935 | {{"_TRT", METHOD_0ARGS, | ||
936 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */ | ||
937 | PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER, | ||
938 | 6, 0), | ||
939 | |||
940 | {{"_TSD", METHOD_0ARGS, | ||
941 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int with count */ | ||
942 | PACKAGE_INFO(ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0), | ||
943 | |||
944 | {{"_TSP", METHOD_0ARGS, | ||
945 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
946 | |||
947 | {{"_TSS", METHOD_0ARGS, | ||
948 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int */ | ||
949 | PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0), | ||
950 | |||
951 | {{"_TST", METHOD_0ARGS, | ||
952 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
953 | |||
954 | {{"_TTS", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
955 | METHOD_NO_RETURN_VALUE}}, | ||
956 | |||
957 | {{"_TZD", METHOD_0ARGS, | ||
958 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ | ||
959 | PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0), | ||
960 | |||
961 | {{"_TZM", METHOD_0ARGS, | ||
962 | METHOD_RETURNS(ACPI_RTYPE_REFERENCE)}}, | ||
963 | |||
964 | {{"_TZP", METHOD_0ARGS, | ||
965 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
966 | |||
967 | {{"_UID", METHOD_0ARGS, | ||
968 | METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}}, | ||
969 | |||
970 | {{"_UPC", METHOD_0ARGS, | ||
971 | METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ | ||
972 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0), | ||
973 | |||
974 | {{"_UPD", METHOD_0ARGS, | ||
975 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
976 | |||
977 | {{"_UPP", METHOD_0ARGS, | ||
978 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
979 | |||
980 | {{"_VPO", METHOD_0ARGS, | ||
981 | METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, | ||
540 | 982 | ||
541 | /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ | 983 | /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ |
542 | 984 | ||
543 | {{"_WAK", 1, | 985 | {{"_WAK", METHOD_1ARGS(ACPI_TYPE_INTEGER), |
544 | ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, | 986 | METHOD_RETURNS(ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | |
545 | {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ | 987 | ACPI_RTYPE_PACKAGE)}}, |
988 | PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0), /* Fixed-length (2 Int), but is optional */ | ||
546 | 989 | ||
547 | /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */ | 990 | /* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */ |
548 | 991 | ||
549 | {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, | 992 | {{"_WDG", METHOD_0ARGS, |
550 | {{"_WED", 1, | 993 | METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, |
551 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}}, | 994 | |
995 | {{"_WED", METHOD_1ARGS(ACPI_TYPE_INTEGER), | ||
996 | METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | | ||
997 | ACPI_RTYPE_BUFFER)}}, | ||
552 | 998 | ||
553 | {{{0, 0, 0, 0}, 0, 0}} /* Table terminator */ | 999 | PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */ |
554 | }; | 1000 | }; |
1001 | #else | ||
1002 | extern const union acpi_predefined_info acpi_gbl_predefined_methods[]; | ||
1003 | #endif | ||
555 | 1004 | ||
556 | #if 0 | 1005 | #if (defined ACPI_CREATE_RESOURCE_TABLE && defined ACPI_APPLICATION) |
1006 | /****************************************************************************** | ||
1007 | * | ||
1008 | * Predefined names for use in Resource Descriptors. These names do not | ||
1009 | * appear in the global Predefined Name table (since these names never | ||
1010 | * appear in actual AML byte code, only in the original ASL) | ||
1011 | * | ||
1012 | * Note: Used by iASL compiler and acpi_help utility only. | ||
1013 | * | ||
1014 | *****************************************************************************/ | ||
557 | 1015 | ||
558 | /* This is an internally implemented control method, no need to check */ | 1016 | const union acpi_predefined_info acpi_gbl_resource_names[] = { |
559 | { { | 1017 | {{"_ADR", WIDTH_16 | WIDTH_64, 0}}, |
560 | "_OSI", 1, ACPI_RTYPE_INTEGER}}, | 1018 | {{"_ALN", WIDTH_8 | WIDTH_16 | WIDTH_32, 0}}, |
1019 | {{"_ASI", WIDTH_8, 0}}, | ||
1020 | {{"_ASZ", WIDTH_8, 0}}, | ||
1021 | {{"_ATT", WIDTH_64, 0}}, | ||
1022 | {{"_BAS", WIDTH_16 | WIDTH_32, 0}}, | ||
1023 | {{"_BM_", WIDTH_1, 0}}, | ||
1024 | {{"_DBT", WIDTH_16, 0}}, /* Acpi 5.0 */ | ||
1025 | {{"_DEC", WIDTH_1, 0}}, | ||
1026 | {{"_DMA", WIDTH_8, 0}}, | ||
1027 | {{"_DPL", WIDTH_1, 0}}, /* Acpi 5.0 */ | ||
1028 | {{"_DRS", WIDTH_16, 0}}, /* Acpi 5.0 */ | ||
1029 | {{"_END", WIDTH_1, 0}}, /* Acpi 5.0 */ | ||
1030 | {{"_FLC", WIDTH_2, 0}}, /* Acpi 5.0 */ | ||
1031 | {{"_GRA", WIDTH_ADDRESS, 0}}, | ||
1032 | {{"_HE_", WIDTH_1, 0}}, | ||
1033 | {{"_INT", WIDTH_16 | WIDTH_32, 0}}, | ||
1034 | {{"_IOR", WIDTH_2, 0}}, /* Acpi 5.0 */ | ||
1035 | {{"_LEN", WIDTH_8 | WIDTH_ADDRESS, 0}}, | ||
1036 | {{"_LIN", WIDTH_8, 0}}, /* Acpi 5.0 */ | ||
1037 | {{"_LL_", WIDTH_1, 0}}, | ||
1038 | {{"_MAF", WIDTH_1, 0}}, | ||
1039 | {{"_MAX", WIDTH_ADDRESS, 0}}, | ||
1040 | {{"_MEM", WIDTH_2, 0}}, | ||
1041 | {{"_MIF", WIDTH_1, 0}}, | ||
1042 | {{"_MIN", WIDTH_ADDRESS, 0}}, | ||
1043 | {{"_MOD", WIDTH_1, 0}}, /* Acpi 5.0 */ | ||
1044 | {{"_MTP", WIDTH_2, 0}}, | ||
1045 | {{"_PAR", WIDTH_8, 0}}, /* Acpi 5.0 */ | ||
1046 | {{"_PHA", WIDTH_1, 0}}, /* Acpi 5.0 */ | ||
1047 | {{"_PIN", WIDTH_16, 0}}, /* Acpi 5.0 */ | ||
1048 | {{"_PPI", WIDTH_8, 0}}, /* Acpi 5.0 */ | ||
1049 | {{"_POL", WIDTH_1 | WIDTH_2, 0}}, /* Acpi 5.0 */ | ||
1050 | {{"_RBO", WIDTH_8, 0}}, | ||
1051 | {{"_RBW", WIDTH_8, 0}}, | ||
1052 | {{"_RNG", WIDTH_1, 0}}, | ||
1053 | {{"_RT_", WIDTH_8, 0}}, /* Acpi 3.0 */ | ||
1054 | {{"_RW_", WIDTH_1, 0}}, | ||
1055 | {{"_RXL", WIDTH_16, 0}}, /* Acpi 5.0 */ | ||
1056 | {{"_SHR", WIDTH_2, 0}}, | ||
1057 | {{"_SIZ", WIDTH_2, 0}}, | ||
1058 | {{"_SLV", WIDTH_1, 0}}, /* Acpi 5.0 */ | ||
1059 | {{"_SPE", WIDTH_32, 0}}, /* Acpi 5.0 */ | ||
1060 | {{"_STB", WIDTH_2, 0}}, /* Acpi 5.0 */ | ||
1061 | {{"_TRA", WIDTH_ADDRESS, 0}}, | ||
1062 | {{"_TRS", WIDTH_1, 0}}, | ||
1063 | {{"_TSF", WIDTH_8, 0}}, /* Acpi 3.0 */ | ||
1064 | {{"_TTP", WIDTH_1, 0}}, | ||
1065 | {{"_TXL", WIDTH_16, 0}}, /* Acpi 5.0 */ | ||
1066 | {{"_TYP", WIDTH_2 | WIDTH_16, 0}}, | ||
1067 | {{"_VEN", VARIABLE_DATA, 0}}, /* Acpi 5.0 */ | ||
1068 | PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */ | ||
1069 | }; | ||
561 | 1070 | ||
562 | /* TBD: */ | 1071 | static const union acpi_predefined_info acpi_gbl_scope_names[] = { |
563 | _PRT - currently ignore reversed entries. attempt to fix here? | 1072 | {{"_GPE", 0, 0}}, |
564 | think about possibly fixing package elements like _BIF, etc. | 1073 | {{"_PR_", 0, 0}}, |
1074 | {{"_SB_", 0, 0}}, | ||
1075 | {{"_SI_", 0, 0}}, | ||
1076 | {{"_TZ_", 0, 0}}, | ||
1077 | PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */ | ||
1078 | }; | ||
1079 | #else | ||
1080 | extern const union acpi_predefined_info acpi_gbl_resource_names[]; | ||
565 | #endif | 1081 | #endif |
566 | 1082 | ||
567 | #endif | 1083 | #endif |
568 | #endif | ||
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 0082fa0a6139..202f4f12d3e2 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -113,9 +113,10 @@ struct acpi_pkg_info { | |||
113 | u32 num_packages; | 113 | u32 num_packages; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | /* Object reference counts */ | ||
117 | |||
116 | #define REF_INCREMENT (u16) 0 | 118 | #define REF_INCREMENT (u16) 0 |
117 | #define REF_DECREMENT (u16) 1 | 119 | #define REF_DECREMENT (u16) 1 |
118 | #define REF_FORCE_DELETE (u16) 2 | ||
119 | 120 | ||
120 | /* acpi_ut_dump_buffer */ | 121 | /* acpi_ut_dump_buffer */ |
121 | 122 | ||
@@ -421,7 +422,7 @@ acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); | |||
421 | */ | 422 | */ |
422 | acpi_status acpi_ut_initialize_interfaces(void); | 423 | acpi_status acpi_ut_initialize_interfaces(void); |
423 | 424 | ||
424 | void acpi_ut_interface_terminate(void); | 425 | acpi_status acpi_ut_interface_terminate(void); |
425 | 426 | ||
426 | acpi_status acpi_ut_install_interface(acpi_string interface_name); | 427 | acpi_status acpi_ut_install_interface(acpi_string interface_name); |
427 | 428 | ||
@@ -432,6 +433,26 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name); | |||
432 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); | 433 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); |
433 | 434 | ||
434 | /* | 435 | /* |
436 | * utpredef - support for predefined names | ||
437 | */ | ||
438 | const union acpi_predefined_info *acpi_ut_get_next_predefined_method(const union | ||
439 | acpi_predefined_info | ||
440 | *this_name); | ||
441 | |||
442 | const union acpi_predefined_info *acpi_ut_match_predefined_method(char *name); | ||
443 | |||
444 | const union acpi_predefined_info *acpi_ut_match_resource_name(char *name); | ||
445 | |||
446 | void | ||
447 | acpi_ut_display_predefined_method(char *buffer, | ||
448 | const union acpi_predefined_info *this_name, | ||
449 | u8 multi_line); | ||
450 | |||
451 | void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes); | ||
452 | |||
453 | u32 acpi_ut_get_resource_bit_width(char *buffer, u16 types); | ||
454 | |||
455 | /* | ||
435 | * utstate - Generic state creation/cache routines | 456 | * utstate - Generic state creation/cache routines |
436 | */ | 457 | */ |
437 | void | 458 | void |
@@ -483,7 +504,8 @@ acpi_ut_short_divide(u64 in_dividend, | |||
483 | /* | 504 | /* |
484 | * utmisc | 505 | * utmisc |
485 | */ | 506 | */ |
486 | const char *acpi_ut_validate_exception(acpi_status status); | 507 | const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status |
508 | status); | ||
487 | 509 | ||
488 | u8 acpi_ut_is_pci_root_bridge(char *id); | 510 | u8 acpi_ut_is_pci_root_bridge(char *id); |
489 | 511 | ||
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index 4d8c992a51d8..99778997c35a 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -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_VALUE(TRUE); | 181 | return_UINT8(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_VALUE(FALSE); | 213 | return_UINT8(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_VALUE(FALSE); | 222 | return_UINT8(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_VALUE(TRUE); | 310 | return_UINT8(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_VALUE(FALSE); | 319 | return_UINT8(FALSE); |
320 | } | 320 | } |
321 | 321 | ||
322 | /******************************************************************************* | 322 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index 44f8325c2bae..e2199a947470 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -693,7 +693,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
693 | default: | 693 | default: |
694 | 694 | ||
695 | ACPI_ERROR((AE_INFO, | 695 | ACPI_ERROR((AE_INFO, |
696 | "Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p", | 696 | "Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p", |
697 | op_class, op_type, op->common.aml_opcode, | 697 | op_class, op_type, op->common.aml_opcode, |
698 | op)); | 698 | op)); |
699 | 699 | ||
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index b8ea0b26cde3..83cd45f4a870 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
@@ -257,6 +257,8 @@ u32 acpi_ev_fixed_event_detect(void) | |||
257 | * | 257 | * |
258 | * DESCRIPTION: Clears the status bit for the requested event, calls the | 258 | * DESCRIPTION: Clears the status bit for the requested event, calls the |
259 | * handler that previously registered for the event. | 259 | * handler that previously registered for the event. |
260 | * NOTE: If there is no handler for the event, the event is | ||
261 | * disabled to prevent further interrupts. | ||
260 | * | 262 | * |
261 | ******************************************************************************/ | 263 | ******************************************************************************/ |
262 | 264 | ||
@@ -271,17 +273,17 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event) | |||
271 | status_register_id, ACPI_CLEAR_STATUS); | 273 | status_register_id, ACPI_CLEAR_STATUS); |
272 | 274 | ||
273 | /* | 275 | /* |
274 | * Make sure we've got a handler. If not, report an error. The event is | 276 | * Make sure that a handler exists. If not, report an error |
275 | * disabled to prevent further interrupts. | 277 | * and disable the event to prevent further interrupts. |
276 | */ | 278 | */ |
277 | if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { | 279 | if (!acpi_gbl_fixed_event_handlers[event].handler) { |
278 | (void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event]. | 280 | (void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event]. |
279 | enable_register_id, | 281 | enable_register_id, |
280 | ACPI_DISABLE_EVENT); | 282 | ACPI_DISABLE_EVENT); |
281 | 283 | ||
282 | ACPI_ERROR((AE_INFO, | 284 | ACPI_ERROR((AE_INFO, |
283 | "No installed handler for fixed event [0x%08X]", | 285 | "No installed handler for fixed event - %s (%u), disabling", |
284 | event)); | 286 | acpi_ut_get_event_name(event), event)); |
285 | 287 | ||
286 | return (ACPI_INTERRUPT_NOT_HANDLED); | 288 | return (ACPI_INTERRUPT_NOT_HANDLED); |
287 | } | 289 | } |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index b9adb9a7ed85..a493b528f8f9 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -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_VALUE(ACPI_INTERRUPT_NOT_HANDLED); | 710 | return_UINT32(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_VALUE(ACPI_INTERRUPT_NOT_HANDLED); | 727 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
728 | } | 728 | } |
729 | 729 | ||
730 | /* | 730 | /* |
@@ -784,7 +784,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
784 | break; | 784 | break; |
785 | } | 785 | } |
786 | 786 | ||
787 | return_VALUE(ACPI_INTERRUPT_HANDLED); | 787 | return_UINT32(ACPI_INTERRUPT_HANDLED); |
788 | } | 788 | } |
789 | 789 | ||
790 | #endif /* !ACPI_REDUCED_HARDWARE */ | 790 | #endif /* !ACPI_REDUCED_HARDWARE */ |
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c index f4b43bede015..b905acf7aacd 100644 --- a/drivers/acpi/acpica/evsci.c +++ b/drivers/acpi/acpica/evsci.c | |||
@@ -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_VALUE(interrupt_handled); | 92 | return_UINT32(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_VALUE(interrupt_handled); | 123 | return_UINT32(interrupt_handled); |
124 | } | 124 | } |
125 | 125 | ||
126 | /****************************************************************************** | 126 | /****************************************************************************** |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index ddffd6847914..ca5fba99c33b 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -467,9 +467,9 @@ acpi_install_fixed_event_handler(u32 event, | |||
467 | return_ACPI_STATUS(status); | 467 | return_ACPI_STATUS(status); |
468 | } | 468 | } |
469 | 469 | ||
470 | /* Don't allow two handlers. */ | 470 | /* Do not allow multiple handlers */ |
471 | 471 | ||
472 | if (NULL != acpi_gbl_fixed_event_handlers[event].handler) { | 472 | if (acpi_gbl_fixed_event_handlers[event].handler) { |
473 | status = AE_ALREADY_EXISTS; | 473 | status = AE_ALREADY_EXISTS; |
474 | goto cleanup; | 474 | goto cleanup; |
475 | } | 475 | } |
@@ -483,8 +483,9 @@ acpi_install_fixed_event_handler(u32 event, | |||
483 | if (ACPI_SUCCESS(status)) | 483 | if (ACPI_SUCCESS(status)) |
484 | status = acpi_enable_event(event, 0); | 484 | status = acpi_enable_event(event, 0); |
485 | if (ACPI_FAILURE(status)) { | 485 | if (ACPI_FAILURE(status)) { |
486 | ACPI_WARNING((AE_INFO, "Could not enable fixed event 0x%X", | 486 | ACPI_WARNING((AE_INFO, |
487 | event)); | 487 | "Could not enable fixed event - %s (%u)", |
488 | acpi_ut_get_event_name(event), event)); | ||
488 | 489 | ||
489 | /* Remove the handler */ | 490 | /* Remove the handler */ |
490 | 491 | ||
@@ -492,7 +493,8 @@ acpi_install_fixed_event_handler(u32 event, | |||
492 | acpi_gbl_fixed_event_handlers[event].context = NULL; | 493 | acpi_gbl_fixed_event_handlers[event].context = NULL; |
493 | } else { | 494 | } else { |
494 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 495 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
495 | "Enabled fixed event %X, Handler=%p\n", event, | 496 | "Enabled fixed event %s (%X), Handler=%p\n", |
497 | acpi_ut_get_event_name(event), event, | ||
496 | handler)); | 498 | handler)); |
497 | } | 499 | } |
498 | 500 | ||
@@ -544,11 +546,12 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) | |||
544 | 546 | ||
545 | if (ACPI_FAILURE(status)) { | 547 | if (ACPI_FAILURE(status)) { |
546 | ACPI_WARNING((AE_INFO, | 548 | ACPI_WARNING((AE_INFO, |
547 | "Could not write to fixed event enable register 0x%X", | 549 | "Could not disable fixed event - %s (%u)", |
548 | event)); | 550 | acpi_ut_get_event_name(event), event)); |
549 | } else { | 551 | } else { |
550 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X\n", | 552 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
551 | event)); | 553 | "Disabled fixed event - %s (%X)\n", |
554 | acpi_ut_get_event_name(event), event)); | ||
552 | } | 555 | } |
553 | 556 | ||
554 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 557 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index d6e4e42316db..7039606a0ba8 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -74,6 +74,12 @@ acpi_status acpi_enable(void) | |||
74 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | 74 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
75 | } | 75 | } |
76 | 76 | ||
77 | /* If the Hardware Reduced flag is set, machine is always in acpi mode */ | ||
78 | |||
79 | if (acpi_gbl_reduced_hardware) { | ||
80 | return_ACPI_STATUS(AE_OK); | ||
81 | } | ||
82 | |||
77 | /* Check current mode */ | 83 | /* Check current mode */ |
78 | 84 | ||
79 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { | 85 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) { |
@@ -126,6 +132,12 @@ acpi_status acpi_disable(void) | |||
126 | 132 | ||
127 | ACPI_FUNCTION_TRACE(acpi_disable); | 133 | ACPI_FUNCTION_TRACE(acpi_disable); |
128 | 134 | ||
135 | /* If the Hardware Reduced flag is set, machine is always in acpi mode */ | ||
136 | |||
137 | if (acpi_gbl_reduced_hardware) { | ||
138 | return_ACPI_STATUS(AE_OK); | ||
139 | } | ||
140 | |||
129 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { | 141 | if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { |
130 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 142 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
131 | "System is already in legacy (non-ACPI) mode\n")); | 143 | "System is already in legacy (non-ACPI) mode\n")); |
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index e491e46f17df..b0838a4ea53e 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c | |||
@@ -257,7 +257,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
257 | union acpi_operand_object *return_desc = NULL; | 257 | union acpi_operand_object *return_desc = NULL; |
258 | u64 index; | 258 | u64 index; |
259 | acpi_status status = AE_OK; | 259 | acpi_status status = AE_OK; |
260 | acpi_size length; | 260 | acpi_size length = 0; |
261 | 261 | ||
262 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R, | 262 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R, |
263 | acpi_ps_get_opcode_name(walk_state->opcode)); | 263 | acpi_ps_get_opcode_name(walk_state->opcode)); |
@@ -320,7 +320,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
320 | * NOTE: A length of zero is ok, and will create a zero-length, null | 320 | * NOTE: A length of zero is ok, and will create a zero-length, null |
321 | * terminated string. | 321 | * terminated string. |
322 | */ | 322 | */ |
323 | length = 0; | ||
324 | while ((length < operand[0]->buffer.length) && | 323 | while ((length < operand[0]->buffer.length) && |
325 | (length < operand[1]->integer.value) && | 324 | (length < operand[1]->integer.value) && |
326 | (operand[0]->buffer.pointer[length])) { | 325 | (operand[0]->buffer.pointer[length])) { |
@@ -376,6 +375,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
376 | case ACPI_TYPE_STRING: | 375 | case ACPI_TYPE_STRING: |
377 | 376 | ||
378 | if (index >= operand[0]->string.length) { | 377 | if (index >= operand[0]->string.length) { |
378 | length = operand[0]->string.length; | ||
379 | status = AE_AML_STRING_LIMIT; | 379 | status = AE_AML_STRING_LIMIT; |
380 | } | 380 | } |
381 | 381 | ||
@@ -386,6 +386,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
386 | case ACPI_TYPE_BUFFER: | 386 | case ACPI_TYPE_BUFFER: |
387 | 387 | ||
388 | if (index >= operand[0]->buffer.length) { | 388 | if (index >= operand[0]->buffer.length) { |
389 | length = operand[0]->buffer.length; | ||
389 | status = AE_AML_BUFFER_LIMIT; | 390 | status = AE_AML_BUFFER_LIMIT; |
390 | } | 391 | } |
391 | 392 | ||
@@ -396,6 +397,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
396 | case ACPI_TYPE_PACKAGE: | 397 | case ACPI_TYPE_PACKAGE: |
397 | 398 | ||
398 | if (index >= operand[0]->package.count) { | 399 | if (index >= operand[0]->package.count) { |
400 | length = operand[0]->package.count; | ||
399 | status = AE_AML_PACKAGE_LIMIT; | 401 | status = AE_AML_PACKAGE_LIMIT; |
400 | } | 402 | } |
401 | 403 | ||
@@ -414,8 +416,9 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
414 | 416 | ||
415 | if (ACPI_FAILURE(status)) { | 417 | if (ACPI_FAILURE(status)) { |
416 | ACPI_EXCEPTION((AE_INFO, status, | 418 | ACPI_EXCEPTION((AE_INFO, status, |
417 | "Index (0x%8.8X%8.8X) is beyond end of object", | 419 | "Index (0x%X%8.8X) is beyond end of object (length 0x%X)", |
418 | ACPI_FORMAT_UINT64(index))); | 420 | ACPI_FORMAT_UINT64(index), |
421 | (u32)length)); | ||
419 | goto cleanup; | 422 | goto cleanup; |
420 | } | 423 | } |
421 | 424 | ||
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index d6eab81f54fb..6b728aef2dca 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -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_VALUE(0); | 279 | return_UINT32(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_VALUE(bit_length); | 292 | return_UINT32(bit_length); |
293 | } | 293 | } |
294 | 294 | ||
295 | /******************************************************************************* | 295 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index b205cbb4b50c..99dc7b287d55 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -340,7 +340,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base) | |||
340 | /* u64 is unsigned, so we don't worry about a '-' prefix */ | 340 | /* u64 is unsigned, so we don't worry about a '-' prefix */ |
341 | 341 | ||
342 | if (value == 0) { | 342 | if (value == 0) { |
343 | return_VALUE(1); | 343 | return_UINT32(1); |
344 | } | 344 | } |
345 | 345 | ||
346 | current_value = value; | 346 | current_value = value; |
@@ -354,7 +354,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base) | |||
354 | num_digits++; | 354 | num_digits++; |
355 | } | 355 | } |
356 | 356 | ||
357 | return_VALUE(num_digits); | 357 | return_UINT32(num_digits); |
358 | } | 358 | } |
359 | 359 | ||
360 | /******************************************************************************* | 360 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c index deb3f61e2bd1..579c3a53ac87 100644 --- a/drivers/acpi/acpica/hwacpi.c +++ b/drivers/acpi/acpica/hwacpi.c | |||
@@ -66,6 +66,12 @@ acpi_status acpi_hw_set_mode(u32 mode) | |||
66 | 66 | ||
67 | ACPI_FUNCTION_TRACE(hw_set_mode); | 67 | ACPI_FUNCTION_TRACE(hw_set_mode); |
68 | 68 | ||
69 | /* If the Hardware Reduced flag is set, machine is always in acpi mode */ | ||
70 | |||
71 | if (acpi_gbl_reduced_hardware) { | ||
72 | return_ACPI_STATUS(AE_OK); | ||
73 | } | ||
74 | |||
69 | /* | 75 | /* |
70 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 76 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
71 | * system does not support mode transition. | 77 | * system does not support mode transition. |
@@ -146,23 +152,29 @@ u32 acpi_hw_get_mode(void) | |||
146 | 152 | ||
147 | ACPI_FUNCTION_TRACE(hw_get_mode); | 153 | ACPI_FUNCTION_TRACE(hw_get_mode); |
148 | 154 | ||
155 | /* If the Hardware Reduced flag is set, machine is always in acpi mode */ | ||
156 | |||
157 | if (acpi_gbl_reduced_hardware) { | ||
158 | return_UINT32(ACPI_SYS_MODE_ACPI); | ||
159 | } | ||
160 | |||
149 | /* | 161 | /* |
150 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 162 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
151 | * system does not support mode transition. | 163 | * system does not support mode transition. |
152 | */ | 164 | */ |
153 | if (!acpi_gbl_FADT.smi_command) { | 165 | if (!acpi_gbl_FADT.smi_command) { |
154 | return_VALUE(ACPI_SYS_MODE_ACPI); | 166 | return_UINT32(ACPI_SYS_MODE_ACPI); |
155 | } | 167 | } |
156 | 168 | ||
157 | status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); | 169 | status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); |
158 | if (ACPI_FAILURE(status)) { | 170 | if (ACPI_FAILURE(status)) { |
159 | return_VALUE(ACPI_SYS_MODE_LEGACY); | 171 | return_UINT32(ACPI_SYS_MODE_LEGACY); |
160 | } | 172 | } |
161 | 173 | ||
162 | if (value) { | 174 | if (value) { |
163 | return_VALUE(ACPI_SYS_MODE_ACPI); | 175 | return_UINT32(ACPI_SYS_MODE_ACPI); |
164 | } else { | 176 | } else { |
165 | return_VALUE(ACPI_SYS_MODE_LEGACY); | 177 | return_UINT32(ACPI_SYS_MODE_LEGACY); |
166 | } | 178 | } |
167 | } | 179 | } |
168 | 180 | ||
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c new file mode 100644 index 000000000000..8f79a9d2d50e --- /dev/null +++ b/drivers/acpi/acpica/nsconvert.c | |||
@@ -0,0 +1,443 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: nsconvert - Object conversions for objects returned by | ||
4 | * predefined methods | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2013, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #include <acpi/acpi.h> | ||
46 | #include "accommon.h" | ||
47 | #include "acnamesp.h" | ||
48 | #include "acinterp.h" | ||
49 | #include "acpredef.h" | ||
50 | #include "amlresrc.h" | ||
51 | |||
52 | #define _COMPONENT ACPI_NAMESPACE | ||
53 | ACPI_MODULE_NAME("nsconvert") | ||
54 | |||
55 | /******************************************************************************* | ||
56 | * | ||
57 | * FUNCTION: acpi_ns_convert_to_integer | ||
58 | * | ||
59 | * PARAMETERS: original_object - Object to be converted | ||
60 | * return_object - Where the new converted object is returned | ||
61 | * | ||
62 | * RETURN: Status. AE_OK if conversion was successful. | ||
63 | * | ||
64 | * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer. | ||
65 | * | ||
66 | ******************************************************************************/ | ||
67 | acpi_status | ||
68 | acpi_ns_convert_to_integer(union acpi_operand_object *original_object, | ||
69 | union acpi_operand_object **return_object) | ||
70 | { | ||
71 | union acpi_operand_object *new_object; | ||
72 | acpi_status status; | ||
73 | u64 value = 0; | ||
74 | u32 i; | ||
75 | |||
76 | switch (original_object->common.type) { | ||
77 | case ACPI_TYPE_STRING: | ||
78 | |||
79 | /* String-to-Integer conversion */ | ||
80 | |||
81 | status = acpi_ut_strtoul64(original_object->string.pointer, | ||
82 | ACPI_ANY_BASE, &value); | ||
83 | if (ACPI_FAILURE(status)) { | ||
84 | return (status); | ||
85 | } | ||
86 | break; | ||
87 | |||
88 | case ACPI_TYPE_BUFFER: | ||
89 | |||
90 | /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */ | ||
91 | |||
92 | if (original_object->buffer.length > 8) { | ||
93 | return (AE_AML_OPERAND_TYPE); | ||
94 | } | ||
95 | |||
96 | /* Extract each buffer byte to create the integer */ | ||
97 | |||
98 | for (i = 0; i < original_object->buffer.length; i++) { | ||
99 | value |= | ||
100 | ((u64)original_object->buffer. | ||
101 | pointer[i] << (i * 8)); | ||
102 | } | ||
103 | break; | ||
104 | |||
105 | default: | ||
106 | return (AE_AML_OPERAND_TYPE); | ||
107 | } | ||
108 | |||
109 | new_object = acpi_ut_create_integer_object(value); | ||
110 | if (!new_object) { | ||
111 | return (AE_NO_MEMORY); | ||
112 | } | ||
113 | |||
114 | *return_object = new_object; | ||
115 | return (AE_OK); | ||
116 | } | ||
117 | |||
118 | /******************************************************************************* | ||
119 | * | ||
120 | * FUNCTION: acpi_ns_convert_to_string | ||
121 | * | ||
122 | * PARAMETERS: original_object - Object to be converted | ||
123 | * return_object - Where the new converted object is returned | ||
124 | * | ||
125 | * RETURN: Status. AE_OK if conversion was successful. | ||
126 | * | ||
127 | * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String. | ||
128 | * | ||
129 | ******************************************************************************/ | ||
130 | |||
131 | acpi_status | ||
132 | acpi_ns_convert_to_string(union acpi_operand_object *original_object, | ||
133 | union acpi_operand_object **return_object) | ||
134 | { | ||
135 | union acpi_operand_object *new_object; | ||
136 | acpi_size length; | ||
137 | acpi_status status; | ||
138 | |||
139 | switch (original_object->common.type) { | ||
140 | case ACPI_TYPE_INTEGER: | ||
141 | /* | ||
142 | * Integer-to-String conversion. Commonly, convert | ||
143 | * an integer of value 0 to a NULL string. The last element of | ||
144 | * _BIF and _BIX packages occasionally need this fix. | ||
145 | */ | ||
146 | if (original_object->integer.value == 0) { | ||
147 | |||
148 | /* Allocate a new NULL string object */ | ||
149 | |||
150 | new_object = acpi_ut_create_string_object(0); | ||
151 | if (!new_object) { | ||
152 | return (AE_NO_MEMORY); | ||
153 | } | ||
154 | } else { | ||
155 | status = | ||
156 | acpi_ex_convert_to_string(original_object, | ||
157 | &new_object, | ||
158 | ACPI_IMPLICIT_CONVERT_HEX); | ||
159 | if (ACPI_FAILURE(status)) { | ||
160 | return (status); | ||
161 | } | ||
162 | } | ||
163 | break; | ||
164 | |||
165 | case ACPI_TYPE_BUFFER: | ||
166 | /* | ||
167 | * Buffer-to-String conversion. Use a to_string | ||
168 | * conversion, no transform performed on the buffer data. The best | ||
169 | * example of this is the _BIF method, where the string data from | ||
170 | * the battery is often (incorrectly) returned as buffer object(s). | ||
171 | */ | ||
172 | length = 0; | ||
173 | while ((length < original_object->buffer.length) && | ||
174 | (original_object->buffer.pointer[length])) { | ||
175 | length++; | ||
176 | } | ||
177 | |||
178 | /* Allocate a new string object */ | ||
179 | |||
180 | new_object = acpi_ut_create_string_object(length); | ||
181 | if (!new_object) { | ||
182 | return (AE_NO_MEMORY); | ||
183 | } | ||
184 | |||
185 | /* | ||
186 | * Copy the raw buffer data with no transform. String is already NULL | ||
187 | * terminated at Length+1. | ||
188 | */ | ||
189 | ACPI_MEMCPY(new_object->string.pointer, | ||
190 | original_object->buffer.pointer, length); | ||
191 | break; | ||
192 | |||
193 | default: | ||
194 | return (AE_AML_OPERAND_TYPE); | ||
195 | } | ||
196 | |||
197 | *return_object = new_object; | ||
198 | return (AE_OK); | ||
199 | } | ||
200 | |||
201 | /******************************************************************************* | ||
202 | * | ||
203 | * FUNCTION: acpi_ns_convert_to_buffer | ||
204 | * | ||
205 | * PARAMETERS: original_object - Object to be converted | ||
206 | * return_object - Where the new converted object is returned | ||
207 | * | ||
208 | * RETURN: Status. AE_OK if conversion was successful. | ||
209 | * | ||
210 | * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer. | ||
211 | * | ||
212 | ******************************************************************************/ | ||
213 | |||
214 | acpi_status | ||
215 | acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | ||
216 | union acpi_operand_object **return_object) | ||
217 | { | ||
218 | union acpi_operand_object *new_object; | ||
219 | acpi_status status; | ||
220 | union acpi_operand_object **elements; | ||
221 | u32 *dword_buffer; | ||
222 | u32 count; | ||
223 | u32 i; | ||
224 | |||
225 | switch (original_object->common.type) { | ||
226 | case ACPI_TYPE_INTEGER: | ||
227 | /* | ||
228 | * Integer-to-Buffer conversion. | ||
229 | * Convert the Integer to a packed-byte buffer. _MAT and other | ||
230 | * objects need this sometimes, if a read has been performed on a | ||
231 | * Field object that is less than or equal to the global integer | ||
232 | * size (32 or 64 bits). | ||
233 | */ | ||
234 | status = | ||
235 | acpi_ex_convert_to_buffer(original_object, &new_object); | ||
236 | if (ACPI_FAILURE(status)) { | ||
237 | return (status); | ||
238 | } | ||
239 | break; | ||
240 | |||
241 | case ACPI_TYPE_STRING: | ||
242 | |||
243 | /* String-to-Buffer conversion. Simple data copy */ | ||
244 | |||
245 | new_object = | ||
246 | acpi_ut_create_buffer_object(original_object->string. | ||
247 | length); | ||
248 | if (!new_object) { | ||
249 | return (AE_NO_MEMORY); | ||
250 | } | ||
251 | |||
252 | ACPI_MEMCPY(new_object->buffer.pointer, | ||
253 | original_object->string.pointer, | ||
254 | original_object->string.length); | ||
255 | break; | ||
256 | |||
257 | case ACPI_TYPE_PACKAGE: | ||
258 | /* | ||
259 | * This case is often seen for predefined names that must return a | ||
260 | * Buffer object with multiple DWORD integers within. For example, | ||
261 | * _FDE and _GTM. The Package can be converted to a Buffer. | ||
262 | */ | ||
263 | |||
264 | /* All elements of the Package must be integers */ | ||
265 | |||
266 | elements = original_object->package.elements; | ||
267 | count = original_object->package.count; | ||
268 | |||
269 | for (i = 0; i < count; i++) { | ||
270 | if ((!*elements) || | ||
271 | ((*elements)->common.type != ACPI_TYPE_INTEGER)) { | ||
272 | return (AE_AML_OPERAND_TYPE); | ||
273 | } | ||
274 | elements++; | ||
275 | } | ||
276 | |||
277 | /* Create the new buffer object to replace the Package */ | ||
278 | |||
279 | new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count)); | ||
280 | if (!new_object) { | ||
281 | return (AE_NO_MEMORY); | ||
282 | } | ||
283 | |||
284 | /* Copy the package elements (integers) to the buffer as DWORDs */ | ||
285 | |||
286 | elements = original_object->package.elements; | ||
287 | dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer); | ||
288 | |||
289 | for (i = 0; i < count; i++) { | ||
290 | *dword_buffer = (u32)(*elements)->integer.value; | ||
291 | dword_buffer++; | ||
292 | elements++; | ||
293 | } | ||
294 | break; | ||
295 | |||
296 | default: | ||
297 | return (AE_AML_OPERAND_TYPE); | ||
298 | } | ||
299 | |||
300 | *return_object = new_object; | ||
301 | return (AE_OK); | ||
302 | } | ||
303 | |||
304 | /******************************************************************************* | ||
305 | * | ||
306 | * FUNCTION: acpi_ns_convert_to_unicode | ||
307 | * | ||
308 | * PARAMETERS: original_object - ASCII String Object to be converted | ||
309 | * return_object - Where the new converted object is returned | ||
310 | * | ||
311 | * RETURN: Status. AE_OK if conversion was successful. | ||
312 | * | ||
313 | * DESCRIPTION: Attempt to convert a String object to a Unicode string Buffer. | ||
314 | * | ||
315 | ******************************************************************************/ | ||
316 | |||
317 | acpi_status | ||
318 | acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, | ||
319 | union acpi_operand_object **return_object) | ||
320 | { | ||
321 | union acpi_operand_object *new_object; | ||
322 | char *ascii_string; | ||
323 | u16 *unicode_buffer; | ||
324 | u32 unicode_length; | ||
325 | u32 i; | ||
326 | |||
327 | if (!original_object) { | ||
328 | return (AE_OK); | ||
329 | } | ||
330 | |||
331 | /* If a Buffer was returned, it must be at least two bytes long */ | ||
332 | |||
333 | if (original_object->common.type == ACPI_TYPE_BUFFER) { | ||
334 | if (original_object->buffer.length < 2) { | ||
335 | return (AE_AML_OPERAND_VALUE); | ||
336 | } | ||
337 | |||
338 | *return_object = NULL; | ||
339 | return (AE_OK); | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * The original object is an ASCII string. Convert this string to | ||
344 | * a unicode buffer. | ||
345 | */ | ||
346 | ascii_string = original_object->string.pointer; | ||
347 | unicode_length = (original_object->string.length * 2) + 2; | ||
348 | |||
349 | /* Create a new buffer object for the Unicode data */ | ||
350 | |||
351 | new_object = acpi_ut_create_buffer_object(unicode_length); | ||
352 | if (!new_object) { | ||
353 | return (AE_NO_MEMORY); | ||
354 | } | ||
355 | |||
356 | unicode_buffer = ACPI_CAST_PTR(u16, new_object->buffer.pointer); | ||
357 | |||
358 | /* Convert ASCII to Unicode */ | ||
359 | |||
360 | for (i = 0; i < original_object->string.length; i++) { | ||
361 | unicode_buffer[i] = (u16)ascii_string[i]; | ||
362 | } | ||
363 | |||
364 | *return_object = new_object; | ||
365 | return (AE_OK); | ||
366 | } | ||
367 | |||
368 | /******************************************************************************* | ||
369 | * | ||
370 | * FUNCTION: acpi_ns_convert_to_resource | ||
371 | * | ||
372 | * PARAMETERS: original_object - Object to be converted | ||
373 | * return_object - Where the new converted object is returned | ||
374 | * | ||
375 | * RETURN: Status. AE_OK if conversion was successful | ||
376 | * | ||
377 | * DESCRIPTION: Attempt to convert a Integer object to a resource_template | ||
378 | * Buffer. | ||
379 | * | ||
380 | ******************************************************************************/ | ||
381 | |||
382 | acpi_status | ||
383 | acpi_ns_convert_to_resource(union acpi_operand_object *original_object, | ||
384 | union acpi_operand_object **return_object) | ||
385 | { | ||
386 | union acpi_operand_object *new_object; | ||
387 | u8 *buffer; | ||
388 | |||
389 | /* | ||
390 | * We can fix the following cases for an expected resource template: | ||
391 | * 1. No return value (interpreter slack mode is disabled) | ||
392 | * 2. A "Return (Zero)" statement | ||
393 | * 3. A "Return empty buffer" statement | ||
394 | * | ||
395 | * We will return a buffer containing a single end_tag | ||
396 | * resource descriptor. | ||
397 | */ | ||
398 | if (original_object) { | ||
399 | switch (original_object->common.type) { | ||
400 | case ACPI_TYPE_INTEGER: | ||
401 | |||
402 | /* We can only repair an Integer==0 */ | ||
403 | |||
404 | if (original_object->integer.value) { | ||
405 | return (AE_AML_OPERAND_TYPE); | ||
406 | } | ||
407 | break; | ||
408 | |||
409 | case ACPI_TYPE_BUFFER: | ||
410 | |||
411 | if (original_object->buffer.length) { | ||
412 | |||
413 | /* Additional checks can be added in the future */ | ||
414 | |||
415 | *return_object = NULL; | ||
416 | return (AE_OK); | ||
417 | } | ||
418 | break; | ||
419 | |||
420 | case ACPI_TYPE_STRING: | ||
421 | default: | ||
422 | |||
423 | return (AE_AML_OPERAND_TYPE); | ||
424 | } | ||
425 | } | ||
426 | |||
427 | /* Create the new buffer object for the resource descriptor */ | ||
428 | |||
429 | new_object = acpi_ut_create_buffer_object(2); | ||
430 | if (!new_object) { | ||
431 | return (AE_NO_MEMORY); | ||
432 | } | ||
433 | |||
434 | buffer = ACPI_CAST_PTR(u8, new_object->buffer.pointer); | ||
435 | |||
436 | /* Initialize the Buffer with a single end_tag descriptor */ | ||
437 | |||
438 | buffer[0] = (ACPI_RESOURCE_NAME_END_TAG | ASL_RDESC_END_TAG_SIZE); | ||
439 | buffer[1] = 0x00; | ||
440 | |||
441 | *return_object = new_object; | ||
442 | return (AE_OK); | ||
443 | } | ||
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index 1538f3eb2a8f..b61db69d5675 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c | |||
@@ -98,17 +98,21 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
98 | info->return_object = NULL; | 98 | info->return_object = NULL; |
99 | info->param_count = 0; | 99 | info->param_count = 0; |
100 | 100 | ||
101 | /* | 101 | if (!info->resolved_node) { |
102 | * Get the actual namespace node for the target object. Handles these cases: | 102 | /* |
103 | * | 103 | * Get the actual namespace node for the target object if we need to. |
104 | * 1) Null node, Pathname (absolute path) | 104 | * Handles these cases: |
105 | * 2) Node, Pathname (path relative to Node) | 105 | * |
106 | * 3) Node, Null Pathname | 106 | * 1) Null node, Pathname (absolute path) |
107 | */ | 107 | * 2) Node, Pathname (path relative to Node) |
108 | status = acpi_ns_get_node(info->prefix_node, info->pathname, | 108 | * 3) Node, Null Pathname |
109 | ACPI_NS_NO_UPSEARCH, &info->resolved_node); | 109 | */ |
110 | if (ACPI_FAILURE(status)) { | 110 | status = acpi_ns_get_node(info->prefix_node, info->pathname, |
111 | return_ACPI_STATUS(status); | 111 | ACPI_NS_NO_UPSEARCH, |
112 | &info->resolved_node); | ||
113 | if (ACPI_FAILURE(status)) { | ||
114 | return_ACPI_STATUS(status); | ||
115 | } | ||
112 | } | 116 | } |
113 | 117 | ||
114 | /* | 118 | /* |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index 224c30053401..8a52916148cb 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -76,19 +76,7 @@ static acpi_status | |||
76 | acpi_ns_check_reference(struct acpi_predefined_data *data, | 76 | acpi_ns_check_reference(struct acpi_predefined_data *data, |
77 | union acpi_operand_object *return_object); | 77 | union acpi_operand_object *return_object); |
78 | 78 | ||
79 | static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes); | 79 | static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object); |
80 | |||
81 | /* | ||
82 | * Names for the types that can be returned by the predefined objects. | ||
83 | * Used for warning messages. Must be in the same order as the ACPI_RTYPEs | ||
84 | */ | ||
85 | static const char *acpi_rtype_names[] = { | ||
86 | "/Integer", | ||
87 | "/String", | ||
88 | "/Buffer", | ||
89 | "/Package", | ||
90 | "/Reference", | ||
91 | }; | ||
92 | 80 | ||
93 | /******************************************************************************* | 81 | /******************************************************************************* |
94 | * | 82 | * |
@@ -112,7 +100,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
112 | acpi_status return_status, | 100 | acpi_status return_status, |
113 | union acpi_operand_object **return_object_ptr) | 101 | union acpi_operand_object **return_object_ptr) |
114 | { | 102 | { |
115 | union acpi_operand_object *return_object = *return_object_ptr; | ||
116 | acpi_status status = AE_OK; | 103 | acpi_status status = AE_OK; |
117 | const union acpi_predefined_info *predefined; | 104 | const union acpi_predefined_info *predefined; |
118 | char *pathname; | 105 | char *pathname; |
@@ -120,7 +107,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
120 | 107 | ||
121 | /* Match the name for this method/object against the predefined list */ | 108 | /* Match the name for this method/object against the predefined list */ |
122 | 109 | ||
123 | predefined = acpi_ns_check_for_predefined_name(node); | 110 | predefined = acpi_ut_match_predefined_method(node->name.ascii); |
124 | 111 | ||
125 | /* Get the full pathname to the object, for use in warning messages */ | 112 | /* Get the full pathname to the object, for use in warning messages */ |
126 | 113 | ||
@@ -152,25 +139,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
152 | } | 139 | } |
153 | 140 | ||
154 | /* | 141 | /* |
155 | * If there is no return value, check if we require a return value for | ||
156 | * this predefined name. Either one return value is expected, or none, | ||
157 | * for both methods and other objects. | ||
158 | * | ||
159 | * Exit now if there is no return object. Warning if one was expected. | ||
160 | */ | ||
161 | if (!return_object) { | ||
162 | if ((predefined->info.expected_btypes) && | ||
163 | (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) { | ||
164 | ACPI_WARN_PREDEFINED((AE_INFO, pathname, | ||
165 | ACPI_WARN_ALWAYS, | ||
166 | "Missing expected return value")); | ||
167 | |||
168 | status = AE_AML_NO_RETURN_VALUE; | ||
169 | } | ||
170 | goto cleanup; | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | * Return value validation and possible repair. | 142 | * Return value validation and possible repair. |
175 | * | 143 | * |
176 | * 1) Don't perform return value validation/repair if this feature | 144 | * 1) Don't perform return value validation/repair if this feature |
@@ -310,8 +278,10 @@ acpi_ns_check_parameter_count(char *pathname, | |||
310 | * Validate the user-supplied parameter count. | 278 | * Validate the user-supplied parameter count. |
311 | * Allow two different legal argument counts (_SCP, etc.) | 279 | * Allow two different legal argument counts (_SCP, etc.) |
312 | */ | 280 | */ |
313 | required_params_current = predefined->info.param_count & 0x0F; | 281 | required_params_current = |
314 | required_params_old = predefined->info.param_count >> 4; | 282 | predefined->info.argument_list & METHOD_ARG_MASK; |
283 | required_params_old = | ||
284 | predefined->info.argument_list >> METHOD_ARG_BIT_WIDTH; | ||
315 | 285 | ||
316 | if (user_param_count != ACPI_UINT32_MAX) { | 286 | if (user_param_count != ACPI_UINT32_MAX) { |
317 | if ((user_param_count != required_params_current) && | 287 | if ((user_param_count != required_params_current) && |
@@ -340,52 +310,6 @@ acpi_ns_check_parameter_count(char *pathname, | |||
340 | 310 | ||
341 | /******************************************************************************* | 311 | /******************************************************************************* |
342 | * | 312 | * |
343 | * FUNCTION: acpi_ns_check_for_predefined_name | ||
344 | * | ||
345 | * PARAMETERS: node - Namespace node for the method/object | ||
346 | * | ||
347 | * RETURN: Pointer to entry in predefined table. NULL indicates not found. | ||
348 | * | ||
349 | * DESCRIPTION: Check an object name against the predefined object list. | ||
350 | * | ||
351 | ******************************************************************************/ | ||
352 | |||
353 | const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | ||
354 | acpi_namespace_node | ||
355 | *node) | ||
356 | { | ||
357 | const union acpi_predefined_info *this_name; | ||
358 | |||
359 | /* Quick check for a predefined name, first character must be underscore */ | ||
360 | |||
361 | if (node->name.ascii[0] != '_') { | ||
362 | return (NULL); | ||
363 | } | ||
364 | |||
365 | /* Search info table for a predefined method/object name */ | ||
366 | |||
367 | this_name = predefined_names; | ||
368 | while (this_name->info.name[0]) { | ||
369 | if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) { | ||
370 | return (this_name); | ||
371 | } | ||
372 | |||
373 | /* | ||
374 | * Skip next entry in the table if this name returns a Package | ||
375 | * (next entry contains the package info) | ||
376 | */ | ||
377 | if (this_name->info.expected_btypes & ACPI_RTYPE_PACKAGE) { | ||
378 | this_name++; | ||
379 | } | ||
380 | |||
381 | this_name++; | ||
382 | } | ||
383 | |||
384 | return (NULL); /* Not found */ | ||
385 | } | ||
386 | |||
387 | /******************************************************************************* | ||
388 | * | ||
389 | * FUNCTION: acpi_ns_check_object_type | 313 | * FUNCTION: acpi_ns_check_object_type |
390 | * | 314 | * |
391 | * PARAMETERS: data - Pointer to validation data structure | 315 | * PARAMETERS: data - Pointer to validation data structure |
@@ -410,28 +334,12 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
410 | { | 334 | { |
411 | union acpi_operand_object *return_object = *return_object_ptr; | 335 | union acpi_operand_object *return_object = *return_object_ptr; |
412 | acpi_status status = AE_OK; | 336 | acpi_status status = AE_OK; |
413 | u32 return_btype; | ||
414 | char type_buffer[48]; /* Room for 5 types */ | 337 | char type_buffer[48]; /* Room for 5 types */ |
415 | 338 | ||
416 | /* | ||
417 | * If we get a NULL return_object here, it is a NULL package element. | ||
418 | * Since all extraneous NULL package elements were removed earlier by a | ||
419 | * call to acpi_ns_remove_null_elements, this is an unexpected NULL element. | ||
420 | * We will attempt to repair it. | ||
421 | */ | ||
422 | if (!return_object) { | ||
423 | status = acpi_ns_repair_null_element(data, expected_btypes, | ||
424 | package_index, | ||
425 | return_object_ptr); | ||
426 | if (ACPI_SUCCESS(status)) { | ||
427 | return (AE_OK); /* Repair was successful */ | ||
428 | } | ||
429 | goto type_error_exit; | ||
430 | } | ||
431 | |||
432 | /* A Namespace node should not get here, but make sure */ | 339 | /* A Namespace node should not get here, but make sure */ |
433 | 340 | ||
434 | if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { | 341 | if (return_object && |
342 | ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { | ||
435 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | 343 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, |
436 | "Invalid return type - Found a Namespace node [%4.4s] type %s", | 344 | "Invalid return type - Found a Namespace node [%4.4s] type %s", |
437 | return_object->node.name.ascii, | 345 | return_object->node.name.ascii, |
@@ -448,59 +356,31 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
448 | * from all of the predefined names (including elements of returned | 356 | * from all of the predefined names (including elements of returned |
449 | * packages) | 357 | * packages) |
450 | */ | 358 | */ |
451 | switch (return_object->common.type) { | 359 | data->return_btype = acpi_ns_get_bitmapped_type(return_object); |
452 | case ACPI_TYPE_INTEGER: | 360 | if (data->return_btype == ACPI_RTYPE_ANY) { |
453 | return_btype = ACPI_RTYPE_INTEGER; | ||
454 | break; | ||
455 | |||
456 | case ACPI_TYPE_BUFFER: | ||
457 | return_btype = ACPI_RTYPE_BUFFER; | ||
458 | break; | ||
459 | |||
460 | case ACPI_TYPE_STRING: | ||
461 | return_btype = ACPI_RTYPE_STRING; | ||
462 | break; | ||
463 | 361 | ||
464 | case ACPI_TYPE_PACKAGE: | ||
465 | return_btype = ACPI_RTYPE_PACKAGE; | ||
466 | break; | ||
467 | |||
468 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
469 | return_btype = ACPI_RTYPE_REFERENCE; | ||
470 | break; | ||
471 | |||
472 | default: | ||
473 | /* Not one of the supported objects, must be incorrect */ | 362 | /* Not one of the supported objects, must be incorrect */ |
474 | |||
475 | goto type_error_exit; | 363 | goto type_error_exit; |
476 | } | 364 | } |
477 | 365 | ||
478 | /* Is the object one of the expected types? */ | 366 | /* For reference objects, check that the reference type is correct */ |
479 | |||
480 | if (return_btype & expected_btypes) { | ||
481 | |||
482 | /* For reference objects, check that the reference type is correct */ | ||
483 | |||
484 | if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { | ||
485 | status = acpi_ns_check_reference(data, return_object); | ||
486 | } | ||
487 | 367 | ||
368 | if ((data->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) { | ||
369 | status = acpi_ns_check_reference(data, return_object); | ||
488 | return (status); | 370 | return (status); |
489 | } | 371 | } |
490 | 372 | ||
491 | /* Type mismatch -- attempt repair of the returned object */ | 373 | /* Attempt simple repair of the returned object if necessary */ |
492 | 374 | ||
493 | status = acpi_ns_repair_object(data, expected_btypes, | 375 | status = acpi_ns_simple_repair(data, expected_btypes, |
494 | package_index, return_object_ptr); | 376 | package_index, return_object_ptr); |
495 | if (ACPI_SUCCESS(status)) { | 377 | return (status); |
496 | return (AE_OK); /* Repair was successful */ | ||
497 | } | ||
498 | 378 | ||
499 | type_error_exit: | 379 | type_error_exit: |
500 | 380 | ||
501 | /* Create a string with all expected types for this predefined object */ | 381 | /* Create a string with all expected types for this predefined object */ |
502 | 382 | ||
503 | acpi_ns_get_expected_types(type_buffer, expected_btypes); | 383 | acpi_ut_get_expected_return_types(type_buffer, expected_btypes); |
504 | 384 | ||
505 | if (package_index == ACPI_NOT_PACKAGE_ELEMENT) { | 385 | if (package_index == ACPI_NOT_PACKAGE_ELEMENT) { |
506 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | 386 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, |
@@ -558,36 +438,55 @@ acpi_ns_check_reference(struct acpi_predefined_data *data, | |||
558 | 438 | ||
559 | /******************************************************************************* | 439 | /******************************************************************************* |
560 | * | 440 | * |
561 | * FUNCTION: acpi_ns_get_expected_types | 441 | * FUNCTION: acpi_ns_get_bitmapped_type |
562 | * | 442 | * |
563 | * PARAMETERS: buffer - Pointer to where the string is returned | 443 | * PARAMETERS: return_object - Object returned from method/obj evaluation |
564 | * expected_btypes - Bitmap of expected return type(s) | ||
565 | * | 444 | * |
566 | * RETURN: Buffer is populated with type names. | 445 | * RETURN: Object return type. ACPI_RTYPE_ANY indicates that the object |
446 | * type is not supported. ACPI_RTYPE_NONE indicates that no | ||
447 | * object was returned (return_object is NULL). | ||
567 | * | 448 | * |
568 | * DESCRIPTION: Translate the expected types bitmap into a string of ascii | 449 | * DESCRIPTION: Convert object type into a bitmapped object return type. |
569 | * names of expected types, for use in warning messages. | ||
570 | * | 450 | * |
571 | ******************************************************************************/ | 451 | ******************************************************************************/ |
572 | 452 | ||
573 | static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes) | 453 | static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object) |
574 | { | 454 | { |
575 | u32 this_rtype; | 455 | u32 return_btype; |
576 | u32 i; | ||
577 | u32 j; | ||
578 | 456 | ||
579 | j = 1; | 457 | if (!return_object) { |
580 | buffer[0] = 0; | 458 | return (ACPI_RTYPE_NONE); |
581 | this_rtype = ACPI_RTYPE_INTEGER; | 459 | } |
582 | 460 | ||
583 | for (i = 0; i < ACPI_NUM_RTYPES; i++) { | 461 | /* Map acpi_object_type to internal bitmapped type */ |
584 | 462 | ||
585 | /* If one of the expected types, concatenate the name of this type */ | 463 | switch (return_object->common.type) { |
464 | case ACPI_TYPE_INTEGER: | ||
465 | return_btype = ACPI_RTYPE_INTEGER; | ||
466 | break; | ||
586 | 467 | ||
587 | if (expected_btypes & this_rtype) { | 468 | case ACPI_TYPE_BUFFER: |
588 | ACPI_STRCAT(buffer, &acpi_rtype_names[i][j]); | 469 | return_btype = ACPI_RTYPE_BUFFER; |
589 | j = 0; /* Use name separator from now on */ | 470 | break; |
590 | } | 471 | |
591 | this_rtype <<= 1; /* Next Rtype */ | 472 | case ACPI_TYPE_STRING: |
473 | return_btype = ACPI_RTYPE_STRING; | ||
474 | break; | ||
475 | |||
476 | case ACPI_TYPE_PACKAGE: | ||
477 | return_btype = ACPI_RTYPE_PACKAGE; | ||
478 | break; | ||
479 | |||
480 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
481 | return_btype = ACPI_RTYPE_REFERENCE; | ||
482 | break; | ||
483 | |||
484 | default: | ||
485 | /* Not one of the supported objects, must be incorrect */ | ||
486 | |||
487 | return_btype = ACPI_RTYPE_ANY; | ||
488 | break; | ||
592 | } | 489 | } |
490 | |||
491 | return (return_btype); | ||
593 | } | 492 | } |
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index a40155467d2e..77cdd539de16 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c | |||
@@ -112,9 +112,15 @@ acpi_ns_check_package(struct acpi_predefined_data *data, | |||
112 | elements = return_object->package.elements; | 112 | elements = return_object->package.elements; |
113 | count = return_object->package.count; | 113 | count = return_object->package.count; |
114 | 114 | ||
115 | /* The package must have at least one element, else invalid */ | 115 | /* |
116 | 116 | * Most packages must have at least one element. The only exception | |
117 | * is the variable-length package (ACPI_PTYPE1_VAR). | ||
118 | */ | ||
117 | if (!count) { | 119 | if (!count) { |
120 | if (package->ret_info.type == ACPI_PTYPE1_VAR) { | ||
121 | return (AE_OK); | ||
122 | } | ||
123 | |||
118 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | 124 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, |
119 | "Return Package has no elements (empty)")); | 125 | "Return Package has no elements (empty)")); |
120 | 126 | ||
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index 9e833353c06a..18f02e4ece01 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
47 | #include "acinterp.h" | 47 | #include "acinterp.h" |
48 | #include "acpredef.h" | 48 | #include "acpredef.h" |
49 | #include "amlresrc.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nsrepair") | 52 | ACPI_MODULE_NAME("nsrepair") |
@@ -71,6 +72,11 @@ ACPI_MODULE_NAME("nsrepair") | |||
71 | * Buffer -> String | 72 | * Buffer -> String |
72 | * Buffer -> Package of Integers | 73 | * Buffer -> Package of Integers |
73 | * Package -> Package of one Package | 74 | * Package -> Package of one Package |
75 | * | ||
76 | * Additional conversions that are available: | ||
77 | * Convert a null return or zero return value to an end_tag descriptor | ||
78 | * Convert an ASCII string to a Unicode buffer | ||
79 | * | ||
74 | * An incorrect standalone object is wrapped with required outer package | 80 | * An incorrect standalone object is wrapped with required outer package |
75 | * | 81 | * |
76 | * Additional possible repairs: | 82 | * Additional possible repairs: |
@@ -78,21 +84,51 @@ ACPI_MODULE_NAME("nsrepair") | |||
78 | * | 84 | * |
79 | ******************************************************************************/ | 85 | ******************************************************************************/ |
80 | /* Local prototypes */ | 86 | /* Local prototypes */ |
81 | static acpi_status | 87 | static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct |
82 | acpi_ns_convert_to_integer(union acpi_operand_object *original_object, | 88 | acpi_namespace_node |
83 | union acpi_operand_object **return_object); | 89 | *node, |
84 | 90 | u32 | |
85 | static acpi_status | 91 | return_btype, |
86 | acpi_ns_convert_to_string(union acpi_operand_object *original_object, | 92 | u32 |
87 | union acpi_operand_object **return_object); | 93 | package_index); |
88 | 94 | ||
89 | static acpi_status | 95 | /* |
90 | acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | 96 | * Special but simple repairs for some names. |
91 | union acpi_operand_object **return_object); | 97 | * |
98 | * 2nd argument: Unexpected types that can be repaired | ||
99 | */ | ||
100 | static const struct acpi_simple_repair_info acpi_object_repair_info[] = { | ||
101 | /* Resource descriptor conversions */ | ||
102 | |||
103 | {"_CRS", | ||
104 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | | ||
105 | ACPI_RTYPE_NONE, | ||
106 | ACPI_NOT_PACKAGE_ELEMENT, | ||
107 | acpi_ns_convert_to_resource}, | ||
108 | {"_DMA", | ||
109 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | | ||
110 | ACPI_RTYPE_NONE, | ||
111 | ACPI_NOT_PACKAGE_ELEMENT, | ||
112 | acpi_ns_convert_to_resource}, | ||
113 | {"_PRS", | ||
114 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | | ||
115 | ACPI_RTYPE_NONE, | ||
116 | ACPI_NOT_PACKAGE_ELEMENT, | ||
117 | acpi_ns_convert_to_resource}, | ||
118 | |||
119 | /* Unicode conversions */ | ||
120 | |||
121 | {"_MLS", ACPI_RTYPE_STRING, 1, | ||
122 | acpi_ns_convert_to_unicode}, | ||
123 | {"_STR", ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, | ||
124 | ACPI_NOT_PACKAGE_ELEMENT, | ||
125 | acpi_ns_convert_to_unicode}, | ||
126 | {{0, 0, 0, 0}, 0, 0, NULL} /* Table terminator */ | ||
127 | }; | ||
92 | 128 | ||
93 | /******************************************************************************* | 129 | /******************************************************************************* |
94 | * | 130 | * |
95 | * FUNCTION: acpi_ns_repair_object | 131 | * FUNCTION: acpi_ns_simple_repair |
96 | * | 132 | * |
97 | * PARAMETERS: data - Pointer to validation data structure | 133 | * PARAMETERS: data - Pointer to validation data structure |
98 | * expected_btypes - Object types expected | 134 | * expected_btypes - Object types expected |
@@ -110,16 +146,54 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | |||
110 | ******************************************************************************/ | 146 | ******************************************************************************/ |
111 | 147 | ||
112 | acpi_status | 148 | acpi_status |
113 | acpi_ns_repair_object(struct acpi_predefined_data *data, | 149 | acpi_ns_simple_repair(struct acpi_predefined_data *data, |
114 | u32 expected_btypes, | 150 | u32 expected_btypes, |
115 | u32 package_index, | 151 | u32 package_index, |
116 | union acpi_operand_object **return_object_ptr) | 152 | union acpi_operand_object **return_object_ptr) |
117 | { | 153 | { |
118 | union acpi_operand_object *return_object = *return_object_ptr; | 154 | union acpi_operand_object *return_object = *return_object_ptr; |
119 | union acpi_operand_object *new_object; | 155 | union acpi_operand_object *new_object = NULL; |
120 | acpi_status status; | 156 | acpi_status status; |
157 | const struct acpi_simple_repair_info *predefined; | ||
158 | |||
159 | ACPI_FUNCTION_NAME(ns_simple_repair); | ||
160 | |||
161 | /* | ||
162 | * Special repairs for certain names that are in the repair table. | ||
163 | * Check if this name is in the list of repairable names. | ||
164 | */ | ||
165 | predefined = acpi_ns_match_simple_repair(data->node, | ||
166 | data->return_btype, | ||
167 | package_index); | ||
168 | if (predefined) { | ||
169 | if (!return_object) { | ||
170 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, | ||
171 | ACPI_WARN_ALWAYS, | ||
172 | "Missing expected return value")); | ||
173 | } | ||
174 | |||
175 | status = | ||
176 | predefined->object_converter(return_object, &new_object); | ||
177 | if (ACPI_FAILURE(status)) { | ||
178 | |||
179 | /* A fatal error occurred during a conversion */ | ||
180 | |||
181 | ACPI_EXCEPTION((AE_INFO, status, | ||
182 | "During return object analysis")); | ||
183 | return (status); | ||
184 | } | ||
185 | if (new_object) { | ||
186 | goto object_repaired; | ||
187 | } | ||
188 | } | ||
121 | 189 | ||
122 | ACPI_FUNCTION_NAME(ns_repair_object); | 190 | /* |
191 | * Do not perform simple object repair unless the return type is not | ||
192 | * expected. | ||
193 | */ | ||
194 | if (data->return_btype & expected_btypes) { | ||
195 | return (AE_OK); | ||
196 | } | ||
123 | 197 | ||
124 | /* | 198 | /* |
125 | * At this point, we know that the type of the returned object was not | 199 | * At this point, we know that the type of the returned object was not |
@@ -127,6 +201,24 @@ acpi_ns_repair_object(struct acpi_predefined_data *data, | |||
127 | * repair the object by converting it to one of the expected object | 201 | * repair the object by converting it to one of the expected object |
128 | * types for this predefined name. | 202 | * types for this predefined name. |
129 | */ | 203 | */ |
204 | |||
205 | /* | ||
206 | * If there is no return value, check if we require a return value for | ||
207 | * this predefined name. Either one return value is expected, or none, | ||
208 | * for both methods and other objects. | ||
209 | * | ||
210 | * Exit now if there is no return object. Warning if one was expected. | ||
211 | */ | ||
212 | if (!return_object) { | ||
213 | if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) { | ||
214 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, | ||
215 | ACPI_WARN_ALWAYS, | ||
216 | "Missing expected return value")); | ||
217 | |||
218 | return (AE_AML_NO_RETURN_VALUE); | ||
219 | } | ||
220 | } | ||
221 | |||
130 | if (expected_btypes & ACPI_RTYPE_INTEGER) { | 222 | if (expected_btypes & ACPI_RTYPE_INTEGER) { |
131 | status = acpi_ns_convert_to_integer(return_object, &new_object); | 223 | status = acpi_ns_convert_to_integer(return_object, &new_object); |
132 | if (ACPI_SUCCESS(status)) { | 224 | if (ACPI_SUCCESS(status)) { |
@@ -216,254 +308,51 @@ acpi_ns_repair_object(struct acpi_predefined_data *data, | |||
216 | return (AE_OK); | 308 | return (AE_OK); |
217 | } | 309 | } |
218 | 310 | ||
219 | /******************************************************************************* | 311 | /****************************************************************************** |
220 | * | ||
221 | * FUNCTION: acpi_ns_convert_to_integer | ||
222 | * | ||
223 | * PARAMETERS: original_object - Object to be converted | ||
224 | * return_object - Where the new converted object is returned | ||
225 | * | ||
226 | * RETURN: Status. AE_OK if conversion was successful. | ||
227 | * | ||
228 | * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer. | ||
229 | * | ||
230 | ******************************************************************************/ | ||
231 | |||
232 | static acpi_status | ||
233 | acpi_ns_convert_to_integer(union acpi_operand_object *original_object, | ||
234 | union acpi_operand_object **return_object) | ||
235 | { | ||
236 | union acpi_operand_object *new_object; | ||
237 | acpi_status status; | ||
238 | u64 value = 0; | ||
239 | u32 i; | ||
240 | |||
241 | switch (original_object->common.type) { | ||
242 | case ACPI_TYPE_STRING: | ||
243 | |||
244 | /* String-to-Integer conversion */ | ||
245 | |||
246 | status = acpi_ut_strtoul64(original_object->string.pointer, | ||
247 | ACPI_ANY_BASE, &value); | ||
248 | if (ACPI_FAILURE(status)) { | ||
249 | return (status); | ||
250 | } | ||
251 | break; | ||
252 | |||
253 | case ACPI_TYPE_BUFFER: | ||
254 | |||
255 | /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */ | ||
256 | |||
257 | if (original_object->buffer.length > 8) { | ||
258 | return (AE_AML_OPERAND_TYPE); | ||
259 | } | ||
260 | |||
261 | /* Extract each buffer byte to create the integer */ | ||
262 | |||
263 | for (i = 0; i < original_object->buffer.length; i++) { | ||
264 | value |= | ||
265 | ((u64) original_object->buffer. | ||
266 | pointer[i] << (i * 8)); | ||
267 | } | ||
268 | break; | ||
269 | |||
270 | default: | ||
271 | return (AE_AML_OPERAND_TYPE); | ||
272 | } | ||
273 | |||
274 | new_object = acpi_ut_create_integer_object(value); | ||
275 | if (!new_object) { | ||
276 | return (AE_NO_MEMORY); | ||
277 | } | ||
278 | |||
279 | *return_object = new_object; | ||
280 | return (AE_OK); | ||
281 | } | ||
282 | |||
283 | /******************************************************************************* | ||
284 | * | ||
285 | * FUNCTION: acpi_ns_convert_to_string | ||
286 | * | ||
287 | * PARAMETERS: original_object - Object to be converted | ||
288 | * return_object - Where the new converted object is returned | ||
289 | * | ||
290 | * RETURN: Status. AE_OK if conversion was successful. | ||
291 | * | ||
292 | * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String. | ||
293 | * | ||
294 | ******************************************************************************/ | ||
295 | |||
296 | static acpi_status | ||
297 | acpi_ns_convert_to_string(union acpi_operand_object *original_object, | ||
298 | union acpi_operand_object **return_object) | ||
299 | { | ||
300 | union acpi_operand_object *new_object; | ||
301 | acpi_size length; | ||
302 | acpi_status status; | ||
303 | |||
304 | switch (original_object->common.type) { | ||
305 | case ACPI_TYPE_INTEGER: | ||
306 | /* | ||
307 | * Integer-to-String conversion. Commonly, convert | ||
308 | * an integer of value 0 to a NULL string. The last element of | ||
309 | * _BIF and _BIX packages occasionally need this fix. | ||
310 | */ | ||
311 | if (original_object->integer.value == 0) { | ||
312 | |||
313 | /* Allocate a new NULL string object */ | ||
314 | |||
315 | new_object = acpi_ut_create_string_object(0); | ||
316 | if (!new_object) { | ||
317 | return (AE_NO_MEMORY); | ||
318 | } | ||
319 | } else { | ||
320 | status = | ||
321 | acpi_ex_convert_to_string(original_object, | ||
322 | &new_object, | ||
323 | ACPI_IMPLICIT_CONVERT_HEX); | ||
324 | if (ACPI_FAILURE(status)) { | ||
325 | return (status); | ||
326 | } | ||
327 | } | ||
328 | break; | ||
329 | |||
330 | case ACPI_TYPE_BUFFER: | ||
331 | /* | ||
332 | * Buffer-to-String conversion. Use a to_string | ||
333 | * conversion, no transform performed on the buffer data. The best | ||
334 | * example of this is the _BIF method, where the string data from | ||
335 | * the battery is often (incorrectly) returned as buffer object(s). | ||
336 | */ | ||
337 | length = 0; | ||
338 | while ((length < original_object->buffer.length) && | ||
339 | (original_object->buffer.pointer[length])) { | ||
340 | length++; | ||
341 | } | ||
342 | |||
343 | /* Allocate a new string object */ | ||
344 | |||
345 | new_object = acpi_ut_create_string_object(length); | ||
346 | if (!new_object) { | ||
347 | return (AE_NO_MEMORY); | ||
348 | } | ||
349 | |||
350 | /* | ||
351 | * Copy the raw buffer data with no transform. String is already NULL | ||
352 | * terminated at Length+1. | ||
353 | */ | ||
354 | ACPI_MEMCPY(new_object->string.pointer, | ||
355 | original_object->buffer.pointer, length); | ||
356 | break; | ||
357 | |||
358 | default: | ||
359 | return (AE_AML_OPERAND_TYPE); | ||
360 | } | ||
361 | |||
362 | *return_object = new_object; | ||
363 | return (AE_OK); | ||
364 | } | ||
365 | |||
366 | /******************************************************************************* | ||
367 | * | 312 | * |
368 | * FUNCTION: acpi_ns_convert_to_buffer | 313 | * FUNCTION: acpi_ns_match_simple_repair |
369 | * | 314 | * |
370 | * PARAMETERS: original_object - Object to be converted | 315 | * PARAMETERS: node - Namespace node for the method/object |
371 | * return_object - Where the new converted object is returned | 316 | * return_btype - Object type that was returned |
317 | * package_index - Index of object within parent package (if | ||
318 | * applicable - ACPI_NOT_PACKAGE_ELEMENT | ||
319 | * otherwise) | ||
372 | * | 320 | * |
373 | * RETURN: Status. AE_OK if conversion was successful. | 321 | * RETURN: Pointer to entry in repair table. NULL indicates not found. |
374 | * | 322 | * |
375 | * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer. | 323 | * DESCRIPTION: Check an object name against the repairable object list. |
376 | * | 324 | * |
377 | ******************************************************************************/ | 325 | *****************************************************************************/ |
378 | 326 | ||
379 | static acpi_status | 327 | static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct |
380 | acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, | 328 | acpi_namespace_node |
381 | union acpi_operand_object **return_object) | 329 | *node, |
330 | u32 | ||
331 | return_btype, | ||
332 | u32 | ||
333 | package_index) | ||
382 | { | 334 | { |
383 | union acpi_operand_object *new_object; | 335 | const struct acpi_simple_repair_info *this_name; |
384 | acpi_status status; | ||
385 | union acpi_operand_object **elements; | ||
386 | u32 *dword_buffer; | ||
387 | u32 count; | ||
388 | u32 i; | ||
389 | 336 | ||
390 | switch (original_object->common.type) { | 337 | /* Search info table for a repairable predefined method/object name */ |
391 | case ACPI_TYPE_INTEGER: | ||
392 | /* | ||
393 | * Integer-to-Buffer conversion. | ||
394 | * Convert the Integer to a packed-byte buffer. _MAT and other | ||
395 | * objects need this sometimes, if a read has been performed on a | ||
396 | * Field object that is less than or equal to the global integer | ||
397 | * size (32 or 64 bits). | ||
398 | */ | ||
399 | status = | ||
400 | acpi_ex_convert_to_buffer(original_object, &new_object); | ||
401 | if (ACPI_FAILURE(status)) { | ||
402 | return (status); | ||
403 | } | ||
404 | break; | ||
405 | 338 | ||
406 | case ACPI_TYPE_STRING: | 339 | this_name = acpi_object_repair_info; |
340 | while (this_name->object_converter) { | ||
341 | if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) { | ||
407 | 342 | ||
408 | /* String-to-Buffer conversion. Simple data copy */ | 343 | /* Check if we can actually repair this name/type combination */ |
409 | |||
410 | new_object = | ||
411 | acpi_ut_create_buffer_object(original_object->string. | ||
412 | length); | ||
413 | if (!new_object) { | ||
414 | return (AE_NO_MEMORY); | ||
415 | } | ||
416 | 344 | ||
417 | ACPI_MEMCPY(new_object->buffer.pointer, | 345 | if ((return_btype & this_name->unexpected_btypes) && |
418 | original_object->string.pointer, | 346 | (package_index == this_name->package_index)) { |
419 | original_object->string.length); | 347 | return (this_name); |
420 | break; | ||
421 | |||
422 | case ACPI_TYPE_PACKAGE: | ||
423 | /* | ||
424 | * This case is often seen for predefined names that must return a | ||
425 | * Buffer object with multiple DWORD integers within. For example, | ||
426 | * _FDE and _GTM. The Package can be converted to a Buffer. | ||
427 | */ | ||
428 | |||
429 | /* All elements of the Package must be integers */ | ||
430 | |||
431 | elements = original_object->package.elements; | ||
432 | count = original_object->package.count; | ||
433 | |||
434 | for (i = 0; i < count; i++) { | ||
435 | if ((!*elements) || | ||
436 | ((*elements)->common.type != ACPI_TYPE_INTEGER)) { | ||
437 | return (AE_AML_OPERAND_TYPE); | ||
438 | } | 348 | } |
439 | elements++; | ||
440 | } | ||
441 | |||
442 | /* Create the new buffer object to replace the Package */ | ||
443 | 349 | ||
444 | new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count)); | 350 | return (NULL); |
445 | if (!new_object) { | ||
446 | return (AE_NO_MEMORY); | ||
447 | } | 351 | } |
448 | 352 | this_name++; | |
449 | /* Copy the package elements (integers) to the buffer as DWORDs */ | ||
450 | |||
451 | elements = original_object->package.elements; | ||
452 | dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer); | ||
453 | |||
454 | for (i = 0; i < count; i++) { | ||
455 | *dword_buffer = (u32) (*elements)->integer.value; | ||
456 | dword_buffer++; | ||
457 | elements++; | ||
458 | } | ||
459 | break; | ||
460 | |||
461 | default: | ||
462 | return (AE_AML_OPERAND_TYPE); | ||
463 | } | 353 | } |
464 | 354 | ||
465 | *return_object = new_object; | 355 | return (NULL); /* Name was not found in the repair table */ |
466 | return (AE_OK); | ||
467 | } | 356 | } |
468 | 357 | ||
469 | /******************************************************************************* | 358 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index ba4d98287c6a..149e9b9c2c1b 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -66,9 +66,9 @@ typedef struct acpi_repair_info { | |||
66 | 66 | ||
67 | /* Local prototypes */ | 67 | /* Local prototypes */ |
68 | 68 | ||
69 | static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct | 69 | static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct |
70 | acpi_namespace_node | 70 | acpi_namespace_node |
71 | *node); | 71 | *node); |
72 | 72 | ||
73 | static acpi_status | 73 | static acpi_status |
74 | acpi_ns_repair_ALR(struct acpi_predefined_data *data, | 74 | acpi_ns_repair_ALR(struct acpi_predefined_data *data, |
@@ -175,7 +175,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data, | |||
175 | 175 | ||
176 | /* Check if this name is in the list of repairable names */ | 176 | /* Check if this name is in the list of repairable names */ |
177 | 177 | ||
178 | predefined = acpi_ns_match_repairable_name(node); | 178 | predefined = acpi_ns_match_complex_repair(node); |
179 | if (!predefined) { | 179 | if (!predefined) { |
180 | return (validate_status); | 180 | return (validate_status); |
181 | } | 181 | } |
@@ -186,7 +186,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data, | |||
186 | 186 | ||
187 | /****************************************************************************** | 187 | /****************************************************************************** |
188 | * | 188 | * |
189 | * FUNCTION: acpi_ns_match_repairable_name | 189 | * FUNCTION: acpi_ns_match_complex_repair |
190 | * | 190 | * |
191 | * PARAMETERS: node - Namespace node for the method/object | 191 | * PARAMETERS: node - Namespace node for the method/object |
192 | * | 192 | * |
@@ -196,9 +196,9 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data, | |||
196 | * | 196 | * |
197 | *****************************************************************************/ | 197 | *****************************************************************************/ |
198 | 198 | ||
199 | static const struct acpi_repair_info *acpi_ns_match_repairable_name(struct | 199 | static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct |
200 | acpi_namespace_node | 200 | acpi_namespace_node |
201 | *node) | 201 | *node) |
202 | { | 202 | { |
203 | const struct acpi_repair_info *this_name; | 203 | const struct acpi_repair_info *this_name; |
204 | 204 | ||
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 686420df684f..2808586fad30 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -112,10 +112,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | |||
112 | 112 | ||
113 | if (!node) { | 113 | if (!node) { |
114 | ACPI_WARNING((AE_INFO, "Null Node parameter")); | 114 | ACPI_WARNING((AE_INFO, "Null Node parameter")); |
115 | return_VALUE(ACPI_TYPE_ANY); | 115 | return_UINT8(ACPI_TYPE_ANY); |
116 | } | 116 | } |
117 | 117 | ||
118 | return_VALUE(node->type); | 118 | return_UINT8(node->type); |
119 | } | 119 | } |
120 | 120 | ||
121 | /******************************************************************************* | 121 | /******************************************************************************* |
@@ -140,10 +140,10 @@ u32 acpi_ns_local(acpi_object_type type) | |||
140 | /* Type code out of range */ | 140 | /* Type code out of range */ |
141 | 141 | ||
142 | ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); | 142 | ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type)); |
143 | return_VALUE(ACPI_NS_NORMAL); | 143 | return_UINT32(ACPI_NS_NORMAL); |
144 | } | 144 | } |
145 | 145 | ||
146 | return_VALUE(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); | 146 | return_UINT32(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); |
147 | } | 147 | } |
148 | 148 | ||
149 | /******************************************************************************* | 149 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index f51308cdbc65..9f25a3d4e992 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
@@ -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_VALUE(package_length); | 111 | return_UINT32(package_length); |
112 | } | 112 | } |
113 | 113 | ||
114 | /******************************************************************************* | 114 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index 7816d4eef04e..72077fa1eea5 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
@@ -202,6 +202,12 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
202 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); | 202 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); |
203 | } | 203 | } |
204 | 204 | ||
205 | /* Sanity check the length. It must not be zero, or we loop forever */ | ||
206 | |||
207 | if (!resource->length) { | ||
208 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | ||
209 | } | ||
210 | |||
205 | /* Get the base size of the (external stream) resource descriptor */ | 211 | /* Get the base size of the (external stream) resource descriptor */ |
206 | 212 | ||
207 | total_size = acpi_gbl_aml_resource_sizes[resource->type]; | 213 | total_size = acpi_gbl_aml_resource_sizes[resource->type]; |
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c index cab51445189d..b5fc0db2e87b 100644 --- a/drivers/acpi/acpica/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c | |||
@@ -385,6 +385,14 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) | |||
385 | return; | 385 | return; |
386 | } | 386 | } |
387 | 387 | ||
388 | /* Sanity check the length. It must not be zero, or we loop forever */ | ||
389 | |||
390 | if (!resource_list->length) { | ||
391 | acpi_os_printf | ||
392 | ("Invalid zero length descriptor in resource list\n"); | ||
393 | return; | ||
394 | } | ||
395 | |||
388 | /* Dump the resource descriptor */ | 396 | /* Dump the resource descriptor */ |
389 | 397 | ||
390 | if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | 398 | if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { |
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c index ee2e206fc6c8..6053aa182093 100644 --- a/drivers/acpi/acpica/rslist.c +++ b/drivers/acpi/acpica/rslist.c | |||
@@ -178,6 +178,14 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
178 | return_ACPI_STATUS(AE_BAD_DATA); | 178 | return_ACPI_STATUS(AE_BAD_DATA); |
179 | } | 179 | } |
180 | 180 | ||
181 | /* Sanity check the length. It must not be zero, or we loop forever */ | ||
182 | |||
183 | if (!resource->length) { | ||
184 | ACPI_ERROR((AE_INFO, | ||
185 | "Invalid zero length descriptor in resource list\n")); | ||
186 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | ||
187 | } | ||
188 | |||
181 | /* Perform the conversion */ | 189 | /* Perform the conversion */ |
182 | 190 | ||
183 | if (resource->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | 191 | if (resource->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { |
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 15d6eaef0e28..c0e5d2d3ce67 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
@@ -563,13 +563,19 @@ acpi_walk_resource_buffer(struct acpi_buffer * buffer, | |||
563 | 563 | ||
564 | while (resource < resource_end) { | 564 | while (resource < resource_end) { |
565 | 565 | ||
566 | /* Sanity check the resource */ | 566 | /* Sanity check the resource type */ |
567 | 567 | ||
568 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 568 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
569 | status = AE_AML_INVALID_RESOURCE_TYPE; | 569 | status = AE_AML_INVALID_RESOURCE_TYPE; |
570 | break; | 570 | break; |
571 | } | 571 | } |
572 | 572 | ||
573 | /* Sanity check the length. It must not be zero, or we loop forever */ | ||
574 | |||
575 | if (!resource->length) { | ||
576 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | ||
577 | } | ||
578 | |||
573 | /* Invoke the user function, abort on any error returned */ | 579 | /* Invoke the user function, abort on any error returned */ |
574 | 580 | ||
575 | status = user_function(resource, context); | 581 | status = user_function(resource, context); |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 74181bf181ec..33b00d22300a 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -559,8 +559,12 @@ static void acpi_tb_validate_fadt(void) | |||
559 | /* | 559 | /* |
560 | * For each extended field, check for length mismatch between the | 560 | * For each extended field, check for length mismatch between the |
561 | * legacy length field and the corresponding 64-bit X length field. | 561 | * legacy length field and the corresponding 64-bit X length field. |
562 | * Note: If the legacy length field is > 0xFF bits, ignore this | ||
563 | * check. (GPE registers can be larger than the 64-bit GAS structure | ||
564 | * can accomodate, 0xFF bits). | ||
562 | */ | 565 | */ |
563 | if (address64->address && | 566 | if (address64->address && |
567 | (ACPI_MUL_8(length) <= ACPI_UINT8_MAX) && | ||
564 | (address64->bit_width != ACPI_MUL_8(length))) { | 568 | (address64->bit_width != ACPI_MUL_8(length))) { |
565 | ACPI_BIOS_WARNING((AE_INFO, | 569 | ACPI_BIOS_WARNING((AE_INFO, |
566 | "32/64X length mismatch in FADT/%s: %u/%u", | 570 | "32/64X length mismatch in FADT/%s: %u/%u", |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index b35a5e6d653a..ad11162482ff 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: tbxface - ACPI table oriented external interfaces | 3 | * Module Name: tbxface - ACPI table-oriented external interfaces |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -80,7 +80,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count) | |||
80 | * array is dynamically allocated. | 80 | * array is dynamically allocated. |
81 | * initial_table_count - Size of initial_table_array, in number of | 81 | * initial_table_count - Size of initial_table_array, in number of |
82 | * struct acpi_table_desc structures | 82 | * struct acpi_table_desc structures |
83 | * allow_realloc - Flag to tell Table Manager if resize of | 83 | * allow_resize - Flag to tell Table Manager if resize of |
84 | * pre-allocated array is allowed. Ignored | 84 | * pre-allocated array is allowed. Ignored |
85 | * if initial_table_array is NULL. | 85 | * if initial_table_array is NULL. |
86 | * | 86 | * |
@@ -107,8 +107,8 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array, | |||
107 | ACPI_FUNCTION_TRACE(acpi_initialize_tables); | 107 | ACPI_FUNCTION_TRACE(acpi_initialize_tables); |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * Set up the Root Table Array | 110 | * Setup the Root Table Array and allocate the table array |
111 | * Allocate the table array if requested | 111 | * if requested |
112 | */ | 112 | */ |
113 | if (!initial_table_array) { | 113 | if (!initial_table_array) { |
114 | status = acpi_allocate_root_table(initial_table_count); | 114 | status = acpi_allocate_root_table(initial_table_count); |
@@ -305,9 +305,10 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id) | |||
305 | * instance - Which instance (for SSDTs) | 305 | * instance - Which instance (for SSDTs) |
306 | * out_table - Where the pointer to the table is returned | 306 | * out_table - Where the pointer to the table is returned |
307 | * | 307 | * |
308 | * RETURN: Status and pointer to table | 308 | * RETURN: Status and pointer to the requested table |
309 | * | 309 | * |
310 | * DESCRIPTION: Finds and verifies an ACPI table. | 310 | * DESCRIPTION: Finds and verifies an ACPI table. Table must be in the |
311 | * RSDT/XSDT. | ||
311 | * | 312 | * |
312 | ******************************************************************************/ | 313 | ******************************************************************************/ |
313 | acpi_status | 314 | acpi_status |
@@ -375,9 +376,10 @@ ACPI_EXPORT_SYMBOL(acpi_get_table) | |||
375 | * PARAMETERS: table_index - Table index | 376 | * PARAMETERS: table_index - Table index |
376 | * table - Where the pointer to the table is returned | 377 | * table - Where the pointer to the table is returned |
377 | * | 378 | * |
378 | * RETURN: Status and pointer to the table | 379 | * RETURN: Status and pointer to the requested table |
379 | * | 380 | * |
380 | * DESCRIPTION: Obtain a table by an index into the global table list. | 381 | * DESCRIPTION: Obtain a table by an index into the global table list. Used |
382 | * internally also. | ||
381 | * | 383 | * |
382 | ******************************************************************************/ | 384 | ******************************************************************************/ |
383 | acpi_status | 385 | acpi_status |
@@ -432,7 +434,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_by_index) | |||
432 | * | 434 | * |
433 | * RETURN: Status | 435 | * RETURN: Status |
434 | * | 436 | * |
435 | * DESCRIPTION: Install table event handler | 437 | * DESCRIPTION: Install a global table event handler. |
436 | * | 438 | * |
437 | ******************************************************************************/ | 439 | ******************************************************************************/ |
438 | acpi_status | 440 | acpi_status |
@@ -479,7 +481,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_table_handler) | |||
479 | * | 481 | * |
480 | * RETURN: Status | 482 | * RETURN: Status |
481 | * | 483 | * |
482 | * DESCRIPTION: Remove table event handler | 484 | * DESCRIPTION: Remove a table event handler |
483 | * | 485 | * |
484 | ******************************************************************************/ | 486 | ******************************************************************************/ |
485 | acpi_status acpi_remove_table_handler(acpi_table_handler handler) | 487 | acpi_status acpi_remove_table_handler(acpi_table_handler handler) |
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c index 698b9d385516..e0a2e2779c2e 100644 --- a/drivers/acpi/acpica/utaddress.c +++ b/drivers/acpi/acpica/utaddress.c | |||
@@ -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_VALUE(0); | 217 | return_UINT32(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_VALUE(overlap_count); | 259 | return_UINT32(overlap_count); |
260 | } | 260 | } |
261 | 261 | ||
262 | /******************************************************************************* | 262 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c index e0e8579deaac..a877a9647fd9 100644 --- a/drivers/acpi/acpica/utcache.c +++ b/drivers/acpi/acpica/utcache.c | |||
@@ -85,7 +85,6 @@ acpi_os_create_cache(char *cache_name, | |||
85 | /* Populate the cache object and return it */ | 85 | /* Populate the cache object and return it */ |
86 | 86 | ||
87 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); | 87 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); |
88 | cache->link_offset = 8; | ||
89 | cache->list_name = cache_name; | 88 | cache->list_name = cache_name; |
90 | cache->object_size = object_size; | 89 | cache->object_size = object_size; |
91 | cache->max_depth = max_depth; | 90 | cache->max_depth = max_depth; |
@@ -108,7 +107,7 @@ acpi_os_create_cache(char *cache_name, | |||
108 | 107 | ||
109 | acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | 108 | acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) |
110 | { | 109 | { |
111 | char *next; | 110 | void *next; |
112 | acpi_status status; | 111 | acpi_status status; |
113 | 112 | ||
114 | ACPI_FUNCTION_ENTRY(); | 113 | ACPI_FUNCTION_ENTRY(); |
@@ -128,10 +127,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | |||
128 | 127 | ||
129 | /* Delete and unlink one cached state object */ | 128 | /* Delete and unlink one cached state object */ |
130 | 129 | ||
131 | next = *(ACPI_CAST_INDIRECT_PTR(char, | 130 | next = ACPI_GET_DESCRIPTOR_PTR(cache->list_head); |
132 | &(((char *)cache-> | ||
133 | list_head)[cache-> | ||
134 | link_offset]))); | ||
135 | ACPI_FREE(cache->list_head); | 131 | ACPI_FREE(cache->list_head); |
136 | 132 | ||
137 | cache->list_head = next; | 133 | cache->list_head = next; |
@@ -221,10 +217,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object) | |||
221 | 217 | ||
222 | /* Put the object at the head of the cache list */ | 218 | /* Put the object at the head of the cache list */ |
223 | 219 | ||
224 | *(ACPI_CAST_INDIRECT_PTR(char, | 220 | ACPI_SET_DESCRIPTOR_PTR(object, cache->list_head); |
225 | &(((char *)object)[cache-> | ||
226 | link_offset]))) = | ||
227 | cache->list_head; | ||
228 | cache->list_head = object; | 221 | cache->list_head = object; |
229 | cache->current_depth++; | 222 | cache->current_depth++; |
230 | 223 | ||
@@ -272,10 +265,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
272 | /* There is an object available, use it */ | 265 | /* There is an object available, use it */ |
273 | 266 | ||
274 | object = cache->list_head; | 267 | object = cache->list_head; |
275 | cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char, | 268 | cache->list_head = ACPI_GET_DESCRIPTOR_PTR(object); |
276 | &(((char *) | ||
277 | object)[cache-> | ||
278 | link_offset]))); | ||
279 | 269 | ||
280 | cache->current_depth--; | 270 | cache->current_depth--; |
281 | 271 | ||
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index 2541de420249..29b930250b6f 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
@@ -359,19 +359,20 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
359 | * FUNCTION: acpi_ut_update_ref_count | 359 | * FUNCTION: acpi_ut_update_ref_count |
360 | * | 360 | * |
361 | * PARAMETERS: object - Object whose ref count is to be updated | 361 | * PARAMETERS: object - Object whose ref count is to be updated |
362 | * action - What to do | 362 | * action - What to do (REF_INCREMENT or REF_DECREMENT) |
363 | * | 363 | * |
364 | * RETURN: New ref count | 364 | * RETURN: None. Sets new reference count within the object |
365 | * | 365 | * |
366 | * DESCRIPTION: Modify the ref count and return it. | 366 | * DESCRIPTION: Modify the reference count for an internal acpi object |
367 | * | 367 | * |
368 | ******************************************************************************/ | 368 | ******************************************************************************/ |
369 | 369 | ||
370 | static void | 370 | static void |
371 | acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | 371 | acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
372 | { | 372 | { |
373 | u16 count; | 373 | u16 original_count; |
374 | u16 new_count; | 374 | u16 new_count = 0; |
375 | acpi_cpu_flags lock_flags; | ||
375 | 376 | ||
376 | ACPI_FUNCTION_NAME(ut_update_ref_count); | 377 | ACPI_FUNCTION_NAME(ut_update_ref_count); |
377 | 378 | ||
@@ -379,76 +380,79 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
379 | return; | 380 | return; |
380 | } | 381 | } |
381 | 382 | ||
382 | count = object->common.reference_count; | ||
383 | new_count = count; | ||
384 | |||
385 | /* | 383 | /* |
386 | * Perform the reference count action (increment, decrement, force delete) | 384 | * Always get the reference count lock. Note: Interpreter and/or |
385 | * Namespace is not always locked when this function is called. | ||
387 | */ | 386 | */ |
387 | lock_flags = acpi_os_acquire_lock(acpi_gbl_reference_count_lock); | ||
388 | original_count = object->common.reference_count; | ||
389 | |||
390 | /* Perform the reference count action (increment, decrement) */ | ||
391 | |||
388 | switch (action) { | 392 | switch (action) { |
389 | case REF_INCREMENT: | 393 | case REF_INCREMENT: |
390 | 394 | ||
391 | new_count++; | 395 | new_count = original_count + 1; |
392 | object->common.reference_count = new_count; | 396 | object->common.reference_count = new_count; |
397 | acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags); | ||
398 | |||
399 | /* The current reference count should never be zero here */ | ||
400 | |||
401 | if (!original_count) { | ||
402 | ACPI_WARNING((AE_INFO, | ||
403 | "Obj %p, Reference Count was zero before increment\n", | ||
404 | object)); | ||
405 | } | ||
393 | 406 | ||
394 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 407 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
395 | "Obj %p Refs=%X, [Incremented]\n", | 408 | "Obj %p Type %.2X Refs %.2X [Incremented]\n", |
396 | object, new_count)); | 409 | object, object->common.type, new_count)); |
397 | break; | 410 | break; |
398 | 411 | ||
399 | case REF_DECREMENT: | 412 | case REF_DECREMENT: |
400 | 413 | ||
401 | if (count < 1) { | 414 | /* The current reference count must be non-zero */ |
402 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | ||
403 | "Obj %p Refs=%X, can't decrement! (Set to 0)\n", | ||
404 | object, new_count)); | ||
405 | |||
406 | new_count = 0; | ||
407 | } else { | ||
408 | new_count--; | ||
409 | 415 | ||
410 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 416 | if (original_count) { |
411 | "Obj %p Refs=%X, [Decremented]\n", | 417 | new_count = original_count - 1; |
412 | object, new_count)); | 418 | object->common.reference_count = new_count; |
413 | } | 419 | } |
414 | 420 | ||
415 | if (object->common.type == ACPI_TYPE_METHOD) { | 421 | acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags); |
416 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | ||
417 | "Method Obj %p Refs=%X, [Decremented]\n", | ||
418 | object, new_count)); | ||
419 | } | ||
420 | 422 | ||
421 | object->common.reference_count = new_count; | 423 | if (!original_count) { |
422 | if (new_count == 0) { | 424 | ACPI_WARNING((AE_INFO, |
423 | acpi_ut_delete_internal_obj(object); | 425 | "Obj %p, Reference Count is already zero, cannot decrement\n", |
426 | object)); | ||
424 | } | 427 | } |
425 | break; | ||
426 | |||
427 | case REF_FORCE_DELETE: | ||
428 | 428 | ||
429 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 429 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
430 | "Obj %p Refs=%X, Force delete! (Set to 0)\n", | 430 | "Obj %p Type %.2X Refs %.2X [Decremented]\n", |
431 | object, count)); | 431 | object, object->common.type, new_count)); |
432 | 432 | ||
433 | new_count = 0; | 433 | /* Actually delete the object on a reference count of zero */ |
434 | object->common.reference_count = new_count; | 434 | |
435 | acpi_ut_delete_internal_obj(object); | 435 | if (new_count == 0) { |
436 | acpi_ut_delete_internal_obj(object); | ||
437 | } | ||
436 | break; | 438 | break; |
437 | 439 | ||
438 | default: | 440 | default: |
439 | 441 | ||
440 | ACPI_ERROR((AE_INFO, "Unknown action (0x%X)", action)); | 442 | acpi_os_release_lock(acpi_gbl_reference_count_lock, lock_flags); |
441 | break; | 443 | ACPI_ERROR((AE_INFO, "Unknown Reference Count action (0x%X)", |
444 | action)); | ||
445 | return; | ||
442 | } | 446 | } |
443 | 447 | ||
444 | /* | 448 | /* |
445 | * Sanity check the reference count, for debug purposes only. | 449 | * Sanity check the reference count, for debug purposes only. |
446 | * (A deleted object will have a huge reference count) | 450 | * (A deleted object will have a huge reference count) |
447 | */ | 451 | */ |
448 | if (count > ACPI_MAX_REFERENCE_COUNT) { | 452 | if (new_count > ACPI_MAX_REFERENCE_COUNT) { |
449 | ACPI_WARNING((AE_INFO, | 453 | ACPI_WARNING((AE_INFO, |
450 | "Large Reference Count (0x%X) in object %p", | 454 | "Large Reference Count (0x%X) in object %p, Type=0x%.2X", |
451 | count, object)); | 455 | new_count, object, object->common.type)); |
452 | } | 456 | } |
453 | } | 457 | } |
454 | 458 | ||
@@ -458,8 +462,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
458 | * | 462 | * |
459 | * PARAMETERS: object - Increment ref count for this object | 463 | * PARAMETERS: object - Increment ref count for this object |
460 | * and all sub-objects | 464 | * and all sub-objects |
461 | * action - Either REF_INCREMENT or REF_DECREMENT or | 465 | * action - Either REF_INCREMENT or REF_DECREMENT |
462 | * REF_FORCE_DELETE | ||
463 | * | 466 | * |
464 | * RETURN: Status | 467 | * RETURN: Status |
465 | * | 468 | * |
@@ -714,7 +717,6 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) | |||
714 | /* | 717 | /* |
715 | * Allow a NULL pointer to be passed in, just ignore it. This saves | 718 | * Allow a NULL pointer to be passed in, just ignore it. This saves |
716 | * each caller from having to check. Also, ignore NS nodes. | 719 | * each caller from having to check. Also, ignore NS nodes. |
717 | * | ||
718 | */ | 720 | */ |
719 | if (!object || | 721 | if (!object || |
720 | (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) { | 722 | (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) { |
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c index a0ab7c02e87c..b543a144941a 100644 --- a/drivers/acpi/acpica/utexcep.c +++ b/drivers/acpi/acpica/utexcep.c | |||
@@ -64,7 +64,7 @@ ACPI_MODULE_NAME("utexcep") | |||
64 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | const char *acpi_format_exception(acpi_status status) | 65 | const char *acpi_format_exception(acpi_status status) |
66 | { | 66 | { |
67 | const char *exception = NULL; | 67 | const struct acpi_exception_info *exception; |
68 | 68 | ||
69 | ACPI_FUNCTION_ENTRY(); | 69 | ACPI_FUNCTION_ENTRY(); |
70 | 70 | ||
@@ -76,10 +76,10 @@ const char *acpi_format_exception(acpi_status status) | |||
76 | ACPI_ERROR((AE_INFO, | 76 | ACPI_ERROR((AE_INFO, |
77 | "Unknown exception code: 0x%8.8X", status)); | 77 | "Unknown exception code: 0x%8.8X", status)); |
78 | 78 | ||
79 | exception = "UNKNOWN_STATUS_CODE"; | 79 | return ("UNKNOWN_STATUS_CODE"); |
80 | } | 80 | } |
81 | 81 | ||
82 | return (ACPI_CAST_PTR(const char, exception)); | 82 | return (exception->name); |
83 | } | 83 | } |
84 | 84 | ||
85 | ACPI_EXPORT_SYMBOL(acpi_format_exception) | 85 | ACPI_EXPORT_SYMBOL(acpi_format_exception) |
@@ -97,10 +97,10 @@ ACPI_EXPORT_SYMBOL(acpi_format_exception) | |||
97 | * an ASCII string. | 97 | * an ASCII string. |
98 | * | 98 | * |
99 | ******************************************************************************/ | 99 | ******************************************************************************/ |
100 | const char *acpi_ut_validate_exception(acpi_status status) | 100 | const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status status) |
101 | { | 101 | { |
102 | u32 sub_status; | 102 | u32 sub_status; |
103 | const char *exception = NULL; | 103 | const struct acpi_exception_info *exception = NULL; |
104 | 104 | ||
105 | ACPI_FUNCTION_ENTRY(); | 105 | ACPI_FUNCTION_ENTRY(); |
106 | 106 | ||
@@ -113,35 +113,35 @@ const char *acpi_ut_validate_exception(acpi_status status) | |||
113 | case AE_CODE_ENVIRONMENTAL: | 113 | case AE_CODE_ENVIRONMENTAL: |
114 | 114 | ||
115 | if (sub_status <= AE_CODE_ENV_MAX) { | 115 | if (sub_status <= AE_CODE_ENV_MAX) { |
116 | exception = acpi_gbl_exception_names_env[sub_status]; | 116 | exception = &acpi_gbl_exception_names_env[sub_status]; |
117 | } | 117 | } |
118 | break; | 118 | break; |
119 | 119 | ||
120 | case AE_CODE_PROGRAMMER: | 120 | case AE_CODE_PROGRAMMER: |
121 | 121 | ||
122 | if (sub_status <= AE_CODE_PGM_MAX) { | 122 | if (sub_status <= AE_CODE_PGM_MAX) { |
123 | exception = acpi_gbl_exception_names_pgm[sub_status]; | 123 | exception = &acpi_gbl_exception_names_pgm[sub_status]; |
124 | } | 124 | } |
125 | break; | 125 | break; |
126 | 126 | ||
127 | case AE_CODE_ACPI_TABLES: | 127 | case AE_CODE_ACPI_TABLES: |
128 | 128 | ||
129 | if (sub_status <= AE_CODE_TBL_MAX) { | 129 | if (sub_status <= AE_CODE_TBL_MAX) { |
130 | exception = acpi_gbl_exception_names_tbl[sub_status]; | 130 | exception = &acpi_gbl_exception_names_tbl[sub_status]; |
131 | } | 131 | } |
132 | break; | 132 | break; |
133 | 133 | ||
134 | case AE_CODE_AML: | 134 | case AE_CODE_AML: |
135 | 135 | ||
136 | if (sub_status <= AE_CODE_AML_MAX) { | 136 | if (sub_status <= AE_CODE_AML_MAX) { |
137 | exception = acpi_gbl_exception_names_aml[sub_status]; | 137 | exception = &acpi_gbl_exception_names_aml[sub_status]; |
138 | } | 138 | } |
139 | break; | 139 | break; |
140 | 140 | ||
141 | case AE_CODE_CONTROL: | 141 | case AE_CODE_CONTROL: |
142 | 142 | ||
143 | if (sub_status <= AE_CODE_CTRL_MAX) { | 143 | if (sub_status <= AE_CODE_CTRL_MAX) { |
144 | exception = acpi_gbl_exception_names_ctrl[sub_status]; | 144 | exception = &acpi_gbl_exception_names_ctrl[sub_status]; |
145 | } | 145 | } |
146 | break; | 146 | break; |
147 | 147 | ||
@@ -149,5 +149,9 @@ const char *acpi_ut_validate_exception(acpi_status status) | |||
149 | break; | 149 | break; |
150 | } | 150 | } |
151 | 151 | ||
152 | return (ACPI_CAST_PTR(const char, exception)); | 152 | if (!exception || !exception->name) { |
153 | return (NULL); | ||
154 | } | ||
155 | |||
156 | return (exception); | ||
153 | } | 157 | } |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index ffecf4b4f0dd..f736448a8606 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -359,6 +359,8 @@ acpi_status acpi_ut_init_globals(void) | |||
359 | 359 | ||
360 | #ifdef ACPI_DISASSEMBLER | 360 | #ifdef ACPI_DISASSEMBLER |
361 | acpi_gbl_external_list = NULL; | 361 | acpi_gbl_external_list = NULL; |
362 | acpi_gbl_num_external_methods = 0; | ||
363 | acpi_gbl_resolved_external_methods = 0; | ||
362 | #endif | 364 | #endif |
363 | 365 | ||
364 | #ifdef ACPI_DEBUG_OUTPUT | 366 | #ifdef ACPI_DEBUG_OUTPUT |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index 22feb99b8e35..08c323245584 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -81,7 +81,7 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | /* Create the spinlocks for use at interrupt level */ | 84 | /* Create the spinlocks for use at interrupt level or for speed */ |
85 | 85 | ||
86 | status = acpi_os_create_lock (&acpi_gbl_gpe_lock); | 86 | status = acpi_os_create_lock (&acpi_gbl_gpe_lock); |
87 | if (ACPI_FAILURE (status)) { | 87 | if (ACPI_FAILURE (status)) { |
@@ -93,7 +93,13 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
93 | return_ACPI_STATUS (status); | 93 | return_ACPI_STATUS (status); |
94 | } | 94 | } |
95 | 95 | ||
96 | status = acpi_os_create_lock(&acpi_gbl_reference_count_lock); | ||
97 | if (ACPI_FAILURE(status)) { | ||
98 | return_ACPI_STATUS(status); | ||
99 | } | ||
100 | |||
96 | /* Mutex for _OSI support */ | 101 | /* Mutex for _OSI support */ |
102 | |||
97 | status = acpi_os_create_mutex(&acpi_gbl_osi_mutex); | 103 | status = acpi_os_create_mutex(&acpi_gbl_osi_mutex); |
98 | if (ACPI_FAILURE(status)) { | 104 | if (ACPI_FAILURE(status)) { |
99 | return_ACPI_STATUS(status); | 105 | return_ACPI_STATUS(status); |
@@ -136,6 +142,7 @@ void acpi_ut_mutex_terminate(void) | |||
136 | 142 | ||
137 | acpi_os_delete_lock(acpi_gbl_gpe_lock); | 143 | acpi_os_delete_lock(acpi_gbl_gpe_lock); |
138 | acpi_os_delete_lock(acpi_gbl_hardware_lock); | 144 | acpi_os_delete_lock(acpi_gbl_hardware_lock); |
145 | acpi_os_delete_lock(acpi_gbl_reference_count_lock); | ||
139 | 146 | ||
140 | /* Delete the reader/writer lock */ | 147 | /* Delete the reader/writer lock */ |
141 | 148 | ||
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 36a7d361d7cb..b15acebb96a1 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c | |||
@@ -108,9 +108,14 @@ static struct acpi_interface_info acpi_default_supported_interfaces[] = { | |||
108 | 108 | ||
109 | acpi_status acpi_ut_initialize_interfaces(void) | 109 | acpi_status acpi_ut_initialize_interfaces(void) |
110 | { | 110 | { |
111 | acpi_status status; | ||
111 | u32 i; | 112 | u32 i; |
112 | 113 | ||
113 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | 114 | status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); |
115 | if (ACPI_FAILURE(status)) { | ||
116 | return (status); | ||
117 | } | ||
118 | |||
114 | acpi_gbl_supported_interfaces = acpi_default_supported_interfaces; | 119 | acpi_gbl_supported_interfaces = acpi_default_supported_interfaces; |
115 | 120 | ||
116 | /* Link the static list of supported interfaces */ | 121 | /* Link the static list of supported interfaces */ |
@@ -132,20 +137,24 @@ acpi_status acpi_ut_initialize_interfaces(void) | |||
132 | * | 137 | * |
133 | * PARAMETERS: None | 138 | * PARAMETERS: None |
134 | * | 139 | * |
135 | * RETURN: None | 140 | * RETURN: Status |
136 | * | 141 | * |
137 | * DESCRIPTION: Delete all interfaces in the global list. Sets | 142 | * DESCRIPTION: Delete all interfaces in the global list. Sets |
138 | * acpi_gbl_supported_interfaces to NULL. | 143 | * acpi_gbl_supported_interfaces to NULL. |
139 | * | 144 | * |
140 | ******************************************************************************/ | 145 | ******************************************************************************/ |
141 | 146 | ||
142 | void acpi_ut_interface_terminate(void) | 147 | acpi_status acpi_ut_interface_terminate(void) |
143 | { | 148 | { |
149 | acpi_status status; | ||
144 | struct acpi_interface_info *next_interface; | 150 | struct acpi_interface_info *next_interface; |
145 | 151 | ||
146 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | 152 | status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); |
147 | next_interface = acpi_gbl_supported_interfaces; | 153 | if (ACPI_FAILURE(status)) { |
154 | return (status); | ||
155 | } | ||
148 | 156 | ||
157 | next_interface = acpi_gbl_supported_interfaces; | ||
149 | while (next_interface) { | 158 | while (next_interface) { |
150 | acpi_gbl_supported_interfaces = next_interface->next; | 159 | acpi_gbl_supported_interfaces = next_interface->next; |
151 | 160 | ||
@@ -160,6 +169,7 @@ void acpi_ut_interface_terminate(void) | |||
160 | } | 169 | } |
161 | 170 | ||
162 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | 171 | acpi_os_release_mutex(acpi_gbl_osi_mutex); |
172 | return (AE_OK); | ||
163 | } | 173 | } |
164 | 174 | ||
165 | /******************************************************************************* | 175 | /******************************************************************************* |
@@ -315,6 +325,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state) | |||
315 | union acpi_operand_object *return_desc; | 325 | union acpi_operand_object *return_desc; |
316 | struct acpi_interface_info *interface_info; | 326 | struct acpi_interface_info *interface_info; |
317 | acpi_interface_handler interface_handler; | 327 | acpi_interface_handler interface_handler; |
328 | acpi_status status; | ||
318 | u32 return_value; | 329 | u32 return_value; |
319 | 330 | ||
320 | ACPI_FUNCTION_TRACE(ut_osi_implementation); | 331 | ACPI_FUNCTION_TRACE(ut_osi_implementation); |
@@ -336,7 +347,10 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state) | |||
336 | /* Default return value is 0, NOT SUPPORTED */ | 347 | /* Default return value is 0, NOT SUPPORTED */ |
337 | 348 | ||
338 | return_value = 0; | 349 | return_value = 0; |
339 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | 350 | status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); |
351 | if (ACPI_FAILURE(status)) { | ||
352 | return (status); | ||
353 | } | ||
340 | 354 | ||
341 | /* Lookup the interface in the global _OSI list */ | 355 | /* Lookup the interface in the global _OSI list */ |
342 | 356 | ||
diff --git a/drivers/acpi/acpica/utpredef.c b/drivers/acpi/acpica/utpredef.c new file mode 100644 index 000000000000..29459479148f --- /dev/null +++ b/drivers/acpi/acpica/utpredef.c | |||
@@ -0,0 +1,399 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utpredef - support functions 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 "acpredef.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utpredef") | ||
50 | |||
51 | /* | ||
52 | * Names for the types that can be returned by the predefined objects. | ||
53 | * Used for warning messages. Must be in the same order as the ACPI_RTYPEs | ||
54 | */ | ||
55 | static const char *ut_rtype_names[] = { | ||
56 | "/Integer", | ||
57 | "/String", | ||
58 | "/Buffer", | ||
59 | "/Package", | ||
60 | "/Reference", | ||
61 | }; | ||
62 | |||
63 | /******************************************************************************* | ||
64 | * | ||
65 | * FUNCTION: acpi_ut_get_next_predefined_method | ||
66 | * | ||
67 | * PARAMETERS: this_name - Entry in the predefined method/name table | ||
68 | * | ||
69 | * RETURN: Pointer to next entry in predefined table. | ||
70 | * | ||
71 | * DESCRIPTION: Get the next entry in the predefine method table. Handles the | ||
72 | * cases where a package info entry follows a method name that | ||
73 | * returns a package. | ||
74 | * | ||
75 | ******************************************************************************/ | ||
76 | |||
77 | const union acpi_predefined_info *acpi_ut_get_next_predefined_method(const union | ||
78 | acpi_predefined_info | ||
79 | *this_name) | ||
80 | { | ||
81 | |||
82 | /* | ||
83 | * Skip next entry in the table if this name returns a Package | ||
84 | * (next entry contains the package info) | ||
85 | */ | ||
86 | if ((this_name->info.expected_btypes & ACPI_RTYPE_PACKAGE) && | ||
87 | (this_name->info.expected_btypes != ACPI_RTYPE_ALL)) { | ||
88 | this_name++; | ||
89 | } | ||
90 | |||
91 | this_name++; | ||
92 | return (this_name); | ||
93 | } | ||
94 | |||
95 | /******************************************************************************* | ||
96 | * | ||
97 | * FUNCTION: acpi_ut_match_predefined_method | ||
98 | * | ||
99 | * PARAMETERS: name - Name to find | ||
100 | * | ||
101 | * RETURN: Pointer to entry in predefined table. NULL indicates not found. | ||
102 | * | ||
103 | * DESCRIPTION: Check an object name against the predefined object list. | ||
104 | * | ||
105 | ******************************************************************************/ | ||
106 | |||
107 | const union acpi_predefined_info *acpi_ut_match_predefined_method(char *name) | ||
108 | { | ||
109 | const union acpi_predefined_info *this_name; | ||
110 | |||
111 | /* Quick check for a predefined name, first character must be underscore */ | ||
112 | |||
113 | if (name[0] != '_') { | ||
114 | return (NULL); | ||
115 | } | ||
116 | |||
117 | /* Search info table for a predefined method/object name */ | ||
118 | |||
119 | this_name = acpi_gbl_predefined_methods; | ||
120 | while (this_name->info.name[0]) { | ||
121 | if (ACPI_COMPARE_NAME(name, this_name->info.name)) { | ||
122 | return (this_name); | ||
123 | } | ||
124 | |||
125 | this_name = acpi_ut_get_next_predefined_method(this_name); | ||
126 | } | ||
127 | |||
128 | return (NULL); /* Not found */ | ||
129 | } | ||
130 | |||
131 | /******************************************************************************* | ||
132 | * | ||
133 | * FUNCTION: acpi_ut_get_expected_return_types | ||
134 | * | ||
135 | * PARAMETERS: buffer - Where the formatted string is returned | ||
136 | * expected_Btypes - Bitfield of expected data types | ||
137 | * | ||
138 | * RETURN: Formatted string in Buffer. | ||
139 | * | ||
140 | * DESCRIPTION: Format the expected object types into a printable string. | ||
141 | * | ||
142 | ******************************************************************************/ | ||
143 | |||
144 | void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes) | ||
145 | { | ||
146 | u32 this_rtype; | ||
147 | u32 i; | ||
148 | u32 j; | ||
149 | |||
150 | j = 1; | ||
151 | buffer[0] = 0; | ||
152 | this_rtype = ACPI_RTYPE_INTEGER; | ||
153 | |||
154 | for (i = 0; i < ACPI_NUM_RTYPES; i++) { | ||
155 | |||
156 | /* If one of the expected types, concatenate the name of this type */ | ||
157 | |||
158 | if (expected_btypes & this_rtype) { | ||
159 | ACPI_STRCAT(buffer, &ut_rtype_names[i][j]); | ||
160 | j = 0; /* Use name separator from now on */ | ||
161 | } | ||
162 | |||
163 | this_rtype <<= 1; /* Next Rtype */ | ||
164 | } | ||
165 | } | ||
166 | |||
167 | /******************************************************************************* | ||
168 | * | ||
169 | * The remaining functions are used by iASL and acpi_help only | ||
170 | * | ||
171 | ******************************************************************************/ | ||
172 | |||
173 | #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP) | ||
174 | #include <stdio.h> | ||
175 | #include <string.h> | ||
176 | |||
177 | /* Local prototypes */ | ||
178 | |||
179 | static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types); | ||
180 | |||
181 | /* Types that can be returned externally by a predefined name */ | ||
182 | |||
183 | static const char *ut_external_type_names[] = /* Indexed by ACPI_TYPE_* */ | ||
184 | { | ||
185 | ", UNSUPPORTED-TYPE", | ||
186 | ", Integer", | ||
187 | ", String", | ||
188 | ", Buffer", | ||
189 | ", Package" | ||
190 | }; | ||
191 | |||
192 | /* Bit widths for resource descriptor predefined names */ | ||
193 | |||
194 | static const char *ut_resource_type_names[] = { | ||
195 | "/1", | ||
196 | "/2", | ||
197 | "/3", | ||
198 | "/8", | ||
199 | "/16", | ||
200 | "/32", | ||
201 | "/64", | ||
202 | "/variable", | ||
203 | }; | ||
204 | |||
205 | /******************************************************************************* | ||
206 | * | ||
207 | * FUNCTION: acpi_ut_match_resource_name | ||
208 | * | ||
209 | * PARAMETERS: name - Name to find | ||
210 | * | ||
211 | * RETURN: Pointer to entry in the resource table. NULL indicates not | ||
212 | * found. | ||
213 | * | ||
214 | * DESCRIPTION: Check an object name against the predefined resource | ||
215 | * descriptor object list. | ||
216 | * | ||
217 | ******************************************************************************/ | ||
218 | |||
219 | const union acpi_predefined_info *acpi_ut_match_resource_name(char *name) | ||
220 | { | ||
221 | const union acpi_predefined_info *this_name; | ||
222 | |||
223 | /* Quick check for a predefined name, first character must be underscore */ | ||
224 | |||
225 | if (name[0] != '_') { | ||
226 | return (NULL); | ||
227 | } | ||
228 | |||
229 | /* Search info table for a predefined method/object name */ | ||
230 | |||
231 | this_name = acpi_gbl_resource_names; | ||
232 | while (this_name->info.name[0]) { | ||
233 | if (ACPI_COMPARE_NAME(name, this_name->info.name)) { | ||
234 | return (this_name); | ||
235 | } | ||
236 | |||
237 | this_name++; | ||
238 | } | ||
239 | |||
240 | return (NULL); /* Not found */ | ||
241 | } | ||
242 | |||
243 | /******************************************************************************* | ||
244 | * | ||
245 | * FUNCTION: acpi_ut_display_predefined_method | ||
246 | * | ||
247 | * PARAMETERS: buffer - Scratch buffer for this function | ||
248 | * this_name - Entry in the predefined method/name table | ||
249 | * multi_line - TRUE if output should be on >1 line | ||
250 | * | ||
251 | * RETURN: None | ||
252 | * | ||
253 | * DESCRIPTION: Display information about a predefined method. Number and | ||
254 | * type of the input arguments, and expected type(s) for the | ||
255 | * return value, if any. | ||
256 | * | ||
257 | ******************************************************************************/ | ||
258 | |||
259 | void | ||
260 | acpi_ut_display_predefined_method(char *buffer, | ||
261 | const union acpi_predefined_info *this_name, | ||
262 | u8 multi_line) | ||
263 | { | ||
264 | u32 arg_count; | ||
265 | |||
266 | /* | ||
267 | * Get the argument count and the string buffer | ||
268 | * containing all argument types | ||
269 | */ | ||
270 | arg_count = acpi_ut_get_argument_types(buffer, | ||
271 | this_name->info.argument_list); | ||
272 | |||
273 | if (multi_line) { | ||
274 | printf(" "); | ||
275 | } | ||
276 | |||
277 | printf("%4.4s Requires %s%u argument%s", | ||
278 | this_name->info.name, | ||
279 | (this_name->info.argument_list & ARG_COUNT_IS_MINIMUM) ? | ||
280 | "(at least) " : "", arg_count, arg_count != 1 ? "s" : ""); | ||
281 | |||
282 | /* Display the types for any arguments */ | ||
283 | |||
284 | if (arg_count > 0) { | ||
285 | printf(" (%s)", buffer); | ||
286 | } | ||
287 | |||
288 | if (multi_line) { | ||
289 | printf("\n "); | ||
290 | } | ||
291 | |||
292 | /* Get the return value type(s) allowed */ | ||
293 | |||
294 | if (this_name->info.expected_btypes) { | ||
295 | acpi_ut_get_expected_return_types(buffer, | ||
296 | this_name->info. | ||
297 | expected_btypes); | ||
298 | printf(" Return value types: %s\n", buffer); | ||
299 | } else { | ||
300 | printf(" No return value\n"); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | /******************************************************************************* | ||
305 | * | ||
306 | * FUNCTION: acpi_ut_get_argument_types | ||
307 | * | ||
308 | * PARAMETERS: buffer - Where to return the formatted types | ||
309 | * argument_types - Types field for this method | ||
310 | * | ||
311 | * RETURN: count - the number of arguments required for this method | ||
312 | * | ||
313 | * DESCRIPTION: Format the required data types for this method (Integer, | ||
314 | * String, Buffer, or Package) and return the required argument | ||
315 | * count. | ||
316 | * | ||
317 | ******************************************************************************/ | ||
318 | |||
319 | static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types) | ||
320 | { | ||
321 | u16 this_argument_type; | ||
322 | u16 sub_index; | ||
323 | u16 arg_count; | ||
324 | u32 i; | ||
325 | |||
326 | *buffer = 0; | ||
327 | sub_index = 2; | ||
328 | |||
329 | /* First field in the types list is the count of args to follow */ | ||
330 | |||
331 | arg_count = (argument_types & METHOD_ARG_MASK); | ||
332 | argument_types >>= METHOD_ARG_BIT_WIDTH; | ||
333 | |||
334 | if (arg_count > METHOD_PREDEF_ARGS_MAX) { | ||
335 | printf("**** Invalid argument count (%u) " | ||
336 | "in predefined info structure\n", arg_count); | ||
337 | return (arg_count); | ||
338 | } | ||
339 | |||
340 | /* Get each argument from the list, convert to ascii, store to buffer */ | ||
341 | |||
342 | for (i = 0; i < arg_count; i++) { | ||
343 | this_argument_type = (argument_types & METHOD_ARG_MASK); | ||
344 | if (!this_argument_type | ||
345 | || (this_argument_type > METHOD_MAX_ARG_TYPE)) { | ||
346 | printf("**** Invalid argument type (%u) " | ||
347 | "in predefined info structure\n", | ||
348 | this_argument_type); | ||
349 | return (arg_count); | ||
350 | } | ||
351 | |||
352 | strcat(buffer, | ||
353 | ut_external_type_names[this_argument_type] + sub_index); | ||
354 | |||
355 | /* Shift to next argument type field */ | ||
356 | |||
357 | argument_types >>= METHOD_ARG_BIT_WIDTH; | ||
358 | sub_index = 0; | ||
359 | } | ||
360 | |||
361 | return (arg_count); | ||
362 | } | ||
363 | |||
364 | /******************************************************************************* | ||
365 | * | ||
366 | * FUNCTION: acpi_ut_get_resource_bit_width | ||
367 | * | ||
368 | * PARAMETERS: buffer - Where the formatted string is returned | ||
369 | * types - Bitfield of expected data types | ||
370 | * | ||
371 | * RETURN: Count of return types. Formatted string in Buffer. | ||
372 | * | ||
373 | * DESCRIPTION: Format the resource bit widths into a printable string. | ||
374 | * | ||
375 | ******************************************************************************/ | ||
376 | |||
377 | u32 acpi_ut_get_resource_bit_width(char *buffer, u16 types) | ||
378 | { | ||
379 | u32 i; | ||
380 | u16 sub_index; | ||
381 | u32 found; | ||
382 | |||
383 | *buffer = 0; | ||
384 | sub_index = 1; | ||
385 | found = 0; | ||
386 | |||
387 | for (i = 0; i < NUM_RESOURCE_WIDTHS; i++) { | ||
388 | if (types & 1) { | ||
389 | strcat(buffer, &(ut_resource_type_names[i][sub_index])); | ||
390 | sub_index = 0; | ||
391 | found++; | ||
392 | } | ||
393 | |||
394 | types >>= 1; | ||
395 | } | ||
396 | |||
397 | return (found); | ||
398 | } | ||
399 | #endif | ||
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 48efb446258c..6505774f223e 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -287,7 +287,10 @@ acpi_status acpi_install_interface(acpi_string interface_name) | |||
287 | return (AE_BAD_PARAMETER); | 287 | return (AE_BAD_PARAMETER); |
288 | } | 288 | } |
289 | 289 | ||
290 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | 290 | status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); |
291 | if (ACPI_FAILURE(status)) { | ||
292 | return (status); | ||
293 | } | ||
291 | 294 | ||
292 | /* Check if the interface name is already in the global list */ | 295 | /* Check if the interface name is already in the global list */ |
293 | 296 | ||
@@ -336,7 +339,10 @@ acpi_status acpi_remove_interface(acpi_string interface_name) | |||
336 | return (AE_BAD_PARAMETER); | 339 | return (AE_BAD_PARAMETER); |
337 | } | 340 | } |
338 | 341 | ||
339 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | 342 | status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); |
343 | if (ACPI_FAILURE(status)) { | ||
344 | return (status); | ||
345 | } | ||
340 | 346 | ||
341 | status = acpi_ut_remove_interface(interface_name); | 347 | status = acpi_ut_remove_interface(interface_name); |
342 | 348 | ||
@@ -362,9 +368,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_interface) | |||
362 | ****************************************************************************/ | 368 | ****************************************************************************/ |
363 | acpi_status acpi_install_interface_handler(acpi_interface_handler handler) | 369 | acpi_status acpi_install_interface_handler(acpi_interface_handler handler) |
364 | { | 370 | { |
365 | acpi_status status = AE_OK; | 371 | acpi_status status; |
366 | 372 | ||
367 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | 373 | status = acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); |
374 | if (ACPI_FAILURE(status)) { | ||
375 | return (status); | ||
376 | } | ||
368 | 377 | ||
369 | if (handler && acpi_gbl_interface_handler) { | 378 | if (handler && acpi_gbl_interface_handler) { |
370 | status = AE_ALREADY_EXISTS; | 379 | status = AE_ALREADY_EXISTS; |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index c5cd5b5513e6..0cc384b72943 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -146,7 +146,7 @@ struct acpi_battery { | |||
146 | 146 | ||
147 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat) | 147 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat) |
148 | 148 | ||
149 | inline int acpi_battery_present(struct acpi_battery *battery) | 149 | static inline int acpi_battery_present(struct acpi_battery *battery) |
150 | { | 150 | { |
151 | return battery->device->status.battery_present; | 151 | return battery->device->status.battery_present; |
152 | } | 152 | } |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 01708a165368..292de3cab9cc 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -288,13 +288,12 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) | |||
288 | } | 288 | } |
289 | out_success: | 289 | out_success: |
290 | context->ret.length = out_obj->buffer.length; | 290 | context->ret.length = out_obj->buffer.length; |
291 | context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL); | 291 | context->ret.pointer = kmemdup(out_obj->buffer.pointer, |
292 | context->ret.length, GFP_KERNEL); | ||
292 | if (!context->ret.pointer) { | 293 | if (!context->ret.pointer) { |
293 | status = AE_NO_MEMORY; | 294 | status = AE_NO_MEMORY; |
294 | goto out_kfree; | 295 | goto out_kfree; |
295 | } | 296 | } |
296 | memcpy(context->ret.pointer, out_obj->buffer.pointer, | ||
297 | context->ret.length); | ||
298 | status = AE_OK; | 297 | status = AE_OK; |
299 | 298 | ||
300 | out_kfree: | 299 | out_kfree: |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 86c7d5445c38..92a659aa6396 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <acpi/acpi_bus.h> | 34 | #include <acpi/acpi_bus.h> |
35 | #include <acpi/acpi_drivers.h> | 35 | #include <acpi/acpi_drivers.h> |
36 | #include <acpi/button.h> | ||
36 | 37 | ||
37 | #define PREFIX "ACPI: " | 38 | #define PREFIX "ACPI: " |
38 | 39 | ||
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 5523ba7d764d..e23151667655 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * acpi_container.c - ACPI Generic Container Driver | 2 | * container.c - ACPI Generic Container Driver |
3 | * ($Revision: ) | ||
4 | * | 3 | * |
5 | * Copyright (C) 2004 Anil S Keshavamurthy (anil.s.keshavamurthy@intel.com) | 4 | * Copyright (C) 2004 Anil S Keshavamurthy (anil.s.keshavamurthy@intel.com) |
6 | * Copyright (C) 2004 Keiichiro Tokunaga (tokunaga.keiich@jp.fujitsu.com) | 5 | * Copyright (C) 2004 Keiichiro Tokunaga (tokunaga.keiich@jp.fujitsu.com) |
7 | * Copyright (C) 2004 Motoyuki Ito (motoyuki@soft.fujitsu.com) | 6 | * Copyright (C) 2004 Motoyuki Ito (motoyuki@soft.fujitsu.com) |
8 | * Copyright (C) 2004 Intel Corp. | ||
9 | * Copyright (C) 2004 FUJITSU LIMITED | 7 | * Copyright (C) 2004 FUJITSU LIMITED |
8 | * Copyright (C) 2004, 2013 Intel Corp. | ||
9 | * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
10 | * | 10 | * |
11 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 11 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
12 | * | 12 | * |
@@ -26,14 +26,11 @@ | |||
26 | * | 26 | * |
27 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 27 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
28 | */ | 28 | */ |
29 | #include <linux/kernel.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/init.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/types.h> | ||
34 | #include <linux/acpi.h> | 29 | #include <linux/acpi.h> |
35 | #include <acpi/acpi_bus.h> | 30 | |
36 | #include <acpi/acpi_drivers.h> | 31 | #include "internal.h" |
32 | |||
33 | #include "internal.h" | ||
37 | 34 | ||
38 | #define PREFIX "ACPI: " | 35 | #define PREFIX "ACPI: " |
39 | 36 | ||
@@ -50,141 +47,20 @@ static const struct acpi_device_id container_device_ids[] = { | |||
50 | static int container_device_attach(struct acpi_device *device, | 47 | static int container_device_attach(struct acpi_device *device, |
51 | const struct acpi_device_id *not_used) | 48 | const struct acpi_device_id *not_used) |
52 | { | 49 | { |
53 | /* | 50 | /* This is necessary for container hotplug to work. */ |
54 | * FIXME: This is necessary, so that acpi_eject_store() doesn't return | ||
55 | * -ENODEV for containers. | ||
56 | */ | ||
57 | return 1; | 51 | return 1; |
58 | } | 52 | } |
59 | 53 | ||
60 | static struct acpi_scan_handler container_device_handler = { | 54 | static struct acpi_scan_handler container_handler = { |
61 | .ids = container_device_ids, | 55 | .ids = container_device_ids, |
62 | .attach = container_device_attach, | 56 | .attach = container_device_attach, |
57 | .hotplug = { | ||
58 | .enabled = true, | ||
59 | .mode = AHM_CONTAINER, | ||
60 | }, | ||
63 | }; | 61 | }; |
64 | 62 | ||
65 | static int is_device_present(acpi_handle handle) | ||
66 | { | ||
67 | acpi_handle temp; | ||
68 | acpi_status status; | ||
69 | unsigned long long sta; | ||
70 | |||
71 | |||
72 | status = acpi_get_handle(handle, "_STA", &temp); | ||
73 | if (ACPI_FAILURE(status)) | ||
74 | return 1; /* _STA not found, assume device present */ | ||
75 | |||
76 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
77 | if (ACPI_FAILURE(status)) | ||
78 | return 0; /* Firmware error */ | ||
79 | |||
80 | return ((sta & ACPI_STA_DEVICE_PRESENT) == ACPI_STA_DEVICE_PRESENT); | ||
81 | } | ||
82 | |||
83 | static void container_notify_cb(acpi_handle handle, u32 type, void *context) | ||
84 | { | ||
85 | struct acpi_device *device = NULL; | ||
86 | int result; | ||
87 | int present; | ||
88 | acpi_status status; | ||
89 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | ||
90 | |||
91 | acpi_scan_lock_acquire(); | ||
92 | |||
93 | switch (type) { | ||
94 | case ACPI_NOTIFY_BUS_CHECK: | ||
95 | /* Fall through */ | ||
96 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
97 | pr_debug("Container driver received %s event\n", | ||
98 | (type == ACPI_NOTIFY_BUS_CHECK) ? | ||
99 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); | ||
100 | |||
101 | present = is_device_present(handle); | ||
102 | status = acpi_bus_get_device(handle, &device); | ||
103 | if (!present) { | ||
104 | if (ACPI_SUCCESS(status)) { | ||
105 | /* device exist and this is a remove request */ | ||
106 | device->flags.eject_pending = 1; | ||
107 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | ||
108 | goto out; | ||
109 | } | ||
110 | break; | ||
111 | } | ||
112 | |||
113 | if (!ACPI_FAILURE(status) || device) | ||
114 | break; | ||
115 | |||
116 | result = acpi_bus_scan(handle); | ||
117 | if (result) { | ||
118 | acpi_handle_warn(handle, "Failed to add container\n"); | ||
119 | break; | ||
120 | } | ||
121 | result = acpi_bus_get_device(handle, &device); | ||
122 | if (result) { | ||
123 | acpi_handle_warn(handle, "Missing device object\n"); | ||
124 | break; | ||
125 | } | ||
126 | |||
127 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); | ||
128 | ost_code = ACPI_OST_SC_SUCCESS; | ||
129 | break; | ||
130 | |||
131 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
132 | if (!acpi_bus_get_device(handle, &device) && device) { | ||
133 | device->flags.eject_pending = 1; | ||
134 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | ||
135 | goto out; | ||
136 | } | ||
137 | break; | ||
138 | |||
139 | default: | ||
140 | /* non-hotplug event; possibly handled by other handler */ | ||
141 | goto out; | ||
142 | } | ||
143 | |||
144 | /* Inform firmware that the hotplug operation has completed */ | ||
145 | (void) acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); | ||
146 | |||
147 | out: | ||
148 | acpi_scan_lock_release(); | ||
149 | } | ||
150 | |||
151 | static bool is_container(acpi_handle handle) | ||
152 | { | ||
153 | struct acpi_device_info *info; | ||
154 | bool ret = false; | ||
155 | |||
156 | if (ACPI_FAILURE(acpi_get_object_info(handle, &info))) | ||
157 | return false; | ||
158 | |||
159 | if (info->valid & ACPI_VALID_HID) { | ||
160 | const struct acpi_device_id *id; | ||
161 | |||
162 | for (id = container_device_ids; id->id[0]; id++) { | ||
163 | ret = !strcmp((char *)id->id, info->hardware_id.string); | ||
164 | if (ret) | ||
165 | break; | ||
166 | } | ||
167 | } | ||
168 | kfree(info); | ||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | static acpi_status acpi_container_register_notify_handler(acpi_handle handle, | ||
173 | u32 lvl, void *ctxt, | ||
174 | void **retv) | ||
175 | { | ||
176 | if (is_container(handle)) | ||
177 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
178 | container_notify_cb, NULL); | ||
179 | |||
180 | return AE_OK; | ||
181 | } | ||
182 | |||
183 | void __init acpi_container_init(void) | 63 | void __init acpi_container_init(void) |
184 | { | 64 | { |
185 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | 65 | acpi_scan_add_handler_with_hotplug(&container_handler, "container"); |
186 | acpi_container_register_notify_handler, NULL, | ||
187 | NULL, NULL); | ||
188 | |||
189 | acpi_scan_add_handler(&container_device_handler); | ||
190 | } | 66 | } |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index dd314ef9bff1..96de787e6104 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -145,27 +145,36 @@ int acpi_device_get_power(struct acpi_device *device, int *state) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | /* | 147 | /* |
148 | * Get the device's power state either directly (via _PSC) or | 148 | * Get the device's power state from power resources settings and _PSC, |
149 | * indirectly (via power resources). | 149 | * if available. |
150 | */ | 150 | */ |
151 | if (device->power.flags.power_resources) { | ||
152 | int error = acpi_power_get_inferred_state(device, &result); | ||
153 | if (error) | ||
154 | return error; | ||
155 | } | ||
151 | if (device->power.flags.explicit_get) { | 156 | if (device->power.flags.explicit_get) { |
157 | acpi_handle handle = device->handle; | ||
152 | unsigned long long psc; | 158 | unsigned long long psc; |
153 | acpi_status status = acpi_evaluate_integer(device->handle, | 159 | acpi_status status; |
154 | "_PSC", NULL, &psc); | 160 | |
161 | status = acpi_evaluate_integer(handle, "_PSC", NULL, &psc); | ||
155 | if (ACPI_FAILURE(status)) | 162 | if (ACPI_FAILURE(status)) |
156 | return -ENODEV; | 163 | return -ENODEV; |
157 | 164 | ||
158 | result = psc; | 165 | /* |
159 | } | 166 | * The power resources settings may indicate a power state |
160 | /* The test below covers ACPI_STATE_UNKNOWN too. */ | 167 | * shallower than the actual power state of the device. |
161 | if (result <= ACPI_STATE_D2) { | 168 | * |
162 | ; /* Do nothing. */ | 169 | * Moreover, on systems predating ACPI 4.0, if the device |
163 | } else if (device->power.flags.power_resources) { | 170 | * doesn't depend on any power resources and _PSC returns 3, |
164 | int error = acpi_power_get_inferred_state(device, &result); | 171 | * that means "power off". We need to maintain compatibility |
165 | if (error) | 172 | * with those systems. |
166 | return error; | 173 | */ |
167 | } else if (result == ACPI_STATE_D3_HOT) { | 174 | if (psc > result && psc < ACPI_STATE_D3_COLD) |
168 | result = ACPI_STATE_D3; | 175 | result = psc; |
176 | else if (result == ACPI_STATE_UNKNOWN) | ||
177 | result = psc > ACPI_STATE_D2 ? ACPI_STATE_D3_COLD : psc; | ||
169 | } | 178 | } |
170 | 179 | ||
171 | /* | 180 | /* |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index f815da82c765..8d1c0105e113 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -174,9 +174,13 @@ static int acpi_fan_add(struct acpi_device *device) | |||
174 | 174 | ||
175 | static int acpi_fan_remove(struct acpi_device *device) | 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; |
178 | |||
179 | if (!device) | ||
180 | return -EINVAL; | ||
178 | 181 | ||
179 | if (!device || !cdev) | 182 | cdev = acpi_driver_data(device); |
183 | if (!cdev) | ||
180 | return -EINVAL; | 184 | return -EINVAL; |
181 | 185 | ||
182 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | 186 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 3c94a732b4b3..6f1afd9118c8 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -41,6 +41,17 @@ void acpi_container_init(void); | |||
41 | #else | 41 | #else |
42 | static inline void acpi_container_init(void) {} | 42 | static inline void acpi_container_init(void) {} |
43 | #endif | 43 | #endif |
44 | #ifdef CONFIG_ACPI_HOTPLUG_MEMORY | ||
45 | void acpi_memory_hotplug_init(void); | ||
46 | #else | ||
47 | static inline void acpi_memory_hotplug_init(void) {} | ||
48 | #endif | ||
49 | |||
50 | void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, | ||
51 | const char *name); | ||
52 | int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler, | ||
53 | const char *hotplug_profile_name); | ||
54 | void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val); | ||
44 | 55 | ||
45 | #ifdef CONFIG_DEBUG_FS | 56 | #ifdef CONFIG_DEBUG_FS |
46 | extern struct dentry *acpi_debugfs_dir; | 57 | extern struct dentry *acpi_debugfs_dir; |
@@ -48,6 +59,11 @@ int acpi_debugfs_init(void); | |||
48 | #else | 59 | #else |
49 | static inline void acpi_debugfs_init(void) { return; } | 60 | static inline void acpi_debugfs_init(void) { return; } |
50 | #endif | 61 | #endif |
62 | #ifdef CONFIG_X86_INTEL_LPSS | ||
63 | void acpi_lpss_init(void); | ||
64 | #else | ||
65 | static inline void acpi_lpss_init(void) {} | ||
66 | #endif | ||
51 | 67 | ||
52 | /* -------------------------------------------------------------------------- | 68 | /* -------------------------------------------------------------------------- |
53 | Device Node Initialization / Removal | 69 | Device Node Initialization / Removal |
@@ -60,7 +76,7 @@ int acpi_device_add(struct acpi_device *device, | |||
60 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | 76 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, |
61 | int type, unsigned long long sta); | 77 | int type, unsigned long long sta); |
62 | void acpi_device_add_finalize(struct acpi_device *device); | 78 | void acpi_device_add_finalize(struct acpi_device *device); |
63 | void acpi_free_ids(struct acpi_device *device); | 79 | void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); |
64 | 80 | ||
65 | /* -------------------------------------------------------------------------- | 81 | /* -------------------------------------------------------------------------- |
66 | Power Resource | 82 | Power Resource |
@@ -131,4 +147,7 @@ static inline void suspend_nvs_restore(void) {} | |||
131 | -------------------------------------------------------------------------- */ | 147 | -------------------------------------------------------------------------- */ |
132 | struct platform_device; | 148 | struct platform_device; |
133 | 149 | ||
150 | int acpi_create_platform_device(struct acpi_device *adev, | ||
151 | const struct acpi_device_id *id); | ||
152 | |||
134 | #endif /* _ACPI_INTERNAL_H_ */ | 153 | #endif /* _ACPI_INTERNAL_H_ */ |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 586e7e993d3d..e72186340fec 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -641,7 +641,7 @@ void __init acpi_initrd_override(void *data, size_t size) | |||
641 | * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area) | 641 | * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area) |
642 | * works fine. | 642 | * works fine. |
643 | */ | 643 | */ |
644 | memblock_reserve(acpi_tables_addr, acpi_tables_addr + all_tables_size); | 644 | memblock_reserve(acpi_tables_addr, all_tables_size); |
645 | arch_reserve_mem_area(acpi_tables_addr, all_tables_size); | 645 | arch_reserve_mem_area(acpi_tables_addr, all_tables_size); |
646 | 646 | ||
647 | p = early_ioremap(acpi_tables_addr, all_tables_size); | 647 | p = early_ioremap(acpi_tables_addr, all_tables_size); |
@@ -1555,7 +1555,7 @@ int acpi_check_resource_conflict(const struct resource *res) | |||
1555 | else | 1555 | else |
1556 | space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY; | 1556 | space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY; |
1557 | 1557 | ||
1558 | length = res->end - res->start + 1; | 1558 | length = resource_size(res); |
1559 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) | 1559 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) |
1560 | warn = 1; | 1560 | warn = 1; |
1561 | clash = acpi_check_address_range(space_id, res->start, length, warn); | 1561 | clash = acpi_check_address_range(space_id, res->start, length, warn); |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index ab764ed34a50..2652a614deeb 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -354,6 +354,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | |||
354 | 354 | ||
355 | } | 355 | } |
356 | resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; | 356 | resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; |
357 | resource->end.length = sizeof(struct acpi_resource); | ||
357 | 358 | ||
358 | /* Attempt to set the resource */ | 359 | /* Attempt to set the resource */ |
359 | status = acpi_set_current_resources(link->device->handle, &buffer); | 360 | status = acpi_set_current_resources(link->device->handle, &buffer); |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index ac8688b89705..1dd6f6c85874 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -169,8 +169,8 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, | |||
169 | *control &= OSC_PCI_CONTROL_MASKS; | 169 | *control &= OSC_PCI_CONTROL_MASKS; |
170 | capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set; | 170 | capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set; |
171 | } else { | 171 | } else { |
172 | /* Run _OSC query for all possible controls. */ | 172 | /* Run _OSC query only with existing controls. */ |
173 | capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS; | 173 | capbuf[OSC_CONTROL_TYPE] = root->osc_control_set; |
174 | } | 174 | } |
175 | 175 | ||
176 | status = acpi_pci_run_osc(root->device->handle, capbuf, &result); | 176 | status = acpi_pci_run_osc(root->device->handle, capbuf, &result); |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 34f5ef11d427..f962047c6c85 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -459,57 +459,79 @@ static struct attribute_group attr_groups[] = { | |||
459 | }, | 459 | }, |
460 | }; | 460 | }; |
461 | 461 | ||
462 | static void acpi_power_hide_list(struct acpi_device *adev, int state) | 462 | static struct attribute_group wakeup_attr_group = { |
463 | .name = "power_resources_wakeup", | ||
464 | .attrs = attrs, | ||
465 | }; | ||
466 | |||
467 | static void acpi_power_hide_list(struct acpi_device *adev, | ||
468 | struct list_head *resources, | ||
469 | struct attribute_group *attr_group) | ||
463 | { | 470 | { |
464 | struct acpi_device_power_state *ps = &adev->power.states[state]; | ||
465 | struct acpi_power_resource_entry *entry; | 471 | struct acpi_power_resource_entry *entry; |
466 | 472 | ||
467 | if (list_empty(&ps->resources)) | 473 | if (list_empty(resources)) |
468 | return; | 474 | return; |
469 | 475 | ||
470 | list_for_each_entry_reverse(entry, &ps->resources, node) { | 476 | list_for_each_entry_reverse(entry, resources, node) { |
471 | struct acpi_device *res_dev = &entry->resource->device; | 477 | struct acpi_device *res_dev = &entry->resource->device; |
472 | 478 | ||
473 | sysfs_remove_link_from_group(&adev->dev.kobj, | 479 | sysfs_remove_link_from_group(&adev->dev.kobj, |
474 | attr_groups[state].name, | 480 | attr_group->name, |
475 | dev_name(&res_dev->dev)); | 481 | dev_name(&res_dev->dev)); |
476 | } | 482 | } |
477 | sysfs_remove_group(&adev->dev.kobj, &attr_groups[state]); | 483 | sysfs_remove_group(&adev->dev.kobj, attr_group); |
478 | } | 484 | } |
479 | 485 | ||
480 | static void acpi_power_expose_list(struct acpi_device *adev, int state) | 486 | static void acpi_power_expose_list(struct acpi_device *adev, |
487 | struct list_head *resources, | ||
488 | struct attribute_group *attr_group) | ||
481 | { | 489 | { |
482 | struct acpi_device_power_state *ps = &adev->power.states[state]; | ||
483 | struct acpi_power_resource_entry *entry; | 490 | struct acpi_power_resource_entry *entry; |
484 | int ret; | 491 | int ret; |
485 | 492 | ||
486 | if (list_empty(&ps->resources)) | 493 | if (list_empty(resources)) |
487 | return; | 494 | return; |
488 | 495 | ||
489 | ret = sysfs_create_group(&adev->dev.kobj, &attr_groups[state]); | 496 | ret = sysfs_create_group(&adev->dev.kobj, attr_group); |
490 | if (ret) | 497 | if (ret) |
491 | return; | 498 | return; |
492 | 499 | ||
493 | list_for_each_entry(entry, &ps->resources, node) { | 500 | list_for_each_entry(entry, resources, node) { |
494 | struct acpi_device *res_dev = &entry->resource->device; | 501 | struct acpi_device *res_dev = &entry->resource->device; |
495 | 502 | ||
496 | ret = sysfs_add_link_to_group(&adev->dev.kobj, | 503 | ret = sysfs_add_link_to_group(&adev->dev.kobj, |
497 | attr_groups[state].name, | 504 | attr_group->name, |
498 | &res_dev->dev.kobj, | 505 | &res_dev->dev.kobj, |
499 | dev_name(&res_dev->dev)); | 506 | dev_name(&res_dev->dev)); |
500 | if (ret) { | 507 | if (ret) { |
501 | acpi_power_hide_list(adev, state); | 508 | acpi_power_hide_list(adev, resources, attr_group); |
502 | break; | 509 | break; |
503 | } | 510 | } |
504 | } | 511 | } |
505 | } | 512 | } |
506 | 513 | ||
514 | static void acpi_power_expose_hide(struct acpi_device *adev, | ||
515 | struct list_head *resources, | ||
516 | struct attribute_group *attr_group, | ||
517 | bool expose) | ||
518 | { | ||
519 | if (expose) | ||
520 | acpi_power_expose_list(adev, resources, attr_group); | ||
521 | else | ||
522 | acpi_power_hide_list(adev, resources, attr_group); | ||
523 | } | ||
524 | |||
507 | void acpi_power_add_remove_device(struct acpi_device *adev, bool add) | 525 | void acpi_power_add_remove_device(struct acpi_device *adev, bool add) |
508 | { | 526 | { |
509 | struct acpi_device_power_state *ps; | 527 | struct acpi_device_power_state *ps; |
510 | struct acpi_power_resource_entry *entry; | 528 | struct acpi_power_resource_entry *entry; |
511 | int state; | 529 | int state; |
512 | 530 | ||
531 | if (adev->wakeup.flags.valid) | ||
532 | acpi_power_expose_hide(adev, &adev->wakeup.resources, | ||
533 | &wakeup_attr_group, add); | ||
534 | |||
513 | if (!adev->power.flags.power_resources) | 535 | if (!adev->power.flags.power_resources) |
514 | return; | 536 | return; |
515 | 537 | ||
@@ -523,12 +545,10 @@ void acpi_power_add_remove_device(struct acpi_device *adev, bool add) | |||
523 | acpi_power_remove_dependent(resource, adev); | 545 | acpi_power_remove_dependent(resource, adev); |
524 | } | 546 | } |
525 | 547 | ||
526 | for (state = ACPI_STATE_D0; state <= ACPI_STATE_D3_HOT; state++) { | 548 | for (state = ACPI_STATE_D0; state <= ACPI_STATE_D3_HOT; state++) |
527 | if (add) | 549 | acpi_power_expose_hide(adev, |
528 | acpi_power_expose_list(adev, state); | 550 | &adev->power.states[state].resources, |
529 | else | 551 | &attr_groups[state], add); |
530 | acpi_power_hide_list(adev, state); | ||
531 | } | ||
532 | } | 552 | } |
533 | 553 | ||
534 | int acpi_power_wakeup_list_init(struct list_head *list, int *system_level_p) | 554 | int acpi_power_wakeup_list_init(struct list_head *list, int *system_level_p) |
@@ -824,7 +844,7 @@ static void acpi_release_power_resource(struct device *dev) | |||
824 | list_del(&resource->list_node); | 844 | list_del(&resource->list_node); |
825 | mutex_unlock(&power_resource_list_lock); | 845 | mutex_unlock(&power_resource_list_lock); |
826 | 846 | ||
827 | acpi_free_ids(device); | 847 | acpi_free_pnp_ids(&device->pnp); |
828 | kfree(resource); | 848 | kfree(resource); |
829 | } | 849 | } |
830 | 850 | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index ee255c60bdac..f0df2c9434d2 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -918,7 +918,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
918 | struct cpuidle_driver acpi_idle_driver = { | 918 | struct cpuidle_driver acpi_idle_driver = { |
919 | .name = "acpi_idle", | 919 | .name = "acpi_idle", |
920 | .owner = THIS_MODULE, | 920 | .owner = THIS_MODULE, |
921 | .en_core_tk_irqen = 1, | ||
922 | }; | 921 | }; |
923 | 922 | ||
924 | /** | 923 | /** |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 641b5450a0db..e8e652710e65 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -218,9 +218,13 @@ processor_get_max_state(struct thermal_cooling_device *cdev, | |||
218 | unsigned long *state) | 218 | unsigned long *state) |
219 | { | 219 | { |
220 | struct acpi_device *device = cdev->devdata; | 220 | struct acpi_device *device = cdev->devdata; |
221 | struct acpi_processor *pr = acpi_driver_data(device); | 221 | struct acpi_processor *pr; |
222 | 222 | ||
223 | if (!device || !pr) | 223 | if (!device) |
224 | return -EINVAL; | ||
225 | |||
226 | pr = acpi_driver_data(device); | ||
227 | if (!pr) | ||
224 | return -EINVAL; | 228 | return -EINVAL; |
225 | 229 | ||
226 | *state = acpi_processor_max_state(pr); | 230 | *state = acpi_processor_max_state(pr); |
@@ -232,9 +236,13 @@ processor_get_cur_state(struct thermal_cooling_device *cdev, | |||
232 | unsigned long *cur_state) | 236 | unsigned long *cur_state) |
233 | { | 237 | { |
234 | struct acpi_device *device = cdev->devdata; | 238 | struct acpi_device *device = cdev->devdata; |
235 | struct acpi_processor *pr = acpi_driver_data(device); | 239 | struct acpi_processor *pr; |
236 | 240 | ||
237 | if (!device || !pr) | 241 | if (!device) |
242 | return -EINVAL; | ||
243 | |||
244 | pr = acpi_driver_data(device); | ||
245 | if (!pr) | ||
238 | return -EINVAL; | 246 | return -EINVAL; |
239 | 247 | ||
240 | *cur_state = cpufreq_get_cur_state(pr->id); | 248 | *cur_state = cpufreq_get_cur_state(pr->id); |
@@ -248,11 +256,15 @@ processor_set_cur_state(struct thermal_cooling_device *cdev, | |||
248 | unsigned long state) | 256 | unsigned long state) |
249 | { | 257 | { |
250 | struct acpi_device *device = cdev->devdata; | 258 | struct acpi_device *device = cdev->devdata; |
251 | struct acpi_processor *pr = acpi_driver_data(device); | 259 | struct acpi_processor *pr; |
252 | int result = 0; | 260 | int result = 0; |
253 | int max_pstate; | 261 | int max_pstate; |
254 | 262 | ||
255 | if (!device || !pr) | 263 | if (!device) |
264 | return -EINVAL; | ||
265 | |||
266 | pr = acpi_driver_data(device); | ||
267 | if (!pr) | ||
256 | return -EINVAL; | 268 | return -EINVAL; |
257 | 269 | ||
258 | max_pstate = cpufreq_get_max_state(pr->id); | 270 | max_pstate = cpufreq_get_max_state(pr->id); |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 1d02b7b5ade0..e7dd2c1fee79 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -211,9 +211,10 @@ err_ret: | |||
211 | */ | 211 | */ |
212 | void acpi_processor_throttling_init(void) | 212 | void acpi_processor_throttling_init(void) |
213 | { | 213 | { |
214 | if (acpi_processor_update_tsd_coord()) | 214 | if (acpi_processor_update_tsd_coord()) { |
215 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 215 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
216 | "Assume no T-state coordination\n")); | 216 | "Assume no T-state coordination\n")); |
217 | } | ||
217 | 218 | ||
218 | return; | 219 | return; |
219 | } | 220 | } |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index f54d1985e594..fe158fd4f1df 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -63,6 +63,19 @@ int acpi_scan_add_handler(struct acpi_scan_handler *handler) | |||
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
66 | int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler, | ||
67 | const char *hotplug_profile_name) | ||
68 | { | ||
69 | int error; | ||
70 | |||
71 | error = acpi_scan_add_handler(handler); | ||
72 | if (error) | ||
73 | return error; | ||
74 | |||
75 | acpi_sysfs_add_hotplug_profile(&handler->hotplug, hotplug_profile_name); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
66 | /* | 79 | /* |
67 | * Creates hid/cid(s) string needed for modalias and uevent | 80 | * Creates hid/cid(s) string needed for modalias and uevent |
68 | * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: | 81 | * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: |
@@ -107,32 +120,20 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha | |||
107 | } | 120 | } |
108 | static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); | 121 | static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); |
109 | 122 | ||
110 | /** | 123 | static int acpi_scan_hot_remove(struct acpi_device *device) |
111 | * acpi_bus_hot_remove_device: hot-remove a device and its children | ||
112 | * @context: struct acpi_eject_event pointer (freed in this func) | ||
113 | * | ||
114 | * Hot-remove a device and its children. This function frees up the | ||
115 | * memory space passed by arg context, so that the caller may call | ||
116 | * this function asynchronously through acpi_os_hotplug_execute(). | ||
117 | */ | ||
118 | void acpi_bus_hot_remove_device(void *context) | ||
119 | { | 124 | { |
120 | struct acpi_eject_event *ej_event = context; | ||
121 | struct acpi_device *device = ej_event->device; | ||
122 | acpi_handle handle = device->handle; | 125 | acpi_handle handle = device->handle; |
123 | acpi_handle temp; | 126 | acpi_handle not_used; |
124 | struct acpi_object_list arg_list; | 127 | struct acpi_object_list arg_list; |
125 | union acpi_object arg; | 128 | union acpi_object arg; |
126 | acpi_status status = AE_OK; | 129 | acpi_status status; |
127 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 130 | unsigned long long sta; |
128 | |||
129 | mutex_lock(&acpi_scan_lock); | ||
130 | 131 | ||
131 | /* If there is no handle, the device node has been unregistered. */ | 132 | /* If there is no handle, the device node has been unregistered. */ |
132 | if (!device->handle) { | 133 | if (!handle) { |
133 | dev_dbg(&device->dev, "ACPI handle missing\n"); | 134 | dev_dbg(&device->dev, "ACPI handle missing\n"); |
134 | put_device(&device->dev); | 135 | put_device(&device->dev); |
135 | goto out; | 136 | return -EINVAL; |
136 | } | 137 | } |
137 | 138 | ||
138 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 139 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -143,7 +144,7 @@ void acpi_bus_hot_remove_device(void *context) | |||
143 | put_device(&device->dev); | 144 | put_device(&device->dev); |
144 | device = NULL; | 145 | device = NULL; |
145 | 146 | ||
146 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_LCK", &temp))) { | 147 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_LCK", ¬_used))) { |
147 | arg_list.count = 1; | 148 | arg_list.count = 1; |
148 | arg_list.pointer = &arg; | 149 | arg_list.pointer = &arg; |
149 | arg.type = ACPI_TYPE_INTEGER; | 150 | arg.type = ACPI_TYPE_INTEGER; |
@@ -161,18 +162,205 @@ void acpi_bus_hot_remove_device(void *context) | |||
161 | */ | 162 | */ |
162 | status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); | 163 | status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); |
163 | if (ACPI_FAILURE(status)) { | 164 | if (ACPI_FAILURE(status)) { |
164 | if (status != AE_NOT_FOUND) | 165 | if (status == AE_NOT_FOUND) { |
165 | acpi_handle_warn(handle, "Eject failed\n"); | 166 | return -ENODEV; |
167 | } else { | ||
168 | acpi_handle_warn(handle, "Eject failed (0x%x)\n", | ||
169 | status); | ||
170 | return -EIO; | ||
171 | } | ||
172 | } | ||
166 | 173 | ||
167 | /* Tell the firmware the hot-remove operation has failed. */ | 174 | /* |
168 | acpi_evaluate_hotplug_ost(handle, ej_event->event, | 175 | * Verify if eject was indeed successful. If not, log an error |
169 | ost_code, NULL); | 176 | * message. No need to call _OST since _EJ0 call was made OK. |
177 | */ | ||
178 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
179 | if (ACPI_FAILURE(status)) { | ||
180 | acpi_handle_warn(handle, | ||
181 | "Status check after eject failed (0x%x)\n", status); | ||
182 | } else if (sta & ACPI_STA_DEVICE_ENABLED) { | ||
183 | acpi_handle_warn(handle, | ||
184 | "Eject incomplete - status 0x%llx\n", sta); | ||
185 | } | ||
186 | |||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static void acpi_bus_device_eject(void *context) | ||
191 | { | ||
192 | acpi_handle handle = context; | ||
193 | struct acpi_device *device = NULL; | ||
194 | struct acpi_scan_handler *handler; | ||
195 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | ||
196 | |||
197 | mutex_lock(&acpi_scan_lock); | ||
198 | |||
199 | acpi_bus_get_device(handle, &device); | ||
200 | if (!device) | ||
201 | goto err_out; | ||
202 | |||
203 | handler = device->handler; | ||
204 | if (!handler || !handler->hotplug.enabled) { | ||
205 | ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED; | ||
206 | goto err_out; | ||
207 | } | ||
208 | acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST, | ||
209 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | ||
210 | if (handler->hotplug.mode == AHM_CONTAINER) { | ||
211 | device->flags.eject_pending = true; | ||
212 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | ||
213 | } else { | ||
214 | int error; | ||
215 | |||
216 | get_device(&device->dev); | ||
217 | error = acpi_scan_hot_remove(device); | ||
218 | if (error) | ||
219 | goto err_out; | ||
170 | } | 220 | } |
171 | 221 | ||
172 | out: | 222 | out: |
173 | mutex_unlock(&acpi_scan_lock); | 223 | mutex_unlock(&acpi_scan_lock); |
174 | kfree(context); | ||
175 | return; | 224 | return; |
225 | |||
226 | err_out: | ||
227 | acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST, ost_code, | ||
228 | NULL); | ||
229 | goto out; | ||
230 | } | ||
231 | |||
232 | static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source) | ||
233 | { | ||
234 | struct acpi_device *device = NULL; | ||
235 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; | ||
236 | int error; | ||
237 | |||
238 | mutex_lock(&acpi_scan_lock); | ||
239 | |||
240 | acpi_bus_get_device(handle, &device); | ||
241 | if (device) { | ||
242 | dev_warn(&device->dev, "Attempt to re-insert\n"); | ||
243 | goto out; | ||
244 | } | ||
245 | acpi_evaluate_hotplug_ost(handle, ost_source, | ||
246 | ACPI_OST_SC_INSERT_IN_PROGRESS, NULL); | ||
247 | error = acpi_bus_scan(handle); | ||
248 | if (error) { | ||
249 | acpi_handle_warn(handle, "Namespace scan failure\n"); | ||
250 | goto out; | ||
251 | } | ||
252 | error = acpi_bus_get_device(handle, &device); | ||
253 | if (error) { | ||
254 | acpi_handle_warn(handle, "Missing device node object\n"); | ||
255 | goto out; | ||
256 | } | ||
257 | ost_code = ACPI_OST_SC_SUCCESS; | ||
258 | if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER) | ||
259 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); | ||
260 | |||
261 | out: | ||
262 | acpi_evaluate_hotplug_ost(handle, ost_source, ost_code, NULL); | ||
263 | mutex_unlock(&acpi_scan_lock); | ||
264 | } | ||
265 | |||
266 | static void acpi_scan_bus_check(void *context) | ||
267 | { | ||
268 | acpi_scan_bus_device_check((acpi_handle)context, | ||
269 | ACPI_NOTIFY_BUS_CHECK); | ||
270 | } | ||
271 | |||
272 | static void acpi_scan_device_check(void *context) | ||
273 | { | ||
274 | acpi_scan_bus_device_check((acpi_handle)context, | ||
275 | ACPI_NOTIFY_DEVICE_CHECK); | ||
276 | } | ||
277 | |||
278 | static void acpi_hotplug_unsupported(acpi_handle handle, u32 type) | ||
279 | { | ||
280 | u32 ost_status; | ||
281 | |||
282 | switch (type) { | ||
283 | case ACPI_NOTIFY_BUS_CHECK: | ||
284 | acpi_handle_debug(handle, | ||
285 | "ACPI_NOTIFY_BUS_CHECK event: unsupported\n"); | ||
286 | ost_status = ACPI_OST_SC_INSERT_NOT_SUPPORTED; | ||
287 | break; | ||
288 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
289 | acpi_handle_debug(handle, | ||
290 | "ACPI_NOTIFY_DEVICE_CHECK event: unsupported\n"); | ||
291 | ost_status = ACPI_OST_SC_INSERT_NOT_SUPPORTED; | ||
292 | break; | ||
293 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
294 | acpi_handle_debug(handle, | ||
295 | "ACPI_NOTIFY_EJECT_REQUEST event: unsupported\n"); | ||
296 | ost_status = ACPI_OST_SC_EJECT_NOT_SUPPORTED; | ||
297 | break; | ||
298 | default: | ||
299 | /* non-hotplug event; possibly handled by other handler */ | ||
300 | return; | ||
301 | } | ||
302 | |||
303 | acpi_evaluate_hotplug_ost(handle, type, ost_status, NULL); | ||
304 | } | ||
305 | |||
306 | static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) | ||
307 | { | ||
308 | acpi_osd_exec_callback callback; | ||
309 | struct acpi_scan_handler *handler = data; | ||
310 | acpi_status status; | ||
311 | |||
312 | if (!handler->hotplug.enabled) | ||
313 | return acpi_hotplug_unsupported(handle, type); | ||
314 | |||
315 | switch (type) { | ||
316 | case ACPI_NOTIFY_BUS_CHECK: | ||
317 | acpi_handle_debug(handle, "ACPI_NOTIFY_BUS_CHECK event\n"); | ||
318 | callback = acpi_scan_bus_check; | ||
319 | break; | ||
320 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
321 | acpi_handle_debug(handle, "ACPI_NOTIFY_DEVICE_CHECK event\n"); | ||
322 | callback = acpi_scan_device_check; | ||
323 | break; | ||
324 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
325 | acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); | ||
326 | callback = acpi_bus_device_eject; | ||
327 | break; | ||
328 | default: | ||
329 | /* non-hotplug event; possibly handled by other handler */ | ||
330 | return; | ||
331 | } | ||
332 | status = acpi_os_hotplug_execute(callback, handle); | ||
333 | if (ACPI_FAILURE(status)) | ||
334 | acpi_evaluate_hotplug_ost(handle, type, | ||
335 | ACPI_OST_SC_NON_SPECIFIC_FAILURE, | ||
336 | NULL); | ||
337 | } | ||
338 | |||
339 | /** | ||
340 | * acpi_bus_hot_remove_device: hot-remove a device and its children | ||
341 | * @context: struct acpi_eject_event pointer (freed in this func) | ||
342 | * | ||
343 | * Hot-remove a device and its children. This function frees up the | ||
344 | * memory space passed by arg context, so that the caller may call | ||
345 | * this function asynchronously through acpi_os_hotplug_execute(). | ||
346 | */ | ||
347 | void acpi_bus_hot_remove_device(void *context) | ||
348 | { | ||
349 | struct acpi_eject_event *ej_event = context; | ||
350 | struct acpi_device *device = ej_event->device; | ||
351 | acpi_handle handle = device->handle; | ||
352 | int error; | ||
353 | |||
354 | mutex_lock(&acpi_scan_lock); | ||
355 | |||
356 | error = acpi_scan_hot_remove(device); | ||
357 | if (error && handle) | ||
358 | acpi_evaluate_hotplug_ost(handle, ej_event->event, | ||
359 | ACPI_OST_SC_NON_SPECIFIC_FAILURE, | ||
360 | NULL); | ||
361 | |||
362 | mutex_unlock(&acpi_scan_lock); | ||
363 | kfree(context); | ||
176 | } | 364 | } |
177 | EXPORT_SYMBOL(acpi_bus_hot_remove_device); | 365 | EXPORT_SYMBOL(acpi_bus_hot_remove_device); |
178 | 366 | ||
@@ -206,51 +394,61 @@ static ssize_t | |||
206 | acpi_eject_store(struct device *d, struct device_attribute *attr, | 394 | acpi_eject_store(struct device *d, struct device_attribute *attr, |
207 | const char *buf, size_t count) | 395 | const char *buf, size_t count) |
208 | { | 396 | { |
209 | int ret = count; | ||
210 | acpi_status status; | ||
211 | acpi_object_type type = 0; | ||
212 | struct acpi_device *acpi_device = to_acpi_device(d); | 397 | struct acpi_device *acpi_device = to_acpi_device(d); |
213 | struct acpi_eject_event *ej_event; | 398 | struct acpi_eject_event *ej_event; |
399 | acpi_object_type not_used; | ||
400 | acpi_status status; | ||
401 | u32 ost_source; | ||
402 | int ret; | ||
214 | 403 | ||
215 | if ((!count) || (buf[0] != '1')) { | 404 | if (!count || buf[0] != '1') |
216 | return -EINVAL; | 405 | return -EINVAL; |
217 | } | ||
218 | if (!acpi_device->driver && !acpi_device->handler) { | ||
219 | ret = -ENODEV; | ||
220 | goto err; | ||
221 | } | ||
222 | status = acpi_get_type(acpi_device->handle, &type); | ||
223 | if (ACPI_FAILURE(status) || (!acpi_device->flags.ejectable)) { | ||
224 | ret = -ENODEV; | ||
225 | goto err; | ||
226 | } | ||
227 | 406 | ||
228 | ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); | 407 | if ((!acpi_device->handler || !acpi_device->handler->hotplug.enabled) |
229 | if (!ej_event) { | 408 | && !acpi_device->driver) |
230 | ret = -ENOMEM; | 409 | return -ENODEV; |
231 | goto err; | 410 | |
232 | } | 411 | status = acpi_get_type(acpi_device->handle, ¬_used); |
412 | if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable) | ||
413 | return -ENODEV; | ||
414 | |||
415 | mutex_lock(&acpi_scan_lock); | ||
233 | 416 | ||
234 | get_device(&acpi_device->dev); | ||
235 | ej_event->device = acpi_device; | ||
236 | if (acpi_device->flags.eject_pending) { | 417 | if (acpi_device->flags.eject_pending) { |
237 | /* event originated from ACPI eject notification */ | 418 | /* ACPI eject notification event. */ |
238 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | 419 | ost_source = ACPI_NOTIFY_EJECT_REQUEST; |
239 | acpi_device->flags.eject_pending = 0; | 420 | acpi_device->flags.eject_pending = 0; |
240 | } else { | 421 | } else { |
241 | /* event originated from user */ | 422 | /* Eject initiated by user space. */ |
242 | ej_event->event = ACPI_OST_EC_OSPM_EJECT; | 423 | ost_source = ACPI_OST_EC_OSPM_EJECT; |
243 | (void) acpi_evaluate_hotplug_ost(acpi_device->handle, | ||
244 | ej_event->event, ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | ||
245 | } | 424 | } |
246 | 425 | ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); | |
426 | if (!ej_event) { | ||
427 | ret = -ENOMEM; | ||
428 | goto err_out; | ||
429 | } | ||
430 | acpi_evaluate_hotplug_ost(acpi_device->handle, ost_source, | ||
431 | ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); | ||
432 | ej_event->device = acpi_device; | ||
433 | ej_event->event = ost_source; | ||
434 | get_device(&acpi_device->dev); | ||
247 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event); | 435 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event); |
248 | if (ACPI_FAILURE(status)) { | 436 | if (ACPI_FAILURE(status)) { |
249 | put_device(&acpi_device->dev); | 437 | put_device(&acpi_device->dev); |
250 | kfree(ej_event); | 438 | kfree(ej_event); |
439 | ret = status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; | ||
440 | goto err_out; | ||
251 | } | 441 | } |
252 | err: | 442 | ret = count; |
443 | |||
444 | out: | ||
445 | mutex_unlock(&acpi_scan_lock); | ||
253 | return ret; | 446 | return ret; |
447 | |||
448 | err_out: | ||
449 | acpi_evaluate_hotplug_ost(acpi_device->handle, ost_source, | ||
450 | ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL); | ||
451 | goto out; | ||
254 | } | 452 | } |
255 | 453 | ||
256 | static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); | 454 | static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); |
@@ -376,7 +574,7 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
376 | goto end; | 574 | goto end; |
377 | } | 575 | } |
378 | 576 | ||
379 | if (dev->flags.bus_address) | 577 | if (dev->pnp.type.bus_address) |
380 | result = device_create_file(&dev->dev, &dev_attr_adr); | 578 | result = device_create_file(&dev->dev, &dev_attr_adr); |
381 | if (dev->pnp.unique_id) | 579 | if (dev->pnp.unique_id) |
382 | result = device_create_file(&dev->dev, &dev_attr_uid); | 580 | result = device_create_file(&dev->dev, &dev_attr_uid); |
@@ -449,7 +647,7 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
449 | 647 | ||
450 | if (dev->pnp.unique_id) | 648 | if (dev->pnp.unique_id) |
451 | device_remove_file(&dev->dev, &dev_attr_uid); | 649 | device_remove_file(&dev->dev, &dev_attr_uid); |
452 | if (dev->flags.bus_address) | 650 | if (dev->pnp.type.bus_address) |
453 | device_remove_file(&dev->dev, &dev_attr_adr); | 651 | device_remove_file(&dev->dev, &dev_attr_adr); |
454 | device_remove_file(&dev->dev, &dev_attr_modalias); | 652 | device_remove_file(&dev->dev, &dev_attr_modalias); |
455 | device_remove_file(&dev->dev, &dev_attr_hid); | 653 | device_remove_file(&dev->dev, &dev_attr_hid); |
@@ -512,17 +710,6 @@ int acpi_match_device_ids(struct acpi_device *device, | |||
512 | } | 710 | } |
513 | EXPORT_SYMBOL(acpi_match_device_ids); | 711 | EXPORT_SYMBOL(acpi_match_device_ids); |
514 | 712 | ||
515 | void acpi_free_ids(struct acpi_device *device) | ||
516 | { | ||
517 | struct acpi_hardware_id *id, *tmp; | ||
518 | |||
519 | list_for_each_entry_safe(id, tmp, &device->pnp.ids, list) { | ||
520 | kfree(id->id); | ||
521 | kfree(id); | ||
522 | } | ||
523 | kfree(device->pnp.unique_id); | ||
524 | } | ||
525 | |||
526 | static void acpi_free_power_resources_lists(struct acpi_device *device) | 713 | static void acpi_free_power_resources_lists(struct acpi_device *device) |
527 | { | 714 | { |
528 | int i; | 715 | int i; |
@@ -543,7 +730,7 @@ static void acpi_device_release(struct device *dev) | |||
543 | { | 730 | { |
544 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 731 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
545 | 732 | ||
546 | acpi_free_ids(acpi_dev); | 733 | acpi_free_pnp_ids(&acpi_dev->pnp); |
547 | acpi_free_power_resources_lists(acpi_dev); | 734 | acpi_free_power_resources_lists(acpi_dev); |
548 | kfree(acpi_dev); | 735 | kfree(acpi_dev); |
549 | } | 736 | } |
@@ -1256,19 +1443,17 @@ static void acpi_device_get_busid(struct acpi_device *device) | |||
1256 | } | 1443 | } |
1257 | 1444 | ||
1258 | /* | 1445 | /* |
1259 | * acpi_bay_match - see if a device is an ejectable driver bay | 1446 | * acpi_bay_match - see if an acpi object is an ejectable driver bay |
1260 | * | 1447 | * |
1261 | * If an acpi object is ejectable and has one of the ACPI ATA methods defined, | 1448 | * If an acpi object is ejectable and has one of the ACPI ATA methods defined, |
1262 | * then we can safely call it an ejectable drive bay | 1449 | * then we can safely call it an ejectable drive bay |
1263 | */ | 1450 | */ |
1264 | static int acpi_bay_match(struct acpi_device *device){ | 1451 | static int acpi_bay_match(acpi_handle handle) |
1452 | { | ||
1265 | acpi_status status; | 1453 | acpi_status status; |
1266 | acpi_handle handle; | ||
1267 | acpi_handle tmp; | 1454 | acpi_handle tmp; |
1268 | acpi_handle phandle; | 1455 | acpi_handle phandle; |
1269 | 1456 | ||
1270 | handle = device->handle; | ||
1271 | |||
1272 | status = acpi_get_handle(handle, "_EJ0", &tmp); | 1457 | status = acpi_get_handle(handle, "_EJ0", &tmp); |
1273 | if (ACPI_FAILURE(status)) | 1458 | if (ACPI_FAILURE(status)) |
1274 | return -ENODEV; | 1459 | return -ENODEV; |
@@ -1292,12 +1477,12 @@ static int acpi_bay_match(struct acpi_device *device){ | |||
1292 | } | 1477 | } |
1293 | 1478 | ||
1294 | /* | 1479 | /* |
1295 | * acpi_dock_match - see if a device has a _DCK method | 1480 | * acpi_dock_match - see if an acpi object has a _DCK method |
1296 | */ | 1481 | */ |
1297 | static int acpi_dock_match(struct acpi_device *device) | 1482 | static int acpi_dock_match(acpi_handle handle) |
1298 | { | 1483 | { |
1299 | acpi_handle tmp; | 1484 | acpi_handle tmp; |
1300 | return acpi_get_handle(device->handle, "_DCK", &tmp); | 1485 | return acpi_get_handle(handle, "_DCK", &tmp); |
1301 | } | 1486 | } |
1302 | 1487 | ||
1303 | const char *acpi_device_hid(struct acpi_device *device) | 1488 | const char *acpi_device_hid(struct acpi_device *device) |
@@ -1312,7 +1497,7 @@ const char *acpi_device_hid(struct acpi_device *device) | |||
1312 | } | 1497 | } |
1313 | EXPORT_SYMBOL(acpi_device_hid); | 1498 | EXPORT_SYMBOL(acpi_device_hid); |
1314 | 1499 | ||
1315 | static void acpi_add_id(struct acpi_device *device, const char *dev_id) | 1500 | static void acpi_add_id(struct acpi_device_pnp *pnp, const char *dev_id) |
1316 | { | 1501 | { |
1317 | struct acpi_hardware_id *id; | 1502 | struct acpi_hardware_id *id; |
1318 | 1503 | ||
@@ -1326,7 +1511,8 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id) | |||
1326 | return; | 1511 | return; |
1327 | } | 1512 | } |
1328 | 1513 | ||
1329 | list_add_tail(&id->list, &device->pnp.ids); | 1514 | list_add_tail(&id->list, &pnp->ids); |
1515 | pnp->type.hardware_id = 1; | ||
1330 | } | 1516 | } |
1331 | 1517 | ||
1332 | /* | 1518 | /* |
@@ -1334,7 +1520,7 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id) | |||
1334 | * lacks the SMBUS01 HID and the methods do not have the necessary "_" | 1520 | * lacks the SMBUS01 HID and the methods do not have the necessary "_" |
1335 | * prefix. Work around this. | 1521 | * prefix. Work around this. |
1336 | */ | 1522 | */ |
1337 | static int acpi_ibm_smbus_match(struct acpi_device *device) | 1523 | static int acpi_ibm_smbus_match(acpi_handle handle) |
1338 | { | 1524 | { |
1339 | acpi_handle h_dummy; | 1525 | acpi_handle h_dummy; |
1340 | struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL}; | 1526 | struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL}; |
@@ -1344,7 +1530,7 @@ static int acpi_ibm_smbus_match(struct acpi_device *device) | |||
1344 | return -ENODEV; | 1530 | return -ENODEV; |
1345 | 1531 | ||
1346 | /* Look for SMBS object */ | 1532 | /* Look for SMBS object */ |
1347 | result = acpi_get_name(device->handle, ACPI_SINGLE_NAME, &path); | 1533 | result = acpi_get_name(handle, ACPI_SINGLE_NAME, &path); |
1348 | if (result) | 1534 | if (result) |
1349 | return result; | 1535 | return result; |
1350 | 1536 | ||
@@ -1355,48 +1541,50 @@ static int acpi_ibm_smbus_match(struct acpi_device *device) | |||
1355 | 1541 | ||
1356 | /* Does it have the necessary (but misnamed) methods? */ | 1542 | /* Does it have the necessary (but misnamed) methods? */ |
1357 | result = -ENODEV; | 1543 | result = -ENODEV; |
1358 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "SBI", &h_dummy)) && | 1544 | if (ACPI_SUCCESS(acpi_get_handle(handle, "SBI", &h_dummy)) && |
1359 | ACPI_SUCCESS(acpi_get_handle(device->handle, "SBR", &h_dummy)) && | 1545 | ACPI_SUCCESS(acpi_get_handle(handle, "SBR", &h_dummy)) && |
1360 | ACPI_SUCCESS(acpi_get_handle(device->handle, "SBW", &h_dummy))) | 1546 | ACPI_SUCCESS(acpi_get_handle(handle, "SBW", &h_dummy))) |
1361 | result = 0; | 1547 | result = 0; |
1362 | out: | 1548 | out: |
1363 | kfree(path.pointer); | 1549 | kfree(path.pointer); |
1364 | return result; | 1550 | return result; |
1365 | } | 1551 | } |
1366 | 1552 | ||
1367 | static void acpi_device_set_id(struct acpi_device *device) | 1553 | static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, |
1554 | int device_type) | ||
1368 | { | 1555 | { |
1369 | acpi_status status; | 1556 | acpi_status status; |
1370 | struct acpi_device_info *info; | 1557 | struct acpi_device_info *info; |
1371 | struct acpi_pnp_device_id_list *cid_list; | 1558 | struct acpi_pnp_device_id_list *cid_list; |
1372 | int i; | 1559 | int i; |
1373 | 1560 | ||
1374 | switch (device->device_type) { | 1561 | switch (device_type) { |
1375 | case ACPI_BUS_TYPE_DEVICE: | 1562 | case ACPI_BUS_TYPE_DEVICE: |
1376 | if (ACPI_IS_ROOT_DEVICE(device)) { | 1563 | if (handle == ACPI_ROOT_OBJECT) { |
1377 | acpi_add_id(device, ACPI_SYSTEM_HID); | 1564 | acpi_add_id(pnp, ACPI_SYSTEM_HID); |
1378 | break; | 1565 | break; |
1379 | } | 1566 | } |
1380 | 1567 | ||
1381 | status = acpi_get_object_info(device->handle, &info); | 1568 | status = acpi_get_object_info(handle, &info); |
1382 | if (ACPI_FAILURE(status)) { | 1569 | if (ACPI_FAILURE(status)) { |
1383 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); | 1570 | pr_err(PREFIX "%s: Error reading device info\n", |
1571 | __func__); | ||
1384 | return; | 1572 | return; |
1385 | } | 1573 | } |
1386 | 1574 | ||
1387 | if (info->valid & ACPI_VALID_HID) | 1575 | if (info->valid & ACPI_VALID_HID) |
1388 | acpi_add_id(device, info->hardware_id.string); | 1576 | acpi_add_id(pnp, info->hardware_id.string); |
1389 | if (info->valid & ACPI_VALID_CID) { | 1577 | if (info->valid & ACPI_VALID_CID) { |
1390 | cid_list = &info->compatible_id_list; | 1578 | cid_list = &info->compatible_id_list; |
1391 | for (i = 0; i < cid_list->count; i++) | 1579 | for (i = 0; i < cid_list->count; i++) |
1392 | acpi_add_id(device, cid_list->ids[i].string); | 1580 | acpi_add_id(pnp, cid_list->ids[i].string); |
1393 | } | 1581 | } |
1394 | if (info->valid & ACPI_VALID_ADR) { | 1582 | if (info->valid & ACPI_VALID_ADR) { |
1395 | device->pnp.bus_address = info->address; | 1583 | pnp->bus_address = info->address; |
1396 | device->flags.bus_address = 1; | 1584 | pnp->type.bus_address = 1; |
1397 | } | 1585 | } |
1398 | if (info->valid & ACPI_VALID_UID) | 1586 | if (info->valid & ACPI_VALID_UID) |
1399 | device->pnp.unique_id = kstrdup(info->unique_id.string, | 1587 | pnp->unique_id = kstrdup(info->unique_id.string, |
1400 | GFP_KERNEL); | 1588 | GFP_KERNEL); |
1401 | 1589 | ||
1402 | kfree(info); | 1590 | kfree(info); |
@@ -1405,40 +1593,50 @@ static void acpi_device_set_id(struct acpi_device *device) | |||
1405 | * Some devices don't reliably have _HIDs & _CIDs, so add | 1593 | * Some devices don't reliably have _HIDs & _CIDs, so add |
1406 | * synthetic HIDs to make sure drivers can find them. | 1594 | * synthetic HIDs to make sure drivers can find them. |
1407 | */ | 1595 | */ |
1408 | if (acpi_is_video_device(device)) | 1596 | if (acpi_is_video_device(handle)) |
1409 | acpi_add_id(device, ACPI_VIDEO_HID); | 1597 | acpi_add_id(pnp, ACPI_VIDEO_HID); |
1410 | else if (ACPI_SUCCESS(acpi_bay_match(device))) | 1598 | else if (ACPI_SUCCESS(acpi_bay_match(handle))) |
1411 | acpi_add_id(device, ACPI_BAY_HID); | 1599 | acpi_add_id(pnp, ACPI_BAY_HID); |
1412 | else if (ACPI_SUCCESS(acpi_dock_match(device))) | 1600 | else if (ACPI_SUCCESS(acpi_dock_match(handle))) |
1413 | acpi_add_id(device, ACPI_DOCK_HID); | 1601 | acpi_add_id(pnp, ACPI_DOCK_HID); |
1414 | else if (!acpi_ibm_smbus_match(device)) | 1602 | else if (!acpi_ibm_smbus_match(handle)) |
1415 | acpi_add_id(device, ACPI_SMBUS_IBM_HID); | 1603 | acpi_add_id(pnp, ACPI_SMBUS_IBM_HID); |
1416 | else if (list_empty(&device->pnp.ids) && | 1604 | else if (list_empty(&pnp->ids) && handle == ACPI_ROOT_OBJECT) { |
1417 | ACPI_IS_ROOT_DEVICE(device->parent)) { | 1605 | acpi_add_id(pnp, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ |
1418 | acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ | 1606 | strcpy(pnp->device_name, ACPI_BUS_DEVICE_NAME); |
1419 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | 1607 | strcpy(pnp->device_class, ACPI_BUS_CLASS); |
1420 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); | ||
1421 | } | 1608 | } |
1422 | 1609 | ||
1423 | break; | 1610 | break; |
1424 | case ACPI_BUS_TYPE_POWER: | 1611 | case ACPI_BUS_TYPE_POWER: |
1425 | acpi_add_id(device, ACPI_POWER_HID); | 1612 | acpi_add_id(pnp, ACPI_POWER_HID); |
1426 | break; | 1613 | break; |
1427 | case ACPI_BUS_TYPE_PROCESSOR: | 1614 | case ACPI_BUS_TYPE_PROCESSOR: |
1428 | acpi_add_id(device, ACPI_PROCESSOR_OBJECT_HID); | 1615 | acpi_add_id(pnp, ACPI_PROCESSOR_OBJECT_HID); |
1429 | break; | 1616 | break; |
1430 | case ACPI_BUS_TYPE_THERMAL: | 1617 | case ACPI_BUS_TYPE_THERMAL: |
1431 | acpi_add_id(device, ACPI_THERMAL_HID); | 1618 | acpi_add_id(pnp, ACPI_THERMAL_HID); |
1432 | break; | 1619 | break; |
1433 | case ACPI_BUS_TYPE_POWER_BUTTON: | 1620 | case ACPI_BUS_TYPE_POWER_BUTTON: |
1434 | acpi_add_id(device, ACPI_BUTTON_HID_POWERF); | 1621 | acpi_add_id(pnp, ACPI_BUTTON_HID_POWERF); |
1435 | break; | 1622 | break; |
1436 | case ACPI_BUS_TYPE_SLEEP_BUTTON: | 1623 | case ACPI_BUS_TYPE_SLEEP_BUTTON: |
1437 | acpi_add_id(device, ACPI_BUTTON_HID_SLEEPF); | 1624 | acpi_add_id(pnp, ACPI_BUTTON_HID_SLEEPF); |
1438 | break; | 1625 | break; |
1439 | } | 1626 | } |
1440 | } | 1627 | } |
1441 | 1628 | ||
1629 | void acpi_free_pnp_ids(struct acpi_device_pnp *pnp) | ||
1630 | { | ||
1631 | struct acpi_hardware_id *id, *tmp; | ||
1632 | |||
1633 | list_for_each_entry_safe(id, tmp, &pnp->ids, list) { | ||
1634 | kfree(id->id); | ||
1635 | kfree(id); | ||
1636 | } | ||
1637 | kfree(pnp->unique_id); | ||
1638 | } | ||
1639 | |||
1442 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | 1640 | void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, |
1443 | int type, unsigned long long sta) | 1641 | int type, unsigned long long sta) |
1444 | { | 1642 | { |
@@ -1448,7 +1646,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | |||
1448 | device->parent = acpi_bus_get_parent(handle); | 1646 | device->parent = acpi_bus_get_parent(handle); |
1449 | STRUCT_TO_INT(device->status) = sta; | 1647 | STRUCT_TO_INT(device->status) = sta; |
1450 | acpi_device_get_busid(device); | 1648 | acpi_device_get_busid(device); |
1451 | acpi_device_set_id(device); | 1649 | acpi_set_pnp_ids(handle, &device->pnp, type); |
1452 | acpi_bus_get_flags(device); | 1650 | acpi_bus_get_flags(device); |
1453 | device->flags.match_driver = false; | 1651 | device->flags.match_driver = false; |
1454 | device_initialize(&device->dev); | 1652 | device_initialize(&device->dev); |
@@ -1536,6 +1734,75 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, | |||
1536 | return 0; | 1734 | return 0; |
1537 | } | 1735 | } |
1538 | 1736 | ||
1737 | static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler, | ||
1738 | char *idstr, | ||
1739 | const struct acpi_device_id **matchid) | ||
1740 | { | ||
1741 | const struct acpi_device_id *devid; | ||
1742 | |||
1743 | for (devid = handler->ids; devid->id[0]; devid++) | ||
1744 | if (!strcmp((char *)devid->id, idstr)) { | ||
1745 | if (matchid) | ||
1746 | *matchid = devid; | ||
1747 | |||
1748 | return true; | ||
1749 | } | ||
1750 | |||
1751 | return false; | ||
1752 | } | ||
1753 | |||
1754 | static struct acpi_scan_handler *acpi_scan_match_handler(char *idstr, | ||
1755 | const struct acpi_device_id **matchid) | ||
1756 | { | ||
1757 | struct acpi_scan_handler *handler; | ||
1758 | |||
1759 | list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) | ||
1760 | if (acpi_scan_handler_matching(handler, idstr, matchid)) | ||
1761 | return handler; | ||
1762 | |||
1763 | return NULL; | ||
1764 | } | ||
1765 | |||
1766 | void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val) | ||
1767 | { | ||
1768 | if (!!hotplug->enabled == !!val) | ||
1769 | return; | ||
1770 | |||
1771 | mutex_lock(&acpi_scan_lock); | ||
1772 | |||
1773 | hotplug->enabled = val; | ||
1774 | |||
1775 | mutex_unlock(&acpi_scan_lock); | ||
1776 | } | ||
1777 | |||
1778 | static void acpi_scan_init_hotplug(acpi_handle handle, int type) | ||
1779 | { | ||
1780 | struct acpi_device_pnp pnp = {}; | ||
1781 | struct acpi_hardware_id *hwid; | ||
1782 | struct acpi_scan_handler *handler; | ||
1783 | |||
1784 | INIT_LIST_HEAD(&pnp.ids); | ||
1785 | acpi_set_pnp_ids(handle, &pnp, type); | ||
1786 | |||
1787 | if (!pnp.type.hardware_id) | ||
1788 | return; | ||
1789 | |||
1790 | /* | ||
1791 | * This relies on the fact that acpi_install_notify_handler() will not | ||
1792 | * install the same notify handler routine twice for the same handle. | ||
1793 | */ | ||
1794 | list_for_each_entry(hwid, &pnp.ids, list) { | ||
1795 | handler = acpi_scan_match_handler(hwid->id, NULL); | ||
1796 | if (handler) { | ||
1797 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | ||
1798 | acpi_hotplug_notify_cb, handler); | ||
1799 | break; | ||
1800 | } | ||
1801 | } | ||
1802 | |||
1803 | acpi_free_pnp_ids(&pnp); | ||
1804 | } | ||
1805 | |||
1539 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | 1806 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, |
1540 | void *not_used, void **return_value) | 1807 | void *not_used, void **return_value) |
1541 | { | 1808 | { |
@@ -1558,6 +1825,8 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
1558 | return AE_OK; | 1825 | return AE_OK; |
1559 | } | 1826 | } |
1560 | 1827 | ||
1828 | acpi_scan_init_hotplug(handle, type); | ||
1829 | |||
1561 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && | 1830 | if (!(sta & ACPI_STA_DEVICE_PRESENT) && |
1562 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { | 1831 | !(sta & ACPI_STA_DEVICE_FUNCTIONING)) { |
1563 | struct acpi_device_wakeup wakeup; | 1832 | struct acpi_device_wakeup wakeup; |
@@ -1583,42 +1852,26 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
1583 | return AE_OK; | 1852 | return AE_OK; |
1584 | } | 1853 | } |
1585 | 1854 | ||
1586 | static int acpi_scan_do_attach_handler(struct acpi_device *device, char *id) | 1855 | static int acpi_scan_attach_handler(struct acpi_device *device) |
1587 | { | 1856 | { |
1588 | struct acpi_scan_handler *handler; | 1857 | struct acpi_hardware_id *hwid; |
1858 | int ret = 0; | ||
1589 | 1859 | ||
1590 | list_for_each_entry(handler, &acpi_scan_handlers_list, list_node) { | 1860 | list_for_each_entry(hwid, &device->pnp.ids, list) { |
1591 | const struct acpi_device_id *devid; | 1861 | const struct acpi_device_id *devid; |
1862 | struct acpi_scan_handler *handler; | ||
1592 | 1863 | ||
1593 | for (devid = handler->ids; devid->id[0]; devid++) { | 1864 | handler = acpi_scan_match_handler(hwid->id, &devid); |
1594 | int ret; | 1865 | if (handler) { |
1595 | |||
1596 | if (strcmp((char *)devid->id, id)) | ||
1597 | continue; | ||
1598 | |||
1599 | ret = handler->attach(device, devid); | 1866 | ret = handler->attach(device, devid); |
1600 | if (ret > 0) { | 1867 | if (ret > 0) { |
1601 | device->handler = handler; | 1868 | device->handler = handler; |
1602 | return ret; | 1869 | break; |
1603 | } else if (ret < 0) { | 1870 | } else if (ret < 0) { |
1604 | return ret; | 1871 | break; |
1605 | } | 1872 | } |
1606 | } | 1873 | } |
1607 | } | 1874 | } |
1608 | return 0; | ||
1609 | } | ||
1610 | |||
1611 | static int acpi_scan_attach_handler(struct acpi_device *device) | ||
1612 | { | ||
1613 | struct acpi_hardware_id *hwid; | ||
1614 | int ret = 0; | ||
1615 | |||
1616 | list_for_each_entry(hwid, &device->pnp.ids, list) { | ||
1617 | ret = acpi_scan_do_attach_handler(device, hwid->id); | ||
1618 | if (ret) | ||
1619 | break; | ||
1620 | |||
1621 | } | ||
1622 | return ret; | 1875 | return ret; |
1623 | } | 1876 | } |
1624 | 1877 | ||
@@ -1788,8 +2041,10 @@ int __init acpi_scan_init(void) | |||
1788 | acpi_pci_root_init(); | 2041 | acpi_pci_root_init(); |
1789 | acpi_pci_link_init(); | 2042 | acpi_pci_link_init(); |
1790 | acpi_platform_init(); | 2043 | acpi_platform_init(); |
2044 | acpi_lpss_init(); | ||
1791 | acpi_csrt_init(); | 2045 | acpi_csrt_init(); |
1792 | acpi_container_init(); | 2046 | acpi_container_init(); |
2047 | acpi_memory_hotplug_init(); | ||
1793 | 2048 | ||
1794 | mutex_lock(&acpi_scan_lock); | 2049 | mutex_lock(&acpi_scan_lock); |
1795 | /* | 2050 | /* |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 41c0504470db..fcae5fa2e1b3 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -7,6 +7,8 @@ | |||
7 | #include <linux/moduleparam.h> | 7 | #include <linux/moduleparam.h> |
8 | #include <acpi/acpi_drivers.h> | 8 | #include <acpi/acpi_drivers.h> |
9 | 9 | ||
10 | #include "internal.h" | ||
11 | |||
10 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 12 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
11 | ACPI_MODULE_NAME("sysfs"); | 13 | ACPI_MODULE_NAME("sysfs"); |
12 | 14 | ||
@@ -249,6 +251,7 @@ module_param_call(acpica_version, NULL, param_get_acpica_version, NULL, 0444); | |||
249 | static LIST_HEAD(acpi_table_attr_list); | 251 | static LIST_HEAD(acpi_table_attr_list); |
250 | static struct kobject *tables_kobj; | 252 | static struct kobject *tables_kobj; |
251 | static struct kobject *dynamic_tables_kobj; | 253 | static struct kobject *dynamic_tables_kobj; |
254 | static struct kobject *hotplug_kobj; | ||
252 | 255 | ||
253 | struct acpi_table_attr { | 256 | struct acpi_table_attr { |
254 | struct bin_attribute attr; | 257 | struct bin_attribute attr; |
@@ -716,6 +719,67 @@ acpi_show_profile(struct device *dev, struct device_attribute *attr, | |||
716 | static const struct device_attribute pm_profile_attr = | 719 | static const struct device_attribute pm_profile_attr = |
717 | __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL); | 720 | __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL); |
718 | 721 | ||
722 | static ssize_t hotplug_enabled_show(struct kobject *kobj, | ||
723 | struct kobj_attribute *attr, char *buf) | ||
724 | { | ||
725 | struct acpi_hotplug_profile *hotplug = to_acpi_hotplug_profile(kobj); | ||
726 | |||
727 | return sprintf(buf, "%d\n", hotplug->enabled); | ||
728 | } | ||
729 | |||
730 | static ssize_t hotplug_enabled_store(struct kobject *kobj, | ||
731 | struct kobj_attribute *attr, | ||
732 | const char *buf, size_t size) | ||
733 | { | ||
734 | struct acpi_hotplug_profile *hotplug = to_acpi_hotplug_profile(kobj); | ||
735 | unsigned int val; | ||
736 | |||
737 | if (kstrtouint(buf, 10, &val) || val > 1) | ||
738 | return -EINVAL; | ||
739 | |||
740 | acpi_scan_hotplug_enabled(hotplug, val); | ||
741 | return size; | ||
742 | } | ||
743 | |||
744 | static struct kobj_attribute hotplug_enabled_attr = | ||
745 | __ATTR(enabled, S_IRUGO | S_IWUSR, hotplug_enabled_show, | ||
746 | hotplug_enabled_store); | ||
747 | |||
748 | static struct attribute *hotplug_profile_attrs[] = { | ||
749 | &hotplug_enabled_attr.attr, | ||
750 | NULL | ||
751 | }; | ||
752 | |||
753 | static struct kobj_type acpi_hotplug_profile_ktype = { | ||
754 | .sysfs_ops = &kobj_sysfs_ops, | ||
755 | .default_attrs = hotplug_profile_attrs, | ||
756 | }; | ||
757 | |||
758 | void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug, | ||
759 | const char *name) | ||
760 | { | ||
761 | int error; | ||
762 | |||
763 | if (!hotplug_kobj) | ||
764 | goto err_out; | ||
765 | |||
766 | kobject_init(&hotplug->kobj, &acpi_hotplug_profile_ktype); | ||
767 | error = kobject_set_name(&hotplug->kobj, "%s", name); | ||
768 | if (error) | ||
769 | goto err_out; | ||
770 | |||
771 | hotplug->kobj.parent = hotplug_kobj; | ||
772 | error = kobject_add(&hotplug->kobj, hotplug_kobj, NULL); | ||
773 | if (error) | ||
774 | goto err_out; | ||
775 | |||
776 | kobject_uevent(&hotplug->kobj, KOBJ_ADD); | ||
777 | return; | ||
778 | |||
779 | err_out: | ||
780 | pr_err(PREFIX "Unable to add hotplug profile '%s'\n", name); | ||
781 | } | ||
782 | |||
719 | int __init acpi_sysfs_init(void) | 783 | int __init acpi_sysfs_init(void) |
720 | { | 784 | { |
721 | int result; | 785 | int result; |
@@ -723,6 +787,8 @@ int __init acpi_sysfs_init(void) | |||
723 | result = acpi_tables_sysfs_init(); | 787 | result = acpi_tables_sysfs_init(); |
724 | if (result) | 788 | if (result) |
725 | return result; | 789 | return result; |
790 | |||
791 | hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj); | ||
726 | result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr); | 792 | result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr); |
727 | return result; | 793 | return result; |
728 | } | 794 | } |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 8470771e5eae..a33821ca3895 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -723,9 +723,19 @@ static int thermal_get_trend(struct thermal_zone_device *thermal, | |||
723 | return -EINVAL; | 723 | return -EINVAL; |
724 | 724 | ||
725 | if (type == THERMAL_TRIP_ACTIVE) { | 725 | if (type == THERMAL_TRIP_ACTIVE) { |
726 | /* aggressive active cooling */ | 726 | unsigned long trip_temp; |
727 | *trend = THERMAL_TREND_RAISING; | 727 | unsigned long temp = KELVIN_TO_MILLICELSIUS(tz->temperature, |
728 | return 0; | 728 | tz->kelvin_offset); |
729 | if (thermal_get_trip_temp(thermal, trip, &trip_temp)) | ||
730 | return -EINVAL; | ||
731 | |||
732 | if (temp > trip_temp) { | ||
733 | *trend = THERMAL_TREND_RAISING; | ||
734 | return 0; | ||
735 | } else { | ||
736 | /* Fall back on default trend */ | ||
737 | return -EINVAL; | ||
738 | } | ||
729 | } | 739 | } |
730 | 740 | ||
731 | /* | 741 | /* |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 313f959413dc..c3932d0876e0 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -167,7 +167,8 @@ struct acpi_video_device_flags { | |||
167 | u8 dvi:1; | 167 | u8 dvi:1; |
168 | u8 bios:1; | 168 | u8 bios:1; |
169 | u8 unknown:1; | 169 | u8 unknown:1; |
170 | u8 reserved:2; | 170 | u8 notify:1; |
171 | u8 reserved:1; | ||
171 | }; | 172 | }; |
172 | 173 | ||
173 | struct acpi_video_device_cap { | 174 | struct acpi_video_device_cap { |
@@ -222,7 +223,7 @@ static int acpi_video_device_lcd_set_level(struct acpi_video_device *device, | |||
222 | int level); | 223 | int level); |
223 | static int acpi_video_device_lcd_get_level_current( | 224 | static int acpi_video_device_lcd_get_level_current( |
224 | struct acpi_video_device *device, | 225 | struct acpi_video_device *device, |
225 | unsigned long long *level, int init); | 226 | unsigned long long *level, bool raw); |
226 | static int acpi_video_get_next_level(struct acpi_video_device *device, | 227 | static int acpi_video_get_next_level(struct acpi_video_device *device, |
227 | u32 level_current, u32 event); | 228 | u32 level_current, u32 event); |
228 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 229 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
@@ -236,7 +237,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd) | |||
236 | struct acpi_video_device *vd = | 237 | struct acpi_video_device *vd = |
237 | (struct acpi_video_device *)bl_get_data(bd); | 238 | (struct acpi_video_device *)bl_get_data(bd); |
238 | 239 | ||
239 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level, 0)) | 240 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level, false)) |
240 | return -EINVAL; | 241 | return -EINVAL; |
241 | for (i = 2; i < vd->brightness->count; i++) { | 242 | for (i = 2; i < vd->brightness->count; i++) { |
242 | if (vd->brightness->levels[i] == cur_level) | 243 | if (vd->brightness->levels[i] == cur_level) |
@@ -281,7 +282,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cooling_dev, unsig | |||
281 | unsigned long long level; | 282 | unsigned long long level; |
282 | int offset; | 283 | int offset; |
283 | 284 | ||
284 | if (acpi_video_device_lcd_get_level_current(video, &level, 0)) | 285 | if (acpi_video_device_lcd_get_level_current(video, &level, false)) |
285 | return -EINVAL; | 286 | return -EINVAL; |
286 | for (offset = 2; offset < video->brightness->count; offset++) | 287 | for (offset = 2; offset < video->brightness->count; offset++) |
287 | if (level == video->brightness->levels[offset]) { | 288 | if (level == video->brightness->levels[offset]) { |
@@ -447,12 +448,45 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
447 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"), | 448 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"), |
448 | }, | 449 | }, |
449 | }, | 450 | }, |
451 | { | ||
452 | .callback = video_ignore_initial_backlight, | ||
453 | .ident = "HP Pavilion dm4", | ||
454 | .matches = { | ||
455 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
456 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"), | ||
457 | }, | ||
458 | }, | ||
450 | {} | 459 | {} |
451 | }; | 460 | }; |
452 | 461 | ||
462 | static unsigned long long | ||
463 | acpi_video_bqc_value_to_level(struct acpi_video_device *device, | ||
464 | unsigned long long bqc_value) | ||
465 | { | ||
466 | unsigned long long level; | ||
467 | |||
468 | if (device->brightness->flags._BQC_use_index) { | ||
469 | /* | ||
470 | * _BQC returns an index that doesn't account for | ||
471 | * the first 2 items with special meaning, so we need | ||
472 | * to compensate for that by offsetting ourselves | ||
473 | */ | ||
474 | if (device->brightness->flags._BCL_reversed) | ||
475 | bqc_value = device->brightness->count - 3 - bqc_value; | ||
476 | |||
477 | level = device->brightness->levels[bqc_value + 2]; | ||
478 | } else { | ||
479 | level = bqc_value; | ||
480 | } | ||
481 | |||
482 | level += bqc_offset_aml_bug_workaround; | ||
483 | |||
484 | return level; | ||
485 | } | ||
486 | |||
453 | static int | 487 | static int |
454 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | 488 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, |
455 | unsigned long long *level, int init) | 489 | unsigned long long *level, bool raw) |
456 | { | 490 | { |
457 | acpi_status status = AE_OK; | 491 | acpi_status status = AE_OK; |
458 | int i; | 492 | int i; |
@@ -463,29 +497,30 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
463 | status = acpi_evaluate_integer(device->dev->handle, buf, | 497 | status = acpi_evaluate_integer(device->dev->handle, buf, |
464 | NULL, level); | 498 | NULL, level); |
465 | if (ACPI_SUCCESS(status)) { | 499 | if (ACPI_SUCCESS(status)) { |
466 | if (device->brightness->flags._BQC_use_index) { | 500 | if (raw) { |
467 | if (device->brightness->flags._BCL_reversed) | 501 | /* |
468 | *level = device->brightness->count | 502 | * Caller has indicated he wants the raw |
469 | - 3 - (*level); | 503 | * value returned by _BQC, so don't furtherly |
470 | *level = device->brightness->levels[*level + 2]; | 504 | * mess with the value. |
471 | 505 | */ | |
506 | return 0; | ||
472 | } | 507 | } |
473 | *level += bqc_offset_aml_bug_workaround; | 508 | |
509 | *level = acpi_video_bqc_value_to_level(device, *level); | ||
510 | |||
474 | for (i = 2; i < device->brightness->count; i++) | 511 | for (i = 2; i < device->brightness->count; i++) |
475 | if (device->brightness->levels[i] == *level) { | 512 | if (device->brightness->levels[i] == *level) { |
476 | device->brightness->curr = *level; | 513 | device->brightness->curr = *level; |
477 | return 0; | 514 | return 0; |
478 | } | 515 | } |
479 | if (!init) { | 516 | /* |
480 | /* | 517 | * BQC returned an invalid level. |
481 | * BQC returned an invalid level. | 518 | * Stop using it. |
482 | * Stop using it. | 519 | */ |
483 | */ | 520 | ACPI_WARNING((AE_INFO, |
484 | ACPI_WARNING((AE_INFO, | 521 | "%s returned an invalid level", |
485 | "%s returned an invalid level", | 522 | buf)); |
486 | buf)); | 523 | device->cap._BQC = device->cap._BCQ = 0; |
487 | device->cap._BQC = device->cap._BCQ = 0; | ||
488 | } | ||
489 | } else { | 524 | } else { |
490 | /* Fixme: | 525 | /* Fixme: |
491 | * should we return an error or ignore this failure? | 526 | * should we return an error or ignore this failure? |
@@ -598,6 +633,56 @@ acpi_video_cmp_level(const void *a, const void *b) | |||
598 | } | 633 | } |
599 | 634 | ||
600 | /* | 635 | /* |
636 | * Decides if _BQC/_BCQ for this system is usable | ||
637 | * | ||
638 | * We do this by changing the level first and then read out the current | ||
639 | * brightness level, if the value does not match, find out if it is using | ||
640 | * index. If not, clear the _BQC/_BCQ capability. | ||
641 | */ | ||
642 | static int acpi_video_bqc_quirk(struct acpi_video_device *device, | ||
643 | int max_level, int current_level) | ||
644 | { | ||
645 | struct acpi_video_device_brightness *br = device->brightness; | ||
646 | int result; | ||
647 | unsigned long long level; | ||
648 | int test_level; | ||
649 | |||
650 | /* don't mess with existing known broken systems */ | ||
651 | if (bqc_offset_aml_bug_workaround) | ||
652 | return 0; | ||
653 | |||
654 | /* | ||
655 | * Some systems always report current brightness level as maximum | ||
656 | * through _BQC, we need to test another value for them. | ||
657 | */ | ||
658 | test_level = current_level == max_level ? br->levels[2] : max_level; | ||
659 | |||
660 | result = acpi_video_device_lcd_set_level(device, test_level); | ||
661 | if (result) | ||
662 | return result; | ||
663 | |||
664 | result = acpi_video_device_lcd_get_level_current(device, &level, true); | ||
665 | if (result) | ||
666 | return result; | ||
667 | |||
668 | if (level != test_level) { | ||
669 | /* buggy _BQC found, need to find out if it uses index */ | ||
670 | if (level < br->count) { | ||
671 | if (br->flags._BCL_reversed) | ||
672 | level = br->count - 3 - level; | ||
673 | if (br->levels[level + 2] == test_level) | ||
674 | br->flags._BQC_use_index = 1; | ||
675 | } | ||
676 | |||
677 | if (!br->flags._BQC_use_index) | ||
678 | device->cap._BQC = device->cap._BCQ = 0; | ||
679 | } | ||
680 | |||
681 | return 0; | ||
682 | } | ||
683 | |||
684 | |||
685 | /* | ||
601 | * Arg: | 686 | * Arg: |
602 | * device : video output device (LCD, CRT, ..) | 687 | * device : video output device (LCD, CRT, ..) |
603 | * | 688 | * |
@@ -703,42 +788,36 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
703 | if (!device->cap._BQC) | 788 | if (!device->cap._BQC) |
704 | goto set_level; | 789 | goto set_level; |
705 | 790 | ||
706 | result = acpi_video_device_lcd_get_level_current(device, &level_old, 1); | 791 | result = acpi_video_device_lcd_get_level_current(device, |
707 | if (result) | 792 | &level_old, true); |
708 | goto out_free_levels; | ||
709 | |||
710 | /* | ||
711 | * Set the level to maximum and check if _BQC uses indexed value | ||
712 | */ | ||
713 | result = acpi_video_device_lcd_set_level(device, max_level); | ||
714 | if (result) | 793 | if (result) |
715 | goto out_free_levels; | 794 | goto out_free_levels; |
716 | 795 | ||
717 | result = acpi_video_device_lcd_get_level_current(device, &level, 0); | 796 | result = acpi_video_bqc_quirk(device, max_level, level_old); |
718 | if (result) | 797 | if (result) |
719 | goto out_free_levels; | 798 | goto out_free_levels; |
799 | /* | ||
800 | * cap._BQC may get cleared due to _BQC is found to be broken | ||
801 | * in acpi_video_bqc_quirk, so check again here. | ||
802 | */ | ||
803 | if (!device->cap._BQC) | ||
804 | goto set_level; | ||
720 | 805 | ||
721 | br->flags._BQC_use_index = (level == max_level ? 0 : 1); | 806 | if (use_bios_initial_backlight) { |
722 | 807 | level = acpi_video_bqc_value_to_level(device, level_old); | |
723 | if (!br->flags._BQC_use_index) { | ||
724 | /* | 808 | /* |
725 | * Set the backlight to the initial state. | 809 | * On some buggy laptops, _BQC returns an uninitialized |
726 | * On some buggy laptops, _BQC returns an uninitialized value | 810 | * value when invoked for the first time, i.e. |
727 | * when invoked for the first time, i.e. level_old is invalid. | 811 | * level_old is invalid (no matter whether it's a level |
728 | * set the backlight to max_level in this case | 812 | * or an index). Set the backlight to max_level in this case. |
729 | */ | 813 | */ |
730 | if (use_bios_initial_backlight) { | 814 | for (i = 2; i < br->count; i++) |
731 | for (i = 2; i < br->count; i++) | 815 | if (level_old == br->levels[i]) |
732 | if (level_old == br->levels[i]) | 816 | break; |
733 | level = level_old; | 817 | if (i == br->count) |
734 | } | 818 | level = max_level; |
735 | goto set_level; | ||
736 | } | 819 | } |
737 | 820 | ||
738 | if (br->flags._BCL_reversed) | ||
739 | level_old = (br->count - 1) - level_old; | ||
740 | level = br->levels[level_old]; | ||
741 | |||
742 | set_level: | 821 | set_level: |
743 | result = acpi_video_device_lcd_set_level(device, level); | 822 | result = acpi_video_device_lcd_set_level(device, level); |
744 | if (result) | 823 | if (result) |
@@ -996,53 +1075,51 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
996 | struct acpi_video_device *data; | 1075 | struct acpi_video_device *data; |
997 | struct acpi_video_device_attrib* attribute; | 1076 | struct acpi_video_device_attrib* attribute; |
998 | 1077 | ||
999 | if (!device || !video) | ||
1000 | return -EINVAL; | ||
1001 | |||
1002 | status = | 1078 | status = |
1003 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | 1079 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); |
1004 | if (ACPI_SUCCESS(status)) { | 1080 | /* Some device omits _ADR, we skip them instead of fail */ |
1005 | 1081 | if (ACPI_FAILURE(status)) | |
1006 | data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL); | 1082 | return 0; |
1007 | if (!data) | ||
1008 | return -ENOMEM; | ||
1009 | |||
1010 | strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); | ||
1011 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); | ||
1012 | device->driver_data = data; | ||
1013 | |||
1014 | data->device_id = device_id; | ||
1015 | data->video = video; | ||
1016 | data->dev = device; | ||
1017 | 1083 | ||
1018 | attribute = acpi_video_get_device_attr(video, device_id); | 1084 | data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL); |
1085 | if (!data) | ||
1086 | return -ENOMEM; | ||
1019 | 1087 | ||
1020 | if((attribute != NULL) && attribute->device_id_scheme) { | 1088 | strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME); |
1021 | switch (attribute->display_type) { | 1089 | strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS); |
1022 | case ACPI_VIDEO_DISPLAY_CRT: | 1090 | device->driver_data = data; |
1023 | data->flags.crt = 1; | 1091 | |
1024 | break; | 1092 | data->device_id = device_id; |
1025 | case ACPI_VIDEO_DISPLAY_TV: | 1093 | data->video = video; |
1026 | data->flags.tvout = 1; | 1094 | data->dev = device; |
1027 | break; | 1095 | |
1028 | case ACPI_VIDEO_DISPLAY_DVI: | 1096 | attribute = acpi_video_get_device_attr(video, device_id); |
1029 | data->flags.dvi = 1; | 1097 | |
1030 | break; | 1098 | if((attribute != NULL) && attribute->device_id_scheme) { |
1031 | case ACPI_VIDEO_DISPLAY_LCD: | 1099 | switch (attribute->display_type) { |
1032 | data->flags.lcd = 1; | 1100 | case ACPI_VIDEO_DISPLAY_CRT: |
1033 | break; | 1101 | data->flags.crt = 1; |
1034 | default: | 1102 | break; |
1035 | data->flags.unknown = 1; | 1103 | case ACPI_VIDEO_DISPLAY_TV: |
1036 | break; | 1104 | data->flags.tvout = 1; |
1037 | } | 1105 | break; |
1038 | if(attribute->bios_can_detect) | 1106 | case ACPI_VIDEO_DISPLAY_DVI: |
1039 | data->flags.bios = 1; | 1107 | data->flags.dvi = 1; |
1040 | } else { | 1108 | break; |
1041 | /* Check for legacy IDs */ | 1109 | case ACPI_VIDEO_DISPLAY_LCD: |
1042 | device_type = acpi_video_get_device_type(video, | 1110 | data->flags.lcd = 1; |
1043 | device_id); | 1111 | break; |
1044 | /* Ignore bits 16 and 18-20 */ | 1112 | default: |
1045 | switch (device_type & 0xffe2ffff) { | 1113 | data->flags.unknown = 1; |
1114 | break; | ||
1115 | } | ||
1116 | if(attribute->bios_can_detect) | ||
1117 | data->flags.bios = 1; | ||
1118 | } else { | ||
1119 | /* Check for legacy IDs */ | ||
1120 | device_type = acpi_video_get_device_type(video, device_id); | ||
1121 | /* Ignore bits 16 and 18-20 */ | ||
1122 | switch (device_type & 0xffe2ffff) { | ||
1046 | case ACPI_VIDEO_DISPLAY_LEGACY_MONITOR: | 1123 | case ACPI_VIDEO_DISPLAY_LEGACY_MONITOR: |
1047 | data->flags.crt = 1; | 1124 | data->flags.crt = 1; |
1048 | break; | 1125 | break; |
@@ -1054,34 +1131,24 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1054 | break; | 1131 | break; |
1055 | default: | 1132 | default: |
1056 | data->flags.unknown = 1; | 1133 | data->flags.unknown = 1; |
1057 | } | ||
1058 | } | 1134 | } |
1135 | } | ||
1059 | 1136 | ||
1060 | acpi_video_device_bind(video, data); | 1137 | acpi_video_device_bind(video, data); |
1061 | acpi_video_device_find_cap(data); | 1138 | acpi_video_device_find_cap(data); |
1062 | |||
1063 | status = acpi_install_notify_handler(device->handle, | ||
1064 | ACPI_DEVICE_NOTIFY, | ||
1065 | acpi_video_device_notify, | ||
1066 | data); | ||
1067 | if (ACPI_FAILURE(status)) { | ||
1068 | printk(KERN_ERR PREFIX | ||
1069 | "Error installing notify handler\n"); | ||
1070 | if(data->brightness) | ||
1071 | kfree(data->brightness->levels); | ||
1072 | kfree(data->brightness); | ||
1073 | kfree(data); | ||
1074 | return -ENODEV; | ||
1075 | } | ||
1076 | 1139 | ||
1077 | mutex_lock(&video->device_list_lock); | 1140 | status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, |
1078 | list_add_tail(&data->entry, &video->video_device_list); | 1141 | acpi_video_device_notify, data); |
1079 | mutex_unlock(&video->device_list_lock); | 1142 | if (ACPI_FAILURE(status)) |
1143 | dev_err(&device->dev, "Error installing notify handler\n"); | ||
1144 | else | ||
1145 | data->flags.notify = 1; | ||
1080 | 1146 | ||
1081 | return 0; | 1147 | mutex_lock(&video->device_list_lock); |
1082 | } | 1148 | list_add_tail(&data->entry, &video->video_device_list); |
1149 | mutex_unlock(&video->device_list_lock); | ||
1083 | 1150 | ||
1084 | return -ENOENT; | 1151 | return status; |
1085 | } | 1152 | } |
1086 | 1153 | ||
1087 | /* | 1154 | /* |
@@ -1268,7 +1335,8 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
1268 | goto out; | 1335 | goto out; |
1269 | 1336 | ||
1270 | result = acpi_video_device_lcd_get_level_current(device, | 1337 | result = acpi_video_device_lcd_get_level_current(device, |
1271 | &level_current, 0); | 1338 | &level_current, |
1339 | false); | ||
1272 | if (result) | 1340 | if (result) |
1273 | goto out; | 1341 | goto out; |
1274 | 1342 | ||
@@ -1373,9 +1441,8 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, | |||
1373 | 1441 | ||
1374 | status = acpi_video_bus_get_one_device(dev, video); | 1442 | status = acpi_video_bus_get_one_device(dev, video); |
1375 | if (status) { | 1443 | if (status) { |
1376 | printk(KERN_WARNING PREFIX | 1444 | dev_err(&dev->dev, "Can't attach device\n"); |
1377 | "Can't attach device\n"); | 1445 | break; |
1378 | continue; | ||
1379 | } | 1446 | } |
1380 | } | 1447 | } |
1381 | return status; | 1448 | return status; |
@@ -1388,13 +1455,14 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1388 | if (!device || !device->video) | 1455 | if (!device || !device->video) |
1389 | return -ENOENT; | 1456 | return -ENOENT; |
1390 | 1457 | ||
1391 | status = acpi_remove_notify_handler(device->dev->handle, | 1458 | if (device->flags.notify) { |
1392 | ACPI_DEVICE_NOTIFY, | 1459 | status = acpi_remove_notify_handler(device->dev->handle, |
1393 | acpi_video_device_notify); | 1460 | ACPI_DEVICE_NOTIFY, acpi_video_device_notify); |
1394 | if (ACPI_FAILURE(status)) { | 1461 | if (ACPI_FAILURE(status)) |
1395 | printk(KERN_WARNING PREFIX | 1462 | dev_err(&device->dev->dev, |
1396 | "Can't remove video notify handler\n"); | 1463 | "Can't remove video notify handler\n"); |
1397 | } | 1464 | } |
1465 | |||
1398 | if (device->backlight) { | 1466 | if (device->backlight) { |
1399 | backlight_device_unregister(device->backlight); | 1467 | backlight_device_unregister(device->backlight); |
1400 | device->backlight = NULL; | 1468 | device->backlight = NULL; |
@@ -1676,7 +1744,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1676 | 1744 | ||
1677 | error = acpi_video_bus_get_devices(video, device); | 1745 | error = acpi_video_bus_get_devices(video, device); |
1678 | if (error) | 1746 | if (error) |
1679 | goto err_free_video; | 1747 | goto err_put_video; |
1680 | 1748 | ||
1681 | video->input = input = input_allocate_device(); | 1749 | video->input = input = input_allocate_device(); |
1682 | if (!input) { | 1750 | if (!input) { |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 4ac2593234e7..66f67626f02e 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -67,40 +67,37 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | |||
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |
69 | 69 | ||
70 | /* Returns true if the device is a video device which can be handled by | 70 | /* Returns true if the ACPI object is a video device which can be |
71 | * video.ko. | 71 | * handled by video.ko. |
72 | * The device will get a Linux specific CID added in scan.c to | 72 | * The device will get a Linux specific CID added in scan.c to |
73 | * identify the device as an ACPI graphics device | 73 | * identify the device as an ACPI graphics device |
74 | * Be aware that the graphics device may not be physically present | 74 | * Be aware that the graphics device may not be physically present |
75 | * Use acpi_video_get_capabilities() to detect general ACPI video | 75 | * Use acpi_video_get_capabilities() to detect general ACPI video |
76 | * capabilities of present cards | 76 | * capabilities of present cards |
77 | */ | 77 | */ |
78 | long acpi_is_video_device(struct acpi_device *device) | 78 | long acpi_is_video_device(acpi_handle handle) |
79 | { | 79 | { |
80 | acpi_handle h_dummy; | 80 | acpi_handle h_dummy; |
81 | long video_caps = 0; | 81 | long video_caps = 0; |
82 | 82 | ||
83 | if (!device) | ||
84 | return 0; | ||
85 | |||
86 | /* Is this device able to support video switching ? */ | 83 | /* Is this device able to support video switching ? */ |
87 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) || | 84 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) || |
88 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | 85 | ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy))) |
89 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | 86 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; |
90 | 87 | ||
91 | /* Is this device able to retrieve a video ROM ? */ | 88 | /* Is this device able to retrieve a video ROM ? */ |
92 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) | 89 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy))) |
93 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | 90 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; |
94 | 91 | ||
95 | /* Is this device able to configure which video head to be POSTed ? */ | 92 | /* Is this device able to configure which video head to be POSTed ? */ |
96 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && | 93 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) && |
97 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && | 94 | ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) && |
98 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) | 95 | ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy))) |
99 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; | 96 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; |
100 | 97 | ||
101 | /* Only check for backlight functionality if one of the above hit. */ | 98 | /* Only check for backlight functionality if one of the above hit. */ |
102 | if (video_caps) | 99 | if (video_caps) |
103 | acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle, | 100 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, |
104 | ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL, | 101 | ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL, |
105 | &video_caps, NULL); | 102 | &video_caps, NULL); |
106 | 103 | ||
@@ -127,7 +124,7 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
127 | if (!dev) | 124 | if (!dev) |
128 | return AE_OK; | 125 | return AE_OK; |
129 | pci_dev_put(dev); | 126 | pci_dev_put(dev); |
130 | *cap |= acpi_is_video_device(acpi_dev); | 127 | *cap |= acpi_is_video_device(handle); |
131 | } | 128 | } |
132 | return AE_OK; | 129 | return AE_OK; |
133 | } | 130 | } |