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