rsmisc.c 19 KB

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