0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __ACLINUX_H__
0011 #define __ACLINUX_H__
0012
0013 #ifdef __KERNEL__
0014
0015
0016
0017 #if !defined(BUILDING_ACPICA) && !defined(_LINUX_ACPI_H)
0018 #error "Please don't include <acpi/acpi.h> directly, include <linux/acpi.h> instead."
0019 #endif
0020
0021 #endif
0022
0023
0024
0025 #define ACPI_USE_SYSTEM_CLIBRARY
0026 #define ACPI_USE_DO_WHILE_0
0027 #define ACPI_IGNORE_PACKAGE_RESOLUTION_ERRORS
0028
0029 #ifdef __KERNEL__
0030
0031 #define ACPI_USE_SYSTEM_INTTYPES
0032 #define ACPI_USE_GPE_POLLING
0033
0034
0035
0036 #ifdef CONFIG_PCI
0037 #define ACPI_PCI_CONFIGURED
0038 #endif
0039
0040 #ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
0041 #define ACPI_REDUCED_HARDWARE 1
0042 #endif
0043
0044 #ifdef CONFIG_ACPI_DEBUGGER
0045 #define ACPI_DEBUGGER
0046 #endif
0047
0048 #ifdef CONFIG_ACPI_DEBUG
0049 #define ACPI_MUTEX_DEBUG
0050 #endif
0051
0052 #include <linux/string.h>
0053 #include <linux/kernel.h>
0054 #include <linux/ctype.h>
0055 #include <linux/sched.h>
0056 #include <linux/atomic.h>
0057 #include <linux/math64.h>
0058 #include <linux/slab.h>
0059 #include <linux/spinlock_types.h>
0060 #ifdef EXPORT_ACPI_INTERFACES
0061 #include <linux/export.h>
0062 #endif
0063 #ifdef CONFIG_ACPI
0064 #include <asm/acenv.h>
0065 #endif
0066
0067 #define ACPI_INIT_FUNCTION __init
0068
0069
0070
0071 #undef ACPI_DEBUG_DEFAULT
0072 #define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR)
0073
0074 #ifndef CONFIG_ACPI
0075
0076
0077
0078 #define ACPI_GLOBAL(t,a)
0079 #define ACPI_INIT_GLOBAL(t,a,b)
0080
0081
0082
0083 #define ACPI_NO_MEM_ALLOCATIONS
0084
0085
0086
0087 #define ACPI_NO_ERROR_MESSAGES
0088 #undef ACPI_DEBUG_OUTPUT
0089
0090
0091
0092 #define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
0093 static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
0094 #define ACPI_EXTERNAL_RETURN_OK(prototype) \
0095 static ACPI_INLINE prototype {return(AE_OK);}
0096 #define ACPI_EXTERNAL_RETURN_VOID(prototype) \
0097 static ACPI_INLINE prototype {return;}
0098 #define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
0099 static ACPI_INLINE prototype {return(0);}
0100 #define ACPI_EXTERNAL_RETURN_PTR(prototype) \
0101 static ACPI_INLINE prototype {return(NULL);}
0102
0103 #endif
0104
0105
0106
0107 #define ACPI_MACHINE_WIDTH BITS_PER_LONG
0108 #define ACPI_USE_NATIVE_MATH64
0109 #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
0110 #define strtoul simple_strtoul
0111
0112 #define acpi_cache_t struct kmem_cache
0113 #define acpi_spinlock spinlock_t *
0114 #define acpi_raw_spinlock raw_spinlock_t *
0115 #define acpi_cpu_flags unsigned long
0116
0117 #define acpi_uintptr_t uintptr_t
0118
0119 #define ACPI_TO_INTEGER(p) ((uintptr_t)(p))
0120 #define ACPI_OFFSET(d, f) offsetof(d, f)
0121
0122
0123
0124 #define USE_NATIVE_ALLOCATE_ZEROED
0125
0126
0127
0128 #define ACPI_GPE_USE_LOGICAL_ADDRESSES
0129
0130
0131
0132
0133 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
0134 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
0135 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
0136 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
0137 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
0138 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
0139 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
0140 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
0141 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_raw_lock
0142 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_raw_lock
0143 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_raw_lock
0144 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_raw_lock
0145
0146
0147
0148
0149 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
0150 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
0151 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize_debugger
0152 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate_debugger
0153
0154
0155
0156
0157 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
0158 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
0159 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
0160 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
0161 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
0162 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
0163 #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
0164
0165 #define ACPI_MSG_ERROR KERN_ERR "ACPI Error: "
0166 #define ACPI_MSG_EXCEPTION KERN_ERR "ACPI Exception: "
0167 #define ACPI_MSG_WARNING KERN_WARNING "ACPI Warning: "
0168 #define ACPI_MSG_INFO KERN_INFO "ACPI: "
0169
0170 #define ACPI_MSG_BIOS_ERROR KERN_ERR "ACPI BIOS Error (bug): "
0171 #define ACPI_MSG_BIOS_WARNING KERN_WARNING "ACPI BIOS Warning (bug): "
0172
0173
0174
0175
0176 #define ACPI_STRUCT_INIT(field, value) .field = value
0177
0178 #else
0179
0180 #define ACPI_USE_STANDARD_HEADERS
0181
0182 #ifdef ACPI_USE_STANDARD_HEADERS
0183 #include <unistd.h>
0184 #endif
0185
0186
0187
0188 #ifndef __init
0189 #define __init
0190 #endif
0191 #ifndef __iomem
0192 #define __iomem
0193 #endif
0194
0195
0196
0197 #define ACPI_FLUSH_CPU_CACHE()
0198 #define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread))
0199
0200 #if defined(__ia64__) || (defined(__x86_64__) && !defined(__ILP32__)) ||\
0201 defined(__aarch64__) || defined(__PPC64__) ||\
0202 defined(__s390x__) ||\
0203 (defined(__riscv) && (defined(__LP64__) || defined(_LP64)))
0204 #define ACPI_MACHINE_WIDTH 64
0205 #define COMPILER_DEPENDENT_INT64 long
0206 #define COMPILER_DEPENDENT_UINT64 unsigned long
0207 #else
0208 #define ACPI_MACHINE_WIDTH 32
0209 #define COMPILER_DEPENDENT_INT64 long long
0210 #define COMPILER_DEPENDENT_UINT64 unsigned long long
0211 #define ACPI_USE_NATIVE_DIVIDE
0212 #define ACPI_USE_NATIVE_MATH64
0213 #endif
0214
0215 #ifndef __cdecl
0216 #define __cdecl
0217 #endif
0218
0219 #endif
0220
0221 #endif