Date: Wed, 11 Apr 2012 19:37:36 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r234142 - in stable/8/sys/i386: acpica conf Message-ID: <201204111937.q3BJbaau092303@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Apr 11 19:37:36 2012 New Revision: 234142 URL: http://svn.freebsd.org/changeset/base/234142 Log: MFC 232742: MFamd64: - Return failure for a suspend attempt if we have no wake address. - Use intr_disable()/intr_restore() instead of ACPI_DISABLE_IRQS(). - Invoke intr_suspend() earlier and call intr_resume() if suspend fails. - Use pause in the loop waiting for CPU to suspend. - Restore PAT MSR, switchtime, switchticks, and MTRRs on resume. Modified: stable/8/sys/i386/acpica/acpi_wakeup.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/i386/acpica/acpi_wakeup.c ============================================================================== --- stable/8/sys/i386/acpica/acpi_wakeup.c Wed Apr 11 19:37:08 2012 (r234141) +++ stable/8/sys/i386/acpica/acpi_wakeup.c Wed Apr 11 19:37:36 2012 (r234142) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/bus.h> #include <sys/lock.h> +#include <sys/malloc.h> +#include <sys/memrange.h> #include <sys/proc.h> #include <sys/sysctl.h> @@ -199,13 +201,14 @@ acpi_sleep_machdep(struct acpi_softc *sc uint32_t cr3; u_long ef; - ret = 0; + ret = -1; if (sc->acpi_wakeaddr == 0) - return (0); + return (ret); AcpiSetFirmwareWakingVector(sc->acpi_wakephys); - ef = read_eflags(); + ef = intr_disable(); + intr_suspend(); /* * Temporarily switch to the kernel pmap because it provides an @@ -221,10 +224,8 @@ acpi_sleep_machdep(struct acpi_softc *sc #endif ret_addr = 0; - ACPI_DISABLE_IRQS(); if (acpi_savecpu()) { /* Execute Sleep */ - intr_suspend(); p_gdt = (struct region_descriptor *) (sc->acpi_wakeaddr + physical_gdt); @@ -266,25 +267,31 @@ acpi_sleep_machdep(struct acpi_softc *sc device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", AcpiFormatException(status)); - ret = -1; goto out; } - for (;;) ; + for (;;) + ia32_pause(); } else { - /* Execute Wakeup */ - mca_resume(); - intr_resume(); - + pmap_init_pat(); + PCPU_SET(switchtime, 0); + PCPU_SET(switchticks, ticks); if (bootverbose) { acpi_savecpu(); acpi_printcpu(); } + ret = 0; } out: load_cr3(cr3); - write_eflags(ef); + mca_resume(); + intr_resume(); + intr_restore(ef); + + if (ret == 0 && mem_range_softc.mr_op != NULL && + mem_range_softc.mr_op->reinit != NULL) + mem_range_softc.mr_op->reinit(&mem_range_softc); /* If we beeped, turn it off after a delay. */ if (acpi_resume_beep)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204111937.q3BJbaau092303>