aclinux.h (26f3cdf0) | aclinux.h (7b1019a6) |
---|---|
1/****************************************************************************** 2 * 3 * Name: aclinux.h - OS specific defines, etc. for Linux 4 * 5 *****************************************************************************/ 6 7/* | 1/****************************************************************************** 2 * 3 * Name: aclinux.h - OS specific defines, etc. for Linux 4 * 5 *****************************************************************************/ 6 7/* |
8 * Copyright (C) 2000 - 2011, Intel Corp. | 8 * Copyright (C) 2000 - 2016, Intel Corp. |
9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. --- 22 unchanged lines hidden (view full) --- 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44#ifndef __ACLINUX_H__ 45#define __ACLINUX_H__ 46 | 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. --- 22 unchanged lines hidden (view full) --- 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44#ifndef __ACLINUX_H__ 45#define __ACLINUX_H__ 46 |
47#ifdef __KERNEL__ 48 49/* ACPICA external files should not include ACPICA headers directly. */ 50 51#if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H) 52#error "Please don't include <acpi/acpi.h> directly, include <linux/acpi.h> instead." 53#endif 54 55#endif 56 |
|
47/* Common (in-kernel/user-space) ACPICA configuration */ 48 49#define ACPI_USE_SYSTEM_CLIBRARY 50#define ACPI_USE_DO_WHILE_0 | 57/* Common (in-kernel/user-space) ACPICA configuration */ 58 59#define ACPI_USE_SYSTEM_CLIBRARY 60#define ACPI_USE_DO_WHILE_0 |
51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE | |
52 53 54#ifdef __KERNEL__ 55 | 61 62 63#ifdef __KERNEL__ 64 |
65#define ACPI_USE_SYSTEM_INTTYPES 66 67/* Kernel specific ACPICA configuration */ 68 69#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY 70#define ACPI_REDUCED_HARDWARE 1 71#endif 72 73#ifdef CONFIG_ACPI_DEBUGGER 74#define ACPI_DEBUGGER 75#endif 76 |
|
56#include <linux/string.h> 57#include <linux/kernel.h> | 77#include <linux/string.h> 78#include <linux/kernel.h> |
58#include <linux/module.h> | |
59#include <linux/ctype.h> 60#include <linux/sched.h> | 79#include <linux/ctype.h> 80#include <linux/sched.h> |
61#include <asm/system.h> 62#include <asm/atomic.h> 63#include <asm/div64.h> 64#include <asm/acpi.h> | 81#include <linux/atomic.h> 82#include <linux/math64.h> |
65#include <linux/slab.h> 66#include <linux/spinlock_types.h> | 83#include <linux/slab.h> 84#include <linux/spinlock_types.h> |
67#include <asm/current.h> | 85#ifdef EXPORT_ACPI_INTERFACES 86#include <linux/export.h> 87#endif 88#ifdef CONFIG_ACPI 89#include <asm/acenv.h> 90#endif |
68 | 91 |
92#ifndef CONFIG_ACPI 93 94/* External globals for __KERNEL__, stubs is needed */ 95 96#define ACPI_GLOBAL(t,a) 97#define ACPI_INIT_GLOBAL(t,a,b) 98 99/* Generating stubs for configurable ACPICA macros */ 100 101#define ACPI_NO_MEM_ALLOCATIONS 102 103/* Generating stubs for configurable ACPICA functions */ 104 105#define ACPI_NO_ERROR_MESSAGES 106#undef ACPI_DEBUG_OUTPUT 107 108/* External interface for __KERNEL__, stub is needed */ 109 110#define ACPI_EXTERNAL_RETURN_STATUS(Prototype) \ 111 static ACPI_INLINE Prototype {return(AE_NOT_CONFIGURED);} 112#define ACPI_EXTERNAL_RETURN_OK(Prototype) \ 113 static ACPI_INLINE Prototype {return(AE_OK);} 114#define ACPI_EXTERNAL_RETURN_VOID(Prototype) \ 115 static ACPI_INLINE Prototype {return;} 116#define ACPI_EXTERNAL_RETURN_UINT32(Prototype) \ 117 static ACPI_INLINE Prototype {return(0);} 118#define ACPI_EXTERNAL_RETURN_PTR(Prototype) \ 119 static ACPI_INLINE Prototype {return(NULL);} 120 121#endif /* CONFIG_ACPI */ 122 |
|
69/* Host-dependent types and defines for in-kernel ACPICA */ 70 71#define ACPI_MACHINE_WIDTH BITS_PER_LONG 72#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 73#define strtoul simple_strtoul 74 75#define ACPI_CACHE_T struct kmem_cache 76#define ACPI_SPINLOCK spinlock_t * 77#define ACPI_CPU_FLAGS unsigned long 78 | 123/* Host-dependent types and defines for in-kernel ACPICA */ 124 125#define ACPI_MACHINE_WIDTH BITS_PER_LONG 126#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 127#define strtoul simple_strtoul 128 129#define ACPI_CACHE_T struct kmem_cache 130#define ACPI_SPINLOCK spinlock_t * 131#define ACPI_CPU_FLAGS unsigned long 132 |
133/* Use native linux version of AcpiOsAllocateZeroed */ 134 135#define USE_NATIVE_ALLOCATE_ZEROED 136 137/* 138 * Overrides for in-kernel ACPICA 139 */ 140#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize 141#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate 142#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate 143#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed 144#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree 145#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject 146#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId 147#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock 148 149/* 150 * OSL interfaces used by debugger/disassembler 151 */ 152#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable 153#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable 154 155/* 156 * OSL interfaces used by utilities 157 */ 158#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput 159#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName 160#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex 161#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress 162#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory 163#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename 164#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory 165 166#define ACPI_MSG_ERROR KERN_ERR "ACPI Error: " 167#define ACPI_MSG_EXCEPTION KERN_ERR "ACPI Exception: " 168#define ACPI_MSG_WARNING KERN_WARNING "ACPI Warning: " 169#define ACPI_MSG_INFO KERN_INFO "ACPI: " 170 171#define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): " 172#define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): " 173 |
|
79#else /* !__KERNEL__ */ 80 81#include <stdarg.h> 82#include <string.h> 83#include <stdlib.h> 84#include <ctype.h> 85#include <unistd.h> 86 | 174#else /* !__KERNEL__ */ 175 176#include <stdarg.h> 177#include <string.h> 178#include <stdlib.h> 179#include <ctype.h> 180#include <unistd.h> 181 |
182/* Define/disable kernel-specific declarators */ 183 184#ifndef __init 185#define __init 186#endif 187 |
|
87/* Host-dependent types and defines for user-space ACPICA */ 88 89#define ACPI_FLUSH_CPU_CACHE() | 188/* Host-dependent types and defines for user-space ACPICA */ 189 190#define ACPI_FLUSH_CPU_CACHE() |
90#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread)) | 191#define ACPI_CAST_PTHREAD_T(Pthread) ((ACPI_THREAD_ID) (Pthread)) |
91 | 192 |
92#if defined(__ia64__) || defined(__x86_64__) | 193#if defined(__ia64__) || defined(__x86_64__) ||\ 194 defined(__aarch64__) || defined(__PPC64__) |
93#define ACPI_MACHINE_WIDTH 64 94#define COMPILER_DEPENDENT_INT64 long 95#define COMPILER_DEPENDENT_UINT64 unsigned long 96#else 97#define ACPI_MACHINE_WIDTH 32 98#define COMPILER_DEPENDENT_INT64 long long 99#define COMPILER_DEPENDENT_UINT64 unsigned long long 100#define ACPI_USE_NATIVE_DIVIDE --- 4 unchanged lines hidden (view full) --- 105#endif 106 107#endif /* __KERNEL__ */ 108 109/* Linux uses GCC */ 110 111#include "acgcc.h" 112 | 195#define ACPI_MACHINE_WIDTH 64 196#define COMPILER_DEPENDENT_INT64 long 197#define COMPILER_DEPENDENT_UINT64 unsigned long 198#else 199#define ACPI_MACHINE_WIDTH 32 200#define COMPILER_DEPENDENT_INT64 long long 201#define COMPILER_DEPENDENT_UINT64 unsigned long long 202#define ACPI_USE_NATIVE_DIVIDE --- 4 unchanged lines hidden (view full) --- 207#endif 208 209#endif /* __KERNEL__ */ 210 211/* Linux uses GCC */ 212 213#include "acgcc.h" 214 |
113 114#ifdef __KERNEL__ 115/* 116 * Overrides for in-kernel ACPICA 117 */ 118static inline acpi_thread_id acpi_os_get_thread_id(void) 119{ 120 return current; 121} 122 123/* 124 * The irqs_disabled() check is for resume from RAM. 125 * Interrupts are off during resume, just like they are for boot. 126 * However, boot has (system_state != SYSTEM_RUNNING) 127 * to quiet __might_sleep() in kmalloc() and resume does not. 128 */ 129#include <acpi/actypes.h> 130static inline void *acpi_os_allocate(acpi_size size) 131{ 132 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 133} 134 135static inline void *acpi_os_allocate_zeroed(acpi_size size) 136{ 137 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 138} 139 140static inline void *acpi_os_acquire_object(acpi_cache_t * cache) 141{ 142 return kmem_cache_zalloc(cache, 143 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); 144} 145 146#define ACPI_ALLOCATE(a) acpi_os_allocate(a) 147#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 148#define ACPI_FREE(a) kfree(a) 149 150/* Used within ACPICA to show where it is safe to preempt execution */ 151 152#define ACPI_PREEMPTION_POINT() \ 153 do { \ 154 if (!irqs_disabled()) \ 155 cond_resched(); \ 156 } while (0) 157 158#endif /* __KERNEL__ */ 159 | |
160#endif /* __ACLINUX_H__ */ | 215#endif /* __ACLINUX_H__ */ |