acpi.c (236408) | acpi.c (239340) |
---|---|
1/*- 2 * Copyright (c) 2000 Takanori Watanabe <takawata@jp.freebsd.org> 3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> 4 * Copyright (c) 2000, 2001 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Takanori Watanabe <takawata@jp.freebsd.org> 3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> 4 * Copyright (c) 2000, 2001 Michael Smith 5 * Copyright (c) 2000 BSDi 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi.c 236408 2012-06-01 17:00:33Z jkim $"); | 31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi.c 239340 2012-08-16 20:54:52Z jkim $"); |
32 33#include "opt_acpi.h" 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/proc.h> 37#include <sys/fcntl.h> 38#include <sys/malloc.h> 39#include <sys/module.h> --- 52 unchanged lines hidden (view full) --- 92}; 93 94/* Global mutex for locking access to the ACPI subsystem. */ 95struct mtx acpi_mutex; 96 97/* Bitmap of device quirks. */ 98int acpi_quirks; 99 | 32 33#include "opt_acpi.h" 34#include <sys/param.h> 35#include <sys/kernel.h> 36#include <sys/proc.h> 37#include <sys/fcntl.h> 38#include <sys/malloc.h> 39#include <sys/module.h> --- 52 unchanged lines hidden (view full) --- 92}; 93 94/* Global mutex for locking access to the ACPI subsystem. */ 95struct mtx acpi_mutex; 96 97/* Bitmap of device quirks. */ 98int acpi_quirks; 99 |
100/* Optional ACPI methods for suspend and resume, e.g., _GTS and _BFS. */ 101int acpi_sleep_flags; 102 | |
103/* Supported sleep states. */ 104static BOOLEAN acpi_sleep_states[ACPI_S_STATE_COUNT]; 105 106static int acpi_modevent(struct module *mod, int event, void *junk); 107static int acpi_probe(device_t dev); 108static int acpi_attach(device_t dev); 109static int acpi_suspend(device_t dev); 110static int acpi_resume(device_t dev); --- 176 unchanged lines hidden (view full) --- 287TUNABLE_INT("debug.acpi.reset_clock", &acpi_reset_clock); 288SYSCTL_INT(_debug_acpi, OID_AUTO, reset_clock, CTLFLAG_RW, 289 &acpi_reset_clock, 1, "Reset system clock while resuming."); 290#endif 291 292/* Allow users to override quirks. */ 293TUNABLE_INT("debug.acpi.quirks", &acpi_quirks); 294 | 100/* Supported sleep states. */ 101static BOOLEAN acpi_sleep_states[ACPI_S_STATE_COUNT]; 102 103static int acpi_modevent(struct module *mod, int event, void *junk); 104static int acpi_probe(device_t dev); 105static int acpi_attach(device_t dev); 106static int acpi_suspend(device_t dev); 107static int acpi_resume(device_t dev); --- 176 unchanged lines hidden (view full) --- 284TUNABLE_INT("debug.acpi.reset_clock", &acpi_reset_clock); 285SYSCTL_INT(_debug_acpi, OID_AUTO, reset_clock, CTLFLAG_RW, 286 &acpi_reset_clock, 1, "Reset system clock while resuming."); 287#endif 288 289/* Allow users to override quirks. */ 290TUNABLE_INT("debug.acpi.quirks", &acpi_quirks); 291 |
295/* Execute optional ACPI methods for suspend and resume. */ 296TUNABLE_INT("debug.acpi.sleep_flags", &acpi_sleep_flags); 297SYSCTL_INT(_debug_acpi, OID_AUTO, sleep_flags, CTLFLAG_RW | CTLFLAG_TUN, 298 &acpi_sleep_flags, 0, "Execute optional ACPI methods for suspend/resume."); 299 | |
300static int acpi_susp_bounce; 301SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW, 302 &acpi_susp_bounce, 0, "Don't actually suspend, just test devices."); 303 304/* 305 * ACPI can only be loaded as a module by the loader; activating it after 306 * system bootstrap time is not useful, and can be fatal to the system. 307 * It also cannot be unloaded, since the entire system bus hierarchy hangs --- 1672 unchanged lines hidden (view full) --- 1980 status = AcpiEnterSleepStatePrep(ACPI_STATE_S5); 1981 if (ACPI_FAILURE(status)) { 1982 device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n", 1983 AcpiFormatException(status)); 1984 return; 1985 } 1986 device_printf(sc->acpi_dev, "Powering system off\n"); 1987 intr = intr_disable(); | 292static int acpi_susp_bounce; 293SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW, 294 &acpi_susp_bounce, 0, "Don't actually suspend, just test devices."); 295 296/* 297 * ACPI can only be loaded as a module by the loader; activating it after 298 * system bootstrap time is not useful, and can be fatal to the system. 299 * It also cannot be unloaded, since the entire system bus hierarchy hangs --- 1672 unchanged lines hidden (view full) --- 1972 status = AcpiEnterSleepStatePrep(ACPI_STATE_S5); 1973 if (ACPI_FAILURE(status)) { 1974 device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n", 1975 AcpiFormatException(status)); 1976 return; 1977 } 1978 device_printf(sc->acpi_dev, "Powering system off\n"); 1979 intr = intr_disable(); |
1988 status = AcpiEnterSleepState(ACPI_STATE_S5, acpi_sleep_flags); | 1980 status = AcpiEnterSleepState(ACPI_STATE_S5); |
1989 if (ACPI_FAILURE(status)) { 1990 intr_restore(intr); 1991 device_printf(sc->acpi_dev, "power-off failed - %s\n", 1992 AcpiFormatException(status)); 1993 } else { 1994 DELAY(1000000); 1995 intr_restore(intr); 1996 device_printf(sc->acpi_dev, "power-off failed - timeout\n"); --- 748 unchanged lines hidden (view full) --- 2745 2746 if (sc->acpi_sleep_delay > 0) 2747 DELAY(sc->acpi_sleep_delay * 1000000); 2748 2749 intr = intr_disable(); 2750 if (state != ACPI_STATE_S1) { 2751 sleep_result = acpi_sleep_machdep(sc, state); 2752 acpi_wakeup_machdep(sc, state, sleep_result, 0); | 1981 if (ACPI_FAILURE(status)) { 1982 intr_restore(intr); 1983 device_printf(sc->acpi_dev, "power-off failed - %s\n", 1984 AcpiFormatException(status)); 1985 } else { 1986 DELAY(1000000); 1987 intr_restore(intr); 1988 device_printf(sc->acpi_dev, "power-off failed - timeout\n"); --- 748 unchanged lines hidden (view full) --- 2737 2738 if (sc->acpi_sleep_delay > 0) 2739 DELAY(sc->acpi_sleep_delay * 1000000); 2740 2741 intr = intr_disable(); 2742 if (state != ACPI_STATE_S1) { 2743 sleep_result = acpi_sleep_machdep(sc, state); 2744 acpi_wakeup_machdep(sc, state, sleep_result, 0); |
2753 AcpiLeaveSleepStatePrep(state, acpi_sleep_flags); | 2745 AcpiLeaveSleepStatePrep(state); |
2754 intr_restore(intr); 2755 2756 /* call acpi_wakeup_machdep() again with interrupt enabled */ 2757 acpi_wakeup_machdep(sc, state, sleep_result, 1); 2758 2759 if (sleep_result == -1) 2760 goto backout; 2761 2762 /* Re-enable ACPI hardware on wakeup from sleep state 4. */ 2763 if (state == ACPI_STATE_S4) 2764 AcpiEnable(); 2765 } else { | 2746 intr_restore(intr); 2747 2748 /* call acpi_wakeup_machdep() again with interrupt enabled */ 2749 acpi_wakeup_machdep(sc, state, sleep_result, 1); 2750 2751 if (sleep_result == -1) 2752 goto backout; 2753 2754 /* Re-enable ACPI hardware on wakeup from sleep state 4. */ 2755 if (state == ACPI_STATE_S4) 2756 AcpiEnable(); 2757 } else { |
2766 status = AcpiEnterSleepState(state, acpi_sleep_flags); 2767 AcpiLeaveSleepStatePrep(state, acpi_sleep_flags); | 2758 status = AcpiEnterSleepState(state); 2759 AcpiLeaveSleepStatePrep(state); |
2768 intr_restore(intr); 2769 if (ACPI_FAILURE(status)) { 2770 device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", 2771 AcpiFormatException(status)); 2772 goto backout; 2773 } 2774 } 2775 slp_state = ACPI_SS_SLEPT; --- 1128 unchanged lines hidden --- | 2760 intr_restore(intr); 2761 if (ACPI_FAILURE(status)) { 2762 device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", 2763 AcpiFormatException(status)); 2764 goto backout; 2765 } 2766 } 2767 slp_state = ACPI_SS_SLEPT; --- 1128 unchanged lines hidden --- |