tbconvrt.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. /******************************************************************************
  2. *
  3. * Module Name: tbconvrt - ACPI Table conversion utilities
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, R. Byron Moore
  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 <linux/module.h>
  43. #include <acpi/acpi.h>
  44. #include <acpi/actables.h>
  45. #define _COMPONENT ACPI_TABLES
  46. ACPI_MODULE_NAME ("tbconvrt")
  47. u8 acpi_fadt_is_v1;
  48. EXPORT_SYMBOL(acpi_fadt_is_v1);
  49. /*******************************************************************************
  50. *
  51. * FUNCTION: acpi_tb_get_table_count
  52. *
  53. * PARAMETERS: RSDP - Pointer to the RSDP
  54. * RSDT - Pointer to the RSDT/XSDT
  55. *
  56. * RETURN: The number of tables pointed to by the RSDT or XSDT.
  57. *
  58. * DESCRIPTION: Calculate the number of tables. Automatically handles either
  59. * an RSDT or XSDT.
  60. *
  61. ******************************************************************************/
  62. u32
  63. acpi_tb_get_table_count (
  64. struct rsdp_descriptor *RSDP,
  65. struct acpi_table_header *RSDT)
  66. {
  67. u32 pointer_size;
  68. ACPI_FUNCTION_ENTRY ();
  69. if (RSDP->revision < 2) {
  70. pointer_size = sizeof (u32);
  71. }
  72. else {
  73. pointer_size = sizeof (u64);
  74. }
  75. /*
  76. * Determine the number of tables pointed to by the RSDT/XSDT.
  77. * This is defined by the ACPI Specification to be the number of
  78. * pointers contained within the RSDT/XSDT. The size of the pointers
  79. * is architecture-dependent.
  80. */
  81. return ((RSDT->length - sizeof (struct acpi_table_header)) / pointer_size);
  82. }
  83. /*******************************************************************************
  84. *
  85. * FUNCTION: acpi_tb_convert_to_xsdt
  86. *
  87. * PARAMETERS: table_info - Info about the RSDT
  88. *
  89. * RETURN: Status
  90. *
  91. * DESCRIPTION: Convert an RSDT to an XSDT (internal common format)
  92. *
  93. ******************************************************************************/
  94. acpi_status
  95. acpi_tb_convert_to_xsdt (
  96. struct acpi_table_desc *table_info)
  97. {
  98. acpi_size table_size;
  99. u32 i;
  100. XSDT_DESCRIPTOR *new_table;
  101. ACPI_FUNCTION_ENTRY ();
  102. /* Compute size of the converted XSDT */
  103. table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof (u64)) +
  104. sizeof (struct acpi_table_header);
  105. /* Allocate an XSDT */
  106. new_table = ACPI_MEM_CALLOCATE (table_size);
  107. if (!new_table) {
  108. return (AE_NO_MEMORY);
  109. }
  110. /* Copy the header and set the length */
  111. ACPI_MEMCPY (new_table, table_info->pointer, sizeof (struct acpi_table_header));
  112. new_table->length = (u32) table_size;
  113. /* Copy the table pointers */
  114. for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
  115. if (acpi_gbl_RSDP->revision < 2) {
  116. ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
  117. (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, table_info->pointer))->table_offset_entry[i]);
  118. }
  119. else {
  120. new_table->table_offset_entry[i] =
  121. (ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info->pointer))->table_offset_entry[i];
  122. }
  123. }
  124. /* Delete the original table (either mapped or in a buffer) */
  125. acpi_tb_delete_single_table (table_info);
  126. /* Point the table descriptor to the new table */
  127. table_info->pointer = ACPI_CAST_PTR (struct acpi_table_header, new_table);
  128. table_info->length = table_size;
  129. table_info->allocation = ACPI_MEM_ALLOCATED;
  130. return (AE_OK);
  131. }
  132. /******************************************************************************
  133. *
  134. * FUNCTION: acpi_tb_init_generic_address
  135. *
  136. * PARAMETERS: new_gas_struct - GAS struct to be initialized
  137. * register_bit_width - Width of this register
  138. * Address - Address of the register
  139. *
  140. * RETURN: None
  141. *
  142. * DESCRIPTION: Initialize a GAS structure.
  143. *
  144. ******************************************************************************/
  145. static void
  146. acpi_tb_init_generic_address (
  147. struct acpi_generic_address *new_gas_struct,
  148. u8 register_bit_width,
  149. acpi_physical_address address)
  150. {
  151. ACPI_STORE_ADDRESS (new_gas_struct->address, address);
  152. new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
  153. new_gas_struct->register_bit_width = register_bit_width;
  154. new_gas_struct->register_bit_offset = 0;
  155. new_gas_struct->access_width = 0;
  156. }
  157. /*******************************************************************************
  158. *
  159. * FUNCTION: acpi_tb_convert_fadt1
  160. *
  161. * PARAMETERS: local_fadt - Pointer to new FADT
  162. * original_fadt - Pointer to old FADT
  163. *
  164. * RETURN: Populates local_fadt
  165. *
  166. * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format
  167. *
  168. ******************************************************************************/
  169. static void
  170. acpi_tb_convert_fadt1 (
  171. struct fadt_descriptor_rev2 *local_fadt,
  172. struct fadt_descriptor_rev1 *original_fadt)
  173. {
  174. /* ACPI 1.0 FACS */
  175. /* The BIOS stored FADT should agree with Revision 1.0 */
  176. acpi_fadt_is_v1 = 1;
  177. /*
  178. * Copy the table header and the common part of the tables.
  179. *
  180. * The 2.0 table is an extension of the 1.0 table, so the entire 1.0
  181. * table can be copied first, then expand some fields to 64 bits.
  182. */
  183. ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev1));
  184. /* Convert table pointers to 64-bit fields */
  185. ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl);
  186. ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
  187. /*
  188. * System Interrupt Model isn't used in ACPI 2.0 (local_fadt->Reserved1 = 0;)
  189. */
  190. /*
  191. * This field is set by the OEM to convey the preferred power management
  192. * profile to OSPM. It doesn't have any 1.0 equivalence. Since we don't
  193. * know what kind of 32-bit system this is, we will use "unspecified".
  194. */
  195. local_fadt->prefer_PM_profile = PM_UNSPECIFIED;
  196. /*
  197. * Processor Performance State Control. This is the value OSPM writes to
  198. * the SMI_CMD register to assume processor performance state control
  199. * responsibility. There isn't any equivalence in 1.0, but as many 1.x
  200. * ACPI tables contain _PCT and _PSS we also keep this value, unless
  201. * acpi_strict is set.
  202. */
  203. if (acpi_strict)
  204. local_fadt->pstate_cnt = 0;
  205. /*
  206. * Support for the _CST object and C States change notification.
  207. * This data item hasn't any 1.0 equivalence so leave it zero.
  208. */
  209. local_fadt->cst_cnt = 0;
  210. /*
  211. * FADT Rev 2 was an interim FADT released between ACPI 1.0 and ACPI 2.0.
  212. * It primarily adds the FADT reset mechanism.
  213. */
  214. if ((original_fadt->revision == 2) &&
  215. (original_fadt->length == sizeof (struct fadt_descriptor_rev2_minus))) {
  216. /*
  217. * Grab the entire generic address struct, plus the 1-byte reset value
  218. * that immediately follows.
  219. */
  220. ACPI_MEMCPY (&local_fadt->reset_register,
  221. &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, original_fadt))->reset_register,
  222. sizeof (struct acpi_generic_address) + 1);
  223. }
  224. else {
  225. /*
  226. * Since there isn't any equivalence in 1.0 and since it is highly
  227. * likely that a 1.0 system has legacy support.
  228. */
  229. local_fadt->iapc_boot_arch = BAF_LEGACY_DEVICES;
  230. }
  231. /*
  232. * Convert the V1.0 block addresses to V2.0 GAS structures
  233. */
  234. acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, local_fadt->pm1_evt_len,
  235. (acpi_physical_address) local_fadt->V1_pm1a_evt_blk);
  236. acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, local_fadt->pm1_evt_len,
  237. (acpi_physical_address) local_fadt->V1_pm1b_evt_blk);
  238. acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, local_fadt->pm1_cnt_len,
  239. (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk);
  240. acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len,
  241. (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk);
  242. acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len,
  243. (acpi_physical_address) local_fadt->V1_pm2_cnt_blk);
  244. acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len,
  245. (acpi_physical_address) local_fadt->V1_pm_tmr_blk);
  246. acpi_tb_init_generic_address (&local_fadt->xgpe0_blk, 0,
  247. (acpi_physical_address) local_fadt->V1_gpe0_blk);
  248. acpi_tb_init_generic_address (&local_fadt->xgpe1_blk, 0,
  249. (acpi_physical_address) local_fadt->V1_gpe1_blk);
  250. /* Create separate GAS structs for the PM1 Enable registers */
  251. acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
  252. (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
  253. (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address +
  254. ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
  255. /* PM1B is optional; leave null if not present */
  256. if (local_fadt->xpm1b_evt_blk.address) {
  257. acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
  258. (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
  259. (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address +
  260. ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
  261. }
  262. }
  263. /*******************************************************************************
  264. *
  265. * FUNCTION: acpi_tb_convert_fadt2
  266. *
  267. * PARAMETERS: local_fadt - Pointer to new FADT
  268. * original_fadt - Pointer to old FADT
  269. *
  270. * RETURN: Populates local_fadt
  271. *
  272. * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format.
  273. * Handles optional "X" fields.
  274. *
  275. ******************************************************************************/
  276. static void
  277. acpi_tb_convert_fadt2 (
  278. struct fadt_descriptor_rev2 *local_fadt,
  279. struct fadt_descriptor_rev2 *original_fadt)
  280. {
  281. /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
  282. ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev2));
  283. /*
  284. * "X" fields are optional extensions to the original V1.0 fields, so
  285. * we must selectively expand V1.0 fields if the corresponding X field
  286. * is zero.
  287. */
  288. if (!(local_fadt->xfirmware_ctrl)) {
  289. ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl);
  290. }
  291. if (!(local_fadt->Xdsdt)) {
  292. ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
  293. }
  294. if (!(local_fadt->xpm1a_evt_blk.address)) {
  295. acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk,
  296. local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1a_evt_blk);
  297. }
  298. if (!(local_fadt->xpm1b_evt_blk.address)) {
  299. acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk,
  300. local_fadt->pm1_evt_len, (acpi_physical_address) local_fadt->V1_pm1b_evt_blk);
  301. }
  302. if (!(local_fadt->xpm1a_cnt_blk.address)) {
  303. acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk,
  304. local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk);
  305. }
  306. if (!(local_fadt->xpm1b_cnt_blk.address)) {
  307. acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk,
  308. local_fadt->pm1_cnt_len, (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk);
  309. }
  310. if (!(local_fadt->xpm2_cnt_blk.address)) {
  311. acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk,
  312. local_fadt->pm2_cnt_len, (acpi_physical_address) local_fadt->V1_pm2_cnt_blk);
  313. }
  314. if (!(local_fadt->xpm_tmr_blk.address)) {
  315. acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk,
  316. local_fadt->pm_tm_len, (acpi_physical_address) local_fadt->V1_pm_tmr_blk);
  317. }
  318. if (!(local_fadt->xgpe0_blk.address)) {
  319. acpi_tb_init_generic_address (&local_fadt->xgpe0_blk,
  320. 0, (acpi_physical_address) local_fadt->V1_gpe0_blk);
  321. }
  322. if (!(local_fadt->xgpe1_blk.address)) {
  323. acpi_tb_init_generic_address (&local_fadt->xgpe1_blk,
  324. 0, (acpi_physical_address) local_fadt->V1_gpe1_blk);
  325. }
  326. /* Create separate GAS structs for the PM1 Enable registers */
  327. acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
  328. (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
  329. (acpi_physical_address) (local_fadt->xpm1a_evt_blk.address +
  330. ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
  331. acpi_gbl_xpm1a_enable.address_space_id = local_fadt->xpm1a_evt_blk.address_space_id;
  332. /* PM1B is optional; leave null if not present */
  333. if (local_fadt->xpm1b_evt_blk.address) {
  334. acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
  335. (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
  336. (acpi_physical_address) (local_fadt->xpm1b_evt_blk.address +
  337. ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
  338. acpi_gbl_xpm1b_enable.address_space_id = local_fadt->xpm1b_evt_blk.address_space_id;
  339. }
  340. }
  341. /*******************************************************************************
  342. *
  343. * FUNCTION: acpi_tb_convert_table_fadt
  344. *
  345. * PARAMETERS: None
  346. *
  347. * RETURN: Status
  348. *
  349. * DESCRIPTION: Converts a BIOS supplied ACPI 1.0 FADT to a local
  350. * ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply
  351. * copied to the local FADT. The ACPI CA software uses this
  352. * local FADT. Thus a significant amount of special #ifdef
  353. * type codeing is saved.
  354. *
  355. ******************************************************************************/
  356. acpi_status
  357. acpi_tb_convert_table_fadt (void)
  358. {
  359. struct fadt_descriptor_rev2 *local_fadt;
  360. struct acpi_table_desc *table_desc;
  361. ACPI_FUNCTION_TRACE ("tb_convert_table_fadt");
  362. /*
  363. * acpi_gbl_FADT is valid. Validate the FADT length. The table must be
  364. * at least as long as the version 1.0 FADT
  365. */
  366. if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) {
  367. ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", acpi_gbl_FADT->length));
  368. return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
  369. }
  370. /* Allocate buffer for the ACPI 2.0(+) FADT */
  371. local_fadt = ACPI_MEM_CALLOCATE (sizeof (struct fadt_descriptor_rev2));
  372. if (!local_fadt) {
  373. return_ACPI_STATUS (AE_NO_MEMORY);
  374. }
  375. if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
  376. if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) {
  377. /* Length is too short to be a V2.0 table */
  378. ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
  379. acpi_gbl_FADT->length, acpi_gbl_FADT->revision));
  380. acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
  381. }
  382. else {
  383. /* Valid V2.0 table */
  384. acpi_tb_convert_fadt2 (local_fadt, acpi_gbl_FADT);
  385. }
  386. }
  387. else {
  388. /* Valid V1.0 table */
  389. acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
  390. }
  391. /*
  392. * Global FADT pointer will point to the new common V2.0 FADT
  393. */
  394. acpi_gbl_FADT = local_fadt;
  395. acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR);
  396. /* Free the original table */
  397. table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next;
  398. acpi_tb_delete_single_table (table_desc);
  399. /* Install the new table */
  400. table_desc->pointer = ACPI_CAST_PTR (struct acpi_table_header, acpi_gbl_FADT);
  401. table_desc->allocation = ACPI_MEM_ALLOCATED;
  402. table_desc->length = sizeof (struct fadt_descriptor_rev2);
  403. /* Dump the entire FADT */
  404. ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
  405. "Hex dump of common internal FADT, size %d (%X)\n",
  406. acpi_gbl_FADT->length, acpi_gbl_FADT->length));
  407. ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length);
  408. return_ACPI_STATUS (AE_OK);
  409. }
  410. /*******************************************************************************
  411. *
  412. * FUNCTION: acpi_tb_convert_table_facs
  413. *
  414. * PARAMETERS: table_info - Info for currently installed FACS
  415. *
  416. * RETURN: Status
  417. *
  418. * DESCRIPTION: Convert ACPI 1.0 and ACPI 2.0 FACS to a common internal
  419. * table format.
  420. *
  421. ******************************************************************************/
  422. acpi_status
  423. acpi_tb_build_common_facs (
  424. struct acpi_table_desc *table_info)
  425. {
  426. ACPI_FUNCTION_TRACE ("tb_build_common_facs");
  427. /* Absolute minimum length is 24, but the ACPI spec says 64 */
  428. if (acpi_gbl_FACS->length < 24) {
  429. ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", acpi_gbl_FACS->length));
  430. return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
  431. }
  432. if (acpi_gbl_FACS->length < 64) {
  433. ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n",
  434. acpi_gbl_FACS->length));
  435. }
  436. /* Copy fields to the new FACS */
  437. acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock);
  438. if ((acpi_gbl_RSDP->revision < 2) ||
  439. (acpi_gbl_FACS->length < 32) ||
  440. (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
  441. /* ACPI 1.0 FACS or short table or optional X_ field is zero */
  442. acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, &(acpi_gbl_FACS->firmware_waking_vector));
  443. acpi_gbl_common_fACS.vector_width = 32;
  444. }
  445. else {
  446. /* ACPI 2.0 FACS with valid X_ field */
  447. acpi_gbl_common_fACS.firmware_waking_vector = &acpi_gbl_FACS->xfirmware_waking_vector;
  448. acpi_gbl_common_fACS.vector_width = 64;
  449. }
  450. return_ACPI_STATUS (AE_OK);
  451. }