]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * acpi_osl.c - OS-dependent functions ($Revision: 83 $) | |
3 | * | |
4 | * Copyright (C) 2000 Andrew Henroid | |
5 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | |
6 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | |
f1241c87 MW |
7 | * Copyright (c) 2008 Intel Corporation |
8 | * Author: Matthew Wilcox <willy@linux.intel.com> | |
1da177e4 LT |
9 | * |
10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
11 | * | |
12 | * This program is free software; you can redistribute it and/or modify | |
13 | * it under the terms of the GNU General Public License as published by | |
14 | * the Free Software Foundation; either version 2 of the License, or | |
15 | * (at your option) any later version. | |
16 | * | |
17 | * This program is distributed in the hope that it will be useful, | |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | * GNU General Public License for more details. | |
21 | * | |
22 | * You should have received a copy of the GNU General Public License | |
23 | * along with this program; if not, write to the Free Software | |
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 | * | |
26 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
27 | * | |
28 | */ | |
29 | ||
1da177e4 LT |
30 | #include <linux/module.h> |
31 | #include <linux/kernel.h> | |
32 | #include <linux/slab.h> | |
33 | #include <linux/mm.h> | |
34 | #include <linux/pci.h> | |
1da177e4 LT |
35 | #include <linux/interrupt.h> |
36 | #include <linux/kmod.h> | |
37 | #include <linux/delay.h> | |
38 | #include <linux/workqueue.h> | |
39 | #include <linux/nmi.h> | |
ad71860a | 40 | #include <linux/acpi.h> |
1da177e4 | 41 | #include <linux/efi.h> |
df92e695 TR |
42 | #include <linux/ioport.h> |
43 | #include <linux/list.h> | |
f1241c87 MW |
44 | #include <linux/jiffies.h> |
45 | #include <linux/semaphore.h> | |
46 | ||
47 | #include <asm/io.h> | |
48 | #include <asm/uaccess.h> | |
49 | ||
50 | #include <acpi/acpi.h> | |
51 | #include <acpi/acpi_bus.h> | |
52 | #include <acpi/processor.h> | |
1da177e4 | 53 | |
1da177e4 | 54 | #define _COMPONENT ACPI_OS_SERVICES |
f52fd66d | 55 | ACPI_MODULE_NAME("osl"); |
1da177e4 | 56 | #define PREFIX "ACPI: " |
4be44fcd LB |
57 | struct acpi_os_dpc { |
58 | acpi_osd_exec_callback function; | |
59 | void *context; | |
65f27f38 | 60 | struct work_struct work; |
9ac61856 | 61 | int wait; |
1da177e4 LT |
62 | }; |
63 | ||
64 | #ifdef CONFIG_ACPI_CUSTOM_DSDT | |
65 | #include CONFIG_ACPI_CUSTOM_DSDT_FILE | |
66 | #endif | |
67 | ||
68 | #ifdef ENABLE_DEBUGGER | |
69 | #include <linux/kdb.h> | |
70 | ||
71 | /* stuff for debugger support */ | |
72 | int acpi_in_debugger; | |
73 | EXPORT_SYMBOL(acpi_in_debugger); | |
74 | ||
75 | extern char line_buf[80]; | |
4be44fcd | 76 | #endif /*ENABLE_DEBUGGER */ |
1da177e4 LT |
77 | |
78 | static unsigned int acpi_irq_irq; | |
79 | static acpi_osd_handler acpi_irq_handler; | |
80 | static void *acpi_irq_context; | |
81 | static struct workqueue_struct *kacpid_wq; | |
88db5e14 | 82 | static struct workqueue_struct *kacpi_notify_wq; |
c02256be | 83 | static struct workqueue_struct *kacpi_hotplug_wq; |
1da177e4 | 84 | |
df92e695 TR |
85 | struct acpi_res_list { |
86 | resource_size_t start; | |
87 | resource_size_t end; | |
88 | acpi_adr_space_type resource_type; /* IO port, System memory, ...*/ | |
89 | char name[5]; /* only can have a length of 4 chars, make use of this | |
90 | one instead of res->name, no need to kalloc then */ | |
91 | struct list_head resource_list; | |
a5fe1a03 | 92 | int count; |
df92e695 TR |
93 | }; |
94 | ||
95 | static LIST_HEAD(resource_list_head); | |
96 | static DEFINE_SPINLOCK(acpi_res_lock); | |
97 | ||
620242ae MS |
98 | /* |
99 | * This list of permanent mappings is for memory that may be accessed from | |
100 | * interrupt context, where we can't do the ioremap(). | |
101 | */ | |
102 | struct acpi_ioremap { | |
103 | struct list_head list; | |
104 | void __iomem *virt; | |
105 | acpi_physical_address phys; | |
106 | acpi_size size; | |
4a3cba5e | 107 | struct kref ref; |
620242ae MS |
108 | }; |
109 | ||
110 | static LIST_HEAD(acpi_ioremaps); | |
111 | static DEFINE_SPINLOCK(acpi_ioremap_lock); | |
112 | ||
ae00d812 | 113 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ |
b0ed7a91 LM |
114 | static char osi_setup_string[OSI_STRING_LENGTH_MAX]; |
115 | ||
116 | static void __init acpi_osi_setup_late(void); | |
ae00d812 | 117 | |
d4b7dc49 | 118 | /* |
a6e0887f | 119 | * The story of _OSI(Linux) |
d4b7dc49 | 120 | * |
a6e0887f LB |
121 | * From pre-history through Linux-2.6.22, |
122 | * Linux responded TRUE upon a BIOS OSI(Linux) query. | |
d4b7dc49 | 123 | * |
a6e0887f LB |
124 | * Unfortunately, reference BIOS writers got wind of this |
125 | * and put OSI(Linux) in their example code, quickly exposing | |
126 | * this string as ill-conceived and opening the door to | |
127 | * an un-bounded number of BIOS incompatibilities. | |
d4b7dc49 | 128 | * |
a6e0887f LB |
129 | * For example, OSI(Linux) was used on resume to re-POST a |
130 | * video card on one system, because Linux at that time | |
131 | * could not do a speedy restore in its native driver. | |
132 | * But then upon gaining quick native restore capability, | |
133 | * Linux has no way to tell the BIOS to skip the time-consuming | |
134 | * POST -- putting Linux at a permanent performance disadvantage. | |
135 | * On another system, the BIOS writer used OSI(Linux) | |
136 | * to infer native OS support for IPMI! On other systems, | |
137 | * OSI(Linux) simply got in the way of Linux claiming to | |
138 | * be compatible with other operating systems, exposing | |
139 | * BIOS issues such as skipped device initialization. | |
d4b7dc49 | 140 | * |
a6e0887f LB |
141 | * So "Linux" turned out to be a really poor chose of |
142 | * OSI string, and from Linux-2.6.23 onward we respond FALSE. | |
d4b7dc49 LB |
143 | * |
144 | * BIOS writers should NOT query _OSI(Linux) on future systems. | |
a6e0887f LB |
145 | * Linux will complain on the console when it sees it, and return FALSE. |
146 | * To get Linux to return TRUE for your system will require | |
147 | * a kernel source update to add a DMI entry, | |
148 | * or boot with "acpi_osi=Linux" | |
d4b7dc49 | 149 | */ |
d4b7dc49 | 150 | |
1d15d84e | 151 | static struct osi_linux { |
d4b7dc49 LB |
152 | unsigned int enable:1; |
153 | unsigned int dmi:1; | |
154 | unsigned int cmdline:1; | |
155 | unsigned int known:1; | |
a6e0887f | 156 | } osi_linux = { 0, 0, 0, 0}; |
f507654d | 157 | |
b0ed7a91 LM |
158 | static u32 acpi_osi_handler(acpi_string interface, u32 supported) |
159 | { | |
160 | if (!strcmp("Linux", interface)) { | |
161 | ||
3af283e1 | 162 | printk(KERN_NOTICE FW_BUG PREFIX |
b0ed7a91 LM |
163 | "BIOS _OSI(Linux) query %s%s\n", |
164 | osi_linux.enable ? "honored" : "ignored", | |
165 | osi_linux.cmdline ? " via cmdline" : | |
166 | osi_linux.dmi ? " via DMI" : ""); | |
167 | } | |
168 | ||
169 | return supported; | |
170 | } | |
171 | ||
9a47cdb1 BH |
172 | static void __init acpi_request_region (struct acpi_generic_address *addr, |
173 | unsigned int length, char *desc) | |
174 | { | |
9a47cdb1 BH |
175 | if (!addr->address || !length) |
176 | return; | |
177 | ||
cfa806f0 | 178 | /* Resources are never freed */ |
eee3c859 | 179 | if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO) |
cfa806f0 | 180 | request_region(addr->address, length, desc); |
eee3c859 | 181 | else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) |
cfa806f0 | 182 | request_mem_region(addr->address, length, desc); |
9a47cdb1 BH |
183 | } |
184 | ||
185 | static int __init acpi_reserve_resources(void) | |
186 | { | |
eee3c859 | 187 | acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, |
9a47cdb1 BH |
188 | "ACPI PM1a_EVT_BLK"); |
189 | ||
eee3c859 | 190 | acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length, |
9a47cdb1 BH |
191 | "ACPI PM1b_EVT_BLK"); |
192 | ||
eee3c859 | 193 | acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length, |
9a47cdb1 BH |
194 | "ACPI PM1a_CNT_BLK"); |
195 | ||
eee3c859 | 196 | acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length, |
9a47cdb1 BH |
197 | "ACPI PM1b_CNT_BLK"); |
198 | ||
eee3c859 LB |
199 | if (acpi_gbl_FADT.pm_timer_length == 4) |
200 | acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR"); | |
9a47cdb1 | 201 | |
eee3c859 | 202 | acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length, |
9a47cdb1 BH |
203 | "ACPI PM2_CNT_BLK"); |
204 | ||
205 | /* Length of GPE blocks must be a non-negative multiple of 2 */ | |
206 | ||
eee3c859 LB |
207 | if (!(acpi_gbl_FADT.gpe0_block_length & 0x1)) |
208 | acpi_request_region(&acpi_gbl_FADT.xgpe0_block, | |
209 | acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK"); | |
9a47cdb1 | 210 | |
eee3c859 LB |
211 | if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) |
212 | acpi_request_region(&acpi_gbl_FADT.xgpe1_block, | |
213 | acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); | |
9a47cdb1 BH |
214 | |
215 | return 0; | |
216 | } | |
217 | device_initcall(acpi_reserve_resources); | |
218 | ||
4be44fcd | 219 | void acpi_os_printf(const char *fmt, ...) |
1da177e4 LT |
220 | { |
221 | va_list args; | |
222 | va_start(args, fmt); | |
223 | acpi_os_vprintf(fmt, args); | |
224 | va_end(args); | |
225 | } | |
4be44fcd | 226 | |
4be44fcd | 227 | void acpi_os_vprintf(const char *fmt, va_list args) |
1da177e4 LT |
228 | { |
229 | static char buffer[512]; | |
4be44fcd | 230 | |
1da177e4 LT |
231 | vsprintf(buffer, fmt, args); |
232 | ||
233 | #ifdef ENABLE_DEBUGGER | |
234 | if (acpi_in_debugger) { | |
235 | kdb_printf("%s", buffer); | |
236 | } else { | |
4d939155 | 237 | printk(KERN_CONT "%s", buffer); |
1da177e4 LT |
238 | } |
239 | #else | |
4d939155 | 240 | printk(KERN_CONT "%s", buffer); |
1da177e4 LT |
241 | #endif |
242 | } | |
243 | ||
ad71860a | 244 | acpi_physical_address __init acpi_os_get_root_pointer(void) |
1da177e4 LT |
245 | { |
246 | if (efi_enabled) { | |
b2c99e3c | 247 | if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) |
ad71860a | 248 | return efi.acpi20; |
b2c99e3c | 249 | else if (efi.acpi != EFI_INVALID_TABLE_ADDR) |
ad71860a | 250 | return efi.acpi; |
1da177e4 | 251 | else { |
4be44fcd LB |
252 | printk(KERN_ERR PREFIX |
253 | "System description tables not found\n"); | |
ad71860a | 254 | return 0; |
1da177e4 | 255 | } |
239665a3 LB |
256 | } else { |
257 | acpi_physical_address pa = 0; | |
258 | ||
259 | acpi_find_root_pointer(&pa); | |
260 | return pa; | |
261 | } | |
1da177e4 LT |
262 | } |
263 | ||
78cdb3ed | 264 | /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */ |
4a3cba5e MS |
265 | static struct acpi_ioremap * |
266 | acpi_map_lookup(acpi_physical_address phys, acpi_size size) | |
620242ae MS |
267 | { |
268 | struct acpi_ioremap *map; | |
269 | ||
78cdb3ed | 270 | list_for_each_entry_rcu(map, &acpi_ioremaps, list) |
620242ae MS |
271 | if (map->phys <= phys && |
272 | phys + size <= map->phys + map->size) | |
4a3cba5e MS |
273 | return map; |
274 | ||
275 | return NULL; | |
276 | } | |
277 | ||
278 | /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */ | |
279 | static void __iomem * | |
280 | acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size) | |
281 | { | |
282 | struct acpi_ioremap *map; | |
283 | ||
284 | map = acpi_map_lookup(phys, size); | |
285 | if (map) | |
286 | return map->virt + (phys - map->phys); | |
620242ae MS |
287 | |
288 | return NULL; | |
289 | } | |
290 | ||
78cdb3ed | 291 | /* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */ |
620242ae MS |
292 | static struct acpi_ioremap * |
293 | acpi_map_lookup_virt(void __iomem *virt, acpi_size size) | |
294 | { | |
295 | struct acpi_ioremap *map; | |
296 | ||
78cdb3ed | 297 | list_for_each_entry_rcu(map, &acpi_ioremaps, list) |
4a3cba5e MS |
298 | if (map->virt <= virt && |
299 | virt + size <= map->virt + map->size) | |
620242ae MS |
300 | return map; |
301 | ||
302 | return NULL; | |
303 | } | |
304 | ||
2fdf0741 JB |
305 | void __iomem *__init_refok |
306 | acpi_os_map_memory(acpi_physical_address phys, acpi_size size) | |
1da177e4 | 307 | { |
4a3cba5e MS |
308 | struct acpi_ioremap *map, *tmp_map; |
309 | unsigned long flags, pg_sz; | |
620242ae | 310 | void __iomem *virt; |
4a3cba5e | 311 | phys_addr_t pg_off; |
620242ae | 312 | |
9f4fd61f BH |
313 | if (phys > ULONG_MAX) { |
314 | printk(KERN_ERR PREFIX "Cannot map memory that high\n"); | |
70c0846e | 315 | return NULL; |
1da177e4 | 316 | } |
620242ae MS |
317 | |
318 | if (!acpi_gbl_permanent_mmap) | |
ad71860a | 319 | return __acpi_map_table((unsigned long)phys, size); |
620242ae MS |
320 | |
321 | map = kzalloc(sizeof(*map), GFP_KERNEL); | |
322 | if (!map) | |
323 | return NULL; | |
324 | ||
4a3cba5e MS |
325 | pg_off = round_down(phys, PAGE_SIZE); |
326 | pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; | |
327 | virt = ioremap(pg_off, pg_sz); | |
620242ae MS |
328 | if (!virt) { |
329 | kfree(map); | |
330 | return NULL; | |
331 | } | |
332 | ||
333 | INIT_LIST_HEAD(&map->list); | |
334 | map->virt = virt; | |
4a3cba5e MS |
335 | map->phys = pg_off; |
336 | map->size = pg_sz; | |
337 | kref_init(&map->ref); | |
620242ae MS |
338 | |
339 | spin_lock_irqsave(&acpi_ioremap_lock, flags); | |
4a3cba5e MS |
340 | /* Check if page has already been mapped. */ |
341 | tmp_map = acpi_map_lookup(phys, size); | |
342 | if (tmp_map) { | |
343 | kref_get(&tmp_map->ref); | |
344 | spin_unlock_irqrestore(&acpi_ioremap_lock, flags); | |
345 | iounmap(map->virt); | |
346 | kfree(map); | |
347 | return tmp_map->virt + (phys - tmp_map->phys); | |
348 | } | |
78cdb3ed | 349 | list_add_tail_rcu(&map->list, &acpi_ioremaps); |
620242ae MS |
350 | spin_unlock_irqrestore(&acpi_ioremap_lock, flags); |
351 | ||
4a3cba5e | 352 | return map->virt + (phys - map->phys); |
1da177e4 | 353 | } |
55a82ab3 | 354 | EXPORT_SYMBOL_GPL(acpi_os_map_memory); |
1da177e4 | 355 | |
4a3cba5e MS |
356 | static void acpi_kref_del_iomap(struct kref *ref) |
357 | { | |
358 | struct acpi_ioremap *map; | |
359 | ||
360 | map = container_of(ref, struct acpi_ioremap, ref); | |
361 | list_del_rcu(&map->list); | |
362 | } | |
363 | ||
0d3a9cf5 | 364 | void __ref acpi_os_unmap_memory(void __iomem *virt, acpi_size size) |
1da177e4 | 365 | { |
620242ae MS |
366 | struct acpi_ioremap *map; |
367 | unsigned long flags; | |
4a3cba5e | 368 | int del; |
620242ae MS |
369 | |
370 | if (!acpi_gbl_permanent_mmap) { | |
7d97277b | 371 | __acpi_unmap_table(virt, size); |
620242ae MS |
372 | return; |
373 | } | |
374 | ||
375 | spin_lock_irqsave(&acpi_ioremap_lock, flags); | |
376 | map = acpi_map_lookup_virt(virt, size); | |
377 | if (!map) { | |
378 | spin_unlock_irqrestore(&acpi_ioremap_lock, flags); | |
379 | printk(KERN_ERR PREFIX "%s: bad address %p\n", __func__, virt); | |
380 | dump_stack(); | |
381 | return; | |
382 | } | |
383 | ||
4a3cba5e | 384 | del = kref_put(&map->ref, acpi_kref_del_iomap); |
620242ae MS |
385 | spin_unlock_irqrestore(&acpi_ioremap_lock, flags); |
386 | ||
4a3cba5e MS |
387 | if (!del) |
388 | return; | |
389 | ||
78cdb3ed | 390 | synchronize_rcu(); |
620242ae MS |
391 | iounmap(map->virt); |
392 | kfree(map); | |
1da177e4 | 393 | } |
55a82ab3 | 394 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); |
1da177e4 | 395 | |
0d3a9cf5 | 396 | void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size) |
7d97277b YL |
397 | { |
398 | if (!acpi_gbl_permanent_mmap) | |
399 | __acpi_unmap_table(virt, size); | |
400 | } | |
401 | ||
29718521 MS |
402 | int acpi_os_map_generic_address(struct acpi_generic_address *addr) |
403 | { | |
404 | void __iomem *virt; | |
405 | ||
406 | if (addr->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) | |
407 | return 0; | |
408 | ||
409 | if (!addr->address || !addr->bit_width) | |
410 | return -EINVAL; | |
411 | ||
412 | virt = acpi_os_map_memory(addr->address, addr->bit_width / 8); | |
413 | if (!virt) | |
414 | return -EIO; | |
415 | ||
416 | return 0; | |
417 | } | |
418 | EXPORT_SYMBOL_GPL(acpi_os_map_generic_address); | |
419 | ||
420 | void acpi_os_unmap_generic_address(struct acpi_generic_address *addr) | |
421 | { | |
422 | void __iomem *virt; | |
423 | unsigned long flags; | |
424 | acpi_size size = addr->bit_width / 8; | |
425 | ||
426 | if (addr->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) | |
427 | return; | |
428 | ||
429 | if (!addr->address || !addr->bit_width) | |
430 | return; | |
431 | ||
432 | spin_lock_irqsave(&acpi_ioremap_lock, flags); | |
433 | virt = acpi_map_vaddr_lookup(addr->address, size); | |
434 | spin_unlock_irqrestore(&acpi_ioremap_lock, flags); | |
435 | ||
436 | acpi_os_unmap_memory(virt, size); | |
437 | } | |
438 | EXPORT_SYMBOL_GPL(acpi_os_unmap_generic_address); | |
439 | ||
1da177e4 LT |
440 | #ifdef ACPI_FUTURE_USAGE |
441 | acpi_status | |
4be44fcd | 442 | acpi_os_get_physical_address(void *virt, acpi_physical_address * phys) |
1da177e4 | 443 | { |
4be44fcd | 444 | if (!phys || !virt) |
1da177e4 LT |
445 | return AE_BAD_PARAMETER; |
446 | ||
447 | *phys = virt_to_phys(virt); | |
448 | ||
449 | return AE_OK; | |
450 | } | |
451 | #endif | |
452 | ||
453 | #define ACPI_MAX_OVERRIDE_LEN 100 | |
454 | ||
455 | static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN]; | |
456 | ||
457 | acpi_status | |
4be44fcd LB |
458 | acpi_os_predefined_override(const struct acpi_predefined_names *init_val, |
459 | acpi_string * new_val) | |
1da177e4 LT |
460 | { |
461 | if (!init_val || !new_val) | |
462 | return AE_BAD_PARAMETER; | |
463 | ||
464 | *new_val = NULL; | |
4be44fcd | 465 | if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) { |
1da177e4 | 466 | printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n", |
4be44fcd | 467 | acpi_os_name); |
1da177e4 LT |
468 | *new_val = acpi_os_name; |
469 | } | |
470 | ||
471 | return AE_OK; | |
472 | } | |
473 | ||
474 | acpi_status | |
4be44fcd LB |
475 | acpi_os_table_override(struct acpi_table_header * existing_table, |
476 | struct acpi_table_header ** new_table) | |
1da177e4 LT |
477 | { |
478 | if (!existing_table || !new_table) | |
479 | return AE_BAD_PARAMETER; | |
480 | ||
71fc47a9 MG |
481 | *new_table = NULL; |
482 | ||
1da177e4 LT |
483 | #ifdef CONFIG_ACPI_CUSTOM_DSDT |
484 | if (strncmp(existing_table->signature, "DSDT", 4) == 0) | |
4be44fcd | 485 | *new_table = (struct acpi_table_header *)AmlCode; |
1da177e4 | 486 | #endif |
6ed31e92 ÉP |
487 | if (*new_table != NULL) { |
488 | printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " | |
489 | "this is unsafe: tainting kernel\n", | |
490 | existing_table->signature, | |
491 | existing_table->oem_table_id); | |
492 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE); | |
493 | } | |
1da177e4 LT |
494 | return AE_OK; |
495 | } | |
496 | ||
7d12e780 | 497 | static irqreturn_t acpi_irq(int irq, void *dev_id) |
1da177e4 | 498 | { |
5229e87d LB |
499 | u32 handled; |
500 | ||
501 | handled = (*acpi_irq_handler) (acpi_irq_context); | |
502 | ||
503 | if (handled) { | |
504 | acpi_irq_handled++; | |
505 | return IRQ_HANDLED; | |
88bea188 LB |
506 | } else { |
507 | acpi_irq_not_handled++; | |
5229e87d | 508 | return IRQ_NONE; |
88bea188 | 509 | } |
1da177e4 LT |
510 | } |
511 | ||
512 | acpi_status | |
4be44fcd LB |
513 | acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, |
514 | void *context) | |
1da177e4 LT |
515 | { |
516 | unsigned int irq; | |
517 | ||
5229e87d LB |
518 | acpi_irq_stats_init(); |
519 | ||
1da177e4 LT |
520 | /* |
521 | * Ignore the GSI from the core, and use the value in our copy of the | |
522 | * FADT. It may not be the same if an interrupt source override exists | |
523 | * for the SCI. | |
524 | */ | |
cee324b1 | 525 | gsi = acpi_gbl_FADT.sci_interrupt; |
1da177e4 LT |
526 | if (acpi_gsi_to_irq(gsi, &irq) < 0) { |
527 | printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n", | |
528 | gsi); | |
529 | return AE_OK; | |
530 | } | |
531 | ||
532 | acpi_irq_handler = handler; | |
533 | acpi_irq_context = context; | |
dace1453 | 534 | if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { |
1da177e4 LT |
535 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); |
536 | return AE_NOT_ACQUIRED; | |
537 | } | |
538 | acpi_irq_irq = irq; | |
539 | ||
540 | return AE_OK; | |
541 | } | |
542 | ||
4be44fcd | 543 | acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) |
1da177e4 LT |
544 | { |
545 | if (irq) { | |
546 | free_irq(irq, acpi_irq); | |
547 | acpi_irq_handler = NULL; | |
548 | acpi_irq_irq = 0; | |
549 | } | |
550 | ||
551 | return AE_OK; | |
552 | } | |
553 | ||
554 | /* | |
555 | * Running in interpreter thread context, safe to sleep | |
556 | */ | |
557 | ||
439913ff | 558 | void acpi_os_sleep(u64 ms) |
1da177e4 | 559 | { |
01a527ec | 560 | schedule_timeout_interruptible(msecs_to_jiffies(ms)); |
1da177e4 | 561 | } |
4be44fcd | 562 | |
4be44fcd | 563 | void acpi_os_stall(u32 us) |
1da177e4 LT |
564 | { |
565 | while (us) { | |
566 | u32 delay = 1000; | |
567 | ||
568 | if (delay > us) | |
569 | delay = us; | |
570 | udelay(delay); | |
571 | touch_nmi_watchdog(); | |
572 | us -= delay; | |
573 | } | |
574 | } | |
4be44fcd | 575 | |
1da177e4 LT |
576 | /* |
577 | * Support ACPI 3.0 AML Timer operand | |
578 | * Returns 64-bit free-running, monotonically increasing timer | |
579 | * with 100ns granularity | |
580 | */ | |
4be44fcd | 581 | u64 acpi_os_get_timer(void) |
1da177e4 LT |
582 | { |
583 | static u64 t; | |
584 | ||
585 | #ifdef CONFIG_HPET | |
586 | /* TBD: use HPET if available */ | |
587 | #endif | |
588 | ||
589 | #ifdef CONFIG_X86_PM_TIMER | |
590 | /* TBD: default to PM timer if HPET was not available */ | |
591 | #endif | |
592 | if (!t) | |
593 | printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n"); | |
594 | ||
595 | return ++t; | |
596 | } | |
597 | ||
4be44fcd | 598 | acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) |
1da177e4 LT |
599 | { |
600 | u32 dummy; | |
601 | ||
602 | if (!value) | |
603 | value = &dummy; | |
604 | ||
49fbabf5 ZY |
605 | *value = 0; |
606 | if (width <= 8) { | |
4be44fcd | 607 | *(u8 *) value = inb(port); |
49fbabf5 | 608 | } else if (width <= 16) { |
4be44fcd | 609 | *(u16 *) value = inw(port); |
49fbabf5 | 610 | } else if (width <= 32) { |
4be44fcd | 611 | *(u32 *) value = inl(port); |
49fbabf5 | 612 | } else { |
1da177e4 LT |
613 | BUG(); |
614 | } | |
615 | ||
616 | return AE_OK; | |
617 | } | |
4be44fcd | 618 | |
1da177e4 LT |
619 | EXPORT_SYMBOL(acpi_os_read_port); |
620 | ||
4be44fcd | 621 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) |
1da177e4 | 622 | { |
49fbabf5 | 623 | if (width <= 8) { |
1da177e4 | 624 | outb(value, port); |
49fbabf5 | 625 | } else if (width <= 16) { |
1da177e4 | 626 | outw(value, port); |
49fbabf5 | 627 | } else if (width <= 32) { |
1da177e4 | 628 | outl(value, port); |
49fbabf5 | 629 | } else { |
1da177e4 LT |
630 | BUG(); |
631 | } | |
632 | ||
633 | return AE_OK; | |
634 | } | |
4be44fcd | 635 | |
1da177e4 LT |
636 | EXPORT_SYMBOL(acpi_os_write_port); |
637 | ||
638 | acpi_status | |
4be44fcd | 639 | acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) |
1da177e4 | 640 | { |
4be44fcd LB |
641 | u32 dummy; |
642 | void __iomem *virt_addr; | |
620242ae | 643 | int size = width / 8, unmap = 0; |
620242ae | 644 | |
78cdb3ed | 645 | rcu_read_lock(); |
620242ae | 646 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
78cdb3ed | 647 | rcu_read_unlock(); |
620242ae MS |
648 | if (!virt_addr) { |
649 | virt_addr = ioremap(phys_addr, size); | |
650 | unmap = 1; | |
651 | } | |
1da177e4 LT |
652 | if (!value) |
653 | value = &dummy; | |
654 | ||
655 | switch (width) { | |
656 | case 8: | |
4be44fcd | 657 | *(u8 *) value = readb(virt_addr); |
1da177e4 LT |
658 | break; |
659 | case 16: | |
4be44fcd | 660 | *(u16 *) value = readw(virt_addr); |
1da177e4 LT |
661 | break; |
662 | case 32: | |
4be44fcd | 663 | *(u32 *) value = readl(virt_addr); |
1da177e4 LT |
664 | break; |
665 | default: | |
666 | BUG(); | |
667 | } | |
668 | ||
620242ae MS |
669 | if (unmap) |
670 | iounmap(virt_addr); | |
1da177e4 LT |
671 | |
672 | return AE_OK; | |
673 | } | |
674 | ||
675 | acpi_status | |
4be44fcd | 676 | acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) |
1da177e4 | 677 | { |
4be44fcd | 678 | void __iomem *virt_addr; |
620242ae | 679 | int size = width / 8, unmap = 0; |
620242ae | 680 | |
78cdb3ed | 681 | rcu_read_lock(); |
620242ae | 682 | virt_addr = acpi_map_vaddr_lookup(phys_addr, size); |
78cdb3ed | 683 | rcu_read_unlock(); |
620242ae MS |
684 | if (!virt_addr) { |
685 | virt_addr = ioremap(phys_addr, size); | |
686 | unmap = 1; | |
687 | } | |
1da177e4 LT |
688 | |
689 | switch (width) { | |
690 | case 8: | |
691 | writeb(value, virt_addr); | |
692 | break; | |
693 | case 16: | |
694 | writew(value, virt_addr); | |
695 | break; | |
696 | case 32: | |
697 | writel(value, virt_addr); | |
698 | break; | |
699 | default: | |
700 | BUG(); | |
701 | } | |
702 | ||
620242ae MS |
703 | if (unmap) |
704 | iounmap(virt_addr); | |
1da177e4 LT |
705 | |
706 | return AE_OK; | |
707 | } | |
708 | ||
1da177e4 | 709 | acpi_status |
4be44fcd | 710 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
c5f0231e | 711 | u64 *value, u32 width) |
1da177e4 LT |
712 | { |
713 | int result, size; | |
c5f0231e | 714 | u32 value32; |
1da177e4 LT |
715 | |
716 | if (!value) | |
717 | return AE_BAD_PARAMETER; | |
718 | ||
719 | switch (width) { | |
720 | case 8: | |
721 | size = 1; | |
722 | break; | |
723 | case 16: | |
724 | size = 2; | |
725 | break; | |
726 | case 32: | |
727 | size = 4; | |
728 | break; | |
729 | default: | |
730 | return AE_ERROR; | |
731 | } | |
732 | ||
b6ce068a MW |
733 | result = raw_pci_read(pci_id->segment, pci_id->bus, |
734 | PCI_DEVFN(pci_id->device, pci_id->function), | |
c5f0231e BM |
735 | reg, size, &value32); |
736 | *value = value32; | |
1da177e4 LT |
737 | |
738 | return (result ? AE_ERROR : AE_OK); | |
739 | } | |
4be44fcd | 740 | |
1da177e4 | 741 | acpi_status |
4be44fcd | 742 | acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
439913ff | 743 | u64 value, u32 width) |
1da177e4 LT |
744 | { |
745 | int result, size; | |
746 | ||
747 | switch (width) { | |
748 | case 8: | |
749 | size = 1; | |
750 | break; | |
751 | case 16: | |
752 | size = 2; | |
753 | break; | |
754 | case 32: | |
755 | size = 4; | |
756 | break; | |
757 | default: | |
758 | return AE_ERROR; | |
759 | } | |
760 | ||
b6ce068a MW |
761 | result = raw_pci_write(pci_id->segment, pci_id->bus, |
762 | PCI_DEVFN(pci_id->device, pci_id->function), | |
763 | reg, size, value); | |
1da177e4 LT |
764 | |
765 | return (result ? AE_ERROR : AE_OK); | |
766 | } | |
767 | ||
65f27f38 | 768 | static void acpi_os_execute_deferred(struct work_struct *work) |
88db5e14 AS |
769 | { |
770 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | |
88db5e14 | 771 | |
9ac61856 BH |
772 | if (dpc->wait) |
773 | acpi_os_wait_events_complete(NULL); | |
19cd847a ZR |
774 | |
775 | dpc->function(dpc->context); | |
776 | kfree(dpc); | |
19cd847a ZR |
777 | } |
778 | ||
b8d35192 AS |
779 | /******************************************************************************* |
780 | * | |
781 | * FUNCTION: acpi_os_execute | |
782 | * | |
783 | * PARAMETERS: Type - Type of the callback | |
784 | * Function - Function to be executed | |
785 | * Context - Function parameters | |
786 | * | |
787 | * RETURN: Status | |
788 | * | |
789 | * DESCRIPTION: Depending on type, either queues function for deferred execution or | |
790 | * immediately executes function on a separate thread. | |
791 | * | |
792 | ******************************************************************************/ | |
793 | ||
19cd847a ZR |
794 | static acpi_status __acpi_os_execute(acpi_execute_type type, |
795 | acpi_osd_exec_callback function, void *context, int hp) | |
1da177e4 | 796 | { |
4be44fcd LB |
797 | acpi_status status = AE_OK; |
798 | struct acpi_os_dpc *dpc; | |
17bc54ee | 799 | struct workqueue_struct *queue; |
19cd847a | 800 | int ret; |
72945b2b LB |
801 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
802 | "Scheduling function [%p(%p)] for deferred execution.\n", | |
803 | function, context)); | |
1da177e4 | 804 | |
1da177e4 LT |
805 | /* |
806 | * Allocate/initialize DPC structure. Note that this memory will be | |
65f27f38 | 807 | * freed by the callee. The kernel handles the work_struct list in a |
1da177e4 LT |
808 | * way that allows us to also free its memory inside the callee. |
809 | * Because we may want to schedule several tasks with different | |
810 | * parameters we can't use the approach some kernel code uses of | |
65f27f38 | 811 | * having a static work_struct. |
1da177e4 | 812 | */ |
72945b2b | 813 | |
65f27f38 | 814 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); |
1da177e4 | 815 | if (!dpc) |
889c78be | 816 | return AE_NO_MEMORY; |
b976fe19 | 817 | |
1da177e4 LT |
818 | dpc->function = function; |
819 | dpc->context = context; | |
b976fe19 | 820 | |
c02256be ZR |
821 | /* |
822 | * We can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq | |
823 | * because the hotplug code may call driver .remove() functions, | |
824 | * which invoke flush_scheduled_work/acpi_os_wait_events_complete | |
825 | * to flush these workqueues. | |
826 | */ | |
827 | queue = hp ? kacpi_hotplug_wq : | |
828 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); | |
9ac61856 | 829 | dpc->wait = hp ? 1 : 0; |
bc73675b ZR |
830 | |
831 | if (queue == kacpi_hotplug_wq) | |
832 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | |
833 | else if (queue == kacpi_notify_wq) | |
834 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | |
835 | else | |
836 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | |
837 | ||
8fec62b2 TH |
838 | /* |
839 | * On some machines, a software-initiated SMI causes corruption unless | |
840 | * the SMI runs on CPU 0. An SMI can be initiated by any AML, but | |
841 | * typically it's done in GPE-related methods that are run via | |
842 | * workqueues, so we can avoid the known corruption cases by always | |
843 | * queueing on CPU 0. | |
844 | */ | |
845 | ret = queue_work_on(0, queue, &dpc->work); | |
19cd847a ZR |
846 | |
847 | if (!ret) { | |
55ac9a01 LM |
848 | printk(KERN_ERR PREFIX |
849 | "Call to queue_work() failed.\n"); | |
17bc54ee AS |
850 | status = AE_ERROR; |
851 | kfree(dpc); | |
1da177e4 | 852 | } |
889c78be | 853 | return status; |
1da177e4 | 854 | } |
4be44fcd | 855 | |
19cd847a ZR |
856 | acpi_status acpi_os_execute(acpi_execute_type type, |
857 | acpi_osd_exec_callback function, void *context) | |
858 | { | |
859 | return __acpi_os_execute(type, function, context, 0); | |
860 | } | |
b8d35192 | 861 | EXPORT_SYMBOL(acpi_os_execute); |
1da177e4 | 862 | |
19cd847a ZR |
863 | acpi_status acpi_os_hotplug_execute(acpi_osd_exec_callback function, |
864 | void *context) | |
865 | { | |
866 | return __acpi_os_execute(0, function, context, 1); | |
867 | } | |
868 | ||
4be44fcd | 869 | void acpi_os_wait_events_complete(void *context) |
1da177e4 LT |
870 | { |
871 | flush_workqueue(kacpid_wq); | |
2f67a069 | 872 | flush_workqueue(kacpi_notify_wq); |
1da177e4 | 873 | } |
4be44fcd | 874 | |
1da177e4 LT |
875 | EXPORT_SYMBOL(acpi_os_wait_events_complete); |
876 | ||
1da177e4 LT |
877 | /* |
878 | * Deallocate the memory for a spinlock. | |
879 | */ | |
967440e3 | 880 | void acpi_os_delete_lock(acpi_spinlock handle) |
1da177e4 | 881 | { |
d550d98d | 882 | return; |
1da177e4 LT |
883 | } |
884 | ||
1da177e4 | 885 | acpi_status |
4be44fcd | 886 | acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) |
1da177e4 | 887 | { |
4be44fcd | 888 | struct semaphore *sem = NULL; |
1da177e4 | 889 | |
1da177e4 LT |
890 | sem = acpi_os_allocate(sizeof(struct semaphore)); |
891 | if (!sem) | |
d550d98d | 892 | return AE_NO_MEMORY; |
1da177e4 LT |
893 | memset(sem, 0, sizeof(struct semaphore)); |
894 | ||
895 | sema_init(sem, initial_units); | |
896 | ||
4be44fcd | 897 | *handle = (acpi_handle *) sem; |
1da177e4 | 898 | |
4be44fcd LB |
899 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", |
900 | *handle, initial_units)); | |
1da177e4 | 901 | |
d550d98d | 902 | return AE_OK; |
1da177e4 | 903 | } |
1da177e4 | 904 | |
1da177e4 LT |
905 | /* |
906 | * TODO: A better way to delete semaphores? Linux doesn't have a | |
907 | * 'delete_semaphore()' function -- may result in an invalid | |
908 | * pointer dereference for non-synchronized consumers. Should | |
909 | * we at least check for blocked threads and signal/cancel them? | |
910 | */ | |
911 | ||
4be44fcd | 912 | acpi_status acpi_os_delete_semaphore(acpi_handle handle) |
1da177e4 | 913 | { |
4be44fcd | 914 | struct semaphore *sem = (struct semaphore *)handle; |
1da177e4 | 915 | |
1da177e4 | 916 | if (!sem) |
d550d98d | 917 | return AE_BAD_PARAMETER; |
1da177e4 | 918 | |
4be44fcd | 919 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); |
1da177e4 | 920 | |
f1241c87 | 921 | BUG_ON(!list_empty(&sem->wait_list)); |
02438d87 | 922 | kfree(sem); |
4be44fcd | 923 | sem = NULL; |
1da177e4 | 924 | |
d550d98d | 925 | return AE_OK; |
1da177e4 | 926 | } |
1da177e4 | 927 | |
1da177e4 | 928 | /* |
1da177e4 LT |
929 | * TODO: Support for units > 1? |
930 | */ | |
4be44fcd | 931 | acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) |
1da177e4 | 932 | { |
4be44fcd LB |
933 | acpi_status status = AE_OK; |
934 | struct semaphore *sem = (struct semaphore *)handle; | |
f1241c87 | 935 | long jiffies; |
4be44fcd | 936 | int ret = 0; |
1da177e4 | 937 | |
1da177e4 | 938 | if (!sem || (units < 1)) |
d550d98d | 939 | return AE_BAD_PARAMETER; |
1da177e4 LT |
940 | |
941 | if (units > 1) | |
d550d98d | 942 | return AE_SUPPORT; |
1da177e4 | 943 | |
4be44fcd LB |
944 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", |
945 | handle, units, timeout)); | |
1da177e4 | 946 | |
f1241c87 MW |
947 | if (timeout == ACPI_WAIT_FOREVER) |
948 | jiffies = MAX_SCHEDULE_TIMEOUT; | |
949 | else | |
950 | jiffies = msecs_to_jiffies(timeout); | |
951 | ||
952 | ret = down_timeout(sem, jiffies); | |
953 | if (ret) | |
954 | status = AE_TIME; | |
1da177e4 LT |
955 | |
956 | if (ACPI_FAILURE(status)) { | |
9e7e2c04 | 957 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
a6fc6720 | 958 | "Failed to acquire semaphore[%p|%d|%d], %s", |
4be44fcd LB |
959 | handle, units, timeout, |
960 | acpi_format_exception(status))); | |
961 | } else { | |
962 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | |
a6fc6720 | 963 | "Acquired semaphore[%p|%d|%d]", handle, |
4be44fcd | 964 | units, timeout)); |
1da177e4 LT |
965 | } |
966 | ||
d550d98d | 967 | return status; |
1da177e4 | 968 | } |
1da177e4 | 969 | |
1da177e4 LT |
970 | /* |
971 | * TODO: Support for units > 1? | |
972 | */ | |
4be44fcd | 973 | acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) |
1da177e4 | 974 | { |
4be44fcd | 975 | struct semaphore *sem = (struct semaphore *)handle; |
1da177e4 | 976 | |
1da177e4 | 977 | if (!sem || (units < 1)) |
d550d98d | 978 | return AE_BAD_PARAMETER; |
1da177e4 LT |
979 | |
980 | if (units > 1) | |
d550d98d | 981 | return AE_SUPPORT; |
1da177e4 | 982 | |
4be44fcd LB |
983 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, |
984 | units)); | |
1da177e4 LT |
985 | |
986 | up(sem); | |
987 | ||
d550d98d | 988 | return AE_OK; |
1da177e4 | 989 | } |
4be44fcd | 990 | |
1da177e4 | 991 | #ifdef ACPI_FUTURE_USAGE |
4be44fcd | 992 | u32 acpi_os_get_line(char *buffer) |
1da177e4 LT |
993 | { |
994 | ||
995 | #ifdef ENABLE_DEBUGGER | |
996 | if (acpi_in_debugger) { | |
997 | u32 chars; | |
998 | ||
999 | kdb_read(buffer, sizeof(line_buf)); | |
1000 | ||
1001 | /* remove the CR kdb includes */ | |
1002 | chars = strlen(buffer) - 1; | |
1003 | buffer[chars] = '\0'; | |
1004 | } | |
1005 | #endif | |
1006 | ||
1007 | return 0; | |
1008 | } | |
4be44fcd | 1009 | #endif /* ACPI_FUTURE_USAGE */ |
1da177e4 | 1010 | |
4be44fcd | 1011 | acpi_status acpi_os_signal(u32 function, void *info) |
1da177e4 | 1012 | { |
4be44fcd | 1013 | switch (function) { |
1da177e4 LT |
1014 | case ACPI_SIGNAL_FATAL: |
1015 | printk(KERN_ERR PREFIX "Fatal opcode executed\n"); | |
1016 | break; | |
1017 | case ACPI_SIGNAL_BREAKPOINT: | |
1018 | /* | |
1019 | * AML Breakpoint | |
1020 | * ACPI spec. says to treat it as a NOP unless | |
1021 | * you are debugging. So if/when we integrate | |
1022 | * AML debugger into the kernel debugger its | |
1023 | * hook will go here. But until then it is | |
1024 | * not useful to print anything on breakpoints. | |
1025 | */ | |
1026 | break; | |
1027 | default: | |
1028 | break; | |
1029 | } | |
1030 | ||
1031 | return AE_OK; | |
1032 | } | |
4be44fcd | 1033 | |
4be44fcd | 1034 | static int __init acpi_os_name_setup(char *str) |
1da177e4 LT |
1035 | { |
1036 | char *p = acpi_os_name; | |
4be44fcd | 1037 | int count = ACPI_MAX_OVERRIDE_LEN - 1; |
1da177e4 LT |
1038 | |
1039 | if (!str || !*str) | |
1040 | return 0; | |
1041 | ||
1042 | for (; count-- && str && *str; str++) { | |
1043 | if (isalnum(*str) || *str == ' ' || *str == ':') | |
1044 | *p++ = *str; | |
1045 | else if (*str == '\'' || *str == '"') | |
1046 | continue; | |
1047 | else | |
1048 | break; | |
1049 | } | |
1050 | *p = 0; | |
1051 | ||
1052 | return 1; | |
4be44fcd | 1053 | |
1da177e4 LT |
1054 | } |
1055 | ||
1056 | __setup("acpi_os_name=", acpi_os_name_setup); | |
1057 | ||
d4b7dc49 LB |
1058 | static void __init set_osi_linux(unsigned int enable) |
1059 | { | |
1060 | if (osi_linux.enable != enable) { | |
1061 | osi_linux.enable = enable; | |
1062 | printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", | |
1063 | enable ? "Add": "Delet"); | |
1064 | } | |
b0ed7a91 LM |
1065 | |
1066 | if (osi_linux.enable) | |
1067 | acpi_osi_setup("Linux"); | |
1068 | else | |
1069 | acpi_osi_setup("!Linux"); | |
1070 | ||
d4b7dc49 LB |
1071 | return; |
1072 | } | |
1073 | ||
1074 | static void __init acpi_cmdline_osi_linux(unsigned int enable) | |
1075 | { | |
1076 | osi_linux.cmdline = 1; /* cmdline set the default */ | |
1077 | set_osi_linux(enable); | |
1078 | ||
1079 | return; | |
1080 | } | |
1081 | ||
1082 | void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) | |
1083 | { | |
1084 | osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ | |
1085 | ||
1086 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); | |
1087 | ||
1088 | if (enable == -1) | |
1089 | return; | |
1090 | ||
1091 | osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */ | |
f507654d | 1092 | |
d4b7dc49 | 1093 | set_osi_linux(enable); |
f507654d | 1094 | |
f507654d LB |
1095 | return; |
1096 | } | |
1097 | ||
1da177e4 | 1098 | /* |
ae00d812 LB |
1099 | * Modify the list of "OS Interfaces" reported to BIOS via _OSI |
1100 | * | |
1da177e4 | 1101 | * empty string disables _OSI |
ae00d812 LB |
1102 | * string starting with '!' disables that string |
1103 | * otherwise string is added to list, augmenting built-in strings | |
1da177e4 | 1104 | */ |
b0ed7a91 | 1105 | static void __init acpi_osi_setup_late(void) |
1da177e4 | 1106 | { |
b0ed7a91 LM |
1107 | char *str = osi_setup_string; |
1108 | ||
1109 | if (*str == '\0') | |
1110 | return; | |
1111 | ||
1112 | if (!strcmp("!Linux", str)) { | |
d4b7dc49 | 1113 | acpi_cmdline_osi_linux(0); /* !enable */ |
ae00d812 | 1114 | } else if (*str == '!') { |
b0ed7a91 | 1115 | if (acpi_remove_interface(++str) == AE_OK) |
ae00d812 | 1116 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); |
f507654d | 1117 | } else if (!strcmp("Linux", str)) { |
d4b7dc49 | 1118 | acpi_cmdline_osi_linux(1); /* enable */ |
b0ed7a91 LM |
1119 | } else { |
1120 | if (acpi_install_interface(str) == AE_OK) | |
1121 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); | |
1122 | } | |
1123 | } | |
1124 | ||
1125 | int __init acpi_osi_setup(char *str) | |
1126 | { | |
1127 | if (str == NULL || *str == '\0') { | |
1128 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | |
1129 | acpi_gbl_create_osi_method = FALSE; | |
1130 | } else { | |
1131 | strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX); | |
1da177e4 LT |
1132 | } |
1133 | ||
1134 | return 1; | |
1135 | } | |
1136 | ||
1137 | __setup("acpi_osi=", acpi_osi_setup); | |
1138 | ||
1139 | /* enable serialization to combat AE_ALREADY_EXISTS errors */ | |
4be44fcd | 1140 | static int __init acpi_serialize_setup(char *str) |
1da177e4 LT |
1141 | { |
1142 | printk(KERN_INFO PREFIX "serialize enabled\n"); | |
1143 | ||
1144 | acpi_gbl_all_methods_serialized = TRUE; | |
1145 | ||
1146 | return 1; | |
1147 | } | |
1148 | ||
1149 | __setup("acpi_serialize", acpi_serialize_setup); | |
1150 | ||
df92e695 TR |
1151 | /* Check of resource interference between native drivers and ACPI |
1152 | * OperationRegions (SystemIO and System Memory only). | |
1153 | * IO ports and memory declared in ACPI might be used by the ACPI subsystem | |
1154 | * in arbitrary AML code and can interfere with legacy drivers. | |
1155 | * acpi_enforce_resources= can be set to: | |
1156 | * | |
7e90560c | 1157 | * - strict (default) (2) |
df92e695 | 1158 | * -> further driver trying to access the resources will not load |
7e90560c | 1159 | * - lax (1) |
df92e695 TR |
1160 | * -> further driver trying to access the resources will load, but you |
1161 | * get a system message that something might go wrong... | |
1162 | * | |
1163 | * - no (0) | |
1164 | * -> ACPI Operation Region resources will not be registered | |
1165 | * | |
1166 | */ | |
1167 | #define ENFORCE_RESOURCES_STRICT 2 | |
1168 | #define ENFORCE_RESOURCES_LAX 1 | |
1169 | #define ENFORCE_RESOURCES_NO 0 | |
1170 | ||
7e90560c | 1171 | static unsigned int acpi_enforce_resources = ENFORCE_RESOURCES_STRICT; |
df92e695 TR |
1172 | |
1173 | static int __init acpi_enforce_resources_setup(char *str) | |
1174 | { | |
1175 | if (str == NULL || *str == '\0') | |
1176 | return 0; | |
1177 | ||
1178 | if (!strcmp("strict", str)) | |
1179 | acpi_enforce_resources = ENFORCE_RESOURCES_STRICT; | |
1180 | else if (!strcmp("lax", str)) | |
1181 | acpi_enforce_resources = ENFORCE_RESOURCES_LAX; | |
1182 | else if (!strcmp("no", str)) | |
1183 | acpi_enforce_resources = ENFORCE_RESOURCES_NO; | |
1184 | ||
1185 | return 1; | |
1186 | } | |
1187 | ||
1188 | __setup("acpi_enforce_resources=", acpi_enforce_resources_setup); | |
1189 | ||
1190 | /* Check for resource conflicts between ACPI OperationRegions and native | |
1191 | * drivers */ | |
876fba43 | 1192 | int acpi_check_resource_conflict(const struct resource *res) |
df92e695 TR |
1193 | { |
1194 | struct acpi_res_list *res_list_elem; | |
1195 | int ioport; | |
1196 | int clash = 0; | |
1197 | ||
1198 | if (acpi_enforce_resources == ENFORCE_RESOURCES_NO) | |
1199 | return 0; | |
1200 | if (!(res->flags & IORESOURCE_IO) && !(res->flags & IORESOURCE_MEM)) | |
1201 | return 0; | |
1202 | ||
1203 | ioport = res->flags & IORESOURCE_IO; | |
1204 | ||
1205 | spin_lock(&acpi_res_lock); | |
1206 | list_for_each_entry(res_list_elem, &resource_list_head, | |
1207 | resource_list) { | |
1208 | if (ioport && (res_list_elem->resource_type | |
1209 | != ACPI_ADR_SPACE_SYSTEM_IO)) | |
1210 | continue; | |
1211 | if (!ioport && (res_list_elem->resource_type | |
1212 | != ACPI_ADR_SPACE_SYSTEM_MEMORY)) | |
1213 | continue; | |
1214 | ||
1215 | if (res->end < res_list_elem->start | |
1216 | || res_list_elem->end < res->start) | |
1217 | continue; | |
1218 | clash = 1; | |
1219 | break; | |
1220 | } | |
1221 | spin_unlock(&acpi_res_lock); | |
1222 | ||
1223 | if (clash) { | |
1224 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { | |
1638bca8 CD |
1225 | printk(KERN_WARNING "ACPI: resource %s %pR" |
1226 | " conflicts with ACPI region %s %pR\n", | |
1227 | res->name, res, res_list_elem->name, | |
1228 | res_list_elem); | |
14f03343 JD |
1229 | if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) |
1230 | printk(KERN_NOTICE "ACPI: This conflict may" | |
1231 | " cause random problems and system" | |
1232 | " instability\n"); | |
1233 | printk(KERN_INFO "ACPI: If an ACPI driver is available" | |
1234 | " for this device, you should use it instead of" | |
1235 | " the native driver\n"); | |
df92e695 TR |
1236 | } |
1237 | if (acpi_enforce_resources == ENFORCE_RESOURCES_STRICT) | |
1238 | return -EBUSY; | |
1239 | } | |
1240 | return 0; | |
1241 | } | |
443dea72 | 1242 | EXPORT_SYMBOL(acpi_check_resource_conflict); |
df92e695 TR |
1243 | |
1244 | int acpi_check_region(resource_size_t start, resource_size_t n, | |
1245 | const char *name) | |
1246 | { | |
1247 | struct resource res = { | |
1248 | .start = start, | |
1249 | .end = start + n - 1, | |
1250 | .name = name, | |
1251 | .flags = IORESOURCE_IO, | |
1252 | }; | |
1253 | ||
1254 | return acpi_check_resource_conflict(&res); | |
1255 | } | |
1256 | EXPORT_SYMBOL(acpi_check_region); | |
1257 | ||
70dd6bea JD |
1258 | /* |
1259 | * Let drivers know whether the resource checks are effective | |
1260 | */ | |
1261 | int acpi_resources_are_enforced(void) | |
1262 | { | |
1263 | return acpi_enforce_resources == ENFORCE_RESOURCES_STRICT; | |
1264 | } | |
1265 | EXPORT_SYMBOL(acpi_resources_are_enforced); | |
1266 | ||
73459f73 RM |
1267 | /* |
1268 | * Acquire a spinlock. | |
1269 | * | |
1270 | * handle is a pointer to the spinlock_t. | |
73459f73 RM |
1271 | */ |
1272 | ||
967440e3 | 1273 | acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) |
73459f73 | 1274 | { |
b8e4d893 | 1275 | acpi_cpu_flags flags; |
967440e3 | 1276 | spin_lock_irqsave(lockp, flags); |
73459f73 RM |
1277 | return flags; |
1278 | } | |
1279 | ||
1280 | /* | |
1281 | * Release a spinlock. See above. | |
1282 | */ | |
1283 | ||
967440e3 | 1284 | void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) |
73459f73 | 1285 | { |
967440e3 | 1286 | spin_unlock_irqrestore(lockp, flags); |
73459f73 RM |
1287 | } |
1288 | ||
73459f73 RM |
1289 | #ifndef ACPI_USE_LOCAL_CACHE |
1290 | ||
1291 | /******************************************************************************* | |
1292 | * | |
1293 | * FUNCTION: acpi_os_create_cache | |
1294 | * | |
b229cf92 BM |
1295 | * PARAMETERS: name - Ascii name for the cache |
1296 | * size - Size of each cached object | |
1297 | * depth - Maximum depth of the cache (in objects) <ignored> | |
1298 | * cache - Where the new cache object is returned | |
73459f73 | 1299 | * |
b229cf92 | 1300 | * RETURN: status |
73459f73 RM |
1301 | * |
1302 | * DESCRIPTION: Create a cache object | |
1303 | * | |
1304 | ******************************************************************************/ | |
1305 | ||
1306 | acpi_status | |
4be44fcd | 1307 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) |
73459f73 | 1308 | { |
20c2df83 | 1309 | *cache = kmem_cache_create(name, size, 0, 0, NULL); |
a6fdbf90 | 1310 | if (*cache == NULL) |
b229cf92 BM |
1311 | return AE_ERROR; |
1312 | else | |
1313 | return AE_OK; | |
73459f73 RM |
1314 | } |
1315 | ||
1316 | /******************************************************************************* | |
1317 | * | |
1318 | * FUNCTION: acpi_os_purge_cache | |
1319 | * | |
1320 | * PARAMETERS: Cache - Handle to cache object | |
1321 | * | |
1322 | * RETURN: Status | |
1323 | * | |
1324 | * DESCRIPTION: Free all objects within the requested cache. | |
1325 | * | |
1326 | ******************************************************************************/ | |
1327 | ||
4be44fcd | 1328 | acpi_status acpi_os_purge_cache(acpi_cache_t * cache) |
73459f73 | 1329 | { |
50dd0969 | 1330 | kmem_cache_shrink(cache); |
4be44fcd | 1331 | return (AE_OK); |
73459f73 RM |
1332 | } |
1333 | ||
1334 | /******************************************************************************* | |
1335 | * | |
1336 | * FUNCTION: acpi_os_delete_cache | |
1337 | * | |
1338 | * PARAMETERS: Cache - Handle to cache object | |
1339 | * | |
1340 | * RETURN: Status | |
1341 | * | |
1342 | * DESCRIPTION: Free all objects within the requested cache and delete the | |
1343 | * cache object. | |
1344 | * | |
1345 | ******************************************************************************/ | |
1346 | ||
4be44fcd | 1347 | acpi_status acpi_os_delete_cache(acpi_cache_t * cache) |
73459f73 | 1348 | { |
1a1d92c1 | 1349 | kmem_cache_destroy(cache); |
4be44fcd | 1350 | return (AE_OK); |
73459f73 RM |
1351 | } |
1352 | ||
1353 | /******************************************************************************* | |
1354 | * | |
1355 | * FUNCTION: acpi_os_release_object | |
1356 | * | |
1357 | * PARAMETERS: Cache - Handle to cache object | |
1358 | * Object - The object to be released | |
1359 | * | |
1360 | * RETURN: None | |
1361 | * | |
1362 | * DESCRIPTION: Release an object to the specified cache. If cache is full, | |
1363 | * the object is deleted. | |
1364 | * | |
1365 | ******************************************************************************/ | |
1366 | ||
4be44fcd | 1367 | acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) |
73459f73 | 1368 | { |
4be44fcd LB |
1369 | kmem_cache_free(cache, object); |
1370 | return (AE_OK); | |
73459f73 RM |
1371 | } |
1372 | ||
a5fe1a03 LM |
1373 | static inline int acpi_res_list_add(struct acpi_res_list *res) |
1374 | { | |
1375 | struct acpi_res_list *res_list_elem; | |
1376 | ||
1377 | list_for_each_entry(res_list_elem, &resource_list_head, | |
1378 | resource_list) { | |
1379 | ||
1380 | if (res->resource_type == res_list_elem->resource_type && | |
1381 | res->start == res_list_elem->start && | |
1382 | res->end == res_list_elem->end) { | |
1383 | ||
1384 | /* | |
1385 | * The Region(addr,len) already exist in the list, | |
1386 | * just increase the count | |
1387 | */ | |
1388 | ||
1389 | res_list_elem->count++; | |
1390 | return 0; | |
1391 | } | |
1392 | } | |
1393 | ||
1394 | res->count = 1; | |
1395 | list_add(&res->resource_list, &resource_list_head); | |
1396 | return 1; | |
1397 | } | |
1398 | ||
1399 | static inline void acpi_res_list_del(struct acpi_res_list *res) | |
1400 | { | |
1401 | struct acpi_res_list *res_list_elem; | |
1402 | ||
1403 | list_for_each_entry(res_list_elem, &resource_list_head, | |
1404 | resource_list) { | |
1405 | ||
1406 | if (res->resource_type == res_list_elem->resource_type && | |
1407 | res->start == res_list_elem->start && | |
1408 | res->end == res_list_elem->end) { | |
1409 | ||
1410 | /* | |
1411 | * If the res count is decreased to 0, | |
1412 | * remove and free it | |
1413 | */ | |
1414 | ||
1415 | if (--res_list_elem->count == 0) { | |
1416 | list_del(&res_list_elem->resource_list); | |
1417 | kfree(res_list_elem); | |
1418 | } | |
1419 | return; | |
1420 | } | |
1421 | } | |
1422 | } | |
1423 | ||
1424 | acpi_status | |
1425 | acpi_os_invalidate_address( | |
1426 | u8 space_id, | |
1427 | acpi_physical_address address, | |
1428 | acpi_size length) | |
1429 | { | |
1430 | struct acpi_res_list res; | |
1431 | ||
1432 | switch (space_id) { | |
1433 | case ACPI_ADR_SPACE_SYSTEM_IO: | |
1434 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | |
88393161 | 1435 | /* Only interference checks against SystemIO and SystemMemory |
a5fe1a03 LM |
1436 | are needed */ |
1437 | res.start = address; | |
1438 | res.end = address + length - 1; | |
1439 | res.resource_type = space_id; | |
1440 | spin_lock(&acpi_res_lock); | |
1441 | acpi_res_list_del(&res); | |
1442 | spin_unlock(&acpi_res_lock); | |
1443 | break; | |
1444 | case ACPI_ADR_SPACE_PCI_CONFIG: | |
1445 | case ACPI_ADR_SPACE_EC: | |
1446 | case ACPI_ADR_SPACE_SMBUS: | |
1447 | case ACPI_ADR_SPACE_CMOS: | |
1448 | case ACPI_ADR_SPACE_PCI_BAR_TARGET: | |
1449 | case ACPI_ADR_SPACE_DATA_TABLE: | |
1450 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | |
1451 | break; | |
1452 | } | |
1453 | return AE_OK; | |
1454 | } | |
1455 | ||
b229cf92 BM |
1456 | /****************************************************************************** |
1457 | * | |
1458 | * FUNCTION: acpi_os_validate_address | |
1459 | * | |
1460 | * PARAMETERS: space_id - ACPI space ID | |
1461 | * address - Physical address | |
1462 | * length - Address length | |
1463 | * | |
1464 | * RETURN: AE_OK if address/length is valid for the space_id. Otherwise, | |
1465 | * should return AE_AML_ILLEGAL_ADDRESS. | |
1466 | * | |
1467 | * DESCRIPTION: Validate a system address via the host OS. Used to validate | |
1468 | * the addresses accessed by AML operation regions. | |
1469 | * | |
1470 | *****************************************************************************/ | |
1471 | ||
1472 | acpi_status | |
1473 | acpi_os_validate_address ( | |
1474 | u8 space_id, | |
1475 | acpi_physical_address address, | |
df92e695 TR |
1476 | acpi_size length, |
1477 | char *name) | |
b229cf92 | 1478 | { |
df92e695 | 1479 | struct acpi_res_list *res; |
a5fe1a03 | 1480 | int added; |
df92e695 TR |
1481 | if (acpi_enforce_resources == ENFORCE_RESOURCES_NO) |
1482 | return AE_OK; | |
b229cf92 | 1483 | |
df92e695 TR |
1484 | switch (space_id) { |
1485 | case ACPI_ADR_SPACE_SYSTEM_IO: | |
1486 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | |
88393161 | 1487 | /* Only interference checks against SystemIO and SystemMemory |
df92e695 TR |
1488 | are needed */ |
1489 | res = kzalloc(sizeof(struct acpi_res_list), GFP_KERNEL); | |
1490 | if (!res) | |
1491 | return AE_OK; | |
1492 | /* ACPI names are fixed to 4 bytes, still better use strlcpy */ | |
1493 | strlcpy(res->name, name, 5); | |
1494 | res->start = address; | |
1495 | res->end = address + length - 1; | |
1496 | res->resource_type = space_id; | |
1497 | spin_lock(&acpi_res_lock); | |
a5fe1a03 | 1498 | added = acpi_res_list_add(res); |
df92e695 | 1499 | spin_unlock(&acpi_res_lock); |
a5fe1a03 LM |
1500 | pr_debug("%s %s resource: start: 0x%llx, end: 0x%llx, " |
1501 | "name: %s\n", added ? "Added" : "Already exist", | |
1502 | (space_id == ACPI_ADR_SPACE_SYSTEM_IO) | |
df92e695 TR |
1503 | ? "SystemIO" : "System Memory", |
1504 | (unsigned long long)res->start, | |
1505 | (unsigned long long)res->end, | |
1506 | res->name); | |
a5fe1a03 LM |
1507 | if (!added) |
1508 | kfree(res); | |
df92e695 TR |
1509 | break; |
1510 | case ACPI_ADR_SPACE_PCI_CONFIG: | |
1511 | case ACPI_ADR_SPACE_EC: | |
1512 | case ACPI_ADR_SPACE_SMBUS: | |
1513 | case ACPI_ADR_SPACE_CMOS: | |
1514 | case ACPI_ADR_SPACE_PCI_BAR_TARGET: | |
1515 | case ACPI_ADR_SPACE_DATA_TABLE: | |
1516 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | |
1517 | break; | |
1518 | } | |
1519 | return AE_OK; | |
b229cf92 | 1520 | } |
73459f73 | 1521 | #endif |
d362edaf MS |
1522 | |
1523 | acpi_status __init acpi_os_initialize(void) | |
1524 | { | |
1525 | acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block); | |
1526 | acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1b_event_block); | |
1527 | acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe0_block); | |
1528 | acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe1_block); | |
1529 | ||
1530 | return AE_OK; | |
1531 | } | |
1532 | ||
1533 | acpi_status acpi_os_initialize1(void) | |
1534 | { | |
1535 | kacpid_wq = create_workqueue("kacpid"); | |
1536 | kacpi_notify_wq = create_workqueue("kacpi_notify"); | |
1537 | kacpi_hotplug_wq = create_workqueue("kacpi_hotplug"); | |
1538 | BUG_ON(!kacpid_wq); | |
1539 | BUG_ON(!kacpi_notify_wq); | |
1540 | BUG_ON(!kacpi_hotplug_wq); | |
1bd64d42 LB |
1541 | acpi_install_interface_handler(acpi_osi_handler); |
1542 | acpi_osi_setup_late(); | |
d362edaf MS |
1543 | return AE_OK; |
1544 | } | |
1545 | ||
1546 | acpi_status acpi_os_terminate(void) | |
1547 | { | |
1548 | if (acpi_irq_handler) { | |
1549 | acpi_os_remove_interrupt_handler(acpi_irq_irq, | |
1550 | acpi_irq_handler); | |
1551 | } | |
1552 | ||
1553 | acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe1_block); | |
1554 | acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe0_block); | |
1555 | acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1b_event_block); | |
1556 | acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1a_event_block); | |
1557 | ||
1558 | destroy_workqueue(kacpid_wq); | |
1559 | destroy_workqueue(kacpi_notify_wq); | |
1560 | destroy_workqueue(kacpi_hotplug_wq); | |
1561 | ||
1562 | return AE_OK; | |
1563 | } |