From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 22 07:48:20 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C61216A447 for ; Fri, 22 Jul 2005 07:48:20 +0000 (GMT) (envelope-from takawata@axe-inc.co.jp) Received: from axe-inc.co.jp (axegw.axe-inc.co.jp [61.199.217.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A5DA43D9F for ; Fri, 22 Jul 2005 07:48:08 +0000 (GMT) (envelope-from takawata@axe-inc.co.jp) Received: from localhost (localhost [127.0.0.1]) by axe-inc.co.jp (8.9.3+3.2W/3.7W) with SMTP id QAA02213 for ; Fri, 22 Jul 2005 16:48:07 +0900 (JST) Message-Id: <200507220748.QAA02213@axe-inc.co.jp> X-Authentication-Warning: axegw.axe-inc.co.jp: localhost [127.0.0.1] didn't use HELO protocol To: freebsd-hackers@freebsd.org From: takawata@jp.freebsd.org In-reply-to: Your message of "Fri, 22 Jul 2005 14:38:32 +0800." Date: Fri, 22 Jul 2005 16:48:07 +0900 Sender: takawata@axe-inc.co.jp Subject: Re: Bus Driver probe and attach device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2005 07:48:20 -0000 In message , 室町優香 wrote: >Hi: > >I'm trying to written Azalia (HD Audio) driver for freebsd now. > >The HDA controller is a standard controller, which can take max= >15 codecs. I'm planning made it be a bus driver (azalia bus). > >I tried to read the PCI, USB and Firewire driver code be sample. >It looks: > >1. Detect codec which already connected to azalia controller. >2. call device_add_child(azbus_dev, NULL, -1); to create a child > device, which attach to azalia bus driver. >3. allocate memory to put codec info (e.g. device id, vendor id,=20 > revision..etc), and call device_set_ivars(codec_dev, codec_info); > save the codec_info ptr into device's ivars. >4. Continue 1 ~ 3, untin all available codecs be added. > >After all codecs be added, I call the device_probe_and_attach(azbus_dev);, >but there is no thing happend.=20 Because it trys to attach azbus driver itself, not try to attach its child. >Then I try to call bus_generic_attach(azbus_dev);, the codecs driver probe >function be called. >Is this correct (use bus_generic_attach()), and I'm interested the detail. Correct. It calls device_probe_and_attach() for all child you already add.