ACPI: make acpi_dmi_dump() static
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / acpi / osl.c
CommitLineData
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>
1da177e4
LT
33#include <linux/interrupt.h>
34#include <linux/kmod.h>
35#include <linux/delay.h>
f507654d 36#include <linux/dmi.h>
1da177e4
LT
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
f52fd66d 49ACPI_MODULE_NAME("osl");
1da177e4 50#define PREFIX "ACPI: "
4be44fcd
LB
51struct 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 */
65int acpi_in_debugger;
66EXPORT_SYMBOL(acpi_in_debugger);
67
68extern char line_buf[80];
4be44fcd 69#endif /*ENABLE_DEBUGGER */
1da177e4
LT
70
71static unsigned int acpi_irq_irq;
72static acpi_osd_handler acpi_irq_handler;
73static void *acpi_irq_context;
74static struct workqueue_struct *kacpid_wq;
88db5e14 75static struct workqueue_struct *kacpi_notify_wq;
1da177e4 76
ae00d812
LB
77#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
78static char osi_additional_string[OSI_STRING_LENGTH_MAX];
79
d4b7dc49
LB
80/*
81 * "Ode to _OSI(Linux)"
82 *
83 * osi_linux -- Control response to BIOS _OSI(Linux) query.
84 *
85 * As Linux evolves, the features that it supports change.
86 * So an OSI string such as "Linux" is not specific enough
87 * to be useful across multiple versions of Linux. It
88 * doesn't identify any particular feature, interface,
89 * or even any particular version of Linux...
90 *
91 * Unfortunately, Linux-2.6.22 and earlier responded "yes"
92 * to a BIOS _OSI(Linux) query. When
93 * a reference mobile BIOS started using it, its use
94 * started to spread to many vendor platforms.
95 * As it is not supportable, we need to halt that spread.
96 *
97 * Today, most BIOS references to _OSI(Linux) are noise --
98 * they have no functional effect and are just dead code
99 * carried over from the reference BIOS.
100 *
101 * The next most common case is that _OSI(Linux) harms Linux,
102 * usually by causing the BIOS to follow paths that are
103 * not tested during Windows validation.
104 *
105 * Finally, there is a short list of platforms
106 * where OSI(Linux) benefits Linux.
107 *
108 * In Linux-2.6.23, OSI(Linux) is first disabled by default.
109 * DMI is used to disable the dmesg warning about OSI(Linux)
110 * on platforms where it is known to have no effect.
111 * But a dmesg warning remains for systems where
112 * we do not know if OSI(Linux) is good or bad for the system.
113 * DMI is also used to enable OSI(Linux) for the machines
114 * that are known to need it.
115 *
116 * BIOS writers should NOT query _OSI(Linux) on future systems.
117 * It will be ignored by default, and to get Linux to
118 * not ignore it will require a kernel source update to
119 * add a DMI entry, or a boot-time "acpi_osi=Linux" invocation.
120 */
121#define OSI_LINUX_ENABLE 0
122
123struct osi_linux {
124 unsigned int enable:1;
125 unsigned int dmi:1;
126 unsigned int cmdline:1;
127 unsigned int known:1;
128} osi_linux = { OSI_LINUX_ENABLE, 0, 0, 0};
f507654d 129
9a47cdb1
BH
130static void __init acpi_request_region (struct acpi_generic_address *addr,
131 unsigned int length, char *desc)
132{
133 struct resource *res;
134
135 if (!addr->address || !length)
136 return;
137
eee3c859 138 if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
9a47cdb1 139 res = request_region(addr->address, length, desc);
eee3c859 140 else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
9a47cdb1
BH
141 res = request_mem_region(addr->address, length, desc);
142}
143
144static int __init acpi_reserve_resources(void)
145{
eee3c859 146 acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
9a47cdb1
BH
147 "ACPI PM1a_EVT_BLK");
148
eee3c859 149 acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length,
9a47cdb1
BH
150 "ACPI PM1b_EVT_BLK");
151
eee3c859 152 acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length,
9a47cdb1
BH
153 "ACPI PM1a_CNT_BLK");
154
eee3c859 155 acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length,
9a47cdb1
BH
156 "ACPI PM1b_CNT_BLK");
157
eee3c859
LB
158 if (acpi_gbl_FADT.pm_timer_length == 4)
159 acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
9a47cdb1 160
eee3c859 161 acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length,
9a47cdb1
BH
162 "ACPI PM2_CNT_BLK");
163
164 /* Length of GPE blocks must be a non-negative multiple of 2 */
165
eee3c859
LB
166 if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
167 acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
168 acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
9a47cdb1 169
eee3c859
LB
170 if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
171 acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
172 acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
9a47cdb1
BH
173
174 return 0;
175}
176device_initcall(acpi_reserve_resources);
177
dd272b57 178acpi_status __init acpi_os_initialize(void)
1da177e4
LT
179{
180 return AE_OK;
181}
182
4be44fcd 183acpi_status acpi_os_initialize1(void)
1da177e4
LT
184{
185 /*
186 * Initialize PCI configuration space access, as we'll need to access
187 * it while walking the namespace (bus 0 and root bridges w/ _BBNs).
188 */
1da177e4 189 if (!raw_pci_ops) {
4be44fcd
LB
190 printk(KERN_ERR PREFIX
191 "Access to PCI configuration space unavailable\n");
1da177e4
LT
192 return AE_NULL_ENTRY;
193 }
1da177e4 194 kacpid_wq = create_singlethread_workqueue("kacpid");
88db5e14 195 kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify");
1da177e4 196 BUG_ON(!kacpid_wq);
88db5e14 197 BUG_ON(!kacpi_notify_wq);
1da177e4
LT
198 return AE_OK;
199}
200
4be44fcd 201acpi_status acpi_os_terminate(void)
1da177e4
LT
202{
203 if (acpi_irq_handler) {
204 acpi_os_remove_interrupt_handler(acpi_irq_irq,
205 acpi_irq_handler);
206 }
207
208 destroy_workqueue(kacpid_wq);
88db5e14 209 destroy_workqueue(kacpi_notify_wq);
1da177e4
LT
210
211 return AE_OK;
212}
213
4be44fcd 214void acpi_os_printf(const char *fmt, ...)
1da177e4
LT
215{
216 va_list args;
217 va_start(args, fmt);
218 acpi_os_vprintf(fmt, args);
219 va_end(args);
220}
4be44fcd 221
1da177e4
LT
222EXPORT_SYMBOL(acpi_os_printf);
223
4be44fcd 224void acpi_os_vprintf(const char *fmt, va_list args)
1da177e4
LT
225{
226 static char buffer[512];
4be44fcd 227
1da177e4
LT
228 vsprintf(buffer, fmt, args);
229
230#ifdef ENABLE_DEBUGGER
231 if (acpi_in_debugger) {
232 kdb_printf("%s", buffer);
233 } else {
234 printk("%s", buffer);
235 }
236#else
237 printk("%s", buffer);
238#endif
239}
240
ad71860a 241acpi_physical_address __init acpi_os_get_root_pointer(void)
1da177e4
LT
242{
243 if (efi_enabled) {
b2c99e3c 244 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
ad71860a 245 return efi.acpi20;
b2c99e3c 246 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
ad71860a 247 return efi.acpi;
1da177e4 248 else {
4be44fcd
LB
249 printk(KERN_ERR PREFIX
250 "System description tables not found\n");
ad71860a 251 return 0;
1da177e4 252 }
ad71860a
AS
253 } else
254 return acpi_find_rsdp();
1da177e4
LT
255}
256
ad71860a 257void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
1da177e4 258{
9f4fd61f
BH
259 if (phys > ULONG_MAX) {
260 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
70c0846e 261 return NULL;
1da177e4 262 }
ad71860a
AS
263 if (acpi_gbl_permanent_mmap)
264 /*
265 * ioremap checks to ensure this is in reserved space
266 */
267 return ioremap((unsigned long)phys, size);
268 else
269 return __acpi_map_table((unsigned long)phys, size);
1da177e4 270}
55a82ab3 271EXPORT_SYMBOL_GPL(acpi_os_map_memory);
1da177e4 272
4be44fcd 273void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
1da177e4 274{
ad71860a
AS
275 if (acpi_gbl_permanent_mmap) {
276 iounmap(virt);
277 }
1da177e4 278}
55a82ab3 279EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
1da177e4
LT
280
281#ifdef ACPI_FUTURE_USAGE
282acpi_status
4be44fcd 283acpi_os_get_physical_address(void *virt, acpi_physical_address * phys)
1da177e4 284{
4be44fcd 285 if (!phys || !virt)
1da177e4
LT
286 return AE_BAD_PARAMETER;
287
288 *phys = virt_to_phys(virt);
289
290 return AE_OK;
291}
292#endif
293
294#define ACPI_MAX_OVERRIDE_LEN 100
295
296static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
297
298acpi_status
4be44fcd
LB
299acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
300 acpi_string * new_val)
1da177e4
LT
301{
302 if (!init_val || !new_val)
303 return AE_BAD_PARAMETER;
304
305 *new_val = NULL;
4be44fcd 306 if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
1da177e4 307 printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
4be44fcd 308 acpi_os_name);
1da177e4
LT
309 *new_val = acpi_os_name;
310 }
311
312 return AE_OK;
313}
314
315acpi_status
4be44fcd
LB
316acpi_os_table_override(struct acpi_table_header * existing_table,
317 struct acpi_table_header ** new_table)
1da177e4
LT
318{
319 if (!existing_table || !new_table)
320 return AE_BAD_PARAMETER;
321
322#ifdef CONFIG_ACPI_CUSTOM_DSDT
323 if (strncmp(existing_table->signature, "DSDT", 4) == 0)
4be44fcd 324 *new_table = (struct acpi_table_header *)AmlCode;
1da177e4
LT
325 else
326 *new_table = NULL;
327#else
328 *new_table = NULL;
329#endif
330 return AE_OK;
331}
332
7d12e780 333static irqreturn_t acpi_irq(int irq, void *dev_id)
1da177e4 334{
4be44fcd 335 return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
1da177e4
LT
336}
337
338acpi_status
4be44fcd
LB
339acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
340 void *context)
1da177e4
LT
341{
342 unsigned int irq;
343
344 /*
345 * Ignore the GSI from the core, and use the value in our copy of the
346 * FADT. It may not be the same if an interrupt source override exists
347 * for the SCI.
348 */
cee324b1 349 gsi = acpi_gbl_FADT.sci_interrupt;
1da177e4
LT
350 if (acpi_gsi_to_irq(gsi, &irq) < 0) {
351 printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n",
352 gsi);
353 return AE_OK;
354 }
355
356 acpi_irq_handler = handler;
357 acpi_irq_context = context;
dace1453 358 if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
1da177e4
LT
359 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
360 return AE_NOT_ACQUIRED;
361 }
362 acpi_irq_irq = irq;
363
364 return AE_OK;
365}
366
4be44fcd 367acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
1da177e4
LT
368{
369 if (irq) {
370 free_irq(irq, acpi_irq);
371 acpi_irq_handler = NULL;
372 acpi_irq_irq = 0;
373 }
374
375 return AE_OK;
376}
377
378/*
379 * Running in interpreter thread context, safe to sleep
380 */
381
4be44fcd 382void acpi_os_sleep(acpi_integer ms)
1da177e4 383{
01a527ec 384 schedule_timeout_interruptible(msecs_to_jiffies(ms));
1da177e4 385}
4be44fcd 386
1da177e4
LT
387EXPORT_SYMBOL(acpi_os_sleep);
388
4be44fcd 389void acpi_os_stall(u32 us)
1da177e4
LT
390{
391 while (us) {
392 u32 delay = 1000;
393
394 if (delay > us)
395 delay = us;
396 udelay(delay);
397 touch_nmi_watchdog();
398 us -= delay;
399 }
400}
4be44fcd 401
1da177e4
LT
402EXPORT_SYMBOL(acpi_os_stall);
403
404/*
405 * Support ACPI 3.0 AML Timer operand
406 * Returns 64-bit free-running, monotonically increasing timer
407 * with 100ns granularity
408 */
4be44fcd 409u64 acpi_os_get_timer(void)
1da177e4
LT
410{
411 static u64 t;
412
413#ifdef CONFIG_HPET
414 /* TBD: use HPET if available */
415#endif
416
417#ifdef CONFIG_X86_PM_TIMER
418 /* TBD: default to PM timer if HPET was not available */
419#endif
420 if (!t)
421 printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n");
422
423 return ++t;
424}
425
4be44fcd 426acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
1da177e4
LT
427{
428 u32 dummy;
429
430 if (!value)
431 value = &dummy;
432
49fbabf5
ZY
433 *value = 0;
434 if (width <= 8) {
4be44fcd 435 *(u8 *) value = inb(port);
49fbabf5 436 } else if (width <= 16) {
4be44fcd 437 *(u16 *) value = inw(port);
49fbabf5 438 } else if (width <= 32) {
4be44fcd 439 *(u32 *) value = inl(port);
49fbabf5 440 } else {
1da177e4
LT
441 BUG();
442 }
443
444 return AE_OK;
445}
4be44fcd 446
1da177e4
LT
447EXPORT_SYMBOL(acpi_os_read_port);
448
4be44fcd 449acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
1da177e4 450{
49fbabf5 451 if (width <= 8) {
1da177e4 452 outb(value, port);
49fbabf5 453 } else if (width <= 16) {
1da177e4 454 outw(value, port);
49fbabf5 455 } else if (width <= 32) {
1da177e4 456 outl(value, port);
49fbabf5 457 } else {
1da177e4
LT
458 BUG();
459 }
460
461 return AE_OK;
462}
4be44fcd 463
1da177e4
LT
464EXPORT_SYMBOL(acpi_os_write_port);
465
466acpi_status
4be44fcd 467acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
1da177e4 468{
4be44fcd
LB
469 u32 dummy;
470 void __iomem *virt_addr;
1da177e4 471
9f4fd61f 472 virt_addr = ioremap(phys_addr, width);
1da177e4
LT
473 if (!value)
474 value = &dummy;
475
476 switch (width) {
477 case 8:
4be44fcd 478 *(u8 *) value = readb(virt_addr);
1da177e4
LT
479 break;
480 case 16:
4be44fcd 481 *(u16 *) value = readw(virt_addr);
1da177e4
LT
482 break;
483 case 32:
4be44fcd 484 *(u32 *) value = readl(virt_addr);
1da177e4
LT
485 break;
486 default:
487 BUG();
488 }
489
9f4fd61f 490 iounmap(virt_addr);
1da177e4
LT
491
492 return AE_OK;
493}
494
495acpi_status
4be44fcd 496acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
1da177e4 497{
4be44fcd 498 void __iomem *virt_addr;
1da177e4 499
9f4fd61f 500 virt_addr = ioremap(phys_addr, width);
1da177e4
LT
501
502 switch (width) {
503 case 8:
504 writeb(value, virt_addr);
505 break;
506 case 16:
507 writew(value, virt_addr);
508 break;
509 case 32:
510 writel(value, virt_addr);
511 break;
512 default:
513 BUG();
514 }
515
9f4fd61f 516 iounmap(virt_addr);
1da177e4
LT
517
518 return AE_OK;
519}
520
1da177e4 521acpi_status
4be44fcd
LB
522acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
523 void *value, u32 width)
1da177e4
LT
524{
525 int result, size;
526
527 if (!value)
528 return AE_BAD_PARAMETER;
529
530 switch (width) {
531 case 8:
532 size = 1;
533 break;
534 case 16:
535 size = 2;
536 break;
537 case 32:
538 size = 4;
539 break;
540 default:
541 return AE_ERROR;
542 }
543
544 BUG_ON(!raw_pci_ops);
545
546 result = raw_pci_ops->read(pci_id->segment, pci_id->bus,
4be44fcd
LB
547 PCI_DEVFN(pci_id->device, pci_id->function),
548 reg, size, value);
1da177e4
LT
549
550 return (result ? AE_ERROR : AE_OK);
551}
4be44fcd 552
1da177e4
LT
553EXPORT_SYMBOL(acpi_os_read_pci_configuration);
554
555acpi_status
4be44fcd
LB
556acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
557 acpi_integer value, u32 width)
1da177e4
LT
558{
559 int result, size;
560
561 switch (width) {
562 case 8:
563 size = 1;
564 break;
565 case 16:
566 size = 2;
567 break;
568 case 32:
569 size = 4;
570 break;
571 default:
572 return AE_ERROR;
573 }
574
575 BUG_ON(!raw_pci_ops);
576
577 result = raw_pci_ops->write(pci_id->segment, pci_id->bus,
4be44fcd
LB
578 PCI_DEVFN(pci_id->device, pci_id->function),
579 reg, size, value);
1da177e4
LT
580
581 return (result ? AE_ERROR : AE_OK);
582}
583
584/* TODO: Change code to take advantage of driver model more */
4be44fcd
LB
585static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
586 acpi_handle chandle, /* current node */
587 struct acpi_pci_id **id,
588 int *is_bridge, u8 * bus_number)
1da177e4 589{
4be44fcd
LB
590 acpi_handle handle;
591 struct acpi_pci_id *pci_id = *id;
592 acpi_status status;
593 unsigned long temp;
594 acpi_object_type type;
595 u8 tu8;
1da177e4
LT
596
597 acpi_get_parent(chandle, &handle);
598 if (handle != rhandle) {
4be44fcd
LB
599 acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge,
600 bus_number);
1da177e4
LT
601
602 status = acpi_get_type(handle, &type);
4be44fcd 603 if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
1da177e4
LT
604 return;
605
4be44fcd
LB
606 status =
607 acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
608 &temp);
1da177e4 609 if (ACPI_SUCCESS(status)) {
4be44fcd
LB
610 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
611 pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
1da177e4
LT
612
613 if (*is_bridge)
614 pci_id->bus = *bus_number;
615
616 /* any nicer way to get bus number of bridge ? */
4be44fcd
LB
617 status =
618 acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8,
619 8);
620 if (ACPI_SUCCESS(status)
621 && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
622 status =
623 acpi_os_read_pci_configuration(pci_id, 0x18,
624 &tu8, 8);
1da177e4
LT
625 if (!ACPI_SUCCESS(status)) {
626 /* Certainly broken... FIX ME */
627 return;
628 }
629 *is_bridge = 1;
630 pci_id->bus = tu8;
4be44fcd
LB
631 status =
632 acpi_os_read_pci_configuration(pci_id, 0x19,
633 &tu8, 8);
1da177e4
LT
634 if (ACPI_SUCCESS(status)) {
635 *bus_number = tu8;
636 }
637 } else
638 *is_bridge = 0;
639 }
640 }
641}
642
4be44fcd
LB
643void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
644 acpi_handle chandle, /* current node */
645 struct acpi_pci_id **id)
1da177e4
LT
646{
647 int is_bridge = 1;
648 u8 bus_number = (*id)->bus;
649
650 acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number);
651}
652
65f27f38 653static void acpi_os_execute_deferred(struct work_struct *work)
88db5e14
AS
654{
655 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
656 if (!dpc) {
657 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
658 return;
659 }
660
661 dpc->function(dpc->context);
662 kfree(dpc);
663
664 /* Yield cpu to notify thread */
665 cond_resched();
666
667 return;
668}
669
670static void acpi_os_execute_notify(struct work_struct *work)
1da177e4 671{
65f27f38 672 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
1da177e4 673
1da177e4 674 if (!dpc) {
6468463a 675 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
d550d98d 676 return;
1da177e4
LT
677 }
678
679 dpc->function(dpc->context);
680
681 kfree(dpc);
682
d550d98d 683 return;
1da177e4
LT
684}
685
b8d35192
AS
686/*******************************************************************************
687 *
688 * FUNCTION: acpi_os_execute
689 *
690 * PARAMETERS: Type - Type of the callback
691 * Function - Function to be executed
692 * Context - Function parameters
693 *
694 * RETURN: Status
695 *
696 * DESCRIPTION: Depending on type, either queues function for deferred execution or
697 * immediately executes function on a separate thread.
698 *
699 ******************************************************************************/
700
701acpi_status acpi_os_execute(acpi_execute_type type,
4be44fcd 702 acpi_osd_exec_callback function, void *context)
1da177e4 703{
4be44fcd
LB
704 acpi_status status = AE_OK;
705 struct acpi_os_dpc *dpc;
72945b2b 706
72945b2b
LB
707 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
708 "Scheduling function [%p(%p)] for deferred execution.\n",
709 function, context));
1da177e4
LT
710
711 if (!function)
88db5e14 712 return AE_BAD_PARAMETER;
72945b2b 713
1da177e4
LT
714 /*
715 * Allocate/initialize DPC structure. Note that this memory will be
65f27f38 716 * freed by the callee. The kernel handles the work_struct list in a
1da177e4
LT
717 * way that allows us to also free its memory inside the callee.
718 * Because we may want to schedule several tasks with different
719 * parameters we can't use the approach some kernel code uses of
65f27f38 720 * having a static work_struct.
1da177e4 721 */
72945b2b 722
65f27f38 723 dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC);
1da177e4 724 if (!dpc)
b976fe19
LT
725 return_ACPI_STATUS(AE_NO_MEMORY);
726
1da177e4
LT
727 dpc->function = function;
728 dpc->context = context;
b976fe19 729
88db5e14
AS
730 if (type == OSL_NOTIFY_HANDLER) {
731 INIT_WORK(&dpc->work, acpi_os_execute_notify);
732 if (!queue_work(kacpi_notify_wq, &dpc->work)) {
733 status = AE_ERROR;
734 kfree(dpc);
735 }
736 } else {
737 INIT_WORK(&dpc->work, acpi_os_execute_deferred);
738 if (!queue_work(kacpid_wq, &dpc->work)) {
739 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
b976fe19 740 "Call to queue_work() failed.\n"));
88db5e14
AS
741 status = AE_ERROR;
742 kfree(dpc);
743 }
1da177e4 744 }
b976fe19 745 return_ACPI_STATUS(status);
1da177e4 746}
4be44fcd 747
b8d35192 748EXPORT_SYMBOL(acpi_os_execute);
1da177e4 749
4be44fcd 750void acpi_os_wait_events_complete(void *context)
1da177e4
LT
751{
752 flush_workqueue(kacpid_wq);
753}
4be44fcd 754
1da177e4
LT
755EXPORT_SYMBOL(acpi_os_wait_events_complete);
756
757/*
758 * Allocate the memory for a spinlock and initialize it.
759 */
967440e3 760acpi_status acpi_os_create_lock(acpi_spinlock * handle)
1da177e4 761{
967440e3 762 spin_lock_init(*handle);
1da177e4 763
d550d98d 764 return AE_OK;
1da177e4
LT
765}
766
1da177e4
LT
767/*
768 * Deallocate the memory for a spinlock.
769 */
967440e3 770void acpi_os_delete_lock(acpi_spinlock handle)
1da177e4 771{
d550d98d 772 return;
1da177e4
LT
773}
774
1da177e4 775acpi_status
4be44fcd 776acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
1da177e4 777{
4be44fcd 778 struct semaphore *sem = NULL;
1da177e4 779
1da177e4
LT
780
781 sem = acpi_os_allocate(sizeof(struct semaphore));
782 if (!sem)
d550d98d 783 return AE_NO_MEMORY;
1da177e4
LT
784 memset(sem, 0, sizeof(struct semaphore));
785
786 sema_init(sem, initial_units);
787
4be44fcd 788 *handle = (acpi_handle *) sem;
1da177e4 789
4be44fcd
LB
790 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
791 *handle, initial_units));
1da177e4 792
d550d98d 793 return AE_OK;
1da177e4 794}
1da177e4 795
4be44fcd 796EXPORT_SYMBOL(acpi_os_create_semaphore);
1da177e4
LT
797
798/*
799 * TODO: A better way to delete semaphores? Linux doesn't have a
800 * 'delete_semaphore()' function -- may result in an invalid
801 * pointer dereference for non-synchronized consumers. Should
802 * we at least check for blocked threads and signal/cancel them?
803 */
804
4be44fcd 805acpi_status acpi_os_delete_semaphore(acpi_handle handle)
1da177e4 806{
4be44fcd 807 struct semaphore *sem = (struct semaphore *)handle;
1da177e4 808
1da177e4
LT
809
810 if (!sem)
d550d98d 811 return AE_BAD_PARAMETER;
1da177e4 812
4be44fcd 813 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
1da177e4 814
02438d87 815 kfree(sem);
4be44fcd 816 sem = NULL;
1da177e4 817
d550d98d 818 return AE_OK;
1da177e4 819}
1da177e4 820
4be44fcd 821EXPORT_SYMBOL(acpi_os_delete_semaphore);
1da177e4
LT
822
823/*
824 * TODO: The kernel doesn't have a 'down_timeout' function -- had to
825 * improvise. The process is to sleep for one scheduler quantum
826 * until the semaphore becomes available. Downside is that this
827 * may result in starvation for timeout-based waits when there's
828 * lots of semaphore activity.
829 *
830 * TODO: Support for units > 1?
831 */
4be44fcd 832acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
1da177e4 833{
4be44fcd
LB
834 acpi_status status = AE_OK;
835 struct semaphore *sem = (struct semaphore *)handle;
836 int ret = 0;
1da177e4 837
1da177e4
LT
838
839 if (!sem || (units < 1))
d550d98d 840 return AE_BAD_PARAMETER;
1da177e4
LT
841
842 if (units > 1)
d550d98d 843 return AE_SUPPORT;
1da177e4 844
4be44fcd
LB
845 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
846 handle, units, timeout));
1da177e4 847
d68909f4
LB
848 /*
849 * This can be called during resume with interrupts off.
850 * Like boot-time, we should be single threaded and will
851 * always get the lock if we try -- timeout or not.
852 * If this doesn't succeed, then we will oops courtesy of
853 * might_sleep() in down().
854 */
855 if (!down_trylock(sem))
856 return AE_OK;
857
4be44fcd 858 switch (timeout) {
1da177e4
LT
859 /*
860 * No Wait:
861 * --------
862 * A zero timeout value indicates that we shouldn't wait - just
863 * acquire the semaphore if available otherwise return AE_TIME
864 * (a.k.a. 'would block').
865 */
4be44fcd
LB
866 case 0:
867 if (down_trylock(sem))
1da177e4
LT
868 status = AE_TIME;
869 break;
870
871 /*
872 * Wait Indefinitely:
873 * ------------------
874 */
4be44fcd 875 case ACPI_WAIT_FOREVER:
1da177e4
LT
876 down(sem);
877 break;
878
879 /*
880 * Wait w/ Timeout:
881 * ----------------
882 */
4be44fcd 883 default:
1da177e4
LT
884 // TODO: A better timeout algorithm?
885 {
886 int i = 0;
4be44fcd 887 static const int quantum_ms = 1000 / HZ;
1da177e4
LT
888
889 ret = down_trylock(sem);
dacd9b80 890 for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) {
01a527ec 891 schedule_timeout_interruptible(1);
1da177e4
LT
892 ret = down_trylock(sem);
893 }
4be44fcd 894
1da177e4
LT
895 if (ret != 0)
896 status = AE_TIME;
897 }
898 break;
899 }
900
901 if (ACPI_FAILURE(status)) {
9e7e2c04 902 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
a6fc6720 903 "Failed to acquire semaphore[%p|%d|%d], %s",
4be44fcd
LB
904 handle, units, timeout,
905 acpi_format_exception(status)));
906 } else {
907 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
a6fc6720 908 "Acquired semaphore[%p|%d|%d]", handle,
4be44fcd 909 units, timeout));
1da177e4
LT
910 }
911
d550d98d 912 return status;
1da177e4 913}
1da177e4 914
4be44fcd 915EXPORT_SYMBOL(acpi_os_wait_semaphore);
1da177e4
LT
916
917/*
918 * TODO: Support for units > 1?
919 */
4be44fcd 920acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
1da177e4 921{
4be44fcd 922 struct semaphore *sem = (struct semaphore *)handle;
1da177e4 923
1da177e4
LT
924
925 if (!sem || (units < 1))
d550d98d 926 return AE_BAD_PARAMETER;
1da177e4
LT
927
928 if (units > 1)
d550d98d 929 return AE_SUPPORT;
1da177e4 930
4be44fcd
LB
931 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
932 units));
1da177e4
LT
933
934 up(sem);
935
d550d98d 936 return AE_OK;
1da177e4 937}
4be44fcd 938
1da177e4
LT
939EXPORT_SYMBOL(acpi_os_signal_semaphore);
940
941#ifdef ACPI_FUTURE_USAGE
4be44fcd 942u32 acpi_os_get_line(char *buffer)
1da177e4
LT
943{
944
945#ifdef ENABLE_DEBUGGER
946 if (acpi_in_debugger) {
947 u32 chars;
948
949 kdb_read(buffer, sizeof(line_buf));
950
951 /* remove the CR kdb includes */
952 chars = strlen(buffer) - 1;
953 buffer[chars] = '\0';
954 }
955#endif
956
957 return 0;
958}
4be44fcd 959#endif /* ACPI_FUTURE_USAGE */
1da177e4 960
4be44fcd 961acpi_status acpi_os_signal(u32 function, void *info)
1da177e4 962{
4be44fcd 963 switch (function) {
1da177e4
LT
964 case ACPI_SIGNAL_FATAL:
965 printk(KERN_ERR PREFIX "Fatal opcode executed\n");
966 break;
967 case ACPI_SIGNAL_BREAKPOINT:
968 /*
969 * AML Breakpoint
970 * ACPI spec. says to treat it as a NOP unless
971 * you are debugging. So if/when we integrate
972 * AML debugger into the kernel debugger its
973 * hook will go here. But until then it is
974 * not useful to print anything on breakpoints.
975 */
976 break;
977 default:
978 break;
979 }
980
981 return AE_OK;
982}
4be44fcd 983
1da177e4
LT
984EXPORT_SYMBOL(acpi_os_signal);
985
4be44fcd 986static int __init acpi_os_name_setup(char *str)
1da177e4
LT
987{
988 char *p = acpi_os_name;
4be44fcd 989 int count = ACPI_MAX_OVERRIDE_LEN - 1;
1da177e4
LT
990
991 if (!str || !*str)
992 return 0;
993
994 for (; count-- && str && *str; str++) {
995 if (isalnum(*str) || *str == ' ' || *str == ':')
996 *p++ = *str;
997 else if (*str == '\'' || *str == '"')
998 continue;
999 else
1000 break;
1001 }
1002 *p = 0;
1003
1004 return 1;
4be44fcd 1005
1da177e4
LT
1006}
1007
1008__setup("acpi_os_name=", acpi_os_name_setup);
1009
d4b7dc49
LB
1010static void __init set_osi_linux(unsigned int enable)
1011{
1012 if (osi_linux.enable != enable) {
1013 osi_linux.enable = enable;
1014 printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n",
1015 enable ? "Add": "Delet");
1016 }
1017 return;
1018}
1019
1020static void __init acpi_cmdline_osi_linux(unsigned int enable)
1021{
1022 osi_linux.cmdline = 1; /* cmdline set the default */
1023 set_osi_linux(enable);
1024
1025 return;
1026}
1027
1028void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
1029{
1030 osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */
1031
1032 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
1033
1034 if (enable == -1)
1035 return;
1036
1037 osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */
f507654d 1038
d4b7dc49 1039 set_osi_linux(enable);
f507654d 1040
f507654d
LB
1041 return;
1042}
1043
1da177e4 1044/*
ae00d812
LB
1045 * Modify the list of "OS Interfaces" reported to BIOS via _OSI
1046 *
1da177e4 1047 * empty string disables _OSI
ae00d812
LB
1048 * string starting with '!' disables that string
1049 * otherwise string is added to list, augmenting built-in strings
1da177e4 1050 */
4be44fcd 1051static int __init acpi_osi_setup(char *str)
1da177e4
LT
1052{
1053 if (str == NULL || *str == '\0') {
1054 printk(KERN_INFO PREFIX "_OSI method disabled\n");
1055 acpi_gbl_create_osi_method = FALSE;
aa2e09da 1056 } else if (!strcmp("!Linux", str)) {
d4b7dc49 1057 acpi_cmdline_osi_linux(0); /* !enable */
ae00d812
LB
1058 } else if (*str == '!') {
1059 if (acpi_osi_invalidate(++str) == AE_OK)
1060 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
f507654d 1061 } else if (!strcmp("Linux", str)) {
d4b7dc49 1062 acpi_cmdline_osi_linux(1); /* enable */
ae00d812
LB
1063 } else if (*osi_additional_string == '\0') {
1064 strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
1065 printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
1da177e4
LT
1066 }
1067
1068 return 1;
1069}
1070
1071__setup("acpi_osi=", acpi_osi_setup);
1072
1073/* enable serialization to combat AE_ALREADY_EXISTS errors */
4be44fcd 1074static int __init acpi_serialize_setup(char *str)
1da177e4
LT
1075{
1076 printk(KERN_INFO PREFIX "serialize enabled\n");
1077
1078 acpi_gbl_all_methods_serialized = TRUE;
1079
1080 return 1;
1081}
1082
1083__setup("acpi_serialize", acpi_serialize_setup);
1084
1085/*
1086 * Wake and Run-Time GPES are expected to be separate.
1087 * We disable wake-GPEs at run-time to prevent spurious
1088 * interrupts.
1089 *
1090 * However, if a system exists that shares Wake and
1091 * Run-time events on the same GPE this flag is available
1092 * to tell Linux to keep the wake-time GPEs enabled at run-time.
1093 */
4be44fcd 1094static int __init acpi_wake_gpes_always_on_setup(char *str)
1da177e4
LT
1095{
1096 printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
1097
1098 acpi_gbl_leave_wake_gpes_disabled = FALSE;
1099
1100 return 1;
1101}
1102
1103__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
1104
73459f73
RM
1105/*
1106 * Acquire a spinlock.
1107 *
1108 * handle is a pointer to the spinlock_t.
73459f73
RM
1109 */
1110
967440e3 1111acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
73459f73 1112{
b8e4d893 1113 acpi_cpu_flags flags;
967440e3 1114 spin_lock_irqsave(lockp, flags);
73459f73
RM
1115 return flags;
1116}
1117
1118/*
1119 * Release a spinlock. See above.
1120 */
1121
967440e3 1122void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
73459f73 1123{
967440e3 1124 spin_unlock_irqrestore(lockp, flags);
73459f73
RM
1125}
1126
73459f73
RM
1127#ifndef ACPI_USE_LOCAL_CACHE
1128
1129/*******************************************************************************
1130 *
1131 * FUNCTION: acpi_os_create_cache
1132 *
b229cf92
BM
1133 * PARAMETERS: name - Ascii name for the cache
1134 * size - Size of each cached object
1135 * depth - Maximum depth of the cache (in objects) <ignored>
1136 * cache - Where the new cache object is returned
73459f73 1137 *
b229cf92 1138 * RETURN: status
73459f73
RM
1139 *
1140 * DESCRIPTION: Create a cache object
1141 *
1142 ******************************************************************************/
1143
1144acpi_status
4be44fcd 1145acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
73459f73 1146{
20c2df83 1147 *cache = kmem_cache_create(name, size, 0, 0, NULL);
a6fdbf90 1148 if (*cache == NULL)
b229cf92
BM
1149 return AE_ERROR;
1150 else
1151 return AE_OK;
73459f73
RM
1152}
1153
1154/*******************************************************************************
1155 *
1156 * FUNCTION: acpi_os_purge_cache
1157 *
1158 * PARAMETERS: Cache - Handle to cache object
1159 *
1160 * RETURN: Status
1161 *
1162 * DESCRIPTION: Free all objects within the requested cache.
1163 *
1164 ******************************************************************************/
1165
4be44fcd 1166acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
73459f73 1167{
50dd0969 1168 kmem_cache_shrink(cache);
4be44fcd 1169 return (AE_OK);
73459f73
RM
1170}
1171
1172/*******************************************************************************
1173 *
1174 * FUNCTION: acpi_os_delete_cache
1175 *
1176 * PARAMETERS: Cache - Handle to cache object
1177 *
1178 * RETURN: Status
1179 *
1180 * DESCRIPTION: Free all objects within the requested cache and delete the
1181 * cache object.
1182 *
1183 ******************************************************************************/
1184
4be44fcd 1185acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
73459f73 1186{
1a1d92c1 1187 kmem_cache_destroy(cache);
4be44fcd 1188 return (AE_OK);
73459f73
RM
1189}
1190
1191/*******************************************************************************
1192 *
1193 * FUNCTION: acpi_os_release_object
1194 *
1195 * PARAMETERS: Cache - Handle to cache object
1196 * Object - The object to be released
1197 *
1198 * RETURN: None
1199 *
1200 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1201 * the object is deleted.
1202 *
1203 ******************************************************************************/
1204
4be44fcd 1205acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
73459f73 1206{
4be44fcd
LB
1207 kmem_cache_free(cache, object);
1208 return (AE_OK);
73459f73
RM
1209}
1210
5a4e1432
LB
1211/**
1212 * acpi_dmi_dump - dump DMI slots needed for blacklist entry
1213 *
1214 * Returns 0 on success
1215 */
12d3931c 1216static int acpi_dmi_dump(void)
5a4e1432
LB
1217{
1218
1219 if (!dmi_available)
1220 return -1;
1221
1222 printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n",
e6298c6d 1223 dmi_get_system_info(DMI_SYS_VENDOR));
5a4e1432 1224 printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n",
e6298c6d 1225 dmi_get_system_info(DMI_PRODUCT_NAME));
5a4e1432 1226 printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n",
e6298c6d 1227 dmi_get_system_info(DMI_PRODUCT_VERSION));
5a4e1432 1228 printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n",
e6298c6d 1229 dmi_get_system_info(DMI_BOARD_NAME));
5a4e1432 1230 printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n",
e6298c6d 1231 dmi_get_system_info(DMI_BIOS_VENDOR));
5a4e1432 1232 printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n",
e6298c6d 1233 dmi_get_system_info(DMI_BIOS_DATE));
5a4e1432
LB
1234
1235 return 0;
1236}
1237
1238
b229cf92
BM
1239/******************************************************************************
1240 *
1241 * FUNCTION: acpi_os_validate_interface
1242 *
1243 * PARAMETERS: interface - Requested interface to be validated
1244 *
1245 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1246 *
1247 * DESCRIPTION: Match an interface string to the interfaces supported by the
1248 * host. Strings originate from an AML call to the _OSI method.
1249 *
1250 *****************************************************************************/
1251
1252acpi_status
1253acpi_os_validate_interface (char *interface)
1254{
ae00d812
LB
1255 if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX))
1256 return AE_OK;
f507654d 1257 if (!strcmp("Linux", interface)) {
d4b7dc49 1258
f40cd6fd 1259 printk(KERN_NOTICE PREFIX
d4b7dc49
LB
1260 "BIOS _OSI(Linux) query %s%s\n",
1261 osi_linux.enable ? "honored" : "ignored",
1262 osi_linux.cmdline ? " via cmdline" :
1263 osi_linux.dmi ? " via DMI" : "");
1264
1265 if (!osi_linux.dmi) {
1266 if (acpi_dmi_dump())
1267 printk(KERN_NOTICE PREFIX
1268 "[please extract dmidecode output]\n");
1269 printk(KERN_NOTICE PREFIX
1270 "Please send DMI info above to "
1271 "linux-acpi@vger.kernel.org\n");
1272 }
1273 if (!osi_linux.known && !osi_linux.cmdline) {
1274 printk(KERN_NOTICE PREFIX
1275 "If \"acpi_osi=%sLinux\" works better, "
1276 "please notify linux-acpi@vger.kernel.org\n",
1277 osi_linux.enable ? "!" : "");
1278 }
1279
1280 if (osi_linux.enable)
f507654d
LB
1281 return AE_OK;
1282 }
ae00d812 1283 return AE_SUPPORT;
b229cf92
BM
1284}
1285
b229cf92
BM
1286/******************************************************************************
1287 *
1288 * FUNCTION: acpi_os_validate_address
1289 *
1290 * PARAMETERS: space_id - ACPI space ID
1291 * address - Physical address
1292 * length - Address length
1293 *
1294 * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
1295 * should return AE_AML_ILLEGAL_ADDRESS.
1296 *
1297 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1298 * the addresses accessed by AML operation regions.
1299 *
1300 *****************************************************************************/
1301
1302acpi_status
1303acpi_os_validate_address (
1304 u8 space_id,
1305 acpi_physical_address address,
1306 acpi_size length)
1307{
1308
1309 return AE_OK;
1310}
1311
73459f73 1312#endif