blob: 2b41bdddbeb68c8d77c03fa84c5fcd0e4505cfb6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <linux/module.h>
29#include <linux/kernel.h>
30#include <linux/slab.h>
31#include <linux/mm.h>
32#include <linux/pci.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#include <linux/interrupt.h>
34#include <linux/kmod.h>
35#include <linux/delay.h>
Len Brownf5076542007-05-30 00:10:38 -040036#include <linux/dmi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#include <linux/workqueue.h>
38#include <linux/nmi.h>
Alexey Starikovskiyad718602007-02-02 19:48:19 +030039#include <linux/acpi.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#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
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#define _COMPONENT ACPI_OS_SERVICES
Len Brownf52fd662007-02-12 22:42:12 -050049ACPI_MODULE_NAME("osl");
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#define PREFIX "ACPI: "
Len Brown4be44fc2005-08-05 00:44:28 -040051struct acpi_os_dpc {
52 acpi_osd_exec_callback function;
53 void *context;
David Howells65f27f32006-11-22 14:55:48 +000054 struct work_struct work;
Linus Torvalds1da177e2005-04-16 15:20:36 -070055};
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];
Len Brown4be44fc2005-08-05 00:44:28 -040069#endif /*ENABLE_DEBUGGER */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
71static unsigned int acpi_irq_irq;
72static acpi_osd_handler acpi_irq_handler;
73static void *acpi_irq_context;
74static struct workqueue_struct *kacpid_wq;
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -040075static struct workqueue_struct *kacpi_notify_wq;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Len Brownae00d812007-05-29 18:43:33 -040077#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
78static char osi_additional_string[OSI_STRING_LENGTH_MAX];
79
Éric Piel9cbc7962008-02-05 00:04:58 +010080#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
81static int acpi_no_initrd_override;
82#endif
83
Len Brownd4b7dc42008-01-23 20:50:56 -050084/*
85 * "Ode to _OSI(Linux)"
86 *
87 * osi_linux -- Control response to BIOS _OSI(Linux) query.
88 *
89 * As Linux evolves, the features that it supports change.
90 * So an OSI string such as "Linux" is not specific enough
91 * to be useful across multiple versions of Linux. It
92 * doesn't identify any particular feature, interface,
93 * or even any particular version of Linux...
94 *
95 * Unfortunately, Linux-2.6.22 and earlier responded "yes"
96 * to a BIOS _OSI(Linux) query. When
97 * a reference mobile BIOS started using it, its use
98 * started to spread to many vendor platforms.
99 * As it is not supportable, we need to halt that spread.
100 *
101 * Today, most BIOS references to _OSI(Linux) are noise --
102 * they have no functional effect and are just dead code
103 * carried over from the reference BIOS.
104 *
105 * The next most common case is that _OSI(Linux) harms Linux,
106 * usually by causing the BIOS to follow paths that are
107 * not tested during Windows validation.
108 *
109 * Finally, there is a short list of platforms
110 * where OSI(Linux) benefits Linux.
111 *
112 * In Linux-2.6.23, OSI(Linux) is first disabled by default.
113 * DMI is used to disable the dmesg warning about OSI(Linux)
114 * on platforms where it is known to have no effect.
115 * But a dmesg warning remains for systems where
116 * we do not know if OSI(Linux) is good or bad for the system.
117 * DMI is also used to enable OSI(Linux) for the machines
118 * that are known to need it.
119 *
120 * BIOS writers should NOT query _OSI(Linux) on future systems.
121 * It will be ignored by default, and to get Linux to
122 * not ignore it will require a kernel source update to
123 * add a DMI entry, or a boot-time "acpi_osi=Linux" invocation.
124 */
125#define OSI_LINUX_ENABLE 0
126
127struct osi_linux {
128 unsigned int enable:1;
129 unsigned int dmi:1;
130 unsigned int cmdline:1;
131 unsigned int known:1;
132} osi_linux = { OSI_LINUX_ENABLE, 0, 0, 0};
Len Brownf5076542007-05-30 00:10:38 -0400133
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700134static void __init acpi_request_region (struct acpi_generic_address *addr,
135 unsigned int length, char *desc)
136{
137 struct resource *res;
138
139 if (!addr->address || !length)
140 return;
141
Len Browneee3c852007-02-03 01:38:16 -0500142 if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700143 res = request_region(addr->address, length, desc);
Len Browneee3c852007-02-03 01:38:16 -0500144 else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700145 res = request_mem_region(addr->address, length, desc);
146}
147
148static int __init acpi_reserve_resources(void)
149{
Len Browneee3c852007-02-03 01:38:16 -0500150 acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700151 "ACPI PM1a_EVT_BLK");
152
Len Browneee3c852007-02-03 01:38:16 -0500153 acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length,
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700154 "ACPI PM1b_EVT_BLK");
155
Len Browneee3c852007-02-03 01:38:16 -0500156 acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length,
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700157 "ACPI PM1a_CNT_BLK");
158
Len Browneee3c852007-02-03 01:38:16 -0500159 acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length,
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700160 "ACPI PM1b_CNT_BLK");
161
Len Browneee3c852007-02-03 01:38:16 -0500162 if (acpi_gbl_FADT.pm_timer_length == 4)
163 acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700164
Len Browneee3c852007-02-03 01:38:16 -0500165 acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length,
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700166 "ACPI PM2_CNT_BLK");
167
168 /* Length of GPE blocks must be a non-negative multiple of 2 */
169
Len Browneee3c852007-02-03 01:38:16 -0500170 if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
171 acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
172 acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700173
Len Browneee3c852007-02-03 01:38:16 -0500174 if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
175 acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
176 acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
Bjorn Helgaas9a47cdb2007-01-18 16:42:55 -0700177
178 return 0;
179}
180device_initcall(acpi_reserve_resources);
181
Len Browndd272b52007-05-30 00:26:11 -0400182acpi_status __init acpi_os_initialize(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183{
184 return AE_OK;
185}
186
Len Brown4be44fc2005-08-05 00:44:28 -0400187acpi_status acpi_os_initialize1(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188{
189 /*
190 * Initialize PCI configuration space access, as we'll need to access
191 * it while walking the namespace (bus 0 and root bridges w/ _BBNs).
192 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 if (!raw_pci_ops) {
Len Brown4be44fc2005-08-05 00:44:28 -0400194 printk(KERN_ERR PREFIX
195 "Access to PCI configuration space unavailable\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700196 return AE_NULL_ENTRY;
197 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 kacpid_wq = create_singlethread_workqueue("kacpid");
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -0400199 kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 BUG_ON(!kacpid_wq);
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -0400201 BUG_ON(!kacpi_notify_wq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202 return AE_OK;
203}
204
Len Brown4be44fc2005-08-05 00:44:28 -0400205acpi_status acpi_os_terminate(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206{
207 if (acpi_irq_handler) {
208 acpi_os_remove_interrupt_handler(acpi_irq_irq,
209 acpi_irq_handler);
210 }
211
212 destroy_workqueue(kacpid_wq);
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -0400213 destroy_workqueue(kacpi_notify_wq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214
215 return AE_OK;
216}
217
Len Brown4be44fc2005-08-05 00:44:28 -0400218void acpi_os_printf(const char *fmt, ...)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219{
220 va_list args;
221 va_start(args, fmt);
222 acpi_os_vprintf(fmt, args);
223 va_end(args);
224}
Len Brown4be44fc2005-08-05 00:44:28 -0400225
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226EXPORT_SYMBOL(acpi_os_printf);
227
Len Brown4be44fc2005-08-05 00:44:28 -0400228void acpi_os_vprintf(const char *fmt, va_list args)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229{
230 static char buffer[512];
Len Brown4be44fc2005-08-05 00:44:28 -0400231
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 vsprintf(buffer, fmt, args);
233
234#ifdef ENABLE_DEBUGGER
235 if (acpi_in_debugger) {
236 kdb_printf("%s", buffer);
237 } else {
238 printk("%s", buffer);
239 }
240#else
241 printk("%s", buffer);
242#endif
243}
244
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300245acpi_physical_address __init acpi_os_get_root_pointer(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246{
247 if (efi_enabled) {
Bjorn Helgaasb2c99e32006-03-26 01:37:08 -0800248 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300249 return efi.acpi20;
Bjorn Helgaasb2c99e32006-03-26 01:37:08 -0800250 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300251 return efi.acpi;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 else {
Len Brown4be44fc2005-08-05 00:44:28 -0400253 printk(KERN_ERR PREFIX
254 "System description tables not found\n");
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300255 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 }
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300257 } else
258 return acpi_find_rsdp();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259}
260
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300261void __iomem *acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262{
Bjorn Helgaas9f4fd612006-03-26 01:37:10 -0800263 if (phys > ULONG_MAX) {
264 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
Randy Dunlap70c08462007-02-13 16:11:36 -0800265 return NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 }
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300267 if (acpi_gbl_permanent_mmap)
268 /*
269 * ioremap checks to ensure this is in reserved space
270 */
271 return ioremap((unsigned long)phys, size);
272 else
273 return __acpi_map_table((unsigned long)phys, size);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274}
Kylene Jo Hall55a82ab2006-01-08 01:03:15 -0800275EXPORT_SYMBOL_GPL(acpi_os_map_memory);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276
Len Brown4be44fc2005-08-05 00:44:28 -0400277void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278{
Alexey Starikovskiyad718602007-02-02 19:48:19 +0300279 if (acpi_gbl_permanent_mmap) {
280 iounmap(virt);
281 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282}
Kylene Jo Hall55a82ab2006-01-08 01:03:15 -0800283EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284
285#ifdef ACPI_FUTURE_USAGE
286acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400287acpi_os_get_physical_address(void *virt, acpi_physical_address * phys)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288{
Len Brown4be44fc2005-08-05 00:44:28 -0400289 if (!phys || !virt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 return AE_BAD_PARAMETER;
291
292 *phys = virt_to_phys(virt);
293
294 return AE_OK;
295}
296#endif
297
298#define ACPI_MAX_OVERRIDE_LEN 100
299
300static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
301
302acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400303acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
304 acpi_string * new_val)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305{
306 if (!init_val || !new_val)
307 return AE_BAD_PARAMETER;
308
309 *new_val = NULL;
Len Brown4be44fc2005-08-05 00:44:28 -0400310 if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311 printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
Len Brown4be44fc2005-08-05 00:44:28 -0400312 acpi_os_name);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 *new_val = acpi_os_name;
314 }
315
316 return AE_OK;
317}
318
Markus Gaugusch71fc47a2008-02-05 00:04:06 +0100319#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
320struct acpi_table_header *acpi_find_dsdt_initrd(void)
321{
322 struct file *firmware_file;
323 mm_segment_t oldfs;
324 unsigned long len, len2;
325 struct acpi_table_header *dsdt_buffer, *ret = NULL;
326 struct kstat stat;
327 char *ramfs_dsdt_name = "/DSDT.aml";
328
329 printk(KERN_INFO PREFIX "Looking for DSDT in initramfs... ");
330
331 /*
332 * Never do this at home, only the user-space is allowed to open a file.
333 * The clean way would be to use the firmware loader. But this code must be run
334 * before there is any userspace available. So we need a static/init firmware
335 * infrastructure, which doesn't exist yet...
336 */
337 if (vfs_stat(ramfs_dsdt_name, &stat) < 0) {
338 printk("not found.\n");
339 return ret;
340 }
341
342 len = stat.size;
343 /* check especially against empty files */
344 if (len <= 4) {
345 printk("error, file is too small: only %lu bytes.\n", len);
346 return ret;
347 }
348
349 firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
350 if (IS_ERR(firmware_file)) {
351 printk("error, could not open file %s.\n", ramfs_dsdt_name);
352 return ret;
353 }
354
355 dsdt_buffer = ACPI_ALLOCATE(len);
356 if (!dsdt_buffer) {
357 printk("error when allocating %lu bytes of memory.\n", len);
358 goto err;
359 }
360
361 oldfs = get_fs();
362 set_fs(KERNEL_DS);
363 len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, &firmware_file->f_pos);
364 set_fs(oldfs);
365 if (len2 < len) {
366 printk("error trying to read %lu bytes from %s.\n", len, ramfs_dsdt_name);
367 ACPI_FREE(dsdt_buffer);
368 goto err;
369 }
370
371 printk("successfully read %lu bytes from %s.\n", len, ramfs_dsdt_name);
372 ret = dsdt_buffer;
373err:
374 filp_close(firmware_file, NULL);
375 return ret;
376}
377#endif
378
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400380acpi_os_table_override(struct acpi_table_header * existing_table,
381 struct acpi_table_header ** new_table)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382{
383 if (!existing_table || !new_table)
384 return AE_BAD_PARAMETER;
385
Markus Gaugusch71fc47a2008-02-05 00:04:06 +0100386 *new_table = NULL;
387
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388#ifdef CONFIG_ACPI_CUSTOM_DSDT
389 if (strncmp(existing_table->signature, "DSDT", 4) == 0)
Len Brown4be44fc2005-08-05 00:44:28 -0400390 *new_table = (struct acpi_table_header *)AmlCode;
Markus Gaugusch71fc47a2008-02-05 00:04:06 +0100391#endif
392#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
Éric Piel9cbc7962008-02-05 00:04:58 +0100393 if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
394 !acpi_no_initrd_override) {
Markus Gaugusch71fc47a2008-02-05 00:04:06 +0100395 struct acpi_table_header *initrd_table = acpi_find_dsdt_initrd();
396 if (initrd_table)
397 *new_table = initrd_table;
398 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399#endif
Éric Piel6ed31e92008-02-05 00:04:50 +0100400 if (*new_table != NULL) {
401 printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
402 "this is unsafe: tainting kernel\n",
403 existing_table->signature,
404 existing_table->oem_table_id);
405 add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
406 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 return AE_OK;
408}
409
Éric Piel9cbc7962008-02-05 00:04:58 +0100410#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
411int __init acpi_no_initrd_override_setup(char *s)
412{
413 acpi_no_initrd_override = 1;
414 return 1;
415}
416__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
417#endif
418
David Howells7d12e782006-10-05 14:55:46 +0100419static irqreturn_t acpi_irq(int irq, void *dev_id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420{
Len Brown4be44fc2005-08-05 00:44:28 -0400421 return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422}
423
424acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400425acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
426 void *context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427{
428 unsigned int irq;
429
430 /*
431 * Ignore the GSI from the core, and use the value in our copy of the
432 * FADT. It may not be the same if an interrupt source override exists
433 * for the SCI.
434 */
Alexey Starikovskiycee324b2007-02-02 19:48:22 +0300435 gsi = acpi_gbl_FADT.sci_interrupt;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 if (acpi_gsi_to_irq(gsi, &irq) < 0) {
437 printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n",
438 gsi);
439 return AE_OK;
440 }
441
442 acpi_irq_handler = handler;
443 acpi_irq_context = context;
Thomas Gleixnerdace1452006-07-01 19:29:38 -0700444 if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
446 return AE_NOT_ACQUIRED;
447 }
448 acpi_irq_irq = irq;
449
450 return AE_OK;
451}
452
Len Brown4be44fc2005-08-05 00:44:28 -0400453acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454{
455 if (irq) {
456 free_irq(irq, acpi_irq);
457 acpi_irq_handler = NULL;
458 acpi_irq_irq = 0;
459 }
460
461 return AE_OK;
462}
463
464/*
465 * Running in interpreter thread context, safe to sleep
466 */
467
Len Brown4be44fc2005-08-05 00:44:28 -0400468void acpi_os_sleep(acpi_integer ms)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469{
Nishanth Aravamudan01a527e2005-11-07 01:01:14 -0800470 schedule_timeout_interruptible(msecs_to_jiffies(ms));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471}
Len Brown4be44fc2005-08-05 00:44:28 -0400472
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473EXPORT_SYMBOL(acpi_os_sleep);
474
Len Brown4be44fc2005-08-05 00:44:28 -0400475void acpi_os_stall(u32 us)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476{
477 while (us) {
478 u32 delay = 1000;
479
480 if (delay > us)
481 delay = us;
482 udelay(delay);
483 touch_nmi_watchdog();
484 us -= delay;
485 }
486}
Len Brown4be44fc2005-08-05 00:44:28 -0400487
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488EXPORT_SYMBOL(acpi_os_stall);
489
490/*
491 * Support ACPI 3.0 AML Timer operand
492 * Returns 64-bit free-running, monotonically increasing timer
493 * with 100ns granularity
494 */
Len Brown4be44fc2005-08-05 00:44:28 -0400495u64 acpi_os_get_timer(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496{
497 static u64 t;
498
499#ifdef CONFIG_HPET
500 /* TBD: use HPET if available */
501#endif
502
503#ifdef CONFIG_X86_PM_TIMER
504 /* TBD: default to PM timer if HPET was not available */
505#endif
506 if (!t)
507 printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n");
508
509 return ++t;
510}
511
Len Brown4be44fc2005-08-05 00:44:28 -0400512acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513{
514 u32 dummy;
515
516 if (!value)
517 value = &dummy;
518
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800519 *value = 0;
520 if (width <= 8) {
Len Brown4be44fc2005-08-05 00:44:28 -0400521 *(u8 *) value = inb(port);
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800522 } else if (width <= 16) {
Len Brown4be44fc2005-08-05 00:44:28 -0400523 *(u16 *) value = inw(port);
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800524 } else if (width <= 32) {
Len Brown4be44fc2005-08-05 00:44:28 -0400525 *(u32 *) value = inl(port);
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800526 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 BUG();
528 }
529
530 return AE_OK;
531}
Len Brown4be44fc2005-08-05 00:44:28 -0400532
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533EXPORT_SYMBOL(acpi_os_read_port);
534
Len Brown4be44fc2005-08-05 00:44:28 -0400535acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536{
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800537 if (width <= 8) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 outb(value, port);
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800539 } else if (width <= 16) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 outw(value, port);
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800541 } else if (width <= 32) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 outl(value, port);
Zhao Yakui49fbabf2007-11-15 17:01:06 +0800543 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 BUG();
545 }
546
547 return AE_OK;
548}
Len Brown4be44fc2005-08-05 00:44:28 -0400549
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550EXPORT_SYMBOL(acpi_os_write_port);
551
552acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400553acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554{
Len Brown4be44fc2005-08-05 00:44:28 -0400555 u32 dummy;
556 void __iomem *virt_addr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557
Bjorn Helgaas9f4fd612006-03-26 01:37:10 -0800558 virt_addr = ioremap(phys_addr, width);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 if (!value)
560 value = &dummy;
561
562 switch (width) {
563 case 8:
Len Brown4be44fc2005-08-05 00:44:28 -0400564 *(u8 *) value = readb(virt_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 break;
566 case 16:
Len Brown4be44fc2005-08-05 00:44:28 -0400567 *(u16 *) value = readw(virt_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 break;
569 case 32:
Len Brown4be44fc2005-08-05 00:44:28 -0400570 *(u32 *) value = readl(virt_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 break;
572 default:
573 BUG();
574 }
575
Bjorn Helgaas9f4fd612006-03-26 01:37:10 -0800576 iounmap(virt_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577
578 return AE_OK;
579}
580
581acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400582acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583{
Len Brown4be44fc2005-08-05 00:44:28 -0400584 void __iomem *virt_addr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585
Bjorn Helgaas9f4fd612006-03-26 01:37:10 -0800586 virt_addr = ioremap(phys_addr, width);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587
588 switch (width) {
589 case 8:
590 writeb(value, virt_addr);
591 break;
592 case 16:
593 writew(value, virt_addr);
594 break;
595 case 32:
596 writel(value, virt_addr);
597 break;
598 default:
599 BUG();
600 }
601
Bjorn Helgaas9f4fd612006-03-26 01:37:10 -0800602 iounmap(virt_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603
604 return AE_OK;
605}
606
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400608acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
609 void *value, u32 width)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610{
611 int result, size;
612
613 if (!value)
614 return AE_BAD_PARAMETER;
615
616 switch (width) {
617 case 8:
618 size = 1;
619 break;
620 case 16:
621 size = 2;
622 break;
623 case 32:
624 size = 4;
625 break;
626 default:
627 return AE_ERROR;
628 }
629
630 BUG_ON(!raw_pci_ops);
631
632 result = raw_pci_ops->read(pci_id->segment, pci_id->bus,
Len Brown4be44fc2005-08-05 00:44:28 -0400633 PCI_DEVFN(pci_id->device, pci_id->function),
634 reg, size, value);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635
636 return (result ? AE_ERROR : AE_OK);
637}
Len Brown4be44fc2005-08-05 00:44:28 -0400638
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639EXPORT_SYMBOL(acpi_os_read_pci_configuration);
640
641acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400642acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
643 acpi_integer value, u32 width)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644{
645 int result, size;
646
647 switch (width) {
648 case 8:
649 size = 1;
650 break;
651 case 16:
652 size = 2;
653 break;
654 case 32:
655 size = 4;
656 break;
657 default:
658 return AE_ERROR;
659 }
660
661 BUG_ON(!raw_pci_ops);
662
663 result = raw_pci_ops->write(pci_id->segment, pci_id->bus,
Len Brown4be44fc2005-08-05 00:44:28 -0400664 PCI_DEVFN(pci_id->device, pci_id->function),
665 reg, size, value);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666
667 return (result ? AE_ERROR : AE_OK);
668}
669
670/* TODO: Change code to take advantage of driver model more */
Len Brown4be44fc2005-08-05 00:44:28 -0400671static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
672 acpi_handle chandle, /* current node */
673 struct acpi_pci_id **id,
674 int *is_bridge, u8 * bus_number)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675{
Len Brown4be44fc2005-08-05 00:44:28 -0400676 acpi_handle handle;
677 struct acpi_pci_id *pci_id = *id;
678 acpi_status status;
679 unsigned long temp;
680 acpi_object_type type;
681 u8 tu8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682
683 acpi_get_parent(chandle, &handle);
684 if (handle != rhandle) {
Len Brown4be44fc2005-08-05 00:44:28 -0400685 acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge,
686 bus_number);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687
688 status = acpi_get_type(handle, &type);
Len Brown4be44fc2005-08-05 00:44:28 -0400689 if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 return;
691
Len Brown4be44fc2005-08-05 00:44:28 -0400692 status =
693 acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
694 &temp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695 if (ACPI_SUCCESS(status)) {
Len Brown4be44fc2005-08-05 00:44:28 -0400696 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
697 pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698
699 if (*is_bridge)
700 pci_id->bus = *bus_number;
701
702 /* any nicer way to get bus number of bridge ? */
Len Brown4be44fc2005-08-05 00:44:28 -0400703 status =
704 acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8,
705 8);
706 if (ACPI_SUCCESS(status)
707 && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
708 status =
709 acpi_os_read_pci_configuration(pci_id, 0x18,
710 &tu8, 8);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 if (!ACPI_SUCCESS(status)) {
712 /* Certainly broken... FIX ME */
713 return;
714 }
715 *is_bridge = 1;
716 pci_id->bus = tu8;
Len Brown4be44fc2005-08-05 00:44:28 -0400717 status =
718 acpi_os_read_pci_configuration(pci_id, 0x19,
719 &tu8, 8);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720 if (ACPI_SUCCESS(status)) {
721 *bus_number = tu8;
722 }
723 } else
724 *is_bridge = 0;
725 }
726 }
727}
728
Len Brown4be44fc2005-08-05 00:44:28 -0400729void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
730 acpi_handle chandle, /* current node */
731 struct acpi_pci_id **id)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732{
733 int is_bridge = 1;
734 u8 bus_number = (*id)->bus;
735
736 acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number);
737}
738
David Howells65f27f32006-11-22 14:55:48 +0000739static void acpi_os_execute_deferred(struct work_struct *work)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740{
David Howells65f27f32006-11-22 14:55:48 +0000741 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -0400742 if (!dpc) {
743 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
744 return;
745 }
746
747 dpc->function(dpc->context);
748 kfree(dpc);
749
750 /* Yield cpu to notify thread */
751 cond_resched();
752
753 return;
754}
755
756static void acpi_os_execute_notify(struct work_struct *work)
757{
758 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760 if (!dpc) {
Len Brown64684632006-06-26 23:41:38 -0400761 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
Patrick Mocheld550d982006-06-27 00:41:40 -0400762 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 }
764
765 dpc->function(dpc->context);
766
767 kfree(dpc);
768
Patrick Mocheld550d982006-06-27 00:41:40 -0400769 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770}
771
Alexey Starikovskiyb8d35192006-05-05 03:23:00 -0400772/*******************************************************************************
773 *
774 * FUNCTION: acpi_os_execute
775 *
776 * PARAMETERS: Type - Type of the callback
777 * Function - Function to be executed
778 * Context - Function parameters
779 *
780 * RETURN: Status
781 *
782 * DESCRIPTION: Depending on type, either queues function for deferred execution or
783 * immediately executes function on a separate thread.
784 *
785 ******************************************************************************/
786
787acpi_status acpi_os_execute(acpi_execute_type type,
Len Brown4be44fc2005-08-05 00:44:28 -0400788 acpi_osd_exec_callback function, void *context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789{
Len Brown4be44fc2005-08-05 00:44:28 -0400790 acpi_status status = AE_OK;
791 struct acpi_os_dpc *dpc;
Len Brown72945b22006-07-12 22:46:42 -0400792
Len Brown72945b22006-07-12 22:46:42 -0400793 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
794 "Scheduling function [%p(%p)] for deferred execution.\n",
795 function, context));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796
797 if (!function)
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -0400798 return AE_BAD_PARAMETER;
Len Brown72945b22006-07-12 22:46:42 -0400799
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800 /*
801 * Allocate/initialize DPC structure. Note that this memory will be
David Howells65f27f32006-11-22 14:55:48 +0000802 * freed by the callee. The kernel handles the work_struct list in a
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803 * way that allows us to also free its memory inside the callee.
804 * Because we may want to schedule several tasks with different
805 * parameters we can't use the approach some kernel code uses of
David Howells65f27f32006-11-22 14:55:48 +0000806 * having a static work_struct.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 */
Len Brown72945b22006-07-12 22:46:42 -0400808
David Howells65f27f32006-11-22 14:55:48 +0000809 dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 if (!dpc)
Linus Torvaldsb976fe12006-11-17 19:31:09 -0800811 return_ACPI_STATUS(AE_NO_MEMORY);
812
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813 dpc->function = function;
814 dpc->context = context;
Linus Torvaldsb976fe12006-11-17 19:31:09 -0800815
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -0400816 if (type == OSL_NOTIFY_HANDLER) {
817 INIT_WORK(&dpc->work, acpi_os_execute_notify);
818 if (!queue_work(kacpi_notify_wq, &dpc->work)) {
819 status = AE_ERROR;
820 kfree(dpc);
821 }
822 } else {
823 INIT_WORK(&dpc->work, acpi_os_execute_deferred);
824 if (!queue_work(kacpid_wq, &dpc->work)) {
825 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
Linus Torvaldsb976fe12006-11-17 19:31:09 -0800826 "Call to queue_work() failed.\n"));
Alexey Starikovskiy88db5e12007-05-09 23:31:03 -0400827 status = AE_ERROR;
828 kfree(dpc);
829 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830 }
Linus Torvaldsb976fe12006-11-17 19:31:09 -0800831 return_ACPI_STATUS(status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832}
Len Brown4be44fc2005-08-05 00:44:28 -0400833
Alexey Starikovskiyb8d35192006-05-05 03:23:00 -0400834EXPORT_SYMBOL(acpi_os_execute);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835
Len Brown4be44fc2005-08-05 00:44:28 -0400836void acpi_os_wait_events_complete(void *context)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837{
838 flush_workqueue(kacpid_wq);
839}
Len Brown4be44fc2005-08-05 00:44:28 -0400840
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841EXPORT_SYMBOL(acpi_os_wait_events_complete);
842
843/*
844 * Allocate the memory for a spinlock and initialize it.
845 */
Bob Moore967440e2006-06-23 17:04:00 -0400846acpi_status acpi_os_create_lock(acpi_spinlock * handle)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847{
Bob Moore967440e2006-06-23 17:04:00 -0400848 spin_lock_init(*handle);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849
Patrick Mocheld550d982006-06-27 00:41:40 -0400850 return AE_OK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851}
852
Linus Torvalds1da177e2005-04-16 15:20:36 -0700853/*
854 * Deallocate the memory for a spinlock.
855 */
Bob Moore967440e2006-06-23 17:04:00 -0400856void acpi_os_delete_lock(acpi_spinlock handle)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857{
Patrick Mocheld550d982006-06-27 00:41:40 -0400858 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859}
860
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400862acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863{
Len Brown4be44fc2005-08-05 00:44:28 -0400864 struct semaphore *sem = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865
Linus Torvalds1da177e2005-04-16 15:20:36 -0700866
867 sem = acpi_os_allocate(sizeof(struct semaphore));
868 if (!sem)
Patrick Mocheld550d982006-06-27 00:41:40 -0400869 return AE_NO_MEMORY;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870 memset(sem, 0, sizeof(struct semaphore));
871
872 sema_init(sem, initial_units);
873
Len Brown4be44fc2005-08-05 00:44:28 -0400874 *handle = (acpi_handle *) sem;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700875
Len Brown4be44fc2005-08-05 00:44:28 -0400876 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
877 *handle, initial_units));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878
Patrick Mocheld550d982006-06-27 00:41:40 -0400879 return AE_OK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881
Len Brown4be44fc2005-08-05 00:44:28 -0400882EXPORT_SYMBOL(acpi_os_create_semaphore);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883
884/*
885 * TODO: A better way to delete semaphores? Linux doesn't have a
886 * 'delete_semaphore()' function -- may result in an invalid
887 * pointer dereference for non-synchronized consumers. Should
888 * we at least check for blocked threads and signal/cancel them?
889 */
890
Len Brown4be44fc2005-08-05 00:44:28 -0400891acpi_status acpi_os_delete_semaphore(acpi_handle handle)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892{
Len Brown4be44fc2005-08-05 00:44:28 -0400893 struct semaphore *sem = (struct semaphore *)handle;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894
Linus Torvalds1da177e2005-04-16 15:20:36 -0700895
896 if (!sem)
Patrick Mocheld550d982006-06-27 00:41:40 -0400897 return AE_BAD_PARAMETER;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700898
Len Brown4be44fc2005-08-05 00:44:28 -0400899 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700900
Len Brown02438d82006-06-30 03:19:10 -0400901 kfree(sem);
Len Brown4be44fc2005-08-05 00:44:28 -0400902 sem = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700903
Patrick Mocheld550d982006-06-27 00:41:40 -0400904 return AE_OK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700905}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700906
Len Brown4be44fc2005-08-05 00:44:28 -0400907EXPORT_SYMBOL(acpi_os_delete_semaphore);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700908
909/*
910 * TODO: The kernel doesn't have a 'down_timeout' function -- had to
911 * improvise. The process is to sleep for one scheduler quantum
912 * until the semaphore becomes available. Downside is that this
913 * may result in starvation for timeout-based waits when there's
914 * lots of semaphore activity.
915 *
916 * TODO: Support for units > 1?
917 */
Len Brown4be44fc2005-08-05 00:44:28 -0400918acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700919{
Len Brown4be44fc2005-08-05 00:44:28 -0400920 acpi_status status = AE_OK;
921 struct semaphore *sem = (struct semaphore *)handle;
922 int ret = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700923
Linus Torvalds1da177e2005-04-16 15:20:36 -0700924
925 if (!sem || (units < 1))
Patrick Mocheld550d982006-06-27 00:41:40 -0400926 return AE_BAD_PARAMETER;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927
928 if (units > 1)
Patrick Mocheld550d982006-06-27 00:41:40 -0400929 return AE_SUPPORT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700930
Len Brown4be44fc2005-08-05 00:44:28 -0400931 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
932 handle, units, timeout));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700933
Len Brownd68909f2006-08-16 19:16:58 -0400934 /*
935 * This can be called during resume with interrupts off.
936 * Like boot-time, we should be single threaded and will
937 * always get the lock if we try -- timeout or not.
938 * If this doesn't succeed, then we will oops courtesy of
939 * might_sleep() in down().
940 */
941 if (!down_trylock(sem))
942 return AE_OK;
943
Len Brown4be44fc2005-08-05 00:44:28 -0400944 switch (timeout) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700945 /*
946 * No Wait:
947 * --------
948 * A zero timeout value indicates that we shouldn't wait - just
949 * acquire the semaphore if available otherwise return AE_TIME
950 * (a.k.a. 'would block').
951 */
Len Brown4be44fc2005-08-05 00:44:28 -0400952 case 0:
953 if (down_trylock(sem))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700954 status = AE_TIME;
955 break;
956
957 /*
958 * Wait Indefinitely:
959 * ------------------
960 */
Len Brown4be44fc2005-08-05 00:44:28 -0400961 case ACPI_WAIT_FOREVER:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700962 down(sem);
963 break;
964
965 /*
966 * Wait w/ Timeout:
967 * ----------------
968 */
Len Brown4be44fc2005-08-05 00:44:28 -0400969 default:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700970 // TODO: A better timeout algorithm?
971 {
972 int i = 0;
Len Brown4be44fc2005-08-05 00:44:28 -0400973 static const int quantum_ms = 1000 / HZ;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700974
975 ret = down_trylock(sem);
Yu Lumingdacd9b82005-12-31 01:45:00 -0500976 for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) {
Nishanth Aravamudan01a527e2005-11-07 01:01:14 -0800977 schedule_timeout_interruptible(1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700978 ret = down_trylock(sem);
979 }
Len Brown4be44fc2005-08-05 00:44:28 -0400980
Linus Torvalds1da177e2005-04-16 15:20:36 -0700981 if (ret != 0)
982 status = AE_TIME;
983 }
984 break;
985 }
986
987 if (ACPI_FAILURE(status)) {
Bjorn Helgaas9e7e2c02006-04-27 05:25:00 -0400988 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
Thomas Renningera6fc6722006-06-26 23:58:43 -0400989 "Failed to acquire semaphore[%p|%d|%d], %s",
Len Brown4be44fc2005-08-05 00:44:28 -0400990 handle, units, timeout,
991 acpi_format_exception(status)));
992 } else {
993 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
Thomas Renningera6fc6722006-06-26 23:58:43 -0400994 "Acquired semaphore[%p|%d|%d]", handle,
Len Brown4be44fc2005-08-05 00:44:28 -0400995 units, timeout));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700996 }
997
Patrick Mocheld550d982006-06-27 00:41:40 -0400998 return status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700999}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001000
Len Brown4be44fc2005-08-05 00:44:28 -04001001EXPORT_SYMBOL(acpi_os_wait_semaphore);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001002
1003/*
1004 * TODO: Support for units > 1?
1005 */
Len Brown4be44fc2005-08-05 00:44:28 -04001006acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007{
Len Brown4be44fc2005-08-05 00:44:28 -04001008 struct semaphore *sem = (struct semaphore *)handle;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001009
Linus Torvalds1da177e2005-04-16 15:20:36 -07001010
1011 if (!sem || (units < 1))
Patrick Mocheld550d982006-06-27 00:41:40 -04001012 return AE_BAD_PARAMETER;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001013
1014 if (units > 1)
Patrick Mocheld550d982006-06-27 00:41:40 -04001015 return AE_SUPPORT;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001016
Len Brown4be44fc2005-08-05 00:44:28 -04001017 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
1018 units));
Linus Torvalds1da177e2005-04-16 15:20:36 -07001019
1020 up(sem);
1021
Patrick Mocheld550d982006-06-27 00:41:40 -04001022 return AE_OK;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001023}
Len Brown4be44fc2005-08-05 00:44:28 -04001024
Linus Torvalds1da177e2005-04-16 15:20:36 -07001025EXPORT_SYMBOL(acpi_os_signal_semaphore);
1026
1027#ifdef ACPI_FUTURE_USAGE
Len Brown4be44fc2005-08-05 00:44:28 -04001028u32 acpi_os_get_line(char *buffer)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001029{
1030
1031#ifdef ENABLE_DEBUGGER
1032 if (acpi_in_debugger) {
1033 u32 chars;
1034
1035 kdb_read(buffer, sizeof(line_buf));
1036
1037 /* remove the CR kdb includes */
1038 chars = strlen(buffer) - 1;
1039 buffer[chars] = '\0';
1040 }
1041#endif
1042
1043 return 0;
1044}
Len Brown4be44fc2005-08-05 00:44:28 -04001045#endif /* ACPI_FUTURE_USAGE */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001046
Len Brown4be44fc2005-08-05 00:44:28 -04001047acpi_status acpi_os_signal(u32 function, void *info)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001048{
Len Brown4be44fc2005-08-05 00:44:28 -04001049 switch (function) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001050 case ACPI_SIGNAL_FATAL:
1051 printk(KERN_ERR PREFIX "Fatal opcode executed\n");
1052 break;
1053 case ACPI_SIGNAL_BREAKPOINT:
1054 /*
1055 * AML Breakpoint
1056 * ACPI spec. says to treat it as a NOP unless
1057 * you are debugging. So if/when we integrate
1058 * AML debugger into the kernel debugger its
1059 * hook will go here. But until then it is
1060 * not useful to print anything on breakpoints.
1061 */
1062 break;
1063 default:
1064 break;
1065 }
1066
1067 return AE_OK;
1068}
Len Brown4be44fc2005-08-05 00:44:28 -04001069
Linus Torvalds1da177e2005-04-16 15:20:36 -07001070EXPORT_SYMBOL(acpi_os_signal);
1071
Len Brown4be44fc2005-08-05 00:44:28 -04001072static int __init acpi_os_name_setup(char *str)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001073{
1074 char *p = acpi_os_name;
Len Brown4be44fc2005-08-05 00:44:28 -04001075 int count = ACPI_MAX_OVERRIDE_LEN - 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001076
1077 if (!str || !*str)
1078 return 0;
1079
1080 for (; count-- && str && *str; str++) {
1081 if (isalnum(*str) || *str == ' ' || *str == ':')
1082 *p++ = *str;
1083 else if (*str == '\'' || *str == '"')
1084 continue;
1085 else
1086 break;
1087 }
1088 *p = 0;
1089
1090 return 1;
Len Brown4be44fc2005-08-05 00:44:28 -04001091
Linus Torvalds1da177e2005-04-16 15:20:36 -07001092}
1093
1094__setup("acpi_os_name=", acpi_os_name_setup);
1095
Len Brownd4b7dc42008-01-23 20:50:56 -05001096static void __init set_osi_linux(unsigned int enable)
1097{
1098 if (osi_linux.enable != enable) {
1099 osi_linux.enable = enable;
1100 printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n",
1101 enable ? "Add": "Delet");
1102 }
1103 return;
1104}
Len Brownf5076542007-05-30 00:10:38 -04001105
Len Brownd4b7dc42008-01-23 20:50:56 -05001106static void __init acpi_cmdline_osi_linux(unsigned int enable)
1107{
1108 osi_linux.cmdline = 1; /* cmdline set the default */
1109 set_osi_linux(enable);
Len Brownf5076542007-05-30 00:10:38 -04001110
Len Brownd4b7dc42008-01-23 20:50:56 -05001111 return;
1112}
1113
1114void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
1115{
1116 osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */
1117
1118 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
1119
1120 if (enable == -1)
1121 return;
1122
1123 osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */
1124
1125 set_osi_linux(enable);
1126
Len Brownf5076542007-05-30 00:10:38 -04001127 return;
1128}
1129
Linus Torvalds1da177e2005-04-16 15:20:36 -07001130/*
Len Brownae00d812007-05-29 18:43:33 -04001131 * Modify the list of "OS Interfaces" reported to BIOS via _OSI
1132 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07001133 * empty string disables _OSI
Len Brownae00d812007-05-29 18:43:33 -04001134 * string starting with '!' disables that string
1135 * otherwise string is added to list, augmenting built-in strings
Linus Torvalds1da177e2005-04-16 15:20:36 -07001136 */
Len Brown4be44fc2005-08-05 00:44:28 -04001137static int __init acpi_osi_setup(char *str)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138{
1139 if (str == NULL || *str == '\0') {
1140 printk(KERN_INFO PREFIX "_OSI method disabled\n");
1141 acpi_gbl_create_osi_method = FALSE;
Len Brownaa2e09d2007-07-02 23:57:45 -04001142 } else if (!strcmp("!Linux", str)) {
Len Brownd4b7dc42008-01-23 20:50:56 -05001143 acpi_cmdline_osi_linux(0); /* !enable */
Len Brownae00d812007-05-29 18:43:33 -04001144 } else if (*str == '!') {
1145 if (acpi_osi_invalidate(++str) == AE_OK)
1146 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
Len Brownf5076542007-05-30 00:10:38 -04001147 } else if (!strcmp("Linux", str)) {
Len Brownd4b7dc42008-01-23 20:50:56 -05001148 acpi_cmdline_osi_linux(1); /* enable */
Len Brownae00d812007-05-29 18:43:33 -04001149 } else if (*osi_additional_string == '\0') {
1150 strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
1151 printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001152 }
1153
1154 return 1;
1155}
1156
1157__setup("acpi_osi=", acpi_osi_setup);
1158
1159/* enable serialization to combat AE_ALREADY_EXISTS errors */
Len Brown4be44fc2005-08-05 00:44:28 -04001160static int __init acpi_serialize_setup(char *str)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001161{
1162 printk(KERN_INFO PREFIX "serialize enabled\n");
1163
1164 acpi_gbl_all_methods_serialized = TRUE;
1165
1166 return 1;
1167}
1168
1169__setup("acpi_serialize", acpi_serialize_setup);
1170
1171/*
1172 * Wake and Run-Time GPES are expected to be separate.
1173 * We disable wake-GPEs at run-time to prevent spurious
1174 * interrupts.
1175 *
1176 * However, if a system exists that shares Wake and
1177 * Run-time events on the same GPE this flag is available
1178 * to tell Linux to keep the wake-time GPEs enabled at run-time.
1179 */
Len Brown4be44fc2005-08-05 00:44:28 -04001180static int __init acpi_wake_gpes_always_on_setup(char *str)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001181{
1182 printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
1183
1184 acpi_gbl_leave_wake_gpes_disabled = FALSE;
1185
1186 return 1;
1187}
1188
1189__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
1190
Linus Torvalds1da177e2005-04-16 15:20:36 -07001191/*
Robert Moore73459f72005-06-24 00:00:00 -04001192 * Acquire a spinlock.
1193 *
1194 * handle is a pointer to the spinlock_t.
Robert Moore73459f72005-06-24 00:00:00 -04001195 */
1196
Bob Moore967440e2006-06-23 17:04:00 -04001197acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
Robert Moore73459f72005-06-24 00:00:00 -04001198{
Bob Mooreb8e4d892006-01-27 16:43:00 -05001199 acpi_cpu_flags flags;
Bob Moore967440e2006-06-23 17:04:00 -04001200 spin_lock_irqsave(lockp, flags);
Robert Moore73459f72005-06-24 00:00:00 -04001201 return flags;
1202}
1203
1204/*
1205 * Release a spinlock. See above.
1206 */
1207
Bob Moore967440e2006-06-23 17:04:00 -04001208void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
Robert Moore73459f72005-06-24 00:00:00 -04001209{
Bob Moore967440e2006-06-23 17:04:00 -04001210 spin_unlock_irqrestore(lockp, flags);
Robert Moore73459f72005-06-24 00:00:00 -04001211}
1212
Robert Moore73459f72005-06-24 00:00:00 -04001213#ifndef ACPI_USE_LOCAL_CACHE
1214
1215/*******************************************************************************
1216 *
1217 * FUNCTION: acpi_os_create_cache
1218 *
Bob Mooreb229cf92006-04-21 17:15:00 -04001219 * PARAMETERS: name - Ascii name for the cache
1220 * size - Size of each cached object
1221 * depth - Maximum depth of the cache (in objects) <ignored>
1222 * cache - Where the new cache object is returned
Robert Moore73459f72005-06-24 00:00:00 -04001223 *
Bob Mooreb229cf92006-04-21 17:15:00 -04001224 * RETURN: status
Robert Moore73459f72005-06-24 00:00:00 -04001225 *
1226 * DESCRIPTION: Create a cache object
1227 *
1228 ******************************************************************************/
1229
1230acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -04001231acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
Robert Moore73459f72005-06-24 00:00:00 -04001232{
Paul Mundt20c2df82007-07-20 10:11:58 +09001233 *cache = kmem_cache_create(name, size, 0, 0, NULL);
Adrian Bunka6fdbf92006-12-19 12:56:13 -08001234 if (*cache == NULL)
Bob Mooreb229cf92006-04-21 17:15:00 -04001235 return AE_ERROR;
1236 else
1237 return AE_OK;
Robert Moore73459f72005-06-24 00:00:00 -04001238}
1239
1240/*******************************************************************************
1241 *
1242 * FUNCTION: acpi_os_purge_cache
1243 *
1244 * PARAMETERS: Cache - Handle to cache object
1245 *
1246 * RETURN: Status
1247 *
1248 * DESCRIPTION: Free all objects within the requested cache.
1249 *
1250 ******************************************************************************/
1251
Len Brown4be44fc2005-08-05 00:44:28 -04001252acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
Robert Moore73459f72005-06-24 00:00:00 -04001253{
Jan Engelhardt50dd0962006-10-01 00:28:50 +02001254 kmem_cache_shrink(cache);
Len Brown4be44fc2005-08-05 00:44:28 -04001255 return (AE_OK);
Robert Moore73459f72005-06-24 00:00:00 -04001256}
1257
1258/*******************************************************************************
1259 *
1260 * FUNCTION: acpi_os_delete_cache
1261 *
1262 * PARAMETERS: Cache - Handle to cache object
1263 *
1264 * RETURN: Status
1265 *
1266 * DESCRIPTION: Free all objects within the requested cache and delete the
1267 * cache object.
1268 *
1269 ******************************************************************************/
1270
Len Brown4be44fc2005-08-05 00:44:28 -04001271acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
Robert Moore73459f72005-06-24 00:00:00 -04001272{
Alexey Dobriyan1a1d92c2006-09-27 01:49:40 -07001273 kmem_cache_destroy(cache);
Len Brown4be44fc2005-08-05 00:44:28 -04001274 return (AE_OK);
Robert Moore73459f72005-06-24 00:00:00 -04001275}
1276
1277/*******************************************************************************
1278 *
1279 * FUNCTION: acpi_os_release_object
1280 *
1281 * PARAMETERS: Cache - Handle to cache object
1282 * Object - The object to be released
1283 *
1284 * RETURN: None
1285 *
1286 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1287 * the object is deleted.
1288 *
1289 ******************************************************************************/
1290
Len Brown4be44fc2005-08-05 00:44:28 -04001291acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
Robert Moore73459f72005-06-24 00:00:00 -04001292{
Len Brown4be44fc2005-08-05 00:44:28 -04001293 kmem_cache_free(cache, object);
1294 return (AE_OK);
Robert Moore73459f72005-06-24 00:00:00 -04001295}
1296
Len Brown5a4e1432008-01-23 20:01:22 -05001297/**
1298 * acpi_dmi_dump - dump DMI slots needed for blacklist entry
1299 *
1300 * Returns 0 on success
1301 */
1302int acpi_dmi_dump(void)
1303{
1304
1305 if (!dmi_available)
1306 return -1;
1307
1308 printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n",
1309 dmi_get_slot(DMI_SYS_VENDOR));
1310 printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n",
1311 dmi_get_slot(DMI_PRODUCT_NAME));
1312 printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n",
1313 dmi_get_slot(DMI_PRODUCT_VERSION));
1314 printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n",
1315 dmi_get_slot(DMI_BOARD_NAME));
1316 printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n",
1317 dmi_get_slot(DMI_BIOS_VENDOR));
1318 printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n",
1319 dmi_get_slot(DMI_BIOS_DATE));
1320
1321 return 0;
1322}
1323
1324
Bob Mooreb229cf92006-04-21 17:15:00 -04001325/******************************************************************************
1326 *
1327 * FUNCTION: acpi_os_validate_interface
1328 *
1329 * PARAMETERS: interface - Requested interface to be validated
1330 *
1331 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1332 *
1333 * DESCRIPTION: Match an interface string to the interfaces supported by the
1334 * host. Strings originate from an AML call to the _OSI method.
1335 *
1336 *****************************************************************************/
1337
1338acpi_status
1339acpi_os_validate_interface (char *interface)
1340{
Len Brownae00d812007-05-29 18:43:33 -04001341 if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX))
1342 return AE_OK;
Len Brownf5076542007-05-30 00:10:38 -04001343 if (!strcmp("Linux", interface)) {
Len Brownd4b7dc42008-01-23 20:50:56 -05001344
1345 printk(KERN_NOTICE PREFIX
1346 "BIOS _OSI(Linux) query %s%s\n",
1347 osi_linux.enable ? "honored" : "ignored",
1348 osi_linux.cmdline ? " via cmdline" :
1349 osi_linux.dmi ? " via DMI" : "");
1350
1351 if (!osi_linux.dmi) {
1352 if (acpi_dmi_dump())
1353 printk(KERN_NOTICE PREFIX
1354 "[please extract dmidecode output]\n");
Len Brownf40cd6f2008-01-23 20:04:28 -05001355 printk(KERN_NOTICE PREFIX
Len Brownd4b7dc42008-01-23 20:50:56 -05001356 "Please send DMI info above to "
1357 "linux-acpi@vger.kernel.org\n");
1358 }
1359 if (!osi_linux.known && !osi_linux.cmdline) {
1360 printk(KERN_NOTICE PREFIX
1361 "If \"acpi_osi=%sLinux\" works better, "
1362 "please notify linux-acpi@vger.kernel.org\n",
1363 osi_linux.enable ? "!" : "");
1364 }
1365
1366 if (osi_linux.enable)
Len Brownf5076542007-05-30 00:10:38 -04001367 return AE_OK;
1368 }
Len Brownae00d812007-05-29 18:43:33 -04001369 return AE_SUPPORT;
Bob Mooreb229cf92006-04-21 17:15:00 -04001370}
1371
Bob Mooreb229cf92006-04-21 17:15:00 -04001372/******************************************************************************
1373 *
1374 * FUNCTION: acpi_os_validate_address
1375 *
1376 * PARAMETERS: space_id - ACPI space ID
1377 * address - Physical address
1378 * length - Address length
1379 *
1380 * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
1381 * should return AE_AML_ILLEGAL_ADDRESS.
1382 *
1383 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1384 * the addresses accessed by AML operation regions.
1385 *
1386 *****************************************************************************/
1387
1388acpi_status
1389acpi_os_validate_address (
1390 u8 space_id,
1391 acpi_physical_address address,
1392 acpi_size length)
1393{
1394
1395 return AE_OK;
1396}
1397
Robert Moore73459f72005-06-24 00:00:00 -04001398#endif