staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / include / acpi / acpiosxf.h
blob1b59fb61f67d503725fb40d78763173ded00e412
1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /******************************************************************************
4 * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
5 * interfaces must be implemented by OSL to interface the
6 * ACPI components to the host operating system.
8 * Copyright (C) 2000 - 2019, Intel Corp.
10 *****************************************************************************/
12 #ifndef __ACPIOSXF_H__
13 #define __ACPIOSXF_H__
15 #include <acpi/platform/acenv.h>
16 #include <acpi/actypes.h>
18 /* Types for acpi_os_execute */
20 typedef enum {
21 OSL_GLOBAL_LOCK_HANDLER,
22 OSL_NOTIFY_HANDLER,
23 OSL_GPE_HANDLER,
24 OSL_DEBUGGER_MAIN_THREAD,
25 OSL_DEBUGGER_EXEC_THREAD,
26 OSL_EC_POLL_HANDLER,
27 OSL_EC_BURST_HANDLER
28 } acpi_execute_type;
30 #define ACPI_NO_UNIT_LIMIT ((u32) -1)
31 #define ACPI_MUTEX_SEM 1
33 /* Functions for acpi_os_signal */
35 #define ACPI_SIGNAL_FATAL 0
36 #define ACPI_SIGNAL_BREAKPOINT 1
38 struct acpi_signal_fatal_info {
39 u32 type;
40 u32 code;
41 u32 argument;
45 * OSL Initialization and shutdown primitives
47 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
48 acpi_status acpi_os_initialize(void);
49 #endif
51 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
52 acpi_status acpi_os_terminate(void);
53 #endif
56 * ACPI Table interfaces
58 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_root_pointer
59 acpi_physical_address acpi_os_get_root_pointer(void);
60 #endif
62 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
63 acpi_status
64 acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
65 acpi_string *new_val);
66 #endif
68 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
69 acpi_status
70 acpi_os_table_override(struct acpi_table_header *existing_table,
71 struct acpi_table_header **new_table);
72 #endif
74 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override
75 acpi_status
76 acpi_os_physical_table_override(struct acpi_table_header *existing_table,
77 acpi_physical_address *new_address,
78 u32 *new_table_length);
79 #endif
82 * Spinlock primitives
84 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
85 acpi_status acpi_os_create_lock(acpi_spinlock * out_handle);
86 #endif
88 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_lock
89 void acpi_os_delete_lock(acpi_spinlock handle);
90 #endif
92 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_lock
93 acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle);
94 #endif
96 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_lock
97 void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags);
98 #endif
101 * RAW spinlock primitives. If the OS does not provide them, fallback to
102 * spinlock primitives
104 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_raw_lock
105 # define acpi_os_create_raw_lock(out_handle) acpi_os_create_lock(out_handle)
106 #endif
108 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_raw_lock
109 # define acpi_os_delete_raw_lock(handle) acpi_os_delete_lock(handle)
110 #endif
112 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_raw_lock
113 # define acpi_os_acquire_raw_lock(handle) acpi_os_acquire_lock(handle)
114 #endif
116 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_raw_lock
117 # define acpi_os_release_raw_lock(handle, flags) \
118 acpi_os_release_lock(handle, flags)
119 #endif
122 * Semaphore primitives
124 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_semaphore
125 acpi_status
126 acpi_os_create_semaphore(u32 max_units,
127 u32 initial_units, acpi_semaphore * out_handle);
128 #endif
130 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_semaphore
131 acpi_status acpi_os_delete_semaphore(acpi_semaphore handle);
132 #endif
134 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_semaphore
135 acpi_status
136 acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout);
137 #endif
139 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal_semaphore
140 acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
141 #endif
144 * Mutex primitives. May be configured to use semaphores instead via
145 * ACPI_MUTEX_TYPE (see platform/acenv.h)
147 #if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
149 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_mutex
150 acpi_status acpi_os_create_mutex(acpi_mutex * out_handle);
151 #endif
153 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_mutex
154 void acpi_os_delete_mutex(acpi_mutex handle);
155 #endif
157 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_mutex
158 acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout);
159 #endif
161 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_mutex
162 void acpi_os_release_mutex(acpi_mutex handle);
163 #endif
165 #endif
168 * Memory allocation and mapping
170 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
171 void *acpi_os_allocate(acpi_size size);
172 #endif
174 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
175 void *acpi_os_allocate_zeroed(acpi_size size);
176 #endif
178 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
179 void acpi_os_free(void *memory);
180 #endif
182 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
183 void *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
184 #endif
186 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
187 void acpi_os_unmap_memory(void *logical_address, acpi_size size);
188 #endif
190 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address
191 acpi_status
192 acpi_os_get_physical_address(void *logical_address,
193 acpi_physical_address *physical_address);
194 #endif
197 * Memory/Object Cache
199 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_cache
200 acpi_status
201 acpi_os_create_cache(char *cache_name,
202 u16 object_size,
203 u16 max_depth, acpi_cache_t ** return_cache);
204 #endif
206 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_cache
207 acpi_status acpi_os_delete_cache(acpi_cache_t * cache);
208 #endif
210 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_purge_cache
211 acpi_status acpi_os_purge_cache(acpi_cache_t * cache);
212 #endif
214 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
215 void *acpi_os_acquire_object(acpi_cache_t * cache);
216 #endif
218 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_object
219 acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
220 #endif
223 * Interrupt handlers
225 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_install_interrupt_handler
226 acpi_status
227 acpi_os_install_interrupt_handler(u32 interrupt_number,
228 acpi_osd_handler service_routine,
229 void *context);
230 #endif
232 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_remove_interrupt_handler
233 acpi_status
234 acpi_os_remove_interrupt_handler(u32 interrupt_number,
235 acpi_osd_handler service_routine);
236 #endif
239 * Threads and Scheduling
241 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
242 acpi_thread_id acpi_os_get_thread_id(void);
243 #endif
245 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_execute
246 acpi_status
247 acpi_os_execute(acpi_execute_type type,
248 acpi_osd_exec_callback function, void *context);
249 #endif
251 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete
252 void acpi_os_wait_events_complete(void);
253 #endif
255 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_sleep
256 void acpi_os_sleep(u64 milliseconds);
257 #endif
259 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_stall
260 void acpi_os_stall(u32 microseconds);
261 #endif
264 * Platform and hardware-independent I/O interfaces
266 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_port
267 acpi_status acpi_os_read_port(acpi_io_address address, u32 *value, u32 width);
268 #endif
270 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_port
271 acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
272 #endif
275 * Platform and hardware-independent physical memory interfaces
277 int acpi_os_read_iomem(void __iomem *virt_addr, u64 *value, u32 width);
279 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_memory
280 acpi_status
281 acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width);
282 #endif
284 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_memory
285 acpi_status
286 acpi_os_write_memory(acpi_physical_address address, u64 value, u32 width);
287 #endif
290 * Platform and hardware-independent PCI configuration space access
291 * Note: Can't use "Register" as a parameter, changed to "Reg" --
292 * certain compilers complain.
294 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_pci_configuration
295 acpi_status
296 acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
297 u32 reg, u64 *value, u32 width);
298 #endif
300 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_pci_configuration
301 acpi_status
302 acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
303 u32 reg, u64 value, u32 width);
304 #endif
307 * Miscellaneous
309 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
310 u8 acpi_os_readable(void *pointer, acpi_size length);
311 #endif
313 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
314 u8 acpi_os_writable(void *pointer, acpi_size length);
315 #endif
317 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_timer
318 u64 acpi_os_get_timer(void);
319 #endif
321 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal
322 acpi_status acpi_os_signal(u32 function, void *info);
323 #endif
325 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_enter_sleep
326 acpi_status acpi_os_enter_sleep(u8 sleep_state, u32 rega_value, u32 regb_value);
327 #endif
330 * Debug print routines
332 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_printf
333 void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...);
334 #endif
336 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_vprintf
337 void acpi_os_vprintf(const char *format, va_list args);
338 #endif
340 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
341 void acpi_os_redirect_output(void *destination);
342 #endif
345 * Debug IO
347 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
348 acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read);
349 #endif
351 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize_debugger
352 acpi_status acpi_os_initialize_debugger(void);
353 #endif
355 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate_debugger
356 void acpi_os_terminate_debugger(void);
357 #endif
359 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_command_ready
360 acpi_status acpi_os_wait_command_ready(void);
361 #endif
363 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_notify_command_complete
364 acpi_status acpi_os_notify_command_complete(void);
365 #endif
367 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_trace_point
368 void
369 acpi_os_trace_point(acpi_trace_event_type type,
370 u8 begin, u8 *aml, char *pathname);
371 #endif
374 * Obtain ACPI table(s)
376 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
377 acpi_status
378 acpi_os_get_table_by_name(char *signature,
379 u32 instance,
380 struct acpi_table_header **table,
381 acpi_physical_address *address);
382 #endif
384 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
385 acpi_status
386 acpi_os_get_table_by_index(u32 index,
387 struct acpi_table_header **table,
388 u32 *instance, acpi_physical_address *address);
389 #endif
391 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
392 acpi_status
393 acpi_os_get_table_by_address(acpi_physical_address address,
394 struct acpi_table_header **table);
395 #endif
398 * Directory manipulation
400 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
401 void *acpi_os_open_directory(char *pathname,
402 char *wildcard_spec, char requested_file_type);
403 #endif
405 /* requeste_file_type values */
407 #define REQUEST_FILE_ONLY 0
408 #define REQUEST_DIR_ONLY 1
410 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
411 char *acpi_os_get_next_filename(void *dir_handle);
412 #endif
414 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
415 void acpi_os_close_directory(void *dir_handle);
416 #endif
418 #endif /* __ACPIOSXF_H__ */