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 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 |
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 |
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(); |
1980 status = AcpiEnterSleepState(ACPI_STATE_S5); |
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); |
2745 AcpiLeaveSleepStatePrep(state); |
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 { |
2758 status = AcpiEnterSleepState(state); 2759 AcpiLeaveSleepStatePrep(state); |
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 --- |