From owner-freebsd-drivers@FreeBSD.ORG Fri Dec 9 19:30:44 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 8D6C31065675 for ; Fri, 9 Dec 2011 19:30:44 +0000 (UTC) (envelope-from gbal.naresh@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3703E8FC1D for ; Fri, 9 Dec 2011 19:30:44 +0000 (UTC) Received: by ggnp1 with SMTP id p1so5056846ggn.13 for ; Fri, 09 Dec 2011 11:30:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=w8MgMSwNv1K6NcXOC0xEp6paLYinCLq+SLZaBKaZUnc=; b=UOKOV3b3LFTM0+PXwVQ8mjtZLDYzzG1+tvIm/K9FdSQagqfT/0YS9GFSDe55d5PVvB HxksCsUo+PmRZ83q7PXnjJUqGP12iy4UZpl4Vc5yzJSqb8mb2d4s8VG27wzcSWO2VAgY riKmWpl6HZZAybFmjW6lu0cowTO171+vgwoyE= Received: by 10.50.207.40 with SMTP id lt8mr4686541igc.43.1323459043512; Fri, 09 Dec 2011 11:30:43 -0800 (PST) Received: from [192.168.1.2] ([122.175.15.173]) by mx.google.com with ESMTPS id l28sm35849449ibc.3.2011.12.09.11.30.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Dec 2011 11:30:41 -0800 (PST) References: <9E03496F-B9A3-499E-9C50-9F0D1EC6FF4F@gmail.com> <201112090749.07012.jhb@freebsd.org> In-Reply-To: <201112090749.07012.jhb@freebsd.org> Mime-Version: 1.0 (1.0) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: X-Mailer: iPhone Mail (9A405) From: Naresh Date: Sat, 10 Dec 2011 00:59:38 +0530 To: John Baldwin Cc: "freebsd-drivers@freebsd.org" 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 19:30:44 -0000 Thanks John. Sent from my iPhone On 09-Dec-2011, at 6:19 PM, John Baldwin wrote: > On Sunday, December 04, 2011 1:04:12 pm Naresh wrote: >> Hi All, >>=20 >> Our product is a CNA i.e it supports both 10G Ethernet and Storage. We ne= ed to provide firmware upgrade facility through our FreeBSD nic driver. >>=20 >> The driver should be able to flash any version of the firmware when provi= ded. >>=20 >> Asuuming driver is already loaded flashing steps should be something like= =20 >> 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. >>=20 >> I looked into load_firmware FreeBSD mechanism. But it requires image to b= e=20 >> converted to loadable module, load image module and then invoke driver us= ing sysctl to start flashing.=20 >>=20 >> Is there any standard way other than load_firmware ? Can we open and read= a file in the driver? >>=20 >> In Linux, we copy the image to /lib/firmware and invoke flashing using so= mething like "ethtool -f eth0 image".=20 >> Then kernel loads the image file from=20 >> /lib/firmware to a data buffer and invokes the driver. The driver then fl= ashes and return status. >>=20 >> Is there a approach in FreeBSD something similar to Linux ? >=20 > There is not a framework along those lines, no. However, you could provid= e an > ioctl which accepts a data buffer and have a small userland utility that t= akes > the filename as an argument, loads it into a local buffer, then invokes yo= ur > ioctl. >=20 > --=20 > John Baldwin