summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/tbfadt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/tbfadt.c')
-rw-r--r--drivers/acpi/acpica/tbfadt.c144
1 files changed, 82 insertions, 62 deletions
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 4c9c760db4a4..390651860bf0 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -49,9 +49,10 @@
ACPI_MODULE_NAME("tbfadt")
/* Local prototypes */
-static ACPI_INLINE void
+static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
- u8 space_id, u8 byte_width, u64 address);
+ u8 space_id,
+ u8 byte_width, u64 address, char *register_name);
static void acpi_tb_convert_fadt(void);
@@ -172,7 +173,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
*
* PARAMETERS: generic_address - GAS struct to be initialized
* byte_width - Width of this register
- * Address - Address of the register
+ * address - Address of the register
*
* RETURN: None
*
@@ -182,10 +183,25 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = {
*
******************************************************************************/
-static ACPI_INLINE void
+static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
- u8 space_id, u8 byte_width, u64 address)
+ u8 space_id,
+ u8 byte_width, u64 address, char *register_name)
{
+ u8 bit_width;
+
+ /* Bit width field in the GAS is only one byte long, 255 max */
+
+ bit_width = (u8)(byte_width * 8);
+
+ if (byte_width > 31) { /* (31*8)=248 */
+ ACPI_ERROR((AE_INFO,
+ "%s - 32-bit FADT register is too long (%u bytes, %u bits) "
+ "to convert to GAS struct - 255 bits max, truncating",
+ register_name, byte_width, (byte_width * 8)));
+
+ bit_width = 255;
+ }
/*
* The 64-bit Address field is non-aligned in the byte packed
@@ -196,7 +212,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
/* All other fields are byte-wide */
generic_address->space_id = space_id;
- generic_address->bit_width = (u8)ACPI_MUL_8(byte_width);
+ generic_address->bit_width = bit_width;
generic_address->bit_offset = 0;
generic_address->access_width = 0; /* Access width ANY */
}
@@ -267,8 +283,8 @@ void acpi_tb_parse_fadt(u32 table_index)
*
* FUNCTION: acpi_tb_create_local_fadt
*
- * PARAMETERS: Table - Pointer to BIOS FADT
- * Length - Length of the table
+ * PARAMETERS: table - Pointer to BIOS FADT
+ * length - Length of the table
*
* RETURN: None
*
@@ -287,11 +303,11 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
* a warning.
*/
if (length > sizeof(struct acpi_table_fadt)) {
- ACPI_WARNING((AE_INFO,
- "FADT (revision %u) is longer than ACPI 5.0 version, "
- "truncating length %u to %u",
- table->revision, length,
- (u32)sizeof(struct acpi_table_fadt)));
+ ACPI_BIOS_WARNING((AE_INFO,
+ "FADT (revision %u) is longer than ACPI 5.0 version, "
+ "truncating length %u to %u",
+ table->revision, length,
+ (u32)sizeof(struct acpi_table_fadt)));
}
/* Clear the entire local FADT */
@@ -436,11 +452,13 @@ static void acpi_tb_convert_fadt(void)
* they must match.
*/
if (address64->address && address32 &&
- (address64->address != (u64) address32)) {
- ACPI_ERROR((AE_INFO,
- "32/64X address mismatch in %s: 0x%8.8X/0x%8.8X%8.8X, using 32",
- fadt_info_table[i].name, address32,
- ACPI_FORMAT_UINT64(address64->address)));
+ (address64->address != (u64)address32)) {
+ ACPI_BIOS_ERROR((AE_INFO,
+ "32/64X address mismatch in FADT/%s: "
+ "0x%8.8X/0x%8.8X%8.8X, using 32",
+ fadt_info_table[i].name, address32,
+ ACPI_FORMAT_UINT64(address64->
+ address)));
}
/* Always use 32-bit address if it is valid (non-null) */
@@ -456,7 +474,8 @@ static void acpi_tb_convert_fadt(void)
&acpi_gbl_FADT,
fadt_info_table
[i].length),
- (u64) address32);
+ (u64) address32,
+ fadt_info_table[i].name);
}
}
}
@@ -465,7 +484,7 @@ static void acpi_tb_convert_fadt(void)
*
* FUNCTION: acpi_tb_validate_fadt
*
- * PARAMETERS: Table - Pointer to the FADT to be validated
+ * PARAMETERS: table - Pointer to the FADT to be validated
*
* RETURN: None
*
@@ -494,25 +513,25 @@ static void acpi_tb_validate_fadt(void)
* DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables.
*/
if (acpi_gbl_FADT.facs &&
- (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) {
- ACPI_WARNING((AE_INFO,
- "32/64X FACS address mismatch in FADT - "
- "0x%8.8X/0x%8.8X%8.8X, using 32",
- acpi_gbl_FADT.facs,
- ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs)));
-
- acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs;
+ (acpi_gbl_FADT.Xfacs != (u64)acpi_gbl_FADT.facs)) {
+ ACPI_BIOS_WARNING((AE_INFO,
+ "32/64X FACS address mismatch in FADT - "
+ "0x%8.8X/0x%8.8X%8.8X, using 32",
+ acpi_gbl_FADT.facs,
+ ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs)));
+
+ acpi_gbl_FADT.Xfacs = (u64)acpi_gbl_FADT.facs;
}
if (acpi_gbl_FADT.dsdt &&
- (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) {
- ACPI_WARNING((AE_INFO,
- "32/64X DSDT address mismatch in FADT - "
- "0x%8.8X/0x%8.8X%8.8X, using 32",
- acpi_gbl_FADT.dsdt,
- ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt)));
-
- acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt;
+ (acpi_gbl_FADT.Xdsdt != (u64)acpi_gbl_FADT.dsdt)) {
+ ACPI_BIOS_WARNING((AE_INFO,
+ "32/64X DSDT address mismatch in FADT - "
+ "0x%8.8X/0x%8.8X%8.8X, using 32",
+ acpi_gbl_FADT.dsdt,
+ ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt)));
+
+ acpi_gbl_FADT.Xdsdt = (u64)acpi_gbl_FADT.dsdt;
}
/* If Hardware Reduced flag is set, we are all done */
@@ -542,10 +561,10 @@ static void acpi_tb_validate_fadt(void)
*/
if (address64->address &&
(address64->bit_width != ACPI_MUL_8(length))) {
- ACPI_WARNING((AE_INFO,
- "32/64X length mismatch in %s: %u/%u",
- name, ACPI_MUL_8(length),
- address64->bit_width));
+ ACPI_BIOS_WARNING((AE_INFO,
+ "32/64X length mismatch in FADT/%s: %u/%u",
+ name, ACPI_MUL_8(length),
+ address64->bit_width));
}
if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) {
@@ -554,29 +573,29 @@ static void acpi_tb_validate_fadt(void)
* Both the address and length must be non-zero.
*/
if (!address64->address || !length) {
- ACPI_ERROR((AE_INFO,
- "Required field %s has zero address and/or length:"
- " 0x%8.8X%8.8X/0x%X",
- name,
- ACPI_FORMAT_UINT64(address64->
- address),
- length));
+ ACPI_BIOS_ERROR((AE_INFO,
+ "Required FADT field %s has zero address and/or length: "
+ "0x%8.8X%8.8X/0x%X",
+ name,
+ ACPI_FORMAT_UINT64(address64->
+ address),
+ length));
}
} else if (fadt_info_table[i].type & ACPI_FADT_SEPARATE_LENGTH) {
/*
- * Field is optional (PM2Control, GPE0, GPE1) AND has its own
+ * Field is optional (Pm2_control, GPE0, GPE1) AND has its own
* length field. If present, both the address and length must
* be valid.
*/
if ((address64->address && !length) ||
(!address64->address && length)) {
- ACPI_WARNING((AE_INFO,
- "Optional field %s has zero address or length: "
- "0x%8.8X%8.8X/0x%X",
- name,
- ACPI_FORMAT_UINT64(address64->
- address),
- length));
+ ACPI_BIOS_WARNING((AE_INFO,
+ "Optional FADT field %s has zero address or length: "
+ "0x%8.8X%8.8X/0x%X",
+ name,
+ ACPI_FORMAT_UINT64
+ (address64->address),
+ length));
}
}
}
@@ -621,12 +640,12 @@ static void acpi_tb_setup_fadt_registers(void)
(fadt_info_table[i].default_length > 0) &&
(fadt_info_table[i].default_length !=
target64->bit_width)) {
- ACPI_WARNING((AE_INFO,
- "Invalid length for %s: %u, using default %u",
- fadt_info_table[i].name,
- target64->bit_width,
- fadt_info_table[i].
- default_length));
+ ACPI_BIOS_WARNING((AE_INFO,
+ "Invalid length for FADT/%s: %u, using default %u",
+ fadt_info_table[i].name,
+ target64->bit_width,
+ fadt_info_table[i].
+ default_length));
/* Incorrect size, set width to the default */
@@ -670,7 +689,8 @@ static void acpi_tb_setup_fadt_registers(void)
source64->address +
(fadt_pm_info_table[i].
register_num *
- pm1_register_byte_width));
+ pm1_register_byte_width),
+ "PmRegisters");
}
}
}
OpenPOWER on IntegriCloud