summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2010-08-11 21:22:44 +0000
committerkettenis <kettenis@openbsd.org>2010-08-11 21:22:44 +0000
commit3191b86a3dbf0bcf80bc8f81bd66dc292243572f (patch)
tree226e9d88307ca76681d38cbe1af61b91c4bd199c
parentplug several resource leaks (diff)
downloadwireguard-openbsd-3191b86a3dbf0bcf80bc8f81bd66dc292243572f.tar.xz
wireguard-openbsd-3191b86a3dbf0bcf80bc8f81bd66dc292243572f.zip
Disable the RTC the periodic interrupt. Leaving it enabled causes the
Dell Inspirion 4150 to wake up immediately even though RTC_EN isn't set in the PM1 Enable register. ok deraadt@, mlarkin@
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c4
-rw-r--r--sys/arch/amd64/include/cpu.h3
-rw-r--r--sys/arch/amd64/isa/clock.c8
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c4
-rw-r--r--sys/arch/i386/include/cpu.h3
-rw-r--r--sys/arch/i386/isa/clock.c8
6 files changed, 24 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index 3ae4a2569cf..6662fd9ad2c 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.44 2010/08/08 21:23:42 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.45 2010/08/11 21:22:44 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -207,6 +207,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
return (ENXIO);
}
+ rtcstop();
+
/* amd64 does not do lazy pmap_activate */
/*
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index fd16b34f02e..91a5678e88e 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.54 2010/08/05 21:10:10 deraadt Exp $ */
+/* $OpenBSD: cpu.h,v 1.55 2010/08/11 21:22:44 kettenis Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -293,6 +293,7 @@ void child_trampoline(void);
extern void (*initclock_func)(void);
void startclocks(void);
void rtcstart(void);
+void rtcstop(void);
void i8254_delay(int);
void i8254_initclocks(void);
void i8254_startclock(void);
diff --git a/sys/arch/amd64/isa/clock.c b/sys/arch/amd64/isa/clock.c
index 5980edd031b..5785a719a09 100644
--- a/sys/arch/amd64/isa/clock.c
+++ b/sys/arch/amd64/isa/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.16 2010/08/10 02:06:43 marco Exp $ */
+/* $OpenBSD: clock.c,v 1.17 2010/08/11 21:22:44 kettenis Exp $ */
/* $NetBSD: clock.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */
/*-
@@ -343,6 +343,12 @@ rtcstart(void)
timeout_add(&rtcdrain_timeout, 1);
}
+void
+rtcstop(void)
+{
+ mc146818_write(NULL, MC_REGB, MC_REGB_24HR);
+}
+
int
rtcget(mc_todregs *regs)
{
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index bf220459368..2cdaf9bcf71 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.38 2010/08/08 21:23:41 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.39 2010/08/11 21:22:44 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -224,6 +224,8 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
return (ENXIO);
}
+ rtcstop();
+
/* i386 does lazy pmap_activate */
pmap_activate(curproc);
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 7ab24ef2037..5896c7230b4 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.113 2010/08/05 21:10:09 deraadt Exp $ */
+/* $OpenBSD: cpu.h,v 1.114 2010/08/11 21:22:44 kettenis Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -375,6 +375,7 @@ extern void (*initclock_func)(void);
void startclocks(void);
void rtcdrain(void *);
void rtcstart(void);
+void rtcstop(void);
void i8254_delay(int);
void i8254_initclocks(void);
void i8254_startclock(void);
diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c
index 81a51342c48..596a37946dd 100644
--- a/sys/arch/i386/isa/clock.c
+++ b/sys/arch/i386/isa/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.44 2010/08/10 02:23:31 marco Exp $ */
+/* $OpenBSD: clock.c,v 1.45 2010/08/11 21:22:44 kettenis Exp $ */
/* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */
/*-
@@ -419,6 +419,12 @@ rtcstart(void)
timeout_add(&rtcdrain_timeout, 1);
}
+void
+rtcstop(void)
+{
+ mc146818_write(NULL, MC_REGB, MC_REGB_24HR);
+}
+
int
rtcget(mc_todregs *regs)
{