mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
Disable CPU idle states during suspend and reenable them during resume.
While in the suspend path, this means the idle thread will just return immediately rather than trying to enter C1-n. This helps in the case where the chipset is powered down before the rest of the system and reads from the cpu sleep registers begin returning immediately, causing the logic that catches bad C2/C3 behavior to kick in. Observed on my Panasonic Y4. MFC after: 3 days
This commit is contained in:
parent
514e149910
commit
3331373ce7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170228
@ -136,6 +136,8 @@ ACPI_SERIAL_DECL(cpu, "ACPI CPU");
|
||||
|
||||
static int acpi_cpu_probe(device_t dev);
|
||||
static int acpi_cpu_attach(device_t dev);
|
||||
static int acpi_cpu_suspend(device_t dev);
|
||||
static int acpi_cpu_resume(device_t dev);
|
||||
static int acpi_pcpu_get_id(uint32_t idx, uint32_t *acpi_id,
|
||||
uint32_t *cpu_id);
|
||||
static struct resource_list *acpi_cpu_get_rlist(device_t dev, device_t child);
|
||||
@ -153,6 +155,7 @@ static void acpi_cpu_idle(void);
|
||||
static void acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context);
|
||||
static int acpi_cpu_quirks(void);
|
||||
static int acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int acpi_cpu_set_cx_lowest(struct acpi_cpu_softc *sc, int val);
|
||||
static int acpi_cpu_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int acpi_cpu_global_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
@ -162,8 +165,8 @@ static device_method_t acpi_cpu_methods[] = {
|
||||
DEVMETHOD(device_attach, acpi_cpu_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, acpi_cpu_shutdown),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
DEVMETHOD(device_suspend, acpi_cpu_suspend),
|
||||
DEVMETHOD(device_resume, acpi_cpu_resume),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_add_child, acpi_cpu_add_child),
|
||||
@ -356,6 +359,30 @@ acpi_cpu_attach(device_t dev)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable any entry to the idle function during suspend and re-enable it
|
||||
* during resume.
|
||||
*/
|
||||
static int
|
||||
acpi_cpu_suspend(device_t dev)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = bus_generic_suspend(dev);
|
||||
if (error)
|
||||
return (error);
|
||||
cpu_disable_idle = TRUE;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_cpu_resume(device_t dev)
|
||||
{
|
||||
|
||||
cpu_disable_idle = FALSE;
|
||||
return (bus_generic_resume(dev));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the nth present CPU and return its pc_cpuid as well as set the
|
||||
* pc_acpi_id from the most reliable source.
|
||||
|
Loading…
Reference in New Issue
Block a user