kern/116347: APM does not suspend USB devices
Marko Zec
zec at fer.hr
Fri Sep 14 05:20:03 PDT 2007
>Number: 116347
>Category: kern
>Synopsis: APM does not suspend USB devices
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Sep 14 12:20:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Marko Zec
>Release: 7.0-CURRENT
>Organization:
U. of Zagreb
>Environment:
FreeBSD tpx32.icir.org 7.0-CURRENT FreeBSD 7.0-CURRENT #6: Fri Sep 14 09:32:49 CEST 2007 marko at tpx32.icir.org:/u/marko/p4/vimage/src/sys/i386/compile/TPX32V i386
>Description:
Any USB device attached to a machine running APM instead of ACPI won't survive a suspend/resume cycle.
>How-To-Repeat:
Boot with ACPI disabled / APM enabled, plug in a USB device, suspend, resume, done.
>Fix:
See the patch attached.
Patch attached with submission follows:
--- ../head/src/sys/i386/bios/apm.c 2007-08-31 03:47:17.000000000 +0200
+++ src/sys/i386/bios/apm.c 2007-09-14 10:20:46.000000000 +0200
@@ -485,7 +485,13 @@ apm_do_suspend(void)
apm_op_inprog = 0;
sc->suspends = sc->suspend_countdown = 0;
+ /*
+ * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since
+ * non-MPSAFE drivers need this.
+ */
+ mtx_lock(&Giant);
error = DEVICE_SUSPEND(root_bus);
+ mtx_unlock(&Giant);
if (error)
return;
@@ -496,7 +502,9 @@ apm_do_suspend(void)
} else {
/* Failure, 'resume' the system again */
apm_execute_hook(hook[APM_HOOK_RESUME]);
+ mtx_lock(&Giant);
DEVICE_RESUME(root_bus);
+ mtx_unlock(&Giant);
}
return;
}
@@ -602,7 +610,9 @@ apm_resume(void)
sc->suspending = 0;
apm_execute_hook(hook[APM_HOOK_RESUME]);
+ mtx_lock(&Giant);
DEVICE_RESUME(root_bus);
+ mtx_unlock(&Giant);
return;
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list