acglobal.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
  2. /******************************************************************************
  3. *
  4. * Name: acglobal.h - Declarations for global variables
  5. *
  6. * Copyright (C) 2000 - 2022, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #ifndef __ACGLOBAL_H__
  10. #define __ACGLOBAL_H__
  11. /*****************************************************************************
  12. *
  13. * Globals related to the incoming ACPI tables
  14. *
  15. ****************************************************************************/
  16. /* Master list of all ACPI tables that were found in the RSDT/XSDT */
  17. ACPI_GLOBAL(struct acpi_table_list, acpi_gbl_root_table_list);
  18. /* DSDT information. Used to check for DSDT corruption */
  19. ACPI_GLOBAL(struct acpi_table_header *, acpi_gbl_DSDT);
  20. ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
  21. ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX);
  22. ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX);
  23. ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX);
  24. ACPI_INIT_GLOBAL(u32, acpi_gbl_fadt_index, ACPI_INVALID_TABLE_INDEX);
  25. #if (!ACPI_REDUCED_HARDWARE)
  26. ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
  27. #endif /* !ACPI_REDUCED_HARDWARE */
  28. /* These addresses are calculated from the FADT Event Block addresses */
  29. ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1a_status);
  30. ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1a_enable);
  31. ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1b_status);
  32. ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1b_enable);
  33. #ifdef ACPI_GPE_USE_LOGICAL_ADDRESSES
  34. ACPI_GLOBAL(unsigned long, acpi_gbl_xgpe0_block_logical_address);
  35. ACPI_GLOBAL(unsigned long, acpi_gbl_xgpe1_block_logical_address);
  36. #endif /* ACPI_GPE_USE_LOGICAL_ADDRESSES */
  37. /*
  38. * Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is
  39. * determined by the revision of the DSDT: If the DSDT revision is less than
  40. * 2, use only the lower 32 bits of the internal 64-bit Integer.
  41. */
  42. ACPI_GLOBAL(u8, acpi_gbl_integer_bit_width);
  43. ACPI_GLOBAL(u8, acpi_gbl_integer_byte_width);
  44. ACPI_GLOBAL(u8, acpi_gbl_integer_nybble_width);
  45. /*****************************************************************************
  46. *
  47. * Mutual exclusion within the ACPICA subsystem
  48. *
  49. ****************************************************************************/
  50. /*
  51. * Predefined mutex objects. This array contains the
  52. * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
  53. * (The table maps local handles to the real OS handles)
  54. */
  55. ACPI_GLOBAL(struct acpi_mutex_info, acpi_gbl_mutex_info[ACPI_NUM_MUTEX]);
  56. /*
  57. * Global lock mutex is an actual AML mutex object
  58. * Global lock semaphore works in conjunction with the actual global lock
  59. * Global lock spinlock is used for "pending" handshake
  60. */
  61. ACPI_GLOBAL(union acpi_operand_object *, acpi_gbl_global_lock_mutex);
  62. ACPI_GLOBAL(acpi_semaphore, acpi_gbl_global_lock_semaphore);
  63. ACPI_GLOBAL(acpi_spinlock, acpi_gbl_global_lock_pending_lock);
  64. ACPI_GLOBAL(u16, acpi_gbl_global_lock_handle);
  65. ACPI_GLOBAL(u8, acpi_gbl_global_lock_acquired);
  66. ACPI_GLOBAL(u8, acpi_gbl_global_lock_present);
  67. ACPI_GLOBAL(u8, acpi_gbl_global_lock_pending);
  68. /*
  69. * Spinlocks are used for interfaces that can be possibly called at
  70. * interrupt level
  71. */
  72. ACPI_GLOBAL(acpi_spinlock, acpi_gbl_gpe_lock); /* For GPE data structs and registers */
  73. ACPI_GLOBAL(acpi_raw_spinlock, acpi_gbl_hardware_lock); /* For ACPI H/W except GPE registers */
  74. ACPI_GLOBAL(acpi_spinlock, acpi_gbl_reference_count_lock);
  75. /* Mutex for _OSI support */
  76. ACPI_GLOBAL(acpi_mutex, acpi_gbl_osi_mutex);
  77. /* Reader/Writer lock is used for namespace walk and dynamic table unload */
  78. ACPI_GLOBAL(struct acpi_rw_lock, acpi_gbl_namespace_rw_lock);
  79. /*****************************************************************************
  80. *
  81. * Miscellaneous globals
  82. *
  83. ****************************************************************************/
  84. /* Object caches */
  85. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_namespace_cache);
  86. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_state_cache);
  87. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_ps_node_cache);
  88. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_ps_node_ext_cache);
  89. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache);
  90. /* System */
  91. ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0);
  92. ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE);
  93. ACPI_INIT_GLOBAL(u8, acpi_gbl_early_initialization, TRUE);
  94. /* Global handlers */
  95. ACPI_GLOBAL(struct acpi_global_notify_handler, acpi_gbl_global_notify[2]);
  96. ACPI_GLOBAL(acpi_exception_handler, acpi_gbl_exception_handler);
  97. ACPI_GLOBAL(acpi_init_handler, acpi_gbl_init_handler);
  98. ACPI_GLOBAL(acpi_table_handler, acpi_gbl_table_handler);
  99. ACPI_GLOBAL(void *, acpi_gbl_table_handler_context);
  100. ACPI_GLOBAL(acpi_interface_handler, acpi_gbl_interface_handler);
  101. ACPI_GLOBAL(struct acpi_sci_handler_info *, acpi_gbl_sci_handler_list);
  102. /* Owner ID support */
  103. ACPI_GLOBAL(u32, acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]);
  104. ACPI_GLOBAL(u8, acpi_gbl_last_owner_id_index);
  105. ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset);
  106. /* Initialization sequencing */
  107. ACPI_INIT_GLOBAL(u8, acpi_gbl_namespace_initialized, FALSE);
  108. /* Miscellaneous */
  109. ACPI_GLOBAL(u32, acpi_gbl_original_mode);
  110. ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count);
  111. ACPI_GLOBAL(u32, acpi_gbl_ps_find_count);
  112. ACPI_GLOBAL(u16, acpi_gbl_pm1_enable_register_save);
  113. ACPI_GLOBAL(u8, acpi_gbl_debugger_configuration);
  114. ACPI_GLOBAL(u8, acpi_gbl_step_to_next_call);
  115. ACPI_GLOBAL(u8, acpi_gbl_acpi_hardware_present);
  116. ACPI_GLOBAL(u8, acpi_gbl_events_initialized);
  117. ACPI_GLOBAL(struct acpi_interface_info *, acpi_gbl_supported_interfaces);
  118. ACPI_GLOBAL(struct acpi_address_range *,
  119. acpi_gbl_address_range_list[ACPI_ADDRESS_RANGE_MAX]);
  120. /* Other miscellaneous, declared and initialized in utglobal */
  121. extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
  122. extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
  123. extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
  124. extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
  125. extern const char acpi_gbl_lower_hex_digits[];
  126. extern const char acpi_gbl_upper_hex_digits[];
  127. extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
  128. /* Lists for tracking memory allocations (debug only) */
  129. #ifdef ACPI_DBG_TRACK_ALLOCATIONS
  130. ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list);
  131. ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list);
  132. ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats);
  133. ACPI_GLOBAL(u8, acpi_gbl_disable_mem_tracking);
  134. ACPI_GLOBAL(u8, acpi_gbl_verbose_leak_dump);
  135. #endif
  136. /*****************************************************************************
  137. *
  138. * ACPI Namespace
  139. *
  140. ****************************************************************************/
  141. #define NUM_PREDEFINED_NAMES 10
  142. ACPI_GLOBAL(struct acpi_namespace_node, acpi_gbl_root_node_struct);
  143. ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_root_node);
  144. ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_fadt_gpe_device);
  145. extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES];
  146. extern const struct acpi_predefined_names
  147. acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES];
  148. #ifdef ACPI_DEBUG_OUTPUT
  149. ACPI_GLOBAL(u32, acpi_gbl_current_node_count);
  150. ACPI_GLOBAL(u32, acpi_gbl_current_node_size);
  151. ACPI_GLOBAL(u32, acpi_gbl_max_concurrent_node_count);
  152. ACPI_GLOBAL(acpi_size *, acpi_gbl_entry_stack_pointer);
  153. ACPI_GLOBAL(acpi_size *, acpi_gbl_lowest_stack_pointer);
  154. ACPI_GLOBAL(u32, acpi_gbl_deepest_nesting);
  155. ACPI_INIT_GLOBAL(u32, acpi_gbl_nesting_level, 0);
  156. #endif
  157. /*****************************************************************************
  158. *
  159. * Interpreter/Parser globals
  160. *
  161. ****************************************************************************/
  162. /* Control method single step flag */
  163. ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
  164. ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
  165. ACPI_INIT_GLOBAL(union acpi_parse_object, *acpi_gbl_current_scope, NULL);
  166. /* ASL/ASL+ converter */
  167. ACPI_INIT_GLOBAL(u8, acpi_gbl_capture_comments, FALSE);
  168. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_last_list_head, NULL);
  169. /*****************************************************************************
  170. *
  171. * Hardware globals
  172. *
  173. ****************************************************************************/
  174. extern struct acpi_bit_register_info
  175. acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
  176. ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a);
  177. ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
  178. ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a_s0);
  179. ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b_s0);
  180. /*****************************************************************************
  181. *
  182. * Event and GPE globals
  183. *
  184. ****************************************************************************/
  185. #if (!ACPI_REDUCED_HARDWARE)
  186. ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized);
  187. ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head);
  188. ACPI_GLOBAL(struct acpi_gpe_block_info *,
  189. acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]);
  190. ACPI_GLOBAL(acpi_gbl_event_handler, acpi_gbl_global_event_handler);
  191. ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context);
  192. ACPI_GLOBAL(struct acpi_fixed_event_handler,
  193. acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]);
  194. extern struct acpi_fixed_event_info
  195. acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
  196. #endif /* !ACPI_REDUCED_HARDWARE */
  197. /*****************************************************************************
  198. *
  199. * Debug support
  200. *
  201. ****************************************************************************/
  202. /* Event counters */
  203. ACPI_GLOBAL(u32, acpi_method_count);
  204. ACPI_GLOBAL(u32, acpi_gpe_count);
  205. ACPI_GLOBAL(u32, acpi_sci_count);
  206. ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]);
  207. /* Dynamic control method tracing mechanism */
  208. ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level);
  209. ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer);
  210. /*****************************************************************************
  211. *
  212. * Debugger and Disassembler
  213. *
  214. ****************************************************************************/
  215. ACPI_INIT_GLOBAL(u8, acpi_gbl_db_output_flags, ACPI_DB_CONSOLE_OUTPUT);
  216. #ifdef ACPI_DISASSEMBLER
  217. /* Do not disassemble buffers to resource descriptors */
  218. ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE);
  219. ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE);
  220. ACPI_INIT_GLOBAL(u8, acpi_gbl_cstyle_disassembly, TRUE);
  221. ACPI_INIT_GLOBAL(u8, acpi_gbl_force_aml_disassembly, FALSE);
  222. ACPI_INIT_GLOBAL(u8, acpi_gbl_dm_opt_verbose, TRUE);
  223. ACPI_INIT_GLOBAL(u8, acpi_gbl_dm_emit_external_opcodes, FALSE);
  224. ACPI_INIT_GLOBAL(u8, acpi_gbl_do_disassembler_optimizations, TRUE);
  225. ACPI_INIT_GLOBAL(ACPI_PARSE_OBJECT_LIST, *acpi_gbl_temp_list_head, NULL);
  226. ACPI_GLOBAL(u8, acpi_gbl_dm_opt_disasm);
  227. ACPI_GLOBAL(u8, acpi_gbl_dm_opt_listing);
  228. ACPI_GLOBAL(u8, acpi_gbl_num_external_methods);
  229. ACPI_GLOBAL(u32, acpi_gbl_resolved_external_methods);
  230. ACPI_GLOBAL(struct acpi_external_list *, acpi_gbl_external_list);
  231. ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
  232. #endif
  233. #ifdef ACPI_DEBUGGER
  234. ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE);
  235. ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID);
  236. ACPI_INIT_GLOBAL(u32, acpi_gbl_next_cmd_num, 1);
  237. ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_ini_methods);
  238. ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_region_support);
  239. ACPI_GLOBAL(u8, acpi_gbl_db_output_to_file);
  240. ACPI_GLOBAL(char *, acpi_gbl_db_buffer);
  241. ACPI_GLOBAL(char *, acpi_gbl_db_filename);
  242. ACPI_GLOBAL(u32, acpi_gbl_db_debug_level);
  243. ACPI_GLOBAL(u32, acpi_gbl_db_console_debug_level);
  244. ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node);
  245. ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop);
  246. ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated);
  247. ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]);
  248. ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]);
  249. /* These buffers should all be the same size */
  250. ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]);
  251. ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]);
  252. ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]);
  253. /* Statistics globals */
  254. ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]);
  255. ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]);
  256. ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc);
  257. ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc);
  258. ACPI_GLOBAL(u32, acpi_gbl_num_nodes);
  259. ACPI_GLOBAL(u32, acpi_gbl_num_objects);
  260. #endif /* ACPI_DEBUGGER */
  261. #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
  262. ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
  263. ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
  264. ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
  265. ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
  266. ACPI_INIT_GLOBAL(u8, acpi_gbl_disasm_flag, FALSE);
  267. #endif
  268. /*****************************************************************************
  269. *
  270. * ACPICA application-specific globals
  271. *
  272. ****************************************************************************/
  273. /* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */
  274. #ifdef ACPI_ASL_COMPILER
  275. ACPI_INIT_GLOBAL(char *, acpi_gbl_current_inline_comment, NULL);
  276. ACPI_INIT_GLOBAL(char *, acpi_gbl_current_end_node_comment, NULL);
  277. ACPI_INIT_GLOBAL(char *, acpi_gbl_current_open_brace_comment, NULL);
  278. ACPI_INIT_GLOBAL(char *, acpi_gbl_current_close_brace_comment, NULL);
  279. ACPI_INIT_GLOBAL(char *, acpi_gbl_root_filename, NULL);
  280. ACPI_INIT_GLOBAL(char *, acpi_gbl_current_filename, NULL);
  281. ACPI_INIT_GLOBAL(char *, acpi_gbl_current_parent_filename, NULL);
  282. ACPI_INIT_GLOBAL(char *, acpi_gbl_current_include_filename, NULL);
  283. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_head,
  284. NULL);
  285. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_def_blk_comment_list_tail,
  286. NULL);
  287. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_head,
  288. NULL);
  289. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_reg_comment_list_tail,
  290. NULL);
  291. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_head,
  292. NULL);
  293. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_inc_comment_list_tail,
  294. NULL);
  295. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_head,
  296. NULL);
  297. ACPI_INIT_GLOBAL(struct acpi_comment_node, *acpi_gbl_end_blk_comment_list_tail,
  298. NULL);
  299. ACPI_INIT_GLOBAL(struct acpi_comment_addr_node,
  300. *acpi_gbl_comment_addr_list_head, NULL);
  301. ACPI_INIT_GLOBAL(struct acpi_file_node, *acpi_gbl_file_tree_root, NULL);
  302. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_reg_comment_cache);
  303. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_comment_addr_cache);
  304. ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_file_cache);
  305. ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_asl_conversion, FALSE);
  306. ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_conv_debug_file, NULL);
  307. ACPI_GLOBAL(char, acpi_gbl_table_sig[4]);
  308. #endif
  309. #ifdef ACPI_APPLICATION
  310. ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL);
  311. ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL);
  312. ACPI_INIT_GLOBAL(u8, acpi_gbl_debug_timeout, FALSE);
  313. /* Print buffer */
  314. ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */
  315. ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]);
  316. #endif /* ACPI_APPLICATION */
  317. #endif /* __ACGLOBAL_H__ */