summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c14
-rw-r--r--sys/arch/i386/i386/autoconf.c7
2 files changed, 19 insertions, 2 deletions
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index 95c753e3bda..027658fe2fe 100644
--- a/sys/arch/i386/i386/acpi_machdep.c
+++ b/sys/arch/i386/i386/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.41 2010/10/06 18:21:09 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.42 2012/03/26 16:15:42 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -23,6 +23,7 @@
#include <sys/memrange.h>
#include <sys/proc.h>
#include <sys/user.h>
+#include <sys/hibernate.h>
#include <uvm/uvm_extern.h>
@@ -263,12 +264,23 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
i386_broadcast_ipi(I386_IPI_HALT);
#endif
wbinvd();
+#ifdef HIBERNATE
+ if (state == ACPI_STATE_S4)
+ if (hibernate_suspend())
+ panic("%s: hibernate failed", DEVNAME(sc));
+#endif
acpi_enter_sleep_state(sc, state);
panic("%s: acpi_enter_sleep_state failed", DEVNAME(sc));
}
/* Resume path continues here */
+#ifdef HIBERNATE
+ /* Free piglet and other pages allocated during suspend */
+ if (state == ACPI_STATE_S4)
+ hibernate_free();
+#endif
+
/* Reset the vector */
sc->sc_facs->wakeup_vector = 0;
diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c
index fa34ca1acd1..3ff07dd2cf4 100644
--- a/sys/arch/i386/i386/autoconf.c
+++ b/sys/arch/i386/i386/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.88 2011/06/26 23:19:11 tedu Exp $ */
+/* $OpenBSD: autoconf.c,v 1.89 2012/03/26 16:15:42 mlarkin Exp $ */
/* $NetBSD: autoconf.c,v 1.20 1996/05/03 19:41:56 christos Exp $ */
/*-
@@ -67,6 +67,7 @@
#include <machine/gdt.h>
#include <machine/biosvar.h>
#include <machine/kvm86.h>
+#include <sys/hibernate.h>
#include <dev/cons.h>
@@ -208,6 +209,10 @@ diskconf(void)
setroot(bootdv, part, RB_USERREQ);
dumpconf();
+
+#ifdef HIBERNATE
+ hibernate_resume();
+#endif /* HIBERNATE */
}
struct nam2blk nam2blk[] = {