summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-01-21 09:40:56 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-01-21 09:40:56 +0000
commitde7cfb5df61360d16fd69df3dba56a7f08a3f348 (patch)
tree6138c53573a1c6041e4a6d7a0dc4efca5edbdae4
parent5b96010fba9ede3444fb59b564df2486e32f8d4e (diff)
Disable lapic when halting CPUs. Allegedly this is necessary to make
suspend work on some machines. ok deraadt@
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c6
-rw-r--r--sys/arch/amd64/amd64/ipifuncs.c3
-rw-r--r--sys/arch/amd64/amd64/lapic.c8
-rw-r--r--sys/arch/amd64/include/i82489var.h3
4 files changed, 16 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index 5467d471aab..f8fce2d08ed 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.56 2013/12/19 21:30:02 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.57 2014/01/21 09:40:54 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -233,6 +233,10 @@ void
acpi_sleep_clocks(struct acpi_softc *sc, int state)
{
rtcstop();
+
+#if NLAPIC > 0
+ lapic_disable();
+#endif
}
/*
diff --git a/sys/arch/amd64/amd64/ipifuncs.c b/sys/arch/amd64/amd64/ipifuncs.c
index a698ebaa05d..9eec8c24601 100644
--- a/sys/arch/amd64/amd64/ipifuncs.c
+++ b/sys/arch/amd64/amd64/ipifuncs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.21 2013/12/19 21:30:02 deraadt Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.22 2014/01/21 09:40:54 kettenis Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
@@ -103,6 +103,7 @@ x86_64_ipi_halt(struct cpu_info *ci)
SCHED_ASSERT_UNLOCKED();
fpusave_cpu(ci, 1);
disable_intr();
+ lapic_disable();
wbinvd();
ci->ci_flags &= ~CPUF_RUNNING;
wbinvd();
diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c
index f558a5821b5..2f4b672510f 100644
--- a/sys/arch/amd64/amd64/lapic.c
+++ b/sys/arch/amd64/amd64/lapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lapic.c,v 1.28 2013/06/02 18:16:42 gerhard Exp $ */
+/* $OpenBSD: lapic.c,v 1.29 2014/01/21 09:40:54 kettenis Exp $ */
/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
/*-
@@ -131,6 +131,12 @@ lapic_enable(void)
}
void
+lapic_disable(void)
+{
+ i82489_writereg(LAPIC_SVR, 0);
+}
+
+void
lapic_set_lvt(void)
{
struct cpu_info *ci = curcpu();
diff --git a/sys/arch/amd64/include/i82489var.h b/sys/arch/amd64/include/i82489var.h
index a380ca8e6b9..dd50af54e5f 100644
--- a/sys/arch/amd64/include/i82489var.h
+++ b/sys/arch/amd64/include/i82489var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i82489var.h,v 1.13 2011/06/30 22:18:01 jsg Exp $ */
+/* $OpenBSD: i82489var.h,v 1.14 2014/01/21 09:40:55 kettenis Exp $ */
/* $NetBSD: i82489var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */
/*-
@@ -119,6 +119,7 @@ struct cpu_info;
extern void lapic_boot_init(paddr_t);
extern void lapic_set_lvt(void);
extern void lapic_enable(void);
+extern void lapic_disable(void);
extern void lapic_calibrate_timer(struct cpu_info *ci);
extern void lapic_startclock(void);
extern void lapic_initclocks(void);