utxface.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. /******************************************************************************
  2. *
  3. * Module Name: utxface - External interfaces for "global" ACPI functions
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2012, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #include <linux/export.h>
  43. #include <acpi/acpi.h>
  44. #include "accommon.h"
  45. #include "acevents.h"
  46. #include "acnamesp.h"
  47. #include "acdebug.h"
  48. #include "actables.h"
  49. #include "acinterp.h"
  50. #define _COMPONENT ACPI_UTILITIES
  51. ACPI_MODULE_NAME("utxface")
  52. #ifndef ACPI_ASL_COMPILER
  53. /*******************************************************************************
  54. *
  55. * FUNCTION: acpi_initialize_subsystem
  56. *
  57. * PARAMETERS: None
  58. *
  59. * RETURN: Status
  60. *
  61. * DESCRIPTION: Initializes all global variables. This is the first function
  62. * called, so any early initialization belongs here.
  63. *
  64. ******************************************************************************/
  65. acpi_status __init acpi_initialize_subsystem(void)
  66. {
  67. acpi_status status;
  68. ACPI_FUNCTION_TRACE(acpi_initialize_subsystem);
  69. acpi_gbl_startup_flags = ACPI_SUBSYSTEM_INITIALIZE;
  70. ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
  71. /* Initialize the OS-Dependent layer */
  72. status = acpi_os_initialize();
  73. if (ACPI_FAILURE(status)) {
  74. ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
  75. return_ACPI_STATUS(status);
  76. }
  77. /* Initialize all globals used by the subsystem */
  78. status = acpi_ut_init_globals();
  79. if (ACPI_FAILURE(status)) {
  80. ACPI_EXCEPTION((AE_INFO, status,
  81. "During initialization of globals"));
  82. return_ACPI_STATUS(status);
  83. }
  84. /* Create the default mutex objects */
  85. status = acpi_ut_mutex_initialize();
  86. if (ACPI_FAILURE(status)) {
  87. ACPI_EXCEPTION((AE_INFO, status,
  88. "During Global Mutex creation"));
  89. return_ACPI_STATUS(status);
  90. }
  91. /*
  92. * Initialize the namespace manager and
  93. * the root of the namespace tree
  94. */
  95. status = acpi_ns_root_initialize();
  96. if (ACPI_FAILURE(status)) {
  97. ACPI_EXCEPTION((AE_INFO, status,
  98. "During Namespace initialization"));
  99. return_ACPI_STATUS(status);
  100. }
  101. /* Initialize the global OSI interfaces list with the static names */
  102. status = acpi_ut_initialize_interfaces();
  103. if (ACPI_FAILURE(status)) {
  104. ACPI_EXCEPTION((AE_INFO, status,
  105. "During OSI interfaces initialization"));
  106. return_ACPI_STATUS(status);
  107. }
  108. /* If configured, initialize the AML debugger */
  109. ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
  110. return_ACPI_STATUS(status);
  111. }
  112. /*******************************************************************************
  113. *
  114. * FUNCTION: acpi_enable_subsystem
  115. *
  116. * PARAMETERS: Flags - Init/enable Options
  117. *
  118. * RETURN: Status
  119. *
  120. * DESCRIPTION: Completes the subsystem initialization including hardware.
  121. * Puts system into ACPI mode if it isn't already.
  122. *
  123. ******************************************************************************/
  124. acpi_status acpi_enable_subsystem(u32 flags)
  125. {
  126. acpi_status status = AE_OK;
  127. ACPI_FUNCTION_TRACE(acpi_enable_subsystem);
  128. #if (!ACPI_REDUCED_HARDWARE)
  129. /* Enable ACPI mode */
  130. if (!(flags & ACPI_NO_ACPI_ENABLE)) {
  131. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  132. "[Init] Going into ACPI mode\n"));
  133. acpi_gbl_original_mode = acpi_hw_get_mode();
  134. status = acpi_enable();
  135. if (ACPI_FAILURE(status)) {
  136. ACPI_WARNING((AE_INFO, "AcpiEnable failed"));
  137. return_ACPI_STATUS(status);
  138. }
  139. }
  140. /*
  141. * Obtain a permanent mapping for the FACS. This is required for the
  142. * Global Lock and the Firmware Waking Vector
  143. */
  144. if (!(flags & ACPI_NO_FACS_INIT)) {
  145. status = acpi_tb_initialize_facs();
  146. if (ACPI_FAILURE(status)) {
  147. ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
  148. return_ACPI_STATUS(status);
  149. }
  150. }
  151. #endif /* !ACPI_REDUCED_HARDWARE */
  152. /*
  153. * Install the default op_region handlers. These are installed unless
  154. * other handlers have already been installed via the
  155. * install_address_space_handler interface.
  156. */
  157. if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
  158. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  159. "[Init] Installing default address space handlers\n"));
  160. status = acpi_ev_install_region_handlers();
  161. if (ACPI_FAILURE(status)) {
  162. return_ACPI_STATUS(status);
  163. }
  164. }
  165. #if (!ACPI_REDUCED_HARDWARE)
  166. /*
  167. * Initialize ACPI Event handling (Fixed and General Purpose)
  168. *
  169. * Note1: We must have the hardware and events initialized before we can
  170. * execute any control methods safely. Any control method can require
  171. * ACPI hardware support, so the hardware must be fully initialized before
  172. * any method execution!
  173. *
  174. * Note2: Fixed events are initialized and enabled here. GPEs are
  175. * initialized, but cannot be enabled until after the hardware is
  176. * completely initialized (SCI and global_lock activated)
  177. */
  178. if (!(flags & ACPI_NO_EVENT_INIT)) {
  179. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  180. "[Init] Initializing ACPI events\n"));
  181. status = acpi_ev_initialize_events();
  182. if (ACPI_FAILURE(status)) {
  183. return_ACPI_STATUS(status);
  184. }
  185. }
  186. /*
  187. * Install the SCI handler and Global Lock handler. This completes the
  188. * hardware initialization.
  189. */
  190. if (!(flags & ACPI_NO_HANDLER_INIT)) {
  191. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  192. "[Init] Installing SCI/GL handlers\n"));
  193. status = acpi_ev_install_xrupt_handlers();
  194. if (ACPI_FAILURE(status)) {
  195. return_ACPI_STATUS(status);
  196. }
  197. }
  198. #endif /* !ACPI_REDUCED_HARDWARE */
  199. return_ACPI_STATUS(status);
  200. }
  201. ACPI_EXPORT_SYMBOL(acpi_enable_subsystem)
  202. /*******************************************************************************
  203. *
  204. * FUNCTION: acpi_initialize_objects
  205. *
  206. * PARAMETERS: Flags - Init/enable Options
  207. *
  208. * RETURN: Status
  209. *
  210. * DESCRIPTION: Completes namespace initialization by initializing device
  211. * objects and executing AML code for Regions, buffers, etc.
  212. *
  213. ******************************************************************************/
  214. acpi_status acpi_initialize_objects(u32 flags)
  215. {
  216. acpi_status status = AE_OK;
  217. ACPI_FUNCTION_TRACE(acpi_initialize_objects);
  218. /*
  219. * Run all _REG methods
  220. *
  221. * Note: Any objects accessed by the _REG methods will be automatically
  222. * initialized, even if they contain executable AML (see the call to
  223. * acpi_ns_initialize_objects below).
  224. */
  225. if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
  226. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  227. "[Init] Executing _REG OpRegion methods\n"));
  228. status = acpi_ev_initialize_op_regions();
  229. if (ACPI_FAILURE(status)) {
  230. return_ACPI_STATUS(status);
  231. }
  232. }
  233. /*
  234. * Execute any module-level code that was detected during the table load
  235. * phase. Although illegal since ACPI 2.0, there are many machines that
  236. * contain this type of code. Each block of detected executable AML code
  237. * outside of any control method is wrapped with a temporary control
  238. * method object and placed on a global list. The methods on this list
  239. * are executed below.
  240. */
  241. acpi_ns_exec_module_code_list();
  242. /*
  243. * Initialize the objects that remain uninitialized. This runs the
  244. * executable AML that may be part of the declaration of these objects:
  245. * operation_regions, buffer_fields, Buffers, and Packages.
  246. */
  247. if (!(flags & ACPI_NO_OBJECT_INIT)) {
  248. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  249. "[Init] Completing Initialization of ACPI Objects\n"));
  250. status = acpi_ns_initialize_objects();
  251. if (ACPI_FAILURE(status)) {
  252. return_ACPI_STATUS(status);
  253. }
  254. }
  255. /*
  256. * Initialize all device objects in the namespace. This runs the device
  257. * _STA and _INI methods.
  258. */
  259. if (!(flags & ACPI_NO_DEVICE_INIT)) {
  260. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  261. "[Init] Initializing ACPI Devices\n"));
  262. status = acpi_ns_initialize_devices();
  263. if (ACPI_FAILURE(status)) {
  264. return_ACPI_STATUS(status);
  265. }
  266. }
  267. /*
  268. * Empty the caches (delete the cached objects) on the assumption that
  269. * the table load filled them up more than they will be at runtime --
  270. * thus wasting non-paged memory.
  271. */
  272. status = acpi_purge_cached_objects();
  273. acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
  274. return_ACPI_STATUS(status);
  275. }
  276. ACPI_EXPORT_SYMBOL(acpi_initialize_objects)
  277. #endif
  278. /*******************************************************************************
  279. *
  280. * FUNCTION: acpi_terminate
  281. *
  282. * PARAMETERS: None
  283. *
  284. * RETURN: Status
  285. *
  286. * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources.
  287. *
  288. ******************************************************************************/
  289. acpi_status acpi_terminate(void)
  290. {
  291. acpi_status status;
  292. ACPI_FUNCTION_TRACE(acpi_terminate);
  293. /* Just exit if subsystem is already shutdown */
  294. if (acpi_gbl_shutdown) {
  295. ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
  296. return_ACPI_STATUS(AE_OK);
  297. }
  298. /* Subsystem appears active, go ahead and shut it down */
  299. acpi_gbl_shutdown = TRUE;
  300. acpi_gbl_startup_flags = 0;
  301. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
  302. /* Terminate the AML Debugger if present */
  303. ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = TRUE);
  304. /* Shutdown and free all resources */
  305. acpi_ut_subsystem_shutdown();
  306. /* Free the mutex objects */
  307. acpi_ut_mutex_terminate();
  308. #ifdef ACPI_DEBUGGER
  309. /* Shut down the debugger */
  310. acpi_db_terminate();
  311. #endif
  312. /* Now we can shutdown the OS-dependent layer */
  313. status = acpi_os_terminate();
  314. return_ACPI_STATUS(status);
  315. }
  316. ACPI_EXPORT_SYMBOL(acpi_terminate)
  317. #ifndef ACPI_ASL_COMPILER
  318. #ifdef ACPI_FUTURE_USAGE
  319. /*******************************************************************************
  320. *
  321. * FUNCTION: acpi_subsystem_status
  322. *
  323. * PARAMETERS: None
  324. *
  325. * RETURN: Status of the ACPI subsystem
  326. *
  327. * DESCRIPTION: Other drivers that use the ACPI subsystem should call this
  328. * before making any other calls, to ensure the subsystem
  329. * initialized successfully.
  330. *
  331. ******************************************************************************/
  332. acpi_status acpi_subsystem_status(void)
  333. {
  334. if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) {
  335. return (AE_OK);
  336. } else {
  337. return (AE_ERROR);
  338. }
  339. }
  340. ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
  341. /*******************************************************************************
  342. *
  343. * FUNCTION: acpi_get_system_info
  344. *
  345. * PARAMETERS: out_buffer - A buffer to receive the resources for the
  346. * device
  347. *
  348. * RETURN: Status - the status of the call
  349. *
  350. * DESCRIPTION: This function is called to get information about the current
  351. * state of the ACPI subsystem. It will return system information
  352. * in the out_buffer.
  353. *
  354. * If the function fails an appropriate status will be returned
  355. * and the value of out_buffer is undefined.
  356. *
  357. ******************************************************************************/
  358. acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
  359. {
  360. struct acpi_system_info *info_ptr;
  361. acpi_status status;
  362. ACPI_FUNCTION_TRACE(acpi_get_system_info);
  363. /* Parameter validation */
  364. status = acpi_ut_validate_buffer(out_buffer);
  365. if (ACPI_FAILURE(status)) {
  366. return_ACPI_STATUS(status);
  367. }
  368. /* Validate/Allocate/Clear caller buffer */
  369. status =
  370. acpi_ut_initialize_buffer(out_buffer,
  371. sizeof(struct acpi_system_info));
  372. if (ACPI_FAILURE(status)) {
  373. return_ACPI_STATUS(status);
  374. }
  375. /*
  376. * Populate the return buffer
  377. */
  378. info_ptr = (struct acpi_system_info *)out_buffer->pointer;
  379. info_ptr->acpi_ca_version = ACPI_CA_VERSION;
  380. /* System flags (ACPI capabilities) */
  381. info_ptr->flags = ACPI_SYS_MODE_ACPI;
  382. /* Timer resolution - 24 or 32 bits */
  383. if (acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) {
  384. info_ptr->timer_resolution = 24;
  385. } else {
  386. info_ptr->timer_resolution = 32;
  387. }
  388. /* Clear the reserved fields */
  389. info_ptr->reserved1 = 0;
  390. info_ptr->reserved2 = 0;
  391. /* Current debug levels */
  392. info_ptr->debug_layer = acpi_dbg_layer;
  393. info_ptr->debug_level = acpi_dbg_level;
  394. return_ACPI_STATUS(AE_OK);
  395. }
  396. ACPI_EXPORT_SYMBOL(acpi_get_system_info)
  397. /*****************************************************************************
  398. *
  399. * FUNCTION: acpi_install_initialization_handler
  400. *
  401. * PARAMETERS: Handler - Callback procedure
  402. * Function - Not (currently) used, see below
  403. *
  404. * RETURN: Status
  405. *
  406. * DESCRIPTION: Install an initialization handler
  407. *
  408. * TBD: When a second function is added, must save the Function also.
  409. *
  410. ****************************************************************************/
  411. acpi_status
  412. acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
  413. {
  414. if (!handler) {
  415. return (AE_BAD_PARAMETER);
  416. }
  417. if (acpi_gbl_init_handler) {
  418. return (AE_ALREADY_EXISTS);
  419. }
  420. acpi_gbl_init_handler = handler;
  421. return AE_OK;
  422. }
  423. ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
  424. #endif /* ACPI_FUTURE_USAGE */
  425. /*****************************************************************************
  426. *
  427. * FUNCTION: acpi_purge_cached_objects
  428. *
  429. * PARAMETERS: None
  430. *
  431. * RETURN: Status
  432. *
  433. * DESCRIPTION: Empty all caches (delete the cached objects)
  434. *
  435. ****************************************************************************/
  436. acpi_status acpi_purge_cached_objects(void)
  437. {
  438. ACPI_FUNCTION_TRACE(acpi_purge_cached_objects);
  439. (void)acpi_os_purge_cache(acpi_gbl_state_cache);
  440. (void)acpi_os_purge_cache(acpi_gbl_operand_cache);
  441. (void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
  442. (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
  443. return_ACPI_STATUS(AE_OK);
  444. }
  445. ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)
  446. /*****************************************************************************
  447. *
  448. * FUNCTION: acpi_install_interface
  449. *
  450. * PARAMETERS: interface_name - The interface to install
  451. *
  452. * RETURN: Status
  453. *
  454. * DESCRIPTION: Install an _OSI interface to the global list
  455. *
  456. ****************************************************************************/
  457. acpi_status acpi_install_interface(acpi_string interface_name)
  458. {
  459. acpi_status status;
  460. struct acpi_interface_info *interface_info;
  461. /* Parameter validation */
  462. if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
  463. return (AE_BAD_PARAMETER);
  464. }
  465. (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
  466. /* Check if the interface name is already in the global list */
  467. interface_info = acpi_ut_get_interface(interface_name);
  468. if (interface_info) {
  469. /*
  470. * The interface already exists in the list. This is OK if the
  471. * interface has been marked invalid -- just clear the bit.
  472. */
  473. if (interface_info->flags & ACPI_OSI_INVALID) {
  474. interface_info->flags &= ~ACPI_OSI_INVALID;
  475. status = AE_OK;
  476. } else {
  477. status = AE_ALREADY_EXISTS;
  478. }
  479. } else {
  480. /* New interface name, install into the global list */
  481. status = acpi_ut_install_interface(interface_name);
  482. }
  483. acpi_os_release_mutex(acpi_gbl_osi_mutex);
  484. return (status);
  485. }
  486. ACPI_EXPORT_SYMBOL(acpi_install_interface)
  487. /*****************************************************************************
  488. *
  489. * FUNCTION: acpi_remove_interface
  490. *
  491. * PARAMETERS: interface_name - The interface to remove
  492. *
  493. * RETURN: Status
  494. *
  495. * DESCRIPTION: Remove an _OSI interface from the global list
  496. *
  497. ****************************************************************************/
  498. acpi_status acpi_remove_interface(acpi_string interface_name)
  499. {
  500. acpi_status status;
  501. /* Parameter validation */
  502. if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
  503. return (AE_BAD_PARAMETER);
  504. }
  505. (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
  506. status = acpi_ut_remove_interface(interface_name);
  507. acpi_os_release_mutex(acpi_gbl_osi_mutex);
  508. return (status);
  509. }
  510. ACPI_EXPORT_SYMBOL(acpi_remove_interface)
  511. /*****************************************************************************
  512. *
  513. * FUNCTION: acpi_install_interface_handler
  514. *
  515. * PARAMETERS: Handler - The _OSI interface handler to install
  516. * NULL means "remove existing handler"
  517. *
  518. * RETURN: Status
  519. *
  520. * DESCRIPTION: Install a handler for the predefined _OSI ACPI method.
  521. * invoked during execution of the internal implementation of
  522. * _OSI. A NULL handler simply removes any existing handler.
  523. *
  524. ****************************************************************************/
  525. acpi_status acpi_install_interface_handler(acpi_interface_handler handler)
  526. {
  527. acpi_status status = AE_OK;
  528. (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER);
  529. if (handler && acpi_gbl_interface_handler) {
  530. status = AE_ALREADY_EXISTS;
  531. } else {
  532. acpi_gbl_interface_handler = handler;
  533. }
  534. acpi_os_release_mutex(acpi_gbl_osi_mutex);
  535. return (status);
  536. }
  537. ACPI_EXPORT_SYMBOL(acpi_install_interface_handler)
  538. /*****************************************************************************
  539. *
  540. * FUNCTION: acpi_check_address_range
  541. *
  542. * PARAMETERS: space_id - Address space ID
  543. * Address - Start address
  544. * Length - Length
  545. * Warn - TRUE if warning on overlap desired
  546. *
  547. * RETURN: Count of the number of conflicts detected.
  548. *
  549. * DESCRIPTION: Check if the input address range overlaps any of the
  550. * ASL operation region address ranges.
  551. *
  552. ****************************************************************************/
  553. u32
  554. acpi_check_address_range(acpi_adr_space_type space_id,
  555. acpi_physical_address address,
  556. acpi_size length, u8 warn)
  557. {
  558. u32 overlaps;
  559. acpi_status status;
  560. status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
  561. if (ACPI_FAILURE(status)) {
  562. return (0);
  563. }
  564. overlaps = acpi_ut_check_address_range(space_id, address,
  565. (u32)length, warn);
  566. (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
  567. return (overlaps);
  568. }
  569. ACPI_EXPORT_SYMBOL(acpi_check_address_range)
  570. #endif /* !ACPI_ASL_COMPILER */