From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 22 08:06:47 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 69F9616A482 for ; Fri, 22 Jul 2005 08:06:47 +0000 (GMT) (envelope-from yuka.muromachi@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3F9F43DA9 for ; Fri, 22 Jul 2005 08:06:16 +0000 (GMT) (envelope-from yuka.muromachi@gmail.com) Received: by zproxy.gmail.com with SMTP id j2so138230nzf for ; Fri, 22 Jul 2005 01:06:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S4GyAeC9k/OBQQvkDL92q7OHLttyr3Duc/HlJaXZPRicyhhraDC3CAZJmgk+58LCX0C0gfKWiBu3OUOAdCzAjxjXF5lA8/QtuXzurto7Fh0hGOphUF7LFgMBsRkJQAQTM6HTFTLQ6RbM9JLBCc6HK1HTFl48nkUXLiJNo5By7sg= Received: by 10.36.129.16 with SMTP id b16mr1281797nzd; Fri, 22 Jul 2005 00:59:04 -0700 (PDT) Received: by 10.36.221.16 with HTTP; Fri, 22 Jul 2005 00:59:04 -0700 (PDT) Message-ID: Date: Fri, 22 Jul 2005 15:59:04 +0800 From: Yuka Muromachi To: freebsd-hackers@freebsd.org In-Reply-To: <200507220748.QAA02213@axe-inc.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200507220748.QAA02213@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 Reply-To: Yuka Muromachi 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 08:06:47 -0000 It mean I have 2 way to do it? (please view the code below) CodecPresent = az_rw(sc, AZX_REG_STATESTS); for (idx=0; idx> idx) & 0x0001) { // alloc codec info // fill codec info device_t codec_dev = device_add_child(azbus_dev, NULL, -1); device_set_ivars(codec_dev, codec); // I can probe and attach new device self here. device_probe_and_attach(codec_dev); } } // Or, I can probe and attach all new child here bus_generic_attach(azbus_dev); 05/07/22 に takawata@jp.freebsd.org さんは書きました: > 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. > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >