mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] megaraid in 2.2.18 : correctly identify NetRaid cards
@ 2000-12-28  7:58 Willy Tarreau
  0 siblings, 0 replies; only message in thread
From: Willy Tarreau @ 2000-12-28  7:58 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel

Hello Alan,

As previously discussed, I've slighlty arranged the version identification
code in the 2.2.18 megaraid driver so that it correcly sees bios and firmware
versions on a netraid. Without the patch, I only get smileys and hieroglyphs
because the version is interpreted as a string which it is not, on the netraid.

On the netraid I have here, the fourth byte in the version is always 0x20, which
I used to identify the version coding because on a megaraid, I have a number
here instead. I'd like people who also have a netraid to test if this is enough
to catch their bios and firmware releases too.

Here comes the small patch. Please note that I extended the version length to
8 bytes to conform to the syntax the bios uses : letter.2digits.2digits
The old undefined code under #ifdef HP has been removed since it was buggy
anyway (char >> 8 always gives 0 ...)

Regards,
Willy

--- linux/drivers/scsi/megaraid.h-orig	Wed Dec 27 16:08:26 2000
+++ linux/drivers/scsi/megaraid.h	Wed Dec 27 16:08:00 2000
@@ -639,8 +639,8 @@
     u32 nWriteBlocks[FC_MAX_LOGICAL_DRIVES];
     u32 nInterrupts;
     /* Host adapter parameters */
-    u8 fwVer[7];
-    u8 biosVer[7];
+    u8 fwVer[8];
+    u8 biosVer[8];
 
     struct Scsi_Host *host;
 
--- linux/drivers/scsi/megaraid.c-orig	Wed Dec 27 13:22:27 2000
+++ linux/drivers/scsi/megaraid.c	Wed Dec 27 16:02:27 2000
@@ -1767,27 +1767,25 @@
   if (megaCfg->host->can_queue >= MAX_COMMANDS) {
     megaCfg->host->can_queue = MAX_COMMANDS-1;
   }
+  if ((megaCfg->productInfo.FwVer[3] == 0x20) &&
+      (megaCfg->productInfo.BiosVer[3] == 0x20)) {
+	/* use HP firmware and bios version encoding */
+	  sprintf (megaCfg->fwVer, "%c.%02x.%02x",
+		   megaCfg->productInfo.FwVer[2],
+		   megaCfg->productInfo.FwVer[1],
+		   megaCfg->productInfo.FwVer[0]);
+	  sprintf (megaCfg->biosVer, "%c.%02x.%02x",
+		   megaCfg->productInfo.BiosVer[2],
+		   megaCfg->productInfo.BiosVer[1],
+		   megaCfg->productInfo.BiosVer[0]);
+  }
+  else {
+	  memcpy (megaCfg->fwVer, (char *)megaCfg->productInfo.FwVer, 4);
+	  megaCfg->fwVer[4] = 0;
 
-#ifdef HP			/* use HP firmware and bios version encoding */
-  sprintf (megaCfg->fwVer, "%c%d%d.%d%d",
-	   megaCfg->productInfo.FwVer[2],
-	   megaCfg->productInfo.FwVer[1] >> 8,
-	   megaCfg->productInfo.FwVer[1] & 0x0f,
-	   megaCfg->productInfo.FwVer[2] >> 8,
-	   megaCfg->productInfo.FwVer[2] & 0x0f);
-  sprintf (megaCfg->biosVer, "%c%d%d.%d%d",
-	   megaCfg->productInfo.BiosVer[2],
-	   megaCfg->productInfo.BiosVer[1] >> 8,
-	   megaCfg->productInfo.BiosVer[1] & 0x0f,
-	   megaCfg->productInfo.BiosVer[2] >> 8,
-	   megaCfg->productInfo.BiosVer[2] & 0x0f);
-#else
-  memcpy (megaCfg->fwVer, (char *)megaCfg->productInfo.FwVer, 4);
-  megaCfg->fwVer[4] = 0;
-
-  memcpy (megaCfg->biosVer, (char *)megaCfg->productInfo.BiosVer, 4);
-  megaCfg->biosVer[4] = 0;
-#endif
+	  memcpy (megaCfg->biosVer, (char *)megaCfg->productInfo.BiosVer, 4);
+	  megaCfg->biosVer[4] = 0;
+  }
 
   printk ("megaraid: [%s:%s] detected %d logical drives" CRLFSTR,
           megaCfg->fwVer,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-12-28  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-28  7:58 [patch] megaraid in 2.2.18 : correctly identify NetRaid cards Willy Tarreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®