acpiosxf.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. /******************************************************************************
  2. *
  3. * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These
  4. * interfaces must be implemented by OSL to interface the
  5. * ACPI components to the host operating system.
  6. *
  7. *****************************************************************************/
  8. /*
  9. * Copyright (C) 2000 - 2005, R. Byron Moore
  10. * All rights reserved.
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. * 1. Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions, and the following disclaimer,
  17. * without modification.
  18. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19. * substantially similar to the "NO WARRANTY" disclaimer below
  20. * ("Disclaimer") and any redistribution must be conditioned upon
  21. * including a substantially similar Disclaimer requirement for further
  22. * binary redistribution.
  23. * 3. Neither the names of the above-listed copyright holders nor the names
  24. * of any contributors may be used to endorse or promote products derived
  25. * from this software without specific prior written permission.
  26. *
  27. * Alternatively, this software may be distributed under the terms of the
  28. * GNU General Public License ("GPL") version 2 as published by the Free
  29. * Software Foundation.
  30. *
  31. * NO WARRANTY
  32. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  33. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  34. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  35. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  36. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  38. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  39. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  40. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  41. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  42. * POSSIBILITY OF SUCH DAMAGES.
  43. */
  44. #ifndef __ACPIOSXF_H__
  45. #define __ACPIOSXF_H__
  46. #include "platform/acenv.h"
  47. #include "actypes.h"
  48. /* Priorities for acpi_os_queue_for_execution */
  49. #define OSD_PRIORITY_GPE 1
  50. #define OSD_PRIORITY_HIGH 2
  51. #define OSD_PRIORITY_MED 3
  52. #define OSD_PRIORITY_LO 4
  53. #define ACPI_NO_UNIT_LIMIT ((u32) -1)
  54. #define ACPI_MUTEX_SEM 1
  55. /* Functions for acpi_os_signal */
  56. #define ACPI_SIGNAL_FATAL 0
  57. #define ACPI_SIGNAL_BREAKPOINT 1
  58. struct acpi_signal_fatal_info
  59. {
  60. u32 type;
  61. u32 code;
  62. u32 argument;
  63. };
  64. /*
  65. * OSL Initialization and shutdown primitives
  66. */
  67. acpi_status
  68. acpi_os_initialize (
  69. void);
  70. acpi_status
  71. acpi_os_terminate (
  72. void);
  73. /*
  74. * ACPI Table interfaces
  75. */
  76. acpi_status
  77. acpi_os_get_root_pointer (
  78. u32 flags,
  79. struct acpi_pointer *address);
  80. acpi_status
  81. acpi_os_predefined_override (
  82. const struct acpi_predefined_names *init_val,
  83. acpi_string *new_val);
  84. acpi_status
  85. acpi_os_table_override (
  86. struct acpi_table_header *existing_table,
  87. struct acpi_table_header **new_table);
  88. /*
  89. * Synchronization primitives
  90. */
  91. acpi_status
  92. acpi_os_create_semaphore (
  93. u32 max_units,
  94. u32 initial_units,
  95. acpi_handle *out_handle);
  96. acpi_status
  97. acpi_os_delete_semaphore (
  98. acpi_handle handle);
  99. acpi_status
  100. acpi_os_wait_semaphore (
  101. acpi_handle handle,
  102. u32 units,
  103. u16 timeout);
  104. acpi_status
  105. acpi_os_signal_semaphore (
  106. acpi_handle handle,
  107. u32 units);
  108. acpi_status
  109. acpi_os_create_lock (
  110. acpi_handle *out_handle);
  111. void
  112. acpi_os_delete_lock (
  113. acpi_handle handle);
  114. void
  115. acpi_os_acquire_lock (
  116. acpi_handle handle,
  117. u32 flags);
  118. void
  119. acpi_os_release_lock (
  120. acpi_handle handle,
  121. u32 flags);
  122. /*
  123. * Memory allocation and mapping
  124. */
  125. void *
  126. acpi_os_allocate (
  127. acpi_size size);
  128. void
  129. acpi_os_free (
  130. void * memory);
  131. acpi_status
  132. acpi_os_map_memory (
  133. acpi_physical_address physical_address,
  134. acpi_size size,
  135. void __iomem **logical_address);
  136. void
  137. acpi_os_unmap_memory (
  138. void __iomem *logical_address,
  139. acpi_size size);
  140. #ifdef ACPI_FUTURE_USAGE
  141. acpi_status
  142. acpi_os_get_physical_address (
  143. void *logical_address,
  144. acpi_physical_address *physical_address);
  145. #endif
  146. /*
  147. * Interrupt handlers
  148. */
  149. acpi_status
  150. acpi_os_install_interrupt_handler (
  151. u32 gsi,
  152. acpi_osd_handler service_routine,
  153. void *context);
  154. acpi_status
  155. acpi_os_remove_interrupt_handler (
  156. u32 gsi,
  157. acpi_osd_handler service_routine);
  158. /*
  159. * Threads and Scheduling
  160. */
  161. u32
  162. acpi_os_get_thread_id (
  163. void);
  164. acpi_status
  165. acpi_os_queue_for_execution (
  166. u32 priority,
  167. acpi_osd_exec_callback function,
  168. void *context);
  169. void
  170. acpi_os_wait_events_complete(
  171. void * context);
  172. void
  173. acpi_os_wait_events_complete (
  174. void *context);
  175. void
  176. acpi_os_sleep (
  177. acpi_integer milliseconds);
  178. void
  179. acpi_os_stall (
  180. u32 microseconds);
  181. /*
  182. * Platform and hardware-independent I/O interfaces
  183. */
  184. acpi_status
  185. acpi_os_read_port (
  186. acpi_io_address address,
  187. u32 *value,
  188. u32 width);
  189. acpi_status
  190. acpi_os_write_port (
  191. acpi_io_address address,
  192. u32 value,
  193. u32 width);
  194. /*
  195. * Platform and hardware-independent physical memory interfaces
  196. */
  197. acpi_status
  198. acpi_os_read_memory (
  199. acpi_physical_address address,
  200. u32 *value,
  201. u32 width);
  202. acpi_status
  203. acpi_os_write_memory (
  204. acpi_physical_address address,
  205. u32 value,
  206. u32 width);
  207. /*
  208. * Platform and hardware-independent PCI configuration space access
  209. * Note: Can't use "Register" as a parameter, changed to "Reg" --
  210. * certain compilers complain.
  211. */
  212. acpi_status
  213. acpi_os_read_pci_configuration (
  214. struct acpi_pci_id *pci_id,
  215. u32 reg,
  216. void *value,
  217. u32 width);
  218. acpi_status
  219. acpi_os_write_pci_configuration (
  220. struct acpi_pci_id *pci_id,
  221. u32 reg,
  222. acpi_integer value,
  223. u32 width);
  224. /*
  225. * Interim function needed for PCI IRQ routing
  226. */
  227. void
  228. acpi_os_derive_pci_id(
  229. acpi_handle rhandle,
  230. acpi_handle chandle,
  231. struct acpi_pci_id **pci_id);
  232. /*
  233. * Miscellaneous
  234. */
  235. u8
  236. acpi_os_readable (
  237. void *pointer,
  238. acpi_size length);
  239. #ifdef ACPI_FUTURE_USAGE
  240. u8
  241. acpi_os_writable (
  242. void *pointer,
  243. acpi_size length);
  244. #endif
  245. u64
  246. acpi_os_get_timer (
  247. void);
  248. acpi_status
  249. acpi_os_signal (
  250. u32 function,
  251. void *info);
  252. /*
  253. * Debug print routines
  254. */
  255. void ACPI_INTERNAL_VAR_XFACE
  256. acpi_os_printf (
  257. const char *format,
  258. ...);
  259. void
  260. acpi_os_vprintf (
  261. const char *format,
  262. va_list args);
  263. void
  264. acpi_os_redirect_output (
  265. void *destination);
  266. /*
  267. * Debug input
  268. */
  269. #ifdef ACPI_FUTURE_USAGE
  270. u32
  271. acpi_os_get_line (
  272. char *buffer);
  273. #endif
  274. /*
  275. * Directory manipulation
  276. */
  277. void *
  278. acpi_os_open_directory (
  279. char *pathname,
  280. char *wildcard_spec,
  281. char requested_file_type);
  282. /* requeste_file_type values */
  283. #define REQUEST_FILE_ONLY 0
  284. #define REQUEST_DIR_ONLY 1
  285. char *
  286. acpi_os_get_next_filename (
  287. void *dir_handle);
  288. void
  289. acpi_os_close_directory (
  290. void *dir_handle);
  291. /*
  292. * Debug
  293. */
  294. void
  295. acpi_os_dbg_assert(
  296. void *failed_assertion,
  297. void *file_name,
  298. u32 line_number,
  299. char *message);
  300. #endif /* __ACPIOSXF_H__ */