]>
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> | |
7 | * | |
8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 | * | |
24 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
25 | * | |
26 | */ | |
27 | ||
1da177e4 LT |
28 | #include <linux/module.h> |
29 | #include <linux/kernel.h> | |
30 | #include <linux/slab.h> | |
31 | #include <linux/mm.h> | |
32 | #include <linux/pci.h> | |
33 | #include <linux/smp_lock.h> | |
34 | #include <linux/interrupt.h> | |
35 | #include <linux/kmod.h> | |
36 | #include <linux/delay.h> | |
37 | #include <linux/workqueue.h> | |
38 | #include <linux/nmi.h> | |
ad71860a | 39 | #include <linux/acpi.h> |
1da177e4 LT |
40 | #include <acpi/acpi.h> |
41 | #include <asm/io.h> | |
42 | #include <acpi/acpi_bus.h> | |
43 | #include <acpi/processor.h> | |
44 | #include <asm/uaccess.h> | |
45 | ||
46 | #include <linux/efi.h> | |
47 | ||
1da177e4 | 48 | #define _COMPONENT ACPI_OS_SERVICES |
4be44fcd | 49 | ACPI_MODULE_NAME("osl") |
1da177e4 | 50 | #define PREFIX "ACPI: " |
4be44fcd LB |
51 | struct acpi_os_dpc { |
52 | acpi_osd_exec_callback function; | |
53 | void *context; | |
65f27f38 | 54 | struct work_struct work; |
1da177e4 LT |
55 | }; |
56 | ||
57 | #ifdef CONFIG_ACPI_CUSTOM_DSDT | |
58 | #include CONFIG_ACPI_CUSTOM_DSDT_FILE | |
59 | #endif | |
60 | ||
61 | #ifdef ENABLE_DEBUGGER | |
62 | #include <linux/kdb.h> | |
63 | ||
64 | /* stuff for debugger support */ | |
65 | int acpi_in_debugger; | |
66 | EXPORT_SYMBOL(acpi_in_debugger); | |
67 | ||
68 | extern char line_buf[80]; | |
4be44fcd | 69 | #endif /*ENABLE_DEBUGGER */ |
1da177e4 | 70 | |
30e332f3 | 71 | int acpi_specific_hotkey_enabled = TRUE; |
fb9802fa LY |
72 | EXPORT_SYMBOL(acpi_specific_hotkey_enabled); |
73 | ||
1da177e4 LT |
74 | static unsigned int acpi_irq_irq; |
75 | static acpi_osd_handler acpi_irq_handler; | |
76 | static void *acpi_irq_context; | |
77 | static struct workqueue_struct *kacpid_wq; | |
78 | ||
4be44fcd | 79 | acpi_status acpi_os_initialize(void) |
1da177e4 LT |
80 | { |
81 | return AE_OK; | |
82 | } | |
83 | ||
4be44fcd | 84 | acpi_status acpi_os_initialize1(void) |
1da177e4 LT |
85 | { |
86 | /* | |
87 | * Initialize PCI configuration space access, as we'll need to access | |
88 | * it while walking the namespace (bus 0 and root bridges w/ _BBNs). | |
89 | */ | |
1da177e4 | 90 | if (!raw_pci_ops) { |
4be44fcd LB |
91 | printk(KERN_ERR PREFIX |
92 | "Access to PCI configuration space unavailable\n"); | |
1da177e4 LT |
93 | return AE_NULL_ENTRY; |
94 | } | |
1da177e4 LT |
95 | kacpid_wq = create_singlethread_workqueue("kacpid"); |
96 | BUG_ON(!kacpid_wq); | |
b976fe19 | 97 | |
1da177e4 LT |
98 | return AE_OK; |
99 | } | |
100 | ||
4be44fcd | 101 | acpi_status acpi_os_terminate(void) |
1da177e4 LT |
102 | { |
103 | if (acpi_irq_handler) { | |
104 | acpi_os_remove_interrupt_handler(acpi_irq_irq, | |
105 | acpi_irq_handler); | |
106 | } | |
107 | ||
108 | destroy_workqueue(kacpid_wq); | |
109 | ||
110 | return AE_OK; | |
111 | } | |
112 | ||
4be44fcd | 113 | void acpi_os_printf(const char *fmt, ...) |
1da177e4 LT |
114 | { |
115 | va_list args; | |
116 | va_start(args, fmt); | |
117 | acpi_os_vprintf(fmt, args); | |
118 | va_end(args); | |
119 | } | |
4be44fcd | 120 | |
1da177e4 LT |
121 | EXPORT_SYMBOL(acpi_os_printf); |
122 | ||
4be44fcd | 123 | void acpi_os_vprintf(const char *fmt, va_list args) |
1da177e4 LT |
124 | { |
125 | static char buffer[512]; | |
4be44fcd | 126 | |
1da177e4 LT |
127 | vsprintf(buffer, fmt, args); |
128 | ||
129 | #ifdef ENABLE_DEBUGGER | |
130 | if (acpi_in_debugger) { | |
131 | kdb_printf("%s", buffer); | |
132 | } else { | |
133 | printk("%s", buffer); | |
134 | } | |
135 | #else | |
136 | printk("%s", buffer); | |
137 | #endif | |
138 | } | |
139 | ||
ad71860a | 140 | acpi_physical_address __init acpi_os_get_root_pointer(void) |
1da177e4 LT |
141 | { |
142 | if (efi_enabled) { | |
b2c99e3c | 143 | if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) |
ad71860a | 144 | return efi.acpi20; |
b2c99e3c | 145 | else if (efi.acpi != EFI_INVALID_TABLE_ADDR) |
ad71860a | 146 | return efi.acpi; |
1da177e4 | 147 | else { |
4be44fcd LB |
148 | printk(KERN_ERR PREFIX |
149 | "System description tables not found\n"); | |
ad71860a | 150 | return 0; |
1da177e4 | 151 | } |
ad71860a AS |
152 | } else |
153 | return acpi_find_rsdp(); | |
1da177e4 LT |
154 | } |
155 | ||
ad71860a | 156 | void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size) |
1da177e4 | 157 | { |
9f4fd61f BH |
158 | if (phys > ULONG_MAX) { |
159 | printk(KERN_ERR PREFIX "Cannot map memory that high\n"); | |
ad71860a | 160 | return 0; |
1da177e4 | 161 | } |
ad71860a AS |
162 | if (acpi_gbl_permanent_mmap) |
163 | /* | |
164 | * ioremap checks to ensure this is in reserved space | |
165 | */ | |
166 | return ioremap((unsigned long)phys, size); | |
167 | else | |
168 | return __acpi_map_table((unsigned long)phys, size); | |
1da177e4 | 169 | } |
55a82ab3 | 170 | EXPORT_SYMBOL_GPL(acpi_os_map_memory); |
1da177e4 | 171 | |
4be44fcd | 172 | void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) |
1da177e4 | 173 | { |
ad71860a AS |
174 | if (acpi_gbl_permanent_mmap) { |
175 | iounmap(virt); | |
176 | } | |
1da177e4 | 177 | } |
55a82ab3 | 178 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); |
1da177e4 LT |
179 | |
180 | #ifdef ACPI_FUTURE_USAGE | |
181 | acpi_status | |
4be44fcd | 182 | acpi_os_get_physical_address(void *virt, acpi_physical_address * phys) |
1da177e4 | 183 | { |
4be44fcd | 184 | if (!phys || !virt) |
1da177e4 LT |
185 | return AE_BAD_PARAMETER; |
186 | ||
187 | *phys = virt_to_phys(virt); | |
188 | ||
189 | return AE_OK; | |
190 | } | |
191 | #endif | |
192 | ||
193 | #define ACPI_MAX_OVERRIDE_LEN 100 | |
194 | ||
195 | static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN]; | |
196 | ||
197 | acpi_status | |
4be44fcd LB |
198 | acpi_os_predefined_override(const struct acpi_predefined_names *init_val, |
199 | acpi_string * new_val) | |
1da177e4 LT |
200 | { |
201 | if (!init_val || !new_val) | |
202 | return AE_BAD_PARAMETER; | |
203 | ||
204 | *new_val = NULL; | |
4be44fcd | 205 | if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) { |
1da177e4 | 206 | printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n", |
4be44fcd | 207 | acpi_os_name); |
1da177e4 LT |
208 | *new_val = acpi_os_name; |
209 | } | |
210 | ||
211 | return AE_OK; | |
212 | } | |
213 | ||
214 | acpi_status | |
4be44fcd LB |
215 | acpi_os_table_override(struct acpi_table_header * existing_table, |
216 | struct acpi_table_header ** new_table) | |
1da177e4 LT |
217 | { |
218 | if (!existing_table || !new_table) | |
219 | return AE_BAD_PARAMETER; | |
220 | ||
221 | #ifdef CONFIG_ACPI_CUSTOM_DSDT | |
222 | if (strncmp(existing_table->signature, "DSDT", 4) == 0) | |
4be44fcd | 223 | *new_table = (struct acpi_table_header *)AmlCode; |
1da177e4 LT |
224 | else |
225 | *new_table = NULL; | |
226 | #else | |
227 | *new_table = NULL; | |
228 | #endif | |
229 | return AE_OK; | |
230 | } | |
231 | ||
7d12e780 | 232 | static irqreturn_t acpi_irq(int irq, void *dev_id) |
1da177e4 | 233 | { |
4be44fcd | 234 | return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE; |
1da177e4 LT |
235 | } |
236 | ||
237 | acpi_status | |
4be44fcd LB |
238 | acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, |
239 | void *context) | |
1da177e4 LT |
240 | { |
241 | unsigned int irq; | |
242 | ||
243 | /* | |
244 | * Ignore the GSI from the core, and use the value in our copy of the | |
245 | * FADT. It may not be the same if an interrupt source override exists | |
246 | * for the SCI. | |
247 | */ | |
cee324b1 | 248 | gsi = acpi_gbl_FADT.sci_interrupt; |
1da177e4 LT |
249 | if (acpi_gsi_to_irq(gsi, &irq) < 0) { |
250 | printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n", | |
251 | gsi); | |
252 | return AE_OK; | |
253 | } | |
254 | ||
255 | acpi_irq_handler = handler; | |
256 | acpi_irq_context = context; | |
dace1453 | 257 | if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { |
1da177e4 LT |
258 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); |
259 | return AE_NOT_ACQUIRED; | |
260 | } | |
261 | acpi_irq_irq = irq; | |
262 | ||
263 | return AE_OK; | |
264 | } | |
265 | ||
4be44fcd | 266 | acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) |
1da177e4 LT |
267 | { |
268 | if (irq) { | |
269 | free_irq(irq, acpi_irq); | |
270 | acpi_irq_handler = NULL; | |
271 | acpi_irq_irq = 0; | |
272 | } | |
273 | ||
274 | return AE_OK; | |
275 | } | |
276 | ||
277 | /* | |
278 | * Running in interpreter thread context, safe to sleep | |
279 | */ | |
280 | ||
4be44fcd | 281 | void acpi_os_sleep(acpi_integer ms) |
1da177e4 | 282 | { |
01a527ec | 283 | schedule_timeout_interruptible(msecs_to_jiffies(ms)); |
1da177e4 | 284 | } |
4be44fcd | 285 | |
1da177e4 LT |
286 | EXPORT_SYMBOL(acpi_os_sleep); |
287 | ||
4be44fcd | 288 | void acpi_os_stall(u32 us) |
1da177e4 LT |
289 | { |
290 | while (us) { | |
291 | u32 delay = 1000; | |
292 | ||
293 | if (delay > us) | |
294 | delay = us; | |
295 | udelay(delay); | |
296 | touch_nmi_watchdog(); | |
297 | us -= delay; | |
298 | } | |
299 | } | |
4be44fcd | 300 | |
1da177e4 LT |
301 | EXPORT_SYMBOL(acpi_os_stall); |
302 | ||
303 | /* | |
304 | * Support ACPI 3.0 AML Timer operand | |
305 | * Returns 64-bit free-running, monotonically increasing timer | |
306 | * with 100ns granularity | |
307 | */ | |
4be44fcd | 308 | u64 acpi_os_get_timer(void) |
1da177e4 LT |
309 | { |
310 | static u64 t; | |
311 | ||
312 | #ifdef CONFIG_HPET | |
313 | /* TBD: use HPET if available */ | |
314 | #endif | |
315 | ||
316 | #ifdef CONFIG_X86_PM_TIMER | |
317 | /* TBD: default to PM timer if HPET was not available */ | |
318 | #endif | |
319 | if (!t) | |
320 | printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n"); | |
321 | ||
322 | return ++t; | |
323 | } | |
324 | ||
4be44fcd | 325 | acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) |
1da177e4 LT |
326 | { |
327 | u32 dummy; | |
328 | ||
329 | if (!value) | |
330 | value = &dummy; | |
331 | ||
4be44fcd | 332 | switch (width) { |
1da177e4 | 333 | case 8: |
4be44fcd | 334 | *(u8 *) value = inb(port); |
1da177e4 LT |
335 | break; |
336 | case 16: | |
4be44fcd | 337 | *(u16 *) value = inw(port); |
1da177e4 LT |
338 | break; |
339 | case 32: | |
4be44fcd | 340 | *(u32 *) value = inl(port); |
1da177e4 LT |
341 | break; |
342 | default: | |
343 | BUG(); | |
344 | } | |
345 | ||
346 | return AE_OK; | |
347 | } | |
4be44fcd | 348 | |
1da177e4 LT |
349 | EXPORT_SYMBOL(acpi_os_read_port); |
350 | ||
4be44fcd | 351 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) |
1da177e4 | 352 | { |
4be44fcd | 353 | switch (width) { |
1da177e4 LT |
354 | case 8: |
355 | outb(value, port); | |
356 | break; | |
357 | case 16: | |
358 | outw(value, port); | |
359 | break; | |
360 | case 32: | |
361 | outl(value, port); | |
362 | break; | |
363 | default: | |
364 | BUG(); | |
365 | } | |
366 | ||
367 | return AE_OK; | |
368 | } | |
4be44fcd | 369 | |
1da177e4 LT |
370 | EXPORT_SYMBOL(acpi_os_write_port); |
371 | ||
372 | acpi_status | |
4be44fcd | 373 | acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) |
1da177e4 | 374 | { |
4be44fcd LB |
375 | u32 dummy; |
376 | void __iomem *virt_addr; | |
1da177e4 | 377 | |
9f4fd61f | 378 | virt_addr = ioremap(phys_addr, width); |
1da177e4 LT |
379 | if (!value) |
380 | value = &dummy; | |
381 | ||
382 | switch (width) { | |
383 | case 8: | |
4be44fcd | 384 | *(u8 *) value = readb(virt_addr); |
1da177e4 LT |
385 | break; |
386 | case 16: | |
4be44fcd | 387 | *(u16 *) value = readw(virt_addr); |
1da177e4 LT |
388 | break; |
389 | case 32: | |
4be44fcd | 390 | *(u32 *) value = readl(virt_addr); |
1da177e4 LT |
391 | break; |
392 | default: | |
393 | BUG(); | |
394 | } | |
395 | ||
9f4fd61f | 396 | iounmap(virt_addr); |
1da177e4 LT |
397 | |
398 | return AE_OK; | |
399 | } | |
400 | ||
401 | acpi_status | |
4be44fcd | 402 | acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) |
1da177e4 | 403 | { |
4be44fcd | 404 | void __iomem *virt_addr; |
1da177e4 | 405 | |
9f4fd61f | 406 | virt_addr = ioremap(phys_addr, width); |
1da177e4 LT |
407 | |
408 | switch (width) { | |
409 | case 8: | |
410 | writeb(value, virt_addr); | |
411 | break; | |
412 | case 16: | |
413 | writew(value, virt_addr); | |
414 | break; | |
415 | case 32: | |
416 | writel(value, virt_addr); | |
417 | break; | |
418 | default: | |
419 | BUG(); | |
420 | } | |
421 | ||
9f4fd61f | 422 | iounmap(virt_addr); |
1da177e4 LT |
423 | |
424 | return AE_OK; | |
425 | } | |
426 | ||
1da177e4 | 427 | acpi_status |
4be44fcd LB |
428 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
429 | void *value, u32 width) | |
1da177e4 LT |
430 | { |
431 | int result, size; | |
432 | ||
433 | if (!value) | |
434 | return AE_BAD_PARAMETER; | |
435 | ||
436 | switch (width) { | |
437 | case 8: | |
438 | size = 1; | |
439 | break; | |
440 | case 16: | |
441 | size = 2; | |
442 | break; | |
443 | case 32: | |
444 | size = 4; | |
445 | break; | |
446 | default: | |
447 | return AE_ERROR; | |
448 | } | |
449 | ||
450 | BUG_ON(!raw_pci_ops); | |
451 | ||
452 | result = raw_pci_ops->read(pci_id->segment, pci_id->bus, | |
4be44fcd LB |
453 | PCI_DEVFN(pci_id->device, pci_id->function), |
454 | reg, size, value); | |
1da177e4 LT |
455 | |
456 | return (result ? AE_ERROR : AE_OK); | |
457 | } | |
4be44fcd | 458 | |
1da177e4 LT |
459 | EXPORT_SYMBOL(acpi_os_read_pci_configuration); |
460 | ||
461 | acpi_status | |
4be44fcd LB |
462 | acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
463 | acpi_integer value, u32 width) | |
1da177e4 LT |
464 | { |
465 | int result, size; | |
466 | ||
467 | switch (width) { | |
468 | case 8: | |
469 | size = 1; | |
470 | break; | |
471 | case 16: | |
472 | size = 2; | |
473 | break; | |
474 | case 32: | |
475 | size = 4; | |
476 | break; | |
477 | default: | |
478 | return AE_ERROR; | |
479 | } | |
480 | ||
481 | BUG_ON(!raw_pci_ops); | |
482 | ||
483 | result = raw_pci_ops->write(pci_id->segment, pci_id->bus, | |
4be44fcd LB |
484 | PCI_DEVFN(pci_id->device, pci_id->function), |
485 | reg, size, value); | |
1da177e4 LT |
486 | |
487 | return (result ? AE_ERROR : AE_OK); | |
488 | } | |
489 | ||
490 | /* TODO: Change code to take advantage of driver model more */ | |
4be44fcd LB |
491 | static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ |
492 | acpi_handle chandle, /* current node */ | |
493 | struct acpi_pci_id **id, | |
494 | int *is_bridge, u8 * bus_number) | |
1da177e4 | 495 | { |
4be44fcd LB |
496 | acpi_handle handle; |
497 | struct acpi_pci_id *pci_id = *id; | |
498 | acpi_status status; | |
499 | unsigned long temp; | |
500 | acpi_object_type type; | |
501 | u8 tu8; | |
1da177e4 LT |
502 | |
503 | acpi_get_parent(chandle, &handle); | |
504 | if (handle != rhandle) { | |
4be44fcd LB |
505 | acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, |
506 | bus_number); | |
1da177e4 LT |
507 | |
508 | status = acpi_get_type(handle, &type); | |
4be44fcd | 509 | if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE)) |
1da177e4 LT |
510 | return; |
511 | ||
4be44fcd LB |
512 | status = |
513 | acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, | |
514 | &temp); | |
1da177e4 | 515 | if (ACPI_SUCCESS(status)) { |
4be44fcd LB |
516 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); |
517 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); | |
1da177e4 LT |
518 | |
519 | if (*is_bridge) | |
520 | pci_id->bus = *bus_number; | |
521 | ||
522 | /* any nicer way to get bus number of bridge ? */ | |
4be44fcd LB |
523 | status = |
524 | acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, | |
525 | 8); | |
526 | if (ACPI_SUCCESS(status) | |
527 | && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) { | |
528 | status = | |
529 | acpi_os_read_pci_configuration(pci_id, 0x18, | |
530 | &tu8, 8); | |
1da177e4 LT |
531 | if (!ACPI_SUCCESS(status)) { |
532 | /* Certainly broken... FIX ME */ | |
533 | return; | |
534 | } | |
535 | *is_bridge = 1; | |
536 | pci_id->bus = tu8; | |
4be44fcd LB |
537 | status = |
538 | acpi_os_read_pci_configuration(pci_id, 0x19, | |
539 | &tu8, 8); | |
1da177e4 LT |
540 | if (ACPI_SUCCESS(status)) { |
541 | *bus_number = tu8; | |
542 | } | |
543 | } else | |
544 | *is_bridge = 0; | |
545 | } | |
546 | } | |
547 | } | |
548 | ||
4be44fcd LB |
549 | void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ |
550 | acpi_handle chandle, /* current node */ | |
551 | struct acpi_pci_id **id) | |
1da177e4 LT |
552 | { |
553 | int is_bridge = 1; | |
554 | u8 bus_number = (*id)->bus; | |
555 | ||
556 | acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number); | |
557 | } | |
558 | ||
65f27f38 | 559 | static void acpi_os_execute_deferred(struct work_struct *work) |
1da177e4 | 560 | { |
65f27f38 | 561 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); |
1da177e4 | 562 | |
1da177e4 | 563 | if (!dpc) { |
6468463a | 564 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
d550d98d | 565 | return; |
1da177e4 LT |
566 | } |
567 | ||
568 | dpc->function(dpc->context); | |
569 | ||
570 | kfree(dpc); | |
571 | ||
d550d98d | 572 | return; |
1da177e4 LT |
573 | } |
574 | ||
b8d35192 AS |
575 | /******************************************************************************* |
576 | * | |
577 | * FUNCTION: acpi_os_execute | |
578 | * | |
579 | * PARAMETERS: Type - Type of the callback | |
580 | * Function - Function to be executed | |
581 | * Context - Function parameters | |
582 | * | |
583 | * RETURN: Status | |
584 | * | |
585 | * DESCRIPTION: Depending on type, either queues function for deferred execution or | |
586 | * immediately executes function on a separate thread. | |
587 | * | |
588 | ******************************************************************************/ | |
589 | ||
590 | acpi_status acpi_os_execute(acpi_execute_type type, | |
4be44fcd | 591 | acpi_osd_exec_callback function, void *context) |
1da177e4 | 592 | { |
4be44fcd LB |
593 | acpi_status status = AE_OK; |
594 | struct acpi_os_dpc *dpc; | |
72945b2b | 595 | |
b976fe19 LT |
596 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); |
597 | ||
72945b2b LB |
598 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
599 | "Scheduling function [%p(%p)] for deferred execution.\n", | |
600 | function, context)); | |
1da177e4 LT |
601 | |
602 | if (!function) | |
b976fe19 | 603 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
72945b2b | 604 | |
1da177e4 LT |
605 | /* |
606 | * Allocate/initialize DPC structure. Note that this memory will be | |
65f27f38 | 607 | * freed by the callee. The kernel handles the work_struct list in a |
1da177e4 LT |
608 | * way that allows us to also free its memory inside the callee. |
609 | * Because we may want to schedule several tasks with different | |
610 | * parameters we can't use the approach some kernel code uses of | |
65f27f38 | 611 | * having a static work_struct. |
1da177e4 | 612 | */ |
72945b2b | 613 | |
65f27f38 | 614 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); |
1da177e4 | 615 | if (!dpc) |
b976fe19 LT |
616 | return_ACPI_STATUS(AE_NO_MEMORY); |
617 | ||
1da177e4 LT |
618 | dpc->function = function; |
619 | dpc->context = context; | |
b976fe19 | 620 | |
65f27f38 DH |
621 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
622 | if (!queue_work(kacpid_wq, &dpc->work)) { | |
b976fe19 LT |
623 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
624 | "Call to queue_work() failed.\n")); | |
37605a69 | 625 | kfree(dpc); |
b976fe19 | 626 | status = AE_ERROR; |
1da177e4 | 627 | } |
b976fe19 LT |
628 | |
629 | return_ACPI_STATUS(status); | |
1da177e4 | 630 | } |
4be44fcd | 631 | |
b8d35192 | 632 | EXPORT_SYMBOL(acpi_os_execute); |
1da177e4 | 633 | |
4be44fcd | 634 | void acpi_os_wait_events_complete(void *context) |
1da177e4 LT |
635 | { |
636 | flush_workqueue(kacpid_wq); | |
637 | } | |
4be44fcd | 638 | |
1da177e4 LT |
639 | EXPORT_SYMBOL(acpi_os_wait_events_complete); |
640 | ||
641 | /* | |
642 | * Allocate the memory for a spinlock and initialize it. | |
643 | */ | |
967440e3 | 644 | acpi_status acpi_os_create_lock(acpi_spinlock * handle) |
1da177e4 | 645 | { |
967440e3 | 646 | spin_lock_init(*handle); |
1da177e4 | 647 | |
d550d98d | 648 | return AE_OK; |
1da177e4 LT |
649 | } |
650 | ||
1da177e4 LT |
651 | /* |
652 | * Deallocate the memory for a spinlock. | |
653 | */ | |
967440e3 | 654 | void acpi_os_delete_lock(acpi_spinlock handle) |
1da177e4 | 655 | { |
d550d98d | 656 | return; |
1da177e4 LT |
657 | } |
658 | ||
1da177e4 | 659 | acpi_status |
4be44fcd | 660 | acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) |
1da177e4 | 661 | { |
4be44fcd | 662 | struct semaphore *sem = NULL; |
1da177e4 | 663 | |
1da177e4 LT |
664 | |
665 | sem = acpi_os_allocate(sizeof(struct semaphore)); | |
666 | if (!sem) | |
d550d98d | 667 | return AE_NO_MEMORY; |
1da177e4 LT |
668 | memset(sem, 0, sizeof(struct semaphore)); |
669 | ||
670 | sema_init(sem, initial_units); | |
671 | ||
4be44fcd | 672 | *handle = (acpi_handle *) sem; |
1da177e4 | 673 | |
4be44fcd LB |
674 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", |
675 | *handle, initial_units)); | |
1da177e4 | 676 | |
d550d98d | 677 | return AE_OK; |
1da177e4 | 678 | } |
1da177e4 | 679 | |
4be44fcd | 680 | EXPORT_SYMBOL(acpi_os_create_semaphore); |
1da177e4 LT |
681 | |
682 | /* | |
683 | * TODO: A better way to delete semaphores? Linux doesn't have a | |
684 | * 'delete_semaphore()' function -- may result in an invalid | |
685 | * pointer dereference for non-synchronized consumers. Should | |
686 | * we at least check for blocked threads and signal/cancel them? | |
687 | */ | |
688 | ||
4be44fcd | 689 | acpi_status acpi_os_delete_semaphore(acpi_handle handle) |
1da177e4 | 690 | { |
4be44fcd | 691 | struct semaphore *sem = (struct semaphore *)handle; |
1da177e4 | 692 | |
1da177e4 LT |
693 | |
694 | if (!sem) | |
d550d98d | 695 | return AE_BAD_PARAMETER; |
1da177e4 | 696 | |
4be44fcd | 697 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); |
1da177e4 | 698 | |
02438d87 | 699 | kfree(sem); |
4be44fcd | 700 | sem = NULL; |
1da177e4 | 701 | |
d550d98d | 702 | return AE_OK; |
1da177e4 | 703 | } |
1da177e4 | 704 | |
4be44fcd | 705 | EXPORT_SYMBOL(acpi_os_delete_semaphore); |
1da177e4 LT |
706 | |
707 | /* | |
708 | * TODO: The kernel doesn't have a 'down_timeout' function -- had to | |
709 | * improvise. The process is to sleep for one scheduler quantum | |
710 | * until the semaphore becomes available. Downside is that this | |
711 | * may result in starvation for timeout-based waits when there's | |
712 | * lots of semaphore activity. | |
713 | * | |
714 | * TODO: Support for units > 1? | |
715 | */ | |
4be44fcd | 716 | acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) |
1da177e4 | 717 | { |
4be44fcd LB |
718 | acpi_status status = AE_OK; |
719 | struct semaphore *sem = (struct semaphore *)handle; | |
720 | int ret = 0; | |
1da177e4 | 721 | |
1da177e4 LT |
722 | |
723 | if (!sem || (units < 1)) | |
d550d98d | 724 | return AE_BAD_PARAMETER; |
1da177e4 LT |
725 | |
726 | if (units > 1) | |
d550d98d | 727 | return AE_SUPPORT; |
1da177e4 | 728 | |
4be44fcd LB |
729 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", |
730 | handle, units, timeout)); | |
1da177e4 | 731 | |
d68909f4 LB |
732 | /* |
733 | * This can be called during resume with interrupts off. | |
734 | * Like boot-time, we should be single threaded and will | |
735 | * always get the lock if we try -- timeout or not. | |
736 | * If this doesn't succeed, then we will oops courtesy of | |
737 | * might_sleep() in down(). | |
738 | */ | |
739 | if (!down_trylock(sem)) | |
740 | return AE_OK; | |
741 | ||
4be44fcd | 742 | switch (timeout) { |
1da177e4 LT |
743 | /* |
744 | * No Wait: | |
745 | * -------- | |
746 | * A zero timeout value indicates that we shouldn't wait - just | |
747 | * acquire the semaphore if available otherwise return AE_TIME | |
748 | * (a.k.a. 'would block'). | |
749 | */ | |
4be44fcd LB |
750 | case 0: |
751 | if (down_trylock(sem)) | |
1da177e4 LT |
752 | status = AE_TIME; |
753 | break; | |
754 | ||
755 | /* | |
756 | * Wait Indefinitely: | |
757 | * ------------------ | |
758 | */ | |
4be44fcd | 759 | case ACPI_WAIT_FOREVER: |
1da177e4 LT |
760 | down(sem); |
761 | break; | |
762 | ||
763 | /* | |
764 | * Wait w/ Timeout: | |
765 | * ---------------- | |
766 | */ | |
4be44fcd | 767 | default: |
1da177e4 LT |
768 | // TODO: A better timeout algorithm? |
769 | { | |
770 | int i = 0; | |
4be44fcd | 771 | static const int quantum_ms = 1000 / HZ; |
1da177e4 LT |
772 | |
773 | ret = down_trylock(sem); | |
dacd9b80 | 774 | for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) { |
01a527ec | 775 | schedule_timeout_interruptible(1); |
1da177e4 LT |
776 | ret = down_trylock(sem); |
777 | } | |
4be44fcd | 778 | |
1da177e4 LT |
779 | if (ret != 0) |
780 | status = AE_TIME; | |
781 | } | |
782 | break; | |
783 | } | |
784 | ||
785 | if (ACPI_FAILURE(status)) { | |
9e7e2c04 | 786 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
a6fc6720 | 787 | "Failed to acquire semaphore[%p|%d|%d], %s", |
4be44fcd LB |
788 | handle, units, timeout, |
789 | acpi_format_exception(status))); | |
790 | } else { | |
791 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | |
a6fc6720 | 792 | "Acquired semaphore[%p|%d|%d]", handle, |
4be44fcd | 793 | units, timeout)); |
1da177e4 LT |
794 | } |
795 | ||
d550d98d | 796 | return status; |
1da177e4 | 797 | } |
1da177e4 | 798 | |
4be44fcd | 799 | EXPORT_SYMBOL(acpi_os_wait_semaphore); |
1da177e4 LT |
800 | |
801 | /* | |
802 | * TODO: Support for units > 1? | |
803 | */ | |
4be44fcd | 804 | acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) |
1da177e4 | 805 | { |
4be44fcd | 806 | struct semaphore *sem = (struct semaphore *)handle; |
1da177e4 | 807 | |
1da177e4 LT |
808 | |
809 | if (!sem || (units < 1)) | |
d550d98d | 810 | return AE_BAD_PARAMETER; |
1da177e4 LT |
811 | |
812 | if (units > 1) | |
d550d98d | 813 | return AE_SUPPORT; |
1da177e4 | 814 | |
4be44fcd LB |
815 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, |
816 | units)); | |
1da177e4 LT |
817 | |
818 | up(sem); | |
819 | ||
d550d98d | 820 | return AE_OK; |
1da177e4 | 821 | } |
4be44fcd | 822 | |
1da177e4 LT |
823 | EXPORT_SYMBOL(acpi_os_signal_semaphore); |
824 | ||
825 | #ifdef ACPI_FUTURE_USAGE | |
4be44fcd | 826 | u32 acpi_os_get_line(char *buffer) |
1da177e4 LT |
827 | { |
828 | ||
829 | #ifdef ENABLE_DEBUGGER | |
830 | if (acpi_in_debugger) { | |
831 | u32 chars; | |
832 | ||
833 | kdb_read(buffer, sizeof(line_buf)); | |
834 | ||
835 | /* remove the CR kdb includes */ | |
836 | chars = strlen(buffer) - 1; | |
837 | buffer[chars] = '\0'; | |
838 | } | |
839 | #endif | |
840 | ||
841 | return 0; | |
842 | } | |
4be44fcd | 843 | #endif /* ACPI_FUTURE_USAGE */ |
1da177e4 LT |
844 | |
845 | /* Assumes no unreadable holes inbetween */ | |
4be44fcd | 846 | u8 acpi_os_readable(void *ptr, acpi_size len) |
1da177e4 | 847 | { |
4be44fcd | 848 | #if defined(__i386__) || defined(__x86_64__) |
1da177e4 | 849 | char tmp; |
4be44fcd LB |
850 | return !__get_user(tmp, (char __user *)ptr) |
851 | && !__get_user(tmp, (char __user *)ptr + len - 1); | |
1da177e4 LT |
852 | #endif |
853 | return 1; | |
854 | } | |
855 | ||
856 | #ifdef ACPI_FUTURE_USAGE | |
4be44fcd | 857 | u8 acpi_os_writable(void *ptr, acpi_size len) |
1da177e4 LT |
858 | { |
859 | /* could do dummy write (racy) or a kernel page table lookup. | |
860 | The later may be difficult at early boot when kmap doesn't work yet. */ | |
861 | return 1; | |
862 | } | |
863 | #endif | |
864 | ||
4be44fcd | 865 | acpi_status acpi_os_signal(u32 function, void *info) |
1da177e4 | 866 | { |
4be44fcd | 867 | switch (function) { |
1da177e4 LT |
868 | case ACPI_SIGNAL_FATAL: |
869 | printk(KERN_ERR PREFIX "Fatal opcode executed\n"); | |
870 | break; | |
871 | case ACPI_SIGNAL_BREAKPOINT: | |
872 | /* | |
873 | * AML Breakpoint | |
874 | * ACPI spec. says to treat it as a NOP unless | |
875 | * you are debugging. So if/when we integrate | |
876 | * AML debugger into the kernel debugger its | |
877 | * hook will go here. But until then it is | |
878 | * not useful to print anything on breakpoints. | |
879 | */ | |
880 | break; | |
881 | default: | |
882 | break; | |
883 | } | |
884 | ||
885 | return AE_OK; | |
886 | } | |
4be44fcd | 887 | |
1da177e4 LT |
888 | EXPORT_SYMBOL(acpi_os_signal); |
889 | ||
4be44fcd | 890 | static int __init acpi_os_name_setup(char *str) |
1da177e4 LT |
891 | { |
892 | char *p = acpi_os_name; | |
4be44fcd | 893 | int count = ACPI_MAX_OVERRIDE_LEN - 1; |
1da177e4 LT |
894 | |
895 | if (!str || !*str) | |
896 | return 0; | |
897 | ||
898 | for (; count-- && str && *str; str++) { | |
899 | if (isalnum(*str) || *str == ' ' || *str == ':') | |
900 | *p++ = *str; | |
901 | else if (*str == '\'' || *str == '"') | |
902 | continue; | |
903 | else | |
904 | break; | |
905 | } | |
906 | *p = 0; | |
907 | ||
908 | return 1; | |
4be44fcd | 909 | |
1da177e4 LT |
910 | } |
911 | ||
912 | __setup("acpi_os_name=", acpi_os_name_setup); | |
913 | ||
914 | /* | |
915 | * _OSI control | |
916 | * empty string disables _OSI | |
917 | * TBD additional string adds to _OSI | |
918 | */ | |
4be44fcd | 919 | static int __init acpi_osi_setup(char *str) |
1da177e4 LT |
920 | { |
921 | if (str == NULL || *str == '\0') { | |
922 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | |
923 | acpi_gbl_create_osi_method = FALSE; | |
4be44fcd | 924 | } else { |
1da177e4 | 925 | /* TBD */ |
4be44fcd LB |
926 | printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", |
927 | str); | |
1da177e4 LT |
928 | } |
929 | ||
930 | return 1; | |
931 | } | |
932 | ||
933 | __setup("acpi_osi=", acpi_osi_setup); | |
934 | ||
935 | /* enable serialization to combat AE_ALREADY_EXISTS errors */ | |
4be44fcd | 936 | static int __init acpi_serialize_setup(char *str) |
1da177e4 LT |
937 | { |
938 | printk(KERN_INFO PREFIX "serialize enabled\n"); | |
939 | ||
940 | acpi_gbl_all_methods_serialized = TRUE; | |
941 | ||
942 | return 1; | |
943 | } | |
944 | ||
945 | __setup("acpi_serialize", acpi_serialize_setup); | |
946 | ||
947 | /* | |
948 | * Wake and Run-Time GPES are expected to be separate. | |
949 | * We disable wake-GPEs at run-time to prevent spurious | |
950 | * interrupts. | |
951 | * | |
952 | * However, if a system exists that shares Wake and | |
953 | * Run-time events on the same GPE this flag is available | |
954 | * to tell Linux to keep the wake-time GPEs enabled at run-time. | |
955 | */ | |
4be44fcd | 956 | static int __init acpi_wake_gpes_always_on_setup(char *str) |
1da177e4 LT |
957 | { |
958 | printk(KERN_INFO PREFIX "wake GPEs not disabled\n"); | |
959 | ||
960 | acpi_gbl_leave_wake_gpes_disabled = FALSE; | |
961 | ||
962 | return 1; | |
963 | } | |
964 | ||
965 | __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); | |
966 | ||
8713cbef | 967 | static int __init acpi_hotkey_setup(char *str) |
fb9802fa | 968 | { |
30e332f3 | 969 | acpi_specific_hotkey_enabled = FALSE; |
fb9802fa LY |
970 | return 1; |
971 | } | |
972 | ||
30e332f3 | 973 | __setup("acpi_generic_hotkey", acpi_hotkey_setup); |
fb9802fa | 974 | |
1da177e4 LT |
975 | /* |
976 | * max_cstate is defined in the base kernel so modules can | |
977 | * change it w/o depending on the state of the processor module. | |
978 | */ | |
979 | unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER; | |
980 | ||
1da177e4 | 981 | EXPORT_SYMBOL(max_cstate); |
73459f73 RM |
982 | |
983 | /* | |
984 | * Acquire a spinlock. | |
985 | * | |
986 | * handle is a pointer to the spinlock_t. | |
73459f73 RM |
987 | */ |
988 | ||
967440e3 | 989 | acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) |
73459f73 | 990 | { |
b8e4d893 | 991 | acpi_cpu_flags flags; |
967440e3 | 992 | spin_lock_irqsave(lockp, flags); |
73459f73 RM |
993 | return flags; |
994 | } | |
995 | ||
996 | /* | |
997 | * Release a spinlock. See above. | |
998 | */ | |
999 | ||
967440e3 | 1000 | void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) |
73459f73 | 1001 | { |
967440e3 | 1002 | spin_unlock_irqrestore(lockp, flags); |
73459f73 RM |
1003 | } |
1004 | ||
73459f73 RM |
1005 | #ifndef ACPI_USE_LOCAL_CACHE |
1006 | ||
1007 | /******************************************************************************* | |
1008 | * | |
1009 | * FUNCTION: acpi_os_create_cache | |
1010 | * | |
b229cf92 BM |
1011 | * PARAMETERS: name - Ascii name for the cache |
1012 | * size - Size of each cached object | |
1013 | * depth - Maximum depth of the cache (in objects) <ignored> | |
1014 | * cache - Where the new cache object is returned | |
73459f73 | 1015 | * |
b229cf92 | 1016 | * RETURN: status |
73459f73 RM |
1017 | * |
1018 | * DESCRIPTION: Create a cache object | |
1019 | * | |
1020 | ******************************************************************************/ | |
1021 | ||
1022 | acpi_status | |
4be44fcd | 1023 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) |
73459f73 | 1024 | { |
4be44fcd | 1025 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); |
a6fdbf90 | 1026 | if (*cache == NULL) |
b229cf92 BM |
1027 | return AE_ERROR; |
1028 | else | |
1029 | return AE_OK; | |
73459f73 RM |
1030 | } |
1031 | ||
1032 | /******************************************************************************* | |
1033 | * | |
1034 | * FUNCTION: acpi_os_purge_cache | |
1035 | * | |
1036 | * PARAMETERS: Cache - Handle to cache object | |
1037 | * | |
1038 | * RETURN: Status | |
1039 | * | |
1040 | * DESCRIPTION: Free all objects within the requested cache. | |
1041 | * | |
1042 | ******************************************************************************/ | |
1043 | ||
4be44fcd | 1044 | acpi_status acpi_os_purge_cache(acpi_cache_t * cache) |
73459f73 | 1045 | { |
50dd0969 | 1046 | kmem_cache_shrink(cache); |
4be44fcd | 1047 | return (AE_OK); |
73459f73 RM |
1048 | } |
1049 | ||
1050 | /******************************************************************************* | |
1051 | * | |
1052 | * FUNCTION: acpi_os_delete_cache | |
1053 | * | |
1054 | * PARAMETERS: Cache - Handle to cache object | |
1055 | * | |
1056 | * RETURN: Status | |
1057 | * | |
1058 | * DESCRIPTION: Free all objects within the requested cache and delete the | |
1059 | * cache object. | |
1060 | * | |
1061 | ******************************************************************************/ | |
1062 | ||
4be44fcd | 1063 | acpi_status acpi_os_delete_cache(acpi_cache_t * cache) |
73459f73 | 1064 | { |
1a1d92c1 | 1065 | kmem_cache_destroy(cache); |
4be44fcd | 1066 | return (AE_OK); |
73459f73 RM |
1067 | } |
1068 | ||
1069 | /******************************************************************************* | |
1070 | * | |
1071 | * FUNCTION: acpi_os_release_object | |
1072 | * | |
1073 | * PARAMETERS: Cache - Handle to cache object | |
1074 | * Object - The object to be released | |
1075 | * | |
1076 | * RETURN: None | |
1077 | * | |
1078 | * DESCRIPTION: Release an object to the specified cache. If cache is full, | |
1079 | * the object is deleted. | |
1080 | * | |
1081 | ******************************************************************************/ | |
1082 | ||
4be44fcd | 1083 | acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) |
73459f73 | 1084 | { |
4be44fcd LB |
1085 | kmem_cache_free(cache, object); |
1086 | return (AE_OK); | |
73459f73 RM |
1087 | } |
1088 | ||
b229cf92 BM |
1089 | /****************************************************************************** |
1090 | * | |
1091 | * FUNCTION: acpi_os_validate_interface | |
1092 | * | |
1093 | * PARAMETERS: interface - Requested interface to be validated | |
1094 | * | |
1095 | * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise | |
1096 | * | |
1097 | * DESCRIPTION: Match an interface string to the interfaces supported by the | |
1098 | * host. Strings originate from an AML call to the _OSI method. | |
1099 | * | |
1100 | *****************************************************************************/ | |
1101 | ||
1102 | acpi_status | |
1103 | acpi_os_validate_interface (char *interface) | |
1104 | { | |
1105 | ||
1106 | return AE_SUPPORT; | |
1107 | } | |
1108 | ||
1109 | ||
1110 | /****************************************************************************** | |
1111 | * | |
1112 | * FUNCTION: acpi_os_validate_address | |
1113 | * | |
1114 | * PARAMETERS: space_id - ACPI space ID | |
1115 | * address - Physical address | |
1116 | * length - Address length | |
1117 | * | |
1118 | * RETURN: AE_OK if address/length is valid for the space_id. Otherwise, | |
1119 | * should return AE_AML_ILLEGAL_ADDRESS. | |
1120 | * | |
1121 | * DESCRIPTION: Validate a system address via the host OS. Used to validate | |
1122 | * the addresses accessed by AML operation regions. | |
1123 | * | |
1124 | *****************************************************************************/ | |
1125 | ||
1126 | acpi_status | |
1127 | acpi_os_validate_address ( | |
1128 | u8 space_id, | |
1129 | acpi_physical_address address, | |
1130 | acpi_size length) | |
1131 | { | |
1132 | ||
1133 | return AE_OK; | |
1134 | } | |
1135 | ||
1136 | ||
73459f73 | 1137 | #endif |