Redo r332918 with the ACPICA API and remove debug.acpi.suspend_deep_bounce.

AcpiOsEnterSleep() was meant to implement this feature.

Reviewed by:	avg
This commit is contained in:
Jung-uk Kim 2018-05-03 19:00:50 +00:00
parent 2570e7c33f
commit e787342e25
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=333222
3 changed files with 11 additions and 14 deletions

View File

@ -37,10 +37,16 @@ __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);
}

View File

@ -287,15 +287,10 @@ SYSCTL_INT(_debug_acpi, OID_AUTO, default_register_width, CTLFLAG_RDTUN,
/* 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.");
int acpi_susp_deep_bounce;
SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_deep_bounce, CTLFLAG_RW,
&acpi_susp_deep_bounce, 0, "Don't actually suspend, "
"bail out just before entering the sleep state.");
/*
* ACPI can only be loaded as a module by the loader; activating it after
* system bootstrap time is not useful, and can be fatal to the system.
@ -2952,10 +2947,6 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
}
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)) {
device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n",

View File

@ -79,7 +79,7 @@ CTASSERT(sizeof(wakecode) < PAGE_SIZE - 1024);
extern int acpi_resume_beep;
extern int acpi_reset_video;
extern int acpi_susp_deep_bounce;
extern int acpi_susp_bounce;
#ifdef SMP
extern struct susppcb **susppcbs;
@ -277,9 +277,6 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
PTD[KPTDI] = PTD[LOWPTDI];
#endif
if (acpi_susp_deep_bounce)
resumectx(pcb);
/* Call ACPICA to enter the desired sleep state */
if (state == ACPI_STATE_S4 && sc->acpi_s4bios)
status = AcpiEnterSleepStateS4bios();
@ -292,6 +289,9 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
return (0); /* couldn't sleep */
}
if (acpi_susp_bounce)
resumectx(pcb);
for (;;)
ia32_pause();
} else {