nsutils.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2. /******************************************************************************
  3. *
  4. * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
  5. * parents and siblings and Scope manipulation
  6. *
  7. * Copyright (C) 2000 - 2022, Intel Corp.
  8. *
  9. *****************************************************************************/
  10. #include <acpi/acpi.h>
  11. #include "accommon.h"
  12. #include "acnamesp.h"
  13. #include "amlcode.h"
  14. #define _COMPONENT ACPI_NAMESPACE
  15. ACPI_MODULE_NAME("nsutils")
  16. /* Local prototypes */
  17. #ifdef ACPI_OBSOLETE_FUNCTIONS
  18. acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
  19. #endif
  20. /*******************************************************************************
  21. *
  22. * FUNCTION: acpi_ns_print_node_pathname
  23. *
  24. * PARAMETERS: node - Object
  25. * message - Prefix message
  26. *
  27. * DESCRIPTION: Print an object's full namespace pathname
  28. * Manages allocation/freeing of a pathname buffer
  29. *
  30. ******************************************************************************/
  31. void
  32. acpi_ns_print_node_pathname(struct acpi_namespace_node *node,
  33. const char *message)
  34. {
  35. struct acpi_buffer buffer;
  36. acpi_status status;
  37. if (!node) {
  38. acpi_os_printf("[NULL NAME]");
  39. return;
  40. }
  41. /* Convert handle to full pathname and print it (with supplied message) */
  42. buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
  43. status = acpi_ns_handle_to_pathname(node, &buffer, TRUE);
  44. if (ACPI_SUCCESS(status)) {
  45. if (message) {
  46. acpi_os_printf("%s ", message);
  47. }
  48. acpi_os_printf("%s", (char *)buffer.pointer);
  49. ACPI_FREE(buffer.pointer);
  50. }
  51. }
  52. /*******************************************************************************
  53. *
  54. * FUNCTION: acpi_ns_get_type
  55. *
  56. * PARAMETERS: node - Parent Node to be examined
  57. *
  58. * RETURN: Type field from Node whose handle is passed
  59. *
  60. * DESCRIPTION: Return the type of a Namespace node
  61. *
  62. ******************************************************************************/
  63. acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
  64. {
  65. ACPI_FUNCTION_TRACE(ns_get_type);
  66. if (!node) {
  67. ACPI_WARNING((AE_INFO, "Null Node parameter"));
  68. return_UINT8(ACPI_TYPE_ANY);
  69. }
  70. return_UINT8(node->type);
  71. }
  72. /*******************************************************************************
  73. *
  74. * FUNCTION: acpi_ns_local
  75. *
  76. * PARAMETERS: type - A namespace object type
  77. *
  78. * RETURN: LOCAL if names must be found locally in objects of the
  79. * passed type, 0 if enclosing scopes should be searched
  80. *
  81. * DESCRIPTION: Returns scope rule for the given object type.
  82. *
  83. ******************************************************************************/
  84. u32 acpi_ns_local(acpi_object_type type)
  85. {
  86. ACPI_FUNCTION_TRACE(ns_local);
  87. if (!acpi_ut_valid_object_type(type)) {
  88. /* Type code out of range */
  89. ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type));
  90. return_UINT32(ACPI_NS_NORMAL);
  91. }
  92. return_UINT32(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
  93. }
  94. /*******************************************************************************
  95. *
  96. * FUNCTION: acpi_ns_get_internal_name_length
  97. *
  98. * PARAMETERS: info - Info struct initialized with the
  99. * external name pointer.
  100. *
  101. * RETURN: None
  102. *
  103. * DESCRIPTION: Calculate the length of the internal (AML) namestring
  104. * corresponding to the external (ASL) namestring.
  105. *
  106. ******************************************************************************/
  107. void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
  108. {
  109. const char *next_external_char;
  110. u32 i;
  111. ACPI_FUNCTION_ENTRY();
  112. next_external_char = info->external_name;
  113. info->num_carats = 0;
  114. info->num_segments = 0;
  115. info->fully_qualified = FALSE;
  116. /*
  117. * For the internal name, the required length is 4 bytes per segment,
  118. * plus 1 each for root_prefix, multi_name_prefix_op, segment count,
  119. * trailing null (which is not really needed, but no there's harm in
  120. * putting it there)
  121. *
  122. * strlen() + 1 covers the first name_seg, which has no path separator
  123. */
  124. if (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
  125. info->fully_qualified = TRUE;
  126. next_external_char++;
  127. /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */
  128. while (ACPI_IS_ROOT_PREFIX(*next_external_char)) {
  129. next_external_char++;
  130. }
  131. } else {
  132. /* Handle Carat prefixes */
  133. while (ACPI_IS_PARENT_PREFIX(*next_external_char)) {
  134. info->num_carats++;
  135. next_external_char++;
  136. }
  137. }
  138. /*
  139. * Determine the number of ACPI name "segments" by counting the number of
  140. * path separators within the string. Start with one segment since the
  141. * segment count is [(# separators) + 1], and zero separators is ok.
  142. */
  143. if (*next_external_char) {
  144. info->num_segments = 1;
  145. for (i = 0; next_external_char[i]; i++) {
  146. if (ACPI_IS_PATH_SEPARATOR(next_external_char[i])) {
  147. info->num_segments++;
  148. }
  149. }
  150. }
  151. info->length = (ACPI_NAMESEG_SIZE * info->num_segments) +
  152. 4 + info->num_carats;
  153. info->next_external_char = next_external_char;
  154. }
  155. /*******************************************************************************
  156. *
  157. * FUNCTION: acpi_ns_build_internal_name
  158. *
  159. * PARAMETERS: info - Info struct fully initialized
  160. *
  161. * RETURN: Status
  162. *
  163. * DESCRIPTION: Construct the internal (AML) namestring
  164. * corresponding to the external (ASL) namestring.
  165. *
  166. ******************************************************************************/
  167. acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
  168. {
  169. u32 num_segments = info->num_segments;
  170. char *internal_name = info->internal_name;
  171. const char *external_name = info->next_external_char;
  172. char *result = NULL;
  173. u32 i;
  174. ACPI_FUNCTION_TRACE(ns_build_internal_name);
  175. /* Setup the correct prefixes, counts, and pointers */
  176. if (info->fully_qualified) {
  177. internal_name[0] = AML_ROOT_PREFIX;
  178. if (num_segments <= 1) {
  179. result = &internal_name[1];
  180. } else if (num_segments == 2) {
  181. internal_name[1] = AML_DUAL_NAME_PREFIX;
  182. result = &internal_name[2];
  183. } else {
  184. internal_name[1] = AML_MULTI_NAME_PREFIX;
  185. internal_name[2] = (char)num_segments;
  186. result = &internal_name[3];
  187. }
  188. } else {
  189. /*
  190. * Not fully qualified.
  191. * Handle Carats first, then append the name segments
  192. */
  193. i = 0;
  194. if (info->num_carats) {
  195. for (i = 0; i < info->num_carats; i++) {
  196. internal_name[i] = AML_PARENT_PREFIX;
  197. }
  198. }
  199. if (num_segments <= 1) {
  200. result = &internal_name[i];
  201. } else if (num_segments == 2) {
  202. internal_name[i] = AML_DUAL_NAME_PREFIX;
  203. result = &internal_name[(acpi_size)i + 1];
  204. } else {
  205. internal_name[i] = AML_MULTI_NAME_PREFIX;
  206. internal_name[(acpi_size)i + 1] = (char)num_segments;
  207. result = &internal_name[(acpi_size)i + 2];
  208. }
  209. }
  210. /* Build the name (minus path separators) */
  211. for (; num_segments; num_segments--) {
  212. for (i = 0; i < ACPI_NAMESEG_SIZE; i++) {
  213. if (ACPI_IS_PATH_SEPARATOR(*external_name) ||
  214. (*external_name == 0)) {
  215. /* Pad the segment with underscore(s) if segment is short */
  216. result[i] = '_';
  217. } else {
  218. /* Convert the character to uppercase and save it */
  219. result[i] = (char)toupper((int)*external_name);
  220. external_name++;
  221. }
  222. }
  223. /* Now we must have a path separator, or the pathname is bad */
  224. if (!ACPI_IS_PATH_SEPARATOR(*external_name) &&
  225. (*external_name != 0)) {
  226. return_ACPI_STATUS(AE_BAD_PATHNAME);
  227. }
  228. /* Move on the next segment */
  229. external_name++;
  230. result += ACPI_NAMESEG_SIZE;
  231. }
  232. /* Terminate the string */
  233. *result = 0;
  234. if (info->fully_qualified) {
  235. ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
  236. "Returning [%p] (abs) \"\\%s\"\n",
  237. internal_name, internal_name));
  238. } else {
  239. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
  240. internal_name, internal_name));
  241. }
  242. return_ACPI_STATUS(AE_OK);
  243. }
  244. /*******************************************************************************
  245. *
  246. * FUNCTION: acpi_ns_internalize_name
  247. *
  248. * PARAMETERS: *external_name - External representation of name
  249. * **Converted name - Where to return the resulting
  250. * internal represention of the name
  251. *
  252. * RETURN: Status
  253. *
  254. * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
  255. * to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
  256. *
  257. *******************************************************************************/
  258. acpi_status
  259. acpi_ns_internalize_name(const char *external_name, char **converted_name)
  260. {
  261. char *internal_name;
  262. struct acpi_namestring_info info;
  263. acpi_status status;
  264. ACPI_FUNCTION_TRACE(ns_internalize_name);
  265. if ((!external_name) || (*external_name == 0) || (!converted_name)) {
  266. return_ACPI_STATUS(AE_BAD_PARAMETER);
  267. }
  268. /* Get the length of the new internal name */
  269. info.external_name = external_name;
  270. acpi_ns_get_internal_name_length(&info);
  271. /* We need a segment to store the internal name */
  272. internal_name = ACPI_ALLOCATE_ZEROED(info.length);
  273. if (!internal_name) {
  274. return_ACPI_STATUS(AE_NO_MEMORY);
  275. }
  276. /* Build the name */
  277. info.internal_name = internal_name;
  278. status = acpi_ns_build_internal_name(&info);
  279. if (ACPI_FAILURE(status)) {
  280. ACPI_FREE(internal_name);
  281. return_ACPI_STATUS(status);
  282. }
  283. *converted_name = internal_name;
  284. return_ACPI_STATUS(AE_OK);
  285. }
  286. /*******************************************************************************
  287. *
  288. * FUNCTION: acpi_ns_externalize_name
  289. *
  290. * PARAMETERS: internal_name_length - Length of the internal name below
  291. * internal_name - Internal representation of name
  292. * converted_name_length - Where the length is returned
  293. * converted_name - Where the resulting external name
  294. * is returned
  295. *
  296. * RETURN: Status
  297. *
  298. * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
  299. * to its external (printable) form (e.g. "\_PR_.CPU0")
  300. *
  301. ******************************************************************************/
  302. acpi_status
  303. acpi_ns_externalize_name(u32 internal_name_length,
  304. const char *internal_name,
  305. u32 * converted_name_length, char **converted_name)
  306. {
  307. u32 names_index = 0;
  308. u32 num_segments = 0;
  309. u32 required_length;
  310. u32 prefix_length = 0;
  311. u32 i = 0;
  312. u32 j = 0;
  313. ACPI_FUNCTION_TRACE(ns_externalize_name);
  314. if (!internal_name_length || !internal_name || !converted_name) {
  315. return_ACPI_STATUS(AE_BAD_PARAMETER);
  316. }
  317. /* Check for a prefix (one '\' | one or more '^') */
  318. switch (internal_name[0]) {
  319. case AML_ROOT_PREFIX:
  320. prefix_length = 1;
  321. break;
  322. case AML_PARENT_PREFIX:
  323. for (i = 0; i < internal_name_length; i++) {
  324. if (ACPI_IS_PARENT_PREFIX(internal_name[i])) {
  325. prefix_length = i + 1;
  326. } else {
  327. break;
  328. }
  329. }
  330. if (i == internal_name_length) {
  331. prefix_length = i;
  332. }
  333. break;
  334. default:
  335. break;
  336. }
  337. /*
  338. * Check for object names. Note that there could be 0-255 of these
  339. * 4-byte elements.
  340. */
  341. if (prefix_length < internal_name_length) {
  342. switch (internal_name[prefix_length]) {
  343. case AML_MULTI_NAME_PREFIX:
  344. /* <count> 4-byte names */
  345. names_index = prefix_length + 2;
  346. num_segments = (u8)
  347. internal_name[(acpi_size)prefix_length + 1];
  348. break;
  349. case AML_DUAL_NAME_PREFIX:
  350. /* Two 4-byte names */
  351. names_index = prefix_length + 1;
  352. num_segments = 2;
  353. break;
  354. case 0:
  355. /* null_name */
  356. names_index = 0;
  357. num_segments = 0;
  358. break;
  359. default:
  360. /* one 4-byte name */
  361. names_index = prefix_length;
  362. num_segments = 1;
  363. break;
  364. }
  365. }
  366. /*
  367. * Calculate the length of converted_name, which equals the length
  368. * of the prefix, length of all object names, length of any required
  369. * punctuation ('.') between object names, plus the NULL terminator.
  370. */
  371. required_length = prefix_length + (4 * num_segments) +
  372. ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
  373. /*
  374. * Check to see if we're still in bounds. If not, there's a problem
  375. * with internal_name (invalid format).
  376. */
  377. if (required_length > internal_name_length) {
  378. ACPI_ERROR((AE_INFO, "Invalid internal name"));
  379. return_ACPI_STATUS(AE_BAD_PATHNAME);
  380. }
  381. /* Build the converted_name */
  382. *converted_name = ACPI_ALLOCATE_ZEROED(required_length);
  383. if (!(*converted_name)) {
  384. return_ACPI_STATUS(AE_NO_MEMORY);
  385. }
  386. j = 0;
  387. for (i = 0; i < prefix_length; i++) {
  388. (*converted_name)[j++] = internal_name[i];
  389. }
  390. if (num_segments > 0) {
  391. for (i = 0; i < num_segments; i++) {
  392. if (i > 0) {
  393. (*converted_name)[j++] = '.';
  394. }
  395. /* Copy and validate the 4-char name segment */
  396. ACPI_COPY_NAMESEG(&(*converted_name)[j],
  397. &internal_name[names_index]);
  398. acpi_ut_repair_name(&(*converted_name)[j]);
  399. j += ACPI_NAMESEG_SIZE;
  400. names_index += ACPI_NAMESEG_SIZE;
  401. }
  402. }
  403. if (converted_name_length) {
  404. *converted_name_length = (u32) required_length;
  405. }
  406. return_ACPI_STATUS(AE_OK);
  407. }
  408. /*******************************************************************************
  409. *
  410. * FUNCTION: acpi_ns_validate_handle
  411. *
  412. * PARAMETERS: handle - Handle to be validated and typecast to a
  413. * namespace node.
  414. *
  415. * RETURN: A pointer to a namespace node
  416. *
  417. * DESCRIPTION: Convert a namespace handle to a namespace node. Handles special
  418. * cases for the root node.
  419. *
  420. * NOTE: Real integer handles would allow for more verification
  421. * and keep all pointers within this subsystem - however this introduces
  422. * more overhead and has not been necessary to this point. Drivers
  423. * holding handles are typically notified before a node becomes invalid
  424. * due to a table unload.
  425. *
  426. ******************************************************************************/
  427. struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)
  428. {
  429. ACPI_FUNCTION_ENTRY();
  430. /* Parameter validation */
  431. if ((!handle) || (handle == ACPI_ROOT_OBJECT)) {
  432. return (acpi_gbl_root_node);
  433. }
  434. /* We can at least attempt to verify the handle */
  435. if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) {
  436. return (NULL);
  437. }
  438. return (ACPI_CAST_PTR(struct acpi_namespace_node, handle));
  439. }
  440. /*******************************************************************************
  441. *
  442. * FUNCTION: acpi_ns_terminate
  443. *
  444. * PARAMETERS: none
  445. *
  446. * RETURN: none
  447. *
  448. * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
  449. *
  450. ******************************************************************************/
  451. void acpi_ns_terminate(void)
  452. {
  453. acpi_status status;
  454. ACPI_FUNCTION_TRACE(ns_terminate);
  455. /*
  456. * Free the entire namespace -- all nodes and all objects
  457. * attached to the nodes
  458. */
  459. acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
  460. /* Delete any objects attached to the root node */
  461. status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
  462. if (ACPI_FAILURE(status)) {
  463. return_VOID;
  464. }
  465. acpi_ns_delete_node(acpi_gbl_root_node);
  466. (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
  467. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
  468. return_VOID;
  469. }
  470. /*******************************************************************************
  471. *
  472. * FUNCTION: acpi_ns_opens_scope
  473. *
  474. * PARAMETERS: type - A valid namespace type
  475. *
  476. * RETURN: NEWSCOPE if the passed type "opens a name scope" according
  477. * to the ACPI specification, else 0
  478. *
  479. ******************************************************************************/
  480. u32 acpi_ns_opens_scope(acpi_object_type type)
  481. {
  482. ACPI_FUNCTION_ENTRY();
  483. if (type > ACPI_TYPE_LOCAL_MAX) {
  484. /* type code out of range */
  485. ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type));
  486. return (ACPI_NS_NORMAL);
  487. }
  488. return (((u32)acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
  489. }
  490. /*******************************************************************************
  491. *
  492. * FUNCTION: acpi_ns_get_node_unlocked
  493. *
  494. * PARAMETERS: *pathname - Name to be found, in external (ASL) format. The
  495. * \ (backslash) and ^ (carat) prefixes, and the
  496. * . (period) to separate segments are supported.
  497. * prefix_node - Root of subtree to be searched, or NS_ALL for the
  498. * root of the name space. If Name is fully
  499. * qualified (first s8 is '\'), the passed value
  500. * of Scope will not be accessed.
  501. * flags - Used to indicate whether to perform upsearch or
  502. * not.
  503. * return_node - Where the Node is returned
  504. *
  505. * DESCRIPTION: Look up a name relative to a given scope and return the
  506. * corresponding Node. NOTE: Scope can be null.
  507. *
  508. * MUTEX: Doesn't locks namespace
  509. *
  510. ******************************************************************************/
  511. acpi_status
  512. acpi_ns_get_node_unlocked(struct acpi_namespace_node *prefix_node,
  513. const char *pathname,
  514. u32 flags, struct acpi_namespace_node **return_node)
  515. {
  516. union acpi_generic_state scope_info;
  517. acpi_status status;
  518. char *internal_path;
  519. ACPI_FUNCTION_TRACE_PTR(ns_get_node_unlocked,
  520. ACPI_CAST_PTR(char, pathname));
  521. /* Simplest case is a null pathname */
  522. if (!pathname) {
  523. *return_node = prefix_node;
  524. if (!prefix_node) {
  525. *return_node = acpi_gbl_root_node;
  526. }
  527. return_ACPI_STATUS(AE_OK);
  528. }
  529. /* Quick check for a reference to the root */
  530. if (ACPI_IS_ROOT_PREFIX(pathname[0]) && (!pathname[1])) {
  531. *return_node = acpi_gbl_root_node;
  532. return_ACPI_STATUS(AE_OK);
  533. }
  534. /* Convert path to internal representation */
  535. status = acpi_ns_internalize_name(pathname, &internal_path);
  536. if (ACPI_FAILURE(status)) {
  537. return_ACPI_STATUS(status);
  538. }
  539. /* Setup lookup scope (search starting point) */
  540. scope_info.scope.node = prefix_node;
  541. /* Lookup the name in the namespace */
  542. status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY,
  543. ACPI_IMODE_EXECUTE,
  544. (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL,
  545. return_node);
  546. if (ACPI_FAILURE(status)) {
  547. ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s, %s\n",
  548. pathname, acpi_format_exception(status)));
  549. }
  550. ACPI_FREE(internal_path);
  551. return_ACPI_STATUS(status);
  552. }
  553. /*******************************************************************************
  554. *
  555. * FUNCTION: acpi_ns_get_node
  556. *
  557. * PARAMETERS: *pathname - Name to be found, in external (ASL) format. The
  558. * \ (backslash) and ^ (carat) prefixes, and the
  559. * . (period) to separate segments are supported.
  560. * prefix_node - Root of subtree to be searched, or NS_ALL for the
  561. * root of the name space. If Name is fully
  562. * qualified (first s8 is '\'), the passed value
  563. * of Scope will not be accessed.
  564. * flags - Used to indicate whether to perform upsearch or
  565. * not.
  566. * return_node - Where the Node is returned
  567. *
  568. * DESCRIPTION: Look up a name relative to a given scope and return the
  569. * corresponding Node. NOTE: Scope can be null.
  570. *
  571. * MUTEX: Locks namespace
  572. *
  573. ******************************************************************************/
  574. acpi_status
  575. acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
  576. const char *pathname,
  577. u32 flags, struct acpi_namespace_node **return_node)
  578. {
  579. acpi_status status;
  580. ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
  581. status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
  582. if (ACPI_FAILURE(status)) {
  583. return_ACPI_STATUS(status);
  584. }
  585. status = acpi_ns_get_node_unlocked(prefix_node, pathname,
  586. flags, return_node);
  587. (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
  588. return_ACPI_STATUS(status);
  589. }