Date: Fri, 14 Sep 2007 12:18:25 GMT From: Marko Zec <zec@fer.hr> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/116347: APM does not suspend USB devices Message-ID: <200709141218.l8ECIP2h070187@www.freebsd.org> Resent-Message-ID: <200709141220.l8ECK3VD081701@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709141218.l8ECIP2h070187>
