exprep.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /******************************************************************************
  2. *
  3. * Module Name: exprep - ACPI AML field prep utilities
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2016, 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 <acpi/acpi.h>
  43. #include "accommon.h"
  44. #include "acinterp.h"
  45. #include "amlcode.h"
  46. #include "acnamesp.h"
  47. #include "acdispat.h"
  48. #define _COMPONENT ACPI_EXECUTER
  49. ACPI_MODULE_NAME("exprep")
  50. /* Local prototypes */
  51. static u32
  52. acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
  53. u8 field_flags, u32 * return_byte_alignment);
  54. #ifdef ACPI_UNDER_DEVELOPMENT
  55. static u32
  56. acpi_ex_generate_access(u32 field_bit_offset,
  57. u32 field_bit_length, u32 region_length);
  58. /*******************************************************************************
  59. *
  60. * FUNCTION: acpi_ex_generate_access
  61. *
  62. * PARAMETERS: field_bit_offset - Start of field within parent region/buffer
  63. * field_bit_length - Length of field in bits
  64. * region_length - Length of parent in bytes
  65. *
  66. * RETURN: Field granularity (8, 16, 32 or 64) and
  67. * byte_alignment (1, 2, 3, or 4)
  68. *
  69. * DESCRIPTION: Generate an optimal access width for fields defined with the
  70. * any_acc keyword.
  71. *
  72. * NOTE: Need to have the region_length in order to check for boundary
  73. * conditions (end-of-region). However, the region_length is a deferred
  74. * operation. Therefore, to complete this implementation, the generation
  75. * of this access width must be deferred until the region length has
  76. * been evaluated.
  77. *
  78. ******************************************************************************/
  79. static u32
  80. acpi_ex_generate_access(u32 field_bit_offset,
  81. u32 field_bit_length, u32 region_length)
  82. {
  83. u32 field_byte_length;
  84. u32 field_byte_offset;
  85. u32 field_byte_end_offset;
  86. u32 access_byte_width;
  87. u32 field_start_offset;
  88. u32 field_end_offset;
  89. u32 minimum_access_width = 0xFFFFFFFF;
  90. u32 minimum_accesses = 0xFFFFFFFF;
  91. u32 accesses;
  92. ACPI_FUNCTION_TRACE(ex_generate_access);
  93. /* Round Field start offset and length to "minimal" byte boundaries */
  94. field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8));
  95. field_byte_end_offset =
  96. ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length + field_bit_offset, 8));
  97. field_byte_length = field_byte_end_offset - field_byte_offset;
  98. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  99. "Bit length %u, Bit offset %u\n",
  100. field_bit_length, field_bit_offset));
  101. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  102. "Byte Length %u, Byte Offset %u, End Offset %u\n",
  103. field_byte_length, field_byte_offset,
  104. field_byte_end_offset));
  105. /*
  106. * Iterative search for the maximum access width that is both aligned
  107. * and does not go beyond the end of the region
  108. *
  109. * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes)
  110. */
  111. for (access_byte_width = 1; access_byte_width <= 8;
  112. access_byte_width <<= 1) {
  113. /*
  114. * 1) Round end offset up to next access boundary and make sure that
  115. * this does not go beyond the end of the parent region.
  116. * 2) When the Access width is greater than the field_byte_length, we
  117. * are done. (This does not optimize for the perfectly aligned
  118. * case yet).
  119. */
  120. if (ACPI_ROUND_UP(field_byte_end_offset, access_byte_width) <=
  121. region_length) {
  122. field_start_offset =
  123. ACPI_ROUND_DOWN(field_byte_offset,
  124. access_byte_width) /
  125. access_byte_width;
  126. field_end_offset =
  127. ACPI_ROUND_UP((field_byte_length +
  128. field_byte_offset),
  129. access_byte_width) /
  130. access_byte_width;
  131. accesses = field_end_offset - field_start_offset;
  132. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  133. "AccessWidth %u end is within region\n",
  134. access_byte_width));
  135. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  136. "Field Start %u, Field End %u -- requires %u accesses\n",
  137. field_start_offset, field_end_offset,
  138. accesses));
  139. /* Single access is optimal */
  140. if (accesses <= 1) {
  141. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  142. "Entire field can be accessed "
  143. "with one operation of size %u\n",
  144. access_byte_width));
  145. return_VALUE(access_byte_width);
  146. }
  147. /*
  148. * Fits in the region, but requires more than one read/write.
  149. * try the next wider access on next iteration
  150. */
  151. if (accesses < minimum_accesses) {
  152. minimum_accesses = accesses;
  153. minimum_access_width = access_byte_width;
  154. }
  155. } else {
  156. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  157. "AccessWidth %u end is NOT within region\n",
  158. access_byte_width));
  159. if (access_byte_width == 1) {
  160. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  161. "Field goes beyond end-of-region!\n"));
  162. /* Field does not fit in the region at all */
  163. return_VALUE(0);
  164. }
  165. /*
  166. * This width goes beyond the end-of-region, back off to
  167. * previous access
  168. */
  169. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  170. "Backing off to previous optimal access width of %u\n",
  171. minimum_access_width));
  172. return_VALUE(minimum_access_width);
  173. }
  174. }
  175. /*
  176. * Could not read/write field with one operation,
  177. * just use max access width
  178. */
  179. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  180. "Cannot access field in one operation, using width 8\n"));
  181. return_VALUE(8);
  182. }
  183. #endif /* ACPI_UNDER_DEVELOPMENT */
  184. /*******************************************************************************
  185. *
  186. * FUNCTION: acpi_ex_decode_field_access
  187. *
  188. * PARAMETERS: obj_desc - Field object
  189. * field_flags - Encoded fieldflags (contains access bits)
  190. * return_byte_alignment - Where the byte alignment is returned
  191. *
  192. * RETURN: Field granularity (8, 16, 32 or 64) and
  193. * byte_alignment (1, 2, 3, or 4)
  194. *
  195. * DESCRIPTION: Decode the access_type bits of a field definition.
  196. *
  197. ******************************************************************************/
  198. static u32
  199. acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
  200. u8 field_flags, u32 * return_byte_alignment)
  201. {
  202. u32 access;
  203. u32 byte_alignment;
  204. u32 bit_length;
  205. ACPI_FUNCTION_TRACE(ex_decode_field_access);
  206. access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
  207. switch (access) {
  208. case AML_FIELD_ACCESS_ANY:
  209. #ifdef ACPI_UNDER_DEVELOPMENT
  210. byte_alignment =
  211. acpi_ex_generate_access(obj_desc->common_field.
  212. start_field_bit_offset,
  213. obj_desc->common_field.bit_length,
  214. 0xFFFFFFFF
  215. /* Temp until we pass region_length as parameter */
  216. );
  217. bit_length = byte_alignment * 8;
  218. #endif
  219. byte_alignment = 1;
  220. bit_length = 8;
  221. break;
  222. case AML_FIELD_ACCESS_BYTE:
  223. case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
  224. byte_alignment = 1;
  225. bit_length = 8;
  226. break;
  227. case AML_FIELD_ACCESS_WORD:
  228. byte_alignment = 2;
  229. bit_length = 16;
  230. break;
  231. case AML_FIELD_ACCESS_DWORD:
  232. byte_alignment = 4;
  233. bit_length = 32;
  234. break;
  235. case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
  236. byte_alignment = 8;
  237. bit_length = 64;
  238. break;
  239. default:
  240. /* Invalid field access type */
  241. ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
  242. return_UINT32(0);
  243. }
  244. if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
  245. /*
  246. * buffer_field access can be on any byte boundary, so the
  247. * byte_alignment is always 1 byte -- regardless of any byte_alignment
  248. * implied by the field access type.
  249. */
  250. byte_alignment = 1;
  251. }
  252. *return_byte_alignment = byte_alignment;
  253. return_UINT32(bit_length);
  254. }
  255. /*******************************************************************************
  256. *
  257. * FUNCTION: acpi_ex_prep_common_field_object
  258. *
  259. * PARAMETERS: obj_desc - The field object
  260. * field_flags - Access, lock_rule, and update_rule.
  261. * The format of a field_flag is described
  262. * in the ACPI specification
  263. * field_attribute - Special attributes (not used)
  264. * field_bit_position - Field start position
  265. * field_bit_length - Field length in number of bits
  266. *
  267. * RETURN: Status
  268. *
  269. * DESCRIPTION: Initialize the areas of the field object that are common
  270. * to the various types of fields. Note: This is very "sensitive"
  271. * code because we are solving the general case for field
  272. * alignment.
  273. *
  274. ******************************************************************************/
  275. acpi_status
  276. acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
  277. u8 field_flags,
  278. u8 field_attribute,
  279. u32 field_bit_position, u32 field_bit_length)
  280. {
  281. u32 access_bit_width;
  282. u32 byte_alignment;
  283. u32 nearest_byte_address;
  284. ACPI_FUNCTION_TRACE(ex_prep_common_field_object);
  285. /*
  286. * Note: the structure being initialized is the
  287. * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common
  288. * area are initialized by this procedure.
  289. */
  290. obj_desc->common_field.field_flags = field_flags;
  291. obj_desc->common_field.attribute = field_attribute;
  292. obj_desc->common_field.bit_length = field_bit_length;
  293. /*
  294. * Decode the access type so we can compute offsets. The access type gives
  295. * two pieces of information - the width of each field access and the
  296. * necessary byte_alignment (address granularity) of the access.
  297. *
  298. * For any_acc, the access_bit_width is the largest width that is both
  299. * necessary and possible in an attempt to access the whole field in one
  300. * I/O operation. However, for any_acc, the byte_alignment is always one
  301. * byte.
  302. *
  303. * For all Buffer Fields, the byte_alignment is always one byte.
  304. *
  305. * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
  306. * the same (equivalent) as the byte_alignment.
  307. */
  308. access_bit_width =
  309. acpi_ex_decode_field_access(obj_desc, field_flags, &byte_alignment);
  310. if (!access_bit_width) {
  311. return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
  312. }
  313. /* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */
  314. obj_desc->common_field.access_byte_width = (u8)
  315. ACPI_DIV_8(access_bit_width);
  316. /*
  317. * base_byte_offset is the address of the start of the field within the
  318. * region. It is the byte address of the first *datum* (field-width data
  319. * unit) of the field. (i.e., the first datum that contains at least the
  320. * first *bit* of the field.)
  321. *
  322. * Note: byte_alignment is always either equal to the access_bit_width or 8
  323. * (Byte access), and it defines the addressing granularity of the parent
  324. * region or buffer.
  325. */
  326. nearest_byte_address =
  327. ACPI_ROUND_BITS_DOWN_TO_BYTES(field_bit_position);
  328. obj_desc->common_field.base_byte_offset = (u32)
  329. ACPI_ROUND_DOWN(nearest_byte_address, byte_alignment);
  330. /*
  331. * start_field_bit_offset is the offset of the first bit of the field within
  332. * a field datum.
  333. */
  334. obj_desc->common_field.start_field_bit_offset = (u8)
  335. (field_bit_position -
  336. ACPI_MUL_8(obj_desc->common_field.base_byte_offset));
  337. return_ACPI_STATUS(AE_OK);
  338. }
  339. /*******************************************************************************
  340. *
  341. * FUNCTION: acpi_ex_prep_field_value
  342. *
  343. * PARAMETERS: info - Contains all field creation info
  344. *
  345. * RETURN: Status
  346. *
  347. * DESCRIPTION: Construct an object of type union acpi_operand_object with a
  348. * subtype of def_field and connect it to the parent Node.
  349. *
  350. ******************************************************************************/
  351. acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
  352. {
  353. union acpi_operand_object *obj_desc;
  354. union acpi_operand_object *second_desc = NULL;
  355. acpi_status status;
  356. u32 access_byte_width;
  357. u32 type;
  358. ACPI_FUNCTION_TRACE(ex_prep_field_value);
  359. /* Parameter validation */
  360. if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
  361. if (!info->region_node) {
  362. ACPI_ERROR((AE_INFO, "Null RegionNode"));
  363. return_ACPI_STATUS(AE_AML_NO_OPERAND);
  364. }
  365. type = acpi_ns_get_type(info->region_node);
  366. if (type != ACPI_TYPE_REGION) {
  367. ACPI_ERROR((AE_INFO,
  368. "Needed Region, found type 0x%X (%s)", type,
  369. acpi_ut_get_type_name(type)));
  370. return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
  371. }
  372. }
  373. /* Allocate a new field object */
  374. obj_desc = acpi_ut_create_internal_object(info->field_type);
  375. if (!obj_desc) {
  376. return_ACPI_STATUS(AE_NO_MEMORY);
  377. }
  378. /* Initialize areas of the object that are common to all fields */
  379. obj_desc->common_field.node = info->field_node;
  380. status = acpi_ex_prep_common_field_object(obj_desc,
  381. info->field_flags,
  382. info->attribute,
  383. info->field_bit_position,
  384. info->field_bit_length);
  385. if (ACPI_FAILURE(status)) {
  386. acpi_ut_delete_object_desc(obj_desc);
  387. return_ACPI_STATUS(status);
  388. }
  389. /* Initialize areas of the object that are specific to the field type */
  390. switch (info->field_type) {
  391. case ACPI_TYPE_LOCAL_REGION_FIELD:
  392. obj_desc->field.region_obj =
  393. acpi_ns_get_attached_object(info->region_node);
  394. /* Fields specific to generic_serial_bus fields */
  395. obj_desc->field.access_length = info->access_length;
  396. if (info->connection_node) {
  397. second_desc = info->connection_node->object;
  398. if (!(second_desc->common.flags & AOPOBJ_DATA_VALID)) {
  399. status =
  400. acpi_ds_get_buffer_arguments(second_desc);
  401. if (ACPI_FAILURE(status)) {
  402. acpi_ut_delete_object_desc(obj_desc);
  403. return_ACPI_STATUS(status);
  404. }
  405. }
  406. obj_desc->field.resource_buffer =
  407. second_desc->buffer.pointer;
  408. obj_desc->field.resource_length =
  409. (u16)second_desc->buffer.length;
  410. } else if (info->resource_buffer) {
  411. obj_desc->field.resource_buffer = info->resource_buffer;
  412. obj_desc->field.resource_length = info->resource_length;
  413. }
  414. obj_desc->field.pin_number_index = info->pin_number_index;
  415. /* Allow full data read from EC address space */
  416. if ((obj_desc->field.region_obj->region.space_id ==
  417. ACPI_ADR_SPACE_EC)
  418. && (obj_desc->common_field.bit_length > 8)) {
  419. access_byte_width =
  420. ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.
  421. bit_length);
  422. /* Maximum byte width supported is 255 */
  423. if (access_byte_width < 256) {
  424. obj_desc->common_field.access_byte_width =
  425. (u8)access_byte_width;
  426. }
  427. }
  428. /* An additional reference for the container */
  429. acpi_ut_add_reference(obj_desc->field.region_obj);
  430. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  431. "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
  432. obj_desc->field.start_field_bit_offset,
  433. obj_desc->field.base_byte_offset,
  434. obj_desc->field.access_byte_width,
  435. obj_desc->field.region_obj));
  436. break;
  437. case ACPI_TYPE_LOCAL_BANK_FIELD:
  438. obj_desc->bank_field.value = info->bank_value;
  439. obj_desc->bank_field.region_obj =
  440. acpi_ns_get_attached_object(info->region_node);
  441. obj_desc->bank_field.bank_obj =
  442. acpi_ns_get_attached_object(info->register_node);
  443. /* An additional reference for the attached objects */
  444. acpi_ut_add_reference(obj_desc->bank_field.region_obj);
  445. acpi_ut_add_reference(obj_desc->bank_field.bank_obj);
  446. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  447. "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n",
  448. obj_desc->bank_field.start_field_bit_offset,
  449. obj_desc->bank_field.base_byte_offset,
  450. obj_desc->field.access_byte_width,
  451. obj_desc->bank_field.region_obj,
  452. obj_desc->bank_field.bank_obj));
  453. /*
  454. * Remember location in AML stream of the field unit
  455. * opcode and operands -- since the bank_value
  456. * operands must be evaluated.
  457. */
  458. second_desc = obj_desc->common.next_object;
  459. second_desc->extra.aml_start =
  460. ACPI_CAST_PTR(union acpi_parse_object,
  461. info->data_register_node)->named.data;
  462. second_desc->extra.aml_length =
  463. ACPI_CAST_PTR(union acpi_parse_object,
  464. info->data_register_node)->named.length;
  465. break;
  466. case ACPI_TYPE_LOCAL_INDEX_FIELD:
  467. /* Get the Index and Data registers */
  468. obj_desc->index_field.index_obj =
  469. acpi_ns_get_attached_object(info->register_node);
  470. obj_desc->index_field.data_obj =
  471. acpi_ns_get_attached_object(info->data_register_node);
  472. if (!obj_desc->index_field.data_obj
  473. || !obj_desc->index_field.index_obj) {
  474. ACPI_ERROR((AE_INFO,
  475. "Null Index Object during field prep"));
  476. acpi_ut_delete_object_desc(obj_desc);
  477. return_ACPI_STATUS(AE_AML_INTERNAL);
  478. }
  479. /* An additional reference for the attached objects */
  480. acpi_ut_add_reference(obj_desc->index_field.data_obj);
  481. acpi_ut_add_reference(obj_desc->index_field.index_obj);
  482. /*
  483. * April 2006: Changed to match MS behavior
  484. *
  485. * The value written to the Index register is the byte offset of the
  486. * target field in units of the granularity of the index_field
  487. *
  488. * Previously, the value was calculated as an index in terms of the
  489. * width of the Data register, as below:
  490. *
  491. * obj_desc->index_field.Value = (u32)
  492. * (Info->field_bit_position / ACPI_MUL_8 (
  493. * obj_desc->Field.access_byte_width));
  494. *
  495. * February 2006: Tried value as a byte offset:
  496. * obj_desc->index_field.Value = (u32)
  497. * ACPI_DIV_8 (Info->field_bit_position);
  498. */
  499. obj_desc->index_field.value =
  500. (u32) ACPI_ROUND_DOWN(ACPI_DIV_8(info->field_bit_position),
  501. obj_desc->index_field.
  502. access_byte_width);
  503. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  504. "IndexField: BitOff %X, Off %X, Value %X, "
  505. "Gran %X, Index %p, Data %p\n",
  506. obj_desc->index_field.start_field_bit_offset,
  507. obj_desc->index_field.base_byte_offset,
  508. obj_desc->index_field.value,
  509. obj_desc->field.access_byte_width,
  510. obj_desc->index_field.index_obj,
  511. obj_desc->index_field.data_obj));
  512. break;
  513. default:
  514. /* No other types should get here */
  515. break;
  516. }
  517. /*
  518. * Store the constructed descriptor (obj_desc) into the parent Node,
  519. * preserving the current type of that named_obj.
  520. */
  521. status =
  522. acpi_ns_attach_object(info->field_node, obj_desc,
  523. acpi_ns_get_type(info->field_node));
  524. ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
  525. "Set NamedObj %p [%4.4s], ObjDesc %p\n",
  526. info->field_node,
  527. acpi_ut_get_node_name(info->field_node), obj_desc));
  528. /* Remove local reference to the object */
  529. acpi_ut_remove_reference(obj_desc);
  530. return_ACPI_STATUS(status);
  531. }