rsmisc.c 19 KB

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