changeset 8031:dad7ab7a3786

6731804 fwflash needs to support ConnectX/hermon HCAs
author Shantkumar Hiremath<Shantkumar.Hiremath@Sun.COM>
date Thu, 06 Nov 2008 21:27:14 -0800
parents 2b963e8d757a
children a18c04c5c307
files usr/src/cmd/fwflash/common/fwflash.c usr/src/pkgdefs/SUNWfwflash/prototype_com
diffstat 2 files changed, 37 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/fwflash/common/fwflash.c	Fri Nov 07 10:39:48 2008 +0800
+++ b/usr/src/cmd/fwflash/common/fwflash.c	Thu Nov 06 21:27:14 2008 -0800
@@ -83,7 +83,7 @@
  * actually of any use - it doesn't line up with Mercurial's
  * concept of the changeset.
  */
-#define	FWFLASH_VERSION		"v1.6"
+#define	FWFLASH_VERSION		"v1.7"
 #define	FWFLASH_PROG_NAME	"fwflash"
 
 static int get_fileopts(char *options);
@@ -103,7 +103,8 @@
  * FWFlash main code
  */
 int
-main(int argc, char **argv) {
+main(int argc, char **argv)
+{
 	int		rv = FWFLASH_SUCCESS;
 	int		i;
 	char		ch;
@@ -185,8 +186,8 @@
 	/* Do Help */
 	if ((fwflash_arg_list & FWFLASH_HELP_FLAG) ||
 	    ((fwflash_arg_list & FWFLASH_DEVICE_FLAG) &&
-		!((fwflash_arg_list & FWFLASH_FW_FLAG) ||
-		    (fwflash_arg_list & FWFLASH_READ_FLAG)))) {
+	    !((fwflash_arg_list & FWFLASH_FW_FLAG) ||
+	    (fwflash_arg_list & FWFLASH_READ_FLAG)))) {
 		fwflash_usage(NULL);
 		return (FWFLASH_SUCCESS);
 	}
@@ -225,7 +226,7 @@
 	/* Do flash update (write) */
 	if ((fwflash_arg_list == (FWFLASH_FW_FLAG | FWFLASH_DEVICE_FLAG)) ||
 	    (fwflash_arg_list == (FWFLASH_FW_FLAG | FWFLASH_DEVICE_FLAG |
-		FWFLASH_YES_FLAG))) {
+	    FWFLASH_YES_FLAG))) {
 		/* the update function handles the real arg parsing */
 		i = 0;
 		while (filelist[i] != NULL) {
@@ -234,7 +235,7 @@
 				/* failed ops have already been noted */
 				logmsg(MSG_ERROR,
 				    gettext("New firmware will be activated "
-					"after you reboot\n\n"));
+				    "after you reboot\n\n"));
 			}
 			++i;
 		}
@@ -246,7 +247,7 @@
 	/* Do flash read */
 	if ((fwflash_arg_list == (FWFLASH_READ_FLAG | FWFLASH_DEVICE_FLAG)) ||
 	    (fwflash_arg_list == (FWFLASH_READ_FLAG | FWFLASH_DEVICE_FLAG |
-		FWFLASH_YES_FLAG))) {
+	    FWFLASH_YES_FLAG))) {
 		rv = fwflash_read_file(devpath, read_file);
 		fwflash_intr(0);
 		return (rv);
@@ -259,7 +260,8 @@
 
 
 static int
-flash_load_plugins() {
+flash_load_plugins()
+{
 
 	int rval = FWFLASH_SUCCESS;
 	DIR *dirp;
@@ -328,7 +330,7 @@
 	    == NULL) {
 		logmsg(MSG_ERROR,
 		    gettext("Unable to malloc %d bytes while "
-			"trying to load plugins: %s\n"),
+		    "trying to load plugins: %s\n"),
 		    sizeof (struct fw_plugin) + 1, strerror(errno));
 		return (FWFLASH_FAILURE);
 	}
@@ -347,7 +349,7 @@
 		if ((plugname = calloc(1, MAXPATHLEN + 1)) == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to malloc %d bytes while "
-				"trying to load plugins: %s\n"),
+			    "trying to load plugins: %s\n"),
 			    MAXPATHLEN + 1, strerror(errno));
 			return (FWFLASH_FAILURE);
 		}
