acpiosxf.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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. unsigned long
  115. acpi_os_acquire_lock (
  116. acpi_handle handle);
  117. void
  118. acpi_os_release_lock (
  119. acpi_handle handle,
  120. unsigned long flags);
  121. /*
  122. * Memory allocation and mapping
  123. */
  124. void *
  125. acpi_os_allocate (
  126. acpi_size size);
  127. void
  128. acpi_os_free (
  129. void * memory);
  130. acpi_status
  131. acpi_os_map_memory (
  132. acpi_physical_address physical_address,
  133. acpi_size size,
  134. void __iomem **logical_address);
  135. void
  136. acpi_os_unmap_memory (
  137. void __iomem *logical_address,
  138. acpi_size size);
  139. #ifdef ACPI_FUTURE_USAGE
  140. acpi_status
  141. acpi_os_get_physical_address (
  142. void *logical_address,
  143. acpi_physical_address *physical_address);
  144. #endif
  145. /*
  146. * Memory/Object Cache
  147. */
  148. acpi_status
  149. acpi_os_create_cache (
  150. char *cache_name,
  151. u16 object_size,
  152. u16 max_depth,
  153. acpi_cache_t **return_cache);
  154. acpi_status
  155. acpi_os_delete_cache (
  156. acpi_cache_t *cache);
  157. acpi_status
  158. acpi_os_purge_cache (
  159. acpi_cache_t *cache);
  160. void *
  161. acpi_os_acquire_object (
  162. acpi_cache_t *cache);
  163. acpi_status
  164. acpi_os_release_object (
  165. acpi_cache_t *cache,
  166. void *object);
  167. /*
  168. * Interrupt handlers
  169. */
  170. acpi_status
  171. acpi_os_install_interrupt_handler (
  172. u32 gsi,
  173. acpi_osd_handler service_routine,
  174. void *context);
  175. acpi_status
  176. acpi_os_remove_interrupt_handler (
  177. u32 gsi,
  178. acpi_osd_handler service_routine);
  179. /*
  180. * Threads and Scheduling
  181. */
  182. u32
  183. acpi_os_get_thread_id (
  184. void);
  185. acpi_status
  186. acpi_os_queue_for_execution (
  187. u32 priority,
  188. acpi_osd_exec_callback function,
  189. void *context);
  190. void
  191. acpi_os_wait_events_complete(
  192. void * context);
  193. void
  194. acpi_os_wait_events_complete (
  195. void *context);
  196. void
  197. acpi_os_sleep (
  198. acpi_integer milliseconds);
  199. void
  200. acpi_os_stall (
  201. u32 microseconds);
  202. /*
  203. * Platform and hardware-independent I/O interfaces
  204. */
  205. acpi_status
  206. acpi_os_read_port (
  207. acpi_io_address address,
  208. u32 *value,
  209. u32 width);
  210. acpi_status
  211. acpi_os_write_port (
  212. acpi_io_address address,
  213. u32 value,
  214. u32 width);
  215. /*
  216. * Platform and hardware-independent physical memory interfaces
  217. */
  218. acpi_status
  219. acpi_os_read_memory (
  220. acpi_physical_address address,
  221. u32 *value,
  222. u32 width);
  223. acpi_status
  224. acpi_os_write_memory (
  225. acpi_physical_address address,
  226. u32 value,
  227. u32 width);
  228. /*
  229. * Platform and hardware-independent PCI configuration space access
  230. * Note: Can't use "Register" as a parameter, changed to "Reg" --
  231. * certain compilers complain.
  232. */
  233. acpi_status
  234. acpi_os_read_pci_configuration (
  235. struct acpi_pci_id *pci_id,
  236. u32 reg,
  237. void *value,
  238. u32 width);
  239. acpi_status
  240. acpi_os_write_pci_configuration (
  241. struct acpi_pci_id *pci_id,
  242. u32 reg,
  243. acpi_integer value,
  244. u32 width);
  245. /*
  246. * Interim function needed for PCI IRQ routing
  247. */
  248. void
  249. acpi_os_derive_pci_id(
  250. acpi_handle rhandle,
  251. acpi_handle chandle,
  252. struct acpi_pci_id **pci_id);
  253. /*
  254. * Miscellaneous
  255. */
  256. u8
  257. acpi_os_readable (
  258. void *pointer,
  259. acpi_size length);
  260. #ifdef ACPI_FUTURE_USAGE
  261. u8
  262. acpi_os_writable (
  263. void *pointer,
  264. acpi_size length);
  265. #endif
  266. u64
  267. acpi_os_get_timer (
  268. void);
  269. acpi_status
  270. acpi_os_signal (
  271. u32 function,
  272. void *info);
  273. /*
  274. * Debug print routines
  275. */
  276. void ACPI_INTERNAL_VAR_XFACE
  277. acpi_os_printf (
  278. const char *format,
  279. ...);
  280. void
  281. acpi_os_vprintf (
  282. const char *format,
  283. va_list args);
  284. void
  285. acpi_os_redirect_output (
  286. void *destination);
  287. #ifdef ACPI_FUTURE_USAGE
  288. /*
  289. * Debug input
  290. */
  291. u32
  292. acpi_os_get_line (
  293. char *buffer);
  294. #endif
  295. /*
  296. * Directory manipulation
  297. */
  298. void *
  299. acpi_os_open_directory (
  300. char *pathname,
  301. char *wildcard_spec,
  302. char requested_file_type);
  303. /* requeste_file_type values */
  304. #define REQUEST_FILE_ONLY 0
  305. #define REQUEST_DIR_ONLY 1
  306. char *
  307. acpi_os_get_next_filename (
  308. void *dir_handle);
  309. void
  310. acpi_os_close_directory (
  311. void *dir_handle);
  312. /*
  313. * Debug
  314. */
  315. void
  316. acpi_os_dbg_assert(
  317. void *failed_assertion,
  318. void *file_name,
  319. u32 line_number,
  320. char *message);
  321. #endif /* __ACPIOSXF_H__ */