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/smp_lock.h>
34 #include <linux/interrupt.h>
35 #include <linux/kmod.h>
36 #include <linux/delay.h>
37 #include <linux/workqueue.h>
38 #include <linux/nmi.h>
39 #include <acpi/acpi.h>
41 #include <acpi/acpi_bus.h>
42 #include <acpi/processor.h>
43 #include <asm/uaccess.h>
45 #include <linux/efi.h>
47 #define _COMPONENT ACPI_OS_SERVICES
48 ACPI_MODULE_NAME("osl")
49 #define PREFIX "ACPI: "
51 acpi_osd_exec_callback function
;
53 struct work_struct work
;
56 #ifdef CONFIG_ACPI_CUSTOM_DSDT
57 #include CONFIG_ACPI_CUSTOM_DSDT_FILE
60 #ifdef ENABLE_DEBUGGER
61 #include <linux/kdb.h>
63 /* stuff for debugger support */
65 EXPORT_SYMBOL(acpi_in_debugger
);
67 extern char line_buf
[80];
68 #endif /*ENABLE_DEBUGGER */
70 int acpi_specific_hotkey_enabled
= TRUE
;
71 EXPORT_SYMBOL(acpi_specific_hotkey_enabled
);
73 static unsigned int acpi_irq_irq
;
74 static acpi_osd_handler acpi_irq_handler
;
75 static void *acpi_irq_context
;
76 static struct workqueue_struct
*kacpid_wq
;
78 acpi_status
acpi_os_initialize(void)
83 acpi_status
acpi_os_initialize1(void)
86 * Initialize PCI configuration space access, as we'll need to access
87 * it while walking the namespace (bus 0 and root bridges w/ _BBNs).
90 printk(KERN_ERR PREFIX
91 "Access to PCI configuration space unavailable\n");
94 kacpid_wq
= create_singlethread_workqueue("kacpid");
100 acpi_status
acpi_os_terminate(void)
102 if (acpi_irq_handler
) {
103 acpi_os_remove_interrupt_handler(acpi_irq_irq
,
107 destroy_workqueue(kacpid_wq
);
112 void acpi_os_printf(const char *fmt
, ...)
116 acpi_os_vprintf(fmt
, args
);
120 EXPORT_SYMBOL(acpi_os_printf
);
122 void acpi_os_vprintf(const char *fmt
, va_list args
)
124 static char buffer
[512];
126 vsprintf(buffer
, fmt
, args
);
128 #ifdef ENABLE_DEBUGGER
129 if (acpi_in_debugger
) {
130 kdb_printf("%s", buffer
);
132 printk("%s", buffer
);
135 printk("%s", buffer
);
139 acpi_status
acpi_os_get_root_pointer(u32 flags
, struct acpi_pointer
*addr
)
142 addr
->pointer_type
= ACPI_PHYSICAL_POINTER
;
143 if (efi
.acpi20
!= EFI_INVALID_TABLE_ADDR
)
144 addr
->pointer
.physical
= efi
.acpi20
;
145 else if (efi
.acpi
!= EFI_INVALID_TABLE_ADDR
)
146 addr
->pointer
.physical
= efi
.acpi
;
148 printk(KERN_ERR PREFIX
149 "System description tables not found\n");
153 if (ACPI_FAILURE(acpi_find_root_pointer(flags
, addr
))) {
154 printk(KERN_ERR PREFIX
155 "System description tables not found\n");
164 acpi_os_map_memory(acpi_physical_address phys
, acpi_size size
,
165 void __iomem
** virt
)
167 if (phys
> ULONG_MAX
) {
168 printk(KERN_ERR PREFIX
"Cannot map memory that high\n");
169 return AE_BAD_PARAMETER
;
172 * ioremap checks to ensure this is in reserved space
174 *virt
= ioremap((unsigned long)phys
, size
);
181 EXPORT_SYMBOL_GPL(acpi_os_map_memory
);
183 void acpi_os_unmap_memory(void __iomem
* virt
, acpi_size size
)
187 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory
);
189 #ifdef ACPI_FUTURE_USAGE
191 acpi_os_get_physical_address(void *virt
, acpi_physical_address
* phys
)
194 return AE_BAD_PARAMETER
;
196 *phys
= virt_to_phys(virt
);
202 #define ACPI_MAX_OVERRIDE_LEN 100
204 static char acpi_os_name
[ACPI_MAX_OVERRIDE_LEN
];
207 acpi_os_predefined_override(const struct acpi_predefined_names
*init_val
,
208 acpi_string
* new_val
)
210 if (!init_val
|| !new_val
)
211 return AE_BAD_PARAMETER
;
214 if (!memcmp(init_val
->name
, "_OS_", 4) && strlen(acpi_os_name
)) {
215 printk(KERN_INFO PREFIX
"Overriding _OS definition to '%s'\n",
217 *new_val
= acpi_os_name
;
224 acpi_os_table_override(struct acpi_table_header
* existing_table
,
225 struct acpi_table_header
** new_table
)
227 if (!existing_table
|| !new_table
)
228 return AE_BAD_PARAMETER
;
230 #ifdef CONFIG_ACPI_CUSTOM_DSDT
231 if (strncmp(existing_table
->signature
, "DSDT", 4) == 0)
232 *new_table
= (struct acpi_table_header
*)AmlCode
;
241 static irqreturn_t
acpi_irq(int irq
, void *dev_id
)
243 return (*acpi_irq_handler
) (acpi_irq_context
) ? IRQ_HANDLED
: IRQ_NONE
;
247 acpi_os_install_interrupt_handler(u32 gsi
, acpi_osd_handler handler
,
253 * Ignore the GSI from the core, and use the value in our copy of the
254 * FADT. It may not be the same if an interrupt source override exists
257 gsi
= acpi_fadt
.sci_int
;
258 if (acpi_gsi_to_irq(gsi
, &irq
) < 0) {
259 printk(KERN_ERR PREFIX
"SCI (ACPI GSI %d) not registered\n",
264 acpi_irq_handler
= handler
;
265 acpi_irq_context
= context
;
266 if (request_irq(irq
, acpi_irq
, IRQF_SHARED
, "acpi", acpi_irq
)) {
267 printk(KERN_ERR PREFIX
"SCI (IRQ%d) allocation failed\n", irq
);
268 return AE_NOT_ACQUIRED
;
275 acpi_status
acpi_os_remove_interrupt_handler(u32 irq
, acpi_osd_handler handler
)
278 free_irq(irq
, acpi_irq
);
279 acpi_irq_handler
= NULL
;
287 * Running in interpreter thread context, safe to sleep
290 void acpi_os_sleep(acpi_integer ms
)
292 schedule_timeout_interruptible(msecs_to_jiffies(ms
));
295 EXPORT_SYMBOL(acpi_os_sleep
);
297 void acpi_os_stall(u32 us
)
305 touch_nmi_watchdog();
310 EXPORT_SYMBOL(acpi_os_stall
);
313 * Support ACPI 3.0 AML Timer operand
314 * Returns 64-bit free-running, monotonically increasing timer
315 * with 100ns granularity
317 u64
acpi_os_get_timer(void)
322 /* TBD: use HPET if available */
325 #ifdef CONFIG_X86_PM_TIMER
326 /* TBD: default to PM timer if HPET was not available */
329 printk(KERN_ERR PREFIX
"acpi_os_get_timer() TBD\n");
334 acpi_status
acpi_os_read_port(acpi_io_address port
, u32
* value
, u32 width
)
343 *(u8
*) value
= inb(port
);
346 *(u16
*) value
= inw(port
);
349 *(u32
*) value
= inl(port
);
358 EXPORT_SYMBOL(acpi_os_read_port
);
360 acpi_status
acpi_os_write_port(acpi_io_address port
, u32 value
, u32 width
)
379 EXPORT_SYMBOL(acpi_os_write_port
);
382 acpi_os_read_memory(acpi_physical_address phys_addr
, u32
* value
, u32 width
)
385 void __iomem
*virt_addr
;
387 virt_addr
= ioremap(phys_addr
, width
);
393 *(u8
*) value
= readb(virt_addr
);
396 *(u16
*) value
= readw(virt_addr
);
399 *(u32
*) value
= readl(virt_addr
);
411 acpi_os_write_memory(acpi_physical_address phys_addr
, u32 value
, u32 width
)
413 void __iomem
*virt_addr
;
415 virt_addr
= ioremap(phys_addr
, width
);
419 writeb(value
, virt_addr
);
422 writew(value
, virt_addr
);
425 writel(value
, virt_addr
);
437 acpi_os_read_pci_configuration(struct acpi_pci_id
* pci_id
, u32 reg
,
438 void *value
, u32 width
)
443 return AE_BAD_PARAMETER
;
459 BUG_ON(!raw_pci_ops
);
461 result
= raw_pci_ops
->read(pci_id
->segment
, pci_id
->bus
,
462 PCI_DEVFN(pci_id
->device
, pci_id
->function
),
465 return (result
? AE_ERROR
: AE_OK
);
468 EXPORT_SYMBOL(acpi_os_read_pci_configuration
);
471 acpi_os_write_pci_configuration(struct acpi_pci_id
* pci_id
, u32 reg
,
472 acpi_integer value
, u32 width
)
490 BUG_ON(!raw_pci_ops
);
492 result
= raw_pci_ops
->write(pci_id
->segment
, pci_id
->bus
,
493 PCI_DEVFN(pci_id
->device
, pci_id
->function
),
496 return (result
? AE_ERROR
: AE_OK
);
499 /* TODO: Change code to take advantage of driver model more */
500 static void acpi_os_derive_pci_id_2(acpi_handle rhandle
, /* upper bound */
501 acpi_handle chandle
, /* current node */
502 struct acpi_pci_id
**id
,
503 int *is_bridge
, u8
* bus_number
)
506 struct acpi_pci_id
*pci_id
= *id
;
509 acpi_object_type type
;
512 acpi_get_parent(chandle
, &handle
);
513 if (handle
!= rhandle
) {
514 acpi_os_derive_pci_id_2(rhandle
, handle
, &pci_id
, is_bridge
,
517 status
= acpi_get_type(handle
, &type
);
518 if ((ACPI_FAILURE(status
)) || (type
!= ACPI_TYPE_DEVICE
))
522 acpi_evaluate_integer(handle
, METHOD_NAME__ADR
, NULL
,
524 if (ACPI_SUCCESS(status
)) {
525 pci_id
->device
= ACPI_HIWORD(ACPI_LODWORD(temp
));
526 pci_id
->function
= ACPI_LOWORD(ACPI_LODWORD(temp
));
529 pci_id
->bus
= *bus_number
;
531 /* any nicer way to get bus number of bridge ? */
533 acpi_os_read_pci_configuration(pci_id
, 0x0e, &tu8
,
535 if (ACPI_SUCCESS(status
)
536 && ((tu8
& 0x7f) == 1 || (tu8
& 0x7f) == 2)) {
538 acpi_os_read_pci_configuration(pci_id
, 0x18,
540 if (!ACPI_SUCCESS(status
)) {
541 /* Certainly broken... FIX ME */
547 acpi_os_read_pci_configuration(pci_id
, 0x19,
549 if (ACPI_SUCCESS(status
)) {
558 void acpi_os_derive_pci_id(acpi_handle rhandle
, /* upper bound */
559 acpi_handle chandle
, /* current node */
560 struct acpi_pci_id
**id
)
563 u8 bus_number
= (*id
)->bus
;
565 acpi_os_derive_pci_id_2(rhandle
, chandle
, id
, &is_bridge
, &bus_number
);
568 static void acpi_os_execute_deferred(struct work_struct
*work
)
570 struct acpi_os_dpc
*dpc
= container_of(work
, struct acpi_os_dpc
, work
);
572 printk(KERN_ERR PREFIX
"Invalid (NULL) context\n");
576 dpc
->function(dpc
->context
);
583 /*******************************************************************************
585 * FUNCTION: acpi_os_execute
587 * PARAMETERS: Type - Type of the callback
588 * Function - Function to be executed
589 * Context - Function parameters
593 * DESCRIPTION: Depending on type, either queues function for deferred execution or
594 * immediately executes function on a separate thread.
596 ******************************************************************************/
598 acpi_status
acpi_os_execute(acpi_execute_type type
,
599 acpi_osd_exec_callback function
, void *context
)
601 acpi_status status
= AE_OK
;
602 struct acpi_os_dpc
*dpc
;
604 ACPI_FUNCTION_TRACE("os_queue_for_execution");
606 ACPI_DEBUG_PRINT((ACPI_DB_EXEC
,
607 "Scheduling function [%p(%p)] for deferred execution.\n",
611 return_ACPI_STATUS(AE_BAD_PARAMETER
);
614 * Allocate/initialize DPC structure. Note that this memory will be
615 * freed by the callee. The kernel handles the work_struct list in a
616 * way that allows us to also free its memory inside the callee.
617 * Because we may want to schedule several tasks with different
618 * parameters we can't use the approach some kernel code uses of
619 * having a static work_struct.
622 dpc
= kmalloc(sizeof(struct acpi_os_dpc
), GFP_ATOMIC
);
624 return_ACPI_STATUS(AE_NO_MEMORY
);
626 dpc
->function
= function
;
627 dpc
->context
= context
;
629 INIT_WORK(&dpc
->work
, acpi_os_execute_deferred
);
630 if (!queue_work(kacpid_wq
, &dpc
->work
)) {
631 ACPI_DEBUG_PRINT((ACPI_DB_ERROR
,
632 "Call to queue_work() failed.\n"));
637 return_ACPI_STATUS(status
);
640 EXPORT_SYMBOL(acpi_os_execute
);
642 void acpi_os_wait_events_complete(void *context
)
644 flush_workqueue(kacpid_wq
);
647 EXPORT_SYMBOL(acpi_os_wait_events_complete
);
650 * Allocate the memory for a spinlock and initialize it.
652 acpi_status
acpi_os_create_lock(acpi_spinlock
* handle
)
654 spin_lock_init(*handle
);
660 * Deallocate the memory for a spinlock.
662 void acpi_os_delete_lock(acpi_spinlock handle
)
668 acpi_os_create_semaphore(u32 max_units
, u32 initial_units
, acpi_handle
* handle
)
670 struct semaphore
*sem
= NULL
;
673 sem
= acpi_os_allocate(sizeof(struct semaphore
));
676 memset(sem
, 0, sizeof(struct semaphore
));
678 sema_init(sem
, initial_units
);
680 *handle
= (acpi_handle
*) sem
;
682 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Creating semaphore[%p|%d].\n",
683 *handle
, initial_units
));
688 EXPORT_SYMBOL(acpi_os_create_semaphore
);
691 * TODO: A better way to delete semaphores? Linux doesn't have a
692 * 'delete_semaphore()' function -- may result in an invalid
693 * pointer dereference for non-synchronized consumers. Should
694 * we at least check for blocked threads and signal/cancel them?
697 acpi_status
acpi_os_delete_semaphore(acpi_handle handle
)
699 struct semaphore
*sem
= (struct semaphore
*)handle
;
703 return AE_BAD_PARAMETER
;
705 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Deleting semaphore[%p].\n", handle
));
713 EXPORT_SYMBOL(acpi_os_delete_semaphore
);
716 * TODO: The kernel doesn't have a 'down_timeout' function -- had to
717 * improvise. The process is to sleep for one scheduler quantum
718 * until the semaphore becomes available. Downside is that this
719 * may result in starvation for timeout-based waits when there's
720 * lots of semaphore activity.
722 * TODO: Support for units > 1?
724 acpi_status
acpi_os_wait_semaphore(acpi_handle handle
, u32 units
, u16 timeout
)
726 acpi_status status
= AE_OK
;
727 struct semaphore
*sem
= (struct semaphore
*)handle
;
731 if (!sem
|| (units
< 1))
732 return AE_BAD_PARAMETER
;
737 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Waiting for semaphore[%p|%d|%d]\n",
738 handle
, units
, timeout
));
741 * This can be called during resume with interrupts off.
742 * Like boot-time, we should be single threaded and will
743 * always get the lock if we try -- timeout or not.
744 * If this doesn't succeed, then we will oops courtesy of
745 * might_sleep() in down().
747 if (!down_trylock(sem
))
754 * A zero timeout value indicates that we shouldn't wait - just
755 * acquire the semaphore if available otherwise return AE_TIME
756 * (a.k.a. 'would block').
759 if (down_trylock(sem
))
767 case ACPI_WAIT_FOREVER
:
776 // TODO: A better timeout algorithm?
779 static const int quantum_ms
= 1000 / HZ
;
781 ret
= down_trylock(sem
);
782 for (i
= timeout
; (i
> 0 && ret
!= 0); i
-= quantum_ms
) {
783 schedule_timeout_interruptible(1);
784 ret
= down_trylock(sem
);
793 if (ACPI_FAILURE(status
)) {
794 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
,
795 "Failed to acquire semaphore[%p|%d|%d], %s",
796 handle
, units
, timeout
,
797 acpi_format_exception(status
)));
799 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
,
800 "Acquired semaphore[%p|%d|%d]", handle
,
807 EXPORT_SYMBOL(acpi_os_wait_semaphore
);
810 * TODO: Support for units > 1?
812 acpi_status
acpi_os_signal_semaphore(acpi_handle handle
, u32 units
)
814 struct semaphore
*sem
= (struct semaphore
*)handle
;
817 if (!sem
|| (units
< 1))
818 return AE_BAD_PARAMETER
;
823 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Signaling semaphore[%p|%d]\n", handle
,
831 EXPORT_SYMBOL(acpi_os_signal_semaphore
);
833 #ifdef ACPI_FUTURE_USAGE
834 u32
acpi_os_get_line(char *buffer
)
837 #ifdef ENABLE_DEBUGGER
838 if (acpi_in_debugger
) {
841 kdb_read(buffer
, sizeof(line_buf
));
843 /* remove the CR kdb includes */
844 chars
= strlen(buffer
) - 1;
845 buffer
[chars
] = '\0';
851 #endif /* ACPI_FUTURE_USAGE */
853 /* Assumes no unreadable holes inbetween */
854 u8
acpi_os_readable(void *ptr
, acpi_size len
)
856 #if defined(__i386__) || defined(__x86_64__)
858 return !__get_user(tmp
, (char __user
*)ptr
)
859 && !__get_user(tmp
, (char __user
*)ptr
+ len
- 1);
864 #ifdef ACPI_FUTURE_USAGE
865 u8
acpi_os_writable(void *ptr
, acpi_size len
)
867 /* could do dummy write (racy) or a kernel page table lookup.
868 The later may be difficult at early boot when kmap doesn't work yet. */
873 acpi_status
acpi_os_signal(u32 function
, void *info
)
876 case ACPI_SIGNAL_FATAL
:
877 printk(KERN_ERR PREFIX
"Fatal opcode executed\n");
879 case ACPI_SIGNAL_BREAKPOINT
:
882 * ACPI spec. says to treat it as a NOP unless
883 * you are debugging. So if/when we integrate
884 * AML debugger into the kernel debugger its
885 * hook will go here. But until then it is
886 * not useful to print anything on breakpoints.
896 EXPORT_SYMBOL(acpi_os_signal
);
898 static int __init
acpi_os_name_setup(char *str
)
900 char *p
= acpi_os_name
;
901 int count
= ACPI_MAX_OVERRIDE_LEN
- 1;
906 for (; count
-- && str
&& *str
; str
++) {
907 if (isalnum(*str
) || *str
== ' ' || *str
== ':')
909 else if (*str
== '\'' || *str
== '"')
920 __setup("acpi_os_name=", acpi_os_name_setup
);
924 * empty string disables _OSI
925 * TBD additional string adds to _OSI
927 static int __init
acpi_osi_setup(char *str
)
929 if (str
== NULL
|| *str
== '\0') {
930 printk(KERN_INFO PREFIX
"_OSI method disabled\n");
931 acpi_gbl_create_osi_method
= FALSE
;
934 printk(KERN_ERR PREFIX
"_OSI additional string ignored -- %s\n",
941 __setup("acpi_osi=", acpi_osi_setup
);
943 /* enable serialization to combat AE_ALREADY_EXISTS errors */
944 static int __init
acpi_serialize_setup(char *str
)
946 printk(KERN_INFO PREFIX
"serialize enabled\n");
948 acpi_gbl_all_methods_serialized
= TRUE
;
953 __setup("acpi_serialize", acpi_serialize_setup
);
956 * Wake and Run-Time GPES are expected to be separate.
957 * We disable wake-GPEs at run-time to prevent spurious
960 * However, if a system exists that shares Wake and
961 * Run-time events on the same GPE this flag is available
962 * to tell Linux to keep the wake-time GPEs enabled at run-time.
964 static int __init
acpi_wake_gpes_always_on_setup(char *str
)
966 printk(KERN_INFO PREFIX
"wake GPEs not disabled\n");
968 acpi_gbl_leave_wake_gpes_disabled
= FALSE
;
973 __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup
);
975 static int __init
acpi_hotkey_setup(char *str
)
977 acpi_specific_hotkey_enabled
= FALSE
;
981 __setup("acpi_generic_hotkey", acpi_hotkey_setup
);
984 * max_cstate is defined in the base kernel so modules can
985 * change it w/o depending on the state of the processor module.
987 unsigned int max_cstate
= ACPI_PROCESSOR_MAX_POWER
;
989 EXPORT_SYMBOL(max_cstate
);
992 * Acquire a spinlock.
994 * handle is a pointer to the spinlock_t.
997 acpi_cpu_flags
acpi_os_acquire_lock(acpi_spinlock lockp
)
999 acpi_cpu_flags flags
;
1000 spin_lock_irqsave(lockp
, flags
);
1005 * Release a spinlock. See above.
1008 void acpi_os_release_lock(acpi_spinlock lockp
, acpi_cpu_flags flags
)
1010 spin_unlock_irqrestore(lockp
, flags
);
1013 #ifndef ACPI_USE_LOCAL_CACHE
1015 /*******************************************************************************
1017 * FUNCTION: acpi_os_create_cache
1019 * PARAMETERS: name - Ascii name for the cache
1020 * size - Size of each cached object
1021 * depth - Maximum depth of the cache (in objects) <ignored>
1022 * cache - Where the new cache object is returned
1026 * DESCRIPTION: Create a cache object
1028 ******************************************************************************/
1031 acpi_os_create_cache(char *name
, u16 size
, u16 depth
, acpi_cache_t
** cache
)
1033 *cache
= kmem_cache_create(name
, size
, 0, 0, NULL
, NULL
);
1040 /*******************************************************************************
1042 * FUNCTION: acpi_os_purge_cache
1044 * PARAMETERS: Cache - Handle to cache object
1048 * DESCRIPTION: Free all objects within the requested cache.
1050 ******************************************************************************/
1052 acpi_status
acpi_os_purge_cache(acpi_cache_t
* cache
)
1054 (void)kmem_cache_shrink(cache
);
1058 /*******************************************************************************
1060 * FUNCTION: acpi_os_delete_cache
1062 * PARAMETERS: Cache - Handle to cache object
1066 * DESCRIPTION: Free all objects within the requested cache and delete the
1069 ******************************************************************************/
1071 acpi_status
acpi_os_delete_cache(acpi_cache_t
* cache
)
1073 kmem_cache_destroy(cache
);
1077 /*******************************************************************************
1079 * FUNCTION: acpi_os_release_object
1081 * PARAMETERS: Cache - Handle to cache object
1082 * Object - The object to be released
1086 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1087 * the object is deleted.
1089 ******************************************************************************/
1091 acpi_status
acpi_os_release_object(acpi_cache_t
* cache
, void *object
)
1093 kmem_cache_free(cache
, object
);
1097 /******************************************************************************
1099 * FUNCTION: acpi_os_validate_interface
1101 * PARAMETERS: interface - Requested interface to be validated
1103 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1105 * DESCRIPTION: Match an interface string to the interfaces supported by the
1106 * host. Strings originate from an AML call to the _OSI method.
1108 *****************************************************************************/
1111 acpi_os_validate_interface (char *interface
)
1118 /******************************************************************************
1120 * FUNCTION: acpi_os_validate_address
1122 * PARAMETERS: space_id - ACPI space ID
1123 * address - Physical address
1124 * length - Address length
1126 * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
1127 * should return AE_AML_ILLEGAL_ADDRESS.
1129 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1130 * the addresses accessed by AML operation regions.
1132 *****************************************************************************/
1135 acpi_os_validate_address (
1137 acpi_physical_address address
,