@@ -360,7 +362,7 @@
 		    == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to malloc %d bytes while "
-				"trying to load plugins: %s\n"),
+			    "trying to load plugins: %s\n"),
 			    sizeof (struct pluginlist), strerror(errno));
 			return (FWFLASH_FAILURE);
 		}
@@ -385,7 +387,7 @@
 		    == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to allocate %d bytes for plugin "
-				"filename %s:%s\n"),
+			    "filename %s:%s\n"),
 			    strlen(plugname) + 1, plugname,
 			    strerror(errno));
 			return (rval);
@@ -454,7 +456,7 @@
 		    == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to allocate space for a"
-				"drivername %s\n"),
+			    "drivername %s\n"),
 			    tmpplug->drvname);
 			return (FWFLASH_FAILURE);
 		}
@@ -466,7 +468,7 @@
 		    strlen(tmpplug->filename) + 1)) == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to allocate %d bytes for "
-				"filename %s\n"),
+			    "filename %s\n"),
 			    strlen(tmpplug->filename) + 1,
 			    tmpplug->filename);
 			return (FWFLASH_FAILURE);
@@ -505,7 +507,8 @@
  * one place.
  */
 int
-fwflash_load_verifier(char *drv, char *vendorid, char *fwimg) {
+fwflash_load_verifier(char *drv, char *vendorid, char *fwimg)
+{
 
 	int rv = FWFLASH_FAILURE;
 	int imgfd;
@@ -536,7 +539,7 @@
 		if ((fwvrfydirpath = calloc(1, MAXPATHLEN + 1)) == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to allocate space for a firmware "
-				"verifier file(1)"));
+			    "verifier file(1)"));
 			return (rv);
 		}
 
@@ -557,7 +560,7 @@
 			/* invalid vendorid, something's really wrong */
 			logmsg(MSG_ERROR,
 			    gettext("Invalid vendorid (null) specified for "
-				"device\n"));
+			    "device\n"));
 			return (rv);
 		}
 
@@ -590,7 +593,7 @@
 		    == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to allocate space to store "
-				"a verifier filename\n"));
+			    "a verifier filename\n"));
 			free(filename);
 			free(fwvrfydirpath);
 			free(vrfy->handle);
@@ -603,8 +606,8 @@
 			logmsg(MSG_ERROR, gettext(dlerror()));
 			logmsg(MSG_ERROR,
 			    gettext("Unable to open verification plugin "
-				"%s. Unable to verify firmware image. "
-				"Aborting.\n"),
+			    "%s. Unable to verify firmware image. "
+			    "Aborting.\n"),
 			    filename);
 			free(filename);
 			free(fwvrfydirpath);
@@ -614,7 +617,7 @@
 		if ((vrfysym = dlsym(vrfy->handle, "vendorvrfy")) == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("%s is an invalid firmware verification "
-				"plugin."), filename);
+			    "plugin."), filename);
 			(void) dlclose(vrfy->handle);
 			free(filename);
 			free(fwvrfydirpath);
@@ -630,7 +633,7 @@
 		if (vrfysym == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Invalid vendor (null) in verification "
-				"plugin %s\n"), filename);
+			    "plugin %s\n"), filename);
 			(void) dlclose(vrfy->handle);
 			free(vrfy);
 			return (NULL);
@@ -663,7 +666,7 @@
 	if ((imgfd = open(fwimg, O_RDONLY)) < 0) {
 		logmsg(MSG_ERROR,
 		    gettext("Unable to open designated firmware "
-			"image file %s: %s\n"),
+		    "image file %s: %s\n"),
 		    (fwimg != NULL) ? fwimg : "(null)",
 		    strerror(errno));
 		rv = FWFLASH_FAILURE;
