Add acpi_get_sleep_type() to i82371eb and P2B _PTS/_WAK methods
[coreboot.git] / src / southbridge / intel / i82371eb / smbus.c
index b1a51c6a8a87b83f6c26689edf1062b6b3ea1ddd..65af02abb0aa464b4dc49e28b425d70771df0604 100644 (file)
 #include "i82371eb.h"
 #include "smbus.h"
 
+#if CONFIG_HAVE_ACPI_RESUME == 1
+extern u8 acpi_slp_type;
+int acpi_get_sleep_type(void);
+#endif
+
 static void pwrmgt_enable(struct device *dev)
 {
        struct southbridge_intel_i82371eb_config *sb = dev->chip_info;
@@ -87,7 +92,13 @@ static void pwrmgt_enable(struct device *dev)
        outw(0xffff,     DEFAULT_PMBASE + GLBSTS);
        outl(0xffffffff, DEFAULT_PMBASE + DEVSTS);
 
-       /* set pmcntrl default */
+#if CONFIG_HAVE_ACPI_RESUME == 1
+       /* this reads PMCNTRL, so we have to call it before writing the
+        * default value */
+       acpi_slp_type = acpi_get_sleep_type();
+#endif
+
+       /* set PMCNTRL default */
        outw(SUS_TYP_S0|SCI_EN, DEFAULT_PMBASE + PMCNTRL);
 }