From owner-freebsd-drivers@FreeBSD.ORG Thu Oct 20 02:04: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 00C6016A420 for ; Thu, 20 Oct 2005 02:04:00 +0000 (GMT) (envelope-from mayong@mail.com) Received: from webmail-outgoing.us4.outblaze.com (webmail-outgoing.us4.outblaze.com [205.158.62.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C59943D62 for ; Thu, 20 Oct 2005 02:04:00 +0000 (GMT) (envelope-from mayong@mail.com) Received: from unknown (unknown [192.168.9.180]) by webmail-outgoing.us4.outblaze.com (Postfix) with QMQP id D2CAA18001B3 for ; Thu, 20 Oct 2005 02:03:57 +0000 (GMT) X-OB-Received: from unknown (205.158.62.182) by wfilter.us4.outblaze.com; 20 Oct 2005 02:03:57 -0000 Received: by ws1-6.us4.outblaze.com (Postfix, from userid 1001) id C0CE31CE304; Thu, 20 Oct 2005 02:03:57 +0000 (GMT) Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 From: "Yong Ma" To: "John Baldwin" Date: Wed, 19 Oct 2005 21:03:57 -0500 Received: from [159.226.5.225] by ws1-6.us4.outblaze.com with http for mayong@mail.com; Wed, 19 Oct 2005 21:03:57 -0500 X-Originating-Ip: 159.226.5.225 X-Originating-Server: ws1-6.us4.outblaze.com Message-Id: <20051020020357.C0CE31CE304@ws1-6.us4.outblaze.com> 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 02:04:01 -0000 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= =20 > 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 origina= l Linux driver,and I use following method: (reference:http://lists.freebsd.org/pipermail/freebsd-hackers/2005-April/01= 1724.html) =20=20 183 int rid =3D 0x10; 184 res =3D bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); 185 printf("resource alloc successfully!\n"); 186 sc->bst =3D rman_get_btag(res); 187 sc->bsh =3D 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' and [root] #kldload -v ./test.ko kldload: can't load ./test.ko: No such file or directory (but the test.ko was just there!) Delete the last two lines and it will be complied and loaded successfully,b= ut I have to keep these two lines.I don't know what to do,tell me please! btw:I had #include in the file. Thanks and best regards Yong --=20 ___________________________________________________ Play 100s of games for FREE! http://games.mail.com/