From owner-freebsd-current@FreeBSD.ORG Tue Dec 13 14:49:40 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ECCF316A424; Tue, 13 Dec 2005 14:49:39 +0000 (GMT) (envelope-from gavin.atkinson@ury.york.ac.uk) Received: from mail-gw1.york.ac.uk (mail-gw1.york.ac.uk [144.32.128.246]) by mx1.FreeBSD.org (Postfix) with ESMTP id A04FB43D7F; Tue, 13 Dec 2005 14:49:32 +0000 (GMT) (envelope-from gavin.atkinson@ury.york.ac.uk) Received: from buffy.york.ac.uk (buffy-128.york.ac.uk [144.32.128.160]) by mail-gw1.york.ac.uk (8.12.10/8.12.10) with ESMTP id jBDEnTNW029237; Tue, 13 Dec 2005 14:49:29 GMT Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.13.4/8.13.4) with ESMTP id jBDEnSJg020995; Tue, 13 Dec 2005 14:49:28 GMT (envelope-from gavin.atkinson@ury.york.ac.uk) Received: (from ga9@localhost) by buffy.york.ac.uk (8.13.4/8.13.4/Submit) id jBDEnSrC020994; Tue, 13 Dec 2005 14:49:28 GMT (envelope-from gavin.atkinson@ury.york.ac.uk) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin.atkinson@ury.york.ac.uk using -f From: Gavin Atkinson To: Gleb Smirnoff In-Reply-To: <1134481135.15730.76.camel@buffy.york.ac.uk> References: <20051211181324.G71610@ury.york.ac.uk> <20051212140446.GQ37414@FreeBSD.org> <1134481135.15730.76.camel@buffy.york.ac.uk> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 13 Dec 2005 14:49:27 +0000 Message-Id: <1134485368.15730.95.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port X-York-MailScanner: Found to be clean X-York-MailScanner-From: gavin.atkinson@ury.york.ac.uk Cc: freebsd-current@freebsd.org, imp@freebsd.org Subject: Re: puc fails to attach serial ports X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2005 14:49:40 -0000 On Tue, 2005-12-13 at 13:38 +0000, Gavin Atkinson wrote: > On Mon, 2005-12-12 at 17:04 +0300, Gleb Smirnoff wrote: > > On Sun, Dec 11, 2005 at 06:22:40PM +0000, Gavin Atkinson wrote: > > G> I'm trying to use puc(4) under RELENG_6 to attach the two serial ports on > > G> a PCI card I have, but it's not working. It also fails under 6.0-RELEASE, > > G> I don't have the ability to test earlier versions. > > G> > > G> How can I further diagnose why this card is not getting recognised? > > > > Afaik, you need 'device uart', that will attach to your pucs. > > No, as far as I can tell, it's sio that should be attaching. I've > loaded the uart module anyway and it still fails. > > With BUS_DEBUG defined, I see the following: > > devclass_find_internal:761: looking for puc > devclass_add_device:1356: (null) in devclass puc > devclass_alloc_unit:1289: unit -1 in devclass puc > devclass_alloc_unit:1329: now: unit 0 in devclass puc > puc0: port 0x18c0-0x18df irq 25 at device 9.0 > on pci0 > puc0: Reserved 0x20 bytes for rid 0x10 type 4 at 0x18c0 > port rid 16 bst 0, start 18c0, end 18df > puc0: i 0, type sio, ressz 8, type 1 > devclass_find_internal:761: looking for sio > puc: Using sio2 > device_add_child_ordered:1542: sio at puc with order 0 as unit 2 > make_device:1427: sio at puc as unit 2 > devclass_find_internal:761: looking for sio > devclass_add_device:1356: (null) in devclass sio > devclass_alloc_unit:1289: unit 2 in devclass sio > devclass_alloc_unit:1329: now: unit 2 in devclass sio > puc: type 1, bar 10, offset 0 > devclass_find_driver_internal:1019: sio in devclass puc > devclass_find_driver_internal:1026: not found > puc0: i 1, type sio, ressz 8, type 1 > devclass_find_internal:761: looking for sio > puc: Using sio3 > device_add_child_ordered:1542: sio at puc with order 0 as unit 3 > make_device:1427: sio at puc as unit 3 > devclass_find_internal:761: looking for sio > devclass_add_device:1356: (null) in devclass sio > devclass_alloc_unit:1289: unit 3 in devclass sio > devclass_alloc_unit:1329: now: unit 3 in devclass sio > puc: type 1, bar 10, offset 8 > devclass_find_driver_internal:1019: sio in devclass puc > devclass_find_driver_internal:1026: not found > > I'm sure somebody with more newbus knowledge will know exactly what that > means... Are we somehow missing a devclass_add_driver(9) call from the > puc initialisation? I'm almost at the point now where I can't > understand how it could possibly be working for anyone else. OK, I've cracked what's happening. Indeed we are somehow missing a call to devclass_add_driver(9). I was loading puc as a module, and in that case the following relevant calls to devclass_add_driver are made: devclass_add_driver: adding puc to cardbus devclass_add_driver: adding puc to pci devclass_add_driver: adding puc to pccard devclass_add_driver: adding uart to puc devclass_add_driver: adding sio to pccard devclass_add_driver: adding sio to pci devclass_add_driver: adding sio to cardbus devclass_add_driver: adding sio to isa devclass_add_driver: adding sio to acpi When compiling puc into the kernel as opposed to using the module, the following extra call is made: devclass_add_driver: adding sio to puc I don't understand why the DRIVER_METHOD(sio, puc, ...) is being ignored in the puc-as-a-module case. Is this expected behaviour? I'm guessing it's not. I do note also that ppc(4) is not added to the puc devclass, presumably for the same reason. I'm also guessing things would work if sio was a module too. It seems odd to me that a module cannot add an in-kernel driver to it's devclass, but at this point I'm out of my depth as far as figuring out how to fix it goes. Gavin Gavin