Michael Nottebrock
2008-Jan-16 09:39 UTC
USB prevents system from powering off and ucom prevents usb from being unloaded - ideas?
Subject line is the executive summary of my problem: I have a box with an Intel 945GC A2 chipset that will not poweroff on shutdown if the usb kernel module is loaded (or statically compiled into the kernel). Unloading the usb kernel modules sometime during shutdown (I hacked the usbd rc script for this) to work around the problem helped until I needed to hook up another device which uses ucom(4) to the machine. On kldunload, ucom claims to detach, but remains loaded and subsequent kldunload attempts trigger the error "kldunload: attempt to unload file that was loaded by the kernel". The stuck ucom in turn prevents usb from getting unloaded and the machine cannot poweroff. I have already tried disabling EHCI, but it does not help. Any ideas on either getting uhci to properly detach on shutdown or getting rid of ucom? Cheers, -- ,_, | Michael Nottebrock | lofi@freebsd.org (/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org \u/ | K Desktop Environment on FreeBSD | http://freebsd.kde.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: This is a digitally signed message part. Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20080116/d94c3bfa/attachment.pgp
Shunsuke Akiyama
2008-Jan-21 05:15 UTC
USB prevents system from powering off and ucom prevents usb from being unloaded - ideas?
Hi, Michael Please try attached patch for current. For other branches, please get a patch from http://people.freebsd.org/~akiyama/patches/ I've only tested it on RELENG_6 branch, but it would work for both current and RELENG_7. Regards, At Wed, 16 Jan 2008 17:08:34 +0100, Michael Nottebrock wrote:> > [1 <text/plain; us-ascii (quoted-printable)>] > Subject line is the executive summary of my problem: > > I have a box with an Intel 945GC A2 chipset that will not poweroff on shutdown > if the usb kernel module is loaded (or statically compiled into the kernel). > Unloading the usb kernel modules sometime during shutdown (I hacked the usbd > rc script for this) to work around the problem helped until I needed to hook > up another device which uses ucom(4) to the machine. On kldunload, ucom > claims to detach, but remains loaded and subsequent kldunload attempts > trigger the error "kldunload: attempt to unload file that was loaded by the > kernel". The stuck ucom in turn prevents usb from getting unloaded and the > machine cannot poweroff. > > I have already tried disabling EHCI, but it does not help. Any ideas on either > getting uhci to properly detach on shutdown or getting rid of ucom? > > > Cheers, > -- > ,_, | Michael Nottebrock | lofi@freebsd.org > (/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org > \u/ | K Desktop Environment on FreeBSD | http://freebsd.kde.org > [2 This is a digitally signed message part. <application/pgp-signature (7bit)>] >Index: sys/dev/usb/ucom.c ==================================================================RCS file: /home/ncvs/src/sys/dev/usb/ucom.c,v retrieving revision 1.64 diff -u -r1.64 ucom.c --- sys/dev/usb/ucom.c 25 Jun 2007 06:40:20 -0000 1.64 +++ sys/dev/usb/ucom.c 21 Jan 2008 12:54:00 -0000 @@ -1,7 +1,8 @@ /* $NetBSD: ucom.c,v 1.40 2001/11/13 06:24:54 lukem Exp $ */ /*- - * Copyright (c) 2001-2003, 2005 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. + * Copyright (c) 2001-2003, 2005, 2008 + * Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -113,6 +114,7 @@ #define DPRINTFN(n, x) #endif +static int ucom_modevent(module_t, int, void *); static void ucom_cleanup(struct ucom_softc *); static int ucomparam(struct tty *, struct termios *); static void ucomstart(struct tty *); @@ -135,7 +137,7 @@ static moduledata_t ucom_mod = { "ucom", - NULL, + ucom_modevent, NULL }; @@ -143,6 +145,21 @@ MODULE_DEPEND(ucom, usb, 1, 1, 1); MODULE_VERSION(ucom, UCOM_MODVER); +static int +ucom_modevent(module_t mod, int type, void *data) +{ + switch (type) { + case MOD_LOAD: + break; + case MOD_UNLOAD: + break; + default: + return (EOPNOTSUPP); + break; + } + return (0); +} + int ucom_attach(struct ucom_softc *sc) { -- Shunsuke Akiyama akiyama@jp.FreeBSD.org akiyama@FreeBSD.org