From owner-freebsd-questions Wed Apr 3 18:59: 3 2002 Delivered-To: freebsd-questions@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id B303D37B41E; Wed, 3 Apr 2002 18:58:56 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id g342wti66281; Wed, 3 Apr 2002 19:58:55 -0700 (MST) (envelope-from imp@village.org) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id g342wsf76712; Wed, 3 Apr 2002 19:58:54 -0700 (MST) (envelope-from imp@village.org) Date: Wed, 03 Apr 2002 19:58:41 -0700 (MST) Message-Id: <20020403.195841.89251387.imp@village.org> To: phk@critter.freebsd.dk Cc: carl.kreider@windriver.com, freebsd-questions@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: read a file from a driver From: "M. Warner Losh" In-Reply-To: <40835.1017848294@critter.freebsd.dk> References: <20020403101614.A12363@indy.doctordesign.com> <40835.1017848294@critter.freebsd.dk> X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <40835.1017848294@critter.freebsd.dk> Poul-Henning Kamp writes: : In message <20020403101614.A12363@indy.doctordesign.com>, "Kreider, Carl" write : s: : > : >I am working on an embedded project running FreeBSD, and my driver : >for our custom card needs to load an FPGA with code. I know I can : >compile the code in as data, but for ease of development, I would : >rather fetch the FPGA code from a file. With a driver in kernel : >space. Really. : > : >Can it be done? If so, how? open() and read() are obviously in libc : >which rules them out. Do I have to write my own in assembler? : : Don't even think about it. : : At the time your driver is probed/attached, there is no filesystems : mounted yet. : : Best suggestion is to use an ioctl to download the data from : userland. The other alternative that I've seen used is to have a module that loaded at the same time as the driver that has the firmware. This allows that second module to, in theory, be unloaded and the memory reclaimed. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message