rsmisc.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2. /*******************************************************************************
  3. *
  4. * Module Name: rsmisc - Miscellaneous resource descriptors
  5. *
  6. ******************************************************************************/
  7. #include <acpi/acpi.h>
  8. #include "accommon.h"
  9. #include "acresrc.h"
  10. #define _COMPONENT ACPI_RESOURCES
  11. ACPI_MODULE_NAME("rsmisc")
  12. #define INIT_RESOURCE_TYPE(i) i->resource_offset
  13. #define INIT_RESOURCE_LENGTH(i) i->aml_offset
  14. #define INIT_TABLE_LENGTH(i) i->value
  15. #define COMPARE_OPCODE(i) i->resource_offset
  16. #define COMPARE_TARGET(i) i->aml_offset
  17. #define COMPARE_VALUE(i) i->value
  18. /*******************************************************************************
  19. *
  20. * FUNCTION: acpi_rs_convert_aml_to_resource
  21. *
  22. * PARAMETERS: resource - Pointer to the resource descriptor
  23. * aml - Where the AML descriptor is returned
  24. * info - Pointer to appropriate conversion table
  25. *
  26. * RETURN: Status
  27. *
  28. * DESCRIPTION: Convert an external AML resource descriptor to the corresponding
  29. * internal resource descriptor
  30. *
  31. ******************************************************************************/
  32. acpi_status
  33. acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
  34. union aml_resource *aml,
  35. struct acpi_rsconvert_info *info)
  36. {
  37. acpi_rs_length aml_resource_length;
  38. void *source;
  39. void *destination;
  40. char *target;
  41. u8 count;
  42. u8 flags_mode = FALSE;
  43. u16 item_count = 0;
  44. u16 temp16 = 0;
  45. ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource);
  46. if (!info) {
  47. return_ACPI_STATUS(AE_BAD_PARAMETER);
  48. }
  49. if (((acpi_size)resource) & 0x3) {
  50. /* Each internal resource struct is expected to be 32-bit aligned */
  51. ACPI_WARNING((AE_INFO,
  52. "Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
  53. resource, resource->type, resource->length));
  54. }
  55. /* Extract the resource Length field (does not include header length) */
  56. aml_resource_length = acpi_ut_get_resource_length(aml);
  57. /*
  58. * First table entry must be ACPI_RSC_INITxxx and must contain the
  59. * table length (# of table entries)
  60. */
  61. count = INIT_TABLE_LENGTH(info);
  62. while (count) {
  63. /*
  64. * Source is the external AML byte stream buffer,
  65. * destination is the internal resource descriptor
  66. */
  67. source = ACPI_ADD_PTR(void, aml, info->aml_offset);
  68. destination =
  69. ACPI_ADD_PTR(void, resource, info->resource_offset);
  70. switch (info->opcode) {
  71. case ACPI_RSC_INITGET:
  72. /*
  73. * Get the resource type and the initial (minimum) length
  74. */
  75. memset(resource, 0, INIT_RESOURCE_LENGTH(info));
  76. resource->type = INIT_RESOURCE_TYPE(info);
  77. resource->length = INIT_RESOURCE_LENGTH(info);
  78. break;
  79. case ACPI_RSC_INITSET:
  80. break;
  81. case ACPI_RSC_FLAGINIT:
  82. flags_mode = TRUE;
  83. break;
  84. case ACPI_RSC_1BITFLAG:
  85. /*
  86. * Mask and shift the flag bit
  87. */
  88. ACPI_SET8(destination,
  89. ((ACPI_GET8(source) >> info->value) & 0x01));
  90. break;
  91. case ACPI_RSC_2BITFLAG:
  92. /*
  93. * Mask and shift the flag bits
  94. */
  95. ACPI_SET8(destination,
  96. ((ACPI_GET8(source) >> info->value) & 0x03));
  97. break;
  98. case ACPI_RSC_3BITFLAG:
  99. /*
  100. * Mask and shift the flag bits
  101. */
  102. ACPI_SET8(destination,
  103. ((ACPI_GET8(source) >> info->value) & 0x07));
  104. break;
  105. case ACPI_RSC_COUNT:
  106. item_count = ACPI_GET8(source);
  107. ACPI_SET8(destination, item_count);
  108. resource->length = resource->length +
  109. (info->value * (item_count - 1));
  110. break;
  111. case ACPI_RSC_COUNT16:
  112. item_count = aml_resource_length;
  113. ACPI_SET16(destination, item_count);
  114. resource->length = resource->length +
  115. (info->value * (item_count - 1));
  116. break;
  117. case ACPI_RSC_COUNT_GPIO_PIN:
  118. target = ACPI_ADD_PTR(void, aml, info->value);
  119. item_count = ACPI_GET16(target) - ACPI_GET16(source);
  120. resource->length = resource->length + item_count;
  121. item_count = item_count / 2;
  122. ACPI_SET16(destination, item_count);
  123. break;
  124. case ACPI_RSC_COUNT_GPIO_VEN:
  125. item_count = ACPI_GET8(source);
  126. ACPI_SET8(destination, item_count);
  127. resource->length =
  128. resource->length + (info->value * item_count);
  129. break;
  130. case ACPI_RSC_COUNT_GPIO_RES:
  131. /*
  132. * Vendor data is optional (length/offset may both be zero)
  133. * Examine vendor data length field first
  134. */
  135. target = ACPI_ADD_PTR(void, aml, (info->value + 2));
  136. if (ACPI_GET16(target)) {
  137. /* Use vendor offset to get resource source length */
  138. target = ACPI_ADD_PTR(void, aml, info->value);
  139. item_count =
  140. ACPI_GET16(target) - ACPI_GET16(source);
  141. } else {
  142. /* No vendor data to worry about */
  143. item_count = aml->large_header.resource_length +
  144. sizeof(struct aml_resource_large_header) -
  145. ACPI_GET16(source);
  146. }
  147. resource->length = resource->length + item_count;
  148. ACPI_SET16(destination, item_count);
  149. break;
  150. case ACPI_RSC_COUNT_SERIAL_VEN:
  151. item_count = ACPI_GET16(source) - info->value;
  152. resource->length = resource->length + item_count;
  153. ACPI_SET16(destination, item_count);
  154. break;
  155. case ACPI_RSC_COUNT_SERIAL_RES:
  156. item_count = (aml_resource_length +
  157. sizeof(struct aml_resource_large_header))
  158. - ACPI_GET16(source) - info->value;
  159. resource->length = resource->length + item_count;
  160. ACPI_SET16(destination, item_count);
  161. break;
  162. case ACPI_RSC_LENGTH:
  163. resource->length = resource->length + info->value;
  164. break;
  165. case ACPI_RSC_MOVE8:
  166. case ACPI_RSC_MOVE16:
  167. case ACPI_RSC_MOVE32:
  168. case ACPI_RSC_MOVE64:
  169. /*
  170. * Raw data move. Use the Info value field unless item_count has
  171. * been previously initialized via a COUNT opcode
  172. */
  173. if (info->value) {
  174. item_count = info->value;
  175. }
  176. acpi_rs_move_data(destination, source, item_count,
  177. info->opcode);
  178. break;
  179. case ACPI_RSC_MOVE_GPIO_PIN:
  180. /* Generate and set the PIN data pointer */
  181. target = (char *)ACPI_ADD_PTR(void, resource,
  182. (resource->length -
  183. item_count * 2));
  184. *(u16 **)destination = ACPI_CAST_PTR(u16, target);
  185. /* Copy the PIN data */
  186. source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
  187. acpi_rs_move_data(target, source, item_count,
  188. info->opcode);
  189. break;
  190. case ACPI_RSC_MOVE_GPIO_RES:
  191. /* Generate and set the resource_source string pointer */
  192. target = (char *)ACPI_ADD_PTR(void, resource,
  193. (resource->length -
  194. item_count));
  195. *(u8 **)destination = ACPI_CAST_PTR(u8, target);
  196. /* Copy the resource_source string */
  197. source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
  198. acpi_rs_move_data(target, source, item_count,
  199. info->opcode);
  200. break;
  201. case ACPI_RSC_MOVE_SERIAL_VEN:
  202. /* Generate and set the Vendor Data pointer */
  203. target = (char *)ACPI_ADD_PTR(void, resource,
  204. (resource->length -
  205. item_count));
  206. *(u8 **)destination = ACPI_CAST_PTR(u8, target);
  207. /* Copy the Vendor Data */
  208. source = ACPI_ADD_PTR(void, aml, info->value);
  209. acpi_rs_move_data(target, source, item_count,
  210. info->opcode);
  211. break;
  212. case ACPI_RSC_MOVE_SERIAL_RES:
  213. /* Generate and set the resource_source string pointer */
  214. target = (char *)ACPI_ADD_PTR(void, resource,
  215. (resource->length -
  216. item_count));
  217. *(u8 **)destination = ACPI_CAST_PTR(u8, target);
  218. /* Copy the resource_source string */
  219. source =
  220. ACPI_ADD_PTR(void, aml,
  221. (ACPI_GET16(source) + info->value));
  222. acpi_rs_move_data(target, source, item_count,
  223. info->opcode);
  224. break;
  225. case ACPI_RSC_SET8:
  226. memset(destination, info->aml_offset, info->value);
  227. break;
  228. case ACPI_RSC_DATA8:
  229. target = ACPI_ADD_PTR(char, resource, info->value);
  230. memcpy(destination, source, ACPI_GET16(target));
  231. break;
  232. case ACPI_RSC_ADDRESS:
  233. /*
  234. * Common handler for address descriptor flags
  235. */
  236. if (!acpi_rs_get_address_common(resource, aml)) {
  237. return_ACPI_STATUS
  238. (AE_AML_INVALID_RESOURCE_TYPE);
  239. }
  240. break;
  241. case ACPI_RSC_SOURCE:
  242. /*
  243. * Optional resource_source (Index and String)
  244. */
  245. resource->length +=
  246. acpi_rs_get_resource_source(aml_resource_length,
  247. info->value,
  248. destination, aml, NULL);
  249. break;
  250. case ACPI_RSC_SOURCEX:
  251. /*
  252. * Optional resource_source (Index and String). This is the more
  253. * complicated case used by the Interrupt() macro
  254. */
  255. target = ACPI_ADD_PTR(char, resource,
  256. info->aml_offset +
  257. (item_count * 4));
  258. resource->length +=
  259. acpi_rs_get_resource_source(aml_resource_length,
  260. (acpi_rs_length)
  261. (((item_count -
  262. 1) * sizeof(u32)) +
  263. info->value),
  264. destination, aml,
  265. target);
  266. break;
  267. case ACPI_RSC_BITMASK:
  268. /*
  269. * 8-bit encoded bitmask (DMA macro)
  270. */
  271. item_count =
  272. acpi_rs_decode_bitmask(ACPI_GET8(source),
  273. destination);
  274. if (item_count) {
  275. resource->length += (item_count - 1);
  276. }
  277. target = ACPI_ADD_PTR(char, resource, info->value);
  278. ACPI_SET8(target, item_count);
  279. break;
  280. case ACPI_RSC_BITMASK16:
  281. /*
  282. * 16-bit encoded bitmask (IRQ macro)
  283. */
  284. ACPI_MOVE_16_TO_16(&temp16, source);
  285. item_count =
  286. acpi_rs_decode_bitmask(temp16, destination);
  287. if (item_count) {
  288. resource->length += (item_count - 1);
  289. }
  290. target = ACPI_ADD_PTR(char, resource, info->value);
  291. ACPI_SET8(target, item_count);
  292. break;
  293. case ACPI_RSC_EXIT_NE:
  294. /*
  295. * control - Exit conversion if not equal
  296. */
  297. switch (info->resource_offset) {
  298. case ACPI_RSC_COMPARE_AML_LENGTH:
  299. if (aml_resource_length != info->value) {
  300. goto exit;
  301. }
  302. break;
  303. case ACPI_RSC_COMPARE_VALUE:
  304. if (ACPI_GET8(source) != info->value) {
  305. goto exit;
  306. }
  307. break;
  308. default:
  309. ACPI_ERROR((AE_INFO,
  310. "Invalid conversion sub-opcode"));
  311. return_ACPI_STATUS(AE_BAD_PARAMETER);
  312. }
  313. break;
  314. default:
  315. ACPI_ERROR((AE_INFO, "Invalid conversion opcode"));
  316. return_ACPI_STATUS(AE_BAD_PARAMETER);
  317. }
  318. count--;
  319. info++;
  320. }
  321. exit:
  322. if (!flags_mode) {
  323. /* Round the resource struct length up to the next boundary (32 or 64) */
  324. resource->length = (u32)
  325. ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length);
  326. }
  327. return_ACPI_STATUS(AE_OK);
  328. }
  329. /*******************************************************************************
  330. *
  331. * FUNCTION: acpi_rs_convert_resource_to_aml
  332. *
  333. * PARAMETERS: resource - Pointer to the resource descriptor
  334. * aml - Where the AML descriptor is returned
  335. * info - Pointer to appropriate conversion table
  336. *
  337. * RETURN: Status
  338. *
  339. * DESCRIPTION: Convert an internal resource descriptor to the corresponding
  340. * external AML resource descriptor.
  341. *
  342. ******************************************************************************/
  343. acpi_status
  344. acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
  345. union aml_resource *aml,
  346. struct acpi_rsconvert_info *info)
  347. {
  348. void *source = NULL;
  349. void *destination;
  350. char *target;
  351. acpi_rsdesc_size aml_length = 0;
  352. u8 count;
  353. u16 temp16 = 0;
  354. u16 item_count = 0;
  355. ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml);
  356. if (!info) {
  357. return_ACPI_STATUS(AE_BAD_PARAMETER);
  358. }
  359. /*
  360. * First table entry must be ACPI_RSC_INITxxx and must contain the
  361. * table length (# of table entries)
  362. */
  363. count = INIT_TABLE_LENGTH(info);
  364. while (count) {
  365. /*
  366. * Source is the internal resource descriptor,
  367. * destination is the external AML byte stream buffer
  368. */
  369. source = ACPI_ADD_PTR(void, resource, info->resource_offset);
  370. destination = ACPI_ADD_PTR(void, aml, info->aml_offset);
  371. switch (info->opcode) {
  372. case ACPI_RSC_INITSET:
  373. memset(aml, 0, INIT_RESOURCE_LENGTH(info));
  374. aml_length = INIT_RESOURCE_LENGTH(info);
  375. acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info),
  376. aml_length, aml);
  377. break;
  378. case ACPI_RSC_INITGET:
  379. break;
  380. case ACPI_RSC_FLAGINIT:
  381. /*
  382. * Clear the flag byte
  383. */
  384. ACPI_SET8(destination, 0);
  385. break;
  386. case ACPI_RSC_1BITFLAG:
  387. /*
  388. * Mask and shift the flag bit
  389. */
  390. ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
  391. ((ACPI_GET8(source) & 0x01) << info->
  392. value));
  393. break;
  394. case ACPI_RSC_2BITFLAG:
  395. /*
  396. * Mask and shift the flag bits
  397. */
  398. ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
  399. ((ACPI_GET8(source) & 0x03) << info->
  400. value));
  401. break;
  402. case ACPI_RSC_3BITFLAG:
  403. /*
  404. * Mask and shift the flag bits
  405. */
  406. ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
  407. ((ACPI_GET8(source) & 0x07) << info->
  408. value));
  409. break;
  410. case ACPI_RSC_COUNT:
  411. item_count = ACPI_GET8(source);
  412. ACPI_SET8(destination, item_count);
  413. aml_length = (u16)
  414. (aml_length + (info->value * (item_count - 1)));
  415. break;
  416. case ACPI_RSC_COUNT16:
  417. item_count = ACPI_GET16(source);
  418. aml_length = (u16) (aml_length + item_count);
  419. acpi_rs_set_resource_length(aml_length, aml);
  420. break;
  421. case ACPI_RSC_COUNT_GPIO_PIN:
  422. item_count = ACPI_GET16(source);
  423. ACPI_SET16(destination, aml_length);
  424. aml_length = (u16)(aml_length + item_count * 2);
  425. target = ACPI_ADD_PTR(void, aml, info->value);
  426. ACPI_SET16(target, aml_length);
  427. acpi_rs_set_resource_length(aml_length, aml);
  428. break;
  429. case ACPI_RSC_COUNT_GPIO_VEN:
  430. item_count = ACPI_GET16(source);
  431. ACPI_SET16(destination, item_count);
  432. aml_length =
  433. (u16)(aml_length + (info->value * item_count));
  434. acpi_rs_set_resource_length(aml_length, aml);
  435. break;
  436. case ACPI_RSC_COUNT_GPIO_RES:
  437. /* Set resource source string length */
  438. item_count = ACPI_GET16(source);
  439. ACPI_SET16(destination, aml_length);
  440. /* Compute offset for the Vendor Data */
  441. aml_length = (u16)(aml_length + item_count);
  442. target = ACPI_ADD_PTR(void, aml, info->value);
  443. /* Set vendor offset only if there is vendor data */
  444. ACPI_SET16(target, aml_length);
  445. acpi_rs_set_resource_length(aml_length, aml);
  446. break;
  447. case ACPI_RSC_COUNT_SERIAL_VEN:
  448. item_count = ACPI_GET16(source);
  449. ACPI_SET16(destination, item_count + info->value);
  450. aml_length = (u16)(aml_length + item_count);
  451. acpi_rs_set_resource_length(aml_length, aml);
  452. break;
  453. case ACPI_RSC_COUNT_SERIAL_RES:
  454. item_count = ACPI_GET16(source);
  455. aml_length = (u16)(aml_length + item_count);
  456. acpi_rs_set_resource_length(aml_length, aml);
  457. break;
  458. case ACPI_RSC_LENGTH:
  459. acpi_rs_set_resource_length(info->value, aml);
  460. break;
  461. case ACPI_RSC_MOVE8:
  462. case ACPI_RSC_MOVE16:
  463. case ACPI_RSC_MOVE32:
  464. case ACPI_RSC_MOVE64:
  465. if (info->value) {
  466. item_count = info->value;
  467. }
  468. acpi_rs_move_data(destination, source, item_count,
  469. info->opcode);
  470. break;
  471. case ACPI_RSC_MOVE_GPIO_PIN:
  472. destination = (char *)ACPI_ADD_PTR(void, aml,
  473. ACPI_GET16
  474. (destination));
  475. source = *(u16 **)source;
  476. acpi_rs_move_data(destination, source, item_count,
  477. info->opcode);
  478. break;
  479. case ACPI_RSC_MOVE_GPIO_RES:
  480. /* Used for both resource_source string and vendor_data */
  481. destination = (char *)ACPI_ADD_PTR(void, aml,
  482. ACPI_GET16
  483. (destination));
  484. source = *(u8 **)source;
  485. acpi_rs_move_data(destination, source, item_count,
  486. info->opcode);
  487. break;
  488. case ACPI_RSC_MOVE_SERIAL_VEN:
  489. destination = (char *)ACPI_ADD_PTR(void, aml,
  490. (aml_length -
  491. item_count));
  492. source = *(u8 **)source;
  493. acpi_rs_move_data(destination, source, item_count,
  494. info->opcode);
  495. break;
  496. case ACPI_RSC_MOVE_SERIAL_RES:
  497. destination = (char *)ACPI_ADD_PTR(void, aml,
  498. (aml_length -
  499. item_count));
  500. source = *(u8 **)source;
  501. acpi_rs_move_data(destination, source, item_count,
  502. info->opcode);
  503. break;
  504. case ACPI_RSC_ADDRESS:
  505. /* Set the Resource Type, General Flags, and Type-Specific Flags */
  506. acpi_rs_set_address_common(aml, resource);
  507. break;
  508. case ACPI_RSC_SOURCEX:
  509. /*
  510. * Optional resource_source (Index and String)
  511. */
  512. aml_length =
  513. acpi_rs_set_resource_source(aml,
  514. (acpi_rs_length)
  515. aml_length, source);
  516. acpi_rs_set_resource_length(aml_length, aml);
  517. break;
  518. case ACPI_RSC_SOURCE:
  519. /*
  520. * Optional resource_source (Index and String). This is the more
  521. * complicated case used by the Interrupt() macro
  522. */
  523. aml_length =
  524. acpi_rs_set_resource_source(aml, info->value,
  525. source);
  526. acpi_rs_set_resource_length(aml_length, aml);
  527. break;
  528. case ACPI_RSC_BITMASK:
  529. /*
  530. * 8-bit encoded bitmask (DMA macro)
  531. */
  532. ACPI_SET8(destination,
  533. acpi_rs_encode_bitmask(source,
  534. *ACPI_ADD_PTR(u8,
  535. resource,
  536. info->
  537. value)));
  538. break;
  539. case ACPI_RSC_BITMASK16:
  540. /*
  541. * 16-bit encoded bitmask (IRQ macro)
  542. */
  543. temp16 =
  544. acpi_rs_encode_bitmask(source,
  545. *ACPI_ADD_PTR(u8, resource,
  546. info->value));
  547. ACPI_MOVE_16_TO_16(destination, &temp16);
  548. break;
  549. case ACPI_RSC_EXIT_LE:
  550. /*
  551. * control - Exit conversion if less than or equal
  552. */
  553. if (item_count <= info->value) {
  554. goto exit;
  555. }
  556. break;
  557. case ACPI_RSC_EXIT_NE:
  558. /*
  559. * control - Exit conversion if not equal
  560. */
  561. switch (COMPARE_OPCODE(info)) {
  562. case ACPI_RSC_COMPARE_VALUE:
  563. if (*ACPI_ADD_PTR(u8, resource,
  564. COMPARE_TARGET(info)) !=
  565. COMPARE_VALUE(info)) {
  566. goto exit;
  567. }
  568. break;
  569. default:
  570. ACPI_ERROR((AE_INFO,
  571. "Invalid conversion sub-opcode"));
  572. return_ACPI_STATUS(AE_BAD_PARAMETER);
  573. }
  574. break;
  575. case ACPI_RSC_EXIT_EQ:
  576. /*
  577. * control - Exit conversion if equal
  578. */
  579. if (*ACPI_ADD_PTR(u8, resource,
  580. COMPARE_TARGET(info)) ==
  581. COMPARE_VALUE(info)) {
  582. goto exit;
  583. }
  584. break;
  585. default:
  586. ACPI_ERROR((AE_INFO, "Invalid conversion opcode"));
  587. return_ACPI_STATUS(AE_BAD_PARAMETER);
  588. }
  589. count--;
  590. info++;
  591. }
  592. exit:
  593. return_ACPI_STATUS(AE_OK);
  594. }
  595. #if 0
  596. /* Previous resource validations */
  597. if (aml->ext_address64.revision_ID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
  598. return_ACPI_STATUS(AE_SUPPORT);
  599. }
  600. if (resource->data.start_dpf.performance_robustness >= 3) {
  601. return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
  602. }
  603. if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
  604. /*
  605. * Only [active_high, edge_sensitive] or [active_low, level_sensitive]
  606. * polarity/trigger interrupts are allowed (ACPI spec, section
  607. * "IRQ Format"), so 0x00 and 0x09 are illegal.
  608. */
  609. ACPI_ERROR((AE_INFO,
  610. "Invalid interrupt polarity/trigger in resource list, 0x%X",
  611. aml->irq.flags));
  612. return_ACPI_STATUS(AE_BAD_DATA);
  613. }
  614. resource->data.extended_irq.interrupt_count = temp8;
  615. if (temp8 < 1) {
  616. /* Must have at least one IRQ */
  617. return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
  618. }
  619. if (resource->data.dma.transfer == 0x03) {
  620. ACPI_ERROR((AE_INFO, "Invalid DMA.Transfer preference (3)"));
  621. return_ACPI_STATUS(AE_BAD_DATA);
  622. }
  623. #endif