blob: 690c369b717ad108918441ad8add5aabb0fd58f2 [file] [log] [blame]
Erik Schmauss95857632018-03-14 16:13:07 -07001/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/******************************************************************************
3 *
Bob Mooreabf95c32012-10-31 02:27:04 +00004 * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 * interfaces must be implemented by OSL to interface the
6 * ACPI components to the host operating system.
7 *
Bob Moore4441e552021-01-15 10:48:25 -08008 * Copyright (C) 2000 - 2021, Intel Corp.
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 *
Erik Schmauss95857632018-03-14 16:13:07 -070010 *****************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
12#ifndef __ACPIOSXF_H__
13#define __ACPIOSXF_H__
14
David Howellsa1ce3922012-10-02 18:01:25 +010015#include <acpi/platform/acenv.h>
16#include <acpi/actypes.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Bob Moore958dd242006-05-12 17:12:00 -040018/* Types for acpi_os_execute */
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Bob Moore958dd242006-05-12 17:12:00 -040020typedef enum {
21 OSL_GLOBAL_LOCK_HANDLER,
22 OSL_NOTIFY_HANDLER,
23 OSL_GPE_HANDLER,
Lv Zhengf988f242015-10-19 10:25:50 +080024 OSL_DEBUGGER_MAIN_THREAD,
25 OSL_DEBUGGER_EXEC_THREAD,
Bob Moore958dd242006-05-12 17:12:00 -040026 OSL_EC_POLL_HANDLER,
Bob Moore41195322006-05-26 16:36:00 -040027 OSL_EC_BURST_HANDLER
Bob Moore958dd242006-05-12 17:12:00 -040028} acpi_execute_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30#define ACPI_NO_UNIT_LIMIT ((u32) -1)
31#define ACPI_MUTEX_SEM 1
32
Linus Torvalds1da177e2005-04-16 15:20:36 -070033/* Functions for acpi_os_signal */
34
35#define ACPI_SIGNAL_FATAL 0
36#define ACPI_SIGNAL_BREAKPOINT 1
37
Len Brown4be44fc2005-08-05 00:44:28 -040038struct acpi_signal_fatal_info {
39 u32 type;
40 u32 code;
41 u32 argument;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042};
43
Linus Torvalds1da177e2005-04-16 15:20:36 -070044/*
45 * OSL Initialization and shutdown primitives
46 */
Lv Zheng7e94632f2013-10-29 09:30:35 +080047#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
Lv Zheng93220582013-10-29 09:30:41 +080048acpi_status acpi_os_initialize(void);
Lv Zheng7e94632f2013-10-29 09:30:35 +080049#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Lv Zheng7e94632f2013-10-29 09:30:35 +080051#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
Len Brown4be44fc2005-08-05 00:44:28 -040052acpi_status acpi_os_terminate(void);
Lv Zheng7e94632f2013-10-29 09:30:35 +080053#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55/*
56 * ACPI Table interfaces
57 */
Lv Zheng7e94632f2013-10-29 09:30:35 +080058#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_root_pointer
Bob Mooref3d2e782007-02-02 19:48:18 +030059acpi_physical_address acpi_os_get_root_pointer(void);
Lv Zheng7e94632f2013-10-29 09:30:35 +080060#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Lv Zheng7e94632f2013-10-29 09:30:35 +080062#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
Linus Torvalds1da177e2005-04-16 15:20:36 -070063acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -040064acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
Lv Zheng80b28812016-03-24 09:38:28 +080065 acpi_string *new_val);
Lv Zheng7e94632f2013-10-29 09:30:35 +080066#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Lv Zheng7e94632f2013-10-29 09:30:35 +080068#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
Linus Torvalds1da177e2005-04-16 15:20:36 -070069acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -040070acpi_os_table_override(struct acpi_table_header *existing_table,
71 struct acpi_table_header **new_table);
Lv Zheng7e94632f2013-10-29 09:30:35 +080072#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Lv Zheng7e94632f2013-10-29 09:30:35 +080074#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override
Bob Mooref7b004a2012-02-14 18:31:56 +080075acpi_status
76acpi_os_physical_table_override(struct acpi_table_header *existing_table,
Lv Zhengf5c1e1c2016-05-05 12:57:53 +080077 acpi_physical_address *new_address,
Bob Mooref7b004a2012-02-14 18:31:56 +080078 u32 *new_table_length);
Lv Zheng7e94632f2013-10-29 09:30:35 +080079#endif
Bob Mooref7b004a2012-02-14 18:31:56 +080080
Linus Torvalds1da177e2005-04-16 15:20:36 -070081/*
Bob Moore967440e32006-06-23 17:04:00 -040082 * Spinlock primitives
83 */
Lv Zheng7e94632f2013-10-29 09:30:35 +080084#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
Lv Zheng3e8214e2012-12-19 05:37:15 +000085acpi_status acpi_os_create_lock(acpi_spinlock * out_handle);
Rafael J. Wysocki07e49a72011-07-06 20:44:25 +020086#endif
Lin Ming9f63b882011-03-23 17:26:34 +080087
Lv Zheng7e94632f2013-10-29 09:30:35 +080088#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_lock
Bob Moore967440e32006-06-23 17:04:00 -040089void acpi_os_delete_lock(acpi_spinlock handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +080090#endif
Bob Moore967440e32006-06-23 17:04:00 -040091
Lv Zheng7e94632f2013-10-29 09:30:35 +080092#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_lock
Bob Moore967440e32006-06-23 17:04:00 -040093acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +080094#endif
Bob Moore967440e32006-06-23 17:04:00 -040095
Lv Zheng7e94632f2013-10-29 09:30:35 +080096#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_lock
Bob Moore967440e32006-06-23 17:04:00 -040097void acpi_os_release_lock(acpi_spinlock handle, acpi_cpu_flags flags);
Lv Zheng7e94632f2013-10-29 09:30:35 +080098#endif
Bob Moore967440e32006-06-23 17:04:00 -040099
100/*
Sebastian Andrzej Siewiorc3052592018-04-25 16:28:26 +0200101 * RAW spinlock primitives. If the OS does not provide them, fallback to
102 * spinlock primitives
103 */
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
107
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
111
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
115
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
120
121/*
Bob Moore967440e32006-06-23 17:04:00 -0400122 * Semaphore primitives
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800124#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_semaphore
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400126acpi_os_create_semaphore(u32 max_units,
Bob Moore967440e32006-06-23 17:04:00 -0400127 u32 initial_units, acpi_semaphore * out_handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800128#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
Lv Zheng7e94632f2013-10-29 09:30:35 +0800130#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_semaphore
Bob Moore967440e32006-06-23 17:04:00 -0400131acpi_status acpi_os_delete_semaphore(acpi_semaphore handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800132#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
Lv Zheng7e94632f2013-10-29 09:30:35 +0800134#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_semaphore
Bob Moore967440e32006-06-23 17:04:00 -0400135acpi_status
136acpi_os_wait_semaphore(acpi_semaphore handle, u32 units, u16 timeout);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800137#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138
Lv Zheng7e94632f2013-10-29 09:30:35 +0800139#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal_semaphore
Bob Moore967440e32006-06-23 17:04:00 -0400140acpi_status acpi_os_signal_semaphore(acpi_semaphore handle, u32 units);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800141#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
Bob Moore967440e32006-06-23 17:04:00 -0400143/*
Bob Moore1685bd42008-12-31 03:03:29 +0800144 * Mutex primitives. May be configured to use semaphores instead via
145 * ACPI_MUTEX_TYPE (see platform/acenv.h)
Bob Moore967440e32006-06-23 17:04:00 -0400146 */
Bob Moore1685bd42008-12-31 03:03:29 +0800147#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
148
Lv Zheng7e94632f2013-10-29 09:30:35 +0800149#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_mutex
Bob Moore967440e32006-06-23 17:04:00 -0400150acpi_status acpi_os_create_mutex(acpi_mutex * out_handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800151#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152
Lv Zheng7e94632f2013-10-29 09:30:35 +0800153#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_mutex
Bob Moore967440e32006-06-23 17:04:00 -0400154void acpi_os_delete_mutex(acpi_mutex handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800155#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
Lv Zheng7e94632f2013-10-29 09:30:35 +0800157#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_mutex
Bob Moore967440e32006-06-23 17:04:00 -0400158acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800159#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
Lv Zheng7e94632f2013-10-29 09:30:35 +0800161#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_mutex
Bob Moore967440e32006-06-23 17:04:00 -0400162void acpi_os_release_mutex(acpi_mutex handle);
Bob Moore1685bd42008-12-31 03:03:29 +0800163#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
Lv Zheng7e94632f2013-10-29 09:30:35 +0800165#endif
166
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167/*
168 * Memory allocation and mapping
169 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800170#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
Len Brown4be44fc2005-08-05 00:44:28 -0400171void *acpi_os_allocate(acpi_size size);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800172#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173
Lv Zheng7e94632f2013-10-29 09:30:35 +0800174#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
Lv Zhengb3c86c32013-10-29 09:29:27 +0800175void *acpi_os_allocate_zeroed(acpi_size size);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800176#endif
Lv Zhengb3c86c32013-10-29 09:29:27 +0800177
Lv Zheng7e94632f2013-10-29 09:30:35 +0800178#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
Lv Zheng739dcbb2012-12-20 01:07:26 +0000179void acpi_os_free(void *memory);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800180#endif
Lv Zheng739dcbb2012-12-20 01:07:26 +0000181
Lv Zheng7e94632f2013-10-29 09:30:35 +0800182#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
Lv Zheng93220582013-10-29 09:30:41 +0800183void *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800184#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185
Lv Zheng7e94632f2013-10-29 09:30:35 +0800186#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
Lv Zheng93220582013-10-29 09:30:41 +0800187void acpi_os_unmap_memory(void *logical_address, acpi_size size);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800188#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
Lv Zheng7e94632f2013-10-29 09:30:35 +0800190#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400192acpi_os_get_physical_address(void *logical_address,
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800193 acpi_physical_address *physical_address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194#endif
195
Robert Moore73459f72005-06-24 00:00:00 -0400196/*
197 * Memory/Object Cache
198 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800199#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_cache
Robert Moore73459f72005-06-24 00:00:00 -0400200acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400201acpi_os_create_cache(char *cache_name,
202 u16 object_size,
203 u16 max_depth, acpi_cache_t ** return_cache);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800204#endif
Robert Moore73459f72005-06-24 00:00:00 -0400205
Lv Zheng7e94632f2013-10-29 09:30:35 +0800206#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_delete_cache
Len Brown4be44fc2005-08-05 00:44:28 -0400207acpi_status acpi_os_delete_cache(acpi_cache_t * cache);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800208#endif
Robert Moore73459f72005-06-24 00:00:00 -0400209
Lv Zheng7e94632f2013-10-29 09:30:35 +0800210#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_purge_cache
Len Brown4be44fc2005-08-05 00:44:28 -0400211acpi_status acpi_os_purge_cache(acpi_cache_t * cache);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800212#endif
Robert Moore73459f72005-06-24 00:00:00 -0400213
Lv Zheng7e94632f2013-10-29 09:30:35 +0800214#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
Len Brown4be44fc2005-08-05 00:44:28 -0400215void *acpi_os_acquire_object(acpi_cache_t * cache);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800216#endif
Robert Moore73459f72005-06-24 00:00:00 -0400217
Lv Zheng7e94632f2013-10-29 09:30:35 +0800218#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_release_object
Len Brown4be44fc2005-08-05 00:44:28 -0400219acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800220#endif
Robert Moore73459f72005-06-24 00:00:00 -0400221
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222/*
223 * Interrupt handlers
224 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800225#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_install_interrupt_handler
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226acpi_status
Lv Zheng739dcbb2012-12-20 01:07:26 +0000227acpi_os_install_interrupt_handler(u32 interrupt_number,
Len Brown4be44fc2005-08-05 00:44:28 -0400228 acpi_osd_handler service_routine,
229 void *context);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800230#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231
Lv Zheng7e94632f2013-10-29 09:30:35 +0800232#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_remove_interrupt_handler
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233acpi_status
Lv Zheng739dcbb2012-12-20 01:07:26 +0000234acpi_os_remove_interrupt_handler(u32 interrupt_number,
235 acpi_osd_handler service_routine);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800236#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237
238/*
239 * Threads and Scheduling
240 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800241#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
Bob Moore83135242006-10-03 00:00:00 -0400242acpi_thread_id acpi_os_get_thread_id(void);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800243#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
Lv Zheng7e94632f2013-10-29 09:30:35 +0800245#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_execute
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246acpi_status
Bob Moore958dd242006-05-12 17:12:00 -0400247acpi_os_execute(acpi_execute_type type,
248 acpi_osd_exec_callback function, void *context);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800249#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250
Lv Zheng7e94632f2013-10-29 09:30:35 +0800251#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_events_complete
Lin Mingbd6f10a2012-05-22 16:43:49 +0800252void acpi_os_wait_events_complete(void);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800253#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254
Lv Zheng7e94632f2013-10-29 09:30:35 +0800255#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_sleep
Bob Moore5df7e6c2010-01-21 10:06:32 +0800256void acpi_os_sleep(u64 milliseconds);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800257#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258
Lv Zheng7e94632f2013-10-29 09:30:35 +0800259#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_stall
Len Brown4be44fc2005-08-05 00:44:28 -0400260void acpi_os_stall(u32 microseconds);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800261#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
263/*
264 * Platform and hardware-independent I/O interfaces
265 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800266#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_port
267acpi_status acpi_os_read_port(acpi_io_address address, u32 *value, u32 width);
268#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269
Lv Zheng7e94632f2013-10-29 09:30:35 +0800270#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_port
Len Brown4be44fc2005-08-05 00:44:28 -0400271acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800272#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273
274/*
275 * Platform and hardware-independent physical memory interfaces
276 */
Srinivas Pandruvadaeeb2d802017-10-05 16:24:03 -0700277int acpi_os_read_iomem(void __iomem *virt_addr, u64 *value, u32 width);
278
Lv Zheng7e94632f2013-10-29 09:30:35 +0800279#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_memory
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280acpi_status
Bob Moore653f4b52012-02-14 18:29:55 +0800281acpi_os_read_memory(acpi_physical_address address, u64 *value, u32 width);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800282#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
Lv Zheng7e94632f2013-10-29 09:30:35 +0800284#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_memory
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285acpi_status
Bob Moore653f4b52012-02-14 18:29:55 +0800286acpi_os_write_memory(acpi_physical_address address, u64 value, u32 width);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800287#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288
289/*
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.
293 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800294#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_read_pci_configuration
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400296acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
Bob Moorec5f02312010-08-06 08:57:53 +0800297 u32 reg, u64 *value, u32 width);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800298#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
Lv Zheng7e94632f2013-10-29 09:30:35 +0800300#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_write_pci_configuration
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301acpi_status
Len Brown4be44fc2005-08-05 00:44:28 -0400302acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
Bob Moore5df7e6c2010-01-21 10:06:32 +0800303 u32 reg, u64 value, u32 width);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800304#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305
306/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 * Miscellaneous
308 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800309#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_readable
310u8 acpi_os_readable(void *pointer, acpi_size length);
311#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312
Lv Zheng7e94632f2013-10-29 09:30:35 +0800313#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_writable
314u8 acpi_os_writable(void *pointer, acpi_size length);
315#endif
316
317#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_timer
318u64 acpi_os_get_timer(void);
319#endif
320
321#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_signal
Len Brown4be44fc2005-08-05 00:44:28 -0400322acpi_status acpi_os_signal(u32 function, void *info);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800323#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324
Lv Zheng0fc5e8f2016-12-28 15:28:49 +0800325#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_enter_sleep
326acpi_status acpi_os_enter_sleep(u8 sleep_state, u32 rega_value, u32 regb_value);
327#endif
328
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329/*
330 * Debug print routines
331 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800332#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_printf
Bob Moore36056d02019-08-16 14:43:25 -0700333ACPI_PRINTF_LIKE(1)
Len Brown4be44fc2005-08-05 00:44:28 -0400334void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800335#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336
Lv Zheng7e94632f2013-10-29 09:30:35 +0800337#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_vprintf
Len Brown4be44fc2005-08-05 00:44:28 -0400338void acpi_os_vprintf(const char *format, va_list args);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800339#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340
Lv Zheng7e94632f2013-10-29 09:30:35 +0800341#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_redirect_output
Len Brown4be44fc2005-08-05 00:44:28 -0400342void acpi_os_redirect_output(void *destination);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800343#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344
345/*
Lv Zhengf8d31482015-12-03 10:42:46 +0800346 * Debug IO
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800348#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_line
349acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read);
350#endif
Lv Zheng7e94632f2013-10-29 09:30:35 +0800351
Lv Zheng703ecd22016-12-28 15:28:07 +0800352#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize_debugger
353acpi_status acpi_os_initialize_debugger(void);
Lv Zhengf8d31482015-12-03 10:42:46 +0800354#endif
355
Lv Zheng703ecd22016-12-28 15:28:07 +0800356#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate_debugger
357void acpi_os_terminate_debugger(void);
Lv Zhengf8d31482015-12-03 10:42:46 +0800358#endif
359
360#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_wait_command_ready
361acpi_status acpi_os_wait_command_ready(void);
362#endif
363
364#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_notify_command_complete
365acpi_status acpi_os_notify_command_complete(void);
366#endif
367
Lv Zhengdd99cbc2016-08-04 16:45:13 +0800368#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_trace_point
369void
370acpi_os_trace_point(acpi_trace_event_type type,
371 u8 begin, u8 *aml, char *pathname);
372#endif
373
Lv Zheng7e94632f2013-10-29 09:30:35 +0800374/*
375 * Obtain ACPI table(s)
376 */
377#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_name
378acpi_status
379acpi_os_get_table_by_name(char *signature,
380 u32 instance,
381 struct acpi_table_header **table,
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800382 acpi_physical_address *address);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800383#endif
384
385#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
386acpi_status
387acpi_os_get_table_by_index(u32 index,
388 struct acpi_table_header **table,
Lv Zhengf5c1e1c2016-05-05 12:57:53 +0800389 u32 *instance, acpi_physical_address *address);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800390#endif
391
392#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
393acpi_status
394acpi_os_get_table_by_address(acpi_physical_address address,
395 struct acpi_table_header **table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396#endif
397
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398/*
399 * Directory manipulation
400 */
Lv Zheng7e94632f2013-10-29 09:30:35 +0800401#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_open_directory
Len Brown4be44fc2005-08-05 00:44:28 -0400402void *acpi_os_open_directory(char *pathname,
403 char *wildcard_spec, char requested_file_type);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800404#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405
406/* requeste_file_type values */
407
408#define REQUEST_FILE_ONLY 0
409#define REQUEST_DIR_ONLY 1
410
Lv Zheng7e94632f2013-10-29 09:30:35 +0800411#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
Len Brown4be44fc2005-08-05 00:44:28 -0400412char *acpi_os_get_next_filename(void *dir_handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800413#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414
Lv Zheng7e94632f2013-10-29 09:30:35 +0800415#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
Len Brown4be44fc2005-08-05 00:44:28 -0400416void acpi_os_close_directory(void *dir_handle);
Lv Zheng7e94632f2013-10-29 09:30:35 +0800417#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418
Len Brown4be44fc2005-08-05 00:44:28 -0400419#endif /* __ACPIOSXF_H__ */