ACPICA: New: acpi_reset interface - write to reset register
authorBob Moore <robert.moore@intel.com>
Tue, 30 Dec 2008 03:11:57 +0000 (11:11 +0800)
committerLen Brown <len.brown@intel.com>
Wed, 31 Dec 2008 06:14:32 +0000 (01:14 -0500)
Uses the FADT-defined reset register and reset value. Checks the
FADT flags for the reset register supported bit. Supports reset
register in memory or I/O space, but not in PCI config space
since the host has the information to do it.

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

index b6244a0fcf4cd3e17b74c9f8fd0211e2bc0b1fbe..0601ed711f30448e47e2ebcce7841605d061fa35 100644 (file)
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwxface")
 
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_reset
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Set reset register in memory or IO space. Note: Does not
+ *              support reset register in PCI config space, this must be
+ *              handled separately.
+ *
+ ******************************************************************************/
+acpi_status acpi_reset(void)
+{
+       struct acpi_generic_address *reset_reg;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(acpi_reset);
+
+       reset_reg = &acpi_gbl_FADT.reset_register;
+
+       /* Check if the reset register is supported */
+
+       if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
+           !reset_reg->address) {
+               return_ACPI_STATUS(AE_NOT_EXIST);
+       }
+
+       /* Write the reset value to the reset register */
+
+       status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg);
+       return_ACPI_STATUS(status);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_reset)
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_read
index 030aeb556e6b6f0befaa7f2fe0eb7f5f60681517..b3bceadf6f75b80af19b98898c67c994a7b988cc 100644 (file)
@@ -322,6 +322,8 @@ acpi_resource_to_address64(struct acpi_resource *resource,
 /*
  * Hardware (ACPI device) interfaces
  */
+acpi_status acpi_reset(void);
+
 acpi_status acpi_get_register(u32 register_id, u32 * return_value);
 
 acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);