Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jun 2018 10:39:22 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r335554 - in stable/11/sys: dev/acpica dev/acpica/Osd x86/acpica
Message-ID:  <201806221039.w5MAdMm5070044@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Fri Jun 22 10:39:22 2018
New Revision: 335554
URL: https://svnweb.freebsd.org/changeset/base/335554

Log:
  MFC r332918, r333222: go deeper for ACPI suspend bounce test
  
  debug.acpi.suspend_bounce sysctl now allows a deeper dive into the sleep
  abyss.  The system will execute the suspend sequence up to the call to
  AcpiEnterSleepState().  That includes saving processor contexts and
  parking APs.  Then, instead of actually entering the sleep state, the
  BSP will call resumectx() to emulate the wakeup.  The APs should get
  restarted by the sequence of Init and Startup IPIs that BSP sends to
  them.
  
  AcpiOsEnterSleep() is used to implement this feature.
  
  Joint work with jkim.

Modified:
  stable/11/sys/dev/acpica/Osd/OsdHardware.c
  stable/11/sys/dev/acpica/acpi.c
  stable/11/sys/x86/acpica/acpi_wakeup.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/acpica/Osd/OsdHardware.c
==============================================================================
--- stable/11/sys/dev/acpica/Osd/OsdHardware.c	Fri Jun 22 10:23:32 2018	(r335553)
+++ stable/11/sys/dev/acpica/Osd/OsdHardware.c	Fri Jun 22 10:39:22 2018	(r335554)
@@ -37,9 +37,15 @@ __FBSDID("$FreeBSD$");
 #include <machine/iodev.h>
 #include <machine/pci_cfgreg.h>
 
+extern int	acpi_susp_bounce;
+
 ACPI_STATUS
 AcpiOsEnterSleep(UINT8 SleepState, UINT32 RegaValue, UINT32 RegbValue)
 {
+
+	/* If testing device suspend only, back out of everything here. */
+	if (acpi_susp_bounce)
+		return (AE_CTRL_TERMINATE);
 
 	return (AE_OK);
 }

Modified: stable/11/sys/dev/acpica/acpi.c
==============================================================================
--- stable/11/sys/dev/acpica/acpi.c	Fri Jun 22 10:23:32 2018	(r335553)
+++ stable/11/sys/dev/acpica/acpi.c	Fri Jun 22 10:39:22 2018	(r335554)
@@ -291,7 +291,7 @@ SYSCTL_INT(_debug_acpi, OID_AUTO, reset_clock, CTLFLAG
 /* Allow users to override quirks. */
 TUNABLE_INT("debug.acpi.quirks", &acpi_quirks);
 
-static int acpi_susp_bounce;
+int acpi_susp_bounce;
 SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW,
     &acpi_susp_bounce, 0, "Don't actually suspend, just test devices.");
 
@@ -2897,10 +2897,6 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
 	goto backout;
     }
     slp_state = ACPI_SS_DEV_SUSPEND;
-
-    /* If testing device suspend only, back out of everything here. */
-    if (acpi_susp_bounce)
-	goto backout;
 
     status = AcpiEnterSleepStatePrep(state);
     if (ACPI_FAILURE(status)) {

Modified: stable/11/sys/x86/acpica/acpi_wakeup.c
==============================================================================
--- stable/11/sys/x86/acpica/acpi_wakeup.c	Fri Jun 22 10:23:32 2018	(r335553)
+++ stable/11/sys/x86/acpica/acpi_wakeup.c	Fri Jun 22 10:39:22 2018	(r335554)
@@ -77,6 +77,7 @@ CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024);
 
 extern int		acpi_resume_beep;
 extern int		acpi_reset_video;
+extern int		acpi_susp_bounce;
 
 #ifdef SMP
 extern struct susppcb	**susppcbs;
@@ -257,6 +258,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
 			    AcpiFormatException(status));
 			return (0);	/* couldn't sleep */
 		}
+
+		if (acpi_susp_bounce)
+			resumectx(pcb);
 
 		for (;;)
 			ia32_pause();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806221039.w5MAdMm5070044>