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
;
55 #ifdef CONFIG_ACPI_CUSTOM_DSDT
56 #include CONFIG_ACPI_CUSTOM_DSDT_FILE
59 #ifdef ENABLE_DEBUGGER
60 #include <linux/kdb.h>
62 /* stuff for debugger support */
64 EXPORT_SYMBOL(acpi_in_debugger
);
66 extern char line_buf
[80];
67 #endif /*ENABLE_DEBUGGER */
69 int acpi_specific_hotkey_enabled
= TRUE
;
70 EXPORT_SYMBOL(acpi_specific_hotkey_enabled
);
72 static unsigned int acpi_irq_irq
;
73 static acpi_osd_handler acpi_irq_handler
;
74 static void *acpi_irq_context
;
75 static struct workqueue_struct
*kacpid_wq
;
77 acpi_status
acpi_os_initialize(void)
82 acpi_status
acpi_os_initialize1(void)
85 * Initialize PCI configuration space access, as we'll need to access
86 * it while walking the namespace (bus 0 and root bridges w/ _BBNs).
89 printk(KERN_ERR PREFIX
90 "Access to PCI configuration space unavailable\n");
93 kacpid_wq
= create_singlethread_workqueue("kacpid");
99 acpi_status
acpi_os_terminate(void)
101 if (acpi_irq_handler
) {
102 acpi_os_remove_interrupt_handler(acpi_irq_irq
,
106 destroy_workqueue(kacpid_wq
);
111 void acpi_os_printf(const char *fmt
, ...)
115 acpi_os_vprintf(fmt
, args
);
119 EXPORT_SYMBOL(acpi_os_printf
);
121 void acpi_os_vprintf(const char *fmt
, va_list args
)
123 static char buffer
[512];
125 vsprintf(buffer
, fmt
, args
);
127 #ifdef ENABLE_DEBUGGER
128 if (acpi_in_debugger
) {
129 kdb_printf("%s", buffer
);
131 printk("%s", buffer
);
134 printk("%s", buffer
);
138 acpi_status
acpi_os_get_root_pointer(u32 flags
, struct acpi_pointer
*addr
)
141 addr
->pointer_type
= ACPI_PHYSICAL_POINTER
;
142 if (efi
.acpi20
!= EFI_INVALID_TABLE_ADDR
)
143 addr
->pointer
.physical
= efi
.acpi20
;
144 else if (efi
.acpi
!= EFI_INVALID_TABLE_ADDR
)
145 addr
->pointer
.physical
= efi
.acpi
;
147 printk(KERN_ERR PREFIX
148 "System description tables not found\n");
152 if (ACPI_FAILURE(acpi_find_root_pointer(flags
, addr
))) {
153 printk(KERN_ERR PREFIX
154 "System description tables not found\n");
163 acpi_os_map_memory(acpi_physical_address phys
, acpi_size size
,
164 void __iomem
** virt
)
166 if (phys
> ULONG_MAX
) {
167 printk(KERN_ERR PREFIX
"Cannot map memory that high\n");
168 return AE_BAD_PARAMETER
;
171 * ioremap checks to ensure this is in reserved space
173 *virt
= ioremap((unsigned long)phys
, size
);
180 EXPORT_SYMBOL_GPL(acpi_os_map_memory
);
182 void acpi_os_unmap_memory(void __iomem
* virt
, acpi_size size
)
186 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory
);
188 #ifdef ACPI_FUTURE_USAGE
190 acpi_os_get_physical_address(void *virt
, acpi_physical_address
* phys
)
193 return AE_BAD_PARAMETER
;
195 *phys
= virt_to_phys(virt
);
201 #define ACPI_MAX_OVERRIDE_LEN 100
203 static char acpi_os_name
[ACPI_MAX_OVERRIDE_LEN
];
206 acpi_os_predefined_override(const struct acpi_predefined_names
*init_val
,
207 acpi_string
* new_val
)
209 if (!init_val
|| !new_val
)
210 return AE_BAD_PARAMETER
;
213 if (!memcmp(init_val
->name
, "_OS_", 4) && strlen(acpi_os_name
)) {
214 printk(KERN_INFO PREFIX
"Overriding _OS definition to '%s'\n",
216 *new_val
= acpi_os_name
;
223 acpi_os_table_override(struct acpi_table_header
* existing_table
,
224 struct acpi_table_header
** new_table
)
226 if (!existing_table
|| !new_table
)
227 return AE_BAD_PARAMETER
;
229 #ifdef CONFIG_ACPI_CUSTOM_DSDT
230 if (strncmp(existing_table
->signature
, "DSDT", 4) == 0)
231 *new_table
= (struct acpi_table_header
*)AmlCode
;
240 static irqreturn_t
acpi_irq(int irq
, void *dev_id
, struct pt_regs
*regs
)
242 return (*acpi_irq_handler
) (acpi_irq_context
) ? IRQ_HANDLED
: IRQ_NONE
;
246 acpi_os_install_interrupt_handler(u32 gsi
, acpi_osd_handler handler
,
252 * Ignore the GSI from the core, and use the value in our copy of the
253 * FADT. It may not be the same if an interrupt source override exists
256 gsi
= acpi_fadt
.sci_int
;
257 if (acpi_gsi_to_irq(gsi
, &irq
) < 0) {
258 printk(KERN_ERR PREFIX
"SCI (ACPI GSI %d) not registered\n",
263 acpi_irq_handler
= handler
;
264 acpi_irq_context
= context
;
265 if (request_irq(irq
, acpi_irq
, IRQF_SHARED
, "acpi", acpi_irq
)) {
266 printk(KERN_ERR PREFIX
"SCI (IRQ%d) allocation failed\n", irq
);
267 return AE_NOT_ACQUIRED
;
274 acpi_status
acpi_os_remove_interrupt_handler(u32 irq
, acpi_osd_handler handler
)
277 free_irq(irq
, acpi_irq
);
278 acpi_irq_handler
= NULL
;
286 * Running in interpreter thread context, safe to sleep
289 void acpi_os_sleep(acpi_integer ms
)
291 schedule_timeout_interruptible(msecs_to_jiffies(ms
));
294 EXPORT_SYMBOL(acpi_os_sleep
);
296 void acpi_os_stall(u32 us
)
304 touch_nmi_watchdog();
309 EXPORT_SYMBOL(acpi_os_stall
);
312 * Support ACPI 3.0 AML Timer operand
313 * Returns 64-bit free-running, monotonically increasing timer
314 * with 100ns granularity
316 u64
acpi_os_get_timer(void)
321 /* TBD: use HPET if available */
324 #ifdef CONFIG_X86_PM_TIMER
325 /* TBD: default to PM timer if HPET was not available */
328 printk(KERN_ERR PREFIX
"acpi_os_get_timer() TBD\n");
333 acpi_status
acpi_os_read_port(acpi_io_address port
, u32
* value
, u32 width
)
342 *(u8
*) value
= inb(port
);
345 *(u16
*) value
= inw(port
);
348 *(u32
*) value
= inl(port
);
357 EXPORT_SYMBOL(acpi_os_read_port
);
359 acpi_status
acpi_os_write_port(acpi_io_address port
, u32 value
, u32 width
)
378 EXPORT_SYMBOL(acpi_os_write_port
);
381 acpi_os_read_memory(acpi_physical_address phys_addr
, u32
* value
, u32 width
)
384 void __iomem
*virt_addr
;
386 virt_addr
= ioremap(phys_addr
, width
);
392 *(u8
*) value
= readb(virt_addr
);
395 *(u16
*) value
= readw(virt_addr
);
398 *(u32
*) value
= readl(virt_addr
);
410 acpi_os_write_memory(acpi_physical_address phys_addr
, u32 value
, u32 width
)
412 void __iomem
*virt_addr
;
414 virt_addr
= ioremap(phys_addr
, width
);
418 writeb(value
, virt_addr
);
421 writew(value
, virt_addr
);
424 writel(value
, virt_addr
);
436 acpi_os_read_pci_configuration(struct acpi_pci_id
* pci_id
, u32 reg
,
437 void *value
, u32 width
)
442 return AE_BAD_PARAMETER
;
458 BUG_ON(!raw_pci_ops
);
460 result
= raw_pci_ops
->read(pci_id
->segment
, pci_id
->bus
,
461 PCI_DEVFN(pci_id
->device
, pci_id
->function
),
464 return (result
? AE_ERROR
: AE_OK
);
467 EXPORT_SYMBOL(acpi_os_read_pci_configuration
);
470 acpi_os_write_pci_configuration(struct acpi_pci_id
* pci_id
, u32 reg
,
471 acpi_integer value
, u32 width
)
489 BUG_ON(!raw_pci_ops
);
491 result
= raw_pci_ops
->write(pci_id
->segment
, pci_id
->bus
,
492 PCI_DEVFN(pci_id
->device
, pci_id
->function
),
495 return (result
? AE_ERROR
: AE_OK
);
498 /* TODO: Change code to take advantage of driver model more */
499 static void acpi_os_derive_pci_id_2(acpi_handle rhandle
, /* upper bound */
500 acpi_handle chandle
, /* current node */
501 struct acpi_pci_id
**id
,
502 int *is_bridge
, u8
* bus_number
)
505 struct acpi_pci_id
*pci_id
= *id
;
508 acpi_object_type type
;
511 acpi_get_parent(chandle
, &handle
);
512 if (handle
!= rhandle
) {
513 acpi_os_derive_pci_id_2(rhandle
, handle
, &pci_id
, is_bridge
,
516 status
= acpi_get_type(handle
, &type
);
517 if ((ACPI_FAILURE(status
)) || (type
!= ACPI_TYPE_DEVICE
))
521 acpi_evaluate_integer(handle
, METHOD_NAME__ADR
, NULL
,
523 if (ACPI_SUCCESS(status
)) {
524 pci_id
->device
= ACPI_HIWORD(ACPI_LODWORD(temp
));
525 pci_id
->function
= ACPI_LOWORD(ACPI_LODWORD(temp
));
528 pci_id
->bus
= *bus_number
;
530 /* any nicer way to get bus number of bridge ? */
532 acpi_os_read_pci_configuration(pci_id
, 0x0e, &tu8
,
534 if (ACPI_SUCCESS(status
)
535 && ((tu8
& 0x7f) == 1 || (tu8
& 0x7f) == 2)) {
537 acpi_os_read_pci_configuration(pci_id
, 0x18,
539 if (!ACPI_SUCCESS(status
)) {
540 /* Certainly broken... FIX ME */
546 acpi_os_read_pci_configuration(pci_id
, 0x19,
548 if (ACPI_SUCCESS(status
)) {
557 void acpi_os_derive_pci_id(acpi_handle rhandle
, /* upper bound */
558 acpi_handle chandle
, /* current node */
559 struct acpi_pci_id
**id
)
562 u8 bus_number
= (*id
)->bus
;
564 acpi_os_derive_pci_id_2(rhandle
, chandle
, id
, &is_bridge
, &bus_number
);
567 static void acpi_os_execute_deferred(void *context
)
569 struct acpi_os_dpc
*dpc
= NULL
;
572 dpc
= (struct acpi_os_dpc
*)context
;
574 printk(KERN_ERR PREFIX
"Invalid (NULL) context\n");
578 dpc
->function(dpc
->context
);
585 /*******************************************************************************
587 * FUNCTION: acpi_os_execute
589 * PARAMETERS: Type - Type of the callback
590 * Function - Function to be executed
591 * Context - Function parameters
595 * DESCRIPTION: Depending on type, either queues function for deferred execution or
596 * immediately executes function on a separate thread.
598 ******************************************************************************/
600 acpi_status
acpi_os_execute(acpi_execute_type type
,
601 acpi_osd_exec_callback function
, void *context
)
603 acpi_status status
= AE_OK
;
604 struct acpi_os_dpc
*dpc
;
605 struct work_struct
*task
;
607 ACPI_FUNCTION_TRACE("os_queue_for_execution");
609 ACPI_DEBUG_PRINT((ACPI_DB_EXEC
,
610 "Scheduling function [%p(%p)] for deferred execution.\n",
614 return_ACPI_STATUS(AE_BAD_PARAMETER
);
617 * Allocate/initialize DPC structure. Note that this memory will be
618 * freed by the callee. The kernel handles the tq_struct list in a
619 * way that allows us to also free its memory inside the callee.
620 * Because we may want to schedule several tasks with different
621 * parameters we can't use the approach some kernel code uses of
622 * having a static tq_struct.
623 * We can save time and code by allocating the DPC and tq_structs
624 * from the same memory.
628 kmalloc(sizeof(struct acpi_os_dpc
) + sizeof(struct work_struct
),
631 return_ACPI_STATUS(AE_NO_MEMORY
);
633 dpc
->function
= function
;
634 dpc
->context
= context
;
636 task
= (void *)(dpc
+ 1);
637 INIT_WORK(task
, acpi_os_execute_deferred
, (void *)dpc
);
639 if (!queue_work(kacpid_wq
, task
)) {
640 ACPI_DEBUG_PRINT((ACPI_DB_ERROR
,
641 "Call to queue_work() failed.\n"));
646 return_ACPI_STATUS(status
);
649 EXPORT_SYMBOL(acpi_os_execute
);
651 void acpi_os_wait_events_complete(void *context
)
653 flush_workqueue(kacpid_wq
);
656 EXPORT_SYMBOL(acpi_os_wait_events_complete
);
659 * Allocate the memory for a spinlock and initialize it.
661 acpi_status
acpi_os_create_lock(acpi_spinlock
* handle
)
663 spin_lock_init(*handle
);
669 * Deallocate the memory for a spinlock.
671 void acpi_os_delete_lock(acpi_spinlock handle
)
677 acpi_os_create_semaphore(u32 max_units
, u32 initial_units
, acpi_handle
* handle
)
679 struct semaphore
*sem
= NULL
;
682 sem
= acpi_os_allocate(sizeof(struct semaphore
));
685 memset(sem
, 0, sizeof(struct semaphore
));
687 sema_init(sem
, initial_units
);
689 *handle
= (acpi_handle
*) sem
;
691 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Creating semaphore[%p|%d].\n",
692 *handle
, initial_units
));
697 EXPORT_SYMBOL(acpi_os_create_semaphore
);
700 * TODO: A better way to delete semaphores? Linux doesn't have a
701 * 'delete_semaphore()' function -- may result in an invalid
702 * pointer dereference for non-synchronized consumers. Should
703 * we at least check for blocked threads and signal/cancel them?
706 acpi_status
acpi_os_delete_semaphore(acpi_handle handle
)
708 struct semaphore
*sem
= (struct semaphore
*)handle
;
712 return AE_BAD_PARAMETER
;
714 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Deleting semaphore[%p].\n", handle
));
722 EXPORT_SYMBOL(acpi_os_delete_semaphore
);
725 * TODO: The kernel doesn't have a 'down_timeout' function -- had to
726 * improvise. The process is to sleep for one scheduler quantum
727 * until the semaphore becomes available. Downside is that this
728 * may result in starvation for timeout-based waits when there's
729 * lots of semaphore activity.
731 * TODO: Support for units > 1?
733 acpi_status
acpi_os_wait_semaphore(acpi_handle handle
, u32 units
, u16 timeout
)
735 acpi_status status
= AE_OK
;
736 struct semaphore
*sem
= (struct semaphore
*)handle
;
740 if (!sem
|| (units
< 1))
741 return AE_BAD_PARAMETER
;
746 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Waiting for semaphore[%p|%d|%d]\n",
747 handle
, units
, timeout
));
750 * This can be called during resume with interrupts off.
751 * Like boot-time, we should be single threaded and will
752 * always get the lock if we try -- timeout or not.
753 * If this doesn't succeed, then we will oops courtesy of
754 * might_sleep() in down().
756 if (!down_trylock(sem
))
763 * A zero timeout value indicates that we shouldn't wait - just
764 * acquire the semaphore if available otherwise return AE_TIME
765 * (a.k.a. 'would block').
768 if (down_trylock(sem
))
776 case ACPI_WAIT_FOREVER
:
785 // TODO: A better timeout algorithm?
788 static const int quantum_ms
= 1000 / HZ
;
790 ret
= down_trylock(sem
);
791 for (i
= timeout
; (i
> 0 && ret
!= 0); i
-= quantum_ms
) {
792 schedule_timeout_interruptible(1);
793 ret
= down_trylock(sem
);
802 if (ACPI_FAILURE(status
)) {
803 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
,
804 "Failed to acquire semaphore[%p|%d|%d], %s",
805 handle
, units
, timeout
,
806 acpi_format_exception(status
)));
808 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
,
809 "Acquired semaphore[%p|%d|%d]", handle
,
816 EXPORT_SYMBOL(acpi_os_wait_semaphore
);
819 * TODO: Support for units > 1?
821 acpi_status
acpi_os_signal_semaphore(acpi_handle handle
, u32 units
)
823 struct semaphore
*sem
= (struct semaphore
*)handle
;
826 if (!sem
|| (units
< 1))
827 return AE_BAD_PARAMETER
;
832 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Signaling semaphore[%p|%d]\n", handle
,
840 EXPORT_SYMBOL(acpi_os_signal_semaphore
);
842 #ifdef ACPI_FUTURE_USAGE
843 u32
acpi_os_get_line(char *buffer
)
846 #ifdef ENABLE_DEBUGGER
847 if (acpi_in_debugger
) {
850 kdb_read(buffer
, sizeof(line_buf
));
852 /* remove the CR kdb includes */
853 chars
= strlen(buffer
) - 1;
854 buffer
[chars
] = '\0';
860 #endif /* ACPI_FUTURE_USAGE */
862 /* Assumes no unreadable holes inbetween */
863 u8
acpi_os_readable(void *ptr
, acpi_size len
)
865 #if defined(__i386__) || defined(__x86_64__)
867 return !__get_user(tmp
, (char __user
*)ptr
)
868 && !__get_user(tmp
, (char __user
*)ptr
+ len
- 1);
873 #ifdef ACPI_FUTURE_USAGE
874 u8
acpi_os_writable(void *ptr
, acpi_size len
)
876 /* could do dummy write (racy) or a kernel page table lookup.
877 The later may be difficult at early boot when kmap doesn't work yet. */
882 acpi_status
acpi_os_signal(u32 function
, void *info
)
885 case ACPI_SIGNAL_FATAL
:
886 printk(KERN_ERR PREFIX
"Fatal opcode executed\n");
888 case ACPI_SIGNAL_BREAKPOINT
:
891 * ACPI spec. says to treat it as a NOP unless
892 * you are debugging. So if/when we integrate
893 * AML debugger into the kernel debugger its
894 * hook will go here. But until then it is
895 * not useful to print anything on breakpoints.
905 EXPORT_SYMBOL(acpi_os_signal
);
907 static int __init
acpi_os_name_setup(char *str
)
909 char *p
= acpi_os_name
;
910 int count
= ACPI_MAX_OVERRIDE_LEN
- 1;
915 for (; count
-- && str
&& *str
; str
++) {
916 if (isalnum(*str
) || *str
== ' ' || *str
== ':')
918 else if (*str
== '\'' || *str
== '"')
929 __setup("acpi_os_name=", acpi_os_name_setup
);
933 * empty string disables _OSI
934 * TBD additional string adds to _OSI
936 static int __init
acpi_osi_setup(char *str
)
938 if (str
== NULL
|| *str
== '\0') {
939 printk(KERN_INFO PREFIX
"_OSI method disabled\n");
940 acpi_gbl_create_osi_method
= FALSE
;
943 printk(KERN_ERR PREFIX
"_OSI additional string ignored -- %s\n",
950 __setup("acpi_osi=", acpi_osi_setup
);
952 /* enable serialization to combat AE_ALREADY_EXISTS errors */
953 static int __init
acpi_serialize_setup(char *str
)
955 printk(KERN_INFO PREFIX
"serialize enabled\n");
957 acpi_gbl_all_methods_serialized
= TRUE
;
962 __setup("acpi_serialize", acpi_serialize_setup
);
965 * Wake and Run-Time GPES are expected to be separate.
966 * We disable wake-GPEs at run-time to prevent spurious
969 * However, if a system exists that shares Wake and
970 * Run-time events on the same GPE this flag is available
971 * to tell Linux to keep the wake-time GPEs enabled at run-time.
973 static int __init
acpi_wake_gpes_always_on_setup(char *str
)
975 printk(KERN_INFO PREFIX
"wake GPEs not disabled\n");
977 acpi_gbl_leave_wake_gpes_disabled
= FALSE
;
982 __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup
);
984 static int __init
acpi_hotkey_setup(char *str
)
986 acpi_specific_hotkey_enabled
= FALSE
;
990 __setup("acpi_generic_hotkey", acpi_hotkey_setup
);
993 * max_cstate is defined in the base kernel so modules can
994 * change it w/o depending on the state of the processor module.
996 unsigned int max_cstate
= ACPI_PROCESSOR_MAX_POWER
;
998 EXPORT_SYMBOL(max_cstate
);
1001 * Acquire a spinlock.
1003 * handle is a pointer to the spinlock_t.
1006 acpi_cpu_flags
acpi_os_acquire_lock(acpi_spinlock lockp
)
1008 acpi_cpu_flags flags
;
1009 spin_lock_irqsave(lockp
, flags
);
1014 * Release a spinlock. See above.
1017 void acpi_os_release_lock(acpi_spinlock lockp
, acpi_cpu_flags flags
)
1019 spin_unlock_irqrestore(lockp
, flags
);
1022 #ifndef ACPI_USE_LOCAL_CACHE
1024 /*******************************************************************************
1026 * FUNCTION: acpi_os_create_cache
1028 * PARAMETERS: name - Ascii name for the cache
1029 * size - Size of each cached object
1030 * depth - Maximum depth of the cache (in objects) <ignored>
1031 * cache - Where the new cache object is returned
1035 * DESCRIPTION: Create a cache object
1037 ******************************************************************************/
1040 acpi_os_create_cache(char *name
, u16 size
, u16 depth
, acpi_cache_t
** cache
)
1042 *cache
= kmem_cache_create(name
, size
, 0, 0, NULL
, NULL
);
1049 /*******************************************************************************
1051 * FUNCTION: acpi_os_purge_cache
1053 * PARAMETERS: Cache - Handle to cache object
1057 * DESCRIPTION: Free all objects within the requested cache.
1059 ******************************************************************************/
1061 acpi_status
acpi_os_purge_cache(acpi_cache_t
* cache
)
1063 (void)kmem_cache_shrink(cache
);
1067 /*******************************************************************************
1069 * FUNCTION: acpi_os_delete_cache
1071 * PARAMETERS: Cache - Handle to cache object
1075 * DESCRIPTION: Free all objects within the requested cache and delete the
1078 ******************************************************************************/
1080 acpi_status
acpi_os_delete_cache(acpi_cache_t
* cache
)
1082 kmem_cache_destroy(cache
);
1086 /*******************************************************************************
1088 * FUNCTION: acpi_os_release_object
1090 * PARAMETERS: Cache - Handle to cache object
1091 * Object - The object to be released
1095 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1096 * the object is deleted.
1098 ******************************************************************************/
1100 acpi_status
acpi_os_release_object(acpi_cache_t
* cache
, void *object
)
1102 kmem_cache_free(cache
, object
);
1106 /******************************************************************************
1108 * FUNCTION: acpi_os_validate_interface
1110 * PARAMETERS: interface - Requested interface to be validated
1112 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1114 * DESCRIPTION: Match an interface string to the interfaces supported by the
1115 * host. Strings originate from an AML call to the _OSI method.
1117 *****************************************************************************/
1120 acpi_os_validate_interface (char *interface
)
1127 /******************************************************************************
1129 * FUNCTION: acpi_os_validate_address
1131 * PARAMETERS: space_id - ACPI space ID
1132 * address - Physical address
1133 * length - Address length
1135 * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
1136 * should return AE_AML_ILLEGAL_ADDRESS.
1138 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1139 * the addresses accessed by AML operation regions.
1141 *****************************************************************************/
1144 acpi_os_validate_address (
1146 acpi_physical_address address
,