From owner-freebsd-drivers@FreeBSD.ORG Fri Dec 9 12:51:35 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C9E1106564A for ; Fri, 9 Dec 2011 12:51:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 456A08FC14 for ; Fri, 9 Dec 2011 12:51:35 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id D71C646B1A; Fri, 9 Dec 2011 07:51:34 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5FD9CB96B; Fri, 9 Dec 2011 07:51:34 -0500 (EST) From: John Baldwin To: freebsd-drivers@freebsd.org Date: Fri, 9 Dec 2011 07:49:06 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <9E03496F-B9A3-499E-9C50-9F0D1EC6FF4F@gmail.com> In-Reply-To: <9E03496F-B9A3-499E-9C50-9F0D1EC6FF4F@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112090749.07012.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 09 Dec 2011 07:51:34 -0500 (EST) Cc: Naresh Subject: Re: Firmware upgrade for CNA 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: Fri, 09 Dec 2011 12:51:35 -0000 On Sunday, December 04, 2011 1:04:12 pm Naresh wrote: > Hi All, > > Our product is a CNA i.e it supports both 10G Ethernet and Storage. We need to provide firmware upgrade facility through our FreeBSD nic driver. > > The driver should be able to flash any version of the firmware when provided. > > Asuuming driver is already loaded flashing steps should be something like > 1) User will invoke flashing by providing the image name and file path. > 2) Driver should load the image from the path and start flashing. > 3) Return the flashing status to the user. > > I looked into load_firmware FreeBSD mechanism. But it requires image to be > converted to loadable module, load image module and then invoke driver using sysctl to start flashing. > > Is there any standard way other than load_firmware ? Can we open and read a file in the driver? > > In Linux, we copy the image to /lib/firmware and invoke flashing using something like "ethtool -f eth0 image". > Then kernel loads the image file from > /lib/firmware to a data buffer and invokes the driver. The driver then flashes and return status. > > Is there a approach in FreeBSD something similar to Linux ? There is not a framework along those lines, no. However, you could provide an ioctl which accepts a data buffer and have a small userland utility that takes the filename as an argument, loads it into a local buffer, then invokes your ioctl. -- John Baldwin