diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/acpi/acpiosxf.h | 18 | ||||
| -rw-r--r-- | include/acpi/platform/aclinux.h | 118 |
2 files changed, 91 insertions, 45 deletions
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 55165fcd77d7..01e6c6d8b7e1 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
| @@ -78,7 +78,7 @@ struct acpi_signal_fatal_info { | |||
| 78 | * OSL Initialization and shutdown primitives | 78 | * OSL Initialization and shutdown primitives |
| 79 | */ | 79 | */ |
| 80 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize | 80 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize |
| 81 | acpi_status __init acpi_os_initialize(void); | 81 | acpi_status acpi_os_initialize(void); |
| 82 | #endif | 82 | #endif |
| 83 | 83 | ||
| 84 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate | 84 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate |
| @@ -192,22 +192,18 @@ void acpi_os_free(void *memory); | |||
| 192 | #endif | 192 | #endif |
| 193 | 193 | ||
| 194 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory | 194 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory |
| 195 | void __iomem *acpi_os_map_memory(acpi_physical_address where, | 195 | void *acpi_os_map_memory(acpi_physical_address where, acpi_size length); |
| 196 | acpi_size length); | ||
| 197 | #endif | 196 | #endif |
| 198 | 197 | ||
| 199 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory | 198 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory |
| 200 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); | 199 | void acpi_os_unmap_memory(void *logical_address, acpi_size size); |
| 201 | #endif | 200 | #endif |
| 202 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); | ||
| 203 | 201 | ||
| 204 | #ifdef ACPI_FUTURE_USAGE | ||
| 205 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address | 202 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address |
| 206 | acpi_status | 203 | acpi_status |
| 207 | acpi_os_get_physical_address(void *logical_address, | 204 | acpi_os_get_physical_address(void *logical_address, |
| 208 | acpi_physical_address * physical_address); | 205 | acpi_physical_address * physical_address); |
| 209 | #endif | 206 | #endif |
| 210 | #endif | ||
| 211 | 207 | ||
| 212 | /* | 208 | /* |
| 213 | * Memory/Object Cache | 209 | * Memory/Object Cache |
| @@ -251,9 +247,6 @@ acpi_os_remove_interrupt_handler(u32 interrupt_number, | |||
| 251 | acpi_osd_handler service_routine); | 247 | acpi_osd_handler service_routine); |
| 252 | #endif | 248 | #endif |
| 253 | 249 | ||
| 254 | void acpi_os_gpe_count(u32 gpe_number); | ||
| 255 | void acpi_os_fixed_event_count(u32 fixed_event_number); | ||
| 256 | |||
| 257 | /* | 250 | /* |
| 258 | * Threads and Scheduling | 251 | * Threads and Scheduling |
| 259 | */ | 252 | */ |
| @@ -267,9 +260,6 @@ acpi_os_execute(acpi_execute_type type, | |||
| 267 | acpi_osd_exec_callback function, void *context); | 260 | acpi_osd_exec_callback function, void *context); |
| 268 | #endif | 261 | #endif |
| 269 | 262 | ||
| 270 | acpi_status | ||
| 271 | acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context); | ||
| 272 | |||
| 273 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete | 263 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete |
| 274 | void acpi_os_wait_events_complete(void); | 264 | void acpi_os_wait_events_complete(void); |
| 275 | #endif | 265 | #endif |
| @@ -357,14 +347,12 @@ void acpi_os_vprintf(const char *format, va_list args); | |||
| 357 | void acpi_os_redirect_output(void *destination); | 347 | void acpi_os_redirect_output(void *destination); |
| 358 | #endif | 348 | #endif |
| 359 | 349 | ||
| 360 | #ifdef ACPI_FUTURE_USAGE | ||
| 361 | /* | 350 | /* |
| 362 | * Debug input | 351 | * Debug input |
| 363 | */ | 352 | */ |
| 364 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line | 353 | #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line |
| 365 | acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read); | 354 | acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read); |
| 366 | #endif | 355 | #endif |
| 367 | #endif | ||
| 368 | 356 | ||
| 369 | /* | 357 | /* |
| 370 | * Obtain ACPI table(s) | 358 | * Obtain ACPI table(s) |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 04e87a3b8086..ab57930794a5 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
| @@ -50,7 +50,6 @@ | |||
| 50 | #define ACPI_USE_DO_WHILE_0 | 50 | #define ACPI_USE_DO_WHILE_0 |
| 51 | #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE | 51 | #define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE |
| 52 | 52 | ||
| 53 | |||
| 54 | #ifdef __KERNEL__ | 53 | #ifdef __KERNEL__ |
| 55 | 54 | ||
| 56 | #include <linux/string.h> | 55 | #include <linux/string.h> |
| @@ -58,11 +57,13 @@ | |||
| 58 | #include <linux/ctype.h> | 57 | #include <linux/ctype.h> |
| 59 | #include <linux/sched.h> | 58 | #include <linux/sched.h> |
| 60 | #include <linux/atomic.h> | 59 | #include <linux/atomic.h> |
| 61 | #include <asm/div64.h> | 60 | #include <linux/math64.h> |
| 62 | #include <asm/acpi.h> | ||
| 63 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
| 64 | #include <linux/spinlock_types.h> | 62 | #include <linux/spinlock_types.h> |
| 65 | #include <asm/current.h> | 63 | #ifdef EXPORT_ACPI_INTERFACES |
| 64 | #include <linux/export.h> | ||
| 65 | #endif | ||
| 66 | #include <asm/acpi.h> | ||
| 66 | 67 | ||
| 67 | /* Host-dependent types and defines for in-kernel ACPICA */ | 68 | /* Host-dependent types and defines for in-kernel ACPICA */ |
| 68 | 69 | ||
| @@ -109,23 +110,29 @@ | |||
| 109 | #include <acpi/platform/acgcc.h> | 110 | #include <acpi/platform/acgcc.h> |
| 110 | 111 | ||
| 111 | #ifdef __KERNEL__ | 112 | #ifdef __KERNEL__ |
| 113 | |||
| 114 | /* | ||
| 115 | * FIXME: Inclusion of actypes.h | ||
| 116 | * Linux kernel need this before defining inline OSL interfaces as | ||
| 117 | * actypes.h need to be included to find ACPICA type definitions. | ||
| 118 | * Since from ACPICA's perspective, the actypes.h should be included after | ||
| 119 | * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue. | ||
| 120 | */ | ||
| 112 | #include <acpi/actypes.h> | 121 | #include <acpi/actypes.h> |
| 122 | |||
| 113 | /* | 123 | /* |
| 114 | * Overrides for in-kernel ACPICA | 124 | * Overrides for in-kernel ACPICA |
| 115 | */ | 125 | */ |
| 116 | static inline acpi_thread_id acpi_os_get_thread_id(void) | 126 | acpi_status __init acpi_os_initialize(void); |
| 117 | { | 127 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize |
| 118 | return (acpi_thread_id)(unsigned long)current; | 128 | |
| 119 | } | 129 | acpi_status acpi_os_terminate(void); |
| 130 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate | ||
| 120 | 131 | ||
| 121 | /* | 132 | /* |
| 122 | * Memory allocation/deallocation | 133 | * Memory allocation/deallocation |
| 123 | */ | 134 | */ |
| 124 | 135 | ||
| 125 | /* Use native linux version of acpi_os_allocate_zeroed */ | ||
| 126 | |||
| 127 | #define USE_NATIVE_ALLOCATE_ZEROED | ||
| 128 | |||
| 129 | /* | 136 | /* |
| 130 | * The irqs_disabled() check is for resume from RAM. | 137 | * The irqs_disabled() check is for resume from RAM. |
| 131 | * Interrupts are off during resume, just like they are for boot. | 138 | * Interrupts are off during resume, just like they are for boot. |
| @@ -134,26 +141,45 @@ static inline acpi_thread_id acpi_os_get_thread_id(void) | |||
| 134 | */ | 141 | */ |
| 135 | static inline void *acpi_os_allocate(acpi_size size) | 142 | static inline void *acpi_os_allocate(acpi_size size) |
| 136 | { | 143 | { |
| 137 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); | 144 | return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); |
| 138 | } | 145 | } |
| 139 | 146 | ||
| 147 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate | ||
| 148 | |||
| 149 | /* Use native linux version of acpi_os_allocate_zeroed */ | ||
| 150 | |||
| 140 | static inline void *acpi_os_allocate_zeroed(acpi_size size) | 151 | static inline void *acpi_os_allocate_zeroed(acpi_size size) |
| 141 | { | 152 | { |
| 142 | return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); | 153 | return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); |
| 154 | } | ||
| 155 | |||
| 156 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed | ||
| 157 | #define USE_NATIVE_ALLOCATE_ZEROED | ||
| 158 | |||
| 159 | static inline void acpi_os_free(void *memory) | ||
| 160 | { | ||
| 161 | kfree(memory); | ||
| 143 | } | 162 | } |
| 144 | 163 | ||
| 164 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free | ||
| 165 | |||
| 145 | static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | 166 | static inline void *acpi_os_acquire_object(acpi_cache_t * cache) |
| 146 | { | 167 | { |
| 147 | return kmem_cache_zalloc(cache, | 168 | return kmem_cache_zalloc(cache, |
| 148 | irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); | 169 | irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); |
| 149 | } | 170 | } |
| 150 | 171 | ||
| 151 | static inline void acpi_os_free(void *a) | 172 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object |
| 173 | |||
| 174 | static inline acpi_thread_id acpi_os_get_thread_id(void) | ||
| 152 | { | 175 | { |
| 153 | kfree(a); | 176 | return (acpi_thread_id) (unsigned long)current; |
| 154 | } | 177 | } |
| 155 | 178 | ||
| 179 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id | ||
| 180 | |||
| 156 | #ifndef CONFIG_PREEMPT | 181 | #ifndef CONFIG_PREEMPT |
| 182 | |||
| 157 | /* | 183 | /* |
| 158 | * Used within ACPICA to show where it is safe to preempt execution | 184 | * Used within ACPICA to show where it is safe to preempt execution |
| 159 | * when CONFIG_PREEMPT=n | 185 | * when CONFIG_PREEMPT=n |
| @@ -163,6 +189,7 @@ static inline void acpi_os_free(void *a) | |||
| 163 | if (!irqs_disabled()) \ | 189 | if (!irqs_disabled()) \ |
| 164 | cond_resched(); \ | 190 | cond_resched(); \ |
| 165 | } while (0) | 191 | } while (0) |
| 192 | |||
| 166 | #endif | 193 | #endif |
| 167 | 194 | ||
| 168 | /* | 195 | /* |
| @@ -172,21 +199,52 @@ static inline void acpi_os_free(void *a) | |||
| 172 | * all locks to the name of the argument of acpi_os_create_lock(), which | 199 | * all locks to the name of the argument of acpi_os_create_lock(), which |
| 173 | * prevents lockdep from reporting false positives for ACPICA locks. | 200 | * prevents lockdep from reporting false positives for ACPICA locks. |
| 174 | */ | 201 | */ |
| 175 | #define acpi_os_create_lock(__handle) \ | 202 | #define acpi_os_create_lock(__handle) \ |
| 176 | ({ \ | 203 | ({ \ |
| 177 | spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ | 204 | spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \ |
| 178 | \ | 205 | if (lock) { \ |
| 179 | if (lock) { \ | 206 | *(__handle) = lock; \ |
| 180 | *(__handle) = lock; \ | 207 | spin_lock_init(*(__handle)); \ |
| 181 | spin_lock_init(*(__handle)); \ | 208 | } \ |
| 182 | } \ | 209 | lock ? AE_OK : AE_NO_MEMORY; \ |
| 183 | lock ? AE_OK : AE_NO_MEMORY; \ | 210 | }) |
| 184 | }) | ||
| 185 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock | 211 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock |
| 186 | 212 | ||
| 187 | #ifdef EXPORT_ACPI_INTERFACES | 213 | void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length); |
| 188 | #include <linux/export.h> | 214 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory |
| 189 | #endif | 215 | |
| 216 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); | ||
| 217 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory | ||
| 218 | |||
| 219 | /* | ||
| 220 | * OSL interfaces used by debugger/disassembler | ||
| 221 | */ | ||
| 222 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable | ||
| 223 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable | ||
| 224 | |||
| 225 | /* | ||
| 226 | * OSL interfaces used by utilities | ||
| 227 | */ | ||
| 228 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output | ||
| 229 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line | ||
| 230 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name | ||
| 231 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index | ||
| 232 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address | ||
| 233 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory | ||
| 234 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename | ||
| 235 | #define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory | ||
| 236 | |||
| 237 | /* | ||
| 238 | * OSL interfaces added by Linux | ||
| 239 | */ | ||
| 240 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); | ||
| 241 | |||
| 242 | void acpi_os_gpe_count(u32 gpe_number); | ||
| 243 | |||
| 244 | void acpi_os_fixed_event_count(u32 fixed_event_number); | ||
| 245 | |||
| 246 | acpi_status | ||
| 247 | acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context); | ||
| 190 | 248 | ||
| 191 | #endif /* __KERNEL__ */ | 249 | #endif /* __KERNEL__ */ |
| 192 | 250 | ||
