aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:19 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:22 -0500
commita4bbb810dedaecf74d54b16b6dd3c33e95e1024c (patch)
tree53c5cb4b1ba8bf36dcefec5529fa760ad4452185
parent4bf273939c99fae5bae399f51c417a552d74b97f (diff)
ACPICA: Lint changes
Lint changes Move RSDT/XSDT pointer extraction to separate function Warning on 32-bit platforms if XSDT pointers use more than 32 bits. Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/tables/tbutils.c121
-rw-r--r--drivers/acpi/tables/tbxface.c4
2 files changed, 84 insertions, 41 deletions
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 77c7e873ec37..8e44f83a64e2 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -60,6 +60,10 @@ static void inline
60acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, 60acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
61 u8 bit_width, u64 address); 61 u8 bit_width, u64 address);
62 62
63static acpi_physical_address
64acpi_tb_get_root_table_entry(u8 * table_entry,
65 acpi_native_uint table_entry_size);
66
63/* Table used for conversion of FADT to common format */ 67/* Table used for conversion of FADT to common format */
64 68
65typedef struct acpi_fadt_conversion { 69typedef struct acpi_fadt_conversion {
@@ -126,10 +130,14 @@ acpi_tb_print_table_header(acpi_physical_address address,
126 130
127 ACPI_INFO((AE_INFO, "RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)", 131 ACPI_INFO((AE_INFO, "RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)",
128 ACPI_CAST_PTR(void, address), 132 ACPI_CAST_PTR(void, address),
129 (((struct acpi_table_rsdp *)header)->revision > 0) ? 133 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
130 ((struct acpi_table_rsdp *)header)->length : 20, 134 revision >
131 ((struct acpi_table_rsdp *)header)->revision, 135 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
132 ((struct acpi_table_rsdp *)header)->oem_id)); 136 header)->length : 20,
137 ACPI_CAST_PTR(struct acpi_table_rsdp,
138 header)->revision,
139 ACPI_CAST_PTR(struct acpi_table_rsdp,
140 header)->oem_id));
133 } else { 141 } else {
134 /* Standard ACPI table with full common header */ 142 /* Standard ACPI table with full common header */
135 143
@@ -278,8 +286,8 @@ static void acpi_tb_convert_fadt(void)
278 } 286 }
279 287
280 /* 288 /*
281 * Expand the V1.0 addresses to the "X" generic address structs, 289 * Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address
282 * as necessary. 290 * structures as necessary.
283 */ 291 */
284 for (i = 0; i < ACPI_FADT_CONVERSION_ENTRIES; i++) { 292 for (i = 0; i < ACPI_FADT_CONVERSION_ENTRIES; i++) {
285 target = 293 target =
@@ -294,10 +302,11 @@ static void acpi_tb_convert_fadt(void)
294 &acpi_gbl_FADT, 302 &acpi_gbl_FADT,
295 fadt_conversion_table 303 fadt_conversion_table
296 [i].length), 304 [i].length),
297 *ACPI_ADD_PTR(u32, 305 (u64) * ACPI_ADD_PTR(u32,
298 &acpi_gbl_FADT, 306 &acpi_gbl_FADT,
299 fadt_conversion_table 307 fadt_conversion_table
300 [i].source)); 308 [i].
309 source));
301 } 310 }
302 } 311 }
303 312
@@ -444,7 +453,7 @@ static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)
444 453
445 /* Copy the entire FADT locally */ 454 /* Copy the entire FADT locally */
446 455
447 ACPI_MEMSET(&acpi_gbl_FADT, sizeof(struct acpi_table_fadt), 0); 456 ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt));
448 457
449 ACPI_MEMCPY(&acpi_gbl_FADT, table, 458 ACPI_MEMCPY(&acpi_gbl_FADT, table,
450 ACPI_MIN(length, sizeof(struct acpi_table_fadt))); 459 ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
@@ -465,6 +474,61 @@ static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags)
465 474
466/******************************************************************************* 475/*******************************************************************************
467 * 476 *
477 * FUNCTION: acpi_tb_get_root_table_entry
478 *
479 * PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry
480 * table_entry_size - sizeof 32 or 64 (RSDT or XSDT)
481 *
482 * RETURN: Physical address extracted from the root table
483 *
484 * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on
485 * both 32-bit and 64-bit platforms
486 *
487 * NOTE: acpi_physical_address is 32-bit on 32-bit platforms, 64-bit on
488 * 64-bit platforms.
489 *
490 ******************************************************************************/
491
492static acpi_physical_address
493acpi_tb_get_root_table_entry(u8 * table_entry,
494 acpi_native_uint table_entry_size)
495{
496 u64 address64;
497
498 /*
499 * Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
500 * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
501 */
502 if (table_entry_size == sizeof(u32)) {
503 /*
504 * 32-bit platform, RSDT: Return 32-bit table entry
505 * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
506 */
507 return ((acpi_physical_address)
508 (*ACPI_CAST_PTR(u32, table_entry)));
509 } else {
510 /*
511 * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
512 * 64-bit platform, XSDT: Move (unaligned) 64-bit to local, return 64-bit
513 */
514 ACPI_MOVE_64_TO_64(&address64, table_entry);
515
516#if ACPI_MACHINE_WIDTH == 32
517 if (address64 > ACPI_UINT32_MAX) {
518
519 /* Will truncate 64-bit address to 32 bits */
520
521 ACPI_WARNING((AE_INFO,
522 "64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating",
523 ACPI_FORMAT_UINT64(address64)));
524 }
525#endif
526 return ((acpi_physical_address) (address64));
527 }
528}
529
530/*******************************************************************************
531 *
468 * FUNCTION: acpi_tb_parse_root_table 532 * FUNCTION: acpi_tb_parse_root_table
469 * 533 *
470 * PARAMETERS: Rsdp - Pointer to the RSDP 534 * PARAMETERS: Rsdp - Pointer to the RSDP
@@ -567,8 +631,8 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
567 /* Calculate the number of tables described in the root table */ 631 /* Calculate the number of tables described in the root table */
568 632
569 table_count = 633 table_count =
570 (table->length - 634 (u32) ((table->length -
571 sizeof(struct acpi_table_header)) / table_entry_size; 635 sizeof(struct acpi_table_header)) / table_entry_size);
572 636
573 /* 637 /*
574 * First two entries in the table array are reserved for the DSDT and FACS, 638 * First two entries in the table array are reserved for the DSDT and FACS,
@@ -599,32 +663,11 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
599 } 663 }
600 } 664 }
601 665
602 /* 666 /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
603 * Get the table physical address (32-bit for RSDT, 64-bit for XSDT) 667
604 */ 668 acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count].
605 if ((table_entry_size == sizeof(u32)) || 669 address =
606 (sizeof(acpi_physical_address) == sizeof(u32))) { 670 acpi_tb_get_root_table_entry(table_entry, table_entry_size);
607 /*
608 * 32-bit platform, RSDT: Move 32-bit to 32-bit
609 * 32-bit platform, XSDT: Truncate 64-bit to 32-bit
610 * 64-bit platform, RSDT: Expand 32-bit to 64-bit
611 *
612 * Note: Addresses are 32-bit aligned in both RSDT and XSDT
613 */
614 acpi_gbl_root_table_list.
615 tables[acpi_gbl_root_table_list.count].address =
616 (acpi_physical_address) (*ACPI_CAST_PTR
617 (u32, table_entry));
618 } else {
619 /*
620 * 64-bit platform, XSDT: Move 64-bit to 64-bit
621 *
622 * Note: 64-bit addresses are only 32-bit aligned in the XSDT
623 */
624 ACPI_MOVE_64_TO_64(&acpi_gbl_root_table_list.
625 tables[acpi_gbl_root_table_list.
626 count].address, table_entry);
627 }
628 671
629 table_entry += table_entry_size; 672 table_entry += table_entry_size;
630 acpi_gbl_root_table_list.count++; 673 acpi_gbl_root_table_list.count++;
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 78ce542f3e67..13e8d6626dd4 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -102,9 +102,9 @@ acpi_initialize_tables(struct acpi_table_desc *initial_table_array,
102 } else { 102 } else {
103 /* Root Table Array has been statically allocated by the host */ 103 /* Root Table Array has been statically allocated by the host */
104 104
105 ACPI_MEMSET(initial_table_array, 105 ACPI_MEMSET(initial_table_array, 0,
106 initial_table_count * 106 initial_table_count *
107 sizeof(struct acpi_table_desc), 0); 107 sizeof(struct acpi_table_desc));
108 108
109 acpi_gbl_root_table_list.tables = initial_table_array; 109 acpi_gbl_root_table_list.tables = initial_table_array;
110 acpi_gbl_root_table_list.size = initial_table_count; 110 acpi_gbl_root_table_list.size = initial_table_count;