2 * acpi_osl.c - OS-dependent functions ($Revision: 83 $)
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>
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
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
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 #include <linux/module.h>
29 #include <linux/kernel.h>
30 #include <linux/slab.h>
32 #include <linux/pci.h>
33 #include <linux/interrupt.h>
34 #include <linux/kmod.h>
35 #include <linux/delay.h>
36 #include <linux/dmi.h>
37 #include <linux/workqueue.h>
38 #include <linux/nmi.h>
39 #include <linux/acpi.h>
40 #include <acpi/acpi.h>
42 #include <acpi/acpi_bus.h>
43 #include <acpi/processor.h>
44 #include <asm/uaccess.h>
46 #include <linux/efi.h>
48 #define _COMPONENT ACPI_OS_SERVICES
49 ACPI_MODULE_NAME("osl");
50 #define PREFIX "ACPI: "
52 acpi_osd_exec_callback function;
54 struct work_struct work;
57 #ifdef CONFIG_ACPI_CUSTOM_DSDT
58 #include CONFIG_ACPI_CUSTOM_DSDT_FILE
61 #ifdef ENABLE_DEBUGGER
62 #include <linux/kdb.h>
64 /* stuff for debugger support */
66 EXPORT_SYMBOL(acpi_in_debugger);
68 extern char line_buf[80];
69 #endif /*ENABLE_DEBUGGER */
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;
75 static struct workqueue_struct *kacpi_notify_wq;
77 #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
78 static char osi_additional_string[OSI_STRING_LENGTH_MAX];
80 static int osi_linux; /* disable _OSI(Linux) by default */
83 static struct __initdata dmi_system_id acpi_osl_dmi_table[];
86 static void __init acpi_request_region (struct acpi_generic_address *addr,
87 unsigned int length, char *desc)
91 if (!addr->address || !length)
94 if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_IO)
95 res = request_region(addr->address, length, desc);
96 else if (addr->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
97 res = request_mem_region(addr->address, length, desc);
100 static int __init acpi_reserve_resources(void)
102 acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,
103 "ACPI PM1a_EVT_BLK");
105 acpi_request_region(&acpi_gbl_FADT.xpm1b_event_block, acpi_gbl_FADT.pm1_event_length,
106 "ACPI PM1b_EVT_BLK");
108 acpi_request_region(&acpi_gbl_FADT.xpm1a_control_block, acpi_gbl_FADT.pm1_control_length,
109 "ACPI PM1a_CNT_BLK");
111 acpi_request_region(&acpi_gbl_FADT.xpm1b_control_block, acpi_gbl_FADT.pm1_control_length,
112 "ACPI PM1b_CNT_BLK");
114 if (acpi_gbl_FADT.pm_timer_length == 4)
115 acpi_request_region(&acpi_gbl_FADT.xpm_timer_block, 4, "ACPI PM_TMR");
117 acpi_request_region(&acpi_gbl_FADT.xpm2_control_block, acpi_gbl_FADT.pm2_control_length,
120 /* Length of GPE blocks must be a non-negative multiple of 2 */
122 if (!(acpi_gbl_FADT.gpe0_block_length & 0x1))
123 acpi_request_region(&acpi_gbl_FADT.xgpe0_block,
124 acpi_gbl_FADT.gpe0_block_length, "ACPI GPE0_BLK");
126 if (!(acpi_gbl_FADT.gpe1_block_length & 0x1))
127 acpi_request_region(&acpi_gbl_FADT.xgpe1_block,
128 acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK");
132 device_initcall(acpi_reserve_resources);
134 acpi_status __init acpi_os_initialize(void)
136 dmi_check_system(acpi_osl_dmi_table);
140 acpi_status acpi_os_initialize1(void)
143 * Initialize PCI configuration space access, as we'll need to access
144 * it while walking the namespace (bus 0 and root bridges w/ _BBNs).
147 printk(KERN_ERR PREFIX
148 "Access to PCI configuration space unavailable\n");
149 return AE_NULL_ENTRY;
151 kacpid_wq = create_singlethread_workqueue("kacpid");
152 kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify");
154 BUG_ON(!kacpi_notify_wq);
158 acpi_status acpi_os_terminate(void)
160 if (acpi_irq_handler) {
161 acpi_os_remove_interrupt_handler(acpi_irq_irq,
165 destroy_workqueue(kacpid_wq);
166 destroy_workqueue(kacpi_notify_wq);
171 void acpi_os_printf(const char *fmt, ...)
175 acpi_os_vprintf(fmt, args);
179 EXPORT_SYMBOL(acpi_os_printf);
181 void acpi_os_vprintf(const char *fmt, va_list args)
183 static char buffer[512];
185 vsprintf(buffer, fmt, args);
187 #ifdef ENABLE_DEBUGGER
188 if (acpi_in_debugger) {
189 kdb_printf("%s", buffer);
191 printk("%s", buffer);
194 printk("%s", buffer);
198 acpi_physical_address __init acpi_os_get_root_pointer(void)
201 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
203 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
206 printk(KERN_ERR PREFIX
207 "System description tables not found\n");
211 return acpi_find_rsdp();
214 void __iomem *__init_refok
215 acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
217 if (phys > ULONG_MAX) {
218 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
221 if (acpi_gbl_permanent_mmap)
223 * ioremap checks to ensure this is in reserved space
225 return ioremap((unsigned long)phys, size);
227 return __acpi_map_table((unsigned long)phys, size);
229 EXPORT_SYMBOL_GPL(acpi_os_map_memory);
231 void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
233 if (acpi_gbl_permanent_mmap) {
237 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
239 #ifdef ACPI_FUTURE_USAGE
241 acpi_os_get_physical_address(void *virt, acpi_physical_address * phys)
244 return AE_BAD_PARAMETER;
246 *phys = virt_to_phys(virt);
252 #define ACPI_MAX_OVERRIDE_LEN 100
254 static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
257 acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
258 acpi_string * new_val)
260 if (!init_val || !new_val)
261 return AE_BAD_PARAMETER;
264 if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
265 printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
267 *new_val = acpi_os_name;
274 acpi_os_table_override(struct acpi_table_header * existing_table,
275 struct acpi_table_header ** new_table)
277 if (!existing_table || !new_table)
278 return AE_BAD_PARAMETER;
280 #ifdef CONFIG_ACPI_CUSTOM_DSDT
281 if (strncmp(existing_table->signature, "DSDT", 4) == 0)
282 *new_table = (struct acpi_table_header *)AmlCode;
291 static irqreturn_t acpi_irq(int irq, void *dev_id)
293 return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
297 acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
303 * Ignore the GSI from the core, and use the value in our copy of the
304 * FADT. It may not be the same if an interrupt source override exists
307 gsi = acpi_gbl_FADT.sci_interrupt;
308 if (acpi_gsi_to_irq(gsi, &irq) < 0) {
309 printk(KERN_ERR PREFIX "SCI (ACPI GSI %d) not registered\n",
314 acpi_irq_handler = handler;
315 acpi_irq_context = context;
316 if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
317 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
318 return AE_NOT_ACQUIRED;
325 acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
328 free_irq(irq, acpi_irq);
329 acpi_irq_handler = NULL;
337 * Running in interpreter thread context, safe to sleep
340 void acpi_os_sleep(acpi_integer ms)
342 schedule_timeout_interruptible(msecs_to_jiffies(ms));
345 EXPORT_SYMBOL(acpi_os_sleep);
347 void acpi_os_stall(u32 us)
355 touch_nmi_watchdog();
360 EXPORT_SYMBOL(acpi_os_stall);
363 * Support ACPI 3.0 AML Timer operand
364 * Returns 64-bit free-running, monotonically increasing timer
365 * with 100ns granularity
367 u64 acpi_os_get_timer(void)
372 /* TBD: use HPET if available */
375 #ifdef CONFIG_X86_PM_TIMER
376 /* TBD: default to PM timer if HPET was not available */
379 printk(KERN_ERR PREFIX "acpi_os_get_timer() TBD\n");
384 acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
393 *(u8 *) value = inb(port);
394 } else if (width <= 16) {
395 *(u16 *) value = inw(port);
396 } else if (width <= 32) {
397 *(u32 *) value = inl(port);
405 EXPORT_SYMBOL(acpi_os_read_port);
407 acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
411 } else if (width <= 16) {
413 } else if (width <= 32) {
422 EXPORT_SYMBOL(acpi_os_write_port);
425 acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
428 void __iomem *virt_addr;
430 virt_addr = ioremap(phys_addr, width);
436 *(u8 *) value = readb(virt_addr);
439 *(u16 *) value = readw(virt_addr);
442 *(u32 *) value = readl(virt_addr);
454 acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
456 void __iomem *virt_addr;
458 virt_addr = ioremap(phys_addr, width);
462 writeb(value, virt_addr);
465 writew(value, virt_addr);
468 writel(value, virt_addr);
480 acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
481 void *value, u32 width)
486 return AE_BAD_PARAMETER;
502 BUG_ON(!raw_pci_ops);
504 result = raw_pci_ops->read(pci_id->segment, pci_id->bus,
505 PCI_DEVFN(pci_id->device, pci_id->function),
508 return (result ? AE_ERROR : AE_OK);
511 EXPORT_SYMBOL(acpi_os_read_pci_configuration);
514 acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
515 acpi_integer value, u32 width)
533 BUG_ON(!raw_pci_ops);
535 result = raw_pci_ops->write(pci_id->segment, pci_id->bus,
536 PCI_DEVFN(pci_id->device, pci_id->function),
539 return (result ? AE_ERROR : AE_OK);
542 /* TODO: Change code to take advantage of driver model more */
543 static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
544 acpi_handle chandle, /* current node */
545 struct acpi_pci_id **id,
546 int *is_bridge, u8 * bus_number)
549 struct acpi_pci_id *pci_id = *id;
552 acpi_object_type type;
555 acpi_get_parent(chandle, &handle);
556 if (handle != rhandle) {
557 acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge,
560 status = acpi_get_type(handle, &type);
561 if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
565 acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
567 if (ACPI_SUCCESS(status)) {
568 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
569 pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
572 pci_id->bus = *bus_number;
574 /* any nicer way to get bus number of bridge ? */
576 acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8,
578 if (ACPI_SUCCESS(status)
579 && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
581 acpi_os_read_pci_configuration(pci_id, 0x18,
583 if (!ACPI_SUCCESS(status)) {
584 /* Certainly broken... FIX ME */
590 acpi_os_read_pci_configuration(pci_id, 0x19,
592 if (ACPI_SUCCESS(status)) {
601 void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
602 acpi_handle chandle, /* current node */
603 struct acpi_pci_id **id)
606 u8 bus_number = (*id)->bus;
608 acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number);
611 static void acpi_os_execute_deferred(struct work_struct *work)
613 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
615 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
619 dpc->function(dpc->context);
622 /* Yield cpu to notify thread */
628 static void acpi_os_execute_notify(struct work_struct *work)
630 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
633 printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
637 dpc->function(dpc->context);
644 /*******************************************************************************
646 * FUNCTION: acpi_os_execute
648 * PARAMETERS: Type - Type of the callback
649 * Function - Function to be executed
650 * Context - Function parameters
654 * DESCRIPTION: Depending on type, either queues function for deferred execution or
655 * immediately executes function on a separate thread.
657 ******************************************************************************/
659 acpi_status acpi_os_execute(acpi_execute_type type,
660 acpi_osd_exec_callback function, void *context)
662 acpi_status status = AE_OK;
663 struct acpi_os_dpc *dpc;
665 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
666 "Scheduling function [%p(%p)] for deferred execution.\n",
670 return AE_BAD_PARAMETER;
673 * Allocate/initialize DPC structure. Note that this memory will be
674 * freed by the callee. The kernel handles the work_struct list in a
675 * way that allows us to also free its memory inside the callee.
676 * Because we may want to schedule several tasks with different
677 * parameters we can't use the approach some kernel code uses of
678 * having a static work_struct.
681 dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC);
683 return_ACPI_STATUS(AE_NO_MEMORY);
685 dpc->function = function;
686 dpc->context = context;
688 if (type == OSL_NOTIFY_HANDLER) {
689 INIT_WORK(&dpc->work, acpi_os_execute_notify);
690 if (!queue_work(kacpi_notify_wq, &dpc->work)) {
695 INIT_WORK(&dpc->work, acpi_os_execute_deferred);
696 if (!queue_work(kacpid_wq, &dpc->work)) {
697 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
698 "Call to queue_work() failed.\n"));
703 return_ACPI_STATUS(status);
706 EXPORT_SYMBOL(acpi_os_execute);
708 void acpi_os_wait_events_complete(void *context)
710 flush_workqueue(kacpid_wq);
713 EXPORT_SYMBOL(acpi_os_wait_events_complete);
716 * Allocate the memory for a spinlock and initialize it.
718 acpi_status acpi_os_create_lock(acpi_spinlock * handle)
720 spin_lock_init(*handle);
726 * Deallocate the memory for a spinlock.
728 void acpi_os_delete_lock(acpi_spinlock handle)
734 acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
736 struct semaphore *sem = NULL;
739 sem = acpi_os_allocate(sizeof(struct semaphore));
742 memset(sem, 0, sizeof(struct semaphore));
744 sema_init(sem, initial_units);
746 *handle = (acpi_handle *) sem;
748 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
749 *handle, initial_units));
754 EXPORT_SYMBOL(acpi_os_create_semaphore);
757 * TODO: A better way to delete semaphores? Linux doesn't have a
758 * 'delete_semaphore()' function -- may result in an invalid
759 * pointer dereference for non-synchronized consumers. Should
760 * we at least check for blocked threads and signal/cancel them?
763 acpi_status acpi_os_delete_semaphore(acpi_handle handle)
765 struct semaphore *sem = (struct semaphore *)handle;
769 return AE_BAD_PARAMETER;
771 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
779 EXPORT_SYMBOL(acpi_os_delete_semaphore);
782 * TODO: The kernel doesn't have a 'down_timeout' function -- had to
783 * improvise. The process is to sleep for one scheduler quantum
784 * until the semaphore becomes available. Downside is that this
785 * may result in starvation for timeout-based waits when there's
786 * lots of semaphore activity.
788 * TODO: Support for units > 1?
790 acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
792 acpi_status status = AE_OK;
793 struct semaphore *sem = (struct semaphore *)handle;
797 if (!sem || (units < 1))
798 return AE_BAD_PARAMETER;
803 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
804 handle, units, timeout));
807 * This can be called during resume with interrupts off.
808 * Like boot-time, we should be single threaded and will
809 * always get the lock if we try -- timeout or not.
810 * If this doesn't succeed, then we will oops courtesy of
811 * might_sleep() in down().
813 if (!down_trylock(sem))
820 * A zero timeout value indicates that we shouldn't wait - just
821 * acquire the semaphore if available otherwise return AE_TIME
822 * (a.k.a. 'would block').
825 if (down_trylock(sem))
833 case ACPI_WAIT_FOREVER:
842 // TODO: A better timeout algorithm?
845 static const int quantum_ms = 1000 / HZ;
847 ret = down_trylock(sem);
848 for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) {
849 schedule_timeout_interruptible(1);
850 ret = down_trylock(sem);
859 if (ACPI_FAILURE(status)) {
860 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
861 "Failed to acquire semaphore[%p|%d|%d], %s",
862 handle, units, timeout,
863 acpi_format_exception(status)));
865 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
866 "Acquired semaphore[%p|%d|%d]", handle,
873 EXPORT_SYMBOL(acpi_os_wait_semaphore);
876 * TODO: Support for units > 1?
878 acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
880 struct semaphore *sem = (struct semaphore *)handle;
883 if (!sem || (units < 1))
884 return AE_BAD_PARAMETER;
889 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
897 EXPORT_SYMBOL(acpi_os_signal_semaphore);
899 #ifdef ACPI_FUTURE_USAGE
900 u32 acpi_os_get_line(char *buffer)
903 #ifdef ENABLE_DEBUGGER
904 if (acpi_in_debugger) {
907 kdb_read(buffer, sizeof(line_buf));
909 /* remove the CR kdb includes */
910 chars = strlen(buffer) - 1;
911 buffer[chars] = '\0';
917 #endif /* ACPI_FUTURE_USAGE */
919 acpi_status acpi_os_signal(u32 function, void *info)
922 case ACPI_SIGNAL_FATAL:
923 printk(KERN_ERR PREFIX "Fatal opcode executed\n");
925 case ACPI_SIGNAL_BREAKPOINT:
928 * ACPI spec. says to treat it as a NOP unless
929 * you are debugging. So if/when we integrate
930 * AML debugger into the kernel debugger its
931 * hook will go here. But until then it is
932 * not useful to print anything on breakpoints.
942 EXPORT_SYMBOL(acpi_os_signal);
944 static int __init acpi_os_name_setup(char *str)
946 char *p = acpi_os_name;
947 int count = ACPI_MAX_OVERRIDE_LEN - 1;
952 for (; count-- && str && *str; str++) {
953 if (isalnum(*str) || *str == ' ' || *str == ':')
955 else if (*str == '\'' || *str == '"')
966 __setup("acpi_os_name=", acpi_os_name_setup);
968 static void enable_osi_linux(int enable) {
970 if (osi_linux != enable)
971 printk(KERN_INFO PREFIX "%sabled _OSI(Linux)\n",
972 enable ? "En": "Dis");
979 * Modify the list of "OS Interfaces" reported to BIOS via _OSI
981 * empty string disables _OSI
982 * string starting with '!' disables that string
983 * otherwise string is added to list, augmenting built-in strings
985 static int __init acpi_osi_setup(char *str)
987 if (str == NULL || *str == '\0') {
988 printk(KERN_INFO PREFIX "_OSI method disabled\n");
989 acpi_gbl_create_osi_method = FALSE;
990 } else if (!strcmp("!Linux", str)) {
992 } else if (*str == '!') {
993 if (acpi_osi_invalidate(++str) == AE_OK)
994 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
995 } else if (!strcmp("Linux", str)) {
997 } else if (*osi_additional_string == '\0') {
998 strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
999 printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
1005 __setup("acpi_osi=", acpi_osi_setup);
1007 /* enable serialization to combat AE_ALREADY_EXISTS errors */
1008 static int __init acpi_serialize_setup(char *str)
1010 printk(KERN_INFO PREFIX "serialize enabled\n");
1012 acpi_gbl_all_methods_serialized = TRUE;
1017 __setup("acpi_serialize", acpi_serialize_setup);
1020 * Wake and Run-Time GPES are expected to be separate.
1021 * We disable wake-GPEs at run-time to prevent spurious
1024 * However, if a system exists that shares Wake and
1025 * Run-time events on the same GPE this flag is available
1026 * to tell Linux to keep the wake-time GPEs enabled at run-time.
1028 static int __init acpi_wake_gpes_always_on_setup(char *str)
1030 printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
1032 acpi_gbl_leave_wake_gpes_disabled = FALSE;
1037 __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
1040 * Acquire a spinlock.
1042 * handle is a pointer to the spinlock_t.
1045 acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
1047 acpi_cpu_flags flags;
1048 spin_lock_irqsave(lockp, flags);
1053 * Release a spinlock. See above.
1056 void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
1058 spin_unlock_irqrestore(lockp, flags);
1061 #ifndef ACPI_USE_LOCAL_CACHE
1063 /*******************************************************************************
1065 * FUNCTION: acpi_os_create_cache
1067 * PARAMETERS: name - Ascii name for the cache
1068 * size - Size of each cached object
1069 * depth - Maximum depth of the cache (in objects) <ignored>
1070 * cache - Where the new cache object is returned
1074 * DESCRIPTION: Create a cache object
1076 ******************************************************************************/
1079 acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
1081 *cache = kmem_cache_create(name, size, 0, 0, NULL);
1088 /*******************************************************************************
1090 * FUNCTION: acpi_os_purge_cache
1092 * PARAMETERS: Cache - Handle to cache object
1096 * DESCRIPTION: Free all objects within the requested cache.
1098 ******************************************************************************/
1100 acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
1102 kmem_cache_shrink(cache);
1106 /*******************************************************************************
1108 * FUNCTION: acpi_os_delete_cache
1110 * PARAMETERS: Cache - Handle to cache object
1114 * DESCRIPTION: Free all objects within the requested cache and delete the
1117 ******************************************************************************/
1119 acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
1121 kmem_cache_destroy(cache);
1125 /*******************************************************************************
1127 * FUNCTION: acpi_os_release_object
1129 * PARAMETERS: Cache - Handle to cache object
1130 * Object - The object to be released
1134 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1135 * the object is deleted.
1137 ******************************************************************************/
1139 acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1141 kmem_cache_free(cache, object);
1145 /******************************************************************************
1147 * FUNCTION: acpi_os_validate_interface
1149 * PARAMETERS: interface - Requested interface to be validated
1151 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1153 * DESCRIPTION: Match an interface string to the interfaces supported by the
1154 * host. Strings originate from an AML call to the _OSI method.
1156 *****************************************************************************/
1159 acpi_os_validate_interface (char *interface)
1161 if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX))
1163 if (!strcmp("Linux", interface)) {
1164 printk(KERN_WARNING PREFIX
1165 "System BIOS is requesting _OSI(Linux)\n");
1166 printk(KERN_WARNING PREFIX
1167 "If \"acpi_osi=Linux\" works better,\n"
1168 "Please send dmidecode "
1169 "to linux-acpi@vger.kernel.org\n");
1176 /******************************************************************************
1178 * FUNCTION: acpi_os_validate_address
1180 * PARAMETERS: space_id - ACPI space ID
1181 * address - Physical address
1182 * length - Address length
1184 * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
1185 * should return AE_AML_ILLEGAL_ADDRESS.
1187 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1188 * the addresses accessed by AML operation regions.
1190 *****************************************************************************/
1193 acpi_os_validate_address (
1195 acpi_physical_address address,
1203 static int dmi_osi_linux(const struct dmi_system_id *d)
1205 printk(KERN_NOTICE "%s detected: enabling _OSI(Linux)\n", d->ident);
1206 enable_osi_linux(1);
1210 static struct dmi_system_id acpi_osl_dmi_table[] __initdata = {
1212 * Boxes that need _OSI(Linux)
1215 .callback = dmi_osi_linux,
1216 .ident = "Intel Napa CRB",
1218 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
1219 DMI_MATCH(DMI_BOARD_NAME, "MPAD-MSAE Customer Reference Boards"),
1224 #endif /* CONFIG_DMI */