ACPICA: Clear PM register write-only bits on reading
authorLin Ming <ming.m.lin@intel.com>
Thu, 19 Mar 2009 01:51:01 +0000 (09:51 +0800)
committerLen Brown <len.brown@intel.com>
Fri, 27 Mar 2009 16:11:03 +0000 (12:11 -0400)
Affects PM1 Control register only. When reading the register, zero
the write-only bits as per the ACPI spec.  ACPICA BZ 443. Lin Ming.

http://www.acpica.org/bugzilla/show_bug.cgi?id=443

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/hwregs.c

index 42ef0cbf70f85002e984c9fa221912b3e7e93375..772ee5c4ccca51669d09ed576630c6b5e5cc0fce 100644 (file)
@@ -781,6 +781,10 @@ struct acpi_bit_register_info {
  */
 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800 /* Bit 11 */
 
+/* Write-only bits must be zeroed by software */
+
+#define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004 /* Bits 13, 2 */
+
 /* For control registers, both ignored and reserved bits must be preserved */
 
 #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0201 /* Bits 9, 0(SCI_EN) */
index f8ee0a7fd44d6387be7502e26cbb6df2e8a3a33c..7b2fb602b5cbf59a441a98950078e34a6d7f862b 100644 (file)
@@ -207,6 +207,13 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)
                                               xpm1a_control_block,
                                               &acpi_gbl_FADT.
                                               xpm1b_control_block);
+
+               /*
+                * Zero the write-only bits. From the ACPI specification, "Hardware
+                * Write-Only Bits": "Upon reads to registers with write-only bits,
+                * software masks out all write-only bits."
+                */
+               value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS;
                break;
 
        case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */