From a4acba7cb82e16ac9f796b70673af9df30cc33f6 Mon Sep 17 00:00:00 2001 From: Mike Larkin Date: Sun, 27 Jun 2010 17:04:28 +0000 Subject: Clear ACPI fixed event status on resume (power buttons/etc) so that some machines don't immediately resume after suspending to S3. Tested by kettenis@ and I on 5 or 6 machines, deraadt@ "yeah, looks good" --- sys/dev/acpi/acpi.c | 6 +++++- sys/dev/acpi/acpireg.h | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index f6e8a521cee..74660fb8061 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.158 2010/06/27 07:26:31 jordan Exp $ */ +/* $OpenBSD: acpi.c,v 1.159 2010/06/27 17:04:27 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -2095,6 +2095,10 @@ acpi_prepare_sleep_state(struct acpi_softc *sc, int state) goto fail; } + /* Clear fixed event status */ + acpi_write_pmreg(sc, ACPIREG_PM1_STS, 1, + ACPI_PM1_ALL_STS); + /* Enable wake GPEs */ acpi_susp_resume_gpewalk(sc, state, 1); diff --git a/sys/dev/acpi/acpireg.h b/sys/dev/acpi/acpireg.h index 9550a684a41..5317ea74126 100644 --- a/sys/dev/acpi/acpireg.h +++ b/sys/dev/acpi/acpireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpireg.h,v 1.18 2009/07/23 01:38:16 cnst Exp $ */ +/* $OpenBSD: acpireg.h,v 1.19 2010/06/27 17:04:27 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Marco Peereboom @@ -420,6 +420,11 @@ struct acpi_facs { #define ACPI_PM1_PCIEXP_WAKE_STS 0x4000 #define ACPI_PM1_WAK_STS 0x8000 +#define ACPI_PM1_ALL_STS (ACPI_PM1_TMR_STS | ACPI_PM1_BM_STS | \ + ACPI_PM1_GBL_STS | ACPI_PM1_PWRBTN_STS | \ + ACPI_PM1_SLPBTN_STS | ACPI_PM1_RTC_STS | \ + ACPI_PM1_PCIEXP_WAKE_STS | ACPI_PM1_WAK_STS ) + /* * PM1 Enable Registers */ -- cgit v1.2.3