@@ -673,7 +676,7 @@
 	if (stat(fwimg, &fwstat) == -1) {
 		logmsg(MSG_ERROR,
 		    gettext("Unable to stat() firmware image file "
-			"%s: %s\n"),
+		    "%s: %s\n"),
 		    fwimg, strerror(errno));
 		rv = FWFLASH_FAILURE;
 		goto cleanup;
@@ -683,7 +686,7 @@
 		    == NULL) {
 			logmsg(MSG_ERROR,
 			    gettext("Unable to load firmware image "
-				"%s: %s\n"),
+			    "%s: %s\n"),
 			    fwimg, strerror(errno));
 			rv = FWFLASH_FAILURE;
 			goto cleanup;
@@ -696,8 +699,8 @@
 		/* we haven't read enough data, bail */
 		logmsg(MSG_ERROR,
 		    gettext("Failed to read sufficient data "
-			"(got %d bytes, expected %d bytes) from "
-			"firmware image file %s: %s\n"),
+		    "(got %d bytes, expected %d bytes) from "
+		    "firmware image file %s: %s\n"),
 		    rv, verifier->imgsize,
 		    filename, strerror(errno));
 		rv = FWFLASH_FAILURE;
@@ -975,7 +978,7 @@
 {
 	struct devicelist *curdev;
 	int rv;
-	int notfound = 0;
+	int found = 0;
 
 	/* new firmware filename and device desc */
 
@@ -989,12 +992,12 @@
 				    gettext("Unable to write out firmware "
 				    "image for %s to file %s\n"),
 				    curdev->access_devname, filename);
-		} else {
-			notfound++;
+			found++;
 		}
 
 	}
-	if (notfound) {
+
+	if (!found) {
 		logmsg(MSG_ERROR,
 		    gettext("No device matching %s was found.\n"),
 		    device);
@@ -1028,7 +1031,7 @@
 	    "\t-c device_class limit search to a specific class\n"
 	    "\t\t\teg IB for InfiniBand, ses for SCSI Enclosures\n"
 	    "\t-v\t\tprint version number of fwflash utility\n"
-	    "\t-h\t\tprint this usage mesage\n\n"));
+	    "\t-h\t\tprint this usage message\n\n"));
 	(void) fprintf(stdout,
 	    gettext("\t-f file1,file2,file3,...\n"
 	    "\t\t\tfirmware image file list to flash\n"
--- a/usr/src/pkgdefs/SUNWfwflash/prototype_com	Fri Nov 07 10:39:48 2008 +0800
+++ b/usr/src/pkgdefs/SUNWfwflash/prototype_com	Thu Nov 06 21:27:14 2008 -0800
@@ -21,8 +21,6 @@
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
-#
 # This required package information file contains a list of package contents.
 # The 'pkgmk' command uses this file to identify the contents of a package
 # and their location on the development machine when building the package.
@@ -52,9 +50,11 @@
 s none usr/lib/fwflash/verify/sgen-SUN.so=ses-SUN.so
 s none usr/lib/fwflash/verify/sgen-LSILOGIC.so=ses-SUN.so
 f none usr/lib/fwflash/verify/tavor-MELLANOX.so 644 root bin
+f none usr/lib/fwflash/verify/hermon-MELLANOX.so 644 root bin
 f none usr/lib/fwflash/identify/ses.so 0644 root bin
 s none usr/lib/fwflash/identify/sgen.so=ses.so 644 root bin
 f none usr/lib/fwflash/identify/tavor.so 0644 root bin
+f none usr/lib/fwflash/identify/hermon.so 0644 root bin
 d none usr/include 0755 root bin
 d none usr/include/fwflash 0755 root bin
 f none usr/include/fwflash/fwflash.h 0644 root bin