From owner-freebsd-stable@FreeBSD.ORG Mon Jan 21 13:15:03 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01E6116A41B; Mon, 21 Jan 2008 13:15:03 +0000 (UTC) (envelope-from akiyama@jp.FreeBSD.org) Received: from castle.jp.FreeBSD.org (castle.jp.FreeBSD.org [IPv6:2001:218:422:1::15]) by mx1.freebsd.org (Postfix) with ESMTP id 85AD013C474; Mon, 21 Jan 2008 13:15:02 +0000 (UTC) (envelope-from akiyama@jp.FreeBSD.org) Received: from localhost (castle.jp.FreeBSD.org [2001:218:422:1::15]) by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3/smtpfeed 1.14) with ESMTP/inet6 id m0LDF1687764; Mon, 21 Jan 2008 22:15:01 +0900 (JST) (envelope-from akiyama@jp.FreeBSD.org) Date: Mon, 21 Jan 2008 22:14:58 +0900 From: Shunsuke Akiyama To: Michael Nottebrock In-Reply-To: <200801161708.38213.lofi@freebsd.org> References: <200801161708.38213.lofi@freebsd.org> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.7 Emacs/21.3 (i386--freebsd) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Message-Id: <20080121221459U.akiyama@jp.FreeBSD.org> X-Dispatcher: imput version 20050308(IM148) Lines: 101 Cc: freebsd-stable@freebsd.org, freebsd-usb@freebsd.org Subject: Re: USB prevents system from powering off and ucom prevents usb from being unloaded - ideas? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jan 2008 13:15:03 -0000 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 ] > 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. ] > 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 . + * Copyright (c) 2001-2003, 2005, 2008 + * Shunsuke Akiyama . * 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