]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/tables/tbfadt.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / drivers / acpi / tables / tbfadt.c
index ccb5b64bbef3396036796509da86ba4b52efc6cd..2c7885e7ffba6c06508e261f5ef547819661db51 100644 (file)
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("tbfadt")
 /* Local prototypes */
 static void inline
 acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
-                            u8 bit_width, u64 address);
+                            u8 byte_width, u64 address);
 
 static void acpi_tb_convert_fadt(void);
 
@@ -111,7 +111,7 @@ static struct acpi_fadt_info fadt_info_table[] = {
  * FUNCTION:    acpi_tb_init_generic_address
  *
  * PARAMETERS:  generic_address     - GAS struct to be initialized
- *              bit_width           - Width of this register
+ *              byte_width          - Width of this register
  *              Address             - Address of the register
  *
  * RETURN:      None
@@ -342,12 +342,21 @@ static void acpi_tb_convert_fadt(void)
         * useful to calculate them once, here.
         *
         * The PM event blocks are split into two register blocks, first is the
-        * PM Status Register block, followed immediately by the PM Enable Register
-        * block. Each is of length (xpm1x_event_block.bit_width/2)
+        * PM Status Register block, followed immediately by the PM Enable
+        * Register block. Each is of length (xpm1x_event_block.bit_width/2).
+        *
+        * On various systems the v2 fields (and particularly the bit widths)
+        * cannot be relied upon, though. Hence resort to using the v1 length
+        * here (and warn about the inconsistency).
         */
-       WARN_ON(ACPI_MOD_16(acpi_gbl_FADT.xpm1a_event_block.bit_width));
-       pm1_register_length = (u8) ACPI_DIV_16(acpi_gbl_FADT
-                                              .xpm1a_event_block.bit_width);
+       if (acpi_gbl_FADT.xpm1a_event_block.bit_width
+           != acpi_gbl_FADT.pm1_event_length * 8)
+               printk(KERN_WARNING "FADT: "
+                      "X_PM1a_EVT_BLK.bit_width (%u) does not match"
+                      " PM1_EVT_LEN (%u)\n",
+                      acpi_gbl_FADT.xpm1a_event_block.bit_width,
+                      acpi_gbl_FADT.pm1_event_length);
+       pm1_register_length = (u8) ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length);
 
        /* The PM1A register block is required */
 
@@ -362,10 +371,13 @@ static void acpi_tb_convert_fadt(void)
        /* The PM1B register block is optional, ignore if not present */
 
        if (acpi_gbl_FADT.xpm1b_event_block.address) {
-               WARN_ON(ACPI_MOD_16(acpi_gbl_FADT.xpm1b_event_block.bit_width));
-               pm1_register_length = (u8) ACPI_DIV_16(acpi_gbl_FADT
-                                                      .xpm1b_event_block
-                                                      .bit_width);
+               if (acpi_gbl_FADT.xpm1b_event_block.bit_width
+                   != acpi_gbl_FADT.pm1_event_length * 8)
+                       printk(KERN_WARNING "FADT: "
+                              "X_PM1b_EVT_BLK.bit_width (%u) does not match"
+                              " PM1_EVT_LEN (%u)\n",
+                              acpi_gbl_FADT.xpm1b_event_block.bit_width,
+                              acpi_gbl_FADT.pm1_event_length);
                acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
                                             pm1_register_length,
                                             (acpi_gbl_FADT.xpm1b_event_block.
@@ -373,6 +385,7 @@ static void acpi_tb_convert_fadt(void)
                /* Don't forget to copy space_id of the GAS */
                acpi_gbl_xpm1b_enable.space_id =
                    acpi_gbl_FADT.xpm1b_event_block.space_id;
+
        }
 }