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 <linux/kthread.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
;
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
);
140 extern int acpi_in_resume
;
141 void *acpi_os_allocate(acpi_size size
)
144 return kmalloc(size
, GFP_ATOMIC
);
146 return kmalloc(size
, GFP_KERNEL
);
149 acpi_status
acpi_os_get_root_pointer(u32 flags
, struct acpi_pointer
*addr
)
152 addr
->pointer_type
= ACPI_PHYSICAL_POINTER
;
153 if (efi
.acpi20
!= EFI_INVALID_TABLE_ADDR
)
154 addr
->pointer
.physical
= efi
.acpi20
;
155 else if (efi
.acpi
!= EFI_INVALID_TABLE_ADDR
)
156 addr
->pointer
.physical
= efi
.acpi
;
158 printk(KERN_ERR PREFIX
159 "System description tables not found\n");
163 if (ACPI_FAILURE(acpi_find_root_pointer(flags
, addr
))) {
164 printk(KERN_ERR PREFIX
165 "System description tables not found\n");
174 acpi_os_map_memory(acpi_physical_address phys
, acpi_size size
,
175 void __iomem
** virt
)
177 if (phys
> ULONG_MAX
) {
178 printk(KERN_ERR PREFIX
"Cannot map memory that high\n");
179 return AE_BAD_PARAMETER
;
182 * ioremap checks to ensure this is in reserved space
184 *virt
= ioremap((unsigned long)phys
, size
);
191 EXPORT_SYMBOL_GPL(acpi_os_map_memory
);
193 void acpi_os_unmap_memory(void __iomem
* virt
, acpi_size size
)
197 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory
);
199 #ifdef ACPI_FUTURE_USAGE
201 acpi_os_get_physical_address(void *virt
, acpi_physical_address
* phys
)
204 return AE_BAD_PARAMETER
;
206 *phys
= virt_to_phys(virt
);
212 #define ACPI_MAX_OVERRIDE_LEN 100
214 static char acpi_os_name
[ACPI_MAX_OVERRIDE_LEN
];
217 acpi_os_predefined_override(const struct acpi_predefined_names
*init_val
,
218 acpi_string
* new_val
)
220 if (!init_val
|| !new_val
)
221 return AE_BAD_PARAMETER
;
224 if (!memcmp(init_val
->name
, "_OS_", 4) && strlen(acpi_os_name
)) {
225 printk(KERN_INFO PREFIX
"Overriding _OS definition to '%s'\n",
227 *new_val
= acpi_os_name
;
234 acpi_os_table_override(struct acpi_table_header
* existing_table
,
235 struct acpi_table_header
** new_table
)
237 if (!existing_table
|| !new_table
)
238 return AE_BAD_PARAMETER
;
240 #ifdef CONFIG_ACPI_CUSTOM_DSDT
241 if (strncmp(existing_table
->signature
, "DSDT", 4) == 0)
242 *new_table
= (struct acpi_table_header
*)AmlCode
;
251 static irqreturn_t
acpi_irq(int irq
, void *dev_id
, struct pt_regs
*regs
)
253 return (*acpi_irq_handler
) (acpi_irq_context
) ? IRQ_HANDLED
: IRQ_NONE
;
257 acpi_os_install_interrupt_handler(u32 gsi
, acpi_osd_handler handler
,
263 * Ignore the GSI from the core, and use the value in our copy of the
264 * FADT. It may not be the same if an interrupt source override exists
267 gsi
= acpi_fadt
.sci_int
;
268 if (acpi_gsi_to_irq(gsi
, &irq
) < 0) {
269 printk(KERN_ERR PREFIX
"SCI (ACPI GSI %d) not registered\n",
274 acpi_irq_handler
= handler
;
275 acpi_irq_context
= context
;
276 if (request_irq(irq
, acpi_irq
, IRQF_SHARED
, "acpi", acpi_irq
)) {
277 printk(KERN_ERR PREFIX
"SCI (IRQ%d) allocation failed\n", irq
);
278 return AE_NOT_ACQUIRED
;
285 acpi_status
acpi_os_remove_interrupt_handler(u32 irq
, acpi_osd_handler handler
)
288 free_irq(irq
, acpi_irq
);
289 acpi_irq_handler
= NULL
;
297 * Running in interpreter thread context, safe to sleep
300 void acpi_os_sleep(acpi_integer ms
)
302 schedule_timeout_interruptible(msecs_to_jiffies(ms
));
305 EXPORT_SYMBOL(acpi_os_sleep
);
307 void acpi_os_stall(u32 us
)
315 touch_nmi_watchdog();
320 EXPORT_SYMBOL(acpi_os_stall
);
323 * Support ACPI 3.0 AML Timer operand
324 * Returns 64-bit free-running, monotonically increasing timer
325 * with 100ns granularity
327 u64
acpi_os_get_timer(void)
332 /* TBD: use HPET if available */
335 #ifdef CONFIG_X86_PM_TIMER
336 /* TBD: default to PM timer if HPET was not available */
339 printk(KERN_ERR PREFIX
"acpi_os_get_timer() TBD\n");
344 acpi_status
acpi_os_read_port(acpi_io_address port
, u32
* value
, u32 width
)
353 *(u8
*) value
= inb(port
);
356 *(u16
*) value
= inw(port
);
359 *(u32
*) value
= inl(port
);
368 EXPORT_SYMBOL(acpi_os_read_port
);
370 acpi_status
acpi_os_write_port(acpi_io_address port
, u32 value
, u32 width
)
389 EXPORT_SYMBOL(acpi_os_write_port
);
392 acpi_os_read_memory(acpi_physical_address phys_addr
, u32
* value
, u32 width
)
395 void __iomem
*virt_addr
;
397 virt_addr
= ioremap(phys_addr
, width
);
403 *(u8
*) value
= readb(virt_addr
);
406 *(u16
*) value
= readw(virt_addr
);
409 *(u32
*) value
= readl(virt_addr
);
421 acpi_os_write_memory(acpi_physical_address phys_addr
, u32 value
, u32 width
)
423 void __iomem
*virt_addr
;
425 virt_addr
= ioremap(phys_addr
, width
);
429 writeb(value
, virt_addr
);
432 writew(value
, virt_addr
);
435 writel(value
, virt_addr
);
447 acpi_os_read_pci_configuration(struct acpi_pci_id
* pci_id
, u32 reg
,
448 void *value
, u32 width
)
453 return AE_BAD_PARAMETER
;
469 BUG_ON(!raw_pci_ops
);
471 result
= raw_pci_ops
->read(pci_id
->segment
, pci_id
->bus
,
472 PCI_DEVFN(pci_id
->device
, pci_id
->function
),
475 return (result
? AE_ERROR
: AE_OK
);
478 EXPORT_SYMBOL(acpi_os_read_pci_configuration
);
481 acpi_os_write_pci_configuration(struct acpi_pci_id
* pci_id
, u32 reg
,
482 acpi_integer value
, u32 width
)
500 BUG_ON(!raw_pci_ops
);
502 result
= raw_pci_ops
->write(pci_id
->segment
, pci_id
->bus
,
503 PCI_DEVFN(pci_id
->device
, pci_id
->function
),
506 return (result
? AE_ERROR
: AE_OK
);
509 /* TODO: Change code to take advantage of driver model more */
510 static void acpi_os_derive_pci_id_2(acpi_handle rhandle
, /* upper bound */
511 acpi_handle chandle
, /* current node */
512 struct acpi_pci_id
**id
,
513 int *is_bridge
, u8
* bus_number
)
516 struct acpi_pci_id
*pci_id
= *id
;
519 acpi_object_type type
;
522 acpi_get_parent(chandle
, &handle
);
523 if (handle
!= rhandle
) {
524 acpi_os_derive_pci_id_2(rhandle
, handle
, &pci_id
, is_bridge
,
527 status
= acpi_get_type(handle
, &type
);
528 if ((ACPI_FAILURE(status
)) || (type
!= ACPI_TYPE_DEVICE
))
532 acpi_evaluate_integer(handle
, METHOD_NAME__ADR
, NULL
,
534 if (ACPI_SUCCESS(status
)) {
535 pci_id
->device
= ACPI_HIWORD(ACPI_LODWORD(temp
));
536 pci_id
->function
= ACPI_LOWORD(ACPI_LODWORD(temp
));
539 pci_id
->bus
= *bus_number
;
541 /* any nicer way to get bus number of bridge ? */
543 acpi_os_read_pci_configuration(pci_id
, 0x0e, &tu8
,
545 if (ACPI_SUCCESS(status
)
546 && ((tu8
& 0x7f) == 1 || (tu8
& 0x7f) == 2)) {
548 acpi_os_read_pci_configuration(pci_id
, 0x18,
550 if (!ACPI_SUCCESS(status
)) {
551 /* Certainly broken... FIX ME */
557 acpi_os_read_pci_configuration(pci_id
, 0x19,
559 if (ACPI_SUCCESS(status
)) {
568 void acpi_os_derive_pci_id(acpi_handle rhandle
, /* upper bound */
569 acpi_handle chandle
, /* current node */
570 struct acpi_pci_id
**id
)
573 u8 bus_number
= (*id
)->bus
;
575 acpi_os_derive_pci_id_2(rhandle
, chandle
, id
, &is_bridge
, &bus_number
);
578 static void acpi_os_execute_deferred(void *context
)
580 struct acpi_os_dpc
*dpc
= NULL
;
583 dpc
= (struct acpi_os_dpc
*)context
;
585 printk(KERN_ERR PREFIX
"Invalid (NULL) context\n");
589 dpc
->function(dpc
->context
);
596 static int acpi_os_execute_thread(void *context
)
598 struct acpi_os_dpc
*dpc
= (struct acpi_os_dpc
*)context
;
600 dpc
->function(dpc
->context
);
606 /*******************************************************************************
608 * FUNCTION: acpi_os_execute
610 * PARAMETERS: Type - Type of the callback
611 * Function - Function to be executed
612 * Context - Function parameters
616 * DESCRIPTION: Depending on type, either queues function for deferred execution or
617 * immediately executes function on a separate thread.
619 ******************************************************************************/
621 acpi_status
acpi_os_execute(acpi_execute_type type
,
622 acpi_osd_exec_callback function
, void *context
)
624 acpi_status status
= AE_OK
;
625 struct acpi_os_dpc
*dpc
;
626 struct work_struct
*task
;
627 struct task_struct
*p
;
630 return AE_BAD_PARAMETER
;
632 * Allocate/initialize DPC structure. Note that this memory will be
633 * freed by the callee. The kernel handles the tq_struct list in a
634 * way that allows us to also free its memory inside the callee.
635 * Because we may want to schedule several tasks with different
636 * parameters we can't use the approach some kernel code uses of
637 * having a static tq_struct.
638 * We can save time and code by allocating the DPC and tq_structs
639 * from the same memory.
641 if (type
== OSL_NOTIFY_HANDLER
) {
642 dpc
= kmalloc(sizeof(struct acpi_os_dpc
), GFP_KERNEL
);
644 dpc
= kmalloc(sizeof(struct acpi_os_dpc
) +
645 sizeof(struct work_struct
), GFP_ATOMIC
);
649 dpc
->function
= function
;
650 dpc
->context
= context
;
652 if (type
== OSL_NOTIFY_HANDLER
) {
653 p
= kthread_create(acpi_os_execute_thread
, dpc
, "kacpid_notify");
657 status
= AE_NO_MEMORY
;
661 task
= (void *)(dpc
+ 1);
662 INIT_WORK(task
, acpi_os_execute_deferred
, (void *)dpc
);
663 if (!queue_work(kacpid_wq
, task
)) {
671 EXPORT_SYMBOL(acpi_os_execute
);
673 void acpi_os_wait_events_complete(void *context
)
675 flush_workqueue(kacpid_wq
);
678 EXPORT_SYMBOL(acpi_os_wait_events_complete
);
681 * Allocate the memory for a spinlock and initialize it.
683 acpi_status
acpi_os_create_lock(acpi_spinlock
* handle
)
685 spin_lock_init(*handle
);
691 * Deallocate the memory for a spinlock.
693 void acpi_os_delete_lock(acpi_spinlock handle
)
699 acpi_os_create_semaphore(u32 max_units
, u32 initial_units
, acpi_handle
* handle
)
701 struct semaphore
*sem
= NULL
;
704 sem
= acpi_os_allocate(sizeof(struct semaphore
));
707 memset(sem
, 0, sizeof(struct semaphore
));
709 sema_init(sem
, initial_units
);
711 *handle
= (acpi_handle
*) sem
;
713 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Creating semaphore[%p|%d].\n",
714 *handle
, initial_units
));
719 EXPORT_SYMBOL(acpi_os_create_semaphore
);
722 * TODO: A better way to delete semaphores? Linux doesn't have a
723 * 'delete_semaphore()' function -- may result in an invalid
724 * pointer dereference for non-synchronized consumers. Should
725 * we at least check for blocked threads and signal/cancel them?
728 acpi_status
acpi_os_delete_semaphore(acpi_handle handle
)
730 struct semaphore
*sem
= (struct semaphore
*)handle
;
734 return AE_BAD_PARAMETER
;
736 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Deleting semaphore[%p].\n", handle
));
744 EXPORT_SYMBOL(acpi_os_delete_semaphore
);
747 * TODO: The kernel doesn't have a 'down_timeout' function -- had to
748 * improvise. The process is to sleep for one scheduler quantum
749 * until the semaphore becomes available. Downside is that this
750 * may result in starvation for timeout-based waits when there's
751 * lots of semaphore activity.
753 * TODO: Support for units > 1?
755 acpi_status
acpi_os_wait_semaphore(acpi_handle handle
, u32 units
, u16 timeout
)
757 acpi_status status
= AE_OK
;
758 struct semaphore
*sem
= (struct semaphore
*)handle
;
762 if (!sem
|| (units
< 1))
763 return AE_BAD_PARAMETER
;
768 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Waiting for semaphore[%p|%d|%d]\n",
769 handle
, units
, timeout
));
775 * A zero timeout value indicates that we shouldn't wait - just
776 * acquire the semaphore if available otherwise return AE_TIME
777 * (a.k.a. 'would block').
780 if (down_trylock(sem
))
788 case ACPI_WAIT_FOREVER
:
797 // TODO: A better timeout algorithm?
800 static const int quantum_ms
= 1000 / HZ
;
802 ret
= down_trylock(sem
);
803 for (i
= timeout
; (i
> 0 && ret
!= 0); i
-= quantum_ms
) {
804 schedule_timeout_interruptible(1);
805 ret
= down_trylock(sem
);
814 if (ACPI_FAILURE(status
)) {
815 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
,
816 "Failed to acquire semaphore[%p|%d|%d], %s",
817 handle
, units
, timeout
,
818 acpi_format_exception(status
)));
820 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
,
821 "Acquired semaphore[%p|%d|%d]", handle
,
828 EXPORT_SYMBOL(acpi_os_wait_semaphore
);
831 * TODO: Support for units > 1?
833 acpi_status
acpi_os_signal_semaphore(acpi_handle handle
, u32 units
)
835 struct semaphore
*sem
= (struct semaphore
*)handle
;
838 if (!sem
|| (units
< 1))
839 return AE_BAD_PARAMETER
;
844 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX
, "Signaling semaphore[%p|%d]\n", handle
,
852 EXPORT_SYMBOL(acpi_os_signal_semaphore
);
854 #ifdef ACPI_FUTURE_USAGE
855 u32
acpi_os_get_line(char *buffer
)
858 #ifdef ENABLE_DEBUGGER
859 if (acpi_in_debugger
) {
862 kdb_read(buffer
, sizeof(line_buf
));
864 /* remove the CR kdb includes */
865 chars
= strlen(buffer
) - 1;
866 buffer
[chars
] = '\0';
872 #endif /* ACPI_FUTURE_USAGE */
874 /* Assumes no unreadable holes inbetween */
875 u8
acpi_os_readable(void *ptr
, acpi_size len
)
877 #if defined(__i386__) || defined(__x86_64__)
879 return !__get_user(tmp
, (char __user
*)ptr
)
880 && !__get_user(tmp
, (char __user
*)ptr
+ len
- 1);
885 #ifdef ACPI_FUTURE_USAGE
886 u8
acpi_os_writable(void *ptr
, acpi_size len
)
888 /* could do dummy write (racy) or a kernel page table lookup.
889 The later may be difficult at early boot when kmap doesn't work yet. */
894 acpi_status
acpi_os_signal(u32 function
, void *info
)
897 case ACPI_SIGNAL_FATAL
:
898 printk(KERN_ERR PREFIX
"Fatal opcode executed\n");
900 case ACPI_SIGNAL_BREAKPOINT
:
903 * ACPI spec. says to treat it as a NOP unless
904 * you are debugging. So if/when we integrate
905 * AML debugger into the kernel debugger its
906 * hook will go here. But until then it is
907 * not useful to print anything on breakpoints.
917 EXPORT_SYMBOL(acpi_os_signal
);
919 static int __init
acpi_os_name_setup(char *str
)
921 char *p
= acpi_os_name
;
922 int count
= ACPI_MAX_OVERRIDE_LEN
- 1;
927 for (; count
-- && str
&& *str
; str
++) {
928 if (isalnum(*str
) || *str
== ' ' || *str
== ':')
930 else if (*str
== '\'' || *str
== '"')
941 __setup("acpi_os_name=", acpi_os_name_setup
);
945 * empty string disables _OSI
946 * TBD additional string adds to _OSI
948 static int __init
acpi_osi_setup(char *str
)
950 if (str
== NULL
|| *str
== '\0') {
951 printk(KERN_INFO PREFIX
"_OSI method disabled\n");
952 acpi_gbl_create_osi_method
= FALSE
;
955 printk(KERN_ERR PREFIX
"_OSI additional string ignored -- %s\n",
962 __setup("acpi_osi=", acpi_osi_setup
);
964 /* enable serialization to combat AE_ALREADY_EXISTS errors */
965 static int __init
acpi_serialize_setup(char *str
)
967 printk(KERN_INFO PREFIX
"serialize enabled\n");
969 acpi_gbl_all_methods_serialized
= TRUE
;
974 __setup("acpi_serialize", acpi_serialize_setup
);
977 * Wake and Run-Time GPES are expected to be separate.
978 * We disable wake-GPEs at run-time to prevent spurious
981 * However, if a system exists that shares Wake and
982 * Run-time events on the same GPE this flag is available
983 * to tell Linux to keep the wake-time GPEs enabled at run-time.
985 static int __init
acpi_wake_gpes_always_on_setup(char *str
)
987 printk(KERN_INFO PREFIX
"wake GPEs not disabled\n");
989 acpi_gbl_leave_wake_gpes_disabled
= FALSE
;
994 __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup
);
996 static int __init
acpi_hotkey_setup(char *str
)
998 acpi_specific_hotkey_enabled
= FALSE
;
1002 __setup("acpi_generic_hotkey", acpi_hotkey_setup
);
1005 * max_cstate is defined in the base kernel so modules can
1006 * change it w/o depending on the state of the processor module.
1008 unsigned int max_cstate
= ACPI_PROCESSOR_MAX_POWER
;
1010 EXPORT_SYMBOL(max_cstate
);
1013 * Acquire a spinlock.
1015 * handle is a pointer to the spinlock_t.
1018 acpi_cpu_flags
acpi_os_acquire_lock(acpi_spinlock lockp
)
1020 acpi_cpu_flags flags
;
1021 spin_lock_irqsave(lockp
, flags
);
1026 * Release a spinlock. See above.
1029 void acpi_os_release_lock(acpi_spinlock lockp
, acpi_cpu_flags flags
)
1031 spin_unlock_irqrestore(lockp
, flags
);
1034 #ifndef ACPI_USE_LOCAL_CACHE
1036 /*******************************************************************************
1038 * FUNCTION: acpi_os_create_cache
1040 * PARAMETERS: name - Ascii name for the cache
1041 * size - Size of each cached object
1042 * depth - Maximum depth of the cache (in objects) <ignored>
1043 * cache - Where the new cache object is returned
1047 * DESCRIPTION: Create a cache object
1049 ******************************************************************************/
1052 acpi_os_create_cache(char *name
, u16 size
, u16 depth
, acpi_cache_t
** cache
)
1054 *cache
= kmem_cache_create(name
, size
, 0, 0, NULL
, NULL
);
1061 /*******************************************************************************
1063 * FUNCTION: acpi_os_purge_cache
1065 * PARAMETERS: Cache - Handle to cache object
1069 * DESCRIPTION: Free all objects within the requested cache.
1071 ******************************************************************************/
1073 acpi_status
acpi_os_purge_cache(acpi_cache_t
* cache
)
1075 (void)kmem_cache_shrink(cache
);
1079 /*******************************************************************************
1081 * FUNCTION: acpi_os_delete_cache
1083 * PARAMETERS: Cache - Handle to cache object
1087 * DESCRIPTION: Free all objects within the requested cache and delete the
1090 ******************************************************************************/
1092 acpi_status
acpi_os_delete_cache(acpi_cache_t
* cache
)
1094 (void)kmem_cache_destroy(cache
);
1098 /*******************************************************************************
1100 * FUNCTION: acpi_os_release_object
1102 * PARAMETERS: Cache - Handle to cache object
1103 * Object - The object to be released
1107 * DESCRIPTION: Release an object to the specified cache. If cache is full,
1108 * the object is deleted.
1110 ******************************************************************************/
1112 acpi_status
acpi_os_release_object(acpi_cache_t
* cache
, void *object
)
1114 kmem_cache_free(cache
, object
);
1118 /*******************************************************************************
1120 * FUNCTION: acpi_os_acquire_object
1122 * PARAMETERS: Cache - Handle to cache object
1123 * ReturnObject - Where the object is returned
1127 * DESCRIPTION: Return a zero-filled object.
1129 ******************************************************************************/
1131 void *acpi_os_acquire_object(acpi_cache_t
* cache
)
1133 void *object
= kmem_cache_zalloc(cache
, GFP_KERNEL
);
1138 /******************************************************************************
1140 * FUNCTION: acpi_os_validate_interface
1142 * PARAMETERS: interface - Requested interface to be validated
1144 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1146 * DESCRIPTION: Match an interface string to the interfaces supported by the
1147 * host. Strings originate from an AML call to the _OSI method.
1149 *****************************************************************************/
1152 acpi_os_validate_interface (char *interface
)
1159 /******************************************************************************
1161 * FUNCTION: acpi_os_validate_address
1163 * PARAMETERS: space_id - ACPI space ID
1164 * address - Physical address
1165 * length - Address length
1167 * RETURN: AE_OK if address/length is valid for the space_id. Otherwise,
1168 * should return AE_AML_ILLEGAL_ADDRESS.
1170 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1171 * the addresses accessed by AML operation regions.
1173 *****************************************************************************/
1176 acpi_os_validate_address (
1178 acpi_physical_address address
,