tbfadt.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. /******************************************************************************
  2. *
  3. * Module Name: tbfadt - FADT table utilities
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2008, 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 <acpi/accommon.h>
  44. #include <acpi/actables.h>
  45. #define _COMPONENT ACPI_TABLES
  46. ACPI_MODULE_NAME("tbfadt")
  47. /* Local prototypes */
  48. static inline void
  49. acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
  50. u8 space_id, u8 byte_width, u64 address);
  51. static void acpi_tb_convert_fadt(void);
  52. static void acpi_tb_validate_fadt(void);
  53. /* Table for conversion of FADT to common internal format and FADT validation */
  54. typedef struct acpi_fadt_info {
  55. char *name;
  56. u8 target;
  57. u8 source;
  58. u8 length;
  59. u8 type;
  60. } acpi_fadt_info;
  61. #define ACPI_FADT_REQUIRED 1
  62. #define ACPI_FADT_SEPARATE_LENGTH 2
  63. static struct acpi_fadt_info fadt_info_table[] = {
  64. {"Pm1aEventBlock", ACPI_FADT_OFFSET(xpm1a_event_block),
  65. ACPI_FADT_OFFSET(pm1a_event_block),
  66. ACPI_FADT_OFFSET(pm1_event_length), ACPI_FADT_REQUIRED},
  67. {"Pm1bEventBlock", ACPI_FADT_OFFSET(xpm1b_event_block),
  68. ACPI_FADT_OFFSET(pm1b_event_block),
  69. ACPI_FADT_OFFSET(pm1_event_length), 0},
  70. {"Pm1aControlBlock", ACPI_FADT_OFFSET(xpm1a_control_block),
  71. ACPI_FADT_OFFSET(pm1a_control_block),
  72. ACPI_FADT_OFFSET(pm1_control_length), ACPI_FADT_REQUIRED},
  73. {"Pm1bControlBlock", ACPI_FADT_OFFSET(xpm1b_control_block),
  74. ACPI_FADT_OFFSET(pm1b_control_block),
  75. ACPI_FADT_OFFSET(pm1_control_length), 0},
  76. {"Pm2ControlBlock", ACPI_FADT_OFFSET(xpm2_control_block),
  77. ACPI_FADT_OFFSET(pm2_control_block),
  78. ACPI_FADT_OFFSET(pm2_control_length), ACPI_FADT_SEPARATE_LENGTH},
  79. {"PmTimerBlock", ACPI_FADT_OFFSET(xpm_timer_block),
  80. ACPI_FADT_OFFSET(pm_timer_block),
  81. ACPI_FADT_OFFSET(pm_timer_length), ACPI_FADT_REQUIRED},
  82. {"Gpe0Block", ACPI_FADT_OFFSET(xgpe0_block),
  83. ACPI_FADT_OFFSET(gpe0_block),
  84. ACPI_FADT_OFFSET(gpe0_block_length), ACPI_FADT_SEPARATE_LENGTH},
  85. {"Gpe1Block", ACPI_FADT_OFFSET(xgpe1_block),
  86. ACPI_FADT_OFFSET(gpe1_block),
  87. ACPI_FADT_OFFSET(gpe1_block_length), ACPI_FADT_SEPARATE_LENGTH}
  88. };
  89. #define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info))
  90. /*******************************************************************************
  91. *
  92. * FUNCTION: acpi_tb_init_generic_address
  93. *
  94. * PARAMETERS: generic_address - GAS struct to be initialized
  95. * byte_width - Width of this register
  96. * Address - Address of the register
  97. *
  98. * RETURN: None
  99. *
  100. * DESCRIPTION: Initialize a Generic Address Structure (GAS)
  101. * See the ACPI specification for a full description and
  102. * definition of this structure.
  103. *
  104. ******************************************************************************/
  105. static inline void
  106. acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
  107. u8 space_id, u8 byte_width, u64 address)
  108. {
  109. /*
  110. * The 64-bit Address field is non-aligned in the byte packed
  111. * GAS struct.
  112. */
  113. ACPI_MOVE_64_TO_64(&generic_address->address, &address);
  114. /* All other fields are byte-wide */
  115. generic_address->space_id = space_id;
  116. generic_address->bit_width = (u8)ACPI_MUL_8(byte_width);
  117. generic_address->bit_offset = 0;
  118. generic_address->access_width = 0; /* Access width ANY */
  119. }
  120. /*******************************************************************************
  121. *
  122. * FUNCTION: acpi_tb_parse_fadt
  123. *
  124. * PARAMETERS: table_index - Index for the FADT
  125. * Flags - Flags
  126. *
  127. * RETURN: None
  128. *
  129. * DESCRIPTION: Initialize the FADT, DSDT and FACS tables
  130. * (FADT contains the addresses of the DSDT and FACS)
  131. *
  132. ******************************************************************************/
  133. void acpi_tb_parse_fadt(u32 table_index, u8 flags)
  134. {
  135. u32 length;
  136. struct acpi_table_header *table;
  137. /*
  138. * The FADT has multiple versions with different lengths,
  139. * and it contains pointers to both the DSDT and FACS tables.
  140. *
  141. * Get a local copy of the FADT and convert it to a common format
  142. * Map entire FADT, assumed to be smaller than one page.
  143. */
  144. length = acpi_gbl_root_table_list.tables[table_index].length;
  145. table =
  146. acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index].
  147. address, length);
  148. if (!table) {
  149. return;
  150. }
  151. /*
  152. * Validate the FADT checksum before we copy the table. Ignore
  153. * checksum error as we want to try to get the DSDT and FACS.
  154. */
  155. (void)acpi_tb_verify_checksum(table, length);
  156. /* Obtain a local copy of the FADT in common ACPI 2.0+ format */
  157. acpi_tb_create_local_fadt(table, length);
  158. /* All done with the real FADT, unmap it */
  159. acpi_os_unmap_memory(table, length);
  160. /* Obtain the DSDT and FACS tables via their addresses within the FADT */
  161. acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt,
  162. flags, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
  163. acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs,
  164. flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
  165. }
  166. /*******************************************************************************
  167. *
  168. * FUNCTION: acpi_tb_create_local_fadt
  169. *
  170. * PARAMETERS: Table - Pointer to BIOS FADT
  171. * Length - Length of the table
  172. *
  173. * RETURN: None
  174. *
  175. * DESCRIPTION: Get a local copy of the FADT and convert it to a common format.
  176. * Performs validation on some important FADT fields.
  177. *
  178. * NOTE: We create a local copy of the FADT regardless of the version.
  179. *
  180. ******************************************************************************/
  181. void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
  182. {
  183. /*
  184. * Check if the FADT is larger than the largest table that we expect
  185. * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue
  186. * a warning.
  187. */
  188. if (length > sizeof(struct acpi_table_fadt)) {
  189. ACPI_WARNING((AE_INFO,
  190. "FADT (revision %u) is longer than ACPI 2.0 version, "
  191. "truncating length 0x%X to 0x%zX",
  192. table->revision, (unsigned)length,
  193. sizeof(struct acpi_table_fadt)));
  194. }
  195. /* Clear the entire local FADT */
  196. ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt));
  197. /* Copy the original FADT, up to sizeof (struct acpi_table_fadt) */
  198. ACPI_MEMCPY(&acpi_gbl_FADT, table,
  199. ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
  200. /*
  201. * 1) Convert the local copy of the FADT to the common internal format
  202. * 2) Validate some of the important values within the FADT
  203. */
  204. acpi_tb_convert_fadt();
  205. }
  206. /*******************************************************************************
  207. *
  208. * FUNCTION: acpi_tb_convert_fadt
  209. *
  210. * PARAMETERS: None, uses acpi_gbl_FADT
  211. *
  212. * RETURN: None
  213. *
  214. * DESCRIPTION: Converts all versions of the FADT to a common internal format.
  215. * Expand all 32-bit addresses to 64-bit.
  216. *
  217. * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt),
  218. * and must contain a copy of the actual FADT.
  219. *
  220. * ACPICA will use the "X" fields of the FADT for all addresses.
  221. *
  222. * "X" fields are optional extensions to the original V1.0 fields. Even if
  223. * they are present in the structure, they can be optionally not used by
  224. * setting them to zero. Therefore, we must selectively expand V1.0 fields
  225. * if the corresponding X field is zero.
  226. *
  227. * For ACPI 1.0 FADTs, all address fields are expanded to the corresponding
  228. * "X" fields.
  229. *
  230. * For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by
  231. * expanding the corresponding ACPI 1.0 field.
  232. *
  233. ******************************************************************************/
  234. static void acpi_tb_convert_fadt(void)
  235. {
  236. u8 pm1_register_length;
  237. struct acpi_generic_address *target;
  238. u32 i;
  239. /* Update the local FADT table header length */
  240. acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);
  241. /*
  242. * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
  243. * Later code will always use the X 64-bit field. Also, check for an
  244. * address mismatch between the 32-bit and 64-bit address fields
  245. * (FIRMWARE_CTRL/X_FIRMWARE_CTRL, DSDT/X_DSDT) which would indicate
  246. * the presence of two FACS or two DSDT tables.
  247. */
  248. if (!acpi_gbl_FADT.Xfacs) {
  249. acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs;
  250. } else if (acpi_gbl_FADT.facs &&
  251. (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) {
  252. ACPI_WARNING((AE_INFO,
  253. "32/64 FACS address mismatch in FADT - two FACS tables!"));
  254. }
  255. if (!acpi_gbl_FADT.Xdsdt) {
  256. acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt;
  257. } else if (acpi_gbl_FADT.dsdt &&
  258. (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) {
  259. ACPI_WARNING((AE_INFO,
  260. "32/64 DSDT address mismatch in FADT - two DSDT tables!"));
  261. }
  262. /*
  263. * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
  264. * should be zero are indeed zero. This will workaround BIOSs that
  265. * inadvertently place values in these fields.
  266. *
  267. * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at
  268. * offset 45, 55, 95, and the word located at offset 109, 110.
  269. */
  270. if (acpi_gbl_FADT.header.revision < FADT2_REVISION_ID) {
  271. acpi_gbl_FADT.preferred_profile = 0;
  272. acpi_gbl_FADT.pstate_control = 0;
  273. acpi_gbl_FADT.cst_control = 0;
  274. acpi_gbl_FADT.boot_flags = 0;
  275. }
  276. /*
  277. * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X"
  278. * generic address structures as necessary.
  279. */
  280. for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) {
  281. target =
  282. ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT,
  283. fadt_info_table[i].target);
  284. /* Expand only if the X target is null */
  285. if (!target->address) {
  286. /* The space_id is always I/O for the legacy address fields */
  287. acpi_tb_init_generic_address(target,
  288. ACPI_ADR_SPACE_SYSTEM_IO,
  289. *ACPI_ADD_PTR(u8,
  290. &acpi_gbl_FADT,
  291. fadt_info_table
  292. [i].length),
  293. (u64) * ACPI_ADD_PTR(u32,
  294. &acpi_gbl_FADT,
  295. fadt_info_table
  296. [i].
  297. source));
  298. }
  299. }
  300. /* Validate FADT values now, before we make any changes */
  301. acpi_tb_validate_fadt();
  302. /*
  303. * Get the length of the individual PM1 registers. Each register is
  304. * defined to be the event block length / 2.
  305. */
  306. pm1_register_length = (u8)ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length);
  307. /*
  308. * Adjust the lengths of the PM1 Event Blocks so that they can be used to
  309. * access the PM1 status register(s).
  310. */
  311. acpi_gbl_FADT.xpm1a_event_block.bit_width =
  312. (u8)ACPI_MUL_8(pm1_register_length);
  313. acpi_gbl_FADT.xpm1b_event_block.bit_width =
  314. (u8)ACPI_MUL_8(pm1_register_length);
  315. /*
  316. * Calculate separate GAS structs for the PM1 Enable registers.
  317. * These addresses do not appear (directly) in the FADT, so it is
  318. * useful to calculate them once, here.
  319. *
  320. * The PM event blocks are split into two register blocks, first is the
  321. * PM Status Register block, followed immediately by the PM Enable
  322. * Register block. Each is of length (xpm1x_event_block.bit_width/2).
  323. *
  324. * On various systems the v2 fields (and particularly the bit widths)
  325. * cannot be relied upon, though. Hence resort to using the v1 length
  326. * here (and warn about the inconsistency).
  327. */
  328. if (acpi_gbl_FADT.xpm1a_event_block.bit_width
  329. != acpi_gbl_FADT.pm1_event_length * 8)
  330. printk(KERN_WARNING "FADT: "
  331. "X_PM1a_EVT_BLK.bit_width (%u) does not match"
  332. " PM1_EVT_LEN (%u)\n",
  333. acpi_gbl_FADT.xpm1a_event_block.bit_width,
  334. acpi_gbl_FADT.pm1_event_length);
  335. /* The PM1A register block is required */
  336. acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable,
  337. acpi_gbl_FADT.xpm1a_event_block.space_id,
  338. pm1_register_length,
  339. (acpi_gbl_FADT.xpm1a_event_block.address +
  340. pm1_register_length));
  341. /* Don't forget to copy space_id of the GAS */
  342. acpi_gbl_xpm1a_enable.space_id =
  343. acpi_gbl_FADT.xpm1a_event_block.space_id;
  344. /* The PM1B register block is optional, ignore if not present */
  345. if (acpi_gbl_FADT.xpm1b_event_block.address) {
  346. if (acpi_gbl_FADT.xpm1b_event_block.bit_width
  347. != acpi_gbl_FADT.pm1_event_length * 8)
  348. printk(KERN_WARNING "FADT: "
  349. "X_PM1b_EVT_BLK.bit_width (%u) does not match"
  350. " PM1_EVT_LEN (%u)\n",
  351. acpi_gbl_FADT.xpm1b_event_block.bit_width,
  352. acpi_gbl_FADT.pm1_event_length);
  353. acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
  354. acpi_gbl_FADT.xpm1b_event_block.space_id,
  355. pm1_register_length,
  356. (acpi_gbl_FADT.xpm1b_event_block.
  357. address + pm1_register_length));
  358. /* Don't forget to copy space_id of the GAS */
  359. acpi_gbl_xpm1b_enable.space_id =
  360. acpi_gbl_FADT.xpm1b_event_block.space_id;
  361. }
  362. if (acpi_gbl_use_default_register_widths) {
  363. /*
  364. * Optionally, use the default sizes for the ACPI registers.
  365. * Some FADTs do not have the correct length(s).
  366. *
  367. * Note: Xpm1a_event_block and Xpm1b_event_block are used to access the PM1
  368. * status registers. The PM1 enable registers are created above.
  369. */
  370. acpi_gbl_xpm1a_enable.bit_width = ACPI_PM1_REGISTER_WIDTH;
  371. acpi_gbl_xpm1b_enable.bit_width = ACPI_PM1_REGISTER_WIDTH;
  372. acpi_gbl_FADT.xpm1a_event_block.bit_width =
  373. ACPI_PM1_REGISTER_WIDTH;
  374. acpi_gbl_FADT.xpm1b_event_block.bit_width =
  375. ACPI_PM1_REGISTER_WIDTH;
  376. acpi_gbl_FADT.xpm1a_control_block.bit_width =
  377. ACPI_PM1_REGISTER_WIDTH;
  378. acpi_gbl_FADT.xpm1b_control_block.bit_width =
  379. ACPI_PM1_REGISTER_WIDTH;
  380. acpi_gbl_FADT.xpm2_control_block.bit_width =
  381. ACPI_PM2_REGISTER_WIDTH;
  382. acpi_gbl_FADT.xpm_timer_block.bit_width = ACPI_PM_TIMER_WIDTH;
  383. }
  384. }
  385. /******************************************************************************
  386. *
  387. * FUNCTION: acpi_tb_validate_fadt
  388. *
  389. * PARAMETERS: Table - Pointer to the FADT to be validated
  390. *
  391. * RETURN: None
  392. *
  393. * DESCRIPTION: Validate various important fields within the FADT. If a problem
  394. * is found, issue a message, but no status is returned.
  395. * Used by both the table manager and the disassembler.
  396. *
  397. * Possible additional checks:
  398. * (acpi_gbl_FADT.pm1_event_length >= 4)
  399. * (acpi_gbl_FADT.pm1_control_length >= 2)
  400. * (acpi_gbl_FADT.pm_timer_length >= 4)
  401. * Gpe block lengths must be multiple of 2
  402. *
  403. ******************************************************************************/
  404. static void acpi_tb_validate_fadt(void)
  405. {
  406. char *name;
  407. u32 *address32;
  408. struct acpi_generic_address *address64;
  409. u8 length;
  410. u32 i;
  411. /*
  412. * Check for FACS and DSDT address mismatches. An address mismatch between
  413. * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and
  414. * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables.
  415. */
  416. if (acpi_gbl_FADT.facs &&
  417. (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) {
  418. ACPI_WARNING((AE_INFO,
  419. "32/64 FACS address mismatch in FADT - "
  420. "two FACS tables! %8.8X/%8.8X%8.8X",
  421. acpi_gbl_FADT.facs,
  422. ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs)));
  423. }
  424. if (acpi_gbl_FADT.dsdt &&
  425. (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) {
  426. ACPI_WARNING((AE_INFO,
  427. "32/64 DSDT address mismatch in FADT - "
  428. "two DSDT tables! %8.8X/%8.8X%8.8X",
  429. acpi_gbl_FADT.dsdt,
  430. ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt)));
  431. }
  432. /* Examine all of the 64-bit extended address fields (X fields) */
  433. for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) {
  434. /*
  435. * Generate pointers to the 32-bit and 64-bit addresses, get the
  436. * register length (width), and the register name
  437. */
  438. address64 = ACPI_ADD_PTR(struct acpi_generic_address,
  439. &acpi_gbl_FADT,
  440. fadt_info_table[i].target);
  441. address32 =
  442. ACPI_ADD_PTR(u32, &acpi_gbl_FADT,
  443. fadt_info_table[i].source);
  444. length =
  445. *ACPI_ADD_PTR(u8, &acpi_gbl_FADT,
  446. fadt_info_table[i].length);
  447. name = fadt_info_table[i].name;
  448. /*
  449. * For each extended field, check for length mismatch between the
  450. * legacy length field and the corresonding 64-bit X length field.
  451. */
  452. if (address64 && (address64->bit_width != ACPI_MUL_8(length))) {
  453. ACPI_WARNING((AE_INFO,
  454. "32/64X bit length mismatch in %s: %d/%d",
  455. name, ACPI_MUL_8(length),
  456. address64->bit_width));
  457. }
  458. if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) {
  459. /*
  460. * Field is required (Pm1a_event, Pm1a_control, pm_timer).
  461. * Both the address and length must be non-zero.
  462. */
  463. if (!address64->address || !length) {
  464. ACPI_ERROR((AE_INFO,
  465. "Required field %s has zero address and/or length: %8.8X%8.8X/%X",
  466. name,
  467. ACPI_FORMAT_UINT64(address64->
  468. address),
  469. length));
  470. }
  471. } else if (fadt_info_table[i].type & ACPI_FADT_SEPARATE_LENGTH) {
  472. /*
  473. * Field is optional (PM2Control, GPE0, GPE1) AND has its own
  474. * length field. If present, both the address and length must be valid.
  475. */
  476. if ((address64->address && !length)
  477. || (!address64->address && length)) {
  478. ACPI_WARNING((AE_INFO,
  479. "Optional field %s has zero address or length: %8.8X%8.8X/%X",
  480. name,
  481. ACPI_FORMAT_UINT64(address64->
  482. address),
  483. length));
  484. }
  485. }
  486. /* If both 32- and 64-bit addresses are valid (non-zero), they must match */
  487. if (address64->address && *address32 &&
  488. (address64->address != (u64) * address32)) {
  489. ACPI_ERROR((AE_INFO,
  490. "32/64X address mismatch in %s: [%8.8X] [%8.8X%8.8X], using 64X",
  491. name, *address32,
  492. ACPI_FORMAT_UINT64(address64->address)));
  493. }
  494. }
  495. }