From owner-freebsd-drivers@FreeBSD.ORG Thu Oct 20 03:43:01 2005 Return-Path: X-Original-To: freebsd-drivers@freebsd.org Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBE0616A41F; Thu, 20 Oct 2005 03:43:01 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B7B043D64; Thu, 20 Oct 2005 03:43:01 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.3/8.13.3) with ESMTP id j9K3eSwS074072; Wed, 19 Oct 2005 21:40:28 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 19 Oct 2005 21:41:49 -0600 (MDT) Message-Id: <20051019.214149.104032722.imp@bsdimp.com> To: mayong@mail.com From: "M. Warner Losh" In-Reply-To: <20051020020357.C0CE31CE304@ws1-6.us4.outblaze.com> References: <20051020020357.C0CE31CE304@ws1-6.us4.outblaze.com> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Wed, 19 Oct 2005 21:40:29 -0600 (MDT) Cc: freebsd-drivers@freebsd.org Subject: Re: Some Questions X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2005 03:43:01 -0000 In message: <20051020020357.C0CE31CE304@ws1-6.us4.outblaze.com> "Yong Ma" writes: : John Baldwin wrote: : : > Do any processes have /dev/mypci0 open when you try to kldunload? You : > probably should maintain a count of open clients and if it is > 0, return : > EBUSY in my_pcidetach(). : > : I have met another question(seems I have so many to ask!): : I have to translate the function pci_resource_start() in the original Linux driver,and I use following method: : (reference:http://lists.freebsd.org/pipermail/freebsd-hackers/2005-April/011724.html) : : 183 int rid = 0x10; : 184 res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); : 185 printf("resource alloc successfully!\n"); : 186 sc->bst = rman_get_btag(res); : 187 sc->bsh = rman_get_handle(res); // to pci_resource_start() : : : An error occurred when I make it: : : test.c: In function `mypci_attach': : test.c:186: warning: implicit declaration of function `rman_get_btag' : test.c:186: warning: nested extern declaration of `rman_get_btag' : test.c:187: warning: implicit declaration of function `rman_get_handle' : test.c:187: warning: nested extern declaration of `rman_get_handle' Try rman_get_bustag and rman_get_bushandle instead. Warner