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