From: mlarkin Date: Thu, 5 Aug 2010 16:57:03 +0000 (+0000) Subject: Write to the correct offset for various ACPI pmreg registers. Writing to X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=348a774e76da33f6af46fb414581002649c7b76d;p=openbsd Write to the correct offset for various ACPI pmreg registers. Writing to the correct register does properly clear the wake status bits and fixed event bits, which allows some machines to have more than 1 suspend cycle. bug spotted by deraadt@ tested by deraadt@ and myself on a half-dozen machines and others on hackers@ ok deraadt@, marco@ --- diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 38396898fcd..e5d419aadbc 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.200 2010/08/05 16:13:03 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.201 2010/08/05 16:57:03 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -1697,10 +1697,10 @@ acpi_enter_sleep_state(struct acpi_softc *sc, int state) int retries; /* Clear WAK_STS bit */ - acpi_write_pmreg(sc, ACPIREG_PM1_STS, 1, ACPI_PM1_WAK_STS); + acpi_write_pmreg(sc, ACPIREG_PM1_STS, 0, ACPI_PM1_WAK_STS); /* Disable BM arbitration */ - acpi_write_pmreg(sc, ACPIREG_PM2_CNT, 1, ACPI_PM2_ARB_DIS); + acpi_write_pmreg(sc, ACPIREG_PM2_CNT, 0, ACPI_PM2_ARB_DIS); /* Write SLP_TYPx values */ rega = acpi_read_pmreg(sc, ACPIREG_PM1A_CNT, 0); @@ -1754,7 +1754,7 @@ acpi_resume(struct acpi_softc *sc, int state) acpi_write_pmreg(sc, ACPIREG_PM1_CNT, 0, ACPI_PM1_SCI_EN); /* Clear fixed event status */ - acpi_write_pmreg(sc, ACPIREG_PM1_STS, 1, + acpi_write_pmreg(sc, ACPIREG_PM1_STS, 0, ACPI_PM1_ALL_STS); if (sc->sc_bfs) @@ -1923,7 +1923,7 @@ acpi_prepare_sleep_state(struct acpi_softc *sc, int state) } /* Clear fixed event status */ - acpi_write_pmreg(sc, ACPIREG_PM1_STS, 1, + acpi_write_pmreg(sc, ACPIREG_PM1_STS, 0, ACPI_PM1_ALL_STS); /* Enable wake GPEs */