acpiosxf.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:6k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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, 2001 R. Byron Moore
  10.  *
  11.  *  This program is free software; you can redistribute it and/or modify
  12.  *  it under the terms of the GNU General Public License as published by
  13.  *  the Free Software Foundation; either version 2 of the License, or
  14.  *  (at your option) any later version.
  15.  *
  16.  *  This program is distributed in the hope that it will be useful,
  17.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  *  GNU General Public License for more details.
  20.  *
  21.  *  You should have received a copy of the GNU General Public License
  22.  *  along with this program; if not, write to the Free Software
  23.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  24.  */
  25. #ifndef __ACPIOSXF_H__
  26. #define __ACPIOSXF_H__
  27. #include "platform/acenv.h"
  28. #include "actypes.h"
  29. /* Priorities for Acpi_os_queue_for_execution */
  30. #define OSD_PRIORITY_GPE            1
  31. #define OSD_PRIORITY_HIGH           2
  32. #define OSD_PRIORITY_MED            3
  33. #define OSD_PRIORITY_LO             4
  34. #define ACPI_NO_UNIT_LIMIT          ((u32) -1)
  35. #define ACPI_MUTEX_SEM              1
  36. /* Functions for Acpi_os_signal */
  37. #define ACPI_SIGNAL_FATAL           0
  38. #define ACPI_SIGNAL_BREAKPOINT      1
  39. typedef struct acpi_fatal_info
  40. {
  41. u32                     type;
  42. u32                     code;
  43. u32                     argument;
  44. } ACPI_SIGNAL_FATAL_INFO;
  45. /*
  46.  * Types specific to the OS service interfaces
  47.  */
  48. typedef
  49. u32 (*OSD_HANDLER) (
  50. void                    *context);
  51. typedef
  52. void (*OSD_EXECUTION_CALLBACK) (
  53. void                    *context);
  54. /*
  55.  * OSL Initialization and shutdown primitives
  56.  */
  57. acpi_status
  58. acpi_os_initialize (
  59. void);
  60. acpi_status
  61. acpi_os_terminate (
  62. void);
  63. acpi_status
  64. acpi_os_get_root_pointer (
  65. u32                     flags,
  66. ACPI_PHYSICAL_ADDRESS   *rsdp_physical_address);
  67. /*
  68.  * Synchronization primitives
  69.  */
  70. acpi_status
  71. acpi_os_create_semaphore (
  72. u32                     max_units,
  73. u32                     initial_units,
  74. acpi_handle             *out_handle);
  75. acpi_status
  76. acpi_os_delete_semaphore (
  77. acpi_handle             handle);
  78. acpi_status
  79. acpi_os_wait_semaphore (
  80. acpi_handle             handle,
  81. u32                     units,
  82. u32                     timeout);
  83. acpi_status
  84. acpi_os_signal_semaphore (
  85. acpi_handle             handle,
  86. u32                     units);
  87. /*
  88.  * Memory allocation and mapping
  89.  */
  90. void *
  91. acpi_os_allocate (
  92. u32                     size);
  93. void *
  94. acpi_os_callocate (
  95. u32                     size);
  96. void
  97. acpi_os_free (
  98. void *                  memory);
  99. acpi_status
  100. acpi_os_map_memory (
  101. ACPI_PHYSICAL_ADDRESS   physical_address,
  102. u32                     length,
  103. void                    **logical_address);
  104. void
  105. acpi_os_unmap_memory (
  106. void                    *logical_address,
  107. u32                     length);
  108. acpi_status
  109. acpi_os_get_physical_address (
  110. void                    *logical_address,
  111. ACPI_PHYSICAL_ADDRESS   *physical_address);
  112. /*
  113.  * Interrupt handlers
  114.  */
  115. acpi_status
  116. acpi_os_install_interrupt_handler (
  117. u32                     interrupt_number,
  118. OSD_HANDLER             service_routine,
  119. void                    *context);
  120. acpi_status
  121. acpi_os_remove_interrupt_handler (
  122. u32                     interrupt_number,
  123. OSD_HANDLER             service_routine);
  124. /*
  125.  * Threads and Scheduling
  126.  */
  127. u32
  128. acpi_os_get_thread_id (
  129. void);
  130. acpi_status
  131. acpi_os_queue_for_execution (
  132. u32                     priority,
  133. OSD_EXECUTION_CALLBACK  function,
  134. void                    *context);
  135. void
  136. acpi_os_sleep (
  137. u32                     seconds,
  138. u32                     milliseconds);
  139. void
  140. acpi_os_stall (
  141. u32                     microseconds);
  142. /*
  143.  * Platform and hardware-independent I/O interfaces
  144.  */
  145. acpi_status
  146. acpi_os_read_port (
  147. ACPI_IO_ADDRESS         address,
  148. void                    *value,
  149. u32                     width);
  150. acpi_status
  151. acpi_os_write_port (
  152. ACPI_IO_ADDRESS         address,
  153. NATIVE_UINT             value,
  154. u32                     width);
  155. /*
  156.  * Platform and hardware-independent physical memory interfaces
  157.  */
  158. acpi_status
  159. acpi_os_read_memory (
  160. ACPI_PHYSICAL_ADDRESS   address,
  161. void                    *value,
  162. u32                     width);
  163. acpi_status
  164. acpi_os_write_memory (
  165. ACPI_PHYSICAL_ADDRESS   address,
  166. NATIVE_UINT             value,
  167. u32                     width);
  168. /*
  169.  * Platform and hardware-independent PCI configuration space access
  170.  */
  171. acpi_status
  172. acpi_os_read_pci_configuration (
  173. acpi_pci_id             *pci_id,
  174. u32                     register,
  175. void                    *value,
  176. u32                     width);
  177. acpi_status
  178. acpi_os_write_pci_configuration (
  179. acpi_pci_id             *pci_id,
  180. u32                     register,
  181. NATIVE_UINT             value,
  182. u32                     width);
  183. /*
  184.  * Miscellaneous
  185.  */
  186. u8
  187. acpi_os_readable (
  188. void                    *pointer,
  189. u32                     length);
  190. u8
  191. acpi_os_writable (
  192. void                    *pointer,
  193. u32                     length);
  194. u32
  195. acpi_os_get_timer (
  196. void);
  197. acpi_status
  198. acpi_os_signal (
  199. u32                     function,
  200. void                    *info);
  201. /*
  202.  * Debug print routines
  203.  */
  204. s32
  205. acpi_os_printf (
  206. const NATIVE_CHAR       *format,
  207. ...);
  208. s32
  209. acpi_os_vprintf (
  210. const NATIVE_CHAR       *format,
  211. va_list                 args);
  212. /*
  213.  * Debug input
  214.  */
  215. u32
  216. acpi_os_get_line (
  217. NATIVE_CHAR             *buffer);
  218. /*
  219.  * Debug
  220.  */
  221. void
  222. acpi_os_dbg_assert(
  223. void                    *failed_assertion,
  224. void                    *file_name,
  225. u32                     line_number,
  226. NATIVE_CHAR             *message);
  227. #endif /* __ACPIOSXF_H__ */